summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/ed/cbc.c7
-rw-r--r--bin/ed/io.c27
-rw-r--r--bin/mv/mv.c1
-rw-r--r--bin/ps/ps.c15
-rw-r--r--bin/ps/ps.h4
-rw-r--r--bin/setfacl/file.c4
-rw-r--r--bin/sh/parser.c10
-rw-r--r--bin/sh/sh.16
-rw-r--r--contrib/binutils/gas/config/tc-arm.c4
-rw-r--r--contrib/bsnmp/snmp_usm/usm_snmp.c10
-rw-r--r--contrib/bsnmp/snmpd/bsnmpd.14
-rw-r--r--contrib/bsnmp/snmpd/config.c5
-rw-r--r--contrib/bsnmp/snmpd/main.c4
-rw-r--r--contrib/file/ChangeLog59
-rw-r--r--contrib/file/README37
-rw-r--r--contrib/file/config.h.in3
-rwxr-xr-xcontrib/file/configure33
-rw-r--r--contrib/file/configure.ac4
-rw-r--r--contrib/file/doc/file.man10
-rw-r--r--contrib/file/doc/libmagic.man9
-rw-r--r--contrib/file/magic/Magdir/android4
-rw-r--r--contrib/file/magic/Magdir/animation4
-rw-r--r--contrib/file/magic/Magdir/apple52
-rw-r--r--contrib/file/magic/Magdir/archive300
-rw-r--r--contrib/file/magic/Magdir/audio45
-rw-r--r--contrib/file/magic/Magdir/bioinformatics178
-rw-r--r--contrib/file/magic/Magdir/c-lang14
-rw-r--r--contrib/file/magic/Magdir/cafebabe11
-rw-r--r--contrib/file/magic/Magdir/coff77
-rw-r--r--contrib/file/magic/Magdir/commands8
-rw-r--r--contrib/file/magic/Magdir/compress3
-rw-r--r--contrib/file/magic/Magdir/console548
-rw-r--r--contrib/file/magic/Magdir/database70
-rw-r--r--contrib/file/magic/Magdir/der116
-rw-r--r--contrib/file/magic/Magdir/filesystems60
-rw-r--r--contrib/file/magic/Magdir/finger16
-rw-r--r--contrib/file/magic/Magdir/flif36
-rw-r--r--contrib/file/magic/Magdir/fonts46
-rw-r--r--contrib/file/magic/Magdir/fortran6
-rw-r--r--contrib/file/magic/Magdir/hitachi-sh32
-rw-r--r--contrib/file/magic/Magdir/images377
-rw-r--r--contrib/file/magic/Magdir/intel20
-rw-r--r--contrib/file/magic/Magdir/java11
-rw-r--r--contrib/file/magic/Magdir/lisp31
-rw-r--r--contrib/file/magic/Magdir/mach57
-rw-r--r--contrib/file/magic/Magdir/macintosh9
-rw-r--r--contrib/file/magic/Magdir/microfocus21
-rw-r--r--contrib/file/magic/Magdir/misctools32
-rw-r--r--contrib/file/magic/Magdir/modem46
-rw-r--r--contrib/file/magic/Magdir/msdos74
-rw-r--r--contrib/file/magic/Magdir/msvc33
-rw-r--r--contrib/file/magic/Magdir/msx30
-rw-r--r--contrib/file/magic/Magdir/netbsd19
-rw-r--r--contrib/file/magic/Magdir/os24
-rw-r--r--contrib/file/magic/Magdir/polyml23
-rw-r--r--contrib/file/magic/Magdir/psdbms14
-rw-r--r--contrib/file/magic/Magdir/python10
-rw-r--r--contrib/file/magic/Magdir/sendmail27
-rw-r--r--contrib/file/magic/Magdir/sgml12
-rw-r--r--contrib/file/magic/Magdir/sinclair23
-rw-r--r--contrib/file/magic/Magdir/sql39
-rw-r--r--contrib/file/magic/Magdir/terminfo18
-rw-r--r--contrib/file/magic/Magdir/vacuum-cleaner54
-rw-r--r--contrib/file/magic/Magdir/windows243
-rw-r--r--contrib/file/magic/Magdir/wordprocessors274
-rw-r--r--contrib/file/magic/Magdir/xenix23
-rw-r--r--contrib/file/magic/Makefile.am12
-rw-r--r--contrib/file/magic/Makefile.in12
-rw-r--r--contrib/file/python/README13
-rw-r--r--contrib/file/python/magic.py90
-rw-r--r--contrib/file/python/setup.py32
-rw-r--r--contrib/file/src/Makefile.am2
-rw-r--r--contrib/file/src/Makefile.in14
-rw-r--r--contrib/file/src/apprentice.c121
-rw-r--r--contrib/file/src/ascmagic.c18
-rw-r--r--contrib/file/src/cdf.c125
-rw-r--r--contrib/file/src/cdf.h3
-rw-r--r--contrib/file/src/compress.c599
-rw-r--r--contrib/file/src/der.c384
-rw-r--r--contrib/file/src/der.h28
-rw-r--r--contrib/file/src/dprintf.c58
-rw-r--r--contrib/file/src/file.c52
-rw-r--r--contrib/file/src/file.h25
-rw-r--r--contrib/file/src/file_opts.h56
-rw-r--r--contrib/file/src/fmtcheck.c17
-rw-r--r--contrib/file/src/funcs.c26
-rw-r--r--contrib/file/src/magic.c26
-rw-r--r--contrib/file/src/magic.h3
-rw-r--r--contrib/file/src/magic.h.in1
-rw-r--r--contrib/file/src/print.c3
-rw-r--r--contrib/file/src/readcdf.c14
-rw-r--r--contrib/file/src/readelf.c219
-rw-r--r--contrib/file/src/readelf.h36
-rw-r--r--contrib/file/src/softmagic.c325
-rw-r--r--contrib/file/tests/Makefile.am2
-rw-r--r--contrib/file/tests/Makefile.in2
-rw-r--r--contrib/ipfilter/man/ipf.52
-rw-r--r--contrib/ntp/ChangeLog22
-rw-r--r--contrib/ntp/CommitLog771
-rw-r--r--contrib/ntp/NEWS112
-rwxr-xr-xcontrib/ntp/configure25
-rw-r--r--contrib/ntp/configure.ac1
-rw-r--r--contrib/ntp/html/miscopt.html4
-rw-r--r--contrib/ntp/include/ntp.h1
-rw-r--r--contrib/ntp/ntpd/complete.conf.in2
-rw-r--r--contrib/ntp/ntpd/invoke-ntp.conf.texi26
-rw-r--r--contrib/ntp/ntpd/invoke-ntp.keys.texi2
-rw-r--r--contrib/ntp/ntpd/invoke-ntpd.texi4
-rw-r--r--contrib/ntp/ntpd/keyword-gen-utd2
-rw-r--r--contrib/ntp/ntpd/keyword-gen.c3
-rw-r--r--contrib/ntp/ntpd/ntp.conf.5man31
-rw-r--r--contrib/ntp/ntpd/ntp.conf.5mdoc26
-rw-r--r--contrib/ntp/ntpd/ntp.conf.def22
-rw-r--r--contrib/ntp/ntpd/ntp.conf.html74
-rw-r--r--contrib/ntp/ntpd/ntp.conf.man.in31
-rw-r--r--contrib/ntp/ntpd/ntp.conf.mdoc.in26
-rw-r--r--contrib/ntp/ntpd/ntp.keys.5man4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.5mdoc4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.html2
-rw-r--r--contrib/ntp/ntpd/ntp.keys.man.in4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.mdoc.in4
-rw-r--r--contrib/ntp/ntpd/ntp_config.c8
-rw-r--r--contrib/ntp/ntpd/ntp_io.c82
-rw-r--r--contrib/ntp/ntpd/ntp_keyword.h1212
-rw-r--r--contrib/ntp/ntpd/ntp_parser.c3144
-rw-r--r--contrib/ntp/ntpd/ntp_parser.h594
-rw-r--r--contrib/ntp/ntpd/ntp_proto.c219
-rw-r--r--contrib/ntp/ntpd/ntpd-opts.c14
-rw-r--r--contrib/ntp/ntpd/ntpd-opts.h6
-rw-r--r--contrib/ntp/ntpd/ntpd.1ntpdman6
-rw-r--r--contrib/ntp/ntpd/ntpd.1ntpdmdoc4
-rw-r--r--contrib/ntp/ntpd/ntpd.html4
-rw-r--r--contrib/ntp/ntpd/ntpd.man.in6
-rw-r--r--contrib/ntp/ntpd/ntpd.mdoc.in4
-rw-r--r--contrib/ntp/ntpd/refclock_parse.c12
-rw-r--r--contrib/ntp/ntpdc/invoke-ntpdc.texi4
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.c14
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.h6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcman6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc4
-rw-r--r--contrib/ntp/ntpdc/ntpdc.c4
-rw-r--r--contrib/ntp/ntpdc/ntpdc.html4
-rw-r--r--contrib/ntp/ntpdc/ntpdc.man.in6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.mdoc.in4
-rw-r--r--contrib/ntp/ntpq/invoke-ntpq.texi4
-rw-r--r--contrib/ntp/ntpq/ntpq-opts.c14
-rw-r--r--contrib/ntp/ntpq/ntpq-opts.h6
-rw-r--r--contrib/ntp/ntpq/ntpq.1ntpqman6
-rw-r--r--contrib/ntp/ntpq/ntpq.1ntpqmdoc4
-rw-r--r--contrib/ntp/ntpq/ntpq.c7
-rw-r--r--contrib/ntp/ntpq/ntpq.html4
-rw-r--r--contrib/ntp/ntpq/ntpq.man.in6
-rw-r--r--contrib/ntp/ntpq/ntpq.mdoc.in4
-rw-r--r--contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi4
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c14
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h6
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman6
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc4
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.html2
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.man.in6
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in4
-rw-r--r--contrib/ntp/packageinfo.sh2
-rw-r--r--contrib/ntp/scripts/build/Makefile.am2
-rw-r--r--contrib/ntp/scripts/build/Makefile.in9
-rw-r--r--contrib/ntp/scripts/build/genAuthors.in82
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman6
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc4
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.html2
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in6
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in4
-rw-r--r--contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi2
-rw-r--r--contrib/ntp/scripts/invoke-plot_summary.texi6
-rw-r--r--contrib/ntp/scripts/invoke-summary.texi4
-rw-r--r--contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait-opts4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman6
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.html4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.in2
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.man.in6
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in4
-rw-r--r--contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep-opts4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman6
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.html4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.man.in6
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in4
-rw-r--r--contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace-opts4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman6
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.html4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.man.in6
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in4
-rw-r--r--contrib/ntp/scripts/plot_summary-opts4
-rw-r--r--contrib/ntp/scripts/plot_summary-opts.def2
-rw-r--r--contrib/ntp/scripts/plot_summary.1plot_summaryman8
-rw-r--r--contrib/ntp/scripts/plot_summary.1plot_summarymdoc6
-rw-r--r--contrib/ntp/scripts/plot_summary.html6
-rw-r--r--contrib/ntp/scripts/plot_summary.man.in8
-rw-r--r--contrib/ntp/scripts/plot_summary.mdoc.in6
-rw-r--r--contrib/ntp/scripts/summary-opts4
-rw-r--r--contrib/ntp/scripts/summary.1summaryman6
-rw-r--r--contrib/ntp/scripts/summary.1summarymdoc4
-rw-r--r--contrib/ntp/scripts/summary.html4
-rw-r--r--contrib/ntp/scripts/summary.man.in6
-rw-r--r--contrib/ntp/scripts/summary.mdoc.in4
-rw-r--r--contrib/ntp/scripts/update-leap/invoke-update-leap.texi2
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap-opts4
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.1update-leapman6
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc4
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.html2
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.man.in6
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.mdoc.in4
-rw-r--r--contrib/ntp/sntp/Makefile.in5
-rw-r--r--contrib/ntp/sntp/aclocal.m41
-rwxr-xr-xcontrib/ntp/sntp/configure91
-rw-r--r--contrib/ntp/sntp/configure.ac2
-rw-r--r--contrib/ntp/sntp/include/Makefile.in5
-rw-r--r--contrib/ntp/sntp/include/version.def2
-rw-r--r--contrib/ntp/sntp/include/version.texi6
-rw-r--r--contrib/ntp/sntp/invoke-sntp.texi4
-rw-r--r--contrib/ntp/sntp/libopts/Makefile.in5
-rw-r--r--contrib/ntp/sntp/m4/ntp_problemtests.m41
-rw-r--r--contrib/ntp/sntp/m4/sntp_problemtests.m447
-rw-r--r--contrib/ntp/sntp/m4/version.m42
-rw-r--r--contrib/ntp/sntp/scripts/Makefile.in5
-rw-r--r--contrib/ntp/sntp/sntp-opts.c14
-rw-r--r--contrib/ntp/sntp/sntp-opts.h6
-rw-r--r--contrib/ntp/sntp/sntp.1sntpman6
-rw-r--r--contrib/ntp/sntp/sntp.1sntpmdoc4
-rw-r--r--contrib/ntp/sntp/sntp.html4
-rw-r--r--contrib/ntp/sntp/sntp.man.in6
-rw-r--r--contrib/ntp/sntp/sntp.mdoc.in4
-rw-r--r--contrib/ntp/sntp/tests/Makefile.am10
-rw-r--r--contrib/ntp/sntp/tests/Makefile.in45
-rw-r--r--contrib/ntp/sntp/unity/Makefile.in5
-rw-r--r--contrib/ntp/sntp/version.c2
-rw-r--r--contrib/ntp/util/invoke-ntp-keygen.texi4
-rw-r--r--contrib/ntp/util/ntp-keygen-opts.c14
-rw-r--r--contrib/ntp/util/ntp-keygen-opts.h6
-rw-r--r--contrib/ntp/util/ntp-keygen.1ntp-keygenman6
-rw-r--r--contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc4
-rw-r--r--contrib/ntp/util/ntp-keygen.html4
-rw-r--r--contrib/ntp/util/ntp-keygen.man.in6
-rw-r--r--contrib/ntp/util/ntp-keygen.mdoc.in4
-rw-r--r--etc/mtree/BSD.tests.dist2
-rw-r--r--etc/ntp/leap-seconds12
-rwxr-xr-xetc/rc.d/ntpd4
-rw-r--r--games/fortune/unstr/unstr.c12
-rw-r--r--lib/libc/gen/fts-compat.c5
-rw-r--r--lib/libc/gen/fts.c1
-rw-r--r--lib/libc/gen/posix_spawn.c9
-rw-r--r--lib/libc/locale/ascii.c2
-rw-r--r--lib/libc/locale/none.c1
-rw-r--r--lib/libc/regex/engine.c15
-rw-r--r--lib/libc/stdlib/div.c2
-rw-r--r--lib/libc/stdlib/imaxdiv.c2
-rw-r--r--lib/libc/stdlib/ldiv.c2
-rw-r--r--lib/libc/stdlib/lldiv.c2
-rw-r--r--lib/libc/stdlib/rand.c57
-rw-r--r--lib/libc/stdlib/random.34
-rw-r--r--lib/libc/stdlib/random.c79
-rw-r--r--lib/libc/sys/vfork.240
-rw-r--r--lib/libcompat/4.3/rexec.c1
-rw-r--r--lib/libfetch/common.c5
-rw-r--r--lib/libfetch/file.c1
-rw-r--r--lib/libmagic/Makefile2
-rw-r--r--lib/libmagic/config.h9
-rw-r--r--lib/libmt/mtlib.c1
-rw-r--r--lib/libstand/Makefile2
-rw-r--r--lib/libstand/bootp.c8
-rw-r--r--lib/libstand/bootp.h1
-rw-r--r--lib/libstand/bswap.c57
-rw-r--r--lib/libstand/globals.c1
-rw-r--r--lib/libstand/net.h1
-rw-r--r--lib/libstand/stand.h5
-rw-r--r--release/tools/arm.subr1
-rw-r--r--sbin/ipfw/dummynet.c24
-rw-r--r--sbin/ipfw/ipfw.811
-rw-r--r--sbin/ipfw/ipfw2.h1
-rw-r--r--share/man/man4/Makefile2
-rw-r--r--share/man/man4/ioat.4334
-rw-r--r--share/man/man4/sfxge.42
-rw-r--r--sys/amd64/amd64/vm_machdep.c8
-rw-r--r--sys/amd64/linux/linux_proto.h6
-rw-r--r--sys/amd64/linux/linux_systrace_args.c12
-rw-r--r--sys/amd64/linux/syscalls.master6
-rw-r--r--sys/amd64/linux32/linux32_proto.h6
-rw-r--r--sys/amd64/linux32/linux32_systrace_args.c12
-rw-r--r--sys/amd64/linux32/syscalls.master6
-rw-r--r--sys/boot/common/dev_net.c6
-rw-r--r--sys/boot/i386/libi386/pxe.c5
-rw-r--r--sys/boot/libstand32/Makefile2
-rw-r--r--sys/boot/userboot/libstand/Makefile2
-rw-r--r--sys/cam/ctl/ctl_tpc.c120
-rw-r--r--sys/cam/scsi/scsi_enc_safte.c7
-rw-r--r--sys/cam/scsi/scsi_enc_ses.c41
-rw-r--r--sys/compat/linux/linux_file.c226
-rw-r--r--sys/compat/linux/linux_futex.c235
-rw-r--r--sys/compat/linux/linux_ioctl.c4
-rw-r--r--sys/compat/linux/linux_misc.c1
-rw-r--r--sys/compat/linux/linux_socket.c29
-rw-r--r--sys/compat/ndis/subr_ntoskrnl.c9
-rw-r--r--sys/conf/files.amd6424
-rw-r--r--sys/conf/kmod.mk4
-rw-r--r--sys/dev/fb/vesa.c3
-rw-r--r--sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c124
-rw-r--r--sys/dev/hyperv/storvsc/hv_vstorage.h5
-rw-r--r--sys/dev/iicbus/iic.c9
-rw-r--r--sys/dev/iicbus/iic.h2
-rw-r--r--sys/dev/ioat/ioat.c2091
-rw-r--r--sys/dev/ioat/ioat.h218
-rw-r--r--sys/dev/ioat/ioat_hw.h167
-rw-r--r--sys/dev/ioat/ioat_internal.h600
-rw-r--r--sys/dev/ioat/ioat_test.c602
-rw-r--r--sys/dev/ioat/ioat_test.h90
-rw-r--r--sys/dev/isp/isp.c36
-rw-r--r--sys/dev/isp/isp_freebsd.c4
-rw-r--r--sys/dev/isp/isp_library.c4
-rw-r--r--sys/dev/isp/isp_target.c41
-rw-r--r--sys/dev/isp/ispvar.h9
-rw-r--r--sys/dev/mlx5/mlx5_en/en.h23
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c381
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_main.c111
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_tx.c91
-rw-r--r--sys/dev/mpr/mpr_sas.c17
-rw-r--r--sys/dev/mps/mps_sas.c17
-rw-r--r--sys/dev/mrsas/mrsas.c700
-rw-r--r--sys/dev/mrsas/mrsas.h65
-rw-r--r--sys/dev/mrsas/mrsas_cam.c294
-rw-r--r--sys/dev/mrsas/mrsas_fp.c27
-rw-r--r--sys/dev/mrsas/mrsas_ioctl.c25
-rw-r--r--sys/dev/sfxge/common/ef10_ev.c (renamed from sys/dev/sfxge/common/hunt_ev.c)32
-rw-r--r--sys/dev/sfxge/common/ef10_filter.c (renamed from sys/dev/sfxge/common/hunt_filter.c)298
-rw-r--r--sys/dev/sfxge/common/ef10_impl.h1001
-rw-r--r--sys/dev/sfxge/common/ef10_intr.c (renamed from sys/dev/sfxge/common/hunt_intr.c)6
-rw-r--r--sys/dev/sfxge/common/ef10_mac.c (renamed from sys/dev/sfxge/common/hunt_mac.c)75
-rw-r--r--sys/dev/sfxge/common/ef10_mcdi.c (renamed from sys/dev/sfxge/common/hunt_mcdi.c)4
-rw-r--r--sys/dev/sfxge/common/ef10_nic.c1697
-rw-r--r--sys/dev/sfxge/common/ef10_nvram.c (renamed from sys/dev/sfxge/common/hunt_nvram.c)633
-rw-r--r--sys/dev/sfxge/common/ef10_phy.c477
-rw-r--r--sys/dev/sfxge/common/ef10_rx.c (renamed from sys/dev/sfxge/common/hunt_rx.c)21
-rw-r--r--sys/dev/sfxge/common/ef10_tlv_layout.h141
-rwxr-xr-xsys/dev/sfxge/common/ef10_tx.c (renamed from sys/dev/sfxge/common/hunt_tx.c)12
-rw-r--r--sys/dev/sfxge/common/ef10_vpd.c (renamed from sys/dev/sfxge/common/hunt_vpd.c)13
-rw-r--r--sys/dev/sfxge/common/efsys.h41
-rw-r--r--sys/dev/sfxge/common/efx.h222
-rw-r--r--sys/dev/sfxge/common/efx_bootcfg.c2
-rw-r--r--sys/dev/sfxge/common/efx_check.h284
-rw-r--r--sys/dev/sfxge/common/efx_crc32.c2
-rw-r--r--sys/dev/sfxge/common/efx_ev.c219
-rw-r--r--sys/dev/sfxge/common/efx_filter.c677
-rw-r--r--sys/dev/sfxge/common/efx_hash.c2
-rw-r--r--sys/dev/sfxge/common/efx_impl.h236
-rw-r--r--sys/dev/sfxge/common/efx_intr.c141
-rw-r--r--sys/dev/sfxge/common/efx_lic.c1036
-rw-r--r--sys/dev/sfxge/common/efx_mac.c258
-rw-r--r--sys/dev/sfxge/common/efx_mcdi.c57
-rw-r--r--sys/dev/sfxge/common/efx_mcdi.h2
-rw-r--r--sys/dev/sfxge/common/efx_mon.c104
-rw-r--r--sys/dev/sfxge/common/efx_nic.c270
-rw-r--r--sys/dev/sfxge/common/efx_nvram.c97
-rw-r--r--sys/dev/sfxge/common/efx_phy.c343
-rw-r--r--sys/dev/sfxge/common/efx_phy_ids.h2
-rw-r--r--sys/dev/sfxge/common/efx_port.c12
-rw-r--r--sys/dev/sfxge/common/efx_regs.h2
-rw-r--r--sys/dev/sfxge/common/efx_regs_ef10.h2
-rw-r--r--sys/dev/sfxge/common/efx_regs_mcdi.h790
-rw-r--r--sys/dev/sfxge/common/efx_regs_pci.h2
-rw-r--r--sys/dev/sfxge/common/efx_rx.c174
-rw-r--r--sys/dev/sfxge/common/efx_sram.c9
-rw-r--r--sys/dev/sfxge/common/efx_tx.c172
-rw-r--r--sys/dev/sfxge/common/efx_types.h2
-rw-r--r--sys/dev/sfxge/common/efx_vpd.c61
-rw-r--r--sys/dev/sfxge/common/efx_wol.c2
-rw-r--r--sys/dev/sfxge/common/hunt_impl.h976
-rw-r--r--sys/dev/sfxge/common/hunt_nic.c1602
-rw-r--r--sys/dev/sfxge/common/hunt_phy.c483
-rw-r--r--sys/dev/sfxge/common/hunt_sram.c68
-rw-r--r--sys/dev/sfxge/common/mcdi_mon.c6
-rw-r--r--sys/dev/sfxge/common/mcdi_mon.h2
-rw-r--r--sys/dev/sfxge/common/medford_impl.h2
-rw-r--r--sys/dev/sfxge/common/medford_nic.c67
-rw-r--r--sys/dev/sfxge/common/siena_flash.h2
-rw-r--r--sys/dev/sfxge/common/siena_impl.h52
-rw-r--r--sys/dev/sfxge/common/siena_mac.c23
-rw-r--r--sys/dev/sfxge/common/siena_mcdi.c6
-rw-r--r--sys/dev/sfxge/common/siena_nic.c28
-rw-r--r--sys/dev/sfxge/common/siena_nvram.c2
-rw-r--r--sys/dev/sfxge/common/siena_phy.c43
-rw-r--r--sys/dev/sfxge/common/siena_sram.c2
-rw-r--r--sys/dev/sfxge/common/siena_vpd.c8
-rw-r--r--sys/dev/sfxge/sfxge.c7
-rw-r--r--sys/dev/sfxge/sfxge.h39
-rw-r--r--sys/dev/sfxge/sfxge_dma.c2
-rw-r--r--sys/dev/sfxge/sfxge_ev.c31
-rw-r--r--sys/dev/sfxge/sfxge_intr.c2
-rw-r--r--sys/dev/sfxge/sfxge_ioc.h2
-rw-r--r--sys/dev/sfxge/sfxge_mcdi.c2
-rw-r--r--sys/dev/sfxge/sfxge_nvram.c2
-rw-r--r--sys/dev/sfxge/sfxge_port.c2
-rw-r--r--sys/dev/sfxge/sfxge_rx.c9
-rw-r--r--sys/dev/sfxge/sfxge_rx.h20
-rw-r--r--sys/dev/sfxge/sfxge_tx.c2
-rw-r--r--sys/dev/sfxge/sfxge_tx.h2
-rw-r--r--sys/dev/sfxge/sfxge_version.h4
-rw-r--r--sys/dev/usb/net/uhso.c4
-rw-r--r--sys/dev/usb/usb_dev.c8
-rw-r--r--sys/dev/usb/usb_device.c27
-rw-r--r--sys/dev/usb/usb_device.h3
-rw-r--r--sys/fs/devfs/devfs_devs.c5
-rw-r--r--sys/fs/fuse/fuse_file.c34
-rw-r--r--sys/fs/fuse/fuse_file.h1
-rw-r--r--sys/fs/fuse/fuse_node.c2
-rw-r--r--sys/fs/fuse/fuse_vnops.c26
-rw-r--r--sys/fs/nfsserver/nfs_nfsdserv.c4
-rw-r--r--sys/i386/i386/vm_machdep.c8
-rw-r--r--sys/i386/linux/linux_proto.h6
-rw-r--r--sys/i386/linux/linux_systrace_args.c12
-rw-r--r--sys/i386/linux/syscalls.master6
-rw-r--r--sys/kern/kern_synch.c2
-rw-r--r--sys/kern/vfs_syscalls.c1
-rw-r--r--sys/kern/vfs_vnops.c2
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/ioat/Makefile15
-rw-r--r--sys/modules/sfxge/Makefile6
-rw-r--r--sys/net/if.c3
-rw-r--r--sys/netinet/ip_dummynet.h1
-rw-r--r--sys/netpfil/ipfw/ip_dn_io.c78
-rw-r--r--sys/netpfil/ipfw/ip_dummynet.c5
-rw-r--r--sys/netpfil/pf/pf_norm.c2
-rw-r--r--sys/nfs/bootp_subr.c94
-rw-r--r--sys/ofed/include/linux/etherdevice.h30
-rw-r--r--sys/powerpc/powerpc/exec_machdep.c6
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c8
-rw-r--r--sys/sys/sysent.h4
-rw-r--r--sys/sys/vnode.h1
-rw-r--r--sys/ufs/ffs/ffs_inode.c2
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c32
-rw-r--r--sys/ufs/ufs/ufs_lookup.c4
-rw-r--r--sys/ufs/ufs/ufs_vnops.c3
-rw-r--r--sys/vm/vm_glue.c2
-rw-r--r--sys/vm/vm_object.c21
-rw-r--r--sys/vm/vm_page.c7
-rw-r--r--tools/tools/ioat/Makefile10
-rw-r--r--tools/tools/ioat/ioatcontrol.8182
-rw-r--r--tools/tools/ioat/ioatcontrol.c258
-rw-r--r--usr.bin/mt/mt.13
-rw-r--r--usr.bin/sed/process.c92
-rw-r--r--usr.bin/sed/sed.14
-rw-r--r--usr.sbin/acpi/acpidb/acpidb.c30
-rw-r--r--usr.sbin/acpi/acpidump/acpi.c61
-rw-r--r--usr.sbin/bsnmpd/bsnmpd/Makefile6
-rw-r--r--usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c2
-rw-r--r--usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c20
-rw-r--r--usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c8
-rw-r--r--usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c6
-rw-r--r--usr.sbin/camdd/camdd.c9
-rw-r--r--usr.sbin/extattr/Makefile8
-rw-r--r--usr.sbin/extattr/rmextattr.818
-rw-r--r--usr.sbin/extattr/rmextattr.c75
-rw-r--r--usr.sbin/extattr/tests/Makefile7
-rwxr-xr-xusr.sbin/extattr/tests/extattr_test.sh335
-rw-r--r--usr.sbin/ntp/config.h10
-rw-r--r--usr.sbin/ntp/doc/ntp-keygen.84
-rw-r--r--usr.sbin/ntp/doc/ntp.conf.526
-rw-r--r--usr.sbin/ntp/doc/ntp.keys.54
-rw-r--r--usr.sbin/ntp/doc/ntpd.84
-rw-r--r--usr.sbin/ntp/doc/ntpdc.84
-rw-r--r--usr.sbin/ntp/doc/ntpq.84
-rw-r--r--usr.sbin/ntp/doc/sntp.84
-rwxr-xr-xusr.sbin/ntp/scripts/mkver2
-rw-r--r--usr.sbin/tzsetup/tzsetup.c4
-rw-r--r--usr.sbin/ypserv/yp_dnslookup.c6
-rw-r--r--usr.sbin/ypserv/yp_server.c1
477 files changed, 24088 insertions, 11024 deletions
diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c
index 3985721..b59778b 100644
--- a/bin/ed/cbc.c
+++ b/bin/ed/cbc.c
@@ -90,16 +90,13 @@ void
init_des_cipher(void)
{
#ifdef DES
- int i;
-
des_ct = des_n = 0;
/* initialize the initialization vector */
MEMZERO(ivec, 8);
/* initialize the padding vector */
- for (i = 0; i < 8; i++)
- pvec[i] = (char) (arc4random() % 256);
+ arc4random_buf(pvec, sizeof(pvec));
#endif
}
@@ -164,7 +161,7 @@ get_keyword(void)
/*
* get the key
*/
- if (*(p = getpass("Enter key: "))) {
+ if ((p = getpass("Enter key: ")) != NULL && *p != '\0') {
/*
* copy it, nul-padded, into the key area
diff --git a/bin/ed/io.c b/bin/ed/io.c
index cf2e959..1907e7a 100644
--- a/bin/ed/io.c
+++ b/bin/ed/io.c
@@ -36,20 +36,24 @@ read_file(char *fn, long n)
{
FILE *fp;
long size;
-
+ int cs;
fp = (*fn == '!') ? popen(fn + 1, "r") : fopen(strip_escapes(fn), "r");
if (fp == NULL) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot open input file";
return ERR;
- } else if ((size = read_stream(fp, n)) < 0)
- return ERR;
- else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) {
+ }
+ if ((size = read_stream(fp, n)) < 0) {
+ fprintf(stderr, "%s: %s\n", fn, strerror(errno));
+ errmsg = "error reading input file";
+ }
+ if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot close input file";
- return ERR;
}
+ if (size < 0 || cs < 0)
+ return ERR;
if (!scripted)
fprintf(stdout, "%lu\n", size);
return current_addr - n;
@@ -143,19 +147,24 @@ write_file(char *fn, const char *mode, long n, long m)
{
FILE *fp;
long size;
+ int cs;
fp = (*fn == '!') ? popen(fn+1, "w") : fopen(strip_escapes(fn), mode);
if (fp == NULL) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot open output file";
return ERR;
- } else if ((size = write_stream(fp, n, m)) < 0)
- return ERR;
- else if (((*fn == '!') ? pclose(fp) : fclose(fp)) < 0) {
+ }
+ if ((size = write_stream(fp, n, m)) < 0) {
+ fprintf(stderr, "%s: %s\n", fn, strerror(errno));
+ errmsg = "error writing output file";
+ }
+ if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) {
fprintf(stderr, "%s: %s\n", fn, strerror(errno));
errmsg = "cannot close output file";
- return ERR;
}
+ if (size < 0 || cs < 0)
+ return ERR;
if (!scripted)
fprintf(stdout, "%lu\n", size);
return n ? m - n + 1 : 0;
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index a23b6da..ea629d2 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -285,6 +285,7 @@ fastcopy(const char *from, const char *to, struct stat *sbp)
}
if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
warnx("malloc(%u) failed", blen);
+ (void)close(from_fd);
return (1);
}
while ((to_fd =
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 9d14a72c..1638160 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1217,6 +1217,7 @@ fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, int), KINFO *ki,
static void
saveuser(KINFO *ki)
{
+ char *argsp;
if (ki->ki_p->ki_flag & P_INMEM) {
/*
@@ -1235,10 +1236,12 @@ saveuser(KINFO *ki)
if (ki->ki_p->ki_stat == SZOMB)
ki->ki_args = strdup("<defunct>");
else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL))
- ki->ki_args = strdup(fmt(kvm_getargv, ki,
- ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN));
- else
- asprintf(&ki->ki_args, "(%s)", ki->ki_p->ki_comm);
+ ki->ki_args = fmt(kvm_getargv, ki,
+ ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN);
+ else {
+ asprintf(&argsp, "(%s)", ki->ki_p->ki_comm);
+ ki->ki_args = argsp;
+ }
if (ki->ki_args == NULL)
errx(1, "malloc failed");
} else {
@@ -1246,8 +1249,8 @@ saveuser(KINFO *ki)
}
if (needenv) {
if (UREADOK(ki))
- ki->ki_env = strdup(fmt(kvm_getenvv, ki,
- (char *)NULL, (char *)NULL, 0));
+ ki->ki_env = fmt(kvm_getenvv, ki,
+ (char *)NULL, (char *)NULL, 0);
else
ki->ki_env = strdup("()");
if (ki->ki_env == NULL)
diff --git a/bin/ps/ps.h b/bin/ps/ps.h
index 86aaeb0..d422335 100644
--- a/bin/ps/ps.h
+++ b/bin/ps/ps.h
@@ -42,8 +42,8 @@ typedef struct kinfo_str {
typedef struct kinfo {
struct kinfo_proc *ki_p; /* kinfo_proc structure */
- char *ki_args; /* exec args */
- char *ki_env; /* environment */
+ const char *ki_args; /* exec args */
+ const char *ki_env; /* environment */
int ki_valid; /* 1 => uarea stuff valid */
double ki_pcpu; /* calculated in main() */
segsz_t ki_memsize; /* calculated in main() */
diff --git a/bin/setfacl/file.c b/bin/setfacl/file.c
index c44f398..e5e19a2 100644
--- a/bin/setfacl/file.c
+++ b/bin/setfacl/file.c
@@ -43,7 +43,7 @@ acl_t
get_acl_from_file(const char *filename)
{
FILE *file;
- char buf[BUFSIZ];
+ char buf[BUFSIZ+1];
if (filename == NULL)
err(1, "(null) filename in get_acl_from_file()");
@@ -61,7 +61,7 @@ get_acl_from_file(const char *filename)
err(1, "fopen() %s failed", filename);
}
- fread(buf, sizeof(buf), (size_t)1, file);
+ fread(buf, sizeof(buf) - 1, (size_t)1, file);
if (ferror(file) != 0) {
fclose(file);
err(1, "error reading from %s", filename);
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index a5679b8..70a4979 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -1974,7 +1974,7 @@ getprompt(void *unused __unused)
/*
* Format prompt string.
*/
- for (i = 0; (i < 127) && (*fmt != '\0'); i++, fmt++)
+ for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++)
if (*fmt == '\\')
switch (*++fmt) {
@@ -1987,7 +1987,8 @@ getprompt(void *unused __unused)
case 'h':
case 'H':
ps[i] = '\0';
- gethostname(&ps[i], PROMPTLEN - i);
+ gethostname(&ps[i], PROMPTLEN - i - 1);
+ ps[PROMPTLEN - 1] = '\0';
/* Skip to end of hostname. */
trim = (*fmt == 'h') ? '.' : '\0';
while ((ps[i] != '\0') && (ps[i] != trim))
@@ -2037,8 +2038,9 @@ getprompt(void *unused __unused)
* Emit unrecognized formats verbatim.
*/
default:
- ps[i++] = '\\';
- ps[i] = *fmt;
+ ps[i] = '\\';
+ if (i < PROMPTLEN - 1)
+ ps[++i] = *fmt;
break;
}
else
diff --git a/bin/sh/sh.1 b/bin/sh/sh.1
index fbe3d81..1afd4e5 100644
--- a/bin/sh/sh.1
+++ b/bin/sh/sh.1
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
-.Dd November 7, 2014
+.Dd May 24, 2016
.Dt SH 1
.Os
.Sh NAME
@@ -1371,9 +1371,9 @@ may include any of the following formatting sequences,
which are replaced by the given information:
.Bl -tag -width indent
.It Li \eH
-The local hostname.
-.It Li \eh
The fully-qualified hostname.
+.It Li \eh
+The local hostname.
.It Li \eW
The final component of the current working directory.
.It Li \ew
diff --git a/contrib/binutils/gas/config/tc-arm.c b/contrib/binutils/gas/config/tc-arm.c
index 8e97b37..d838047 100644
--- a/contrib/binutils/gas/config/tc-arm.c
+++ b/contrib/binutils/gas/config/tc-arm.c
@@ -3837,10 +3837,10 @@ s_arm_eabi_attribute (int ignored ATTRIBUTE_UNUSED)
#endif /* OBJ_ELF */
static void s_arm_arch (int);
-static void s_arm_arch_extension (int);
static void s_arm_object_arch (int);
static void s_arm_cpu (int);
static void s_arm_fpu (int);
+static void s_arm_arch_extension (int);
#ifdef TE_PE
@@ -3892,9 +3892,9 @@ const pseudo_typeS md_pseudo_table[] =
{ "syntax", s_syntax, 0 },
{ "cpu", s_arm_cpu, 0 },
{ "arch", s_arm_arch, 0 },
- { "arch_extension", s_arm_arch_extension, 0 },
{ "object_arch", s_arm_object_arch, 0 },
{ "fpu", s_arm_fpu, 0 },
+ { "arch_extension", s_arm_arch_extension, 0 },
#ifdef OBJ_ELF
{ "word", s_arm_elf_cons, 4 },
{ "long", s_arm_elf_cons, 4 },
diff --git a/contrib/bsnmp/snmp_usm/usm_snmp.c b/contrib/bsnmp/snmp_usm/usm_snmp.c
index d5350bc..6b7d0eb 100644
--- a/contrib/bsnmp/snmp_usm/usm_snmp.c
+++ b/contrib/bsnmp/snmp_usm/usm_snmp.c
@@ -262,7 +262,7 @@ op_usm_users(struct snmp_context *ctx, struct snmp_value *val,
if (ctx->scratch->ptr1 == NULL)
return (SNMP_ERR_GENERR);
memcpy(ctx->scratch->ptr1, uuser->suser.priv_key,
- SNMP_PRIV_KEY_SIZ);
+ sizeof(uuser->suser.priv_key));
memcpy(uuser->suser.priv_key, val->v.octetstring.octets,
val->v.octetstring.len);
break;
@@ -286,7 +286,7 @@ op_usm_users(struct snmp_context *ctx, struct snmp_value *val,
uuser->user_public_len = val->v.octetstring.len;
} else {
memset(uuser->user_public, 0,
- SNMP_ADM_STR32_SIZ);
+ sizeof(uuser->user_public));
uuser->user_public_len = 0;
}
break;
@@ -351,7 +351,7 @@ op_usm_users(struct snmp_context *ctx, struct snmp_value *val,
case LEAF_usmUserAuthKeyChange:
case LEAF_usmUserOwnAuthKeyChange:
memcpy(uuser->suser.auth_key, ctx->scratch->ptr1,
- SNMP_AUTH_KEY_SIZ);
+ sizeof(uuser->suser.auth_key));
free(ctx->scratch->ptr1);
break;
case LEAF_usmUserPrivProtocol:
@@ -360,7 +360,7 @@ op_usm_users(struct snmp_context *ctx, struct snmp_value *val,
case LEAF_usmUserPrivKeyChange:
case LEAF_usmUserOwnPrivKeyChange:
memcpy(uuser->suser.priv_key, ctx->scratch->ptr1,
- SNMP_AUTH_KEY_SIZ);
+ sizeof(uuser->suser.priv_key));
free(ctx->scratch->ptr1);
break;
case LEAF_usmUserPublic:
@@ -371,7 +371,7 @@ op_usm_users(struct snmp_context *ctx, struct snmp_value *val,
free(ctx->scratch->ptr2);
} else {
memset(uuser->user_public, 0,
- SNMP_ADM_STR32_SIZ);
+ sizeof(uuser->user_public));
uuser->user_public_len = 0;
}
break;
diff --git a/contrib/bsnmp/snmpd/bsnmpd.1 b/contrib/bsnmp/snmpd/bsnmpd.1
index 76141bc..145e9d5 100644
--- a/contrib/bsnmp/snmpd/bsnmpd.1
+++ b/contrib/bsnmp/snmpd/bsnmpd.1
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti@FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/contrib/bsnmp/snmpd/config.c b/contrib/bsnmp/snmpd/config.c
index ff82e82..23e97bd 100644
--- a/contrib/bsnmp/snmpd/config.c
+++ b/contrib/bsnmp/snmpd/config.c
@@ -823,7 +823,8 @@ parse_oid(const char *varname, struct asn_oid *oid)
while (token == '.') {
if (gettoken() == TOK_NUM) {
if (numval > ASN_MAXID)
- report("subid too large %#"QUADXFMT, numval);
+ report("subid too large %#jx",
+ (uintmax_t)numval);
if (oid->len == ASN_MAXOIDLEN)
report("index too long");
if (gettoken() != ':')
@@ -878,7 +879,7 @@ parse_syntax_integer(struct snmp_value *value)
if (token != TOK_NUM)
report("bad INTEGER syntax");
if (numval > 0x7fffffff)
- report("INTEGER too large %"QUADFMT, numval);
+ report("INTEGER too large %ju", (uintmax_t)numval);
value->v.integer = numval;
gettoken();
diff --git a/contrib/bsnmp/snmpd/main.c b/contrib/bsnmp/snmpd/main.c
index 2d60926..ea87127 100644
--- a/contrib/bsnmp/snmpd/main.c
+++ b/contrib/bsnmp/snmpd/main.c
@@ -648,11 +648,11 @@ decoded:
} else if (usm_user->suser.auth_proto != SNMP_AUTH_NOAUTH &&
(pdu->engine.engine_boots == 0 || pdu->engine.engine_time == 0)) {
snmpd_usmstats.not_in_time_windows++;
- ret = SNMP_CODE_FAILED;
+ ret = SNMPD_INPUT_FAILED;
}
if ((code = snmp_pdu_auth_access(pdu, ip)) != SNMP_CODE_OK)
- ret = SNMP_CODE_FAILED;
+ ret = SNMPD_INPUT_FAILED;
return (ret);
}
diff --git a/contrib/file/ChangeLog b/contrib/file/ChangeLog
index 8e67ef6..7554254 100644
--- a/contrib/file/ChangeLog
+++ b/contrib/file/ChangeLog
@@ -1,3 +1,62 @@
+2016-05-13 12:00 Christos Zoulas <christos@zoulas.com>
+
+ * release 5.27
+
+2016-04-18 9:35 Christos Zoulas <christos@zoulas.com>
+
+ * Errors comparing DER entries or computing offsets
+ are just indications of malformed non-DER files.
+ Don't print them.
+ * Offset comparison was off-by-one.
+ * Fix compression code (Werner Fink)
+ * Put new bytes constant in the right file (not the generated one)
+
+2016-04-16 18:34 Christos Zoulas <christos@zoulas.com>
+
+ * release 5.26
+
+2016-03-31 13:50 Christos Zoulas <christos@zoulas.com>
+
+ * make the number of bytes read from files configurable.
+
+2016-03-21 13:40 Christos Zoulas <christos@zoulas.com>
+
+ * Add bounds checks for DER code (discovered by Thomas Jarosch)
+ * Change indirect recursion limit to indirect use count and
+ bump from 15 to 50 to prevent abuse.
+
+2016-03-13 20:39 Christos Zoulas <christos@zoulas.com>
+
+ * Add -00 which prints filename\0description\0
+
+2016-03-01 13:28 Christos Zoulas <christos@zoulas.com>
+
+ * Fix ID3 indirect parsing
+
+2016-01-19 10:18 Christos Zoulas <christos@zoulas.com>
+
+ * add DER parsing capability
+
+2015-11-13 10:35 Christos Zoulas <christos@zoulas.com>
+
+ * provide dprintf(3) for the OS's that don't have it.
+
+2015-11-11 16:25 Christos Zoulas <christos@zoulas.com>
+
+ * redo the compression code report decompression errors
+
+2015-11-10 23:25 Christos Zoulas <christos@zoulas.com>
+
+ * REG_STARTEND code is not working as expected, delete it.
+
+2015-11-09 16:05 Christos Zoulas <christos@zoulas.com>
+
+ * Add zlib support if we have it.
+
+2015-11-05 11:22 Christos Zoulas <christos@zoulas.com>
+
+ * PR/492: compression forking was broken with magic_buffer.
+
2015-09-16 9:50 Christos Zoulas <christos@zoulas.com>
* release 5.25
diff --git a/contrib/file/README b/contrib/file/README
index 81a5221..bb8186f 100644
--- a/contrib/file/README
+++ b/contrib/file/README
@@ -1,6 +1,6 @@
## README for file(1) Command ##
- @(#) $File: README,v 1.49 2015/01/02 20:23:04 christos Exp $
+ @(#) $File: README,v 1.50 2016/04/16 22:40:54 christos Exp $
Mailing List: file@mx.gw.com
Mailing List archives: http://mx.gw.com/pipermail/file/
@@ -67,17 +67,41 @@ in magic(5) format please, to the maintainer, Christos Zoulas.
COPYING - read this first.
README - read this second (you are currently reading this file).
INSTALL - read on how to install
+src/localtime_r.c
+src/magic.c
+src/magic.h
+src/mygetopt.h
+src/newtest2.c
+src/newtest3.c
+src/pread.c
+src/print.c
+src/readcdf.c
+src/readelf.c
+src/readelf.h
+src/regex.c
+src/regex2.c
+src/softmagic.c
+src/strcasestr.c
+src/strlcat.c
+src/strlcpy.c
+src/strndup.c
+src/tar.h
+src/teststrchr.c
+src/vasprintf.c
+src/x.c
src/apprentice.c - parses /etc/magic to learn magic
-src/asctime_r.c - replacement for OS's that don't have it.
src/apptype.c - used for OS/2 specific application type magic
-src/asprintf.c - replacement for OS's that don't have it.
src/ascmagic.c - third & last set of tests, based on hardwired assumptions.
src/asctime_r.c - replacement for OS's that don't have it.
src/asprintf.c - replacement for OS's that don't have it.
+src/asctime_r.c - replacement for OS's that don't have it.
+src/asprintf.c - replacement for OS's that don't have it.
src/cdf.[ch] - parser for Microsoft Compound Document Files
src/cdf_time.c - time converter for CDF.
src/compress.c - handles decompressing files to look inside.
src/ctime_r.c - replacement for OS's that don't have it.
+src/der.[ch] - parser for Distinguished Encoding Rules
+src/dprintf.c - replacement for OS's that don't have it.
src/elfclass.h - common code for elf 32/64.
src/encoding.c - handles unicode encodings
src/file.c - the main program
@@ -88,10 +112,13 @@ src/fsmagic.c - first set of tests the program runs, based on filesystem info
src/funcs.c - utilility functions
src/getline.c - replacement for OS's that don't have it.
src/getopt_long.c - replacement for OS's that don't have it.
-src/is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore).
-src/names.h - header file for ascmagic.c
+src/gmtime_r.c - replacement for OS's that don't have it.
+src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore).
+src/localtime_r.c - replacement for OS's that don't have it.
src/magic.h.in - source file for magic.h
+src/mygetopt.h - replacement for OS's that don't have it.
src/magic.c - the libmagic api
+src/names.h - header file for ascmagic.c
src/pread.c - replacement for OS's that don't have it.
src/print.c - print results, errors, warnings.
src/readcdf.c - CDF wrapper.
diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in
index 0397fe4..86efb6f 100644
--- a/contrib/file/config.h.in
+++ b/contrib/file/config.h.in
@@ -32,6 +32,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if you have the `dprintf' function. */
+#undef HAVE_DPRINTF
+
/* Define to 1 if you have the <err.h> header file. */
#undef HAVE_ERR_H
diff --git a/contrib/file/configure b/contrib/file/configure
index 7f62b63..7381141 100755
--- a/contrib/file/configure
+++ b/contrib/file/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for file 5.25.
+# Generated by GNU Autoconf 2.69 for file 5.27.
#
# Report bugs to <christos@astron.com>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='file'
PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.25'
-PACKAGE_STRING='file 5.25'
+PACKAGE_VERSION='5.27'
+PACKAGE_STRING='file 5.27'
PACKAGE_BUGREPORT='christos@astron.com'
PACKAGE_URL=''
@@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures file 5.25 to adapt to many kinds of systems.
+\`configure' configures file 5.27 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1397,7 +1397,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of file 5.25:";;
+ short | recursive ) echo "Configuration of file 5.27:";;
esac
cat <<\_ACEOF
@@ -1507,7 +1507,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-file configure 5.25
+file configure 5.27
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by file $as_me 5.25, which was
+It was created by file $as_me 5.27, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3029,7 +3029,7 @@ fi
# Define the identity of the package.
PACKAGE='file'
- VERSION='5.25'
+ VERSION='5.27'
cat >>confdefs.h <<_ACEOF
@@ -14385,6 +14385,19 @@ esac
fi
+ac_fn_c_check_func "$LINENO" "dprintf" "ac_cv_func_dprintf"
+if test "x$ac_cv_func_dprintf" = xyes; then :
+ $as_echo "#define HAVE_DPRINTF 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" dprintf.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS dprintf.$ac_objext"
+ ;;
+esac
+
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzopen in -lz" >&5
@@ -15036,7 +15049,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by file $as_me 5.25, which was
+This file was extended by file $as_me 5.27, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15102,7 +15115,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-file config.status 5.25
+file config.status 5.27
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/contrib/file/configure.ac b/contrib/file/configure.ac
index 50c3188..3c5f922 100644
--- a/contrib/file/configure.ac
+++ b/contrib/file/configure.ac
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.25],[christos@astron.com])
+AC_INIT([file],[5.27],[christos@astron.com])
AM_INIT_AUTOMAKE([subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -145,7 +145,7 @@ dnl Checks for functions
AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale)
dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck)
+AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)
dnl Checks for libraries
AC_CHECK_LIB(z,gzopen)
diff --git a/contrib/file/doc/file.man b/contrib/file/doc/file.man
index 2a048a2..f1a86ae 100644
--- a/contrib/file/doc/file.man
+++ b/contrib/file/doc/file.man
@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.118 2015/09/11 17:24:09 christos Exp $
-.Dd September 11, 2015
+.\" $File: file.man,v 1.120 2016/03/31 17:51:12 christos Exp $
+.Dd March 13, 2016
.Dt FILE __CSECTION__
.Os
.Sh NAME
@@ -317,6 +317,7 @@ Set various parameter limits.
.It Li elf_phnum Ta 128 Ta max ELF program sections processed
.It Li elf_shnum Ta 32768 Ta max ELF sections processed
.It Li regex Ta 8192 Ta length limit for regex searches
+.It Li bytes Ta 1048576 Ta max number of bytes to read from file
.El
.It Fl r , Fl Fl raw
Don't translate unprintable characters to \eooo.
@@ -358,6 +359,11 @@ Nice to
.Xr cut 1
the output.
This does not affect the separator, which is still printed.
+.Pp
+If this option is repeated more than once, then
+.Nm
+prints just the filename followed by a NUL followed by the description
+(or ERROR: text) followed by a second NUL for each entry.
.It Fl -help
Print a help message and exit.
.El
diff --git a/contrib/file/doc/libmagic.man b/contrib/file/doc/libmagic.man
index 8f5c032..a3de981 100644
--- a/contrib/file/doc/libmagic.man
+++ b/contrib/file/doc/libmagic.man
@@ -1,4 +1,4 @@
-.\" $File: libmagic.man,v 1.38 2015/09/11 17:24:09 christos Exp $
+.\" $File: libmagic.man,v 1.40 2016/03/31 17:51:12 christos Exp $
.\"
.\" Copyright (c) Christos Zoulas 2003.
.\" All Rights Reserved.
@@ -225,7 +225,7 @@ It returns 0 on success and \-1 on failure.
.Pp
The
.Fn magic_compile
-function can be used to compile the the colon
+function can be used to compile the colon
separated list of database files passed in as
.Ar filename ,
or
@@ -251,7 +251,7 @@ for the default database.
.Pp
The
.Fn magic_load
-function must be used to load the the colon
+function must be used to load the colon
separated list of database files passed in as
.Ar filename ,
or
@@ -282,7 +282,7 @@ The
.Fn magic_getparam
and
.Fn magic_setparam
-allow getting and setting various limits related to the the magic
+allow getting and setting various limits related to the magic
library.
.Bl -column "MAGIC_PARAM_ELF_PHNUM_MAX" "size_t" "Default" -offset indent
.It Sy "Parameter" Ta Sy "Type" Ta Sy "Default"
@@ -292,6 +292,7 @@ library.
.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128
.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768
.It Li MAGIC_PARAM_REGEX_MAX Ta size_t Ta 8192
+.It Li MAGIC_PARAM_BYTES_MAX Ta size_t Ta 1048576
.El
.Pp
The
diff --git a/contrib/file/magic/Magdir/android b/contrib/file/magic/Magdir/android
index 7675c1c..f1340d5 100644
--- a/contrib/file/magic/Magdir/android
+++ b/contrib/file/magic/Magdir/android
@@ -1,6 +1,6 @@
#------------------------------------------------------------
-# $File: android,v 1.8 2015/03/19 18:04:37 christos Exp $
+# $File: android,v 1.9 2016/01/11 21:19:18 christos Exp $
# Various android related magic entries
#------------------------------------------------------------
@@ -128,7 +128,7 @@
# partition size in blocks ?
#>>>>0x22 ulelong x \b*%d
-# Android bootimg format
+# Android sparse img format
# From https://android.googlesource.com/\
# platform/system/core/+/master/libsparse/sparse_format.h
0 lelong 0xed26ff3a Android sparse image
diff --git a/contrib/file/magic/Magdir/animation b/contrib/file/magic/Magdir/animation
index 0445adc..51eeea2 100644
--- a/contrib/file/magic/Magdir/animation
+++ b/contrib/file/magic/Magdir/animation
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: animation,v 1.56 2014/10/23 23:12:51 christos Exp $
+# $File: animation,v 1.57 2015/11/29 22:11:07 christos Exp $
# animation: file(1) magic for animation/movie formats
#
# animation formats
@@ -76,6 +76,8 @@
>8 string da2b \b, DMB MAF, ext da2a, with 3GPP timed text, DID, TVA, REL, IPMP
>8 string da3a \b, DMB MAF aud with HE-AAC aud, JPG/PNG/MNG images
>8 string da3b \b, DMB MAF, ext da3a w/ BIFS, 3GPP, DID, TVA, REL, IPMP
+>8 string dash \b, MPEG v4 system, Dynamic Adaptive Streaming over HTTP
+!:mime video/mp4
>8 string dmb1 \b, DMB MAF supporting all the components defined in the spec
>8 string dmpf \b, Digital Media Project
>8 string drc1 \b, Dirac (wavelet compression), encap in ISO base media (MP4)
diff --git a/contrib/file/magic/Magdir/apple b/contrib/file/magic/Magdir/apple
index 1418688..5db4fee 100644
--- a/contrib/file/magic/Magdir/apple
+++ b/contrib/file/magic/Magdir/apple
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: apple,v 1.31 2015/08/29 07:10:35 christos Exp $
+# $File: apple,v 1.32 2015/12/04 20:40:10 christos Exp $
# apple: file(1) magic for Apple file formats
#
0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text
@@ -65,18 +65,48 @@
# Eric Fischer <enf@pobox.com>
# AppleWorks word processor:
-#
-# This matches the standard tab stops for an AppleWorks file, but if
-# a file has a tab stop set in the first four columns this will fail.
-#
+# URL: https://en.wikipedia.org/wiki/AppleWorks
+# Reference: http://www.gno.org/pub/apple2/doc/apple/filetypes/ftn.1a.xxxx
+# Update: Joerg Jenderek
+# NOTE:
# The "O" is really the magic number, but that's so common that it's
# necessary to check the tab stops that follow it to avoid false positives.
-
-4 string O==== AppleWorks word processor data
->85 byte&0x01 >0 \b, zoomed
->90 byte&0x01 >0 \b, paginated
->92 byte&0x01 >0 \b, with mail merge
-#>91 byte x \b, left margin %d
+# and/or look for unused bits of booleans bytes like zoom, paginated, mail merge
+# the newer AppleWorks is from claris with extension CWK
+4 string O
+# test for unused bits of zoom- , paginated-boolean bytes
+>84 ubequad ^0x00Fe00000000Fe00
+# look for tabstop definitions "=" no tab, "|" no tab
+# "<" left tab,"^" center tab,">" right tab, "." decimal tab,
+# unofficial "!" other , "\x8a" other
+# official only if SFMinVers is nonzero
+>>5 regex/s [=.<>|!^\x8a]{79} AppleWorks Word Processor
+# AppleWorks Word Processor File (Apple II)
+# ./apple (version 5.25) labeled the entry as "AppleWorks word processor data"
+# application/x-appleworks is mime type for claris version with cwk extension
+!:mime application/x-appleworks3
+# http://home.earthlink.net/~hughhood/appleiiworksenvoy/
+# ('p' + 1-byte ProDOS File Type + 2-byte ProDOS Aux Type')
+# $70 $1A $F8 $FF is this the apple type ?
+#:apple pdospøÿ
+!:ext awp
+# minimum version needed to read this files. SFMinVers (0 , 30~3.0 )
+>>>183 ubyte 30 3.0
+>>>183 ubyte !30
+>>>>183 ubyte !0 0x%x
+# usual tabstop start sequence "=====<"
+>>>5 string x \b, tabstop ruler "%6.6s"
+# tabstop ruler
+#>>>5 string >\0 \b, tabstops "%-79s"
+# zoom switch
+>>>85 byte&0x01 >0 \b, zoomed
+# whether paginated
+>>>90 byte&0x01 >0 \b, paginated
+# contains any mail-merge commands
+>>>92 byte&0x01 >0 \b, with mail merge
+# left margin in 1/10 inches ( normally 0 or 10 )
+>>>91 ubyte >0
+>>>>91 ubyte x \b, %d/10 inch left margin
# AppleWorks database:
#
diff --git a/contrib/file/magic/Magdir/archive b/contrib/file/magic/Magdir/archive
index f115e95..e737550 100644
--- a/contrib/file/magic/Magdir/archive
+++ b/contrib/file/magic/Magdir/archive
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: archive,v 1.91 2015/09/16 13:49:33 christos Exp $
+# $File: archive,v 1.103 2016/05/05 17:07:40 christos Exp $
# archive: file(1) magic for archive formats (see also "msdos" for self-
# extracting compressed archives)
#
@@ -246,7 +246,15 @@
# BA
# TODO: idarc says "bytes 0-2 == bytes 3-5"
# TTComp
-0 string \0\6 TTComp archive data
+# URL: http://fileformats.archiveteam.org/wiki/TTComp_archive
+# Update: Joerg Jenderek
+# GRR: line below is too general as it matches also Panorama database "TCDB 2003-10 demo.pan", others
+0 string \0\6
+# look for first keyword of Panorama database *.pan
+>12 search/261 DESIGN
+# skip keyword with low entropy
+>12 default x TTComp archive, binary, 4K dictionary
+# (version 5.25) labeled the above entry as "TTComp archive data"
# ESP, could this conflict with Easy Software Products' (e.g.ESP ghostscript) documentation?
0 string ESP ESP archive data
# ZPack
@@ -544,55 +552,212 @@
>>0x36 string >\0 fstype %.8s
# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
-2 string -lh0- LHarc 1.x/ARX archive data [lh0]
-!:mime application/x-lharc
-2 string -lh1- LHarc 1.x/ARX archive data [lh1]
-!:mime application/x-lharc
-2 string -lz4- LHarc 1.x archive data [lz4]
-!:mime application/x-lharc
-2 string -lz5- LHarc 1.x archive data [lz5]
-!:mime application/x-lharc
+# Update: Joerg Jenderek
+# URL: https://en.wikipedia.org/wiki/LHA_(file_format)
+# Reference: http://web.archive.org/web/20021005080911/http://www.osirusoft.com/joejared/lzhformat.html
+#
+# check and display information of lharc (LHa,PMarc) file
+0 name lharc-file
+# check 1st character of method id like -lz4- -lh5- or -pm2-
+>2 string -
+# check 5th character of method id
+>>6 string -
+# check header level 0 1 2 3
+>>>20 ubyte <4
+# check 2nd, 3th and 4th character of method id
+>>>>3 regex \^(lh[0-9a-ex]|lz[s2-8]|pm[012]|pc1) \b
+!:mime application/x-lzh-compressed
+# creator type "LHA "
+!:apple ????LHA
+# display archive type name like "LHa/LZS archive data" or "LArc archive"
+>>>>>2 string -lz \b
+!:ext lzs
+# already known -lzs- -lz4- -lz5- with old names
+>>>>>>2 string -lzs LHa/LZS archive data
+>>>>>>3 regex \^lz[45] LHarc 1.x archive data
+# missing -lz?- with wikipedia names
+>>>>>>3 regex \^lz[2378] LArc archive
+# display archive type name like "LHa (2.x) archive data"
+>>>>>2 string -lh \b
+# already known -lh0- -lh1- -lh2- -lh3- -lh4- -lh5- -lh6- -lh7- -lhd- variants with old names
+>>>>>>3 regex \^lh[01] LHarc 1.x/ARX archive data
+# LHice archiver use ".ICE" as name extension instead usual one ".lzh"
+# FOOBAR archiver use ".foo" as name extension instead usual one
+# "Florain Orjanov's and Olga Bachetska's ARchiver" not found at the moment
+>>>>>>>2 string -lh1 \b
+!:ext lha/lzh/ice
+>>>>>>3 regex \^lh[23d] LHa 2.x? archive data
+>>>>>>3 regex \^lh[7] LHa (2.x)/LHark archive data
+>>>>>>3 regex \^lh[456] LHa (2.x) archive data
+>>>>>>>2 string -lh5 \b
+# https://en.wikipedia.org/wiki/BIOS
+# Some mainboard BIOS like Award use LHa compression. So archives with unusal extension are found like
+# bios.rom , kd7_v14.bin, 1010.004, ...
+!:ext lha/lzh/rom/bin
+# missing -lh?- variants (Joe Jared)
+>>>>>>3 regex \^lh[89a-ce] LHa (Joe Jared) archive
+# UNLHA32 2.67a
+>>>>>>2 string -lhx LHa (UNLHA32) archive
+# lha archives with standard file name extensions ".lha" ".lzh"
+>>>>>>3 regex !\^(lh1|lh5) \b
+!:ext lha/lzh
+# this should not happen if all -lh variants are described
+>>>>>>2 default x LHa (unknown) archive
+#!:ext lha
+# PMarc
+>>>>>3 regex \^pm[012] PMarc archive data
+!:ext pma
+# append method id without leading and trailing minus character
+>>>>>3 string x [%3.3s]
+>>>>>>0 use lharc-header
+#
+# check and display information of lharc header
+0 name lharc-header
+# header size 0x4 , 0x1b-0x61
+>0 ubyte x
+# compressed data size != compressed file size
+#>7 ulelong x \b, data size %d
+# attribute: 0x2~?? 0x10~symlink|target 0x20~normal
+#>19 ubyte x \b, 19_0x%x
+# level identifier 0 1 2 3
+#>20 ubyte x \b, level %d
+# time stamp
+#>15 ubelong x DATE 0x%8.8x
+# OS ID for level 1
+>20 ubyte 1
+# 0x20 types find for *.rom files
+>>(21.b+24) ubyte <0x21 \b, 0x%x OS
+# ascii type like M for MSDOS
+>>(21.b+24) ubyte >0x20 \b, '%c' OS
+# OS ID for level 2
+>20 ubyte 2
+#>>23 ubyte x \b, OS ID 0x%x
+>>23 ubyte <0x21 \b, 0x%x OS
+>>23 ubyte >0x20 \b, '%c' OS
+# filename only for level 0 and 1
+>20 ubyte <2
+# length of filename
+>>21 ubyte >0 \b, with
+# filename
+>>>21 pstring x "%s"
+#
+#2 string -lh0- LHarc 1.x/ARX archive data [lh0]
+#!:mime application/x-lharc
+2 string -lh0-
+>0 use lharc-file
+#2 string -lh1- LHarc 1.x/ARX archive data [lh1]
+#!:mime application/x-lharc
+2 string -lh1-
+>0 use lharc-file
+# NEW -lz2- ... -lz8-
+2 string -lz2-
+>0 use lharc-file
+2 string -lz3-
+>0 use lharc-file
+2 string -lz4-
+>0 use lharc-file
+2 string -lz5-
+>0 use lharc-file
+2 string -lz7-
+>0 use lharc-file
+2 string -lz8-
+>0 use lharc-file
# [never seen any but the last; -lh4- reported in comp.compression:]
-2 string -lzs- LHa/LZS archive data [lzs]
-!:mime application/x-lha
-2 string -lh\40- LHa 2.x? archive data [lh ]
-!:mime application/x-lha
-2 string -lhd- LHa 2.x? archive data [lhd]
-!:mime application/x-lha
-2 string -lh2- LHa 2.x? archive data [lh2]
-!:mime application/x-lha
-2 string -lh3- LHa 2.x? archive data [lh3]
-!:mime application/x-lha
-2 string -lh4- LHa (2.x) archive data [lh4]
-!:mime application/x-lha
-2 string -lh5- LHa (2.x) archive data [lh5]
-!:mime application/x-lha
-2 string -lh6- LHa (2.x) archive data [lh6]
-!:mime application/x-lha
-2 string -lh7- LHa (2.x)/LHark archive data [lh7]
-!:mime application/x-lha
->20 byte x - header level %d
+#2 string -lzs- LHa/LZS archive data [lzs]
+2 string -lzs-
+>0 use lharc-file
+# According to wikipedia and others such a version does not exist
+#2 string -lh\40- LHa 2.x? archive data [lh ]
+#2 string -lhd- LHa 2.x? archive data [lhd]
+2 string -lhd-
+>0 use lharc-file
+#2 string -lh2- LHa 2.x? archive data [lh2]
+2 string -lh2-
+>0 use lharc-file
+#2 string -lh3- LHa 2.x? archive data [lh3]
+2 string -lh3-
+>0 use lharc-file
+#2 string -lh4- LHa (2.x) archive data [lh4]
+2 string -lh4-
+>0 use lharc-file
+#2 string -lh5- LHa (2.x) archive data [lh5]
+2 string -lh5-
+>0 use lharc-file
+#2 string -lh6- LHa (2.x) archive data [lh6]
+2 string -lh6-
+>0 use lharc-file
+#2 string -lh7- LHa (2.x)/LHark archive data [lh7]
+2 string -lh7-
+# !:mime application/x-lha
+# >20 byte x - header level %d
+>0 use lharc-file
+# NEW -lh8- ... -lhe- , -lhx-
+2 string -lh8-
+>0 use lharc-file
+2 string -lh9-
+>0 use lharc-file
+2 string -lha-
+>0 use lharc-file
+2 string -lhb-
+>0 use lharc-file
+2 string -lhc-
+>0 use lharc-file
+2 string -lhe-
+>0 use lharc-file
+2 string -lhx-
+>0 use lharc-file
# taken from idarc [JW]
2 string -lZ PUT archive data
-2 string -lz LZS archive data
+# already done by LHarc magics
+# this should never happen if all sub types of LZS archive are identified
+#2 string -lz LZS archive data
2 string -sw1- Swag archive data
-# RAR archiver (Greg Roelofs, newt@uchicago.edu)
-0 string Rar! RAR archive data,
+0 name rar-file-header
+>24 byte 15 \b, v1.5
+>24 byte 20 \b, v2.0
+>24 byte 29 \b, v4
+>15 byte 0 \b, os: MS-DOS
+>15 byte 1 \b, os: OS/2
+>15 byte 2 \b, os: Win32
+>15 byte 3 \b, os: Unix
+>15 byte 4 \b, os: Mac OS
+>15 byte 5 \b, os: BeOS
+
+0 name rar-archive-header
+>3 leshort&0x1ff >0 \b, flags:
+>>3 leshort &0x01 ArchiveVolume
+>>3 leshort &0x02 Commented
+>>3 leshort &0x04 Locked
+>>3 leshort &0x10 NewVolumeNaming
+>>3 leshort &0x08 Solid
+>>3 leshort &0x20 Authenticated
+>>3 leshort &0x40 RecoveryRecordPresent
+>>3 leshort &0x80 EncryptedBlockHeader
+>>3 leshort &0x100 FirstVolume
+
+# RAR (Roshal Archive) archive
+0 string Rar!\x1a\7\0 RAR archive data
+!:mime application/x-rar
+!:ext rar/cbr
+# file header
+>(0xc.l+9) byte 0x74
+>>(0xc.l+7) use rar-file-header
+# subblock seems to share information with file header
+>(0xc.l+9) byte 0x7a
+>>(0xc.l+7) use rar-file-header
+>9 byte 0x73
+>>7 use rar-archive-header
+
+0 string Rar!\x1a\7\1\0 RAR archive data, v5
!:mime application/x-rar
->44 byte x v%0x,
->10 byte >0 flags:
->>10 byte &0x01 Archive volume,
->>10 byte &0x02 Commented,
->>10 byte &0x04 Locked,
->>10 byte &0x08 Solid,
->>10 byte &0x20 Authenticated,
->35 byte 0 os: MS-DOS
->35 byte 1 os: OS/2
->35 byte 2 os: Win32
->35 byte 3 os: Unix
-# some old version? idarc says:
-0 string RE\x7e\x5e RAR archive data
+!:ext rar
+
+# Very old RAR archive
+# http://jasonblanks.com/wp-includes/images/papers/KnowyourarchiveRAR.pdf
+0 string RE\x7e\x5e RAR archive data (<v1.5)
+!:mime application/x-rar
+!:ext rar/cbr
# SQUISH archiver (Greg Roelofs, newt@uchicago.edu)
0 string SQSH squished archive data (Acorn RISCOS)
@@ -604,9 +769,12 @@
# PKZIP multi-volume archive
0 string PK\x07\x08PK\x03\x04 Zip multi-volume archive data, at least PKZIP v2.50 to extract
!:mime application/zip
+!:ext zip/cbz
# Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
0 string PK\005\006 Zip archive data (empty)
+!:mime application/zip
+!:ext zip/cbz
0 string PK\003\004
# Specialised zip formats which start with a member named 'mimetype'
@@ -723,6 +891,14 @@
>(26.s+30) leshort 0xcafe Java archive data (JAR)
!:mime application/java-archive
+# iOS App
+>(26.s+30) leshort !0xcafe
+>>26 string !\x8\0\0\0mimetype
+>>>30 string Payload/
+>>>>38 search/64 .app/ iOS App
+!:mime application/x-ios-app
+
+
# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
# Next line excludes specialized formats:
>(26.s+30) leshort !0xcafe
@@ -764,12 +940,24 @@
0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data
#
# PMA (CP/M derivative of LHA)
+# Update: Joerg Jenderek
+# URL: https://en.wikipedia.org/wiki/LHA_(file_format)
#
-2 string -pm0- PMarc archive data [pm0]
-2 string -pm1- PMarc archive data [pm1]
-2 string -pm2- PMarc archive data [pm2]
+#2 string -pm0- PMarc archive data [pm0]
+2 string -pm0-
+>0 use lharc-file
+#2 string -pm1- PMarc archive data [pm1]
+2 string -pm1-
+>0 use lharc-file
+#2 string -pm2- PMarc archive data [pm2]
+2 string -pm2-
+>0 use lharc-file
2 string -pms- PMarc SFX archive (CP/M, DOS)
+#!:mime application/x-foobar-exec
+!:ext com
5 string -pc1- PopCom compressed executable (CP/M)
+#!:mime application/x-
+#!:ext com
# From Rafael Laboissiere <rafael@laboissiere.net>
# The Project Revision Control System (see
@@ -802,6 +990,9 @@
# Felix von Leitner <felix-file@fefe.de>
0 string d8:announce BitTorrent file
!:mime application/x-bittorrent
+# Durval Menezes, <jmgthbfile at durval dot com>
+0 string d13:announce-list BitTorrent file
+!:mime application/x-bittorrent
# Atari MSA archive - Teemu Hukkanen <tjhukkan@iki.fi>
0 beshort 0x0e0f Atari MSA archive data
@@ -889,19 +1080,16 @@
# From "Nelson A. de Oliveira" <naoliv@gmail.com>
0 string MPQ\032 MoPaQ (MPQ) archive
-# From: Dirk Jagdmann <doj@cubic.org>
-# xar archive format: http://code.google.com/p/xar/
-0 string xar! xar archive
->6 beshort x - version %d
-
# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
# .kgb
0 string KGB_arch KGB Archiver file
>10 string x with compression level %.1s
# xar (eXtensible ARchiver) archive
+# xar archive format: http://code.google.com/p/xar/
# From: "David Remahl" <dremahl@apple.com>
0 string xar! xar archive
+!:mime application/x-xar
#>4 beshort x header size %d
>6 beshort x version %d,
#>8 quad x compressed TOC: %d,
@@ -975,3 +1163,9 @@
>0xE08 search/7776 \x55\xAA
>>&-512 indirect x \b; contains
+# Google Chrome extensions
+# https://developer.chrome.com/extensions/crx
+# https://developer.chrome.com/extensions/hosting
+0 string Cr24 Google Chrome extension
+!:mime application/x-chrome-extension
+>4 ulong x \b, version %u
diff --git a/contrib/file/magic/Magdir/audio b/contrib/file/magic/Magdir/audio
index e1d52c2..29442a5 100644
--- a/contrib/file/magic/Magdir/audio
+++ b/contrib/file/magic/Magdir/audio
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: audio,v 1.73 2015/03/15 23:21:42 christos Exp $
+# $File: audio,v 1.75 2016/02/08 17:30:11 christos Exp $
# audio: file(1) magic for sound formats (see also "iff")
#
# Jan Nicolai Langfeldt (janl@ifi.uio.no), Dan Quinlan (quinlan@yggdrasil.com),
@@ -585,7 +585,7 @@
0 string SC68\ Music-file\ /\ (c)\ (BeN)jami sc68 Atari ST music
# musepak support From: "Jiri Pejchal" <jiri.pejchal@gmail.com>
-0 string MP+ Musepack audio
+0 string MP+ Musepack audio (MP+)
!:mime audio/x-musepack
>3 byte 255 \b, SV pre8
>3 byte&0xF 0x6 \b, SV 6
@@ -619,6 +619,9 @@
>>27 byte 114 \b, Beta 1.14
>>27 byte 115 \b, Alpha 1.15
+0 string MPCK Musepack audio (MPCK)
+!:mime audio/x-musepack
+
# IMY
# from http://filext.com/detaillist.php?extdetail=IMY
# http://cellphones.about.com/od/cellularfaqs/f/rf_imelody.htm
@@ -715,3 +718,41 @@
0 string ZBOT
>4 byte 0xc5 GVOX Encore music, version < 5.0
+# Summary: Garmin Voice Processing Module (WAVE audios)
+# From: Joerg Jenderek
+# URL: http://www.garmin.com/
+# Reference: http://turboccc.wikispaces.com/share/view/28622555
+# NOTE: there exist 2 other Garmin VPM formats
+0 string AUDIMG
+# skip text files starting with string "AUDIMG"
+>13 ubyte <13 Garmin Voice Processing Module
+!:mime audio/x-vpm-wav-garmin
+!:ext vpm
+# 3 bytes indicating the voice version (200,220)
+>>6 string x \b, version %3.3s
+# day of release (01-31)
+>>12 ubyte x \b, %.2d
+# month of release (01-12)
+>>13 ubyte x \b.%.2d
+# year of release (like 2006, 2007, 2008)
+>>14 uleshort x \b.%.4d
+# hour of release (0-23)
+>>11 ubyte x %.2d
+# minute of release (0-59)
+>>10 ubyte x \b:%.2d
+# second of release (0-59)
+>>9 ubyte x \b:%.2d
+# if you select a language like german on your garmin device
+# you can only select voice modules with correponding language byte ID like 1
+>>18 ubyte x \b, language ID %d
+# pointer to 1st audio WAV sample
+>>16 uleshort >0
+>>>(16.s) ulelong >0 \b, at offset 0x%x
+# WAV length
+>>>>(16.s+4) ulelong >0 %d Bytes
+# look for magic
+>>>>>(&-8.l) string RIFF
+# determine type by ./riff
+>>>>>>&-4 indirect x \b
+# 2 - ~ 131 WAV samples following same way
+
diff --git a/contrib/file/magic/Magdir/bioinformatics b/contrib/file/magic/Magdir/bioinformatics
new file mode 100644
index 0000000..7de08a1
--- /dev/null
+++ b/contrib/file/magic/Magdir/bioinformatics
@@ -0,0 +1,178 @@
+
+#------------------------------------------------------------------------------
+# $File: bioinformatics,v 1.2 2016/02/14 15:53:53 christos Exp $
+# bioinfomatics: file(1) magic for Bioinfomatics file formats
+
+###############################################################################
+# BGZF (Blocked GNU Zip Format) - gzip compatible, but also indexable
+# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
+###############################################################################
+0 string \037\213
+>3 byte &0x04
+>>12 string BC
+>>>14 leshort &0x02 Blocked GNU Zip Format (BGZF; gzip compatible)
+>>>>16 leshort x \b, block length %d
+!:mime application/x-gzip
+
+
+###############################################################################
+# Tabix index file
+# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
+###############################################################################
+0 string TBI\1 SAMtools TBI (Tabix index format)
+>0x04 lelong =1 \b, with %d reference sequence
+>0x04 lelong >1 \b, with %d reference sequences
+>0x08 lelong &0x10000 \b, using half-closed-half-open coordinates (BED style)
+>0x08 lelong ^0x10000
+>>0x08 lelong =0 \b, using closed and one based coordinates (GFF style)
+>>0x08 lelong =1 \b, using SAM format
+>>0x08 lelong =2 \b, using VCF format
+>0x0c lelong x \b, sequence name column: %d
+>0x10 lelong x \b, region start column: %d
+>0x08 lelong =0
+>>0x14 lelong x \b, region end column: %d
+>0x18 byte x \b, comment character: %c
+>0x1c lelong x \b, skip line count: %d
+
+
+###############################################################################
+# BAM (Binary Sequence Alignment/Map format)
+# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
+# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
+###############################################################################
+0 string BAM\1 SAMtools BAM (Binary Sequence Alignment/Map)
+>0x04 lelong >0
+>>&0x00 regex =^[@]HD\t.*VN: \b, with SAM header
+>>>&0 regex =[0-9.]+ \b version %s
+>>&(0x04) lelong >0 \b, with %d reference sequences
+
+
+###############################################################################
+# BAI (BAM indexing format)
+# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
+###############################################################################
+0 string BAI\1 SAMtools BAI (BAM indexing format)
+>0x04 lelong >0 \b, with %d reference sequences
+
+
+###############################################################################
+# CRAM (Binary Sequence Alignment/Map format)
+###############################################################################
+0 string CRAM CRAM
+>0x04 byte >-1 version %d.
+>0x05 byte >-1 \b%d
+>0x06 string >\0 (identified as %s)
+
+
+###############################################################################
+# BCF (Binary Call Format), version 1
+# used by SAMtools & VCFtools (http://vcftools.sourceforge.net/bcf.pdf)
+# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
+###############################################################################
+0 string BCF\4
+# length of seqnm data in bytes is positive
+>&0x00 lelong >0
+# length of smpl data in bytes is positive
+>>&(&-0x04) lelong >0 SAMtools BCF (Binary Call Format)
+# length of meta in bytes
+>>>&(&-0x04) lelong >0
+# have meta text string
+>>>>&0x00 search ##samtoolsVersion=
+>>>>>&0x00 string x \b, generated by SAMtools version %s
+
+
+###############################################################################
+# BCF (Binary Call Format), version 2.1
+# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf)
+# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
+###############################################################################
+0 string BCF\2\1 Binary Call Format (BCF) version 2.1
+# length of header text
+>&0x00 lelong >0
+# have header string
+>>&0x00 search ##samtoolsVersion=
+>>>&0x00 string x \b, generated by SAMtools version %s
+
+
+###############################################################################
+# BCF (Binary Call Format), version 2.2
+# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf)
+# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
+###############################################################################
+0 string BCF\2\2 Binary Call Format (BCF) version 2.2
+# length of header text
+>&0x00 lelong >0
+# have header string
+>>&0x00 search ##samtoolsVersion=
+>>>&0x00 string x \b, generated by SAMtools version %s
+
+###############################################################################
+# VCF (Variant Call Format)
+# used by VCFtools (http://vcftools.sourceforge.net/)
+###############################################################################
+0 search ##fileformat=VCFv Variant Call Format (VCF)
+>&0 string x \b version %s
+
+###############################################################################
+# FASTQ
+# used by MAQ (http://maq.sourceforge.net/fastq.shtml)
+###############################################################################
+# XXX Broken?
+# @<seqname>
+#0 regex =^@[A-Za-z0-9_.:-]+\?\n
+# <seq>
+#>&1 regex =^[A-Za-z\n.~]++
+# +[<seqname>]
+#>>&1 regex =^[A-Za-z0-9_.:-]*\?\n
+# <qual>
+#>>>&1 regex =^[!-~\n]+\n FASTQ
+
+###############################################################################
+# FASTA
+# used by FASTA (http://fasta.bioch.virginia.edu/fasta_www2/fasta_guide.pdf)
+###############################################################################
+#0 byte 0x3e
+# q>0 regex =^[>][!-~\t\ ]+$
+# Amino Acid codes: [A-IK-Z*-]+
+#>>1 regex !=[!-'Jj;:=?@^`|~\\] FASTA
+# IUPAC codes/gaps: [ACGTURYKMSWBDHVNX-]+
+# not in IUPAC codes/gaps: [EFIJLOPQZ]
+#>>>1 regex !=[EFIJLOPQZefijlopqz] \b, with IUPAC nucleotide codes
+#>>>1 regex =^[EFIJLOPQZefijlopqz]+$ \b, with Amino Acid codes
+
+###############################################################################
+# SAM (Sequence Alignment/Map format)
+# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
+###############################################################################
+# Short-cut version to recognise SAM files with (optional) header at beginning
+###############################################################################
+0 string @HD\t
+>4 search VN: Sequence Alignment/Map (SAM), with header
+>>&0 regex [0-9.]+ \b version %s
+###############################################################################
+# Longer version to recognise SAM alignment lines using (many) regexes
+###############################################################################
+# SAM Alignment QNAME
+0 regex =^[!-?A-~]{1,255}(\t[^\t]+){11}
+# SAM Alignment FLAG
+>0 regex =^([^\t]+\t){1}[0-9]{1,5}\t
+# SAM Alignment RNAME
+>>0 regex =^([^\t]+\t){2}\\*|[^*=]*\t
+# SAM Alignment POS
+>>>0 regex =^([^\t]+\t){3}[0-9]{1,9}\t
+# SAM Alignment MAPQ
+>>>>0 regex =^([^\t]+\t){4}[0-9]{1,3}\t
+# SAM Alignment CIGAR
+>>>>>0 regex =\t\\*|([0-9]+[MIDNSHPX=])+)\t
+# SAM Alignment RNEXT
+>>>>>>0 regex =\t(\\*|=|[!-()+->?-~][!-~]*)\t
+# SAM Alignment PNEXT
+>>>>>>>0 regex =^([^\t]+\t){7}[0-9]{1,9}\t
+# SAM Alignment TLEN
+>>>>>>>>0 regex =\t[+-]{0,1}[0-9]{1,9}\t.*\t
+# SAM Alignment SEQ
+>>>>>>>>>0 regex =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t
+# SAM Alignment QUAL
+>>>>>>>>>>0 regex =^([^\t]+\t){10}[!-~]+ Sequence Alignment/Map (SAM)
+>>>>>>>>>>>0 regex =^[@]HD\t.*VN: \b, with header
+>>>>>>>>>>>>&0 regex =[0-9.]+ \b version %s
diff --git a/contrib/file/magic/Magdir/c-lang b/contrib/file/magic/Magdir/c-lang
index 0b17611..69ae516 100644
--- a/contrib/file/magic/Magdir/c-lang
+++ b/contrib/file/magic/Magdir/c-lang
@@ -1,7 +1,8 @@
#------------------------------------------------------------------------------
-# $File: c-lang,v 1.20 2015/07/27 14:33:10 christos Exp $
+# $File: c-lang,v 1.22 2015/10/29 18:49:11 christos Exp $
# c-lang: file(1) magic for C and related languages programs
#
+# The strength is to beat standard HTML
# BCPL
0 search/8192 "libhdr" BCPL source text
@@ -11,6 +12,7 @@
# C
0 regex \^#include C source text
+!:strength +25
!:mime text/x-c
0 regex \^char[\ \t\n]+ C source text
!:mime text/x-c
@@ -30,19 +32,19 @@
# C++
# The strength of these rules is increased so they beat the C rules above
0 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text
-!:strength + 5
+!:strength + 30
!:mime text/x-c++
0 regex \^virtual[\ \t\n]+ C++ source text
-!:strength + 5
+!:strength + 30
!:mime text/x-c++
0 regex \^class[\ \t\n]+ C++ source text
-!:strength + 5
+!:strength + 30
!:mime text/x-c++
0 regex \^public: C++ source text
-!:strength + 5
+!:strength + 30
!:mime text/x-c++
0 regex \^private: C++ source text
-!:strength + 5
+!:strength + 30
!:mime text/x-c++
# From: Mikhail Teterin <mi@aldan.algebra.com>
diff --git a/contrib/file/magic/Magdir/cafebabe b/contrib/file/magic/Magdir/cafebabe
index 51e97c4..6d97ceb 100644
--- a/contrib/file/magic/Magdir/cafebabe
+++ b/contrib/file/magic/Magdir/cafebabe
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: cafebabe,v 1.20 2015/05/29 14:21:58 christos Exp $
+# $File: cafebabe,v 1.21 2015/10/15 20:56:51 christos Exp $
# Cafe Babes unite!
#
# Since Java bytecode and Mach-O universal binaries have the same magic number,
@@ -58,12 +58,15 @@
>>4 belong <20 Mach-O universal binary with %d architectures:
!:mime application/x-mach-binary
>>>8 use mach-o \b
->>>28 use mach-o \b
>>4 belong 2
->>>48 use mach-o \b
+>>>28 use mach-o \b
>>4 belong 3
->>>68 use mach-o \b
+>>>48 use mach-o \b
>>4 belong 4
+>>>68 use mach-o \b
+>>4 belong 5
>>>88 use mach-o \b
+>>4 belong 6
+>>>108 use mach-o \b
### MACH-O END ###
diff --git a/contrib/file/magic/Magdir/coff b/contrib/file/magic/Magdir/coff
new file mode 100644
index 0000000..02cbf9c
--- /dev/null
+++ b/contrib/file/magic/Magdir/coff
@@ -0,0 +1,77 @@
+
+#------------------------------------------------------------------------------
+# $File: coff,v 1.1 2015/09/30 20:32:35 christos Exp $
+# coff: file(1) magic for Common Object Files not specific to known cpu types or manufactures
+#
+# COFF
+#
+# by Joerg Jenderek at Oct 2015
+# https://en.wikipedia.org/wiki/COFF
+# https://de.wikipedia.org/wiki/Common_Object_File_Format
+# http://www.delorie.com/djgpp/doc/coff/filhdr.html
+
+# display name+variables+flags of Common Object Files Format (32bit)
+# Maybe used also in adi,att3b,clipper,hitachi-sh,hp,ibm6000,intel,
+# mips,motorola,msdos,osf1,sharc,varied.out,vax
+0 name display-coff
+# test for unused flag bits (0x8000,0x0800,0x0400,0x0200,x0080) in f_flags
+>18 uleshort&0x8E80 0
+>>0 clear x
+# f_magic - magic number
+# DJGPP, 80386 COFF executable, MS Windows COFF Intel 80386 object file (./intel)
+>>0 uleshort 0x014C Intel 80386
+# Hitachi SH big-endian COFF (./hitachi-sh)
+>>0 uleshort 0x0500 Hitachi SH big-endian
+# Hitachi SH little-endian COFF (./hitachi-sh)
+>>0 uleshort 0x0550 Hitachi SH little-endian
+# executable (RISC System/6000 V3.1) or obj module (./ibm6000)
+#>>0 uleshort 0x01DF
+# TODO for other COFFs
+#>>0 uleshort 0xABCD COFF_TEMPLATE
+>>0 default x
+>>>0 uleshort x type 0x%04x
+>>0 uleshort x COFF
+# F_EXEC flag bit
+>>18 leshort ^0x0002 object file
+#!:mime application/x-coff
+#!:ext cof/o/obj/lib
+>>18 leshort &0x0002 executable
+#!:mime application/x-coffexec
+# F_RELFLG flag bit,static object
+>>18 leshort &0x0001 \b, no relocation info
+# F_LNNO flag bit
+>>18 leshort &0x0004 \b, no line number info
+# F_LSYMS flag bit
+>>18 leshort &0x0008 \b, stripped
+>>18 leshort ^0x0008 \b, not stripped
+# flags in other COFF versions
+#0x0010 F_FDPR_PROF
+#0x0020 F_FDPR_OPTI
+#0x0040 F_DSA
+# F_AR32WR flag bit
+#>>>18 leshort &0x0100 \b, 32 bit little endian
+#0x1000 F_DYNLOAD
+#0x2000 F_SHROBJ
+#0x4000 F_LOADONLY
+# f_nscns - number of sections
+>>2 uleshort <2 \b, %d section
+>>2 uleshort >1 \b, %d sections
+# f_timdat - file time & date stamp only for little endian
+#>>4 date x \b, %s
+# f_symptr - symbol table pointer, only for not stripped
+>>8 ulelong >0 \b, symbol offset=0x%x
+# f_nsyms - number of symbols, only for not stripped
+>>12 ulelong >0 \b, %d symbols
+# f_opthdr - optional header size
+>>16 uleshort >0 \b, optional header size %d
+# at offset 20 can be optional header, extra bytes FILHSZ-20 because
+# do not rely on sizeof(FILHDR) to give the correct size for header.
+# or first section header
+# additional variables for other COFF files
+# >20 beshort 0407 (impure)
+# >20 beshort 0410 (pure)
+# >20 beshort 0413 (demand paged)
+# >20 beshort 0421 (standalone)
+# >22 leshort >0 - version %d
+# >168 string .lowmem Apple toolbox
+
diff --git a/contrib/file/magic/Magdir/commands b/contrib/file/magic/Magdir/commands
index 153af5e..8dad8fe 100644
--- a/contrib/file/magic/Magdir/commands
+++ b/contrib/file/magic/Magdir/commands
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: commands,v 1.52 2015/06/04 19:16:55 christos Exp $
+# $File: commands,v 1.54 2016/04/19 13:40:02 christos Exp $
# commands: file(1) magic for various shells and interpreters
#
#0 string/w : shell archive or script for antique kernel text
@@ -98,8 +98,10 @@
!:mime text/x-php
# Smarty compiled template, http://www.smarty.net/
# Elan Ruusamae <glen@delfi.ee>
-0 string =<?php\ /*\ Smarty\ version Smarty compiled template
->24 regex [0-9.]+ \b, version %s
+0 string =<?php
+>5 regex [\ \n]
+>>6 string /*\ Smarty\ version Smarty compiled template
+>>>24 regex [0-9.]+ \b, version %s
!:mime text/x-php
0 string Zend\x00 PHP script Zend Optimizer data
diff --git a/contrib/file/magic/Magdir/compress b/contrib/file/magic/Magdir/compress
index 8452f52..910545a 100644
--- a/contrib/file/magic/Magdir/compress
+++ b/contrib/file/magic/Magdir/compress
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: compress,v 1.64 2015/07/27 15:41:09 christos Exp $
+# $File: compress,v 1.65 2015/12/04 20:48:03 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -188,6 +188,7 @@
>6 byte x version %d
>7 byte x \b.%d
!:mime application/x-7z-compressed
+!:ext 7z/cb7
# Type: LZMA
0 lelong&0xffffff =0x5d
diff --git a/contrib/file/magic/Magdir/console b/contrib/file/magic/Magdir/console
index 9dee3ff..f82d40f 100644
--- a/contrib/file/magic/Magdir/console
+++ b/contrib/file/magic/Magdir/console
@@ -1,53 +1,109 @@
#------------------------------------------------------------------------------
-# $File: console,v 1.20 2015/03/15 23:21:42 christos Exp $
+# $File: console,v 1.25 2016/04/18 20:22:10 christos Exp $
# Console game magic
# Toby Deshane <hac@shoelace.digivill.net>
-# ines: file(1) magic for Marat's iNES Nintendo Entertainment System
-# ROM dump format
-
-0 string NES\032 iNES ROM dump,
->4 byte x %dx16k PRG
->5 byte x \b, %dx8k CHR
->6 byte&0x01 =0x1 \b, [Vert.]
->6 byte&0x01 =0x0 \b, [Horiz.]
->6 byte&0x02 =0x2 \b, [SRAM]
->6 byte&0x04 =0x4 \b, [Trainer]
->6 byte&0x04 =0x8 \b, [4-Scr]
+
+# ines: file(1) magic for Marat's iNES Nintendo Entertainment System ROM dump format
+# Updated by David Korth <gerbilsoft@gerbilsoft.com>
+# References:
+# - http://wiki.nesdev.com/w/index.php/INES
+# - http://wiki.nesdev.com/w/index.php/NES_2.0
+0 string NES\x1A iNES ROM image
+>7 byte&0x0C =0x8 (NES 2.0)
+>4 byte x \b: %ux16k PRG
+>5 byte x \b, %ux16k CHR
+>6 byte&0x08 =0x8 [4-Scr]
+>6 byte&0x09 =0x0 [H-mirror]
+>6 byte&0x09 =0x1 [V-mirror]
+>6 byte&0x02 =0x2 [SRAM]
+>6 byte&0x04 =0x4 [Trainer]
+>7 byte&0x03 =0x2 [PC10]
+>7 byte&0x03 =0x1 [VS
+>>7 byte&0x0C =0x8
+# NES 2.0: VS PPU
+>>>13 byte&0x0F =0x0 \b, RP2C03B
+>>>13 byte&0x0F =0x1 \b, RP2C03G
+>>>13 byte&0x0F =0x2 \b, RP2C04-0001
+>>>13 byte&0x0F =0x3 \b, RP2C04-0002
+>>>13 byte&0x0F =0x4 \b, RP2C04-0003
+>>>13 byte&0x0F =0x5 \b, RP2C04-0004
+>>>13 byte&0x0F =0x6 \b, RP2C03B
+>>>13 byte&0x0F =0x7 \b, RP2C03C
+>>>13 byte&0x0F =0x8 \b, RP2C05-01
+>>>13 byte&0x0F =0x9 \b, RP2C05-02
+>>>13 byte&0x0F =0xA \b, RP2C05-03
+>>>13 byte&0x0F =0xB \b, RP2C05-04
+>>>13 byte&0x0F =0xC \b, RP2C05-05
+# TODO: VS protection hardware?
+>>7 byte x \b]
+# NES 2.0-specific flags.
+>7 byte&0x0C =0x8
+>>12 byte&0x03 =0x0 [NTSC]
+>>12 byte&0x03 =0x1 [PAL]
+>>12 byte&0x02 =0x2 [NTSC+PAL]
+
+#------------------------------------------------------------------------------
+# unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
+# Reference: http://wiki.nesdev.com/w/index.php/UNIF
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# TODO commit on 2016/03/21
+#
+# NOTE: The UNIF format uses chunks instead of a fixed header,
+# so most of the data isn't easily parseable.
+#
+0 string UNIF
+>4 lelong <16 UNIF v%d format NES ROM image
#------------------------------------------------------------------------------
-# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
+# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
+# Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
#
-0x104 belong 0xCEED6666 Gameboy ROM:
->0x134 string >\0 "%.16s"
->0x146 byte 0x03 \b,[SGB]
->0x147 byte 0x00 \b, [ROM ONLY]
->0x147 byte 0x01 \b, [ROM+MBC1]
->0x147 byte 0x02 \b, [ROM+MBC1+RAM]
->0x147 byte 0x03 \b, [ROM+MBC1+RAM+BATT]
->0x147 byte 0x05 \b, [ROM+MBC2]
->0x147 byte 0x06 \b, [ROM+MBC2+BATTERY]
->0x147 byte 0x08 \b, [ROM+RAM]
->0x147 byte 0x09 \b, [ROM+RAM+BATTERY]
->0x147 byte 0x0B \b, [ROM+MMM01]
->0x147 byte 0x0C \b, [ROM+MMM01+SRAM]
->0x147 byte 0x0D \b, [ROM+MMM01+SRAM+BATT]
->0x147 byte 0x0F \b, [ROM+MBC3+TIMER+BATT]
->0x147 byte 0x10 \b, [ROM+MBC3+TIMER+RAM+BATT]
->0x147 byte 0x11 \b, [ROM+MBC3]
->0x147 byte 0x12 \b, [ROM+MBC3+RAM]
->0x147 byte 0x13 \b, [ROM+MBC3+RAM+BATT]
->0x147 byte 0x19 \b, [ROM+MBC5]
->0x147 byte 0x1A \b, [ROM+MBC5+RAM]
->0x147 byte 0x1B \b, [ROM+MBC5+RAM+BATT]
->0x147 byte 0x1C \b, [ROM+MBC5+RUMBLE]
->0x147 byte 0x1D \b, [ROM+MBC5+RUMBLE+SRAM]
->0x147 byte 0x1E \b, [ROM+MBC5+RUMBLE+SRAM+BATT]
->0x147 byte 0x1F \b, [Pocket Camera]
->0x147 byte 0xFD \b, [Bandai TAMA5]
->0x147 byte 0xFE \b, [Hudson HuC-3]
->0x147 byte 0xFF \b, [Hudson HuC-1]
+0x104 bequad 0xCEED6666CC0D000B Game Boy ROM image
+>0x143 byte&0x80 0x80
+>>0x134 string >\0 \b: "%.15s"
+>0x143 byte&0x80 !0x80
+>>0x134 string >\0 \b: "%.16s"
+>0x14c byte x (Rev.%02u)
+# Machine type. (SGB, CGB, SGB+CGB)
+>0x14b byte 0x33
+>>0x146 byte 0x03
+>>>0x143 byte&0x80 0x80 [SGB+CGB]
+>>>0x143 byte&0x80 !0x80 [SGB]
+>>0x146 byte !0x03
+>>>0x143 byte&0xC0 0x80 [CGB]
+>>>0x143 byte&0xC0 0xC0 [CGB ONLY]
+
+# Mapper.
+>0x147 byte 0x00 [ROM ONLY]
+>0x147 byte 0x01 [MBC1]
+>0x147 byte 0x02 [MBC1+RAM]
+>0x147 byte 0x03 [MBC1+RAM+BATT]
+>0x147 byte 0x05 [MBC2]
+>0x147 byte 0x06 [MBC2+BATTERY]
+>0x147 byte 0x08 [ROM+RAM]
+>0x147 byte 0x09 [ROM+RAM+BATTERY]
+>0x147 byte 0x0B [MMM01]
+>0x147 byte 0x0C [MMM01+SRAM]
+>0x147 byte 0x0D [MMM01+SRAM+BATT]
+>0x147 byte 0x0F [MBC3+TIMER+BATT]
+>0x147 byte 0x10 [MBC3+TIMER+RAM+BATT]
+>0x147 byte 0x11 [MBC3]
+>0x147 byte 0x12 [MBC3+RAM]
+>0x147 byte 0x13 [MBC3+RAM+BATT]
+>0x147 byte 0x19 [MBC5]
+>0x147 byte 0x1A [MBC5+RAM]
+>0x147 byte 0x1B [MBC5+RAM+BATT]
+>0x147 byte 0x1C [MBC5+RUMBLE]
+>0x147 byte 0x1D [MBC5+RUMBLE+SRAM]
+>0x147 byte 0x1E [MBC5+RUMBLE+SRAM+BATT]
+>0x147 byte 0xFC [Pocket Camera]
+>0x147 byte 0xFD [Bandai TAMA5]
+>0x147 byte 0xFE [Hudson HuC-3]
+>0x147 byte 0xFF [Hudson HuC-1]
+
+# ROM size.
>0x148 byte 0 \b, ROM: 256Kbit
>0x148 byte 1 \b, ROM: 512Kbit
>0x148 byte 2 \b, ROM: 1Mbit
@@ -55,58 +111,198 @@
>0x148 byte 4 \b, ROM: 4Mbit
>0x148 byte 5 \b, ROM: 8Mbit
>0x148 byte 6 \b, ROM: 16Mbit
+>0x148 byte 7 \b, ROM: 32Mbit
>0x148 byte 0x52 \b, ROM: 9Mbit
>0x148 byte 0x53 \b, ROM: 10Mbit
>0x148 byte 0x54 \b, ROM: 12Mbit
+# RAM size.
>0x149 byte 1 \b, RAM: 16Kbit
>0x149 byte 2 \b, RAM: 64Kbit
>0x149 byte 3 \b, RAM: 128Kbit
>0x149 byte 4 \b, RAM: 1Mbit
-
-#>0x14e long x \b, CRC: %x
+>0x149 byte 5 \b, RAM: 512Kbit
#------------------------------------------------------------------------------
-# genesis: file(1) magic for the Sega MegaDrive/Genesis raw ROM format
+# genesis: file(1) magic for various Sega Mega Drive / Genesis ROM image and disc formats
+# Updated by David Korth <gerbilsoft@gerbilsoft.com>
+# References:
+# - http://www.retrodev.com/segacd.html
+# - http://devster.monkeeh.com/sega/32xguide1.txt
#
-0x100 string SEGA Sega MegaDrive/Genesis raw ROM dump
->0x120 string >\0 Name: "%.16s"
->0x110 string >\0 %.16s
->0x1B0 string RA with SRAM
+
+# Common Sega Mega Drive header format.
+# FIXME: Name fields are 48 bytes, but have spaces for padding instead of 00s.
+0 name sega-mega-drive-header
+# ROM title. (Use domestic if present; if not, use international.)
+>0x120 byte >0x20
+>>0x120 string >\0 \b: "%.16s"
+>0x120 byte <0x21
+>>0x150 string >\0 \b: "%.16s"
+# Other information.
+>0x180 string >\0 (%.14s
+>>0x110 string >\0 \b, %.16s
+>0x180 byte 0
+>>0x110 string >\0 (%.16s
+>0 byte x \b)
+
+# TODO: Check for 32X CD?
+# Sega Mega CD disc images: 2048-byte sectors.
+0 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
+>0 use sega-mega-drive-header
+>0 byte x \b, 2048-byte sectors
+0 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
+>0 use sega-mega-drive-header
+>0 byte x \b, 2048-byte sectors
+# Sega Mega CD disc images: 2352-byte sectors.
+0x10 string SEGADISCSYSTEM\ \ Sega Mega CD disc image
+>0x10 use sega-mega-drive-header
+>0 byte x \b, 2352-byte sectors
+0x10 string SEGABOOTDISC\ \ \ \ Sega Mega CD disc image
+>0x10 use sega-mega-drive-header
+>0 byte x \b, 2352-byte sectors
+
+# Sega Mega Drive, 32X, Pico, and Mega CD Boot ROM images.
+0x100 string SEGA
+>0x3C0 bequad 0x4D41525320434845 Sega 32X ROM image
+>>0 use sega-mega-drive-header
+>0x3C0 bequad !0x4D41525320434845
+>>0x105 belong 0x5049434F Sega Pico ROM image
+>>>0 use sega-mega-drive-header
+>>0x105 belong !0x5049434F
+>>>0x180 beshort 0x4252 Sega Mega CD Boot ROM image
+>>>0x180 beshort !0x4252 Sega Mega Drive / Genesis ROM image
+>>>0 use sega-mega-drive-header
#------------------------------------------------------------------------------
-# genesis: file(1) magic for the Super MegaDrive ROM dump format
+# genesis: file(1) magic for the Super MegaDrive ROM dump format
#
-0x280 string EAGN Super MagicDrive ROM dump
->0 byte x %dx16k blocks
->2 byte 0 \b, last in series or standalone
->2 byte >0 \b, split ROM
->8 byte 0xAA
->9 byte 0xBB
+
+# NOTE: Due to interleaving, we can't display anything
+# other than the copier header information.
+0 name sega-genesis-smd-header
+>0 byte x %dx16k blocks
+>2 byte 0 \b, last in series or standalone
+>2 byte >0 \b, split ROM
+
+# "Sega Genesis" header.
+0x280 string EAGN
+>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
+>>0 use sega-genesis-smd-header
+
+# "Sega Mega Drive" header.
+0x280 string EAMG
+>8 beshort 0xAABB Sega Mega Drive / Genesis ROM image (SMD format):
+>>0 use sega-genesis-smd-header
#------------------------------------------------------------------------------
-# genesis: file(1) alternate magic for the Super MegaDrive ROM dump format
+# smsgg: file(1) magic for Sega Master System and Game Gear ROM images
+# Detects all Game Gear and export Sega Master System ROM images,
+# and some Japanese Sega Master System ROM images.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://www.smspower.org/Development/ROMHeader
#
-0x280 string EAMG Super MagicDrive ROM dump
->0 byte x %dx16k blocks
->2 byte x \b, last in series or standalone
->8 byte 0xAA
->9 byte 0xBB
+
+# General SMS header rule.
+# The SMS boot ROM checks the header at three locations.
+0 name sega-master-system-rom-header
+# Machine type.
+>0x0F byte&0xF0 0x30 Sega Master System
+>0x0F byte&0xF0 0x40 Sega Master System
+>0x0F byte&0xF0 0x50 Sega Game Gear
+>0x0F byte&0xF0 0x60 Sega Game Gear
+>0x0F byte&0xF0 0x70 Sega Game Gear
+>0x0F byte&0xF0 <0x30 Sega Master System / Game Gear
+>0x0F byte&0xF0 >0x70 Sega Master System / Game Gear
+>0 byte x ROM image:
+# Product code.
+>0x0E byte&0xF0 0x10 1
+>0x0E byte&0xF0 0x20 2
+>0x0E byte&0xF0 0x30 3
+>0x0E byte&0xF0 0x40 4
+>0x0E byte&0xF0 0x50 5
+>0x0E byte&0xF0 0x60 6
+>0x0E byte&0xF0 0x70 7
+>0x0E byte&0xF0 0x80 8
+>0x0E byte&0xF0 0x90 9
+>0x0E byte&0xF0 0xA0 10
+>0x0E byte&0xF0 0xB0 11
+>0x0E byte&0xF0 0xC0 12
+>0x0E byte&0xF0 0xD0 13
+>0x0E byte&0xF0 0xE0 14
+>0x0E byte&0xF0 0xF0 15
+# If the product code is 5 digits, we'll need to backspace here.
+>0x0E byte&0xF0 !0
+>>0x0C leshort x \b%04x
+>0x0E byte&0xF0 0
+>>0x0C leshort x %04x
+# Revision.
+>0x0E byte&0x0F x (Rev.%02d)
+# ROM size. (Used for the boot ROM checksum routine.)
+>0x0F byte&0x0F 0x0A (8 KB)
+>0x0F byte&0x0F 0x0B (16 KB)
+>0x0F byte&0x0F 0x0C (32 KB)
+>0x0F byte&0x0F 0x0D (48 KB)
+>0x0F byte&0x0F 0x0E (64 KB)
+>0x0F byte&0x0F 0x0F (128 KB)
+>0x0F byte&0x0F 0x00 (256 KB)
+>0x0F byte&0x0F 0x01 (512 KB)
+>0x0F byte&0x0F 0x02 (1 MB)
+
+# SMS/GG header locations.
+0x7FF0 string TMR\ SEGA
+>0x7FF0 use sega-master-system-rom-header
+0x3FF0 string TMR\ SEGA
+>0x3FF0 use sega-master-system-rom-header
+0x1FF0 string TMR\ SEGA
+>0x1FF0 use sega-master-system-rom-header
#------------------------------------------------------------------------------
-# smsgg: file(1) magic for Sega Master System and Game Gear ROM dumps
-#
-# Does not detect all images. Very preliminary guesswork. Need more data
-# on format.
+# saturn: file(1) magic for the Sega Saturn disc image format.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
#
-# FIXME: need a little more info...;P
+
+# Common Sega Saturn disc header format.
+# NOTE: Title is 112 bytes, but we're only showing 32 due to space padding.
+# TODO: Release date, device information, region code, others?
+0 name sega-saturn-disc-header
+>0x60 string >\0 \b: "%.32s"
+>0x20 string >\0 (%.10s
+>>0x2A string >\0 \b, %.6s)
+>>0x2A byte 0 \b)
+
+# 2048-byte sector version.
+0 string SEGA\ SEGASATURN\ Sega Saturn disc image
+>0 use sega-saturn-disc-header
+>0 byte x (2048-byte sectors)
+# 2352-byte sector version.
+0x10 string SEGA\ SEGASATURN\ Sega Saturn disc image
+>0x10 use sega-saturn-disc-header
+>0 byte x (2352-byte sectors)
+
+#------------------------------------------------------------------------------
+# dreamcast: file(1) magic for the Sega Dreamcast disc image format.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://mc.pp.se/dc/ip0000.bin.html
#
-#0 byte 0xF3
-#>1 byte 0xED Sega Master System/Game Gear ROM dump
-#>1 byte 0x31 Sega Master System/Game Gear ROM dump
-#>1 byte 0xDB Sega Master System/Game Gear ROM dump
-#>1 byte 0xAF Sega Master System/Game Gear ROM dump
-#>1 byte 0xC3 Sega Master System/Game Gear ROM dump
+
+# Common Sega Dreamcast disc header format.
+# NOTE: Title is 128 bytes, but we're only showing 32 due to space padding.
+# TODO: Release date, device information, region code, others?
+0 name sega-dreamcast-disc-header
+>0x80 string >\0 \b: "%.32s"
+>0x40 string >\0 (%.10s
+>>0x4A string >\0 \b, %.6s)
+>>0x4A byte 0 \b)
+
+# 2048-byte sector version.
+0 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
+>0 use sega-dreamcast-disc-header
+>0 byte x (2048-byte sectors)
+# 2352-byte sector version.
+0x10 string SEGA\ SEGAKATANA\ Sega Dreamcast disc image
+>0x10 use sega-dreamcast-disc-header
+>0 byte x (2352-byte sectors)
#------------------------------------------------------------------------------
# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format
@@ -115,15 +311,77 @@
0 string LCDi Dream Animator file
#------------------------------------------------------------------------------
-# v64: file(1) uncertain magic for the V64 format N64 ROM dumps
+# z64: file(1) magic for the Z64 format N64 ROM dumps
+# Reference: http://forum.pj64-emu.com/showthread.php?t=2239
+# From: David Korth <gerbilsoft@gerbilsoft.com>
#
-0 belong 0x37804012 V64 Nintendo 64 ROM dump
+0 bequad 0x803712400000000F Nintendo 64 ROM image
+>0x20 string >\0 \b: "%.20s"
+>0x3B string x (%.4s
+>0x3F byte x \b, Rev.%02u)
-# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
-# Nintendo .nds
-192 string \044\377\256Qi\232 Nintendo DS Game ROM Image
-# Nintendo .gba
-0 string \056\000\000\352$\377\256Qi Nintendo Game Boy Advance ROM Image
+#------------------------------------------------------------------------------
+# v64: file(1) magic for the V64 format N64 ROM dumps
+# Same as z64 format, but with 16-bit byteswapping.
+#
+0 bequad 0x3780401200000F00 Nintendo 64 ROM image (V64)
+
+#------------------------------------------------------------------------------
+# n64-swap2: file(1) magic for the swap2 format N64 ROM dumps
+# Same as z64 format, but with swapped 16-bit words.
+#
+0 bequad 0x12408037000F0000 Nintendo 64 ROM image (wordswapped)
+
+#------------------------------------------------------------------------------
+# n64-le32: file(1) magic for the 32-bit byteswapped format N64 ROM dumps
+# Same as z64 format, but with 32-bit byteswapping.
+#
+0 bequad 0x401237800F000000 Nintendo 64 ROM image (32-bit byteswapped)
+
+#------------------------------------------------------------------------------
+# gba: file(1) magic for the Nintendo Game Boy Advance raw ROM format
+# Reference: http://problemkaputt.de/gbatek.htm#gbacartridgeheader
+#
+# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
+# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
+#
+4 bequad 0x24FFAE51699AA221 Game Boy Advance ROM image
+>0xA0 string >\0 \b: "%.12s"
+>0xAC string x (%.6s
+>0xBC byte x \b, Rev.%02u)
+
+#------------------------------------------------------------------------------
+# nds: file(1) magic for the Nintendo DS(i) raw ROM format
+# Reference: http://problemkaputt.de/gbatek.htm#dscartridgeheader
+#
+# Original version from: "Nelson A. de Oliveira" <naoliv@gmail.com>
+# Updated version from: David Korth <gerbilsoft@gerbilsoft.com>
+#
+0xC0 bequad 0x24FFAE51699AA221 Nintendo DS ROM image
+>0x00 string >\0 \b: "%.12s"
+>0x0C string x (%.6s
+>0x1E byte x \b, Rev.%02u)
+>0x12 byte 2 (DSi enhanced)
+>0x12 byte 3 (DSi only)
+
+#------------------------------------------------------------------------------
+# nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
+# This is also used for loading .nds files using the MSET exploit on 3DS.
+# Reference: https://github.com/devkitPro/ndstool/blob/master/source/ndscreate.cpp
+0xC0 bequad 0xC8604FE201708FE2 Nintendo DS Slot-2 ROM image (PassMe)
+
+#------------------------------------------------------------------------------
+# ngp: file(1) magic for the Neo Geo Pocket (Color) raw ROM format.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# References:
+# - https://neogpc.googlecode.com/svn-history/r10/trunk/src/core/neogpc.cpp
+# - http://www.devrs.com/ngp/files/ngpctech.txt
+#
+0x0A string BY\ SNK\ CORPORATION Neo Geo Pocket
+>0x23 byte 0x10 Color
+>0 byte x ROM image
+>0x24 string >\0 \b: "%.12s"
+>0x1F byte 0xFF (debug mode enabled)
#------------------------------------------------------------------------------
# msx: file(1) magic for MSX game cartridge dumps
@@ -133,9 +391,25 @@
#------------------------------------------------------------------------------
# Sony Playstation executables (Adam Sjoegren <asjo@diku.dk>) :
0 string PS-X\ EXE Sony Playstation executable
+>16 lelong x PC=0x%08x,
+>20 lelong !0 GP=0x%08x,
+>24 lelong !0 .text=[0x%08x,
+>>28 lelong x \b0x%x],
+>32 lelong !0 .data=[0x%08x,
+>>36 lelong x \b0x%x],
+>40 lelong !0 .bss=[0x%08x,
+>>44 lelong x \b0x%x],
+>48 lelong !0 Stack=0x%08x,
+>48 lelong =0 No Stack!,
+>52 lelong !0 StackSize=0x%x,
+#>76 string >\0 (%s)
# Area:
>113 string x (%s)
+# CPE executables
+0 string CPE CPE executable
+>3 byte x (version %d)
+
#------------------------------------------------------------------------------
# Microsoft Xbox executables .xbe (Esa Hyytia <ehyytia@cc.hut.fi>)
0 string XBEH XBE, Microsoft Xbox executable
@@ -272,3 +546,117 @@
# From: Sven Hartge <debian@ds9.argh.org>
0 string SCVM ScummVM savegame
>12 string >\0 "%s"
+
+#------------------------------------------------------------------------------
+# Nintendo GameCube / Wii file formats.
+#
+
+# Type: Nintendo GameCube/Wii common disc header data.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://wiibrew.org/wiki/Wii_Disc
+0 name nintendo-gcn-disc-common
+>0x20 string x "%.64s"
+>0x00 string x (%.6s
+>0x06 byte >0
+>>0x06 byte 1 \b, Disc 2
+>>0x06 byte 2 \b, Disc 3
+>>0x06 byte 3 \b, Disc 4
+>0x07 byte x \b, Rev.%02u)
+
+# Type: Nintendo GameCube disc image
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://wiibrew.org/wiki/Wii_Disc
+0x1C belong 0xC2339F3D Nintendo GameCube disc image:
+>0 use nintendo-gcn-disc-common
+
+# Type: Nintendo Wii disc image
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://wiibrew.org/wiki/Wii_Disc
+0x18 belong 0x5D1C9EA3 Nintendo Wii disc image:
+>0 use nintendo-gcn-disc-common
+
+# Type: Nintendo Wii disc image (WBFS format)
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://wiibrew.org/wiki/Wii_Disc
+0 string WBFS
+>0x218 belong 0x5D1C9EA3 Nintendo Wii disc image (WBFS format):
+>>0x200 use nintendo-gcn-disc-common
+
+#------------------------------------------------------------------------------
+# Nintendo 3DS file formats.
+#
+
+# Type: Nintendo 3DS "NCCH" header.
+# Contained within either a CXI executable or an NCSD image.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: https://www.3dbrew.org/wiki/NCCH
+0 name nintendo-3ds-NCCH
+>0x100 string NCCH
+>>0x150 string >\0 \b: "%.16s"
+>>0x112 leshort x (v%u)
+>>0x18C byte 2 (New3DS only)
+
+# Type: Nintendo 3DS "NCSD" image. (game cards and eMMC)
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: https://www.3dbrew.org/wiki/NCSD
+0x100 string NCSD
+>0x118 lequad 0 Nintendo 3DS Game Card image
+>>0x1000 use nintendo-3ds-NCCH
+>>0x18D byte 0 (inner device)
+>>0x18D byte 1 (Card1)
+>>0x18D byte 2 (Card2)
+>>0x18D byte 3 (extended device)
+>0x118 bequad 0x0102020202000000 Nintendo 3DS eMMC dump (Old3DS)
+>0x118 bequad 0x0102020203000000 Nintendo 3DS eMMC dump (New3DS)
+
+# Type: Nintendo 3DS "NCCH" container.
+# https://www.3dbrew.org/wiki/NCCH
+0x100 string NCCH Nintendo 3DS
+>0x18D byte&2 0 File Archive (CFA)
+>0x18D byte&2 2 Executable Image (CXI)
+>0 use nintendo-3ds-NCCH
+
+# Type: Nintendo 3DS "SMDH" file. (application description)
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: https://3dbrew.org/wiki/SMDH
+0 string SMDH Nintendo 3DS SMDH file
+>0x208 leshort !0
+>>0x208 lestring16 x \b: "%.128s"
+>>0x388 leshort !0
+>>>0x388 lestring16 x by %.128s
+>0x208 leshort 0
+>>0x008 leshort !0
+>>>0x008 lestring16 x \b: "%.128s"
+>>>0x188 leshort !0
+>>>>0x188 lestring16 x by %.128s
+
+# Type: Nintendo 3DS Homebrew Application.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Refernece: https://3dbrew.org/wiki/3DSX_Format
+0 string 3DSX Nintendo 3DS Homebrew Application (3DSX)
+
+#------------------------------------------------------------------------------
+# a7800: file(1) magic for the Atari 7800 raw ROM format.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: https://sites.google.com/site/atari7800wiki/a78-header
+
+0 byte >0
+>0 byte <3
+>>1 string ATARI7800 Atari 7800 ROM image
+>>>0x11 string >\0 \b: "%.32s"
+# Display type.
+>>>0x39 byte 0 (NTSC)
+>>>0x39 byte 1 (PAL)
+>>>0x36 byte&1 1 (POKEY)
+
+#------------------------------------------------------------------------------
+# vectrex: file(1) magic for the GCE Vectrex raw ROM format.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# Reference: http://www.playvectrex.com/designit/chrissalo/hello1.htm
+#
+# NOTE: Title is terminated with 0x80, not 0.
+# The header is terminated with a 0, so that will
+# terminate the title as well.
+#
+0 string g\ GCE Vectrex ROM image
+>0x11 string >\0 \b: "%.16s"
diff --git a/contrib/file/magic/Magdir/database b/contrib/file/magic/Magdir/database
index f39acfda..e5cde8a 100644
--- a/contrib/file/magic/Magdir/database
+++ b/contrib/file/magic/Magdir/database
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: database,v 1.45 2015/09/09 16:25:29 christos Exp $
+# $File: database,v 1.48 2016/04/14 20:34:28 christos Exp $
# database: file(1) magic for various databases
#
# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
@@ -377,7 +377,10 @@
>>>>>>>>>>>>0 use dbase3-memo-print
# dBASE IV DBT with positive block size
>>>>>>>20 uleshort >0
->>>>>>>>0 use dbase4-memo-print
+# dBASE IV DBT with valid block length like 512, 1024
+# multiple of 2 in between 16 and 16 K ,implies upper and lower bits are zero
+>>>>>>>>20 uleshort&0x800f 0
+>>>>>>>>>0 use dbase4-memo-print
# Print the information of dBase III DBT memo file
0 name dbase3-memo-print
@@ -395,6 +398,8 @@
# Print the information of dBase IV DBT memo file
0 name dbase4-memo-print
>0 lelong x dBase IV DBT
+!:mime application/x-dbt
+!:ext dbt
# 8 character shorted main name of coresponding dBASE IV DBF file
>8 ubelong >0x20000000
# skip unusual like for angest.dbt
@@ -455,6 +460,52 @@
4 string Standard\ ACE\ DB Microsoft Access Database
!:mime application/x-msaccess
+# From: Joerg Jenderek
+# URL: http://fileformats.archiveteam.org/wiki/Extensible_Storage_Engine
+# Reference: https://github.com/libyal/libesedb/archive/master.zip
+# libesedb-master/documentation/
+# Extensible Storage Engine (ESE) Database File (EDB) format.asciidoc
+# Note: also known as "JET Blue". Used by numerous Windows components such as
+# Windows Search, Mail, Exchange and Active Directory.
+4 ubelong 0xefcdab89
+# unknown1
+>132 ubelong 0 Extensible storage engine
+!:mime application/x-ms-ese
+# file_type 0~database 1~stream
+>>12 ulelong 0 DataBase
+# Security DataBase (sdb)
+!:ext edb/sdb
+>>12 ulelong 1 STreaMing
+!:ext stm
+# format_version 620h
+>>8 uleshort x \b, version 0x%x
+>>10 uleshort >0 revision 0x%4.4x
+>>0 ubelong x \b, checksum 0x%8.8x
+# Page size 4096 8192 32768
+>>236 ulequad x \b, page size %lld
+# database_state
+>>52 ulelong 1 \b, JustCreated
+>>52 ulelong 2 \b, DirtyShutdown
+#>>52 ulelong 3 \b, CleanShutdown
+>>52 ulelong 4 \b, BeingConverted
+>>52 ulelong 5 \b, ForceDetach
+# Windows NT major version when the databases indexes were updated.
+>>216 ulelong x \b, Windows version %d
+# Windows NT minor version
+>>220 ulelong x \b.%d
+
+# From: Joerg Jenderek
+# URL: http://forensicswiki.org/wiki/Windows_Application_Compatibility
+# Note: files contain application compatibility fixes, application compatibility modes and application help messages.
+8 string sdbf
+>7 ubyte 0
+# TAG_TYPE_LIST+TAG_INDEXES
+>>12 uleshort 0x7802 Windows application compatibility Shim DataBase
+# version? 2 3
+#>>>0 ulelong x \b, version %d
+!:mime application/x-ms-sdb
+!:ext sdb
+
# TDB database from Samba et al - Martin Pool <mbp@samba.org>
0 string TDB\ file TDB database
>32 lelong 0x2601196D version 6, little-endian
@@ -545,3 +596,18 @@
# Hopper (reverse engineering tool) http://www.hopperapp.com/
0 string hopperdb Hopper database
+# URL: https://en.wikipedia.org/wiki/Panorama_(database_engine)
+# Reference: http://www.provue.com/Panorama/
+# From: Joerg Jenderek
+# NOTE: test only versions 4 and 6.0 with Windows
+# length of Panorama database name
+5 ubyte >0
+# look after database name for "some" null bits
+>(5.B+7) ubelong&0xF3ffF000 0
+# look for first keyword
+>>&1 search/2 DESIGN Panorama database
+#!:mime application/x-panorama-database
+!:apple KASXZEPD
+!:ext pan
+# database name
+>>>5 pstring x \b, "%s"
diff --git a/contrib/file/magic/Magdir/der b/contrib/file/magic/Magdir/der
new file mode 100644
index 0000000..abfbf9b
--- /dev/null
+++ b/contrib/file/magic/Magdir/der
@@ -0,0 +1,116 @@
+#------------------------------------------------------------------------------
+# $File: der,v 1.1 2016/01/19 15:07:45 christos Exp $
+# der: file(1) magic for DER encoded files
+#
+
+# Certificate information piece
+0 name certinfo
+>0 der seq
+>>&0 der set
+>>>&0 der seq
+>>>>&0 der obj_id3=550406
+>>>>&0 der prt_str=x \b, countryName=%s
+>>&0 der set
+>>>&0 der seq
+>>>>&0 der obj_id3=550408
+>>>>&0 der utf8_str=x \b, stateOrProvinceName=%s
+>>&0 der set
+>>>&0 der seq
+>>>>&0 der obj_id3=55040a
+>>>>&0 der utf8_str=x \b, organizationName=%s
+>>&0 der set
+>>>&0 der seq
+>>>>&0 der obj_id3=550403
+>>>>&0 der utf8_str=x \b, commonName=%s
+>>&0 der seq
+
+# Certificate requests
+0 der seq
+>&0 der seq
+>>&0 der int1=00 DER Encoded Certificate request
+>>&0 use certinfo
+
+# Key Pairs
+0 der seq
+>&0 der int1=00
+>&0 der int65=x
+>&0 der int3=010001 DER Encoded Key Pair, 512 bits
+
+0 der seq
+>&0 der int1=00
+>&0 der int129=x
+>&0 der int3=010001 DER Encoded Key Pair, 1024 bits
+
+0 der seq
+>&0 der int1=00
+>&0 der int257=x
+>&0 der int3=010001 DER Encoded Key Pair, 2048 bits
+
+0 der seq
+>&0 der int1=00
+>&0 der int513=x
+>&0 der int3=010001 DER Encoded Key Pair, 4096 bits
+
+0 der seq
+>&0 der int1=00
+>&0 der int1025=x
+>&0 der int3=010001 DER Encoded Key Pair, 8192 bits
+
+0 der seq
+>&0 der int1=00
+>&0 der int2049=x
+>&0 der int3=010001 DER Encoded Key Pair, 16k bits
+
+0 der seq
+>&0 der int1=00
+>&0 der int4097=x
+>&0 der int3=010001 DER Encoded Key Pair, 32k bits
+
+# Certificates
+0 der seq
+>&0 der seq
+>>&0 der int2=0dfa DER Encoded Certificate, 512 bits
+>>&0 der int2=0dfb DER Encoded Certificate, 1024 bits
+>>&0 der int2=0dfc DER Encoded Certificate, 2048 bits
+>>&0 der int2=0dfd DER Encoded Certificate, 4096 bits
+>>&0 der int2=0dfe DER Encoded Certificate, 8192 bits
+>>&0 der int2=0dff DER Encoded Certificate, 16k bits
+>>&0 der int2=0e04 DER Encoded Certificate, 32k bits
+>>&0 der int2=x DER Encoded Certificate, ? bits (%s)
+>>&0 der seq
+>>>&0 der obj_id9=2a864886f70d010105 \b, sha1WithRSAEncryption
+>>>&0 der obj_id9=x \b, ? Encryption (%s)
+>>>&0 der null
+>>&0 der seq
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id3=550406
+>>>>>&0 der prt_str=x \b, countryName=%s
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id3=550408
+>>>>>&0 der prt_str=x \b, stateOrProvinceName=%s
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id3=550407
+>>>>>&0 der prt_str=x \b, localityName=%s
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id3=55040a
+>>>>>&0 der prt_str=x \b, organizationName=%s
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id3=55040b
+>>>>>&0 der prt_str=x \b, organizationUnitName=%s
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id3=550403
+>>>>>&0 der prt_str=x \b, commonName=%s
+>>>&0 der set
+>>>>&0 der seq
+>>>>>&0 der obj_id9=2a864886f70d010901
+>>>>>&0 der ia5_str=x \b, emailAddress=%s
+>>&0 der seq
+>>>&0 der utc_time=x \b, utcTime=%s
+>>>&0 der utc_time=x \b, utcTime=%s
+>>&0 use certinfo
diff --git a/contrib/file/magic/Magdir/filesystems b/contrib/file/magic/Magdir/filesystems
index 87c067e..e950873 100644
--- a/contrib/file/magic/Magdir/filesystems
+++ b/contrib/file/magic/Magdir/filesystems
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: filesystems,v 1.111 2015/09/09 16:26:54 christos Exp $
+# $File: filesystems,v 1.113 2016/02/14 14:38:24 christos Exp $
# filesystems: file(1) magic for different filesystems
#
0 name partid
@@ -1738,28 +1738,30 @@
>0x402 beshort < 100
>0x402 beshort > -1 Minix filesystem, V1, 30 char names (big endian), %d zones
>0x1e string minix \b, bootable
-0x410 leshort 0x2468
->0x402 beshort < 100
->>0x402 beshort > -1 Minix filesystem, V2, 14 char names
->0x1e string minix \b, bootable
-0x410 beshort 0x2468
->0x402 beshort < 100
->0x402 beshort > -1 Minix filesystem, V2 (big endian)
->0x1e string minix \b, bootable
-0x410 leshort 0x2478
->0x402 beshort < 100
->0x402 beshort > -1 Minix filesystem, V2, 30 char names
->0x1e string minix \b, bootable
-0x410 leshort 0x2478
->0x402 beshort < 100
->0x402 beshort > -1 Minix filesystem, V2, 30 char names
->0x1e string minix \b, bootable
-0x410 beshort 0x2478
->0x402 beshort !0 Minix filesystem, V2, 30 char names (big endian)
->0x1e string minix \b, bootable
-0x418 leshort 0x4d5a
->0x402 beshort <100
->>0x402 beshort > -1 Minix filesystem, V3, 60 char names
+# Weak Magic: this is $x
+#0x410 leshort 0x2468
+#>0x402 beshort < 100
+#>>0x402 beshort > -1 Minix filesystem, V2, 14 char names
+#>0x1e string minix \b, bootable
+#0x410 beshort 0x2468
+#>0x402 beshort < 100
+#>0x402 beshort > -1 Minix filesystem, V2 (big endian)
+#>0x1e string minix \b, bootable
+#0x410 leshort 0x2478
+#>0x402 beshort < 100
+#>0x402 beshort > -1 Minix filesystem, V2, 30 char names
+#>0x1e string minix \b, bootable
+#0x410 leshort 0x2478
+#>0x402 beshort < 100
+#>0x402 beshort > -1 Minix filesystem, V2, 30 char names
+#>0x1e string minix \b, bootable
+#0x410 beshort 0x2478
+#>0x402 beshort !0 Minix filesystem, V2, 30 char names (big endian)
+#>0x1e string minix \b, bootable
+# Weak Magic! this is MD
+#0x418 leshort 0x4d5a
+#>0x402 beshort <100
+#>>0x402 beshort > -1 Minix filesystem, V3, 60 char names
# SGI disk labels - Nathan Scott <nathans@debian.org>
0 belong 0x0BE5A941 SGI disk label (volume header)
@@ -2214,12 +2216,12 @@
>0x10090 lelong x sectorsize %d,
>0x10094 lelong x nodesize %d,
>0x10098 lelong x leafsize %d,
->0x10020 belong x UUID=%8x-
->0x10024 beshort x \b%4x-
->0x10026 beshort x \b%4x-
->0x10028 beshort x \b%4x-
->0x1002a beshort x \b%4x
->0x1002c belong x \b%8x,
+>0x10020 belong x UUID=%08x-
+>0x10024 beshort x \b%04x-
+>0x10026 beshort x \b%04x-
+>0x10028 beshort x \b%04x-
+>0x1002a beshort x \b%04x
+>0x1002c belong x \b%08x,
>0x10078 lequad x %lld/
>0x10070 lequad x \b%lld bytes used,
>0x10088 lequad x %lld devices
diff --git a/contrib/file/magic/Magdir/finger b/contrib/file/magic/Magdir/finger
new file mode 100644
index 0000000..d8611f6
--- /dev/null
+++ b/contrib/file/magic/Magdir/finger
@@ -0,0 +1,16 @@
+
+#------------------------------------------------------------------------------
+# $File: finger,v 1.2 2015/10/07 02:37:57 christos Exp $
+# fingerprint: file(1) magic for fingerprint data
+# XPM bitmaps)
+#
+
+# http://cgit.freedesktop.org/libfprint/libfprint/tree/libfprint/data.c
+
+0 string FP1 libfprint fingerprint data V1
+>3 beshort x \b, driver_id %x
+>5 belong x \b, devtype %x
+
+0 string FP2 libfprint fingerprint data V2
+>3 beshort x \b, driver_id %x
+>5 belong x \b, devtype %x
diff --git a/contrib/file/magic/Magdir/flif b/contrib/file/magic/Magdir/flif
new file mode 100644
index 0000000..9406208
--- /dev/null
+++ b/contrib/file/magic/Magdir/flif
@@ -0,0 +1,36 @@
+
+#------------------------------------------------------------------------------
+# $File: flif,v 1.1 2015/11/23 22:04:36 christos Exp $
+# flif: Magic data for file(1) command.
+# FLIF (Free Lossless Image Format)
+
+0 string FLIF FLIF
+>4 string <H image data
+>>6 beshort x \b, %u
+>>8 beshort x \bx%u
+>>5 string 1 \b, 8-bit/color,
+>>5 string 2 \b, 16-bit/color,
+>>4 string 1 \b, grayscale, non-interlaced
+>>4 string 3 \b, RGB, non-interlaced
+>>4 string 4 \b, RGBA, non-interlaced
+>>4 string A \b, grayscale
+>>4 string C \b, RGB, interlaced
+>>4 string D \b, RGBA, interlaced
+>4 string >H \b, animation data
+>>5 ubyte <255 \b, %i frames
+>>>7 beshort x \b, %u
+>>>9 beshort x \bx%u
+>>>6 string =1 \b, 8-bit/color
+>>>6 string =2 \b, 16-bit/color
+>>5 ubyte 0xFF
+>>>6 beshort x \b, %i frames,
+>>>9 beshort x \b, %u
+>>>11 beshort x \bx%u
+>>>8 string =1 \b, 8-bit/color
+>>>8 string =2 \b, 16-bit/color
+>>4 string =Q \b, grayscale, non-interlaced
+>>4 string =S \b, RGB, non-interlaced
+>>4 string =T \b, RGBA, non-interlaced
+>>4 string =a \b, grayscale
+>>4 string =c \b, RGB, interlaced
+>>4 string =d \b, RGBA, interlaced
diff --git a/contrib/file/magic/Magdir/fonts b/contrib/file/magic/Magdir/fonts
index 4b3173c..41899fb 100644
--- a/contrib/file/magic/Magdir/fonts
+++ b/contrib/file/magic/Magdir/fonts
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: fonts,v 1.27 2014/04/30 21:41:02 christos Exp $
+# $File: fonts,v 1.30 2016/03/22 22:27:47 christos Exp $
# fonts: file(1) magic for font data
#
0 search/1 FONT ASCII vfont text
@@ -29,6 +29,25 @@
# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
0 search/1 STARTFONT\ X11 BDF font text
+# From: Joerg Jenderek
+# URL: http://grub.gibibit.com/New_font_format
+# Reference: util/grub-mkfont.c
+# include/grub/fontformat.h
+# FONT_FORMAT_SECTION_NAMES_FILE
+0 string FILE
+# FONT_FORMAT_PFF2_MAGIC
+>8 string PFF2
+# leng 4 only at the moment
+>>4 ubelong 4
+# FONT_FORMAT_SECTION_NAMES_FONT_NAME
+>>>12 string NAME GRUB2 font
+!:mime application/x-font-pf2
+!:ext pf2
+# length of font_name
+>>>>16 ubelong >0
+# font_name
+>>>>>20 string >\0 "%-s"
+
# X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com)
# PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
0 string \001fcp X11 Portable Compiled Font data
@@ -58,8 +77,11 @@
4098 string DOSFONT DOSFONT2 encrypted font data
# downloadable fonts for browser (prints type) anthon@mnt.org
-0 string PFR1 PFR1 font
+# https://tools.ietf.org/html/rfc3073
+0 string PFR1 Portable Font Resource font data (new)
>102 string >0 \b: %s
+0 string PFR0 Portable Font Resource font data (old)
+>4 beshort >0 version %d
# True Type fonts
0 string \000\001\000\000\000 TrueType font data
@@ -92,9 +114,25 @@
!:mime application/vnd.ms-fontobject
# Web Open Font Format (.woff)
+0 name woff
+>4 belong 0x00010000 \b, TrueType
+>4 belong 0x4F54544F \b, CFF
+>4 belong 0x74727565 \b, TrueType
+>4 default x
+>>4 belong x \b, flavor %d
+>8 belong x \b, length %d
+#>12 beshort x \b, numTables %d
+#>14 beshort x \b, reserved %d
+#>16 belong x \b, totalSfntSize %d
+
# http://www.w3.org/TR/WOFF/
0 string wOFF Web Open Font Format
->4 belong x \b, flavor %d
->8 belong x \b, length %d
+>0 use woff
>20 beshort x \b, version %d
>22 beshort x \b.%d
+# http://www.w3.org/TR/WOFF2/
+0 string wOF2 Web Open Font Format (Version 2)
+>0 use woff
+#>20 belong x \b, totalCompressedSize %d
+>24 beshort x \b, version %d
+>26 beshort x \b.%d
diff --git a/contrib/file/magic/Magdir/fortran b/contrib/file/magic/Magdir/fortran
index 826e912..6abc2f7 100644
--- a/contrib/file/magic/Magdir/fortran
+++ b/contrib/file/magic/Magdir/fortran
@@ -1,7 +1,9 @@
#------------------------------------------------------------------------------
-# $File: fortran,v 1.9 2015/06/17 19:55:27 christos Exp $
+# $File: fortran,v 1.10 2015/11/05 18:47:16 christos Exp $
# FORTRAN source
-0 regex/100l \^[Cc][\ \t] FORTRAN program text
+# Check that the first 100 lines start with C or whitespace first.
+0 regex/100l !\^[^Cc\ \t].*$
+>0 regex/100l \^[Cc][\ \t] FORTRAN program text
!:mime text/x-fortran
!:strength - 5
diff --git a/contrib/file/magic/Magdir/hitachi-sh b/contrib/file/magic/Magdir/hitachi-sh
index 213d2d6..1b615ae 100644
--- a/contrib/file/magic/Magdir/hitachi-sh
+++ b/contrib/file/magic/Magdir/hitachi-sh
@@ -1,22 +1,28 @@
#------------------------------------------------------------------------------
-# $File: hitachi-sh,v 1.6 2013/01/29 19:31:33 christos Exp $
+# $File: hitachi-sh,v 1.7 2015/09/30 20:32:35 christos Exp $
# hitach-sh: file(1) magic for Hitachi Super-H
#
# Super-H COFF
#
+# updated by Joerg Jenderek at Oct 2015
+# https://en.wikipedia.org/wiki/COFF
+# https://de.wikipedia.org/wiki/Common_Object_File_Format
+# http://www.delorie.com/djgpp/doc/coff/filhdr.html
# below test line conflicts with 2nd NTFS filesystem sector
-0 beshort 0x0500 Hitachi SH big-endian COFF
# 2nd NTFS filesystem sector often starts with 0x05004e00 for unicode string 5 NTLDR
-#0 ubelong&0xFFFFNMPQ 0x0500NMPQ Hitachi SH big-endian COFF
->18 beshort&0x0002 =0x0000 object
->18 beshort&0x0002 =0x0002 executable
->18 beshort&0x0008 =0x0008 \b, stripped
->18 beshort&0x0008 =0x0000 \b, not stripped
-#
-0 leshort 0x0550 Hitachi SH little-endian COFF
->18 leshort&0x0002 =0x0000 object
->18 leshort&0x0002 =0x0002 executable
->18 leshort&0x0008 =0x0008 \b, stripped
->18 leshort&0x0008 =0x0000 \b, not stripped
+# and Portable Gaming Notation Compressed format (*.WID http://pgn.freeservers.com/)
+0 beshort 0x0500
+# test for unused flag bits (0x8000,0x0800,0x0400,0x0200,x0080) in f_flags
+>18 ubeshort&0x8E80 0
+# use big endian variant of subroutine to display name+variables+flags
+# for common object formated files
+>>0 use \^display-coff
+
+0 leshort 0x0550
+# test for unused flag bits in f_flags
+>18 uleshort&0x8E80 0
+# use little endian variant of subroutine to
+# display name+variables+flags for common object formated files
+>>0 use display-coff
diff --git a/contrib/file/magic/Magdir/images b/contrib/file/magic/Magdir/images
index a3ac70b..d084da7 100644
--- a/contrib/file/magic/Magdir/images
+++ b/contrib/file/magic/Magdir/images
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: images,v 1.107 2015/07/11 14:40:10 christos Exp $
+# $File: images,v 1.116 2016/03/23 15:29:20 christos Exp $
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
# XPM bitmaps)
#
@@ -12,26 +12,155 @@
# Targa - matches `povray', `ppmtotga' and `xv' outputs
# by Philippe De Muyter <phdm@macqel.be>
+# URL: http://justsolve.archiveteam.org/wiki/TGA
+# Reference: http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
+# Update: Joerg Jenderek
# at 2, byte ImgType must be 1, 2, 3, 9, 10 or 11
+# ,32 or 33 (both not observed)
# at 1, byte CoMapType must be 1 if ImgType is 1 or 9, 0 otherwise
+# or theoretically 2-128 reserved for use by Truevision or 128-255 may be used for developer applications
# at 3, leshort Index is 0 for povray, ppmtotga and xv outputs
# `xv' recognizes only a subset of the following (RGB with pixelsize = 24)
# `tgatoppm' recognizes a superset (Index may be anything)
-1 belong&0xfff7ffff 0x01010000 Targa image data - Map
-!:strength + 2
->2 byte&8 8 - RLE
->12 leshort >0 %d x
->14 leshort >0 %d
-1 belong&0xfff7ffff 0x00020000 Targa image data - RGB
-!:strength + 2
->2 byte&8 8 - RLE
->12 leshort >0 %d x
->14 leshort >0 %d
-1 belong&0xfff7ffff 0x00030000 Targa image data - Mono
-!:strength + 2
->2 byte&8 8 - RLE
->12 leshort >0 %d x
->14 leshort >0 %d
+#
+# test of Color Map Type 0~no 1~color map
+# and Image Type 1 2 3 9 10 11 32 33
+# and Color Map Entry Size 0 15 16 24 32
+0 ubequad&0x00FeC400000000C0 0
+# skip more garbage by looking for positive image type
+>2 ubyte >0
+# skip some compiled terminfo by looking for image type less equal 33
+>>2 ubyte <34
+# skip arches.3200 , Finder.Root , Slp.1 by looking for low pixel sizes 15 16 24 32
+>>>16 ubyte <33
+# skip more by looking for pixel size 0Fh 10h 18h 20h
+>>>>16 ubyte&0xC0 0x00
+# skip 260-16.ico by looking for no color map
+>>>>>1 ubyte 0
+# implies no first map entry
+>>>>>>3 uleshort 0
+>>>>>>>0 use tga-image
+# Color Map
+>>>>>1 ubyte >0
+>>>>>>0 use tga-image
+# display tga bitmap image information
+0 name tga-image
+>2 ubyte <34 Targa image data
+!:mime image/x-tga
+!:apple ????TPIC
+# normal extension .tga but some Truevision products used others:
+# tpic (Apple),icb (Image Capture Board),vda (Video Display Adapter),vst (NuVista),win (UNSURE about that)
+!:ext tga/tpic/icb/vda/vst
+# image type 1 2 3 9 10 11 32 33
+>2 ubyte&0xF7 1 - Map
+>2 ubyte&0xF7 2 - RGB
+# alpha channel
+>>17 ubyte&0x0F >0 \bA
+>2 ubyte&0xF7 3 - Mono
+# type not found, but by http://www.fileformat.info/format/tga/corion.htm
+# Compressed color-mapped data, using Huffman, Delta, and runlength encoding
+>2 ubyte 32 - Color
+# Compressed color-mapped data, using Huffman, Delta, and RLE. 4-pass quadtree- type process
+>2 ubyte 33 - Color
+# Color Map Type 0~no 1~color map
+>1 ubyte 1 (
+# first color map entry, 0 normal
+>>3 uleshort >0 \b%d-
+# color map length 0 2 1dh 3bh d9h 100h
+>>5 uleshort x \b%d)
+# 8~run length encoding bit
+>2 ubyte&0x08 8 - RLE
+# gimp can create big pictures!
+>12 uleshort >0 %d x
+>12 uleshort =0 65536 x
+# image height. 0 interpreted as 65536
+>14 uleshort >0 %d
+>14 uleshort =0 65536
+# Image Pixel Size 15 16 24 32
+>16 ubyte x x %d
+# X origin of image. 0 normal
+>8 uleshort >0 +%d
+# Y origin of image. 0 normal; positive for top
+>10 uleshort >0 +%d
+# Image descriptor: bits 3-0 give the alpha channel depth, bits 5-4 give direction
+>17 ubyte&0x0F >0 - %d-bit alpha
+# bits 5-4 give direction. normal bottom left
+>17 ubyte &0x20 - top
+#>17 ubyte ^0x20 - bottom
+>17 ubyte &0x10 - right
+#>17 ubyte ^0x10 - left
+# some info say other bits 6-7 should be zero
+# but data storage interleave by http://www.fileformat.info/format/tga/corion.htm
+# 00 - no interleave;01 - even/odd interleave; 10 - four way interleave; 11 - reserved
+#>17 ubyte&0xC0 0x00 - no interleave
+>17 ubyte&0xC0 0x40 - interleave
+>17 ubyte&0xC0 0x80 - four way interleave
+>17 ubyte&0xC0 0xC0 - reserved
+# positive length implies identification field
+>0 ubyte >0
+>>18 string x "%s"
+# last 18 bytes of newer tga file footer signature
+>18 search/4261301/s TRUEVISION-XFILE.\0
+# extension area offset if not 0
+>>&-8 ulelong >0
+# length of the extension area. normal 495 for version 2.0
+>>>(&-4.l) uleshort 0x01EF
+# AuthorName[41]
+>>>>&0 string >\0 - author "%-.40s"
+# Comment[324]=4 * 80 null terminated
+>>>>&41 string >\0 - comment "%-.80s"
+# date
+>>>>&365 ubequad&0xffffFFFFffff0000 !0
+# Day
+>>>>>&-6 uleshort x %d
+# Month
+>>>>>&-8 uleshort x \b-%d
+# Year
+>>>>>&-4 uleshort x \b-%d
+# time
+>>>>&371 ubequad&0xffffFFFFffff0000 !0
+# hour
+>>>>>&-8 uleshort x %d
+# minutes
+>>>>>&-6 uleshort x \b:%.2d
+# second
+>>>>>&-4 uleshort x \b:%.2d
+# JobName[41]
+>>>>&377 string >\0 - job "%-.40s"
+# JobHour Jobminute Jobsecond
+>>>>&418 ubequad&0xffffFFFFffff0000 !0
+>>>>>&-8 uleshort x %d
+>>>>>&-6 uleshort x \b:%.2d
+>>>>>&-4 uleshort x \b:%.2d
+# SoftwareId[41]
+>>>>&424 string >\0 - %-.40s
+# SoftwareVersionNumber
+>>>>&424 ubyte >0
+>>>>>&40 uleshort/100 x %d
+>>>>>&40 uleshort%100 x \b.%d
+# VersionLetter
+>>>>>&42 ubyte >0x20 \b%c
+# KeyColor
+>>>>&468 ulelong >0 - keycolor 0x%8.8x
+# Denominator of Pixel ratio. 0~no pixel aspect
+>>>>&474 uleshort >0
+# Numerator
+>>>>>&-4 uleshort >0 - aspect %d
+>>>>>&-2 uleshort x \b/%d
+# Denominator of Gamma ratio. 0~no Gamma value
+>>>>&478 uleshort >0
+# Numerator
+>>>>>&-4 uleshort >0 - gamma %d
+>>>>>&-2 uleshort x \b/%d
+# ColorOffset
+#>>>>&480 ulelong x - col offset 0x%8.8x
+# StampOffset
+#>>>>&484 ulelong x - stamp offset 0x%8.8x
+# ScanOffset
+#>>>>&488 ulelong x - scan offset 0x%8.8x
+# AttributesType
+#>>>>&492 ubyte x - Attributes 0x%x
+## EndOfTGA
# PBMPLUS images
# The next byte following the magic is always whitespace.
@@ -545,8 +674,12 @@
0 beshort 0x1010 PEX Binary Archive
# DICOM medical imaging data
+# URL: https://en.wikipedia.org/wiki/DICOM#Data_format
+# Note: "dcm" is the official file name extension
+# XnView mention also "dc3" and "acr" as file name extension
128 string DICM DICOM medical imaging data
!:mime application/dicom
+!:ext dcm/dicom/dic
# XWD - X Window Dump file.
# As described in /usr/X11R6/include/X11/XWDFile.h
@@ -686,6 +819,7 @@
# GEM Image: Version 1, Headerlen 8 (Wolfram Kleff)
# Format variations from: Bernd Nuernberger <bernd.nuernberger@web.de>
+# Update: Joerg Jenderek
# See http://fileformats.archiveteam.org/wiki/GEM_Raster
# For variations, also see:
# http://www.seasip.info/Gem/ff_img.html (Ventura)
@@ -693,23 +827,59 @@
# http://www.fileformat.info/format/gemraster/spec/index.htm (XIMG, STTT)
# http://sylvana.net/1stguide/1STGUIDE.ENG (TIMG)
0 beshort 0x0001
->2 beshort 0x0008 GEM Image data
+# header_size
+>2 beshort 0x0008
+>>0 use gem_info
+>2 beshort 0x0009
+>>0 use gem_info
+# no example for NOSIG
+>2 beshort 24
>>0 use gem_info
->2 beshort 0x0009 GEM Image data (Ventura)
+# no example for HYPERPAINT
+>2 beshort 25
>>0 use gem_info
-16 string XIMG\0 GEM XIMG Image data
+16 string XIMG\0
>0 use gem_info
-16 string STTT\0\x10 GEM STTT Image data
+# no example
+16 string STTT\0\x10
>0 use gem_info
-16 string TIMG\0 GEM TIMG Image data
+# no example or description
+16 string TIMG\0
>0 use gem_info
0 name gem_info
->12 beshort x %d x
->14 beshort x %d,
->4 beshort x %d planes,
->8 beshort x %d x
->10 beshort x %d pixelsize
+# version is 2 for some XIMG and 1 for all others
+>0 beshort <0x0003 GEM
+# http://www.snowstone.org.uk/riscos/mimeman/mimemap.txt
+!:mime image/x-gem
+# header_size 24 25 27 59 779 words for colored bitmaps
+>>2 beshort >9
+>>>16 string STTT\0\x10 STTT
+>>>16 string TIMG\0 TIMG
+# HYPERPAINT or NOSIG variant
+>>>16 string \0\x80
+>>>>2 beshort =24 NOSIG
+>>>>2 beshort !24 HYPERPAINT
+# NOSIG or XIMG variant
+>>>16 default x
+>>>>16 string !XIMG\0 NOSIG
+>>16 string =XIMG\0 XIMG Image data
+!:ext img/ximg
+# to avoid Warning: Current entry does not yet have a description for adding a EXTENSION type
+>>16 string !XIMG\0 Image data
+!:ext img
+# header_size is 9 for Ventura files and 8 for other GEM Paint files
+>>2 beshort 9 (Ventura)
+#>>2 beshort 8 (Paint)
+>>12 beshort x %d x
+>>14 beshort x %d,
+# 1 4 8
+>>4 beshort x %d planes,
+# in tenths of a millimetre
+>>8 beshort x %d x
+>>10 beshort x %d pixelsize
+# pattern_size 1-8. 2 for GEM Paint
+>>6 beshort !2 \b, pattern size %d
# GEM Metafile (Wolfram Kleff)
0 lelong 0x0018FFFF GEM Metafile data
@@ -998,7 +1168,22 @@
!:mime image/x-polar-monitor-bitmap
# From: Rick Richardson <rickrich@gmail.com>
+# updated by: Joerg Jenderek
+# URL: http://techmods.net/nuvi/
0 string GARMIN\ BITMAP\ 01 Garmin Bitmap file
+# extension is also used for
+# Sony SRF raw image (image/x-sony-srf)
+# SRF map
+# Terragen Surface Map (http://www.planetside.co.uk/terragen)
+# FileLocator Pro search criteria file (http://www.mythicsoft.com/filelocatorpro)
+!:ext srf
+#!:mime image/x-garmin-srf
+# version 1.00,2.00,2.10,2.40,2.50
+>0x2f string >0 \b, version %4.4s
+# width (2880,2881,3240)
+>0x55 uleshort >0 \b, %dx
+# height (80,90)
+>>0x53 uleshort x \b%d
# Type: Ulead Photo Explorer5 (.pe5)
# URL: http://www.jisyo.com/cgibin/view.cgi?EXT=pe5 (Japanese)
@@ -1120,3 +1305,143 @@
#
0 string \x42\x50\x47\xFB BPG (Better Portable Graphics)
!:mime image/bpg
+
+# From: Joerg Jenderek
+# URL: https://en.wikipedia.org/wiki/Apple_Icon_Image_format
+0 string icns Mac OS X icon
+!:mime image/x-icns
+!:apple ????icns
+!:ext icns
+>4 ubelong >0
+# file size
+>>4 ubelong x \b, %d bytes
+# icon type
+>>8 string x \b, "%4.4s" type
+
+# TIM images
+0 lelong 0x00000010 TIM image,
+>4 lelong 0x8 4-Bit,
+>4 lelong 0x9 8-Bit,
+>4 lelong 0x2 15-Bit,
+>4 lelong 0x3 24-Bit,
+>4 lelong &8
+>>(8.l+12) leshort x Pixel at (%d,
+>>(8.l+14) leshort x \b%d)
+>>(8.l+16) leshort x Size=%dx
+>>(8.l+18) leshort x \b%d,
+>>4 lelong 0x8 16 CLUT Entries at
+>>4 lelong 0x9 256 CLUT Entries at
+>>12 leshort x (%d,
+>>14 leshort x \b%d)
+>4 lelong ^8
+>>12 leshort x Pixel at (%d,
+>>14 leshort x \b%d)
+>>16 leshort x Size=%dx
+>>18 leshort x \b%d
+
+# MDEC streams
+0 lelong 0x80010160 MDEC video stream,
+>16 leshort x %dx
+>18 leshort x \b%d
+#>8 lelong x %d frames
+#>4 leshort x secCount=%d;
+#>6 leshort x nSectors=%d;
+#>12 lelong x frameSize=%d;
+
+# BS encoded bitstreams
+2 leshort 0x3800 BS image,
+>6 leshort x Version %d,
+>4 leshort x Quantization %d,
+>0 leshort x (Decompresses to %d words)
+
+# Type: farbfeld image.
+# Url: http://tools.suckless.org/farbfeld/
+# From: Ian D. Scott <ian@iandouglasscott.com>
+#
+0 string farbfeld farbfeld image data,
+>8 ubelong x %dx
+>12 ubelong x \b%d
+
+# Type: Sega PVR image.
+# From: David Korth <gerbilsoft@gerbilsoft.com>
+# References:
+# - http://fabiensanglard.net/Mykaruga/tools/segaPVRFormat.txt
+# - https://github.com/yazgoo/pvrx2png
+# - https://github.com/nickworonekin/puyotools
+
+# Sega PVR header.
+0 name sega-pvr-image-header
+>0x0C leshort x %d x
+>0x0E leshort x %d
+# Image format.
+>0x08 byte 0 \b, ARGB1555
+>0x08 byte 1 \b, RGB565
+>0x08 byte 2 \b, ARGB4444
+>0x08 byte 3 \b, YUV442
+>0x08 byte 4 \b, Bump
+>0x08 byte 5 \b, 4bpp
+>0x08 byte 6 \b, 8bpp
+# Image data type.
+>0x09 byte 0x01 \b, square twiddled
+>0x09 byte 0x02 \b, square twiddled & mipmap
+>0x09 byte 0x03 \b, VQ
+>0x09 byte 0x04 \b, VQ & mipmap
+>0x09 byte 0x05 \b, 8-bit CLUT twiddled
+>0x09 byte 0x06 \b, 4-bit CLUT twiddled
+>0x09 byte 0x07 \b, 8-bit direct twiddled
+>0x09 byte 0x08 \b, 4-bit direct twiddled
+>0x09 byte 0x09 \b, rectangle
+>0x09 byte 0x0B \b, rectangular stride
+>0x09 byte 0x0D \b, rectangular twiddled
+>0x09 byte 0x10 \b, small VQ
+>0x09 byte 0x11 \b, small VQ & mipmap
+>0x09 byte 0x12 \b, square twiddled & mipmap
+
+# Sega PVR (Xbox) image header.
+# Contains an embedded DirectDraw surface instead of PVR data.
+0 name sega-pvr-xbox-dds-header
+>16 lelong x %d x
+>12 lelong x %d,
+>84 string x %.4s
+
+# Sega PVR image.
+0 string PVRT
+>0x10 string DDS\040\174\000\000\000 Sega PVR (Xbox) image:
+>>0x20 use sega-pvr-xbox-dds-header
+>0x10 belong !0x44445320 Sega PVR image:
+>>0 use sega-pvr-image-header
+
+# Sega PVR image with GBIX.
+0 string GBIX
+>0x10 string PVRT
+>>0x10 string DDS\040\174\000\000\000 Sega PVR (Xbox) image:
+>>>0x20 use sega-pvr-xbox-dds-header
+>>0x10 belong !0x44445320 Sega PVR image:
+>>>0x10 use sega-pvr-image-header
+>>0x08 lelong x \b, global index = %u
+
+# Sega GVR header.
+0 name sega-gvr-image-header
+>0x0C beshort x %d x
+>0x0E beshort x %d
+# Image data format.
+>0x0B byte 0 \b, I4
+>0x0B byte 1 \b, I8
+>0x0B byte 2 \b, IA4
+>0x0B byte 3 \b, IA8
+>0x0B byte 4 \b, RGB565
+>0x0B byte 5 \b, RGB5A3
+>0x0B byte 6 \b, ARGB8888
+>0x0B byte 8 \b, CI4
+>0x0B byte 9 \b, CI8
+>0x0B byte 14 \b, DXT1
+
+# Sega GVR image.
+0 string GVRT Sega GVR image:
+>0x10 use sega-gvr-image-header
+
+# Sega GVR image with GBIX.
+0 string GBIX
+>0x10 string GVRT Sega GVR image:
+>>0x10 use sega-gvr-image-header
+>>0x08 belong x \b, global index = %u
diff --git a/contrib/file/magic/Magdir/intel b/contrib/file/magic/Magdir/intel
index 9fa90f4..3f96b75 100644
--- a/contrib/file/magic/Magdir/intel
+++ b/contrib/file/magic/Magdir/intel
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: intel,v 1.12 2014/04/30 21:41:02 christos Exp $
+# $File: intel,v 1.14 2015/11/10 00:13:27 christos Exp $
# intel: file(1) magic for x86 Unix
#
# Various flavors of x86 UNIX executable/object (other than Xenix, which
@@ -30,15 +30,27 @@
0 leshort =0522 iAPX 286 executable large model (COFF)
>12 lelong >0 not stripped
#>22 leshort >0 - version %d
+# updated by Joerg Jenderek at Oct 2015
+# https://de.wikipedia.org/wiki/Common_Object_File_Format
+# http://www.delorie.com/djgpp/doc/coff/filhdr.html
+# ./msdos (version 5.25) labeled the next entry as "MS Windows COFF Intel 80386 object file"
+# ./intel (version 5.25) label labeled the next entry as "80386 COFF executable"
# SGI labeled the next entry as "iAPX 386 executable" --Dan Quinlan
-0 leshort =0514 80386 COFF executable
->12 lelong >0 not stripped
->22 leshort >0 - version %d
+0 leshort =0514
+# use subroutine to display name+flags+variables for common object formated files
+>0 use display-coff
+#>12 lelong >0 not stripped
+# no hint found, that at offset 22 is version
+#>22 leshort >0 - version %d
# rom: file(1) magic for BIOS ROM Extensions found in intel machines
# mapped into memory between 0xC0000 and 0xFFFFF
# From Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu
+# updated by Joerg Jenderek
+# https://en.wikipedia.org/wiki/Option_ROM
0 beshort 0x55AA BIOS (ia32) ROM Ext.
+!:mime application/octet-stream
+!:ext rom/bin
>5 string USB USB
>7 string LDR UNDI image
>30 string IBM IBM comp. Video
diff --git a/contrib/file/magic/Magdir/java b/contrib/file/magic/Magdir/java
index b09302e..21acf29 100644
--- a/contrib/file/magic/Magdir/java
+++ b/contrib/file/magic/Magdir/java
@@ -1,6 +1,6 @@
#------------------------------------------------------------
-# $File: java,v 1.16 2013/09/24 20:22:03 christos Exp $
+# $File: java,v 1.18 2015/11/29 22:08:14 christos Exp $
# Java ByteCode and Mach-O binaries (e.g., Mac OS X) use the
# same magic number, 0xcafebabe, so they are both handled
# in the entry called "cafebabe".
@@ -16,5 +16,12 @@
!:mime application/x-java-jce-keystore
# Java source
-0 regex ^import.*;$ Java source
+0 regex \^import.*;$ Java source
!:mime text/x-java
+
+# Java HPROF dumps
+# https://java.net/downloads/heap-snapshot/hprof-binary-format.html
+0 string JAVA\x20PROFILE\x201.0.
+>0x12 short 0
+>>0x11 ushort-0x31 <2 Java HPROF dump,
+>>0x17 beqdate/1000 x created %s
diff --git a/contrib/file/magic/Magdir/lisp b/contrib/file/magic/Magdir/lisp
index 1109880..db0592e 100644
--- a/contrib/file/magic/Magdir/lisp
+++ b/contrib/file/magic/Magdir/lisp
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: lisp,v 1.23 2009/09/19 16:28:10 christos Exp $
+# $File: lisp,v 1.24 2015/11/30 20:54:26 christos Exp $
# lisp: file(1) magic for lisp programs
#
# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
@@ -26,16 +26,39 @@
0 search/4096 (custom-set-variables\ Lisp/Scheme program text
!:mime text/x-lisp
+# URL: https://en.wikipedia.org/wiki/Emacs_Lisp
+# Reference: http://ftp.gnu.org/old-gnu/emacs/elisp-manual-18-1.03.tar.gz
+# Update: Joerg Jenderek
# Emacs 18 - this is always correct, but not very magical.
-0 string \012( Emacs v18 byte-compiled Lisp data
+0 string \012(
+# look for emacs lisp keywords
+# GRR: split regex because it is too long or get error like
+# lisp, 36: Warning: cannot get string from `^(defun|defvar|defconst|defmacro|setq|fset|put|provide|require|'
+>&0 regex \^(defun|defvar|defconst|defmacro|setq|fset) Emacs v18 byte-compiled Lisp data
!:mime application/x-elc
+# https://searchcode.com/codesearch/view/2173420/
+# not really pure text
+!:apple EMAxTEXT
+!:ext elc
+# remaining regex
+>&0 regex \^(put|provide|require|random) Emacs v18 byte-compiled Lisp data
+!:mime application/x-elc
+!:apple EMAxTEXT
+!:ext elc
+# missed cl.elc dbx.elc simple.elc look like normal lisp starting with ;;;
+
# Emacs 19+ - ver. recognition added by Ian Springer
# Also applies to XEmacs 19+ .elc files; could tell them apart with regexs
# - Chris Chittleborough <cchittleborough@yahoo.com.au>
+# Update: Joerg Jenderek
0 string ;ELC
->4 byte >18
->4 byte <32 Emacs/XEmacs v%d byte-compiled Lisp data
+# version\0\0\0
+>4 byte >18 Emacs/XEmacs v%d byte-compiled Lisp data
+# why less than 32 ? does not make sense to me. GNU Emacs version is 24.5 at April 2015
+#>4 byte <32 Emacs/XEmacs v%d byte-compiled Lisp data
!:mime application/x-elc
+!:apple EMAxTEXT
+!:ext elc
# Files produced by CLISP Common Lisp From: Bruno Haible <haible@ilog.fr>
0 string (SYSTEM::VERSION\040' CLISP byte-compiled Lisp program (pre 2004-03-27)
diff --git a/contrib/file/magic/Magdir/mach b/contrib/file/magic/Magdir/mach
index 7782e5b..c1bec07 100644
--- a/contrib/file/magic/Magdir/mach
+++ b/contrib/file/magic/Magdir/mach
@@ -1,6 +1,6 @@
#------------------------------------------------------------
-# $File: mach,v 1.20 2015/05/21 18:28:41 christos Exp $
+# $File: mach,v 1.23 2015/10/15 21:51:22 christos Exp $
# Mach has two magic numbers, 0xcafebabe and 0xfeedface.
# Unfortunately the first, cafebabe, is shared with
# Java ByteCode, so they are both handled in the file "cafebabe".
@@ -106,15 +106,19 @@
>>>4 belong&0x00ffffff 2 subarchitecture=%d
>>>4 belong&0x00ffffff 3 subarchitecture=%d
>>>4 belong&0x00ffffff 4 subarchitecture=%d
->>>4 belong&0x00ffffff 5 \b_v4t
->>>4 belong&0x00ffffff 6 \b_v6
->>>4 belong&0x00ffffff 7 \b_v5tej
->>>4 belong&0x00ffffff 8 \b_xscale
->>>4 belong&0x00ffffff 9 \b_v7
->>>4 belong&0x00ffffff 10 \b_v7f
->>>4 belong&0x00ffffff 11 subarchitecture=%d
->>>4 belong&0x00ffffff 12 \b_v7k
->>>4 belong&0x00ffffff >12 subarchitecture=%d
+>>>4 belong&0x00ffffff 5 \bv4t
+>>>4 belong&0x00ffffff 6 \bv6
+>>>4 belong&0x00ffffff 7 \bv5tej
+>>>4 belong&0x00ffffff 8 \bxscale
+>>>4 belong&0x00ffffff 9 \bv7
+>>>4 belong&0x00ffffff 10 \bv7f
+>>>4 belong&0x00ffffff 11 \bv7s
+>>>4 belong&0x00ffffff 12 \bv7k
+>>>4 belong&0x00ffffff 13 \bv8
+>>>4 belong&0x00ffffff 14 \bv6m
+>>>4 belong&0x00ffffff 15 \bv7m
+>>>4 belong&0x00ffffff 16 \bv7em
+>>>4 belong&0x00ffffff >16 subarchitecture=%d
# 13 m88k
>>0 belong&0x00ffffff 13
>>>4 belong&0x00ffffff 0 mc88000
@@ -158,12 +162,15 @@
>>>4 belong&0x00ffffff 2 subarchitecture=%d
>>>4 belong&0x00ffffff 3
>>>4 belong&0x00ffffff 4 \b_arch1
+>>>4 belong&0x00ffffff 8 \b_haswell
>>>4 belong&0x00ffffff >4 subarchitecture=%d
>>0 belong&0x00ffffff 8 64-bit architecture=%d
>>0 belong&0x00ffffff 9 64-bit architecture=%d
>>0 belong&0x00ffffff 10 64-bit architecture=%d
>>0 belong&0x00ffffff 11 64-bit architecture=%d
->>0 belong&0x00ffffff 12 64-bit architecture=%d
+>>0 belong&0x00ffffff 12 arm64
+>>>4 belong&0x00ffffff 0
+>>>4 belong&0x00ffffff 1 \bv8
>>0 belong&0x00ffffff 13 64-bit architecture=%d
>>0 belong&0x00ffffff 14 64-bit architecture=%d
>>0 belong&0x00ffffff 15 64-bit architecture=%d
@@ -203,6 +210,34 @@
>12 belong 11 kext bundle
>12 belong >11
>>12 belong x filetype=%d
+>24 belong >0 \b, flags:<
+>>24 belong &0x0000001 \bNOUNDEFS
+>>24 belong &0x0000002 \b|INCRLINK
+>>24 belong &0x0000004 \b|DYLDLINK
+>>24 belong &0x0000008 \b|BINDATLOAD
+>>24 belong &0x0000010 \b|PREBOUND
+>>24 belong &0x0000020 \b|SPLIT_SEGS
+>>24 belong &0x0000040 \b|LAZY_INIT
+>>24 belong &0x0000080 \b|TWOLEVEL
+>>24 belong &0x0000100 \b|FORCE_FLAT
+>>24 belong &0x0000200 \b|NOMULTIDEFS
+>>24 belong &0x0000400 \b|NOFIXPREBINDING
+>>24 belong &0x0000800 \b|PREBINDABLE
+>>24 belong &0x0001000 \b|ALLMODSBOUND
+>>24 belong &0x0002000 \b|SUBSECTIONS_VIA_SYMBOLS
+>>24 belong &0x0004000 \b|CANONICAL
+>>24 belong &0x0008000 \b|WEAK_DEFINES
+>>24 belong &0x0010000 \b|BINDS_TO_WEAK
+>>24 belong &0x0020000 \b|ALLOW_STACK_EXECUTION
+>>24 belong &0x0040000 \b|ROOT_SAFE
+>>24 belong &0x0080000 \b|SETUID_SAFE
+>>24 belong &0x0100000 \b|NO_REEXPORTED_DYLIBS
+>>24 belong &0x0200000 \b|PIE
+>>24 belong &0x0400000 \b|DEAD_STRIPPABLE_DYLIB
+>>24 belong &0x0800000 \b|HAS_TLV_DESCRIPTORS
+>>24 belong &0x1000000 \b|NO_HEAP_EXECUTION
+>>24 belong &0x2000000 \b|APP_EXTENSION_SAFE
+>>24 belong x \b>
#
0 lelong&0xfffffffe 0xfeedface Mach-O
diff --git a/contrib/file/magic/Magdir/macintosh b/contrib/file/magic/Magdir/macintosh
index 3ca2cab..d7f20f2 100644
--- a/contrib/file/magic/Magdir/macintosh
+++ b/contrib/file/magic/Magdir/macintosh
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: macintosh,v 1.25 2014/09/03 13:34:16 christos Exp $
+# $File: macintosh,v 1.26 2015/11/25 00:36:02 christos Exp $
# macintosh description
#
# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
@@ -297,11 +297,14 @@
>0x40e ubeshort 0x0003
# maximal length of volume name is 27
>>0x424 ubyte <28 Macintosh HFS data
-#!:mime application/octet-stream
-# these mime and apple types are not sure
!:mime application/x-apple-diskimage
#!:apple hfsdINIT
#!:apple MACSdisk
+# http://www.macdisk.com/macsigen.php
+#!:apple ddskdevi
+!:apple ????devi
+# https://en.wikipedia.org/wiki/Apple_Disk_Image
+!:ext hfs/dmg
>>>0 beshort 0x4C4B (bootable)
#>>>0 beshort 0x0000 (not bootable)
>>>0x40a beshort &0x8000 (locked)
diff --git a/contrib/file/magic/Magdir/microfocus b/contrib/file/magic/Magdir/microfocus
new file mode 100644
index 0000000..b2d204b
--- /dev/null
+++ b/contrib/file/magic/Magdir/microfocus
@@ -0,0 +1,21 @@
+
+#------------------------------------------------------------------------------
+# $File: microfocus,v 1.1 2016/02/09 01:22:49 christos Exp $
+# Micro Focus COBOL data files.
+
+# http://documentation.microfocus.com/help/index.jsp?topic=\
+# %2FGUID-0E0191D8-C39A-44D1-BA4C-D67107BAF784%2FHRFLRHFILE05.html
+# http://www.cobolproducts.com/datafile/data-viewer.html
+# https://github.com/miracle2k/mfcobol-export
+
+0 string \x30\x00\x00\x7C
+>36 string \x00\x3E Micro Focus File with Header (DAT)
+!:mime application/octet-stream
+
+0 string \x30\x7E\x00\x00
+>36 string \x00\x3E Micro Focus File with Header (DAT)
+!:mime application/octet-stream
+
+39 string \x02
+>136 string \x02\x02\x04\x04 Micro Focus Index File (IDX)
+!:mime application/octet-stream
diff --git a/contrib/file/magic/Magdir/misctools b/contrib/file/magic/Magdir/misctools
index d09a543..eeb518d 100644
--- a/contrib/file/magic/Magdir/misctools
+++ b/contrib/file/magic/Magdir/misctools
@@ -1,6 +1,6 @@
#-----------------------------------------------------------------------------
-# $File: misctools,v 1.15 2015/04/15 18:29:30 christos Exp $
+# $File: misctools,v 1.16 2016/02/14 15:46:52 christos Exp $
# misctools: file(1) magic for miscellaneous UNIX tools.
#
0 search/1 %%!! X-Post-It-Note text
@@ -29,7 +29,35 @@
0 search/80 .lo\ -\ a\ libtool\ object\ file libtool object file
# From: Daniel Novotny <dnovotny@redhat.com>
-0 string MDMP\x93\xA7 MDMP crash report data
+# Update: Joerg Jenderek
+# URL: https://en.wikipedia.org/wiki/Core_dump#User-mode_memory_dumps
+# Reference: https://msdn.microsoft.com/en-us/library/ms680378%28VS.85%29.aspx
+#
+# "Windows Minidump" by TrID
+# ./misctools (version 5.25) labeled the entry as "MDMP crash report data"
+0 string MDMP Mini DuMP crash report
+# http://filext.com/file-extension/DMP
+!:mime application/x-dmp
+!:ext dmp/mdmp
+# The high-order word is an internal value that is implementation specific.
+# The low-order word is MINIDUMP_VERSION 0xA793
+>4 ulelong&0x0000FFFF !0xA793 \b, version 0x%4.4x
+# NumberOfStreams 8,9,10,13
+>8 ulelong x \b, %d streams
+# StreamDirectoryRva 0x20
+>12 ulelong !0x20 \b, 0x%8.8x RVA
+# CheckSum 0
+>16 ulelong !0 \b, CheckSum 0x%8.8x
+# Reserved or TimeDateStamp
+>20 ledate x \b, %s
+# https://msdn.microsoft.com/en-us/library/windows/desktop/ms680519%28v=vs.85%29.aspx
+# Flags MINIDUMP_TYPE enumeration type 0 0x121 0x800
+>24 ulelong x \b, 0x%x type
+# >24 ulelong >0 \b; include
+# >>24 ulelong &0x00000001 \b data sections,
+# >>24 ulelong &0x00000020 \b list of unloaded modules,
+# >>24 ulelong &0x00000100 \b process and thread information,
+# >>24 ulelong &0x00000800 \b memory information,
# Summary: abook addressbook file
# Submitted by: Mark Schreiber <mark7@alumni.cmu.edu>
diff --git a/contrib/file/magic/Magdir/modem b/contrib/file/magic/Magdir/modem
index d3bf7fa..e4decfd 100644
--- a/contrib/file/magic/Magdir/modem
+++ b/contrib/file/magic/Magdir/modem
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: modem,v 1.6 2015/02/14 17:35:47 christos Exp $
+# $File: modem,v 1.7 2016/01/08 00:56:42 christos Exp $
# modem: file(1) magic for modem programs
#
# From: Florian La Roche <florian@knorke.saar.de>
@@ -8,8 +8,48 @@
>29 byte 1 \b, fine resolution
>29 byte 0 \b, normal resolution
-0 short 0x0100 raw G3 data, byte-padded
-0 short 0x1400 raw G3 data
+# Summary: CCITT Group 3 Facsimile in "raw" form (i.e. no header).
+# Modified by: Joerg Jenderek
+# URL: https://de.wikipedia.org/wiki/Fax
+# Reference: http://web.archive.org/web/20020628195336/http://www.netnam.vn/unescocourse/computervision/104.htm
+# GRR: EOL of G3 is too general as it catches also TrueType fonts, Postscript PrinterFontMetric, others
+0 short 0x0100
+# 16 0-bits near beginning like True Type fonts *.ttf, Postscript PrinterFontMetric *.pfm, FTYPE.HYPERCARD, XFER
+>2 search/9 \0\0
+# maximal 7 0-bits for pixel sequences or 11 0-bits for EOL in G3
+>2 default x
+# skip IRCAM file (VAX big-endian) ./audio
+>>0 belong !0x0001a364
+# skip GEM Image data ./images
+>>>2 beshort !0x0008
+# look for first keyword of Panorama database *.pan
+>>>>11 search/262 \x06DESIGN
+# skip Panorama database
+>>>>11 default x
+# old Apple DreamWorld DreamGrafix *.3200 with keyword at end of g3 looking files
+>>>>>27118 search/1864 DreamWorld
+>>>>>27118 default x
+# skip MouseTrap/Mt.Defaults with file size 16 found on Golden Orchard Apple II CD Rom
+>>>>>>8 ubequad !0x2e01010454010203
+# skip PICTUREH.SML found on Golden Orchard Apple II CD Rom
+>>>>>>>8 ubequad !0x5dee74ad1aa56394 raw G3 (Group 3) FAX, byte-padded
+# version 5.25 labeled the entry above "raw G3 data, byte-padded"
+!:mime image/g3fax
+#!:apple ????TIFF
+!:ext g3
+# unusual image starting with black pixel
+#0 short 0x1300 raw G3 (Group 3) FAX
+0 short 0x1400
+# 16 0-bits near beginning like PicturePuzzler found on Golden Orchard Apple CD Rom
+>2 search/9 \0\0
+# maximal 7 0-bits for pixel sequences or 11 0-bits for EOL in G3
+>2 default x raw G3 (Group 3) FAX
+# version 5.25 labeled the above entry as "raw G3 data"
+!:mime image/g3fax
+!:ext g3
+# unusual image with black pixel near beginning
+#0 short 0x1900 raw G3 (Group 3) FAX
+
#
# Magic data for vgetty voice formats
# (Martin Seine & Marc Eberhard)
diff --git a/contrib/file/magic/Magdir/msdos b/contrib/file/magic/Magdir/msdos
index 89c141e..7755274 100644
--- a/contrib/file/magic/Magdir/msdos
+++ b/contrib/file/magic/Magdir/msdos
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: msdos,v 1.101 2015/08/24 05:08:48 christos Exp $
+# $File: msdos,v 1.105 2016/03/03 18:58:14 christos Exp $
# msdos: file(1) magic for MS-DOS files
#
@@ -24,7 +24,11 @@
100 search/0xffff say
>100 regex/c =^[\ \t]{0,10}say\ ['"] OS/2 REXX batch file text
-0 leshort 0x14c MS Windows COFF Intel 80386 object file
+# updated by Joerg Jenderek at Oct 2015
+# https://de.wikipedia.org/wiki/Common_Object_File_Format
+# http://www.delorie.com/djgpp/doc/coff/filhdr.html
+# ./intel already labeled COFF type 0x14c=0514 as "80386 COFF executable"
+#0 leshort 0x14c MS Windows COFF Intel 80386 object file
#>4 ledate x stamp %s
0 leshort 0x166 MS Windows COFF MIPS R4000 object file
#>4 ledate x stamp %s
@@ -405,8 +409,31 @@
#>>10 string x %-.8s
#>4 uleshort&0x4000 0x4000 \b,control strings-support)
-# test too generic ?
-0 byte 0x8c DOS executable (COM)
+# updated by Joerg Jenderek
+# GRR: line below too general as it catches also
+# rt.lib DYADISKS.PIC and many more
+# start with assembler instruction MOV
+0 ubyte 0x8c
+# skip "AppleWorks word processor data" like ARTICLE.1 ./apple
+>4 string !O====
+# skip some unknown basic binaries like RocketRnger.SHR
+>>5 string !MAIN
+# skip "GPG symmetrically encrypted data" ./gnu
+# skip "PGP symmetric key encrypted data" ./pgp
+# openpgpdefs.h: fourth byte < 14 indicate cipher algorithm type
+>>>4 ubyte >13 DOS executable (COM, 0x8C-variant)
+# the remaining files should be DOS *.COM executables
+# dosshell.COM 8cc0 2ea35f07 e85211 e88a11 b80058 cd
+# hmload.COM 8cc8 8ec0 bbc02b 89dc 83c30f c1eb04 b4
+# UNDELETE.COM 8cca 2e8916 6503 b430 cd21 8b 2e0200 8b
+# BOOTFIX.COM 8cca 2e8916 9603 b430 cd21 8b 2e0200 8b
+# RAWRITE3.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
+# SHARE.COM 8cca 2e8916 d602 b430 cd21 8b 2e0200 8b
+# validchr.COM 8cca 2e8916 9603 b430 cd21 8b 2e028b1e
+# devload.COM 8cca 8916ad01 b430 cd21 8b2e0200 892e
+!:mime application/x-dosexec
+!:ext com
+
# updated by Joerg Jenderek at Oct 2008
0 ulelong 0xffff10eb DR-DOS executable (COM)
# byte 0xeb conflicts with "sequent" magic leshort 0xn2eb
@@ -418,23 +445,41 @@
>>4 string \ $ARX DOS executable (COM), ARX self-extracting archive
>>4 string \ $LHarc DOS executable (COM), LHarc self-extracting archive
>>0x20e string SFX\ by\ LARC DOS executable (COM), LARC self-extracting archive
-# updated by Joerg Jenderek at Oct 2008
-#0 byte 0xb8 COM executable
-0 uleshort&0x80ff 0x00b8
+# updated by Joerg Jenderek at Oct 2008,2015
+# following line is too general
+0 ubyte 0xb8
+# skip 2 linux kernels like memtest.bin with "\xb8\xc0\x07\x8e" in ./linux
+>0 string !\xb8\xc0\x07\x8e
# modified by Joerg Jenderek
->1 lelong !0x21cd4cff COM executable for DOS
+# syslinux COM32 or COM32R executable
+>>1 lelong&0xFFFFFFFe 0x21CD4CFe COM executable (32-bit COMBOOT
+# http://www.syslinux.org/wiki/index.php/Comboot_API
+# Since version 5.00 c32 modules switched from the COM32 object format to ELF
+!:mime application/x-c32-comboot-syslinux-exec
+!:ext c32
# http://syslinux.zytor.com/comboot.php
+# older syslinux version ( <4 )
# (32-bit COMBOOT) programs *.C32 contain 32-bit code and run in flat-memory 32-bit protected mode
# start with assembler instructions mov eax,21cd4cffh
-0 uleshort&0xc0ff 0xc0b8
->1 lelong 0x21cd4cff COM executable (32-bit COMBOOT)
+>>>1 lelong 0x21CD4CFf \b)
# syslinux:doc/comboot.txt
# A COM32R program must start with the byte sequence B8 FE 4C CD 21 (mov
# eax,21cd4cfeh) as a magic number.
-0 string/b \xb8\xfe\x4c\xcd\x21 COM executable (COM32R)
-# start with assembler instructions mov eax,21cd4cfeh
-0 uleshort&0xc0ff 0xc0b8
->1 lelong 0x21cd4cfe COM executable (32-bit COMBOOT, relocatable)
+# syslinux version (4.x)
+# "COM executable (COM32R)" or "Syslinux COM32 module" by TrID
+>>>1 lelong 0x21CD4CFe \b, relocatable)
+# remaining are DOS COM executables starting with assembler instruction MOV
+# like FreeDOS BANNER*.COM FINDDISK.COM GIF2RAW.COM WINCHK.COM
+# MS-DOS SYS.COM RESTART.COM
+# SYSLINUX.COM (version 1.40 - 2.13)
+# GFXBOOT.COM (version 3.75)
+# COPYBS.COM POWEROFF.COM INT18.COM
+>>1 default x COM executable for DOS
+!:mime application/x-dosexec
+#!:mime application/x-ms-dos-executable
+#!:mime application/x-msdos-program
+!:ext com
+
0 string/b \x81\xfc
>4 string \x77\x02\xcd\x20\xb9
>>36 string UPX! FREE-DOS executable (COM), UPX compressed
@@ -869,6 +914,7 @@
# Windows Imaging (WIM) Image
0 string/b MSWIM\000\000\000 Windows imaging (WIM) image
+0 string/b WLPWM\000\000\000 Windows imaging (WIM) image, wimlib pipable format
# The second byte of these signatures is a file version; I don't know what,
# if anything, produced files with version numbers 0-2.
diff --git a/contrib/file/magic/Magdir/msvc b/contrib/file/magic/Magdir/msvc
index 1095d05..bf4ab0c 100644
--- a/contrib/file/magic/Magdir/msvc
+++ b/contrib/file/magic/Magdir/msvc
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: msvc,v 1.5 2009/09/19 16:28:11 christos Exp $
+# $File: msvc,v 1.6 2016/01/26 00:03:19 christos Exp $
# msvc: file(1) magic for msvc
# "H. Nanosecond" <aldomel@ix.netcom.com>
# Microsoft visual C
@@ -27,11 +27,32 @@
#.pch
0 string DTJPCH0\000\022\103\006\200 Microsoft Visual C .pch
-# .pdb
-# too long 0 string Microsoft\ C/C++\ program\ database\
-0 string Microsoft\ C/C++\ MSVC program database
->18 string program\ database\
->33 string >\0 ver %s
+# Summary: Symbol Table / Debug info used by Microsoft compilers
+# URL: https://en.wikipedia.org/wiki/Program_database
+# Reference: https://code.google.com/p/pdbparser/wiki/MSF_Format
+# Update: Joerg Jenderek
+# Note: test only for Windows XP+SP3 x86 , 8.1 x64 arm and 10.1 x86
+# info does only applies partly for older files like msvbvm50.pdb about year 2001
+0 string Microsoft\ C/C++\
+# "Microsoft Program DataBase" by TrID
+>24 search/14 \r\n\x1A MSVC program database
+!:mime application/x-ms-pdb
+!:ext pdb
+# "MSF 7.00" "program database 2.00" for msvbvm50.pdb
+>>16 regex \([0-9.]+\) ver %s
+#>>>0x38 search/128123456 /LinkInfo \b with linkinfo
+# "MSF 7.00" variant
+>>0x1e leshort 0
+# PageSize 400h 1000h
+>>>0x20 lelong x \b, %d
+# Page Count
+>>>0x28 lelong x \b*%d bytes
+# "program database 2.00" variant
+>>0x1e leshort !0
+# PageSize 400h
+>>>0x2c lelong x \b, %d
+# Page Count for msoo-dll.pdb 4379h
+>>>0x32 leshort x \b*%d bytes
#.sbr
0 string \000\002\000\007\000 MSVC .sbr
diff --git a/contrib/file/magic/Magdir/msx b/contrib/file/magic/Magdir/msx
index 0eacbe5..ba5607c 100644
--- a/contrib/file/magic/Magdir/msx
+++ b/contrib/file/magic/Magdir/msx
@@ -7,20 +7,20 @@
############## MSX Music file formats ##############
# Gigamix MGSDRV music file
-0 string MGS MSX Gigamix MGSDRV3 music file,
+0 string/b MGS MSX Gigamix MGSDRV3 music file,
>6 ubeshort 0x0D0A
>>3 byte x \bv%c
>>4 byte x \b.%c
>>5 byte x \b%c
>>8 string >\0 \b, title: %s
-1 string mgs2\ MSX Gigamix MGSDRV2 music file
+1 string/b mgs2\ MSX Gigamix MGSDRV2 music file
>6 uleshort 0x80
>>0x2E uleshort 0
>>>0x30 string >\0 \b, title: %s
# KSS music file
-0 string KSCC KSS music file v1.03
+0 string/b KSCC KSS music file v1.03
>0xE byte 0
>>0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+)
>>0xF byte&0x02 2 \b, soundchip(s): SN76489
@@ -28,7 +28,7 @@
>>0xF byte&0x01 1 \b, YM2413
>>0xF byte&0x08 8 \b, Y8950
-0 string KSSX KSS music file v1.20
+0 string/b KSSX KSS music file v1.20
>0xE byte&0xEF 0
>>0xF byte&0x40 0x00 \b, 60Hz
>>0xF byte&0x40 0x40 \b, 50Hz
@@ -42,11 +42,11 @@
>>0xF byte&0x18 0x10 \b, Majyutsushi DAC
# Moonblaster for Moonsound
-0 string MBMS
+0 string/b MBMS
>4 byte 0x10 MSX Moonblaster for MoonSound music
# Music Player K-kaz
-0 string MPK MSX Music Player K-kaz song
+0 string/b MPK MSX Music Player K-kaz song
>6 ubeshort 0x0D0A
>>3 byte x v%c
>>4 byte x \b.%c
@@ -70,7 +70,7 @@
>>>>>0 string >\32 \b, title: %s
# SCMD music file
-0x8B string SCMD
+0x8B string/b SCMD
>0xCE uleshort 0 MSX SCMD Music file
#>>-2 uleshort 0x6a71 ; The file must end with this value. How to code this here?
>>0x8F string >\0 \b, title: %s
@@ -100,7 +100,7 @@
>>>3 uleshort >0x013D MSX Graph Saurus compressed image
# Maki-chan Graphic format
-0 string MAKI02\ \ Maki-chan image,
+0 string/b MAKI02\ \ Maki-chan image,
>8 byte x system ID: %c
>9 byte x \b%c
>10 byte x \b%c
@@ -124,11 +124,11 @@
>>&3 ubyte&0x01 1 \b, 2:1 dot aspect ratio
# Japanese PIC file
-0 string PIC\x1A
+0 string/b PIC\x1A
>4 lelong 0 Japanese PIC image file
# MSX G9B image file
-0 string G9B
+0 string/b G9B
>1 uleshort 11
>>3 uleshort >10
>>>5 ubyte >0 MSX G9B image, depth=%d
@@ -147,7 +147,7 @@
############## Other MSX file formats ##############
# MSX ROMs
-0 string AB
+0 string/b AB
>2 uleshort 0x0010 MSX ROM
>>2 uleshort x \b, init=0x%4x
>>4 uleshort >0 \b, stat=0x%4x
@@ -164,7 +164,7 @@
>>6 uleshort >0 \b, dev=0x%04x
>>8 uleshort >0 \b, bas=0x%04x
-0 string AB
+0 string/b AB
#>2 string 5JSuperLAYDOCK MSX Super Laydock ROM
#>3 string @HYDLIDE3MSX MSX Hydlide-3 ROM
#>3 string @3\x80IA862 Golvellius MSX1 ROM
@@ -188,7 +188,7 @@
>>>6 uleshort 0
>>>>8 uleshort >0 MSX BASIC program in ROM, bas=0x%04x
-0x4000 string AB
+0x4000 string/b AB
>0x4002 uleshort >0x4010
>>0x400A string \0\0\0\0\0\0 MSX MegaROM with nonstandard page order
>>0x4002 uleshort x \b, init=0x%04x
@@ -196,7 +196,7 @@
>>0x4006 uleshort >0 \b, dev=0x%04x
>>0x4008 uleshort >0 \b, bas=0x%04x
-0x8000 string AB
+0x8000 string/b AB
>0x8002 uleshort >0x4010
>>0x800A string \0\0\0\0\0\0 MSX MegaROM with nonstandard page order
>>0x8002 uleshort x \b, init=0x%04x
@@ -206,7 +206,7 @@
0x3C000 string AB
->0x3C008 string \0\0\0\0\0\0\0\0 MSX MegaROM with nonstandard page order
+>0x3C008 string/b \0\0\0\0\0\0\0\0 MSX MegaROM with nonstandard page order
>>0x3C002 uleshort x \b, init=0x%04x
>>0x3C004 uleshort >0 \b, stat=0x%04x
>>0x3C006 uleshort >0 \b, dev=0x%04x
diff --git a/contrib/file/magic/Magdir/netbsd b/contrib/file/magic/Magdir/netbsd
index aa933ff..eb0847b 100644
--- a/contrib/file/magic/Magdir/netbsd
+++ b/contrib/file/magic/Magdir/netbsd
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: netbsd,v 1.22 2014/12/08 20:53:52 christos Exp $
+# $File: netbsd,v 1.23 2015/11/29 01:55:14 christos Exp $
# netbsd: file(1) magic for NetBSD objects
#
# All new-style magic numbers are in network byte order.
@@ -286,3 +286,20 @@
>4 leshort x \b, (headersize = %d
>6 leshort x \b, segmentsize = %d
>6 lelong x \b, segments = %d)
+
+# little endian only for now.
+0 name ktrace
+>4 leshort 7
+>>6 leshort <3 NetBSD ktrace file version %d
+>>>12 string x from %s
+>>>56 string x \b, emulation %s
+>>>8 lelong <65536 \b, pid=%d
+
+56 string netbsd
+>0 use ktrace
+56 string linux
+>0 use ktrace
+56 string sunos
+>0 use ktrace
+56 string hpux
+>0 use ktrace
diff --git a/contrib/file/magic/Magdir/os2 b/contrib/file/magic/Magdir/os2
index 25fb728..21c1c00 100644
--- a/contrib/file/magic/Magdir/os2
+++ b/contrib/file/magic/Magdir/os2
@@ -1,12 +1,12 @@
#------------------------------------------------------------------------------
-# $File: os2,v 1.8 2015/01/05 00:17:13 christos Exp $
+# $File: os2,v 1.9 2016/05/11 15:51:57 christos Exp $
# os2: file(1) magic for OS/2 files
#
# Provided 1998/08/22 by
# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net>
-1 search/1 InternetShortcut MS Windows 95 Internet shortcut text
+1 search/100 InternetShortcut MS Windows 95 Internet shortcut text
>17 search/100 URL= (URL=<
>>&0 string x \b%s>)
diff --git a/contrib/file/magic/Magdir/polyml b/contrib/file/magic/Magdir/polyml
new file mode 100644
index 0000000..0af9baf
--- /dev/null
+++ b/contrib/file/magic/Magdir/polyml
@@ -0,0 +1,23 @@
+
+#------------------------------------------------------------------------------
+# $File: polyml,v 1.1 2016/02/26 15:52:45 christos Exp $
+# polyml: file(1) magic for PolyML
+#
+# PolyML
+# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8)
+# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com)
+
+# [0]: http://www.polyml.org/
+# [1]: https://github.com/polyml/polyml/blob/master/\
+# libpolyml/savestate.cpp#L146-L147
+# [2]: https://github.com/polyml/polyml/blob/master/\
+# libpolyml/savestate.cpp#L1262-L1263
+
+# Type: Poly/ML saved data
+# From: Matthew Fernandez <matthew.fernandez@gmail.com>
+
+0 string POLYSAVE Poly/ML saved state
+>8 long x version %u
+
+0 string POLYMODU Poly/ML saved module
+>8 long x version %u
diff --git a/contrib/file/magic/Magdir/psdbms b/contrib/file/magic/Magdir/psdbms
index 09c733f..1d218c0 100644
--- a/contrib/file/magic/Magdir/psdbms
+++ b/contrib/file/magic/Magdir/psdbms
@@ -1,8 +1,14 @@
#------------------------------------------------------------------------------
-# $File: psdbms,v 1.6 2009/09/19 16:28:11 christos Exp $
+# $File: psdbms,v 1.7 2016/01/08 00:41:02 christos Exp $
# psdbms: file(1) magic for psdatabase
#
-0 belong&0xff00ffff 0x56000000 ps database
->1 string >\0 version %s
->4 string >\0 from kernel %s
+# Update: Joerg Jenderek
+# GRR: line below too general as it catches also some Panorama database *.pan ,
+# AppleWorks word processor
+0 belong&0xff00ffff 0x56000000
+# assume version starts with digit
+>1 regex/s =^[0-9] ps database
+>>1 string >\0 version %s
+# kernel name
+>>4 string >\0 from kernel %s
diff --git a/contrib/file/magic/Magdir/python b/contrib/file/magic/Magdir/python
index 0668a93..06da176 100644
--- a/contrib/file/magic/Magdir/python
+++ b/contrib/file/magic/Magdir/python
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: python,v 1.27 2015/09/08 13:59:44 christos Exp $
+# $File: python,v 1.28 2015/09/16 22:19:54 christos Exp $
# python: file(1) magic for python
#
# Outlook puts """ too for urgent messages
@@ -26,16 +26,16 @@
0 belong 0xee0c0d0a python 3.4 byte-compiled
0 search/1/w #!\ /usr/bin/python Python script text executable
-!:strength + 10
+!:strength + 15
!:mime text/x-python
0 search/1/w #!\ /usr/local/bin/python Python script text executable
-!:strength + 10
+!:strength + 15
!:mime text/x-python
0 search/1 #!/usr/bin/env\ python Python script text executable
-!:strength + 10
+!:strength + 15
!:mime text/x-python
0 search/10 #!\ /usr/bin/env\ python Python script text executable
-!:strength + 10
+!:strength + 15
!:mime text/x-python
diff --git a/contrib/file/magic/Magdir/sendmail b/contrib/file/magic/Magdir/sendmail
index aeb6203..2900410 100644
--- a/contrib/file/magic/Magdir/sendmail
+++ b/contrib/file/magic/Magdir/sendmail
@@ -1,14 +1,31 @@
#------------------------------------------------------------------------------
-# $File: sendmail,v 1.7 2009/09/19 16:28:12 christos Exp $
+# $File: sendmail,v 1.8 2015/11/11 15:27:03 christos Exp $
# sendmail: file(1) magic for sendmail config files
#
# XXX - byte order?
#
-0 byte 046 Sendmail frozen configuration
->16 string >\0 - version %s
-0 short 0x271c Sendmail frozen configuration
->16 string >\0 - version %s
+# Update: Joerg Jenderek
+# GRR: this test is too general as it catches also
+# READ.ME.FIRST.AWP Sendmail frozen configuration
+# - version ====|====|====|====|====|====|====|====|====|====|====|====|===
+# Email_23_f217153422.ts Sendmail frozen configuration
+# - version \330jK\354
+0 byte 046
+# http://www.sendmail.com/sm/open_source/docs/older_release_notes/
+# freezed configuration file (dbm format?) created from sendmal.cf with -bz
+# by older sendmail. til version 8.6 support for frozen configuration files is removed
+# valid version numbers look like "7.14.4" and should be simliar to output of commands
+# "sendmail -d0 -bt < /dev/null |grep -i Version" or "egrep '^DZ' /etc/sendmail.cf"
+>16 regex/s =^[0-78][0-9.]{4} Sendmail frozen configuration
+# normally only /etc/sendmail.fc or /var/adm/sendmail/sendmail.fc
+!:ext fc
+>>16 string >\0 - version %s
+0 short 0x271c
+# look for valid version number
+>16 regex/s =^[0-78][0-9.]{4} Sendmail frozen configuration
+!:ext fc
+>>16 string >\0 - version %s
#------------------------------------------------------------------------------
# sendmail: file(1) magic for sendmail m4(1) files
diff --git a/contrib/file/magic/Magdir/sgml b/contrib/file/magic/Magdir/sgml
index 0d48255..28cbf87 100644
--- a/contrib/file/magic/Magdir/sgml
+++ b/contrib/file/magic/Magdir/sgml
@@ -1,4 +1,4 @@
-#------------------------------------------------------------------------------ # $File: sgml,v 1.32 2015/07/11 15:08:53 christos Exp $
+#------------------------------------------------------------------------------ # $File: sgml,v 1.33 2015/11/29 22:14:49 christos Exp $
# Type: SVG Vectorial Graphics
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
0 string \<?xml\ version="
@@ -88,25 +88,25 @@
# Extensible markup language (XML), a subset of SGML
# from Marc Prud'hommeaux (marc@apocalypse.org)
0 search/1/cwt \<?xml XML document text
-!:mime application/xml
+!:mime text/xml
!:strength + 5
0 string/t \<?xml\ version\ " XML
-!:mime application/xml
+!:mime text/xml
!:strength + 5
0 string/t \<?xml\ version=" XML
-!:mime application/xml
+!:mime text/xml
!:strength + 5
>15 string/t >\0 %.3s document text
>>23 search/1 \<xsl:stylesheet (XSL stylesheet)
>>24 search/1 \<xsl:stylesheet (XSL stylesheet)
0 string \<?xml\ version=' XML
-!:mime application/xml
+!:mime text/xml
!:strength + 5
>15 string/t >\0 %.3s document text
>>23 search/1 \<xsl:stylesheet (XSL stylesheet)
>>24 search/1 \<xsl:stylesheet (XSL stylesheet)
0 search/1/wt \<?XML broken XML document text
-!:mime application/xml
+!:mime text/xml
!:strength - 10
diff --git a/contrib/file/magic/Magdir/sinclair b/contrib/file/magic/Magdir/sinclair
index 5882a64..6008892 100644
--- a/contrib/file/magic/Magdir/sinclair
+++ b/contrib/file/magic/Magdir/sinclair
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: sinclair,v 1.5 2009/09/19 16:28:12 christos Exp $
+# $File: sinclair,v 1.6 2015/11/14 13:38:35 christos Exp $
# sinclair: file(1) sinclair QL
# additions to /etc/magic by Thomas M. Ott (ThMO)
@@ -13,20 +13,13 @@
>4 string >\0 label:%.10s
# Sinclair QL OS dump (ThMO)
-# (NOTE: if `file' would be able to use indirect references in a endian format
-# differing from the natural host format, this could be written more
-# reliably and faster...)
-#
-# we *can't* lookup QL OS code dumps, because `file' is UNABLE to read more
-# than the first 8K of a file... #-(
-#
-#0 belong =0x30000
-#>49124 belong <47104
-#>>49128 belong <47104
-#>>>49132 belong <47104
-#>>>>49136 belong <47104 QL OS dump data,
-#>>>>>49148 string >\0 type %.3s,
-#>>>>>49142 string >\0 version %.4s
+0 belong =0x30000
+>49124 belong <47104
+>>49128 belong <47104
+>>>49132 belong <47104
+>>>>49136 belong <47104 QL OS dump data,
+>>>>>49148 string >\0 type %.3s,
+>>>>>49142 string >\0 version %.4s
# Sinclair QL firmware executables (ThMO)
0 string NqNqNq`\004 QL firmware executable (BCPL)
diff --git a/contrib/file/magic/Magdir/sql b/contrib/file/magic/Magdir/sql
index c69f44f..86f6869 100644
--- a/contrib/file/magic/Magdir/sql
+++ b/contrib/file/magic/Magdir/sql
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: sql,v 1.15 2014/04/30 21:41:02 christos Exp $
+# $File: sql,v 1.18 2015/12/04 20:38:43 christos Exp $
# sql: file(1) magic for SQL files
#
# From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
@@ -54,21 +54,32 @@
# at offset 68 that is preferred over "user version" for indicating the
# associated application.
#
-0 string SQLite\ format\ 3
->60 belong =0x5f4d544e Monotone source repository - SQLite3 database
->68 belong =0x0f055112 Fossil checkout - SQLite3 database
->68 belong =0x0f055113 Fossil global configuration - SQLite3 database
->68 belong =0x0f055111 Fossil repository - SQLite3 database
->68 belong =0x42654462 Bentley Systems BeSQLite Database - SQLite3 database
->68 belong =0x42654c6e Bentley Systems Localization File - SQLite3 database
->68 belong =0x47504b47 OGC GeoPackage file - SQLite3 database
->68 default x SQLite 3.x database
+0 string SQLite\ format\ 3 SQLite 3.x database
+!:mime application/x-sqlite3
+# seldom found extension sqlite3 like in SyncData.sqlite3
+# db
+# Avira Antivir use extension "dbe" like in avevtdb.dbe, avguard_tchk.dbe
+# Unfortunately extension sqlite also used for other databases starting with string
+# "TTCONTAINER" like in tracks.sqlite contentconsumer.sqlite contentproducerrepository.sqlite
+# and with string "ZV-zlib" in like extra.sqlite
+!:ext sqlite/sqlite3/db/dbe
+>60 belong =0x5f4d544e (Monotone source repository)
+>68 belong =0x0f055112 (Fossil checkout)
+>68 belong =0x0f055113 (Fossil global configuration)
+>68 belong =0x0f055111 (Fossil repository)
+>68 belong =0x42654462 (Bentley Systems BeSQLite Database)
+>68 belong =0x42654c6e (Bentley Systems Localization File)
+>68 belong =0x47504b47 (OGC GeoPackage file)
+>68 default x
>>68 belong !0 \b, application id %u
>>60 belong !0 \b, user version %d
+>96 belong x \b, last written using SQLite version %d
+
# SQLite Write-Ahead Log from SQLite version >= 3.7.0
# http://www.sqlite.org/fileformat.html#walformat
0 belong&0xfffffffe 0x377f0682 SQLite Write-Ahead Log,
+!:ext sqlite-wal/db-wal
>4 belong x version %d
# SQLite Rollback Journal
@@ -76,8 +87,10 @@
0 string \xd9\xd5\x05\xf9\x20\xa1\x63\xd7 SQLite Rollback Journal
# Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
-# http://www.ullrich.es/job/service-menue/panasonic/panasonic-sendersortierung-sat-am-pc/
-# pceditor_V2003.jar
-0 string PSDB\0 Panasonic channel list database
+# https://github.com/PredatH0r/ChanSort
+0 string PSDB\0 Panasonic channel list DataBase
+!:ext db/bin
+#!:mime application/x-db-svl-panasonic
>126 string SQLite\ format\ 3
+#!:mime application/x-panasonic-sqlite3
>>&-15 indirect x \b; contains
diff --git a/contrib/file/magic/Magdir/terminfo b/contrib/file/magic/Magdir/terminfo
index 97ea429..b201bca 100644
--- a/contrib/file/magic/Magdir/terminfo
+++ b/contrib/file/magic/Magdir/terminfo
@@ -1,10 +1,24 @@
#------------------------------------------------------------------------------
-# $File: terminfo,v 1.6 2009/09/19 16:28:12 christos Exp $
+# $File: terminfo,v 1.7 2016/03/17 21:02:29 christos Exp $
# terminfo: file(1) magic for terminfo
#
# XXX - byte order for screen images?
#
-0 string \032\001 Compiled terminfo entry
+# URL: https://en.wikipedia.org/wiki/Terminfo
+# Reference: ncurses-5.9/ncurses/tinfo/write_entry.c
+# Update: Joerg Jenderek
+#
+# GRR: line below too general as it catches also
+# Targa image type 1 with 26 long identification field
+# and HELP.DSK
+0 string \032\001
+# 5th character of terminal name list, but not Targa image pixel size (15 16 24 32)
+>16 ubyte >32
+# namelist, if more than 1 separated by "|" like "st|stterm| simpleterm 0.4.1"
+>>12 regex \^[a-zA-Z0-9][a-zA-Z0-9.][^|]* Compiled terminfo entry "%-s"
+!:mime application/x-terminfo
+# no extension
+#!:ext
0 short 0433 Curses screen image
0 short 0434 Curses screen image
diff --git a/contrib/file/magic/Magdir/vacuum-cleaner b/contrib/file/magic/Magdir/vacuum-cleaner
new file mode 100644
index 0000000..eef78f2
--- /dev/null
+++ b/contrib/file/magic/Magdir/vacuum-cleaner
@@ -0,0 +1,54 @@
+
+#------------------------------------------------------------------------------
+# $File: vacuum-cleaner,v 1.1 2015/11/14 13:38:35 christos Exp $
+# vacuum cleaner magic by Thomas M. Ott (ThMO)
+#
+# navigation map for LG robot vacuum cleaner models VR62xx, VR64xx, VR63xx
+# file: MAPDATAyyyymmddhhmmss_xxxxxx_cc.blk
+# -> yyyymmdd: year, month, day of cleaning
+# -> hhmmss: hour, minute, second of cleaning
+# -> xxxxxx: 6 digits
+# -> cc: cleaning runs counter
+# size: 136044 bytes
+#
+# struct maphdr {
+# int32_t map_cnt; /* 0: single map */
+# int32_t min_ceil; /* 4: 100 mm == 10 cm == min. ceil */
+# int32_t max_ceil; /* 8: 10000 mm == 100 m == max. ceil */
+# int32_t max_climb; /* 12: 50 mm = 5 cm == max. height to climb */
+# int32_t unknown; /* 16: 50000 ??? */
+# int32_t cell_bytes; /* 20: # of bytes for cells per block */
+# int32_t block_max; /* 24: 1000 == max. # of blocks */
+# int32_t route_max; /* 28: 1000 == max. # of routes */
+# int32_t used_blocks; /* 32: 5/45/33/... == # of block entries used! */
+# int32_t cell_dim; /* 36: 10 == cell dimension */
+# int32_t clock_tick; /* 40: 100 == clock ticks */
+# #if 0
+# struct { /* 44: 1000 blocks for 10x10 cells */
+# int32_t yoffset;
+# int32_t xoffset;
+# int32_t posxy;
+# int32_t timecode;
+# } blocks[ 1000];
+# char cells[ 1000* 100]; /* 16044: 1000 10x10 cells */
+# int16_t routes[ 1000* 10]; /* 116044: 1000 10-routes */
+# #endif
+# };
+
+0 lelong =1
+>4 lelong =100
+>>8 lelong =10000
+>>>12 lelong =50
+>>>>16 lelong =50000
+>>>>>20 lelong =100
+>>>>>>24 lelong =1000
+>>>>>>>28 lelong =1000
+>>>>>>>>36 lelong =10
+>>>>>>>>>40 lelong =100
+>>>>>>>>>>32 lelong x LG robot VR6[234]xx %dm^2 navigation
+>>>>>>>>>>136040 lelong =-1 reuse map data
+>>>>>>>>>>136040 lelong =0 map data
+>>>>>>>>>>136040 lelong >0 spurious map data
+>>>>>>>>>>136040 lelong <-1 spurious map data
+
+
diff --git a/contrib/file/magic/Magdir/windows b/contrib/file/magic/Magdir/windows
index 7e0d4d1..faaa7e2 100644
--- a/contrib/file/magic/Magdir/windows
+++ b/contrib/file/magic/Magdir/windows
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: windows,v 1.12 2015/08/29 07:10:35 christos Exp $
+# $File: windows,v 1.14 2015/12/15 01:06:17 christos Exp $
# windows: file(1) magic for Microsoft Windows
#
# This file is mainly reserved for files where programs
@@ -64,10 +64,148 @@
# Summary: Old format help files
-# Extension: .hlp
+# URL: https://en.wikipedia.org/wiki/WinHelp
+# Reference: http://www.oocities.org/mwinterhoff/helpfile.htm
+# Update: Joerg Jenderek
# Created by: Dirk Jagdmann <doj@cubic.org>
-0 lelong 0x00035f3f MS Windows 3.x help file
+#
+# check and then display version and date inside MS Windows HeLP file fragment
+0 name help-ver-date
+# look for Magic of SYSTEMHEADER
+>0 leshort 0x036C
+# version Major 1 for right file fragment
+>>4 leshort 1 Windows
+# print non empty string above to avoid error message
+# Warning: Current entry does not yet have a description for adding a MIME type
+!:mime application/winhelp
+!:ext hlp
+# version Minor of help file format is hint for windows version
+>>>2 leshort 0x0F 3.x
+>>>2 leshort 0x15 3.0
+>>>2 leshort 0x21 3.1
+>>>2 leshort 0x27 x.y
+>>>2 leshort 0x33 95
+>>>2 default x y.z
+>>>>2 leshort x 0x%x
+# to complete message string like "MS Windows 3.x help file"
+>>>2 leshort x help
+# GenDate often older than file creation date
+>>>6 ldate x \b, %s
+#
+# Magic for HeLP files
+0 lelong 0x00035f3f
+# ./windows (version 5.25) labeled the entry as "MS Windows 3.x help file"
+# file header magic 0x293B at DirectoryStart+9
+>(4.l+9) uleshort 0x293B MS
+# look for @VERSION bmf.. like IBMAVW.ANN
+>>0xD4 string =\x62\x6D\x66\x01\x00 Windows help annotation
+!:mime application/x-winhelp
+!:ext ann
+>>0xD4 string !\x62\x6D\x66\x01\x00
+# "GID Help index" by TrID
+>>>(4.l+0x65) string =|Pete Windows help Global Index
+!:mime application/x-winhelp
+!:ext gid
+# HeLP Bookmark or
+# "Windows HELP File" by TrID
+>>>(4.l+0x65) string !|Pete
+# maybe there exist a cleaner way to detect HeLP fragments
+# brute search for Magic 0x036C with matching Major maximal 7 iterations
+# discapp.hlp
+>>>>16 search/0x49AF/s \x6c\x03
+>>>>>&0 use help-ver-date
+>>>>>&4 leshort !1
+# putty.hlp
+>>>>>>&0 search/0x69AF/s \x6c\x03
+>>>>>>>&0 use help-ver-date
+>>>>>>>&4 leshort !1
+>>>>>>>>&0 search/0x49AF/s \x6c\x03
+>>>>>>>>>&0 use help-ver-date
+>>>>>>>>>&4 leshort !1
+>>>>>>>>>>&0 search/0x49AF/s \x6c\x03
+>>>>>>>>>>>&0 use help-ver-date
+>>>>>>>>>>>&4 leshort !1
+>>>>>>>>>>>>&0 search/0x49AF/s \x6c\x03
+>>>>>>>>>>>>>&0 use help-ver-date
+>>>>>>>>>>>>>&4 leshort !1
+>>>>>>>>>>>>>>&0 search/0x49AF/s \x6c\x03
+>>>>>>>>>>>>>>>&0 use help-ver-date
+>>>>>>>>>>>>>>>&4 leshort !1
+>>>>>>>>>>>>>>>>&0 search/0x49AF/s \x6c\x03
+# GCC.HLP is detected after 7 iterations
+>>>>>>>>>>>>>>>>>&0 use help-ver-date
+# this only happens if bigger hlp file is detected after used search iterations
+>>>>>>>>>>>>>>>>>&4 leshort !1 Windows y.z help
+!:mime application/winhelp
+!:ext hlp
+# repeat search again or following default line does not work
+>>>>16 search/0x49AF/s \x6c\x03
+# remaining files should be HeLP Bookmark WinHlp32.BMK (XP 32-bit) or WinHlp32 (Windows 8.1 64-bit)
+>>>>16 default x Windows help Bookmark
+!:mime application/x-winhelp
+!:ext /bmk
+## FirstFreeBlock normally FFFFFFFFh 10h for *ANN
+##>>8 lelong x \b, FirstFreeBlock 0x%8.8x
+# EntireFileSize
+>>12 lelong x \b, %d bytes
+## ReservedSpace normally 042Fh AFh for *.ANN
+#>>(4.l) lelong x \b, ReservedSpace 0x%8.8x
+## UsedSpace normally 0426h A6h for *.ANN
+#>>(4.l+4) lelong x \b, UsedSpace 0x%8.8x
+## FileFlags normally 04...
+#>>(4.l+5) lelong x \b, FileFlags 0x%8.8x
+## file header magic 0x293B
+#>>(4.l+9) uleshort x \b, file header magic 0x%4.4x
+## file header Flags 0x0402
+#>>(4.l+11) uleshort x \b, file header Flags 0x%4.4x
+## file header PageSize 0400h 80h for *.ANN
+#>>(4.l+13) uleshort x \b, PageSize 0x%4.4x
+## Structure[16] z4
+#>>(4.l+15) string >\0 \b, Structure_"%-.16s"
+## MustBeZero 0
+#>>(4.l+31) uleshort x \b, MustBeZero 0x%4.4x
+## PageSplits
+#>>(4.l+33) uleshort x \b, PageSplits 0x%4.4x
+## RootPage
+#>>(4.l+35) uleshort x \b, RootPage 0x%4.4x
+## MustBeNegOne 0xffff
+#>>(4.l+37) uleshort x \b, MustBeNegOne 0x%4.4x
+## TotalPages 1
+#>>(4.l+39) uleshort x \b, TotalPages 0x%4.4x
+## NLevels 0x0001
+#>>(4.l+41) uleshort x \b, NLevels 0x%4.4x
+## TotalBtreeEntries
+#>>(4.l+43) ulelong x \b, TotalBtreeEntries 0x%8.8x
+## pages of the B+ tree
+#>>(4.l+47) ubequad x \b, PageStart 0x%16.16llx
+# start with colon or semicolon for comment line like Back2Life.cnt
+0 regex \^(:|;)
+# look for first keyword Base
+>0 search/45 :Base
+>>&0 use cnt-name
+# only solution to search again from beginning , because relative offsets changes when use is called
+>0 search/45 :Base
+>0 default x
+# look for other keyword Title like in putty.cnt
+>>0 search/45 :Title
+>>>&0 use cnt-name
+#
+# display mime type and name of Windows help Content source
+0 name cnt-name
+# skip space at beginning
+>0 string \
+# name without extension and greater character or name with hlp extension
+>>1 regex/c \^([^\xd>]*|.*\.hlp) MS Windows help file Content, based "%s"
+!:mime text/plain
+!:apple ????TEXT
+!:ext cnt
+#
+# Windows creates an full text search from hlp file, if the user clicks the "Find" tab and enables keyword indexing
+0 string tfMR MS Windows help Full Text Search index
+!:mime application/x-winhelp-fts
+!:ext fts
+>16 string >\0 for "%s"
# Summary: Hyper terminal
# Extension: .ht
@@ -336,3 +474,102 @@
>>>>>4 ulelong&0x00000001 !0x00000001
>>>>>>(84.l) string >\0 InfName "%s"
+# Summary: backup file created with utility like NTBACKUP.EXE shipped with Windows NT/2K/XP/2003
+# Extension: .bkf
+# Created by: Joerg Jenderek
+# URL: http://en.wikipedia.org/wiki/NTBackup
+# Reference: http://laytongraphics.com/mtf/MTF_100a.PDF
+# Descriptor BloCK name of Microsoft Tape Format
+0 string TAPE
+# Format Logical Address is zero
+>20 ulequad 0
+# Reserved for MBC is zero
+>>28 uleshort 0
+# Control Block ID is zero
+>>>36 ulelong 0
+# BIT4-BIT15, BIT18-BIT31 of block attributes are unused
+>>>>4 ulelong&0xFFfcFFe0 0 Windows NTbackup archive
+#!:mime application/x-ntbackup
+!:ext bkf
+# OS ID
+>>>>>10 ubyte 1 \b NetWare
+>>>>>10 ubyte 13 \b NetWare SMS
+>>>>>10 ubyte 14 \b NT
+>>>>>10 ubyte 24 \b 3
+>>>>>10 ubyte 25 \b OS/2
+>>>>>10 ubyte 26 \b 95
+>>>>>10 ubyte 27 \b Macintosh
+>>>>>10 ubyte 28 \b UNIX
+# OS Version (2)
+#>>>>>11 ubyte x OS V=%x
+# MTF_CONTINUATION Media Sequence Number > 1
+#>>>>>4 ulelong&0x00000001 !0 \b, continued
+# MTF_COMPRESSION
+>>>>>4 ulelong&0x00000004 !0 \b, compressed
+# MTF_EOS_AT_EOM End Of Medium was hit during end of set processing
+>>>>>4 ulelong&0x00000008 !0 \b, End Of Medium hit
+>>>>>4 ulelong&0x00020000 0
+# MTF_SET_MAP_EXISTS A Media Based Catalog Set Map may exist on tape
+>>>>>>4 ulelong&0x00010000 !0 \b, with catalog
+# MTF_FDD_ALLOWED However File/Directory Detail can only exist if a Set Map is also present
+>>>>>4 ulelong&0x00020000 !0 \b, with file catalog
+# Offset To First Event 238h,240h,28Ch
+#>>>>>8 uleshort x \b, event offset %4.4x
+# Displayable Size (20e0230h 20e024ch 20e0224h)
+#>>>>>8 ulequad x dis. size %16.16llx
+# Media Family ID (455288C4h 4570BD1Ah 45708F2Fh 4570BBF5h)
+#>>>>>52 ulelong x family ID %8.8x
+# TAPE Attributes (3)
+#>>>>>56 ulelong x TAPE %8.8x
+# Media Sequence Number
+>>>>>60 uleshort >1 \b, sequence %u
+# Password Encryption Algorithm (3)
+>>>>>62 uleshort >0 \b, 0x%x encrypted
+# Soft Filemark Block Size * 512 (2)
+#>>>>>64 uleshort =2 \b, soft size %u*512
+>>>>>64 uleshort !2 \b, soft size %u*512
+# Media Based Catalog Type (1,2)
+#>>>>>66 uleshort x \b, catalog type %4.4x
+# size of Media Name (66,68,6Eh)
+>>>>>68 uleshort >0
+# offset of Media Name (5Eh)
+>>>>>>70 uleshort >0
+# 0~, 1~ANSI, 2~UNICODE
+>>>>>>>48 ubyte 1
+# size terminated ansi coded string normally followed by "MTF Media Label"
+>>>>>>>>(70.s) string >\0 \b, name: %s
+>>>>>>>48 ubyte 2
+# Not null, but size terminated unicoded string
+>>>>>>>>(70.s) lestring16 x \b, name: %s
+# size of Media Label (104h)
+>>>>>72 uleshort >0
+# offset of Media Label (C4h,C6h,CCh)
+>>>>>74 uleshort >0
+>>>>>>48 ubyte 1
+#Tag|Version|Vendor|Vendor ID|Creation Time Stamp|Cartridge Label|Side|Media ID|Media Domain ID|Vendor Specific fields
+>>>>>>>(74.s) string >\0 \b, label: %s
+>>>>>>48 ubyte 2
+>>>>>>>(74.s) lestring16 x \b, label: %s
+# size of password name (0,1Ch)
+#>>>>>76 uleshort >0 \b, password size %4.4x
+# Software Vendor ID (CBEh)
+>>>>>86 uleshort x \b, software (0x%x)
+# size of Software Name (6Eh)
+>>>>>80 uleshort >0
+# offset of Software Name (1C8h,1CAh,1D0h)
+>>>>>>82 uleshort >0
+# 1~ANSI, 2~UNICODE
+>>>>>>>48 ubyte 1
+>>>>>>>>(82.s) string >\0 \b: %s
+>>>>>>>48 ubyte 2
+# size terminated unicoded coded string normally followed by "SPAD"
+>>>>>>>>(82.s) lestring16 x \b: %s
+# Format Logical Block Size (512,1024)
+#>>>>>84 uleshort =1024 \b, block size %u
+>>>>>84 uleshort !1024 \b, block size %u
+# Media Date of MTF_DATE_TIME type with 5 bytes
+#>>>>>>88 ubequad x DATE %16.16llx
+# MTF Major Version (1)
+#>>>>>>93 ubyte x \b, MFT version %x
+#
+
diff --git a/contrib/file/magic/Magdir/wordprocessors b/contrib/file/magic/Magdir/wordprocessors
index 951f603..a7cfab7 100644
--- a/contrib/file/magic/Magdir/wordprocessors
+++ b/contrib/file/magic/Magdir/wordprocessors
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: wordprocessors,v 1.18 2013/06/03 19:07:29 christos Exp $
+# $File: wordprocessors,v 1.19 2015/10/16 15:11:07 christos Exp $
# wordprocessors: file(1) magic fo word processors.
#
####### PWP file format used on Smith Corona Personal Word Processors:
@@ -12,97 +12,187 @@
>25 byte 0x54 \b, legal
>26 byte 0x46 \b, A4
-#WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
-0 string \377WPC\020\000\000\000\022\012\001\001\000\000\000\000 (WP) loadable file
->15 byte 0 Optimized for Intel
->15 byte 1 Optimized for Non-Intel
-1 string WPC (Corel/WP)
->8 short 257 WordPerfect macro
->8 short 258 WordPerfect help file
->8 short 259 WordPerfect keyboard file
->8 short 266 WordPerfect document
->8 short 267 WordPerfect dictionary
->8 short 268 WordPerfect thesaurus
->8 short 269 WordPerfect block
->8 short 270 WordPerfect rectangular block
->8 short 271 WordPerfect column block
->8 short 272 WordPerfect printer data
->8 short 275 WordPerfect printer data
->8 short 276 WordPerfect driver resource data
->8 short 279 WordPerfect hyphenation code
->8 short 280 WordPerfect hyphenation data
->8 short 281 WordPerfect macro resource data
->8 short 283 WordPerfect hyphenation lex
->8 short 285 WordPerfect wordlist
->8 short 286 WordPerfect equation resource data
->8 short 289 WordPerfect spell rules
->8 short 290 WordPerfect dictionary rules
->8 short 295 WordPerfect spell rules (Microlytics)
->8 short 299 WordPerfect settings file
->8 short 301 WordPerfect 4.2 document
->8 short 325 WordPerfect dialog file
->8 short 332 WordPerfect button bar
->8 short 513 Shell macro
->8 short 522 Shell definition
->8 short 769 Notebook macro
->8 short 770 Notebook help file
->8 short 771 Notebook keyboard file
->8 short 778 Notebook definition
->8 short 1026 Calculator help file
->8 short 1538 Calendar help file
->8 short 1546 Calendar data file
->8 short 1793 Editor macro
->8 short 1794 Editor help file
->8 short 1795 Editor keyboard file
->8 short 1817 Editor macro resource file
->8 short 2049 Macro editor macro
->8 short 2050 Macro editor help file
->8 short 2051 Macro editor keyboard file
->8 short 2305 PlanPerfect macro
->8 short 2306 PlanPerfect help file
->8 short 2307 PlanPerfect keyboard file
->8 short 2314 PlanPerfect worksheet
->8 short 2319 PlanPerfect printer definition
->8 short 2322 PlanPerfect graphic definition
->8 short 2323 PlanPerfect data
->8 short 2324 PlanPerfect temporary printer
->8 short 2329 PlanPerfect macro resource data
->8 byte 11 Mail
->8 short 2818 help file
->8 short 2821 distribution list
->8 short 2826 out box
->8 short 2827 in box
->8 short 2836 users archived mailbox
->8 short 2837 archived message database
->8 short 2838 archived attachments
->8 short 3083 Printer temporary file
->8 short 3330 Scheduler help file
->8 short 3338 Scheduler in file
->8 short 3339 Scheduler out file
->8 short 3594 GroupWise settings file
->8 short 3601 GroupWise directory services
->8 short 3627 GroupWise settings file
->8 short 4362 Terminal resource data
->8 short 4363 Terminal resource data
->8 short 4395 Terminal resource data
->8 short 4619 GUI loadable text
->8 short 4620 graphics resource data
->8 short 4621 printer settings file
->8 short 4622 port definition file
->8 short 4623 print queue parameters
->8 short 4624 compressed file
->8 short 5130 Network service msg file
->8 short 5131 Network service msg file
->8 short 5132 Async gateway login msg
->8 short 5134 GroupWise message file
->8 short 7956 GroupWise admin domain database
->8 short 7957 GroupWise admin host database
->8 short 7959 GroupWise admin remote host database
->8 short 7960 GroupWise admin ADS deferment data file
->8 short 8458 IntelliTAG (SGML) compiled DTD
->8 long 18219264 WordPerfect graphic image (1.0)
->8 long 18219520 WordPerfect graphic image (2.0)
-#end of WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE
+# Corel/WordPerfect
+0 string \xffWPC
+# WordPerfect
+>8 byte 1
+>>9 byte 1 WordPerfect macro
+>>9 byte 2 WordPerfect help file
+>>9 byte 3 WordPerfect keyboard file
+>>9 byte 10 WordPerfect document
+>>9 byte 11 WordPerfect dictionary
+>>9 byte 12 WordPerfect thesaurus
+>>9 byte 13 WordPerfect block
+>>9 byte 14 WordPerfect rectangular block
+>>9 byte 15 WordPerfect column block
+>>9 byte 16 WordPerfect printer data
+>>9 byte 19 WordPerfect printer data
+>>9 byte 20 WordPerfect driver resource data
+>>9 byte 22 WordPerfect graphic image
+>>9 byte 23 WordPerfect hyphenation code
+>>9 byte 24 WordPerfect hyphenation data
+>>9 byte 25 WordPerfect macro resource data
+>>9 byte 27 WordPerfect hyphenation lex
+>>9 byte 29 WordPerfect wordlist
+>>9 byte 30 WordPerfect equation resource data
+>>9 byte 33 WordPerfect spell rules
+>>9 byte 34 WordPerfect dictionary rules
+>>9 byte 39 WordPerfect spell rules (Microlytics)
+>>9 byte 43 WordPerfect settings file
+>>9 byte 44 WordPerfect 3.5 document
+>>9 byte 45 WordPerfect 4.2 document
+>>9 byte 69 WordPerfect dialog file
+>>9 byte 76 WordPerfect button bar
+>>9 default x
+>>>9 byte x Corel WordPerfect: Unknown filetype %d
+# Corel Shell
+>8 byte 2
+>>9 byte 1 Corel shell macro
+>>9 byte 10 Corel shell definition
+>>9 default x
+>>>9 byte x Corel Shell: Unknown filetype %d
+# Corel Notebook
+>8 byte 3
+>>9 byte 1 Corel Notebook macro
+>>9 byte 2 Corel Notebook help file
+>>9 byte 3 Corel Notebook keyboard file
+>>9 byte 10 Corel Notebook definition
+>>9 default x
+>>>9 byte x Corel Notebook: Unknown filetype %d
+# Corel Calculator
+>8 byte 4
+>>9 byte 2 Corel Calculator help file
+>>9 default x
+>>>9 byte x Corel Calculator: Unknown filetype %d
+# Corel File Manager
+>8 byte 5
+>>9 default x
+>>>9 byte x Corel File Manager: Unknown filetype %d
+# Corel Calendar
+>8 byte 6
+>>9 byte 2 Corel Calendar help file
+>>9 byte 10 Corel Calendar data file
+>>9 default x
+>>>9 byte x Corel Calendar: Unknown filetype %d
+# Corel Program Editor/Ed Editor
+>8 byte 7
+>>9 byte 1 Corel Editor macro
+>>9 byte 2 Corel Editor help file
+>>9 byte 3 Corel Editor keyboard file
+>>9 byte 25 Corel Editor macro resource file
+>>9 default x
+>>>9 byte x Corel Program Editor/Ed Editor: Unknown filetype %d
+# Corel Macro Editor
+>8 byte 8
+>>9 byte 1 Corel Macro editor macro
+>>9 byte 2 Corel Macro editor help file
+>>9 byte 3 Corel Macro editor keyboard file
+>>9 default x
+>>>9 byte x Corel Macro Editor: Unknown filetype %d
+# Corel Plan Perfect
+>8 byte 9
+>>9 default x
+>>>9 byte x Corel Plan Perfect: Unknown filetype %d
+# Corel DataPerfect
+>8 byte 10
+# CHECK: Don't these belong into product 9?
+>>9 byte 1 Corel PlanPerfect macro
+>>9 byte 2 Corel PlanPerfect help file
+>>9 byte 3 Corel PlanPerfect keyboard file
+>>9 byte 10 Corel PlanPerfect worksheet
+>>9 byte 15 Corel PlanPerfect printer definition
+>>9 byte 18 Corel PlanPerfect graphic definition
+>>9 byte 19 Corel PlanPerfect data
+>>9 byte 20 Corel PlanPerfect temporary printer
+>>9 byte 25 Corel PlanPerfect macro resource data
+>>9 default x
+>>>9 byte x Corel DataPerfect: Unknown filetype %d
+# Corel Mail
+>8 byte 11
+>>9 byte 2 Corel Mail help file
+>>9 byte 5 Corel Mail distribution list
+>>9 byte 10 Corel Mail out box
+>>9 byte 11 Corel Mail in box
+>>9 byte 20 Corel Mail users archived mailbox
+>>9 byte 21 Corel Mail archived message database
+>>9 byte 22 Corel Mail archived attachments
+>>9 default x
+>>>9 byte x Corel Mail: Unknown filetype %d
+# Corel Printer
+>8 byte 12
+>>9 byte 11 Corel Printer temporary file
+>>9 default x
+>>>9 byte x Corel Printer: Unknown filetype %d
+# Corel Scheduler
+>8 byte 13
+>>9 byte 2 Corel Scheduler help file
+>>9 byte 10 Corel Scheduler in file
+>>9 byte 11 Corel Scheduler out file
+>>9 default x
+>>>9 byte x Corel Scheduler: Unknown filetype %d
+# Corel WordPerfect Office
+>8 byte 14
+>>9 byte 10 Corel GroupWise settings file
+>>9 byte 17 Corel GroupWise directory services
+>>9 byte 43 Corel GroupWise settings file
+>>9 default x
+>>>9 byte x Corel WordPerfect Office: Unknown filetype %d
+# Corel DrawPerfect
+>8 byte 15
+>>9 default x
+>>>9 byte x Corel DrawPerfect: Unknown filetype %d
+# Corel LetterPerfect
+>8 byte 16
+>>9 default x
+>>>9 byte x Corel LetterPerfect: Unknown filetype %d
+# Corel Terminal
+>8 byte 17
+>>9 byte 10 Corel Terminal resource data
+>>9 byte 11 Corel Terminal resource data
+>>9 byte 43 Corel Terminal resource data
+>>9 default x
+>>>9 byte x Corel Terminal: Unknown filetype %d
+# Corel loadable file
+>8 byte 18
+>>9 byte 10 Corel loadable file
+>>9 byte 11 Corel GUI loadable text
+>>9 byte 12 Corel graphics resource data
+>>9 byte 13 Corel printer settings file
+>>9 byte 14 Corel port definition file
+>>9 byte 15 Corel print queue parameters
+>>9 byte 16 Corel compressed file
+>>9 default x
+>>>9 byte x Corel loadable file: Unknown filetype %d
+>>15 byte 0 \b, optimized for Intel
+>>15 byte 1 \b, optimized for Non-Intel
+# Network service
+>8 byte 20
+>>9 byte 10 Corel Network service msg file
+>>9 byte 11 Corel Network service msg file
+>>9 byte 12 Corel Async gateway login msg
+>>9 byte 14 Corel GroupWise message file
+>>9 default x
+>>>9 byte x Corel Network service: Unknown filetype %d
+# GroupWise
+>8 byte 31
+>>9 byte 20 GroupWise admin domain database
+>>9 byte 21 GroupWise admin host database
+>>9 byte 23 GroupWise admin remote host database
+>>9 byte 24 GroupWise admin ADS deferment data file
+>>9 default x
+>>>9 byte x GroupWise: Unknown filetype %d
+# IntelliTAG
+>8 byte 33
+>>9 byte 10 IntelliTAG (SGML) compiled DTD
+>>9 default x
+>>>9 byte x IntelliTAG: Unknown filetype %d
+# everything else
+>8 default x
+>>8 byte x Unknown Corel/Wordperfect product %d,
+>>>9 byte x file type %d
+>10 byte 0 \b, v5.
+>10 byte !0 \b, v%d.
+>11 byte x \b%d
# Hangul (Korean) Word Processor File
0 string HWP\ Document\ File Hangul (Korean) Word Processor File 3.0
diff --git a/contrib/file/magic/Magdir/xenix b/contrib/file/magic/Magdir/xenix
index 3d238df..89de603 100644
--- a/contrib/file/magic/Magdir/xenix
+++ b/contrib/file/magic/Magdir/xenix
@@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
-# $File: xenix,v 1.9 2009/09/19 16:28:13 christos Exp $
+# $File: xenix,v 1.10 2016/04/19 18:14:19 christos Exp $
# xenix: file(1) magic for Microsoft Xenix
#
# "Middle model" stuff, and "Xenix 8086 relocatable or 80286 small
@@ -12,7 +12,26 @@
# XXX - "x.out" collides with PDP-11 archives
#
0 string core core file (Xenix)
-0 byte 0x80 8086 relocatable (Microsoft)
+# URL: http://www.polarhome.com/service/man/?qf=86rel&tf=2&of=Xenix
+# Reference: http://www.azillionmonkeys.com/qed/Omfg.pdf
+# Update: Joerg Jenderek
+# recordtype~TranslatorHEADerRecord
+0 byte 0x80
+# GRR: line above is too general as it catches also Extensible storage engine DataBase
+# skip examples like GENA.SND Switch.Snd by looking for record length maximal 1024-3
+>1 uleshort <1022
+# skip examples like GAME.PICTURE Strange.Pic by looking for positiv record length
+>>1 uleshort >0
+# skip examples like Xtable.Data FRACTAL.GEN SHR.VIEW by looking for positiv string length
+>>>3 ubyte >0
+# skip examples like OMBRE.6 with "UUUUUU" by looking for filename like "hello.c"
+>>>>4 regex [a-zA-Z_/]{1,8}[.] 8086 relocatable (Microsoft)
+#!:mime application/octet-stream
+!:mime application/x-object
+!:ext o/a
+>>>>>3 pstring x \b, "%s"
+# checksum
+#>>>>>(3.b+4) ubyte x \b, checksum 0x%2.2x
0 leshort 0xff65 x.out
>2 string __.SYMDEF randomized
>0 byte x archive
diff --git a/contrib/file/magic/Makefile.am b/contrib/file/magic/Makefile.am
index cb62f95..a5ed8ab 100644
--- a/contrib/file/magic/Makefile.am
+++ b/contrib/file/magic/Makefile.am
@@ -1,5 +1,5 @@
#
-# $File: Makefile.am,v 1.103 2015/03/17 15:15:12 christos Exp $
+# $File: Makefile.am,v 1.113 2016/02/26 15:52:45 christos Exp $
#
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@@ -30,6 +30,7 @@ $(MAGIC_FRAGMENT_DIR)/att3b \
$(MAGIC_FRAGMENT_DIR)/audio \
$(MAGIC_FRAGMENT_DIR)/basis \
$(MAGIC_FRAGMENT_DIR)/bflt \
+$(MAGIC_FRAGMENT_DIR)/bioinformatics \
$(MAGIC_FRAGMENT_DIR)/blackberry \
$(MAGIC_FRAGMENT_DIR)/blcr \
$(MAGIC_FRAGMENT_DIR)/blender \
@@ -50,6 +51,7 @@ $(MAGIC_FRAGMENT_DIR)/citrus \
$(MAGIC_FRAGMENT_DIR)/clarion \
$(MAGIC_FRAGMENT_DIR)/claris \
$(MAGIC_FRAGMENT_DIR)/clipper \
+$(MAGIC_FRAGMENT_DIR)/coff \
$(MAGIC_FRAGMENT_DIR)/commands \
$(MAGIC_FRAGMENT_DIR)/communications \
$(MAGIC_FRAGMENT_DIR)/compress \
@@ -62,6 +64,7 @@ $(MAGIC_FRAGMENT_DIR)/cubemap \
$(MAGIC_FRAGMENT_DIR)/cups \
$(MAGIC_FRAGMENT_DIR)/dact \
$(MAGIC_FRAGMENT_DIR)/database \
+$(MAGIC_FRAGMENT_DIR)/der \
$(MAGIC_FRAGMENT_DIR)/diamond \
$(MAGIC_FRAGMENT_DIR)/diff \
$(MAGIC_FRAGMENT_DIR)/digital \
@@ -78,7 +81,9 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
$(MAGIC_FRAGMENT_DIR)/filesystems \
+$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/flash \
+$(MAGIC_FRAGMENT_DIR)/flif \
$(MAGIC_FRAGMENT_DIR)/fonts \
$(MAGIC_FRAGMENT_DIR)/fortran \
$(MAGIC_FRAGMENT_DIR)/frame \
@@ -145,6 +150,7 @@ $(MAGIC_FRAGMENT_DIR)/mcrypt \
$(MAGIC_FRAGMENT_DIR)/mercurial \
$(MAGIC_FRAGMENT_DIR)/metastore \
$(MAGIC_FRAGMENT_DIR)/meteorological \
+$(MAGIC_FRAGMENT_DIR)/microfocus \
$(MAGIC_FRAGMENT_DIR)/mime \
$(MAGIC_FRAGMENT_DIR)/mips \
$(MAGIC_FRAGMENT_DIR)/mirage \
@@ -193,6 +199,7 @@ $(MAGIC_FRAGMENT_DIR)/pgp \
$(MAGIC_FRAGMENT_DIR)/pkgadd \
$(MAGIC_FRAGMENT_DIR)/plan9 \
$(MAGIC_FRAGMENT_DIR)/plus5 \
+$(MAGIC_FRAGMENT_DIR)/polyml \
$(MAGIC_FRAGMENT_DIR)/printer \
$(MAGIC_FRAGMENT_DIR)/project \
$(MAGIC_FRAGMENT_DIR)/psdbms \
@@ -247,6 +254,7 @@ $(MAGIC_FRAGMENT_DIR)/unknown \
$(MAGIC_FRAGMENT_DIR)/uterus \
$(MAGIC_FRAGMENT_DIR)/uuencode \
$(MAGIC_FRAGMENT_DIR)/varied.out \
+$(MAGIC_FRAGMENT_DIR)/vacuum-cleaner \
$(MAGIC_FRAGMENT_DIR)/varied.script \
$(MAGIC_FRAGMENT_DIR)/vax \
$(MAGIC_FRAGMENT_DIR)/vicar \
@@ -291,7 +299,7 @@ ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
else \
- v=$$(file --version | sed -e s/file-// -e q); \
+ v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
echo "Cannot use the installed version of file ($$v) to"; \
echo "cross-compile file ${PACKAGE_VERSION}"; \
diff --git a/contrib/file/magic/Makefile.in b/contrib/file/magic/Makefile.in
index f214a56..502e7df 100644
--- a/contrib/file/magic/Makefile.in
+++ b/contrib/file/magic/Makefile.in
@@ -273,7 +273,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
#
-# $File: Makefile.am,v 1.103 2015/03/17 15:15:12 christos Exp $
+# $File: Makefile.am,v 1.113 2016/02/26 15:52:45 christos Exp $
#
MAGIC_FRAGMENT_BASE = Magdir
MAGIC_DIR = $(top_srcdir)/magic
@@ -302,6 +302,7 @@ $(MAGIC_FRAGMENT_DIR)/att3b \
$(MAGIC_FRAGMENT_DIR)/audio \
$(MAGIC_FRAGMENT_DIR)/basis \
$(MAGIC_FRAGMENT_DIR)/bflt \
+$(MAGIC_FRAGMENT_DIR)/bioinformatics \
$(MAGIC_FRAGMENT_DIR)/blackberry \
$(MAGIC_FRAGMENT_DIR)/blcr \
$(MAGIC_FRAGMENT_DIR)/blender \
@@ -322,6 +323,7 @@ $(MAGIC_FRAGMENT_DIR)/citrus \
$(MAGIC_FRAGMENT_DIR)/clarion \
$(MAGIC_FRAGMENT_DIR)/claris \
$(MAGIC_FRAGMENT_DIR)/clipper \
+$(MAGIC_FRAGMENT_DIR)/coff \
$(MAGIC_FRAGMENT_DIR)/commands \
$(MAGIC_FRAGMENT_DIR)/communications \
$(MAGIC_FRAGMENT_DIR)/compress \
@@ -334,6 +336,7 @@ $(MAGIC_FRAGMENT_DIR)/cubemap \
$(MAGIC_FRAGMENT_DIR)/cups \
$(MAGIC_FRAGMENT_DIR)/dact \
$(MAGIC_FRAGMENT_DIR)/database \
+$(MAGIC_FRAGMENT_DIR)/der \
$(MAGIC_FRAGMENT_DIR)/diamond \
$(MAGIC_FRAGMENT_DIR)/diff \
$(MAGIC_FRAGMENT_DIR)/digital \
@@ -350,7 +353,9 @@ $(MAGIC_FRAGMENT_DIR)/erlang \
$(MAGIC_FRAGMENT_DIR)/esri \
$(MAGIC_FRAGMENT_DIR)/fcs \
$(MAGIC_FRAGMENT_DIR)/filesystems \
+$(MAGIC_FRAGMENT_DIR)/finger \
$(MAGIC_FRAGMENT_DIR)/flash \
+$(MAGIC_FRAGMENT_DIR)/flif \
$(MAGIC_FRAGMENT_DIR)/fonts \
$(MAGIC_FRAGMENT_DIR)/fortran \
$(MAGIC_FRAGMENT_DIR)/frame \
@@ -417,6 +422,7 @@ $(MAGIC_FRAGMENT_DIR)/mcrypt \
$(MAGIC_FRAGMENT_DIR)/mercurial \
$(MAGIC_FRAGMENT_DIR)/metastore \
$(MAGIC_FRAGMENT_DIR)/meteorological \
+$(MAGIC_FRAGMENT_DIR)/microfocus \
$(MAGIC_FRAGMENT_DIR)/mime \
$(MAGIC_FRAGMENT_DIR)/mips \
$(MAGIC_FRAGMENT_DIR)/mirage \
@@ -465,6 +471,7 @@ $(MAGIC_FRAGMENT_DIR)/pgp \
$(MAGIC_FRAGMENT_DIR)/pkgadd \
$(MAGIC_FRAGMENT_DIR)/plan9 \
$(MAGIC_FRAGMENT_DIR)/plus5 \
+$(MAGIC_FRAGMENT_DIR)/polyml \
$(MAGIC_FRAGMENT_DIR)/printer \
$(MAGIC_FRAGMENT_DIR)/project \
$(MAGIC_FRAGMENT_DIR)/psdbms \
@@ -519,6 +526,7 @@ $(MAGIC_FRAGMENT_DIR)/unknown \
$(MAGIC_FRAGMENT_DIR)/uterus \
$(MAGIC_FRAGMENT_DIR)/uuencode \
$(MAGIC_FRAGMENT_DIR)/varied.out \
+$(MAGIC_FRAGMENT_DIR)/vacuum-cleaner \
$(MAGIC_FRAGMENT_DIR)/varied.script \
$(MAGIC_FRAGMENT_DIR)/vax \
$(MAGIC_FRAGMENT_DIR)/vicar \
@@ -776,7 +784,7 @@ ${MAGIC}: $(EXTRA_DIST) $(FILE_COMPILE_DEP)
@(if expr "${FILE_COMPILE}" : '.*/.*' > /dev/null; then \
echo "Using ${FILE_COMPILE} to generate ${MAGIC}" > /dev/null; \
else \
- v=$$(file --version | sed -e s/file-// -e q); \
+ v=$$(${FILE_COMPILE} --version | sed -e s/file-// -e q); \
if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
echo "Cannot use the installed version of file ($$v) to"; \
echo "cross-compile file ${PACKAGE_VERSION}"; \
diff --git a/contrib/file/python/README b/contrib/file/python/README
index 8b9a2a7..e69de29 100644
--- a/contrib/file/python/README
+++ b/contrib/file/python/README
@@ -1,13 +0,0 @@
-This directory contains Python bindings to allow you to access the
-libmagic api. At the moment their status is "experimental".
-
-You can install the modules either with:
-
-$ python setup.py build
-$ python setup.py install
-
-or, if you have easy_install:
-
-$ easy_install .
-
-magic-python should work now!
diff --git a/contrib/file/python/magic.py b/contrib/file/python/magic.py
index a17e8da..c48f7d5 100644
--- a/contrib/file/python/magic.py
+++ b/contrib/file/python/magic.py
@@ -1,10 +1,13 @@
-#!/usr/bin/env python
+# coding: utf-8
+
'''
Python bindings for libmagic
'''
import ctypes
+from collections import namedtuple
+
from ctypes import *
from ctypes.util import find_library
@@ -32,7 +35,7 @@ MAGIC_PRESERVE_ATIME = PRESERVE_ATIME = 128
MAGIC_RAW = RAW = 256
MAGIC_ERROR = ERROR = 512
MAGIC_MIME_ENCODING = MIME_ENCODING = 1024
-MAGIC_MIME = MIME = 1040
+MAGIC_MIME = MIME = 1040 # MIME_TYPE + MIME_ENCODING
MAGIC_APPLE = APPLE = 2048
MAGIC_NO_CHECK_COMPRESS = NO_CHECK_COMPRESS = 4096
@@ -47,6 +50,8 @@ MAGIC_NO_CHECK_ENCODING = NO_CHECK_ENCODING = 2097152
MAGIC_NO_CHECK_BUILTIN = NO_CHECK_BUILTIN = 4173824
+FileMagic = namedtuple('FileMagic', ('mime_type', 'encoding', 'name'))
+
class magic_set(Structure):
pass
@@ -118,14 +123,18 @@ class Magic(object):
as a filename or None if an error occurred and the MAGIC_ERROR flag
is set. A call to errno() will return the numeric error code.
"""
- try: # attempt python3 approach first
- if isinstance(filename, bytes):
- bi = filename
- else:
+ if isinstance(filename, bytes):
+ bi = filename
+ else:
+ try: # keep Python 2 compatibility
bi = bytes(filename, 'utf-8')
- return str(_file(self._magic_t, bi), 'utf-8')
- except:
- return _file(self._magic_t, filename.encode('utf-8'))
+ except TypeError:
+ bi = bytes(filename)
+ r = _file(self._magic_t, bi)
+ if isinstance(r, str):
+ return r
+ else:
+ return str(r).encode('utf-8')
def descriptor(self, fd):
"""
@@ -139,20 +148,22 @@ class Magic(object):
as a buffer or None if an error occurred and the MAGIC_ERROR flag
is set. A call to errno() will return the numeric error code.
"""
- try: # attempt python3 approach first
- return str(_buffer(self._magic_t, buf, len(buf)), 'utf-8')
- except:
- return _buffer(self._magic_t, buf, len(buf))
+ r = _buffer(self._magic_t, buf, len(buf))
+ if isinstance(r, str):
+ return r
+ else:
+ return str(r).encode('utf-8')
def error(self):
"""
Returns a textual explanation of the last error or None
if there was no error.
"""
- try: # attempt python3 approach first
- return str(_error(self._magic_t), 'utf-8')
- except:
- return _error(self._magic_t)
+ e = _error(self._magic_t)
+ if isinstance(e, str):
+ return e
+ else:
+ return str(e).encode('utf-8')
def setflags(self, flags):
"""
@@ -219,3 +230,48 @@ def open(flags):
Flags argument as for setflags.
"""
return Magic(_open(flags))
+
+
+# Objects used by `detect_from_` functions
+mime_magic = Magic(_open(MAGIC_MIME))
+mime_magic.load()
+none_magic = Magic(_open(MAGIC_NONE))
+none_magic.load()
+
+
+def _create_filemagic(mime_detected, type_detected):
+ mime_type, mime_encoding = mime_detected.split('; ')
+
+ return FileMagic(name=type_detected, mime_type=mime_type,
+ encoding=mime_encoding.replace('charset=', ''))
+
+
+def detect_from_filename(filename):
+ '''Detect mime type, encoding and file type from a filename
+
+ Returns a `FileMagic` namedtuple.
+ '''
+
+ return _create_filemagic(mime_magic.file(filename),
+ none_magic.file(filename))
+
+
+def detect_from_fobj(fobj):
+ '''Detect mime type, encoding and file type from file-like object
+
+ Returns a `FileMagic` namedtuple.
+ '''
+
+ file_descriptor = fobj.fileno()
+ return _create_filemagic(mime_magic.descriptor(file_descriptor),
+ none_magic.descriptor(file_descriptor))
+
+
+def detect_from_content(byte_content):
+ '''Detect mime type, encoding and file type from bytes
+
+ Returns a `FileMagic` namedtuple.
+ '''
+
+ return _create_filemagic(mime_magic.buffer(byte_content),
+ none_magic.buffer(byte_content))
diff --git a/contrib/file/python/setup.py b/contrib/file/python/setup.py
index 2c3b527..24ae182 100644
--- a/contrib/file/python/setup.py
+++ b/contrib/file/python/setup.py
@@ -1,10 +1,22 @@
-# Python distutils build script for magic extension
-from distutils.core import setup
-
-setup(name = 'Magic file extensions',
- version = '0.2',
- author = 'Reuben Thomas',
- author_email = 'rrt@sc3d.org',
- license = 'BSD',
- description = 'libmagic Python bindings',
- py_modules = ['magic'])
+# coding: utf-8
+
+from __future__ import unicode_literals
+
+from setuptools import setup
+
+
+setup(name='file-magic',
+ version='0.3.0',
+ author='Reuben Thomas, Ãlvaro Justen',
+ author_email='rrt@sc3d.org, alvarojusten@gmail.com',
+ url='https://github.com/file/file',
+ license='BSD',
+ description='(official) libmagic Python bindings',
+ py_modules=['magic'],
+ test_suite='tests',
+ classifiers = [
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Natural Language :: English',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ])
diff --git a/contrib/file/src/Makefile.am b/contrib/file/src/Makefile.am
index e3196ce..5891feb 100644
--- a/contrib/file/src/Makefile.am
+++ b/contrib/file/src/Makefile.am
@@ -9,7 +9,7 @@ AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
- funcs.c file.h readelf.h tar.h apptype.c \
+ funcs.c file.h readelf.h tar.h apptype.c der.c der.h \
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
if MINGW
diff --git a/contrib/file/src/Makefile.in b/contrib/file/src/Makefile.in
index 5e69c00..a44bf88 100644
--- a/contrib/file/src/Makefile.in
+++ b/contrib/file/src/Makefile.in
@@ -138,8 +138,8 @@ am__DEPENDENCIES_1 =
libmagic_la_DEPENDENCIES = $(LTLIBOBJS) $(am__DEPENDENCIES_1)
am_libmagic_la_OBJECTS = magic.lo apprentice.lo softmagic.lo \
ascmagic.lo encoding.lo compress.lo is_tar.lo readelf.lo \
- print.lo fsmagic.lo funcs.lo apptype.lo cdf.lo cdf_time.lo \
- readcdf.lo
+ print.lo fsmagic.lo funcs.lo apptype.lo der.lo cdf.lo \
+ cdf_time.lo readcdf.lo
libmagic_la_OBJECTS = $(am_libmagic_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -214,9 +214,9 @@ am__define_uniq_tagged_files = \
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
- asctime_r.c asprintf.c ctime_r.c fmtcheck.c getline.c \
- getopt_long.c gmtime_r.c localtime_r.c pread.c strcasestr.c \
- strlcat.c strlcpy.c vasprintf.c
+ asctime_r.c asprintf.c ctime_r.c dprintf.c fmtcheck.c \
+ getline.c getopt_long.c gmtime_r.c localtime_r.c pread.c \
+ strcasestr.c strlcat.c strlcpy.c vasprintf.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = @pkgdatadir@
ACLOCAL = @ACLOCAL@
@@ -345,7 +345,7 @@ AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \
- funcs.c file.h readelf.h tar.h apptype.c \
+ funcs.c file.h readelf.h tar.h apptype.c der.c der.h \
file_opts.h elfclass.h mygetopt.h cdf.c cdf_time.c readcdf.c cdf.h
libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
@@ -493,6 +493,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asctime_r.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asprintf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ctime_r.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dprintf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fmtcheck.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getline.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Plo@am__quote@
@@ -509,6 +510,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdf_time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/der.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoding.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsmagic.Plo@am__quote@
diff --git a/contrib/file/src/apprentice.c b/contrib/file/src/apprentice.c
index 66f64bd..f8956de 100644
--- a/contrib/file/src/apprentice.c
+++ b/contrib/file/src/apprentice.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.238 2015/09/12 18:10:42 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.248 2016/03/31 17:51:12 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -86,9 +86,9 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.238 2015/09/12 18:10:42 christos Exp $")
#define ALLOC_CHUNK (size_t)10
#define ALLOC_INCR (size_t)200
-#define MAP_TYPE_MMAP 0
+#define MAP_TYPE_USER 0
#define MAP_TYPE_MALLOC 1
-#define MAP_TYPE_USER 2
+#define MAP_TYPE_MMAP 2
struct magic_entry {
struct magic *mp;
@@ -143,7 +143,7 @@ private int check_buffer(struct magic_set *, struct magic_map *, const char *);
private void apprentice_unmap(struct magic_map *);
private int apprentice_compile(struct magic_set *, struct magic_map *,
const char *);
-private int check_format_type(const char *, int);
+private int check_format_type(const char *, int, const char **);
private int check_format(struct magic_set *, struct magic *);
private int get_op(char);
private int parse_mime(struct magic_set *, struct magic_entry *, const char *);
@@ -268,6 +268,7 @@ static const struct type_tbl_s type_tbl[] = {
{ XX("name"), FILE_NAME, FILE_FMT_NONE },
{ XX("use"), FILE_USE, FILE_FMT_NONE },
{ XX("clear"), FILE_CLEAR, FILE_FMT_NONE },
+ { XX("der"), FILE_DER, FILE_FMT_STR },
{ XX_NULL, FILE_INVALID, FILE_FMT_NONE },
};
@@ -276,6 +277,7 @@ static const struct type_tbl_s type_tbl[] = {
* unsigned.
*/
static const struct type_tbl_s special_tbl[] = {
+ { XX("der"), FILE_DER, FILE_FMT_STR },
{ XX("name"), FILE_NAME, FILE_FMT_STR },
{ XX("use"), FILE_USE, FILE_FMT_STR },
{ XX_NULL, FILE_INVALID, FILE_FMT_NONE },
@@ -532,6 +534,7 @@ file_ms_alloc(int flags)
ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
ms->elf_notes_max = FILE_ELF_NOTES_MAX;
ms->regex_max = FILE_REGEX_MAX;
+ ms->bytes_max = FILE_BYTES_MAX;
return ms;
free:
free(ms);
@@ -546,19 +549,23 @@ apprentice_unmap(struct magic_map *map)
return;
switch (map->type) {
-#ifdef QUICK
- case MAP_TYPE_MMAP:
- if (map->p)
- (void)munmap(map->p, map->len);
+ case MAP_TYPE_USER:
break;
-#endif
case MAP_TYPE_MALLOC:
- free(map->p);
- for (i = 0; i < MAGIC_SETS; i++)
+ for (i = 0; i < MAGIC_SETS; i++) {
+ if ((char *)map->magic[i] >= (char *)map->p &&
+ (char *)map->magic[i] < (char *)map->p + map->len)
+ continue;
free(map->magic[i]);
+ }
+ free(map->p);
break;
- case MAP_TYPE_USER:
+#ifdef QUICK
+ case MAP_TYPE_MMAP:
+ if (map->p && map->p != MAP_FAILED)
+ (void)munmap(map->p, map->len);
break;
+#endif
default:
abort();
}
@@ -862,6 +869,10 @@ apprentice_magic_strength(const struct magic *m)
case FILE_USE:
break;
+ case FILE_DER:
+ val += MULT;
+ break;
+
default:
(void)fprintf(stderr, "Bad type %d\n", m->type);
abort();
@@ -1017,6 +1028,7 @@ set_test_type(struct magic *mstart, struct magic *m)
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
+ case FILE_DER:
mstart->flag |= BINTEST;
break;
case FILE_STRING:
@@ -1448,6 +1460,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
case FILE_NAME:
case FILE_USE:
case FILE_CLEAR:
+ case FILE_DER:
break;
default:
if (ms->flags & MAGIC_CHECK)
@@ -2103,7 +2116,7 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
/*
* TODO finish this macro and start using it!
- * #define offsetcheck {if (offset > HOWMANY-1)
+ * #define offsetcheck {if (offset > ms->bytes_max -1)
* magwarn("offset too big"); }
*/
@@ -2267,7 +2280,7 @@ parse_apple(struct magic_set *ms, struct magic_entry *me, const char *line)
return parse_extra(ms, me, line,
CAST(off_t, offsetof(struct magic, apple)),
- sizeof(m->apple), "APPLE", "!+-./", 0);
+ sizeof(m->apple), "APPLE", "!+-./?", 0);
}
/*
@@ -2298,11 +2311,13 @@ parse_mime(struct magic_set *ms, struct magic_entry *me, const char *line)
}
private int
-check_format_type(const char *ptr, int type)
+check_format_type(const char *ptr, int type, const char **estr)
{
int quad = 0, h;
+ size_t len, cnt;
if (*ptr == '\0') {
/* Missing format string; bad */
+ *estr = "missing format spec";
return -1;
}
@@ -2339,15 +2354,22 @@ check_format_type(const char *ptr, int type)
ptr++;
if (*ptr == '.')
ptr++;
- while (isdigit((unsigned char)*ptr)) ptr++;
+#define CHECKLEN() do { \
+ for (len = cnt = 0; isdigit((unsigned char)*ptr); ptr++, cnt++) \
+ len = len * 10 + (*ptr - '0'); \
+ if (cnt > 5 || len > 1024) \
+ goto toolong; \
+} while (/*CONSTCOND*/0)
+
+ CHECKLEN();
if (*ptr == '.')
ptr++;
- while (isdigit((unsigned char)*ptr)) ptr++;
+ CHECKLEN();
if (quad) {
if (*ptr++ != 'l')
- return -1;
+ goto invalid;
if (*ptr++ != 'l')
- return -1;
+ goto invalid;
}
switch (*ptr++) {
@@ -2361,9 +2383,11 @@ check_format_type(const char *ptr, int type)
case 'o':
case 'x':
case 'X':
- return h != 0 ? -1 : 0;
+ if (h == 0)
+ return 0;
+ /*FALLTHROUGH*/
default:
- return -1;
+ goto invalid;
}
/*
@@ -2372,11 +2396,11 @@ check_format_type(const char *ptr, int type)
*/
case 'h':
if (h-- <= 0)
- return -1;
+ goto invalid;
switch (*ptr++) {
case 'h':
if (h-- <= 0)
- return -1;
+ goto invalid;
switch (*ptr++) {
case 'i':
case 'd':
@@ -2386,7 +2410,7 @@ check_format_type(const char *ptr, int type)
case 'X':
return 0;
default:
- return -1;
+ goto invalid;
}
case 'i':
case 'd':
@@ -2394,13 +2418,17 @@ check_format_type(const char *ptr, int type)
case 'o':
case 'x':
case 'X':
- return h != 0 ? -1 : 0;
+ if (h == 0)
+ return 0;
+ /*FALLTHROUGH*/
default:
- return -1;
+ goto invalid;
}
#endif
case 'c':
- return h != 2 ? -1 : 0;
+ if (h == 2)
+ return 0;
+ goto invalid;
case 'i':
case 'd':
case 'u':
@@ -2408,12 +2436,14 @@ check_format_type(const char *ptr, int type)
case 'x':
case 'X':
#ifdef STRICT_FORMAT
- return h != 0 ? -1 : 0;
+ if (h == 0)
+ return 0;
+ /*FALLTHROUGH*/
#else
return 0;
#endif
default:
- return -1;
+ goto invalid;
}
case FILE_FMT_FLOAT:
@@ -2422,11 +2452,10 @@ check_format_type(const char *ptr, int type)
ptr++;
if (*ptr == '.')
ptr++;
- while (isdigit((unsigned char)*ptr)) ptr++;
+ CHECKLEN();
if (*ptr == '.')
ptr++;
- while (isdigit((unsigned char)*ptr)) ptr++;
-
+ CHECKLEN();
switch (*ptr++) {
case 'e':
case 'E':
@@ -2437,7 +2466,7 @@ check_format_type(const char *ptr, int type)
return 0;
default:
- return -1;
+ goto invalid;
}
@@ -2456,14 +2485,17 @@ check_format_type(const char *ptr, int type)
case 's':
return 0;
default:
- return -1;
+ goto invalid;
}
default:
/* internal error */
abort();
}
- /*NOTREACHED*/
+invalid:
+ *estr = "not valid";
+toolong:
+ *estr = "too long";
return -1;
}
@@ -2475,6 +2507,7 @@ private int
check_format(struct magic_set *ms, struct magic *m)
{
char *ptr;
+ const char *estr;
for (ptr = m->desc; *ptr; ptr++)
if (*ptr == '%')
@@ -2498,13 +2531,13 @@ check_format(struct magic_set *ms, struct magic *m)
}
ptr++;
- if (check_format_type(ptr, m->type) == -1) {
+ if (check_format_type(ptr, m->type, &estr) == -1) {
/*
* TODO: this error message is unhelpful if the format
* string is not one character long
*/
- file_magwarn(ms, "Printf format `%c' is not valid for type "
- "`%s' in description `%s'", *ptr ? *ptr : '?',
+ file_magwarn(ms, "Printf format is %s for type "
+ "`%s' in description `%s'", estr,
file_names[m->type], m->desc);
return -1;
}
@@ -2538,6 +2571,7 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
case FILE_SEARCH:
case FILE_NAME:
case FILE_USE:
+ case FILE_DER:
*p = getstr(ms, m, *p, action == FILE_COMPILE);
if (*p == NULL) {
if (ms->flags & MAGIC_CHECK)
@@ -2902,6 +2936,7 @@ apprentice_map(struct magic_set *ms, const char *fn)
file_oomem(ms, sizeof(*map));
goto error;
}
+ map->type = MAP_TYPE_USER; /* unspecified */
dbname = mkdbname(ms, fn, 0);
if (dbname == NULL)
@@ -2922,13 +2957,14 @@ apprentice_map(struct magic_set *ms, const char *fn)
map->len = (size_t)st.st_size;
#ifdef QUICK
+ map->type = MAP_TYPE_MMAP;
if ((map->p = mmap(0, (size_t)st.st_size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FILE, fd, (off_t)0)) == MAP_FAILED) {
file_error(ms, errno, "cannot map `%s'", dbname);
goto error;
}
- map->type = MAP_TYPE_MMAP;
#else
+ map->type = MAP_TYPE_MALLOC;
if ((map->p = CAST(void *, malloc(map->len))) == NULL) {
file_oomem(ms, map->len);
goto error;
@@ -2937,7 +2973,6 @@ apprentice_map(struct magic_set *ms, const char *fn)
file_badread(ms);
goto error;
}
- map->type = MAP_TYPE_MALLOC;
#define RET 1
#endif
(void)close(fd);
@@ -2945,6 +2980,12 @@ apprentice_map(struct magic_set *ms, const char *fn)
if (check_buffer(ms, map, dbname) != 0)
goto error;
+#ifdef QUICK
+ if (mprotect(map->p, (size_t)st.st_size, PROT_READ) == -1) {
+ file_error(ms, errno, "cannot mprotect `%s'", dbname);
+ goto error;
+ }
+#endif
free(dbname);
return map;
diff --git a/contrib/file/src/ascmagic.c b/contrib/file/src/ascmagic.c
index 9e0f663..baa95ab 100644
--- a/contrib/file/src/ascmagic.c
+++ b/contrib/file/src/ascmagic.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.92 2015/04/09 20:01:41 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.95 2016/05/03 16:10:37 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -79,9 +79,6 @@ file_ascmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
const char *code_mime = NULL;
const char *type = NULL;
- if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
- return 0;
-
nbytes = trim_nuls(buf, nbytes);
/* If file doesn't look like any sort of text, give up. */
@@ -123,9 +120,6 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
size_t last_line_end = (size_t)-1;
int has_long_lines = 0;
- if (ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))
- return 0;
-
nbytes = trim_nuls(buf, nbytes);
/* If we have fewer than 2 bytes, give up. */
@@ -147,10 +141,14 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
== NULL)
goto done;
if ((rv = file_softmagic(ms, utf8_buf,
- (size_t)(utf8_end - utf8_buf), 0, NULL,
+ (size_t)(utf8_end - utf8_buf), NULL, NULL,
TEXTTEST, text)) == 0)
rv = -1;
+ if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)))
+ return rv == -1 ? 0 : 1;
}
+ if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)))
+ return 0;
/* Now try to discover other details about the file. */
for (i = 0; i < ulen; i++) {
@@ -183,10 +181,10 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
}
/* Beware, if the data has been truncated, the final CR could have
- been followed by a LF. If we have HOWMANY bytes, it indicates
+ been followed by a LF. If we have ms->bytes_max bytes, it indicates
that the data might have been truncated, probably even before
this function was called. */
- if (seen_cr && nbytes < HOWMANY)
+ if (seen_cr && nbytes < ms->bytes_max)
n_cr++;
if (strcmp(type, "binary") == 0) {
diff --git a/contrib/file/src/cdf.c b/contrib/file/src/cdf.c
index c979b1d..cc587fc 100644
--- a/contrib/file/src/cdf.c
+++ b/contrib/file/src/cdf.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.76 2015/02/28 00:18:02 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.80 2016/05/06 15:17:10 christos Exp $")
#endif
#include <assert.h>
@@ -267,13 +267,32 @@ cdf_unpack_dir(cdf_directory_t *d, char *buf)
}
static int
+cdf_zero_stream(cdf_stream_t *scn)
+{
+ scn->sst_len = 0;
+ scn->sst_dirlen = 0;
+ scn->sst_ss = 0;
+ free(scn->sst_tab);
+ scn->sst_tab = NULL;
+ return -1;
+}
+
+static size_t
+cdf_check_stream(const cdf_stream_t *sst, const cdf_header_t *h)
+{
+ size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
+ CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
+ assert(ss == sst->sst_ss);
+ return sst->sst_ss;
+}
+
+static int
cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
const void *p, size_t tail, int line)
{
const char *b = (const char *)sst->sst_tab;
const char *e = ((const char *)p) + tail;
- size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
- CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
+ size_t ss = cdf_check_stream(sst, h);
/*LINTED*/(void)&line;
if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
return 0;
@@ -290,10 +309,8 @@ cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
{
size_t siz = (size_t)off + len;
- if ((off_t)(off + len) != (off_t)siz) {
- errno = EINVAL;
- return -1;
- }
+ if ((off_t)(off + len) != (off_t)siz)
+ goto out;
if (info->i_buf != NULL && info->i_len >= siz) {
(void)memcpy(buf, &info->i_buf[off], len);
@@ -301,12 +318,15 @@ cdf_read(const cdf_info_t *info, off_t off, void *buf, size_t len)
}
if (info->i_fd == -1)
- return -1;
+ goto out;
if (pread(info->i_fd, buf, len, off) != (ssize_t)len)
return -1;
return (ssize_t)len;
+out:
+ errno = EINVAL;
+ return -1;
}
int
@@ -363,11 +383,14 @@ cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs,
DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
SIZE_T_FORMAT "u\n",
pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
- return -1;
+ goto out;
}
(void)memcpy(((char *)buf) + offs,
((const char *)sst->sst_tab) + pos, len);
return len;
+out:
+ errno = EFTYPE;
+ return -1;
}
/*
@@ -421,8 +444,7 @@ cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
goto out;
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Reading master sector loop limit"));
- errno = EFTYPE;
- goto out2;
+ goto out3;
}
if (cdf_read_sector(info, msa, 0, ss, h, mid) != (ssize_t)ss) {
DPRINTF(("Reading master sector %d", mid));
@@ -435,8 +457,7 @@ cdf_read_sat(const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
if (i >= sat->sat_len) {
DPRINTF(("Out of bounds reading MSA %" SIZE_T_FORMAT
"u >= %" SIZE_T_FORMAT "u", i, sat->sat_len));
- errno = EFTYPE;
- goto out2;
+ goto out3;
}
if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
sec) != (ssize_t)ss) {
@@ -451,6 +472,8 @@ out:
sat->sat_len = i;
free(msa);
return 0;
+out3:
+ errno = EFTYPE;
out2:
free(msa);
out1:
@@ -476,23 +499,24 @@ cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
DPRINTF((" %d", sid));
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Counting chain loop limit"));
- errno = EFTYPE;
- return (size_t)-1;
+ goto out;
}
if (sid >= maxsector) {
DPRINTF(("Sector %d >= %d\n", sid, maxsector));
- errno = EFTYPE;
- return (size_t)-1;
+ goto out;
}
sid = CDF_TOLE4((uint32_t)sat->sat_tab[sid]);
}
if (i == 0) {
DPRINTF((" none, sid: %d\n", sid));
- return (size_t)-1;
+ goto out;
}
DPRINTF(("\n"));
return i;
+out:
+ errno = EFTYPE;
+ return (size_t)-1;
}
int
@@ -501,27 +525,27 @@ cdf_read_long_sector_chain(const cdf_info_t *info, const cdf_header_t *h,
{
size_t ss = CDF_SEC_SIZE(h), i, j;
ssize_t nr;
+ scn->sst_tab = NULL;
scn->sst_len = cdf_count_chain(sat, sid, ss);
scn->sst_dirlen = len;
+ scn->sst_ss = ss;
if (scn->sst_len == (size_t)-1)
- return -1;
+ goto out;
scn->sst_tab = calloc(scn->sst_len, ss);
if (scn->sst_tab == NULL)
- return -1;
+ return cdf_zero_stream(scn);
for (j = i = 0; sid >= 0; i++, j++) {
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Read long sector chain loop limit"));
- errno = EFTYPE;
goto out;
}
if (i >= scn->sst_len) {
DPRINTF(("Out of bounds reading long sector chain "
"%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
scn->sst_len));
- errno = EFTYPE;
goto out;
}
if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
@@ -537,8 +561,8 @@ cdf_read_long_sector_chain(const cdf_info_t *info, const cdf_header_t *h,
}
return 0;
out:
- free(scn->sst_tab);
- return -1;
+ errno = EFTYPE;
+ return cdf_zero_stream(scn);
}
int
@@ -547,27 +571,27 @@ cdf_read_short_sector_chain(const cdf_header_t *h,
cdf_secid_t sid, size_t len, cdf_stream_t *scn)
{
size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
- scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
+ scn->sst_tab = NULL;
+ scn->sst_len = cdf_count_chain(ssat, sid, ss);
scn->sst_dirlen = len;
+ scn->sst_ss = ss;
if (sst->sst_tab == NULL || scn->sst_len == (size_t)-1)
- return -1;
+ goto out;
scn->sst_tab = calloc(scn->sst_len, ss);
if (scn->sst_tab == NULL)
- return -1;
+ return cdf_zero_stream(scn);
for (j = i = 0; sid >= 0; i++, j++) {
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Read short sector chain loop limit"));
- errno = EFTYPE;
goto out;
}
if (i >= scn->sst_len) {
DPRINTF(("Out of bounds reading short sector chain "
"%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n",
i, scn->sst_len));
- errno = EFTYPE;
goto out;
}
if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
@@ -579,8 +603,8 @@ cdf_read_short_sector_chain(const cdf_header_t *h,
}
return 0;
out:
- free(scn->sst_tab);
- return -1;
+ errno = EFTYPE;
+ return cdf_zero_stream(scn);
}
int
@@ -625,7 +649,6 @@ cdf_read_dir(const cdf_info_t *info, const cdf_header_t *h,
for (j = i = 0; i < ns; i++, j++) {
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Read dir loop limit"));
- errno = EFTYPE;
goto out;
}
if (cdf_read_sector(info, buf, 0, ss, h, sid) != (ssize_t)ss) {
@@ -646,6 +669,7 @@ cdf_read_dir(const cdf_info_t *info, const cdf_header_t *h,
out:
free(dir->dir_tab);
free(buf);
+ errno = EFTYPE;
return -1;
}
@@ -658,36 +682,37 @@ cdf_read_ssat(const cdf_info_t *info, const cdf_header_t *h,
size_t ss = CDF_SEC_SIZE(h);
cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;
+ ssat->sat_tab = NULL;
ssat->sat_len = cdf_count_chain(sat, sid, CDF_SEC_SIZE(h));
if (ssat->sat_len == (size_t)-1)
- return -1;
+ goto out;
ssat->sat_tab = CAST(cdf_secid_t *, calloc(ssat->sat_len, ss));
if (ssat->sat_tab == NULL)
- return -1;
+ goto out1;
for (j = i = 0; sid >= 0; i++, j++) {
if (j >= CDF_LOOP_LIMIT) {
DPRINTF(("Read short sat sector loop limit"));
- errno = EFTYPE;
goto out;
}
if (i >= ssat->sat_len) {
DPRINTF(("Out of bounds reading short sector chain "
"%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i,
ssat->sat_len));
- errno = EFTYPE;
goto out;
}
if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
(ssize_t)ss) {
DPRINTF(("Reading short sat sector %d", sid));
- goto out;
+ goto out1;
}
sid = CDF_TOLE4((uint32_t)sat->sat_tab[sid]);
}
return 0;
out:
+ errno = EFTYPE;
+out1:
free(ssat->sat_tab);
return -1;
}
@@ -715,13 +740,13 @@ cdf_read_short_stream(const cdf_info_t *info, const cdf_header_t *h,
if (d->d_stream_first_sector < 0)
goto out;
- return cdf_read_long_sector_chain(info, h, sat,
+ return cdf_read_long_sector_chain(info, h, sat,
d->d_stream_first_sector, d->d_size, scn);
out:
scn->sst_tab = NULL;
- scn->sst_len = 0;
- scn->sst_dirlen = 0;
- return 0;
+ (void)cdf_zero_stream(scn);
+ errno = EFTYPE;
+ return -1;
}
static int
@@ -750,8 +775,10 @@ cdf_read_user_stream(const cdf_info_t *info, const cdf_header_t *h,
const cdf_directory_t *d;
int i = cdf_find_stream(dir, name, CDF_DIR_TYPE_USER_STREAM);
- if (i <= 0)
+ if (i <= 0) {
+ memset(scn, 0, sizeof(*scn));
return -1;
+ }
d = &dir->dir_tab[i - 1];
return cdf_read_sector_chain(info, h, sat, ssat, sst,
@@ -824,7 +851,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
malloc(*maxcount * sizeof(*inp)));
}
if (inp == NULL)
- goto out;
+ goto out1;
*info = inp;
inp += *count;
*count += sh.sh_properties;
@@ -931,7 +958,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
inp = CAST(cdf_property_info_t *,
realloc(*info, *maxcount * sizeof(*inp)));
if (inp == NULL)
- goto out;
+ goto out1;
*info = inp;
inp = *info + nelem;
}
@@ -976,6 +1003,8 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
}
return 0;
out:
+ errno = EFTYPE;
+out1:
free(*info);
return -1;
}
@@ -1022,8 +1051,7 @@ int
cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
cdf_catalog_t **cat)
{
- size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
- CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
+ size_t ss = cdf_check_stream(sst, h);
const char *b = CAST(const char *, sst->sst_tab);
const char *eb = b + ss * sst->sst_len;
size_t nr, i, j, k;
@@ -1043,6 +1071,8 @@ cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
nr--;
*cat = CAST(cdf_catalog_t *,
malloc(sizeof(cdf_catalog_t) + nr * sizeof(*ce)));
+ if (*cat == NULL)
+ return -1;
ce = (*cat)->cat_e;
memset(ce, 0, nr * sizeof(*ce));
b = CAST(const char *, sst->sst_tab);
@@ -1245,8 +1275,7 @@ cdf_dump(const void *v, size_t len)
void
cdf_dump_stream(const cdf_header_t *h, const cdf_stream_t *sst)
{
- size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
- CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
+ size_t ss = sst->sst_ss;
cdf_dump(sst->sst_tab, ss * sst->sst_len);
}
diff --git a/contrib/file/src/cdf.h b/contrib/file/src/cdf.h
index cee8d77..853a719 100644
--- a/contrib/file/src/cdf.h
+++ b/contrib/file/src/cdf.h
@@ -129,6 +129,7 @@ typedef struct {
void *sst_tab;
size_t sst_len;
size_t sst_dirlen;
+ size_t sst_ss;
} cdf_stream_t;
typedef struct {
@@ -277,7 +278,7 @@ typedef struct {
typedef struct {
size_t cat_num;
- cdf_catalog_entry_t cat_e[0];
+ cdf_catalog_entry_t cat_e[1];
} cdf_catalog_t;
struct timespec;
diff --git a/contrib/file/src/compress.c b/contrib/file/src/compress.c
index 539031e..979443b 100644
--- a/contrib/file/src/compress.c
+++ b/contrib/file/src/compress.c
@@ -35,7 +35,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.80 2015/06/03 18:21:24 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.96 2016/04/20 00:00:26 christos Exp $")
#endif
#include "magic.h"
@@ -45,6 +45,8 @@ FILE_RCSID("@(#)$File: compress.c,v 1.80 2015/06/03 18:21:24 christos Exp $")
#endif
#include <string.h>
#include <errno.h>
+#include <ctype.h>
+#include <stdarg.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
# ifndef HAVE_SIG_T
@@ -63,43 +65,119 @@ typedef void (*sig_t)(int);
#if defined(HAVE_ZLIB_H) && defined(HAVE_LIBZ)
#define BUILTIN_DECOMPRESS
#include <zlib.h>
+#define ZLIBSUPPORT
#endif
+#ifdef DEBUG
+int tty = -1;
+#define DPRINTF(...) do { \
+ if (tty == -1) \
+ tty = open("/dev/tty", O_RDWR); \
+ if (tty == -1) \
+ abort(); \
+ dprintf(tty, __VA_ARGS__); \
+} while (/*CONSTCOND*/0)
+#else
+#define DPRINTF(...)
+#endif
+
+#ifdef ZLIBSUPPORT
+/*
+ * The following python code is not really used because ZLIBSUPPORT is only
+ * defined if we have a built-in zlib, and the built-in zlib handles that.
+ */
+static const char zlibcode[] =
+ "import sys, zlib; sys.stdout.write(zlib.decompress(sys.stdin.read()))";
+
+static const char *zlib_args[] = { "python", "-c", zlibcode, NULL };
+
+static int
+zlibcmp(const unsigned char *buf)
+{
+ unsigned short x = 1;
+ unsigned char *s = (unsigned char *)&x;
+
+ if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
+ return 0;
+ if (s[0] != 1) /* endianness test */
+ x = buf[0] | (buf[1] << 8);
+ else
+ x = buf[1] | (buf[0] << 8);
+ if (x % 31)
+ return 0;
+ return 1;
+}
+#endif
+
+#define gzip_flags "-cd"
+#define lrzip_flags "-do"
+#define lzip_flags gzip_flags
+
+static const char *gzip_args[] = {
+ "gzip", gzip_flags, NULL
+};
+static const char *uncompress_args[] = {
+ "uncompress", "-c", NULL
+};
+static const char *bzip2_args[] = {
+ "bzip2", "-cd", NULL
+};
+static const char *lzip_args[] = {
+ "lzip", lzip_flags, NULL
+};
+static const char *xz_args[] = {
+ "xz", "-cd", NULL
+};
+static const char *lrzip_args[] = {
+ "lrzip", lrzip_flags, NULL
+};
+static const char *lz4_args[] = {
+ "lz4", "-cd", NULL
+};
private const struct {
- const char magic[8];
+ const void *magic;
size_t maglen;
- const char *argv[3];
- int silent;
+ const char **argv;
} compr[] = {
- { "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */
+ { "\037\235", 2, gzip_args }, /* compressed */
/* Uncompress can get stuck; so use gzip first if we have it
* Idea from Damien Clark, thanks! */
- { "\037\235", 2, { "uncompress", "-c", NULL }, 1 }, /* compressed */
- { "\037\213", 2, { "gzip", "-cdq", NULL }, 1 }, /* gzipped */
- { "\037\236", 2, { "gzip", "-cdq", NULL }, 1 }, /* frozen */
- { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */
+ { "\037\235", 2, uncompress_args }, /* compressed */
+ { "\037\213", 2, gzip_args }, /* gzipped */
+ { "\037\236", 2, gzip_args }, /* frozen */
+ { "\037\240", 2, gzip_args }, /* SCO LZH */
/* the standard pack utilities do not accept standard input */
- { "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */
- { "PK\3\4", 4, { "gzip", "-cdq", NULL }, 1 }, /* pkzipped, */
- /* ...only first file examined */
- { "BZh", 3, { "bzip2", "-cd", NULL }, 1 }, /* bzip2-ed */
- { "LZIP", 4, { "lzip", "-cdq", NULL }, 1 },
- { "\3757zXZ\0",6,{ "xz", "-cd", NULL }, 1 }, /* XZ Utils */
- { "LRZI", 4, { "lrzip", "-dqo-", NULL }, 1 }, /* LRZIP */
- { "\004\"M\030", 4, { "lz4", "-cd", NULL }, 1 }, /* LZ4 */
+ { "\037\036", 2, gzip_args }, /* packed */
+ { "PK\3\4", 4, gzip_args }, /* pkzipped, */
+ /* ...only first file examined */
+ { "BZh", 3, bzip2_args }, /* bzip2-ed */
+ { "LZIP", 4, lzip_args }, /* lzip-ed */
+ { "\3757zXZ\0", 6, xz_args }, /* XZ Utils */
+ { "LRZI", 4, lrzip_args }, /* LRZIP */
+ { "\004\"M\030",4, lz4_args }, /* LZ4 */
+#ifdef ZLIBSUPPORT
+ { zlibcmp, 0, zlib_args }, /* zlib */
+#endif
};
-#define NODATA ((size_t)~0)
+#define OKDATA 0
+#define NODATA 1
+#define ERRDATA 2
private ssize_t swrite(int, const void *, size_t);
#if HAVE_FORK
private size_t ncompr = sizeof(compr) / sizeof(compr[0]);
-private size_t uncompressbuf(struct magic_set *, int, size_t,
- const unsigned char *, unsigned char **, size_t);
+private int uncompressbuf(int, size_t, size_t, const unsigned char *,
+ unsigned char **, size_t *);
#ifdef BUILTIN_DECOMPRESS
-private size_t uncompressgzipped(struct magic_set *, const unsigned char *,
- unsigned char **, size_t);
+private int uncompresszlib(const unsigned char *, unsigned char **, size_t,
+ size_t *, int);
+private int uncompressgzipped(const unsigned char *, unsigned char **, size_t,
+ size_t *);
#endif
+static int makeerror(unsigned char **, size_t *, const char *, ...)
+ __attribute__((__format__(__printf__, 3, 4)));
+private const char *methodname(size_t);
protected int
file_zmagic(struct magic_set *ms, int fd, const char *name,
@@ -107,7 +185,9 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
{
unsigned char *newbuf = NULL;
size_t i, nsz;
- int rv = 0;
+ char *rbuf;
+ file_pushbuf_t *pb;
+ int urv, prv, rv = 0;
int mime = ms->flags & MAGIC_MIME;
#ifdef HAVE_SIGNAL_H
sig_t osigpipe;
@@ -120,37 +200,80 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
osigpipe = signal(SIGPIPE, SIG_IGN);
#endif
for (i = 0; i < ncompr; i++) {
+ int zm;
if (nbytes < compr[i].maglen)
continue;
- if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0 &&
- (nsz = uncompressbuf(ms, fd, i, buf, &newbuf,
- nbytes)) != NODATA) {
+#ifdef ZLIBSUPPORT
+ if (compr[i].maglen == 0)
+ zm = (CAST(int (*)(const unsigned char *),
+ CCAST(void *, compr[i].magic)))(buf);
+ else
+#endif
+ zm = memcmp(buf, compr[i].magic, compr[i].maglen) == 0;
+
+ if (!zm)
+ continue;
+ nsz = nbytes;
+ urv = uncompressbuf(fd, ms->bytes_max, i, buf, &newbuf, &nsz);
+ DPRINTF("uncompressbuf = %d, %s, %zu\n", urv, (char *)newbuf,
+ nsz);
+ switch (urv) {
+ case OKDATA:
+ case ERRDATA:
+
ms->flags &= ~MAGIC_COMPRESS;
- rv = -1;
- if (file_buffer(ms, -1, name, newbuf, nsz) == -1)
+ if (urv == ERRDATA)
+ prv = file_printf(ms, "%s ERROR: %s",
+ methodname(i), newbuf);
+ else
+ prv = file_buffer(ms, -1, name, newbuf, nsz);
+ if (prv == -1)
goto error;
-
- if ((ms->flags & MAGIC_COMPRESS_TRANSP) == 0 &&
- (mime == MAGIC_MIME || mime == 0)) {
- if (file_printf(ms, mime ?
- " compressed-encoding=" : " (") == -1)
- goto error;
- if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
- goto error;
- if (!mime && file_printf(ms, ")") == -1)
+ rv = 1;
+ if ((ms->flags & MAGIC_COMPRESS_TRANSP) != 0)
+ goto out;
+ if (mime != MAGIC_MIME && mime != 0)
+ goto out;
+ if ((file_printf(ms,
+ mime ? " compressed-encoding=" : " (")) == -1)
+ goto error;
+ if ((pb = file_push_buffer(ms)) == NULL)
+ goto error;
+ /*
+ * XXX: If file_buffer fails here, we overwrite
+ * the compressed text. FIXME.
+ */
+ if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
+ goto error;
+ if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
+ if (file_printf(ms, "%s", rbuf) == -1) {
+ free(rbuf);
goto error;
+ }
+ free(rbuf);
}
-
- rv = 1;
+ if (!mime && file_printf(ms, ")") == -1)
+ goto error;
+ /*FALLTHROUGH*/
+ case NODATA:
+ break;
+ default:
+ abort();
+ /*NOTREACHED*/
+ error:
+ rv = -1;
break;
}
}
-error:
+out:
+ DPRINTF("rv = %d\n", rv);
+
#ifdef HAVE_SIGNAL_H
(void)signal(SIGPIPE, osigpipe);
#endif
free(newbuf);
ms->flags |= MAGIC_COMPRESS;
+ DPRINTF("Zmagic returns %d\n", rv);
return rv;
}
#endif
@@ -322,222 +445,314 @@ file_pipe2file(struct magic_set *ms, int fd, const void *startbuf,
#define FNAME (1 << 3)
#define FCOMMENT (1 << 4)
-private size_t
-uncompressgzipped(struct magic_set *ms, const unsigned char *old,
- unsigned char **newch, size_t n)
+
+private int
+uncompressgzipped(const unsigned char *old, unsigned char **newch,
+ size_t bytes_max, size_t *n)
{
unsigned char flg = old[3];
size_t data_start = 10;
- z_stream z;
- int rc;
if (flg & FEXTRA) {
- if (data_start+1 >= n)
- return 0;
+ if (data_start + 1 >= *n)
+ goto err;
data_start += 2 + old[data_start] + old[data_start + 1] * 256;
}
if (flg & FNAME) {
- while(data_start < n && old[data_start])
+ while(data_start < *n && old[data_start])
data_start++;
data_start++;
}
- if(flg & FCOMMENT) {
- while(data_start < n && old[data_start])
+ if (flg & FCOMMENT) {
+ while(data_start < *n && old[data_start])
data_start++;
data_start++;
}
- if(flg & FHCRC)
+ if (flg & FHCRC)
data_start += 2;
- if (data_start >= n)
- return 0;
- if ((*newch = CAST(unsigned char *, malloc(HOWMANY + 1))) == NULL) {
- return 0;
- }
-
- /* XXX: const castaway, via strchr */
- z.next_in = (Bytef *)strchr((const char *)old + data_start,
- old[data_start]);
- z.avail_in = CAST(uint32_t, (n - data_start));
+ if (data_start >= *n)
+ goto err;
+
+ *n -= data_start;
+ old += data_start;
+ return uncompresszlib(old, newch, bytes_max, n, 0);
+err:
+ return makeerror(newch, n, "File too short");
+}
+
+private int
+uncompresszlib(const unsigned char *old, unsigned char **newch,
+ size_t bytes_max, size_t *n, int zlib)
+{
+ int rc;
+ z_stream z;
+
+ if ((*newch = CAST(unsigned char *, malloc(bytes_max + 1))) == NULL)
+ return makeerror(newch, n, "No buffer, %s", strerror(errno));
+
+ z.next_in = CCAST(Bytef *, old);
+ z.avail_in = CAST(uint32_t, *n);
z.next_out = *newch;
- z.avail_out = HOWMANY;
+ z.avail_out = bytes_max;
z.zalloc = Z_NULL;
z.zfree = Z_NULL;
z.opaque = Z_NULL;
/* LINTED bug in header macro */
- rc = inflateInit2(&z, -15);
- if (rc != Z_OK) {
- file_error(ms, 0, "zlib: %s", z.msg);
- return 0;
- }
+ rc = zlib ? inflateInit(&z) : inflateInit2(&z, -15);
+ if (rc != Z_OK)
+ goto err;
rc = inflate(&z, Z_SYNC_FLUSH);
- if (rc != Z_OK && rc != Z_STREAM_END) {
- file_error(ms, 0, "zlib: %s", z.msg);
- return 0;
- }
+ if (rc != Z_OK && rc != Z_STREAM_END)
+ goto err;
- n = (size_t)z.total_out;
- (void)inflateEnd(&z);
+ *n = (size_t)z.total_out;
+ rc = inflateEnd(&z);
+ if (rc != Z_OK)
+ goto err;
/* let's keep the nul-terminate tradition */
- (*newch)[n] = '\0';
+ (*newch)[*n] = '\0';
- return n;
+ return OKDATA;
+err:
+ strlcpy((char *)*newch, z.msg, bytes_max);
+ *n = strlen((char *)*newch);
+ return ERRDATA;
}
#endif
-private size_t
-uncompressbuf(struct magic_set *ms, int fd, size_t method,
- const unsigned char *old, unsigned char **newch, size_t n)
+static int
+makeerror(unsigned char **buf, size_t *len, const char *fmt, ...)
+{
+ char *msg;
+ va_list ap;
+ int rv;
+
+ va_start(ap, fmt);
+ rv = vasprintf(&msg, fmt, ap);
+ va_end(ap);
+ if (rv < 0) {
+ *buf = NULL;
+ *len = 0;
+ return NODATA;
+ }
+ *buf = (unsigned char *)msg;
+ *len = strlen(msg);
+ return ERRDATA;
+}
+
+static void
+closefd(int *fd, size_t i)
+{
+ if (fd[i] == -1)
+ return;
+ (void) close(fd[i]);
+ fd[i] = -1;
+}
+
+static void
+closep(int *fd)
+{
+ size_t i;
+ for (i = 0; i < 2; i++)
+ closefd(fd, i);
+}
+
+static void
+copydesc(int i, int *fd)
+{
+ int j = fd[i == STDIN_FILENO ? 0 : 1];
+ if (j == i)
+ return;
+ if (dup2(j, i) == -1) {
+ DPRINTF("dup(%d, %d) failed (%s)\n", j, i, strerror(errno));
+ exit(1);
+ }
+ closep(fd);
+}
+
+static void
+writechild(int fdp[3][2], const void *old, size_t n)
{
- int fdin[2], fdout[2];
int status;
+
+ closefd(fdp[STDIN_FILENO], 0);
+ /*
+ * fork again, to avoid blocking because both
+ * pipes filled
+ */
+ switch (fork()) {
+ case 0: /* child */
+ closefd(fdp[STDOUT_FILENO], 0);
+ if (swrite(fdp[STDIN_FILENO][1], old, n) != (ssize_t)n) {
+ DPRINTF("Write failed (%s)\n", strerror(errno));
+ exit(1);
+ }
+ exit(0);
+ /*NOTREACHED*/
+
+ case -1:
+ DPRINTF("Fork failed (%s)\n", strerror(errno));
+ exit(1);
+ /*NOTREACHED*/
+
+ default: /* parent */
+ if (wait(&status) == -1) {
+ DPRINTF("Wait failed (%s)\n", strerror(errno));
+ exit(1);
+ }
+ DPRINTF("Grandchild wait return %#x\n", status);
+ }
+ closefd(fdp[STDIN_FILENO], 1);
+}
+
+static ssize_t
+filter_error(unsigned char *ubuf, ssize_t n)
+{
+ char *p;
+ char *buf;
+
+ ubuf[n] = '\0';
+ buf = (char *)ubuf;
+ while (isspace((unsigned char)*buf))
+ buf++;
+ DPRINTF("Filter error[[[%s]]]\n", buf);
+ if ((p = strchr((char *)buf, '\n')) != NULL)
+ *p = '\0';
+ if ((p = strchr((char *)buf, ';')) != NULL)
+ *p = '\0';
+ if ((p = strrchr((char *)buf, ':')) != NULL) {
+ ++p;
+ while (isspace((unsigned char)*p))
+ p++;
+ n = strlen(p);
+ memmove(ubuf, p, n + 1);
+ }
+ DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
+ if (islower(*ubuf))
+ *ubuf = toupper(*ubuf);
+ return n;
+}
+
+private const char *
+methodname(size_t method)
+{
+#ifdef BUILTIN_DECOMPRESS
+ /* FIXME: This doesn't cope with bzip2 */
+ if (method == 2 || compr[method].maglen == 0)
+ return "zlib";
+#endif
+ return compr[method].argv[0];
+}
+
+private int
+uncompressbuf(int fd, size_t bytes_max, size_t method, const unsigned char *old,
+ unsigned char **newch, size_t* n)
+{
+ int fdp[3][2];
+ int status, rv;
+ size_t i;
ssize_t r;
#ifdef BUILTIN_DECOMPRESS
/* FIXME: This doesn't cope with bzip2 */
if (method == 2)
- return uncompressgzipped(ms, old, newch, n);
+ return uncompressgzipped(old, newch, bytes_max, n);
+ if (compr[method].maglen == 0)
+ return uncompresszlib(old, newch, bytes_max, n, 1);
#endif
(void)fflush(stdout);
(void)fflush(stderr);
- if ((fd != -1 && pipe(fdin) == -1) || pipe(fdout) == -1) {
- file_error(ms, errno, "cannot create pipe");
- return NODATA;
+ for (i = 0; i < __arraycount(fdp); i++)
+ fdp[i][0] = fdp[i][1] = -1;
+
+ if ((fd == -1 && pipe(fdp[STDIN_FILENO]) == -1) ||
+ pipe(fdp[STDOUT_FILENO]) == -1 || pipe(fdp[STDERR_FILENO]) == -1) {
+ closep(fdp[STDIN_FILENO]);
+ closep(fdp[STDOUT_FILENO]);
+ return makeerror(newch, n, "Cannot create pipe, %s",
+ strerror(errno));
}
switch (fork()) {
case 0: /* child */
- (void) close(0);
if (fd != -1) {
- if (dup(fd) == -1)
- _exit(1);
- (void) lseek(0, (off_t)0, SEEK_SET);
- } else {
- if (dup(fdin[0]) == -1)
- _exit(1);
- (void) close(fdin[0]);
- (void) close(fdin[1]);
+ fdp[STDIN_FILENO][0] = fd;
+ (void) lseek(fd, (off_t)0, SEEK_SET);
}
-
- (void) close(1);
- if (dup(fdout[1]) == -1)
- _exit(1);
- (void) close(fdout[0]);
- (void) close(fdout[1]);
-#ifndef DEBUG
- if (compr[method].silent)
- (void)close(2);
-#endif
+
+ for (i = 0; i < __arraycount(fdp); i++)
+ copydesc(i, fdp[i]);
(void)execvp(compr[method].argv[0],
(char *const *)(intptr_t)compr[method].argv);
-#ifdef DEBUG
- (void)fprintf(stderr, "exec `%s' failed (%s)\n",
+ dprintf(STDERR_FILENO, "exec `%s' failed, %s",
compr[method].argv[0], strerror(errno));
-#endif
exit(1);
/*NOTREACHED*/
case -1:
- file_error(ms, errno, "could not fork");
- return NODATA;
+ return makeerror(newch, n, "Cannot fork, %s",
+ strerror(errno));
default: /* parent */
- (void) close(fdout[1]);
- if (fd == -1) {
- (void) close(fdin[0]);
- /*
- * fork again, to avoid blocking because both
- * pipes filled
- */
- switch (fork()) {
- case 0: /* child */
- (void)close(fdout[0]);
- if (swrite(fdin[1], old, n) != (ssize_t)n) {
-#ifdef DEBUG
- (void)fprintf(stderr,
- "Write failed (%s)\n",
- strerror(errno));
-#endif
- exit(1);
- }
- exit(0);
- /*NOTREACHED*/
+ for (i = 1; i < __arraycount(fdp); i++)
+ closefd(fdp[i], 1);
- case -1:
-#ifdef DEBUG
- (void)fprintf(stderr, "Fork failed (%s)\n",
- strerror(errno));
-#endif
- exit(1);
- /*NOTREACHED*/
+ /* Write the buffer data to the child, if we don't have fd */
+ if (fd == -1)
+ writechild(fdp, old, *n);
- default: /* parent */
- if (wait(&status) == -1) {
-#ifdef DEBUG
- (void)fprintf(stderr,
- "Wait failed (%s)\n",
- strerror(errno));
-#endif
- exit(1);
- }
- exit(WIFEXITED(status) ?
- WEXITSTATUS(status) : 1);
- /*NOTREACHED*/
- }
- (void) close(fdin[1]);
- fdin[1] = -1;
- }
-
- if ((*newch = (unsigned char *) malloc(HOWMANY + 1)) == NULL) {
-#ifdef DEBUG
- (void)fprintf(stderr, "Malloc failed (%s)\n",
+ *newch = CAST(unsigned char *, malloc(bytes_max + 1));
+ if (*newch == NULL) {
+ rv = makeerror(newch, n, "No buffer, %s",
strerror(errno));
-#endif
- n = NODATA;
goto err;
}
- if ((r = sread(fdout[0], *newch, HOWMANY, 0)) <= 0) {
-#ifdef DEBUG
- (void)fprintf(stderr, "Read failed (%s)\n",
- strerror(errno));
-#endif
- free(*newch);
- n = NODATA;
- *newch = NULL;
- goto err;
- } else {
- n = r;
+ rv = OKDATA;
+ if ((r = sread(fdp[STDOUT_FILENO][0], *newch, bytes_max, 0)) > 0)
+ break;
+ DPRINTF("Read stdout failed %d (%s)\n", fdp[STDOUT_FILENO][0],
+ r != -1 ? strerror(errno) : "no data");
+
+ rv = ERRDATA;
+ if (r == 0 &&
+ (r = sread(fdp[STDERR_FILENO][0], *newch, bytes_max, 0)) > 0)
+ {
+ r = filter_error(*newch, r);
+ break;
}
- /* NUL terminate, as every buffer is handled here. */
- (*newch)[n] = '\0';
-err:
- if (fdin[1] != -1)
- (void) close(fdin[1]);
- (void) close(fdout[0]);
- if (wait(&status) == -1) {
-#ifdef DEBUG
- (void)fprintf(stderr, "Wait failed (%s)\n",
+ free(*newch);
+ if (r == 0)
+ rv = makeerror(newch, n, "Read failed, %s",
strerror(errno));
-#endif
- n = NODATA;
- } else if (!WIFEXITED(status)) {
-#ifdef DEBUG
- (void)fprintf(stderr, "Child not exited (0x%x)\n",
- status);
-#endif
- } else if (WEXITSTATUS(status) != 0) {
-#ifdef DEBUG
- (void)fprintf(stderr, "Child exited (0x%d)\n",
- WEXITSTATUS(status));
-#endif
- }
+ else
+ rv = makeerror(newch, n, "No data");
+ goto err;
+ }
- (void) close(fdin[0]);
-
- return n;
+ *n = r;
+ /* NUL terminate, as every buffer is handled here. */
+ (*newch)[*n] = '\0';
+err:
+ closefd(fdp[STDIN_FILENO], 1);
+ closefd(fdp[STDOUT_FILENO], 0);
+ closefd(fdp[STDERR_FILENO], 0);
+ if (wait(&status) == -1) {
+ free(*newch);
+ rv = makeerror(newch, n, "Wait failed, %s", strerror(errno));
+ DPRINTF("Child wait return %#x\n", status);
+ } else if (!WIFEXITED(status)) {
+ DPRINTF("Child not exited (0x%x)\n", status);
+ } else if (WEXITSTATUS(status) != 0) {
+ DPRINTF("Child exited (0x%d)\n", WEXITSTATUS(status));
}
+
+ closefd(fdp[STDIN_FILENO], 0);
+ DPRINTF("Returning %p n=%zu rv=%d\n", *newch, *n, rv);
+
+ return rv;
}
#endif
diff --git a/contrib/file/src/der.c b/contrib/file/src/der.c
new file mode 100644
index 0000000..af5f149
--- /dev/null
+++ b/contrib/file/src/der.c
@@ -0,0 +1,384 @@
+/*-
+ * Copyright (c) 2016 Christos Zoulas
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * DER (Distinguished Encoding Rules) Parser
+ *
+ * Sources:
+ * https://en.wikipedia.org/wiki/X.690
+ * http://fm4dd.com/openssl/certexamples.htm
+ * http://blog.engelke.com/2014/10/17/parsing-ber-and-der-encoded-asn-1-objects/
+ */
+#ifndef TEST_DER
+#include "file.h"
+
+#ifndef lint
+FILE_RCSID("@(#)$File: der.c,v 1.6 2016/04/21 14:26:03 christos Exp $")
+#endif
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifndef TEST_DER
+#include "magic.h"
+#include "der.h"
+#else
+#include <err.h>
+#endif
+
+#define DER_BAD ((uint32_t)-1)
+
+#define DER_CLASS_UNIVERSAL 0
+#define DER_CLASS_APPLICATION 1
+#define DER_CLASS_CONTEXT 2
+#define DER_CLASS_PRIVATE 3
+#ifdef DEBUG_DER
+static const char der_class[] = "UACP";
+#endif
+
+#define DER_TYPE_PRIMITIVE 0
+#define DER_TYPE_CONSTRUCTED 1
+#ifdef DEBUG_DER
+static const char der_type[] = "PC";
+#endif
+
+#define DER_TAG_EOC 0x00
+#define DER_TAG_BOOLEAN 0x01
+#define DER_TAG_INTEGER 0x02
+#define DER_TAG_BIT STRING 0x03
+#define DER_TAG_OCTET_STRING 0x04
+#define DER_TAG_NULL 0x05
+#define DER_TAG_OBJECT_IDENTIFIER 0x06
+#define DER_TAG_OBJECT_DESCRIPTOR 0x07
+#define DER_TAG_EXTERNAL 0x08
+#define DER_TAG_REAL 0x09
+#define DER_TAG_ENUMERATED 0x0a
+#define DER_TAG_EMBEDDED_PDV 0x0b
+#define DER_TAG_UTF8_STRING 0x0c
+#define DER_TAG_RELATIVE_OID 0x0d
+#define DER_TAG_RESERVED_1 0x0e
+#define DER_TAG_RESERVED_2 0x0f
+#define DER_TAG_SEQUENCE 0x10
+#define DER_TAG_SET 0x11
+#define DER_TAG_NUMERIC_STRING 0x12
+#define DER_TAG_PRINTABLE_STRING 0x13
+#define DER_TAG_T61_STRING 0x14
+#define DER_TAG_VIDEOTEX_STRING 0x15
+#define DER_TAG_IA5_STRING 0x16
+#define DER_TAG_UTCTIME 0x17
+#define DER_TAG_GENERALIZED_TIME 0x18
+#define DER_TAG_GRAPHIC_STRING 0x19
+#define DER_TAG_VISIBLE_STRING 0x1a
+#define DER_TAG_GENERAL_STRING 0x1b
+#define DER_TAG_UNIVERSAL_STRING 0x1c
+#define DER_TAG_CHARACTER_STRING 0x1d
+#define DER_TAG_BMP_STRING 0x1e
+#define DER_TAG_LONG 0x1f
+
+static const char *der__tag[] = {
+ "eoc", "bool", "int", "bit_str", "octet_str",
+ "null", "obj_id", "obj_desc", "ext", "real",
+ "enum", "embed", "utf8_str", "oid", "res1",
+ "res2", "seq", "set", "num_str", "prt_str",
+ "t61_str", "vid_str", "ia5_str", "utc_time",
+ "gen_time", "gr_str", "vis_str", "gen_str",
+ "char_str", "bmp_str", "long"
+};
+
+#ifdef DEBUG_DER
+#define DPRINTF(a) printf a
+#else
+#define DPRINTF(a)
+#endif
+
+#ifdef TEST_DER
+static uint8_t
+getclass(uint8_t c)
+{
+ return c >> 6;
+}
+
+static uint8_t
+gettype(uint8_t c)
+{
+ return (c >> 5) & 1;
+}
+#endif
+
+static uint32_t
+gettag(const uint8_t *c, size_t *p, size_t l)
+{
+ uint32_t tag;
+
+ if (*p >= l)
+ return DER_BAD;
+
+ tag = c[(*p)++] & 0x1f;
+
+ if (tag != 0x1f)
+ return tag;
+
+ if (*p >= l)
+ return DER_BAD;
+
+ while (c[*p] >= 0x80) {
+ tag = tag * 128 + c[(*p)++] - 0x80;
+ if (*p >= l)
+ return DER_BAD;
+ }
+ return tag;
+}
+
+static uint32_t
+getlength(const uint8_t *c, size_t *p, size_t l)
+{
+ uint8_t digits, i;
+ size_t len;
+
+ if (*p >= l)
+ return DER_BAD;
+
+ digits = c[(*p)++];
+
+ if ((digits & 0x80) == 0)
+ return digits;
+
+ digits &= 0x7f;
+ len = 0;
+
+ if (*p + digits >= l)
+ return DER_BAD;
+
+ for (i = 0; i < digits; i++)
+ len = (len << 8) | c[(*p)++];
+ return len;
+}
+
+static const char *
+der_tag(char *buf, size_t len, uint32_t tag)
+{
+ if (tag < DER_TAG_LONG)
+ strlcpy(buf, der__tag[tag], len);
+ else
+ snprintf(buf, len, "%#x", tag);
+ return buf;
+}
+
+#ifndef TEST_DER
+static int
+der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
+{
+ const uint8_t *d = q;
+ switch (tag) {
+ case DER_TAG_PRINTABLE_STRING:
+ case DER_TAG_UTF8_STRING:
+ case DER_TAG_IA5_STRING:
+ case DER_TAG_UTCTIME:
+ return snprintf(buf, blen, "%.*s", len, (const char *)q);
+ default:
+ break;
+ }
+
+ for (uint32_t i = 0; i < len; i++) {
+ uint32_t z = i << 1;
+ if (z < blen - 2)
+ snprintf(buf + z, blen - z, "%.2x", d[i]);
+ }
+ return len * 2;
+}
+
+int32_t
+der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
+{
+ const uint8_t *b = CAST(const void *, ms->search.s);
+ size_t offs = 0, len = ms->search.rm_len ? ms->search.rm_len : nbytes;
+
+ if (gettag(b, &offs, len) == DER_BAD)
+ return -1;
+ DPRINTF(("%s1: %d %zu %u\n", __func__, ms->offset, offs, m->offset));
+
+ uint32_t tlen = getlength(b, &offs, len);
+ if (tlen == DER_BAD)
+ return -1;
+ DPRINTF(("%s2: %d %zu %u\n", __func__, ms->offset, offs, tlen));
+
+ offs += ms->offset + m->offset;
+ DPRINTF(("cont_level = %d\n", m->cont_level));
+#ifdef DEBUG_DER
+ for (size_t i = 0; i < m->cont_level; i++)
+ printf("cont_level[%zu] = %u\n", i, ms->c.li[i].off);
+#endif
+ if (m->cont_level != 0) {
+ if (offs + tlen > nbytes)
+ return DER_BAD;
+ ms->c.li[m->cont_level - 1].off = offs + tlen;
+ DPRINTF(("cont_level[%u] = %u\n", m->cont_level - 1,
+ ms->c.li[m->cont_level - 1].off));
+ }
+ return offs;
+}
+
+int
+der_cmp(struct magic_set *ms, struct magic *m)
+{
+ const uint8_t *b = CAST(const void *, ms->search.s);
+ const char *s = m->value.s;
+ size_t offs = 0, len = ms->search.s_len;
+ uint32_t tag, tlen;
+ char buf[128];
+
+ tag = gettag(b, &offs, len);
+ if (tag == DER_BAD)
+ return -1;
+
+ tlen = getlength(b, &offs, len);
+ if (tlen == DER_BAD)
+ return -1;
+
+ der_tag(buf, sizeof(buf), tag);
+ if ((ms->flags & MAGIC_DEBUG) != 0)
+ fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b,
+ buf, s);
+ size_t slen = strlen(buf);
+
+ if (strncmp(buf, s, slen) != 0)
+ return 0;
+
+ s += slen;
+
+again:
+ switch (*s) {
+ case '\0':
+ return 1;
+ case '=':
+ s++;
+ goto val;
+ default:
+ if (!isdigit((unsigned char)*s))
+ return 0;
+
+ slen = 0;
+ do
+ slen = slen * 10 + *s - '0';
+ while (isdigit((unsigned char)*++s));
+ if ((ms->flags & MAGIC_DEBUG) != 0)
+ fprintf(stderr, "%s: len %zu %u\n", __func__,
+ slen, tlen);
+ if (tlen != slen)
+ return 0;
+ goto again;
+ }
+val:
+ DPRINTF(("%s: before data %zu %u\n", __func__, offs, tlen));
+ der_data(buf, sizeof(buf), tag, b + offs, tlen);
+ if ((ms->flags & MAGIC_DEBUG) != 0)
+ fprintf(stderr, "%s: data %s %s\n", __func__, buf, s);
+ if (strcmp(buf, s) != 0 && strcmp("x", s) != 0)
+ return 0;
+ strlcpy(ms->ms_value.s, buf, sizeof(ms->ms_value.s));
+ return 1;
+}
+#endif
+
+#ifdef TEST_DER
+static void
+printtag(uint32_t tag, const void *q, uint32_t len)
+{
+ const uint8_t *d = q;
+ switch (tag) {
+ case DER_TAG_PRINTABLE_STRING:
+ case DER_TAG_UTF8_STRING:
+ printf("%.*s\n", len, (const char *)q);
+ return;
+ default:
+ break;
+ }
+
+ for (uint32_t i = 0; i < len; i++)
+ printf("%.2x", d[i]);
+ printf("\n");
+}
+
+static void
+printdata(size_t level, const void *v, size_t x, size_t l)
+{
+ const uint8_t *p = v, *ep = p + l;
+ size_t ox;
+ char buf[128];
+
+ while (p + x < ep) {
+ const uint8_t *q;
+ uint8_t c = getclass(p[x]);
+ uint8_t t = gettype(p[x]);
+ ox = x;
+ if (x != 0)
+ printf("%.2x %.2x %.2x\n", p[x - 1], p[x], p[x + 1]);
+ uint32_t tag = gettag(p, &x, ep - p + x);
+ if (p + x >= ep)
+ break;
+ uint32_t len = getlength(p, &x, ep - p + x);
+
+ printf("%zu %zu-%zu %c,%c,%s,%u:", level, ox, x,
+ der_class[c], der_type[t],
+ der_tag(buf, sizeof(buf), tag), len);
+ q = p + x;
+ if (p + len > ep)
+ errx(EXIT_FAILURE, "corrupt der");
+ printtag(tag, q, len);
+ if (t != DER_TYPE_PRIMITIVE)
+ printdata(level + 1, p, x, len + x);
+ x += len;
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ int fd;
+ struct stat st;
+ size_t l;
+ void *p;
+
+ if ((fd = open(argv[1], O_RDONLY)) == -1)
+ err(EXIT_FAILURE, "open `%s'", argv[1]);
+ if (fstat(fd, &st) == -1)
+ err(EXIT_FAILURE, "stat `%s'", argv[1]);
+ l = (size_t)st.st_size;
+ if ((p = mmap(NULL, l, PROT_READ, MAP_FILE, fd, 0)) == MAP_FAILED)
+ err(EXIT_FAILURE, "mmap `%s'", argv[1]);
+
+ printdata(0, p, 0, l);
+ munmap(p, l);
+ return 0;
+}
+#endif
diff --git a/contrib/file/src/der.h b/contrib/file/src/der.h
new file mode 100644
index 0000000..3333239
--- /dev/null
+++ b/contrib/file/src/der.h
@@ -0,0 +1,28 @@
+/*-
+ * Copyright (c) 2016 Christos Zoulas
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+extern int der_offs(struct magic_set *, struct magic *, size_t);
+extern int der_cmp(struct magic_set *, struct magic *);
diff --git a/contrib/file/src/dprintf.c b/contrib/file/src/dprintf.c
new file mode 100644
index 0000000..3ae1581
--- /dev/null
+++ b/contrib/file/src/dprintf.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) Ian F. Darwin 1986-1995.
+ * Software written by Ian F. Darwin and others;
+ * maintained 1995-present by Christos Zoulas and others.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "file.h"
+
+#ifndef lint
+FILE_RCSID("@(#)$File: dprintf.c,v 1.1 2015/11/13 15:36:14 christos Exp $")
+#endif /* lint */
+
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+int
+dprintf(int fd, const char *fmt, ...)
+{
+ va_list ap;
+ /* Simpler than using vasprintf() here, since we never need more */
+ char buf[1024];
+ int len;
+
+ va_start(ap, fmt);
+ len = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+
+ if ((size_t)len >= sizeof(buf))
+ return -1;
+
+ if (write(fd, buf, (size_t)len) != len)
+ return -1;
+
+ return len;
+}
diff --git a/contrib/file/src/file.c b/contrib/file/src/file.c
index fa46b95..2226ec4 100644
--- a/contrib/file/src/file.c
+++ b/contrib/file/src/file.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.167 2015/09/11 17:24:09 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.170 2016/03/31 17:51:12 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -94,9 +94,9 @@ private const struct option long_options[] = {
#define OPT_EXTENSIONS 3
#define OPT_MIME_TYPE 4
#define OPT_MIME_ENCODING 5
-#define OPT(shortname, longname, opt, doc) \
+#define OPT(shortname, longname, opt, def, doc) \
{longname, opt, NULL, shortname},
-#define OPT_LONGONLY(longname, opt, doc, id) \
+#define OPT_LONGONLY(longname, opt, def, doc, id) \
{longname, opt, NULL, id},
#include "file_opts.h"
#undef OPT
@@ -132,15 +132,17 @@ private struct {
{ "elf_shnum", MAGIC_PARAM_ELF_SHNUM_MAX, 0 },
{ "elf_notes", MAGIC_PARAM_ELF_NOTES_MAX, 0 },
{ "regex", MAGIC_PARAM_REGEX_MAX, 0 },
+ { "bytes", MAGIC_PARAM_BYTES_MAX, 0 },
};
private char *progname; /* used throughout */
+private int posixly;
#ifdef __dead
__dead
#endif
private void usage(void);
-private void docprint(const char *);
+private void docprint(const char *, int);
#ifdef __dead
__dead
#endif
@@ -183,7 +185,8 @@ main(int argc, char *argv[])
progname = argv[0];
#ifdef S_IFLNK
- flags |= getenv("POSIXLY_CORRECT") ? MAGIC_SYMLINK : 0;
+ posixly = getenv("POSIXLY_CORRECT") != NULL;
+ flags |= posixly ? MAGIC_SYMLINK : 0;
#endif
while ((c = getopt_long(argc, argv, OPTSTRING, long_options,
&longindex)) != -1)
@@ -204,7 +207,7 @@ main(int argc, char *argv[])
flags |= MAGIC_MIME_ENCODING;
break;
case '0':
- nulsep = 1;
+ nulsep++;
break;
case 'b':
bflag++;
@@ -492,24 +495,28 @@ unwrap(struct magic_set *ms, const char *fn)
private int
process(struct magic_set *ms, const char *inname, int wid)
{
- const char *type;
+ const char *type, c = nulsep > 1 ? '\0' : '\n';
int std_in = strcmp(inname, "-") == 0;
if (wid > 0 && !bflag) {
(void)printf("%s", std_in ? "/dev/stdin" : inname);
if (nulsep)
(void)putc('\0', stdout);
- (void)printf("%s", separator);
- (void)printf("%*s ",
- (int) (nopad ? 0 : (wid - file_mbswidth(inname))), "");
+ if (nulsep < 2) {
+ (void)printf("%s", separator);
+ (void)printf("%*s ",
+ (int) (nopad ? 0 : (wid - file_mbswidth(inname))),
+ "");
+ }
}
type = magic_file(ms, std_in ? NULL : inname);
+
if (type == NULL) {
- (void)printf("ERROR: %s\n", magic_error(ms));
+ (void)printf("ERROR: %s%c", magic_error(ms), c);
return 1;
} else {
- (void)printf("%s\n", type);
+ (void)printf("%s%c", type, c);
return 0;
}
}
@@ -559,7 +566,17 @@ usage(void)
}
private void
-docprint(const char *opts)
+defprint(int def)
+{
+ if (!def)
+ return;
+ if (((def & 1) && posixly) || ((def & 2) && !posixly))
+ fprintf(stdout, " (default)");
+ fputc('\n', stdout);
+}
+
+private void
+docprint(const char *opts, int def)
{
size_t i;
int comma;
@@ -568,6 +585,7 @@ docprint(const char *opts)
p = strstr(opts, "%o");
if (p == NULL) {
fprintf(stdout, "%s", opts);
+ defprint(def);
return;
}
@@ -595,12 +613,12 @@ help(void)
"Usage: file [OPTION...] [FILE...]\n"
"Determine type of FILEs.\n"
"\n", stdout);
-#define OPT(shortname, longname, opt, doc) \
+#define OPT(shortname, longname, opt, def, doc) \
fprintf(stdout, " -%c, --" longname, shortname), \
- docprint(doc);
-#define OPT_LONGONLY(longname, opt, doc, id) \
+ docprint(doc, def);
+#define OPT_LONGONLY(longname, opt, def, doc, id) \
fprintf(stdout, " --" longname), \
- docprint(doc);
+ docprint(doc, def);
#include "file_opts.h"
#undef OPT
#undef OPT_LONGONLY
diff --git a/contrib/file/src/file.h b/contrib/file/src/file.h
index b0f0cc1..f22fcd9 100644
--- a/contrib/file/src/file.h
+++ b/contrib/file/src/file.h
@@ -27,7 +27,7 @@
*/
/*
* file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.172 2015/09/11 17:24:09 christos Exp $
+ * @(#)$File: file.h,v 1.178 2016/03/31 17:51:12 christos Exp $
*/
#ifndef __file_h__
@@ -127,8 +127,8 @@
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
-#ifndef HOWMANY
-# define HOWMANY (1024 * 1024) /* how much of the file to look at */
+#ifndef FILE_BYTES_MAX
+# define FILE_BYTES_MAX (1024 * 1024) /* how much of the file to look at */
#endif
#define MAXMAGIS 8192 /* max entries in any one magic file
or directory */
@@ -227,7 +227,8 @@ struct magic {
#define FILE_NAME 45
#define FILE_USE 46
#define FILE_CLEAR 47
-#define FILE_NAMES_SIZE 48 /* size of array to contain all names */
+#define FILE_DER 48
+#define FILE_NAMES_SIZE 49 /* size of array to contain all names */
#define IS_STRING(t) \
((t) == FILE_STRING || \
@@ -365,9 +366,11 @@ struct mlist {
#ifdef __cplusplus
#define CAST(T, b) static_cast<T>(b)
#define RCAST(T, b) reinterpret_cast<T>(b)
+#define CCAST(T, b) const_cast<T>(b)
#else
-#define CAST(T, b) (T)(b)
-#define RCAST(T, b) (T)(b)
+#define CAST(T, b) ((T)(b))
+#define RCAST(T, b) ((T)(b))
+#define CCAST(T, b) ((T)(uintptr_t)(b))
#endif
struct level_info {
@@ -416,7 +419,8 @@ struct magic_set {
uint16_t elf_phnum_max;
uint16_t elf_notes_max;
uint16_t regex_max;
-#define FILE_INDIR_MAX 15
+ size_t bytes_max; /* number of bytes to read from file */
+#define FILE_INDIR_MAX 50
#define FILE_NAME_MAX 30
#define FILE_ELF_SHNUM_MAX 32768
#define FILE_ELF_PHNUM_MAX 2048
@@ -461,7 +465,7 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
unichar **, size_t *, const char **, const char **, const char **);
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
- uint16_t, uint16_t *, int, int);
+ uint16_t *, uint16_t *, int, int);
protected int file_apprentice(struct magic_set *, const char *, int);
protected int buffer_apprentice(struct magic_set *, struct magic **,
size_t *, size_t);
@@ -506,6 +510,8 @@ typedef struct {
#define USE_C_LOCALE
locale_t old_lc_ctype;
locale_t c_lc_ctype;
+#else
+ char *old_lc_ctype;
#endif
int rc;
regex_t rx;
@@ -550,6 +556,9 @@ int vasprintf(char **, const char *, va_list);
#ifndef HAVE_ASPRINTF
int asprintf(char **, const char *, ...);
#endif
+#ifndef HAVE_DPRINTF
+int dprintf(int, const char *, ...);
+#endif
#ifndef HAVE_STRLCPY
size_t strlcpy(char *, const char *, size_t);
diff --git a/contrib/file/src/file_opts.h b/contrib/file/src/file_opts.h
index 3d9a7ce..52ace18 100644
--- a/contrib/file/src/file_opts.h
+++ b/contrib/file/src/file_opts.h
@@ -12,47 +12,47 @@
* switch statement!
*/
-OPT_LONGONLY("help", 0, " display this help and exit\n", OPT_HELP)
-OPT('v', "version", 0, " output version information and exit\n")
-OPT('m', "magic-file", 1, " LIST use LIST as a colon-separated list of magic\n"
+OPT_LONGONLY("help", 0, 0, " display this help and exit\n", OPT_HELP)
+OPT('v', "version", 0, 0, " output version information and exit\n")
+OPT('m', "magic-file", 1, 0, " LIST use LIST as a colon-separated list of magic\n"
" number files\n")
-OPT('z', "uncompress", 0, " try to look inside compressed files\n")
-OPT('Z', "uncompress-noreport", 0, " only print the contents of compressed files\n")
-OPT('b', "brief", 0, " do not prepend filenames to output lines\n")
-OPT('c', "checking-printout", 0, " print the parsed form of the magic file, use in\n"
+OPT('z', "uncompress", 0, 0, " try to look inside compressed files\n")
+OPT('Z', "uncompress-noreport", 0, 0, " only print the contents of compressed files\n")
+OPT('b', "brief", 0, 0, " do not prepend filenames to output lines\n")
+OPT('c', "checking-printout", 0, 0, " print the parsed form of the magic file, use in\n"
" conjunction with -m to debug a new magic file\n"
" before installing it\n")
-OPT('e', "exclude", 1, " TEST exclude TEST from the list of test to be\n"
+OPT('e', "exclude", 1, 0, " TEST exclude TEST from the list of test to be\n"
" performed for file. Valid tests are:\n"
" %o\n")
-OPT('f', "files-from", 1, " FILE read the filenames to be examined from FILE\n")
-OPT('F', "separator", 1, " STRING use string as separator instead of `:'\n")
-OPT('i', "mime", 0, " output MIME type strings (--mime-type and\n"
+OPT('f', "files-from", 1, 0, " FILE read the filenames to be examined from FILE\n")
+OPT('F', "separator", 1, 0, " STRING use string as separator instead of `:'\n")
+OPT('i', "mime", 0, 0, " output MIME type strings (--mime-type and\n"
" --mime-encoding)\n")
-OPT_LONGONLY("apple", 0, " output the Apple CREATOR/TYPE\n", OPT_APPLE)
-OPT_LONGONLY("extension", 0, " output a slash-separated list of extensions\n", OPT_EXTENSIONS)
-OPT_LONGONLY("mime-type", 0, " output the MIME type\n", OPT_MIME_TYPE)
-OPT_LONGONLY("mime-encoding", 0, " output the MIME encoding\n", OPT_MIME_ENCODING)
-OPT('k', "keep-going", 0, " don't stop at the first match\n")
-OPT('l', "list", 0, " list magic strength\n")
+OPT_LONGONLY("apple", 0, 0, " output the Apple CREATOR/TYPE\n", OPT_APPLE)
+OPT_LONGONLY("extension", 0, 0, " output a slash-separated list of extensions\n", OPT_EXTENSIONS)
+OPT_LONGONLY("mime-type", 0, 0, " output the MIME type\n", OPT_MIME_TYPE)
+OPT_LONGONLY("mime-encoding", 0, 0, " output the MIME encoding\n", OPT_MIME_ENCODING)
+OPT('k', "keep-going", 0, 0, " don't stop at the first match\n")
+OPT('l', "list", 0, 0, " list magic strength\n")
#ifdef S_IFLNK
-OPT('L', "dereference", 0, " follow symlinks (default)\n")
-OPT('h', "no-dereference", 0, " don't follow symlinks\n")
+OPT('L', "dereference", 0, 1, " follow symlinks")
+OPT('h', "no-dereference", 0, 2, " don't follow symlinks")
#endif
-OPT('n', "no-buffer", 0, " do not buffer output\n")
-OPT('N', "no-pad", 0, " do not pad output\n")
-OPT('0', "print0", 0, " terminate filenames with ASCII NUL\n")
+OPT('n', "no-buffer", 0, 0, " do not buffer output\n")
+OPT('N', "no-pad", 0, 0, " do not pad output\n")
+OPT('0', "print0", 0, 0, " terminate filenames with ASCII NUL\n")
#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
-OPT('p', "preserve-date", 0, " preserve access times on files\n")
+OPT('p', "preserve-date", 0, 0, " preserve access times on files\n")
#endif
-OPT('P', "parameter", 1, " set file engine parameter limits\n"
+OPT('P', "parameter", 1, 0, " set file engine parameter limits\n"
" indir 15 recursion limit for indirection\n"
" name 30 use limit for name/use magic\n"
" elf_notes 256 max ELF notes processed\n"
" elf_phnum 128 max ELF prog sections processed\n"
" elf_shnum 32768 max ELF sections processed\n")
-OPT('r', "raw", 0, " don't translate unprintable chars to \\ooo\n")
-OPT('s', "special-files", 0, " treat special (block/char devices) files as\n"
+OPT('r', "raw", 0, 0, " don't translate unprintable chars to \\ooo\n")
+OPT('s', "special-files", 0, 0, " treat special (block/char devices) files as\n"
" ordinary ones\n")
-OPT('C', "compile", 0, " compile file specified by -m\n")
-OPT('d', "debug", 0, " print debugging messages\n")
+OPT('C', "compile", 0, 0, " compile file specified by -m\n")
+OPT('d', "debug", 0, 0, " print debugging messages\n")
diff --git a/contrib/file/src/fmtcheck.c b/contrib/file/src/fmtcheck.c
index 0fc7038..486aa08 100644
--- a/contrib/file/src/fmtcheck.c
+++ b/contrib/file/src/fmtcheck.c
@@ -91,6 +91,23 @@ get_next_format_from_precision(const char **pf)
f++;
longdouble = 1;
break;
+#ifdef WIN32
+ case 'I':
+ f++;
+ if (!*f) RETURN(pf,f,FMTCHECK_UNKNOWN);
+ if (*f == '3' && f[1] == '2') {
+ f += 2;
+ } else if (*f == '6' && f[1] == '4') {
+ f += 2;
+ quad = 1;
+ }
+#ifdef _WIN64
+ else {
+ quad = 1;
+ }
+#endif
+ break;
+#endif
default:
break;
}
diff --git a/contrib/file/src/funcs.c b/contrib/file/src/funcs.c
index 97d4a0a..df8dbae 100644
--- a/contrib/file/src/funcs.c
+++ b/contrib/file/src/funcs.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.84 2015/09/10 13:32:19 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.89 2016/03/21 15:56:53 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -178,7 +178,6 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
const void *buf, size_t nb)
{
int m = 0, rv = 0, looks_text = 0;
- int mime = ms->flags & MAGIC_MIME;
const unsigned char *ubuf = CAST(const unsigned char *, buf);
unichar *u8buf = NULL;
size_t ulen;
@@ -252,7 +251,8 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
/* try soft magic tests */
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
- m = file_softmagic(ms, ubuf, nb, 0, NULL, BINTEST, looks_text);
+ m = file_softmagic(ms, ubuf, nb, NULL, NULL, BINTEST,
+ looks_text);
if ((ms->flags & MAGIC_DEBUG) != 0)
(void)fprintf(stderr, "[try softmagic %d]\n", m);
if (m) {
@@ -293,9 +293,19 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
simple:
/* give up */
m = 1;
- if ((!mime || (mime & MAGIC_MIME_TYPE)) &&
- file_printf(ms, "%s", mime ? type : def) == -1) {
- rv = -1;
+ if (ms->flags & MAGIC_MIME) {
+ if ((ms->flags & MAGIC_MIME_TYPE) &&
+ file_printf(ms, "%s", type) == -1)
+ rv = -1;
+ } else if (ms->flags & MAGIC_APPLE) {
+ if (file_printf(ms, "UNKNUNKN") == -1)
+ rv = -1;
+ } else if (ms->flags & MAGIC_EXTENSION) {
+ if (file_printf(ms, "???") == -1)
+ rv = -1;
+ } else {
+ if (file_printf(ms, "%s", def) == -1)
+ rv = -1;
}
done:
if ((ms->flags & MAGIC_MIME_ENCODING) != 0) {
@@ -485,6 +495,8 @@ file_regcomp(file_regex_t *rx, const char *pat, int flags)
assert(rx->c_lc_ctype != NULL);
rx->old_lc_ctype = uselocale(rx->c_lc_ctype);
assert(rx->old_lc_ctype != NULL);
+#else
+ rx->old_lc_ctype = setlocale(LC_CTYPE, "C");
#endif
rx->pat = pat;
@@ -507,6 +519,8 @@ file_regfree(file_regex_t *rx)
#ifdef USE_C_LOCALE
(void)uselocale(rx->old_lc_ctype);
freelocale(rx->c_lc_ctype);
+#else
+ (void)setlocale(LC_CTYPE, rx->old_lc_ctype);
#endif
}
diff --git a/contrib/file/src/magic.c b/contrib/file/src/magic.c
index 87ac1cb..a256c42 100644
--- a/contrib/file/src/magic.c
+++ b/contrib/file/src/magic.c
@@ -33,7 +33,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.95 2015/09/11 17:24:09 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.99 2016/05/03 16:09:38 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -417,7 +417,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
* some overlapping space for matches near EOF
*/
#define SLOP (1 + sizeof(union VALUETYPE))
- if ((buf = CAST(unsigned char *, malloc(HOWMANY + SLOP))) == NULL)
+ if ((buf = CAST(unsigned char *, malloc(ms->bytes_max + SLOP))) == NULL)
return NULL;
switch (file_fsmagic(ms, inname, &sb)) {
@@ -481,13 +481,13 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
}
/*
- * try looking at the first HOWMANY bytes
+ * try looking at the first ms->bytes_max bytes
*/
if (ispipe) {
ssize_t r = 0;
while ((r = sread(fd, (void *)&buf[nbytes],
- (size_t)(HOWMANY - nbytes), 1)) > 0) {
+ (size_t)(ms->bytes_max - nbytes), 1)) > 0) {
nbytes += r;
if (r < PIPE_BUF) break;
}
@@ -503,10 +503,10 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
} else {
/* Windows refuses to read from a big console buffer. */
size_t howmany =
-#if defined(WIN32) && HOWMANY > 8 * 1024
+#if defined(WIN32)
_isatty(fd) ? 8 * 1024 :
#endif
- HOWMANY;
+ ms->bytes_max;
if ((nbytes = read(fd, (char *)buf, howmany)) == -1) {
if (inname == NULL && fd != STDIN_FILENO)
file_error(ms, errno, "cannot read fd %d", fd);
@@ -523,9 +523,11 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
rv = 0;
done:
free(buf);
- if (pos != (off_t)-1)
- (void)lseek(fd, pos, SEEK_SET);
- close_and_restore(ms, inname, fd, &sb);
+ if (fd != -1) {
+ if (pos != (off_t)-1)
+ (void)lseek(fd, pos, SEEK_SET);
+ close_and_restore(ms, inname, fd, &sb);
+ }
out:
return rv == 0 ? file_getbuffer(ms) : NULL;
}
@@ -606,6 +608,9 @@ magic_setparam(struct magic_set *ms, int param, const void *val)
case MAGIC_PARAM_REGEX_MAX:
ms->elf_notes_max = (uint16_t)*(const size_t *)val;
return 0;
+ case MAGIC_PARAM_BYTES_MAX:
+ ms->bytes_max = *(const size_t *)val;
+ return 0;
default:
errno = EINVAL;
return -1;
@@ -634,6 +639,9 @@ magic_getparam(struct magic_set *ms, int param, void *val)
case MAGIC_PARAM_REGEX_MAX:
*(size_t *)val = ms->regex_max;
return 0;
+ case MAGIC_PARAM_BYTES_MAX:
+ *(size_t *)val = ms->bytes_max;
+ return 0;
default:
errno = EINVAL;
return -1;
diff --git a/contrib/file/src/magic.h b/contrib/file/src/magic.h
index eab3d3a..3ba1f12 100644
--- a/contrib/file/src/magic.h
+++ b/contrib/file/src/magic.h
@@ -80,7 +80,7 @@
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
-#define MAGIC_VERSION 524 /* This implementation */
+#define MAGIC_VERSION 526 /* This implementation */
#ifdef __cplusplus
@@ -114,6 +114,7 @@ int magic_errno(magic_t);
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
#define MAGIC_PARAM_ELF_NOTES_MAX 4
#define MAGIC_PARAM_REGEX_MAX 5
+#define MAGIC_PARAM_BYTES_MAX 6
int magic_setparam(magic_t, int, const void *);
int magic_getparam(magic_t, int, void *);
diff --git a/contrib/file/src/magic.h.in b/contrib/file/src/magic.h.in
index 1e567cd..3d6954a 100644
--- a/contrib/file/src/magic.h.in
+++ b/contrib/file/src/magic.h.in
@@ -114,6 +114,7 @@ int magic_errno(magic_t);
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
#define MAGIC_PARAM_ELF_NOTES_MAX 4
#define MAGIC_PARAM_REGEX_MAX 5
+#define MAGIC_PARAM_BYTES_MAX 6
int magic_setparam(magic_t, int, const void *);
int magic_getparam(magic_t, int, void *);
diff --git a/contrib/file/src/print.c b/contrib/file/src/print.c
index 0d52290..a0221b1 100644
--- a/contrib/file/src/print.c
+++ b/contrib/file/src/print.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.80 2015/07/16 14:28:57 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.81 2016/01/19 15:09:03 christos Exp $")
#endif /* lint */
#include <string.h>
@@ -198,6 +198,7 @@ file_mdump(struct magic *m)
break;
case FILE_USE:
case FILE_NAME:
+ case FILE_DER:
(void) fprintf(stderr, "'%s'", m->value.s);
break;
default:
diff --git a/contrib/file/src/readcdf.c b/contrib/file/src/readcdf.c
index 99d8ec0..db8d3d3 100644
--- a/contrib/file/src/readcdf.c
+++ b/contrib/file/src/readcdf.c
@@ -26,7 +26,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.53 2015/04/09 20:01:41 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.57 2016/05/03 16:08:49 christos Exp $")
#endif
#include <assert.h>
@@ -60,12 +60,16 @@ static const struct nv {
{ "Windows Installer", "vnd.ms-msi", },
{ NULL, NULL, },
}, name2mime[] = {
+ { "Book", "vnd.ms-excel", },
+ { "Workbook", "vnd.ms-excel", },
{ "WordDocument", "msword", },
{ "PowerPoint", "vnd.ms-powerpoint", },
{ "DigitalSignature", "vnd.ms-msi", },
{ NULL, NULL, },
}, name2desc[] = {
- { "WordDocument", "Microsoft Office Word",},
+ { "Book", "Microsoft Excel", },
+ { "Workbook", "Microsoft Excel", },
+ { "WordDocument", "Microsoft Word", },
{ "PowerPoint", "Microsoft PowerPoint", },
{ "DigitalSignature", "Microsoft Installer", },
{ NULL, NULL, },
@@ -119,6 +123,8 @@ cdf_app_to_mime(const char *vbuf, const struct nv *nv)
assert(c_lc_ctype != NULL);
old_lc_ctype = uselocale(c_lc_ctype);
assert(old_lc_ctype != NULL);
+#else
+ char *old_lc_ctype = setlocale(LC_CTYPE, "C");
#endif
for (i = 0; nv[i].pattern != NULL; i++)
if (strcasestr(vbuf, nv[i].pattern) != NULL) {
@@ -131,6 +137,8 @@ cdf_app_to_mime(const char *vbuf, const struct nv *nv)
#ifdef USE_C_LOCALE
(void)uselocale(old_lc_ctype);
freelocale(c_lc_ctype);
+#else
+ setlocale(LC_CTYPE, old_lc_ctype);
#endif
return rv;
}
@@ -365,7 +373,7 @@ cdf_file_catalog_info(struct magic_set *ms, const cdf_info_t *info,
dir, "Catalog", scn)) == -1)
return i;
#ifdef CDF_DEBUG
- cdf_dump_catalog(&h, &scn);
+ cdf_dump_catalog(&h, scn);
#endif
if ((i = cdf_file_catalog(ms, h, scn)) == -1)
return -1;
diff --git a/contrib/file/src/readelf.c b/contrib/file/src/readelf.c
index 2a7fc01..39598f7 100644
--- a/contrib/file/src/readelf.c
+++ b/contrib/file/src/readelf.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.122 2015/09/10 13:59:32 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.127 2015/11/18 12:29:29 christos Exp $")
#endif
#ifdef BUILTIN_ELF
@@ -50,7 +50,7 @@ private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
off_t, int, int, int *, uint16_t *);
private size_t donote(struct magic_set *, void *, size_t, size_t, int,
- int, size_t, int *, uint16_t *);
+ int, size_t, int *, uint16_t *, int, off_t, int, off_t);
#define ELF_ALIGN(a) ((((a) + align - 1) / align) * align)
@@ -177,6 +177,11 @@ getu64(int swap, uint64_t value)
elf_getu32(swap, ph32.p_align) : 4) \
: (off_t) (ph64.p_align ? \
elf_getu64(swap, ph64.p_align) : 4)))
+#define xph_vaddr (size_t)((clazz == ELFCLASS32 \
+ ? (off_t) (ph32.p_vaddr ? \
+ elf_getu32(swap, ph32.p_vaddr) : 4) \
+ : (off_t) (ph64.p_vaddr ? \
+ elf_getu64(swap, ph64.p_vaddr) : 4)))
#define xph_filesz (size_t)((clazz == ELFCLASS32 \
? elf_getu32(swap, ph32.p_filesz) \
: elf_getu64(swap, ph64.p_filesz)))
@@ -187,8 +192,8 @@ getu64(int swap, uint64_t value)
? elf_getu32(swap, ph32.p_memsz) \
: elf_getu64(swap, ph64.p_memsz)))
#define xnh_sizeof (clazz == ELFCLASS32 \
- ? sizeof nh32 \
- : sizeof nh64)
+ ? sizeof(nh32) \
+ : sizeof(nh64))
#define xnh_type (clazz == ELFCLASS32 \
? elf_getu32(swap, nh32.n_type) \
: elf_getu32(swap, nh64.n_type))
@@ -213,6 +218,18 @@ getu64(int swap, uint64_t value)
#define xcap_val (clazz == ELFCLASS32 \
? elf_getu32(swap, cap32.c_un.c_val) \
: elf_getu64(swap, cap64.c_un.c_val))
+#define xauxv_addr (clazz == ELFCLASS32 \
+ ? (void *)&auxv32 \
+ : (void *)&auxv64)
+#define xauxv_sizeof (clazz == ELFCLASS32 \
+ ? sizeof(auxv32) \
+ : sizeof(auxv64))
+#define xauxv_type (clazz == ELFCLASS32 \
+ ? elf_getu32(swap, auxv32.a_type) \
+ : elf_getu64(swap, auxv64.a_type))
+#define xauxv_val (clazz == ELFCLASS32 \
+ ? elf_getu32(swap, auxv32.a_v) \
+ : elf_getu64(swap, auxv64.a_v))
#ifdef ELFCORE
/*
@@ -302,6 +319,7 @@ private const char os_style_names[][8] = {
#define FLAGS_DID_NETBSD_CMODEL 0x040
#define FLAGS_DID_NETBSD_UNKNOWN 0x080
#define FLAGS_IS_CORE 0x100
+#define FLAGS_DID_AUXV 0x200
private int
dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
@@ -312,6 +330,8 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
size_t offset, len;
unsigned char nbuf[BUFSIZ];
ssize_t bufsize;
+ off_t ph_off = off;
+ int ph_num = num;
if (size != xph_sizeof) {
if (file_printf(ms, ", corrupted program header size") == -1)
@@ -351,7 +371,8 @@ dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
if (offset >= (size_t)bufsize)
break;
offset = donote(ms, nbuf, offset, (size_t)bufsize,
- clazz, swap, 4, flags, notecount);
+ clazz, swap, 4, flags, notecount, fd, ph_off,
+ ph_num, fsize);
if (offset == 0)
break;
@@ -813,9 +834,157 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
return 0;
}
+private off_t
+get_offset_from_virtaddr(struct magic_set *ms, int swap, int clazz, int fd,
+ off_t off, int num, off_t fsize, uint64_t virtaddr)
+{
+ Elf32_Phdr ph32;
+ Elf64_Phdr ph64;
+
+ /*
+ * Loop through all the program headers and find the header with
+ * virtual address in which the "virtaddr" belongs to.
+ */
+ for ( ; num; num--) {
+ if (pread(fd, xph_addr, xph_sizeof, off) < (ssize_t)xph_sizeof) {
+ file_badread(ms);
+ return -1;
+ }
+ off += xph_sizeof;
+
+ if (fsize != SIZE_UNKNOWN && xph_offset > fsize) {
+ /* Perhaps warn here */
+ continue;
+ }
+
+ if (virtaddr >= xph_vaddr && virtaddr < xph_vaddr + xph_filesz)
+ return xph_offset + (virtaddr - xph_vaddr);
+ }
+ return 0;
+}
+
+private size_t
+get_string_on_virtaddr(struct magic_set *ms,
+ int swap, int clazz, int fd, off_t ph_off, int ph_num,
+ off_t fsize, uint64_t virtaddr, char *buf, ssize_t buflen)
+{
+ char *bptr;
+ off_t offset;
+
+ if (buflen == 0)
+ return 0;
+
+ offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
+ fsize, virtaddr);
+ if ((buflen = pread(fd, buf, buflen, offset)) <= 0) {
+ file_badread(ms);
+ return 0;
+ }
+
+ buf[buflen - 1] = '\0';
+
+ /* We expect only printable characters, so return if buffer contains
+ * non-printable character before the '\0' or just '\0'. */
+ for (bptr = buf; *bptr && isprint((unsigned char)*bptr); bptr++)
+ continue;
+ if (*bptr != '\0')
+ return 0;
+
+ return bptr - buf;
+}
+
+
+private int
+do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
+ int swap, uint32_t namesz __attribute__((__unused__)),
+ uint32_t descsz __attribute__((__unused__)),
+ size_t noff __attribute__((__unused__)), size_t doff,
+ int *flags, size_t size __attribute__((__unused__)), int clazz,
+ int fd, off_t ph_off, int ph_num, off_t fsize)
+{
+#ifdef ELFCORE
+ Aux32Info auxv32;
+ Aux64Info auxv64;
+ size_t elsize = xauxv_sizeof;
+ const char *tag;
+ int is_string;
+ size_t nval;
+
+ if (type != NT_AUXV || (*flags & FLAGS_IS_CORE) == 0)
+ return 0;
+
+ *flags |= FLAGS_DID_AUXV;
+
+ nval = 0;
+ for (size_t off = 0; off + elsize <= descsz; off += elsize) {
+ (void)memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
+ /* Limit processing to 50 vector entries to prevent DoS */
+ if (nval++ >= 50) {
+ file_error(ms, 0, "Too many ELF Auxv elements");
+ return 1;
+ }
+
+ switch(xauxv_type) {
+ case AT_LINUX_EXECFN:
+ is_string = 1;
+ tag = "execfn";
+ break;
+ case AT_LINUX_PLATFORM:
+ is_string = 1;
+ tag = "platform";
+ break;
+ case AT_LINUX_UID:
+ is_string = 0;
+ tag = "real uid";
+ break;
+ case AT_LINUX_GID:
+ is_string = 0;
+ tag = "real gid";
+ break;
+ case AT_LINUX_EUID:
+ is_string = 0;
+ tag = "effective uid";
+ break;
+ case AT_LINUX_EGID:
+ is_string = 0;
+ tag = "effective gid";
+ break;
+ default:
+ is_string = 0;
+ tag = NULL;
+ break;
+ }
+
+ if (tag == NULL)
+ continue;
+
+ if (is_string) {
+ char buf[256];
+ ssize_t buflen;
+ buflen = get_string_on_virtaddr(ms, swap, clazz, fd,
+ ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf));
+
+ if (buflen == 0)
+ continue;
+
+ if (file_printf(ms, ", %s: '%s'", tag, buf) == -1)
+ return 0;
+ } else {
+ if (file_printf(ms, ", %s: %d", tag, (int) xauxv_val)
+ == -1)
+ return 0;
+ }
+ }
+ return 1;
+#else
+ return 0;
+#endif
+}
+
private size_t
donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
- int clazz, int swap, size_t align, int *flags, uint16_t *notecount)
+ int clazz, int swap, size_t align, int *flags, uint16_t *notecount,
+ int fd, off_t ph_off, int ph_num, off_t fsize)
{
Elf32_Nhdr nh32;
Elf64_Nhdr nh64;
@@ -839,6 +1008,7 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
namesz = xnh_namesz;
descsz = xnh_descsz;
+
if ((namesz == 0) && (descsz == 0)) {
/*
* We're out of note headers.
@@ -876,28 +1046,36 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
return (offset >= size) ? offset : size;
}
+
if ((*flags & FLAGS_DID_OS_NOTE) == 0) {
if (do_os_note(ms, nbuf, xnh_type, swap,
namesz, descsz, noff, doff, flags))
- return size;
+ return offset;
}
if ((*flags & FLAGS_DID_BUILD_ID) == 0) {
if (do_bid_note(ms, nbuf, xnh_type, swap,
namesz, descsz, noff, doff, flags))
- return size;
+ return offset;
}
if ((*flags & FLAGS_DID_NETBSD_PAX) == 0) {
if (do_pax_note(ms, nbuf, xnh_type, swap,
namesz, descsz, noff, doff, flags))
- return size;
+ return offset;
}
if ((*flags & FLAGS_DID_CORE) == 0) {
if (do_core_note(ms, nbuf, xnh_type, swap,
namesz, descsz, noff, doff, flags, size, clazz))
- return size;
+ return offset;
+ }
+
+ if ((*flags & FLAGS_DID_AUXV) == 0) {
+ if (do_auxv_note(ms, nbuf, xnh_type, swap,
+ namesz, descsz, noff, doff, flags, size, clazz,
+ fd, ph_off, ph_num, fsize))
+ return offset;
}
if (namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0) {
@@ -905,32 +1083,32 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
descsz = 100;
switch (xnh_type) {
case NT_NETBSD_VERSION:
- return size;
+ return offset;
case NT_NETBSD_MARCH:
if (*flags & FLAGS_DID_NETBSD_MARCH)
- return size;
+ return offset;
*flags |= FLAGS_DID_NETBSD_MARCH;
if (file_printf(ms, ", compiled for: %.*s",
(int)descsz, (const char *)&nbuf[doff]) == -1)
- return size;
+ return offset;
break;
case NT_NETBSD_CMODEL:
if (*flags & FLAGS_DID_NETBSD_CMODEL)
- return size;
+ return offset;
*flags |= FLAGS_DID_NETBSD_CMODEL;
if (file_printf(ms, ", compiler model: %.*s",
(int)descsz, (const char *)&nbuf[doff]) == -1)
- return size;
+ return offset;
break;
default:
if (*flags & FLAGS_DID_NETBSD_UNKNOWN)
- return size;
+ return offset;
*flags |= FLAGS_DID_NETBSD_UNKNOWN;
if (file_printf(ms, ", note=%u", xnh_type) == -1)
- return size;
+ return offset;
break;
}
- return size;
+ return offset;
}
return offset;
@@ -1080,7 +1258,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
if (noff >= (off_t)xsh_size)
break;
noff = donote(ms, nbuf, (size_t)noff,
- xsh_size, clazz, swap, 4, flags, notecount);
+ xsh_size, clazz, swap, 4, flags, notecount,
+ fd, 0, 0, 0);
if (noff == 0)
break;
}
@@ -1329,7 +1508,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
break;
offset = donote(ms, nbuf, offset,
(size_t)bufsize, clazz, swap, align,
- flags, notecount);
+ flags, notecount, fd, 0, 0, 0);
if (offset == 0)
break;
}
diff --git a/contrib/file/src/readelf.h b/contrib/file/src/readelf.h
index 732b20c..f443b29 100644
--- a/contrib/file/src/readelf.h
+++ b/contrib/file/src/readelf.h
@@ -54,6 +54,42 @@ typedef uint8_t Elf64_Char;
#define EI_NIDENT 16
typedef struct {
+ Elf32_Word a_type; /* 32-bit id */
+ Elf32_Word a_v; /* 32-bit id */
+} Aux32Info;
+
+typedef struct {
+ Elf64_Xword a_type; /* 64-bit id */
+ Elf64_Xword a_v; /* 64-bit id */
+} Aux64Info;
+
+#define AT_NULL 0 /* end of vector */
+#define AT_IGNORE 1 /* entry should be ignored */
+#define AT_EXECFD 2 /* file descriptor of program */
+#define AT_PHDR 3 /* program headers for program */
+#define AT_PHENT 4 /* size of program header entry */
+#define AT_PHNUM 5 /* number of program headers */
+#define AT_PAGESZ 6 /* system page size */
+#define AT_BASE 7 /* base address of interpreter */
+#define AT_FLAGS 8 /* flags */
+#define AT_ENTRY 9 /* entry point of program */
+#define AT_LINUX_NOTELF 10 /* program is not ELF */
+#define AT_LINUX_UID 11 /* real uid */
+#define AT_LINUX_EUID 12 /* effective uid */
+#define AT_LINUX_GID 13 /* real gid */
+#define AT_LINUX_EGID 14 /* effective gid */
+#define AT_LINUX_PLATFORM 15 /* string identifying CPU for optimizations */
+#define AT_LINUX_HWCAP 16 /* arch dependent hints at CPU capabilities */
+#define AT_LINUX_CLKTCK 17 /* frequency at which times() increments */
+/* AT_* values 18 through 22 are reserved */
+#define AT_LINUX_SECURE 23 /* secure mode boolean */
+#define AT_LINUX_BASE_PLATFORM 24 /* string identifying real platform, may
+ * differ from AT_PLATFORM. */
+#define AT_LINUX_RANDOM 25 /* address of 16 random bytes */
+#define AT_LINUX_HWCAP2 26 /* extension of AT_HWCAP */
+#define AT_LINUX_EXECFN 31 /* filename of program */
+
+typedef struct {
Elf32_Char e_ident[EI_NIDENT];
Elf32_Half e_type;
Elf32_Half e_machine;
diff --git a/contrib/file/src/softmagic.c b/contrib/file/src/softmagic.c
index 84a8932..2ceb26c 100644
--- a/contrib/file/src/softmagic.c
+++ b/contrib/file/src/softmagic.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.218 2015/09/11 17:24:09 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.231 2016/04/21 15:23:31 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -41,26 +41,27 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.218 2015/09/11 17:24:09 christos Exp $")
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
+#include "der.h"
private int match(struct magic_set *, struct magic *, uint32_t,
- const unsigned char *, size_t, size_t, int, int, int, uint16_t,
+ const unsigned char *, size_t, size_t, int, int, int, uint16_t *,
uint16_t *, int *, int *, int *);
private int mget(struct magic_set *, const unsigned char *,
- struct magic *, size_t, size_t, unsigned int, int, int, int, uint16_t,
+ struct magic *, size_t, size_t, unsigned int, int, int, int, uint16_t *,
uint16_t *, int *, int *, int *);
private int magiccheck(struct magic_set *, struct magic *);
private int32_t mprint(struct magic_set *, struct magic *);
-private int32_t moffset(struct magic_set *, struct magic *);
+private int moffset(struct magic_set *, struct magic *, size_t, int32_t *);
private void mdebug(uint32_t, const char *, size_t);
private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
const unsigned char *, uint32_t, size_t, struct magic *);
private int mconvert(struct magic_set *, struct magic *, int);
private int print_sep(struct magic_set *, int);
private int handle_annotation(struct magic_set *, struct magic *);
-private void cvt_8(union VALUETYPE *, const struct magic *);
-private void cvt_16(union VALUETYPE *, const struct magic *);
-private void cvt_32(union VALUETYPE *, const struct magic *);
-private void cvt_64(union VALUETYPE *, const struct magic *);
+private int cvt_8(union VALUETYPE *, const struct magic *);
+private int cvt_16(union VALUETYPE *, const struct magic *);
+private int cvt_32(union VALUETYPE *, const struct magic *);
+private int cvt_64(union VALUETYPE *, const struct magic *);
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
#define BE64(p) (((uint64_t)(p)->hq[0]<<56)|((uint64_t)(p)->hq[1]<<48)| \
@@ -87,20 +88,24 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
protected int
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
- uint16_t indir_level, uint16_t *name_count, int mode, int text)
+ uint16_t *indir_count, uint16_t *name_count, int mode, int text)
{
struct mlist *ml;
int rv, printed_something = 0, need_separator = 0;
- uint16_t nc;
+ uint16_t nc, ic;
if (name_count == NULL) {
nc = 0;
name_count = &nc;
}
+ if (indir_count == NULL) {
+ ic = 0;
+ indir_count = &ic;
+ }
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
- text, 0, indir_level, name_count,
+ text, 0, indir_count, name_count,
&printed_something, &need_separator, NULL)) != 0)
return rv;
@@ -156,7 +161,7 @@ file_fmtcheck(struct magic_set *ms, const struct magic *m, const char *def,
private int
match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
const unsigned char *s, size_t nbytes, size_t offset, int mode, int text,
- int flip, uint16_t indir_level, uint16_t *name_count,
+ int flip, uint16_t *indir_count, uint16_t *name_count,
int *printed_something, int *need_separator, int *returnval)
{
uint32_t magindex = 0;
@@ -181,11 +186,11 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
((text && (m->str_flags & FLT) == STRING_BINTEST) ||
(!text && (m->str_flags & FLT) == STRING_TEXTTEST))) ||
(m->flag & mode) != mode) {
+flush:
/* Skip sub-tests */
- while (magindex + 1 < nmagic &&
- magic[magindex + 1].cont_level != 0 &&
- ++magindex)
- continue;
+ while (magindex < nmagic - 1 &&
+ magic[magindex + 1].cont_level != 0)
+ magindex++;
continue; /* Skip to next top-level test*/
}
@@ -194,7 +199,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
/* if main entry matches, print it... */
switch (mget(ms, s, m, nbytes, offset, cont_level, mode, text,
- flip, indir_level, name_count,
+ flip, indir_count, name_count,
printed_something, need_separator, returnval)) {
case -1:
return -1;
@@ -222,10 +227,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
* main entry didn't match,
* flush its continuations
*/
- while (magindex < nmagic - 1 &&
- magic[magindex + 1].cont_level != 0)
- magindex++;
- continue;
+ goto flush;
}
if ((e = handle_annotation(ms, m)) != 0) {
@@ -234,6 +236,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
*returnval = 1;
return e;
}
+
/*
* If we are going to print something, we'll need to print
* a blank before we print something else.
@@ -249,7 +252,13 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
if (print && mprint(ms, m) == -1)
return -1;
- ms->c.li[cont_level].off = moffset(ms, m);
+ switch (moffset(ms, m, nbytes, &ms->c.li[cont_level].off)) {
+ case -1:
+ case 0:
+ goto flush;
+ default:
+ break;
+ }
/* and any continuations that match */
if (file_check_mem(ms, ++cont_level) == -1)
@@ -283,7 +292,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
}
#endif
switch (mget(ms, s, m, nbytes, offset, cont_level, mode,
- text, flip, indir_level, name_count,
+ text, flip, indir_count, name_count,
printed_something, need_separator, returnval)) {
case -1:
return -1;
@@ -318,6 +327,7 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
break;
} else
ms->c.li[cont_level].got_match = 1;
+
if ((e = handle_annotation(ms, m)) != 0) {
*need_separator = 1;
*printed_something = 1;
@@ -354,7 +364,15 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
if (print && mprint(ms, m) == -1)
return -1;
- ms->c.li[cont_level].off = moffset(ms, m);
+ switch (moffset(ms, m, nbytes,
+ &ms->c.li[cont_level].off)) {
+ case -1:
+ case 0:
+ flush = 1;
+ break;
+ default:
+ break;
+ }
if (*m->desc)
*need_separator = 1;
@@ -682,7 +700,12 @@ mprint(struct magic_set *ms, struct magic *m)
case FILE_NAME:
t = ms->offset;
break;
-
+ case FILE_DER:
+ if (file_printf(ms, F(ms, m, "%s"),
+ file_printable(sbuf, sizeof(sbuf), ms->ms_value.s)) == -1)
+ return -1;
+ t = ms->offset;
+ break;
default:
file_magerror(ms, "invalid m->type (%d) in mprint()", m->type);
return -1;
@@ -690,100 +713,151 @@ mprint(struct magic_set *ms, struct magic *m)
return (int32_t)t;
}
-private int32_t
-moffset(struct magic_set *ms, struct magic *m)
+private int
+moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op)
{
+ int32_t o;
+
switch (m->type) {
case FILE_BYTE:
- return CAST(int32_t, (ms->offset + sizeof(char)));
+ o = CAST(int32_t, (ms->offset + sizeof(char)));
+ break;
case FILE_SHORT:
case FILE_BESHORT:
case FILE_LESHORT:
- return CAST(int32_t, (ms->offset + sizeof(short)));
+ o = CAST(int32_t, (ms->offset + sizeof(short)));
+ break;
case FILE_LONG:
case FILE_BELONG:
case FILE_LELONG:
case FILE_MELONG:
- return CAST(int32_t, (ms->offset + sizeof(int32_t)));
+ o = CAST(int32_t, (ms->offset + sizeof(int32_t)));
+ break;
case FILE_QUAD:
case FILE_BEQUAD:
case FILE_LEQUAD:
- return CAST(int32_t, (ms->offset + sizeof(int64_t)));
+ o = CAST(int32_t, (ms->offset + sizeof(int64_t)));
+ break;
case FILE_STRING:
case FILE_PSTRING:
case FILE_BESTRING16:
case FILE_LESTRING16:
- if (m->reln == '=' || m->reln == '!')
- return ms->offset + m->vallen;
- else {
+ if (m->reln == '=' || m->reln == '!') {
+ o = ms->offset + m->vallen;
+ } else {
union VALUETYPE *p = &ms->ms_value;
- uint32_t t;
if (*m->value.s == '\0')
p->s[strcspn(p->s, "\r\n")] = '\0';
- t = CAST(uint32_t, (ms->offset + strlen(p->s)));
+ o = CAST(uint32_t, (ms->offset + strlen(p->s)));
if (m->type == FILE_PSTRING)
- t += (uint32_t)file_pstring_length_size(m);
- return t;
+ o += (uint32_t)file_pstring_length_size(m);
}
+ break;
case FILE_DATE:
case FILE_BEDATE:
case FILE_LEDATE:
case FILE_MEDATE:
- return CAST(int32_t, (ms->offset + sizeof(uint32_t)));
+ o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
+ break;
case FILE_LDATE:
case FILE_BELDATE:
case FILE_LELDATE:
case FILE_MELDATE:
- return CAST(int32_t, (ms->offset + sizeof(uint32_t)));
+ o = CAST(int32_t, (ms->offset + sizeof(uint32_t)));
+ break;
case FILE_QDATE:
case FILE_BEQDATE:
case FILE_LEQDATE:
- return CAST(int32_t, (ms->offset + sizeof(uint64_t)));
+ o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
+ break;
case FILE_QLDATE:
case FILE_BEQLDATE:
case FILE_LEQLDATE:
- return CAST(int32_t, (ms->offset + sizeof(uint64_t)));
+ o = CAST(int32_t, (ms->offset + sizeof(uint64_t)));
+ break;
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
- return CAST(int32_t, (ms->offset + sizeof(float)));
+ o = CAST(int32_t, (ms->offset + sizeof(float)));
+ break;
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
- return CAST(int32_t, (ms->offset + sizeof(double)));
+ o = CAST(int32_t, (ms->offset + sizeof(double)));
+ break;
case FILE_REGEX:
if ((m->str_flags & REGEX_OFFSET_START) != 0)
- return CAST(int32_t, ms->search.offset);
+ o = CAST(int32_t, ms->search.offset);
else
- return CAST(int32_t, (ms->search.offset +
- ms->search.rm_len));
+ o = CAST(int32_t,
+ (ms->search.offset + ms->search.rm_len));
+ break;
case FILE_SEARCH:
if ((m->str_flags & REGEX_OFFSET_START) != 0)
- return CAST(int32_t, ms->search.offset);
+ o = CAST(int32_t, ms->search.offset);
else
- return CAST(int32_t, (ms->search.offset + m->vallen));
+ o = CAST(int32_t, (ms->search.offset + m->vallen));
+ break;
case FILE_CLEAR:
case FILE_DEFAULT:
case FILE_INDIRECT:
- return ms->offset;
+ o = ms->offset;
+ break;
+
+ case FILE_DER:
+ {
+ o = der_offs(ms, m, nbytes);
+ if (o == -1 || (size_t)o > nbytes) {
+ if ((ms->flags & MAGIC_DEBUG) != 0) {
+ (void)fprintf(stderr,
+ "Bad DER offset %d nbytes=%zu",
+ o, nbytes);
+ }
+ return 0;
+ }
+ break;
+ }
default:
- return 0;
+ o = 0;
+ break;
+ }
+
+ if ((size_t)o > nbytes) {
+#if 0
+ file_error(ms, 0, "Offset out of range %zu > %zu",
+ (size_t)o, nbytes);
+#endif
+ return -1;
}
+ *op = o;
+ return 1;
+}
+
+private uint32_t
+cvt_id3(struct magic_set *ms, uint32_t v)
+{
+ v = ((((v >> 0) & 0x7f) << 0) |
+ (((v >> 8) & 0x7f) << 7) |
+ (((v >> 16) & 0x7f) << 14) |
+ (((v >> 24) & 0x7f) << 21));
+ if ((ms->flags & MAGIC_DEBUG) != 0)
+ fprintf(stderr, "id3 offs=%u\n", v);
+ return v;
}
private int
@@ -858,37 +932,45 @@ cvt_flip(int type, int flip)
p->fld *= cast m->num_mask; \
break; \
case FILE_OPDIVIDE: \
+ if (cast m->num_mask == 0) \
+ return -1; \
p->fld /= cast m->num_mask; \
break; \
case FILE_OPMODULO: \
+ if (cast m->num_mask == 0) \
+ return -1; \
p->fld %= cast m->num_mask; \
break; \
} \
if (m->mask_op & FILE_OPINVERSE) \
p->fld = ~p->fld \
-private void
+private int
cvt_8(union VALUETYPE *p, const struct magic *m)
{
DO_CVT(b, (uint8_t));
+ return 0;
}
-private void
+private int
cvt_16(union VALUETYPE *p, const struct magic *m)
{
DO_CVT(h, (uint16_t));
+ return 0;
}
-private void
+private int
cvt_32(union VALUETYPE *p, const struct magic *m)
{
DO_CVT(l, (uint32_t));
+ return 0;
}
-private void
+private int
cvt_64(union VALUETYPE *p, const struct magic *m)
{
DO_CVT(q, (uint64_t));
+ return 0;
}
#define DO_CVT2(fld, cast) \
@@ -904,20 +986,24 @@ cvt_64(union VALUETYPE *p, const struct magic *m)
p->fld *= cast m->num_mask; \
break; \
case FILE_OPDIVIDE: \
+ if (cast m->num_mask == 0) \
+ return -1; \
p->fld /= cast m->num_mask; \
break; \
} \
-private void
+private int
cvt_float(union VALUETYPE *p, const struct magic *m)
{
DO_CVT2(f, (float));
+ return 0;
}
-private void
+private int
cvt_double(union VALUETYPE *p, const struct magic *m)
{
DO_CVT2(d, (double));
+ return 0;
}
/*
@@ -933,21 +1019,25 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
switch (type = cvt_flip(m->type, flip)) {
case FILE_BYTE:
- cvt_8(p, m);
+ if (cvt_8(p, m) == -1)
+ goto out;
return 1;
case FILE_SHORT:
- cvt_16(p, m);
+ if (cvt_16(p, m) == -1)
+ goto out;
return 1;
case FILE_LONG:
case FILE_DATE:
case FILE_LDATE:
- cvt_32(p, m);
+ if (cvt_32(p, m) == -1)
+ goto out;
return 1;
case FILE_QUAD:
case FILE_QDATE:
case FILE_QLDATE:
case FILE_QWDATE:
- cvt_64(p, m);
+ if (cvt_64(p, m) == -1)
+ goto out;
return 1;
case FILE_STRING:
case FILE_BESTRING16:
@@ -979,65 +1069,78 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
}
case FILE_BESHORT:
p->h = (short)BE16(p);
- cvt_16(p, m);
+ if (cvt_16(p, m) == -1)
+ goto out;
return 1;
case FILE_BELONG:
case FILE_BEDATE:
case FILE_BELDATE:
p->l = (int32_t)BE32(p);
- cvt_32(p, m);
+ if (cvt_32(p, m) == -1)
+ goto out;
return 1;
case FILE_BEQUAD:
case FILE_BEQDATE:
case FILE_BEQLDATE:
case FILE_BEQWDATE:
p->q = (uint64_t)BE64(p);
- cvt_64(p, m);
+ if (cvt_64(p, m) == -1)
+ goto out;
return 1;
case FILE_LESHORT:
p->h = (short)LE16(p);
- cvt_16(p, m);
+ if (cvt_16(p, m) == -1)
+ goto out;
return 1;
case FILE_LELONG:
case FILE_LEDATE:
case FILE_LELDATE:
p->l = (int32_t)LE32(p);
- cvt_32(p, m);
+ if (cvt_32(p, m) == -1)
+ goto out;
return 1;
case FILE_LEQUAD:
case FILE_LEQDATE:
case FILE_LEQLDATE:
case FILE_LEQWDATE:
p->q = (uint64_t)LE64(p);
- cvt_64(p, m);
+ if (cvt_64(p, m) == -1)
+ goto out;
return 1;
case FILE_MELONG:
case FILE_MEDATE:
case FILE_MELDATE:
p->l = (int32_t)ME32(p);
- cvt_32(p, m);
+ if (cvt_32(p, m) == -1)
+ goto out;
return 1;
case FILE_FLOAT:
- cvt_float(p, m);
+ if (cvt_float(p, m) == -1)
+ goto out;
return 1;
case FILE_BEFLOAT:
p->l = BE32(p);
- cvt_float(p, m);
+ if (cvt_float(p, m) == -1)
+ goto out;
return 1;
case FILE_LEFLOAT:
p->l = LE32(p);
- cvt_float(p, m);
+ if (cvt_float(p, m) == -1)
+ goto out;
return 1;
case FILE_DOUBLE:
- cvt_double(p, m);
+ if (cvt_double(p, m) == -1)
+ goto out;
return 1;
case FILE_BEDOUBLE:
p->q = BE64(p);
- cvt_double(p, m);
+ if (cvt_double(p, m) == -1)
+ goto out;
return 1;
case FILE_LEDOUBLE:
p->q = LE64(p);
- cvt_double(p, m);
+ if (cvt_double(p, m) == -1)
+ goto out;
return 1;
case FILE_REGEX:
case FILE_SEARCH:
@@ -1045,11 +1148,15 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
case FILE_CLEAR:
case FILE_NAME:
case FILE_USE:
+ case FILE_DER:
return 1;
default:
file_magerror(ms, "invalid type %d in mconvert()", m->type);
return 0;
}
+out:
+ file_magerror(ms, "zerodivide in mconvert()");
+ return 0;
}
@@ -1072,6 +1179,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
*/
if (indir == 0) {
switch (type) {
+ case FILE_DER:
case FILE_SEARCH:
ms->search.s = RCAST(const char *, s) + offset;
ms->search.s_len = nbytes - offset;
@@ -1186,7 +1294,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
private int
mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
size_t nbytes, size_t o, unsigned int cont_level, int mode, int text,
- int flip, uint16_t indir_level, uint16_t *name_count,
+ int flip, uint16_t *indir_count, uint16_t *name_count,
int *printed_something, int *need_separator, int *returnval)
{
uint32_t offset = ms->offset;
@@ -1197,9 +1305,9 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
union VALUETYPE *p = &ms->ms_value;
struct mlist ml;
- if (indir_level >= ms->indir_max) {
- file_error(ms, 0, "indirect recursion nesting (%hu) exceeded",
- indir_level);
+ if (*indir_count >= ms->indir_max) {
+ file_error(ms, 0, "indirect count (%hu) exceeded",
+ *indir_count);
return -1;
}
@@ -1218,7 +1326,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
SIZE_T_FORMAT "u, " "nbytes=%" SIZE_T_FORMAT
"u, il=%hu, nc=%hu)\n",
m->type, m->flag, offset, o, nbytes,
- indir_level, *name_count);
+ *indir_count, *name_count);
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
#ifndef COMPILE_ONLY
file_mdump(m);
@@ -1230,6 +1338,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
if (m->in_op & FILE_OPINDIRECT) {
const union VALUETYPE *q = CAST(const union VALUETYPE *,
((const void *)(s + offset + off)));
+ if (OFFSET_OOB(nbytes, offset + off, sizeof(*q)))
+ return 0;
switch (cvt_flip(m->in_type, flip)) {
case FILE_BYTE:
off = q->b;
@@ -1410,6 +1520,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
lhs = BE32(p);
+ if (in_type == FILE_BEID3)
+ lhs = cvt_id3(ms, lhs);
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
case FILE_OPAND:
@@ -1447,6 +1559,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
if (OFFSET_OOB(nbytes, offset, 4))
return 0;
lhs = LE32(p);
+ if (in_type == FILE_LEID3)
+ lhs = cvt_id3(ms, lhs);
if (off) {
switch (m->in_op & FILE_OPS_MASK) {
case FILE_OPAND:
@@ -1554,20 +1668,6 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
break;
}
- switch (in_type) {
- case FILE_LEID3:
- case FILE_BEID3:
- offset = ((((offset >> 0) & 0x7f) << 0) |
- (((offset >> 8) & 0x7f) << 7) |
- (((offset >> 16) & 0x7f) << 14) |
- (((offset >> 24) & 0x7f) << 21));
- if ((ms->flags & MAGIC_DEBUG) != 0)
- fprintf(stderr, "id3 offs=%u\n", offset);
- break;
- default:
- break;
- }
-
if (m->flag & INDIROFFADD) {
offset += ms->c.li[cont_level-1].off;
if (offset == 0) {
@@ -1656,8 +1756,9 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
if ((pb = file_push_buffer(ms)) == NULL)
return -1;
+ (*indir_count)++;
rv = file_softmagic(ms, s + offset, nbytes - offset,
- indir_level + 1, name_count, BINTEST, text);
+ indir_count, name_count, BINTEST, text);
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
@@ -1697,7 +1798,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
if (m->flag & NOSPACE)
*need_separator = 0;
rv = match(ms, ml.magic, ml.nmagic, s, nbytes, offset + o,
- mode, text, flip, indir_level, name_count,
+ mode, text, flip, indir_count, name_count,
printed_something, need_separator, returnval);
if (rv != 1)
*need_separator = oneed_separator;
@@ -1709,6 +1810,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
if (file_printf(ms, "%s", m->desc) == -1)
return -1;
return 1;
+ case FILE_DER:
case FILE_DEFAULT: /* nothing to check */
case FILE_CLEAR:
default:
@@ -1969,10 +2071,8 @@ magiccheck(struct magic_set *ms, struct magic *m)
file_regerror(&rx, rc, ms);
v = (uint64_t)-1;
} else {
- regmatch_t pmatch[1];
+ regmatch_t pmatch;
size_t slen = ms->search.s_len;
-#ifndef REG_STARTEND
-#define REG_STARTEND 0
char *copy;
if (slen != 0) {
copy = malloc(slen);
@@ -1989,22 +2089,15 @@ magiccheck(struct magic_set *ms, struct magic *m)
search = ms->search.s;
copy = NULL;
}
-#else
- search = ms->search.s;
- pmatch[0].rm_so = 0;
- pmatch[0].rm_eo = slen;
-#endif
rc = file_regexec(&rx, (const char *)search,
- 1, pmatch, REG_STARTEND);
-#if REG_STARTEND == 0
+ 1, &pmatch, 0);
free(copy);
-#endif
switch (rc) {
case 0:
- ms->search.s += (int)pmatch[0].rm_so;
- ms->search.offset += (size_t)pmatch[0].rm_so;
+ ms->search.s += (int)pmatch.rm_so;
+ ms->search.offset += (size_t)pmatch.rm_so;
ms->search.rm_len =
- (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so);
+ (size_t)(pmatch.rm_eo - pmatch.rm_so);
v = 0;
break;
@@ -2027,6 +2120,16 @@ magiccheck(struct magic_set *ms, struct magic *m)
case FILE_USE:
case FILE_NAME:
return 1;
+ case FILE_DER:
+ matched = der_cmp(ms, m);
+ if (matched == -1) {
+ if ((ms->flags & MAGIC_DEBUG) != 0) {
+ (void) fprintf(stderr,
+ "EOF comparing DER entries");
+ }
+ return 0;
+ }
+ return matched;
default:
file_magerror(ms, "invalid type %d in magiccheck()", m->type);
return -1;
@@ -2126,12 +2229,12 @@ magiccheck(struct magic_set *ms, struct magic *m)
private int
handle_annotation(struct magic_set *ms, struct magic *m)
{
- if (ms->flags & MAGIC_APPLE) {
+ if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
if (file_printf(ms, "%.8s", m->apple) == -1)
return -1;
return 1;
}
- if (ms->flags & MAGIC_EXTENSION) {
+ if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
if (file_printf(ms, "%s", m->ext) == -1)
return -1;
return 1;
diff --git a/contrib/file/tests/Makefile.am b/contrib/file/tests/Makefile.am
index c2cb5ee..46c02e8 100644
--- a/contrib/file/tests/Makefile.am
+++ b/contrib/file/tests/Makefile.am
@@ -13,4 +13,4 @@ issue311docx.testfile
T = $(top_srcdir)/tests
check-local:
MAGIC=$(top_builddir)/magic/magic ./test
- for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
+ set -e; for i in $T/*.testfile; do echo Running test: $$i; TZ=UTC MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
diff --git a/contrib/file/tests/Makefile.in b/contrib/file/tests/Makefile.in
index 6638369..92f623e 100644
--- a/contrib/file/tests/Makefile.in
+++ b/contrib/file/tests/Makefile.in
@@ -608,7 +608,7 @@ uninstall-am:
check-local:
MAGIC=$(top_builddir)/magic/magic ./test
- for i in $T/*.testfile; do echo Running test: $$i; MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
+ set -e; for i in $T/*.testfile; do echo Running test: $$i; TZ=UTC MAGIC=$(top_builddir)/magic/magic ./test $$i $${i%%.testfile}.result; done
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/contrib/ipfilter/man/ipf.5 b/contrib/ipfilter/man/ipf.5
index 3e5e9b2..e6b470f 100644
--- a/contrib/ipfilter/man/ipf.5
+++ b/contrib/ipfilter/man/ipf.5
@@ -881,7 +881,7 @@ through without needing to explicitly allow all fragment body packets.
An example of how this is done is as follows:
.PP
.nf
-pass in proto udp from any prot = 2049 to any with frags keep fags
+pass in proto udp from any port = 2049 to any with frags keep frags
.fi
.SH Building a tree of rules
.PP
diff --git a/contrib/ntp/ChangeLog b/contrib/ntp/ChangeLog
index f61a447..0805467 100644
--- a/contrib/ntp/ChangeLog
+++ b/contrib/ntp/ChangeLog
@@ -1,4 +1,26 @@
---
+(4.2.8p8) 2016/06/02 Released by Harlan Stenn <stenn@ntp.org>
+
+* [Sec 3042] Broadcast Interleave. HStenn.
+* [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+ - validate origin timestamps on bad MACs, too. stenn@ntp.org
+* [Sec 3044] Spoofed server packets are partially processed. HStenn.
+* [Sec 3045] Bad authentication demobilizes ephemeral associations. JPerlinger.
+* [Sec 3046] CRYPTO_NAK crash. stenn@ntp.org
+* [Bug 3038] NTP fails to build in VS2015. perlinger@ntp.org
+ - provide build environment
+ - 'wint_t' and 'struct timespec' defined by VS2015
+ - fixed print()/scanf() format issues
+* [Bug 3052] Add a .gitignore file. Edmund Wong.
+* [Bug 3054] miscopt.html documents the allan intercept in seconds. SWhite.
+* [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback,
+ JPerlinger, HStenn.
+* Update the NEWS file for 4.2.8p8. HStenn.
+* Fix typo in ntp-wait and plot_summary. HStenn.
+* Make sure we have an "author" file for git imports. HStenn.
+* Update the sntp problem tests for MacOS. HStenn.
+
+---
(4.2.8p7) 2016/04/26 Released by Harlan Stenn <stenn@ntp.org>
* [Sec 2901] KoD packets must have non-zero transmit timestamps. HStenn.
diff --git a/contrib/ntp/CommitLog b/contrib/ntp/CommitLog
index 3c221ac..4577755 100644
--- a/contrib/ntp/CommitLog
+++ b/contrib/ntp/CommitLog
@@ -1,3 +1,774 @@
+ChangeSet@1.3686, 2016-06-02 07:40:06-04:00, stenn@deacon.udel.edu
+ NTP_4_2_8P8
+ TAG: NTP_4_2_8P8
+
+ ChangeLog@1.1834 +1 -0
+ NTP_4_2_8P8
+
+ ntpd/invoke-ntp.conf.texi@1.200 +1 -1
+ NTP_4_2_8P8
+
+ ntpd/invoke-ntp.keys.texi@1.190 +1 -1
+ NTP_4_2_8P8
+
+ ntpd/invoke-ntpd.texi@1.506 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntp.conf.5man@1.234 +3 -3
+ NTP_4_2_8P8
+
+ ntpd/ntp.conf.5mdoc@1.234 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntp.conf.html@1.185 +55 -19
+ NTP_4_2_8P8
+
+ ntpd/ntp.conf.man.in@1.234 +3 -3
+ NTP_4_2_8P8
+
+ ntpd/ntp.conf.mdoc.in@1.234 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntp.keys.5man@1.224 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntp.keys.5mdoc@1.224 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntp.keys.html@1.186 +1 -1
+ NTP_4_2_8P8
+
+ ntpd/ntp.keys.man.in@1.224 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntp.keys.mdoc.in@1.224 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntpd-opts.c@1.528 +7 -7
+ NTP_4_2_8P8
+
+ ntpd/ntpd-opts.h@1.527 +3 -3
+ NTP_4_2_8P8
+
+ ntpd/ntpd.1ntpdman@1.335 +3 -3
+ NTP_4_2_8P8
+
+ ntpd/ntpd.1ntpdmdoc@1.335 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntpd.html@1.179 +2 -2
+ NTP_4_2_8P8
+
+ ntpd/ntpd.man.in@1.335 +3 -3
+ NTP_4_2_8P8
+
+ ntpd/ntpd.mdoc.in@1.335 +2 -2
+ NTP_4_2_8P8
+
+ ntpdc/invoke-ntpdc.texi@1.503 +2 -2
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc-opts.c@1.521 +7 -7
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc-opts.h@1.520 +3 -3
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc.1ntpdcman@1.334 +3 -3
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.334 +2 -2
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc.html@1.347 +2 -2
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc.man.in@1.334 +3 -3
+ NTP_4_2_8P8
+
+ ntpdc/ntpdc.mdoc.in@1.334 +2 -2
+ NTP_4_2_8P8
+
+ ntpq/invoke-ntpq.texi@1.511 +2 -2
+ NTP_4_2_8P8
+
+ ntpq/ntpq-opts.c@1.528 +7 -7
+ NTP_4_2_8P8
+
+ ntpq/ntpq-opts.h@1.526 +3 -3
+ NTP_4_2_8P8
+
+ ntpq/ntpq.1ntpqman@1.339 +3 -3
+ NTP_4_2_8P8
+
+ ntpq/ntpq.1ntpqmdoc@1.339 +2 -2
+ NTP_4_2_8P8
+
+ ntpq/ntpq.html@1.176 +2 -2
+ NTP_4_2_8P8
+
+ ntpq/ntpq.man.in@1.339 +3 -3
+ NTP_4_2_8P8
+
+ ntpq/ntpq.mdoc.in@1.339 +2 -2
+ NTP_4_2_8P8
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.505 +2 -2
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.523 +7 -7
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.522 +3 -3
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.334 +3 -3
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.334 +2 -2
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd.html@1.174 +1 -1
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd.man.in@1.334 +3 -3
+ NTP_4_2_8P8
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.334 +2 -2
+ NTP_4_2_8P8
+
+ packageinfo.sh@1.528 +2 -2
+ NTP_4_2_8P8
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.95 +3 -3
+ NTP_4_2_8P8
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.96 +2 -2
+ NTP_4_2_8P8
+
+ scripts/calc_tickadj/calc_tickadj.html@1.97 +1 -1
+ NTP_4_2_8P8
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.94 +3 -3
+ NTP_4_2_8P8
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.96 +2 -2
+ NTP_4_2_8P8
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.99 +1 -1
+ NTP_4_2_8P8
+
+ scripts/invoke-plot_summary.texi@1.117 +2 -2
+ NTP_4_2_8P8
+
+ scripts/invoke-summary.texi@1.116 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.326 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/ntp-wait-opts@1.62 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.323 +3 -3
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.324 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/ntp-wait.html@1.343 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/ntp-wait.man.in@1.323 +3 -3
+ NTP_4_2_8P8
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.324 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.114 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/ntpsweep-opts@1.64 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.102 +3 -3
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.102 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/ntpsweep.html@1.115 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/ntpsweep.man.in@1.102 +3 -3
+ NTP_4_2_8P8
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.103 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.115 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntptrace/ntptrace-opts@1.64 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.102 +3 -3
+ NTP_4_2_8P8
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.103 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntptrace/ntptrace.html@1.116 +2 -2
+ NTP_4_2_8P8
+
+ scripts/ntptrace/ntptrace.man.in@1.102 +3 -3
+ NTP_4_2_8P8
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.104 +2 -2
+ NTP_4_2_8P8
+
+ scripts/plot_summary-opts@1.65 +2 -2
+ NTP_4_2_8P8
+
+ scripts/plot_summary.1plot_summaryman@1.115 +3 -3
+ NTP_4_2_8P8
+
+ scripts/plot_summary.1plot_summarymdoc@1.115 +2 -2
+ NTP_4_2_8P8
+
+ scripts/plot_summary.html@1.118 +40 -58
+ NTP_4_2_8P8
+
+ scripts/plot_summary.man.in@1.115 +3 -3
+ NTP_4_2_8P8
+
+ scripts/plot_summary.mdoc.in@1.115 +2 -2
+ NTP_4_2_8P8
+
+ scripts/summary-opts@1.64 +2 -2
+ NTP_4_2_8P8
+
+ scripts/summary.1summaryman@1.114 +3 -3
+ NTP_4_2_8P8
+
+ scripts/summary.1summarymdoc@1.114 +2 -2
+ NTP_4_2_8P8
+
+ scripts/summary.html@1.117 +2 -2
+ NTP_4_2_8P8
+
+ scripts/summary.man.in@1.114 +3 -3
+ NTP_4_2_8P8
+
+ scripts/summary.mdoc.in@1.114 +2 -2
+ NTP_4_2_8P8
+
+ scripts/update-leap/invoke-update-leap.texi@1.15 +1 -1
+ NTP_4_2_8P8
+
+ scripts/update-leap/update-leap-opts@1.15 +2 -2
+ NTP_4_2_8P8
+
+ scripts/update-leap/update-leap.1update-leapman@1.15 +3 -3
+ NTP_4_2_8P8
+
+ scripts/update-leap/update-leap.1update-leapmdoc@1.15 +2 -2
+ NTP_4_2_8P8
+
+ scripts/update-leap/update-leap.html@1.15 +1 -1
+ NTP_4_2_8P8
+
+ scripts/update-leap/update-leap.man.in@1.15 +3 -3
+ NTP_4_2_8P8
+
+ scripts/update-leap/update-leap.mdoc.in@1.15 +2 -2
+ NTP_4_2_8P8
+
+ sntp/invoke-sntp.texi@1.503 +2 -2
+ NTP_4_2_8P8
+
+ sntp/sntp-opts.c@1.522 +7 -7
+ NTP_4_2_8P8
+
+ sntp/sntp-opts.h@1.520 +3 -3
+ NTP_4_2_8P8
+
+ sntp/sntp.1sntpman@1.338 +3 -3
+ NTP_4_2_8P8
+
+ sntp/sntp.1sntpmdoc@1.338 +2 -2
+ NTP_4_2_8P8
+
+ sntp/sntp.html@1.518 +2 -2
+ NTP_4_2_8P8
+
+ sntp/sntp.man.in@1.338 +3 -3
+ NTP_4_2_8P8
+
+ sntp/sntp.mdoc.in@1.338 +2 -2
+ NTP_4_2_8P8
+
+ util/invoke-ntp-keygen.texi@1.506 +2 -2
+ NTP_4_2_8P8
+
+ util/ntp-keygen-opts.c@1.524 +7 -7
+ NTP_4_2_8P8
+
+ util/ntp-keygen-opts.h@1.522 +3 -3
+ NTP_4_2_8P8
+
+ util/ntp-keygen.1ntp-keygenman@1.334 +3 -3
+ NTP_4_2_8P8
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.334 +2 -2
+ NTP_4_2_8P8
+
+ util/ntp-keygen.html@1.180 +2 -2
+ NTP_4_2_8P8
+
+ util/ntp-keygen.man.in@1.334 +3 -3
+ NTP_4_2_8P8
+
+ util/ntp-keygen.mdoc.in@1.334 +2 -2
+ NTP_4_2_8P8
+
+ChangeSet@1.3685, 2016-06-02 06:50:37-04:00, stenn@deacon.udel.edu
+ 4.2.8p8
+
+ packageinfo.sh@1.527 +1 -1
+ 4.2.8p8
+
+ChangeSet@1.3684, 2016-05-27 08:02:09+00:00, stenn@psp-deb1.ntp.org
+ typo
+
+ NEWS@1.174 +1 -1
+ typo
+
+ChangeSet@1.3683, 2016-05-27 00:07:22-07:00, harlan@max.pfcs.com
+ [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback, JPerlinger, HStenn.
+
+ ChangeLog@1.1833 +2 -0
+ [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback, JPerlinger, HStenn.
+
+ NEWS@1.173 +2 -0
+ [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback, JPerlinger, HStenn.
+
+ ntpd/ntp_io.c@1.417 +41 -41
+ [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback, JPerlinger, HStenn.
+
+ChangeSet@1.3682, 2016-05-26 22:37:19-07:00, harlan@max.pfcs.com
+ [Sec3043] - validate origin timestamps on bad MACs, too. stenn@ntp.org
+
+ ChangeLog@1.1832 +2 -1
+ [Sec3043] - validate origin timestamps on bad MACs, too. stenn@ntp.org
+
+ NEWS@1.172 +9 -9
+ [Sec3043] - validate origin timestamps on bad MACs, too. stenn@ntp.org
+
+ ntpd/ntp_proto.c@1.392 +19 -6
+ [Sec3043] - validate origin timestamps on bad MACs, too. stenn@ntp.org
+
+ChangeSet@1.3681, 2016-05-24 23:31:36+00:00, stenn@psp-deb1.ntp.org
+ Update the NEWS file for 4.2.8p8. HStenn.
+
+ ChangeLog@1.1831 +1 -0
+ Update the NEWS file for 4.2.8p8. HStenn.
+
+ NEWS@1.171 +103 -2
+ Update the NEWS file for 4.2.8p8. HStenn.
+
+ChangeSet@1.3680, 2016-05-24 12:05:06+00:00, stenn@psp-deb1.ntp.org
+ [Sec 3044] Spoofed server packets are partially processed. HStenn.
+
+ ChangeLog@1.1830 +3 -2
+ [Sec 3044] Spoofed server packets are partially processed. HStenn.
+
+ ntpd/ntp_proto.c@1.391 +39 -24
+ [Sec 3044] Spoofed server packets are partially processed. HStenn.
+
+ChangeSet@1.3669.3.2, 2016-05-24 02:58:00-07:00, harlan@hms-mbp11.pfcs.com
+ Make sure we have an "author" file for git imports. HStenn.
+
+ ChangeLog@1.1820.3.3 +1 -0
+ Update the problem tests for MacOS for sntp. HStenn.
+
+ ChangeLog@1.1820.3.2 +1 -0
+ Make sure we have an "author" file for git imports. HStenn.
+
+ configure.ac@1.606 +1 -0
+ Make sure we have an "author" file for git imports. HStenn.
+
+ scripts/build/Makefile.am@1.5 +1 -1
+ Make sure we have an "author" file for git imports. HStenn.
+
+ scripts/build/genAuthors.in@1.1 +82 -0
+ BitKeeper file /Users/harlan/src/ntp-stable/scripts/build/genAuthors.in
+
+ scripts/build/genAuthors.in@1.0 +0 -0
+
+ sntp/configure.ac@1.83 +2 -0
+ Make sure we have an "author" file for git imports. HStenn.
+
+ sntp/m4/ntp_problemtests.m4@1.5 +1 -0
+ Make sure we have an "author" file for git imports. HStenn.
+
+ sntp/m4/sntp_problemtests.m4@1.1 +47 -0
+ BitKeeper file /Users/harlan/src/ntp-stable/sntp/m4/sntp_problemtests.m4
+
+ sntp/m4/sntp_problemtests.m4@1.0 +0 -0
+
+ sntp/tests/Makefile.am@1.67 +8 -2
+ Update the problem tests for MacOS for sntp. HStenn.
+
+ChangeSet@1.3669.3.1, 2016-05-24 02:25:46-07:00, harlan@hms-mbp11.pfcs.com
+ [Sec 3042] Broadcast Interleave. HStenn.
+
+ ChangeLog@1.1820.3.1 +4 -0
+ [Sec 3042] Broadcast Interleave. HStenn.
+
+ ntpd/ntp_proto.c@1.386.1.1 +69 -14
+ [Sec 3042] Broadcast Interleave. HStenn.
+
+ChangeSet@1.3678, 2016-05-23 09:53:37+00:00, stenn@psp-deb1.ntp.org
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ChangeLog@1.1828 +1 -1
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ include/ntp.h@1.220 +1 -0
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/complete.conf.in@1.31 +1 -1
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/invoke-ntp.conf.texi@1.199 +23 -3
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/keyword-gen-utd@1.28 +1 -1
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/keyword-gen.c@1.34 +2 -1
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp.conf.5man@1.233 +27 -6
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp.conf.5mdoc@1.233 +24 -2
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp.conf.def@1.24 +22 -0
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp.conf.man.in@1.233 +27 -6
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp.conf.mdoc.in@1.233 +24 -2
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp_config.c@1.338 +6 -2
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp_keyword.h@1.30 +617 -597
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp_parser.c@1.102 +1541 -1773
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp_parser.h@1.66 +294 -306
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp_parser.y@1.92 +2 -0
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ ntpd/ntp_proto.c@1.389 +29 -8
+ [Sec 3043] Autokey association reset. perlinger@ntp.org, stenn@ntp.org
+
+ChangeSet@1.3671.1.3, 2016-05-17 06:49:41+00:00, stenn@psp-deb1.ntp.org
+ [Bug 3054] miscopt.html documents the allan intercept in seconds. SWhite.
+
+ ChangeLog@1.1822.1.3 +1 -0
+ [Bug 3054] miscopt.html documents the allan intercept in seconds. SWhite.
+
+ html/miscopt.html@1.86 +2 -2
+ [Bug 3054] miscopt.html documents the allan intercept in seconds. SWhite.
+
+ChangeSet@1.3671.1.2, 2016-05-17 04:25:50+00:00, stenn@psp-deb1.ntp.org
+ [Bug 3052] Add a .gitignore file. Edmund Wong.
+
+ .gitignore@1.1 +9 -0
+ BitKeeper file /home/stenn/ntp-stable/.gitignore
+
+ .gitignore@1.0 +0 -0
+
+ BitKeeper/etc/ignore@1.91 +0 -1
+ [Bug 3052] Add a .gitignore file. Edmund Wong.
+
+ ChangeLog@1.1822.1.2 +1 -0
+ [Bug 3052] Add a .gitignore file. Edmund Wong.
+
+ChangeSet@1.3675, 2016-05-08 11:59:28+02:00, perlinger@ntp.org
+ [Sec 3043] Autokey association reset. perlinger@ntp.org
+ (fixes [Sec 3044] and [Sec 3045], too)
+
+ ChangeLog@1.1825 +2 -0
+ [Sec 3043] Autokey association reset. perlinger@ntp.org
+
+ ntpd/ntp_proto.c@1.388 +28 -22
+ [Sec 3043] Autokey association reset. perlinger@ntp.org
+ (fixes [Sec 3044] and [Sec 3045], too)
+
+ChangeSet@1.3674, 2016-05-06 11:05:44+00:00, stenn@psp-deb1.ntp.org
+ [Sec 3046] CRYPTO_NAK crash
+
+ ChangeLog@1.1824 +1 -0
+ [Sec 3046] CRYPTO_NAK crash
+
+ ntpd/ntp_proto.c@1.387 +2 -1
+ [Sec 3046] CRYPTO_NAK crash
+
+ChangeSet@1.3669.2.1, 2016-05-06 09:20:29+00:00, stenn@psp-deb1.ntp.org
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ ChangeLog@1.1820.2.1 +4 -0
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/invoke-plot_summary.texi@1.116 +2 -2
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/ntp-wait/ntp-wait.in@1.12 +1 -1
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary-opts@1.64 +1 -1
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary-opts.def@1.3 +1 -1
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary.1plot_summaryman@1.114 +4 -4
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary.1plot_summarymdoc@1.114 +3 -3
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary.html@1.117 +58 -40
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary.man.in@1.114 +4 -4
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/plot_summary.mdoc.in@1.114 +3 -3
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ scripts/t/ntp-wait.t@1.2 +1 -1
+ Fix typo in ntp-wait and plot_summary. HStenn.
+
+ChangeSet@1.3672, 2016-05-05 06:17:20+00:00, stenn@psp-deb1.ntp.org
+ Update NEWS file for 4.2.8p9 for Bug 3038
+
+ NEWS@1.170 +9 -0
+ Update NEWS file for 4.2.8p9 for Bug 3038
+
+ChangeSet@1.3671, 2016-05-05 06:09:53+00:00, stenn@psp-deb1.ntp.org
+ trivial cleanup
+
+ ChangeLog@1.1822 +1 -0
+ trivial cleanup
+
+ChangeSet@1.3670, 2016-04-27 21:54:12+02:00, perlinger@ntp.org
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - new build environment
+ - 'wint_t' and 'struct timespec' defined by VS2015
+ - fixed several format clashes in 'printf()' and 'scanf'
+
+ BitKeeper/etc/ignore@1.90 +1 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - skip next version of MSVC symbol database
+
+ ChangeLog@1.1821 +6 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+
+ ntpd/refclock_parse.c@1.83 +6 -6
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - work around clash SOCKET vs file descriptor formatting
+
+ ntpdc/ntpdc.c@1.107 +2 -2
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - fix format warnings/errors
+
+ ntpq/ntpq.c@1.170 +5 -2
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - fix format warnings/errors
+
+ ports/winnt/include/config.h@1.115 +4 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - VS2015 has 'wint_t'
+
+ ports/winnt/include/sys/time.h@1.9 +2 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - VS2015 has 'struct timespec'
+
+ ports/winnt/libntp/termios.c@1.33 +3 -3
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - fix format parsing error
+
+ ports/winnt/ppsapi/loopback/src/sys/time.h@1.2 +2 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - VS2015 has 'struct timespec'
+
+ ports/winnt/vs2013/common.props@1.3 +1 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ -enable multiprocessor build
+
+ ports/winnt/vs2015/common.props@1.1 +60 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/common.props@1.0 +0 -0
+
+ ports/winnt/vs2015/debug-x64.props@1.1 +24 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/debug-x64.props@1.0 +0 -0
+
+ ports/winnt/vs2015/debug.props@1.1 +24 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/debug.props@1.0 +0 -0
+
+ ports/winnt/vs2015/instsrv/instsrv.vcxproj@1.1 +269 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/instsrv/instsrv.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/instsrv/instsrv.vcxproj.filters@1.1 +28 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/instsrv/instsrv.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/libntp/libntp.vcxproj@1.1 +431 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/libntp/libntp.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/libntp/libntp.vcxproj.filters@1.1 +574 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/libntp/libntp.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/loopback-pps/loopback-ppsapi-provider.vcxproj@1.1 +252 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/loopback-pps/loopback-ppsapi-provider.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/loopback-pps/loopback-ppsapi-provider.vcxproj.filters@1.1 +39 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/loopback-pps/loopback-ppsapi-provider.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/ntp-keygen/ntp-keygen.vcxproj@1.1 +270 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntp-keygen/ntp-keygen.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/ntp-keygen/ntp-keygen.vcxproj.filters@1.1 +36 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntp-keygen/ntp-keygen.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/ntp.sln@1.1 +166 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntp.sln@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpd-keyword-gen/ntpd-keyword-gen.vcxproj@1.1 +227 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpd-keyword-gen/ntpd-keyword-gen.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpd-keyword-gen/ntpd-keyword-gen.vcxproj.filters@1.1 +69 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpd-keyword-gen/ntpd-keyword-gen.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpd/gen-ntp_keyword.bat@1.1 +53 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpd/gen-ntp_keyword.bat@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpd/ntpd.vcxproj@1.1 +515 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpd/ntpd.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpd/ntpd.vcxproj.filters@1.1 +556 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpd/ntpd.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpdate/ntpdate.vcxproj@1.1 +287 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpdate/ntpdate.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpdate/ntpdate.vcxproj.filters@1.1 +72 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpdate/ntpdate.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpdc/ntpdc.vcxproj@1.1 +278 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpdc/ntpdc.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpdc/ntpdc.vcxproj.filters@1.1 +45 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpdc/ntpdc.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpq/ntpq.vcxproj@1.1 +277 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpq/ntpq.vcxproj@1.0 +0 -0
+
+ ports/winnt/vs2015/ntpq/ntpq.vcxproj.filters@1.1 +42 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/ntpq/ntpq.vcxproj.filters@1.0 +0 -0
+
+ ports/winnt/vs2015/release-x64.props@1.1 +25 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/release-x64.props@1.0 +0 -0
+
+ ports/winnt/vs2015/release.props@1.1 +25 -0
+ [Bug 3038] NTP fails to build in VS2015 Community Edition
+ - add build environment
+
+ ports/winnt/vs2015/release.props@1.0 +0 -0
+
ChangeSet@1.3669, 2016-04-26 20:30:51-04:00, stenn@deacon.udel.edu
NTP_4_2_8P7
TAG: NTP_4_2_8P7
diff --git a/contrib/ntp/NEWS b/contrib/ntp/NEWS
index 1edaf5d..fd2551c 100644
--- a/contrib/ntp/NEWS
+++ b/contrib/ntp/NEWS
@@ -1,4 +1,116 @@
---
+NTP 4.2.8p8 (Harlan Stenn <stenn@ntp.org>, 2016/06/02)
+
+Focus: Security, Bug fixes, enhancements.
+
+Severity: HIGH
+
+In addition to bug fixes and enhancements, this release fixes the
+following 1 high- and 4 low-severity vulnerabilities:
+
+* CRYPTO_NAK crash
+ Date Resolved: 02 June 2016; Dev (4.3.93) 02 June 2016
+ References: Sec 3046 / CVE-2016-4957 / VU#321640
+ Affects: ntp-4.2.8p7, and ntp-4.3.92.
+ CVSS2: HIGH 7.8 (AV:N/AC:L/Au:N/C:N/I:N/A:C)
+ CVSS3: HIGH 7.5 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
+ Summary: The fix for Sec 3007 in ntp-4.2.8p7 contained a bug that
+ could cause ntpd to crash.
+ Mitigation:
+ Implement BCP-38.
+ Upgrade to 4.2.8p8, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page
+ If you cannot upgrade from 4.2.8p7, the only other alternatives
+ are to patch your code or filter CRYPTO_NAK packets.
+ Properly monitor your ntpd instances, and auto-restart ntpd
+ (without -g) if it stops running.
+ Credit: This weakness was discovered by Nicolas Edet of Cisco.
+
+* Bad authentication demobilizes ephemeral associations
+ Date Resolved: 02 June 2016; Dev (4.3.93) 02 June 2016
+ References: Sec 3045 / CVE-2016-4953 / VU#321640
+ Affects: ntp-4, up to but not including ntp-4.2.8p8, and
+ ntp-4.3.0 up to, but not including ntp-4.3.93.
+ CVSS2: LOW 2.6 (AV:N/AC:H/Au:N/C:N/I:N/A:P)
+ CVSS3: LOW 3.7 CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
+ Summary: An attacker who knows the origin timestamp and can send a
+ spoofed packet containing a CRYPTO-NAK to an ephemeral peer
+ target before any other response is sent can demobilize that
+ association.
+ Mitigation:
+ Implement BCP-38.
+ Upgrade to 4.2.8p8, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page
+ Properly monitor your ntpd instances.
+ Credit: This weakness was discovered by Miroslav Lichvar of Red Hat.
+
+* Processing spoofed server packets
+ Date Resolved: 02 June 2016; Dev (4.3.93) 02 June 2016
+ References: Sec 3044 / CVE-2016-4954 / VU#321640
+ Affects: ntp-4, up to but not including ntp-4.2.8p8, and
+ ntp-4.3.0 up to, but not including ntp-4.3.93.
+ CVSS2: LOW 2.6 (AV:N/AC:H/Au:N/C:N/I:N/A:P)
+ CVSS3: LOW 3.7 CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
+ Summary: An attacker who is able to spoof packets with correct origin
+ timestamps from enough servers before the expected response
+ packets arrive at the target machine can affect some peer
+ variables and, for example, cause a false leap indication to be set.
+ Mitigation:
+ Implement BCP-38.
+ Upgrade to 4.2.8p8, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page
+ Properly monitor your ntpd instances.
+ Credit: This weakness was discovered by Jakub Prokes of Red Hat.
+
+* Autokey association reset
+ Date Resolved: 02 June 2016; Dev (4.3.93) 02 June 2016
+ References: Sec 3043 / CVE-2016-4955 / VU#321640
+ Affects: ntp-4, up to but not including ntp-4.2.8p8, and
+ ntp-4.3.0 up to, but not including ntp-4.3.93.
+ CVSS2: LOW 2.6 (AV:N/AC:H/Au:N/C:N/I:N/A:P)
+ CVSS3: LOW 3.7 CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
+ Summary: An attacker who is able to spoof a packet with a correct
+ origin timestamp before the expected response packet arrives at
+ the target machine can send a CRYPTO_NAK or a bad MAC and cause
+ the association's peer variables to be cleared. If this can be
+ done often enough, it will prevent that association from working.
+ Mitigation:
+ Implement BCP-38.
+ Upgrade to 4.2.8p8, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page
+ Properly monitor your ntpd instances.
+ Credit: This weakness was discovered by Miroslav Lichvar of Red Hat.
+
+* Broadcast interleave
+ Date Resolved: 02 June 2016; Dev (4.3.93) 02 June 2016
+ References: Sec 3042 / CVE-2016-4956 / VU#321640
+ Affects: ntp-4, up to but not including ntp-4.2.8p8, and
+ ntp-4.3.0 up to, but not including ntp-4.3.93.
+ CVSS2: LOW 2.6 (AV:N/AC:H/Au:N/C:N/I:N/A:P)
+ CVSS3: LOW 3.7 CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
+ Summary: The fix for NtpBug2978 does not cover broadcast associations,
+ so broadcast clients can be triggered to flip into interleave mode.
+ Mitigation:
+ Implement BCP-38.
+ Upgrade to 4.2.8p8, or later, from the NTP Project Download Page
+ or the NTP Public Services Project Download Page
+ Properly monitor your ntpd instances.
+ Credit: This weakness was discovered by Miroslav Lichvar of Red Hat.
+
+Other fixes:
+* [Bug 3038] NTP fails to build in VS2015. perlinger@ntp.org
+ - provide build environment
+ - 'wint_t' and 'struct timespec' defined by VS2015
+ - fixed print()/scanf() format issues
+* [Bug 3052] Add a .gitignore file. Edmund Wong.
+* [Bug 3054] miscopt.html documents the allan intercept in seconds. SWhite.
+* [Bug 3058] fetch_timestamp() mishandles 64-bit alignment. Brian Utterback,
+ JPerlinger, HStenn.
+* Fix typo in ntp-wait and plot_summary. HStenn.
+* Make sure we have an "author" file for git imports. HStenn.
+* Update the sntp problem tests for MacOS. HStenn.
+
+---
NTP 4.2.8p7 (Harlan Stenn <stenn@ntp.org>, 2016/04/26)
Focus: Security, Bug fixes, enhancements.
diff --git a/contrib/ntp/configure b/contrib/ntp/configure
index 4639476..c38e7eb 100755
--- a/contrib/ntp/configure
+++ b/contrib/ntp/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ntp 4.2.8p7.
+# Generated by GNU Autoconf 2.69 for ntp 4.2.8p8.
#
# Report bugs to <http://bugs.ntp.org./>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ntp'
PACKAGE_TARNAME='ntp'
-PACKAGE_VERSION='4.2.8p7'
-PACKAGE_STRING='ntp 4.2.8p7'
+PACKAGE_VERSION='4.2.8p8'
+PACKAGE_STRING='ntp 4.2.8p8'
PACKAGE_BUGREPORT='http://bugs.ntp.org./'
PACKAGE_URL='http://www.ntp.org./'
@@ -1618,7 +1618,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ntp 4.2.8p7 to adapt to many kinds of systems.
+\`configure' configures ntp 4.2.8p8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1688,7 +1688,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ntp 4.2.8p7:";;
+ short | recursive ) echo "Configuration of ntp 4.2.8p8:";;
esac
cat <<\_ACEOF
@@ -1924,7 +1924,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ntp configure 4.2.8p7
+ntp configure 4.2.8p8
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2754,7 +2754,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ntp $as_me 4.2.8p7, which was
+It was created by ntp $as_me 4.2.8p8, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3755,7 +3755,7 @@ fi
# Define the identity of the package.
PACKAGE='ntp'
- VERSION='4.2.8p7'
+ VERSION='4.2.8p8'
cat >>confdefs.h <<_ACEOF
@@ -37251,6 +37251,7 @@ fi
+
###
@@ -37309,6 +37310,8 @@ ac_config_files="$ac_config_files scripts/Makefile"
ac_config_files="$ac_config_files scripts/build/Makefile"
+ac_config_files="$ac_config_files scripts/build/genAuthors"
+
ac_config_files="$ac_config_files scripts/build/mkver"
ac_config_files="$ac_config_files scripts/calc_tickadj/Makefile"
@@ -38000,7 +38003,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ntp $as_me 4.2.8p7, which was
+This file was extended by ntp $as_me 4.2.8p8, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -38067,7 +38070,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ntp config.status 4.2.8p7
+ntp config.status 4.2.8p8
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -38595,6 +38598,7 @@ do
"parseutil/Makefile") CONFIG_FILES="$CONFIG_FILES parseutil/Makefile" ;;
"scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
"scripts/build/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/build/Makefile" ;;
+ "scripts/build/genAuthors") CONFIG_FILES="$CONFIG_FILES scripts/build/genAuthors" ;;
"scripts/build/mkver") CONFIG_FILES="$CONFIG_FILES scripts/build/mkver" ;;
"scripts/calc_tickadj/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/calc_tickadj/Makefile" ;;
"scripts/calc_tickadj/calc_tickadj") CONFIG_FILES="$CONFIG_FILES scripts/calc_tickadj/calc_tickadj" ;;
@@ -40149,6 +40153,7 @@ _LT_EOF
;;
"ntpd/complete.conf":F) sed -e '/^rlimit$/d' -e '/^$/d' < ntpd/complete.conf > ntpd/complete.conf.new && mv ntpd/complete.conf.new ntpd/complete.conf ;;
"ntpdc/nl.pl":F) chmod +x ntpdc/nl.pl ;;
+ "scripts/build/genAuthors":F) chmod +x scripts/build/genAuthors ;;
"scripts/build/mkver":F) chmod +x scripts/build/mkver ;;
"scripts/calc_tickadj/calc_tickadj":F) chmod +x scripts/calc_tickadj/calc_tickadj ;;
"scripts/ntp-wait/ntp-wait":F) chmod +x scripts/ntp-wait/ntp-wait ;;
diff --git a/contrib/ntp/configure.ac b/contrib/ntp/configure.ac
index caba8f6..a34ed6d 100644
--- a/contrib/ntp/configure.ac
+++ b/contrib/ntp/configure.ac
@@ -4397,6 +4397,7 @@ AC_CONFIG_FILES([ntpsnmpd/Makefile])
AC_CONFIG_FILES([parseutil/Makefile])
AC_CONFIG_FILES([scripts/Makefile])
AC_CONFIG_FILES([scripts/build/Makefile])
+AC_CONFIG_FILES([scripts/build/genAuthors], [chmod +x scripts/build/genAuthors])
AC_CONFIG_FILES([scripts/build/mkver], [chmod +x scripts/build/mkver])
AC_CONFIG_FILES([scripts/calc_tickadj/Makefile])
AC_CONFIG_FILES([scripts/calc_tickadj/calc_tickadj], [chmod +x scripts/calc_tickadj/calc_tickadj])
diff --git a/contrib/ntp/html/miscopt.html b/contrib/ntp/html/miscopt.html
index bc520f6..bf4cfbf 100644
--- a/contrib/ntp/html/miscopt.html
+++ b/contrib/ntp/html/miscopt.html
@@ -11,7 +11,7 @@
<img src="pic/boom3.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
<p>We have three, now looking for more.</p>
<p>Last update:
- <!-- #BeginDate format:En2m -->16-Jan-2016 13:08<!-- #EndDate -->
+ <!-- #BeginDate format:En2m -->17-May-2016 06:26<!-- #EndDate -->
UTC</p>
<br clear="left">
<h4>Related Links</h4>
@@ -129,7 +129,7 @@
<dd>
<dl>
<dt><tt>allan <i>allan</i></tt></dt>
- <dd>Specifies the Allan intercept, which is a parameter of the PLL/FLL clock discipline algorithm, in seconds with default 1500 s.</dd>
+ <dd>Specifies the Allan intercept, which is a parameter of the PLL/FLL clock discipline algorithm, in log2 seconds with default 11 (2048 s).</dd>
<dt><tt>dispersion <i>dispersion</i></tt></dt>
<dd>Specifies the dispersion increase rate in parts-per-million (PPM) with default 15 PPM.</dd>
<dt><tt>freq <i>freq</i></tt></dt>
diff --git a/contrib/ntp/include/ntp.h b/contrib/ntp/include/ntp.h
index cad3003..84c30d9 100644
--- a/contrib/ntp/include/ntp.h
+++ b/contrib/ntp/include/ntp.h
@@ -723,6 +723,7 @@ struct pkt {
#define PROTO_UECRYPTO 29
#define PROTO_UECRYPTONAK 30
#define PROTO_UEDIGEST 31
+#define PROTO_PCEDIGEST 32
/*
* Configuration items for the loop filter
diff --git a/contrib/ntp/ntpd/complete.conf.in b/contrib/ntp/ntpd/complete.conf.in
index 747a48f..2c547fa 100644
--- a/contrib/ntp/ntpd/complete.conf.in
+++ b/contrib/ntp/ntpd/complete.conf.in
@@ -25,7 +25,7 @@ trustedkey 1 2 3 4 5 6 7 8 9 10 11 12 (14 ... 16) 18 (32768 ... 65534)
controlkey 12
requestkey 12
enable auth ntp monitor stats
-disable bclient calibrate kernel mode7
+disable bclient calibrate kernel mode7 peer_clear_digest_early unpeer_crypto_early unpeer_crypto_nak_early unpeer_digest_early
tos beacon 3600 ceiling 16 cohort 0 floor 1 maxclock 10 maxdist 1.5 minclock 3 mindist 0.001 minsane 1 orphan 16 orphanwait 300
rlimit@HAVE_RLIMIT_MEMLOCK@@HAVE_RLIMIT_STACK@
tinker allan 1500 dispersion 15 freq 0 huffpuff 7200 panic 1000 step 0.128 stepout 900 tick 0.01
diff --git a/contrib/ntp/ntpd/invoke-ntp.conf.texi b/contrib/ntp/ntpd/invoke-ntp.conf.texi
index fa8e87a..7efecee 100644
--- a/contrib/ntp/ntpd/invoke-ntp.conf.texi
+++ b/contrib/ntp/ntpd/invoke-ntp.conf.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.conf.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:28:27 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:36:07 AM by AutoGen 5.18.5
# From the definitions ntp.conf.def
# and the template file agtexi-file.tpl
@end ignore
@@ -2335,8 +2335,8 @@ otherwise, should be avoided.
This option specifies the Differentiated Services Control Point (DSCP) value,
a 6-bit code.
The default value is 46, signifying Expedited Forwarding.
-@item @code{enable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
-@item @code{disable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
+@item @code{enable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{peer_clear_digest_early} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
+@item @code{disable} @code{[@code{auth} | @code{bclient} | @code{calibrate} | @code{kernel} | @code{mode7} | @code{monitor} | @code{ntp} | @code{stats} | @code{peer_clear_digest_early} | @code{unpeer_crypto_early} | @code{unpeer_crypto_nak_early} | @code{unpeer_digest_early}]}
Provides a way to enable or disable various server options.
Flags not mentioned are unaffected.
Note that all of these flags
@@ -2401,6 +2401,26 @@ closes the feedback loop, which is useful for testing.
The default for
this flag is
@code{enable}.
+@item @code{peer_clear_digest_early}
+By default, if
+@code{ntpd(1ntpdmdoc)}
+is using autokey and it
+receives a crypto-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+@code{peerstats}
+file for evidence of any of these attacks.
+The
+default for this flag is
+@code{enable}.
@item @code{stats}
Enables the statistics facility.
See the
diff --git a/contrib/ntp/ntpd/invoke-ntp.keys.texi b/contrib/ntp/ntpd/invoke-ntp.keys.texi
index c3b8355..8585e65 100644
--- a/contrib/ntp/ntpd/invoke-ntp.keys.texi
+++ b/contrib/ntp/ntpd/invoke-ntp.keys.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.keys.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:28:30 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:36:10 AM by AutoGen 5.18.5
# From the definitions ntp.keys.def
# and the template file agtexi-file.tpl
@end ignore
diff --git a/contrib/ntp/ntpd/invoke-ntpd.texi b/contrib/ntp/ntpd/invoke-ntpd.texi
index 8856d36..7c1275a 100644
--- a/contrib/ntp/ntpd/invoke-ntpd.texi
+++ b/contrib/ntp/ntpd/invoke-ntpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpd.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:28:32 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:36:12 AM by AutoGen 5.18.5
# From the definitions ntpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -142,7 +142,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpd - NTP daemon program - Ver. 4.2.8p7
+ntpd - NTP daemon program - Ver. 4.2.8p8
Usage: ntpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
[ <server1> ... <serverN> ]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/ntpd/keyword-gen-utd b/contrib/ntp/ntpd/keyword-gen-utd
index 99c7220..69665c2 100644
--- a/contrib/ntp/ntpd/keyword-gen-utd
+++ b/contrib/ntp/ntpd/keyword-gen-utd
@@ -1 +1 @@
- * Generated 2016-01-16 08:33:03 UTC diff_ignore_line
+ * Generated 2016-05-19 06:35:34 UTC diff_ignore_line
diff --git a/contrib/ntp/ntpd/keyword-gen.c b/contrib/ntp/ntpd/keyword-gen.c
index 2e7f621..648b3ae 100644
--- a/contrib/ntp/ntpd/keyword-gen.c
+++ b/contrib/ntp/ntpd/keyword-gen.c
@@ -199,8 +199,9 @@ struct key_tok ntp_keywords[] = {
{ "bclient", T_Bclient, FOLLBY_TOKEN },
{ "calibrate", T_Calibrate, FOLLBY_TOKEN },
{ "kernel", T_Kernel, FOLLBY_TOKEN },
-{ "ntp", T_Ntp, FOLLBY_TOKEN },
{ "mode7", T_Mode7, FOLLBY_TOKEN },
+{ "ntp", T_Ntp, FOLLBY_TOKEN },
+{ "peer_clear_digest_early", T_PCEdigest, FOLLBY_TOKEN },
{ "stats", T_Stats, FOLLBY_TOKEN },
{ "unpeer_crypto_early", T_UEcrypto, FOLLBY_TOKEN },
{ "unpeer_crypto_nak_early", T_UEcryptonak, FOLLBY_TOKEN },
diff --git a/contrib/ntp/ntpd/ntp.conf.5man b/contrib/ntp/ntpd/ntp.conf.5man
index 7804902..b3fc3d8 100644
--- a/contrib/ntp/ntpd/ntp.conf.5man
+++ b/contrib/ntp/ntpd/ntp.conf.5man
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5man "26 Apr 2016" "4.2.8p7" "File Formats"
+.TH ntp.conf 5man "02 Jun 2016" "4.2.8p8" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ana4jE/ag-QnaWiE)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-OzaOIT/ag-3zaGHT)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:14 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:35:50 AM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -2618,9 +2618,9 @@ This option specifies the Differentiated Services Control Point (DSCP) value,
a 6-bit code.
The default value is 46, signifying Expedited Forwarding.
.TP 7
-.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
+.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]peer_clear_digest_early\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
.TP 7
-.NOP \f\*[B-Font]disable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
+.NOP \f\*[B-Font]disable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]peer_clear_digest_early\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
Provides a way to enable or disable various server options.
Flags not mentioned are unaffected.
Note that all of these flags
@@ -2693,6 +2693,27 @@ The default for
this flag is
\f\*[B-Font]enable\f[].
.TP 7
+.NOP \f\*[B-Font]peer_clear_digest_early\f[]
+By default, if
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+is using autokey and it
+receives a crypto-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+\f\*[B-Font]peerstats\f[]
+file for evidence of any of these attacks.
+The
+default for this flag is
+\f\*[B-Font]enable\f[].
+.TP 7
.NOP \f\*[B-Font]stats\f[]
Enables the statistics facility.
See the
diff --git a/contrib/ntp/ntpd/ntp.conf.5mdoc b/contrib/ntp/ntpd/ntp.conf.5mdoc
index c6c7e6c..21806bc 100644
--- a/contrib/ntp/ntpd/ntp.conf.5mdoc
+++ b/contrib/ntp/ntpd/ntp.conf.5mdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_CONF 5mdoc File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:16 AM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -2440,6 +2440,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2449,6 +2450,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2516,6 +2518,26 @@ closes the feedback loop, which is useful for testing.
The default for
this flag is
.Ic enable .
+.It Cm peer_clear_digest_early
+By default, if
+.Xr ntpd 1ntpdmdoc
+is using autokey and it
+receives a crypto\-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto\-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+.Cm peerstats
+file for evidence of any of these attacks.
+The
+default for this flag is
+.Ic enable .
.It Cm stats
Enables the statistics facility.
See the
diff --git a/contrib/ntp/ntpd/ntp.conf.def b/contrib/ntp/ntpd/ntp.conf.def
index 4993e02..a62e976 100644
--- a/contrib/ntp/ntpd/ntp.conf.def
+++ b/contrib/ntp/ntpd/ntp.conf.def
@@ -2442,6 +2442,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2451,6 +2452,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2518,6 +2520,26 @@ closes the feedback loop, which is useful for testing.
The default for
this flag is
.Ic enable .
+.It Cm peer_clear_digest_early
+By default, if
+.Xr ntpd 1ntpdmdoc
+is using autokey and it
+receives a crypto-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+.Cm peerstats
+file for evidence of any of these attacks.
+The
+default for this flag is
+.Ic enable .
.It Cm stats
Enables the statistics facility.
See the
diff --git a/contrib/ntp/ntpd/ntp.conf.html b/contrib/ntp/ntpd/ntp.conf.html
index c7f1b74..2f0db05 100644
--- a/contrib/ntp/ntpd/ntp.conf.html
+++ b/contrib/ntp/ntpd/ntp.conf.html
@@ -33,7 +33,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the configuration file for the NTP Project's
<code>ntpd</code> program.
- <p>This document applies to version 4.2.8p7 of <code>ntp.conf</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntp.conf</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -167,8 +167,14 @@ in some weird and even destructive behavior.
<p>If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
is detected, support for the IPv6 address family is generated
in addition to the default support of the IPv4 address family.
-In a few cases, including the reslist billboard generated
-by ntpdc, IPv6 addresses are automatically generated.
+In a few cases, including the
+<code>reslist</code>
+billboard generated
+by
+<code>ntpq(1ntpqmdoc)</code>
+or
+<code>ntpdc(1ntpdcmdoc)</code>,
+IPv6 addresses are automatically generated.
IPv6 addresses can be identified by the presence of colons
:
in the address field.
@@ -187,7 +193,7 @@ qualifier forces DNS resolution to the IPv6 namespace.
See IPv6 references for the
equivalent classes for that address family.
<dl>
-<dt><code>pool</code> <kbd>address</kbd> <code>[burst]</code> <code>[iburst]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>server</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[burst]</code> <code>[iburst]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>peer</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>broadcast</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[ttl </code><kbd>ttl</kbd><code>]</code><br><dt><code>manycastclient</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code> <code>[ttl </code><kbd>ttl</kbd><code>]</code><dd></dl>
+<dt><code>pool</code> <kbd>address</kbd> <code>[burst]</code> <code>[iburst]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>server</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[burst]</code> <code>[iburst]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code> <code>[true]</code><br><dt><code>peer</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code> <code>[true]</code> <code>[xleave]</code><br><dt><code>broadcast</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[ttl </code><kbd>ttl</kbd><code>]</code> <code>[xleave]</code><br><dt><code>manycastclient</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code> <code>[ttl </code><kbd>ttl</kbd><code>]</code><dd></dl>
<p>These five commands specify the time server name or address to
be used and the mode in which to operate.
@@ -341,6 +347,7 @@ option to a lower limit of 4 (16 s).
The server is discarded by the selection algroithm.
<br><dt><code>preempt</code><dd>Says the association can be preempted.
<br><dt><code>true</code><dd>Marks the server as a truechimer.
+Use this option only for testing.
<br><dt><code>prefer</code><dd>Marks the server as preferred.
All other things being equal,
this host will be chosen for synchronization among a set of
@@ -352,6 +359,10 @@ page
provided in
<span class="file">/usr/share/doc/ntp</span>)
for further information.
+<br><dt><code>true</code><dd>Forces the association to always survive the selection and clustering algorithms.
+This option should almost certainly
+<em>only</em>
+be used while testing an association.
<br><dt><code>ttl</code> <kbd>ttl</kbd><dd>This option is used only with broadcast server and manycast
client modes.
It specifies the time-to-live
@@ -523,7 +534,7 @@ and
commands and also by remote
configuration commands sent by a
<code>ntpdc(1ntpdcmdoc)</code>
-program running in
+program running on
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
@@ -709,7 +720,7 @@ using the host name, network address and public keys,
all of which are bound together by the protocol specifically
to deflect masquerade attacks.
For this reason Autokey
-includes the source and destinatino IP addresses in message digest
+includes the source and destination IP addresses in message digest
computations and so the same addresses must be available
at both the server and client.
For this reason operation
@@ -895,8 +906,8 @@ This overrides
the link
<span class="file">ntpkey_key_</span><kbd>hostname</kbd>
in the keys directory.
-<br><dt><code>iffpar</code> <kbd>file</kbd><dd>Specifies the location of the optional IFF parameters file.This
-overrides the link
+<br><dt><code>iffpar</code> <kbd>file</kbd><dd>Specifies the location of the optional IFF parameters file.
+This overrides the link
<span class="file">ntpkey_iff_</span><kbd>hostname</kbd>
in the keys directory.
<br><dt><code>leap</code> <kbd>file</kbd><dd>Specifies the location of the optional leapsecond file.
@@ -904,8 +915,7 @@ This overrides the link
<span class="file">ntpkey_leap</span>
in the keys directory.
<br><dt><code>mvpar</code> <kbd>file</kbd><dd>Specifies the location of the optional MV parameters file.
-This
-overrides the link
+This overrides the link
<span class="file">ntpkey_mv_</span><kbd>hostname</kbd>
in the keys directory.
<br><dt><code>pw</code> <kbd>password</kbd><dd>Specifies the password to decrypt files containing private keys and
@@ -1033,7 +1043,7 @@ supported.
Statistic files are managed using file generation sets
and scripts in the
<span class="file">./scripts</span>
-directory of this distribution.
+directory of the source code distribution.
Using
these facilities and
<span class="sc">unix</span>
@@ -1331,7 +1341,9 @@ When there is already a file with this name and
the number of links of this file is one, it is renamed appending a
dot, the letter
<code>C</code>,
-and the pid of the ntpd server process.
+and the pid of the
+<code>ntpd(1ntpdmdoc)</code>
+server process.
When the
number of links is greater than one, the file is unlinked.
This
@@ -1392,9 +1404,9 @@ at abusive rates.
Some violations cause denied service
only for the offending packet, others cause denied service
for a timed period and others cause the denied service for
-an indefinate period.
+an indefinite period.
When a client or network is denied access
-for an indefinate period, the only way at present to remove
+for an indefinite period, the only way at present to remove
the restrictions is by restarting the server.
<h5 class="subsubsection">The Kiss-of-Death Packet</h5>
@@ -1560,7 +1572,9 @@ and
queries.
<br><dt><code>notrap</code><dd>Decline to provide mode 6 control message trap service to matching
hosts.
-The trap service is a subsystem of the ntpdq control message
+The trap service is a subsystem of the
+<code>ntpq(1ntpqmdoc)</code>
+control message
protocol which is intended for use by remote event logging programs.
<br><dt><code>notrust</code><dd>Deny service unless the packet is cryptographically authenticated.
<br><dt><code>ntpport</code><dd>This is actually a match algorithm modifier, rather than a
@@ -2309,8 +2323,9 @@ must have write permission for the directory the
drift file is located in, and that file system links, symbolic or
otherwise, should be avoided.
<br><dt><code>dscp</code> <kbd>value</kbd><dd>This option specifies the Differentiated Services Control Point (DSCP) value,
-a 6-bit code. The default value is 46, signifying Expedited Forwarding.
-<br><dt><code>enable</code> <code>[auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</code><br><dt><code>disable</code> <code>[auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</code><dd>Provides a way to enable or disable various server options.
+a 6-bit code.
+The default value is 46, signifying Expedited Forwarding.
+<br><dt><code>enable</code> <code>[auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | peer_clear_digest_early | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</code><br><dt><code>disable</code> <code>[auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | peer_clear_digest_early | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</code><dd>Provides a way to enable or disable various server options.
Flags not mentioned are unaffected.
Note that all of these flags
can be controlled remotely using the
@@ -2367,6 +2382,25 @@ closes the feedback loop, which is useful for testing.
The default for
this flag is
<code>enable</code>.
+<br><dt><code>peer_clear_digest_early</code><dd>By default, if
+<code>ntpd(1ntpdmdoc)</code>
+is using autokey and it
+receives a crypto-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+<code>peerstats</code>
+file for evidence of any of these attacks.
+The
+default for this flag is
+<code>enable</code>.
<br><dt><code>stats</code><dd>Enables the statistics facility.
See the
<a href="#Monitoring-Options">Monitoring Options</a>
@@ -2502,7 +2536,8 @@ A
message class may also be followed by the
<code>all</code>
keyword to enable/disable all
-messages of the respective message class.Thus, a minimal log configuration
+messages of the respective message class.
+Thus, a minimal log configuration
could look like this:
<pre class="verbatim">
logconfig =syncstatus +sysevents
@@ -2641,7 +2676,8 @@ The default is 32 megabytes on non-Linux machines, and -1 under Linux.
<code>mlockall()</code>
function.
Defaults to 50 4k pages (200 4k pages in OpenBSD).
-<br><dt><code>filenum</code> <kbd>Nfiledescriptors</kbd><dd>Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
+<br><dt><code>filenum</code> <kbd>Nfiledescriptors</kbd><dd>Specifies the maximum number of file descriptors ntpd may have open at once.
+Defaults to the system default.
</dl>
<br><dt><code>trap</code> <kbd>host_address</kbd> <code>[port </code><kbd>port_number</kbd><code>]</code> <code>[interface </code><kbd>interface_address</kbd><code>]</code><dd>This command configures a trap receiver at the given host
address and port number for sending messages with the specified
diff --git a/contrib/ntp/ntpd/ntp.conf.man.in b/contrib/ntp/ntpd/ntp.conf.man.in
index 98b37bc..8b794da 100644
--- a/contrib/ntp/ntpd/ntp.conf.man.in
+++ b/contrib/ntp/ntpd/ntp.conf.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5 "26 Apr 2016" "4.2.8p7" "File Formats"
+.TH ntp.conf 5 "02 Jun 2016" "4.2.8p8" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ana4jE/ag-QnaWiE)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-OzaOIT/ag-3zaGHT)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:14 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:35:50 AM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -2618,9 +2618,9 @@ This option specifies the Differentiated Services Control Point (DSCP) value,
a 6-bit code.
The default value is 46, signifying Expedited Forwarding.
.TP 7
-.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
+.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]peer_clear_digest_early\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
.TP 7
-.NOP \f\*[B-Font]disable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
+.NOP \f\*[B-Font]disable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]mode7\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]stats\f[] | \f\*[B-Font]peer_clear_digest_early\f[] | \f\*[B-Font]unpeer_crypto_early\f[] | \f\*[B-Font]unpeer_crypto_nak_early\f[] | \f\*[B-Font]unpeer_digest_early\f[]]
Provides a way to enable or disable various server options.
Flags not mentioned are unaffected.
Note that all of these flags
@@ -2693,6 +2693,27 @@ The default for
this flag is
\f\*[B-Font]enable\f[].
.TP 7
+.NOP \f\*[B-Font]peer_clear_digest_early\f[]
+By default, if
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+is using autokey and it
+receives a crypto-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+\f\*[B-Font]peerstats\f[]
+file for evidence of any of these attacks.
+The
+default for this flag is
+\f\*[B-Font]enable\f[].
+.TP 7
.NOP \f\*[B-Font]stats\f[]
Enables the statistics facility.
See the
diff --git a/contrib/ntp/ntpd/ntp.conf.mdoc.in b/contrib/ntp/ntpd/ntp.conf.mdoc.in
index 82164a3..a9a3424 100644
--- a/contrib/ntp/ntpd/ntp.conf.mdoc.in
+++ b/contrib/ntp/ntpd/ntp.conf.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_CONF 5 File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:16 AM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -2440,6 +2440,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2449,6 +2450,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2516,6 +2518,26 @@ closes the feedback loop, which is useful for testing.
The default for
this flag is
.Ic enable .
+.It Cm peer_clear_digest_early
+By default, if
+.Xr ntpd @NTPD_MS@
+is using autokey and it
+receives a crypto\-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto\-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+.Cm peerstats
+file for evidence of any of these attacks.
+The
+default for this flag is
+.Ic enable .
.It Cm stats
Enables the statistics facility.
See the
diff --git a/contrib/ntp/ntpd/ntp.keys.5man b/contrib/ntp/ntpd/ntp.keys.5man
index 9843554..3e02861 100644
--- a/contrib/ntp/ntpd/ntp.keys.5man
+++ b/contrib/ntp/ntpd/ntp.keys.5man
@@ -1,8 +1,8 @@
-.TH ntp.keys 5man "26 Apr 2016" "4.2.8p7" "File Formats"
+.TH ntp.keys 5man "02 Jun 2016" "4.2.8p8" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:19 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:35:57 AM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.5mdoc b/contrib/ntp/ntpd/ntp.keys.5mdoc
index ad9cc92..275b0d5 100644
--- a/contrib/ntp/ntpd/ntp.keys.5mdoc
+++ b/contrib/ntp/ntpd/ntp.keys.5mdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_KEYS 5mdoc File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:20 AM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.html b/contrib/ntp/ntpd/ntp.keys.html
index 083b28b..5952608 100644
--- a/contrib/ntp/ntpd/ntp.keys.html
+++ b/contrib/ntp/ntpd/ntp.keys.html
@@ -33,7 +33,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the symmetric key file for the NTP Project's
<code>ntpd</code> program.
- <p>This document applies to version 4.2.8p7 of <code>ntp.keys</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntp.keys</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/ntpd/ntp.keys.man.in b/contrib/ntp/ntpd/ntp.keys.man.in
index d68be1c..692a4e2 100644
--- a/contrib/ntp/ntpd/ntp.keys.man.in
+++ b/contrib/ntp/ntpd/ntp.keys.man.in
@@ -1,8 +1,8 @@
-.TH ntp.keys 5 "26 Apr 2016" "4.2.8p7" "File Formats"
+.TH ntp.keys 5 "02 Jun 2016" "4.2.8p8" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:19 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:35:57 AM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.mdoc.in b/contrib/ntp/ntpd/ntp.keys.mdoc.in
index c1a9c7d..7881296 100644
--- a/contrib/ntp/ntpd/ntp.keys.mdoc.in
+++ b/contrib/ntp/ntpd/ntp.keys.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_KEYS 5 File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:20 AM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp_config.c b/contrib/ntp/ntpd/ntp_config.c
index cb32737..2d4ab52 100644
--- a/contrib/ntp/ntpd/ntp_config.c
+++ b/contrib/ntp/ntpd/ntp_config.c
@@ -2971,12 +2971,16 @@ apply_enable_disable(
proto_config(PROTO_MONITOR, enable, 0., NULL);
break;
+ case T_Mode7:
+ proto_config(PROTO_MODE7, enable, 0., NULL);
+ break;
+
case T_Ntp:
proto_config(PROTO_NTP, enable, 0., NULL);
break;
- case T_Mode7:
- proto_config(PROTO_MODE7, enable, 0., NULL);
+ case T_PCEdigest:
+ proto_config(PROTO_PCEDIGEST, enable, 0., NULL);
break;
case T_Stats:
diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c
index 55f9ada..8064252 100644
--- a/contrib/ntp/ntpd/ntp_io.c
+++ b/contrib/ntp/ntpd/ntp_io.c
@@ -3285,15 +3285,6 @@ fetch_timestamp(
)
{
struct cmsghdr * cmsghdr;
-#ifdef HAVE_BINTIME
- struct bintime * btp;
-#endif
-#ifdef HAVE_TIMESTAMPNS
- struct timespec * tsp;
-#endif
-#ifdef HAVE_TIMESTAMP
- struct timeval * tvp;
-#endif
unsigned long ticks;
double fuzz;
l_fp lfpfuzz;
@@ -3320,49 +3311,58 @@ fetch_timestamp(
{
#ifdef HAVE_BINTIME
case SCM_BINTIME:
- btp = (struct bintime *)CMSG_DATA(cmsghdr);
- /*
- * bintime documentation is at http://phk.freebsd.dk/pubs/timecounter.pdf
- */
- nts.l_i = btp->sec + JAN_1970;
- nts.l_uf = (u_int32)(btp->frac >> 32);
- if (sys_tick > measured_tick &&
- sys_tick > 1e-9) {
- ticks = (unsigned long)(nts.l_uf / (unsigned long)(sys_tick * FRAC));
- nts.l_uf = (unsigned long)(ticks * (unsigned long)(sys_tick * FRAC));
+ {
+ struct bintime pbt;
+ memcpy(&pbt, CMSG_DATA(cmsghdr), sizeof(pbt));
+ /*
+ * bintime documentation is at http://phk.freebsd.dk/pubs/timecounter.pdf
+ */
+ nts.l_i = pbt.sec + JAN_1970;
+ nts.l_uf = (u_int32)(pbt.frac >> 32);
+ if (sys_tick > measured_tick &&
+ sys_tick > 1e-9) {
+ ticks = (unsigned long)(nts.l_uf / (unsigned long)(sys_tick * FRAC));
+ nts.l_uf = (unsigned long)(ticks * (unsigned long)(sys_tick * FRAC));
+ }
+ DPRINTF(4, ("fetch_timestamp: system bintime network time stamp: %ld.%09lu\n",
+ pbt.sec, (unsigned long)((nts.l_uf / FRAC) * 1e9)));
}
- DPRINTF(4, ("fetch_timestamp: system bintime network time stamp: %ld.%09lu\n",
- btp->sec, (unsigned long)((nts.l_uf / FRAC) * 1e9)));
break;
#endif /* HAVE_BINTIME */
#ifdef HAVE_TIMESTAMPNS
case SCM_TIMESTAMPNS:
- tsp = UA_PTR(struct timespec, CMSG_DATA(cmsghdr));
- if (sys_tick > measured_tick &&
- sys_tick > 1e-9) {
- ticks = (unsigned long)((tsp->tv_nsec * 1e-9) /
- sys_tick);
- tsp->tv_nsec = (long)(ticks * 1e9 *
- sys_tick);
+ {
+ struct timespec pts;
+ memcpy(&pts, CMSG_DATA(cmsghdr), sizeof(pts));
+ if (sys_tick > measured_tick &&
+ sys_tick > 1e-9) {
+ ticks = (unsigned long)((pts.tv_nsec * 1e-9) /
+ sys_tick);
+ pts.tv_nsec = (long)(ticks * 1e9 *
+ sys_tick);
+ }
+ DPRINTF(4, ("fetch_timestamp: system nsec network time stamp: %ld.%09ld\n",
+ pts.tv_sec, pts.tv_nsec));
+ nts = tspec_stamp_to_lfp(pts);
}
- DPRINTF(4, ("fetch_timestamp: system nsec network time stamp: %ld.%09ld\n",
- tsp->tv_sec, tsp->tv_nsec));
- nts = tspec_stamp_to_lfp(*tsp);
break;
#endif /* HAVE_TIMESTAMPNS */
#ifdef HAVE_TIMESTAMP
case SCM_TIMESTAMP:
- tvp = (struct timeval *)CMSG_DATA(cmsghdr);
- if (sys_tick > measured_tick &&
- sys_tick > 1e-6) {
- ticks = (unsigned long)((tvp->tv_usec * 1e-6) /
- sys_tick);
- tvp->tv_usec = (long)(ticks * 1e6 *
- sys_tick);
+ {
+ struct timeval ptv;
+ memcpy(&ptv, CMSG_DATA(cmsghdr), sizeof(ptv));
+ if (sys_tick > measured_tick &&
+ sys_tick > 1e-6) {
+ ticks = (unsigned long)((ptv.tv_usec * 1e-6) /
+ sys_tick);
+ ptv.tv_usec = (long)(ticks * 1e6 *
+ sys_tick);
+ }
+ DPRINTF(4, ("fetch_timestamp: system usec network time stamp: %jd.%06ld\n",
+ (intmax_t)ptv.tv_sec, (long)ptv.tv_usec));
+ nts = tval_stamp_to_lfp(ptv);
}
- DPRINTF(4, ("fetch_timestamp: system usec network time stamp: %jd.%06ld\n",
- (intmax_t)tvp->tv_sec, (long)tvp->tv_usec));
- nts = tval_stamp_to_lfp(*tvp);
break;
#endif /* HAVE_TIMESTAMP */
}
diff --git a/contrib/ntp/ntpd/ntp_keyword.h b/contrib/ntp/ntpd/ntp_keyword.h
index c726c60..ec373cf 100644
--- a/contrib/ntp/ntpd/ntp_keyword.h
+++ b/contrib/ntp/ntpd/ntp_keyword.h
@@ -2,7 +2,7 @@
* ntp_keyword.h
*
* NOTE: edit this file with caution, it is generated by keyword-gen.c
- * Generated 2016-01-16 08:33:03 UTC diff_ignore_line
+ * Generated 2016-05-19 06:35:34 UTC diff_ignore_line
*
*/
#include "ntp_scanner.h"
@@ -10,7 +10,7 @@
#define LOWEST_KEYWORD_ID 258
-const char * const keyword_text[194] = {
+const char * const keyword_text[195] = {
/* 0 258 T_Abbrev */ "abbrev",
/* 1 259 T_Age */ "age",
/* 2 260 T_All */ "all",
@@ -133,83 +133,84 @@ const char * const keyword_text[194] = {
/* 119 377 T_NtpSignDsocket */ "ntpsigndsocket",
/* 120 378 T_Orphan */ "orphan",
/* 121 379 T_Orphanwait */ "orphanwait",
- /* 122 380 T_Panic */ "panic",
- /* 123 381 T_Peer */ "peer",
- /* 124 382 T_Peerstats */ "peerstats",
- /* 125 383 T_Phone */ "phone",
- /* 126 384 T_Pid */ "pid",
- /* 127 385 T_Pidfile */ "pidfile",
- /* 128 386 T_Pool */ "pool",
- /* 129 387 T_Port */ "port",
- /* 130 388 T_Preempt */ "preempt",
- /* 131 389 T_Prefer */ "prefer",
- /* 132 390 T_Protostats */ "protostats",
- /* 133 391 T_Pw */ "pw",
- /* 134 392 T_Randfile */ "randfile",
- /* 135 393 T_Rawstats */ "rawstats",
- /* 136 394 T_Refid */ "refid",
- /* 137 395 T_Requestkey */ "requestkey",
- /* 138 396 T_Reset */ "reset",
- /* 139 397 T_Restrict */ "restrict",
- /* 140 398 T_Revoke */ "revoke",
- /* 141 399 T_Rlimit */ "rlimit",
- /* 142 400 T_Saveconfigdir */ "saveconfigdir",
- /* 143 401 T_Server */ "server",
- /* 144 402 T_Setvar */ "setvar",
- /* 145 403 T_Source */ "source",
- /* 146 404 T_Stacksize */ "stacksize",
- /* 147 405 T_Statistics */ "statistics",
- /* 148 406 T_Stats */ "stats",
- /* 149 407 T_Statsdir */ "statsdir",
- /* 150 408 T_Step */ "step",
- /* 151 409 T_Stepback */ "stepback",
- /* 152 410 T_Stepfwd */ "stepfwd",
- /* 153 411 T_Stepout */ "stepout",
- /* 154 412 T_Stratum */ "stratum",
- /* 155 413 T_String */ NULL,
- /* 156 414 T_Sys */ "sys",
- /* 157 415 T_Sysstats */ "sysstats",
- /* 158 416 T_Tick */ "tick",
- /* 159 417 T_Time1 */ "time1",
- /* 160 418 T_Time2 */ "time2",
- /* 161 419 T_Timer */ "timer",
- /* 162 420 T_Timingstats */ "timingstats",
- /* 163 421 T_Tinker */ "tinker",
- /* 164 422 T_Tos */ "tos",
- /* 165 423 T_Trap */ "trap",
- /* 166 424 T_True */ "true",
- /* 167 425 T_Trustedkey */ "trustedkey",
- /* 168 426 T_Ttl */ "ttl",
- /* 169 427 T_Type */ "type",
- /* 170 428 T_U_int */ NULL,
- /* 171 429 T_UEcrypto */ "unpeer_crypto_early",
- /* 172 430 T_UEcryptonak */ "unpeer_crypto_nak_early",
- /* 173 431 T_UEdigest */ "unpeer_digest_early",
- /* 174 432 T_Unconfig */ "unconfig",
- /* 175 433 T_Unpeer */ "unpeer",
- /* 176 434 T_Version */ "version",
- /* 177 435 T_WanderThreshold */ NULL,
- /* 178 436 T_Week */ "week",
- /* 179 437 T_Wildcard */ "wildcard",
- /* 180 438 T_Xleave */ "xleave",
- /* 181 439 T_Year */ "year",
- /* 182 440 T_Flag */ NULL,
- /* 183 441 T_EOC */ NULL,
- /* 184 442 T_Simulate */ "simulate",
- /* 185 443 T_Beep_Delay */ "beep_delay",
- /* 186 444 T_Sim_Duration */ "simulation_duration",
- /* 187 445 T_Server_Offset */ "server_offset",
- /* 188 446 T_Duration */ "duration",
- /* 189 447 T_Freq_Offset */ "freq_offset",
- /* 190 448 T_Wander */ "wander",
- /* 191 449 T_Jitter */ "jitter",
- /* 192 450 T_Prop_Delay */ "prop_delay",
- /* 193 451 T_Proc_Delay */ "proc_delay"
+ /* 122 380 T_PCEdigest */ "peer_clear_digest_early",
+ /* 123 381 T_Panic */ "panic",
+ /* 124 382 T_Peer */ "peer",
+ /* 125 383 T_Peerstats */ "peerstats",
+ /* 126 384 T_Phone */ "phone",
+ /* 127 385 T_Pid */ "pid",
+ /* 128 386 T_Pidfile */ "pidfile",
+ /* 129 387 T_Pool */ "pool",
+ /* 130 388 T_Port */ "port",
+ /* 131 389 T_Preempt */ "preempt",
+ /* 132 390 T_Prefer */ "prefer",
+ /* 133 391 T_Protostats */ "protostats",
+ /* 134 392 T_Pw */ "pw",
+ /* 135 393 T_Randfile */ "randfile",
+ /* 136 394 T_Rawstats */ "rawstats",
+ /* 137 395 T_Refid */ "refid",
+ /* 138 396 T_Requestkey */ "requestkey",
+ /* 139 397 T_Reset */ "reset",
+ /* 140 398 T_Restrict */ "restrict",
+ /* 141 399 T_Revoke */ "revoke",
+ /* 142 400 T_Rlimit */ "rlimit",
+ /* 143 401 T_Saveconfigdir */ "saveconfigdir",
+ /* 144 402 T_Server */ "server",
+ /* 145 403 T_Setvar */ "setvar",
+ /* 146 404 T_Source */ "source",
+ /* 147 405 T_Stacksize */ "stacksize",
+ /* 148 406 T_Statistics */ "statistics",
+ /* 149 407 T_Stats */ "stats",
+ /* 150 408 T_Statsdir */ "statsdir",
+ /* 151 409 T_Step */ "step",
+ /* 152 410 T_Stepback */ "stepback",
+ /* 153 411 T_Stepfwd */ "stepfwd",
+ /* 154 412 T_Stepout */ "stepout",
+ /* 155 413 T_Stratum */ "stratum",
+ /* 156 414 T_String */ NULL,
+ /* 157 415 T_Sys */ "sys",
+ /* 158 416 T_Sysstats */ "sysstats",
+ /* 159 417 T_Tick */ "tick",
+ /* 160 418 T_Time1 */ "time1",
+ /* 161 419 T_Time2 */ "time2",
+ /* 162 420 T_Timer */ "timer",
+ /* 163 421 T_Timingstats */ "timingstats",
+ /* 164 422 T_Tinker */ "tinker",
+ /* 165 423 T_Tos */ "tos",
+ /* 166 424 T_Trap */ "trap",
+ /* 167 425 T_True */ "true",
+ /* 168 426 T_Trustedkey */ "trustedkey",
+ /* 169 427 T_Ttl */ "ttl",
+ /* 170 428 T_Type */ "type",
+ /* 171 429 T_U_int */ NULL,
+ /* 172 430 T_UEcrypto */ "unpeer_crypto_early",
+ /* 173 431 T_UEcryptonak */ "unpeer_crypto_nak_early",
+ /* 174 432 T_UEdigest */ "unpeer_digest_early",
+ /* 175 433 T_Unconfig */ "unconfig",
+ /* 176 434 T_Unpeer */ "unpeer",
+ /* 177 435 T_Version */ "version",
+ /* 178 436 T_WanderThreshold */ NULL,
+ /* 179 437 T_Week */ "week",
+ /* 180 438 T_Wildcard */ "wildcard",
+ /* 181 439 T_Xleave */ "xleave",
+ /* 182 440 T_Year */ "year",
+ /* 183 441 T_Flag */ NULL,
+ /* 184 442 T_EOC */ NULL,
+ /* 185 443 T_Simulate */ "simulate",
+ /* 186 444 T_Beep_Delay */ "beep_delay",
+ /* 187 445 T_Sim_Duration */ "simulation_duration",
+ /* 188 446 T_Server_Offset */ "server_offset",
+ /* 189 447 T_Duration */ "duration",
+ /* 190 448 T_Freq_Offset */ "freq_offset",
+ /* 191 449 T_Wander */ "wander",
+ /* 192 450 T_Jitter */ "jitter",
+ /* 193 451 T_Prop_Delay */ "prop_delay",
+ /* 194 452 T_Proc_Delay */ "proc_delay"
};
-#define SCANNER_INIT_S 887
+#define SCANNER_INIT_S 906
-const scan_state sst[890] = {
+const scan_state sst[909] = {
/*SS_T( ch, f-by, match, other ), */
0, /* 0 */
S_ST( '-', 3, 323, 0 ), /* 1 */
@@ -255,7 +256,7 @@ const scan_state sst[890] = {
S_ST( 'd', 3, 42, 0 ), /* 41 beep_ */
S_ST( 'e', 3, 43, 0 ), /* 42 beep_d */
S_ST( 'l', 3, 44, 0 ), /* 43 beep_de */
- S_ST( 'a', 3, 443, 0 ), /* 44 beep_del */
+ S_ST( 'a', 3, 444, 0 ), /* 44 beep_del */
S_ST( 'r', 3, 46, 34 ), /* 45 b */
S_ST( 'o', 3, 47, 0 ), /* 46 br */
S_ST( 'a', 3, 48, 0 ), /* 47 bro */
@@ -355,7 +356,7 @@ const scan_state sst[890] = {
S_ST( 'a', 3, 142, 0 ), /* 141 dur */
S_ST( 't', 3, 143, 0 ), /* 142 dura */
S_ST( 'i', 3, 144, 0 ), /* 143 durat */
- S_ST( 'o', 3, 446, 0 ), /* 144 durati */
+ S_ST( 'o', 3, 447, 0 ), /* 144 durati */
S_ST( 'e', 3, 146, 105 ), /* 145 */
S_ST( 'n', 3, 293, 0 ), /* 146 e */
S_ST( 'a', 3, 148, 0 ), /* 147 en */
@@ -381,7 +382,7 @@ const scan_state sst[890] = {
S_ST( 'f', 3, 168, 0 ), /* 167 freq_o */
S_ST( 'f', 3, 169, 0 ), /* 168 freq_of */
S_ST( 's', 3, 170, 0 ), /* 169 freq_off */
- S_ST( 'e', 3, 447, 0 ), /* 170 freq_offs */
+ S_ST( 'e', 3, 448, 0 ), /* 170 freq_offs */
S_ST( 'u', 3, 172, 163 ), /* 171 f */
S_ST( 'd', 3, 173, 0 ), /* 172 fu */
S_ST( 'g', 3, 305, 0 ), /* 173 fud */
@@ -441,7 +442,7 @@ const scan_state sst[890] = {
S_ST( 'i', 3, 228, 0 ), /* 227 j */
S_ST( 't', 3, 229, 0 ), /* 228 ji */
S_ST( 't', 3, 230, 0 ), /* 229 jit */
- S_ST( 'e', 3, 449, 0 ), /* 230 jitt */
+ S_ST( 'e', 3, 450, 0 ), /* 230 jitt */
S_ST( 'k', 3, 238, 226 ), /* 231 */
S_ST( 'e', 3, 325, 0 ), /* 232 k */
S_ST( 'r', 3, 234, 0 ), /* 233 ke */
@@ -450,7 +451,7 @@ const scan_state sst[890] = {
S_ST( 'd', 3, 237, 0 ), /* 236 keys */
S_ST( 'i', 3, 327, 0 ), /* 237 keysd */
S_ST( 'o', 3, 328, 232 ), /* 238 k */
- S_ST( 'l', 3, 452, 231 ), /* 239 */
+ S_ST( 'l', 3, 453, 231 ), /* 239 */
S_ST( 'e', 3, 241, 0 ), /* 240 l */
S_ST( 'a', 3, 242, 0 ), /* 241 le */
S_ST( 'p', 3, 246, 0 ), /* 242 lea */
@@ -498,7 +499,7 @@ const scan_state sst[890] = {
S_ST( 'e', 0, 0, 0 ), /* 284 T_Disable */
S_ST( 'd', 0, 0, 0 ), /* 285 T_Discard */
S_ST( 'n', 0, 0, 0 ), /* 286 T_Dispersion */
- S_ST( 'i', 3, 435, 240 ), /* 287 l */
+ S_ST( 'i', 3, 436, 240 ), /* 287 l */
S_ST( 'e', 1, 0, 0 ), /* 288 T_Driftfile */
S_ST( 'p', 0, 0, 0 ), /* 289 T_Drop */
S_ST( 'p', 0, 0, 0 ), /* 290 T_Dscp */
@@ -529,7 +530,7 @@ const scan_state sst[890] = {
S_ST( 'e', 1, 0, 0 ), /* 315 T_Includefile */
S_ST( 'i', 3, 318, 0 ), /* 316 lim */
S_ST( 'e', 0, 0, 0 ), /* 317 T_Interface */
- S_ST( 't', 3, 413, 0 ), /* 318 limi */
+ S_ST( 't', 3, 414, 0 ), /* 318 limi */
S_ST( 'o', 0, 0, 195 ), /* 319 T_Io */
S_ST( '4', 0, 0, 0 ), /* 320 T_Ipv4 */
S_ST( '4', 0, 0, 0 ), /* 321 T_Ipv4_flag */
@@ -560,7 +561,7 @@ const scan_state sst[890] = {
S_ST( 'm', 0, 0, 0 ), /* 346 T_Maxmem */
S_ST( 'l', 0, 0, 0 ), /* 347 T_Maxpoll */
S_ST( 's', 0, 0, 0 ), /* 348 T_Mdnstries */
- S_ST( 'm', 0, 521, 0 ), /* 349 T_Mem */
+ S_ST( 'm', 0, 522, 0 ), /* 349 T_Mem */
S_ST( 'k', 0, 0, 0 ), /* 350 T_Memlock */
S_ST( 'k', 0, 0, 0 ), /* 351 T_Minclock */
S_ST( 'h', 0, 0, 0 ), /* 352 T_Mindepth */
@@ -586,520 +587,539 @@ const scan_state sst[890] = {
S_ST( 'e', 0, 0, 0 ), /* 372 T_Noserve */
S_ST( 'p', 0, 0, 0 ), /* 373 T_Notrap */
S_ST( 't', 0, 0, 0 ), /* 374 T_Notrust */
- S_ST( 'p', 0, 617, 0 ), /* 375 T_Ntp */
+ S_ST( 'p', 0, 618, 0 ), /* 375 T_Ntp */
S_ST( 't', 0, 0, 0 ), /* 376 T_Ntpport */
S_ST( 't', 1, 0, 0 ), /* 377 T_NtpSignDsocket */
- S_ST( 'n', 0, 632, 0 ), /* 378 T_Orphan */
+ S_ST( 'n', 0, 633, 0 ), /* 378 T_Orphan */
S_ST( 't', 0, 0, 0 ), /* 379 T_Orphanwait */
- S_ST( 'c', 0, 0, 0 ), /* 380 T_Panic */
- S_ST( 'r', 1, 641, 0 ), /* 381 T_Peer */
- S_ST( 's', 0, 0, 0 ), /* 382 T_Peerstats */
- S_ST( 'e', 2, 0, 0 ), /* 383 T_Phone */
- S_ST( 'd', 0, 649, 0 ), /* 384 T_Pid */
- S_ST( 'e', 1, 0, 0 ), /* 385 T_Pidfile */
- S_ST( 'l', 1, 0, 0 ), /* 386 T_Pool */
- S_ST( 't', 0, 0, 0 ), /* 387 T_Port */
- S_ST( 't', 0, 0, 0 ), /* 388 T_Preempt */
- S_ST( 'r', 0, 0, 0 ), /* 389 T_Prefer */
- S_ST( 's', 0, 0, 0 ), /* 390 T_Protostats */
- S_ST( 'w', 1, 0, 655 ), /* 391 T_Pw */
- S_ST( 'e', 1, 0, 0 ), /* 392 T_Randfile */
- S_ST( 's', 0, 0, 0 ), /* 393 T_Rawstats */
- S_ST( 'd', 1, 0, 0 ), /* 394 T_Refid */
- S_ST( 'y', 0, 0, 0 ), /* 395 T_Requestkey */
- S_ST( 't', 0, 0, 0 ), /* 396 T_Reset */
- S_ST( 't', 0, 0, 0 ), /* 397 T_Restrict */
- S_ST( 'e', 0, 0, 0 ), /* 398 T_Revoke */
- S_ST( 't', 0, 0, 0 ), /* 399 T_Rlimit */
- S_ST( 'r', 1, 0, 0 ), /* 400 T_Saveconfigdir */
- S_ST( 'r', 1, 732, 0 ), /* 401 T_Server */
- S_ST( 'r', 1, 0, 0 ), /* 402 T_Setvar */
- S_ST( 'e', 0, 0, 0 ), /* 403 T_Source */
- S_ST( 'e', 0, 0, 0 ), /* 404 T_Stacksize */
- S_ST( 's', 0, 0, 0 ), /* 405 T_Statistics */
- S_ST( 's', 0, 775, 770 ), /* 406 T_Stats */
- S_ST( 'r', 1, 0, 0 ), /* 407 T_Statsdir */
- S_ST( 'p', 0, 783, 0 ), /* 408 T_Step */
- S_ST( 'k', 0, 0, 0 ), /* 409 T_Stepback */
- S_ST( 'd', 0, 0, 0 ), /* 410 T_Stepfwd */
- S_ST( 't', 0, 0, 0 ), /* 411 T_Stepout */
- S_ST( 'm', 0, 0, 0 ), /* 412 T_Stratum */
- S_ST( 'e', 3, 332, 0 ), /* 413 limit */
- S_ST( 's', 0, 790, 0 ), /* 414 T_Sys */
- S_ST( 's', 0, 0, 0 ), /* 415 T_Sysstats */
- S_ST( 'k', 0, 0, 0 ), /* 416 T_Tick */
- S_ST( '1', 0, 0, 0 ), /* 417 T_Time1 */
- S_ST( '2', 0, 0, 417 ), /* 418 T_Time2 */
- S_ST( 'r', 0, 0, 418 ), /* 419 T_Timer */
- S_ST( 's', 0, 0, 0 ), /* 420 T_Timingstats */
- S_ST( 'r', 0, 0, 0 ), /* 421 T_Tinker */
- S_ST( 's', 0, 0, 0 ), /* 422 T_Tos */
- S_ST( 'p', 1, 0, 0 ), /* 423 T_Trap */
- S_ST( 'e', 0, 0, 0 ), /* 424 T_True */
- S_ST( 'y', 0, 0, 0 ), /* 425 T_Trustedkey */
- S_ST( 'l', 0, 0, 0 ), /* 426 T_Ttl */
- S_ST( 'e', 0, 0, 0 ), /* 427 T_Type */
- S_ST( 'n', 3, 333, 294 ), /* 428 li */
- S_ST( 'y', 0, 0, 0 ), /* 429 T_UEcrypto */
- S_ST( 'y', 0, 0, 0 ), /* 430 T_UEcryptonak */
- S_ST( 'y', 0, 0, 0 ), /* 431 T_UEdigest */
- S_ST( 'g', 1, 0, 0 ), /* 432 T_Unconfig */
- S_ST( 'r', 1, 832, 0 ), /* 433 T_Unpeer */
- S_ST( 'n', 0, 0, 0 ), /* 434 T_Version */
- S_ST( 's', 3, 440, 428 ), /* 435 li */
- S_ST( 'k', 0, 0, 0 ), /* 436 T_Week */
- S_ST( 'd', 0, 0, 0 ), /* 437 T_Wildcard */
- S_ST( 'e', 0, 0, 0 ), /* 438 T_Xleave */
- S_ST( 'r', 0, 0, 0 ), /* 439 T_Year */
- S_ST( 't', 3, 441, 0 ), /* 440 lis */
- S_ST( 'e', 3, 334, 0 ), /* 441 list */
- S_ST( 'e', 0, 0, 0 ), /* 442 T_Simulate */
- S_ST( 'y', 0, 0, 0 ), /* 443 T_Beep_Delay */
- S_ST( 'n', 0, 0, 0 ), /* 444 T_Sim_Duration */
- S_ST( 't', 0, 0, 0 ), /* 445 T_Server_Offset */
- S_ST( 'n', 0, 0, 0 ), /* 446 T_Duration */
- S_ST( 't', 0, 0, 0 ), /* 447 T_Freq_Offset */
- S_ST( 'r', 0, 0, 0 ), /* 448 T_Wander */
- S_ST( 'r', 0, 0, 0 ), /* 449 T_Jitter */
- S_ST( 'y', 0, 0, 0 ), /* 450 T_Prop_Delay */
- S_ST( 'y', 0, 0, 0 ), /* 451 T_Proc_Delay */
- S_ST( 'o', 3, 468, 287 ), /* 452 l */
- S_ST( 'g', 3, 459, 0 ), /* 453 lo */
- S_ST( 'c', 3, 455, 0 ), /* 454 log */
- S_ST( 'o', 3, 456, 0 ), /* 455 logc */
- S_ST( 'n', 3, 457, 0 ), /* 456 logco */
- S_ST( 'f', 3, 458, 0 ), /* 457 logcon */
- S_ST( 'i', 3, 335, 0 ), /* 458 logconf */
- S_ST( 'f', 3, 460, 454 ), /* 459 log */
- S_ST( 'i', 3, 461, 0 ), /* 460 logf */
- S_ST( 'l', 3, 336, 0 ), /* 461 logfi */
- S_ST( 'o', 3, 463, 453 ), /* 462 lo */
- S_ST( 'p', 3, 464, 0 ), /* 463 loo */
- S_ST( 's', 3, 465, 0 ), /* 464 loop */
- S_ST( 't', 3, 466, 0 ), /* 465 loops */
- S_ST( 'a', 3, 467, 0 ), /* 466 loopst */
- S_ST( 't', 3, 337, 0 ), /* 467 loopsta */
- S_ST( 'w', 3, 469, 462 ), /* 468 lo */
- S_ST( 'p', 3, 470, 0 ), /* 469 low */
- S_ST( 'r', 3, 471, 0 ), /* 470 lowp */
- S_ST( 'i', 3, 472, 0 ), /* 471 lowpr */
- S_ST( 'o', 3, 473, 0 ), /* 472 lowpri */
- S_ST( 't', 3, 474, 0 ), /* 473 lowprio */
- S_ST( 'r', 3, 475, 0 ), /* 474 lowpriot */
- S_ST( 'a', 3, 338, 0 ), /* 475 lowpriotr */
- S_ST( 'm', 3, 557, 239 ), /* 476 */
- S_ST( 'a', 3, 495, 0 ), /* 477 m */
- S_ST( 'n', 3, 479, 0 ), /* 478 ma */
- S_ST( 'y', 3, 480, 0 ), /* 479 man */
- S_ST( 'c', 3, 481, 0 ), /* 480 many */
- S_ST( 'a', 3, 482, 0 ), /* 481 manyc */
- S_ST( 's', 3, 483, 0 ), /* 482 manyca */
- S_ST( 't', 3, 489, 0 ), /* 483 manycas */
- S_ST( 'c', 3, 485, 0 ), /* 484 manycast */
- S_ST( 'l', 3, 486, 0 ), /* 485 manycastc */
- S_ST( 'i', 3, 487, 0 ), /* 486 manycastcl */
- S_ST( 'e', 3, 488, 0 ), /* 487 manycastcli */
- S_ST( 'n', 3, 339, 0 ), /* 488 manycastclie */
- S_ST( 's', 3, 490, 484 ), /* 489 manycast */
- S_ST( 'e', 3, 491, 0 ), /* 490 manycasts */
- S_ST( 'r', 3, 492, 0 ), /* 491 manycastse */
- S_ST( 'v', 3, 493, 0 ), /* 492 manycastser */
- S_ST( 'e', 3, 340, 0 ), /* 493 manycastserv */
- S_ST( 's', 3, 341, 478 ), /* 494 ma */
- S_ST( 'x', 3, 510, 494 ), /* 495 ma */
- S_ST( 'a', 3, 497, 0 ), /* 496 max */
- S_ST( 'g', 3, 342, 0 ), /* 497 maxa */
- S_ST( 'c', 3, 499, 496 ), /* 498 max */
- S_ST( 'l', 3, 500, 0 ), /* 499 maxc */
- S_ST( 'o', 3, 501, 0 ), /* 500 maxcl */
- S_ST( 'c', 3, 343, 0 ), /* 501 maxclo */
- S_ST( 'd', 3, 506, 498 ), /* 502 max */
- S_ST( 'e', 3, 504, 0 ), /* 503 maxd */
- S_ST( 'p', 3, 505, 0 ), /* 504 maxde */
- S_ST( 't', 3, 344, 0 ), /* 505 maxdep */
- S_ST( 'i', 3, 507, 503 ), /* 506 maxd */
- S_ST( 's', 3, 345, 0 ), /* 507 maxdi */
- S_ST( 'm', 3, 509, 502 ), /* 508 max */
- S_ST( 'e', 3, 346, 0 ), /* 509 maxm */
- S_ST( 'p', 3, 511, 508 ), /* 510 max */
- S_ST( 'o', 3, 512, 0 ), /* 511 maxp */
- S_ST( 'l', 3, 347, 0 ), /* 512 maxpo */
- S_ST( 'd', 3, 514, 477 ), /* 513 m */
- S_ST( 'n', 3, 515, 0 ), /* 514 md */
- S_ST( 's', 3, 516, 0 ), /* 515 mdn */
- S_ST( 't', 3, 517, 0 ), /* 516 mdns */
- S_ST( 'r', 3, 518, 0 ), /* 517 mdnst */
- S_ST( 'i', 3, 519, 0 ), /* 518 mdnstr */
- S_ST( 'e', 3, 348, 0 ), /* 519 mdnstri */
- S_ST( 'e', 3, 349, 513 ), /* 520 m */
- S_ST( 'l', 3, 522, 0 ), /* 521 mem */
- S_ST( 'o', 3, 523, 0 ), /* 522 meml */
- S_ST( 'c', 3, 350, 0 ), /* 523 memlo */
- S_ST( 'i', 3, 525, 520 ), /* 524 m */
- S_ST( 'n', 3, 542, 0 ), /* 525 mi */
- S_ST( 'c', 3, 527, 0 ), /* 526 min */
- S_ST( 'l', 3, 528, 0 ), /* 527 minc */
- S_ST( 'o', 3, 529, 0 ), /* 528 mincl */
- S_ST( 'c', 3, 351, 0 ), /* 529 minclo */
- S_ST( 'd', 3, 534, 526 ), /* 530 min */
- S_ST( 'e', 3, 532, 0 ), /* 531 mind */
- S_ST( 'p', 3, 533, 0 ), /* 532 minde */
- S_ST( 't', 3, 352, 0 ), /* 533 mindep */
- S_ST( 'i', 3, 535, 531 ), /* 534 mind */
- S_ST( 's', 3, 353, 0 ), /* 535 mindi */
- S_ST( 'i', 3, 537, 530 ), /* 536 min */
- S_ST( 'm', 3, 538, 0 ), /* 537 mini */
- S_ST( 'u', 3, 354, 0 ), /* 538 minim */
- S_ST( 'p', 3, 540, 536 ), /* 539 min */
- S_ST( 'o', 3, 541, 0 ), /* 540 minp */
- S_ST( 'l', 3, 355, 0 ), /* 541 minpo */
- S_ST( 's', 3, 543, 539 ), /* 542 min */
- S_ST( 'a', 3, 544, 0 ), /* 543 mins */
- S_ST( 'n', 3, 356, 0 ), /* 544 minsa */
- S_ST( 'o', 3, 547, 524 ), /* 545 m */
- S_ST( 'd', 3, 357, 0 ), /* 546 mo */
- S_ST( 'n', 3, 551, 546 ), /* 547 mo */
- S_ST( 'i', 3, 549, 0 ), /* 548 mon */
- S_ST( 't', 3, 550, 0 ), /* 549 moni */
- S_ST( 'o', 3, 359, 0 ), /* 550 monit */
- S_ST( 't', 3, 360, 548 ), /* 551 mon */
- S_ST( 'r', 3, 361, 545 ), /* 552 m */
- S_ST( 's', 3, 554, 552 ), /* 553 m */
- S_ST( 's', 3, 555, 0 ), /* 554 ms */
- S_ST( 'n', 3, 556, 0 ), /* 555 mss */
- S_ST( 't', 3, 329, 0 ), /* 556 mssn */
- S_ST( 'u', 3, 558, 553 ), /* 557 m */
- S_ST( 'l', 3, 559, 0 ), /* 558 mu */
- S_ST( 't', 3, 560, 0 ), /* 559 mul */
- S_ST( 'i', 3, 561, 0 ), /* 560 mult */
- S_ST( 'c', 3, 562, 0 ), /* 561 multi */
- S_ST( 'a', 3, 563, 0 ), /* 562 multic */
- S_ST( 's', 3, 564, 0 ), /* 563 multica */
- S_ST( 't', 3, 565, 0 ), /* 564 multicas */
- S_ST( 'c', 3, 566, 0 ), /* 565 multicast */
- S_ST( 'l', 3, 567, 0 ), /* 566 multicastc */
- S_ST( 'i', 3, 568, 0 ), /* 567 multicastcl */
- S_ST( 'e', 3, 569, 0 ), /* 568 multicastcli */
- S_ST( 'n', 3, 362, 0 ), /* 569 multicastclie */
- S_ST( 'n', 3, 613, 476 ), /* 570 */
- S_ST( 'i', 3, 363, 0 ), /* 571 n */
- S_ST( 'o', 3, 608, 571 ), /* 572 n */
- S_ST( 'l', 3, 574, 0 ), /* 573 no */
- S_ST( 'i', 3, 575, 0 ), /* 574 nol */
- S_ST( 'n', 3, 364, 0 ), /* 575 noli */
- S_ST( 'm', 3, 581, 573 ), /* 576 no */
- S_ST( 'o', 3, 578, 0 ), /* 577 nom */
- S_ST( 'd', 3, 579, 0 ), /* 578 nomo */
- S_ST( 'i', 3, 580, 0 ), /* 579 nomod */
- S_ST( 'f', 3, 365, 0 ), /* 580 nomodi */
- S_ST( 'r', 3, 582, 577 ), /* 581 nom */
- S_ST( 'u', 3, 583, 0 ), /* 582 nomr */
- S_ST( 'l', 3, 584, 0 ), /* 583 nomru */
- S_ST( 'i', 3, 585, 0 ), /* 584 nomrul */
- S_ST( 's', 3, 366, 0 ), /* 585 nomruli */
- S_ST( 'n', 3, 587, 576 ), /* 586 no */
- S_ST( 'v', 3, 588, 367 ), /* 587 non */
- S_ST( 'o', 3, 589, 0 ), /* 588 nonv */
- S_ST( 'l', 3, 590, 0 ), /* 589 nonvo */
- S_ST( 'a', 3, 591, 0 ), /* 590 nonvol */
- S_ST( 't', 3, 592, 0 ), /* 591 nonvola */
- S_ST( 'i', 3, 593, 0 ), /* 592 nonvolat */
- S_ST( 'l', 3, 368, 0 ), /* 593 nonvolati */
- S_ST( 'p', 3, 595, 586 ), /* 594 no */
- S_ST( 'e', 3, 596, 0 ), /* 595 nop */
- S_ST( 'e', 3, 369, 0 ), /* 596 nope */
- S_ST( 'q', 3, 598, 594 ), /* 597 no */
- S_ST( 'u', 3, 599, 0 ), /* 598 noq */
- S_ST( 'e', 3, 600, 0 ), /* 599 noqu */
- S_ST( 'r', 3, 370, 0 ), /* 600 noque */
- S_ST( 's', 3, 602, 597 ), /* 601 no */
- S_ST( 'e', 3, 606, 0 ), /* 602 nos */
- S_ST( 'l', 3, 604, 0 ), /* 603 nose */
- S_ST( 'e', 3, 605, 0 ), /* 604 nosel */
- S_ST( 'c', 3, 371, 0 ), /* 605 nosele */
- S_ST( 'r', 3, 607, 603 ), /* 606 nose */
- S_ST( 'v', 3, 372, 0 ), /* 607 noser */
- S_ST( 't', 3, 609, 601 ), /* 608 no */
- S_ST( 'r', 3, 611, 0 ), /* 609 not */
- S_ST( 'a', 3, 373, 0 ), /* 610 notr */
- S_ST( 'u', 3, 612, 610 ), /* 611 notr */
- S_ST( 's', 3, 374, 0 ), /* 612 notru */
- S_ST( 't', 3, 375, 572 ), /* 613 n */
- S_ST( 'p', 3, 615, 0 ), /* 614 ntp */
- S_ST( 'o', 3, 616, 0 ), /* 615 ntpp */
- S_ST( 'r', 3, 376, 0 ), /* 616 ntppo */
- S_ST( 's', 3, 618, 614 ), /* 617 ntp */
- S_ST( 'i', 3, 619, 0 ), /* 618 ntps */
- S_ST( 'g', 3, 620, 0 ), /* 619 ntpsi */
- S_ST( 'n', 3, 621, 0 ), /* 620 ntpsig */
- S_ST( 'd', 3, 622, 0 ), /* 621 ntpsign */
- S_ST( 's', 3, 623, 0 ), /* 622 ntpsignd */
- S_ST( 'o', 3, 624, 0 ), /* 623 ntpsignds */
- S_ST( 'c', 3, 625, 0 ), /* 624 ntpsigndso */
- S_ST( 'k', 3, 626, 0 ), /* 625 ntpsigndsoc */
- S_ST( 'e', 3, 377, 0 ), /* 626 ntpsigndsock */
- S_ST( 'o', 3, 628, 570 ), /* 627 */
- S_ST( 'r', 3, 629, 0 ), /* 628 o */
- S_ST( 'p', 3, 630, 0 ), /* 629 or */
- S_ST( 'h', 3, 631, 0 ), /* 630 orp */
- S_ST( 'a', 3, 378, 0 ), /* 631 orph */
- S_ST( 'w', 3, 633, 0 ), /* 632 orphan */
- S_ST( 'a', 3, 634, 0 ), /* 633 orphanw */
- S_ST( 'i', 3, 379, 0 ), /* 634 orphanwa */
- S_ST( 'p', 3, 391, 627 ), /* 635 */
- S_ST( 'a', 3, 637, 0 ), /* 636 p */
- S_ST( 'n', 3, 638, 0 ), /* 637 pa */
- S_ST( 'i', 3, 380, 0 ), /* 638 pan */
- S_ST( 'e', 3, 640, 636 ), /* 639 p */
- S_ST( 'e', 3, 381, 0 ), /* 640 pe */
- S_ST( 's', 3, 642, 0 ), /* 641 peer */
- S_ST( 't', 3, 643, 0 ), /* 642 peers */
- S_ST( 'a', 3, 644, 0 ), /* 643 peerst */
- S_ST( 't', 3, 382, 0 ), /* 644 peersta */
- S_ST( 'h', 3, 646, 639 ), /* 645 p */
- S_ST( 'o', 3, 647, 0 ), /* 646 ph */
- S_ST( 'n', 3, 383, 0 ), /* 647 pho */
- S_ST( 'i', 3, 384, 645 ), /* 648 p */
- S_ST( 'f', 3, 650, 0 ), /* 649 pid */
- S_ST( 'i', 3, 651, 0 ), /* 650 pidf */
- S_ST( 'l', 3, 385, 0 ), /* 651 pidfi */
- S_ST( 'o', 3, 654, 648 ), /* 652 p */
- S_ST( 'o', 3, 386, 0 ), /* 653 po */
- S_ST( 'r', 3, 387, 653 ), /* 654 po */
- S_ST( 'r', 3, 662, 652 ), /* 655 p */
- S_ST( 'e', 3, 660, 0 ), /* 656 pr */
- S_ST( 'e', 3, 658, 0 ), /* 657 pre */
- S_ST( 'm', 3, 659, 0 ), /* 658 pree */
- S_ST( 'p', 3, 388, 0 ), /* 659 preem */
- S_ST( 'f', 3, 661, 657 ), /* 660 pre */
- S_ST( 'e', 3, 389, 0 ), /* 661 pref */
- S_ST( 'o', 3, 675, 656 ), /* 662 pr */
- S_ST( 'c', 3, 664, 0 ), /* 663 pro */
- S_ST( '_', 3, 665, 0 ), /* 664 proc */
- S_ST( 'd', 3, 666, 0 ), /* 665 proc_ */
- S_ST( 'e', 3, 667, 0 ), /* 666 proc_d */
- S_ST( 'l', 3, 668, 0 ), /* 667 proc_de */
- S_ST( 'a', 3, 451, 0 ), /* 668 proc_del */
- S_ST( 'p', 3, 670, 663 ), /* 669 pro */
- S_ST( '_', 3, 671, 0 ), /* 670 prop */
- S_ST( 'd', 3, 672, 0 ), /* 671 prop_ */
- S_ST( 'e', 3, 673, 0 ), /* 672 prop_d */
- S_ST( 'l', 3, 674, 0 ), /* 673 prop_de */
- S_ST( 'a', 3, 450, 0 ), /* 674 prop_del */
- S_ST( 't', 3, 676, 669 ), /* 675 pro */
- S_ST( 'o', 3, 677, 0 ), /* 676 prot */
- S_ST( 's', 3, 678, 0 ), /* 677 proto */
- S_ST( 't', 3, 679, 0 ), /* 678 protos */
- S_ST( 'a', 3, 680, 0 ), /* 679 protost */
- S_ST( 't', 3, 390, 0 ), /* 680 protosta */
- S_ST( 'r', 3, 712, 635 ), /* 681 */
- S_ST( 'a', 3, 688, 0 ), /* 682 r */
- S_ST( 'n', 3, 684, 0 ), /* 683 ra */
- S_ST( 'd', 3, 685, 0 ), /* 684 ran */
- S_ST( 'f', 3, 686, 0 ), /* 685 rand */
- S_ST( 'i', 3, 687, 0 ), /* 686 randf */
- S_ST( 'l', 3, 392, 0 ), /* 687 randfi */
- S_ST( 'w', 3, 689, 683 ), /* 688 ra */
- S_ST( 's', 3, 690, 0 ), /* 689 raw */
- S_ST( 't', 3, 691, 0 ), /* 690 raws */
- S_ST( 'a', 3, 692, 0 ), /* 691 rawst */
- S_ST( 't', 3, 393, 0 ), /* 692 rawsta */
- S_ST( 'e', 3, 709, 682 ), /* 693 r */
- S_ST( 'f', 3, 695, 0 ), /* 694 re */
- S_ST( 'i', 3, 394, 0 ), /* 695 ref */
- S_ST( 'q', 3, 697, 694 ), /* 696 re */
- S_ST( 'u', 3, 698, 0 ), /* 697 req */
- S_ST( 'e', 3, 699, 0 ), /* 698 requ */
- S_ST( 's', 3, 700, 0 ), /* 699 reque */
- S_ST( 't', 3, 701, 0 ), /* 700 reques */
- S_ST( 'k', 3, 702, 0 ), /* 701 request */
- S_ST( 'e', 3, 395, 0 ), /* 702 requestk */
- S_ST( 's', 3, 705, 696 ), /* 703 re */
- S_ST( 'e', 3, 396, 0 ), /* 704 res */
- S_ST( 't', 3, 706, 704 ), /* 705 res */
- S_ST( 'r', 3, 707, 0 ), /* 706 rest */
- S_ST( 'i', 3, 708, 0 ), /* 707 restr */
- S_ST( 'c', 3, 397, 0 ), /* 708 restri */
- S_ST( 'v', 3, 710, 703 ), /* 709 re */
- S_ST( 'o', 3, 711, 0 ), /* 710 rev */
- S_ST( 'k', 3, 398, 0 ), /* 711 revo */
- S_ST( 'l', 3, 713, 693 ), /* 712 r */
- S_ST( 'i', 3, 714, 0 ), /* 713 rl */
- S_ST( 'm', 3, 715, 0 ), /* 714 rli */
- S_ST( 'i', 3, 399, 0 ), /* 715 rlim */
- S_ST( 's', 3, 789, 681 ), /* 716 */
- S_ST( 'a', 3, 718, 0 ), /* 717 s */
- S_ST( 'v', 3, 719, 0 ), /* 718 sa */
- S_ST( 'e', 3, 720, 0 ), /* 719 sav */
- S_ST( 'c', 3, 721, 0 ), /* 720 save */
- S_ST( 'o', 3, 722, 0 ), /* 721 savec */
- S_ST( 'n', 3, 723, 0 ), /* 722 saveco */
- S_ST( 'f', 3, 724, 0 ), /* 723 savecon */
- S_ST( 'i', 3, 725, 0 ), /* 724 saveconf */
- S_ST( 'g', 3, 726, 0 ), /* 725 saveconfi */
- S_ST( 'd', 3, 727, 0 ), /* 726 saveconfig */
- S_ST( 'i', 3, 400, 0 ), /* 727 saveconfigd */
- S_ST( 'e', 3, 738, 717 ), /* 728 s */
- S_ST( 'r', 3, 730, 0 ), /* 729 se */
- S_ST( 'v', 3, 731, 0 ), /* 730 ser */
- S_ST( 'e', 3, 401, 0 ), /* 731 serv */
- S_ST( '_', 3, 733, 0 ), /* 732 server */
- S_ST( 'o', 3, 734, 0 ), /* 733 server_ */
- S_ST( 'f', 3, 735, 0 ), /* 734 server_o */
- S_ST( 'f', 3, 736, 0 ), /* 735 server_of */
- S_ST( 's', 3, 737, 0 ), /* 736 server_off */
- S_ST( 'e', 3, 445, 0 ), /* 737 server_offs */
- S_ST( 't', 3, 739, 729 ), /* 738 se */
- S_ST( 'v', 3, 740, 0 ), /* 739 set */
- S_ST( 'a', 3, 402, 0 ), /* 740 setv */
- S_ST( 'i', 3, 742, 728 ), /* 741 s */
- S_ST( 'm', 3, 743, 0 ), /* 742 si */
- S_ST( 'u', 3, 744, 0 ), /* 743 sim */
- S_ST( 'l', 3, 745, 0 ), /* 744 simu */
- S_ST( 'a', 3, 746, 0 ), /* 745 simul */
- S_ST( 't', 3, 747, 0 ), /* 746 simula */
- S_ST( 'i', 3, 748, 442 ), /* 747 simulat */
- S_ST( 'o', 3, 749, 0 ), /* 748 simulati */
- S_ST( 'n', 3, 750, 0 ), /* 749 simulatio */
- S_ST( '_', 3, 751, 0 ), /* 750 simulation */
- S_ST( 'd', 3, 752, 0 ), /* 751 simulation_ */
- S_ST( 'u', 3, 753, 0 ), /* 752 simulation_d */
- S_ST( 'r', 3, 754, 0 ), /* 753 simulation_du */
- S_ST( 'a', 3, 755, 0 ), /* 754 simulation_dur */
- S_ST( 't', 3, 756, 0 ), /* 755 simulation_dura */
- S_ST( 'i', 3, 757, 0 ), /* 756 simulation_durat */
- S_ST( 'o', 3, 444, 0 ), /* 757 simulation_durati */
- S_ST( 'o', 3, 759, 741 ), /* 758 s */
- S_ST( 'u', 3, 760, 0 ), /* 759 so */
- S_ST( 'r', 3, 761, 0 ), /* 760 sou */
- S_ST( 'c', 3, 403, 0 ), /* 761 sour */
- S_ST( 't', 3, 785, 758 ), /* 762 s */
- S_ST( 'a', 3, 769, 0 ), /* 763 st */
- S_ST( 'c', 3, 765, 0 ), /* 764 sta */
- S_ST( 'k', 3, 766, 0 ), /* 765 stac */
- S_ST( 's', 3, 767, 0 ), /* 766 stack */
- S_ST( 'i', 3, 768, 0 ), /* 767 stacks */
- S_ST( 'z', 3, 404, 0 ), /* 768 stacksi */
- S_ST( 't', 3, 406, 764 ), /* 769 sta */
- S_ST( 'i', 3, 771, 0 ), /* 770 stat */
- S_ST( 's', 3, 772, 0 ), /* 771 stati */
- S_ST( 't', 3, 773, 0 ), /* 772 statis */
- S_ST( 'i', 3, 774, 0 ), /* 773 statist */
- S_ST( 'c', 3, 405, 0 ), /* 774 statisti */
- S_ST( 'd', 3, 776, 0 ), /* 775 stats */
- S_ST( 'i', 3, 407, 0 ), /* 776 statsd */
- S_ST( 'e', 3, 408, 763 ), /* 777 st */
- S_ST( 'b', 3, 779, 0 ), /* 778 step */
- S_ST( 'a', 3, 780, 0 ), /* 779 stepb */
- S_ST( 'c', 3, 409, 0 ), /* 780 stepba */
- S_ST( 'f', 3, 782, 778 ), /* 781 step */
- S_ST( 'w', 3, 410, 0 ), /* 782 stepf */
- S_ST( 'o', 3, 784, 781 ), /* 783 step */
- S_ST( 'u', 3, 411, 0 ), /* 784 stepo */
- S_ST( 'r', 3, 786, 777 ), /* 785 st */
- S_ST( 'a', 3, 787, 0 ), /* 786 str */
- S_ST( 't', 3, 788, 0 ), /* 787 stra */
- S_ST( 'u', 3, 412, 0 ), /* 788 strat */
- S_ST( 'y', 3, 414, 762 ), /* 789 s */
- S_ST( 's', 3, 791, 0 ), /* 790 sys */
- S_ST( 't', 3, 792, 0 ), /* 791 syss */
- S_ST( 'a', 3, 793, 0 ), /* 792 sysst */
- S_ST( 't', 3, 415, 0 ), /* 793 syssta */
- S_ST( 't', 3, 820, 716 ), /* 794 */
- S_ST( 'i', 3, 806, 0 ), /* 795 t */
- S_ST( 'c', 3, 416, 0 ), /* 796 ti */
- S_ST( 'm', 3, 799, 796 ), /* 797 ti */
- S_ST( 'e', 3, 419, 0 ), /* 798 tim */
- S_ST( 'i', 3, 800, 798 ), /* 799 tim */
- S_ST( 'n', 3, 801, 0 ), /* 800 timi */
- S_ST( 'g', 3, 802, 0 ), /* 801 timin */
- S_ST( 's', 3, 803, 0 ), /* 802 timing */
- S_ST( 't', 3, 804, 0 ), /* 803 timings */
- S_ST( 'a', 3, 805, 0 ), /* 804 timingst */
- S_ST( 't', 3, 420, 0 ), /* 805 timingsta */
- S_ST( 'n', 3, 807, 797 ), /* 806 ti */
- S_ST( 'k', 3, 808, 0 ), /* 807 tin */
- S_ST( 'e', 3, 421, 0 ), /* 808 tink */
- S_ST( 'o', 3, 422, 795 ), /* 809 t */
- S_ST( 'r', 3, 812, 809 ), /* 810 t */
- S_ST( 'a', 3, 423, 0 ), /* 811 tr */
- S_ST( 'u', 3, 813, 811 ), /* 812 tr */
- S_ST( 's', 3, 814, 424 ), /* 813 tru */
- S_ST( 't', 3, 815, 0 ), /* 814 trus */
- S_ST( 'e', 3, 816, 0 ), /* 815 trust */
- S_ST( 'd', 3, 817, 0 ), /* 816 truste */
- S_ST( 'k', 3, 818, 0 ), /* 817 trusted */
- S_ST( 'e', 3, 425, 0 ), /* 818 trustedk */
- S_ST( 't', 3, 426, 810 ), /* 819 t */
- S_ST( 'y', 3, 821, 819 ), /* 820 t */
- S_ST( 'p', 3, 427, 0 ), /* 821 ty */
- S_ST( 'u', 3, 823, 794 ), /* 822 */
- S_ST( 'n', 3, 829, 0 ), /* 823 u */
- S_ST( 'c', 3, 825, 0 ), /* 824 un */
- S_ST( 'o', 3, 826, 0 ), /* 825 unc */
- S_ST( 'n', 3, 827, 0 ), /* 826 unco */
- S_ST( 'f', 3, 828, 0 ), /* 827 uncon */
- S_ST( 'i', 3, 432, 0 ), /* 828 unconf */
- S_ST( 'p', 3, 830, 824 ), /* 829 un */
- S_ST( 'e', 3, 831, 0 ), /* 830 unp */
- S_ST( 'e', 3, 433, 0 ), /* 831 unpe */
- S_ST( '_', 3, 852, 0 ), /* 832 unpeer */
- S_ST( 'c', 3, 834, 0 ), /* 833 unpeer_ */
- S_ST( 'r', 3, 835, 0 ), /* 834 unpeer_c */
- S_ST( 'y', 3, 836, 0 ), /* 835 unpeer_cr */
- S_ST( 'p', 3, 837, 0 ), /* 836 unpeer_cry */
- S_ST( 't', 3, 838, 0 ), /* 837 unpeer_cryp */
- S_ST( 'o', 3, 839, 0 ), /* 838 unpeer_crypt */
- S_ST( '_', 3, 844, 0 ), /* 839 unpeer_crypto */
- S_ST( 'e', 3, 841, 0 ), /* 840 unpeer_crypto_ */
- S_ST( 'a', 3, 842, 0 ), /* 841 unpeer_crypto_e */
- S_ST( 'r', 3, 843, 0 ), /* 842 unpeer_crypto_ea */
- S_ST( 'l', 3, 429, 0 ), /* 843 unpeer_crypto_ear */
- S_ST( 'n', 3, 845, 840 ), /* 844 unpeer_crypto_ */
- S_ST( 'a', 3, 846, 0 ), /* 845 unpeer_crypto_n */
- S_ST( 'k', 3, 847, 0 ), /* 846 unpeer_crypto_na */
- S_ST( '_', 3, 848, 0 ), /* 847 unpeer_crypto_nak */
- S_ST( 'e', 3, 849, 0 ), /* 848 unpeer_crypto_nak_ */
- S_ST( 'a', 3, 850, 0 ), /* 849 unpeer_crypto_nak_e */
- S_ST( 'r', 3, 851, 0 ), /* 850 unpeer_crypto_nak_ea */
- S_ST( 'l', 3, 430, 0 ), /* 851 unpeer_crypto_nak_ear */
- S_ST( 'd', 3, 853, 833 ), /* 852 unpeer_ */
- S_ST( 'i', 3, 854, 0 ), /* 853 unpeer_d */
- S_ST( 'g', 3, 855, 0 ), /* 854 unpeer_di */
- S_ST( 'e', 3, 856, 0 ), /* 855 unpeer_dig */
- S_ST( 's', 3, 857, 0 ), /* 856 unpeer_dige */
- S_ST( 't', 3, 858, 0 ), /* 857 unpeer_diges */
- S_ST( '_', 3, 859, 0 ), /* 858 unpeer_digest */
- S_ST( 'e', 3, 860, 0 ), /* 859 unpeer_digest_ */
- S_ST( 'a', 3, 861, 0 ), /* 860 unpeer_digest_e */
- S_ST( 'r', 3, 862, 0 ), /* 861 unpeer_digest_ea */
- S_ST( 'l', 3, 431, 0 ), /* 862 unpeer_digest_ear */
- S_ST( 'v', 3, 864, 822 ), /* 863 */
- S_ST( 'e', 3, 865, 0 ), /* 864 v */
- S_ST( 'r', 3, 866, 0 ), /* 865 ve */
- S_ST( 's', 3, 867, 0 ), /* 866 ver */
- S_ST( 'i', 3, 868, 0 ), /* 867 vers */
- S_ST( 'o', 3, 434, 0 ), /* 868 versi */
- S_ST( 'w', 3, 876, 863 ), /* 869 */
- S_ST( 'a', 3, 871, 0 ), /* 870 w */
- S_ST( 'n', 3, 872, 0 ), /* 871 wa */
- S_ST( 'd', 3, 873, 0 ), /* 872 wan */
- S_ST( 'e', 3, 448, 0 ), /* 873 wand */
- S_ST( 'e', 3, 875, 870 ), /* 874 w */
- S_ST( 'e', 3, 436, 0 ), /* 875 we */
- S_ST( 'i', 3, 877, 874 ), /* 876 w */
- S_ST( 'l', 3, 878, 0 ), /* 877 wi */
- S_ST( 'd', 3, 879, 0 ), /* 878 wil */
- S_ST( 'c', 3, 880, 0 ), /* 879 wild */
- S_ST( 'a', 3, 881, 0 ), /* 880 wildc */
- S_ST( 'r', 3, 437, 0 ), /* 881 wildca */
- S_ST( 'x', 3, 883, 869 ), /* 882 */
- S_ST( 'l', 3, 884, 0 ), /* 883 x */
- S_ST( 'e', 3, 885, 0 ), /* 884 xl */
- S_ST( 'a', 3, 886, 0 ), /* 885 xle */
- S_ST( 'v', 3, 438, 0 ), /* 886 xlea */
- S_ST( 'y', 3, 888, 882 ), /* 887 [initial state] */
- S_ST( 'e', 3, 889, 0 ), /* 888 y */
- S_ST( 'a', 3, 439, 0 ) /* 889 ye */
+ S_ST( 'y', 0, 0, 0 ), /* 380 T_PCEdigest */
+ S_ST( 'c', 0, 0, 0 ), /* 381 T_Panic */
+ S_ST( 'r', 1, 660, 0 ), /* 382 T_Peer */
+ S_ST( 's', 0, 0, 0 ), /* 383 T_Peerstats */
+ S_ST( 'e', 2, 0, 0 ), /* 384 T_Phone */
+ S_ST( 'd', 0, 668, 0 ), /* 385 T_Pid */
+ S_ST( 'e', 1, 0, 0 ), /* 386 T_Pidfile */
+ S_ST( 'l', 1, 0, 0 ), /* 387 T_Pool */
+ S_ST( 't', 0, 0, 0 ), /* 388 T_Port */
+ S_ST( 't', 0, 0, 0 ), /* 389 T_Preempt */
+ S_ST( 'r', 0, 0, 0 ), /* 390 T_Prefer */
+ S_ST( 's', 0, 0, 0 ), /* 391 T_Protostats */
+ S_ST( 'w', 1, 0, 674 ), /* 392 T_Pw */
+ S_ST( 'e', 1, 0, 0 ), /* 393 T_Randfile */
+ S_ST( 's', 0, 0, 0 ), /* 394 T_Rawstats */
+ S_ST( 'd', 1, 0, 0 ), /* 395 T_Refid */
+ S_ST( 'y', 0, 0, 0 ), /* 396 T_Requestkey */
+ S_ST( 't', 0, 0, 0 ), /* 397 T_Reset */
+ S_ST( 't', 0, 0, 0 ), /* 398 T_Restrict */
+ S_ST( 'e', 0, 0, 0 ), /* 399 T_Revoke */
+ S_ST( 't', 0, 0, 0 ), /* 400 T_Rlimit */
+ S_ST( 'r', 1, 0, 0 ), /* 401 T_Saveconfigdir */
+ S_ST( 'r', 1, 751, 0 ), /* 402 T_Server */
+ S_ST( 'r', 1, 0, 0 ), /* 403 T_Setvar */
+ S_ST( 'e', 0, 0, 0 ), /* 404 T_Source */
+ S_ST( 'e', 0, 0, 0 ), /* 405 T_Stacksize */
+ S_ST( 's', 0, 0, 0 ), /* 406 T_Statistics */
+ S_ST( 's', 0, 794, 789 ), /* 407 T_Stats */
+ S_ST( 'r', 1, 0, 0 ), /* 408 T_Statsdir */
+ S_ST( 'p', 0, 802, 0 ), /* 409 T_Step */
+ S_ST( 'k', 0, 0, 0 ), /* 410 T_Stepback */
+ S_ST( 'd', 0, 0, 0 ), /* 411 T_Stepfwd */
+ S_ST( 't', 0, 0, 0 ), /* 412 T_Stepout */
+ S_ST( 'm', 0, 0, 0 ), /* 413 T_Stratum */
+ S_ST( 'e', 3, 332, 0 ), /* 414 limit */
+ S_ST( 's', 0, 809, 0 ), /* 415 T_Sys */
+ S_ST( 's', 0, 0, 0 ), /* 416 T_Sysstats */
+ S_ST( 'k', 0, 0, 0 ), /* 417 T_Tick */
+ S_ST( '1', 0, 0, 0 ), /* 418 T_Time1 */
+ S_ST( '2', 0, 0, 418 ), /* 419 T_Time2 */
+ S_ST( 'r', 0, 0, 419 ), /* 420 T_Timer */
+ S_ST( 's', 0, 0, 0 ), /* 421 T_Timingstats */
+ S_ST( 'r', 0, 0, 0 ), /* 422 T_Tinker */
+ S_ST( 's', 0, 0, 0 ), /* 423 T_Tos */
+ S_ST( 'p', 1, 0, 0 ), /* 424 T_Trap */
+ S_ST( 'e', 0, 0, 0 ), /* 425 T_True */
+ S_ST( 'y', 0, 0, 0 ), /* 426 T_Trustedkey */
+ S_ST( 'l', 0, 0, 0 ), /* 427 T_Ttl */
+ S_ST( 'e', 0, 0, 0 ), /* 428 T_Type */
+ S_ST( 'n', 3, 333, 294 ), /* 429 li */
+ S_ST( 'y', 0, 0, 0 ), /* 430 T_UEcrypto */
+ S_ST( 'y', 0, 0, 0 ), /* 431 T_UEcryptonak */
+ S_ST( 'y', 0, 0, 0 ), /* 432 T_UEdigest */
+ S_ST( 'g', 1, 0, 0 ), /* 433 T_Unconfig */
+ S_ST( 'r', 1, 851, 0 ), /* 434 T_Unpeer */
+ S_ST( 'n', 0, 0, 0 ), /* 435 T_Version */
+ S_ST( 's', 3, 441, 429 ), /* 436 li */
+ S_ST( 'k', 0, 0, 0 ), /* 437 T_Week */
+ S_ST( 'd', 0, 0, 0 ), /* 438 T_Wildcard */
+ S_ST( 'e', 0, 0, 0 ), /* 439 T_Xleave */
+ S_ST( 'r', 0, 0, 0 ), /* 440 T_Year */
+ S_ST( 't', 3, 442, 0 ), /* 441 lis */
+ S_ST( 'e', 3, 334, 0 ), /* 442 list */
+ S_ST( 'e', 0, 0, 0 ), /* 443 T_Simulate */
+ S_ST( 'y', 0, 0, 0 ), /* 444 T_Beep_Delay */
+ S_ST( 'n', 0, 0, 0 ), /* 445 T_Sim_Duration */
+ S_ST( 't', 0, 0, 0 ), /* 446 T_Server_Offset */
+ S_ST( 'n', 0, 0, 0 ), /* 447 T_Duration */
+ S_ST( 't', 0, 0, 0 ), /* 448 T_Freq_Offset */
+ S_ST( 'r', 0, 0, 0 ), /* 449 T_Wander */
+ S_ST( 'r', 0, 0, 0 ), /* 450 T_Jitter */
+ S_ST( 'y', 0, 0, 0 ), /* 451 T_Prop_Delay */
+ S_ST( 'y', 0, 0, 0 ), /* 452 T_Proc_Delay */
+ S_ST( 'o', 3, 469, 287 ), /* 453 l */
+ S_ST( 'g', 3, 460, 0 ), /* 454 lo */
+ S_ST( 'c', 3, 456, 0 ), /* 455 log */
+ S_ST( 'o', 3, 457, 0 ), /* 456 logc */
+ S_ST( 'n', 3, 458, 0 ), /* 457 logco */
+ S_ST( 'f', 3, 459, 0 ), /* 458 logcon */
+ S_ST( 'i', 3, 335, 0 ), /* 459 logconf */
+ S_ST( 'f', 3, 461, 455 ), /* 460 log */
+ S_ST( 'i', 3, 462, 0 ), /* 461 logf */
+ S_ST( 'l', 3, 336, 0 ), /* 462 logfi */
+ S_ST( 'o', 3, 464, 454 ), /* 463 lo */
+ S_ST( 'p', 3, 465, 0 ), /* 464 loo */
+ S_ST( 's', 3, 466, 0 ), /* 465 loop */
+ S_ST( 't', 3, 467, 0 ), /* 466 loops */
+ S_ST( 'a', 3, 468, 0 ), /* 467 loopst */
+ S_ST( 't', 3, 337, 0 ), /* 468 loopsta */
+ S_ST( 'w', 3, 470, 463 ), /* 469 lo */
+ S_ST( 'p', 3, 471, 0 ), /* 470 low */
+ S_ST( 'r', 3, 472, 0 ), /* 471 lowp */
+ S_ST( 'i', 3, 473, 0 ), /* 472 lowpr */
+ S_ST( 'o', 3, 474, 0 ), /* 473 lowpri */
+ S_ST( 't', 3, 475, 0 ), /* 474 lowprio */
+ S_ST( 'r', 3, 476, 0 ), /* 475 lowpriot */
+ S_ST( 'a', 3, 338, 0 ), /* 476 lowpriotr */
+ S_ST( 'm', 3, 558, 239 ), /* 477 */
+ S_ST( 'a', 3, 496, 0 ), /* 478 m */
+ S_ST( 'n', 3, 480, 0 ), /* 479 ma */
+ S_ST( 'y', 3, 481, 0 ), /* 480 man */
+ S_ST( 'c', 3, 482, 0 ), /* 481 many */
+ S_ST( 'a', 3, 483, 0 ), /* 482 manyc */
+ S_ST( 's', 3, 484, 0 ), /* 483 manyca */
+ S_ST( 't', 3, 490, 0 ), /* 484 manycas */
+ S_ST( 'c', 3, 486, 0 ), /* 485 manycast */
+ S_ST( 'l', 3, 487, 0 ), /* 486 manycastc */
+ S_ST( 'i', 3, 488, 0 ), /* 487 manycastcl */
+ S_ST( 'e', 3, 489, 0 ), /* 488 manycastcli */
+ S_ST( 'n', 3, 339, 0 ), /* 489 manycastclie */
+ S_ST( 's', 3, 491, 485 ), /* 490 manycast */
+ S_ST( 'e', 3, 492, 0 ), /* 491 manycasts */
+ S_ST( 'r', 3, 493, 0 ), /* 492 manycastse */
+ S_ST( 'v', 3, 494, 0 ), /* 493 manycastser */
+ S_ST( 'e', 3, 340, 0 ), /* 494 manycastserv */
+ S_ST( 's', 3, 341, 479 ), /* 495 ma */
+ S_ST( 'x', 3, 511, 495 ), /* 496 ma */
+ S_ST( 'a', 3, 498, 0 ), /* 497 max */
+ S_ST( 'g', 3, 342, 0 ), /* 498 maxa */
+ S_ST( 'c', 3, 500, 497 ), /* 499 max */
+ S_ST( 'l', 3, 501, 0 ), /* 500 maxc */
+ S_ST( 'o', 3, 502, 0 ), /* 501 maxcl */
+ S_ST( 'c', 3, 343, 0 ), /* 502 maxclo */
+ S_ST( 'd', 3, 507, 499 ), /* 503 max */
+ S_ST( 'e', 3, 505, 0 ), /* 504 maxd */
+ S_ST( 'p', 3, 506, 0 ), /* 505 maxde */
+ S_ST( 't', 3, 344, 0 ), /* 506 maxdep */
+ S_ST( 'i', 3, 508, 504 ), /* 507 maxd */
+ S_ST( 's', 3, 345, 0 ), /* 508 maxdi */
+ S_ST( 'm', 3, 510, 503 ), /* 509 max */
+ S_ST( 'e', 3, 346, 0 ), /* 510 maxm */
+ S_ST( 'p', 3, 512, 509 ), /* 511 max */
+ S_ST( 'o', 3, 513, 0 ), /* 512 maxp */
+ S_ST( 'l', 3, 347, 0 ), /* 513 maxpo */
+ S_ST( 'd', 3, 515, 478 ), /* 514 m */
+ S_ST( 'n', 3, 516, 0 ), /* 515 md */
+ S_ST( 's', 3, 517, 0 ), /* 516 mdn */
+ S_ST( 't', 3, 518, 0 ), /* 517 mdns */
+ S_ST( 'r', 3, 519, 0 ), /* 518 mdnst */
+ S_ST( 'i', 3, 520, 0 ), /* 519 mdnstr */
+ S_ST( 'e', 3, 348, 0 ), /* 520 mdnstri */
+ S_ST( 'e', 3, 349, 514 ), /* 521 m */
+ S_ST( 'l', 3, 523, 0 ), /* 522 mem */
+ S_ST( 'o', 3, 524, 0 ), /* 523 meml */
+ S_ST( 'c', 3, 350, 0 ), /* 524 memlo */
+ S_ST( 'i', 3, 526, 521 ), /* 525 m */
+ S_ST( 'n', 3, 543, 0 ), /* 526 mi */
+ S_ST( 'c', 3, 528, 0 ), /* 527 min */
+ S_ST( 'l', 3, 529, 0 ), /* 528 minc */
+ S_ST( 'o', 3, 530, 0 ), /* 529 mincl */
+ S_ST( 'c', 3, 351, 0 ), /* 530 minclo */
+ S_ST( 'd', 3, 535, 527 ), /* 531 min */
+ S_ST( 'e', 3, 533, 0 ), /* 532 mind */
+ S_ST( 'p', 3, 534, 0 ), /* 533 minde */
+ S_ST( 't', 3, 352, 0 ), /* 534 mindep */
+ S_ST( 'i', 3, 536, 532 ), /* 535 mind */
+ S_ST( 's', 3, 353, 0 ), /* 536 mindi */
+ S_ST( 'i', 3, 538, 531 ), /* 537 min */
+ S_ST( 'm', 3, 539, 0 ), /* 538 mini */
+ S_ST( 'u', 3, 354, 0 ), /* 539 minim */
+ S_ST( 'p', 3, 541, 537 ), /* 540 min */
+ S_ST( 'o', 3, 542, 0 ), /* 541 minp */
+ S_ST( 'l', 3, 355, 0 ), /* 542 minpo */
+ S_ST( 's', 3, 544, 540 ), /* 543 min */
+ S_ST( 'a', 3, 545, 0 ), /* 544 mins */
+ S_ST( 'n', 3, 356, 0 ), /* 545 minsa */
+ S_ST( 'o', 3, 548, 525 ), /* 546 m */
+ S_ST( 'd', 3, 357, 0 ), /* 547 mo */
+ S_ST( 'n', 3, 552, 547 ), /* 548 mo */
+ S_ST( 'i', 3, 550, 0 ), /* 549 mon */
+ S_ST( 't', 3, 551, 0 ), /* 550 moni */
+ S_ST( 'o', 3, 359, 0 ), /* 551 monit */
+ S_ST( 't', 3, 360, 549 ), /* 552 mon */
+ S_ST( 'r', 3, 361, 546 ), /* 553 m */
+ S_ST( 's', 3, 555, 553 ), /* 554 m */
+ S_ST( 's', 3, 556, 0 ), /* 555 ms */
+ S_ST( 'n', 3, 557, 0 ), /* 556 mss */
+ S_ST( 't', 3, 329, 0 ), /* 557 mssn */
+ S_ST( 'u', 3, 559, 554 ), /* 558 m */
+ S_ST( 'l', 3, 560, 0 ), /* 559 mu */
+ S_ST( 't', 3, 561, 0 ), /* 560 mul */
+ S_ST( 'i', 3, 562, 0 ), /* 561 mult */
+ S_ST( 'c', 3, 563, 0 ), /* 562 multi */
+ S_ST( 'a', 3, 564, 0 ), /* 563 multic */
+ S_ST( 's', 3, 565, 0 ), /* 564 multica */
+ S_ST( 't', 3, 566, 0 ), /* 565 multicas */
+ S_ST( 'c', 3, 567, 0 ), /* 566 multicast */
+ S_ST( 'l', 3, 568, 0 ), /* 567 multicastc */
+ S_ST( 'i', 3, 569, 0 ), /* 568 multicastcl */
+ S_ST( 'e', 3, 570, 0 ), /* 569 multicastcli */
+ S_ST( 'n', 3, 362, 0 ), /* 570 multicastclie */
+ S_ST( 'n', 3, 614, 477 ), /* 571 */
+ S_ST( 'i', 3, 363, 0 ), /* 572 n */
+ S_ST( 'o', 3, 609, 572 ), /* 573 n */
+ S_ST( 'l', 3, 575, 0 ), /* 574 no */
+ S_ST( 'i', 3, 576, 0 ), /* 575 nol */
+ S_ST( 'n', 3, 364, 0 ), /* 576 noli */
+ S_ST( 'm', 3, 582, 574 ), /* 577 no */
+ S_ST( 'o', 3, 579, 0 ), /* 578 nom */
+ S_ST( 'd', 3, 580, 0 ), /* 579 nomo */
+ S_ST( 'i', 3, 581, 0 ), /* 580 nomod */
+ S_ST( 'f', 3, 365, 0 ), /* 581 nomodi */
+ S_ST( 'r', 3, 583, 578 ), /* 582 nom */
+ S_ST( 'u', 3, 584, 0 ), /* 583 nomr */
+ S_ST( 'l', 3, 585, 0 ), /* 584 nomru */
+ S_ST( 'i', 3, 586, 0 ), /* 585 nomrul */
+ S_ST( 's', 3, 366, 0 ), /* 586 nomruli */
+ S_ST( 'n', 3, 588, 577 ), /* 587 no */
+ S_ST( 'v', 3, 589, 367 ), /* 588 non */
+ S_ST( 'o', 3, 590, 0 ), /* 589 nonv */
+ S_ST( 'l', 3, 591, 0 ), /* 590 nonvo */
+ S_ST( 'a', 3, 592, 0 ), /* 591 nonvol */
+ S_ST( 't', 3, 593, 0 ), /* 592 nonvola */
+ S_ST( 'i', 3, 594, 0 ), /* 593 nonvolat */
+ S_ST( 'l', 3, 368, 0 ), /* 594 nonvolati */
+ S_ST( 'p', 3, 596, 587 ), /* 595 no */
+ S_ST( 'e', 3, 597, 0 ), /* 596 nop */
+ S_ST( 'e', 3, 369, 0 ), /* 597 nope */
+ S_ST( 'q', 3, 599, 595 ), /* 598 no */
+ S_ST( 'u', 3, 600, 0 ), /* 599 noq */
+ S_ST( 'e', 3, 601, 0 ), /* 600 noqu */
+ S_ST( 'r', 3, 370, 0 ), /* 601 noque */
+ S_ST( 's', 3, 603, 598 ), /* 602 no */
+ S_ST( 'e', 3, 607, 0 ), /* 603 nos */
+ S_ST( 'l', 3, 605, 0 ), /* 604 nose */
+ S_ST( 'e', 3, 606, 0 ), /* 605 nosel */
+ S_ST( 'c', 3, 371, 0 ), /* 606 nosele */
+ S_ST( 'r', 3, 608, 604 ), /* 607 nose */
+ S_ST( 'v', 3, 372, 0 ), /* 608 noser */
+ S_ST( 't', 3, 610, 602 ), /* 609 no */
+ S_ST( 'r', 3, 612, 0 ), /* 610 not */
+ S_ST( 'a', 3, 373, 0 ), /* 611 notr */
+ S_ST( 'u', 3, 613, 611 ), /* 612 notr */
+ S_ST( 's', 3, 374, 0 ), /* 613 notru */
+ S_ST( 't', 3, 375, 573 ), /* 614 n */
+ S_ST( 'p', 3, 616, 0 ), /* 615 ntp */
+ S_ST( 'o', 3, 617, 0 ), /* 616 ntpp */
+ S_ST( 'r', 3, 376, 0 ), /* 617 ntppo */
+ S_ST( 's', 3, 619, 615 ), /* 618 ntp */
+ S_ST( 'i', 3, 620, 0 ), /* 619 ntps */
+ S_ST( 'g', 3, 621, 0 ), /* 620 ntpsi */
+ S_ST( 'n', 3, 622, 0 ), /* 621 ntpsig */
+ S_ST( 'd', 3, 623, 0 ), /* 622 ntpsign */
+ S_ST( 's', 3, 624, 0 ), /* 623 ntpsignd */
+ S_ST( 'o', 3, 625, 0 ), /* 624 ntpsignds */
+ S_ST( 'c', 3, 626, 0 ), /* 625 ntpsigndso */
+ S_ST( 'k', 3, 627, 0 ), /* 626 ntpsigndsoc */
+ S_ST( 'e', 3, 377, 0 ), /* 627 ntpsigndsock */
+ S_ST( 'o', 3, 629, 571 ), /* 628 */
+ S_ST( 'r', 3, 630, 0 ), /* 629 o */
+ S_ST( 'p', 3, 631, 0 ), /* 630 or */
+ S_ST( 'h', 3, 632, 0 ), /* 631 orp */
+ S_ST( 'a', 3, 378, 0 ), /* 632 orph */
+ S_ST( 'w', 3, 634, 0 ), /* 633 orphan */
+ S_ST( 'a', 3, 635, 0 ), /* 634 orphanw */
+ S_ST( 'i', 3, 379, 0 ), /* 635 orphanwa */
+ S_ST( 'p', 3, 392, 628 ), /* 636 */
+ S_ST( 'a', 3, 638, 0 ), /* 637 p */
+ S_ST( 'n', 3, 639, 0 ), /* 638 pa */
+ S_ST( 'i', 3, 381, 0 ), /* 639 pan */
+ S_ST( 'e', 3, 641, 637 ), /* 640 p */
+ S_ST( 'e', 3, 382, 0 ), /* 641 pe */
+ S_ST( '_', 3, 643, 0 ), /* 642 peer */
+ S_ST( 'c', 3, 644, 0 ), /* 643 peer_ */
+ S_ST( 'l', 3, 645, 0 ), /* 644 peer_c */
+ S_ST( 'e', 3, 646, 0 ), /* 645 peer_cl */
+ S_ST( 'a', 3, 647, 0 ), /* 646 peer_cle */
+ S_ST( 'r', 3, 648, 0 ), /* 647 peer_clea */
+ S_ST( '_', 3, 649, 0 ), /* 648 peer_clear */
+ S_ST( 'd', 3, 650, 0 ), /* 649 peer_clear_ */
+ S_ST( 'i', 3, 651, 0 ), /* 650 peer_clear_d */
+ S_ST( 'g', 3, 652, 0 ), /* 651 peer_clear_di */
+ S_ST( 'e', 3, 653, 0 ), /* 652 peer_clear_dig */
+ S_ST( 's', 3, 654, 0 ), /* 653 peer_clear_dige */
+ S_ST( 't', 3, 655, 0 ), /* 654 peer_clear_diges */
+ S_ST( '_', 3, 656, 0 ), /* 655 peer_clear_digest */
+ S_ST( 'e', 3, 657, 0 ), /* 656 peer_clear_digest_ */
+ S_ST( 'a', 3, 658, 0 ), /* 657 peer_clear_digest_e */
+ S_ST( 'r', 3, 659, 0 ), /* 658 peer_clear_digest_ea */
+ S_ST( 'l', 3, 380, 0 ), /* 659 peer_clear_digest_ear */
+ S_ST( 's', 3, 661, 642 ), /* 660 peer */
+ S_ST( 't', 3, 662, 0 ), /* 661 peers */
+ S_ST( 'a', 3, 663, 0 ), /* 662 peerst */
+ S_ST( 't', 3, 383, 0 ), /* 663 peersta */
+ S_ST( 'h', 3, 665, 640 ), /* 664 p */
+ S_ST( 'o', 3, 666, 0 ), /* 665 ph */
+ S_ST( 'n', 3, 384, 0 ), /* 666 pho */
+ S_ST( 'i', 3, 385, 664 ), /* 667 p */
+ S_ST( 'f', 3, 669, 0 ), /* 668 pid */
+ S_ST( 'i', 3, 670, 0 ), /* 669 pidf */
+ S_ST( 'l', 3, 386, 0 ), /* 670 pidfi */
+ S_ST( 'o', 3, 673, 667 ), /* 671 p */
+ S_ST( 'o', 3, 387, 0 ), /* 672 po */
+ S_ST( 'r', 3, 388, 672 ), /* 673 po */
+ S_ST( 'r', 3, 681, 671 ), /* 674 p */
+ S_ST( 'e', 3, 679, 0 ), /* 675 pr */
+ S_ST( 'e', 3, 677, 0 ), /* 676 pre */
+ S_ST( 'm', 3, 678, 0 ), /* 677 pree */
+ S_ST( 'p', 3, 389, 0 ), /* 678 preem */
+ S_ST( 'f', 3, 680, 676 ), /* 679 pre */
+ S_ST( 'e', 3, 390, 0 ), /* 680 pref */
+ S_ST( 'o', 3, 694, 675 ), /* 681 pr */
+ S_ST( 'c', 3, 683, 0 ), /* 682 pro */
+ S_ST( '_', 3, 684, 0 ), /* 683 proc */
+ S_ST( 'd', 3, 685, 0 ), /* 684 proc_ */
+ S_ST( 'e', 3, 686, 0 ), /* 685 proc_d */
+ S_ST( 'l', 3, 687, 0 ), /* 686 proc_de */
+ S_ST( 'a', 3, 452, 0 ), /* 687 proc_del */
+ S_ST( 'p', 3, 689, 682 ), /* 688 pro */
+ S_ST( '_', 3, 690, 0 ), /* 689 prop */
+ S_ST( 'd', 3, 691, 0 ), /* 690 prop_ */
+ S_ST( 'e', 3, 692, 0 ), /* 691 prop_d */
+ S_ST( 'l', 3, 693, 0 ), /* 692 prop_de */
+ S_ST( 'a', 3, 451, 0 ), /* 693 prop_del */
+ S_ST( 't', 3, 695, 688 ), /* 694 pro */
+ S_ST( 'o', 3, 696, 0 ), /* 695 prot */
+ S_ST( 's', 3, 697, 0 ), /* 696 proto */
+ S_ST( 't', 3, 698, 0 ), /* 697 protos */
+ S_ST( 'a', 3, 699, 0 ), /* 698 protost */
+ S_ST( 't', 3, 391, 0 ), /* 699 protosta */
+ S_ST( 'r', 3, 731, 636 ), /* 700 */
+ S_ST( 'a', 3, 707, 0 ), /* 701 r */
+ S_ST( 'n', 3, 703, 0 ), /* 702 ra */
+ S_ST( 'd', 3, 704, 0 ), /* 703 ran */
+ S_ST( 'f', 3, 705, 0 ), /* 704 rand */
+ S_ST( 'i', 3, 706, 0 ), /* 705 randf */
+ S_ST( 'l', 3, 393, 0 ), /* 706 randfi */
+ S_ST( 'w', 3, 708, 702 ), /* 707 ra */
+ S_ST( 's', 3, 709, 0 ), /* 708 raw */
+ S_ST( 't', 3, 710, 0 ), /* 709 raws */
+ S_ST( 'a', 3, 711, 0 ), /* 710 rawst */
+ S_ST( 't', 3, 394, 0 ), /* 711 rawsta */
+ S_ST( 'e', 3, 728, 701 ), /* 712 r */
+ S_ST( 'f', 3, 714, 0 ), /* 713 re */
+ S_ST( 'i', 3, 395, 0 ), /* 714 ref */
+ S_ST( 'q', 3, 716, 713 ), /* 715 re */
+ S_ST( 'u', 3, 717, 0 ), /* 716 req */
+ S_ST( 'e', 3, 718, 0 ), /* 717 requ */
+ S_ST( 's', 3, 719, 0 ), /* 718 reque */
+ S_ST( 't', 3, 720, 0 ), /* 719 reques */
+ S_ST( 'k', 3, 721, 0 ), /* 720 request */
+ S_ST( 'e', 3, 396, 0 ), /* 721 requestk */
+ S_ST( 's', 3, 724, 715 ), /* 722 re */
+ S_ST( 'e', 3, 397, 0 ), /* 723 res */
+ S_ST( 't', 3, 725, 723 ), /* 724 res */
+ S_ST( 'r', 3, 726, 0 ), /* 725 rest */
+ S_ST( 'i', 3, 727, 0 ), /* 726 restr */
+ S_ST( 'c', 3, 398, 0 ), /* 727 restri */
+ S_ST( 'v', 3, 729, 722 ), /* 728 re */
+ S_ST( 'o', 3, 730, 0 ), /* 729 rev */
+ S_ST( 'k', 3, 399, 0 ), /* 730 revo */
+ S_ST( 'l', 3, 732, 712 ), /* 731 r */
+ S_ST( 'i', 3, 733, 0 ), /* 732 rl */
+ S_ST( 'm', 3, 734, 0 ), /* 733 rli */
+ S_ST( 'i', 3, 400, 0 ), /* 734 rlim */
+ S_ST( 's', 3, 808, 700 ), /* 735 */
+ S_ST( 'a', 3, 737, 0 ), /* 736 s */
+ S_ST( 'v', 3, 738, 0 ), /* 737 sa */
+ S_ST( 'e', 3, 739, 0 ), /* 738 sav */
+ S_ST( 'c', 3, 740, 0 ), /* 739 save */
+ S_ST( 'o', 3, 741, 0 ), /* 740 savec */
+ S_ST( 'n', 3, 742, 0 ), /* 741 saveco */
+ S_ST( 'f', 3, 743, 0 ), /* 742 savecon */
+ S_ST( 'i', 3, 744, 0 ), /* 743 saveconf */
+ S_ST( 'g', 3, 745, 0 ), /* 744 saveconfi */
+ S_ST( 'd', 3, 746, 0 ), /* 745 saveconfig */
+ S_ST( 'i', 3, 401, 0 ), /* 746 saveconfigd */
+ S_ST( 'e', 3, 757, 736 ), /* 747 s */
+ S_ST( 'r', 3, 749, 0 ), /* 748 se */
+ S_ST( 'v', 3, 750, 0 ), /* 749 ser */
+ S_ST( 'e', 3, 402, 0 ), /* 750 serv */
+ S_ST( '_', 3, 752, 0 ), /* 751 server */
+ S_ST( 'o', 3, 753, 0 ), /* 752 server_ */
+ S_ST( 'f', 3, 754, 0 ), /* 753 server_o */
+ S_ST( 'f', 3, 755, 0 ), /* 754 server_of */
+ S_ST( 's', 3, 756, 0 ), /* 755 server_off */
+ S_ST( 'e', 3, 446, 0 ), /* 756 server_offs */
+ S_ST( 't', 3, 758, 748 ), /* 757 se */
+ S_ST( 'v', 3, 759, 0 ), /* 758 set */
+ S_ST( 'a', 3, 403, 0 ), /* 759 setv */
+ S_ST( 'i', 3, 761, 747 ), /* 760 s */
+ S_ST( 'm', 3, 762, 0 ), /* 761 si */
+ S_ST( 'u', 3, 763, 0 ), /* 762 sim */
+ S_ST( 'l', 3, 764, 0 ), /* 763 simu */
+ S_ST( 'a', 3, 765, 0 ), /* 764 simul */
+ S_ST( 't', 3, 766, 0 ), /* 765 simula */
+ S_ST( 'i', 3, 767, 443 ), /* 766 simulat */
+ S_ST( 'o', 3, 768, 0 ), /* 767 simulati */
+ S_ST( 'n', 3, 769, 0 ), /* 768 simulatio */
+ S_ST( '_', 3, 770, 0 ), /* 769 simulation */
+ S_ST( 'd', 3, 771, 0 ), /* 770 simulation_ */
+ S_ST( 'u', 3, 772, 0 ), /* 771 simulation_d */
+ S_ST( 'r', 3, 773, 0 ), /* 772 simulation_du */
+ S_ST( 'a', 3, 774, 0 ), /* 773 simulation_dur */
+ S_ST( 't', 3, 775, 0 ), /* 774 simulation_dura */
+ S_ST( 'i', 3, 776, 0 ), /* 775 simulation_durat */
+ S_ST( 'o', 3, 445, 0 ), /* 776 simulation_durati */
+ S_ST( 'o', 3, 778, 760 ), /* 777 s */
+ S_ST( 'u', 3, 779, 0 ), /* 778 so */
+ S_ST( 'r', 3, 780, 0 ), /* 779 sou */
+ S_ST( 'c', 3, 404, 0 ), /* 780 sour */
+ S_ST( 't', 3, 804, 777 ), /* 781 s */
+ S_ST( 'a', 3, 788, 0 ), /* 782 st */
+ S_ST( 'c', 3, 784, 0 ), /* 783 sta */
+ S_ST( 'k', 3, 785, 0 ), /* 784 stac */
+ S_ST( 's', 3, 786, 0 ), /* 785 stack */
+ S_ST( 'i', 3, 787, 0 ), /* 786 stacks */
+ S_ST( 'z', 3, 405, 0 ), /* 787 stacksi */
+ S_ST( 't', 3, 407, 783 ), /* 788 sta */
+ S_ST( 'i', 3, 790, 0 ), /* 789 stat */
+ S_ST( 's', 3, 791, 0 ), /* 790 stati */
+ S_ST( 't', 3, 792, 0 ), /* 791 statis */
+ S_ST( 'i', 3, 793, 0 ), /* 792 statist */
+ S_ST( 'c', 3, 406, 0 ), /* 793 statisti */
+ S_ST( 'd', 3, 795, 0 ), /* 794 stats */
+ S_ST( 'i', 3, 408, 0 ), /* 795 statsd */
+ S_ST( 'e', 3, 409, 782 ), /* 796 st */
+ S_ST( 'b', 3, 798, 0 ), /* 797 step */
+ S_ST( 'a', 3, 799, 0 ), /* 798 stepb */
+ S_ST( 'c', 3, 410, 0 ), /* 799 stepba */
+ S_ST( 'f', 3, 801, 797 ), /* 800 step */
+ S_ST( 'w', 3, 411, 0 ), /* 801 stepf */
+ S_ST( 'o', 3, 803, 800 ), /* 802 step */
+ S_ST( 'u', 3, 412, 0 ), /* 803 stepo */
+ S_ST( 'r', 3, 805, 796 ), /* 804 st */
+ S_ST( 'a', 3, 806, 0 ), /* 805 str */
+ S_ST( 't', 3, 807, 0 ), /* 806 stra */
+ S_ST( 'u', 3, 413, 0 ), /* 807 strat */
+ S_ST( 'y', 3, 415, 781 ), /* 808 s */
+ S_ST( 's', 3, 810, 0 ), /* 809 sys */
+ S_ST( 't', 3, 811, 0 ), /* 810 syss */
+ S_ST( 'a', 3, 812, 0 ), /* 811 sysst */
+ S_ST( 't', 3, 416, 0 ), /* 812 syssta */
+ S_ST( 't', 3, 839, 735 ), /* 813 */
+ S_ST( 'i', 3, 825, 0 ), /* 814 t */
+ S_ST( 'c', 3, 417, 0 ), /* 815 ti */
+ S_ST( 'm', 3, 818, 815 ), /* 816 ti */
+ S_ST( 'e', 3, 420, 0 ), /* 817 tim */
+ S_ST( 'i', 3, 819, 817 ), /* 818 tim */
+ S_ST( 'n', 3, 820, 0 ), /* 819 timi */
+ S_ST( 'g', 3, 821, 0 ), /* 820 timin */
+ S_ST( 's', 3, 822, 0 ), /* 821 timing */
+ S_ST( 't', 3, 823, 0 ), /* 822 timings */
+ S_ST( 'a', 3, 824, 0 ), /* 823 timingst */
+ S_ST( 't', 3, 421, 0 ), /* 824 timingsta */
+ S_ST( 'n', 3, 826, 816 ), /* 825 ti */
+ S_ST( 'k', 3, 827, 0 ), /* 826 tin */
+ S_ST( 'e', 3, 422, 0 ), /* 827 tink */
+ S_ST( 'o', 3, 423, 814 ), /* 828 t */
+ S_ST( 'r', 3, 831, 828 ), /* 829 t */
+ S_ST( 'a', 3, 424, 0 ), /* 830 tr */
+ S_ST( 'u', 3, 832, 830 ), /* 831 tr */
+ S_ST( 's', 3, 833, 425 ), /* 832 tru */
+ S_ST( 't', 3, 834, 0 ), /* 833 trus */
+ S_ST( 'e', 3, 835, 0 ), /* 834 trust */
+ S_ST( 'd', 3, 836, 0 ), /* 835 truste */
+ S_ST( 'k', 3, 837, 0 ), /* 836 trusted */
+ S_ST( 'e', 3, 426, 0 ), /* 837 trustedk */
+ S_ST( 't', 3, 427, 829 ), /* 838 t */
+ S_ST( 'y', 3, 840, 838 ), /* 839 t */
+ S_ST( 'p', 3, 428, 0 ), /* 840 ty */
+ S_ST( 'u', 3, 842, 813 ), /* 841 */
+ S_ST( 'n', 3, 848, 0 ), /* 842 u */
+ S_ST( 'c', 3, 844, 0 ), /* 843 un */
+ S_ST( 'o', 3, 845, 0 ), /* 844 unc */
+ S_ST( 'n', 3, 846, 0 ), /* 845 unco */
+ S_ST( 'f', 3, 847, 0 ), /* 846 uncon */
+ S_ST( 'i', 3, 433, 0 ), /* 847 unconf */
+ S_ST( 'p', 3, 849, 843 ), /* 848 un */
+ S_ST( 'e', 3, 850, 0 ), /* 849 unp */
+ S_ST( 'e', 3, 434, 0 ), /* 850 unpe */
+ S_ST( '_', 3, 871, 0 ), /* 851 unpeer */
+ S_ST( 'c', 3, 853, 0 ), /* 852 unpeer_ */
+ S_ST( 'r', 3, 854, 0 ), /* 853 unpeer_c */
+ S_ST( 'y', 3, 855, 0 ), /* 854 unpeer_cr */
+ S_ST( 'p', 3, 856, 0 ), /* 855 unpeer_cry */
+ S_ST( 't', 3, 857, 0 ), /* 856 unpeer_cryp */
+ S_ST( 'o', 3, 858, 0 ), /* 857 unpeer_crypt */
+ S_ST( '_', 3, 863, 0 ), /* 858 unpeer_crypto */
+ S_ST( 'e', 3, 860, 0 ), /* 859 unpeer_crypto_ */
+ S_ST( 'a', 3, 861, 0 ), /* 860 unpeer_crypto_e */
+ S_ST( 'r', 3, 862, 0 ), /* 861 unpeer_crypto_ea */
+ S_ST( 'l', 3, 430, 0 ), /* 862 unpeer_crypto_ear */
+ S_ST( 'n', 3, 864, 859 ), /* 863 unpeer_crypto_ */
+ S_ST( 'a', 3, 865, 0 ), /* 864 unpeer_crypto_n */
+ S_ST( 'k', 3, 866, 0 ), /* 865 unpeer_crypto_na */
+ S_ST( '_', 3, 867, 0 ), /* 866 unpeer_crypto_nak */
+ S_ST( 'e', 3, 868, 0 ), /* 867 unpeer_crypto_nak_ */
+ S_ST( 'a', 3, 869, 0 ), /* 868 unpeer_crypto_nak_e */
+ S_ST( 'r', 3, 870, 0 ), /* 869 unpeer_crypto_nak_ea */
+ S_ST( 'l', 3, 431, 0 ), /* 870 unpeer_crypto_nak_ear */
+ S_ST( 'd', 3, 872, 852 ), /* 871 unpeer_ */
+ S_ST( 'i', 3, 873, 0 ), /* 872 unpeer_d */
+ S_ST( 'g', 3, 874, 0 ), /* 873 unpeer_di */
+ S_ST( 'e', 3, 875, 0 ), /* 874 unpeer_dig */
+ S_ST( 's', 3, 876, 0 ), /* 875 unpeer_dige */
+ S_ST( 't', 3, 877, 0 ), /* 876 unpeer_diges */
+ S_ST( '_', 3, 878, 0 ), /* 877 unpeer_digest */
+ S_ST( 'e', 3, 879, 0 ), /* 878 unpeer_digest_ */
+ S_ST( 'a', 3, 880, 0 ), /* 879 unpeer_digest_e */
+ S_ST( 'r', 3, 881, 0 ), /* 880 unpeer_digest_ea */
+ S_ST( 'l', 3, 432, 0 ), /* 881 unpeer_digest_ear */
+ S_ST( 'v', 3, 883, 841 ), /* 882 */
+ S_ST( 'e', 3, 884, 0 ), /* 883 v */
+ S_ST( 'r', 3, 885, 0 ), /* 884 ve */
+ S_ST( 's', 3, 886, 0 ), /* 885 ver */
+ S_ST( 'i', 3, 887, 0 ), /* 886 vers */
+ S_ST( 'o', 3, 435, 0 ), /* 887 versi */
+ S_ST( 'w', 3, 895, 882 ), /* 888 */
+ S_ST( 'a', 3, 890, 0 ), /* 889 w */
+ S_ST( 'n', 3, 891, 0 ), /* 890 wa */
+ S_ST( 'd', 3, 892, 0 ), /* 891 wan */
+ S_ST( 'e', 3, 449, 0 ), /* 892 wand */
+ S_ST( 'e', 3, 894, 889 ), /* 893 w */
+ S_ST( 'e', 3, 437, 0 ), /* 894 we */
+ S_ST( 'i', 3, 896, 893 ), /* 895 w */
+ S_ST( 'l', 3, 897, 0 ), /* 896 wi */
+ S_ST( 'd', 3, 898, 0 ), /* 897 wil */
+ S_ST( 'c', 3, 899, 0 ), /* 898 wild */
+ S_ST( 'a', 3, 900, 0 ), /* 899 wildc */
+ S_ST( 'r', 3, 438, 0 ), /* 900 wildca */
+ S_ST( 'x', 3, 902, 888 ), /* 901 */
+ S_ST( 'l', 3, 903, 0 ), /* 902 x */
+ S_ST( 'e', 3, 904, 0 ), /* 903 xl */
+ S_ST( 'a', 3, 905, 0 ), /* 904 xle */
+ S_ST( 'v', 3, 439, 0 ), /* 905 xlea */
+ S_ST( 'y', 3, 907, 901 ), /* 906 [initial state] */
+ S_ST( 'e', 3, 908, 0 ), /* 907 y */
+ S_ST( 'a', 3, 440, 0 ) /* 908 ye */
};
diff --git a/contrib/ntp/ntpd/ntp_parser.c b/contrib/ntp/ntpd/ntp_parser.c
index 3159669..c432694 100644
--- a/contrib/ntp/ntpd/ntp_parser.c
+++ b/contrib/ntp/ntpd/ntp_parser.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.7.12-4996"
+#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -62,8 +62,7 @@
/* Copy the first part of user declarations. */
-/* Line 371 of yacc.c */
-#line 11 "../../ntpd/ntp_parser.y"
+#line 11 "../../ntpd/ntp_parser.y" /* yacc.c:339 */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -97,14 +96,13 @@
# define ONLY_SIM(a) NULL
#endif
-/* Line 371 of yacc.c */
-#line 102 "ntp_parser.c"
+#line 100 "../../ntpd/ntp_parser.c" /* yacc.c:339 */
-# ifndef YY_NULL
+# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULL nullptr
+# define YY_NULLPTR nullptr
# else
-# define YY_NULL 0
+# define YY_NULLPTR 0
# endif
# endif
@@ -118,9 +116,9 @@
/* In a future release of Bison, this section will be replaced
by #include "y.tab.h". */
-#ifndef YY_YY_NTP_PARSER_H_INCLUDED
-# define YY_YY_NTP_PARSER_H_INCLUDED
-/* Enabling traces. */
+#ifndef YY_YY_Y_TAB_H_INCLUDED
+# define YY_YY_Y_TAB_H_INCLUDED
+/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
@@ -128,207 +126,207 @@
extern int yydebug;
#endif
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- T_Abbrev = 258,
- T_Age = 259,
- T_All = 260,
- T_Allan = 261,
- T_Allpeers = 262,
- T_Auth = 263,
- T_Autokey = 264,
- T_Automax = 265,
- T_Average = 266,
- T_Bclient = 267,
- T_Beacon = 268,
- T_Broadcast = 269,
- T_Broadcastclient = 270,
- T_Broadcastdelay = 271,
- T_Burst = 272,
- T_Calibrate = 273,
- T_Ceiling = 274,
- T_Clockstats = 275,
- T_Cohort = 276,
- T_ControlKey = 277,
- T_Crypto = 278,
- T_Cryptostats = 279,
- T_Ctl = 280,
- T_Day = 281,
- T_Default = 282,
- T_Digest = 283,
- T_Disable = 284,
- T_Discard = 285,
- T_Dispersion = 286,
- T_Double = 287,
- T_Driftfile = 288,
- T_Drop = 289,
- T_Dscp = 290,
- T_Ellipsis = 291,
- T_Enable = 292,
- T_End = 293,
- T_False = 294,
- T_File = 295,
- T_Filegen = 296,
- T_Filenum = 297,
- T_Flag1 = 298,
- T_Flag2 = 299,
- T_Flag3 = 300,
- T_Flag4 = 301,
- T_Flake = 302,
- T_Floor = 303,
- T_Freq = 304,
- T_Fudge = 305,
- T_Host = 306,
- T_Huffpuff = 307,
- T_Iburst = 308,
- T_Ident = 309,
- T_Ignore = 310,
- T_Incalloc = 311,
- T_Incmem = 312,
- T_Initalloc = 313,
- T_Initmem = 314,
- T_Includefile = 315,
- T_Integer = 316,
- T_Interface = 317,
- T_Intrange = 318,
- T_Io = 319,
- T_Ipv4 = 320,
- T_Ipv4_flag = 321,
- T_Ipv6 = 322,
- T_Ipv6_flag = 323,
- T_Kernel = 324,
- T_Key = 325,
- T_Keys = 326,
- T_Keysdir = 327,
- T_Kod = 328,
- T_Mssntp = 329,
- T_Leapfile = 330,
- T_Leapsmearinterval = 331,
- T_Limited = 332,
- T_Link = 333,
- T_Listen = 334,
- T_Logconfig = 335,
- T_Logfile = 336,
- T_Loopstats = 337,
- T_Lowpriotrap = 338,
- T_Manycastclient = 339,
- T_Manycastserver = 340,
- T_Mask = 341,
- T_Maxage = 342,
- T_Maxclock = 343,
- T_Maxdepth = 344,
- T_Maxdist = 345,
- T_Maxmem = 346,
- T_Maxpoll = 347,
- T_Mdnstries = 348,
- T_Mem = 349,
- T_Memlock = 350,
- T_Minclock = 351,
- T_Mindepth = 352,
- T_Mindist = 353,
- T_Minimum = 354,
- T_Minpoll = 355,
- T_Minsane = 356,
- T_Mode = 357,
- T_Mode7 = 358,
- T_Monitor = 359,
- T_Month = 360,
- T_Mru = 361,
- T_Multicastclient = 362,
- T_Nic = 363,
- T_Nolink = 364,
- T_Nomodify = 365,
- T_Nomrulist = 366,
- T_None = 367,
- T_Nonvolatile = 368,
- T_Nopeer = 369,
- T_Noquery = 370,
- T_Noselect = 371,
- T_Noserve = 372,
- T_Notrap = 373,
- T_Notrust = 374,
- T_Ntp = 375,
- T_Ntpport = 376,
- T_NtpSignDsocket = 377,
- T_Orphan = 378,
- T_Orphanwait = 379,
- T_Panic = 380,
- T_Peer = 381,
- T_Peerstats = 382,
- T_Phone = 383,
- T_Pid = 384,
- T_Pidfile = 385,
- T_Pool = 386,
- T_Port = 387,
- T_Preempt = 388,
- T_Prefer = 389,
- T_Protostats = 390,
- T_Pw = 391,
- T_Randfile = 392,
- T_Rawstats = 393,
- T_Refid = 394,
- T_Requestkey = 395,
- T_Reset = 396,
- T_Restrict = 397,
- T_Revoke = 398,
- T_Rlimit = 399,
- T_Saveconfigdir = 400,
- T_Server = 401,
- T_Setvar = 402,
- T_Source = 403,
- T_Stacksize = 404,
- T_Statistics = 405,
- T_Stats = 406,
- T_Statsdir = 407,
- T_Step = 408,
- T_Stepback = 409,
- T_Stepfwd = 410,
- T_Stepout = 411,
- T_Stratum = 412,
- T_String = 413,
- T_Sys = 414,
- T_Sysstats = 415,
- T_Tick = 416,
- T_Time1 = 417,
- T_Time2 = 418,
- T_Timer = 419,
- T_Timingstats = 420,
- T_Tinker = 421,
- T_Tos = 422,
- T_Trap = 423,
- T_True = 424,
- T_Trustedkey = 425,
- T_Ttl = 426,
- T_Type = 427,
- T_U_int = 428,
- T_UEcrypto = 429,
- T_UEcryptonak = 430,
- T_UEdigest = 431,
- T_Unconfig = 432,
- T_Unpeer = 433,
- T_Version = 434,
- T_WanderThreshold = 435,
- T_Week = 436,
- T_Wildcard = 437,
- T_Xleave = 438,
- T_Year = 439,
- T_Flag = 440,
- T_EOC = 441,
- T_Simulate = 442,
- T_Beep_Delay = 443,
- T_Sim_Duration = 444,
- T_Server_Offset = 445,
- T_Duration = 446,
- T_Freq_Offset = 447,
- T_Wander = 448,
- T_Jitter = 449,
- T_Prop_Delay = 450,
- T_Proc_Delay = 451
- };
+ enum yytokentype
+ {
+ T_Abbrev = 258,
+ T_Age = 259,
+ T_All = 260,
+ T_Allan = 261,
+ T_Allpeers = 262,
+ T_Auth = 263,
+ T_Autokey = 264,
+ T_Automax = 265,
+ T_Average = 266,
+ T_Bclient = 267,
+ T_Beacon = 268,
+ T_Broadcast = 269,
+ T_Broadcastclient = 270,
+ T_Broadcastdelay = 271,
+ T_Burst = 272,
+ T_Calibrate = 273,
+ T_Ceiling = 274,
+ T_Clockstats = 275,
+ T_Cohort = 276,
+ T_ControlKey = 277,
+ T_Crypto = 278,
+ T_Cryptostats = 279,
+ T_Ctl = 280,
+ T_Day = 281,
+ T_Default = 282,
+ T_Digest = 283,
+ T_Disable = 284,
+ T_Discard = 285,
+ T_Dispersion = 286,
+ T_Double = 287,
+ T_Driftfile = 288,
+ T_Drop = 289,
+ T_Dscp = 290,
+ T_Ellipsis = 291,
+ T_Enable = 292,
+ T_End = 293,
+ T_False = 294,
+ T_File = 295,
+ T_Filegen = 296,
+ T_Filenum = 297,
+ T_Flag1 = 298,
+ T_Flag2 = 299,
+ T_Flag3 = 300,
+ T_Flag4 = 301,
+ T_Flake = 302,
+ T_Floor = 303,
+ T_Freq = 304,
+ T_Fudge = 305,
+ T_Host = 306,
+ T_Huffpuff = 307,
+ T_Iburst = 308,
+ T_Ident = 309,
+ T_Ignore = 310,
+ T_Incalloc = 311,
+ T_Incmem = 312,
+ T_Initalloc = 313,
+ T_Initmem = 314,
+ T_Includefile = 315,
+ T_Integer = 316,
+ T_Interface = 317,
+ T_Intrange = 318,
+ T_Io = 319,
+ T_Ipv4 = 320,
+ T_Ipv4_flag = 321,
+ T_Ipv6 = 322,
+ T_Ipv6_flag = 323,
+ T_Kernel = 324,
+ T_Key = 325,
+ T_Keys = 326,
+ T_Keysdir = 327,
+ T_Kod = 328,
+ T_Mssntp = 329,
+ T_Leapfile = 330,
+ T_Leapsmearinterval = 331,
+ T_Limited = 332,
+ T_Link = 333,
+ T_Listen = 334,
+ T_Logconfig = 335,
+ T_Logfile = 336,
+ T_Loopstats = 337,
+ T_Lowpriotrap = 338,
+ T_Manycastclient = 339,
+ T_Manycastserver = 340,
+ T_Mask = 341,
+ T_Maxage = 342,
+ T_Maxclock = 343,
+ T_Maxdepth = 344,
+ T_Maxdist = 345,
+ T_Maxmem = 346,
+ T_Maxpoll = 347,
+ T_Mdnstries = 348,
+ T_Mem = 349,
+ T_Memlock = 350,
+ T_Minclock = 351,
+ T_Mindepth = 352,
+ T_Mindist = 353,
+ T_Minimum = 354,
+ T_Minpoll = 355,
+ T_Minsane = 356,
+ T_Mode = 357,
+ T_Mode7 = 358,
+ T_Monitor = 359,
+ T_Month = 360,
+ T_Mru = 361,
+ T_Multicastclient = 362,
+ T_Nic = 363,
+ T_Nolink = 364,
+ T_Nomodify = 365,
+ T_Nomrulist = 366,
+ T_None = 367,
+ T_Nonvolatile = 368,
+ T_Nopeer = 369,
+ T_Noquery = 370,
+ T_Noselect = 371,
+ T_Noserve = 372,
+ T_Notrap = 373,
+ T_Notrust = 374,
+ T_Ntp = 375,
+ T_Ntpport = 376,
+ T_NtpSignDsocket = 377,
+ T_Orphan = 378,
+ T_Orphanwait = 379,
+ T_PCEdigest = 380,
+ T_Panic = 381,
+ T_Peer = 382,
+ T_Peerstats = 383,
+ T_Phone = 384,
+ T_Pid = 385,
+ T_Pidfile = 386,
+ T_Pool = 387,
+ T_Port = 388,
+ T_Preempt = 389,
+ T_Prefer = 390,
+ T_Protostats = 391,
+ T_Pw = 392,
+ T_Randfile = 393,
+ T_Rawstats = 394,
+ T_Refid = 395,
+ T_Requestkey = 396,
+ T_Reset = 397,
+ T_Restrict = 398,
+ T_Revoke = 399,
+ T_Rlimit = 400,
+ T_Saveconfigdir = 401,
+ T_Server = 402,
+ T_Setvar = 403,
+ T_Source = 404,
+ T_Stacksize = 405,
+ T_Statistics = 406,
+ T_Stats = 407,
+ T_Statsdir = 408,
+ T_Step = 409,
+ T_Stepback = 410,
+ T_Stepfwd = 411,
+ T_Stepout = 412,
+ T_Stratum = 413,
+ T_String = 414,
+ T_Sys = 415,
+ T_Sysstats = 416,
+ T_Tick = 417,
+ T_Time1 = 418,
+ T_Time2 = 419,
+ T_Timer = 420,
+ T_Timingstats = 421,
+ T_Tinker = 422,
+ T_Tos = 423,
+ T_Trap = 424,
+ T_True = 425,
+ T_Trustedkey = 426,
+ T_Ttl = 427,
+ T_Type = 428,
+ T_U_int = 429,
+ T_UEcrypto = 430,
+ T_UEcryptonak = 431,
+ T_UEdigest = 432,
+ T_Unconfig = 433,
+ T_Unpeer = 434,
+ T_Version = 435,
+ T_WanderThreshold = 436,
+ T_Week = 437,
+ T_Wildcard = 438,
+ T_Xleave = 439,
+ T_Year = 440,
+ T_Flag = 441,
+ T_EOC = 442,
+ T_Simulate = 443,
+ T_Beep_Delay = 444,
+ T_Sim_Duration = 445,
+ T_Server_Offset = 446,
+ T_Duration = 447,
+ T_Freq_Offset = 448,
+ T_Wander = 449,
+ T_Jitter = 450,
+ T_Prop_Delay = 451,
+ T_Proc_Delay = 452
+ };
#endif
/* Tokens. */
#define T_Abbrev 258
@@ -453,86 +451,86 @@ extern int yydebug;
#define T_NtpSignDsocket 377
#define T_Orphan 378
#define T_Orphanwait 379
-#define T_Panic 380
-#define T_Peer 381
-#define T_Peerstats 382
-#define T_Phone 383
-#define T_Pid 384
-#define T_Pidfile 385
-#define T_Pool 386
-#define T_Port 387
-#define T_Preempt 388
-#define T_Prefer 389
-#define T_Protostats 390
-#define T_Pw 391
-#define T_Randfile 392
-#define T_Rawstats 393
-#define T_Refid 394
-#define T_Requestkey 395
-#define T_Reset 396
-#define T_Restrict 397
-#define T_Revoke 398
-#define T_Rlimit 399
-#define T_Saveconfigdir 400
-#define T_Server 401
-#define T_Setvar 402
-#define T_Source 403
-#define T_Stacksize 404
-#define T_Statistics 405
-#define T_Stats 406
-#define T_Statsdir 407
-#define T_Step 408
-#define T_Stepback 409
-#define T_Stepfwd 410
-#define T_Stepout 411
-#define T_Stratum 412
-#define T_String 413
-#define T_Sys 414
-#define T_Sysstats 415
-#define T_Tick 416
-#define T_Time1 417
-#define T_Time2 418
-#define T_Timer 419
-#define T_Timingstats 420
-#define T_Tinker 421
-#define T_Tos 422
-#define T_Trap 423
-#define T_True 424
-#define T_Trustedkey 425
-#define T_Ttl 426
-#define T_Type 427
-#define T_U_int 428
-#define T_UEcrypto 429
-#define T_UEcryptonak 430
-#define T_UEdigest 431
-#define T_Unconfig 432
-#define T_Unpeer 433
-#define T_Version 434
-#define T_WanderThreshold 435
-#define T_Week 436
-#define T_Wildcard 437
-#define T_Xleave 438
-#define T_Year 439
-#define T_Flag 440
-#define T_EOC 441
-#define T_Simulate 442
-#define T_Beep_Delay 443
-#define T_Sim_Duration 444
-#define T_Server_Offset 445
-#define T_Duration 446
-#define T_Freq_Offset 447
-#define T_Wander 448
-#define T_Jitter 449
-#define T_Prop_Delay 450
-#define T_Proc_Delay 451
-
-
-
+#define T_PCEdigest 380
+#define T_Panic 381
+#define T_Peer 382
+#define T_Peerstats 383
+#define T_Phone 384
+#define T_Pid 385
+#define T_Pidfile 386
+#define T_Pool 387
+#define T_Port 388
+#define T_Preempt 389
+#define T_Prefer 390
+#define T_Protostats 391
+#define T_Pw 392
+#define T_Randfile 393
+#define T_Rawstats 394
+#define T_Refid 395
+#define T_Requestkey 396
+#define T_Reset 397
+#define T_Restrict 398
+#define T_Revoke 399
+#define T_Rlimit 400
+#define T_Saveconfigdir 401
+#define T_Server 402
+#define T_Setvar 403
+#define T_Source 404
+#define T_Stacksize 405
+#define T_Statistics 406
+#define T_Stats 407
+#define T_Statsdir 408
+#define T_Step 409
+#define T_Stepback 410
+#define T_Stepfwd 411
+#define T_Stepout 412
+#define T_Stratum 413
+#define T_String 414
+#define T_Sys 415
+#define T_Sysstats 416
+#define T_Tick 417
+#define T_Time1 418
+#define T_Time2 419
+#define T_Timer 420
+#define T_Timingstats 421
+#define T_Tinker 422
+#define T_Tos 423
+#define T_Trap 424
+#define T_True 425
+#define T_Trustedkey 426
+#define T_Ttl 427
+#define T_Type 428
+#define T_U_int 429
+#define T_UEcrypto 430
+#define T_UEcryptonak 431
+#define T_UEdigest 432
+#define T_Unconfig 433
+#define T_Unpeer 434
+#define T_Version 435
+#define T_WanderThreshold 436
+#define T_Week 437
+#define T_Wildcard 438
+#define T_Xleave 439
+#define T_Year 440
+#define T_Flag 441
+#define T_EOC 442
+#define T_Simulate 443
+#define T_Beep_Delay 444
+#define T_Sim_Duration 445
+#define T_Server_Offset 446
+#define T_Duration 447
+#define T_Freq_Offset 448
+#define T_Wander 449
+#define T_Jitter 450
+#define T_Prop_Delay 451
+#define T_Proc_Delay 452
+
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+
+union YYSTYPE
{
-/* Line 387 of yacc.c */
-#line 51 "../../ntpd/ntp_parser.y"
+#line 51 "../../ntpd/ntp_parser.y" /* yacc.c:355 */
char * String;
double Double;
@@ -551,37 +549,24 @@ typedef union YYSTYPE
script_info * Sim_script;
script_info_fifo * Sim_script_fifo;
+#line 553 "../../ntpd/ntp_parser.c" /* yacc.c:355 */
+};
-/* Line 387 of yacc.c */
-#line 557 "ntp_parser.c"
-} YYSTYPE;
+typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+
extern YYSTYPE yylval;
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-#endif /* !YY_YY_NTP_PARSER_H_INCLUDED */
+#endif /* !YY_YY_Y_TAB_H_INCLUDED */
/* Copy the second part of user declarations. */
-/* Line 390 of yacc.c */
-#line 585 "ntp_parser.c"
+#line 570 "../../ntpd/ntp_parser.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -595,11 +580,8 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -619,8 +601,7 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -642,11 +623,30 @@ typedef short int yytype_int16;
# endif
#endif
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if (! defined __GNUC__ || __GNUC__ < 2 \
- || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
-# define __attribute__(Spec) /* empty */
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
@@ -657,25 +657,26 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -693,8 +694,7 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
@@ -706,8 +706,8 @@ YYID (yyi)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -723,7 +723,7 @@ YYID (yyi)
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -731,15 +731,13 @@ YYID (yyi)
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -749,7 +747,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -774,16 +772,16 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
@@ -802,48 +800,50 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (YYID (0))
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 213
+#define YYFINAL 214
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 624
+#define YYLAST 655
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 202
+#define YYNTOKENS 203
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 105
/* YYNRULES -- Number of rules. */
-#define YYNRULES 316
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 422
+#define YYNRULES 317
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 423
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 451
+#define YYMAXUTOK 452
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 198, 199, 2, 2, 2, 2, 2, 2, 2, 2,
+ 199, 200, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 197, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 198, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 200, 2, 201, 2, 2, 2, 2,
+ 2, 2, 2, 201, 2, 202, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -876,165 +876,45 @@ static const yytype_uint8 yytranslate[] =
165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
- 195, 196
+ 195, 196, 197
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 5, 9, 12, 15, 16, 18, 20,
- 22, 24, 26, 28, 30, 32, 34, 36, 38, 40,
- 42, 46, 48, 50, 52, 54, 56, 58, 61, 63,
- 65, 67, 68, 71, 73, 75, 77, 79, 81, 83,
- 85, 87, 89, 91, 93, 95, 98, 101, 103, 105,
- 107, 109, 111, 113, 116, 118, 121, 123, 125, 127,
- 130, 133, 136, 139, 142, 145, 148, 151, 154, 157,
- 160, 163, 164, 167, 170, 173, 175, 177, 179, 181,
- 183, 186, 189, 191, 194, 197, 200, 202, 204, 206,
- 208, 210, 212, 214, 216, 218, 220, 223, 226, 230,
- 233, 235, 237, 239, 241, 243, 245, 247, 249, 251,
- 252, 255, 258, 261, 263, 265, 267, 269, 271, 273,
- 275, 277, 279, 281, 283, 285, 287, 290, 293, 297,
- 303, 307, 312, 317, 321, 322, 325, 327, 329, 331,
- 333, 335, 337, 339, 341, 343, 345, 347, 349, 351,
- 353, 355, 358, 360, 363, 365, 367, 369, 372, 374,
- 377, 379, 381, 383, 385, 387, 389, 391, 393, 397,
- 400, 402, 405, 408, 411, 414, 417, 419, 421, 423,
- 425, 427, 429, 432, 435, 437, 440, 442, 444, 446,
- 449, 452, 455, 457, 459, 461, 463, 465, 467, 469,
- 471, 473, 475, 477, 479, 481, 483, 486, 489, 491,
- 494, 496, 498, 500, 502, 504, 506, 508, 510, 512,
- 514, 516, 518, 521, 524, 527, 530, 534, 536, 539,
- 542, 545, 548, 552, 555, 557, 559, 561, 563, 565,
- 567, 569, 571, 573, 575, 577, 580, 581, 586, 588,
- 589, 590, 593, 596, 599, 602, 604, 606, 610, 614,
- 616, 618, 620, 622, 624, 626, 628, 630, 632, 635,
- 638, 640, 642, 644, 646, 648, 650, 652, 654, 657,
- 659, 662, 664, 666, 668, 674, 677, 679, 682, 684,
- 686, 688, 690, 692, 694, 700, 702, 706, 709, 713,
- 715, 717, 720, 722, 728, 733, 737, 740, 742, 749,
- 753, 756, 760, 762, 764, 766, 768
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int16 yyrhs[] =
-{
- 203, 0, -1, 204, -1, 204, 205, 186, -1, 205,
- 186, -1, 1, 186, -1, -1, 206, -1, 219, -1,
- 221, -1, 222, -1, 231, -1, 239, -1, 226, -1,
- 248, -1, 253, -1, 257, -1, 262, -1, 266, -1,
- 293, -1, 207, 208, 211, -1, 146, -1, 131, -1,
- 126, -1, 14, -1, 84, -1, 209, -1, 210, 158,
- -1, 158, -1, 66, -1, 68, -1, -1, 211, 212,
- -1, 213, -1, 215, -1, 217, -1, 214, -1, 9,
- -1, 17, -1, 53, -1, 116, -1, 133, -1, 134,
- -1, 169, -1, 183, -1, 216, 61, -1, 216, 173,
- -1, 70, -1, 100, -1, 92, -1, 171, -1, 102,
- -1, 179, -1, 218, 158, -1, 54, -1, 220, 208,
- -1, 177, -1, 178, -1, 15, -1, 85, 290, -1,
- 107, 290, -1, 93, 61, -1, 10, 61, -1, 22,
- 61, -1, 23, 223, -1, 71, 158, -1, 72, 158,
- -1, 140, 61, -1, 143, 61, -1, 170, 286, -1,
- 122, 158, -1, -1, 223, 224, -1, 225, 158, -1,
- 143, 61, -1, 51, -1, 54, -1, 136, -1, 137,
- -1, 28, -1, 167, 227, -1, 227, 228, -1, 228,
- -1, 229, 61, -1, 230, 292, -1, 21, 291, -1,
- 19, -1, 48, -1, 123, -1, 124, -1, 101, -1,
- 13, -1, 98, -1, 90, -1, 96, -1, 88, -1,
- 150, 232, -1, 152, 158, -1, 41, 233, 234, -1,
- 232, 233, -1, 233, -1, 20, -1, 24, -1, 82,
- -1, 127, -1, 138, -1, 160, -1, 165, -1, 135,
- -1, -1, 234, 235, -1, 40, 158, -1, 172, 238,
- -1, 236, -1, 237, -1, 78, -1, 109, -1, 37,
- -1, 29, -1, 112, -1, 129, -1, 26, -1, 181,
- -1, 105, -1, 184, -1, 4, -1, 30, 242, -1,
- 106, 245, -1, 142, 208, 240, -1, 142, 209, 86,
- 209, 240, -1, 142, 27, 240, -1, 142, 66, 27,
- 240, -1, 142, 68, 27, 240, -1, 142, 148, 240,
- -1, -1, 240, 241, -1, 47, -1, 55, -1, 73,
- -1, 74, -1, 77, -1, 83, -1, 110, -1, 111,
- -1, 114, -1, 115, -1, 117, -1, 118, -1, 119,
- -1, 121, -1, 179, -1, 242, 243, -1, 243, -1,
- 244, 61, -1, 11, -1, 99, -1, 104, -1, 245,
- 246, -1, 246, -1, 247, 61, -1, 56, -1, 57,
- -1, 58, -1, 59, -1, 87, -1, 89, -1, 91,
- -1, 97, -1, 50, 208, 249, -1, 249, 250, -1,
- 250, -1, 251, 292, -1, 252, 291, -1, 157, 61,
- -1, 3, 158, -1, 139, 158, -1, 162, -1, 163,
- -1, 43, -1, 44, -1, 45, -1, 46, -1, 144,
- 254, -1, 254, 255, -1, 255, -1, 256, 61, -1,
- 95, -1, 149, -1, 42, -1, 37, 258, -1, 29,
- 258, -1, 258, 259, -1, 259, -1, 260, -1, 261,
- -1, 8, -1, 12, -1, 18, -1, 69, -1, 104,
- -1, 120, -1, 103, -1, 151, -1, 174, -1, 175,
- -1, 176, -1, 166, 263, -1, 263, 264, -1, 264,
- -1, 265, 292, -1, 6, -1, 31, -1, 49, -1,
- 52, -1, 125, -1, 153, -1, 154, -1, 155, -1,
- 156, -1, 161, -1, 278, -1, 282, -1, 267, 292,
- -1, 268, 61, -1, 269, 158, -1, 270, 158, -1,
- 60, 158, 205, -1, 38, -1, 33, 271, -1, 80,
- 276, -1, 128, 289, -1, 147, 272, -1, 168, 209,
- 274, -1, 171, 285, -1, 16, -1, 113, -1, 161,
- -1, 35, -1, 76, -1, 54, -1, 75, -1, 81,
- -1, 130, -1, 145, -1, 158, -1, 158, 32, -1,
- -1, 158, 197, 158, 273, -1, 27, -1, -1, -1,
- 274, 275, -1, 132, 61, -1, 62, 209, -1, 276,
- 277, -1, 277, -1, 158, -1, 279, 281, 280, -1,
- 279, 281, 158, -1, 62, -1, 108, -1, 5, -1,
- 65, -1, 67, -1, 182, -1, 79, -1, 55, -1,
- 34, -1, 141, 283, -1, 283, 284, -1, 284, -1,
- 7, -1, 8, -1, 25, -1, 64, -1, 94, -1,
- 159, -1, 164, -1, 285, 61, -1, 61, -1, 286,
- 287, -1, 287, -1, 61, -1, 288, -1, 198, 61,
- 36, 61, 199, -1, 289, 158, -1, 158, -1, 290,
- 208, -1, 208, -1, 61, -1, 169, -1, 39, -1,
- 61, -1, 32, -1, 294, 200, 295, 298, 201, -1,
- 187, -1, 295, 296, 186, -1, 296, 186, -1, 297,
- 197, 292, -1, 188, -1, 189, -1, 298, 299, -1,
- 299, -1, 301, 200, 300, 302, 201, -1, 190, 197,
- 292, 186, -1, 146, 197, 208, -1, 302, 303, -1,
- 303, -1, 191, 197, 292, 200, 304, 201, -1, 304,
- 305, 186, -1, 305, 186, -1, 306, 197, 292, -1,
- 192, -1, 193, -1, 194, -1, 195, -1, 196, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 369, 369, 373, 374, 375, 390, 391, 392, 393,
- 394, 395, 396, 397, 398, 399, 400, 401, 402, 403,
- 411, 421, 422, 423, 424, 425, 429, 430, 435, 440,
- 442, 448, 449, 457, 458, 459, 463, 468, 469, 470,
- 471, 472, 473, 474, 475, 479, 481, 486, 487, 488,
- 489, 490, 491, 495, 500, 509, 519, 520, 530, 532,
- 534, 536, 547, 554, 556, 561, 563, 565, 567, 569,
- 578, 584, 585, 593, 595, 607, 608, 609, 610, 611,
- 620, 625, 630, 638, 640, 642, 647, 648, 649, 650,
- 651, 652, 656, 657, 658, 659, 668, 670, 679, 689,
- 694, 702, 703, 704, 705, 706, 707, 708, 709, 714,
- 715, 723, 733, 742, 757, 762, 763, 767, 768, 772,
- 773, 774, 775, 776, 777, 778, 787, 791, 795, 803,
- 811, 819, 834, 849, 862, 863, 871, 872, 873, 874,
- 875, 876, 877, 878, 879, 880, 881, 882, 883, 884,
- 885, 889, 894, 902, 907, 908, 909, 913, 918, 926,
- 931, 932, 933, 934, 935, 936, 937, 938, 946, 956,
- 961, 969, 971, 973, 982, 984, 989, 990, 994, 995,
- 996, 997, 1005, 1010, 1015, 1023, 1028, 1029, 1030, 1039,
- 1041, 1046, 1051, 1059, 1061, 1078, 1079, 1080, 1081, 1082,
- 1083, 1087, 1088, 1089, 1090, 1091, 1099, 1104, 1109, 1117,
- 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131,
- 1140, 1141, 1142, 1149, 1156, 1163, 1179, 1198, 1200, 1202,
- 1204, 1206, 1208, 1215, 1220, 1221, 1222, 1226, 1230, 1239,
- 1240, 1244, 1245, 1246, 1250, 1261, 1275, 1287, 1292, 1294,
- 1299, 1300, 1308, 1310, 1318, 1323, 1331, 1356, 1363, 1373,
- 1374, 1378, 1379, 1380, 1381, 1385, 1386, 1387, 1391, 1396,
- 1401, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1425, 1430,
- 1438, 1443, 1451, 1453, 1457, 1462, 1467, 1475, 1480, 1488,
- 1497, 1498, 1502, 1503, 1512, 1530, 1534, 1539, 1547, 1552,
- 1553, 1557, 1562, 1570, 1575, 1580, 1585, 1590, 1598, 1603,
- 1608, 1616, 1621, 1622, 1623, 1624, 1625
+ 0, 370, 370, 374, 375, 376, 391, 392, 393, 394,
+ 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
+ 412, 422, 423, 424, 425, 426, 430, 431, 436, 441,
+ 443, 449, 450, 458, 459, 460, 464, 469, 470, 471,
+ 472, 473, 474, 475, 476, 480, 482, 487, 488, 489,
+ 490, 491, 492, 496, 501, 510, 520, 521, 531, 533,
+ 535, 537, 548, 555, 557, 562, 564, 566, 568, 570,
+ 579, 585, 586, 594, 596, 608, 609, 610, 611, 612,
+ 621, 626, 631, 639, 641, 643, 648, 649, 650, 651,
+ 652, 653, 657, 658, 659, 660, 669, 671, 680, 690,
+ 695, 703, 704, 705, 706, 707, 708, 709, 710, 715,
+ 716, 724, 734, 743, 758, 763, 764, 768, 769, 773,
+ 774, 775, 776, 777, 778, 779, 788, 792, 796, 804,
+ 812, 820, 835, 850, 863, 864, 872, 873, 874, 875,
+ 876, 877, 878, 879, 880, 881, 882, 883, 884, 885,
+ 886, 890, 895, 903, 908, 909, 910, 914, 919, 927,
+ 932, 933, 934, 935, 936, 937, 938, 939, 947, 957,
+ 962, 970, 972, 974, 983, 985, 990, 991, 995, 996,
+ 997, 998, 1006, 1011, 1016, 1024, 1029, 1030, 1031, 1040,
+ 1042, 1047, 1052, 1060, 1062, 1079, 1080, 1081, 1082, 1083,
+ 1084, 1088, 1089, 1090, 1091, 1092, 1093, 1101, 1106, 1111,
+ 1119, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132,
+ 1133, 1142, 1143, 1144, 1151, 1158, 1165, 1181, 1200, 1202,
+ 1204, 1206, 1208, 1210, 1217, 1222, 1223, 1224, 1228, 1232,
+ 1241, 1242, 1246, 1247, 1248, 1252, 1263, 1277, 1289, 1294,
+ 1296, 1301, 1302, 1310, 1312, 1320, 1325, 1333, 1358, 1365,
+ 1375, 1376, 1380, 1381, 1382, 1383, 1387, 1388, 1389, 1393,
+ 1398, 1403, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1427,
+ 1432, 1440, 1445, 1453, 1455, 1459, 1464, 1469, 1477, 1482,
+ 1490, 1499, 1500, 1504, 1505, 1514, 1532, 1536, 1541, 1549,
+ 1554, 1555, 1559, 1564, 1572, 1577, 1582, 1587, 1592, 1600,
+ 1605, 1610, 1618, 1623, 1624, 1625, 1626, 1627
};
#endif
@@ -1066,9 +946,9 @@ static const char *const yytname[] =
"T_Mru", "T_Multicastclient", "T_Nic", "T_Nolink", "T_Nomodify",
"T_Nomrulist", "T_None", "T_Nonvolatile", "T_Nopeer", "T_Noquery",
"T_Noselect", "T_Noserve", "T_Notrap", "T_Notrust", "T_Ntp", "T_Ntpport",
- "T_NtpSignDsocket", "T_Orphan", "T_Orphanwait", "T_Panic", "T_Peer",
- "T_Peerstats", "T_Phone", "T_Pid", "T_Pidfile", "T_Pool", "T_Port",
- "T_Preempt", "T_Prefer", "T_Protostats", "T_Pw", "T_Randfile",
+ "T_NtpSignDsocket", "T_Orphan", "T_Orphanwait", "T_PCEdigest", "T_Panic",
+ "T_Peer", "T_Peerstats", "T_Phone", "T_Pid", "T_Pidfile", "T_Pool",
+ "T_Port", "T_Preempt", "T_Prefer", "T_Protostats", "T_Pw", "T_Randfile",
"T_Rawstats", "T_Refid", "T_Requestkey", "T_Reset", "T_Restrict",
"T_Revoke", "T_Rlimit", "T_Saveconfigdir", "T_Server", "T_Setvar",
"T_Source", "T_Stacksize", "T_Statistics", "T_Stats", "T_Statsdir",
@@ -1112,13 +992,13 @@ static const char *const yytname[] =
"sim_init_statement_list", "sim_init_statement", "sim_init_keyword",
"sim_server_list", "sim_server", "sim_server_offset", "sim_server_name",
"sim_act_list", "sim_act", "sim_act_stmt_list", "sim_act_stmt",
- "sim_act_keyword", YY_NULL
+ "sim_act_keyword", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -1140,434 +1020,428 @@ static const yytype_uint16 yytoknum[] =
415, 416, 417, 418, 419, 420, 421, 422, 423, 424,
425, 426, 427, 428, 429, 430, 431, 432, 433, 434,
435, 436, 437, 438, 439, 440, 441, 442, 443, 444,
- 445, 446, 447, 448, 449, 450, 451, 61, 40, 41,
- 123, 125
+ 445, 446, 447, 448, 449, 450, 451, 452, 61, 40,
+ 41, 123, 125
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint16 yyr1[] =
-{
- 0, 202, 203, 204, 204, 204, 205, 205, 205, 205,
- 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
- 206, 207, 207, 207, 207, 207, 208, 208, 209, 210,
- 210, 211, 211, 212, 212, 212, 213, 214, 214, 214,
- 214, 214, 214, 214, 214, 215, 215, 216, 216, 216,
- 216, 216, 216, 217, 218, 219, 220, 220, 221, 221,
- 221, 221, 222, 222, 222, 222, 222, 222, 222, 222,
- 222, 223, 223, 224, 224, 225, 225, 225, 225, 225,
- 226, 227, 227, 228, 228, 228, 229, 229, 229, 229,
- 229, 229, 230, 230, 230, 230, 231, 231, 231, 232,
- 232, 233, 233, 233, 233, 233, 233, 233, 233, 234,
- 234, 235, 235, 235, 235, 236, 236, 237, 237, 238,
- 238, 238, 238, 238, 238, 238, 239, 239, 239, 239,
- 239, 239, 239, 239, 240, 240, 241, 241, 241, 241,
- 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
- 241, 242, 242, 243, 244, 244, 244, 245, 245, 246,
- 247, 247, 247, 247, 247, 247, 247, 247, 248, 249,
- 249, 250, 250, 250, 250, 250, 251, 251, 252, 252,
- 252, 252, 253, 254, 254, 255, 256, 256, 256, 257,
- 257, 258, 258, 259, 259, 260, 260, 260, 260, 260,
- 260, 261, 261, 261, 261, 261, 262, 263, 263, 264,
- 265, 265, 265, 265, 265, 265, 265, 265, 265, 265,
- 266, 266, 266, 266, 266, 266, 266, 266, 266, 266,
- 266, 266, 266, 266, 267, 267, 267, 268, 268, 269,
- 269, 270, 270, 270, 271, 271, 271, 272, 273, 273,
- 274, 274, 275, 275, 276, 276, 277, 278, 278, 279,
- 279, 280, 280, 280, 280, 281, 281, 281, 282, 283,
- 283, 284, 284, 284, 284, 284, 284, 284, 285, 285,
- 286, 286, 287, 287, 288, 289, 289, 290, 290, 291,
- 291, 291, 292, 292, 293, 294, 295, 295, 296, 297,
- 297, 298, 298, 299, 300, 301, 302, 302, 303, 304,
- 304, 305, 306, 306, 306, 306, 306
-};
+#define YYPACT_NINF -189
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-189)))
+
+#define YYTABLE_NINF -7
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] =
{
- 0, 2, 1, 3, 2, 2, 0, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 3, 1, 1, 1, 1, 1, 1, 2, 1, 1,
- 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 2, 1, 1, 1,
- 1, 1, 1, 2, 1, 2, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 0, 2, 2, 2, 1, 1, 1, 1, 1,
- 2, 2, 1, 2, 2, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 2, 3, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 2, 3, 5,
- 3, 4, 4, 3, 0, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 2, 1, 1, 1, 2, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
- 1, 2, 2, 2, 2, 2, 1, 1, 1, 1,
- 1, 1, 2, 2, 1, 2, 1, 1, 1, 2,
- 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 2, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 2, 2, 2, 3, 1, 2, 2,
- 2, 2, 3, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 0, 4, 1, 0,
- 0, 2, 2, 2, 2, 1, 1, 3, 3, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
- 2, 1, 1, 1, 5, 2, 1, 2, 1, 1,
- 1, 1, 1, 1, 5, 1, 3, 2, 3, 1,
- 1, 2, 1, 5, 4, 3, 2, 1, 6, 3,
- 2, 3, 1, 1, 1, 1, 1
+ 20, -174, -32, -189, -189, -189, -29, -189, 315, 3,
+ -133, -189, 315, -189, 119, -48, -189, -126, -189, -118,
+ -115, -189, -189, -113, -189, -189, -48, -5, 374, -48,
+ -189, -189, -105, -189, -100, -189, -189, 1, 81, 46,
+ 2, -31, -189, -189, -90, 119, -88, -189, 148, 380,
+ -81, -53, 23, -189, -189, -189, 87, 207, -106, -189,
+ -48, -189, -48, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, -9, 29, -62, -61, -189, -7, -189,
+ -189, -102, -189, -189, -189, 32, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, 315, -189,
+ -189, -189, -189, -189, -189, 3, -189, 42, 78, -189,
+ 315, -189, -189, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, 112, -189, -39, 367, -189, -189, -189,
+ -113, -189, -189, -48, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, 374, -189, 60, -48, -189, -189, -34,
+ -189, -189, -189, -189, -189, -189, -189, -189, 81, -189,
+ -189, 97, 102, -189, -189, 44, -189, -189, -189, -189,
+ -31, -189, 71, -63, -189, 119, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, 148, -189,
+ -9, -189, -189, -36, -189, -189, -189, -189, -189, -189,
+ -189, -189, 380, -189, 75, -9, -189, -189, 76, -53,
+ -189, -189, -189, 77, -189, -43, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, 0, -150,
+ -189, -189, -189, -189, -189, 89, -189, -6, -189, -189,
+ -189, -189, 39, 13, -189, -189, -189, -189, 15, 99,
+ -189, -189, 112, -189, -9, -36, -189, -189, -189, -189,
+ -189, -189, -189, -189, 475, -189, -189, 475, 475, -81,
+ -189, -189, 18, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, -58, 144, -189, -189, -189, 353, -189,
+ -189, -189, -189, -189, -189, -189, -189, -96, -3, -13,
+ -189, -189, -189, -189, 27, -189, -189, 11, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, 475, 475, -189, 163, -81, 133, -189,
+ 141, -189, -189, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,
+ -52, -189, 45, 5, 19, -125, -189, 8, -189, -9,
+ -189, -189, -189, -189, -189, -189, -189, -189, -189, 475,
+ -189, -189, -189, -189, 14, -189, -189, -189, -48, -189,
+ -189, -189, 22, -189, -189, -189, 21, 24, -9, 36,
+ -164, -189, 33, -9, -189, -189, -189, 10, 69, -189,
+ -189, -189, -189, -189, 31, 48, 40, -189, 52, -189,
+ -9, -189, -189
};
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint16 yydefact[] =
{
- 0, 0, 0, 24, 58, 234, 0, 71, 0, 0,
- 246, 237, 0, 227, 0, 0, 239, 0, 259, 0,
- 0, 240, 238, 0, 241, 25, 0, 0, 0, 0,
- 260, 235, 0, 23, 0, 242, 22, 0, 0, 0,
- 0, 0, 243, 21, 0, 0, 0, 236, 0, 0,
- 0, 0, 0, 56, 57, 295, 0, 2, 0, 7,
+ 0, 0, 0, 24, 58, 235, 0, 71, 0, 0,
+ 247, 238, 0, 228, 0, 0, 240, 0, 260, 0,
+ 0, 241, 239, 0, 242, 25, 0, 0, 0, 0,
+ 261, 236, 0, 23, 0, 243, 22, 0, 0, 0,
+ 0, 0, 244, 21, 0, 0, 0, 237, 0, 0,
+ 0, 0, 0, 56, 57, 296, 0, 2, 0, 7,
0, 8, 0, 9, 10, 13, 11, 12, 14, 15,
- 16, 17, 18, 0, 0, 0, 0, 220, 0, 221,
+ 16, 17, 18, 0, 0, 0, 0, 221, 0, 222,
19, 0, 5, 62, 63, 64, 195, 196, 197, 198,
- 201, 199, 200, 202, 203, 204, 205, 190, 192, 193,
- 194, 154, 155, 156, 126, 152, 0, 244, 228, 189,
- 101, 102, 103, 104, 108, 105, 106, 107, 109, 29,
- 30, 28, 0, 26, 0, 6, 65, 66, 256, 229,
- 255, 288, 59, 61, 160, 161, 162, 163, 164, 165,
- 166, 167, 127, 158, 0, 60, 70, 286, 230, 67,
- 271, 272, 273, 274, 275, 276, 277, 268, 270, 134,
- 29, 30, 134, 134, 26, 68, 188, 186, 187, 182,
- 184, 0, 0, 231, 96, 100, 97, 210, 211, 212,
- 213, 214, 215, 216, 217, 218, 219, 206, 208, 0,
- 91, 86, 0, 87, 95, 93, 94, 92, 90, 88,
- 89, 80, 82, 0, 0, 250, 282, 0, 69, 281,
- 283, 279, 233, 1, 0, 4, 31, 55, 293, 292,
- 222, 223, 224, 225, 267, 266, 265, 0, 0, 79,
- 75, 76, 77, 78, 0, 72, 0, 191, 151, 153,
- 245, 98, 0, 178, 179, 180, 181, 0, 0, 176,
- 177, 168, 170, 0, 0, 27, 226, 254, 287, 157,
- 159, 285, 269, 130, 134, 134, 133, 128, 0, 183,
- 185, 0, 99, 207, 209, 291, 289, 290, 85, 81,
- 83, 84, 232, 0, 280, 278, 3, 20, 261, 262,
- 263, 258, 264, 257, 299, 300, 0, 0, 0, 74,
- 73, 118, 117, 0, 115, 116, 0, 110, 113, 114,
- 174, 175, 173, 169, 171, 172, 136, 137, 138, 139,
- 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 135, 131, 132, 134, 249, 0, 0, 251, 0,
- 37, 38, 39, 54, 47, 49, 48, 51, 40, 41,
- 42, 43, 50, 52, 44, 32, 33, 36, 34, 0,
- 35, 0, 0, 0, 0, 302, 0, 297, 0, 111,
- 125, 121, 123, 119, 120, 122, 124, 112, 129, 248,
- 247, 253, 252, 0, 45, 46, 53, 0, 296, 294,
- 301, 0, 298, 284, 305, 0, 0, 0, 0, 0,
- 307, 0, 0, 303, 306, 304, 0, 0, 312, 313,
- 314, 315, 316, 0, 0, 0, 308, 0, 310, 0,
- 309, 311
+ 201, 199, 200, 202, 203, 204, 205, 206, 190, 192,
+ 193, 194, 154, 155, 156, 126, 152, 0, 245, 229,
+ 189, 101, 102, 103, 104, 108, 105, 106, 107, 109,
+ 29, 30, 28, 0, 26, 0, 6, 65, 66, 257,
+ 230, 256, 289, 59, 61, 160, 161, 162, 163, 164,
+ 165, 166, 167, 127, 158, 0, 60, 70, 287, 231,
+ 67, 272, 273, 274, 275, 276, 277, 278, 269, 271,
+ 134, 29, 30, 134, 134, 26, 68, 188, 186, 187,
+ 182, 184, 0, 0, 232, 96, 100, 97, 211, 212,
+ 213, 214, 215, 216, 217, 218, 219, 220, 207, 209,
+ 0, 91, 86, 0, 87, 95, 93, 94, 92, 90,
+ 88, 89, 80, 82, 0, 0, 251, 283, 0, 69,
+ 282, 284, 280, 234, 1, 0, 4, 31, 55, 294,
+ 293, 223, 224, 225, 226, 268, 267, 266, 0, 0,
+ 79, 75, 76, 77, 78, 0, 72, 0, 191, 151,
+ 153, 246, 98, 0, 178, 179, 180, 181, 0, 0,
+ 176, 177, 168, 170, 0, 0, 27, 227, 255, 288,
+ 157, 159, 286, 270, 130, 134, 134, 133, 128, 0,
+ 183, 185, 0, 99, 208, 210, 292, 290, 291, 85,
+ 81, 83, 84, 233, 0, 281, 279, 3, 20, 262,
+ 263, 264, 259, 265, 258, 300, 301, 0, 0, 0,
+ 74, 73, 118, 117, 0, 115, 116, 0, 110, 113,
+ 114, 174, 175, 173, 169, 171, 172, 136, 137, 138,
+ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 150, 135, 131, 132, 134, 250, 0, 0, 252,
+ 0, 37, 38, 39, 54, 47, 49, 48, 51, 40,
+ 41, 42, 43, 50, 52, 44, 32, 33, 36, 34,
+ 0, 35, 0, 0, 0, 0, 303, 0, 298, 0,
+ 111, 125, 121, 123, 119, 120, 122, 124, 112, 129,
+ 249, 248, 254, 253, 0, 45, 46, 53, 0, 297,
+ 295, 302, 0, 299, 285, 306, 0, 0, 0, 0,
+ 0, 308, 0, 0, 304, 307, 305, 0, 0, 313,
+ 314, 315, 316, 317, 0, 0, 0, 309, 0, 311,
+ 0, 310, 312
};
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 56, 57, 58, 59, 60, 131, 123, 124, 287,
- 355, 356, 357, 358, 359, 360, 361, 61, 62, 63,
- 64, 85, 235, 236, 65, 201, 202, 203, 204, 66,
- 174, 118, 241, 307, 308, 309, 377, 67, 263, 331,
- 104, 105, 106, 142, 143, 144, 68, 251, 252, 253,
- 254, 69, 169, 170, 171, 70, 97, 98, 99, 100,
- 71, 187, 188, 189, 72, 73, 74, 75, 76, 108,
- 173, 380, 282, 338, 129, 130, 77, 78, 293, 227,
- 79, 157, 158, 212, 208, 209, 210, 148, 132, 278,
- 220, 80, 81, 296, 297, 298, 364, 365, 396, 366,
- 399, 400, 413, 414, 415
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -188
-static const yytype_int16 yypact[] =
+ /* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
{
- 5, -160, -28, -188, -188, -188, -24, -188, 60, 0,
- -119, -188, 60, -188, 118, 7, -188, -117, -188, -110,
- -108, -188, -188, -101, -188, -188, 7, -1, 345, 7,
- -188, -188, -96, -188, -95, -188, -188, 21, -3, 73,
- 33, 11, -188, -188, -94, 118, -61, -188, 43, 446,
- -57, -58, 41, -188, -188, -188, 105, 179, -79, -188,
- 7, -188, 7, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, -188, -7, 48, -48, -39, -188, 24, -188,
- -188, -86, -188, -188, -188, 42, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, 60, -188, -188,
- -188, -188, -188, -188, 0, -188, 59, 89, -188, 60,
- -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, 80, -188, 9, 338, -188, -188, -188, -101,
- -188, -188, 7, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, 345, -188, 67, 7, -188, -188, 12, -188,
- -188, -188, -188, -188, -188, -188, -188, -3, -188, -188,
- 107, 116, -188, -188, 83, -188, -188, -188, -188, 11,
- -188, 113, -20, -188, 118, -188, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, 43, -188, -7,
- -188, -188, -25, -188, -188, -188, -188, -188, -188, -188,
- -188, 446, -188, 127, -7, -188, -188, 129, -58, -188,
- -188, -188, 142, -188, 19, -188, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, 4, -158, -188,
- -188, -188, -188, -188, 145, -188, 49, -188, -188, -188,
- -188, 233, 55, -188, -188, -188, -188, 64, 157, -188,
- -188, 80, -188, -7, -25, -188, -188, -188, -188, -188,
- -188, -188, -188, 445, -188, -188, 445, 445, -57, -188,
- -188, 82, -188, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, -44, 202, -188, -188, -188, 324, -188, -188,
- -188, -188, -188, -188, -188, -188, -30, 58, 50, -188,
- -188, -188, -188, 88, -188, -188, 3, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, 445, 445, -188, 221, -57, 188, -188, 191,
- -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, -188, -188, -51,
- -188, 99, 61, 75, -114, -188, 65, -188, -7, -188,
- -188, -188, -188, -188, -188, -188, -188, -188, 445, -188,
- -188, -188, -188, 68, -188, -188, -188, 7, -188, -188,
- -188, 76, -188, -188, -188, 71, 78, -7, 74, -178,
- -188, 90, -7, -188, -188, -188, 77, 32, -188, -188,
- -188, -188, -188, 101, 93, 84, -188, 94, -188, -7,
- -188, -188
+ -189, -189, -189, -41, -189, -189, -15, -38, -189, -189,
+ -189, -189, -189, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, -189, 16, -189, -189, -189,
+ -189, -35, -189, -189, -189, -189, -189, -189, -157, -189,
+ -189, 138, -189, -189, 106, -189, -189, -189, -2, -189,
+ -189, -189, -189, 83, -189, -189, 239, -79, -189, -189,
+ -189, -189, 66, -189, -189, -189, -189, -189, -189, -189,
+ -189, -189, -189, -189, -189, 126, -189, -189, -189, -189,
+ -189, -189, 101, -189, -189, 51, -189, -189, 242, 17,
+ -188, -189, -189, -189, -24, -189, -189, -97, -189, -189,
+ -189, -123, -189, -130, -189
};
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
{
- -188, -188, -188, -41, -188, -188, -15, -38, -188, -188,
- -188, -188, -188, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, -188, 81, -188, -188, -188,
- -188, -37, -188, -188, -188, -188, -188, -188, -111, -188,
- -188, 170, -188, -188, 133, -188, -188, -188, 37, -188,
- -188, -188, -188, 115, -188, -188, 277, -53, -188, -188,
- -188, -188, 103, -188, -188, -188, -188, -188, -188, -188,
- -188, -188, -188, -188, -188, 162, -188, -188, -188, -188,
- -188, -188, 143, -188, -188, 91, -188, -188, 274, 52,
- -187, -188, -188, -188, 8, -188, -188, -56, -188, -188,
- -188, -87, -188, -100, -188
+ -1, 56, 57, 58, 59, 60, 132, 124, 125, 288,
+ 356, 357, 358, 359, 360, 361, 362, 61, 62, 63,
+ 64, 85, 236, 237, 65, 202, 203, 204, 205, 66,
+ 175, 119, 242, 308, 309, 310, 378, 67, 264, 332,
+ 105, 106, 107, 143, 144, 145, 68, 252, 253, 254,
+ 255, 69, 170, 171, 172, 70, 98, 99, 100, 101,
+ 71, 188, 189, 190, 72, 73, 74, 75, 76, 109,
+ 174, 381, 283, 339, 130, 131, 77, 78, 294, 228,
+ 79, 158, 159, 213, 209, 210, 211, 149, 133, 279,
+ 221, 80, 81, 297, 298, 299, 365, 366, 397, 367,
+ 400, 401, 414, 415, 416
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -7
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
- 122, 164, 274, 206, 150, 151, 1, 370, 175, 288,
- 384, 101, 205, 398, 275, 2, 214, 281, 336, 3,
- 4, 5, 152, 403, 163, 218, 82, 6, 7, 371,
- 294, 295, 362, 83, 8, 9, 276, 84, 10, 107,
- 11, 125, 12, 13, 237, 216, 14, 217, 126, 177,
- 127, 266, 267, 166, 219, 15, 237, 128, 224, 16,
- 133, 153, 146, 147, 172, 17, 314, 18, 86, 289,
- 229, 290, 87, 119, 178, 120, 19, 20, 88, 225,
- 21, 22, 149, 242, 256, 23, 24, 389, 337, 25,
- 26, 154, 179, 230, 165, 180, 231, 176, 27, 102,
- 159, 121, 211, 226, 103, 213, 167, 215, 372, 221,
- 222, 28, 29, 30, 228, 373, 362, 258, 31, 223,
- 239, 240, 385, 243, 244, 245, 246, 32, 260, 89,
- 258, 33, 374, 34, 264, 35, 36, 272, 110, 160,
- 207, 161, 111, 265, 277, 37, 38, 39, 40, 41,
- 42, 43, 44, 332, 333, 45, 155, 46, 294, 295,
- 168, 156, 291, 90, 91, 121, 47, 255, 181, 268,
- 261, 48, 49, 50, 270, 51, 52, 271, 232, 233,
- 92, 392, 53, 54, 375, 234, 292, 376, 280, 2,
- 283, -6, 55, 3, 4, 5, 182, 183, 184, 185,
- 112, 6, 7, 285, 186, 286, 299, 300, 8, 9,
- 401, 93, 10, 310, 11, 406, 12, 13, 312, 247,
- 14, 162, 311, 378, 408, 409, 410, 411, 412, 15,
- 334, 121, 421, 16, 94, 95, 96, 248, 339, 17,
- 335, 18, 249, 250, 367, 113, 369, 368, 379, 382,
- 19, 20, 383, 114, 21, 22, 115, 386, 387, 23,
- 24, 388, 301, 25, 26, 391, 395, 393, 397, 398,
- 302, 402, 27, 303, 238, 259, 405, 407, 116, 418,
- 420, 419, 279, 117, 269, 28, 29, 30, 313, 109,
- 273, 257, 31, 408, 409, 410, 411, 412, 381, 284,
- 262, 32, 416, 145, 363, 33, 315, 34, 390, 35,
- 36, 304, 404, 417, 0, 0, 0, 0, 0, 37,
- 38, 39, 40, 41, 42, 43, 44, 0, 0, 45,
- 0, 46, 0, 340, 0, 0, 0, 0, 0, 0,
- 47, 341, 305, 0, 0, 48, 49, 50, 2, 51,
- 52, 0, 3, 4, 5, 0, 53, 54, 0, 0,
- 6, 7, 0, 0, 0, -6, 55, 8, 9, 0,
- 0, 10, 394, 11, 0, 12, 13, 342, 343, 14,
- 0, 0, 0, 0, 0, 0, 0, 0, 15, 0,
- 0, 0, 16, 0, 344, 0, 0, 0, 17, 0,
- 18, 134, 135, 136, 137, 306, 0, 0, 0, 19,
- 20, 0, 0, 21, 22, 0, 345, 0, 23, 24,
- 0, 0, 25, 26, 346, 0, 347, 0, 0, 0,
- 0, 27, 138, 0, 139, 0, 140, 0, 0, 0,
- 348, 0, 141, 0, 28, 29, 30, 0, 0, 0,
- 0, 31, 0, 0, 0, 0, 0, 349, 350, 190,
- 32, 0, 0, 0, 33, 191, 34, 192, 35, 36,
+ 123, 165, 275, 276, 337, 289, 267, 268, 207, 385,
+ 176, 167, 206, 82, 102, 371, 215, 282, 120, 238,
+ 121, 1, 363, 219, 164, 277, 108, 225, 399, 83,
+ 2, 238, 84, 126, 3, 4, 5, 372, 404, 295,
+ 296, 127, 6, 7, 128, 217, 129, 218, 226, 8,
+ 9, 363, 220, 10, 147, 11, 134, 12, 13, 148,
+ 230, 14, 150, 166, 168, 290, 315, 291, 302, 173,
+ 15, 177, 227, 160, 16, 338, 303, 390, 122, 304,
+ 17, 216, 18, 231, 212, 257, 232, 214, 151, 152,
+ 222, 19, 20, 295, 296, 21, 22, 223, 224, 229,
+ 23, 24, 103, 240, 25, 26, 153, 104, 333, 334,
+ 241, 122, 161, 27, 162, 243, 373, 305, 259, 169,
+ 256, 261, 386, 374, 265, 262, 28, 29, 30, 266,
+ 269, 259, 271, 31, 278, 272, 281, 284, 286, 111,
+ 273, 375, 32, 112, 287, 154, 208, 33, 306, 34,
+ 300, 35, 36, 301, 178, 244, 245, 246, 247, 292,
+ 313, 37, 38, 39, 40, 41, 42, 43, 44, 233,
+ 234, 45, 311, 46, 312, 155, 235, 336, 379, 179,
+ 340, 393, 47, 293, 368, 369, 370, 48, 49, 50,
+ 380, 51, 52, 376, 383, 163, 377, 180, 53, 54,
+ 181, 113, 384, 388, 387, 122, 389, -6, 55, 392,
+ 402, 408, 307, 396, 394, 407, 399, 2, 280, 398,
+ 406, 3, 4, 5, 409, 410, 411, 412, 413, 6,
+ 7, 335, 422, 417, 403, 419, 8, 9, 420, 421,
+ 10, 156, 11, 239, 12, 13, 157, 114, 14, 260,
+ 314, 110, 248, 270, 274, 115, 258, 15, 116, 263,
+ 285, 16, 409, 410, 411, 412, 413, 17, 391, 18,
+ 249, 146, 316, 364, 182, 250, 251, 405, 19, 20,
+ 117, 0, 21, 22, 418, 118, 0, 23, 24, 0,
+ 0, 25, 26, 0, 0, 0, 0, 0, 0, 382,
+ 27, 0, 183, 184, 185, 186, 0, 0, 0, 0,
+ 187, 0, 0, 28, 29, 30, 0, 0, 0, 0,
+ 31, 0, 0, 86, 0, 0, 0, 87, 0, 32,
+ 0, 0, 0, 88, 33, 0, 34, 0, 35, 36,
0, 0, 0, 0, 0, 0, 0, 0, 37, 38,
39, 40, 41, 42, 43, 44, 0, 0, 45, 0,
- 46, 0, 316, 351, 193, 352, 0, 0, 0, 47,
- 317, 0, 0, 353, 48, 49, 50, 354, 51, 52,
- 0, 0, 0, 0, 0, 53, 54, 0, 318, 319,
- 0, 0, 320, 0, 0, 55, 0, 0, 321, 0,
- 0, 0, 0, 0, 194, 0, 195, 0, 0, 0,
- 0, 0, 196, 0, 197, 0, 0, 198, 0, 0,
- 0, 0, 0, 0, 0, 322, 323, 0, 0, 324,
- 325, 0, 326, 327, 328, 0, 329, 0, 0, 199,
- 200, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 46, 0, 341, 0, 0, 0, 0, 0, 0, 47,
+ 342, 0, 0, 395, 48, 49, 50, 2, 51, 52,
+ 0, 3, 4, 5, 89, 53, 54, 0, 0, 6,
+ 7, 0, 0, 191, -6, 55, 8, 9, 0, 192,
+ 10, 193, 11, 0, 12, 13, 343, 344, 14, 0,
+ 0, 0, 0, 0, 0, 0, 0, 15, 90, 91,
+ 0, 16, 0, 345, 0, 0, 0, 17, 194, 18,
+ 135, 136, 137, 138, 0, 92, 0, 0, 19, 20,
+ 93, 0, 21, 22, 0, 346, 0, 23, 24, 0,
+ 0, 25, 26, 347, 0, 348, 0, 0, 0, 0,
+ 27, 139, 0, 140, 0, 141, 0, 94, 195, 349,
+ 196, 142, 0, 28, 29, 30, 197, 0, 198, 0,
+ 31, 199, 0, 0, 0, 0, 0, 350, 351, 32,
+ 95, 96, 97, 0, 33, 0, 34, 0, 35, 36,
+ 0, 0, 0, 200, 201, 0, 0, 0, 37, 38,
+ 39, 40, 41, 42, 43, 44, 0, 0, 45, 0,
+ 46, 0, 317, 352, 0, 353, 0, 0, 0, 47,
+ 318, 0, 0, 354, 48, 49, 50, 355, 51, 52,
+ 0, 0, 0, 0, 0, 53, 54, 0, 319, 320,
+ 0, 0, 321, 0, 0, 55, 0, 0, 322, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 323, 324, 0, 0, 325,
+ 326, 0, 327, 328, 329, 0, 330, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 330
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 331
};
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-188)))
-
-#define yytable_value_is_error(Yytable_value) \
- YYID (0)
-
static const yytype_int16 yycheck[] =
{
- 15, 39, 189, 61, 7, 8, 1, 4, 45, 5,
- 61, 11, 50, 191, 39, 10, 57, 204, 62, 14,
- 15, 16, 25, 201, 39, 32, 186, 22, 23, 26,
- 188, 189, 146, 61, 29, 30, 61, 61, 33, 158,
- 35, 158, 37, 38, 97, 60, 41, 62, 158, 6,
- 158, 162, 163, 42, 61, 50, 109, 158, 34, 54,
- 61, 64, 158, 158, 158, 60, 253, 62, 8, 65,
- 28, 67, 12, 66, 31, 68, 71, 72, 18, 55,
- 75, 76, 61, 3, 125, 80, 81, 201, 132, 84,
- 85, 94, 49, 51, 61, 52, 54, 158, 93, 99,
- 27, 158, 61, 79, 104, 0, 95, 186, 105, 61,
- 158, 106, 107, 108, 200, 112, 146, 132, 113, 158,
- 61, 32, 173, 43, 44, 45, 46, 122, 61, 69,
- 145, 126, 129, 128, 27, 130, 131, 174, 20, 66,
- 198, 68, 24, 27, 169, 140, 141, 142, 143, 144,
- 145, 146, 147, 264, 265, 150, 159, 152, 188, 189,
- 149, 164, 158, 103, 104, 158, 161, 158, 125, 86,
- 158, 166, 167, 168, 61, 170, 171, 197, 136, 137,
- 120, 368, 177, 178, 181, 143, 182, 184, 61, 10,
- 61, 186, 187, 14, 15, 16, 153, 154, 155, 156,
- 82, 22, 23, 61, 161, 186, 61, 158, 29, 30,
- 397, 151, 33, 158, 35, 402, 37, 38, 61, 139,
- 41, 148, 158, 334, 192, 193, 194, 195, 196, 50,
- 268, 158, 419, 54, 174, 175, 176, 157, 36, 60,
- 158, 62, 162, 163, 186, 127, 158, 197, 27, 61,
- 71, 72, 61, 135, 75, 76, 138, 158, 197, 80,
- 81, 186, 29, 84, 85, 200, 190, 199, 197, 191,
- 37, 197, 93, 40, 104, 142, 186, 200, 160, 186,
- 186, 197, 201, 165, 169, 106, 107, 108, 251, 12,
- 187, 129, 113, 192, 193, 194, 195, 196, 336, 208,
- 157, 122, 201, 29, 296, 126, 254, 128, 364, 130,
- 131, 78, 399, 413, -1, -1, -1, -1, -1, 140,
- 141, 142, 143, 144, 145, 146, 147, -1, -1, 150,
- -1, 152, -1, 9, -1, -1, -1, -1, -1, -1,
- 161, 17, 109, -1, -1, 166, 167, 168, 10, 170,
- 171, -1, 14, 15, 16, -1, 177, 178, -1, -1,
- 22, 23, -1, -1, -1, 186, 187, 29, 30, -1,
- -1, 33, 387, 35, -1, 37, 38, 53, 54, 41,
- -1, -1, -1, -1, -1, -1, -1, -1, 50, -1,
- -1, -1, 54, -1, 70, -1, -1, -1, 60, -1,
- 62, 56, 57, 58, 59, 172, -1, -1, -1, 71,
- 72, -1, -1, 75, 76, -1, 92, -1, 80, 81,
- -1, -1, 84, 85, 100, -1, 102, -1, -1, -1,
- -1, 93, 87, -1, 89, -1, 91, -1, -1, -1,
- 116, -1, 97, -1, 106, 107, 108, -1, -1, -1,
- -1, 113, -1, -1, -1, -1, -1, 133, 134, 13,
- 122, -1, -1, -1, 126, 19, 128, 21, 130, 131,
- -1, -1, -1, -1, -1, -1, -1, -1, 140, 141,
- 142, 143, 144, 145, 146, 147, -1, -1, 150, -1,
- 152, -1, 47, 169, 48, 171, -1, -1, -1, 161,
- 55, -1, -1, 179, 166, 167, 168, 183, 170, 171,
- -1, -1, -1, -1, -1, 177, 178, -1, 73, 74,
- -1, -1, 77, -1, -1, 187, -1, -1, 83, -1,
- -1, -1, -1, -1, 88, -1, 90, -1, -1, -1,
- -1, -1, 96, -1, 98, -1, -1, 101, -1, -1,
+ 15, 39, 190, 39, 62, 5, 163, 164, 61, 61,
+ 45, 42, 50, 187, 11, 4, 57, 205, 66, 98,
+ 68, 1, 147, 32, 39, 61, 159, 34, 192, 61,
+ 10, 110, 61, 159, 14, 15, 16, 26, 202, 189,
+ 190, 159, 22, 23, 159, 60, 159, 62, 55, 29,
+ 30, 147, 61, 33, 159, 35, 61, 37, 38, 159,
+ 28, 41, 61, 61, 95, 65, 254, 67, 29, 159,
+ 50, 159, 79, 27, 54, 133, 37, 202, 159, 40,
+ 60, 187, 62, 51, 61, 126, 54, 0, 7, 8,
+ 61, 71, 72, 189, 190, 75, 76, 159, 159, 201,
+ 80, 81, 99, 61, 84, 85, 25, 104, 265, 266,
+ 32, 159, 66, 93, 68, 3, 105, 78, 133, 150,
+ 159, 61, 174, 112, 27, 159, 106, 107, 108, 27,
+ 86, 146, 61, 113, 170, 198, 61, 61, 61, 20,
+ 175, 130, 122, 24, 187, 64, 199, 127, 109, 129,
+ 61, 131, 132, 159, 6, 43, 44, 45, 46, 159,
+ 61, 141, 142, 143, 144, 145, 146, 147, 148, 137,
+ 138, 151, 159, 153, 159, 94, 144, 159, 335, 31,
+ 36, 369, 162, 183, 187, 198, 159, 167, 168, 169,
+ 27, 171, 172, 182, 61, 149, 185, 49, 178, 179,
+ 52, 82, 61, 198, 159, 159, 187, 187, 188, 201,
+ 398, 201, 173, 191, 200, 403, 192, 10, 202, 198,
+ 187, 14, 15, 16, 193, 194, 195, 196, 197, 22,
+ 23, 269, 420, 202, 198, 187, 29, 30, 198, 187,
+ 33, 160, 35, 105, 37, 38, 165, 128, 41, 143,
+ 252, 12, 140, 170, 188, 136, 130, 50, 139, 158,
+ 209, 54, 193, 194, 195, 196, 197, 60, 365, 62,
+ 158, 29, 255, 297, 126, 163, 164, 400, 71, 72,
+ 161, -1, 75, 76, 414, 166, -1, 80, 81, -1,
+ -1, 84, 85, -1, -1, -1, -1, -1, -1, 337,
+ 93, -1, 154, 155, 156, 157, -1, -1, -1, -1,
+ 162, -1, -1, 106, 107, 108, -1, -1, -1, -1,
+ 113, -1, -1, 8, -1, -1, -1, 12, -1, 122,
+ -1, -1, -1, 18, 127, -1, 129, -1, 131, 132,
+ -1, -1, -1, -1, -1, -1, -1, -1, 141, 142,
+ 143, 144, 145, 146, 147, 148, -1, -1, 151, -1,
+ 153, -1, 9, -1, -1, -1, -1, -1, -1, 162,
+ 17, -1, -1, 388, 167, 168, 169, 10, 171, 172,
+ -1, 14, 15, 16, 69, 178, 179, -1, -1, 22,
+ 23, -1, -1, 13, 187, 188, 29, 30, -1, 19,
+ 33, 21, 35, -1, 37, 38, 53, 54, 41, -1,
+ -1, -1, -1, -1, -1, -1, -1, 50, 103, 104,
+ -1, 54, -1, 70, -1, -1, -1, 60, 48, 62,
+ 56, 57, 58, 59, -1, 120, -1, -1, 71, 72,
+ 125, -1, 75, 76, -1, 92, -1, 80, 81, -1,
+ -1, 84, 85, 100, -1, 102, -1, -1, -1, -1,
+ 93, 87, -1, 89, -1, 91, -1, 152, 88, 116,
+ 90, 97, -1, 106, 107, 108, 96, -1, 98, -1,
+ 113, 101, -1, -1, -1, -1, -1, 134, 135, 122,
+ 175, 176, 177, -1, 127, -1, 129, -1, 131, 132,
+ -1, -1, -1, 123, 124, -1, -1, -1, 141, 142,
+ 143, 144, 145, 146, 147, 148, -1, -1, 151, -1,
+ 153, -1, 47, 170, -1, 172, -1, -1, -1, 162,
+ 55, -1, -1, 180, 167, 168, 169, 184, 171, 172,
+ -1, -1, -1, -1, -1, 178, 179, -1, 73, 74,
+ -1, -1, 77, -1, -1, 188, -1, -1, 83, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 110, 111, -1, -1, 114,
- 115, -1, 117, 118, 119, -1, 121, -1, -1, 123,
- 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 115, -1, 117, 118, 119, -1, 121, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 179
+ -1, -1, -1, -1, -1, 180
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint16 yystos[] =
{
0, 1, 10, 14, 15, 16, 22, 23, 29, 30,
33, 35, 37, 38, 41, 50, 54, 60, 62, 71,
72, 75, 76, 80, 81, 84, 85, 93, 106, 107,
- 108, 113, 122, 126, 128, 130, 131, 140, 141, 142,
- 143, 144, 145, 146, 147, 150, 152, 161, 166, 167,
- 168, 170, 171, 177, 178, 187, 203, 204, 205, 206,
- 207, 219, 220, 221, 222, 226, 231, 239, 248, 253,
- 257, 262, 266, 267, 268, 269, 270, 278, 279, 282,
- 293, 294, 186, 61, 61, 223, 8, 12, 18, 69,
- 103, 104, 120, 151, 174, 175, 176, 258, 259, 260,
- 261, 11, 99, 104, 242, 243, 244, 158, 271, 258,
- 20, 24, 82, 127, 135, 138, 160, 165, 233, 66,
- 68, 158, 208, 209, 210, 158, 158, 158, 158, 276,
- 277, 208, 290, 61, 56, 57, 58, 59, 87, 89,
- 91, 97, 245, 246, 247, 290, 158, 158, 289, 61,
- 7, 8, 25, 64, 94, 159, 164, 283, 284, 27,
- 66, 68, 148, 208, 209, 61, 42, 95, 149, 254,
- 255, 256, 158, 272, 232, 233, 158, 6, 31, 49,
- 52, 125, 153, 154, 155, 156, 161, 263, 264, 265,
- 13, 19, 21, 48, 88, 90, 96, 98, 101, 123,
- 124, 227, 228, 229, 230, 209, 61, 198, 286, 287,
- 288, 61, 285, 0, 205, 186, 208, 208, 32, 61,
- 292, 61, 158, 158, 34, 55, 79, 281, 200, 28,
- 51, 54, 136, 137, 143, 224, 225, 259, 243, 61,
- 32, 234, 3, 43, 44, 45, 46, 139, 157, 162,
- 163, 249, 250, 251, 252, 158, 205, 277, 208, 246,
- 61, 158, 284, 240, 27, 27, 240, 240, 86, 255,
- 61, 197, 233, 264, 292, 39, 61, 169, 291, 228,
- 61, 292, 274, 61, 287, 61, 186, 211, 5, 65,
- 67, 158, 182, 280, 188, 189, 295, 296, 297, 61,
- 158, 29, 37, 40, 78, 109, 172, 235, 236, 237,
- 158, 158, 61, 250, 292, 291, 47, 55, 73, 74,
- 77, 83, 110, 111, 114, 115, 117, 118, 119, 121,
- 179, 241, 240, 240, 209, 158, 62, 132, 275, 36,
- 9, 17, 53, 54, 70, 92, 100, 102, 116, 133,
- 134, 169, 171, 179, 183, 212, 213, 214, 215, 216,
- 217, 218, 146, 296, 298, 299, 301, 186, 197, 158,
- 4, 26, 105, 112, 129, 181, 184, 238, 240, 27,
- 273, 209, 61, 61, 61, 173, 158, 197, 186, 201,
- 299, 200, 292, 199, 208, 190, 300, 197, 191, 302,
- 303, 292, 197, 201, 303, 186, 292, 200, 192, 193,
- 194, 195, 196, 304, 305, 306, 201, 305, 186, 197,
- 186, 292
+ 108, 113, 122, 127, 129, 131, 132, 141, 142, 143,
+ 144, 145, 146, 147, 148, 151, 153, 162, 167, 168,
+ 169, 171, 172, 178, 179, 188, 204, 205, 206, 207,
+ 208, 220, 221, 222, 223, 227, 232, 240, 249, 254,
+ 258, 263, 267, 268, 269, 270, 271, 279, 280, 283,
+ 294, 295, 187, 61, 61, 224, 8, 12, 18, 69,
+ 103, 104, 120, 125, 152, 175, 176, 177, 259, 260,
+ 261, 262, 11, 99, 104, 243, 244, 245, 159, 272,
+ 259, 20, 24, 82, 128, 136, 139, 161, 166, 234,
+ 66, 68, 159, 209, 210, 211, 159, 159, 159, 159,
+ 277, 278, 209, 291, 61, 56, 57, 58, 59, 87,
+ 89, 91, 97, 246, 247, 248, 291, 159, 159, 290,
+ 61, 7, 8, 25, 64, 94, 160, 165, 284, 285,
+ 27, 66, 68, 149, 209, 210, 61, 42, 95, 150,
+ 255, 256, 257, 159, 273, 233, 234, 159, 6, 31,
+ 49, 52, 126, 154, 155, 156, 157, 162, 264, 265,
+ 266, 13, 19, 21, 48, 88, 90, 96, 98, 101,
+ 123, 124, 228, 229, 230, 231, 210, 61, 199, 287,
+ 288, 289, 61, 286, 0, 206, 187, 209, 209, 32,
+ 61, 293, 61, 159, 159, 34, 55, 79, 282, 201,
+ 28, 51, 54, 137, 138, 144, 225, 226, 260, 244,
+ 61, 32, 235, 3, 43, 44, 45, 46, 140, 158,
+ 163, 164, 250, 251, 252, 253, 159, 206, 278, 209,
+ 247, 61, 159, 285, 241, 27, 27, 241, 241, 86,
+ 256, 61, 198, 234, 265, 293, 39, 61, 170, 292,
+ 229, 61, 293, 275, 61, 288, 61, 187, 212, 5,
+ 65, 67, 159, 183, 281, 189, 190, 296, 297, 298,
+ 61, 159, 29, 37, 40, 78, 109, 173, 236, 237,
+ 238, 159, 159, 61, 251, 293, 292, 47, 55, 73,
+ 74, 77, 83, 110, 111, 114, 115, 117, 118, 119,
+ 121, 180, 242, 241, 241, 210, 159, 62, 133, 276,
+ 36, 9, 17, 53, 54, 70, 92, 100, 102, 116,
+ 134, 135, 170, 172, 180, 184, 213, 214, 215, 216,
+ 217, 218, 219, 147, 297, 299, 300, 302, 187, 198,
+ 159, 4, 26, 105, 112, 130, 182, 185, 239, 241,
+ 27, 274, 210, 61, 61, 61, 174, 159, 198, 187,
+ 202, 300, 201, 293, 200, 209, 191, 301, 198, 192,
+ 303, 304, 293, 198, 202, 304, 187, 293, 201, 193,
+ 194, 195, 196, 197, 305, 306, 307, 202, 306, 187,
+ 198, 187, 293
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint16 yyr1[] =
+{
+ 0, 203, 204, 205, 205, 205, 206, 206, 206, 206,
+ 206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
+ 207, 208, 208, 208, 208, 208, 209, 209, 210, 211,
+ 211, 212, 212, 213, 213, 213, 214, 215, 215, 215,
+ 215, 215, 215, 215, 215, 216, 216, 217, 217, 217,
+ 217, 217, 217, 218, 219, 220, 221, 221, 222, 222,
+ 222, 222, 223, 223, 223, 223, 223, 223, 223, 223,
+ 223, 224, 224, 225, 225, 226, 226, 226, 226, 226,
+ 227, 228, 228, 229, 229, 229, 230, 230, 230, 230,
+ 230, 230, 231, 231, 231, 231, 232, 232, 232, 233,
+ 233, 234, 234, 234, 234, 234, 234, 234, 234, 235,
+ 235, 236, 236, 236, 236, 237, 237, 238, 238, 239,
+ 239, 239, 239, 239, 239, 239, 240, 240, 240, 240,
+ 240, 240, 240, 240, 241, 241, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 243, 243, 244, 245, 245, 245, 246, 246, 247,
+ 248, 248, 248, 248, 248, 248, 248, 248, 249, 250,
+ 250, 251, 251, 251, 251, 251, 252, 252, 253, 253,
+ 253, 253, 254, 255, 255, 256, 257, 257, 257, 258,
+ 258, 259, 259, 260, 260, 261, 261, 261, 261, 261,
+ 261, 262, 262, 262, 262, 262, 262, 263, 264, 264,
+ 265, 266, 266, 266, 266, 266, 266, 266, 266, 266,
+ 266, 267, 267, 267, 267, 267, 267, 267, 267, 267,
+ 267, 267, 267, 267, 267, 268, 268, 268, 269, 269,
+ 270, 270, 271, 271, 271, 272, 272, 272, 273, 274,
+ 274, 275, 275, 276, 276, 277, 277, 278, 279, 279,
+ 280, 280, 281, 281, 281, 281, 282, 282, 282, 283,
+ 284, 284, 285, 285, 285, 285, 285, 285, 285, 286,
+ 286, 287, 287, 288, 288, 289, 290, 290, 291, 291,
+ 292, 292, 292, 293, 293, 294, 295, 296, 296, 297,
+ 298, 298, 299, 299, 300, 301, 302, 303, 303, 304,
+ 305, 305, 306, 307, 307, 307, 307, 307
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 3, 2, 2, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 3, 1, 1, 1, 1, 1, 1, 2, 1, 1,
+ 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 1, 1, 1,
+ 1, 1, 1, 2, 1, 2, 1, 1, 1, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 0, 2, 2, 2, 1, 1, 1, 1, 1,
+ 2, 2, 1, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 3, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 3, 5,
+ 3, 4, 4, 3, 0, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 2, 1, 1, 1, 2, 1, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
+ 1, 2, 2, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 2, 2, 1, 2, 1, 1, 1, 2,
+ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2, 2, 1,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 2, 2, 2, 3, 1, 2,
+ 2, 2, 2, 3, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 0, 4, 1,
+ 0, 0, 2, 2, 2, 2, 1, 1, 3, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 2, 1, 1, 1, 5, 2, 1, 2, 1,
+ 1, 1, 1, 1, 1, 5, 1, 3, 2, 3,
+ 1, 1, 2, 1, 5, 4, 3, 2, 1, 6,
+ 3, 2, 3, 1, 1, 1, 1, 1
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
#define YYRECOVERING() (!!yyerrstatus)
@@ -1584,27 +1458,15 @@ do \
else \
{ \
yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
+ YYERROR; \
+ } \
+while (0)
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -1614,40 +1476,36 @@ while (YYID (0))
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
@@ -1656,8 +1514,6 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
YYUSE (yytype);
}
@@ -1667,22 +1523,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
@@ -1693,16 +1538,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -1713,49 +1550,42 @@ yy_stack_print (yybottom, yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
static void
-yy_reduce_print (yyvsp, yyrule)
- YYSTYPE *yyvsp;
- int yyrule;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1769,7 +1599,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1792,15 +1622,8 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1816,16 +1639,8 @@ yystrlen (yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1855,27 +1670,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1898,11 +1713,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULL;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1910,10 +1725,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1963,7 +1774,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@@ -2030,26 +1841,17 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
{
YYUSE (yyvaluep);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
@@ -2058,18 +1860,8 @@ yydestruct (yymsg, yytype, yyvaluep)
/* The lookahead symbol. */
int yychar;
-
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
-
+YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
@@ -2078,35 +1870,16 @@ int yynerrs;
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
{
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
@@ -2174,23 +1947,23 @@ yyparse ()
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -2198,22 +1971,22 @@ yyparse ()
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -2222,10 +1995,10 @@ yyparse ()
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -2254,7 +2027,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex ();
}
if (yychar <= YYEOF)
@@ -2319,7 +2092,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -2333,8 +2106,7 @@ yyreduce:
switch (yyn)
{
case 5:
-/* Line 1787 of yacc.c */
-#line 376 "../../ntpd/ntp_parser.y"
+#line 377 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
/* I will need to incorporate much more fine grained
* error messages. The following should suffice for
@@ -2347,433 +2119,433 @@ yyreduce:
ip_ctx->errpos.nline,
ip_ctx->errpos.ncol);
}
+#line 2123 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 20:
-/* Line 1787 of yacc.c */
-#line 412 "../../ntpd/ntp_parser.y"
+#line 413 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
peer_node *my_node;
- my_node = create_peer_node((yyvsp[(1) - (3)].Integer), (yyvsp[(2) - (3)].Address_node), (yyvsp[(3) - (3)].Attr_val_fifo));
+ my_node = create_peer_node((yyvsp[-2].Integer), (yyvsp[-1].Address_node), (yyvsp[0].Attr_val_fifo));
APPEND_G_FIFO(cfgt.peers, my_node);
}
+#line 2134 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 27:
-/* Line 1787 of yacc.c */
-#line 431 "../../ntpd/ntp_parser.y"
- { (yyval.Address_node) = create_address_node((yyvsp[(2) - (2)].String), (yyvsp[(1) - (2)].Integer)); }
+#line 432 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Address_node) = create_address_node((yyvsp[0].String), (yyvsp[-1].Integer)); }
+#line 2140 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 28:
-/* Line 1787 of yacc.c */
-#line 436 "../../ntpd/ntp_parser.y"
- { (yyval.Address_node) = create_address_node((yyvsp[(1) - (1)].String), AF_UNSPEC); }
+#line 437 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Address_node) = create_address_node((yyvsp[0].String), AF_UNSPEC); }
+#line 2146 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 29:
-/* Line 1787 of yacc.c */
-#line 441 "../../ntpd/ntp_parser.y"
+#line 442 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = AF_INET; }
+#line 2152 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 30:
-/* Line 1787 of yacc.c */
-#line 443 "../../ntpd/ntp_parser.y"
+#line 444 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = AF_INET6; }
+#line 2158 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 31:
-/* Line 1787 of yacc.c */
-#line 448 "../../ntpd/ntp_parser.y"
+#line 449 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val_fifo) = NULL; }
+#line 2164 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 32:
-/* Line 1787 of yacc.c */
-#line 450 "../../ntpd/ntp_parser.y"
+#line 451 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2173 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 36:
-/* Line 1787 of yacc.c */
-#line 464 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); }
+#line 465 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer)); }
+#line 2179 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 45:
-/* Line 1787 of yacc.c */
-#line 480 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+#line 481 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 2185 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 46:
-/* Line 1787 of yacc.c */
-#line 482 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_uval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+#line 483 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_uval((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 2191 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 53:
-/* Line 1787 of yacc.c */
-#line 496 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); }
+#line 497 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String)); }
+#line 2197 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 55:
-/* Line 1787 of yacc.c */
-#line 510 "../../ntpd/ntp_parser.y"
+#line 511 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
unpeer_node *my_node;
- my_node = create_unpeer_node((yyvsp[(2) - (2)].Address_node));
+ my_node = create_unpeer_node((yyvsp[0].Address_node));
if (my_node)
APPEND_G_FIFO(cfgt.unpeers, my_node);
}
+#line 2209 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 58:
-/* Line 1787 of yacc.c */
-#line 531 "../../ntpd/ntp_parser.y"
+#line 532 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ cfgt.broadcastclient = 1; }
+#line 2215 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 59:
-/* Line 1787 of yacc.c */
-#line 533 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.manycastserver, (yyvsp[(2) - (2)].Address_fifo)); }
+#line 534 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.manycastserver, (yyvsp[0].Address_fifo)); }
+#line 2221 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 60:
-/* Line 1787 of yacc.c */
-#line 535 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.multicastclient, (yyvsp[(2) - (2)].Address_fifo)); }
+#line 536 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.multicastclient, (yyvsp[0].Address_fifo)); }
+#line 2227 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 61:
-/* Line 1787 of yacc.c */
-#line 537 "../../ntpd/ntp_parser.y"
- { cfgt.mdnstries = (yyvsp[(2) - (2)].Integer); }
+#line 538 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.mdnstries = (yyvsp[0].Integer); }
+#line 2233 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 62:
-/* Line 1787 of yacc.c */
-#line 548 "../../ntpd/ntp_parser.y"
+#line 549 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *atrv;
- atrv = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer));
+ atrv = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer));
APPEND_G_FIFO(cfgt.vars, atrv);
}
+#line 2244 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 63:
-/* Line 1787 of yacc.c */
-#line 555 "../../ntpd/ntp_parser.y"
- { cfgt.auth.control_key = (yyvsp[(2) - (2)].Integer); }
+#line 556 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.auth.control_key = (yyvsp[0].Integer); }
+#line 2250 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 64:
-/* Line 1787 of yacc.c */
-#line 557 "../../ntpd/ntp_parser.y"
+#line 558 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
cfgt.auth.cryptosw++;
- CONCAT_G_FIFOS(cfgt.auth.crypto_cmd_list, (yyvsp[(2) - (2)].Attr_val_fifo));
+ CONCAT_G_FIFOS(cfgt.auth.crypto_cmd_list, (yyvsp[0].Attr_val_fifo));
}
+#line 2259 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 65:
-/* Line 1787 of yacc.c */
-#line 562 "../../ntpd/ntp_parser.y"
- { cfgt.auth.keys = (yyvsp[(2) - (2)].String); }
+#line 563 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.auth.keys = (yyvsp[0].String); }
+#line 2265 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 66:
-/* Line 1787 of yacc.c */
-#line 564 "../../ntpd/ntp_parser.y"
- { cfgt.auth.keysdir = (yyvsp[(2) - (2)].String); }
+#line 565 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.auth.keysdir = (yyvsp[0].String); }
+#line 2271 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 67:
-/* Line 1787 of yacc.c */
-#line 566 "../../ntpd/ntp_parser.y"
- { cfgt.auth.request_key = (yyvsp[(2) - (2)].Integer); }
+#line 567 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.auth.request_key = (yyvsp[0].Integer); }
+#line 2277 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 68:
-/* Line 1787 of yacc.c */
-#line 568 "../../ntpd/ntp_parser.y"
- { cfgt.auth.revoke = (yyvsp[(2) - (2)].Integer); }
+#line 569 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.auth.revoke = (yyvsp[0].Integer); }
+#line 2283 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 69:
-/* Line 1787 of yacc.c */
-#line 570 "../../ntpd/ntp_parser.y"
+#line 571 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- cfgt.auth.trusted_key_list = (yyvsp[(2) - (2)].Attr_val_fifo);
+ cfgt.auth.trusted_key_list = (yyvsp[0].Attr_val_fifo);
// if (!cfgt.auth.trusted_key_list)
// cfgt.auth.trusted_key_list = $2;
// else
// LINK_SLIST(cfgt.auth.trusted_key_list, $2, link);
}
+#line 2296 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 70:
-/* Line 1787 of yacc.c */
-#line 579 "../../ntpd/ntp_parser.y"
- { cfgt.auth.ntp_signd_socket = (yyvsp[(2) - (2)].String); }
+#line 580 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { cfgt.auth.ntp_signd_socket = (yyvsp[0].String); }
+#line 2302 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 71:
-/* Line 1787 of yacc.c */
-#line 584 "../../ntpd/ntp_parser.y"
+#line 585 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val_fifo) = NULL; }
+#line 2308 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 72:
-/* Line 1787 of yacc.c */
-#line 586 "../../ntpd/ntp_parser.y"
+#line 587 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2317 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 73:
-/* Line 1787 of yacc.c */
-#line 594 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); }
+#line 595 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String)); }
+#line 2323 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 74:
-/* Line 1787 of yacc.c */
-#line 596 "../../ntpd/ntp_parser.y"
+#line 597 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val) = NULL;
- cfgt.auth.revoke = (yyvsp[(2) - (2)].Integer);
+ cfgt.auth.revoke = (yyvsp[0].Integer);
msyslog(LOG_WARNING,
"'crypto revoke %d' is deprecated, "
"please use 'revoke %d' instead.",
cfgt.auth.revoke, cfgt.auth.revoke);
}
+#line 2336 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 80:
-/* Line 1787 of yacc.c */
-#line 621 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.orphan_cmds, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+#line 622 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.orphan_cmds, (yyvsp[0].Attr_val_fifo)); }
+#line 2342 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 81:
-/* Line 1787 of yacc.c */
-#line 626 "../../ntpd/ntp_parser.y"
+#line 627 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2351 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 82:
-/* Line 1787 of yacc.c */
-#line 631 "../../ntpd/ntp_parser.y"
+#line 632 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2360 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 83:
-/* Line 1787 of yacc.c */
-#line 639 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); }
+#line 640 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-1].Integer), (double)(yyvsp[0].Integer)); }
+#line 2366 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 84:
-/* Line 1787 of yacc.c */
-#line 641 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); }
+#line 642 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-1].Integer), (yyvsp[0].Double)); }
+#line 2372 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 85:
-/* Line 1787 of yacc.c */
-#line 643 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); }
+#line 644 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-1].Integer), (double)(yyvsp[0].Integer)); }
+#line 2378 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 96:
-/* Line 1787 of yacc.c */
-#line 669 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.stats_list, (yyvsp[(2) - (2)].Int_fifo)); }
+#line 670 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.stats_list, (yyvsp[0].Int_fifo)); }
+#line 2384 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 97:
-/* Line 1787 of yacc.c */
-#line 671 "../../ntpd/ntp_parser.y"
+#line 672 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
- cfgt.stats_dir = (yyvsp[(2) - (2)].String);
+ cfgt.stats_dir = (yyvsp[0].String);
} else {
- YYFREE((yyvsp[(2) - (2)].String));
+ YYFREE((yyvsp[0].String));
yyerror("statsdir remote configuration ignored");
}
}
+#line 2397 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 98:
-/* Line 1787 of yacc.c */
-#line 680 "../../ntpd/ntp_parser.y"
+#line 681 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
filegen_node *fgn;
- fgn = create_filegen_node((yyvsp[(2) - (3)].Integer), (yyvsp[(3) - (3)].Attr_val_fifo));
+ fgn = create_filegen_node((yyvsp[-1].Integer), (yyvsp[0].Attr_val_fifo));
APPEND_G_FIFO(cfgt.filegen_opts, fgn);
}
+#line 2408 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 99:
-/* Line 1787 of yacc.c */
-#line 690 "../../ntpd/ntp_parser.y"
+#line 691 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Int_fifo) = (yyvsp[(1) - (2)].Int_fifo);
- APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[(2) - (2)].Integer)));
+ (yyval.Int_fifo) = (yyvsp[-1].Int_fifo);
+ APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 2417 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 100:
-/* Line 1787 of yacc.c */
-#line 695 "../../ntpd/ntp_parser.y"
+#line 696 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Int_fifo) = NULL;
- APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[(1) - (1)].Integer)));
+ APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 2426 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 109:
-/* Line 1787 of yacc.c */
-#line 714 "../../ntpd/ntp_parser.y"
+#line 715 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val_fifo) = NULL; }
+#line 2432 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 110:
-/* Line 1787 of yacc.c */
-#line 716 "../../ntpd/ntp_parser.y"
+#line 717 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2441 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 111:
-/* Line 1787 of yacc.c */
-#line 724 "../../ntpd/ntp_parser.y"
+#line 725 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
- (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String));
+ (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String));
} else {
(yyval.Attr_val) = NULL;
- YYFREE((yyvsp[(2) - (2)].String));
+ YYFREE((yyvsp[0].String));
yyerror("filegen file remote config ignored");
}
}
+#line 2455 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 112:
-/* Line 1787 of yacc.c */
-#line 734 "../../ntpd/ntp_parser.y"
+#line 735 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
- (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer));
+ (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer));
} else {
(yyval.Attr_val) = NULL;
yyerror("filegen type remote config ignored");
}
}
+#line 2468 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 113:
-/* Line 1787 of yacc.c */
-#line 743 "../../ntpd/ntp_parser.y"
+#line 744 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
const char *err;
if (lex_from_file()) {
- (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer));
+ (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer));
} else {
(yyval.Attr_val) = NULL;
- if (T_Link == (yyvsp[(1) - (1)].Integer))
+ if (T_Link == (yyvsp[0].Integer))
err = "filegen link remote config ignored";
else
err = "filegen nolink remote config ignored";
yyerror(err);
}
}
+#line 2487 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 114:
-/* Line 1787 of yacc.c */
-#line 758 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); }
+#line 759 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer)); }
+#line 2493 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 126:
-/* Line 1787 of yacc.c */
-#line 788 "../../ntpd/ntp_parser.y"
+#line 789 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- CONCAT_G_FIFOS(cfgt.discard_opts, (yyvsp[(2) - (2)].Attr_val_fifo));
+ CONCAT_G_FIFOS(cfgt.discard_opts, (yyvsp[0].Attr_val_fifo));
}
+#line 2501 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 127:
-/* Line 1787 of yacc.c */
-#line 792 "../../ntpd/ntp_parser.y"
+#line 793 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- CONCAT_G_FIFOS(cfgt.mru_opts, (yyvsp[(2) - (2)].Attr_val_fifo));
+ CONCAT_G_FIFOS(cfgt.mru_opts, (yyvsp[0].Attr_val_fifo));
}
+#line 2509 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 128:
-/* Line 1787 of yacc.c */
-#line 796 "../../ntpd/ntp_parser.y"
+#line 797 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
restrict_node *rn;
- rn = create_restrict_node((yyvsp[(2) - (3)].Address_node), NULL, (yyvsp[(3) - (3)].Int_fifo),
+ rn = create_restrict_node((yyvsp[-1].Address_node), NULL, (yyvsp[0].Int_fifo),
lex_current()->curpos.nline);
APPEND_G_FIFO(cfgt.restrict_opts, rn);
}
+#line 2521 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 129:
-/* Line 1787 of yacc.c */
-#line 804 "../../ntpd/ntp_parser.y"
+#line 805 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
restrict_node *rn;
- rn = create_restrict_node((yyvsp[(2) - (5)].Address_node), (yyvsp[(4) - (5)].Address_node), (yyvsp[(5) - (5)].Int_fifo),
+ rn = create_restrict_node((yyvsp[-3].Address_node), (yyvsp[-1].Address_node), (yyvsp[0].Int_fifo),
lex_current()->curpos.nline);
APPEND_G_FIFO(cfgt.restrict_opts, rn);
}
+#line 2533 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 130:
-/* Line 1787 of yacc.c */
-#line 812 "../../ntpd/ntp_parser.y"
+#line 813 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
restrict_node *rn;
- rn = create_restrict_node(NULL, NULL, (yyvsp[(3) - (3)].Int_fifo),
+ rn = create_restrict_node(NULL, NULL, (yyvsp[0].Int_fifo),
lex_current()->curpos.nline);
APPEND_G_FIFO(cfgt.restrict_opts, rn);
}
+#line 2545 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 131:
-/* Line 1787 of yacc.c */
-#line 820 "../../ntpd/ntp_parser.y"
+#line 821 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
restrict_node *rn;
@@ -2784,15 +2556,15 @@ yyreduce:
create_address_node(
estrdup("0.0.0.0"),
AF_INET),
- (yyvsp[(4) - (4)].Int_fifo),
+ (yyvsp[0].Int_fifo),
lex_current()->curpos.nline);
APPEND_G_FIFO(cfgt.restrict_opts, rn);
}
+#line 2564 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 132:
-/* Line 1787 of yacc.c */
-#line 835 "../../ntpd/ntp_parser.y"
+#line 836 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
restrict_node *rn;
@@ -2803,327 +2575,327 @@ yyreduce:
create_address_node(
estrdup("::"),
AF_INET6),
- (yyvsp[(4) - (4)].Int_fifo),
+ (yyvsp[0].Int_fifo),
lex_current()->curpos.nline);
APPEND_G_FIFO(cfgt.restrict_opts, rn);
}
+#line 2583 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 133:
-/* Line 1787 of yacc.c */
-#line 850 "../../ntpd/ntp_parser.y"
+#line 851 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
restrict_node * rn;
- APPEND_G_FIFO((yyvsp[(3) - (3)].Int_fifo), create_int_node((yyvsp[(2) - (3)].Integer)));
+ APPEND_G_FIFO((yyvsp[0].Int_fifo), create_int_node((yyvsp[-1].Integer)));
rn = create_restrict_node(
- NULL, NULL, (yyvsp[(3) - (3)].Int_fifo), lex_current()->curpos.nline);
+ NULL, NULL, (yyvsp[0].Int_fifo), lex_current()->curpos.nline);
APPEND_G_FIFO(cfgt.restrict_opts, rn);
}
+#line 2596 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 134:
-/* Line 1787 of yacc.c */
-#line 862 "../../ntpd/ntp_parser.y"
+#line 863 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Int_fifo) = NULL; }
+#line 2602 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 135:
-/* Line 1787 of yacc.c */
-#line 864 "../../ntpd/ntp_parser.y"
+#line 865 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Int_fifo) = (yyvsp[(1) - (2)].Int_fifo);
- APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[(2) - (2)].Integer)));
+ (yyval.Int_fifo) = (yyvsp[-1].Int_fifo);
+ APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 2611 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 151:
-/* Line 1787 of yacc.c */
-#line 890 "../../ntpd/ntp_parser.y"
+#line 891 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2620 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 152:
-/* Line 1787 of yacc.c */
-#line 895 "../../ntpd/ntp_parser.y"
+#line 896 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2629 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 153:
-/* Line 1787 of yacc.c */
-#line 903 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+#line 904 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 2635 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 157:
-/* Line 1787 of yacc.c */
-#line 914 "../../ntpd/ntp_parser.y"
+#line 915 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2644 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 158:
-/* Line 1787 of yacc.c */
-#line 919 "../../ntpd/ntp_parser.y"
+#line 920 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2653 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 159:
-/* Line 1787 of yacc.c */
-#line 927 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+#line 928 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 2659 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 168:
-/* Line 1787 of yacc.c */
-#line 947 "../../ntpd/ntp_parser.y"
+#line 948 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
addr_opts_node *aon;
- aon = create_addr_opts_node((yyvsp[(2) - (3)].Address_node), (yyvsp[(3) - (3)].Attr_val_fifo));
+ aon = create_addr_opts_node((yyvsp[-1].Address_node), (yyvsp[0].Attr_val_fifo));
APPEND_G_FIFO(cfgt.fudge, aon);
}
+#line 2670 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 169:
-/* Line 1787 of yacc.c */
-#line 957 "../../ntpd/ntp_parser.y"
+#line 958 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2679 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 170:
-/* Line 1787 of yacc.c */
-#line 962 "../../ntpd/ntp_parser.y"
+#line 963 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2688 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 171:
-/* Line 1787 of yacc.c */
-#line 970 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); }
+#line 971 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-1].Integer), (yyvsp[0].Double)); }
+#line 2694 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 172:
-/* Line 1787 of yacc.c */
-#line 972 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+#line 973 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 2700 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 173:
-/* Line 1787 of yacc.c */
-#line 974 "../../ntpd/ntp_parser.y"
+#line 975 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- if ((yyvsp[(2) - (2)].Integer) >= 0 && (yyvsp[(2) - (2)].Integer) <= 16) {
- (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer));
+ if ((yyvsp[0].Integer) >= 0 && (yyvsp[0].Integer) <= 16) {
+ (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer));
} else {
(yyval.Attr_val) = NULL;
yyerror("fudge factor: stratum value not in [0..16], ignored");
}
}
+#line 2713 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 174:
-/* Line 1787 of yacc.c */
-#line 983 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); }
+#line 984 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String)); }
+#line 2719 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 175:
-/* Line 1787 of yacc.c */
-#line 985 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); }
+#line 986 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String)); }
+#line 2725 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 182:
-/* Line 1787 of yacc.c */
-#line 1006 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.rlimit, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+#line 1007 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.rlimit, (yyvsp[0].Attr_val_fifo)); }
+#line 2731 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 183:
-/* Line 1787 of yacc.c */
-#line 1011 "../../ntpd/ntp_parser.y"
+#line 1012 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2740 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 184:
-/* Line 1787 of yacc.c */
-#line 1016 "../../ntpd/ntp_parser.y"
+#line 1017 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2749 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 185:
-/* Line 1787 of yacc.c */
-#line 1024 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+#line 1025 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 2755 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 189:
-/* Line 1787 of yacc.c */
-#line 1040 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.enable_opts, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+#line 1041 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.enable_opts, (yyvsp[0].Attr_val_fifo)); }
+#line 2761 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 190:
-/* Line 1787 of yacc.c */
-#line 1042 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.disable_opts, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+#line 1043 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.disable_opts, (yyvsp[0].Attr_val_fifo)); }
+#line 2767 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 191:
-/* Line 1787 of yacc.c */
-#line 1047 "../../ntpd/ntp_parser.y"
+#line 1048 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2776 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 192:
-/* Line 1787 of yacc.c */
-#line 1052 "../../ntpd/ntp_parser.y"
+#line 1053 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2785 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 193:
-/* Line 1787 of yacc.c */
-#line 1060 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); }
+#line 1061 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer)); }
+#line 2791 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 194:
-/* Line 1787 of yacc.c */
-#line 1062 "../../ntpd/ntp_parser.y"
+#line 1063 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
- (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer));
+ (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer));
} else {
char err_str[128];
(yyval.Attr_val) = NULL;
snprintf(err_str, sizeof(err_str),
"enable/disable %s remote configuration ignored",
- keyword((yyvsp[(1) - (1)].Integer)));
+ keyword((yyvsp[0].Integer)));
yyerror(err_str);
}
}
+#line 2809 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 206:
-/* Line 1787 of yacc.c */
-#line 1100 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.tinker, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+ case 207:
+#line 1102 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.tinker, (yyvsp[0].Attr_val_fifo)); }
+#line 2815 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 207:
-/* Line 1787 of yacc.c */
-#line 1105 "../../ntpd/ntp_parser.y"
+ case 208:
+#line 1107 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2824 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 208:
-/* Line 1787 of yacc.c */
-#line 1110 "../../ntpd/ntp_parser.y"
+ case 209:
+#line 1112 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 2833 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 209:
-/* Line 1787 of yacc.c */
-#line 1118 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); }
+ case 210:
+#line 1120 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-1].Integer), (yyvsp[0].Double)); }
+#line 2839 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 222:
-/* Line 1787 of yacc.c */
-#line 1143 "../../ntpd/ntp_parser.y"
+ case 223:
+#line 1145 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *av;
- av = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double));
+ av = create_attr_dval((yyvsp[-1].Integer), (yyvsp[0].Double));
APPEND_G_FIFO(cfgt.vars, av);
}
+#line 2850 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 223:
-/* Line 1787 of yacc.c */
-#line 1150 "../../ntpd/ntp_parser.y"
+ case 224:
+#line 1152 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *av;
- av = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer));
+ av = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer));
APPEND_G_FIFO(cfgt.vars, av);
}
+#line 2861 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 224:
-/* Line 1787 of yacc.c */
-#line 1157 "../../ntpd/ntp_parser.y"
+ case 225:
+#line 1159 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *av;
- av = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String));
+ av = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String));
APPEND_G_FIFO(cfgt.vars, av);
}
+#line 2872 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 225:
-/* Line 1787 of yacc.c */
-#line 1164 "../../ntpd/ntp_parser.y"
+ case 226:
+#line 1166 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
char error_text[64];
attr_val *av;
if (lex_from_file()) {
- av = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String));
+ av = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String));
APPEND_G_FIFO(cfgt.vars, av);
} else {
- YYFREE((yyvsp[(2) - (2)].String));
+ YYFREE((yyvsp[0].String));
snprintf(error_text, sizeof(error_text),
"%s remote config ignored",
- keyword((yyvsp[(1) - (2)].Integer)));
+ keyword((yyvsp[-1].Integer)));
yyerror(error_text);
}
}
+#line 2892 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 226:
-/* Line 1787 of yacc.c */
-#line 1180 "../../ntpd/ntp_parser.y"
+ case 227:
+#line 1182 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (!lex_from_file()) {
- YYFREE((yyvsp[(2) - (3)].String)); /* avoid leak */
+ YYFREE((yyvsp[-1].String)); /* avoid leak */
yyerror("remote includefile ignored");
break;
}
@@ -3131,108 +2903,108 @@ yyreduce:
fprintf(stderr, "getconfig: Maximum include file level exceeded.\n");
msyslog(LOG_ERR, "getconfig: Maximum include file level exceeded.");
} else {
- const char * path = FindConfig((yyvsp[(2) - (3)].String)); /* might return $2! */
+ const char * path = FindConfig((yyvsp[-1].String)); /* might return $2! */
if (!lex_push_file(path, "r")) {
fprintf(stderr, "getconfig: Couldn't open <%s>\n", path);
msyslog(LOG_ERR, "getconfig: Couldn't open <%s>", path);
}
}
- YYFREE((yyvsp[(2) - (3)].String)); /* avoid leak */
+ YYFREE((yyvsp[-1].String)); /* avoid leak */
}
- break;
-
- case 227:
-/* Line 1787 of yacc.c */
-#line 1199 "../../ntpd/ntp_parser.y"
- { lex_flush_stack(); }
+#line 2915 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 228:
-/* Line 1787 of yacc.c */
-#line 1201 "../../ntpd/ntp_parser.y"
- { /* see drift_parm below for actions */ }
+#line 1201 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { lex_flush_stack(); }
+#line 2921 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 229:
-/* Line 1787 of yacc.c */
-#line 1203 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.logconfig, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+#line 1203 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { /* see drift_parm below for actions */ }
+#line 2927 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 230:
-/* Line 1787 of yacc.c */
-#line 1205 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.phone, (yyvsp[(2) - (2)].String_fifo)); }
+#line 1205 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.logconfig, (yyvsp[0].Attr_val_fifo)); }
+#line 2933 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 231:
-/* Line 1787 of yacc.c */
-#line 1207 "../../ntpd/ntp_parser.y"
- { APPEND_G_FIFO(cfgt.setvar, (yyvsp[(2) - (2)].Set_var)); }
+#line 1207 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.phone, (yyvsp[0].String_fifo)); }
+#line 2939 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 232:
-/* Line 1787 of yacc.c */
-#line 1209 "../../ntpd/ntp_parser.y"
+#line 1209 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { APPEND_G_FIFO(cfgt.setvar, (yyvsp[0].Set_var)); }
+#line 2945 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+ break;
+
+ case 233:
+#line 1211 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
addr_opts_node *aon;
- aon = create_addr_opts_node((yyvsp[(2) - (3)].Address_node), (yyvsp[(3) - (3)].Attr_val_fifo));
+ aon = create_addr_opts_node((yyvsp[-1].Address_node), (yyvsp[0].Attr_val_fifo));
APPEND_G_FIFO(cfgt.trap, aon);
}
+#line 2956 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 233:
-/* Line 1787 of yacc.c */
-#line 1216 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.ttl, (yyvsp[(2) - (2)].Attr_val_fifo)); }
+ case 234:
+#line 1218 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.ttl, (yyvsp[0].Attr_val_fifo)); }
+#line 2962 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 238:
-/* Line 1787 of yacc.c */
-#line 1231 "../../ntpd/ntp_parser.y"
+ case 239:
+#line 1233 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
#ifndef LEAP_SMEAR
yyerror("Built without LEAP_SMEAR support.");
#endif
}
+#line 2972 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 244:
-/* Line 1787 of yacc.c */
-#line 1251 "../../ntpd/ntp_parser.y"
+ case 245:
+#line 1253 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
attr_val *av;
- av = create_attr_sval(T_Driftfile, (yyvsp[(1) - (1)].String));
+ av = create_attr_sval(T_Driftfile, (yyvsp[0].String));
APPEND_G_FIFO(cfgt.vars, av);
} else {
- YYFREE((yyvsp[(1) - (1)].String));
+ YYFREE((yyvsp[0].String));
yyerror("driftfile remote configuration ignored");
}
}
+#line 2987 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 245:
-/* Line 1787 of yacc.c */
-#line 1262 "../../ntpd/ntp_parser.y"
+ case 246:
+#line 1264 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
attr_val *av;
- av = create_attr_sval(T_Driftfile, (yyvsp[(1) - (2)].String));
+ av = create_attr_sval(T_Driftfile, (yyvsp[-1].String));
APPEND_G_FIFO(cfgt.vars, av);
- av = create_attr_dval(T_WanderThreshold, (yyvsp[(2) - (2)].Double));
+ av = create_attr_dval(T_WanderThreshold, (yyvsp[0].Double));
APPEND_G_FIFO(cfgt.vars, av);
} else {
- YYFREE((yyvsp[(1) - (2)].String));
+ YYFREE((yyvsp[-1].String));
yyerror("driftfile remote configuration ignored");
}
}
+#line 3004 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 246:
-/* Line 1787 of yacc.c */
-#line 1275 "../../ntpd/ntp_parser.y"
+ case 247:
+#line 1277 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
attr_val *av;
@@ -3242,386 +3014,386 @@ yyreduce:
yyerror("driftfile remote configuration ignored");
}
}
+#line 3018 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 247:
-/* Line 1787 of yacc.c */
-#line 1288 "../../ntpd/ntp_parser.y"
- { (yyval.Set_var) = create_setvar_node((yyvsp[(1) - (4)].String), (yyvsp[(3) - (4)].String), (yyvsp[(4) - (4)].Integer)); }
+ case 248:
+#line 1290 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Set_var) = create_setvar_node((yyvsp[-3].String), (yyvsp[-1].String), (yyvsp[0].Integer)); }
+#line 3024 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 249:
-/* Line 1787 of yacc.c */
-#line 1294 "../../ntpd/ntp_parser.y"
+ case 250:
+#line 1296 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = 0; }
+#line 3030 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 250:
-/* Line 1787 of yacc.c */
-#line 1299 "../../ntpd/ntp_parser.y"
+ case 251:
+#line 1301 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val_fifo) = NULL; }
+#line 3036 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 251:
-/* Line 1787 of yacc.c */
-#line 1301 "../../ntpd/ntp_parser.y"
+ case 252:
+#line 1303 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 3045 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 252:
-/* Line 1787 of yacc.c */
-#line 1309 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); }
+ case 253:
+#line 1311 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
+#line 3051 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 253:
-/* Line 1787 of yacc.c */
-#line 1311 "../../ntpd/ntp_parser.y"
+ case 254:
+#line 1313 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), estrdup((yyvsp[(2) - (2)].Address_node)->address));
- destroy_address_node((yyvsp[(2) - (2)].Address_node));
+ (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), estrdup((yyvsp[0].Address_node)->address));
+ destroy_address_node((yyvsp[0].Address_node));
}
+#line 3060 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 254:
-/* Line 1787 of yacc.c */
-#line 1319 "../../ntpd/ntp_parser.y"
+ case 255:
+#line 1321 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 3069 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 255:
-/* Line 1787 of yacc.c */
-#line 1324 "../../ntpd/ntp_parser.y"
+ case 256:
+#line 1326 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 3078 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 256:
-/* Line 1787 of yacc.c */
-#line 1332 "../../ntpd/ntp_parser.y"
+ case 257:
+#line 1334 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
char prefix;
char * type;
- switch ((yyvsp[(1) - (1)].String)[0]) {
+ switch ((yyvsp[0].String)[0]) {
case '+':
case '-':
case '=':
- prefix = (yyvsp[(1) - (1)].String)[0];
- type = (yyvsp[(1) - (1)].String) + 1;
+ prefix = (yyvsp[0].String)[0];
+ type = (yyvsp[0].String) + 1;
break;
default:
prefix = '=';
- type = (yyvsp[(1) - (1)].String);
+ type = (yyvsp[0].String);
}
(yyval.Attr_val) = create_attr_sval(prefix, estrdup(type));
- YYFREE((yyvsp[(1) - (1)].String));
+ YYFREE((yyvsp[0].String));
}
+#line 3104 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 257:
-/* Line 1787 of yacc.c */
-#line 1357 "../../ntpd/ntp_parser.y"
+ case 258:
+#line 1359 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
nic_rule_node *nrn;
- nrn = create_nic_rule_node((yyvsp[(3) - (3)].Integer), NULL, (yyvsp[(2) - (3)].Integer));
+ nrn = create_nic_rule_node((yyvsp[0].Integer), NULL, (yyvsp[-1].Integer));
APPEND_G_FIFO(cfgt.nic_rules, nrn);
}
+#line 3115 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 258:
-/* Line 1787 of yacc.c */
-#line 1364 "../../ntpd/ntp_parser.y"
+ case 259:
+#line 1366 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
nic_rule_node *nrn;
- nrn = create_nic_rule_node(0, (yyvsp[(3) - (3)].String), (yyvsp[(2) - (3)].Integer));
+ nrn = create_nic_rule_node(0, (yyvsp[0].String), (yyvsp[-1].Integer));
APPEND_G_FIFO(cfgt.nic_rules, nrn);
}
- break;
-
- case 268:
-/* Line 1787 of yacc.c */
-#line 1392 "../../ntpd/ntp_parser.y"
- { CONCAT_G_FIFOS(cfgt.reset_counters, (yyvsp[(2) - (2)].Int_fifo)); }
+#line 3126 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 269:
-/* Line 1787 of yacc.c */
-#line 1397 "../../ntpd/ntp_parser.y"
- {
- (yyval.Int_fifo) = (yyvsp[(1) - (2)].Int_fifo);
- APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[(2) - (2)].Integer)));
- }
+#line 1394 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { CONCAT_G_FIFOS(cfgt.reset_counters, (yyvsp[0].Int_fifo)); }
+#line 3132 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 270:
-/* Line 1787 of yacc.c */
-#line 1402 "../../ntpd/ntp_parser.y"
+#line 1399 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Int_fifo) = NULL;
- APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[(1) - (1)].Integer)));
+ (yyval.Int_fifo) = (yyvsp[-1].Int_fifo);
+ APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 3141 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 278:
-/* Line 1787 of yacc.c */
-#line 1426 "../../ntpd/ntp_parser.y"
+ case 271:
+#line 1404 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), create_int_node((yyvsp[(2) - (2)].Integer)));
+ (yyval.Int_fifo) = NULL;
+ APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 3150 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 279:
-/* Line 1787 of yacc.c */
-#line 1431 "../../ntpd/ntp_parser.y"
+#line 1428 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), create_int_node((yyvsp[(1) - (1)].Integer)));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 3159 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 280:
-/* Line 1787 of yacc.c */
-#line 1439 "../../ntpd/ntp_parser.y"
+#line 1433 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (2)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (2)].Attr_val));
+ (yyval.Attr_val_fifo) = NULL;
+ APPEND_G_FIFO((yyval.Attr_val_fifo), create_int_node((yyvsp[0].Integer)));
}
+#line 3168 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 281:
-/* Line 1787 of yacc.c */
-#line 1444 "../../ntpd/ntp_parser.y"
+#line 1441 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (1)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
+#line 3177 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 282:
-/* Line 1787 of yacc.c */
-#line 1452 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_ival('i', (yyvsp[(1) - (1)].Integer)); }
+#line 1446 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ {
+ (yyval.Attr_val_fifo) = NULL;
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
+ }
+#line 3186 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 284:
-/* Line 1787 of yacc.c */
-#line 1458 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_rangeval('-', (yyvsp[(2) - (5)].Integer), (yyvsp[(4) - (5)].Integer)); }
+ case 283:
+#line 1454 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_ival('i', (yyvsp[0].Integer)); }
+#line 3192 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 285:
-/* Line 1787 of yacc.c */
-#line 1463 "../../ntpd/ntp_parser.y"
- {
- (yyval.String_fifo) = (yyvsp[(1) - (2)].String_fifo);
- APPEND_G_FIFO((yyval.String_fifo), create_string_node((yyvsp[(2) - (2)].String)));
- }
+#line 1460 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_rangeval('-', (yyvsp[-3].Integer), (yyvsp[-1].Integer)); }
+#line 3198 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 286:
-/* Line 1787 of yacc.c */
-#line 1468 "../../ntpd/ntp_parser.y"
+#line 1465 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.String_fifo) = NULL;
- APPEND_G_FIFO((yyval.String_fifo), create_string_node((yyvsp[(1) - (1)].String)));
+ (yyval.String_fifo) = (yyvsp[-1].String_fifo);
+ APPEND_G_FIFO((yyval.String_fifo), create_string_node((yyvsp[0].String)));
}
+#line 3207 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 287:
-/* Line 1787 of yacc.c */
-#line 1476 "../../ntpd/ntp_parser.y"
+#line 1470 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Address_fifo) = (yyvsp[(1) - (2)].Address_fifo);
- APPEND_G_FIFO((yyval.Address_fifo), (yyvsp[(2) - (2)].Address_node));
+ (yyval.String_fifo) = NULL;
+ APPEND_G_FIFO((yyval.String_fifo), create_string_node((yyvsp[0].String)));
}
+#line 3216 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 288:
-/* Line 1787 of yacc.c */
-#line 1481 "../../ntpd/ntp_parser.y"
+#line 1478 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Address_fifo) = NULL;
- APPEND_G_FIFO((yyval.Address_fifo), (yyvsp[(1) - (1)].Address_node));
+ (yyval.Address_fifo) = (yyvsp[-1].Address_fifo);
+ APPEND_G_FIFO((yyval.Address_fifo), (yyvsp[0].Address_node));
}
+#line 3225 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 289:
-/* Line 1787 of yacc.c */
-#line 1489 "../../ntpd/ntp_parser.y"
+#line 1483 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ {
+ (yyval.Address_fifo) = NULL;
+ APPEND_G_FIFO((yyval.Address_fifo), (yyvsp[0].Address_node));
+ }
+#line 3234 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+ break;
+
+ case 290:
+#line 1491 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- if ((yyvsp[(1) - (1)].Integer) != 0 && (yyvsp[(1) - (1)].Integer) != 1) {
+ if ((yyvsp[0].Integer) != 0 && (yyvsp[0].Integer) != 1) {
yyerror("Integer value is not boolean (0 or 1). Assuming 1");
(yyval.Integer) = 1;
} else {
- (yyval.Integer) = (yyvsp[(1) - (1)].Integer);
+ (yyval.Integer) = (yyvsp[0].Integer);
}
}
+#line 3247 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 290:
-/* Line 1787 of yacc.c */
-#line 1497 "../../ntpd/ntp_parser.y"
+ case 291:
+#line 1499 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = 1; }
+#line 3253 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 291:
-/* Line 1787 of yacc.c */
-#line 1498 "../../ntpd/ntp_parser.y"
+ case 292:
+#line 1500 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = 0; }
+#line 3259 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 292:
-/* Line 1787 of yacc.c */
-#line 1502 "../../ntpd/ntp_parser.y"
- { (yyval.Double) = (double)(yyvsp[(1) - (1)].Integer); }
+ case 293:
+#line 1504 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Double) = (double)(yyvsp[0].Integer); }
+#line 3265 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 294:
-/* Line 1787 of yacc.c */
-#line 1513 "../../ntpd/ntp_parser.y"
+ case 295:
+#line 1515 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
sim_node *sn;
- sn = create_sim_node((yyvsp[(3) - (5)].Attr_val_fifo), (yyvsp[(4) - (5)].Sim_server_fifo));
+ sn = create_sim_node((yyvsp[-2].Attr_val_fifo), (yyvsp[-1].Sim_server_fifo));
APPEND_G_FIFO(cfgt.sim_details, sn);
/* Revert from ; to \n for end-of-command */
old_config_style = 1;
}
+#line 3279 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 295:
-/* Line 1787 of yacc.c */
-#line 1530 "../../ntpd/ntp_parser.y"
+ case 296:
+#line 1532 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ old_config_style = 0; }
+#line 3285 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 296:
-/* Line 1787 of yacc.c */
-#line 1535 "../../ntpd/ntp_parser.y"
+ case 297:
+#line 1537 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (3)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (3)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-2].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
+#line 3294 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 297:
-/* Line 1787 of yacc.c */
-#line 1540 "../../ntpd/ntp_parser.y"
+ case 298:
+#line 1542 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (2)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
+#line 3303 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 298:
-/* Line 1787 of yacc.c */
-#line 1548 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); }
+ case 299:
+#line 1550 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-2].Integer), (yyvsp[0].Double)); }
+#line 3309 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 301:
-/* Line 1787 of yacc.c */
-#line 1558 "../../ntpd/ntp_parser.y"
+ case 302:
+#line 1560 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Sim_server_fifo) = (yyvsp[(1) - (2)].Sim_server_fifo);
- APPEND_G_FIFO((yyval.Sim_server_fifo), (yyvsp[(2) - (2)].Sim_server));
+ (yyval.Sim_server_fifo) = (yyvsp[-1].Sim_server_fifo);
+ APPEND_G_FIFO((yyval.Sim_server_fifo), (yyvsp[0].Sim_server));
}
+#line 3318 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 302:
-/* Line 1787 of yacc.c */
-#line 1563 "../../ntpd/ntp_parser.y"
+ case 303:
+#line 1565 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Sim_server_fifo) = NULL;
- APPEND_G_FIFO((yyval.Sim_server_fifo), (yyvsp[(1) - (1)].Sim_server));
+ APPEND_G_FIFO((yyval.Sim_server_fifo), (yyvsp[0].Sim_server));
}
- break;
-
- case 303:
-/* Line 1787 of yacc.c */
-#line 1571 "../../ntpd/ntp_parser.y"
- { (yyval.Sim_server) = ONLY_SIM(create_sim_server((yyvsp[(1) - (5)].Address_node), (yyvsp[(3) - (5)].Double), (yyvsp[(4) - (5)].Sim_script_fifo))); }
+#line 3327 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 304:
-/* Line 1787 of yacc.c */
-#line 1576 "../../ntpd/ntp_parser.y"
- { (yyval.Double) = (yyvsp[(3) - (4)].Double); }
+#line 1573 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Sim_server) = ONLY_SIM(create_sim_server((yyvsp[-4].Address_node), (yyvsp[-2].Double), (yyvsp[-1].Sim_script_fifo))); }
+#line 3333 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 305:
-/* Line 1787 of yacc.c */
-#line 1581 "../../ntpd/ntp_parser.y"
- { (yyval.Address_node) = (yyvsp[(3) - (3)].Address_node); }
+#line 1578 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Double) = (yyvsp[-1].Double); }
+#line 3339 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 306:
-/* Line 1787 of yacc.c */
-#line 1586 "../../ntpd/ntp_parser.y"
- {
- (yyval.Sim_script_fifo) = (yyvsp[(1) - (2)].Sim_script_fifo);
- APPEND_G_FIFO((yyval.Sim_script_fifo), (yyvsp[(2) - (2)].Sim_script));
- }
+#line 1583 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Address_node) = (yyvsp[0].Address_node); }
+#line 3345 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 307:
-/* Line 1787 of yacc.c */
-#line 1591 "../../ntpd/ntp_parser.y"
+#line 1588 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Sim_script_fifo) = NULL;
- APPEND_G_FIFO((yyval.Sim_script_fifo), (yyvsp[(1) - (1)].Sim_script));
+ (yyval.Sim_script_fifo) = (yyvsp[-1].Sim_script_fifo);
+ APPEND_G_FIFO((yyval.Sim_script_fifo), (yyvsp[0].Sim_script));
}
+#line 3354 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 308:
-/* Line 1787 of yacc.c */
-#line 1599 "../../ntpd/ntp_parser.y"
- { (yyval.Sim_script) = ONLY_SIM(create_sim_script_info((yyvsp[(3) - (6)].Double), (yyvsp[(5) - (6)].Attr_val_fifo))); }
+#line 1593 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ {
+ (yyval.Sim_script_fifo) = NULL;
+ APPEND_G_FIFO((yyval.Sim_script_fifo), (yyvsp[0].Sim_script));
+ }
+#line 3363 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 309:
-/* Line 1787 of yacc.c */
-#line 1604 "../../ntpd/ntp_parser.y"
+#line 1601 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Sim_script) = ONLY_SIM(create_sim_script_info((yyvsp[-3].Double), (yyvsp[-1].Attr_val_fifo))); }
+#line 3369 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+ break;
+
+ case 310:
+#line 1606 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
- (yyval.Attr_val_fifo) = (yyvsp[(1) - (3)].Attr_val_fifo);
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(2) - (3)].Attr_val));
+ (yyval.Attr_val_fifo) = (yyvsp[-2].Attr_val_fifo);
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
+#line 3378 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 310:
-/* Line 1787 of yacc.c */
-#line 1609 "../../ntpd/ntp_parser.y"
+ case 311:
+#line 1611 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
- APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[(1) - (2)].Attr_val));
+ APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
+#line 3387 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
- case 311:
-/* Line 1787 of yacc.c */
-#line 1617 "../../ntpd/ntp_parser.y"
- { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); }
+ case 312:
+#line 1619 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+ { (yyval.Attr_val) = create_attr_dval((yyvsp[-2].Integer), (yyvsp[0].Double)); }
+#line 3393 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
-/* Line 1787 of yacc.c */
-#line 3625 "ntp_parser.c"
+#line 3397 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -3643,7 +3415,7 @@ yyreduce:
*++yyvsp = yyval;
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -3658,9 +3430,9 @@ yyreduce:
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -3711,20 +3483,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -3743,7 +3515,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -3756,29 +3528,29 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
+ yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -3829,14 +3601,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
+ yystos[*yyssp], yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -3847,13 +3619,9 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-/* Line 2050 of yacc.c */
-#line 1628 "../../ntpd/ntp_parser.y"
+#line 1630 "../../ntpd/ntp_parser.y" /* yacc.c:1906 */
void
diff --git a/contrib/ntp/ntpd/ntp_parser.h b/contrib/ntp/ntpd/ntp_parser.h
index ae729b5..3409e25 100644
--- a/contrib/ntp/ntpd/ntp_parser.h
+++ b/contrib/ntp/ntpd/ntp_parser.h
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,13 +26,13 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
-#ifndef YY_YY_NTP_PARSER_H_INCLUDED
-# define YY_YY_NTP_PARSER_H_INCLUDED
-/* Enabling traces. */
+#ifndef YY_YY_Y_TAB_H_INCLUDED
+# define YY_YY_Y_TAB_H_INCLUDED
+/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
@@ -40,207 +40,207 @@
extern int yydebug;
#endif
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- T_Abbrev = 258,
- T_Age = 259,
- T_All = 260,
- T_Allan = 261,
- T_Allpeers = 262,
- T_Auth = 263,
- T_Autokey = 264,
- T_Automax = 265,
- T_Average = 266,
- T_Bclient = 267,
- T_Beacon = 268,
- T_Broadcast = 269,
- T_Broadcastclient = 270,
- T_Broadcastdelay = 271,
- T_Burst = 272,
- T_Calibrate = 273,
- T_Ceiling = 274,
- T_Clockstats = 275,
- T_Cohort = 276,
- T_ControlKey = 277,
- T_Crypto = 278,
- T_Cryptostats = 279,
- T_Ctl = 280,
- T_Day = 281,
- T_Default = 282,
- T_Digest = 283,
- T_Disable = 284,
- T_Discard = 285,
- T_Dispersion = 286,
- T_Double = 287,
- T_Driftfile = 288,
- T_Drop = 289,
- T_Dscp = 290,
- T_Ellipsis = 291,
- T_Enable = 292,
- T_End = 293,
- T_False = 294,
- T_File = 295,
- T_Filegen = 296,
- T_Filenum = 297,
- T_Flag1 = 298,
- T_Flag2 = 299,
- T_Flag3 = 300,
- T_Flag4 = 301,
- T_Flake = 302,
- T_Floor = 303,
- T_Freq = 304,
- T_Fudge = 305,
- T_Host = 306,
- T_Huffpuff = 307,
- T_Iburst = 308,
- T_Ident = 309,
- T_Ignore = 310,
- T_Incalloc = 311,
- T_Incmem = 312,
- T_Initalloc = 313,
- T_Initmem = 314,
- T_Includefile = 315,
- T_Integer = 316,
- T_Interface = 317,
- T_Intrange = 318,
- T_Io = 319,
- T_Ipv4 = 320,
- T_Ipv4_flag = 321,
- T_Ipv6 = 322,
- T_Ipv6_flag = 323,
- T_Kernel = 324,
- T_Key = 325,
- T_Keys = 326,
- T_Keysdir = 327,
- T_Kod = 328,
- T_Mssntp = 329,
- T_Leapfile = 330,
- T_Leapsmearinterval = 331,
- T_Limited = 332,
- T_Link = 333,
- T_Listen = 334,
- T_Logconfig = 335,
- T_Logfile = 336,
- T_Loopstats = 337,
- T_Lowpriotrap = 338,
- T_Manycastclient = 339,
- T_Manycastserver = 340,
- T_Mask = 341,
- T_Maxage = 342,
- T_Maxclock = 343,
- T_Maxdepth = 344,
- T_Maxdist = 345,
- T_Maxmem = 346,
- T_Maxpoll = 347,
- T_Mdnstries = 348,
- T_Mem = 349,
- T_Memlock = 350,
- T_Minclock = 351,
- T_Mindepth = 352,
- T_Mindist = 353,
- T_Minimum = 354,
- T_Minpoll = 355,
- T_Minsane = 356,
- T_Mode = 357,
- T_Mode7 = 358,
- T_Monitor = 359,
- T_Month = 360,
- T_Mru = 361,
- T_Multicastclient = 362,
- T_Nic = 363,
- T_Nolink = 364,
- T_Nomodify = 365,
- T_Nomrulist = 366,
- T_None = 367,
- T_Nonvolatile = 368,
- T_Nopeer = 369,
- T_Noquery = 370,
- T_Noselect = 371,
- T_Noserve = 372,
- T_Notrap = 373,
- T_Notrust = 374,
- T_Ntp = 375,
- T_Ntpport = 376,
- T_NtpSignDsocket = 377,
- T_Orphan = 378,
- T_Orphanwait = 379,
- T_Panic = 380,
- T_Peer = 381,
- T_Peerstats = 382,
- T_Phone = 383,
- T_Pid = 384,
- T_Pidfile = 385,
- T_Pool = 386,
- T_Port = 387,
- T_Preempt = 388,
- T_Prefer = 389,
- T_Protostats = 390,
- T_Pw = 391,
- T_Randfile = 392,
- T_Rawstats = 393,
- T_Refid = 394,
- T_Requestkey = 395,
- T_Reset = 396,
- T_Restrict = 397,
- T_Revoke = 398,
- T_Rlimit = 399,
- T_Saveconfigdir = 400,
- T_Server = 401,
- T_Setvar = 402,
- T_Source = 403,
- T_Stacksize = 404,
- T_Statistics = 405,
- T_Stats = 406,
- T_Statsdir = 407,
- T_Step = 408,
- T_Stepback = 409,
- T_Stepfwd = 410,
- T_Stepout = 411,
- T_Stratum = 412,
- T_String = 413,
- T_Sys = 414,
- T_Sysstats = 415,
- T_Tick = 416,
- T_Time1 = 417,
- T_Time2 = 418,
- T_Timer = 419,
- T_Timingstats = 420,
- T_Tinker = 421,
- T_Tos = 422,
- T_Trap = 423,
- T_True = 424,
- T_Trustedkey = 425,
- T_Ttl = 426,
- T_Type = 427,
- T_U_int = 428,
- T_UEcrypto = 429,
- T_UEcryptonak = 430,
- T_UEdigest = 431,
- T_Unconfig = 432,
- T_Unpeer = 433,
- T_Version = 434,
- T_WanderThreshold = 435,
- T_Week = 436,
- T_Wildcard = 437,
- T_Xleave = 438,
- T_Year = 439,
- T_Flag = 440,
- T_EOC = 441,
- T_Simulate = 442,
- T_Beep_Delay = 443,
- T_Sim_Duration = 444,
- T_Server_Offset = 445,
- T_Duration = 446,
- T_Freq_Offset = 447,
- T_Wander = 448,
- T_Jitter = 449,
- T_Prop_Delay = 450,
- T_Proc_Delay = 451
- };
+ enum yytokentype
+ {
+ T_Abbrev = 258,
+ T_Age = 259,
+ T_All = 260,
+ T_Allan = 261,
+ T_Allpeers = 262,
+ T_Auth = 263,
+ T_Autokey = 264,
+ T_Automax = 265,
+ T_Average = 266,
+ T_Bclient = 267,
+ T_Beacon = 268,
+ T_Broadcast = 269,
+ T_Broadcastclient = 270,
+ T_Broadcastdelay = 271,
+ T_Burst = 272,
+ T_Calibrate = 273,
+ T_Ceiling = 274,
+ T_Clockstats = 275,
+ T_Cohort = 276,
+ T_ControlKey = 277,
+ T_Crypto = 278,
+ T_Cryptostats = 279,
+ T_Ctl = 280,
+ T_Day = 281,
+ T_Default = 282,
+ T_Digest = 283,
+ T_Disable = 284,
+ T_Discard = 285,
+ T_Dispersion = 286,
+ T_Double = 287,
+ T_Driftfile = 288,
+ T_Drop = 289,
+ T_Dscp = 290,
+ T_Ellipsis = 291,
+ T_Enable = 292,
+ T_End = 293,
+ T_False = 294,
+ T_File = 295,
+ T_Filegen = 296,
+ T_Filenum = 297,
+ T_Flag1 = 298,
+ T_Flag2 = 299,
+ T_Flag3 = 300,
+ T_Flag4 = 301,
+ T_Flake = 302,
+ T_Floor = 303,
+ T_Freq = 304,
+ T_Fudge = 305,
+ T_Host = 306,
+ T_Huffpuff = 307,
+ T_Iburst = 308,
+ T_Ident = 309,
+ T_Ignore = 310,
+ T_Incalloc = 311,
+ T_Incmem = 312,
+ T_Initalloc = 313,
+ T_Initmem = 314,
+ T_Includefile = 315,
+ T_Integer = 316,
+ T_Interface = 317,
+ T_Intrange = 318,
+ T_Io = 319,
+ T_Ipv4 = 320,
+ T_Ipv4_flag = 321,
+ T_Ipv6 = 322,
+ T_Ipv6_flag = 323,
+ T_Kernel = 324,
+ T_Key = 325,
+ T_Keys = 326,
+ T_Keysdir = 327,
+ T_Kod = 328,
+ T_Mssntp = 329,
+ T_Leapfile = 330,
+ T_Leapsmearinterval = 331,
+ T_Limited = 332,
+ T_Link = 333,
+ T_Listen = 334,
+ T_Logconfig = 335,
+ T_Logfile = 336,
+ T_Loopstats = 337,
+ T_Lowpriotrap = 338,
+ T_Manycastclient = 339,
+ T_Manycastserver = 340,
+ T_Mask = 341,
+ T_Maxage = 342,
+ T_Maxclock = 343,
+ T_Maxdepth = 344,
+ T_Maxdist = 345,
+ T_Maxmem = 346,
+ T_Maxpoll = 347,
+ T_Mdnstries = 348,
+ T_Mem = 349,
+ T_Memlock = 350,
+ T_Minclock = 351,
+ T_Mindepth = 352,
+ T_Mindist = 353,
+ T_Minimum = 354,
+ T_Minpoll = 355,
+ T_Minsane = 356,
+ T_Mode = 357,
+ T_Mode7 = 358,
+ T_Monitor = 359,
+ T_Month = 360,
+ T_Mru = 361,
+ T_Multicastclient = 362,
+ T_Nic = 363,
+ T_Nolink = 364,
+ T_Nomodify = 365,
+ T_Nomrulist = 366,
+ T_None = 367,
+ T_Nonvolatile = 368,
+ T_Nopeer = 369,
+ T_Noquery = 370,
+ T_Noselect = 371,
+ T_Noserve = 372,
+ T_Notrap = 373,
+ T_Notrust = 374,
+ T_Ntp = 375,
+ T_Ntpport = 376,
+ T_NtpSignDsocket = 377,
+ T_Orphan = 378,
+ T_Orphanwait = 379,
+ T_PCEdigest = 380,
+ T_Panic = 381,
+ T_Peer = 382,
+ T_Peerstats = 383,
+ T_Phone = 384,
+ T_Pid = 385,
+ T_Pidfile = 386,
+ T_Pool = 387,
+ T_Port = 388,
+ T_Preempt = 389,
+ T_Prefer = 390,
+ T_Protostats = 391,
+ T_Pw = 392,
+ T_Randfile = 393,
+ T_Rawstats = 394,
+ T_Refid = 395,
+ T_Requestkey = 396,
+ T_Reset = 397,
+ T_Restrict = 398,
+ T_Revoke = 399,
+ T_Rlimit = 400,
+ T_Saveconfigdir = 401,
+ T_Server = 402,
+ T_Setvar = 403,
+ T_Source = 404,
+ T_Stacksize = 405,
+ T_Statistics = 406,
+ T_Stats = 407,
+ T_Statsdir = 408,
+ T_Step = 409,
+ T_Stepback = 410,
+ T_Stepfwd = 411,
+ T_Stepout = 412,
+ T_Stratum = 413,
+ T_String = 414,
+ T_Sys = 415,
+ T_Sysstats = 416,
+ T_Tick = 417,
+ T_Time1 = 418,
+ T_Time2 = 419,
+ T_Timer = 420,
+ T_Timingstats = 421,
+ T_Tinker = 422,
+ T_Tos = 423,
+ T_Trap = 424,
+ T_True = 425,
+ T_Trustedkey = 426,
+ T_Ttl = 427,
+ T_Type = 428,
+ T_U_int = 429,
+ T_UEcrypto = 430,
+ T_UEcryptonak = 431,
+ T_UEdigest = 432,
+ T_Unconfig = 433,
+ T_Unpeer = 434,
+ T_Version = 435,
+ T_WanderThreshold = 436,
+ T_Week = 437,
+ T_Wildcard = 438,
+ T_Xleave = 439,
+ T_Year = 440,
+ T_Flag = 441,
+ T_EOC = 442,
+ T_Simulate = 443,
+ T_Beep_Delay = 444,
+ T_Sim_Duration = 445,
+ T_Server_Offset = 446,
+ T_Duration = 447,
+ T_Freq_Offset = 448,
+ T_Wander = 449,
+ T_Jitter = 450,
+ T_Prop_Delay = 451,
+ T_Proc_Delay = 452
+ };
#endif
/* Tokens. */
#define T_Abbrev 258
@@ -365,86 +365,86 @@ extern int yydebug;
#define T_NtpSignDsocket 377
#define T_Orphan 378
#define T_Orphanwait 379
-#define T_Panic 380
-#define T_Peer 381
-#define T_Peerstats 382
-#define T_Phone 383
-#define T_Pid 384
-#define T_Pidfile 385
-#define T_Pool 386
-#define T_Port 387
-#define T_Preempt 388
-#define T_Prefer 389
-#define T_Protostats 390
-#define T_Pw 391
-#define T_Randfile 392
-#define T_Rawstats 393
-#define T_Refid 394
-#define T_Requestkey 395
-#define T_Reset 396
-#define T_Restrict 397
-#define T_Revoke 398
-#define T_Rlimit 399
-#define T_Saveconfigdir 400
-#define T_Server 401
-#define T_Setvar 402
-#define T_Source 403
-#define T_Stacksize 404
-#define T_Statistics 405
-#define T_Stats 406
-#define T_Statsdir 407
-#define T_Step 408
-#define T_Stepback 409
-#define T_Stepfwd 410
-#define T_Stepout 411
-#define T_Stratum 412
-#define T_String 413
-#define T_Sys 414
-#define T_Sysstats 415
-#define T_Tick 416
-#define T_Time1 417
-#define T_Time2 418
-#define T_Timer 419
-#define T_Timingstats 420
-#define T_Tinker 421
-#define T_Tos 422
-#define T_Trap 423
-#define T_True 424
-#define T_Trustedkey 425
-#define T_Ttl 426
-#define T_Type 427
-#define T_U_int 428
-#define T_UEcrypto 429
-#define T_UEcryptonak 430
-#define T_UEdigest 431
-#define T_Unconfig 432
-#define T_Unpeer 433
-#define T_Version 434
-#define T_WanderThreshold 435
-#define T_Week 436
-#define T_Wildcard 437
-#define T_Xleave 438
-#define T_Year 439
-#define T_Flag 440
-#define T_EOC 441
-#define T_Simulate 442
-#define T_Beep_Delay 443
-#define T_Sim_Duration 444
-#define T_Server_Offset 445
-#define T_Duration 446
-#define T_Freq_Offset 447
-#define T_Wander 448
-#define T_Jitter 449
-#define T_Prop_Delay 450
-#define T_Proc_Delay 451
-
-
+#define T_PCEdigest 380
+#define T_Panic 381
+#define T_Peer 382
+#define T_Peerstats 383
+#define T_Phone 384
+#define T_Pid 385
+#define T_Pidfile 386
+#define T_Pool 387
+#define T_Port 388
+#define T_Preempt 389
+#define T_Prefer 390
+#define T_Protostats 391
+#define T_Pw 392
+#define T_Randfile 393
+#define T_Rawstats 394
+#define T_Refid 395
+#define T_Requestkey 396
+#define T_Reset 397
+#define T_Restrict 398
+#define T_Revoke 399
+#define T_Rlimit 400
+#define T_Saveconfigdir 401
+#define T_Server 402
+#define T_Setvar 403
+#define T_Source 404
+#define T_Stacksize 405
+#define T_Statistics 406
+#define T_Stats 407
+#define T_Statsdir 408
+#define T_Step 409
+#define T_Stepback 410
+#define T_Stepfwd 411
+#define T_Stepout 412
+#define T_Stratum 413
+#define T_String 414
+#define T_Sys 415
+#define T_Sysstats 416
+#define T_Tick 417
+#define T_Time1 418
+#define T_Time2 419
+#define T_Timer 420
+#define T_Timingstats 421
+#define T_Tinker 422
+#define T_Tos 423
+#define T_Trap 424
+#define T_True 425
+#define T_Trustedkey 426
+#define T_Ttl 427
+#define T_Type 428
+#define T_U_int 429
+#define T_UEcrypto 430
+#define T_UEcryptonak 431
+#define T_UEdigest 432
+#define T_Unconfig 433
+#define T_Unpeer 434
+#define T_Version 435
+#define T_WanderThreshold 436
+#define T_Week 437
+#define T_Wildcard 438
+#define T_Xleave 439
+#define T_Year 440
+#define T_Flag 441
+#define T_EOC 442
+#define T_Simulate 443
+#define T_Beep_Delay 444
+#define T_Sim_Duration 445
+#define T_Server_Offset 446
+#define T_Duration 447
+#define T_Freq_Offset 448
+#define T_Wander 449
+#define T_Jitter 450
+#define T_Prop_Delay 451
+#define T_Proc_Delay 452
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+
+union YYSTYPE
{
-/* Line 2053 of yacc.c */
-#line 51 "../../ntpd/ntp_parser.y"
+#line 51 "../../ntpd/ntp_parser.y" /* yacc.c:1909 */
char * String;
double Double;
@@ -463,29 +463,17 @@ typedef union YYSTYPE
script_info * Sim_script;
script_info_fifo * Sim_script_fifo;
+#line 467 "../../ntpd/ntp_parser.h" /* yacc.c:1909 */
+};
-/* Line 2053 of yacc.c */
-#line 469 "ntp_parser.h"
-} YYSTYPE;
+typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+
extern YYSTYPE yylval;
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-#endif /* !YY_YY_NTP_PARSER_H_INCLUDED */
+#endif /* !YY_YY_Y_TAB_H_INCLUDED */
diff --git a/contrib/ntp/ntpd/ntp_proto.c b/contrib/ntp/ntpd/ntp_proto.c
index 713a0c2..513b99f 100644
--- a/contrib/ntp/ntpd/ntp_proto.c
+++ b/contrib/ntp/ntpd/ntp_proto.c
@@ -165,7 +165,7 @@ u_long sys_limitrejected; /* rate exceeded */
u_long sys_kodsent; /* KoD sent */
/*
- * Mechanism knobs: how soon do we unpeer()?
+ * Mechanism knobs: how soon do we peer_clear() or unpeer()?
*
* The default way is "on-receipt". If this was a packet from a
* well-behaved source, on-receipt will offer the fastest recovery.
@@ -173,6 +173,7 @@ u_long sys_kodsent; /* KoD sent */
* for a bad-guy to DoS us. So look and see what bites you harder
* and choose according to your environment.
*/
+int peer_clear_digest_early = 1; /* bad digest (TEST5) and Autokey */
int unpeer_crypto_early = 1; /* bad crypto (TEST9) */
int unpeer_crypto_nak_early = 1; /* crypto_NAK (TEST5) */
int unpeer_digest_early = 1; /* bad digest (TEST5) */
@@ -277,10 +278,12 @@ valid_NAK(
u_char hismode
)
{
- int base_packet_length = MIN_V4_PKT_LEN;
- int remainder_size;
- struct pkt *rpkt;
- int keyid;
+ int base_packet_length = MIN_V4_PKT_LEN;
+ int remainder_size;
+ struct pkt * rpkt;
+ int keyid;
+ l_fp p_org; /* origin timestamp */
+ const l_fp * myorg; /* selected peer origin */
/*
* Check to see if there is something beyond the basic packet
@@ -305,7 +308,7 @@ valid_NAK(
hismode != MODE_ACTIVE &&
hismode != MODE_PASSIVE
) {
- return (INVALIDNAK);
+ return INVALIDNAK;
}
/*
@@ -314,18 +317,35 @@ valid_NAK(
rpkt = &rbufp->recv_pkt;
keyid = ntohl(((u_int32 *)rpkt)[base_packet_length / 4]);
if (keyid != 0) {
- return (INVALIDNAK);
+ return INVALIDNAK;
}
/*
* Only valid if peer uses a key
*/
- if (peer->keyid > 0 || peer->flags & FLAG_SKEY) {
- return (VALIDNAK);
+ if (!peer || !peer->keyid || !(peer->flags & FLAG_SKEY)) {
+ return INVALIDNAK;
}
- else {
- return (INVALIDNAK);
+
+ /*
+ * The ORIGIN must match, or this cannot be a valid NAK, either.
+ */
+ NTOHL_FP(&rpkt->org, &p_org);
+ if (peer->flip > 0)
+ myorg = &peer->borg;
+ else
+ myorg = &peer->aorg;
+
+ if (L_ISZERO(&p_org) ||
+ L_ISZERO( myorg) ||
+ !L_ISEQU(&p_org, myorg)) {
+ return INVALIDNAK;
}
+
+ /* If we ever passed all that checks, we should be safe. Well,
+ * as safe as we can ever be with an unauthenticated crypto-nak.
+ */
+ return VALIDNAK;
}
@@ -568,7 +588,7 @@ receive(
int kissCode = NOKISS; /* Kiss Code */
int has_mac; /* length of MAC field */
int authlen; /* offset of MAC field */
- int is_authentic = 0; /* cryptosum ok */
+ int is_authentic = AUTH_NONE; /* cryptosum ok */
int crypto_nak_test; /* result of crypto-NAK check */
int retcode = AM_NOMATCH; /* match code */
keyid_t skeyid = 0; /* key IDs */
@@ -616,6 +636,8 @@ receive(
hisleap = PKT_LEAP(pkt->li_vn_mode);
hismode = (int)PKT_MODE(pkt->li_vn_mode);
hisstratum = PKT_TO_STRATUM(pkt->stratum);
+ INSIST(0 != hisstratum);
+
if (restrict_mask & RES_IGNORE) {
sys_restricted++;
return; /* ignore everything */
@@ -1512,7 +1534,7 @@ receive(
*/
if (L_ISZERO(&p_xmt)) {
peer->flash |= TEST3; /* unsynch */
- if (0 == hisstratum) { /* KoD packet */
+ if (STRATUM_UNSPEC == hisstratum) { /* KoD packet */
peer->bogusorg++; /* for TEST2 or TEST3 */
msyslog(LOG_INFO,
"receive: Unexpected zero transmit timestamp in KoD from %s",
@@ -1531,17 +1553,22 @@ receive(
return;
/*
- * If this is a broadcast mode packet, skip further checking. If
- * an initial volley, bail out now and let the client do its
- * stuff. If the origin timestamp is nonzero, this is an
- * interleaved broadcast. so restart the protocol.
+ * If this is a broadcast mode packet, make sure hisstratum
+ * is appropriate. Don't do anything else here - we wait to
+ * see if this is an interleave broadcast packet until after
+ * we've validated the MAC that SHOULD be provided.
+ *
+ * hisstratum should never be 0.
+ * If hisstratum is 15, then we'll advertise as UNSPEC but
+ * at least we'll be able to sync with the broadcast server.
*/
} else if (hismode == MODE_BROADCAST) {
- if (!L_ISZERO(&p_org) && !(peer->flags & FLAG_XB)) {
- peer->flags |= FLAG_XB;
- peer->aorg = p_xmt;
- peer->borg = rbufp->recv_time;
- report_event(PEVNT_XLEAVE, peer, NULL);
+ if ( 0 == hisstratum
+ || STRATUM_UNSPEC <= hisstratum) {
+ /* Is this a ++sys_declined or ??? */
+ msyslog(LOG_INFO,
+ "receive: Unexpected stratum (%d) in broadcast from %s",
+ hisstratum, ntoa(&peer->srcadr));
return;
}
@@ -1558,7 +1585,7 @@ receive(
* (nonzero) org, rec, and xmt timestamps set to the xmt timestamp
* that we have previously sent out. Watch interleave mode.
*/
- } else if (0 == hisstratum) {
+ } else if (STRATUM_UNSPEC == hisstratum) {
DEBUG_INSIST(!L_ISZERO(&p_xmt));
if ( L_ISZERO(&p_org) /* We checked p_xmt above */
|| L_ISZERO(&p_rec)) {
@@ -1617,6 +1644,7 @@ receive(
*/
} else if (peer->flip == 0) {
INSIST(0 != hisstratum);
+ INSIST(STRATUM_UNSPEC != hisstratum);
if (0) {
} else if (L_ISZERO(&p_org)) {
msyslog(LOG_INFO,
@@ -1654,8 +1682,9 @@ receive(
/*
* Check for valid nonzero timestamp fields.
*/
- } else if (L_ISZERO(&p_org) || L_ISZERO(&p_rec) ||
- L_ISZERO(&peer->dst)) {
+ } else if ( L_ISZERO(&p_org)
+ || L_ISZERO(&p_rec)
+ || L_ISZERO(&peer->dst)) {
peer->flash |= TEST3; /* unsynch */
/*
@@ -1671,6 +1700,8 @@ receive(
return; /* Bogus packet, we are done */
}
+ /**/
+
/*
* If this is a crypto_NAK, the server cannot authenticate a
* client packet. The server might have just changed keys. Clear
@@ -1687,8 +1718,9 @@ receive(
return;
}
#ifdef AUTOKEY
- if (peer->crypto)
+ if (peer->crypto) {
peer_clear(peer, "AUTH");
+ }
#endif /* AUTOKEY */
return;
@@ -1702,28 +1734,78 @@ receive(
*/
} else if (!AUTH(peer->keyid || has_mac ||
(restrict_mask & RES_DONTTRUST), is_authentic)) {
+
+ if (peer->flash & PKT_TEST_MASK) {
+ msyslog(LOG_INFO,
+ "receive: Bad auth in packet with bad timestamps from %s denied - spoof?",
+ ntoa(&peer->srcadr));
+ return;
+ }
+
report_event(PEVNT_AUTH, peer, "digest");
peer->flash |= TEST5; /* bad auth */
peer->badauth++;
if ( has_mac
- && (hismode == MODE_ACTIVE || hismode == MODE_PASSIVE))
+ && ( hismode == MODE_ACTIVE
+ || hismode == MODE_PASSIVE))
fast_xmit(rbufp, MODE_ACTIVE, 0, restrict_mask);
if (peer->flags & FLAG_PREEMPT) {
if (unpeer_digest_early) {
unpeer(peer);
}
- return;
}
#ifdef AUTOKEY
- if (peer->crypto)
+ else if (peer_clear_digest_early && peer->crypto) {
peer_clear(peer, "AUTH");
+ }
#endif /* AUTOKEY */
return;
}
/*
- * Update the state variables.
+ * For broadcast packets:
+ *
+ * HMS: This next line never made much sense to me, even
+ * when it was up higher:
+ * If an initial volley, bail out now and let the
+ * client do its stuff.
+ *
+ * If the packet has not failed authentication, then
+ * - if the origin timestamp is nonzero this is an
+ * interleaved broadcast, so restart the protocol.
+ * - else, this is not an interleaved broadcast packet.
*/
+ if (hismode == MODE_BROADCAST) {
+ if ( is_authentic == AUTH_OK
+ || is_authentic == AUTH_NONE) {
+ if (!L_ISZERO(&p_org)) {
+ if (!(peer->flags & FLAG_XB)) {
+ msyslog(LOG_INFO,
+ "receive: Broadcast server at %s is in interleave mode",
+ ntoa(&peer->srcadr));
+ peer->flags |= FLAG_XB;
+ peer->aorg = p_xmt;
+ peer->borg = rbufp->recv_time;
+ report_event(PEVNT_XLEAVE, peer, NULL);
+ return;
+ }
+ } else if (peer->flags & FLAG_XB) {
+ msyslog(LOG_INFO,
+ "receive: Broadcast server at %s is no longer in interleave mode",
+ ntoa(&peer->srcadr));
+ peer->flags &= ~FLAG_XB;
+ }
+ } else {
+ msyslog(LOG_INFO,
+ "receive: Bad broadcast auth (%d) from %s",
+ is_authentic, ntoa(&peer->srcadr));
+ }
+ }
+
+
+ /*
+ ** Update the state variables.
+ */
if (peer->flip == 0) {
if (hismode != MODE_BROADCAST)
peer->rec = p_xmt;
@@ -1766,6 +1848,12 @@ receive(
return; /* Drop any other kiss code packets */
}
+
+ /*
+ * XXX
+ */
+
+
/*
* If:
* - this is a *cast (uni-, broad-, or m-) server packet
@@ -1963,9 +2051,9 @@ receive(
/*
- * process_packet - Packet Procedure, a la Section 3.4.4 of the
- * specification. Or almost, at least. If we're in here we have a
- * reasonable expectation that we will be having a long term
+ * process_packet - Packet Procedure, a la Section 3.4.4 of RFC-1305
+ * Or almost, at least. If we're in here we have a reasonable
+ * expectation that we will be having a long term
* relationship with this host.
*/
void
@@ -1985,8 +2073,10 @@ process_packet(
double etemp, ftemp, td;
#endif /* ASSYM */
+#if 0
sys_processed++;
peer->processed++;
+#endif
p_del = FPTOD(NTOHS_FP(pkt->rootdelay));
p_offset = 0;
p_disp = FPTOD(NTOHS_FP(pkt->rootdisp));
@@ -1999,6 +2089,39 @@ process_packet(
pversion = PKT_VERSION(pkt->li_vn_mode);
pstratum = PKT_TO_STRATUM(pkt->stratum);
+ /**/
+
+ /**/
+
+ /*
+ * Verify the server is synchronized; that is, the leap bits,
+ * stratum and root distance are valid.
+ */
+ if ( pleap == LEAP_NOTINSYNC /* test 6 */
+ || pstratum < sys_floor || pstratum >= sys_ceiling)
+ peer->flash |= TEST6; /* bad synch or strat */
+ if (p_del / 2 + p_disp >= MAXDISPERSE) /* test 7 */
+ peer->flash |= TEST7; /* bad header */
+
+ /*
+ * If any tests fail at this point, the packet is discarded.
+ * Note that some flashers may have already been set in the
+ * receive() routine.
+ */
+ if (peer->flash & PKT_TEST_MASK) {
+ peer->seldisptoolarge++;
+ DPRINTF(1, ("packet: flash header %04x\n",
+ peer->flash));
+ return;
+ }
+
+ /**/
+
+#if 1
+ sys_processed++;
+ peer->processed++;
+#endif
+
/*
* Capture the header values in the client/peer association..
*/
@@ -2033,27 +2156,7 @@ process_packet(
}
poll_update(peer, peer->hpoll);
- /*
- * Verify the server is synchronized; that is, the leap bits,
- * stratum and root distance are valid.
- */
- if ( pleap == LEAP_NOTINSYNC /* test 6 */
- || pstratum < sys_floor || pstratum >= sys_ceiling)
- peer->flash |= TEST6; /* bad synch or strat */
- if (p_del / 2 + p_disp >= MAXDISPERSE) /* test 7 */
- peer->flash |= TEST7; /* bad header */
-
- /*
- * If any tests fail at this point, the packet is discarded.
- * Note that some flashers may have already been set in the
- * receive() routine.
- */
- if (peer->flash & PKT_TEST_MASK) {
- peer->seldisptoolarge++;
- DPRINTF(1, ("packet: flash header %04x\n",
- peer->flash));
- return;
- }
+ /**/
/*
* If the peer was previously unreachable, raise a trap. In any
@@ -4682,6 +4785,14 @@ proto_config(
break;
/*
+ * Peer_clear Early policy choices
+ */
+
+ case PROTO_PCEDIGEST: /* Digest */
+ peer_clear_digest_early = value;
+ break;
+
+ /*
* Unpeer Early policy choices
*/
diff --git a/contrib/ntp/ntpd/ntpd-opts.c b/contrib/ntp/ntpd/ntpd-opts.c
index 3e9a5c3..f19705b 100644
--- a/contrib/ntp/ntpd/ntpd-opts.c
+++ b/contrib/ntp/ntpd/ntpd-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.c)
*
- * It has been AutoGen-ed April 26, 2016 at 08:26:14 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:32:42 AM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@@ -75,7 +75,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpd options
*/
static char const ntpd_opt_strs[3129] =
-/* 0 */ "ntpd 4.2.8p7\n"
+/* 0 */ "ntpd 4.2.8p8\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -205,12 +205,12 @@ static char const ntpd_opt_strs[3129] =
/* 2900 */ "output version information and exit\0"
/* 2936 */ "version\0"
/* 2944 */ "NTPD\0"
-/* 2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p7\n"
+/* 2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p8\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ <server1> ... <serverN> ]\n\0"
/* 3080 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 3114 */ "\n\0"
-/* 3116 */ "ntpd 4.2.8p7";
+/* 3116 */ "ntpd 4.2.8p8";
/**
* ipv4 option description with
@@ -1529,7 +1529,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdOptions.pzCopyright */
- puts(_("ntpd 4.2.8p7\n\
+ puts(_("ntpd 4.2.8p8\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1670,7 +1670,7 @@ implied warranty.\n"));
puts(_("output version information and exit"));
/* referenced via ntpdOptions.pzUsageTitle */
- puts(_("ntpd - NTP daemon program - Ver. 4.2.8p7\n\
+ puts(_("ntpd - NTP daemon program - Ver. 4.2.8p8\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ <server1> ... <serverN> ]\n"));
@@ -1678,7 +1678,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via ntpdOptions.pzFullVersion */
- puts(_("ntpd 4.2.8p7"));
+ puts(_("ntpd 4.2.8p8"));
/* referenced via ntpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpd/ntpd-opts.h b/contrib/ntp/ntpd/ntpd-opts.h
index 818a531..069673c 100644
--- a/contrib/ntp/ntpd/ntpd-opts.h
+++ b/contrib/ntp/ntpd/ntpd-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.h)
*
- * It has been AutoGen-ed April 26, 2016 at 08:26:13 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:32:40 AM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@@ -106,9 +106,9 @@ typedef enum {
/** count of all options for ntpd */
#define OPTION_CT 38
/** ntpd version */
-#define NTPD_VERSION "4.2.8p7"
+#define NTPD_VERSION "4.2.8p8"
/** Full ntpd version text */
-#define NTPD_FULL_VERSION "ntpd 4.2.8p7"
+#define NTPD_FULL_VERSION "ntpd 4.2.8p8"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpd/ntpd.1ntpdman b/contrib/ntp/ntpd/ntpd.1ntpdman
index 03a3a1c..f449c20 100644
--- a/contrib/ntp/ntpd/ntpd.1ntpdman
+++ b/contrib/ntp/ntpd/ntpd.1ntpdman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd 1ntpdman "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpd 1ntpdman "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-0uayDF/ag-avaqCF)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Jnai2U/ag-Ynaa1U)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:01 AM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntpd.1ntpdmdoc b/contrib/ntp/ntpd/ntpd.1ntpdmdoc
index da8bf97..1621274 100644
--- a/contrib/ntp/ntpd/ntpd.1ntpdmdoc
+++ b/contrib/ntp/ntpd/ntpd.1ntpdmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPD 1ntpdmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:22 AM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntpd.html b/contrib/ntp/ntpd/ntpd.html
index 8c5c2be..077f723 100644
--- a/contrib/ntp/ntpd/ntpd.html
+++ b/contrib/ntp/ntpd/ntpd.html
@@ -39,7 +39,7 @@ The program can operate in any of several modes, including client/server,
symmetric and broadcast modes, and with both symmetric-key and public-key
cryptography.
- <p>This document applies to version 4.2.8p7 of <code>ntpd</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntpd</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpd-Description">ntpd Description</a>: Description
@@ -220,7 +220,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p6
+<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p7
Usage: ntpd [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
[ &lt;server1&gt; ... &lt;serverN&gt; ]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/ntpd/ntpd.man.in b/contrib/ntp/ntpd/ntpd.man.in
index 37ccedb..b1eafe6 100644
--- a/contrib/ntp/ntpd/ntpd.man.in
+++ b/contrib/ntp/ntpd/ntpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd @NTPD_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpd @NTPD_MS@ "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-0uayDF/ag-avaqCF)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Jnai2U/ag-Ynaa1U)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:01 AM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntpd.mdoc.in b/contrib/ntp/ntpd/ntpd.mdoc.in
index 9aa8770..0b7489a 100644
--- a/contrib/ntp/ntpd/ntpd.mdoc.in
+++ b/contrib/ntp/ntpd/ntpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPD @NTPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:22 AM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/refclock_parse.c b/contrib/ntp/ntpd/refclock_parse.c
index eb69dcb..aa9d2f2 100644
--- a/contrib/ntp/ntpd/refclock_parse.c
+++ b/contrib/ntp/ntpd/refclock_parse.c
@@ -2264,8 +2264,8 @@ local_input(
if (debug > 3)
{
printf(
- "parse: local_receive: fd %d PPSAPI seq %ld - PPS %s\n",
- rbufp->fd,
+ "parse: local_receive: fd %ld PPSAPI seq %ld - PPS %s\n",
+ (long)rbufp->fd,
(long)pps_info.assert_sequence + (long)pps_info.clear_sequence,
lfptoa(&parse->parseio.parse_dtime.parse_ptime.fp, 6));
}
@@ -2277,8 +2277,8 @@ local_input(
if (debug > 3)
{
printf(
- "parse: local_receive: fd %d PPSAPI seq assert %ld, seq clear %ld - NO PPS event\n",
- rbufp->fd,
+ "parse: local_receive: fd %ld PPSAPI seq assert %ld, seq clear %ld - NO PPS event\n",
+ (long)rbufp->fd,
(long)pps_info.assert_sequence, (long)pps_info.clear_sequence);
}
}
@@ -2291,8 +2291,8 @@ local_input(
if (debug > 3)
{
printf(
- "parse: local_receive: fd %d PPSAPI time_pps_fetch errno = %d\n",
- rbufp->fd,
+ "parse: local_receive: fd %ld PPSAPI time_pps_fetch errno = %d\n",
+ (long)rbufp->fd,
errno);
}
}
diff --git a/contrib/ntp/ntpdc/invoke-ntpdc.texi b/contrib/ntp/ntpdc/invoke-ntpdc.texi
index fb917df..717904a 100644
--- a/contrib/ntp/ntpdc/invoke-ntpdc.texi
+++ b/contrib/ntp/ntpdc/invoke-ntpdc.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpdc.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:29:05 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:36:54 AM by AutoGen 5.18.5
# From the definitions ntpdc-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -76,7 +76,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7
+ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p8
Usage: ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.c b/contrib/ntp/ntpdc/ntpdc-opts.c
index 2557dac..830f07f 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.c
+++ b/contrib/ntp/ntpdc/ntpdc-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
*
- * It has been AutoGen-ed April 26, 2016 at 08:28:50 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:36:34 AM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -69,7 +69,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpdc options
*/
static char const ntpdc_opt_strs[1911] =
-/* 0 */ "ntpdc 4.2.8p7\n"
+/* 0 */ "ntpdc 4.2.8p8\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -128,14 +128,14 @@ static char const ntpdc_opt_strs[1911] =
/* 1694 */ "no-load-opts\0"
/* 1707 */ "no\0"
/* 1710 */ "NTPDC\0"
-/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7\n"
+/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p8\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1846 */ "$HOME\0"
/* 1852 */ ".\0"
/* 1854 */ ".ntprc\0"
/* 1861 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1895 */ "\n\0"
-/* 1897 */ "ntpdc 4.2.8p7";
+/* 1897 */ "ntpdc 4.2.8p8";
/**
* ipv4 option description with
@@ -796,7 +796,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdcOptions.pzCopyright */
- puts(_("ntpdc 4.2.8p7\n\
+ puts(_("ntpdc 4.2.8p8\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -862,14 +862,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpdcOptions.pzUsageTitle */
- puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7\n\
+ puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p8\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpdcOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpdcOptions.pzFullVersion */
- puts(_("ntpdc 4.2.8p7"));
+ puts(_("ntpdc 4.2.8p8"));
/* referenced via ntpdcOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.h b/contrib/ntp/ntpdc/ntpdc-opts.h
index 8a7e9e0..7bd869e 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.h
+++ b/contrib/ntp/ntpdc/ntpdc-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
*
- * It has been AutoGen-ed April 26, 2016 at 08:28:50 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:36:34 AM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -83,9 +83,9 @@ typedef enum {
/** count of all options for ntpdc */
#define OPTION_CT 15
/** ntpdc version */
-#define NTPDC_VERSION "4.2.8p7"
+#define NTPDC_VERSION "4.2.8p8"
/** Full ntpdc version text */
-#define NTPDC_FULL_VERSION "ntpdc 4.2.8p7"
+#define NTPDC_FULL_VERSION "ntpdc 4.2.8p8"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcman b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
index 8f8a74b..c7055fc 100644
--- a/contrib/ntp/ntpdc/ntpdc.1ntpdcman
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc 1ntpdcman "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpdc 1ntpdcman "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-bTaatH/ag-nTa4rH)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-seaORW/ag-FeaGQW)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:01 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:50 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
index f092396..ac6fae5 100644
--- a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPDC 1ntpdcmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:58 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpdc/ntpdc.c b/contrib/ntp/ntpdc/ntpdc.c
index 8a79d0b..69fe6a5 100644
--- a/contrib/ntp/ntpdc/ntpdc.c
+++ b/contrib/ntp/ntpdc/ntpdc.c
@@ -669,7 +669,7 @@ getresponse(
printf("Received sequence numbers");
for (n = 0; n <= MAXSEQ; n++)
if (haveseq[n])
- printf(" %zd,", n);
+ printf(" %zd,", (size_t)n);
if (lastseq != 999)
printf(" last frame received\n");
else
@@ -691,7 +691,7 @@ getresponse(
*/
if (n < (ssize_t)RESP_HEADER_SIZE) {
if (debug)
- printf("Short (%zd byte) packet received\n", n);
+ printf("Short (%zd byte) packet received\n", (size_t)n);
goto again;
}
if (INFO_VERSION(rpkt.rm_vn_mode) > NTP_VERSION ||
diff --git a/contrib/ntp/ntpdc/ntpdc.html b/contrib/ntp/ntpdc/ntpdc.html
index 5fc295e..0561004 100644
--- a/contrib/ntp/ntpdc/ntpdc.html
+++ b/contrib/ntp/ntpdc/ntpdc.html
@@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server
clock. Run as root, it can correct the system clock to this offset as
well. It can be run as an interactive command or from a cron job.
- <p>This document applies to version 4.2.8p7 of <code>ntpdc</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntpdc</code>.
<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
@@ -152,7 +152,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p7
+<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p8
Usage: ntpdc [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpdc/ntpdc.man.in b/contrib/ntp/ntpdc/ntpdc.man.in
index ac28045..3175905 100644
--- a/contrib/ntp/ntpdc/ntpdc.man.in
+++ b/contrib/ntp/ntpdc/ntpdc.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc @NTPDC_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpdc @NTPDC_MS@ "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-bTaatH/ag-nTa4rH)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-seaORW/ag-FeaGQW)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:01 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:50 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpdc/ntpdc.mdoc.in b/contrib/ntp/ntpdc/ntpdc.mdoc.in
index ead9a50..fdca923 100644
--- a/contrib/ntp/ntpdc/ntpdc.mdoc.in
+++ b/contrib/ntp/ntpdc/ntpdc.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPDC @NTPDC_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:58 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpq/invoke-ntpq.texi b/contrib/ntp/ntpq/invoke-ntpq.texi
index 0829876..28cf6c9 100644
--- a/contrib/ntp/ntpq/invoke-ntpq.texi
+++ b/contrib/ntp/ntpq/invoke-ntpq.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpq.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:29:39 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:37:46 AM by AutoGen 5.18.5
# From the definitions ntpq-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -848,7 +848,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpq - standard NTP query program - Ver. 4.2.8p7
+ntpq - standard NTP query program - Ver. 4.2.8p8
Usage: ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpq/ntpq-opts.c b/contrib/ntp/ntpq/ntpq-opts.c
index a3ff412..b2bb3d9 100644
--- a/contrib/ntp/ntpq/ntpq-opts.c
+++ b/contrib/ntp/ntpq/ntpq-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.c)
*
- * It has been AutoGen-ed April 26, 2016 at 08:29:11 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:37:05 AM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -69,7 +69,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpq options
*/
static char const ntpq_opt_strs[1982] =
-/* 0 */ "ntpq 4.2.8p7\n"
+/* 0 */ "ntpq 4.2.8p8\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -132,13 +132,13 @@ static char const ntpq_opt_strs[1982] =
/* 1775 */ "no-load-opts\0"
/* 1788 */ "no\0"
/* 1791 */ "NTPQ\0"
-/* 1796 */ "ntpq - standard NTP query program - Ver. 4.2.8p7\n"
+/* 1796 */ "ntpq - standard NTP query program - Ver. 4.2.8p8\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1915 */ "$HOME\0"
/* 1921 */ ".\0"
/* 1923 */ ".ntprc\0"
/* 1930 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 1964 */ "ntpq 4.2.8p7\0"
+/* 1964 */ "ntpq 4.2.8p8\0"
/* 1977 */ "hash";
/**
@@ -841,7 +841,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpqOptions.pzCopyright */
- puts(_("ntpq 4.2.8p7\n\
+ puts(_("ntpq 4.2.8p8\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -910,11 +910,11 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpqOptions.pzUsageTitle */
- puts(_("ntpq - standard NTP query program - Ver. 4.2.8p7\n\
+ puts(_("ntpq - standard NTP query program - Ver. 4.2.8p8\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpqOptions.pzFullVersion */
- puts(_("ntpq 4.2.8p7"));
+ puts(_("ntpq 4.2.8p8"));
/* referenced via ntpqOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpq/ntpq-opts.h b/contrib/ntp/ntpq/ntpq-opts.h
index d275471..03fd3a3 100644
--- a/contrib/ntp/ntpq/ntpq-opts.h
+++ b/contrib/ntp/ntpq/ntpq-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
*
- * It has been AutoGen-ed April 26, 2016 at 08:29:10 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:37:04 AM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -84,9 +84,9 @@ typedef enum {
/** count of all options for ntpq */
#define OPTION_CT 16
/** ntpq version */
-#define NTPQ_VERSION "4.2.8p7"
+#define NTPQ_VERSION "4.2.8p8"
/** Full ntpq version text */
-#define NTPQ_FULL_VERSION "ntpq 4.2.8p7"
+#define NTPQ_FULL_VERSION "ntpq 4.2.8p8"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpq/ntpq.1ntpqman b/contrib/ntp/ntpq/ntpq.1ntpqman
index 40f7afe..6270eeb 100644
--- a/contrib/ntp/ntpq/ntpq.1ntpqman
+++ b/contrib/ntp/ntpq/ntpq.1ntpqman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq 1ntpqman "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpq 1ntpqman "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-11aqEI/ag-c2aiDI)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-pGa42X/ag-CGaW1X)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:35 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:37:41 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpq/ntpq.1ntpqmdoc b/contrib/ntp/ntpq/ntpq.1ntpqmdoc
index 7a7be52..9985ecf 100644
--- a/contrib/ntp/ntpq/ntpq.1ntpqmdoc
+++ b/contrib/ntp/ntpq/ntpq.1ntpqmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPQ 1ntpqmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:41 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:37:48 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpq/ntpq.c b/contrib/ntp/ntpq/ntpq.c
index 3710375..ed5c65f 100644
--- a/contrib/ntp/ntpq/ntpq.c
+++ b/contrib/ntp/ntpq/ntpq.c
@@ -1063,7 +1063,7 @@ getresponse(
if (n < shouldbesize) {
printf("Response packet claims %u octets payload, above %ld received\n",
- count, (long)n - CTL_HEADER_LEN);
+ count, (long)(n - CTL_HEADER_LEN));
return ERR_INCOMPLETE;
}
@@ -1196,7 +1196,10 @@ getresponse(
* If we've seen the last fragment, look for holes in the sequence.
* If there aren't any, we're done.
*/
- maybe_final:
+#if !defined(SYS_WINNT) && defined(EINTR)
+ maybe_final:
+#endif
+
if (seenlastfrag && offsets[0] == 0) {
for (f = 1; f < numfrags; f++)
if (offsets[f-1] + counts[f-1] !=
diff --git a/contrib/ntp/ntpq/ntpq.html b/contrib/ntp/ntpq/ntpq.html
index 24ef3d1..8b91763 100644
--- a/contrib/ntp/ntpq/ntpq.html
+++ b/contrib/ntp/ntpq/ntpq.html
@@ -44,7 +44,7 @@ monitor the operational status
and determine the performance of
<code>ntpd</code>, the NTP daemon.
- <p>This document applies to version 4.2.8p7 of <code>ntpq</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntpq</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpq-Description">ntpq Description</a>
@@ -770,7 +770,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p6
+<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p7
Usage: ntpq [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpq/ntpq.man.in b/contrib/ntp/ntpq/ntpq.man.in
index bf74a50..37eec21 100644
--- a/contrib/ntp/ntpq/ntpq.man.in
+++ b/contrib/ntp/ntpq/ntpq.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq @NTPQ_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpq @NTPQ_MS@ "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-11aqEI/ag-c2aiDI)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-pGa42X/ag-CGaW1X)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:35 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:37:41 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpq/ntpq.mdoc.in b/contrib/ntp/ntpq/ntpq.mdoc.in
index 6cf0cc4..576d631 100644
--- a/contrib/ntp/ntpq/ntpq.mdoc.in
+++ b/contrib/ntp/ntpq/ntpq.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPQ @NTPQ_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:41 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:37:48 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi b/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
index b725729..6e6590c 100644
--- a/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
+++ b/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpsnmpd.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:29:54 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:39:15 AM by AutoGen 5.18.5
# From the definitions ntpsnmpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -47,7 +47,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p7
+ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p8
Usage: ntpsnmpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Flg Arg Option-Name Description
-n no nofork Do not fork
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
index 3b394c2..68fcd01 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.c)
*
- * It has been AutoGen-ed April 26, 2016 at 08:29:44 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:37:55 AM by AutoGen 5.18.5
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@@ -61,7 +61,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpsnmpd options
*/
static char const ntpsnmpd_opt_strs[1610] =
-/* 0 */ "ntpsnmpd 4.2.8p7\n"
+/* 0 */ "ntpsnmpd 4.2.8p8\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -101,14 +101,14 @@ static char const ntpsnmpd_opt_strs[1610] =
/* 1414 */ "no-load-opts\0"
/* 1427 */ "no\0"
/* 1430 */ "NTPSNMPD\0"
-/* 1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p7\n"
+/* 1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p8\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 1542 */ "$HOME\0"
/* 1548 */ ".\0"
/* 1550 */ ".ntprc\0"
/* 1557 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1591 */ "\n\0"
-/* 1593 */ "ntpsnmpd 4.2.8p7";
+/* 1593 */ "ntpsnmpd 4.2.8p8";
/**
* nofork option description:
@@ -554,7 +554,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpsnmpdOptions.pzCopyright */
- puts(_("ntpsnmpd 4.2.8p7\n\
+ puts(_("ntpsnmpd 4.2.8p8\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -599,14 +599,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpsnmpdOptions.pzUsageTitle */
- puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p7\n\
+ puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p8\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntpsnmpdOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpsnmpdOptions.pzFullVersion */
- puts(_("ntpsnmpd 4.2.8p7"));
+ puts(_("ntpsnmpd 4.2.8p8"));
/* referenced via ntpsnmpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
index 4f8bb7f..f0a4e84 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.h)
*
- * It has been AutoGen-ed April 26, 2016 at 08:29:43 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:37:55 AM by AutoGen 5.18.5
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@@ -76,9 +76,9 @@ typedef enum {
/** count of all options for ntpsnmpd */
#define OPTION_CT 8
/** ntpsnmpd version */
-#define NTPSNMPD_VERSION "4.2.8p7"
+#define NTPSNMPD_VERSION "4.2.8p8"
/** Full ntpsnmpd version text */
-#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p7"
+#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p8"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
index 4940401..27aaed6 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsnmpd 1ntpsnmpdman "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpsnmpd 1ntpsnmpdman "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-sYaGMJ/ag-EYayLJ)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-IPay_Y/ag-WPaq.Y)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:51 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:11 AM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
index 8e3712d..b89b192 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPSNMPD 1ntpsnmpdmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:57 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:18 AM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.html b/contrib/ntp/ntpsnmpd/ntpsnmpd.html
index d0ce579..6c892e4 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.html
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.html
@@ -42,7 +42,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>The <code>ntpsnmpd</code> utility program is used to monitor NTP daemon <code>ntpd</code>
operations and determine performance. It uses the standard NTP mode 6 control
- <p>This document applies to version 4.2.8p7 of <code>ntpsnmpd</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntpsnmpd</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpsnmpd-Description">ntpsnmpd Description</a>: Description
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in b/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
index 7bd6d9c..882f555 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsnmpd @NTPSNMPD_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH ntpsnmpd @NTPSNMPD_MS@ "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-sYaGMJ/ag-EYayLJ)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-IPay_Y/ag-WPaq.Y)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:51 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:11 AM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in b/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
index 4ef8466..d655b1b 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPSNMPD @NTPSNMPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:57 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:18 AM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/packageinfo.sh b/contrib/ntp/packageinfo.sh
index b9dc5c9..f5916b0 100644
--- a/contrib/ntp/packageinfo.sh
+++ b/contrib/ntp/packageinfo.sh
@@ -83,7 +83,7 @@ CLTAG=NTP_4_2_0
# - Numeric values increment
# - empty 'increments' to 1
# - NEW 'increments' to empty
-point=7
+point=8
### betapoint is normally modified by script.
# ntp-stable Beta number (betapoint)
diff --git a/contrib/ntp/scripts/build/Makefile.am b/contrib/ntp/scripts/build/Makefile.am
index 51a1bbc..a165b1c 100644
--- a/contrib/ntp/scripts/build/Makefile.am
+++ b/contrib/ntp/scripts/build/Makefile.am
@@ -1,7 +1,7 @@
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D \
autogen -L ../sntp/include -L ../sntp/ag-tpl
-noinst_SCRIPTS = mkver
+noinst_SCRIPTS = genAuthors mkver
NULL=
EXTRA_DIST = \
diff --git a/contrib/ntp/scripts/build/Makefile.in b/contrib/ntp/scripts/build/Makefile.in
index d758d61..f33f41d 100644
--- a/contrib/ntp/scripts/build/Makefile.in
+++ b/contrib/ntp/scripts/build/Makefile.in
@@ -133,7 +133,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = mkver
+CONFIG_CLEAN_FILES = genAuthors mkver
CONFIG_CLEAN_VPATH_FILES =
SCRIPTS = $(noinst_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
@@ -156,7 +156,8 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/mkver.in
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/genAuthors.in \
+ $(srcdir)/mkver.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
@@ -427,7 +428,7 @@ top_srcdir = @top_srcdir@
run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D \
autogen -L ../sntp/include -L ../sntp/ag-tpl
-noinst_SCRIPTS = mkver
+noinst_SCRIPTS = genAuthors mkver
NULL =
EXTRA_DIST = \
check--help \
@@ -473,6 +474,8 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+genAuthors: $(top_builddir)/config.status $(srcdir)/genAuthors.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mkver: $(top_builddir)/config.status $(srcdir)/mkver.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
diff --git a/contrib/ntp/scripts/build/genAuthors.in b/contrib/ntp/scripts/build/genAuthors.in
new file mode 100644
index 0000000..f0e49c5
--- /dev/null
+++ b/contrib/ntp/scripts/build/genAuthors.in
@@ -0,0 +1,82 @@
+#! @PATH_PERL@
+
+# DESCRIPTION
+#
+# Make sure we have the list of authors for git imports.
+# Call with the path to the Authors/ subdirectory.
+#
+# AUTHOR
+#
+# Harlan Stenn
+#
+# LICENSE
+#
+# This file is Copyright (c) 2016 Network Time Foundation
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice,
+# author attribution and this notice are preserved. This file is offered
+# as-is, without any warranty.
+
+use strict;
+use warnings;
+
+# Read in the list of known authors.
+# run:
+# bk changes -and:USER: | sort -u
+# to get the list of users who have made commits.
+# Make sure that each of these users is in the set of known authors.
+# Make sure the format of that file is 1 or more lines of the form:
+# user = User Name <user@place>
+#
+# If all of the above is true, exit 0.
+# If there are any problems, squawk and exit 1.
+
+my $bk_u = "bk changes -and:USER: | sort -u |";
+chomp(my $bk_root = `bk root`);
+my $A_path = "$bk_root/BitKeeper/etc/authors.txt";
+my %authors;
+my $problem = 0;
+
+die "bkroot: <$bk_root>, A_path: <$A_path>\n" if (! -r $A_path);
+
+# Process the authors.txt file
+open(my $FILE, '<', $A_path) or die "Could not open <$A_path>: $!\n";
+while (<$FILE>) {
+ chomp;
+ if (/^([\S]+) = ([\V]+) <([\w.-]+\@[\w.-]+)>$/) {
+ # print "Got '$1 = $2 <$3>'\n";
+ $authors{$1} = "";
+ } else {
+ print "In $A_path: unrecognized line: '$_'\n";
+ $problem = 1;
+ }
+}
+close($FILE);
+
+#print "\%authors = ", join(' ', sort keys %authors), "\n";
+
+die "Fix the problem(s) noted above!\n" if $problem;
+
+# Process "bk changes ..."
+
+open(BKU, $bk_u) || die "$0: <$bk_u> failed: $!\n";
+while (<BKU>) {
+ chomp;
+ my $Name = $_;
+ my $name = lc;
+ # print "Got Name <$Name>, name <$name>\n";
+ if (!defined($authors{$Name})) {
+ $problem = 1;
+ print "<$Name> is not a defined author!\n";
+ open(my $FILE, '>>', "$A_path/$name.txt") || die "Cannot create '$A_path/$name.txt': $!\n";
+ print $FILE "$Name = \n";
+ close($FILE);
+ }
+}
+
+die "Fix the problem(s) noted above!\n" if $problem;
+
+# Local Variables: **
+# mode:cperl **
+# End: **
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
index 32d1c67..c52f3f2 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH calc_tickadj 1calc_tickadjman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH calc_tickadj 1calc_tickadjman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-b1aGJu/ag-n1aOIu)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-3laW2J/ag-ema41J)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:11 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:25 AM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
index 0c80ddd..df3de6d 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt CALC_TICKADJ 1calc_tickadjmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (calc_tickadj-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:13 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:27 AM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
index 98dcac8..d27d634 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">calc_tickadj User's Manual</h2>
<p>This document describes the use of the NTP Project's <code>calc_tickadj</code> program.
-This document applies to version 4.2.8p7 of <code>calc_tickadj</code>.
+This document applies to version 4.2.8p8 of <code>calc_tickadj</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
index 32d1c67..c52f3f2 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH calc_tickadj 1calc_tickadjman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH calc_tickadj 1calc_tickadjman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-b1aGJu/ag-n1aOIu)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-3laW2J/ag-ema41J)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:11 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:25 AM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
index 0c80ddd..df3de6d 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt CALC_TICKADJ 1calc_tickadjmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (calc_tickadj-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:13 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:27 AM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi b/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
index 6ade9e2..3f5e897 100644
--- a/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
+++ b/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-calc_tickadj.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:15 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:24:29 AM by AutoGen 5.18.5
# From the definitions calc_tickadj-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
diff --git a/contrib/ntp/scripts/invoke-plot_summary.texi b/contrib/ntp/scripts/invoke-plot_summary.texi
index a8ba9cc..bfa8a8e 100644
--- a/contrib/ntp/scripts/invoke-plot_summary.texi
+++ b/contrib/ntp/scripts/invoke-plot_summary.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-plot_summary.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:25:00 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:50 AM by AutoGen 5.18.5
# From the definitions plot_summary-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -41,7 +41,7 @@ with a status code of 0.
@exampleindent 0
@example
-plot_summary - plot statistics generated by summary script - Ver. 4.2.8p7
+plot_summary - plot statistics generated by summary script - Ver. 4.2.8p8
USAGE: plot_summary [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
--directory=str Where the summary files are
@@ -101,7 +101,7 @@ This option takes a string argument.
This is string is passed directly to the @code{gnuplot set terminal}
command. Default is @code{x11} if @code{DISPLAY} is set and
@code{dumb} is it's not'. See output from @code(gnuplot -e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
@node plot_summary output-file
@subsection output-file option
@cindex plot_summary-output-file
diff --git a/contrib/ntp/scripts/invoke-summary.texi b/contrib/ntp/scripts/invoke-summary.texi
index 1a10492..43d74b0 100644
--- a/contrib/ntp/scripts/invoke-summary.texi
+++ b/contrib/ntp/scripts/invoke-summary.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-summary.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:25:06 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:58 AM by AutoGen 5.18.5
# From the definitions summary-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -42,7 +42,7 @@ with a status code of 0.
@exampleindent 0
@example
-summary - compute various stastics from NTP stat files - Ver. 4.2.8p7
+summary - compute various stastics from NTP stat files - Ver. 4.2.8p8
USAGE: summary [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
--directory=str Directory containing stat files
diff --git a/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi b/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
index c73f244..3387634 100644
--- a/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
+++ b/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp-wait.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:23 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:24:39 AM by AutoGen 5.18.5
# From the definitions ntp-wait-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -61,7 +61,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p7
+ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p8
USAGE: ntp-wait [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
-n, --tries=num Number of times to check ntpd
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait-opts b/contrib/ntp/scripts/ntp-wait/ntp-wait-opts
index 814432d..e199079 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait-opts
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (ntp-wait-opts)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:18 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:24:33 AM by AutoGen 5.18.5
# From the definitions ntp-wait-opts.def
# and the template file perlopt
@@ -40,7 +40,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p7
+ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p8
USAGE: ntp-wait [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
-n, --tries=num Number of times to check ntpd
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
index 0ee4f82..c3b1c138 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-wait 1ntp-waitman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntp-wait 1ntp-waitman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-LcaO9v/ag-XcaW8v)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-IZaWqL/ag-WZa4pL)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:20 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:36 AM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
index 83f0413..4f1cfde 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_WAIT 1ntp-waitmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-wait-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:26 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:44 AM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.html b/contrib/ntp/scripts/ntp-wait/ntp-wait.html
index 7f57e60..2b790d5 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.html
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.html
@@ -39,7 +39,7 @@ until the system's time has stabilized and synchronized,
and only then start any applicaitons (like database servers) that require
accurate and stable time.
- <p>This document applies to version 4.2.8p7 of <code>ntp-wait</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntp-wait</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -114,7 +114,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p7
+<pre class="example">ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p8
USAGE: ntp-wait [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
-n, --tries=num Number of times to check ntpd
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.in b/contrib/ntp/scripts/ntp-wait/ntp-wait.in
index b35828a..cfccbe0 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.in
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.in
@@ -33,7 +33,7 @@ sub run {
}
if (!exists $info->{status_line}{leap}) {
- print "\bLeap status not avalaible\n";
+ print "\bLeap status not available\n";
return 1;
}
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in b/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
index 2acf43d..2775a88 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-wait @NTP_WAIT_MS@ "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntp-wait @NTP_WAIT_MS@ "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-LcaO9v/ag-XcaW8v)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-IZaWqL/ag-WZa4pL)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:20 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:36 AM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in b/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
index 5bade8e..9dc96d1 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_WAIT @NTP_WAIT_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-wait-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:26 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:44 AM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi b/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
index bdfd9d2..a8d498e 100644
--- a/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
+++ b/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpsweep.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:29 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:24:48 AM by AutoGen 5.18.5
# From the definitions ntpsweep-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -45,7 +45,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
+ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p8
USAGE: ntpsweep [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [hostfile]
-l, --host-list=str Host to execute actions on
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep-opts b/contrib/ntp/scripts/ntpsweep/ntpsweep-opts
index 67896ee..abb519d 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep-opts
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (ntpsweep-opts)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:28 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:24:46 AM by AutoGen 5.18.5
# From the definitions ntpsweep-opts.def
# and the template file perlopt
@@ -43,7 +43,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
+ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p8
USAGE: ntpsweep [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostfile]
-l, --host-list=str Host to execute actions on
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
index f222b60..3cb11a3 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsweep 1ntpsweepman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntpsweep 1ntpsweepman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-L6aGzx/ag-Y6aOyx)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-KKaWSM/ag-XKa4RM)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:32 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:51 AM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
index 716b8e9..d6de8dd 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPSWEEP 1ntpsweepmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsweep-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:35 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:55 AM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.html b/contrib/ntp/scripts/ntpsweep/ntpsweep.html
index fd98e1c..1226459 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.html
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.html
@@ -30,7 +30,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the use of the NTP Project's <code>ntpsweep</code> program.
- <p>This document applies to version 4.2.8p7 of <code>ntpsweep</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntpsweep</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -90,7 +90,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p7
+<pre class="example">ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p8
USAGE: ntpsweep [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [hostfile]
-l, --host-list=str Host to execute actions on
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in b/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
index f222b60..3cb11a3 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsweep 1ntpsweepman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntpsweep 1ntpsweepman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-L6aGzx/ag-Y6aOyx)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-KKaWSM/ag-XKa4RM)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:32 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:51 AM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in b/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
index 716b8e9..d6de8dd 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPSWEEP 1ntpsweepmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsweep-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:35 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:55 AM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi b/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
index e6771a5..e7c2a2c 100644
--- a/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
+++ b/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntptrace.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:42 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:03 AM by AutoGen 5.18.5
# From the definitions ntptrace-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -62,7 +62,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntptrace - Trace peers of an NTP server - Ver. 4.2.8p7
+ntptrace - Trace peers of an NTP server - Ver. 4.2.8p8
USAGE: ntptrace [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [host]
-n, --numeric Print IP addresses instead of hostnames
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace-opts b/contrib/ntp/scripts/ntptrace/ntptrace-opts
index ed41f91..7cc0719 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace-opts
+++ b/contrib/ntp/scripts/ntptrace/ntptrace-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (ntptrace-opts)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:37 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:24:57 AM by AutoGen 5.18.5
# From the definitions ntptrace-opts.def
# and the template file perlopt
@@ -40,7 +40,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-ntptrace - Trace peers of an NTP server - Ver. 4.2.8p7
+ntptrace - Trace peers of an NTP server - Ver. 4.2.8p8
USAGE: ntptrace [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [host]
-n, --numeric Print IP addresses instead of hostnames
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
index 8fb7188..964037d 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntptrace 1ntptraceman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntptrace 1ntptraceman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-1QaORy/ag-bRaWQy)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-GMa4.N/ag-VMaa.N)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:59 AM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
index fb33296..5c33659 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPTRACE 1ntptracemdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntptrace-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:44 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:05 AM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.html b/contrib/ntp/scripts/ntptrace/ntptrace.html
index 4cdf2dc..8b2be15 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.html
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">Simple Network Time Protocol User Manual</h2>
<p>This document describes the use of the NTP Project's <code>ntptrace</code> program.
-This document applies to version 4.2.8p7 of <code>ntptrace</code>.
+This document applies to version 4.2.8p8 of <code>ntptrace</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -107,7 +107,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntptrace - Trace peers of an NTP server - Ver. 4.2.8p7
+<pre class="example">ntptrace - Trace peers of an NTP server - Ver. 4.2.8p8
USAGE: ntptrace [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [host]
-n, --numeric Print IP addresses instead of hostnames
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.man.in b/contrib/ntp/scripts/ntptrace/ntptrace.man.in
index d7c1383..a4aed35 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.man.in
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntptrace @NTPTRACE_MS@ "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntptrace @NTPTRACE_MS@ "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-1QaORy/ag-bRaWQy)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-GMa4.N/ag-VMaa.N)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:24:59 AM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in b/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
index 9a6bc3a..8002291 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPTRACE @NTPTRACE_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntptrace-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:44 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:05 AM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/plot_summary-opts b/contrib/ntp/scripts/plot_summary-opts
index ffb9d3f..27d1712 100644
--- a/contrib/ntp/scripts/plot_summary-opts
+++ b/contrib/ntp/scripts/plot_summary-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (plot_summary-opts)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:56 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:41 AM by AutoGen 5.18.5
# From the definitions plot_summary-opts.def
# and the template file perlopt
@@ -46,7 +46,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-plot_summary - plot statistics generated by summary script - Ver. 4.2.8p7
+plot_summary - plot statistics generated by summary script - Ver. 4.2.8p8
USAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
--directory=str Where the summary files are
diff --git a/contrib/ntp/scripts/plot_summary-opts.def b/contrib/ntp/scripts/plot_summary-opts.def
index 61f028b..3010192 100644
--- a/contrib/ntp/scripts/plot_summary-opts.def
+++ b/contrib/ntp/scripts/plot_summary-opts.def
@@ -62,7 +62,7 @@ flag = {
This is string is passed directly to the @code{gnuplot set terminal}
command. Default is @code{x11} if @code{DISPLAY} is set and
@code{dumb} is it's not'. See output from @code(gnuplot -e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
_EndOfDoc_;
};
diff --git a/contrib/ntp/scripts/plot_summary.1plot_summaryman b/contrib/ntp/scripts/plot_summary.1plot_summaryman
index 38d3134..1decf33 100644
--- a/contrib/ntp/scripts/plot_summary.1plot_summaryman
+++ b/contrib/ntp/scripts/plot_summary.1plot_summaryman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH plot_summary 1plot_summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH plot_summary 1plot_summaryman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaiHB/ag-ssaqGB)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-4QaG0Q/ag-hRaOZQ)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:02 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:53 AM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -74,7 +74,7 @@ Gnuplot terminal.
This is string is passed directly to the \fBgnuplot set terminal\fP
command. Default is \fBx11\fP if \fBDISPLAY\fP is set and
\fBdumb\fP is it's not'. See output from @code(gnuplot \-e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
.TP
.NOP \f\*[B-Font]\-\-output\-file\f[]=\f\*[I-Font]str\f[]
Output file.
diff --git a/contrib/ntp/scripts/plot_summary.1plot_summarymdoc b/contrib/ntp/scripts/plot_summary.1plot_summarymdoc
index 4b598dc..3d6828a 100644
--- a/contrib/ntp/scripts/plot_summary.1plot_summarymdoc
+++ b/contrib/ntp/scripts/plot_summary.1plot_summarymdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt PLOT_SUMMARY 1plot_summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (plot_summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:04 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:55 AM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -55,7 +55,7 @@ Gnuplot terminal.
This is string is passed directly to the \fBgnuplot set terminal\fP
command. Default is \fBx11\fP if \fBDISPLAY\fP is set and
\fBdumb\fP is it's not'. See output from @code(gnuplot \-e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
.It Fl \-output\-file Ns = Ns Ar str
Output file.
.sp
diff --git a/contrib/ntp/scripts/plot_summary.html b/contrib/ntp/scripts/plot_summary.html
index 9bb6228..9feede6 100644
--- a/contrib/ntp/scripts/plot_summary.html
+++ b/contrib/ntp/scripts/plot_summary.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">Plot_summary User Manual</h2>
<p>This document describes the use of the NTP Project's <code>plot_summary</code> program.
-This document applies to version 4.2.8p7 of <code>plot_summary</code>.
+This document applies to version 4.2.8p8 of <code>plot_summary</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -89,7 +89,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">plot_summary - plot statistics generated by summary script - Ver. 4.2.8p7
+<pre class="example">plot_summary - plot statistics generated by summary script - Ver. 4.2.8p8
USAGE: plot_summary [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
--directory=str Where the summary files are
@@ -173,7 +173,7 @@ This option takes a string argument.
This is string is passed directly to the <code>gnuplot set terminal</code>
command. Default is <code>x11</code> if <code>DISPLAY</code> is set and
<code>dumb</code> is it's not'. See output from -e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
<div class="node">
<p><hr>
<a name="plot_005fsummary-output_002dfile"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#plot_005fsummary-exit-status">plot_summary exit status</a>,
diff --git a/contrib/ntp/scripts/plot_summary.man.in b/contrib/ntp/scripts/plot_summary.man.in
index 38d3134..1decf33 100644
--- a/contrib/ntp/scripts/plot_summary.man.in
+++ b/contrib/ntp/scripts/plot_summary.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH plot_summary 1plot_summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH plot_summary 1plot_summaryman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gsaiHB/ag-ssaqGB)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-4QaG0Q/ag-hRaOZQ)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:02 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:53 AM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
@@ -74,7 +74,7 @@ Gnuplot terminal.
This is string is passed directly to the \fBgnuplot set terminal\fP
command. Default is \fBx11\fP if \fBDISPLAY\fP is set and
\fBdumb\fP is it's not'. See output from @code(gnuplot \-e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
.TP
.NOP \f\*[B-Font]\-\-output\-file\f[]=\f\*[I-Font]str\f[]
Output file.
diff --git a/contrib/ntp/scripts/plot_summary.mdoc.in b/contrib/ntp/scripts/plot_summary.mdoc.in
index 4b598dc..3d6828a 100644
--- a/contrib/ntp/scripts/plot_summary.mdoc.in
+++ b/contrib/ntp/scripts/plot_summary.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt PLOT_SUMMARY 1plot_summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (plot_summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:04 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:55 AM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -55,7 +55,7 @@ Gnuplot terminal.
This is string is passed directly to the \fBgnuplot set terminal\fP
command. Default is \fBx11\fP if \fBDISPLAY\fP is set and
\fBdumb\fP is it's not'. See output from @code(gnuplot \-e "set
- terminal") for the list of avalaible options.
+ terminal") for the list of available options.
.It Fl \-output\-file Ns = Ns Ar str
Output file.
.sp
diff --git a/contrib/ntp/scripts/summary-opts b/contrib/ntp/scripts/summary-opts
index e88cd0f..c5da364 100644
--- a/contrib/ntp/scripts/summary-opts
+++ b/contrib/ntp/scripts/summary-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (summary-opts)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:58 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:48 AM by AutoGen 5.18.5
# From the definitions summary-opts.def
# and the template file perlopt
@@ -44,7 +44,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-summary - compute various stastics from NTP stat files - Ver. 4.2.8p7
+summary - compute various stastics from NTP stat files - Ver. 4.2.8p8
USAGE: summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
--directory=str Directory containing stat files
diff --git a/contrib/ntp/scripts/summary.1summaryman b/contrib/ntp/scripts/summary.1summaryman
index 7f02c00..b99aa5c 100644
--- a/contrib/ntp/scripts/summary.1summaryman
+++ b/contrib/ntp/scripts/summary.1summaryman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH summary 1summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH summary 1summaryman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gNaWUB/ag-tNa4TB)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-OuaicR/ag-3uaqbR)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:07 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:26:00 AM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/summary.1summarymdoc b/contrib/ntp/scripts/summary.1summarymdoc
index b72cbcf..b10309a 100644
--- a/contrib/ntp/scripts/summary.1summarymdoc
+++ b/contrib/ntp/scripts/summary.1summarymdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt SUMMARY 1summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:09 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:26:02 AM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/summary.html b/contrib/ntp/scripts/summary.html
index d9ef47a..dedac73 100644
--- a/contrib/ntp/scripts/summary.html
+++ b/contrib/ntp/scripts/summary.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">Summary User Manual</h2>
<p>This document describes the use of the NTP Project's <code>summary</code> program.
-This document applies to version 4.2.8p7 of <code>summary</code>.
+This document applies to version 4.2.8p8 of <code>summary</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -88,7 +88,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">summary - compute various stastics from NTP stat files - Ver. 4.2.8p7
+<pre class="example">summary - compute various stastics from NTP stat files - Ver. 4.2.8p8
USAGE: summary [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
--directory=str Directory containing stat files
diff --git a/contrib/ntp/scripts/summary.man.in b/contrib/ntp/scripts/summary.man.in
index 7f02c00..b99aa5c 100644
--- a/contrib/ntp/scripts/summary.man.in
+++ b/contrib/ntp/scripts/summary.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH summary 1summaryman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH summary 1summaryman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-gNaWUB/ag-tNa4TB)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-OuaicR/ag-3uaqbR)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:07 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:26:00 AM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/summary.mdoc.in b/contrib/ntp/scripts/summary.mdoc.in
index b72cbcf..b10309a 100644
--- a/contrib/ntp/scripts/summary.mdoc.in
+++ b/contrib/ntp/scripts/summary.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt SUMMARY 1summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:25:09 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:26:02 AM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/update-leap/invoke-update-leap.texi b/contrib/ntp/scripts/update-leap/invoke-update-leap.texi
index e4b43a9..3e538f0 100644
--- a/contrib/ntp/scripts/update-leap/invoke-update-leap.texi
+++ b/contrib/ntp/scripts/update-leap/invoke-update-leap.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-update-leap.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:50 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:12 AM by AutoGen 5.18.5
# From the definitions update-leap-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
diff --git a/contrib/ntp/scripts/update-leap/update-leap-opts b/contrib/ntp/scripts/update-leap/update-leap-opts
index a5ca4ee..2f32d66 100644
--- a/contrib/ntp/scripts/update-leap/update-leap-opts
+++ b/contrib/ntp/scripts/update-leap/update-leap-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (update-leap-opts)
#
-# It has been AutoGen-ed April 26, 2016 at 08:24:56 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:25:39 AM by AutoGen 5.18.5
# From the definitions update-leap-opts.def
# and the template file perlopt
@@ -46,7 +46,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-update-leap - leap-seconds file manager/updater - Ver. 4.2.8p7
+update-leap - leap-seconds file manager/updater - Ver. 4.2.8p8
USAGE: update-leap [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
-s, --source-url=str The URL of the master copy of the leapseconds file
diff --git a/contrib/ntp/scripts/update-leap/update-leap.1update-leapman b/contrib/ntp/scripts/update-leap/update-leap.1update-leapman
index 17eda3e..d105806 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.1update-leapman
+++ b/contrib/ntp/scripts/update-leap/update-leap.1update-leapman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH update-leap 1update-leapman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH update-leap 1update-leapman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FCaqHz/ag-RCayGz)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-qJaG0O/ag-DJaOZO)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:46 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:07 AM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc b/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
index e7fd508..2e9c479 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
+++ b/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt UPDATE_LEAP 1update-leapmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (update-leap-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:54 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:37 AM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/update-leap/update-leap.html b/contrib/ntp/scripts/update-leap/update-leap.html
index f7431b4..e2e4ad3 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.html
+++ b/contrib/ntp/scripts/update-leap/update-leap.html
@@ -30,7 +30,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the use of the NTP Project's <code>update-leap</code> program.
- <p>This document applies to version 4.2.8p7 of <code>update-leap</code>.
+ <p>This document applies to version 4.2.8p8 of <code>update-leap</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/scripts/update-leap/update-leap.man.in b/contrib/ntp/scripts/update-leap/update-leap.man.in
index 17eda3e..d105806 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.man.in
+++ b/contrib/ntp/scripts/update-leap/update-leap.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH update-leap 1update-leapman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH update-leap 1update-leapman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FCaqHz/ag-RCayGz)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-qJaG0O/ag-DJaOZO)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:46 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:07 AM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/update-leap/update-leap.mdoc.in b/contrib/ntp/scripts/update-leap/update-leap.mdoc.in
index e7fd508..2e9c479 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.mdoc.in
+++ b/contrib/ntp/scripts/update-leap/update-leap.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt UPDATE_LEAP 1update-leapmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (update-leap-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:24:54 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:25:37 AM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/sntp/Makefile.in b/contrib/ntp/sntp/Makefile.in
index 39f7dc7..73acd4f 100644
--- a/contrib/ntp/sntp/Makefile.in
+++ b/contrib/ntp/sntp/Makefile.in
@@ -126,8 +126,9 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/m4/openldap-thread-check.m4 \
$(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
- $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
diff --git a/contrib/ntp/sntp/aclocal.m4 b/contrib/ntp/sntp/aclocal.m4
index 00ce908..515b2bb 100644
--- a/contrib/ntp/sntp/aclocal.m4
+++ b/contrib/ntp/sntp/aclocal.m4
@@ -1361,3 +1361,4 @@ m4_include([m4/openldap-thread-check.m4])
m4_include([m4/openldap.m4])
m4_include([m4/os_cflags.m4])
m4_include([m4/snprintf.m4])
+m4_include([m4/sntp_problemtests.m4])
diff --git a/contrib/ntp/sntp/configure b/contrib/ntp/sntp/configure
index 75555f6..db89397 100755
--- a/contrib/ntp/sntp/configure
+++ b/contrib/ntp/sntp/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sntp 4.2.8p7.
+# Generated by GNU Autoconf 2.69 for sntp 4.2.8p8.
#
# Report bugs to <http://bugs.ntp.org./>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sntp'
PACKAGE_TARNAME='sntp'
-PACKAGE_VERSION='4.2.8p7'
-PACKAGE_STRING='sntp 4.2.8p7'
+PACKAGE_VERSION='4.2.8p8'
+PACKAGE_STRING='sntp 4.2.8p8'
PACKAGE_BUGREPORT='http://bugs.ntp.org./'
PACKAGE_URL='http://www.ntp.org./'
@@ -636,6 +636,10 @@ enable_option_checking=no
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
+BUILD_TEST_KODFILE_FALSE
+BUILD_TEST_KODFILE_TRUE
+BUILD_TEST_KODDATABASE_FALSE
+BUILD_TEST_KODDATABASE_TRUE
GTEST_AVAILABLE_FALSE
GTEST_AVAILABLE_TRUE
GTEST_CPPFLAGS
@@ -937,6 +941,7 @@ enable_ipv6
with_kame
enable_getifaddrs
with_gtest
+enable_problem_tests
'
ac_precious_vars='build_alias
host_alias
@@ -1491,7 +1496,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sntp 4.2.8p7 to adapt to many kinds of systems.
+\`configure' configures sntp 4.2.8p8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1561,7 +1566,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sntp 4.2.8p7:";;
+ short | recursive ) echo "Configuration of sntp 4.2.8p8:";;
esac
cat <<\_ACEOF
@@ -1596,6 +1601,7 @@ Optional Features:
--enable-ipv6 s use IPv6?
--enable-getifaddrs + Enable the use of getifaddrs() [[yes|no]].
+ --enable-problem-tests + enable tests with undiagnosed problems
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1706,7 +1712,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sntp configure 4.2.8p7
+sntp configure 4.2.8p8
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2536,7 +2542,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sntp $as_me 4.2.8p7, which was
+It was created by sntp $as_me 4.2.8p8, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3533,7 +3539,7 @@ fi
# Define the identity of the package.
PACKAGE='sntp'
- VERSION='4.2.8p7'
+ VERSION='4.2.8p8'
cat >>confdefs.h <<_ACEOF
@@ -30508,6 +30514,63 @@ fi
+
+case "$build" in
+ $host) cross=0 ;;
+ *) cross=1 ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we want to enable tests with undiagnosed problems" >&5
+$as_echo_n "checking if we want to enable tests with undiagnosed problems... " >&6; }
+# Check whether --enable-problem-tests was given.
+if test "${enable_problem_tests+set}" = set; then :
+ enableval=$enable_problem_tests; sntp_ept=$enableval
+else
+ sntp_ept=yes
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sntp_ept" >&5
+$as_echo "$sntp_ept" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can run test-kodDatabase" >&5
+$as_echo_n "checking if we can run test-kodDatabase... " >&6; }
+sntp_test_kodDatabase="no"
+case "$sntp_ept:$cross:$host" in
+ no:0:*-apple-darwin12.6.0) ;;
+ *) sntp_test_kodDatabase="yes" ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sntp_test_kodDatabase" >&5
+$as_echo "$sntp_test_kodDatabase" >&6; }
+ if test x$sntp_test_kodDatabase = xyes; then
+ BUILD_TEST_KODDATABASE_TRUE=
+ BUILD_TEST_KODDATABASE_FALSE='#'
+else
+ BUILD_TEST_KODDATABASE_TRUE='#'
+ BUILD_TEST_KODDATABASE_FALSE=
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can run test-kodFile" >&5
+$as_echo_n "checking if we can run test-kodFile... " >&6; }
+sntp_test_kodFile="no"
+case "$sntp_ept:$cross:$host" in
+ no:0:*-apple-darwin12.6.0) ;;
+ *) sntp_test_kodFile="yes" ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sntp_test_kodFile" >&5
+$as_echo "$sntp_test_kodFile" >&6; }
+ if test x$sntp_test_kodFile = xyes; then
+ BUILD_TEST_KODFILE_TRUE=
+ BUILD_TEST_KODFILE_FALSE='#'
+else
+ BUILD_TEST_KODFILE_TRUE='#'
+ BUILD_TEST_KODFILE_FALSE=
+fi
+
+
+
+
# All libraries should be in various LIB_* variables now.
#LIBS=
# Sadly not. There is a gettext() check somewhere, and on Solaris this pulls
@@ -30716,6 +30779,14 @@ if test -z "${GTEST_AVAILABLE_TRUE}" && test -z "${GTEST_AVAILABLE_FALSE}"; then
as_fn_error $? "conditional \"GTEST_AVAILABLE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${BUILD_TEST_KODDATABASE_TRUE}" && test -z "${BUILD_TEST_KODDATABASE_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_TEST_KODDATABASE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_TEST_KODFILE_TRUE}" && test -z "${BUILD_TEST_KODFILE_FALSE}"; then
+ as_fn_error $? "conditional \"BUILD_TEST_KODFILE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
@@ -31113,7 +31184,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sntp $as_me 4.2.8p7, which was
+This file was extended by sntp $as_me 4.2.8p8, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -31180,7 +31251,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-sntp config.status 4.2.8p7
+sntp config.status 4.2.8p8
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/contrib/ntp/sntp/configure.ac b/contrib/ntp/sntp/configure.ac
index a08aa13..391e586 100644
--- a/contrib/ntp/sntp/configure.ac
+++ b/contrib/ntp/sntp/configure.ac
@@ -143,6 +143,8 @@ NTP_UNITYBUILD
AC_PROG_CXX
NTP_GOOGLETEST
+SNTP_PROBLEM_TESTS
+
# All libraries should be in various LIB_* variables now.
#LIBS=
# Sadly not. There is a gettext() check somewhere, and on Solaris this pulls
diff --git a/contrib/ntp/sntp/include/Makefile.in b/contrib/ntp/sntp/include/Makefile.in
index 1c8a179..e5274a5 100644
--- a/contrib/ntp/sntp/include/Makefile.in
+++ b/contrib/ntp/sntp/include/Makefile.in
@@ -114,8 +114,9 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/m4/openldap-thread-check.m4 \
$(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
- $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
diff --git a/contrib/ntp/sntp/include/version.def b/contrib/ntp/sntp/include/version.def
index a6eb3b4..add303d 100644
--- a/contrib/ntp/sntp/include/version.def
+++ b/contrib/ntp/sntp/include/version.def
@@ -1 +1 @@
-version = '4.2.8p7';
+version = '4.2.8p8';
diff --git a/contrib/ntp/sntp/include/version.texi b/contrib/ntp/sntp/include/version.texi
index d604964..9f303b2 100644
--- a/contrib/ntp/sntp/include/version.texi
+++ b/contrib/ntp/sntp/include/version.texi
@@ -1,3 +1,3 @@
-@set UPDATED 26 April 2016
-@set EDITION 4.2.8p7
-@set VERSION 4.2.8p7
+@set UPDATED 02 June 2016
+@set EDITION 4.2.8p8
+@set VERSION 4.2.8p8
diff --git a/contrib/ntp/sntp/invoke-sntp.texi b/contrib/ntp/sntp/invoke-sntp.texi
index 455dc36..256ff86 100644
--- a/contrib/ntp/sntp/invoke-sntp.texi
+++ b/contrib/ntp/sntp/invoke-sntp.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-sntp.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:21:12 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:19:58 AM by AutoGen 5.18.5
# From the definitions sntp-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -101,7 +101,7 @@ with a status code of 0.
@exampleindent 0
@example
-sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7
+sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p8
Usage: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
[ hostname-or-IP ...]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/sntp/libopts/Makefile.in b/contrib/ntp/sntp/libopts/Makefile.in
index 1f138a2..d98b8a3 100644
--- a/contrib/ntp/sntp/libopts/Makefile.in
+++ b/contrib/ntp/sntp/libopts/Makefile.in
@@ -114,8 +114,9 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/m4/openldap-thread-check.m4 \
$(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
- $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/contrib/ntp/sntp/m4/ntp_problemtests.m4 b/contrib/ntp/sntp/m4/ntp_problemtests.m4
index 7cc14c9..ebc2cd9 100644
--- a/contrib/ntp/sntp/m4/ntp_problemtests.m4
+++ b/contrib/ntp/sntp/m4/ntp_problemtests.m4
@@ -55,5 +55,6 @@ case "$ntp_ept:$cross:$host" in
esac
AC_MSG_RESULT([$ntp_test_ntp_signd])
AM_CONDITIONAL([BUILD_TEST_NTP_SIGND], [test x$ntp_test_ntp_signd = xyes])
+
])
dnl ======================================================================
diff --git a/contrib/ntp/sntp/m4/sntp_problemtests.m4 b/contrib/ntp/sntp/m4/sntp_problemtests.m4
new file mode 100644
index 0000000..fcf7014
--- /dev/null
+++ b/contrib/ntp/sntp/m4/sntp_problemtests.m4
@@ -0,0 +1,47 @@
+dnl ######################################################################
+dnl SNTP_PROBLEM_TESTS
+dnl
+dnl Some platforms have problems building or running certain tests.
+dnl While we're in the initial phase of the deployment of the test
+dnl framework, sometimes we may need to disable these tests.
+dnl
+dnl This is where we do that.
+dnl
+AC_DEFUN([SNTP_PROBLEM_TESTS], [
+case "$build" in
+ $host) cross=0 ;;
+ *) cross=1 ;;
+esac
+
+AC_MSG_CHECKING([if we want to enable tests with undiagnosed problems])
+AC_ARG_ENABLE(
+ [problem-tests],
+ [AS_HELP_STRING(
+ [--enable-problem-tests],
+ [+ enable tests with undiagnosed problems]
+ )],
+ [sntp_ept=$enableval],
+ [sntp_ept=yes]
+)
+AC_MSG_RESULT([$sntp_ept])
+
+AC_MSG_CHECKING([if we can run test-kodDatabase])
+sntp_test_kodDatabase="no"
+case "$sntp_ept:$cross:$host" in
+ no:0:*-apple-darwin12.6.0) ;;
+ *) sntp_test_kodDatabase="yes" ;;
+esac
+AC_MSG_RESULT([$sntp_test_kodDatabase])
+AM_CONDITIONAL([BUILD_TEST_KODDATABASE], [test x$sntp_test_kodDatabase = xyes])
+
+AC_MSG_CHECKING([if we can run test-kodFile])
+sntp_test_kodFile="no"
+case "$sntp_ept:$cross:$host" in
+ no:0:*-apple-darwin12.6.0) ;;
+ *) sntp_test_kodFile="yes" ;;
+esac
+AC_MSG_RESULT([$sntp_test_kodFile])
+AM_CONDITIONAL([BUILD_TEST_KODFILE], [test x$sntp_test_kodFile = xyes])
+
+])
+dnl ======================================================================
diff --git a/contrib/ntp/sntp/m4/version.m4 b/contrib/ntp/sntp/m4/version.m4
index 87597f3..3529730 100644
--- a/contrib/ntp/sntp/m4/version.m4
+++ b/contrib/ntp/sntp/m4/version.m4
@@ -1 +1 @@
-m4_define([VERSION_NUMBER],[4.2.8p7])
+m4_define([VERSION_NUMBER],[4.2.8p8])
diff --git a/contrib/ntp/sntp/scripts/Makefile.in b/contrib/ntp/sntp/scripts/Makefile.in
index 0494fc3..952e7b8 100644
--- a/contrib/ntp/sntp/scripts/Makefile.in
+++ b/contrib/ntp/sntp/scripts/Makefile.in
@@ -113,8 +113,9 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/m4/openldap-thread-check.m4 \
$(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
- $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/contrib/ntp/sntp/sntp-opts.c b/contrib/ntp/sntp/sntp-opts.c
index 71c8ab0..e469d3e 100644
--- a/contrib/ntp/sntp/sntp-opts.c
+++ b/contrib/ntp/sntp/sntp-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (sntp-opts.c)
*
- * It has been AutoGen-ed April 26, 2016 at 08:20:39 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:18:42 AM by AutoGen 5.18.5
* From the definitions sntp-opts.def
* and the template file options
*
@@ -70,7 +70,7 @@ extern FILE * option_usage_fp;
* static const strings for sntp options
*/
static char const sntp_opt_strs[2549] =
-/* 0 */ "sntp 4.2.8p7\n"
+/* 0 */ "sntp 4.2.8p8\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -155,7 +155,7 @@ static char const sntp_opt_strs[2549] =
/* 2298 */ "LOAD_OPTS\0"
/* 2308 */ "no-load-opts\0"
/* 2321 */ "SNTP\0"
-/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7\n"
+/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p8\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ hostname-or-IP ...]\n\0"
/* 2485 */ "$HOME\0"
@@ -163,7 +163,7 @@ static char const sntp_opt_strs[2549] =
/* 2493 */ ".ntprc\0"
/* 2500 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 2534 */ "\n\0"
-/* 2536 */ "sntp 4.2.8p7";
+/* 2536 */ "sntp 4.2.8p8";
/**
* ipv4 option description with
@@ -1173,7 +1173,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via sntpOptions.pzCopyright */
- puts(_("sntp 4.2.8p7\n\
+ puts(_("sntp 4.2.8p8\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1263,7 +1263,7 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via sntpOptions.pzUsageTitle */
- puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7\n\
+ puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p8\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ hostname-or-IP ...]\n"));
@@ -1271,7 +1271,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via sntpOptions.pzFullVersion */
- puts(_("sntp 4.2.8p7"));
+ puts(_("sntp 4.2.8p8"));
/* referenced via sntpOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/sntp/sntp-opts.h b/contrib/ntp/sntp/sntp-opts.h
index 0c8fae6..9136f28 100644
--- a/contrib/ntp/sntp/sntp-opts.h
+++ b/contrib/ntp/sntp/sntp-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (sntp-opts.h)
*
- * It has been AutoGen-ed April 26, 2016 at 08:20:38 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:18:40 AM by AutoGen 5.18.5
* From the definitions sntp-opts.def
* and the template file options
*
@@ -91,9 +91,9 @@ typedef enum {
/** count of all options for sntp */
#define OPTION_CT 23
/** sntp version */
-#define SNTP_VERSION "4.2.8p7"
+#define SNTP_VERSION "4.2.8p8"
/** Full sntp version text */
-#define SNTP_FULL_VERSION "sntp 4.2.8p7"
+#define SNTP_FULL_VERSION "sntp 4.2.8p8"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/sntp/sntp.1sntpman b/contrib/ntp/sntp/sntp.1sntpman
index e0f0553..6921dd3 100644
--- a/contrib/ntp/sntp/sntp.1sntpman
+++ b/contrib/ntp/sntp/sntp.1sntpman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH sntp 1sntpman "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH sntp 1sntpman "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EjaOrb/ag-RjaGqb)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-5CayKq/ag-fDaqJq)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:21:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:19:39 AM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/sntp/sntp.1sntpmdoc b/contrib/ntp/sntp/sntp.1sntpmdoc
index 959ab83..8025d49 100644
--- a/contrib/ntp/sntp/sntp.1sntpmdoc
+++ b/contrib/ntp/sntp/sntp.1sntpmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt SNTP 1sntpmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:21:15 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:20:03 AM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/sntp/sntp.html b/contrib/ntp/sntp/sntp.html
index 2bbb8a1..46bad27 100644
--- a/contrib/ntp/sntp/sntp.html
+++ b/contrib/ntp/sntp/sntp.html
@@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server
clock. Run as root, it can correct the system clock to this offset as
well. It can be run as an interactive command or from a cron job.
- <p>This document applies to version 4.2.8p7 of <code>sntp</code>.
+ <p>This document applies to version 4.2.8p8 of <code>sntp</code>.
<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
@@ -176,7 +176,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p7
+<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p8
Usage: sntp [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
[ hostname-or-IP ...]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/sntp/sntp.man.in b/contrib/ntp/sntp/sntp.man.in
index f136a72..899c49a 100644
--- a/contrib/ntp/sntp/sntp.man.in
+++ b/contrib/ntp/sntp/sntp.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH sntp @SNTP_MS@ "26 Apr 2016" "4.2.8p7" "User Commands"
+.TH sntp @SNTP_MS@ "02 Jun 2016" "4.2.8p8" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EjaOrb/ag-RjaGqb)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-5CayKq/ag-fDaqJq)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:21:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:19:39 AM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/sntp/sntp.mdoc.in b/contrib/ntp/sntp/sntp.mdoc.in
index 00a18e1..71dd224 100644
--- a/contrib/ntp/sntp/sntp.mdoc.in
+++ b/contrib/ntp/sntp/sntp.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt SNTP @SNTP_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:21:15 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:20:03 AM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/sntp/tests/Makefile.am b/contrib/ntp/sntp/tests/Makefile.am
index c5338c7..0e14a87 100644
--- a/contrib/ntp/sntp/tests/Makefile.am
+++ b/contrib/ntp/sntp/tests/Makefile.am
@@ -34,8 +34,6 @@ run_unity = cd $(srcdir) && ruby ../unity/auto/generate_test_runner.rb
check_PROGRAMS = \
test-crypto \
test-keyFile \
- test-kodDatabase \
- test-kodFile \
test-log \
test-networking \
test-packetHandling \
@@ -43,6 +41,14 @@ check_PROGRAMS = \
test-utilities \
$(NULL)
+if BUILD_TEST_KODDATABASE
+check_PROGRAMS += test-kodDatabase
+endif
+
+if BUILD_TEST_KODFILE
+check_PROGRAMS += test-kodFile
+endif
+
noinst_HEADERS = \
sntptest.h \
$(NULL)
diff --git a/contrib/ntp/sntp/tests/Makefile.in b/contrib/ntp/sntp/tests/Makefile.in
index 9803fa8..e557947 100644
--- a/contrib/ntp/sntp/tests/Makefile.in
+++ b/contrib/ntp/sntp/tests/Makefile.in
@@ -90,11 +90,13 @@ build_triplet = @build@
host_triplet = @host@
EXTRA_PROGRAMS =
check_PROGRAMS = test-crypto$(EXEEXT) test-keyFile$(EXEEXT) \
- test-kodDatabase$(EXEEXT) test-kodFile$(EXEEXT) \
test-log$(EXEEXT) test-networking$(EXEEXT) \
test-packetHandling$(EXEEXT) test-packetProcessing$(EXEEXT) \
- test-utilities$(EXEEXT) $(am__EXEEXT_1)
-@NTP_CROSSCOMPILE_FALSE@am__append_1 = $(check_PROGRAMS)
+ test-utilities$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
+ $(am__EXEEXT_3)
+@BUILD_TEST_KODDATABASE_TRUE@am__append_1 = test-kodDatabase
+@BUILD_TEST_KODFILE_TRUE@am__append_2 = test-kodFile
+@NTP_CROSSCOMPILE_FALSE@am__append_3 = $(check_PROGRAMS)
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
@@ -121,8 +123,9 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/m4/openldap-thread-check.m4 \
$(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
- $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(dist_check_SCRIPTS) \
@@ -132,6 +135,8 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = fileHandlingTest.h
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 =
+@BUILD_TEST_KODDATABASE_TRUE@am__EXEEXT_2 = test-kodDatabase$(EXEEXT)
+@BUILD_TEST_KODFILE_TRUE@am__EXEEXT_3 = test-kodFile$(EXEEXT)
am__objects_1 =
am_test_crypto_OBJECTS = test_crypto-crypto.$(OBJEXT) \
test_crypto-run-crypto.$(OBJEXT) test_crypto-version.$(OBJEXT) \
@@ -863,7 +868,7 @@ test_log_SOURCES = \
#$(srcdir)/../version.c: $(srcdir)/../version.c
# gcc -o version.o ../version.c
-TESTS = $(am__append_1)
+TESTS = $(am__append_3)
SNTP_INCS = -I$(top_srcdir)/../include \
-I$(top_srcdir)/../lib/isc/include \
-I$(top_srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/include \
@@ -1270,20 +1275,6 @@ test-keyFile.log: test-keyFile$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
-test-kodDatabase.log: test-kodDatabase$(EXEEXT)
- @p='test-kodDatabase$(EXEEXT)'; \
- b='test-kodDatabase'; \
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
- --log-file $$b.log --trs-file $$b.trs \
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
-test-kodFile.log: test-kodFile$(EXEEXT)
- @p='test-kodFile$(EXEEXT)'; \
- b='test-kodFile'; \
- $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
- --log-file $$b.log --trs-file $$b.trs \
- $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
- "$$tst" $(AM_TESTS_FD_REDIRECT)
test-log.log: test-log$(EXEEXT)
@p='test-log$(EXEEXT)'; \
b='test-log'; \
@@ -1319,6 +1310,20 @@ test-utilities.log: test-utilities$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+test-kodDatabase.log: test-kodDatabase$(EXEEXT)
+ @p='test-kodDatabase$(EXEEXT)'; \
+ b='test-kodDatabase'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-kodFile.log: test-kodFile$(EXEEXT)
+ @p='test-kodFile$(EXEEXT)'; \
+ b='test-kodFile'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \
diff --git a/contrib/ntp/sntp/unity/Makefile.in b/contrib/ntp/sntp/unity/Makefile.in
index a5758b4..e82e55e 100644
--- a/contrib/ntp/sntp/unity/Makefile.in
+++ b/contrib/ntp/sntp/unity/Makefile.in
@@ -114,8 +114,9 @@ am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
$(top_srcdir)/m4/ntp_ver_suffix.m4 \
$(top_srcdir)/m4/openldap-thread-check.m4 \
$(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
- $(top_srcdir)/m4/snprintf.m4 $(top_srcdir)/m4/version.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
diff --git a/contrib/ntp/sntp/version.c b/contrib/ntp/sntp/version.c
index 7eae711..38424f3 100644
--- a/contrib/ntp/sntp/version.c
+++ b/contrib/ntp/sntp/version.c
@@ -2,4 +2,4 @@
* version file for sntp
*/
#include <config.h>
-const char * Version = "sntp 4.2.8p6@1.3265-o Wed Apr 27 00:21:06 UTC 2016 (28)";
+const char * Version = "sntp 4.2.8p7@1.3265-o Thu Jun 2 11:19:34 UTC 2016 (29)";
diff --git a/contrib/ntp/util/invoke-ntp-keygen.texi b/contrib/ntp/util/invoke-ntp-keygen.texi
index 90cef02..cc8a005 100644
--- a/contrib/ntp/util/invoke-ntp-keygen.texi
+++ b/contrib/ntp/util/invoke-ntp-keygen.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp-keygen.texi)
#
-# It has been AutoGen-ed April 26, 2016 at 08:30:20 PM by AutoGen 5.18.5
+# It has been AutoGen-ed June 2, 2016 at 07:39:40 AM by AutoGen 5.18.5
# From the definitions ntp-keygen-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -886,7 +886,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7
+ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p8
Usage: ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/contrib/ntp/util/ntp-keygen-opts.c b/contrib/ntp/util/ntp-keygen-opts.c
index 3799a52..2fb198b 100644
--- a/contrib/ntp/util/ntp-keygen-opts.c
+++ b/contrib/ntp/util/ntp-keygen-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
*
- * It has been AutoGen-ed April 26, 2016 at 08:30:03 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:39:24 AM by AutoGen 5.18.5
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@@ -72,7 +72,7 @@ extern FILE * option_usage_fp;
* static const strings for ntp-keygen options
*/
static char const ntp_keygen_opt_strs[2419] =
-/* 0 */ "ntp-keygen (ntp) 4.2.8p7\n"
+/* 0 */ "ntp-keygen (ntp) 4.2.8p8\n"
"Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -164,14 +164,14 @@ static char const ntp_keygen_opt_strs[2419] =
/* 2202 */ "no-load-opts\0"
/* 2215 */ "no\0"
/* 2218 */ "NTP_KEYGEN\0"
-/* 2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7\n"
+/* 2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p8\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 2343 */ "$HOME\0"
/* 2349 */ ".\0"
/* 2351 */ ".ntprc\0"
/* 2358 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 2392 */ "\n\0"
-/* 2394 */ "ntp-keygen (ntp) 4.2.8p7";
+/* 2394 */ "ntp-keygen (ntp) 4.2.8p8";
/**
* imbits option description:
@@ -1309,7 +1309,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntp_keygenOptions.pzCopyright */
- puts(_("ntp-keygen (ntp) 4.2.8p7\n\
+ puts(_("ntp-keygen (ntp) 4.2.8p8\n\
Copyright (C) 1992-2016 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1408,14 +1408,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntp_keygenOptions.pzUsageTitle */
- puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7\n\
+ puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p8\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntp_keygenOptions.pzExplain */
puts(_("\n"));
/* referenced via ntp_keygenOptions.pzFullVersion */
- puts(_("ntp-keygen (ntp) 4.2.8p7"));
+ puts(_("ntp-keygen (ntp) 4.2.8p8"));
/* referenced via ntp_keygenOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/util/ntp-keygen-opts.h b/contrib/ntp/util/ntp-keygen-opts.h
index a88fdd1..68d6272 100644
--- a/contrib/ntp/util/ntp-keygen-opts.h
+++ b/contrib/ntp/util/ntp-keygen-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
*
- * It has been AutoGen-ed April 26, 2016 at 08:30:02 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed June 2, 2016 at 07:39:23 AM by AutoGen 5.18.5
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@@ -94,9 +94,9 @@ typedef enum {
/** count of all options for ntp-keygen */
#define OPTION_CT 26
/** ntp-keygen version */
-#define NTP_KEYGEN_VERSION "4.2.8p7"
+#define NTP_KEYGEN_VERSION "4.2.8p8"
/** Full ntp-keygen version text */
-#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p7"
+#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p8"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/util/ntp-keygen.1ntp-keygenman b/contrib/ntp/util/ntp-keygen.1ntp-keygenman
index da1bd52..b3c1f2f 100644
--- a/contrib/ntp/util/ntp-keygen.1ntp-keygenman
+++ b/contrib/ntp/util/ntp-keygen.1ntp-keygenman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-keygen 1ntp-keygenman "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntp-keygen 1ntp-keygenman "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FRa4eL/ag-RRaWdL)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-.JaGB0/ag-lKayA0)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:30:15 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:36 AM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc b/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
index 0a7c0fb..0e5a5eb 100644
--- a/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
+++ b/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:30:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:43 AM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/util/ntp-keygen.html b/contrib/ntp/util/ntp-keygen.html
index 30e8485..b7ca2c8 100644
--- a/contrib/ntp/util/ntp-keygen.html
+++ b/contrib/ntp/util/ntp-keygen.html
@@ -70,7 +70,7 @@ All other files are in PEM-encoded
printable ASCII format so they can be embedded as MIME attachments in
mail to other sites.
- <p>This document applies to version 4.2.8p7 of <code>ntp-keygen</code>.
+ <p>This document applies to version 4.2.8p8 of <code>ntp-keygen</code>.
<div class="node">
<p><hr>
@@ -1085,7 +1085,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p6
+<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p7
Usage: ntp-keygen [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/contrib/ntp/util/ntp-keygen.man.in b/contrib/ntp/util/ntp-keygen.man.in
index aa0790a..6c8b5db 100644
--- a/contrib/ntp/util/ntp-keygen.man.in
+++ b/contrib/ntp/util/ntp-keygen.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-keygen @NTP_KEYGEN_MS@ "26 Apr 2016" "ntp (4.2.8p7)" "User Commands"
+.TH ntp-keygen @NTP_KEYGEN_MS@ "02 Jun 2016" "ntp (4.2.8p8)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-FRa4eL/ag-RRaWdL)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-.JaGB0/ag-lKayA0)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:30:15 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:36 AM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/util/ntp-keygen.mdoc.in b/contrib/ntp/util/ntp-keygen.mdoc.in
index 50a8f6a..d108b60 100644
--- a/contrib/ntp/util/ntp-keygen.mdoc.in
+++ b/contrib/ntp/util/ntp-keygen.mdoc.in
@@ -1,9 +1,9 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:30:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:43 AM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index c4886e3..6762e97 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -456,6 +456,8 @@
usr.sbin
etcupdate
..
+ extattr
+ ..
fstyp
..
makefs
diff --git a/etc/ntp/leap-seconds b/etc/ntp/leap-seconds
index 79d8e15..4fab58f 100644
--- a/etc/ntp/leap-seconds
+++ b/etc/ntp/leap-seconds
@@ -130,7 +130,7 @@
# Washington, DC
# jeffrey.prillaman@usno.navy.mil
#
-# Last Update of leap second values: 31 Dec 2015
+# Last Update of leap second values: 11 Jan 2016
#
# The following line shows this last update date in NTP timestamp
# format. This is the date on which the most recent change to
@@ -138,7 +138,7 @@
# be identified by the unique pair of characters in the first two
# columns as shown below.
#
-#$ 3660508800
+#$ 3661459200
#
# The data in this file will be updated periodically as new leap
# seconds are announced. In addition to being entered on the line
@@ -170,10 +170,10 @@
# current -- the update time stamp, the data and the name of the file
# will not change.
#
-# Updated through IERS Bulletin C 50
-# File expires on: 1 Jun 2016
+# Updated through IERS Bulletin C 51
+# File expires on: 1 Dec 2016
#
-#@ 3673728000
+#@ 3689539200
#
2272060800 10 # 1 Jan 1972
2287785600 11 # 1 Jul 1972
@@ -217,5 +217,5 @@
# the hash line is also ignored in the
# computation.
#
-#h 44a44c49 35b22601 a9c7054c 8c56cf57 9b6f6ed5
+#h 63b4df04 0907d94f 2dadb7a1 684f7767 2a372421
#
diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd
index fe2fc4b..91785b3 100755
--- a/etc/rc.d/ntpd
+++ b/etc/rc.d/ntpd
@@ -107,8 +107,8 @@ ntpd_fetch_leapfile() {
$verbose fetching $url
fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile $url && break
done
- ntp_ver_no_tmp=$(get_ntp_leapfile_ver $ntp_tmp_leapfile)
- if [ "$ntp_ver_no_tmp" -gt "$ntp_ver_no_db" ]; then
+ ntp_expiry_tmp=$(get_ntp_leapfile_expiry $ntp_tmp_leapfile)
+ if [ "$ntp_expiry_tmp" -gt "$ntp_leap_expiry" ]; then
$verbose using $url as $ntp_db_leapfile
mv $ntp_tmp_leapfile $ntp_db_leapfile
else
diff --git a/games/fortune/unstr/unstr.c b/games/fortune/unstr/unstr.c
index f79a0ec..77ee1ec 100644
--- a/games/fortune/unstr/unstr.c
+++ b/games/fortune/unstr/unstr.c
@@ -86,13 +86,19 @@ main(int argc, char *argv[])
exit(1);
}
Infile = argv[1];
- strcpy(Datafile, Infile);
- strcat(Datafile, ".dat");
+ if ((size_t)snprintf(Datafile, sizeof(Datafile), "%s.dat", Infile) >=
+ sizeof(Datafile))
+ errx(1, "%s name too long", Infile);
if ((Inf = fopen(Infile, "r")) == NULL)
err(1, "%s", Infile);
if ((Dataf = fopen(Datafile, "r")) == NULL)
err(1, "%s", Datafile);
- fread((char *)&tbl, sizeof(tbl), 1, Dataf);
+ if (fread((char *)&tbl, sizeof(tbl), 1, Dataf) != 1) {
+ if (feof(Dataf))
+ errx(1, "%s read EOF", Datafile);
+ else
+ err(1, "%s read", Datafile);
+ }
tbl.str_version = be32toh(tbl.str_version);
tbl.str_numstr = be32toh(tbl.str_numstr);
tbl.str_longlen = be32toh(tbl.str_longlen);
diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c
index 1be41da..8254a9b 100644
--- a/lib/libc/gen/fts-compat.c
+++ b/lib/libc/gen/fts-compat.c
@@ -114,7 +114,6 @@ static const char *ufslike_filesystems[] = {
"ufs",
"zfs",
"nfs",
- "nfs4",
"ext2fs",
0
};
@@ -586,8 +585,10 @@ __fts_children_44bsd(sp, instr)
if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0)
return (NULL);
sp->fts_child = fts_build(sp, instr);
- if (fchdir(fd))
+ if (fchdir(fd)) {
+ (void)_close(fd);
return (NULL);
+ }
(void)_close(fd);
return (sp->fts_child);
}
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 8083a88..b0623c0 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -104,7 +104,6 @@ static const char *ufslike_filesystems[] = {
"ufs",
"zfs",
"nfs",
- "nfs4",
"ext2fs",
0
};
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index c65a730..2838c5c 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -140,7 +140,7 @@ process_spawnattr(const posix_spawnattr_t sa)
static int
process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
{
- int fd;
+ int fd, saved_errno;
switch (fae->fae_action) {
case FAE_OPEN:
@@ -149,8 +149,11 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
if (fd < 0)
return (errno);
if (fd != fae->fae_fildes) {
- if (_dup2(fd, fae->fae_fildes) == -1)
- return (errno);
+ if (_dup2(fd, fae->fae_fildes) == -1) {
+ saved_errno = errno;
+ (void)_close(fd);
+ return (saved_errno);
+ }
if (_close(fd) != 0) {
if (errno == EBADF)
return (EBADF);
diff --git a/lib/libc/locale/ascii.c b/lib/libc/locale/ascii.c
index 784814d..a70d71a 100644
--- a/lib/libc/locale/ascii.c
+++ b/lib/libc/locale/ascii.c
@@ -143,6 +143,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
nchr = 0;
while (len-- > 0 && nms-- > 0) {
if (*s & 0x80) {
+ *src = s;
errno = EILSEQ;
return ((size_t)-1);
}
@@ -177,6 +178,7 @@ _ascii_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
nchr = 0;
while (len-- > 0 && nwc-- > 0) {
if (*s < 0 || *s > 127) {
+ *src = s;
errno = EILSEQ;
return ((size_t)-1);
}
diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c
index 75adffa..41835ee 100644
--- a/lib/libc/locale/none.c
+++ b/lib/libc/locale/none.c
@@ -172,6 +172,7 @@ _none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src,
nchr = 0;
while (len-- > 0 && nwc-- > 0) {
if (*s < 0 || *s > UCHAR_MAX) {
+ *src = s;
errno = EILSEQ;
return ((size_t)-1);
}
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index 72922f6..2ca971b 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -606,9 +606,9 @@ backref(struct match *m,
return(NULL);
break;
case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
+ if ((sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
+ (sp > m->offp && sp < m->endp &&
+ *(sp-1) == '\n' && (m->g->cflags&REG_NEWLINE)))
{ /* yes */ }
else
return(NULL);
@@ -622,12 +622,9 @@ backref(struct match *m,
return(NULL);
break;
case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
+ if (sp < m->endp && ISWORD(*sp) &&
+ ((sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
+ (sp > m->offp && !ISWORD(*(sp-1)))))
{ /* yes */ }
else
return(NULL);
diff --git a/lib/libc/stdlib/div.c b/lib/libc/stdlib/div.c
index 7dfe553..0bafbe6 100644
--- a/lib/libc/stdlib/div.c
+++ b/lib/libc/stdlib/div.c
@@ -46,6 +46,7 @@ div(num, denom)
r.quot = num / denom;
r.rem = num % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/*
* The ANSI standard says that |r.quot| <= |n/d|, where
* n/d is to be computed in infinite precision. In other
@@ -73,5 +74,6 @@ div(num, denom)
r.quot++;
r.rem -= denom;
}
+#endif
return (r);
}
diff --git a/lib/libc/stdlib/imaxdiv.c b/lib/libc/stdlib/imaxdiv.c
index 7dae467..adcab0b 100644
--- a/lib/libc/stdlib/imaxdiv.c
+++ b/lib/libc/stdlib/imaxdiv.c
@@ -37,9 +37,11 @@ imaxdiv(intmax_t numer, intmax_t denom)
retval.quot = numer / denom;
retval.rem = numer % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
if (numer >= 0 && retval.rem < 0) {
retval.quot++;
retval.rem -= denom;
}
+#endif
return (retval);
}
diff --git a/lib/libc/stdlib/ldiv.c b/lib/libc/stdlib/ldiv.c
index 0ec98e6..745c566 100644
--- a/lib/libc/stdlib/ldiv.c
+++ b/lib/libc/stdlib/ldiv.c
@@ -48,9 +48,11 @@ ldiv(num, denom)
r.quot = num / denom;
r.rem = num % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
if (num >= 0 && r.rem < 0) {
r.quot++;
r.rem -= denom;
}
+#endif
return (r);
}
diff --git a/lib/libc/stdlib/lldiv.c b/lib/libc/stdlib/lldiv.c
index b34b65e..197b48f 100644
--- a/lib/libc/stdlib/lldiv.c
+++ b/lib/libc/stdlib/lldiv.c
@@ -37,9 +37,11 @@ lldiv(long long numer, long long denom)
retval.quot = numer / denom;
retval.rem = numer % denom;
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
if (numer >= 0 && retval.rem < 0) {
retval.quot++;
retval.rem -= denom;
}
+#endif
return (retval);
}
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c
index 4f4aa8d..6125b1a 100644
--- a/lib/libc/stdlib/rand.c
+++ b/lib/libc/stdlib/rand.c
@@ -49,14 +49,6 @@ __FBSDID("$FreeBSD$");
static int
do_rand(unsigned long *ctx)
{
-#ifdef USE_WEAK_SEEDING
-/*
- * Historic implementation compatibility.
- * The random sequences do not vary much with the seed,
- * even with overflowing.
- */
- return ((*ctx = *ctx * 1103515245 + 12345) % ((u_long)RAND_MAX + 1));
-#else /* !USE_WEAK_SEEDING */
/*
* Compute x = (7^5 * x) mod (2^31 - 1)
* without overflowing 31 bits:
@@ -67,64 +59,45 @@ do_rand(unsigned long *ctx)
*/
long hi, lo, x;
- /* Must be in [1, 0x7ffffffe] range at this point. */
- hi = *ctx / 127773;
- lo = *ctx % 127773;
+ /* Transform to [1, 0x7ffffffe] range. */
+ x = (*ctx % 0x7ffffffe) + 1;
+ hi = x / 127773;
+ lo = x % 127773;
x = 16807 * lo - 2836 * hi;
if (x < 0)
x += 0x7fffffff;
- *ctx = x;
/* Transform to [0, 0x7ffffffd] range. */
- return (x - 1);
-#endif /* !USE_WEAK_SEEDING */
+ x--;
+ *ctx = x;
+ return (x);
}
int
-rand_r(unsigned int *ctx)
+rand_r(unsigned *ctx)
{
u_long val;
int r;
-#ifdef USE_WEAK_SEEDING
val = *ctx;
-#else
- /* Transform to [1, 0x7ffffffe] range. */
- val = (*ctx % 0x7ffffffe) + 1;
-#endif
r = do_rand(&val);
-
-#ifdef USE_WEAK_SEEDING
- *ctx = (unsigned int)val;
-#else
- *ctx = (unsigned int)(val - 1);
-#endif
+ *ctx = (unsigned)val;
return (r);
}
-static u_long next =
-#ifdef USE_WEAK_SEEDING
- 1;
-#else
- 2;
-#endif
+static u_long next = 1;
int
-rand()
+rand(void)
{
return (do_rand(&next));
}
void
-srand(seed)
-u_int seed;
+srand(unsigned seed)
{
next = seed;
-#ifndef USE_WEAK_SEEDING
- /* Transform to [1, 0x7ffffffe] range. */
- next = (next % 0x7ffffffe) + 1;
-#endif
}
@@ -136,7 +109,7 @@ u_int seed;
* data from the kernel.
*/
void
-sranddev()
+sranddev(void)
{
int mib[2];
size_t len;
@@ -146,10 +119,6 @@ sranddev()
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
sysctl(mib, 2, (void *)&next, &len, NULL, 0);
-#ifndef USE_WEAK_SEEDING
- /* Transform to [1, 0x7ffffffe] range. */
- next = (next % 0x7ffffffe) + 1;
-#endif
}
diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3
index dc8e961..35b0aa1 100644
--- a/lib/libc/stdlib/random.3
+++ b/lib/libc/stdlib/random.3
@@ -175,8 +175,8 @@ If
.Fn initstate
is called with less than 8 bytes of state information, or if
.Fn setstate
-detects that the state information has been garbled, error
-messages are printed on the standard error output.
+detects that the state information has been garbled,
+NULL is returned.
.Sh SEE ALSO
.Xr arc4random 3 ,
.Xr lrand48 3 ,
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index 580f26e3..fe8fc86 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/sysctl.h>
#include <stdint.h>
-#include <stdio.h>
#include <stdlib.h>
#include "un-namespace.h"
@@ -138,11 +137,7 @@ __FBSDID("$FreeBSD$");
*/
#define MAX_TYPES 5 /* max number of types above */
-#ifdef USE_WEAK_SEEDING
-#define NSHUFF 0
-#else /* !USE_WEAK_SEEDING */
#define NSHUFF 50 /* to drop some "seed -> 1st value" linearity */
-#endif /* !USE_WEAK_SEEDING */
static const int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
static const int seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
@@ -163,23 +158,12 @@ static const int seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
static uint32_t randtbl[DEG_3 + 1] = {
TYPE_3,
-#ifdef USE_WEAK_SEEDING
-/* Historic implementation compatibility */
-/* The random sequences do not vary much with the seed */
- 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5,
- 0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
- 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88,
- 0xe369735d, 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
- 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, 0x8999220b,
- 0x27fb47b9,
-#else /* !USE_WEAK_SEEDING */
- 0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05,
- 0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454,
- 0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471,
- 0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1,
- 0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41,
- 0xf3bec5da
-#endif /* !USE_WEAK_SEEDING */
+ 0x2cf41758, 0x27bb3711, 0x4916d4d1, 0x7b02f59f, 0x9b8e28eb, 0xc0e80269,
+ 0x696f5c16, 0x878f1ff5, 0x52d9c07f, 0x916a06cd, 0xb50b3a20, 0x2776970a,
+ 0xee4eb2a6, 0xe94640ec, 0xb1d65612, 0x9d1ed968, 0x1043f6b7, 0xa3432a76,
+ 0x17eacbb9, 0x3c09e2eb, 0x4f8c2b3, 0x708a1f57, 0xee341814, 0x95d0e4d2,
+ 0xb06f216c, 0x8bd2e72e, 0x8f7c38d7, 0xcfc6a8fc, 0x2a59495, 0xa20d2a69,
+ 0xe29d12d1
};
/*
@@ -216,16 +200,8 @@ static int rand_sep = SEP_3;
static uint32_t *end_ptr = &randtbl[DEG_3 + 1];
static inline uint32_t
-good_rand(int32_t x)
+good_rand(uint32_t ctx)
{
-#ifdef USE_WEAK_SEEDING
-/*
- * Historic implementation compatibility.
- * The random sequences do not vary much with the seed,
- * even with overflowing.
- */
- return (1103515245 * x + 12345);
-#else /* !USE_WEAK_SEEDING */
/*
* Compute x = (7^5 * x) mod (2^31 - 1)
* wihout overflowing 31 bits:
@@ -234,18 +210,17 @@ good_rand(int32_t x)
* Park and Miller, Communications of the ACM, vol. 31, no. 10,
* October 1988, p. 1195.
*/
- int32_t hi, lo;
+ int32_t hi, lo, x;
- /* Can't be initialized with 0, so use another value. */
- if (x == 0)
- x = 123459876;
+ /* Transform to [1, 0x7ffffffe] range. */
+ x = (ctx % 0x7ffffffe) + 1;
hi = x / 127773;
lo = x % 127773;
x = 16807 * lo - 2836 * hi;
if (x < 0)
x += 0x7fffffff;
- return (x);
-#endif /* !USE_WEAK_SEEDING */
+ /* Transform to [0, 0x7ffffffd] range. */
+ return (x - 1);
}
/*
@@ -341,15 +316,12 @@ initstate(unsigned long seed, char *arg_state, long n)
char *ostate = (char *)(&state[-1]);
uint32_t *int_arg_state = (uint32_t *)arg_state;
+ if (n < BREAK_0)
+ return (NULL);
if (rand_type == TYPE_0)
state[-1] = rand_type;
else
state[-1] = MAX_TYPES * (rptr - state) + rand_type;
- if (n < BREAK_0) {
- (void)fprintf(stderr,
- "random: not enough state (%ld bytes); ignored.\n", n);
- return (0);
- }
if (n < BREAK_1) {
rand_type = TYPE_0;
rand_deg = DEG_0;
@@ -408,24 +380,15 @@ setstate(char *arg_state)
uint32_t rear = new_state[0] / MAX_TYPES;
char *ostate = (char *)(&state[-1]);
+ if (type != TYPE_0 && rear >= degrees[type])
+ return (NULL);
if (rand_type == TYPE_0)
state[-1] = rand_type;
else
state[-1] = MAX_TYPES * (rptr - state) + rand_type;
- switch(type) {
- case TYPE_0:
- case TYPE_1:
- case TYPE_2:
- case TYPE_3:
- case TYPE_4:
- rand_type = type;
- rand_deg = degrees[type];
- rand_sep = seps[type];
- break;
- default:
- (void)fprintf(stderr,
- "random: state info corrupted; not changed.\n");
- }
+ rand_type = type;
+ rand_deg = degrees[type];
+ rand_sep = seps[type];
state = new_state + 1;
if (rand_type != TYPE_0) {
rptr = &state[rear];
@@ -460,14 +423,14 @@ random(void)
if (rand_type == TYPE_0) {
i = state[0];
- state[0] = i = (good_rand(i)) & 0x7fffffff;
+ state[0] = i = good_rand(i);
} else {
/*
* Use local variables rather than static variables for speed.
*/
f = fptr; r = rptr;
*f += *r;
- i = (*f >> 1) & 0x7fffffff; /* chucking least random bit */
+ i = *f >> 1; /* chucking least random bit */
if (++f >= end_ptr) {
f = state;
++r;
diff --git a/lib/libc/sys/vfork.2 b/lib/libc/sys/vfork.2
index 798c500..751a3cf 100644
--- a/lib/libc/sys/vfork.2
+++ b/lib/libc/sys/vfork.2
@@ -28,7 +28,7 @@
.\" @(#)vfork.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd April 6, 2015
+.Dd May 22, 2016
.Dt VFORK 2
.Os
.Sh NAME
@@ -41,11 +41,20 @@
.Ft pid_t
.Fn vfork void
.Sh DESCRIPTION
+.Bf -symbolic
+Since this function is hard to use correctly from application software,
+it is recommended to use
+.Xr posix_spawn 3
+or
+.Xr fork 2
+instead.
+.Ef
+.Pp
The
.Fn vfork
system call
can be used to create new processes without fully copying the address
-space of the old process, which is horrendously inefficient in a paged
+space of the old process, which is inefficient in a paged
environment.
It is useful when the purpose of
.Xr fork 2
@@ -56,13 +65,15 @@ The
system call
differs from
.Xr fork 2
-in that the child borrows the parent's memory and thread of
-control until a call to
+in that the child borrows the parent process's address space and the
+calling thread's stack
+until a call to
.Xr execve 2
or an exit (either by a call to
.Xr _exit 2
or abnormally).
-The parent process is suspended while the child is using its resources.
+The calling thread is suspended while the child is using its resources.
+Other threads continue to run.
.Pp
The
.Fn vfork
@@ -70,17 +81,21 @@ system call
returns 0 in the child's context and (later) the pid of the child in
the parent's context.
.Pp
-The
-.Fn vfork
-system call
-can normally be used just like
-.Xr fork 2 .
-It does not work, however, to return while running in the child's context
+Many problems can occur when replacing
+.Xr fork 2
+with
+.Fn vfork .
+For example, it does not work to return while running in the child's context
from the procedure that called
.Fn vfork
since the eventual return from
.Fn vfork
would then return to a no longer existent stack frame.
+Also, changing process state which is partially implemented in user space
+such as signal handlers with
+.Xr libthr 3
+will corrupt the parent's state.
+.Pp
Be careful, also, to call
.Xr _exit 2
rather than
@@ -106,7 +121,8 @@ Same as for
.Xr rfork 2 ,
.Xr sigaction 2 ,
.Xr wait 2 ,
-.Xr exit 3
+.Xr exit 3 ,
+.Xr posix_spawn 3
.Sh HISTORY
The
.Fn vfork
diff --git a/lib/libcompat/4.3/rexec.c b/lib/libcompat/4.3/rexec.c
index 4e01eb6..3a8b452 100644
--- a/lib/libcompat/4.3/rexec.c
+++ b/lib/libcompat/4.3/rexec.c
@@ -330,6 +330,7 @@ retry:
goto retry;
}
perror(hp->h_name);
+ (void) close(s);
return (-1);
}
if (fd2p == 0) {
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 76dc4f9..6ae9926 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -256,8 +256,11 @@ fetch_bind(int sd, int af, const char *addr)
if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0)
return (-1);
for (res = res0; res; res = res->ai_next)
- if (bind(sd, res->ai_addr, res->ai_addrlen) == 0)
+ if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) {
+ freeaddrinfo(res0);
return (0);
+ }
+ freeaddrinfo(res0);
return (-1);
}
diff --git a/lib/libfetch/file.c b/lib/libfetch/file.c
index 7b6462f..ab6b4b7 100644
--- a/lib/libfetch/file.c
+++ b/lib/libfetch/file.c
@@ -149,5 +149,6 @@ fetchListFile(struct url *u, const char *flags __unused)
fetch_add_entry(&ue, &size, &len, de->d_name, &us);
}
+ closedir(dir);
return (ue);
}
diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile
index 14f1702..0ddecc8 100644
--- a/lib/libmagic/Makefile
+++ b/lib/libmagic/Makefile
@@ -12,7 +12,7 @@ LDADD= -lz
MAN= libmagic.3 magic.5
SRCS= apprentice.c apptype.c ascmagic.c cdf.c cdf_time.c compress.c \
- encoding.c fsmagic.c funcs.c \
+ der.c encoding.c fsmagic.c funcs.c \
is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c
INCS= magic.h
diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h
index 752b82b..6fd2942 100644
--- a/lib/libmagic/config.h
+++ b/lib/libmagic/config.h
@@ -43,6 +43,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
+/* Define to 1 if you have the `dprintf' function. */
+#define HAVE_DPRINTF 1
+
/* Define to 1 if you have the <err.h> header file. */
#define HAVE_ERR_H 1
@@ -290,7 +293,7 @@
#define PACKAGE_NAME "file"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "file 5.25"
+#define PACKAGE_STRING "file 5.27"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "file"
@@ -299,7 +302,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "5.25"
+#define PACKAGE_VERSION "5.27"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
@@ -330,7 +333,7 @@
/* Version number of package */
-#define VERSION "5.25"
+#define VERSION "5.27"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
diff --git a/lib/libmt/mtlib.c b/lib/libmt/mtlib.c
index f6acba2..a36b9bf 100644
--- a/lib/libmt/mtlib.c
+++ b/lib/libmt/mtlib.c
@@ -643,6 +643,7 @@ static struct densities {
{ 0x55, 20670, 525018, "3592A5 (unencrypted)" },
{ 0x58, 15142, 384607, "LTO-5" },
{ 0x5A, 15142, 384607, "LTO-6" },
+ { 0x5C, 19107, 485318, "LTO-7" },
{ 0x71, 11800, 299720, "3592A1 (encrypted)" },
{ 0x72, 11800, 299720, "3592A2 (encrypted)" },
{ 0x73, 13452, 341681, "3592A3 (encrypted)" },
diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile
index 893ed68..754bac4 100644
--- a/lib/libstand/Makefile
+++ b/lib/libstand/Makefile
@@ -43,7 +43,7 @@ CFLAGS+= -G0 -fno-pic -mno-abicalls
.endif
# standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
+SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
sbrk.c twiddle.c zalloc.c zalloc_malloc.c
diff --git a/lib/libstand/bootp.c b/lib/libstand/bootp.c
index 1af7bd5..f3bc816 100644
--- a/lib/libstand/bootp.c
+++ b/lib/libstand/bootp.c
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/endian.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -393,6 +394,13 @@ vend_rfc1048(cp, len)
val = (const char *)cp;
strlcpy(hostname, val, sizeof(hostname));
}
+ if (tag == TAG_INTF_MTU) {
+ if ((val = getenv("dhcp.interface-mtu")) != NULL) {
+ intf_mtu = (u_int)strtoul(val, NULL, 0);
+ } else {
+ intf_mtu = be16dec(cp);
+ }
+ }
#ifdef SUPPORT_DHCP
if (tag == TAG_DHCP_MSGTYPE) {
if(*cp != expected_dhcpmsgtype)
diff --git a/lib/libstand/bootp.h b/lib/libstand/bootp.h
index ed9101f..47e5649 100644
--- a/lib/libstand/bootp.h
+++ b/lib/libstand/bootp.h
@@ -91,6 +91,7 @@ struct bootp {
#define TAG_DOMAINNAME ((unsigned char) 15)
#define TAG_SWAPSERVER ((unsigned char) 16)
#define TAG_ROOTPATH ((unsigned char) 17)
+#define TAG_INTF_MTU ((unsigned char) 26)
#ifdef SUPPORT_DHCP
#define TAG_REQ_ADDR ((unsigned char) 50)
diff --git a/lib/libstand/bswap.c b/lib/libstand/bswap.c
deleted file mode 100644
index 308edda..0000000
--- a/lib/libstand/bswap.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Written by Manuel Bouyer <bouyer@netbsd.org>.
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: bswap32.c,v 1.1 1997/10/09 15:42:33 bouyer Exp $";
-static char *rcsid = "$NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $";
-#endif
-
-#include <sys/types.h>
-
-#undef bswap32
-#undef bswap64
-
-u_int32_t bswap32(u_int32_t x);
-u_int64_t bswap64(u_int64_t x);
-
-u_int32_t
-bswap32(u_int32_t x)
-{
- return ((x << 24) & 0xff000000 ) |
- ((x << 8) & 0x00ff0000 ) |
- ((x >> 8) & 0x0000ff00 ) |
- ((x >> 24) & 0x000000ff );
-}
-
-u_int64_t
-bswap64(u_int64_t x)
-{
-#ifdef __LP64__
- /*
- * Assume we have wide enough registers to do it without touching
- * memory.
- */
- return ( (x << 56) & 0xff00000000000000UL ) |
- ( (x << 40) & 0x00ff000000000000UL ) |
- ( (x << 24) & 0x0000ff0000000000UL ) |
- ( (x << 8) & 0x000000ff00000000UL ) |
- ( (x >> 8) & 0x00000000ff000000UL ) |
- ( (x >> 24) & 0x0000000000ff0000UL ) |
- ( (x >> 40) & 0x000000000000ff00UL ) |
- ( (x >> 56) & 0x00000000000000ffUL );
-#else
- /*
- * Split the operation in two 32bit steps.
- */
- u_int32_t tl, th;
-
- th = bswap32((u_int32_t)(x & 0x00000000ffffffffULL));
- tl = bswap32((u_int32_t)((x >> 32) & 0x00000000ffffffffULL));
- return ((u_int64_t)th << 32) | tl;
-#endif
-}
diff --git a/lib/libstand/globals.c b/lib/libstand/globals.c
index 0310823..8284fae 100644
--- a/lib/libstand/globals.c
+++ b/lib/libstand/globals.c
@@ -32,5 +32,6 @@ struct in_addr rootip; /* root ip address */
struct in_addr swapip; /* swap ip address */
struct in_addr gateip; /* swap ip address */
n_long netmask = 0xffffff00; /* subnet or net mask */
+u_int intf_mtu; /* interface mtu from bootp/dhcp */
int errno; /* our old friend */
diff --git a/lib/libstand/net.h b/lib/libstand/net.h
index 94f2aab..ce7df49 100644
--- a/lib/libstand/net.h
+++ b/lib/libstand/net.h
@@ -83,6 +83,7 @@ extern struct in_addr swapip;
extern struct in_addr gateip;
extern struct in_addr nameip;
extern n_long netmask;
+extern u_int intf_mtu;
extern int debug; /* defined in the machdep sources */
diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h
index ebd248d..b5e0d8a 100644
--- a/lib/libstand/stand.h
+++ b/lib/libstand/stand.h
@@ -334,11 +334,6 @@ static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }
static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }
static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }
-/* swaps (undocumented, useful?) */
-#ifdef __i386__
-extern u_int32_t bswap32(u_int32_t x);
-extern u_int64_t bswap64(u_int64_t x);
-#endif
/* null functions for device/filesystem switches (undocumented) */
extern int nodev(void);
diff --git a/release/tools/arm.subr b/release/tools/arm.subr
index 2adadd2..edce8ba 100644
--- a/release/tools/arm.subr
+++ b/release/tools/arm.subr
@@ -72,7 +72,6 @@ arm_create_disk() {
chroot ${CHROOTDIR} gpart create -s bsd ${mddev}s2
chroot ${CHROOTDIR} gpart add -t freebsd-ufs -a 64k /dev/${mddev}s2
chroot ${CHROOTDIR} newfs -U -L rootfs /dev/${mddev}s2a
- chroot ${CHROOTDIR} tunefs -N enable /dev/${mddev}s2a
return 0
}
diff --git a/sbin/ipfw/dummynet.c b/sbin/ipfw/dummynet.c
index c5b5253..6be36a2 100644
--- a/sbin/ipfw/dummynet.c
+++ b/sbin/ipfw/dummynet.c
@@ -56,6 +56,7 @@ static struct _s_x dummynet_params[] = {
{ "sched_mask", TOK_SCHED_MASK },
{ "flow_mask", TOK_FLOW_MASK },
{ "droptail", TOK_DROPTAIL },
+ { "ecn", TOK_ECN },
{ "red", TOK_RED },
{ "gred", TOK_GRED },
{ "bw", TOK_BW },
@@ -239,7 +240,7 @@ print_flowset_parms(struct dn_fs *fs, char *prefix)
else
plr[0] = '\0';
- if (fs->flags & DN_IS_RED) /* RED parameters */
+ if (fs->flags & DN_IS_RED) { /* RED parameters */
sprintf(red,
"\n\t %cRED w_q %f min_th %d max_th %d max_p %f",
(fs->flags & DN_IS_GENTLE_RED) ? 'G' : ' ',
@@ -247,7 +248,9 @@ print_flowset_parms(struct dn_fs *fs, char *prefix)
fs->min_th,
fs->max_th,
1.0 * fs->max_p / (double)(1 << SCALE_RED));
- else
+ if (fs->flags & DN_IS_ECN)
+ strncat(red, " (ecn)", 6);
+ } else
sprintf(red, "droptail");
if (prefix[0]) {
@@ -1046,13 +1049,17 @@ end_mask:
}
if ((end = strsep(&av[0], "/"))) {
double max_p = strtod(end, NULL);
- if (max_p > 1 || max_p <= 0)
- errx(EX_DATAERR, "0 < max_p <= 1");
+ if (max_p > 1 || max_p < 0)
+ errx(EX_DATAERR, "0 <= max_p <= 1");
fs->max_p = (int)(max_p * (1 << SCALE_RED));
}
ac--; av++;
break;
+ case TOK_ECN:
+ fs->flags |= DN_IS_ECN;
+ break;
+
case TOK_DROPTAIL:
NEED(fs, "droptail is only for flowsets");
fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
@@ -1175,13 +1182,20 @@ end_mask:
errx(EX_DATAERR, "2 <= queue size <= %ld", limit);
}
+ if ((fs->flags & DN_IS_ECN) && !(fs->flags & DN_IS_RED))
+ errx(EX_USAGE, "enable red/gred for ECN");
+
if (fs->flags & DN_IS_RED) {
size_t len;
int lookup_depth, avg_pkt_size;
- if (fs->min_th >= fs->max_th)
+ if (!(fs->flags & DN_IS_ECN) && (fs->min_th >= fs->max_th))
errx(EX_DATAERR, "min_th %d must be < than max_th %d",
fs->min_th, fs->max_th);
+ else if ((fs->flags & DN_IS_ECN) && (fs->min_th > fs->max_th))
+ errx(EX_DATAERR, "min_th %d must be =< than max_th %d",
+ fs->min_th, fs->max_th);
+
if (fs->max_th == 0)
errx(EX_DATAERR, "max_th must be > 0");
diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8
index 65fa334..13b8cc7 100644
--- a/sbin/ipfw/ipfw.8
+++ b/sbin/ipfw/ipfw.8
@@ -1,7 +1,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 25, 2012
+.Dd May 31, 2014
.Dt IPFW 8
.Os
.Sh NAME
@@ -2442,22 +2442,23 @@ and
control the maximum lengths that can be specified.
.Pp
.It Cm red | gred Ar w_q Ns / Ns Ar min_th Ns / Ns Ar max_th Ns / Ns Ar max_p
+[ecn]
Make use of the RED (Random Early Detection) queue management algorithm.
.Ar w_q
and
.Ar max_p
are floating
-point numbers between 0 and 1 (0 not included), while
+point numbers between 0 and 1 (inclusive), while
.Ar min_th
and
.Ar max_th
are integer numbers specifying thresholds for queue management
(thresholds are computed in bytes if the queue has been defined
in bytes, in slots otherwise).
-The
+The two parameters can also be of the same value if needed. The
.Nm dummynet
-also supports the gentle RED variant (gred).
-Three
+also supports the gentle RED variant (gred) and ECN (Explicit Congestion
+Notification) as optional. Three
.Xr sysctl 8
variables can be used to control the RED behaviour:
.Bl -tag -width indent
diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h
index 3ef9b19..d7d4f05 100644
--- a/sbin/ipfw/ipfw2.h
+++ b/sbin/ipfw/ipfw2.h
@@ -166,6 +166,7 @@ enum tokens {
TOK_BURST,
TOK_RED,
TOK_GRED,
+ TOK_ECN,
TOK_DROPTAIL,
TOK_PROTO,
/* dummynet tokens */
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 2c3f632..9d3684d 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -199,6 +199,7 @@ MAN= aac.4 \
intpm.4 \
intro.4 \
${_io.4} \
+ ${_ioat.4} \
ip.4 \
ip6.4 \
ipfirewall.4 \
@@ -797,6 +798,7 @@ MLINKS+=lindev.4 full.4
.if ${MACHINE_CPUARCH} == "amd64"
_if_ntb.4= if_ntb.4
+_ioat.4= ioat.4
_ntb.4= ntb.4
_ntb_hw.4= ntb_hw.4
_qlxge.4= qlxge.4
diff --git a/share/man/man4/ioat.4 b/share/man/man4/ioat.4
new file mode 100644
index 0000000..3808945
--- /dev/null
+++ b/share/man/man4/ioat.4
@@ -0,0 +1,334 @@
+.\" Copyright (c) 2015 EMC / Isilon Storage Division
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 3, 2016
+.Dt IOAT 4
+.Os
+.Sh NAME
+.Nm I/OAT
+.Nd Intel I/O Acceleration Technology
+.Sh SYNOPSIS
+To compile this driver into your kernel,
+place the following line in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ioat"
+.Ed
+.Pp
+Or, to load the driver as a module at boot, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+ioat_load="YES"
+.Ed
+.Pp
+In
+.Xr loader.conf 5 :
+.Pp
+.Cd hw.ioat.force_legacy_interrupts=0
+.Pp
+In
+.Xr loader.conf 5 or
+.Xr sysctl.conf 5 :
+.Pp
+.Cd hw.ioat.enable_ioat_test=0
+.Cd hw.ioat.debug_level=0
+(only critical errors; maximum of 3)
+.Pp
+.Ft typedef void
+.Fn (*bus_dmaengine_callback_t) "void *arg" "int error"
+.Pp
+.Ft bus_dmaengine_t
+.Fn ioat_get_dmaengine "uint32_t channel_index"
+.Ft void
+.Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine"
+.Ft int
+.Fn ioat_get_hwversion "bus_dmaengine_t dmaengine"
+.Ft size_t
+.Fn ioat_get_max_io_size "bus_dmaengine_t dmaengine"
+.Ft int
+.Fn ioat_set_interrupt_coalesce "bus_dmaengine_t dmaengine" "uint16_t delay"
+.Ft uint16_t
+.Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine"
+.Ft void
+.Fn ioat_acquire "bus_dmaengine_t dmaengine"
+.Ft int
+.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags"
+.Ft void
+.Fn ioat_release "bus_dmaengine_t dmaengine"
+.Ft struct bus_dmadesc *
+.Fo ioat_copy
+.Fa "bus_dmaengine_t dmaengine"
+.Fa "bus_addr_t dst"
+.Fa "bus_addr_t src"
+.Fa "bus_size_t len"
+.Fa "bus_dmaengine_callback_t callback_fn"
+.Fa "void *callback_arg"
+.Fa "uint32_t flags"
+.Fc
+.Ft struct bus_dmadesc *
+.Fo ioat_copy_8k_aligned
+.Fa "bus_dmaengine_t dmaengine"
+.Fa "bus_addr_t dst1"
+.Fa "bus_addr_t dst2"
+.Fa "bus_addr_t src1"
+.Fa "bus_addr_t src2"
+.Fa "bus_dmaengine_callback_t callback_fn"
+.Fa "void *callback_arg"
+.Fa "uint32_t flags"
+.Fc
+.Ft struct bus_dmadesc *
+.Fo ioat_copy_crc
+.Fa "bus_dmaengine_t dmaengine"
+.Fa "bus_addr_t dst"
+.Fa "bus_addr_t src"
+.Fa "bus_size_t len"
+.Fa "uint32_t *initialseed"
+.Fa "bus_addr_t crcptr"
+.Fa "bus_dmaengine_callback_t callback_fn"
+.Fa "void *callback_arg"
+.Fa "uint32_t flags"
+.Fc
+.Ft struct bus_dmadesc *
+.Fo ioat_crc
+.Fa "bus_dmaengine_t dmaengine"
+.Fa "bus_addr_t src"
+.Fa "bus_size_t len"
+.Fa "uint32_t *initialseed"
+.Fa "bus_addr_t crcptr"
+.Fa "bus_dmaengine_callback_t callback_fn"
+.Fa "void *callback_arg"
+.Fa "uint32_t flags"
+.Fc
+.Ft struct bus_dmadesc *
+.Fo ioat_blockfill
+.Fa "bus_dmaengine_t dmaengine"
+.Fa "bus_addr_t dst"
+.Fa "uint64_t fillpattern"
+.Fa "bus_size_t len"
+.Fa "bus_dmaengine_callback_t callback_fn"
+.Fa "void *callback_arg"
+.Fa "uint32_t flags"
+.Fc
+.Ft struct bus_dmadesc *
+.Fo ioat_null
+.Fa "bus_dmaengine_t dmaengine"
+.Fa "bus_dmaengine_callback_t callback_fn"
+.Fa "void *callback_arg"
+.Fa "uint32_t flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Nm
+driver provides a kernel API to a variety of DMA engines on some Intel server
+platforms.
+.Pp
+There is a number of DMA channels per CPU package.
+(Typically 4 or 8.)
+Each may be used independently.
+Operations on a single channel proceed sequentially.
+.Pp
+Blockfill operations can be used to write a 64-bit pattern to memory.
+.Pp
+Copy operations can be used to offload memory copies to the DMA engines.
+.Pp
+Null operations do nothing, but may be used to test the interrupt and callback
+mechanism.
+.Pp
+All operations can optionally trigger an interrupt at completion with the
+.Ar DMA_INT_EN
+flag.
+For example, a user might submit multiple operations to the same channel and
+only enable an interrupt and callback for the last operation.
+.Pp
+The hardware can delay and coalesce interrupts on a given channel for a
+configurable period of time, in microseconds.
+This may be desired to reduce the processing and interrupt overhead per
+descriptor, especially for workflows consisting of many small operations.
+Software can control this on a per-channel basis with the
+.Fn ioat_set_interrupt_coalesce
+API.
+The
+.Fn ioat_get_max_coalesce_period
+API can be used to determine the maximum coalescing period supported by the
+hardware, in microseconds.
+Current platforms support up to a 16.383 millisecond coalescing period.
+Optimal configuration will vary by workflow and desired operation latency.
+.Pp
+All operations are safe to use in a non-blocking context with the
+.Ar DMA_NO_WAIT
+flag.
+(Of course, allocations may fail and operations requested with
+.Ar DMA_NO_WAIT
+may return NULL.)
+.Pp
+Operations that depend on the result of prior operations should use
+.Ar DMA_FENCE .
+For example, such a scenario can happen when two related DMA operations are
+queued.
+First, a DMA copy to one location (A), followed directly by a DMA copy
+from A to B.
+In this scenario, some classes of I/OAT hardware may prefetch A for the second
+operation before it is written by the first operation.
+To avoid reading a stale value in sequences of dependent operations, use
+.Ar DMA_FENCE .
+.Pp
+All operations, as well as
+.Fn ioat_get_dmaengine ,
+can return NULL in special circumstances.
+For example, if the
+.Nm
+driver is being unloaded, or the administrator has induced a hardware reset, or
+a usage error has resulted in a hardware error state that needs to be recovered
+from.
+.Pp
+It is invalid to attempt to submit new DMA operations in a
+.Fa bus_dmaengine_callback_t
+context.
+.Pp
+The CRC operations have three distinct modes.
+The default mode is to accumulate.
+By accumulating over multiple descriptors, a user may gather a CRC over several
+chunks of memory and only write out the result once.
+.Pp
+The
+.Ar DMA_CRC_STORE
+flag causes the operation to emit the CRC32C result.
+If
+.Ar DMA_CRC_INLINE
+is set, the result is written inline with the destination data (or source in
+.Fn ioat_crc
+mode).
+If
+.Ar DMA_CRC_INLINE
+is not set, the result is written to the provided
+.Fa crcptr .
+.Pp
+Similarly, the
+.Ar DMA_CRC_TEST
+flag causes the operation to compare the CRC32C result to an existing checksum.
+If
+.Ar DMA_CRC_INLINE
+is set, the result is compared against the inline four bytes trailing the
+source data.
+If it is not set, the result is compared against the value pointed to by
+.Fa crcptr .
+.Pp
+.Fn ioat_copy_crc
+calculates a CRC32C while copying data.
+.Fn ioat_crc
+only computes a CRC32C of some data.
+If the
+.Fa initialseed
+argument to either routine is non-NULL, the CRC32C engine is initialized with
+the value it points to.
+.Sh USAGE
+A typical user will lookup the DMA engine object for a given channel with
+.Fn ioat_get_dmaengine .
+When the user wants to offload a copy, they will first
+.Fn ioat_acquire
+the
+.Ar bus_dmaengine_t
+object for exclusive access to enqueue operations on that channel.
+Optionally, the user can reserve space by using
+.Fn ioat_acquire_reserve
+instead.
+If
+.Fn ioat_acquire_reserve
+succeeds, there is guaranteed to be room for
+.Fa N
+new operations in the internal ring buffer.
+.Pp
+Then, they will submit one or more operations using
+.Fn ioat_blockfill ,
+.Fn ioat_copy ,
+.Fn ioat_copy_8k_aligned ,
+.Fn ioat_copy_crc ,
+.Fn ioat_crc ,
+or
+.Fn ioat_null .
+After queuing one or more individual DMA operations, they will
+.Fn ioat_release
+the
+.Ar bus_dmaengine_t
+to drop their exclusive access to the channel.
+The routine they provided for the
+.Fa callback_fn
+argument will be invoked with the provided
+.Fa callback_arg
+when the operation is complete.
+When they are finished with the
+.Ar bus_dmaengine_t ,
+the user should
+.Fn ioat_put_dmaengine .
+.Pp
+Users MUST NOT block between
+.Fn ioat_acquire
+and
+.Fn ioat_release .
+Users SHOULD NOT hold
+.Ar bus_dmaengine_t
+references for a very long time to enable fault recovery and kernel module
+unload.
+.Pp
+For an example of usage, see
+.Pa src/sys/dev/ioat/ioat_test.c .
+.Sh FILES
+.Bl -tag
+.It Pa /dev/ioat_test
+test device for
+.Xr ioatcontrol 8
+.El
+.Sh SEE ALSO
+.Xr ioatcontrol 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was developed by
+.An \&Jim Harris Aq Mt jimharris@FreeBSD.org ,
+.An \&Carl Delsey Aq Mt carl.r.delsey@intel.com ,
+and
+.An \&Conrad Meyer Aq Mt cem@FreeBSD.org .
+This manual page was written by
+.An \&Conrad Meyer Aq Mt cem@FreeBSD.org .
+.Sh CAVEATS
+Copy operation takes bus addresses as parameters, not virtual addresses.
+.Pp
+Buffers for individual copy operations must be physically contiguous.
+.Pp
+Copies larger than max transfer size (1MB, but may vary by hardware) are not
+supported.
+Future versions will likely support this by breaking up the transfer into
+smaller sizes.
+.Sh BUGS
+The
+.Nm
+driver only supports blockfill, copy, and null operations at this time.
+The driver does not yet support advanced DMA modes, such as XOR, that some
+I/OAT devices support.
diff --git a/share/man/man4/sfxge.4 b/share/man/man4/sfxge.4
index 9057fa8..40f324c 100644
--- a/share/man/man4/sfxge.4
+++ b/share/man/man4/sfxge.4
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2011-2015 Solarflare Communications Inc.
+.\" Copyright (c) 2011-2016 Solarflare Communications Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index aaa3741..751966f 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -414,13 +414,7 @@ cpu_set_syscall_retval(struct thread *td, int error)
break;
default:
- if (td->td_proc->p_sysent->sv_errsize) {
- if (error >= td->td_proc->p_sysent->sv_errsize)
- error = -1; /* XXX */
- else
- error = td->td_proc->p_sysent->sv_errtbl[error];
- }
- td->td_frame->tf_rax = error;
+ td->td_frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_rflags |= PSL_C;
break;
}
diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h
index 0a0cbe6..4946805 100644
--- a/sys/amd64/linux/linux_proto.h
+++ b/sys/amd64/linux/linux_proto.h
@@ -524,16 +524,16 @@ struct linux_getpriority_args {
};
struct linux_sched_setparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_getparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_setscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_getscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c
index d649eed..5dcdd55 100644
--- a/sys/amd64/linux/linux_systrace_args.c
+++ b/sys/amd64/linux/linux_systrace_args.c
@@ -1178,7 +1178,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 142: {
struct linux_sched_setparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
- uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1186,7 +1186,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 143: {
struct linux_sched_getparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
- uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1195,7 +1195,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct linux_sched_setscheduler_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
iarg[1] = p->policy; /* l_int */
- uarg[2] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[2] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 3;
break;
}
@@ -4209,7 +4209,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
@@ -4222,7 +4222,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
@@ -4238,7 +4238,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 2:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master
index 87c8000..50ddd92 100644
--- a/sys/amd64/linux/syscalls.master
+++ b/sys/amd64/linux/syscalls.master
@@ -283,12 +283,12 @@
141 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \
int prio); }
142 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
143 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
144 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \
l_pid_t pid, l_int policy, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
145 AUE_SCHED_GETSCHEDULER STD { int linux_sched_getscheduler( \
l_pid_t pid); }
146 AUE_SCHED_GET_PRIORITY_MAX STD { int linux_sched_get_priority_max( \
diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h
index 0f98b94..a960c09 100644
--- a/sys/amd64/linux32/linux32_proto.h
+++ b/sys/amd64/linux32/linux32_proto.h
@@ -480,16 +480,16 @@ struct linux_sysctl_args {
};
struct linux_sched_setparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_getparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_setscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_getscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c
index fc4c89a..cabfab7 100644
--- a/sys/amd64/linux32/linux32_systrace_args.c
+++ b/sys/amd64/linux32/linux32_systrace_args.c
@@ -1047,7 +1047,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 154: {
struct linux_sched_setparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
- uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1055,7 +1055,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 155: {
struct linux_sched_getparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
- uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1064,7 +1064,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct linux_sched_setscheduler_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
iarg[1] = p->policy; /* l_int */
- uarg[2] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[2] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 3;
break;
}
@@ -3938,7 +3938,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
@@ -3951,7 +3951,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
@@ -3967,7 +3967,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 2:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master
index e40247e..79cd2c8 100644
--- a/sys/amd64/linux32/syscalls.master
+++ b/sys/amd64/linux32/syscalls.master
@@ -268,12 +268,12 @@
152 AUE_MLOCKALL NOPROTO { int mlockall(int how); }
153 AUE_MUNLOCKALL NOPROTO { int munlockall(void); }
154 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
155 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
156 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \
l_pid_t pid, l_int policy, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
157 AUE_SCHED_GETSCHEDULER STD { int linux_sched_getscheduler( \
l_pid_t pid); }
158 AUE_NULL NOPROTO { int sched_yield(void); }
diff --git a/sys/boot/common/dev_net.c b/sys/boot/common/dev_net.c
index 091ed02..d9d64ca 100644
--- a/sys/boot/common/dev_net.c
+++ b/sys/boot/common/dev_net.c
@@ -171,6 +171,12 @@ net_open(struct open_file *f, ...)
setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
setenv("boot.nfsroot.path", rootpath, 1);
+ if (intf_mtu != 0) {
+ char mtu[16];
+ sprintf(mtu, "%u", intf_mtu);
+ setenv("boot.netif.mtu", mtu, 1);
+ }
+
}
netdev_opens++;
f->f_devdata = &netdev_sock;
diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c
index 49814dd..e57e0af 100644
--- a/sys/boot/i386/libi386/pxe.c
+++ b/sys/boot/i386/libi386/pxe.c
@@ -312,6 +312,11 @@ pxe_open(struct open_file *f, ...)
sprintf(temp, "%6D", bootplayer.CAddr, ":");
setenv("boot.netif.hwaddr", temp, 1);
}
+ if (intf_mtu != 0) {
+ char mtu[16];
+ sprintf(mtu, "%u", intf_mtu);
+ setenv("boot.netif.mtu", mtu, 1);
+ }
setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
setenv("boot.nfsroot.path", rootpath, 1);
setenv("dhcp.host-name", hostname, 1);
diff --git a/sys/boot/libstand32/Makefile b/sys/boot/libstand32/Makefile
index 4ee8690..c2bb701 100644
--- a/sys/boot/libstand32/Makefile
+++ b/sys/boot/libstand32/Makefile
@@ -45,7 +45,7 @@ CFLAGS+= -G0 -fno-pic -mno-abicalls
.endif
# standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
+SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
sbrk.c twiddle.c zalloc.c zalloc_malloc.c
diff --git a/sys/boot/userboot/libstand/Makefile b/sys/boot/userboot/libstand/Makefile
index 4ef62f3..53d6e85 100644
--- a/sys/boot/userboot/libstand/Makefile
+++ b/sys/boot/userboot/libstand/Makefile
@@ -42,7 +42,7 @@ CFLAGS+= -msoft-float -D_STANDALONE
.endif
# standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
+SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c environment.c getopt.c gets.c \
globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
sbrk.c twiddle.c zalloc.c zalloc_malloc.c
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index d21b5e3..bebaccf 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -1104,6 +1104,42 @@ tpc_ranges_length(struct scsi_range_desc *range, int nrange)
}
static int
+tpc_check_ranges_l(struct scsi_range_desc *range, int nrange, uint64_t maxlba)
+{
+ uint64_t b1;
+ uint32_t l1;
+ int i;
+
+ for (i = 0; i < nrange; i++) {
+ b1 = scsi_8btou64(range[i].lba);
+ l1 = scsi_4btoul(range[i].length);
+ if (b1 + l1 < b1 || b1 + l1 > maxlba + 1)
+ return (-1);
+ }
+ return (0);
+}
+
+static int
+tpc_check_ranges_x(struct scsi_range_desc *range, int nrange)
+{
+ uint64_t b1, b2;
+ uint32_t l1, l2;
+ int i, j;
+
+ for (i = 0; i < nrange - 1; i++) {
+ b1 = scsi_8btou64(range[i].lba);
+ l1 = scsi_4btoul(range[i].length);
+ for (j = i + 1; j < nrange; j++) {
+ b2 = scsi_8btou64(range[j].lba);
+ l2 = scsi_4btoul(range[j].length);
+ if (b1 + l1 > b2 && b2 + l2 > b1)
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+static int
tpc_skip_ranges(struct scsi_range_desc *range, int nrange, off_t skip,
int *srange, off_t *soffset)
{
@@ -1916,7 +1952,7 @@ ctl_populate_token(struct ctl_scsiio *ctsio)
struct ctl_port *port;
struct tpc_list *list, *tlist;
struct tpc_token *token;
- int len, lendesc;
+ int len, lendata, lendesc;
CTL_DEBUG_PRINT(("ctl_populate_token\n"));
@@ -1953,10 +1989,19 @@ ctl_populate_token(struct ctl_scsiio *ctsio)
}
data = (struct scsi_populate_token_data *)ctsio->kern_data_ptr;
+ lendata = scsi_2btoul(data->length);
+ if (lendata < sizeof(struct scsi_populate_token_data) - 2 +
+ sizeof(struct scsi_range_desc)) {
+ ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0,
+ /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0);
+ goto done;
+ }
lendesc = scsi_2btoul(data->range_descriptor_length);
- if (len < sizeof(struct scsi_populate_token_data) + lendesc) {
+ if (lendesc < sizeof(struct scsi_range_desc) ||
+ len < sizeof(struct scsi_populate_token_data) + lendesc ||
+ lendata < sizeof(struct scsi_populate_token_data) - 2 + lendesc) {
ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0,
- /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0);
+ /*field*/ 14, /*bit_valid*/ 0, /*bit*/ 0);
goto done;
}
/*
@@ -1966,6 +2011,16 @@ ctl_populate_token(struct ctl_scsiio *ctsio)
scsi_4btoul(data->rod_type),
scsi_2btoul(data->range_descriptor_length));
*/
+
+ /* Validate INACTIVITY TIMEOUT field */
+ if (scsi_4btoul(data->inactivity_timeout) > TPC_MAX_TOKEN_TIMEOUT) {
+ ctl_set_invalid_field(ctsio, /*sks_valid*/ 1,
+ /*command*/ 0, /*field*/ 4, /*bit_valid*/ 0,
+ /*bit*/ 0);
+ goto done;
+ }
+
+ /* Validate ROD TYPE field */
if ((data->flags & EC_PT_RTV) &&
scsi_4btoul(data->rod_type) != ROD_TYPE_AUR) {
ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0,
@@ -1973,6 +2028,23 @@ ctl_populate_token(struct ctl_scsiio *ctsio)
goto done;
}
+ /* Validate list of ranges */
+ if (tpc_check_ranges_l(&data->desc[0],
+ scsi_2btoul(data->range_descriptor_length) /
+ sizeof(struct scsi_range_desc),
+ lun->be_lun->maxlba) != 0) {
+ ctl_set_lba_out_of_range(ctsio);
+ goto done;
+ }
+ if (tpc_check_ranges_x(&data->desc[0],
+ scsi_2btoul(data->range_descriptor_length) /
+ sizeof(struct scsi_range_desc)) != 0) {
+ ctl_set_invalid_field(ctsio, /*sks_valid*/ 0,
+ /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0,
+ /*bit*/ 0);
+ goto done;
+ }
+
list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO);
list->service_action = cdb->service_action;
list->init_port = ctsio->io_hdr.nexus.targ_port;
@@ -2016,11 +2088,6 @@ ctl_populate_token(struct ctl_scsiio *ctsio)
token->timeout = TPC_DFL_TOKEN_TIMEOUT;
else if (token->timeout < TPC_MIN_TOKEN_TIMEOUT)
token->timeout = TPC_MIN_TOKEN_TIMEOUT;
- else if (token->timeout > TPC_MAX_TOKEN_TIMEOUT) {
- ctl_set_invalid_field(ctsio, /*sks_valid*/ 1,
- /*command*/ 0, /*field*/ 4, /*bit_valid*/ 0,
- /*bit*/ 0);
- }
memcpy(list->res_token, token->token, sizeof(list->res_token));
list->res_token_valid = 1;
list->curseg = 0;
@@ -2051,7 +2118,7 @@ ctl_write_using_token(struct ctl_scsiio *ctsio)
struct ctl_lun *lun;
struct tpc_list *list, *tlist;
struct tpc_token *token;
- int len, lendesc;
+ int len, lendata, lendesc;
CTL_DEBUG_PRINT(("ctl_write_using_token\n"));
@@ -2060,8 +2127,8 @@ ctl_write_using_token(struct ctl_scsiio *ctsio)
cdb = (struct scsi_write_using_token *)ctsio->cdb;
len = scsi_4btoul(cdb->length);
- if (len < sizeof(struct scsi_populate_token_data) ||
- len > sizeof(struct scsi_populate_token_data) +
+ if (len < sizeof(struct scsi_write_using_token_data) ||
+ len > sizeof(struct scsi_write_using_token_data) +
TPC_MAX_SEGS * sizeof(struct scsi_range_desc)) {
ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1,
/*field*/ 9, /*bit_valid*/ 0, /*bit*/ 0);
@@ -2087,10 +2154,19 @@ ctl_write_using_token(struct ctl_scsiio *ctsio)
}
data = (struct scsi_write_using_token_data *)ctsio->kern_data_ptr;
+ lendata = scsi_2btoul(data->length);
+ if (lendata < sizeof(struct scsi_write_using_token_data) - 2 +
+ sizeof(struct scsi_range_desc)) {
+ ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0,
+ /*field*/ 0, /*bit_valid*/ 0, /*bit*/ 0);
+ goto done;
+ }
lendesc = scsi_2btoul(data->range_descriptor_length);
- if (len < sizeof(struct scsi_populate_token_data) + lendesc) {
+ if (lendesc < sizeof(struct scsi_range_desc) ||
+ len < sizeof(struct scsi_write_using_token_data) + lendesc ||
+ lendata < sizeof(struct scsi_write_using_token_data) - 2 + lendesc) {
ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0,
- /*field*/ 2, /*bit_valid*/ 0, /*bit*/ 0);
+ /*field*/ 534, /*bit_valid*/ 0, /*bit*/ 0);
goto done;
}
/*
@@ -2099,6 +2175,24 @@ ctl_write_using_token(struct ctl_scsiio *ctsio)
data->flags, scsi_8btou64(data->offset_into_rod),
scsi_2btoul(data->range_descriptor_length));
*/
+
+ /* Validate list of ranges */
+ if (tpc_check_ranges_l(&data->desc[0],
+ scsi_2btoul(data->range_descriptor_length) /
+ sizeof(struct scsi_range_desc),
+ lun->be_lun->maxlba) != 0) {
+ ctl_set_lba_out_of_range(ctsio);
+ goto done;
+ }
+ if (tpc_check_ranges_x(&data->desc[0],
+ scsi_2btoul(data->range_descriptor_length) /
+ sizeof(struct scsi_range_desc)) != 0) {
+ ctl_set_invalid_field(ctsio, /*sks_valid*/ 0,
+ /*command*/ 0, /*field*/ 0, /*bit_valid*/ 0,
+ /*bit*/ 0);
+ goto done;
+ }
+
list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO);
list->service_action = cdb->service_action;
list->init_port = ctsio->io_hdr.nexus.targ_port;
diff --git a/sys/cam/scsi/scsi_enc_safte.c b/sys/cam/scsi/scsi_enc_safte.c
index 8282d01..8b2a592 100644
--- a/sys/cam/scsi/scsi_enc_safte.c
+++ b/sys/cam/scsi/scsi_enc_safte.c
@@ -292,11 +292,8 @@ safte_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
cfg->DoorLock + cfg->Ntherm + cfg->Nspkrs + cfg->Ntstats + 1;
ENC_FREE_AND_NULL(enc->enc_cache.elm_map);
enc->enc_cache.elm_map =
- ENC_MALLOCZ(enc->enc_cache.nelms * sizeof(enc_element_t));
- if (enc->enc_cache.elm_map == NULL) {
- enc->enc_cache.nelms = 0;
- return (ENOMEM);
- }
+ malloc(enc->enc_cache.nelms * sizeof(enc_element_t),
+ M_SCSIENC, M_WAITOK|M_ZERO);
r = 0;
/*
diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c
index 34b0238..8387ef2 100644
--- a/sys/cam/scsi/scsi_enc_ses.c
+++ b/sys/cam/scsi/scsi_enc_ses.c
@@ -715,13 +715,15 @@ ses_cache_clone(enc_softc_t *enc, enc_cache_t *src, enc_cache_t *dst)
* The element map is independent even though it starts out
* pointing to the same constant page data.
*/
- dst->elm_map = ENC_MALLOCZ(dst->nelms * sizeof(enc_element_t));
+ dst->elm_map = malloc(dst->nelms * sizeof(enc_element_t),
+ M_SCSIENC, M_WAITOK);
memcpy(dst->elm_map, src->elm_map, dst->nelms * sizeof(enc_element_t));
for (dst_elm = dst->elm_map, src_elm = src->elm_map,
last_elm = &src->elm_map[src->nelms];
src_elm != last_elm; src_elm++, dst_elm++) {
- dst_elm->elm_private = ENC_MALLOCZ(sizeof(ses_element_t));
+ dst_elm->elm_private = malloc(sizeof(ses_element_t),
+ M_SCSIENC, M_WAITOK);
memcpy(dst_elm->elm_private, src_elm->elm_private,
sizeof(ses_element_t));
}
@@ -1066,11 +1068,7 @@ ses_set_physpath(enc_softc_t *enc, enc_element_t *elm,
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.buftype = CDAI_TYPE_SCSI_DEVID;
cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN;
- cdai.buf = devid = ENC_MALLOCZ(cdai.bufsiz);
- if (devid == NULL) {
- ret = ENOMEM;
- goto out;
- }
+ cdai.buf = devid = malloc(cdai.bufsiz, M_SCSIENC, M_WAITOK|M_ZERO);
cam_periph_lock(enc->periph);
xpt_action((union ccb *)&cdai);
if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0)
@@ -1371,12 +1369,8 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
* Now waltz through all the subenclosures summing the number of
* types available in each.
*/
- subencs = ENC_MALLOCZ(ses_cfg_page_get_num_subenc(cfg_page)
- * sizeof(*subencs));
- if (subencs == NULL) {
- err = ENOMEM;
- goto out;
- }
+ subencs = malloc(ses_cfg_page_get_num_subenc(cfg_page)
+ * sizeof(*subencs), M_SCSIENC, M_WAITOK|M_ZERO);
/*
* Sub-enclosure data is const after construction (i.e. when
* accessed via our cache object.
@@ -1414,11 +1408,8 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
}
/* Process the type headers. */
- ses_types = ENC_MALLOCZ(ntype * sizeof(*ses_types));
- if (ses_types == NULL) {
- err = ENOMEM;
- goto out;
- }
+ ses_types = malloc(ntype * sizeof(*ses_types),
+ M_SCSIENC, M_WAITOK|M_ZERO);
/*
* Type data is const after construction (i.e. when accessed via
* our cache object.
@@ -1455,11 +1446,8 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
}
/* Create the object map. */
- enc_cache->elm_map = ENC_MALLOCZ(nelm * sizeof(enc_element_t));
- if (enc_cache->elm_map == NULL) {
- err = ENOMEM;
- goto out;
- }
+ enc_cache->elm_map = malloc(nelm * sizeof(enc_element_t),
+ M_SCSIENC, M_WAITOK|M_ZERO);
enc_cache->nelms = nelm;
ses_iter_init(enc, enc_cache, &iter);
@@ -1473,11 +1461,8 @@ ses_process_config(enc_softc_t *enc, struct enc_fsm_state *state,
element->subenclosure = thdr->etype_subenc;
element->enctype = thdr->etype_elm_type;
element->overall_status_elem = iter.type_element_index == 0;
- element->elm_private = ENC_MALLOCZ(sizeof(ses_element_t));
- if (element->elm_private == NULL) {
- err = ENOMEM;
- goto out;
- }
+ element->elm_private = malloc(sizeof(ses_element_t),
+ M_SCSIENC, M_WAITOK|M_ZERO);
ENC_DLOG(enc, "%s: creating elmpriv %d(%d,%d) subenc %d "
"type 0x%x\n", __func__, iter.global_element_index,
iter.type_index, iter.type_element_index,
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 1a47196..e371985 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -69,108 +69,106 @@ __FBSDID("$FreeBSD$");
int
linux_creat(struct thread *td, struct linux_creat_args *args)
{
- char *path;
- int error;
-
- LCONVPATHEXIST(td, args->path, &path);
+ char *path;
+ int error;
+ LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(creat))
printf(ARGS(creat, "%s, %d"), path, args->mode);
#endif
- error = kern_open(td, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC,
- args->mode);
- LFREEPATH(path);
- return (error);
+ error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE,
+ O_WRONLY | O_CREAT | O_TRUNC, args->mode);
+ LFREEPATH(path);
+ return (error);
}
static int
linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mode)
{
- cap_rights_t rights;
- struct proc *p = td->td_proc;
- struct file *fp;
- int fd;
- int bsd_flags, error;
-
- bsd_flags = 0;
- switch (l_flags & LINUX_O_ACCMODE) {
- case LINUX_O_WRONLY:
- bsd_flags |= O_WRONLY;
- break;
- case LINUX_O_RDWR:
- bsd_flags |= O_RDWR;
- break;
- default:
- bsd_flags |= O_RDONLY;
- }
- if (l_flags & LINUX_O_NDELAY)
- bsd_flags |= O_NONBLOCK;
- if (l_flags & LINUX_O_APPEND)
- bsd_flags |= O_APPEND;
- if (l_flags & LINUX_O_SYNC)
- bsd_flags |= O_FSYNC;
- if (l_flags & LINUX_O_NONBLOCK)
- bsd_flags |= O_NONBLOCK;
- if (l_flags & LINUX_FASYNC)
- bsd_flags |= O_ASYNC;
- if (l_flags & LINUX_O_CREAT)
- bsd_flags |= O_CREAT;
- if (l_flags & LINUX_O_TRUNC)
- bsd_flags |= O_TRUNC;
- if (l_flags & LINUX_O_EXCL)
- bsd_flags |= O_EXCL;
- if (l_flags & LINUX_O_NOCTTY)
- bsd_flags |= O_NOCTTY;
- if (l_flags & LINUX_O_DIRECT)
- bsd_flags |= O_DIRECT;
- if (l_flags & LINUX_O_NOFOLLOW)
- bsd_flags |= O_NOFOLLOW;
- if (l_flags & LINUX_O_DIRECTORY)
- bsd_flags |= O_DIRECTORY;
- /* XXX LINUX_O_NOATIME: unable to be easily implemented. */
-
- error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
- if (error != 0)
- goto done;
-
- if (bsd_flags & O_NOCTTY)
- goto done;
-
- /*
- * XXX In between kern_open() and fget(), another process
- * having the same filedesc could use that fd without
- * checking below.
- */
- fd = td->td_retval[0];
- if (fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp) == 0) {
- if (fp->f_type != DTYPE_VNODE) {
- fdrop(fp, td);
- goto done;
- }
- sx_slock(&proctree_lock);
- PROC_LOCK(p);
- if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
- PROC_UNLOCK(p);
- sx_sunlock(&proctree_lock);
- /* XXXPJD: Verify if TIOCSCTTY is allowed. */
- (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
- td->td_ucred, td);
- } else {
- PROC_UNLOCK(p);
- sx_sunlock(&proctree_lock);
- }
- fdrop(fp, td);
- }
+ cap_rights_t rights;
+ struct proc *p = td->td_proc;
+ struct file *fp;
+ int fd;
+ int bsd_flags, error;
+
+ bsd_flags = 0;
+ switch (l_flags & LINUX_O_ACCMODE) {
+ case LINUX_O_WRONLY:
+ bsd_flags |= O_WRONLY;
+ break;
+ case LINUX_O_RDWR:
+ bsd_flags |= O_RDWR;
+ break;
+ default:
+ bsd_flags |= O_RDONLY;
+ }
+ if (l_flags & LINUX_O_NDELAY)
+ bsd_flags |= O_NONBLOCK;
+ if (l_flags & LINUX_O_APPEND)
+ bsd_flags |= O_APPEND;
+ if (l_flags & LINUX_O_SYNC)
+ bsd_flags |= O_FSYNC;
+ if (l_flags & LINUX_O_NONBLOCK)
+ bsd_flags |= O_NONBLOCK;
+ if (l_flags & LINUX_FASYNC)
+ bsd_flags |= O_ASYNC;
+ if (l_flags & LINUX_O_CREAT)
+ bsd_flags |= O_CREAT;
+ if (l_flags & LINUX_O_TRUNC)
+ bsd_flags |= O_TRUNC;
+ if (l_flags & LINUX_O_EXCL)
+ bsd_flags |= O_EXCL;
+ if (l_flags & LINUX_O_NOCTTY)
+ bsd_flags |= O_NOCTTY;
+ if (l_flags & LINUX_O_DIRECT)
+ bsd_flags |= O_DIRECT;
+ if (l_flags & LINUX_O_NOFOLLOW)
+ bsd_flags |= O_NOFOLLOW;
+ if (l_flags & LINUX_O_DIRECTORY)
+ bsd_flags |= O_DIRECTORY;
+ /* XXX LINUX_O_NOATIME: unable to be easily implemented. */
+
+ error = kern_openat(td, dirfd, path, UIO_SYSSPACE, bsd_flags, mode);
+ if (error != 0)
+ goto done;
+ if (bsd_flags & O_NOCTTY)
+ goto done;
+
+ /*
+ * XXX In between kern_open() and fget(), another process
+ * having the same filedesc could use that fd without
+ * checking below.
+ */
+ fd = td->td_retval[0];
+ if (fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp) == 0) {
+ if (fp->f_type != DTYPE_VNODE) {
+ fdrop(fp, td);
+ goto done;
+ }
+ sx_slock(&proctree_lock);
+ PROC_LOCK(p);
+ if (SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
+ PROC_UNLOCK(p);
+ sx_sunlock(&proctree_lock);
+ /* XXXPJD: Verify if TIOCSCTTY is allowed. */
+ (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
+ td->td_ucred, td);
+ } else {
+ PROC_UNLOCK(p);
+ sx_sunlock(&proctree_lock);
+ }
+ fdrop(fp, td);
+ }
done:
#ifdef DEBUG
- if (ldebug(open))
- printf(LMSG("open returns error %d"), error);
+ if (ldebug(open))
+ printf(LMSG("open returns error %d"), error);
#endif
- LFREEPATH(path);
- return (error);
+ LFREEPATH(path);
+ return (error);
}
int
@@ -195,44 +193,41 @@ linux_openat(struct thread *td, struct linux_openat_args *args)
int
linux_open(struct thread *td, struct linux_open_args *args)
{
- char *path;
-
- if (args->flags & LINUX_O_CREAT)
- LCONVPATHCREAT(td, args->path, &path);
- else
- LCONVPATHEXIST(td, args->path, &path);
+ char *path;
+ if (args->flags & LINUX_O_CREAT)
+ LCONVPATHCREAT(td, args->path, &path);
+ else
+ LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(open))
printf(ARGS(open, "%s, 0x%x, 0x%x"),
path, args->flags, args->mode);
#endif
-
return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode));
}
int
linux_lseek(struct thread *td, struct linux_lseek_args *args)
{
-
- struct lseek_args /* {
- int fd;
- int pad;
- off_t offset;
- int whence;
- } */ tmp_args;
- int error;
+ struct lseek_args /* {
+ int fd;
+ int pad;
+ off_t offset;
+ int whence;
+ } */ tmp_args;
+ int error;
#ifdef DEBUG
if (ldebug(lseek))
printf(ARGS(lseek, "%d, %ld, %d"),
args->fdes, (long)args->off, args->whence);
#endif
- tmp_args.fd = args->fdes;
- tmp_args.offset = (off_t)args->off;
- tmp_args.whence = args->whence;
- error = sys_lseek(td, &tmp_args);
- return error;
+ tmp_args.fd = args->fdes;
+ tmp_args.offset = (off_t)args->off;
+ tmp_args.whence = args->whence;
+ error = sys_lseek(td, &tmp_args);
+ return (error);
}
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
@@ -255,13 +250,13 @@ linux_llseek(struct thread *td, struct linux_llseek_args *args)
bsd_args.whence = args->whence;
if ((error = sys_lseek(td, &bsd_args)))
- return error;
+ return (error);
if ((error = copyout(td->td_retval, args->res, sizeof (off_t))))
- return error;
+ return (error);
td->td_retval[0] = 0;
- return 0;
+ return (0);
}
int
@@ -272,7 +267,7 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args)
lda.fd = args->fd;
lda.dent = args->dent;
lda.count = 1;
- return linux_getdents(td, &lda);
+ return (linux_getdents(td, &lda));
}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
@@ -945,7 +940,7 @@ linux_ftruncate(struct thread *td, struct linux_ftruncate_args *args)
int pad;
off_t length;
} */ nuap;
-
+
nuap.fd = args->fd;
nuap.length = args->length;
return (sys_ftruncate(td, &nuap));
@@ -1016,7 +1011,7 @@ linux_fdatasync(td, uap)
struct fsync_args bsd;
bsd.fd = uap->fd;
- return sys_fsync(td, &bsd);
+ return (sys_fsync(td, &bsd));
}
int
@@ -1033,9 +1028,7 @@ linux_pread(td, uap)
bsd.buf = uap->buf;
bsd.nbyte = uap->nbyte;
bsd.offset = uap->offset;
-
error = sys_pread(td, &bsd);
-
if (error == 0) {
/* This seems to violate POSIX but linux does it */
error = fgetvp(td, uap->fd,
@@ -1048,7 +1041,6 @@ linux_pread(td, uap)
}
vrele(vp);
}
-
return (error);
}
@@ -1063,7 +1055,7 @@ linux_pwrite(td, uap)
bsd.buf = uap->buf;
bsd.nbyte = uap->nbyte;
bsd.offset = uap->offset;
- return sys_pwrite(td, &bsd);
+ return (sys_pwrite(td, &bsd));
}
int
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index c7688ae..14d2d528 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -1,7 +1,9 @@
/* $NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $ */
/*-
- * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
+ * Copyright (c) 2009-2016 Dmitry Chagin
+ * Copyright (c) 2005 Emmanuel Dreyfus
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -53,9 +55,10 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $")
#include <sys/queue.h>
#include <sys/sched.h>
#include <sys/sdt.h>
-#include <sys/sx.h>
#include <sys/umtx.h>
+#include <vm/vm_extern.h>
+
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@@ -107,7 +110,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_get, entry, "uint32_t *",
LIN_SDT_PROBE_DEFINE0(futex, futex_get, error);
LIN_SDT_PROBE_DEFINE1(futex, futex_get, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, entry, "struct futex *",
- "struct waiting_proc **", "int");
+ "struct waiting_proc **", "struct timespec *");
LIN_SDT_PROBE_DEFINE5(futex, futex_sleep, requeue_error, "int", "uint32_t *",
"struct waiting_proc *", "uint32_t *", "uint32_t");
LIN_SDT_PROBE_DEFINE3(futex, futex_sleep, sleep_error, "int", "uint32_t *",
@@ -126,7 +129,7 @@ LIN_SDT_PROBE_DEFINE3(futex, futex_requeue, requeue, "uint32_t *",
"struct waiting_proc *", "uint32_t");
LIN_SDT_PROBE_DEFINE1(futex, futex_requeue, return, "int");
LIN_SDT_PROBE_DEFINE4(futex, futex_wait, entry, "struct futex *",
- "struct waiting_proc **", "int", "uint32_t");
+ "struct waiting_proc **", "struct timespec *", "uint32_t");
LIN_SDT_PROBE_DEFINE1(futex, futex_wait, sleep_error, "int");
LIN_SDT_PROBE_DEFINE1(futex, futex_wait, return, "int");
LIN_SDT_PROBE_DEFINE3(futex, futex_atomic_op, entry, "struct thread *",
@@ -140,7 +143,6 @@ LIN_SDT_PROBE_DEFINE1(futex, futex_atomic_op, return, "int");
LIN_SDT_PROBE_DEFINE2(futex, linux_sys_futex, entry, "struct thread *",
"struct linux_sys_futex_args *");
LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, unimplemented_clockswitch);
-LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, itimerfix_error, "int");
LIN_SDT_PROBE_DEFINE1(futex, linux_sys_futex, copyin_error, "int");
LIN_SDT_PROBE_DEFINE0(futex, linux_sys_futex, invalid_cmp_requeue_use);
LIN_SDT_PROBE_DEFINE3(futex, linux_sys_futex, debug_wait, "uint32_t *",
@@ -195,7 +197,7 @@ struct waiting_proc {
};
struct futex {
- struct sx f_lck;
+ struct mtx f_lck;
uint32_t *f_uaddr; /* user-supplied value, for debug */
struct umtx_key f_key;
uint32_t f_refcount;
@@ -206,20 +208,22 @@ struct futex {
struct futex_list futex_list;
-#define FUTEX_LOCK(f) sx_xlock(&(f)->f_lck)
-#define FUTEX_UNLOCK(f) sx_xunlock(&(f)->f_lck)
+#define FUTEX_LOCK(f) mtx_lock(&(f)->f_lck)
+#define FUTEX_LOCKED(f) mtx_owned(&(f)->f_lck)
+#define FUTEX_UNLOCK(f) mtx_unlock(&(f)->f_lck)
#define FUTEX_INIT(f) do { \
- sx_init_flags(&(f)->f_lck, "ftlk", \
- SX_DUPOK); \
+ mtx_init(&(f)->f_lck, "ftlk", NULL, \
+ MTX_DUPOK); \
LIN_SDT_PROBE1(futex, futex, create, \
&(f)->f_lck); \
} while (0)
#define FUTEX_DESTROY(f) do { \
LIN_SDT_PROBE1(futex, futex, destroy, \
&(f)->f_lck); \
- sx_destroy(&(f)->f_lck); \
+ mtx_destroy(&(f)->f_lck); \
} while (0)
-#define FUTEX_ASSERT_LOCKED(f) sx_assert(&(f)->f_lck, SA_XLOCKED)
+#define FUTEX_ASSERT_LOCKED(f) mtx_assert(&(f)->f_lck, MA_OWNED)
+#define FUTEX_ASSERT_UNLOCKED(f) mtx_assert(&(f)->f_lck, MA_NOTOWNED)
struct mtx futex_mtx; /* protects the futex list */
#define FUTEXES_LOCK do { \
@@ -238,6 +242,7 @@ struct mtx futex_mtx; /* protects the futex list */
#define FUTEX_DONTCREATE 0x2 /* don't create futex if not exists */
#define FUTEX_DONTEXISTS 0x4 /* return EINVAL if futex exists */
#define FUTEX_SHARED 0x8 /* shared futex */
+#define FUTEX_DONTLOCK 0x10 /* don't lock futex */
/* wp_flags */
#define FUTEX_WP_REQUEUED 0x1 /* wp requeued - wp moved from wp_list
@@ -252,11 +257,15 @@ static void futex_put(struct futex *, struct waiting_proc *);
static int futex_get0(uint32_t *, struct futex **f, uint32_t);
static int futex_get(uint32_t *, struct waiting_proc **, struct futex **,
uint32_t);
-static int futex_sleep(struct futex *, struct waiting_proc *, int);
+static int futex_sleep(struct futex *, struct waiting_proc *, struct timespec *);
static int futex_wake(struct futex *, int, uint32_t);
static int futex_requeue(struct futex *, int, struct futex *, int);
-static int futex_wait(struct futex *, struct waiting_proc *, int,
+static int futex_copyin_timeout(int, struct l_timespec *, int,
+ struct timespec *);
+static int futex_wait(struct futex *, struct waiting_proc *, struct timespec *,
uint32_t);
+static void futex_lock(struct futex *);
+static void futex_unlock(struct futex *);
static int futex_atomic_op(struct thread *, int, uint32_t *);
static int handle_futex_death(struct linux_emuldata *, uint32_t *,
unsigned int);
@@ -271,12 +280,39 @@ int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
+static int
+futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt,
+ struct timespec *ts)
+{
+ struct l_timespec lts;
+ struct timespec kts;
+ int error;
+
+ error = copyin(luts, &lts, sizeof(lts));
+ if (error)
+ return (error);
+
+ error = linux_to_native_timespec(ts, &lts);
+ if (error)
+ return (error);
+ if (ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000)
+ return (EINVAL);
+
+ if (clockrt) {
+ nanotime(&kts);
+ timespecsub(ts, &kts);
+ } else if (op == LINUX_FUTEX_WAIT_BITSET) {
+ nanouptime(&kts);
+ timespecsub(ts, &kts);
+ }
+ return (error);
+}
+
static void
futex_put(struct futex *f, struct waiting_proc *wp)
{
LIN_SDT_PROBE2(futex, futex_put, entry, f, wp);
- FUTEX_ASSERT_LOCKED(f);
if (wp != NULL) {
if ((wp->wp_flags & FUTEX_WP_REMOVED) == 0)
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
@@ -287,7 +323,8 @@ futex_put(struct futex *f, struct waiting_proc *wp)
if (--f->f_refcount == 0) {
LIST_REMOVE(f, f_list);
FUTEXES_UNLOCK;
- FUTEX_UNLOCK(f);
+ if (FUTEX_LOCKED(f))
+ futex_unlock(f);
LIN_SDT_PROBE3(futex, futex_put, destroy, f->f_uaddr,
f->f_refcount, f->f_key.shared);
@@ -306,7 +343,8 @@ futex_put(struct futex *f, struct waiting_proc *wp)
LINUX_CTR3(sys_futex, "futex_put uaddr %p ref %d shared %d",
f->f_uaddr, f->f_refcount, f->f_key.shared);
FUTEXES_UNLOCK;
- FUTEX_UNLOCK(f);
+ if (FUTEX_LOCKED(f))
+ futex_unlock(f);
LIN_SDT_PROBE0(futex, futex_put, return);
}
@@ -334,7 +372,8 @@ retry:
LIST_FOREACH(f, &futex_list, f_list) {
if (umtx_key_match(&f->f_key, &key)) {
if (tmpf != NULL) {
- FUTEX_UNLOCK(tmpf);
+ if (FUTEX_LOCKED(tmpf))
+ futex_unlock(tmpf);
FUTEX_DESTROY(tmpf);
free(tmpf, M_FUTEX);
}
@@ -355,7 +394,8 @@ retry:
FUTEXES_UNLOCK;
umtx_key_release(&key);
- FUTEX_LOCK(f);
+ if ((flags & FUTEX_DONTLOCK) == 0)
+ futex_lock(f);
*newf = f;
LIN_SDT_PROBE3(futex, futex_get0, shared, uaddr,
f->f_refcount, f->f_key.shared);
@@ -391,7 +431,8 @@ retry:
* Lock the new futex before an insert into the futex_list
* to prevent futex usage by other.
*/
- FUTEX_LOCK(tmpf);
+ if ((flags & FUTEX_DONTLOCK) == 0)
+ futex_lock(tmpf);
goto retry;
}
@@ -439,16 +480,56 @@ futex_get(uint32_t *uaddr, struct waiting_proc **wp, struct futex **f,
return (error);
}
+static inline void
+futex_lock(struct futex *f)
+{
+
+ LINUX_CTR3(sys_futex, "futex_lock uaddr %p ref %d shared %d",
+ f->f_uaddr, f->f_refcount, f->f_key.shared);
+ FUTEX_ASSERT_UNLOCKED(f);
+ FUTEX_LOCK(f);
+}
+
+static inline void
+futex_unlock(struct futex *f)
+{
+
+ LINUX_CTR3(sys_futex, "futex_unlock uaddr %p ref %d shared %d",
+ f->f_uaddr, f->f_refcount, f->f_key.shared);
+ FUTEX_ASSERT_LOCKED(f);
+ FUTEX_UNLOCK(f);
+}
+
static int
-futex_sleep(struct futex *f, struct waiting_proc *wp, int timeout)
+futex_sleep(struct futex *f, struct waiting_proc *wp, struct timespec *ts)
{
+ struct timespec uts;
+ sbintime_t sbt, prec, tmp;
+ time_t over;
int error;
FUTEX_ASSERT_LOCKED(f);
- LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, timeout);
- LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %d ref %d",
- f->f_uaddr, wp, timeout, f->f_refcount);
- error = sx_sleep(wp, &f->f_lck, PCATCH, "futex", timeout);
+ if (ts != NULL) {
+ uts = *ts;
+ if (uts.tv_sec > INT32_MAX / 2) {
+ over = uts.tv_sec - INT32_MAX / 2;
+ uts.tv_sec -= over;
+ }
+ tmp = tstosbt(uts);
+ if (TIMESEL(&sbt, tmp))
+ sbt += tc_tick_sbt;
+ sbt += tmp;
+ prec = tmp;
+ prec >>= tc_precexp;
+ } else {
+ sbt = 0;
+ prec = 0;
+ }
+ LIN_SDT_PROBE3(futex, futex_sleep, entry, f, wp, sbt);
+ LINUX_CTR4(sys_futex, "futex_sleep enter uaddr %p wp %p timo %ld ref %d",
+ f->f_uaddr, wp, sbt, f->f_refcount);
+
+ error = msleep_sbt(wp, &f->f_lck, PCATCH, "futex", sbt, prec, C_ABSOLUTE);
if (wp->wp_flags & FUTEX_WP_REQUEUED) {
KASSERT(f != wp->wp_futex, ("futex != wp_futex"));
@@ -464,7 +545,7 @@ futex_sleep(struct futex *f, struct waiting_proc *wp, int timeout)
wp->wp_futex->f_refcount);
futex_put(f, NULL);
f = wp->wp_futex;
- FUTEX_LOCK(f);
+ futex_lock(f);
} else {
if (error) {
LIN_SDT_PROBE3(futex, futex_sleep, sleep_error, error,
@@ -566,12 +647,12 @@ futex_requeue(struct futex *f, int n, struct futex *f2, int n2)
}
static int
-futex_wait(struct futex *f, struct waiting_proc *wp, int timeout_hz,
+futex_wait(struct futex *f, struct waiting_proc *wp, struct timespec *ts,
uint32_t bitset)
{
int error;
- LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, timeout_hz, bitset);
+ LIN_SDT_PROBE4(futex, futex_wait, entry, f, wp, ts, bitset);
if (bitset == 0) {
LIN_SDT_PROBE1(futex, futex_wait, return, EINVAL);
@@ -579,7 +660,7 @@ futex_wait(struct futex *f, struct waiting_proc *wp, int timeout_hz,
}
f->f_bitset = bitset;
- error = futex_sleep(f, wp, timeout_hz);
+ error = futex_sleep(f, wp, ts);
if (error)
LIN_SDT_PROBE1(futex, futex_wait, sleep_error, error);
if (error == EWOULDBLOCK)
@@ -605,7 +686,7 @@ futex_atomic_op(struct thread *td, int encoded_op, uint32_t *uaddr)
LIN_SDT_PROBE4(futex, futex_atomic_op, decoded_op, op, cmp, oparg,
cmparg);
-
+
/* XXX: Linux verifies access here and returns EFAULT */
LIN_SDT_PROBE0(futex, futex_atomic_op, missing_access_check);
@@ -671,11 +752,8 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
struct linux_pemuldata *pem;
struct waiting_proc *wp;
struct futex *f, *f2;
- struct l_timespec ltimeout;
- struct timespec timeout;
- struct timeval utv, ctv;
- int timeout_hz;
- int error;
+ struct timespec uts, *ts;
+ int error, save;
uint32_t flags, val;
LIN_SDT_PROBE2(futex, linux_sys_futex, entry, td, args);
@@ -717,37 +795,19 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
args->uaddr, args->val, args->val3);
if (args->timeout != NULL) {
- error = copyin(args->timeout, &ltimeout, sizeof(ltimeout));
+ error = futex_copyin_timeout(args->op, args->timeout,
+ clockrt, &uts);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error,
error);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
- error = linux_to_native_timespec(&timeout, &ltimeout);
- if (error)
- return (error);
- TIMESPEC_TO_TIMEVAL(&utv, &timeout);
- error = itimerfix(&utv);
- if (error) {
- LIN_SDT_PROBE1(futex, linux_sys_futex, itimerfix_error,
- error);
- LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
- return (error);
- }
- if (clockrt) {
- microtime(&ctv);
- timevalsub(&utv, &ctv);
- } else if (args->op == LINUX_FUTEX_WAIT_BITSET) {
- microuptime(&ctv);
- timevalsub(&utv, &ctv);
- }
- if (utv.tv_sec < 0)
- timevalclear(&utv);
- timeout_hz = tvtohz(&utv);
+ ts = &uts;
} else
- timeout_hz = 0;
+ ts = NULL;
+retry0:
error = futex_get(args->uaddr, &wp, &f,
flags | FUTEX_CREATE_WP);
if (error) {
@@ -755,14 +815,16 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
return (error);
}
- error = copyin(args->uaddr, &val, sizeof(val));
+ error = copyin_nofault(args->uaddr, &val, sizeof(val));
if (error) {
+ futex_put(f, wp);
+ error = copyin(args->uaddr, &val, sizeof(val));
+ if (error == 0)
+ goto retry0;
LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error,
error);
LINUX_CTR1(sys_futex, "WAIT copyin failed %d",
error);
- futex_put(f, wp);
-
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
@@ -780,7 +842,7 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
return (EWOULDBLOCK);
}
- error = futex_wait(f, wp, timeout_hz, args->val3);
+ error = futex_wait(f, wp, ts, args->val3);
break;
case LINUX_FUTEX_WAKE:
@@ -830,7 +892,8 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
return (EINVAL);
}
- error = futex_get(args->uaddr, NULL, &f, flags);
+retry1:
+ error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
@@ -844,22 +907,26 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
* returned by FUTEX_CMP_REQUEUE.
*/
error = futex_get(args->uaddr2, NULL, &f2,
- flags | FUTEX_DONTEXISTS);
+ flags | FUTEX_DONTEXISTS | FUTEX_DONTLOCK);
if (error) {
futex_put(f, NULL);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
- error = copyin(args->uaddr, &val, sizeof(val));
+ futex_lock(f);
+ futex_lock(f2);
+ error = copyin_nofault(args->uaddr, &val, sizeof(val));
if (error) {
+ futex_put(f2, NULL);
+ futex_put(f, NULL);
+ error = copyin(args->uaddr, &val, sizeof(val));
+ if (error == 0)
+ goto retry1;
LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error,
error);
LINUX_CTR1(sys_futex, "CMP_REQUEUE copyin failed %d",
error);
- futex_put(f2, NULL);
- futex_put(f, NULL);
-
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
@@ -889,50 +956,45 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
args->uaddr, args->val, args->uaddr2, args->val3,
args->timeout);
- error = futex_get(args->uaddr, NULL, &f, flags);
+retry2:
+ error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK);
if (error) {
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
if (args->uaddr != args->uaddr2)
- error = futex_get(args->uaddr2, NULL, &f2, flags);
+ error = futex_get(args->uaddr2, NULL, &f2,
+ flags | FUTEX_DONTLOCK);
if (error) {
futex_put(f, NULL);
LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
return (error);
}
+ futex_lock(f);
+ futex_lock(f2);
/*
* This function returns positive number as results and
* negative as errors
*/
+ save = vm_fault_disable_pagefaults();
op_ret = futex_atomic_op(td, args->val3, args->uaddr2);
+ vm_fault_enable_pagefaults(save);
LINUX_CTR2(sys_futex, "WAKE_OP atomic_op uaddr %p ret 0x%x",
args->uaddr, op_ret);
if (op_ret < 0) {
- /* XXX: We don't handle the EFAULT yet. */
- if (op_ret != -EFAULT) {
- if (f2 != NULL)
- futex_put(f2, NULL);
- futex_put(f, NULL);
-
- LIN_SDT_PROBE1(futex, linux_sys_futex, return,
- -op_ret);
- return (-op_ret);
- } else {
- LIN_SDT_PROBE0(futex, linux_sys_futex,
- unhandled_efault);
- }
if (f2 != NULL)
futex_put(f2, NULL);
futex_put(f, NULL);
-
- LIN_SDT_PROBE1(futex, linux_sys_futex, return, EFAULT);
- return (EFAULT);
+ error = copyin(args->uaddr2, &val, sizeof(val));
+ if (error == 0)
+ goto retry2;
+ LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
+ return (error);
}
ret = futex_wake(f, args->val, args->val3);
@@ -997,7 +1059,6 @@ linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
return (ENOSYS);
case LINUX_FUTEX_REQUEUE:
-
/*
* Glibc does not use this operation since version 2.3.3,
* as it is racy and replaced by FUTEX_CMP_REQUEUE operation.
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index 8858e2f..7185a12 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -915,6 +915,8 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
case LINUX_TIOCGSERIAL: {
struct linux_serial_struct lss;
+
+ bzero(&lss, sizeof(lss));
lss.type = LINUX_PORT_16550A;
lss.flags = 0;
lss.close_delay = 0;
@@ -976,7 +978,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line,
td->td_ucred, td);
if (error)
- return (error);
+ break;
switch (bsd_line) {
case TTYDISC:
linux_line = LINUX_N_TTY;
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 86f9ac3..db7488b 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -150,6 +150,7 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
int i, j;
struct timespec ts;
+ bzero(&sysinfo, sizeof(sysinfo));
getnanouptime(&ts);
if (ts.tv_nsec != 0)
ts.tv_sec++;
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index b33b260..bc543c7 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -462,12 +462,16 @@ bsd_to_linux_sockaddr(struct sockaddr *arg)
{
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
- int error;
+ int error, bdom;
if ((error = copyin(arg, &sa, sa_len)))
return (error);
- *(u_short *)&sa = sa.sa_family;
+ bdom = bsd_to_linux_domain(sa.sa_family);
+ if (bdom == -1)
+ return (EAFNOSUPPORT);
+
+ *(u_short *)&sa = bdom;
return (copyout(&sa, arg, sa_len));
}
@@ -476,12 +480,16 @@ linux_to_bsd_sockaddr(struct sockaddr *arg, int len)
{
struct sockaddr sa;
size_t sa_len = sizeof(struct sockaddr);
- int error;
+ int error, bdom;
if ((error = copyin(arg, &sa, sa_len)))
return (error);
- sa.sa_family = *(sa_family_t *)&sa;
+ bdom = linux_to_bsd_domain(*(sa_family_t *)&sa);
+ if (bdom == -1)
+ return (EAFNOSUPPORT);
+
+ sa.sa_family = bdom;
sa.sa_len = len;
return (copyout(&sa, arg, sa_len));
}
@@ -1594,10 +1602,10 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
} */ bsd_args;
l_timeval linux_tv;
struct timeval tv;
- socklen_t tv_len, xulen;
+ socklen_t tv_len, xulen, len;
struct xucred xu;
struct l_ucred lxu;
- int error, name;
+ int error, name, newval;
bsd_args.s = args->s;
bsd_args.level = linux_to_bsd_sockopt_level(args->level);
@@ -1636,6 +1644,15 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
return (copyout(&lxu, PTRIN(args->optval), sizeof(lxu)));
/* NOTREACHED */
break;
+ case SO_ERROR:
+ len = sizeof(newval);
+ error = kern_getsockopt(td, args->s, bsd_args.level,
+ name, &newval, UIO_SYSSPACE, &len);
+ if (error)
+ return (error);
+ newval = -SV_ABI_ERRNO(td->td_proc, newval);
+ return (copyout(&newval, PTRIN(args->optval), len));
+ /* NOTREACHED */
default:
break;
}
diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c
index 482392d..1d198c0 100644
--- a/sys/compat/ndis/subr_ntoskrnl.c
+++ b/sys/compat/ndis/subr_ntoskrnl.c
@@ -3188,17 +3188,14 @@ atol(str)
static int
rand(void)
{
- struct timeval tv;
- microtime(&tv);
- srandom(tv.tv_usec);
- return ((int)random());
+ return (random());
}
static void
-srand(seed)
- unsigned int seed;
+srand(unsigned int seed)
{
+
srandom(seed);
}
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 2c22b3f..f96b4f3 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -208,6 +208,8 @@ dev/if_ndis/if_ndis_pccard.c optional ndis pccard
dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci
dev/if_ndis/if_ndis_usb.c optional ndis usb
dev/io/iodev.c optional io
+dev/ioat/ioat.c optional ioat pci
+dev/ioat/ioat_test.c optional ioat pci
dev/ipmi/ipmi.c optional ipmi
dev/ipmi/ipmi_acpi.c optional ipmi acpi
dev/ipmi/ipmi_isa.c optional ipmi isa
@@ -317,6 +319,17 @@ dev/qlxgbe/ql_isr.c optional qlxgbe pci
dev/qlxgbe/ql_misc.c optional qlxgbe pci
dev/qlxgbe/ql_os.c optional qlxgbe pci
dev/qlxgbe/ql_reset.c optional qlxgbe pci
+dev/sfxge/common/ef10_ev.c optional sfxge pci
+dev/sfxge/common/ef10_filter.c optional sfxge pci
+dev/sfxge/common/ef10_intr.c optional sfxge pci
+dev/sfxge/common/ef10_mac.c optional sfxge pci
+dev/sfxge/common/ef10_mcdi.c optional sfxge pci
+dev/sfxge/common/ef10_nic.c optional sfxge pci
+dev/sfxge/common/ef10_nvram.c optional sfxge pci
+dev/sfxge/common/ef10_phy.c optional sfxge pci
+dev/sfxge/common/ef10_rx.c optional sfxge pci
+dev/sfxge/common/ef10_tx.c optional sfxge pci
+dev/sfxge/common/ef10_vpd.c optional sfxge pci
dev/sfxge/common/efx_bootcfg.c optional sfxge pci
dev/sfxge/common/efx_crc32.c optional sfxge pci
dev/sfxge/common/efx_ev.c optional sfxge pci
@@ -336,18 +349,9 @@ dev/sfxge/common/efx_sram.c optional sfxge pci
dev/sfxge/common/efx_tx.c optional sfxge pci
dev/sfxge/common/efx_vpd.c optional sfxge pci
dev/sfxge/common/efx_wol.c optional sfxge pci
-dev/sfxge/common/hunt_ev.c optional sfxge pci
-dev/sfxge/common/hunt_filter.c optional sfxge pci
-dev/sfxge/common/hunt_intr.c optional sfxge pci
-dev/sfxge/common/hunt_mac.c optional sfxge pci
-dev/sfxge/common/hunt_mcdi.c optional sfxge pci
dev/sfxge/common/hunt_nic.c optional sfxge pci
-dev/sfxge/common/hunt_nvram.c optional sfxge pci
dev/sfxge/common/hunt_phy.c optional sfxge pci
-dev/sfxge/common/hunt_rx.c optional sfxge pci
-dev/sfxge/common/hunt_sram.c optional sfxge pci
-dev/sfxge/common/hunt_tx.c optional sfxge pci
-dev/sfxge/common/hunt_vpd.c optional sfxge pci
+dev/sfxge/common/mcdi_mon.c optional sfxge pci
dev/sfxge/common/medford_nic.c optional sfxge pci
dev/sfxge/common/siena_mac.c optional sfxge pci
dev/sfxge/common/siena_mcdi.c optional sfxge pci
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 6b81ec0..8b363d4 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -164,7 +164,7 @@ SRCS+= ${KMOD:S/$/.c/}
CLEANFILES+= ${KMOD:S/$/.c/}
.for _firmw in ${FIRMWS}
-${_firmw:C/\:.*$/.fwo/}: ${_firmw:C/\:.*$//}
+${_firmw:C/\:.*$/.fwo/:T}: ${_firmw:C/\:.*$//}
@${ECHO} ${_firmw:C/\:.*$//} ${.ALLSRC:M*${_firmw:C/\:.*$//}}
@if [ -e ${_firmw:C/\:.*$//} ]; then \
${LD} -b binary --no-warn-mismatch ${LDFLAGS} \
@@ -176,7 +176,7 @@ ${_firmw:C/\:.*$/.fwo/}: ${_firmw:C/\:.*$//}
rm ${_firmw:C/\:.*$//}; \
fi
-OBJS+= ${_firmw:C/\:.*$/.fwo/}
+OBJS+= ${_firmw:C/\:.*$/.fwo/:T}
.endfor
.endif
diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c
index 48067b6..1db24bd 100644
--- a/sys/dev/fb/vesa.c
+++ b/sys/dev/fb/vesa.c
@@ -1026,7 +1026,8 @@ vesa_bios_init(void)
++modes;
}
- vesa_vmode[modes].vi_mode = EOT;
+ if (vesa_vmode != NULL)
+ vesa_vmode[modes].vi_mode = EOT;
if (bootverbose)
printf("VESA: %d mode(s) found\n", modes);
diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
index 0159a9d..a780f9e 100644
--- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
@@ -81,12 +81,6 @@ __FBSDID("$FreeBSD$");
#define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS
#define STORVSC_MAX_TARGETS (2)
-#define STORVSC_WIN7_MAJOR 4
-#define STORVSC_WIN7_MINOR 2
-
-#define STORVSC_WIN8_MAJOR 5
-#define STORVSC_WIN8_MINOR 1
-
#define VSTOR_PKT_SIZE (sizeof(struct vstor_packet) - vmscsi_size_delta)
#define HV_ALIGN(x, a) roundup2(x, a)
@@ -208,7 +202,7 @@ static struct storvsc_driver_props g_drv_props_table[] = {
* Sense buffer size changed in win8; have a run-time
* variable to track the size we should use.
*/
-static int sense_buffer_size;
+static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE;
/*
* The size of the vmscsi_request has changed in win8. The
@@ -218,9 +212,46 @@ static int sense_buffer_size;
* Track the correct size we need to apply.
*/
static int vmscsi_size_delta;
+/*
+ * The storage protocol version is determined during the
+ * initial exchange with the host. It will indicate which
+ * storage functionality is available in the host.
+*/
+static int vmstor_proto_version;
+
+struct vmstor_proto {
+ int proto_version;
+ int sense_buffer_size;
+ int vmscsi_size_delta;
+};
-static int storvsc_current_major;
-static int storvsc_current_minor;
+static const struct vmstor_proto vmstor_proto_list[] = {
+ {
+ VMSTOR_PROTOCOL_VERSION_WIN10,
+ POST_WIN7_STORVSC_SENSE_BUFFER_SIZE,
+ 0
+ },
+ {
+ VMSTOR_PROTOCOL_VERSION_WIN8_1,
+ POST_WIN7_STORVSC_SENSE_BUFFER_SIZE,
+ 0
+ },
+ {
+ VMSTOR_PROTOCOL_VERSION_WIN8,
+ POST_WIN7_STORVSC_SENSE_BUFFER_SIZE,
+ 0
+ },
+ {
+ VMSTOR_PROTOCOL_VERSION_WIN7,
+ PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE,
+ sizeof(struct vmscsi_win8_extension),
+ },
+ {
+ VMSTOR_PROTOCOL_VERSION_WIN6,
+ PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE,
+ sizeof(struct vmscsi_win8_extension),
+ }
+};
/* static functions */
static int storvsc_probe(device_t dev);
@@ -435,7 +466,7 @@ storvsc_send_multichannel_request(struct hv_device *dev, int max_chans)
static int
hv_storvsc_channel_init(struct hv_device *dev)
{
- int ret = 0;
+ int ret = 0, i;
struct hv_storvsc_request *request;
struct vstor_packet *vstor_packet;
struct storvsc_softc *sc;
@@ -484,19 +515,20 @@ hv_storvsc_channel_init(struct hv_device *dev)
goto cleanup;
}
- /* reuse the packet for version range supported */
+ for (i = 0; i < nitems(vmstor_proto_list); i++) {
+ /* reuse the packet for version range supported */
- memset(vstor_packet, 0, sizeof(struct vstor_packet));
- vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION;
- vstor_packet->flags = REQUEST_COMPLETION_FLAG;
+ memset(vstor_packet, 0, sizeof(struct vstor_packet));
+ vstor_packet->operation = VSTOR_OPERATION_QUERYPROTOCOLVERSION;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;
- vstor_packet->u.version.major_minor =
- VMSTOR_PROTOCOL_VERSION(storvsc_current_major, storvsc_current_minor);
+ vstor_packet->u.version.major_minor =
+ vmstor_proto_list[i].proto_version;
- /* revision is only significant for Windows guests */
- vstor_packet->u.version.revision = 0;
+ /* revision is only significant for Windows guests */
+ vstor_packet->u.version.revision = 0;
- ret = hv_vmbus_channel_send_packet(
+ ret = hv_vmbus_channel_send_packet(
dev->channel,
vstor_packet,
VSTOR_PKT_SIZE,
@@ -504,20 +536,34 @@ hv_storvsc_channel_init(struct hv_device *dev)
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
- if (ret != 0)
- goto cleanup;
+ if (ret != 0)
+ goto cleanup;
- /* wait 5 seconds */
- ret = sema_timedwait(&request->synch_sema, 5 * hz);
+ /* wait 5 seconds */
+ ret = sema_timedwait(&request->synch_sema, 5 * hz);
- if (ret)
- goto cleanup;
+ if (ret)
+ goto cleanup;
- /* TODO: Check returned version */
- if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO ||
- vstor_packet->status != 0)
- goto cleanup;
+ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO) {
+ ret = EINVAL;
+ goto cleanup;
+ }
+ if (vstor_packet->status == 0) {
+ vmstor_proto_version =
+ vmstor_proto_list[i].proto_version;
+ sense_buffer_size =
+ vmstor_proto_list[i].sense_buffer_size;
+ vmscsi_size_delta =
+ vmstor_proto_list[i].vmscsi_size_delta;
+ break;
+ }
+ }
+ if (vstor_packet->status != 0) {
+ ret = EINVAL;
+ goto cleanup;
+ }
/**
* Query channel properties
*/
@@ -916,19 +962,6 @@ storvsc_probe(device_t dev)
int ata_disk_enable = 0;
int ret = ENXIO;
- if (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008 ||
- hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7) {
- sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE;
- vmscsi_size_delta = sizeof(struct vmscsi_win8_extension);
- storvsc_current_major = STORVSC_WIN7_MAJOR;
- storvsc_current_minor = STORVSC_WIN7_MINOR;
- } else {
- sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE;
- vmscsi_size_delta = 0;
- storvsc_current_major = STORVSC_WIN8_MAJOR;
- storvsc_current_minor = STORVSC_WIN8_MINOR;
- }
-
switch (storvsc_get_storage_type(dev)) {
case DRIVER_BLKVSC:
if(bootverbose)
@@ -2070,6 +2103,13 @@ storvsc_io_done(struct hv_storvsc_request *reqp)
((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
if (cmd->opcode == INQUIRY &&
+ /*
+ * XXX: Temporary work around disk hot plugin on win2k12r2,
+ * only filtering the invalid disk on win10 or 2016 server.
+ * So, the hot plugin on win10 and 2016 server needs
+ * to be fixed.
+ */
+ vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN10 &&
is_inquiry_valid(
(const struct scsi_inquiry_data *)csio->data_ptr) == 0) {
ccb->ccb_h.status |= CAM_DEV_NOT_THERE;
diff --git a/sys/dev/hyperv/storvsc/hv_vstorage.h b/sys/dev/hyperv/storvsc/hv_vstorage.h
index 026189c..f2b9480 100644
--- a/sys/dev/hyperv/storvsc/hv_vstorage.h
+++ b/sys/dev/hyperv/storvsc/hv_vstorage.h
@@ -41,6 +41,11 @@
#define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \
(((MINOR_) & 0xff) ))
+#define VMSTOR_PROTOCOL_VERSION_WIN6 VMSTOR_PROTOCOL_VERSION(2, 0)
+#define VMSTOR_PROTOCOL_VERSION_WIN7 VMSTOR_PROTOCOL_VERSION(4, 2)
+#define VMSTOR_PROTOCOL_VERSION_WIN8 VMSTOR_PROTOCOL_VERSION(5, 1)
+#define VMSTOR_PROTOCOL_VERSION_WIN8_1 VMSTOR_PROTOCOL_VERSION(6, 0)
+#define VMSTOR_PROTOCOL_VERSION_WIN10 VMSTOR_PROTOCOL_VERSION(6, 2)
/*
* Invalid version.
*/
diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c
index 84e1314..9ac7f74 100644
--- a/sys/dev/iicbus/iic.c
+++ b/sys/dev/iicbus/iic.c
@@ -299,9 +299,16 @@ iicrdwr(struct iic_cdevpriv *priv, struct iic_rdwr_data *d, int flags)
parent = device_get_parent(iicdev);
error = 0;
+ if (d->nmsgs > IIC_RDRW_MAX_MSGS)
+ return (EINVAL);
+
buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_IIC, M_WAITOK);
error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
+ if (error != 0) {
+ free(buf, M_IIC);
+ return (error);
+ }
/* Alloc kernel buffers for userland data, copyin write data */
usrbufs = malloc(sizeof(void *) * d->nmsgs, M_IIC, M_WAITOK | M_ZERO);
@@ -317,6 +324,8 @@ iicrdwr(struct iic_cdevpriv *priv, struct iic_rdwr_data *d, int flags)
m->buf = NULL;
if (error != 0)
continue;
+
+ /* m->len is uint16_t, so allocation size is capped at 64K. */
m->buf = malloc(m->len, M_IIC, M_WAITOK);
if (!(m->flags & IIC_M_RD))
error = copyin(usrbufs[i], m->buf, m->len);
diff --git a/sys/dev/iicbus/iic.h b/sys/dev/iicbus/iic.h
index ba98d28..8ae1912 100644
--- a/sys/dev/iicbus/iic.h
+++ b/sys/dev/iicbus/iic.h
@@ -56,6 +56,8 @@ struct iic_rdwr_data {
uint32_t nmsgs;
};
+#define IIC_RDRW_MAX_MSGS 42
+
#define I2CSTART _IOW('i', 1, struct iiccmd) /* start condition */
#define I2CSTOP _IO('i', 2) /* stop condition */
#define I2CRSTCARD _IOW('i', 3, struct iiccmd) /* reset the card */
diff --git a/sys/dev/ioat/ioat.c b/sys/dev/ioat/ioat.c
new file mode 100644
index 0000000..aff048a
--- /dev/null
+++ b/sys/dev/ioat/ioat.c
@@ -0,0 +1,2091 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/ioccom.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/sbuf.h>
+#include <sys/sysctl.h>
+#include <sys/taskqueue.h>
+#include <sys/time.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <machine/stdarg.h>
+
+#include "ioat.h"
+#include "ioat_hw.h"
+#include "ioat_internal.h"
+
+#ifndef BUS_SPACE_MAXADDR_40BIT
+#define BUS_SPACE_MAXADDR_40BIT 0xFFFFFFFFFFULL
+#endif
+#define IOAT_INTR_TIMO (hz / 10)
+#define IOAT_REFLK (&ioat->submit_lock)
+
+static int ioat_probe(device_t device);
+static int ioat_attach(device_t device);
+static int ioat_detach(device_t device);
+static int ioat_setup_intr(struct ioat_softc *ioat);
+static int ioat_teardown_intr(struct ioat_softc *ioat);
+static int ioat3_attach(device_t device);
+static int ioat_start_channel(struct ioat_softc *ioat);
+static int ioat_map_pci_bar(struct ioat_softc *ioat);
+static void ioat_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg,
+ int error);
+static void ioat_interrupt_handler(void *arg);
+static boolean_t ioat_model_resets_msix(struct ioat_softc *ioat);
+static int chanerr_to_errno(uint32_t);
+static void ioat_process_events(struct ioat_softc *ioat);
+static inline uint32_t ioat_get_active(struct ioat_softc *ioat);
+static inline uint32_t ioat_get_ring_space(struct ioat_softc *ioat);
+static void ioat_free_ring(struct ioat_softc *, uint32_t size,
+ struct ioat_descriptor **);
+static void ioat_free_ring_entry(struct ioat_softc *ioat,
+ struct ioat_descriptor *desc);
+static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *,
+ int mflags);
+static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags);
+static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat,
+ uint32_t index);
+static struct ioat_descriptor **ioat_prealloc_ring(struct ioat_softc *,
+ uint32_t size, boolean_t need_dscr, int mflags);
+static int ring_grow(struct ioat_softc *, uint32_t oldorder,
+ struct ioat_descriptor **);
+static int ring_shrink(struct ioat_softc *, uint32_t oldorder,
+ struct ioat_descriptor **);
+static void ioat_halted_debug(struct ioat_softc *, uint32_t);
+static void ioat_timer_callback(void *arg);
+static void dump_descriptor(void *hw_desc);
+static void ioat_submit_single(struct ioat_softc *ioat);
+static void ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg,
+ int error);
+static int ioat_reset_hw(struct ioat_softc *ioat);
+static void ioat_reset_hw_task(void *, int);
+static void ioat_setup_sysctl(device_t device);
+static int sysctl_handle_reset(SYSCTL_HANDLER_ARGS);
+static inline struct ioat_softc *ioat_get(struct ioat_softc *,
+ enum ioat_ref_kind);
+static inline void ioat_put(struct ioat_softc *, enum ioat_ref_kind);
+static inline void _ioat_putn(struct ioat_softc *, uint32_t,
+ enum ioat_ref_kind, boolean_t);
+static inline void ioat_putn(struct ioat_softc *, uint32_t,
+ enum ioat_ref_kind);
+static inline void ioat_putn_locked(struct ioat_softc *, uint32_t,
+ enum ioat_ref_kind);
+static void ioat_drain_locked(struct ioat_softc *);
+
+#define ioat_log_message(v, ...) do { \
+ if ((v) <= g_ioat_debug_level) { \
+ device_printf(ioat->device, __VA_ARGS__); \
+ } \
+} while (0)
+
+MALLOC_DEFINE(M_IOAT, "ioat", "ioat driver memory allocations");
+SYSCTL_NODE(_hw, OID_AUTO, ioat, CTLFLAG_RD, 0, "ioat node");
+
+static int g_force_legacy_interrupts;
+SYSCTL_INT(_hw_ioat, OID_AUTO, force_legacy_interrupts, CTLFLAG_RDTUN,
+ &g_force_legacy_interrupts, 0, "Set to non-zero to force MSI-X disabled");
+
+int g_ioat_debug_level = 0;
+SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, &g_ioat_debug_level,
+ 0, "Set log level (0-3) for ioat(4). Higher is more verbose.");
+
+/*
+ * OS <-> Driver interface structures
+ */
+static device_method_t ioat_pci_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ioat_probe),
+ DEVMETHOD(device_attach, ioat_attach),
+ DEVMETHOD(device_detach, ioat_detach),
+ DEVMETHOD_END
+};
+
+static driver_t ioat_pci_driver = {
+ "ioat",
+ ioat_pci_methods,
+ sizeof(struct ioat_softc),
+};
+
+static devclass_t ioat_devclass;
+DRIVER_MODULE(ioat, pci, ioat_pci_driver, ioat_devclass, 0, 0);
+MODULE_VERSION(ioat, 1);
+
+/*
+ * Private data structures
+ */
+static struct ioat_softc *ioat_channel[IOAT_MAX_CHANNELS];
+static int ioat_channel_index = 0;
+SYSCTL_INT(_hw_ioat, OID_AUTO, channels, CTLFLAG_RD, &ioat_channel_index, 0,
+ "Number of IOAT channels attached");
+
+static struct _pcsid
+{
+ u_int32_t type;
+ const char *desc;
+} pci_ids[] = {
+ { 0x34308086, "TBG IOAT Ch0" },
+ { 0x34318086, "TBG IOAT Ch1" },
+ { 0x34328086, "TBG IOAT Ch2" },
+ { 0x34338086, "TBG IOAT Ch3" },
+ { 0x34298086, "TBG IOAT Ch4" },
+ { 0x342a8086, "TBG IOAT Ch5" },
+ { 0x342b8086, "TBG IOAT Ch6" },
+ { 0x342c8086, "TBG IOAT Ch7" },
+
+ { 0x37108086, "JSF IOAT Ch0" },
+ { 0x37118086, "JSF IOAT Ch1" },
+ { 0x37128086, "JSF IOAT Ch2" },
+ { 0x37138086, "JSF IOAT Ch3" },
+ { 0x37148086, "JSF IOAT Ch4" },
+ { 0x37158086, "JSF IOAT Ch5" },
+ { 0x37168086, "JSF IOAT Ch6" },
+ { 0x37178086, "JSF IOAT Ch7" },
+ { 0x37188086, "JSF IOAT Ch0 (RAID)" },
+ { 0x37198086, "JSF IOAT Ch1 (RAID)" },
+
+ { 0x3c208086, "SNB IOAT Ch0" },
+ { 0x3c218086, "SNB IOAT Ch1" },
+ { 0x3c228086, "SNB IOAT Ch2" },
+ { 0x3c238086, "SNB IOAT Ch3" },
+ { 0x3c248086, "SNB IOAT Ch4" },
+ { 0x3c258086, "SNB IOAT Ch5" },
+ { 0x3c268086, "SNB IOAT Ch6" },
+ { 0x3c278086, "SNB IOAT Ch7" },
+ { 0x3c2e8086, "SNB IOAT Ch0 (RAID)" },
+ { 0x3c2f8086, "SNB IOAT Ch1 (RAID)" },
+
+ { 0x0e208086, "IVB IOAT Ch0" },
+ { 0x0e218086, "IVB IOAT Ch1" },
+ { 0x0e228086, "IVB IOAT Ch2" },
+ { 0x0e238086, "IVB IOAT Ch3" },
+ { 0x0e248086, "IVB IOAT Ch4" },
+ { 0x0e258086, "IVB IOAT Ch5" },
+ { 0x0e268086, "IVB IOAT Ch6" },
+ { 0x0e278086, "IVB IOAT Ch7" },
+ { 0x0e2e8086, "IVB IOAT Ch0 (RAID)" },
+ { 0x0e2f8086, "IVB IOAT Ch1 (RAID)" },
+
+ { 0x2f208086, "HSW IOAT Ch0" },
+ { 0x2f218086, "HSW IOAT Ch1" },
+ { 0x2f228086, "HSW IOAT Ch2" },
+ { 0x2f238086, "HSW IOAT Ch3" },
+ { 0x2f248086, "HSW IOAT Ch4" },
+ { 0x2f258086, "HSW IOAT Ch5" },
+ { 0x2f268086, "HSW IOAT Ch6" },
+ { 0x2f278086, "HSW IOAT Ch7" },
+ { 0x2f2e8086, "HSW IOAT Ch0 (RAID)" },
+ { 0x2f2f8086, "HSW IOAT Ch1 (RAID)" },
+
+ { 0x0c508086, "BWD IOAT Ch0" },
+ { 0x0c518086, "BWD IOAT Ch1" },
+ { 0x0c528086, "BWD IOAT Ch2" },
+ { 0x0c538086, "BWD IOAT Ch3" },
+
+ { 0x6f508086, "BDXDE IOAT Ch0" },
+ { 0x6f518086, "BDXDE IOAT Ch1" },
+ { 0x6f528086, "BDXDE IOAT Ch2" },
+ { 0x6f538086, "BDXDE IOAT Ch3" },
+
+ { 0x6f208086, "BDX IOAT Ch0" },
+ { 0x6f218086, "BDX IOAT Ch1" },
+ { 0x6f228086, "BDX IOAT Ch2" },
+ { 0x6f238086, "BDX IOAT Ch3" },
+ { 0x6f248086, "BDX IOAT Ch4" },
+ { 0x6f258086, "BDX IOAT Ch5" },
+ { 0x6f268086, "BDX IOAT Ch6" },
+ { 0x6f278086, "BDX IOAT Ch7" },
+ { 0x6f2e8086, "BDX IOAT Ch0 (RAID)" },
+ { 0x6f2f8086, "BDX IOAT Ch1 (RAID)" },
+
+ { 0x00000000, NULL }
+};
+
+/*
+ * OS <-> Driver linkage functions
+ */
+static int
+ioat_probe(device_t device)
+{
+ struct _pcsid *ep;
+ u_int32_t type;
+
+ type = pci_get_devid(device);
+ for (ep = pci_ids; ep->type; ep++) {
+ if (ep->type == type) {
+ device_set_desc(device, ep->desc);
+ return (0);
+ }
+ }
+ return (ENXIO);
+}
+
+static int
+ioat_attach(device_t device)
+{
+ struct ioat_softc *ioat;
+ int error;
+
+ ioat = DEVICE2SOFTC(device);
+ ioat->device = device;
+
+ error = ioat_map_pci_bar(ioat);
+ if (error != 0)
+ goto err;
+
+ ioat->version = ioat_read_cbver(ioat);
+ if (ioat->version < IOAT_VER_3_0) {
+ error = ENODEV;
+ goto err;
+ }
+
+ error = ioat3_attach(device);
+ if (error != 0)
+ goto err;
+
+ error = pci_enable_busmaster(device);
+ if (error != 0)
+ goto err;
+
+ error = ioat_setup_intr(ioat);
+ if (error != 0)
+ goto err;
+
+ error = ioat_reset_hw(ioat);
+ if (error != 0)
+ goto err;
+
+ ioat_process_events(ioat);
+ ioat_setup_sysctl(device);
+
+ ioat->chan_idx = ioat_channel_index;
+ ioat_channel[ioat_channel_index++] = ioat;
+ ioat_test_attach();
+
+err:
+ if (error != 0)
+ ioat_detach(device);
+ return (error);
+}
+
+static int
+ioat_detach(device_t device)
+{
+ struct ioat_softc *ioat;
+
+ ioat = DEVICE2SOFTC(device);
+
+ ioat_test_detach();
+ taskqueue_drain(taskqueue_thread, &ioat->reset_task);
+
+ mtx_lock(IOAT_REFLK);
+ ioat->quiescing = TRUE;
+ ioat->destroying = TRUE;
+ wakeup(&ioat->quiescing);
+
+ ioat_channel[ioat->chan_idx] = NULL;
+
+ ioat_drain_locked(ioat);
+ mtx_unlock(IOAT_REFLK);
+
+ ioat_teardown_intr(ioat);
+ callout_drain(&ioat->timer);
+
+ pci_disable_busmaster(device);
+
+ if (ioat->pci_resource != NULL)
+ bus_release_resource(device, SYS_RES_MEMORY,
+ ioat->pci_resource_id, ioat->pci_resource);
+
+ if (ioat->ring != NULL)
+ ioat_free_ring(ioat, 1 << ioat->ring_size_order, ioat->ring);
+
+ if (ioat->comp_update != NULL) {
+ bus_dmamap_unload(ioat->comp_update_tag, ioat->comp_update_map);
+ bus_dmamem_free(ioat->comp_update_tag, ioat->comp_update,
+ ioat->comp_update_map);
+ bus_dma_tag_destroy(ioat->comp_update_tag);
+ }
+
+ bus_dma_tag_destroy(ioat->hw_desc_tag);
+
+ return (0);
+}
+
+static int
+ioat_teardown_intr(struct ioat_softc *ioat)
+{
+
+ if (ioat->tag != NULL)
+ bus_teardown_intr(ioat->device, ioat->res, ioat->tag);
+
+ if (ioat->res != NULL)
+ bus_release_resource(ioat->device, SYS_RES_IRQ,
+ rman_get_rid(ioat->res), ioat->res);
+
+ pci_release_msi(ioat->device);
+ return (0);
+}
+
+static int
+ioat_start_channel(struct ioat_softc *ioat)
+{
+ uint64_t status;
+ uint32_t chanerr;
+ int i;
+
+ ioat_acquire(&ioat->dmaengine);
+ ioat_null(&ioat->dmaengine, NULL, NULL, 0);
+ ioat_release(&ioat->dmaengine);
+
+ for (i = 0; i < 100; i++) {
+ DELAY(1);
+ status = ioat_get_chansts(ioat);
+ if (is_ioat_idle(status))
+ return (0);
+ }
+
+ chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
+ ioat_log_message(0, "could not start channel: "
+ "status = %#jx error = %b\n", (uintmax_t)status, (int)chanerr,
+ IOAT_CHANERR_STR);
+ return (ENXIO);
+}
+
+/*
+ * Initialize Hardware
+ */
+static int
+ioat3_attach(device_t device)
+{
+ struct ioat_softc *ioat;
+ struct ioat_descriptor **ring;
+ struct ioat_descriptor *next;
+ struct ioat_dma_hw_descriptor *dma_hw_desc;
+ int i, num_descriptors;
+ int error;
+ uint8_t xfercap;
+
+ error = 0;
+ ioat = DEVICE2SOFTC(device);
+ ioat->capabilities = ioat_read_dmacapability(ioat);
+
+ ioat_log_message(1, "Capabilities: %b\n", (int)ioat->capabilities,
+ IOAT_DMACAP_STR);
+
+ xfercap = ioat_read_xfercap(ioat);
+ ioat->max_xfer_size = 1 << xfercap;
+
+ ioat->intrdelay_supported = (ioat_read_2(ioat, IOAT_INTRDELAY_OFFSET) &
+ IOAT_INTRDELAY_SUPPORTED) != 0;
+ if (ioat->intrdelay_supported)
+ ioat->intrdelay_max = IOAT_INTRDELAY_US_MASK;
+
+ /* TODO: need to check DCA here if we ever do XOR/PQ */
+
+ mtx_init(&ioat->submit_lock, "ioat_submit", NULL, MTX_DEF);
+ mtx_init(&ioat->cleanup_lock, "ioat_cleanup", NULL, MTX_DEF);
+ callout_init(&ioat->timer, 1);
+ TASK_INIT(&ioat->reset_task, 0, ioat_reset_hw_task, ioat);
+
+ /* Establish lock order for Witness */
+ mtx_lock(&ioat->submit_lock);
+ mtx_lock(&ioat->cleanup_lock);
+ mtx_unlock(&ioat->cleanup_lock);
+ mtx_unlock(&ioat->submit_lock);
+
+ ioat->is_resize_pending = FALSE;
+ ioat->is_completion_pending = FALSE;
+ ioat->is_reset_pending = FALSE;
+ ioat->is_channel_running = FALSE;
+
+ bus_dma_tag_create(bus_get_dma_tag(ioat->device), sizeof(uint64_t), 0x0,
+ BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
+ sizeof(uint64_t), 1, sizeof(uint64_t), 0, NULL, NULL,
+ &ioat->comp_update_tag);
+
+ error = bus_dmamem_alloc(ioat->comp_update_tag,
+ (void **)&ioat->comp_update, BUS_DMA_ZERO, &ioat->comp_update_map);
+ if (ioat->comp_update == NULL)
+ return (ENOMEM);
+
+ error = bus_dmamap_load(ioat->comp_update_tag, ioat->comp_update_map,
+ ioat->comp_update, sizeof(uint64_t), ioat_comp_update_map, ioat,
+ 0);
+ if (error != 0)
+ return (error);
+
+ ioat->ring_size_order = IOAT_MIN_ORDER;
+
+ num_descriptors = 1 << ioat->ring_size_order;
+
+ bus_dma_tag_create(bus_get_dma_tag(ioat->device), 0x40, 0x0,
+ BUS_SPACE_MAXADDR_40BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ sizeof(struct ioat_dma_hw_descriptor), 1,
+ sizeof(struct ioat_dma_hw_descriptor), 0, NULL, NULL,
+ &ioat->hw_desc_tag);
+
+ ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT,
+ M_ZERO | M_WAITOK);
+
+ ring = ioat->ring;
+ for (i = 0; i < num_descriptors; i++) {
+ ring[i] = ioat_alloc_ring_entry(ioat, M_WAITOK);
+ if (ring[i] == NULL)
+ return (ENOMEM);
+
+ ring[i]->id = i;
+ }
+
+ for (i = 0; i < num_descriptors - 1; i++) {
+ next = ring[i + 1];
+ dma_hw_desc = ring[i]->u.dma;
+
+ dma_hw_desc->next = next->hw_desc_bus_addr;
+ }
+
+ ring[i]->u.dma->next = ring[0]->hw_desc_bus_addr;
+
+ ioat->head = ioat->hw_head = 0;
+ ioat->tail = 0;
+ ioat->last_seen = 0;
+ return (0);
+}
+
+static int
+ioat_map_pci_bar(struct ioat_softc *ioat)
+{
+
+ ioat->pci_resource_id = PCIR_BAR(0);
+ ioat->pci_resource = bus_alloc_resource_any(ioat->device,
+ SYS_RES_MEMORY, &ioat->pci_resource_id, RF_ACTIVE);
+
+ if (ioat->pci_resource == NULL) {
+ ioat_log_message(0, "unable to allocate pci resource\n");
+ return (ENODEV);
+ }
+
+ ioat->pci_bus_tag = rman_get_bustag(ioat->pci_resource);
+ ioat->pci_bus_handle = rman_get_bushandle(ioat->pci_resource);
+ return (0);
+}
+
+static void
+ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg, int error)
+{
+ struct ioat_softc *ioat = arg;
+
+ KASSERT(error == 0, ("%s: error:%d", __func__, error));
+ ioat->comp_update_bus_addr = seg[0].ds_addr;
+}
+
+static void
+ioat_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
+{
+ bus_addr_t *baddr;
+
+ KASSERT(error == 0, ("%s: error:%d", __func__, error));
+ baddr = arg;
+ *baddr = segs->ds_addr;
+}
+
+/*
+ * Interrupt setup and handlers
+ */
+static int
+ioat_setup_intr(struct ioat_softc *ioat)
+{
+ uint32_t num_vectors;
+ int error;
+ boolean_t use_msix;
+ boolean_t force_legacy_interrupts;
+
+ use_msix = FALSE;
+ force_legacy_interrupts = FALSE;
+
+ if (!g_force_legacy_interrupts && pci_msix_count(ioat->device) >= 1) {
+ num_vectors = 1;
+ pci_alloc_msix(ioat->device, &num_vectors);
+ if (num_vectors == 1)
+ use_msix = TRUE;
+ }
+
+ if (use_msix) {
+ ioat->rid = 1;
+ ioat->res = bus_alloc_resource_any(ioat->device, SYS_RES_IRQ,
+ &ioat->rid, RF_ACTIVE);
+ } else {
+ ioat->rid = 0;
+ ioat->res = bus_alloc_resource_any(ioat->device, SYS_RES_IRQ,
+ &ioat->rid, RF_SHAREABLE | RF_ACTIVE);
+ }
+ if (ioat->res == NULL) {
+ ioat_log_message(0, "bus_alloc_resource failed\n");
+ return (ENOMEM);
+ }
+
+ ioat->tag = NULL;
+ error = bus_setup_intr(ioat->device, ioat->res, INTR_MPSAFE |
+ INTR_TYPE_MISC, NULL, ioat_interrupt_handler, ioat, &ioat->tag);
+ if (error != 0) {
+ ioat_log_message(0, "bus_setup_intr failed\n");
+ return (error);
+ }
+
+ ioat_write_intrctrl(ioat, IOAT_INTRCTRL_MASTER_INT_EN);
+ return (0);
+}
+
+static boolean_t
+ioat_model_resets_msix(struct ioat_softc *ioat)
+{
+ u_int32_t pciid;
+
+ pciid = pci_get_devid(ioat->device);
+ switch (pciid) {
+ /* BWD: */
+ case 0x0c508086:
+ case 0x0c518086:
+ case 0x0c528086:
+ case 0x0c538086:
+ /* BDXDE: */
+ case 0x6f508086:
+ case 0x6f518086:
+ case 0x6f528086:
+ case 0x6f538086:
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+static void
+ioat_interrupt_handler(void *arg)
+{
+ struct ioat_softc *ioat = arg;
+
+ ioat->stats.interrupts++;
+ ioat_process_events(ioat);
+}
+
+static int
+chanerr_to_errno(uint32_t chanerr)
+{
+
+ if (chanerr == 0)
+ return (0);
+ if ((chanerr & (IOAT_CHANERR_XSADDERR | IOAT_CHANERR_XDADDERR)) != 0)
+ return (EFAULT);
+ if ((chanerr & (IOAT_CHANERR_RDERR | IOAT_CHANERR_WDERR)) != 0)
+ return (EIO);
+ /* This one is probably our fault: */
+ if ((chanerr & IOAT_CHANERR_NDADDERR) != 0)
+ return (EIO);
+ return (EIO);
+}
+
+static void
+ioat_process_events(struct ioat_softc *ioat)
+{
+ struct ioat_descriptor *desc;
+ struct bus_dmadesc *dmadesc;
+ uint64_t comp_update, status;
+ uint32_t completed, chanerr;
+ int error;
+
+ mtx_lock(&ioat->cleanup_lock);
+
+ completed = 0;
+ comp_update = *ioat->comp_update;
+ status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK;
+
+ CTR0(KTR_IOAT, __func__);
+
+ if (status == ioat->last_seen) {
+ /*
+ * If we landed in process_events and nothing has been
+ * completed, check for a timeout due to channel halt.
+ */
+ comp_update = ioat_get_chansts(ioat);
+ goto out;
+ }
+
+ while (1) {
+ desc = ioat_get_ring_entry(ioat, ioat->tail);
+ dmadesc = &desc->bus_dmadesc;
+ CTR1(KTR_IOAT, "completing desc %d", ioat->tail);
+
+ if (dmadesc->callback_fn != NULL)
+ dmadesc->callback_fn(dmadesc->callback_arg, 0);
+
+ completed++;
+ ioat->tail++;
+ if (desc->hw_desc_bus_addr == status)
+ break;
+ }
+
+ ioat->last_seen = desc->hw_desc_bus_addr;
+
+ if (ioat->head == ioat->tail) {
+ ioat->is_completion_pending = FALSE;
+ callout_reset(&ioat->timer, IOAT_INTR_TIMO,
+ ioat_timer_callback, ioat);
+ }
+
+ ioat->stats.descriptors_processed += completed;
+
+out:
+ ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
+ mtx_unlock(&ioat->cleanup_lock);
+
+ if (completed != 0) {
+ ioat_putn(ioat, completed, IOAT_ACTIVE_DESCR_REF);
+ wakeup(&ioat->tail);
+ }
+
+ if (!is_ioat_halted(comp_update) && !is_ioat_suspended(comp_update))
+ return;
+
+ ioat->stats.channel_halts++;
+
+ /*
+ * Fatal programming error on this DMA channel. Flush any outstanding
+ * work with error status and restart the engine.
+ */
+ ioat_log_message(0, "Channel halted due to fatal programming error\n");
+ mtx_lock(&ioat->submit_lock);
+ mtx_lock(&ioat->cleanup_lock);
+ ioat->quiescing = TRUE;
+
+ chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
+ ioat_halted_debug(ioat, chanerr);
+ ioat->stats.last_halt_chanerr = chanerr;
+
+ while (ioat_get_active(ioat) > 0) {
+ desc = ioat_get_ring_entry(ioat, ioat->tail);
+ dmadesc = &desc->bus_dmadesc;
+ CTR1(KTR_IOAT, "completing err desc %d", ioat->tail);
+
+ if (dmadesc->callback_fn != NULL)
+ dmadesc->callback_fn(dmadesc->callback_arg,
+ chanerr_to_errno(chanerr));
+
+ ioat_putn_locked(ioat, 1, IOAT_ACTIVE_DESCR_REF);
+ ioat->tail++;
+ ioat->stats.descriptors_processed++;
+ ioat->stats.descriptors_error++;
+ }
+
+ /* Clear error status */
+ ioat_write_4(ioat, IOAT_CHANERR_OFFSET, chanerr);
+
+ mtx_unlock(&ioat->cleanup_lock);
+ mtx_unlock(&ioat->submit_lock);
+
+ ioat_log_message(0, "Resetting channel to recover from error\n");
+ error = taskqueue_enqueue(taskqueue_thread, &ioat->reset_task);
+ KASSERT(error == 0,
+ ("%s: taskqueue_enqueue failed: %d", __func__, error));
+}
+
+static void
+ioat_reset_hw_task(void *ctx, int pending __unused)
+{
+ struct ioat_softc *ioat;
+ int error;
+
+ ioat = ctx;
+ ioat_log_message(1, "%s: Resetting channel\n", __func__);
+
+ error = ioat_reset_hw(ioat);
+ KASSERT(error == 0, ("%s: reset failed: %d", __func__, error));
+ (void)error;
+}
+
+/*
+ * User API functions
+ */
+bus_dmaengine_t
+ioat_get_dmaengine(uint32_t index, int flags)
+{
+ struct ioat_softc *ioat;
+
+ KASSERT((flags & ~(M_NOWAIT | M_WAITOK)) == 0,
+ ("invalid flags: 0x%08x", flags));
+ KASSERT((flags & (M_NOWAIT | M_WAITOK)) != (M_NOWAIT | M_WAITOK),
+ ("invalid wait | nowait"));
+
+ if (index >= ioat_channel_index)
+ return (NULL);
+
+ ioat = ioat_channel[index];
+ if (ioat == NULL || ioat->destroying)
+ return (NULL);
+
+ if (ioat->quiescing) {
+ if ((flags & M_NOWAIT) != 0)
+ return (NULL);
+
+ mtx_lock(IOAT_REFLK);
+ while (ioat->quiescing && !ioat->destroying)
+ msleep(&ioat->quiescing, IOAT_REFLK, 0, "getdma", 0);
+ mtx_unlock(IOAT_REFLK);
+
+ if (ioat->destroying)
+ return (NULL);
+ }
+
+ /*
+ * There's a race here between the quiescing check and HW reset or
+ * module destroy.
+ */
+ return (&ioat_get(ioat, IOAT_DMAENGINE_REF)->dmaengine);
+}
+
+void
+ioat_put_dmaengine(bus_dmaengine_t dmaengine)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ ioat_put(ioat, IOAT_DMAENGINE_REF);
+}
+
+int
+ioat_get_hwversion(bus_dmaengine_t dmaengine)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ return (ioat->version);
+}
+
+size_t
+ioat_get_max_io_size(bus_dmaengine_t dmaengine)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ return (ioat->max_xfer_size);
+}
+
+int
+ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ if (!ioat->intrdelay_supported)
+ return (ENODEV);
+ if (delay > ioat->intrdelay_max)
+ return (ERANGE);
+
+ ioat_write_2(ioat, IOAT_INTRDELAY_OFFSET, delay);
+ ioat->cached_intrdelay =
+ ioat_read_2(ioat, IOAT_INTRDELAY_OFFSET) & IOAT_INTRDELAY_US_MASK;
+ return (0);
+}
+
+uint16_t
+ioat_get_max_coalesce_period(bus_dmaengine_t dmaengine)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ return (ioat->intrdelay_max);
+}
+
+void
+ioat_acquire(bus_dmaengine_t dmaengine)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ mtx_lock(&ioat->submit_lock);
+ CTR0(KTR_IOAT, __func__);
+}
+
+int
+ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags)
+{
+ struct ioat_softc *ioat;
+ int error;
+
+ ioat = to_ioat_softc(dmaengine);
+ ioat_acquire(dmaengine);
+
+ error = ioat_reserve_space(ioat, n, mflags);
+ if (error != 0)
+ ioat_release(dmaengine);
+ return (error);
+}
+
+void
+ioat_release(bus_dmaengine_t dmaengine)
+{
+ struct ioat_softc *ioat;
+
+ ioat = to_ioat_softc(dmaengine);
+ CTR0(KTR_IOAT, __func__);
+ ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->hw_head);
+ mtx_unlock(&ioat->submit_lock);
+}
+
+static struct ioat_descriptor *
+ioat_op_generic(struct ioat_softc *ioat, uint8_t op,
+ uint32_t size, uint64_t src, uint64_t dst,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg,
+ uint32_t flags)
+{
+ struct ioat_generic_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ int mflags;
+
+ mtx_assert(&ioat->submit_lock, MA_OWNED);
+
+ KASSERT((flags & ~_DMA_GENERIC_FLAGS) == 0,
+ ("Unrecognized flag(s): %#x", flags & ~_DMA_GENERIC_FLAGS));
+ if ((flags & DMA_NO_WAIT) != 0)
+ mflags = M_NOWAIT;
+ else
+ mflags = M_WAITOK;
+
+ if (size > ioat->max_xfer_size) {
+ ioat_log_message(0, "%s: max_xfer_size = %d, requested = %u\n",
+ __func__, ioat->max_xfer_size, (unsigned)size);
+ return (NULL);
+ }
+
+ if (ioat_reserve_space(ioat, 1, mflags) != 0)
+ return (NULL);
+
+ desc = ioat_get_ring_entry(ioat, ioat->head);
+ hw_desc = desc->u.generic;
+
+ hw_desc->u.control_raw = 0;
+ hw_desc->u.control_generic.op = op;
+ hw_desc->u.control_generic.completion_update = 1;
+
+ if ((flags & DMA_INT_EN) != 0)
+ hw_desc->u.control_generic.int_enable = 1;
+ if ((flags & DMA_FENCE) != 0)
+ hw_desc->u.control_generic.fence = 1;
+
+ hw_desc->size = size;
+ hw_desc->src_addr = src;
+ hw_desc->dest_addr = dst;
+
+ desc->bus_dmadesc.callback_fn = callback_fn;
+ desc->bus_dmadesc.callback_arg = callback_arg;
+ return (desc);
+}
+
+struct bus_dmadesc *
+ioat_null(bus_dmaengine_t dmaengine, bus_dmaengine_callback_t callback_fn,
+ void *callback_arg, uint32_t flags)
+{
+ struct ioat_dma_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+
+ CTR0(KTR_IOAT, __func__);
+ ioat = to_ioat_softc(dmaengine);
+
+ desc = ioat_op_generic(ioat, IOAT_OP_COPY, 8, 0, 0, callback_fn,
+ callback_arg, flags);
+ if (desc == NULL)
+ return (NULL);
+
+ hw_desc = desc->u.dma;
+ hw_desc->u.control.null = 1;
+ ioat_submit_single(ioat);
+ return (&desc->bus_dmadesc);
+}
+
+struct bus_dmadesc *
+ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst,
+ bus_addr_t src, bus_size_t len, bus_dmaengine_callback_t callback_fn,
+ void *callback_arg, uint32_t flags)
+{
+ struct ioat_dma_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+
+ CTR0(KTR_IOAT, __func__);
+ ioat = to_ioat_softc(dmaengine);
+
+ if (((src | dst) & (0xffffull << 48)) != 0) {
+ ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n",
+ __func__);
+ return (NULL);
+ }
+
+ desc = ioat_op_generic(ioat, IOAT_OP_COPY, len, src, dst, callback_fn,
+ callback_arg, flags);
+ if (desc == NULL)
+ return (NULL);
+
+ hw_desc = desc->u.dma;
+ if (g_ioat_debug_level >= 3)
+ dump_descriptor(hw_desc);
+
+ ioat_submit_single(ioat);
+ return (&desc->bus_dmadesc);
+}
+
+struct bus_dmadesc *
+ioat_copy_8k_aligned(bus_dmaengine_t dmaengine, bus_addr_t dst1,
+ bus_addr_t dst2, bus_addr_t src1, bus_addr_t src2,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags)
+{
+ struct ioat_dma_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+
+ CTR0(KTR_IOAT, __func__);
+ ioat = to_ioat_softc(dmaengine);
+
+ if (((src1 | src2 | dst1 | dst2) & (0xffffull << 48)) != 0) {
+ ioat_log_message(0, "%s: High 16 bits of src/dst invalid\n",
+ __func__);
+ return (NULL);
+ }
+ if (((src1 | src2 | dst1 | dst2) & PAGE_MASK) != 0) {
+ ioat_log_message(0, "%s: Addresses must be page-aligned\n",
+ __func__);
+ return (NULL);
+ }
+
+ desc = ioat_op_generic(ioat, IOAT_OP_COPY, 2 * PAGE_SIZE, src1, dst1,
+ callback_fn, callback_arg, flags);
+ if (desc == NULL)
+ return (NULL);
+
+ hw_desc = desc->u.dma;
+ if (src2 != src1 + PAGE_SIZE) {
+ hw_desc->u.control.src_page_break = 1;
+ hw_desc->next_src_addr = src2;
+ }
+ if (dst2 != dst1 + PAGE_SIZE) {
+ hw_desc->u.control.dest_page_break = 1;
+ hw_desc->next_dest_addr = dst2;
+ }
+
+ if (g_ioat_debug_level >= 3)
+ dump_descriptor(hw_desc);
+
+ ioat_submit_single(ioat);
+ return (&desc->bus_dmadesc);
+}
+
+struct bus_dmadesc *
+ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t dst, bus_addr_t src,
+ bus_size_t len, uint32_t *initialseed, bus_addr_t crcptr,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags)
+{
+ struct ioat_crc32_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+ uint32_t teststore;
+ uint8_t op;
+
+ CTR0(KTR_IOAT, __func__);
+ ioat = to_ioat_softc(dmaengine);
+
+ if ((ioat->capabilities & IOAT_DMACAP_MOVECRC) == 0) {
+ ioat_log_message(0, "%s: Device lacks MOVECRC capability\n",
+ __func__);
+ return (NULL);
+ }
+ if (((src | dst) & (0xffffffull << 40)) != 0) {
+ ioat_log_message(0, "%s: High 24 bits of src/dst invalid\n",
+ __func__);
+ return (NULL);
+ }
+ teststore = (flags & _DMA_CRC_TESTSTORE);
+ if (teststore == _DMA_CRC_TESTSTORE) {
+ ioat_log_message(0, "%s: TEST and STORE invalid\n", __func__);
+ return (NULL);
+ }
+ if (teststore == 0 && (flags & DMA_CRC_INLINE) != 0) {
+ ioat_log_message(0, "%s: INLINE invalid without TEST or STORE\n",
+ __func__);
+ return (NULL);
+ }
+
+ switch (teststore) {
+ case DMA_CRC_STORE:
+ op = IOAT_OP_MOVECRC_STORE;
+ break;
+ case DMA_CRC_TEST:
+ op = IOAT_OP_MOVECRC_TEST;
+ break;
+ default:
+ KASSERT(teststore == 0, ("bogus"));
+ op = IOAT_OP_MOVECRC;
+ break;
+ }
+
+ if ((flags & DMA_CRC_INLINE) == 0 &&
+ (crcptr & (0xffffffull << 40)) != 0) {
+ ioat_log_message(0,
+ "%s: High 24 bits of crcptr invalid\n", __func__);
+ return (NULL);
+ }
+
+ desc = ioat_op_generic(ioat, op, len, src, dst, callback_fn,
+ callback_arg, flags & ~_DMA_CRC_FLAGS);
+ if (desc == NULL)
+ return (NULL);
+
+ hw_desc = desc->u.crc32;
+
+ if ((flags & DMA_CRC_INLINE) == 0)
+ hw_desc->crc_address = crcptr;
+ else
+ hw_desc->u.control.crc_location = 1;
+
+ if (initialseed != NULL) {
+ hw_desc->u.control.use_seed = 1;
+ hw_desc->seed = *initialseed;
+ }
+
+ if (g_ioat_debug_level >= 3)
+ dump_descriptor(hw_desc);
+
+ ioat_submit_single(ioat);
+ return (&desc->bus_dmadesc);
+}
+
+struct bus_dmadesc *
+ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src, bus_size_t len,
+ uint32_t *initialseed, bus_addr_t crcptr,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags)
+{
+ struct ioat_crc32_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+ uint32_t teststore;
+ uint8_t op;
+
+ CTR0(KTR_IOAT, __func__);
+ ioat = to_ioat_softc(dmaengine);
+
+ if ((ioat->capabilities & IOAT_DMACAP_CRC) == 0) {
+ ioat_log_message(0, "%s: Device lacks CRC capability\n",
+ __func__);
+ return (NULL);
+ }
+ if ((src & (0xffffffull << 40)) != 0) {
+ ioat_log_message(0, "%s: High 24 bits of src invalid\n",
+ __func__);
+ return (NULL);
+ }
+ teststore = (flags & _DMA_CRC_TESTSTORE);
+ if (teststore == _DMA_CRC_TESTSTORE) {
+ ioat_log_message(0, "%s: TEST and STORE invalid\n", __func__);
+ return (NULL);
+ }
+ if (teststore == 0 && (flags & DMA_CRC_INLINE) != 0) {
+ ioat_log_message(0, "%s: INLINE invalid without TEST or STORE\n",
+ __func__);
+ return (NULL);
+ }
+
+ switch (teststore) {
+ case DMA_CRC_STORE:
+ op = IOAT_OP_CRC_STORE;
+ break;
+ case DMA_CRC_TEST:
+ op = IOAT_OP_CRC_TEST;
+ break;
+ default:
+ KASSERT(teststore == 0, ("bogus"));
+ op = IOAT_OP_CRC;
+ break;
+ }
+
+ if ((flags & DMA_CRC_INLINE) == 0 &&
+ (crcptr & (0xffffffull << 40)) != 0) {
+ ioat_log_message(0,
+ "%s: High 24 bits of crcptr invalid\n", __func__);
+ return (NULL);
+ }
+
+ desc = ioat_op_generic(ioat, op, len, src, 0, callback_fn,
+ callback_arg, flags & ~_DMA_CRC_FLAGS);
+ if (desc == NULL)
+ return (NULL);
+
+ hw_desc = desc->u.crc32;
+
+ if ((flags & DMA_CRC_INLINE) == 0)
+ hw_desc->crc_address = crcptr;
+ else
+ hw_desc->u.control.crc_location = 1;
+
+ if (initialseed != NULL) {
+ hw_desc->u.control.use_seed = 1;
+ hw_desc->seed = *initialseed;
+ }
+
+ if (g_ioat_debug_level >= 3)
+ dump_descriptor(hw_desc);
+
+ ioat_submit_single(ioat);
+ return (&desc->bus_dmadesc);
+}
+
+struct bus_dmadesc *
+ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t dst, uint64_t fillpattern,
+ bus_size_t len, bus_dmaengine_callback_t callback_fn, void *callback_arg,
+ uint32_t flags)
+{
+ struct ioat_fill_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+
+ CTR0(KTR_IOAT, __func__);
+ ioat = to_ioat_softc(dmaengine);
+
+ if ((ioat->capabilities & IOAT_DMACAP_BFILL) == 0) {
+ ioat_log_message(0, "%s: Device lacks BFILL capability\n",
+ __func__);
+ return (NULL);
+ }
+
+ if ((dst & (0xffffull << 48)) != 0) {
+ ioat_log_message(0, "%s: High 16 bits of dst invalid\n",
+ __func__);
+ return (NULL);
+ }
+
+ desc = ioat_op_generic(ioat, IOAT_OP_FILL, len, fillpattern, dst,
+ callback_fn, callback_arg, flags);
+ if (desc == NULL)
+ return (NULL);
+
+ hw_desc = desc->u.fill;
+ if (g_ioat_debug_level >= 3)
+ dump_descriptor(hw_desc);
+
+ ioat_submit_single(ioat);
+ return (&desc->bus_dmadesc);
+}
+
+/*
+ * Ring Management
+ */
+static inline uint32_t
+ioat_get_active(struct ioat_softc *ioat)
+{
+
+ return ((ioat->head - ioat->tail) & ((1 << ioat->ring_size_order) - 1));
+}
+
+static inline uint32_t
+ioat_get_ring_space(struct ioat_softc *ioat)
+{
+
+ return ((1 << ioat->ring_size_order) - ioat_get_active(ioat) - 1);
+}
+
+static struct ioat_descriptor *
+ioat_alloc_ring_entry(struct ioat_softc *ioat, int mflags)
+{
+ struct ioat_generic_hw_descriptor *hw_desc;
+ struct ioat_descriptor *desc;
+ int error, busdmaflag;
+
+ error = ENOMEM;
+ hw_desc = NULL;
+
+ if ((mflags & M_WAITOK) != 0)
+ busdmaflag = BUS_DMA_WAITOK;
+ else
+ busdmaflag = BUS_DMA_NOWAIT;
+
+ desc = malloc(sizeof(*desc), M_IOAT, mflags);
+ if (desc == NULL)
+ goto out;
+
+ bus_dmamem_alloc(ioat->hw_desc_tag, (void **)&hw_desc,
+ BUS_DMA_ZERO | busdmaflag, &ioat->hw_desc_map);
+ if (hw_desc == NULL)
+ goto out;
+
+ memset(&desc->bus_dmadesc, 0, sizeof(desc->bus_dmadesc));
+ desc->u.generic = hw_desc;
+
+ error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc,
+ sizeof(*hw_desc), ioat_dmamap_cb, &desc->hw_desc_bus_addr,
+ busdmaflag);
+ if (error)
+ goto out;
+
+out:
+ if (error) {
+ ioat_free_ring_entry(ioat, desc);
+ return (NULL);
+ }
+ return (desc);
+}
+
+static void
+ioat_free_ring_entry(struct ioat_softc *ioat, struct ioat_descriptor *desc)
+{
+
+ if (desc == NULL)
+ return;
+
+ if (desc->u.generic)
+ bus_dmamem_free(ioat->hw_desc_tag, desc->u.generic,
+ ioat->hw_desc_map);
+ free(desc, M_IOAT);
+}
+
+/*
+ * Reserves space in this IOAT descriptor ring by ensuring enough slots remain
+ * for 'num_descs'.
+ *
+ * If mflags contains M_WAITOK, blocks until enough space is available.
+ *
+ * Returns zero on success, or an errno on error. If num_descs is beyond the
+ * maximum ring size, returns EINVAl; if allocation would block and mflags
+ * contains M_NOWAIT, returns EAGAIN.
+ *
+ * Must be called with the submit_lock held; returns with the lock held. The
+ * lock may be dropped to allocate the ring.
+ *
+ * (The submit_lock is needed to add any entries to the ring, so callers are
+ * assured enough room is available.)
+ */
+static int
+ioat_reserve_space(struct ioat_softc *ioat, uint32_t num_descs, int mflags)
+{
+ struct ioat_descriptor **new_ring;
+ uint32_t order;
+ int error;
+
+ mtx_assert(&ioat->submit_lock, MA_OWNED);
+ error = 0;
+
+ if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) {
+ error = EINVAL;
+ goto out;
+ }
+ if (ioat->quiescing) {
+ error = ENXIO;
+ goto out;
+ }
+
+ for (;;) {
+ if (ioat_get_ring_space(ioat) >= num_descs)
+ goto out;
+
+ order = ioat->ring_size_order;
+ if (ioat->is_resize_pending || order == IOAT_MAX_ORDER) {
+ if ((mflags & M_WAITOK) != 0) {
+ msleep(&ioat->tail, &ioat->submit_lock, 0,
+ "ioat_rsz", 0);
+ continue;
+ }
+
+ error = EAGAIN;
+ break;
+ }
+
+ ioat->is_resize_pending = TRUE;
+ for (;;) {
+ mtx_unlock(&ioat->submit_lock);
+
+ new_ring = ioat_prealloc_ring(ioat, 1 << (order + 1),
+ TRUE, mflags);
+
+ mtx_lock(&ioat->submit_lock);
+ KASSERT(ioat->ring_size_order == order,
+ ("is_resize_pending should protect order"));
+
+ if (new_ring == NULL) {
+ KASSERT((mflags & M_WAITOK) == 0,
+ ("allocation failed"));
+ error = EAGAIN;
+ break;
+ }
+
+ error = ring_grow(ioat, order, new_ring);
+ if (error == 0)
+ break;
+ }
+ ioat->is_resize_pending = FALSE;
+ wakeup(&ioat->tail);
+ if (error)
+ break;
+ }
+
+out:
+ mtx_assert(&ioat->submit_lock, MA_OWNED);
+ return (error);
+}
+
+static struct ioat_descriptor **
+ioat_prealloc_ring(struct ioat_softc *ioat, uint32_t size, boolean_t need_dscr,
+ int mflags)
+{
+ struct ioat_descriptor **ring;
+ uint32_t i;
+ int error;
+
+ KASSERT(size > 0 && powerof2(size), ("bogus size"));
+
+ ring = malloc(size * sizeof(*ring), M_IOAT, M_ZERO | mflags);
+ if (ring == NULL)
+ return (NULL);
+
+ if (need_dscr) {
+ error = ENOMEM;
+ for (i = size / 2; i < size; i++) {
+ ring[i] = ioat_alloc_ring_entry(ioat, mflags);
+ if (ring[i] == NULL)
+ goto out;
+ ring[i]->id = i;
+ }
+ }
+ error = 0;
+
+out:
+ if (error != 0 && ring != NULL) {
+ ioat_free_ring(ioat, size, ring);
+ ring = NULL;
+ }
+ return (ring);
+}
+
+static void
+ioat_free_ring(struct ioat_softc *ioat, uint32_t size,
+ struct ioat_descriptor **ring)
+{
+ uint32_t i;
+
+ for (i = 0; i < size; i++) {
+ if (ring[i] != NULL)
+ ioat_free_ring_entry(ioat, ring[i]);
+ }
+ free(ring, M_IOAT);
+}
+
+static struct ioat_descriptor *
+ioat_get_ring_entry(struct ioat_softc *ioat, uint32_t index)
+{
+
+ return (ioat->ring[index % (1 << ioat->ring_size_order)]);
+}
+
+static int
+ring_grow(struct ioat_softc *ioat, uint32_t oldorder,
+ struct ioat_descriptor **newring)
+{
+ struct ioat_descriptor *tmp, *next;
+ struct ioat_dma_hw_descriptor *hw;
+ uint32_t oldsize, newsize, head, tail, i, end;
+ int error;
+
+ CTR0(KTR_IOAT, __func__);
+
+ mtx_assert(&ioat->submit_lock, MA_OWNED);
+
+ if (oldorder != ioat->ring_size_order || oldorder >= IOAT_MAX_ORDER) {
+ error = EINVAL;
+ goto out;
+ }
+
+ oldsize = (1 << oldorder);
+ newsize = (1 << (oldorder + 1));
+
+ mtx_lock(&ioat->cleanup_lock);
+
+ head = ioat->head & (oldsize - 1);
+ tail = ioat->tail & (oldsize - 1);
+
+ /* Copy old descriptors to new ring */
+ for (i = 0; i < oldsize; i++)
+ newring[i] = ioat->ring[i];
+
+ /*
+ * If head has wrapped but tail hasn't, we must swap some descriptors
+ * around so that tail can increment directly to head.
+ */
+ if (head < tail) {
+ for (i = 0; i <= head; i++) {
+ tmp = newring[oldsize + i];
+
+ newring[oldsize + i] = newring[i];
+ newring[oldsize + i]->id = oldsize + i;
+
+ newring[i] = tmp;
+ newring[i]->id = i;
+ }
+ head += oldsize;
+ }
+
+ KASSERT(head >= tail, ("invariants"));
+
+ /* Head didn't wrap; we only need to link in oldsize..newsize */
+ if (head < oldsize) {
+ i = oldsize - 1;
+ end = newsize;
+ } else {
+ /* Head did wrap; link newhead..newsize and 0..oldhead */
+ i = head;
+ end = newsize + (head - oldsize) + 1;
+ }
+
+ /*
+ * Fix up hardware ring, being careful not to trample the active
+ * section (tail -> head).
+ */
+ for (; i < end; i++) {
+ KASSERT((i & (newsize - 1)) < tail ||
+ (i & (newsize - 1)) >= head, ("trampling snake"));
+
+ next = newring[(i + 1) & (newsize - 1)];
+ hw = newring[i & (newsize - 1)]->u.dma;
+ hw->next = next->hw_desc_bus_addr;
+ }
+
+ free(ioat->ring, M_IOAT);
+ ioat->ring = newring;
+ ioat->ring_size_order = oldorder + 1;
+ ioat->tail = tail;
+ ioat->head = head;
+ error = 0;
+
+ mtx_unlock(&ioat->cleanup_lock);
+out:
+ if (error)
+ ioat_free_ring(ioat, (1 << (oldorder + 1)), newring);
+ return (error);
+}
+
+static int
+ring_shrink(struct ioat_softc *ioat, uint32_t oldorder,
+ struct ioat_descriptor **newring)
+{
+ struct ioat_dma_hw_descriptor *hw;
+ struct ioat_descriptor *ent, *next;
+ uint32_t oldsize, newsize, current_idx, new_idx, i;
+ int error;
+
+ CTR0(KTR_IOAT, __func__);
+
+ mtx_assert(&ioat->submit_lock, MA_OWNED);
+
+ if (oldorder != ioat->ring_size_order || oldorder <= IOAT_MIN_ORDER) {
+ error = EINVAL;
+ goto out_unlocked;
+ }
+
+ oldsize = (1 << oldorder);
+ newsize = (1 << (oldorder - 1));
+
+ mtx_lock(&ioat->cleanup_lock);
+
+ /* Can't shrink below current active set! */
+ if (ioat_get_active(ioat) >= newsize) {
+ error = ENOMEM;
+ goto out;
+ }
+
+ /*
+ * Copy current descriptors to the new ring, dropping the removed
+ * descriptors.
+ */
+ for (i = 0; i < newsize; i++) {
+ current_idx = (ioat->tail + i) & (oldsize - 1);
+ new_idx = (ioat->tail + i) & (newsize - 1);
+
+ newring[new_idx] = ioat->ring[current_idx];
+ newring[new_idx]->id = new_idx;
+ }
+
+ /* Free deleted descriptors */
+ for (i = newsize; i < oldsize; i++) {
+ ent = ioat_get_ring_entry(ioat, ioat->tail + i);
+ ioat_free_ring_entry(ioat, ent);
+ }
+
+ /* Fix up hardware ring. */
+ hw = newring[(ioat->tail + newsize - 1) & (newsize - 1)]->u.dma;
+ next = newring[(ioat->tail + newsize) & (newsize - 1)];
+ hw->next = next->hw_desc_bus_addr;
+
+ free(ioat->ring, M_IOAT);
+ ioat->ring = newring;
+ ioat->ring_size_order = oldorder - 1;
+ error = 0;
+
+out:
+ mtx_unlock(&ioat->cleanup_lock);
+out_unlocked:
+ if (error)
+ ioat_free_ring(ioat, (1 << (oldorder - 1)), newring);
+ return (error);
+}
+
+static void
+ioat_halted_debug(struct ioat_softc *ioat, uint32_t chanerr)
+{
+ struct ioat_descriptor *desc;
+
+ ioat_log_message(0, "Channel halted (%b)\n", (int)chanerr,
+ IOAT_CHANERR_STR);
+ if (chanerr == 0)
+ return;
+
+ mtx_assert(&ioat->cleanup_lock, MA_OWNED);
+
+ desc = ioat_get_ring_entry(ioat, ioat->tail + 0);
+ dump_descriptor(desc->u.raw);
+
+ desc = ioat_get_ring_entry(ioat, ioat->tail + 1);
+ dump_descriptor(desc->u.raw);
+}
+
+static void
+ioat_timer_callback(void *arg)
+{
+ struct ioat_descriptor **newring;
+ struct ioat_softc *ioat;
+ uint32_t order;
+
+ ioat = arg;
+ ioat_log_message(1, "%s\n", __func__);
+
+ if (ioat->is_completion_pending) {
+ ioat_process_events(ioat);
+ return;
+ }
+
+ /* Slowly scale the ring down if idle. */
+ mtx_lock(&ioat->submit_lock);
+ order = ioat->ring_size_order;
+ if (ioat->is_resize_pending || order == IOAT_MIN_ORDER) {
+ mtx_unlock(&ioat->submit_lock);
+ goto out;
+ }
+ ioat->is_resize_pending = TRUE;
+ mtx_unlock(&ioat->submit_lock);
+
+ newring = ioat_prealloc_ring(ioat, 1 << (order - 1), FALSE,
+ M_NOWAIT);
+
+ mtx_lock(&ioat->submit_lock);
+ KASSERT(ioat->ring_size_order == order,
+ ("resize_pending protects order"));
+
+ if (newring != NULL)
+ ring_shrink(ioat, order, newring);
+
+ ioat->is_resize_pending = FALSE;
+ mtx_unlock(&ioat->submit_lock);
+
+out:
+ if (ioat->ring_size_order > IOAT_MIN_ORDER)
+ callout_reset(&ioat->timer, 10 * hz,
+ ioat_timer_callback, ioat);
+}
+
+/*
+ * Support Functions
+ */
+static void
+ioat_submit_single(struct ioat_softc *ioat)
+{
+
+ ioat_get(ioat, IOAT_ACTIVE_DESCR_REF);
+ atomic_add_rel_int(&ioat->head, 1);
+ atomic_add_rel_int(&ioat->hw_head, 1);
+
+ if (!ioat->is_completion_pending) {
+ ioat->is_completion_pending = TRUE;
+ callout_reset(&ioat->timer, IOAT_INTR_TIMO,
+ ioat_timer_callback, ioat);
+ }
+
+ ioat->stats.descriptors_submitted++;
+}
+
+static int
+ioat_reset_hw(struct ioat_softc *ioat)
+{
+ uint64_t status;
+ uint32_t chanerr;
+ unsigned timeout;
+ int error;
+
+ mtx_lock(IOAT_REFLK);
+ ioat->quiescing = TRUE;
+ ioat_drain_locked(ioat);
+ mtx_unlock(IOAT_REFLK);
+
+ status = ioat_get_chansts(ioat);
+ if (is_ioat_active(status) || is_ioat_idle(status))
+ ioat_suspend(ioat);
+
+ /* Wait at most 20 ms */
+ for (timeout = 0; (is_ioat_active(status) || is_ioat_idle(status)) &&
+ timeout < 20; timeout++) {
+ DELAY(1000);
+ status = ioat_get_chansts(ioat);
+ }
+ if (timeout == 20) {
+ error = ETIMEDOUT;
+ goto out;
+ }
+
+ KASSERT(ioat_get_active(ioat) == 0, ("active after quiesce"));
+
+ chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
+ ioat_write_4(ioat, IOAT_CHANERR_OFFSET, chanerr);
+
+ /*
+ * IOAT v3 workaround - CHANERRMSK_INT with 3E07h to masks out errors
+ * that can cause stability issues for IOAT v3.
+ */
+ pci_write_config(ioat->device, IOAT_CFG_CHANERRMASK_INT_OFFSET, 0x3e07,
+ 4);
+ chanerr = pci_read_config(ioat->device, IOAT_CFG_CHANERR_INT_OFFSET, 4);
+ pci_write_config(ioat->device, IOAT_CFG_CHANERR_INT_OFFSET, chanerr, 4);
+
+ /*
+ * BDXDE and BWD models reset MSI-X registers on device reset.
+ * Save/restore their contents manually.
+ */
+ if (ioat_model_resets_msix(ioat)) {
+ ioat_log_message(1, "device resets MSI-X registers; saving\n");
+ pci_save_state(ioat->device);
+ }
+
+ ioat_reset(ioat);
+
+ /* Wait at most 20 ms */
+ for (timeout = 0; ioat_reset_pending(ioat) && timeout < 20; timeout++)
+ DELAY(1000);
+ if (timeout == 20) {
+ error = ETIMEDOUT;
+ goto out;
+ }
+
+ if (ioat_model_resets_msix(ioat)) {
+ ioat_log_message(1, "device resets registers; restored\n");
+ pci_restore_state(ioat->device);
+ }
+
+ /* Reset attempts to return the hardware to "halted." */
+ status = ioat_get_chansts(ioat);
+ if (is_ioat_active(status) || is_ioat_idle(status)) {
+ /* So this really shouldn't happen... */
+ ioat_log_message(0, "Device is active after a reset?\n");
+ ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
+ error = 0;
+ goto out;
+ }
+
+ chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
+ if (chanerr != 0) {
+ mtx_lock(&ioat->cleanup_lock);
+ ioat_halted_debug(ioat, chanerr);
+ mtx_unlock(&ioat->cleanup_lock);
+ error = EIO;
+ goto out;
+ }
+
+ /*
+ * Bring device back online after reset. Writing CHAINADDR brings the
+ * device back to active.
+ *
+ * The internal ring counter resets to zero, so we have to start over
+ * at zero as well.
+ */
+ ioat->tail = ioat->head = ioat->hw_head = 0;
+ ioat->last_seen = 0;
+
+ ioat_write_chanctrl(ioat, IOAT_CHANCTRL_RUN);
+ ioat_write_chancmp(ioat, ioat->comp_update_bus_addr);
+ ioat_write_chainaddr(ioat, ioat->ring[0]->hw_desc_bus_addr);
+ error = 0;
+
+out:
+ mtx_lock(IOAT_REFLK);
+ ioat->quiescing = FALSE;
+ wakeup(&ioat->quiescing);
+ mtx_unlock(IOAT_REFLK);
+
+ if (error == 0)
+ error = ioat_start_channel(ioat);
+
+ return (error);
+}
+
+static int
+sysctl_handle_chansts(SYSCTL_HANDLER_ARGS)
+{
+ struct ioat_softc *ioat;
+ struct sbuf sb;
+ uint64_t status;
+ int error;
+
+ ioat = arg1;
+
+ status = ioat_get_chansts(ioat) & IOAT_CHANSTS_STATUS;
+
+ sbuf_new_for_sysctl(&sb, NULL, 256, req);
+ switch (status) {
+ case IOAT_CHANSTS_ACTIVE:
+ sbuf_printf(&sb, "ACTIVE");
+ break;
+ case IOAT_CHANSTS_IDLE:
+ sbuf_printf(&sb, "IDLE");
+ break;
+ case IOAT_CHANSTS_SUSPENDED:
+ sbuf_printf(&sb, "SUSPENDED");
+ break;
+ case IOAT_CHANSTS_HALTED:
+ sbuf_printf(&sb, "HALTED");
+ break;
+ case IOAT_CHANSTS_ARMED:
+ sbuf_printf(&sb, "ARMED");
+ break;
+ default:
+ sbuf_printf(&sb, "UNKNOWN");
+ break;
+ }
+ error = sbuf_finish(&sb);
+ sbuf_delete(&sb);
+
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ return (EINVAL);
+}
+
+static int
+sysctl_handle_dpi(SYSCTL_HANDLER_ARGS)
+{
+ struct ioat_softc *ioat;
+ struct sbuf sb;
+#define PRECISION "1"
+ const uintmax_t factor = 10;
+ uintmax_t rate;
+ int error;
+
+ ioat = arg1;
+ sbuf_new_for_sysctl(&sb, NULL, 16, req);
+
+ if (ioat->stats.interrupts == 0) {
+ sbuf_printf(&sb, "NaN");
+ goto out;
+ }
+ rate = ioat->stats.descriptors_processed * factor /
+ ioat->stats.interrupts;
+ sbuf_printf(&sb, "%ju.%." PRECISION "ju", rate / factor,
+ rate % factor);
+#undef PRECISION
+out:
+ error = sbuf_finish(&sb);
+ sbuf_delete(&sb);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ return (EINVAL);
+}
+
+static int
+sysctl_handle_error(SYSCTL_HANDLER_ARGS)
+{
+ struct ioat_descriptor *desc;
+ struct ioat_softc *ioat;
+ int error, arg;
+
+ ioat = arg1;
+
+ arg = 0;
+ error = SYSCTL_OUT(req, &arg, sizeof(arg));
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ error = SYSCTL_IN(req, &arg, sizeof(arg));
+ if (error != 0)
+ return (error);
+
+ if (arg != 0) {
+ ioat_acquire(&ioat->dmaengine);
+ desc = ioat_op_generic(ioat, IOAT_OP_COPY, 1,
+ 0xffff000000000000ull, 0xffff000000000000ull, NULL, NULL,
+ 0);
+ if (desc == NULL)
+ error = ENOMEM;
+ else
+ ioat_submit_single(ioat);
+ ioat_release(&ioat->dmaengine);
+ }
+ return (error);
+}
+
+static int
+sysctl_handle_reset(SYSCTL_HANDLER_ARGS)
+{
+ struct ioat_softc *ioat;
+ int error, arg;
+
+ ioat = arg1;
+
+ arg = 0;
+ error = SYSCTL_OUT(req, &arg, sizeof(arg));
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ error = SYSCTL_IN(req, &arg, sizeof(arg));
+ if (error != 0)
+ return (error);
+
+ if (arg != 0)
+ error = ioat_reset_hw(ioat);
+
+ return (error);
+}
+
+static void
+dump_descriptor(void *hw_desc)
+{
+ int i, j;
+
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 8; j++)
+ printf("%08x ", ((uint32_t *)hw_desc)[i * 8 + j]);
+ printf("\n");
+ }
+}
+
+static void
+ioat_setup_sysctl(device_t device)
+{
+ struct sysctl_oid_list *par, *statpar, *state, *hammer;
+ struct sysctl_ctx_list *ctx;
+ struct sysctl_oid *tree, *tmp;
+ struct ioat_softc *ioat;
+
+ ioat = DEVICE2SOFTC(device);
+ ctx = device_get_sysctl_ctx(device);
+ tree = device_get_sysctl_tree(device);
+ par = SYSCTL_CHILDREN(tree);
+
+ SYSCTL_ADD_INT(ctx, par, OID_AUTO, "version", CTLFLAG_RD,
+ &ioat->version, 0, "HW version (0xMM form)");
+ SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "max_xfer_size", CTLFLAG_RD,
+ &ioat->max_xfer_size, 0, "HW maximum transfer size");
+ SYSCTL_ADD_INT(ctx, par, OID_AUTO, "intrdelay_supported", CTLFLAG_RD,
+ &ioat->intrdelay_supported, 0, "Is INTRDELAY supported");
+#ifdef notyet
+ SYSCTL_ADD_U16(ctx, par, OID_AUTO, "intrdelay_max", CTLFLAG_RD,
+ &ioat->intrdelay_max, 0,
+ "Maximum configurable INTRDELAY on this channel (microseconds)");
+#endif
+
+ tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "state", CTLFLAG_RD, NULL,
+ "IOAT channel internal state");
+ state = SYSCTL_CHILDREN(tmp);
+
+ SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "ring_size_order", CTLFLAG_RD,
+ &ioat->ring_size_order, 0, "SW descriptor ring size order");
+ SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "head", CTLFLAG_RD, &ioat->head,
+ 0, "SW descriptor head pointer index");
+ SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "tail", CTLFLAG_RD, &ioat->tail,
+ 0, "SW descriptor tail pointer index");
+ SYSCTL_ADD_UINT(ctx, state, OID_AUTO, "hw_head", CTLFLAG_RD,
+ &ioat->hw_head, 0, "HW DMACOUNT");
+
+ SYSCTL_ADD_UQUAD(ctx, state, OID_AUTO, "last_completion", CTLFLAG_RD,
+ ioat->comp_update, "HW addr of last completion");
+
+ SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_resize_pending", CTLFLAG_RD,
+ &ioat->is_resize_pending, 0, "resize pending");
+ SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_completion_pending",
+ CTLFLAG_RD, &ioat->is_completion_pending, 0, "completion pending");
+ SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_reset_pending", CTLFLAG_RD,
+ &ioat->is_reset_pending, 0, "reset pending");
+ SYSCTL_ADD_INT(ctx, state, OID_AUTO, "is_channel_running", CTLFLAG_RD,
+ &ioat->is_channel_running, 0, "channel running");
+
+ SYSCTL_ADD_PROC(ctx, state, OID_AUTO, "chansts",
+ CTLTYPE_STRING | CTLFLAG_RD, ioat, 0, sysctl_handle_chansts, "A",
+ "String of the channel status");
+
+#ifdef notyet
+ SYSCTL_ADD_U16(ctx, state, OID_AUTO, "intrdelay", CTLFLAG_RD,
+ &ioat->cached_intrdelay, 0,
+ "Current INTRDELAY on this channel (cached, microseconds)");
+#endif
+
+ tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "hammer", CTLFLAG_RD, NULL,
+ "Big hammers (mostly for testing)");
+ hammer = SYSCTL_CHILDREN(tmp);
+
+ SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_reset",
+ CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_reset, "I",
+ "Set to non-zero to reset the hardware");
+ SYSCTL_ADD_PROC(ctx, hammer, OID_AUTO, "force_hw_error",
+ CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_error, "I",
+ "Set to non-zero to inject a recoverable hardware error");
+
+ tmp = SYSCTL_ADD_NODE(ctx, par, OID_AUTO, "stats", CTLFLAG_RD, NULL,
+ "IOAT channel statistics");
+ statpar = SYSCTL_CHILDREN(tmp);
+
+ SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "interrupts", CTLFLAG_RW,
+ &ioat->stats.interrupts,
+ "Number of interrupts processed on this channel");
+ SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "descriptors", CTLFLAG_RW,
+ &ioat->stats.descriptors_processed,
+ "Number of descriptors processed on this channel");
+ SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "submitted", CTLFLAG_RW,
+ &ioat->stats.descriptors_submitted,
+ "Number of descriptors submitted to this channel");
+ SYSCTL_ADD_UQUAD(ctx, statpar, OID_AUTO, "errored", CTLFLAG_RW,
+ &ioat->stats.descriptors_error,
+ "Number of descriptors failed by channel errors");
+#ifdef notyet
+ SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "halts", CTLFLAG_RW,
+ &ioat->stats.channel_halts, 0,
+ "Number of times the channel has halted");
+ SYSCTL_ADD_U32(ctx, statpar, OID_AUTO, "last_halt_chanerr", CTLFLAG_RW,
+ &ioat->stats.last_halt_chanerr, 0,
+ "The raw CHANERR when the channel was last halted");
+#endif
+
+ SYSCTL_ADD_PROC(ctx, statpar, OID_AUTO, "desc_per_interrupt",
+ CTLTYPE_STRING | CTLFLAG_RD, ioat, 0, sysctl_handle_dpi, "A",
+ "Descriptors per interrupt");
+}
+
+static inline struct ioat_softc *
+ioat_get(struct ioat_softc *ioat, enum ioat_ref_kind kind)
+{
+ uint32_t old;
+
+ KASSERT(kind < IOAT_NUM_REF_KINDS, ("bogus"));
+
+ old = atomic_fetchadd_32(&ioat->refcnt, 1);
+ KASSERT(old < UINT32_MAX, ("refcnt overflow"));
+
+#ifdef INVARIANTS
+ old = atomic_fetchadd_32(&ioat->refkinds[kind], 1);
+ KASSERT(old < UINT32_MAX, ("refcnt kind overflow"));
+#endif
+
+ return (ioat);
+}
+
+static inline void
+ioat_putn(struct ioat_softc *ioat, uint32_t n, enum ioat_ref_kind kind)
+{
+
+ _ioat_putn(ioat, n, kind, FALSE);
+}
+
+static inline void
+ioat_putn_locked(struct ioat_softc *ioat, uint32_t n, enum ioat_ref_kind kind)
+{
+
+ _ioat_putn(ioat, n, kind, TRUE);
+}
+
+static inline void
+_ioat_putn(struct ioat_softc *ioat, uint32_t n, enum ioat_ref_kind kind,
+ boolean_t locked)
+{
+ uint32_t old;
+
+ KASSERT(kind < IOAT_NUM_REF_KINDS, ("bogus"));
+
+ if (n == 0)
+ return;
+
+#ifdef INVARIANTS
+ old = atomic_fetchadd_32(&ioat->refkinds[kind], -n);
+ KASSERT(old >= n, ("refcnt kind underflow"));
+#endif
+
+ /* Skip acquiring the lock if resulting refcnt > 0. */
+ for (;;) {
+ old = ioat->refcnt;
+ if (old <= n)
+ break;
+ if (atomic_cmpset_32(&ioat->refcnt, old, old - n))
+ return;
+ }
+
+ if (locked)
+ mtx_assert(IOAT_REFLK, MA_OWNED);
+ else
+ mtx_lock(IOAT_REFLK);
+
+ old = atomic_fetchadd_32(&ioat->refcnt, -n);
+ KASSERT(old >= n, ("refcnt error"));
+
+ if (old == n)
+ wakeup(IOAT_REFLK);
+ if (!locked)
+ mtx_unlock(IOAT_REFLK);
+}
+
+static inline void
+ioat_put(struct ioat_softc *ioat, enum ioat_ref_kind kind)
+{
+
+ ioat_putn(ioat, 1, kind);
+}
+
+static void
+ioat_drain_locked(struct ioat_softc *ioat)
+{
+
+ mtx_assert(IOAT_REFLK, MA_OWNED);
+ while (ioat->refcnt > 0)
+ msleep(IOAT_REFLK, IOAT_REFLK, 0, "ioat_drain", 0);
+}
diff --git a/sys/dev/ioat/ioat.h b/sys/dev/ioat/ioat.h
new file mode 100644
index 0000000..2e10124
--- /dev/null
+++ b/sys/dev/ioat/ioat.h
@@ -0,0 +1,218 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+__FBSDID("$FreeBSD$");
+
+#ifndef __IOAT_H__
+#define __IOAT_H__
+
+#include <sys/param.h>
+#include <machine/bus.h>
+
+/*
+ * This file defines the public interface to the IOAT driver.
+ */
+
+/*
+ * Enables an interrupt for this operation. Typically, you would only enable
+ * this on the last operation in a group
+ */
+#define DMA_INT_EN 0x1
+/*
+ * Like M_NOWAIT. Operations will return NULL if they cannot allocate a
+ * descriptor without blocking.
+ */
+#define DMA_NO_WAIT 0x2
+/*
+ * Disallow prefetching the source of the following operation. Ordinarily, DMA
+ * operations can be pipelined on some hardware. E.g., operation 2's source
+ * may be prefetched before operation 1 completes.
+ */
+#define DMA_FENCE 0x4
+#define _DMA_GENERIC_FLAGS (DMA_INT_EN | DMA_NO_WAIT | DMA_FENCE)
+
+/*
+ * Emit a CRC32C as the result of a ioat_copy_crc() or ioat_crc().
+ */
+#define DMA_CRC_STORE 0x8
+
+/*
+ * Compare the CRC32C of a ioat_copy_crc() or ioat_crc() against an expeceted
+ * value. It is invalid to specify both TEST and STORE.
+ */
+#define DMA_CRC_TEST 0x10
+#define _DMA_CRC_TESTSTORE (DMA_CRC_STORE | DMA_CRC_TEST)
+
+/*
+ * Use an inline comparison CRC32C or emit an inline CRC32C result. Invalid
+ * without one of STORE or TEST.
+ */
+#define DMA_CRC_INLINE 0x20
+#define _DMA_CRC_FLAGS (DMA_CRC_STORE | DMA_CRC_TEST | DMA_CRC_INLINE)
+
+/*
+ * Hardware revision number. Different hardware revisions support different
+ * features. For example, 3.2 cannot read from MMIO space, while 3.3 can.
+ */
+#define IOAT_VER_3_0 0x30
+#define IOAT_VER_3_2 0x32
+#define IOAT_VER_3_3 0x33
+
+typedef void *bus_dmaengine_t;
+struct bus_dmadesc;
+typedef void (*bus_dmaengine_callback_t)(void *arg, int error);
+
+/*
+ * Called first to acquire a reference to the DMA channel
+ *
+ * Flags may be M_WAITOK or M_NOWAIT.
+ */
+bus_dmaengine_t ioat_get_dmaengine(uint32_t channel_index, int flags);
+
+/* Release the DMA channel */
+void ioat_put_dmaengine(bus_dmaengine_t dmaengine);
+
+/* Check the DMA engine's HW version */
+int ioat_get_hwversion(bus_dmaengine_t dmaengine);
+size_t ioat_get_max_io_size(bus_dmaengine_t dmaengine);
+
+/*
+ * Set interrupt coalescing on a DMA channel.
+ *
+ * The argument is in microseconds. A zero value disables coalescing. Any
+ * other value delays interrupt generation for N microseconds to provide
+ * opportunity to coalesce multiple operations into a single interrupt.
+ *
+ * Returns an error status, or zero on success.
+ *
+ * - ERANGE if the given value exceeds the delay supported by the hardware.
+ * (All current hardware supports a maximum of 0x3fff microseconds delay.)
+ * - ENODEV if the hardware does not support interrupt coalescing.
+ */
+int ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay);
+
+/*
+ * Return the maximum supported coalescing period, for use in
+ * ioat_set_interrupt_coalesce(). If the hardware does not support coalescing,
+ * returns zero.
+ */
+uint16_t ioat_get_max_coalesce_period(bus_dmaengine_t dmaengine);
+
+/*
+ * Acquire must be called before issuing an operation to perform. Release is
+ * called after. Multiple operations can be issued within the context of one
+ * acquire and release
+ */
+void ioat_acquire(bus_dmaengine_t dmaengine);
+void ioat_release(bus_dmaengine_t dmaengine);
+
+/*
+ * Acquire_reserve can be called to ensure there is room for N descriptors. If
+ * it succeeds, the next N valid operations will successfully enqueue.
+ *
+ * It may fail with:
+ * - ENXIO if the channel is in an errored state, or the driver is being
+ * unloaded
+ * - EAGAIN if mflags included M_NOWAIT
+ *
+ * On failure, the caller does not hold the dmaengine.
+ */
+int ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags);
+
+/*
+ * Issue a blockfill operation. The 64-bit pattern 'fillpattern' is written to
+ * 'len' physically contiguous bytes at 'dst'.
+ *
+ * Only supported on devices with the BFILL capability.
+ */
+struct bus_dmadesc *ioat_blockfill(bus_dmaengine_t dmaengine, bus_addr_t dst,
+ uint64_t fillpattern, bus_size_t len, bus_dmaengine_callback_t callback_fn,
+ void *callback_arg, uint32_t flags);
+
+/* Issues the copy data operation */
+struct bus_dmadesc *ioat_copy(bus_dmaengine_t dmaengine, bus_addr_t dst,
+ bus_addr_t src, bus_size_t len, bus_dmaengine_callback_t callback_fn,
+ void *callback_arg, uint32_t flags);
+
+/*
+ * Issue a copy data operation, with constraints:
+ * - src1, src2, dst1, dst2 are all page-aligned addresses
+ * - The quantity to copy is exactly 2 pages;
+ * - src1 -> dst1, src2 -> dst2
+ *
+ * Why use this instead of normal _copy()? You can copy two non-contiguous
+ * pages (src, dst, or both) with one descriptor.
+ */
+struct bus_dmadesc *ioat_copy_8k_aligned(bus_dmaengine_t dmaengine,
+ bus_addr_t dst1, bus_addr_t dst2, bus_addr_t src1, bus_addr_t src2,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags);
+
+/*
+ * Copy len bytes from dst to src, like ioat_copy().
+ *
+ * Additionally, accumulate a CRC32C of the data.
+ *
+ * If initialseed is not NULL, the value it points to is used to seed the
+ * initial value of the CRC32C.
+ *
+ * If flags include DMA_CRC_STORE and not DMA_CRC_INLINE, crcptr is written
+ * with the 32-bit CRC32C result (in wire format).
+ *
+ * If flags include DMA_CRC_TEST and not DMA_CRC_INLINE, the computed CRC32C is
+ * compared with the 32-bit CRC32C pointed to by crcptr. If they do not match,
+ * a channel error is raised.
+ *
+ * If the DMA_CRC_INLINE flag is set, crcptr is ignored and the DMA engine uses
+ * the 4 bytes trailing the source data (TEST) or the destination data (STORE).
+ */
+struct bus_dmadesc *ioat_copy_crc(bus_dmaengine_t dmaengine, bus_addr_t dst,
+ bus_addr_t src, bus_size_t len, uint32_t *initialseed, bus_addr_t crcptr,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags);
+
+/*
+ * ioat_crc() is nearly identical to ioat_copy_crc(), but does not actually
+ * move data around.
+ *
+ * Like ioat_copy_crc, ioat_crc computes a CRC32C over len bytes pointed to by
+ * src. The flags affect its operation in the same way, with one exception:
+ *
+ * If flags includes both DMA_CRC_STORE and DMA_CRC_INLINE, the computed CRC32C
+ * is written to the 4 bytes trailing the *source* data.
+ */
+struct bus_dmadesc *ioat_crc(bus_dmaengine_t dmaengine, bus_addr_t src,
+ bus_size_t len, uint32_t *initialseed, bus_addr_t crcptr,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags);
+
+/*
+ * Issues a null operation. This issues the operation to the hardware, but the
+ * hardware doesn't do anything with it.
+ */
+struct bus_dmadesc *ioat_null(bus_dmaengine_t dmaengine,
+ bus_dmaengine_callback_t callback_fn, void *callback_arg, uint32_t flags);
+
+
+#endif /* __IOAT_H__ */
+
diff --git a/sys/dev/ioat/ioat_hw.h b/sys/dev/ioat/ioat_hw.h
new file mode 100644
index 0000000..6dfe9a6
--- /dev/null
+++ b/sys/dev/ioat/ioat_hw.h
@@ -0,0 +1,167 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+__FBSDID("$FreeBSD$");
+
+#ifndef __IOAT_HW_H__
+#define __IOAT_HW_H__
+
+#define IOAT_MAX_CHANNELS 32
+
+#define IOAT_CHANCNT_OFFSET 0x00
+
+#define IOAT_XFERCAP_OFFSET 0x01
+/* Only bits [4:0] are valid. */
+#define IOAT_XFERCAP_VALID_MASK 0x1f
+
+#define IOAT_GENCTRL_OFFSET 0x02
+
+#define IOAT_INTRCTRL_OFFSET 0x03
+#define IOAT_INTRCTRL_MASTER_INT_EN 0x01
+
+#define IOAT_ATTNSTATUS_OFFSET 0x04
+
+#define IOAT_CBVER_OFFSET 0x08
+
+#define IOAT_INTRDELAY_OFFSET 0x0C
+#define IOAT_INTRDELAY_SUPPORTED (1 << 15)
+/* Reserved. (1 << 14) */
+/* [13:0] is the coalesce period, in microseconds. */
+#define IOAT_INTRDELAY_US_MASK ((1 << 14) - 1)
+
+#define IOAT_CS_STATUS_OFFSET 0x0E
+
+#define IOAT_DMACAPABILITY_OFFSET 0x10
+#define IOAT_DMACAP_PB (1 << 0)
+#define IOAT_DMACAP_CRC (1 << 1)
+#define IOAT_DMACAP_MARKER_SKIP (1 << 2)
+#define IOAT_DMACAP_OLD_XOR (1 << 3)
+#define IOAT_DMACAP_DCA (1 << 4)
+#define IOAT_DMACAP_MOVECRC (1 << 5)
+#define IOAT_DMACAP_BFILL (1 << 6)
+#define IOAT_DMACAP_EXT_APIC (1 << 7)
+#define IOAT_DMACAP_XOR (1 << 8)
+#define IOAT_DMACAP_PQ (1 << 9)
+#define IOAT_DMACAP_DMA_DIF (1 << 10)
+#define IOAT_DMACAP_DWBES (1 << 13)
+#define IOAT_DMACAP_RAID16SS (1 << 17)
+#define IOAT_DMACAP_DMAMC (1 << 18)
+#define IOAT_DMACAP_CTOS (1 << 19)
+
+#define IOAT_DMACAP_STR \
+ "\20\24Completion_Timeout_Support\23DMA_with_Multicasting_Support" \
+ "\22RAID_Super_descriptors\16Descriptor_Write_Back_Error_Support" \
+ "\13DMA_with_DIF\12PQ\11XOR\10Extended_APIC_ID\07Block_Fill\06Move_CRC" \
+ "\05DCA\04Old_XOR\03Marker_Skipping\02CRC\01Page_Break"
+
+/* DMA Channel Registers */
+#define IOAT_CHANCTRL_OFFSET 0x80
+#define IOAT_CHANCTRL_CHANNEL_PRIORITY_MASK 0xF000
+#define IOAT_CHANCTRL_COMPL_DCA_EN 0x0200
+#define IOAT_CHANCTRL_CHANNEL_IN_USE 0x0100
+#define IOAT_CHANCTRL_DESCRIPTOR_ADDR_SNOOP_CONTROL 0x0020
+#define IOAT_CHANCTRL_ERR_INT_EN 0x0010
+#define IOAT_CHANCTRL_ANY_ERR_ABORT_EN 0x0008
+#define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004
+#define IOAT_CHANCTRL_INT_REARM 0x0001
+#define IOAT_CHANCTRL_RUN (IOAT_CHANCTRL_INT_REARM |\
+ IOAT_CHANCTRL_ERR_COMPLETION_EN |\
+ IOAT_CHANCTRL_ANY_ERR_ABORT_EN |\
+ IOAT_CHANCTRL_ERR_INT_EN)
+
+#define IOAT_CHANCMD_OFFSET 0x84
+#define IOAT_CHANCMD_RESET 0x20
+#define IOAT_CHANCMD_SUSPEND 0x04
+
+#define IOAT_DMACOUNT_OFFSET 0x86
+
+#define IOAT_CHANSTS_OFFSET_LOW 0x88
+#define IOAT_CHANSTS_OFFSET_HIGH 0x8C
+#define IOAT_CHANSTS_OFFSET 0x88
+
+#define IOAT_CHANSTS_STATUS 0x7ULL
+#define IOAT_CHANSTS_ACTIVE 0x0
+#define IOAT_CHANSTS_IDLE 0x1
+#define IOAT_CHANSTS_SUSPENDED 0x2
+#define IOAT_CHANSTS_HALTED 0x3
+#define IOAT_CHANSTS_ARMED 0x4
+
+#define IOAT_CHANSTS_UNAFFILIATED_ERROR 0x8ULL
+#define IOAT_CHANSTS_SOFT_ERROR 0x10ULL
+
+#define IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK (~0x3FULL)
+
+#define IOAT_CHAINADDR_OFFSET_LOW 0x90
+#define IOAT_CHAINADDR_OFFSET_HIGH 0x94
+
+#define IOAT_CHANCMP_OFFSET_LOW 0x98
+#define IOAT_CHANCMP_OFFSET_HIGH 0x9C
+
+#define IOAT_CHANERR_OFFSET 0xA8
+
+#define IOAT_CHANERR_XSADDERR (1 << 0)
+#define IOAT_CHANERR_XDADDERR (1 << 1)
+#define IOAT_CHANERR_NDADDERR (1 << 2)
+#define IOAT_CHANERR_DERR (1 << 3)
+#define IOAT_CHANERR_CHADDERR (1 << 4)
+#define IOAT_CHANERR_CCMDERR (1 << 5)
+#define IOAT_CHANERR_CUNCORERR (1 << 6)
+#define IOAT_CHANERR_DUNCORERR (1 << 7)
+#define IOAT_CHANERR_RDERR (1 << 8)
+#define IOAT_CHANERR_WDERR (1 << 9)
+#define IOAT_CHANERR_DCERR (1 << 10)
+#define IOAT_CHANERR_DXSERR (1 << 11)
+#define IOAT_CHANERR_CMPADDERR (1 << 12)
+#define IOAT_CHANERR_INTCFGERR (1 << 13)
+#define IOAT_CHANERR_SEDERR (1 << 14)
+#define IOAT_CHANERR_UNAFFERR (1 << 15)
+#define IOAT_CHANERR_CXPERR (1 << 16)
+/* Reserved. (1 << 17) */
+#define IOAT_CHANERR_DCNTERR (1 << 18)
+#define IOAT_CHANERR_DIFFERR (1 << 19)
+#define IOAT_CHANERR_GTVERR (1 << 20)
+#define IOAT_CHANERR_ATVERR (1 << 21)
+#define IOAT_CHANERR_RTVERR (1 << 22)
+#define IOAT_CHANERR_BBERR (1 << 23)
+#define IOAT_CHANERR_RDIFFERR (1 << 24)
+#define IOAT_CHANERR_RGTVERR (1 << 25)
+#define IOAT_CHANERR_RATVERR (1 << 26)
+#define IOAT_CHANERR_RRTVERR (1 << 27)
+
+#define IOAT_CHANERR_STR \
+ "\20\34RRTVERR\33RATVERR\32RGTVERR\31RDIFFERR\30BBERR\27RTVERR\26ATVERR" \
+ "\25GTVERR\24DIFFERR\23DCNTERR\21CXPERR\20UNAFFERR\17SEDERR\16INTCFGERR" \
+ "\15CMPADDERR\14DXSERR\13DCERR\12WDERR\11RDERR\10DUNCORERR\07CUNCORERR" \
+ "\06CCMDERR\05CHADDERR\04DERR\03NDADDERR\02XDADDERR\01XSADDERR"
+
+
+#define IOAT_CFG_CHANERR_INT_OFFSET 0x180
+#define IOAT_CFG_CHANERRMASK_INT_OFFSET 0x184
+
+#define IOAT_MIN_ORDER 4
+#define IOAT_MAX_ORDER 16
+
+#endif /* __IOAT_HW_H__ */
diff --git a/sys/dev/ioat/ioat_internal.h b/sys/dev/ioat/ioat_internal.h
new file mode 100644
index 0000000..322671c
--- /dev/null
+++ b/sys/dev/ioat/ioat_internal.h
@@ -0,0 +1,600 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+__FBSDID("$FreeBSD$");
+
+#ifndef __IOAT_INTERNAL_H__
+#define __IOAT_INTERNAL_H__
+
+#include <sys/_task.h>
+
+#define DEVICE2SOFTC(dev) ((struct ioat_softc *) device_get_softc(dev))
+#define KTR_IOAT KTR_SPARE3
+
+#define ioat_read_chancnt(ioat) \
+ ioat_read_1((ioat), IOAT_CHANCNT_OFFSET)
+
+#define ioat_read_xfercap(ioat) \
+ (ioat_read_1((ioat), IOAT_XFERCAP_OFFSET) & IOAT_XFERCAP_VALID_MASK)
+
+#define ioat_write_intrctrl(ioat, value) \
+ ioat_write_1((ioat), IOAT_INTRCTRL_OFFSET, (value))
+
+#define ioat_read_cbver(ioat) \
+ (ioat_read_1((ioat), IOAT_CBVER_OFFSET) & 0xFF)
+
+#define ioat_read_dmacapability(ioat) \
+ ioat_read_4((ioat), IOAT_DMACAPABILITY_OFFSET)
+
+#define ioat_write_chanctrl(ioat, value) \
+ ioat_write_2((ioat), IOAT_CHANCTRL_OFFSET, (value))
+
+static __inline uint64_t
+ioat_bus_space_read_8_lower_first(bus_space_tag_t tag,
+ bus_space_handle_t handle, bus_size_t offset)
+{
+ return (bus_space_read_4(tag, handle, offset) |
+ ((uint64_t)bus_space_read_4(tag, handle, offset + 4)) << 32);
+}
+
+static __inline void
+ioat_bus_space_write_8_lower_first(bus_space_tag_t tag,
+ bus_space_handle_t handle, bus_size_t offset, uint64_t val)
+{
+ bus_space_write_4(tag, handle, offset, val);
+ bus_space_write_4(tag, handle, offset + 4, val >> 32);
+}
+
+#ifdef __i386__
+#define ioat_bus_space_read_8 ioat_bus_space_read_8_lower_first
+#define ioat_bus_space_write_8 ioat_bus_space_write_8_lower_first
+#else
+#define ioat_bus_space_read_8(tag, handle, offset) \
+ bus_space_read_8((tag), (handle), (offset))
+#define ioat_bus_space_write_8(tag, handle, offset, val) \
+ bus_space_write_8((tag), (handle), (offset), (val))
+#endif
+
+#define ioat_read_1(ioat, offset) \
+ bus_space_read_1((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset))
+
+#define ioat_read_2(ioat, offset) \
+ bus_space_read_2((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset))
+
+#define ioat_read_4(ioat, offset) \
+ bus_space_read_4((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset))
+
+#define ioat_read_8(ioat, offset) \
+ ioat_bus_space_read_8((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset))
+
+#define ioat_read_double_4(ioat, offset) \
+ ioat_bus_space_read_8_lower_first((ioat)->pci_bus_tag, \
+ (ioat)->pci_bus_handle, (offset))
+
+#define ioat_write_1(ioat, offset, value) \
+ bus_space_write_1((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset), (value))
+
+#define ioat_write_2(ioat, offset, value) \
+ bus_space_write_2((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset), (value))
+
+#define ioat_write_4(ioat, offset, value) \
+ bus_space_write_4((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset), (value))
+
+#define ioat_write_8(ioat, offset, value) \
+ ioat_bus_space_write_8((ioat)->pci_bus_tag, (ioat)->pci_bus_handle, \
+ (offset), (value))
+
+#define ioat_write_double_4(ioat, offset, value) \
+ ioat_bus_space_write_8_lower_first((ioat)->pci_bus_tag, \
+ (ioat)->pci_bus_handle, (offset), (value))
+
+MALLOC_DECLARE(M_IOAT);
+
+SYSCTL_DECL(_hw_ioat);
+
+extern int g_ioat_debug_level;
+
+struct generic_dma_control {
+ uint32_t int_enable:1;
+ uint32_t src_snoop_disable:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t reserved1:1;
+ uint32_t src_page_break:1;
+ uint32_t dest_page_break:1;
+ uint32_t bundle:1;
+ uint32_t dest_dca:1;
+ uint32_t hint:1;
+ uint32_t reserved2:13;
+ uint32_t op:8;
+};
+
+struct ioat_generic_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ } u;
+ uint64_t src_addr;
+ uint64_t dest_addr;
+ uint64_t next;
+ uint64_t reserved[4];
+};
+
+struct ioat_dma_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ struct {
+ uint32_t int_enable:1;
+ uint32_t src_snoop_disable:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t null:1;
+ uint32_t src_page_break:1;
+ uint32_t dest_page_break:1;
+ uint32_t bundle:1;
+ uint32_t dest_dca:1;
+ uint32_t hint:1;
+ uint32_t reserved:13;
+ #define IOAT_OP_COPY 0x00
+ uint32_t op:8;
+ } control;
+ } u;
+ uint64_t src_addr;
+ uint64_t dest_addr;
+ uint64_t next;
+ uint64_t next_src_addr;
+ uint64_t next_dest_addr;
+ uint64_t user1;
+ uint64_t user2;
+};
+
+struct ioat_fill_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ struct {
+ uint32_t int_enable:1;
+ uint32_t reserved:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t reserved2:2;
+ uint32_t dest_page_break:1;
+ uint32_t bundle:1;
+ uint32_t reserved3:15;
+ #define IOAT_OP_FILL 0x01
+ uint32_t op:8;
+ } control;
+ } u;
+ uint64_t src_data;
+ uint64_t dest_addr;
+ uint64_t next;
+ uint64_t reserved;
+ uint64_t next_dest_addr;
+ uint64_t user1;
+ uint64_t user2;
+};
+
+struct ioat_crc32_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ struct {
+ uint32_t int_enable:1;
+ uint32_t src_snoop_disable:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t reserved1:3;
+ uint32_t bundle:1;
+ uint32_t dest_dca:1;
+ uint32_t hint:1;
+ uint32_t use_seed:1;
+ /*
+ * crc_location:
+ * For IOAT_OP_MOVECRC_TEST and IOAT_OP_CRC_TEST:
+ * 0: comparison value is pointed to by CRC Address
+ * field.
+ * 1: comparison value follows data in wire format
+ * ("inverted reflected bit order") in the 4 bytes
+ * following the source data.
+ *
+ * For IOAT_OP_CRC_STORE:
+ * 0: Result will be stored at location pointed to by
+ * CRC Address field (in wire format).
+ * 1: Result will be stored directly following the
+ * source data.
+ *
+ * For IOAT_OP_MOVECRC_STORE:
+ * 0: Result will be stored at location pointed to by
+ * CRC Address field (in wire format).
+ * 1: Result will be stored directly following the
+ * *destination* data.
+ */
+ uint32_t crc_location:1;
+ uint32_t reserved2:11;
+ /*
+ * MOVECRC - Move data in the same way as standard copy
+ * operation, but also compute CRC32.
+ *
+ * CRC - Only compute CRC on source data.
+ *
+ * There is a CRC accumulator register in the hardware.
+ * If 'initial' is set, it is initialized to the value
+ * in 'seed.'
+ *
+ * In all modes, these operators accumulate size bytes
+ * at src_addr into the running CRC32C.
+ *
+ * Store mode emits the accumulated CRC, in wire
+ * format, as specified by the crc_location bit above.
+ *
+ * Test mode compares the accumulated CRC against the
+ * reference CRC, as described in crc_location above.
+ * On failure, halts the DMA engine with a CRC error
+ * status.
+ */
+ #define IOAT_OP_MOVECRC 0x41
+ #define IOAT_OP_MOVECRC_TEST 0x42
+ #define IOAT_OP_MOVECRC_STORE 0x43
+ #define IOAT_OP_CRC 0x81
+ #define IOAT_OP_CRC_TEST 0x82
+ #define IOAT_OP_CRC_STORE 0x83
+ uint32_t op:8;
+ } control;
+ } u;
+ uint64_t src_addr;
+ uint64_t dest_addr;
+ uint64_t next;
+ uint64_t next_src_addr;
+ uint64_t next_dest_addr;
+ uint32_t seed;
+ uint32_t reserved;
+ uint64_t crc_address;
+};
+
+struct ioat_xor_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ struct {
+ uint32_t int_enable:1;
+ uint32_t src_snoop_disable:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t src_count:3;
+ uint32_t bundle:1;
+ uint32_t dest_dca:1;
+ uint32_t hint:1;
+ uint32_t reserved:13;
+ #define IOAT_OP_XOR 0x87
+ #define IOAT_OP_XOR_VAL 0x88
+ uint32_t op:8;
+ } control;
+ } u;
+ uint64_t src_addr;
+ uint64_t dest_addr;
+ uint64_t next;
+ uint64_t src_addr2;
+ uint64_t src_addr3;
+ uint64_t src_addr4;
+ uint64_t src_addr5;
+};
+
+struct ioat_xor_ext_hw_descriptor {
+ uint64_t src_addr6;
+ uint64_t src_addr7;
+ uint64_t src_addr8;
+ uint64_t next;
+ uint64_t reserved[4];
+};
+
+struct ioat_pq_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ struct {
+ uint32_t int_enable:1;
+ uint32_t src_snoop_disable:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t src_count:3;
+ uint32_t bundle:1;
+ uint32_t dest_dca:1;
+ uint32_t hint:1;
+ uint32_t p_disable:1;
+ uint32_t q_disable:1;
+ uint32_t reserved:11;
+ #define IOAT_OP_PQ 0x89
+ #define IOAT_OP_PQ_VAL 0x8a
+ uint32_t op:8;
+ } control;
+ } u;
+ uint64_t src_addr;
+ uint64_t p_addr;
+ uint64_t next;
+ uint64_t src_addr2;
+ uint64_t src_addr3;
+ uint8_t coef[8];
+ uint64_t q_addr;
+};
+
+struct ioat_pq_ext_hw_descriptor {
+ uint64_t src_addr4;
+ uint64_t src_addr5;
+ uint64_t src_addr6;
+ uint64_t next;
+ uint64_t src_addr7;
+ uint64_t src_addr8;
+ uint64_t reserved[2];
+};
+
+struct ioat_pq_update_hw_descriptor {
+ uint32_t size;
+ union {
+ uint32_t control_raw;
+ struct generic_dma_control control_generic;
+ struct {
+ uint32_t int_enable:1;
+ uint32_t src_snoop_disable:1;
+ uint32_t dest_snoop_disable:1;
+ uint32_t completion_update:1;
+ uint32_t fence:1;
+ uint32_t src_cnt:3;
+ uint32_t bundle:1;
+ uint32_t dest_dca:1;
+ uint32_t hint:1;
+ uint32_t p_disable:1;
+ uint32_t q_disable:1;
+ uint32_t reserved:3;
+ uint32_t coef:8;
+ #define IOAT_OP_PQ_UP 0x8b
+ uint32_t op:8;
+ } control;
+ } u;
+ uint64_t src_addr;
+ uint64_t p_addr;
+ uint64_t next;
+ uint64_t src_addr2;
+ uint64_t p_src;
+ uint64_t q_src;
+ uint64_t q_addr;
+};
+
+struct ioat_raw_hw_descriptor {
+ uint64_t field[8];
+};
+
+struct bus_dmadesc {
+ bus_dmaengine_callback_t callback_fn;
+ void *callback_arg;
+};
+
+struct ioat_descriptor {
+ struct bus_dmadesc bus_dmadesc;
+ union {
+ struct ioat_generic_hw_descriptor *generic;
+ struct ioat_dma_hw_descriptor *dma;
+ struct ioat_fill_hw_descriptor *fill;
+ struct ioat_crc32_hw_descriptor *crc32;
+ struct ioat_xor_hw_descriptor *xor;
+ struct ioat_xor_ext_hw_descriptor *xor_ext;
+ struct ioat_pq_hw_descriptor *pq;
+ struct ioat_pq_ext_hw_descriptor *pq_ext;
+ struct ioat_raw_hw_descriptor *raw;
+ } u;
+ uint32_t id;
+ bus_addr_t hw_desc_bus_addr;
+};
+
+/* Unused by this driver at this time. */
+#define IOAT_OP_MARKER 0x84
+
+/*
+ * Deprecated OPs -- v3 DMA generates an abort if given these. And this driver
+ * doesn't support anything older than v3.
+ */
+#define IOAT_OP_OLD_XOR 0x85
+#define IOAT_OP_OLD_XOR_VAL 0x86
+
+enum ioat_ref_kind {
+ IOAT_DMAENGINE_REF = 0,
+ IOAT_ACTIVE_DESCR_REF,
+ IOAT_NUM_REF_KINDS
+};
+
+/* One of these per allocated PCI device. */
+struct ioat_softc {
+ bus_dmaengine_t dmaengine;
+#define to_ioat_softc(_dmaeng) \
+({ \
+ bus_dmaengine_t *_p = (_dmaeng); \
+ (struct ioat_softc *)((char *)_p - \
+ offsetof(struct ioat_softc, dmaengine)); \
+})
+
+ int version;
+ int chan_idx;
+
+ struct mtx submit_lock;
+ device_t device;
+ bus_space_tag_t pci_bus_tag;
+ bus_space_handle_t pci_bus_handle;
+ int pci_resource_id;
+ struct resource *pci_resource;
+ uint32_t max_xfer_size;
+ uint32_t capabilities;
+ uint16_t intrdelay_max;
+ uint16_t cached_intrdelay;
+
+ struct resource *res;
+ int rid;
+ void *tag;
+
+ bus_dma_tag_t hw_desc_tag;
+ bus_dmamap_t hw_desc_map;
+
+ bus_dma_tag_t comp_update_tag;
+ bus_dmamap_t comp_update_map;
+ uint64_t *comp_update;
+ bus_addr_t comp_update_bus_addr;
+
+ struct callout timer;
+ struct task reset_task;
+
+ boolean_t quiescing;
+ boolean_t destroying;
+ boolean_t is_resize_pending;
+ boolean_t is_completion_pending;
+ boolean_t is_reset_pending;
+ boolean_t is_channel_running;
+ boolean_t intrdelay_supported;
+
+ uint32_t head;
+ uint32_t tail;
+ uint32_t hw_head;
+ uint32_t ring_size_order;
+ bus_addr_t last_seen;
+
+ struct ioat_descriptor **ring;
+
+ struct mtx cleanup_lock;
+ volatile uint32_t refcnt;
+#ifdef INVARIANTS
+ volatile uint32_t refkinds[IOAT_NUM_REF_KINDS];
+#endif
+
+ struct {
+ uint64_t interrupts;
+ uint64_t descriptors_processed;
+ uint64_t descriptors_error;
+ uint64_t descriptors_submitted;
+
+ uint32_t channel_halts;
+ uint32_t last_halt_chanerr;
+ } stats;
+};
+
+void ioat_test_attach(void);
+void ioat_test_detach(void);
+
+static inline uint64_t
+ioat_get_chansts(struct ioat_softc *ioat)
+{
+ uint64_t status;
+
+ if (ioat->version >= IOAT_VER_3_3)
+ status = ioat_read_8(ioat, IOAT_CHANSTS_OFFSET);
+ else
+ /* Must read lower 4 bytes before upper 4 bytes. */
+ status = ioat_read_double_4(ioat, IOAT_CHANSTS_OFFSET);
+ return (status);
+}
+
+static inline void
+ioat_write_chancmp(struct ioat_softc *ioat, uint64_t addr)
+{
+
+ if (ioat->version >= IOAT_VER_3_3)
+ ioat_write_8(ioat, IOAT_CHANCMP_OFFSET_LOW, addr);
+ else
+ ioat_write_double_4(ioat, IOAT_CHANCMP_OFFSET_LOW, addr);
+}
+
+static inline void
+ioat_write_chainaddr(struct ioat_softc *ioat, uint64_t addr)
+{
+
+ if (ioat->version >= IOAT_VER_3_3)
+ ioat_write_8(ioat, IOAT_CHAINADDR_OFFSET_LOW, addr);
+ else
+ ioat_write_double_4(ioat, IOAT_CHAINADDR_OFFSET_LOW, addr);
+}
+
+static inline boolean_t
+is_ioat_active(uint64_t status)
+{
+ return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_ACTIVE);
+}
+
+static inline boolean_t
+is_ioat_idle(uint64_t status)
+{
+ return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_IDLE);
+}
+
+static inline boolean_t
+is_ioat_halted(uint64_t status)
+{
+ return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_HALTED);
+}
+
+static inline boolean_t
+is_ioat_suspended(uint64_t status)
+{
+ return ((status & IOAT_CHANSTS_STATUS) == IOAT_CHANSTS_SUSPENDED);
+}
+
+static inline void
+ioat_suspend(struct ioat_softc *ioat)
+{
+ ioat_write_1(ioat, IOAT_CHANCMD_OFFSET, IOAT_CHANCMD_SUSPEND);
+}
+
+static inline void
+ioat_reset(struct ioat_softc *ioat)
+{
+ ioat_write_1(ioat, IOAT_CHANCMD_OFFSET, IOAT_CHANCMD_RESET);
+}
+
+static inline boolean_t
+ioat_reset_pending(struct ioat_softc *ioat)
+{
+ uint8_t cmd;
+
+ cmd = ioat_read_1(ioat, IOAT_CHANCMD_OFFSET);
+ return ((cmd & IOAT_CHANCMD_RESET) != 0);
+}
+
+#endif /* __IOAT_INTERNAL_H__ */
diff --git a/sys/dev/ioat/ioat_test.c b/sys/dev/ioat/ioat_test.c
new file mode 100644
index 0000000..5d27b1b
--- /dev/null
+++ b/sys/dev/ioat/ioat_test.c
@@ -0,0 +1,602 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/ioccom.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/sysctl.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <machine/stdarg.h>
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+
+#include "ioat.h"
+#include "ioat_hw.h"
+#include "ioat_internal.h"
+#include "ioat_test.h"
+
+#ifndef time_after
+#define time_after(a,b) ((long)(b) - (long)(a) < 0)
+#endif
+
+MALLOC_DEFINE(M_IOAT_TEST, "ioat_test", "ioat test allocations");
+
+#define IOAT_MAX_BUFS 256
+
+struct test_transaction {
+ void *buf[IOAT_MAX_BUFS];
+ uint32_t length;
+ uint32_t depth;
+ struct ioat_test *test;
+ TAILQ_ENTRY(test_transaction) entry;
+};
+
+#define IT_LOCK() mtx_lock(&ioat_test_lk)
+#define IT_UNLOCK() mtx_unlock(&ioat_test_lk)
+#define IT_ASSERT() mtx_assert(&ioat_test_lk, MA_OWNED)
+static struct mtx ioat_test_lk;
+MTX_SYSINIT(ioat_test_lk, &ioat_test_lk, "test coordination mtx", MTX_DEF);
+
+static int g_thread_index = 1;
+static struct cdev *g_ioat_cdev = NULL;
+
+#define ioat_test_log(v, ...) _ioat_test_log((v), "ioat_test: " __VA_ARGS__)
+static inline void _ioat_test_log(int verbosity, const char *fmt, ...);
+
+static void
+ioat_test_transaction_destroy(struct test_transaction *tx)
+{
+ struct ioat_test *test;
+ int i;
+
+ test = tx->test;
+
+ for (i = 0; i < IOAT_MAX_BUFS; i++) {
+ if (tx->buf[i] != NULL) {
+ if (test->testkind == IOAT_TEST_DMA_8K)
+ free(tx->buf[i], M_IOAT_TEST);
+ else
+ contigfree(tx->buf[i], tx->length, M_IOAT_TEST);
+ tx->buf[i] = NULL;
+ }
+ }
+
+ free(tx, M_IOAT_TEST);
+}
+
+static struct
+test_transaction *ioat_test_transaction_create(struct ioat_test *test,
+ unsigned num_buffers)
+{
+ struct test_transaction *tx;
+ unsigned i;
+
+ tx = malloc(sizeof(*tx), M_IOAT_TEST, M_NOWAIT | M_ZERO);
+ if (tx == NULL)
+ return (NULL);
+
+ tx->length = test->buffer_size;
+
+ for (i = 0; i < num_buffers; i++) {
+ if (test->testkind == IOAT_TEST_DMA_8K)
+ tx->buf[i] = malloc(test->buffer_size, M_IOAT_TEST,
+ M_NOWAIT);
+ else
+ tx->buf[i] = contigmalloc(test->buffer_size,
+ M_IOAT_TEST, M_NOWAIT, 0, BUS_SPACE_MAXADDR,
+ PAGE_SIZE, 0);
+
+ if (tx->buf[i] == NULL) {
+ ioat_test_transaction_destroy(tx);
+ return (NULL);
+ }
+ }
+ return (tx);
+}
+
+static void
+dump_hex(void *p, size_t chunks)
+{
+ size_t i, j;
+
+ for (i = 0; i < chunks; i++) {
+ for (j = 0; j < 8; j++)
+ printf("%08x ", ((uint32_t *)p)[i * 8 + j]);
+ printf("\n");
+ }
+}
+
+static bool
+ioat_compare_ok(struct test_transaction *tx)
+{
+ struct ioat_test *test;
+ char *dst, *src;
+ uint32_t i, j;
+
+ test = tx->test;
+
+ for (i = 0; i < tx->depth; i++) {
+ dst = tx->buf[2 * i + 1];
+ src = tx->buf[2 * i];
+
+ if (test->testkind == IOAT_TEST_FILL) {
+ for (j = 0; j < tx->length; j += sizeof(uint64_t)) {
+ if (memcmp(src, &dst[j],
+ MIN(sizeof(uint64_t), tx->length - j))
+ != 0)
+ return (false);
+ }
+ } else if (test->testkind == IOAT_TEST_DMA) {
+ if (memcmp(src, dst, tx->length) != 0)
+ return (false);
+ } else if (test->testkind == IOAT_TEST_RAW_DMA) {
+ if (test->raw_write)
+ dst = test->raw_vtarget;
+ dump_hex(dst, tx->length / 32);
+ }
+ }
+ return (true);
+}
+
+static void
+ioat_dma_test_callback(void *arg, int error)
+{
+ struct test_transaction *tx;
+ struct ioat_test *test;
+
+ if (error != 0)
+ ioat_test_log(0, "%s: Got error: %d\n", __func__, error);
+
+ tx = arg;
+ test = tx->test;
+
+ if (test->verify && !ioat_compare_ok(tx)) {
+ ioat_test_log(0, "miscompare found\n");
+ atomic_add_32(&test->status[IOAT_TEST_MISCOMPARE], tx->depth);
+ } else if (!test->too_late)
+ atomic_add_32(&test->status[IOAT_TEST_OK], tx->depth);
+
+ IT_LOCK();
+ TAILQ_REMOVE(&test->pend_q, tx, entry);
+ TAILQ_INSERT_TAIL(&test->free_q, tx, entry);
+ wakeup(&test->free_q);
+ IT_UNLOCK();
+}
+
+static int
+ioat_test_prealloc_memory(struct ioat_test *test, int index)
+{
+ uint32_t i, j, k;
+ struct test_transaction *tx;
+
+ for (i = 0; i < test->transactions; i++) {
+ tx = ioat_test_transaction_create(test, test->chain_depth * 2);
+ if (tx == NULL) {
+ ioat_test_log(0, "tx == NULL - memory exhausted\n");
+ test->status[IOAT_TEST_NO_MEMORY]++;
+ return (ENOMEM);
+ }
+
+ TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
+
+ tx->test = test;
+ tx->depth = test->chain_depth;
+
+ /* fill in source buffers */
+ for (j = 0; j < (tx->length / sizeof(uint32_t)); j++) {
+ uint32_t val = j + (index << 28);
+
+ for (k = 0; k < test->chain_depth; k++) {
+ ((uint32_t *)tx->buf[2*k])[j] = ~val;
+ ((uint32_t *)tx->buf[2*k+1])[j] = val;
+ }
+ }
+ }
+ return (0);
+}
+
+static void
+ioat_test_release_memory(struct ioat_test *test)
+{
+ struct test_transaction *tx, *s;
+
+ TAILQ_FOREACH_SAFE(tx, &test->free_q, entry, s)
+ ioat_test_transaction_destroy(tx);
+ TAILQ_INIT(&test->free_q);
+
+ TAILQ_FOREACH_SAFE(tx, &test->pend_q, entry, s)
+ ioat_test_transaction_destroy(tx);
+ TAILQ_INIT(&test->pend_q);
+}
+
+static void
+ioat_test_submit_1_tx(struct ioat_test *test, bus_dmaengine_t dma)
+{
+ struct test_transaction *tx;
+ struct bus_dmadesc *desc;
+ bus_dmaengine_callback_t cb;
+ bus_addr_t src, dest;
+ uint64_t fillpattern;
+ uint32_t i, flags;
+
+ desc = NULL;
+
+ IT_LOCK();
+ while (TAILQ_EMPTY(&test->free_q))
+ msleep(&test->free_q, &ioat_test_lk, 0, "test_submit", 0);
+
+ tx = TAILQ_FIRST(&test->free_q);
+ TAILQ_REMOVE(&test->free_q, tx, entry);
+ TAILQ_INSERT_HEAD(&test->pend_q, tx, entry);
+ IT_UNLOCK();
+
+ if (test->testkind != IOAT_TEST_MEMCPY)
+ ioat_acquire(dma);
+ for (i = 0; i < tx->depth; i++) {
+ if (test->testkind == IOAT_TEST_MEMCPY) {
+ memcpy(tx->buf[2 * i + 1], tx->buf[2 * i], tx->length);
+ if (i == tx->depth - 1)
+ ioat_dma_test_callback(tx, 0);
+ continue;
+ }
+
+ src = vtophys((vm_offset_t)tx->buf[2*i]);
+ dest = vtophys((vm_offset_t)tx->buf[2*i+1]);
+
+ if (test->testkind == IOAT_TEST_RAW_DMA) {
+ if (test->raw_write)
+ dest = test->raw_target;
+ else
+ src = test->raw_target;
+ }
+
+ if (i == tx->depth - 1) {
+ cb = ioat_dma_test_callback;
+ flags = DMA_INT_EN;
+ } else {
+ cb = NULL;
+ flags = 0;
+ }
+
+ if (test->testkind == IOAT_TEST_DMA ||
+ test->testkind == IOAT_TEST_RAW_DMA)
+ desc = ioat_copy(dma, dest, src, tx->length, cb, tx,
+ flags);
+ else if (test->testkind == IOAT_TEST_FILL) {
+ fillpattern = *(uint64_t *)tx->buf[2*i];
+ desc = ioat_blockfill(dma, dest, fillpattern,
+ tx->length, cb, tx, flags);
+ } else if (test->testkind == IOAT_TEST_DMA_8K) {
+ bus_addr_t src2, dst2;
+
+ src2 = vtophys((vm_offset_t)tx->buf[2*i] + PAGE_SIZE);
+ dst2 = vtophys((vm_offset_t)tx->buf[2*i+1] + PAGE_SIZE);
+
+ desc = ioat_copy_8k_aligned(dma, dest, dst2, src, src2,
+ cb, tx, flags);
+ }
+ if (desc == NULL)
+ break;
+ }
+ if (test->testkind == IOAT_TEST_MEMCPY)
+ return;
+ ioat_release(dma);
+
+ /*
+ * We couldn't issue an IO -- either the device is being detached or
+ * the HW reset. Essentially spin until the device comes back up or
+ * our timer expires.
+ */
+ if (desc == NULL && tx->depth > 0) {
+ atomic_add_32(&test->status[IOAT_TEST_NO_DMA_ENGINE], tx->depth);
+ IT_LOCK();
+ TAILQ_REMOVE(&test->pend_q, tx, entry);
+ TAILQ_INSERT_HEAD(&test->free_q, tx, entry);
+ IT_UNLOCK();
+ }
+}
+
+static void
+ioat_dma_test(void *arg)
+{
+ struct ioat_softc *ioat;
+ struct ioat_test *test;
+ bus_dmaengine_t dmaengine;
+ uint32_t loops;
+ int index, rc, start, end, error;
+
+ test = arg;
+ memset(__DEVOLATILE(void *, test->status), 0, sizeof(test->status));
+
+ if (test->testkind == IOAT_TEST_DMA_8K &&
+ test->buffer_size != 2 * PAGE_SIZE) {
+ ioat_test_log(0, "Asked for 8k test and buffer size isn't 8k\n");
+ test->status[IOAT_TEST_INVALID_INPUT]++;
+ return;
+ }
+
+ if (test->buffer_size > 1024 * 1024) {
+ ioat_test_log(0, "Buffer size too large >1MB\n");
+ test->status[IOAT_TEST_NO_MEMORY]++;
+ return;
+ }
+
+ if (test->chain_depth * 2 > IOAT_MAX_BUFS) {
+ ioat_test_log(0, "Depth too large (> %u)\n",
+ (unsigned)IOAT_MAX_BUFS / 2);
+ test->status[IOAT_TEST_NO_MEMORY]++;
+ return;
+ }
+
+ if (btoc((uint64_t)test->buffer_size * test->chain_depth *
+ test->transactions) > (physmem / 4)) {
+ ioat_test_log(0, "Sanity check failed -- test would "
+ "use more than 1/4 of phys mem.\n");
+ test->status[IOAT_TEST_NO_MEMORY]++;
+ return;
+ }
+
+ if ((uint64_t)test->transactions * test->chain_depth > (1<<16)) {
+ ioat_test_log(0, "Sanity check failed -- test would "
+ "use more than available IOAT ring space.\n");
+ test->status[IOAT_TEST_NO_MEMORY]++;
+ return;
+ }
+
+ if (test->testkind >= IOAT_NUM_TESTKINDS) {
+ ioat_test_log(0, "Invalid kind %u\n",
+ (unsigned)test->testkind);
+ test->status[IOAT_TEST_INVALID_INPUT]++;
+ return;
+ }
+
+ dmaengine = ioat_get_dmaengine(test->channel_index, M_NOWAIT);
+ if (dmaengine == NULL) {
+ ioat_test_log(0, "Couldn't acquire dmaengine\n");
+ test->status[IOAT_TEST_NO_DMA_ENGINE]++;
+ return;
+ }
+ ioat = to_ioat_softc(dmaengine);
+
+ if (test->testkind == IOAT_TEST_FILL &&
+ (ioat->capabilities & IOAT_DMACAP_BFILL) == 0)
+ {
+ ioat_test_log(0,
+ "Hardware doesn't support block fill, aborting test\n");
+ test->status[IOAT_TEST_INVALID_INPUT]++;
+ goto out;
+ }
+
+ if (test->coalesce_period > ioat->intrdelay_max) {
+ ioat_test_log(0,
+ "Hardware doesn't support intrdelay of %u us.\n",
+ (unsigned)test->coalesce_period);
+ test->status[IOAT_TEST_INVALID_INPUT]++;
+ goto out;
+ }
+ error = ioat_set_interrupt_coalesce(dmaengine, test->coalesce_period);
+ if (error == ENODEV && test->coalesce_period == 0)
+ error = 0;
+ if (error != 0) {
+ ioat_test_log(0, "ioat_set_interrupt_coalesce: %d\n", error);
+ test->status[IOAT_TEST_INVALID_INPUT]++;
+ goto out;
+ }
+
+ if (test->zero_stats)
+ memset(&ioat->stats, 0, sizeof(ioat->stats));
+
+ if (test->testkind == IOAT_TEST_RAW_DMA) {
+ if (test->raw_is_virtual) {
+ test->raw_vtarget = (void *)test->raw_target;
+ test->raw_target = vtophys(test->raw_vtarget);
+ } else {
+ test->raw_vtarget = pmap_mapdev(test->raw_target,
+ test->buffer_size);
+ }
+ }
+
+ index = g_thread_index++;
+ TAILQ_INIT(&test->free_q);
+ TAILQ_INIT(&test->pend_q);
+
+ if (test->duration == 0)
+ ioat_test_log(1, "Thread %d: num_loops remaining: 0x%08x\n",
+ index, test->transactions);
+ else
+ ioat_test_log(1, "Thread %d: starting\n", index);
+
+ rc = ioat_test_prealloc_memory(test, index);
+ if (rc != 0) {
+ ioat_test_log(0, "prealloc_memory: %d\n", rc);
+ goto out;
+ }
+ wmb();
+
+ test->too_late = false;
+ start = ticks;
+ end = start + (((sbintime_t)test->duration * hz) / 1000);
+
+ for (loops = 0;; loops++) {
+ if (test->duration == 0 && loops >= test->transactions)
+ break;
+ else if (test->duration != 0 && time_after(ticks, end)) {
+ test->too_late = true;
+ break;
+ }
+
+ ioat_test_submit_1_tx(test, dmaengine);
+ }
+
+ ioat_test_log(1, "Test Elapsed: %d ticks (overrun %d), %d sec.\n",
+ ticks - start, ticks - end, (ticks - start) / hz);
+
+ IT_LOCK();
+ while (!TAILQ_EMPTY(&test->pend_q))
+ msleep(&test->free_q, &ioat_test_lk, 0, "ioattestcompl", hz);
+ IT_UNLOCK();
+
+ ioat_test_log(1, "Test Elapsed2: %d ticks (overrun %d), %d sec.\n",
+ ticks - start, ticks - end, (ticks - start) / hz);
+
+ ioat_test_release_memory(test);
+out:
+ if (test->testkind == IOAT_TEST_RAW_DMA && !test->raw_is_virtual)
+ pmap_unmapdev((vm_offset_t)test->raw_vtarget,
+ test->buffer_size);
+ ioat_put_dmaengine(dmaengine);
+}
+
+static int
+ioat_test_open(struct cdev *dev, int flags, int fmt, struct thread *td)
+{
+
+ return (0);
+}
+
+static int
+ioat_test_close(struct cdev *dev, int flags, int fmt, struct thread *td)
+{
+
+ return (0);
+}
+
+static int
+ioat_test_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg, int flag,
+ struct thread *td)
+{
+
+ switch (cmd) {
+ case IOAT_DMATEST:
+ ioat_dma_test(arg);
+ break;
+ default:
+ return (EINVAL);
+ }
+ return (0);
+}
+
+static struct cdevsw ioat_cdevsw = {
+ .d_version = D_VERSION,
+ .d_flags = 0,
+ .d_open = ioat_test_open,
+ .d_close = ioat_test_close,
+ .d_ioctl = ioat_test_ioctl,
+ .d_name = "ioat_test",
+};
+
+static int
+enable_ioat_test(bool enable)
+{
+
+ mtx_assert(&Giant, MA_OWNED);
+
+ if (enable && g_ioat_cdev == NULL) {
+ g_ioat_cdev = make_dev(&ioat_cdevsw, 0, UID_ROOT, GID_WHEEL,
+ 0600, "ioat_test");
+ } else if (!enable && g_ioat_cdev != NULL) {
+ destroy_dev(g_ioat_cdev);
+ g_ioat_cdev = NULL;
+ }
+ return (0);
+}
+
+static int
+sysctl_enable_ioat_test(SYSCTL_HANDLER_ARGS)
+{
+ int error, enabled;
+
+ enabled = (g_ioat_cdev != NULL);
+ error = sysctl_handle_int(oidp, &enabled, 0, req);
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+
+ enable_ioat_test(enabled);
+ return (0);
+}
+SYSCTL_PROC(_hw_ioat, OID_AUTO, enable_ioat_test, CTLTYPE_INT | CTLFLAG_RW,
+ 0, 0, sysctl_enable_ioat_test, "I",
+ "Non-zero: Enable the /dev/ioat_test device");
+
+void
+ioat_test_attach(void)
+{
+#ifdef notyet
+ char *val;
+
+ val = kern_getenv("hw.ioat.enable_ioat_test");
+ if (val != NULL && strcmp(val, "0") != 0) {
+#else
+ int val = 0;
+
+ TUNABLE_INT_FETCH("hw.ioat.enable_ioat_test", &val);
+ if (val != 0) {
+#endif
+ mtx_lock(&Giant);
+ enable_ioat_test(true);
+ mtx_unlock(&Giant);
+ }
+#ifdef notyet
+ freeenv(val);
+#endif
+}
+
+void
+ioat_test_detach(void)
+{
+
+ mtx_lock(&Giant);
+ enable_ioat_test(false);
+ mtx_unlock(&Giant);
+}
+
+static inline void
+_ioat_test_log(int verbosity, const char *fmt, ...)
+{
+ va_list argp;
+
+ if (verbosity > g_ioat_debug_level)
+ return;
+
+ va_start(argp, fmt);
+ vprintf(fmt, argp);
+ va_end(argp);
+}
diff --git a/sys/dev/ioat/ioat_test.h b/sys/dev/ioat/ioat_test.h
new file mode 100644
index 0000000..8ef521c
--- /dev/null
+++ b/sys/dev/ioat/ioat_test.h
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+__FBSDID("$FreeBSD$");
+
+#ifndef __IOAT_TEST_H__
+#define __IOAT_TEST_H__
+
+enum ioat_res {
+ IOAT_TEST_OK = 0,
+ IOAT_TEST_NO_DMA_ENGINE,
+ IOAT_TEST_NO_MEMORY,
+ IOAT_TEST_MISCOMPARE,
+ IOAT_TEST_INVALID_INPUT,
+ IOAT_NUM_RES
+};
+
+enum ioat_test_kind {
+ IOAT_TEST_FILL = 0,
+ IOAT_TEST_DMA,
+ IOAT_TEST_RAW_DMA,
+ IOAT_TEST_DMA_8K,
+ IOAT_TEST_MEMCPY,
+ IOAT_NUM_TESTKINDS
+};
+
+struct test_transaction;
+
+struct ioat_test {
+ volatile uint32_t status[IOAT_NUM_RES];
+ uint32_t channel_index;
+
+ enum ioat_test_kind testkind;
+
+ /* HW max of 1MB */
+ uint32_t buffer_size;
+ uint32_t chain_depth;
+ uint32_t transactions;
+
+ /*
+ * If non-zero, duration is time in ms;
+ * If zero, bounded by 'transactions' above.
+ */
+ uint32_t duration;
+
+ /* If true, check for miscompares after a copy. */
+ bool verify;
+
+ /* DMA directly to/from some memory address */
+ uint64_t raw_target;
+ void *raw_vtarget;
+ bool raw_write;
+ bool raw_is_virtual;
+
+ bool zero_stats;
+ /* Configure coalesce period */
+ uint16_t coalesce_period;
+
+ /* Internal usage -- not test inputs */
+ TAILQ_HEAD(, test_transaction) free_q;
+ TAILQ_HEAD(, test_transaction) pend_q;
+ volatile bool too_late;
+};
+
+#define IOAT_DMATEST _IOWR('i', 0, struct ioat_test)
+
+#endif /* __IOAT_TEST_H__ */
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index ceb54ed..aa36453 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -3206,7 +3206,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
case FC_PORTDB_STATE_DEAD:
lp->state = FC_PORTDB_STATE_NIL;
isp_async(isp, ISPASYNC_DEV_GONE, chan, lp);
- if (lp->autologin == 0) {
+ if ((lp->portid & 0xffff00) != 0) {
(void) isp_plogx(isp, chan, lp->handle,
lp->portid,
PLOGX_FLG_CMD_LOGO |
@@ -3304,7 +3304,6 @@ isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_t *pdb)
}
ISP_MEMZERO(lp, sizeof (fcportdb_t));
- lp->autologin = 1;
lp->probational = 0;
lp->state = FC_PORTDB_STATE_NEW;
lp->portid = lp->new_portid = pdb->portid;
@@ -3808,6 +3807,9 @@ fail:
goto fail;
}
+ if (lp->state == FC_PORTDB_STATE_ZOMBIE)
+ goto relogin;
+
/*
* See if we're still logged into it.
*
@@ -4697,6 +4699,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
tmf->tmf_tidhi = lp->portid >> 16;
tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan);
isp_put_24xx_tmf(isp, tmf, isp->isp_iocb);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "TMF IOCB request", QENTRY_LEN, isp->isp_iocb);
MEMORYBARRIER(isp, SYNC_IFORDEV, 0, QENTRY_LEN, chan);
fcp->sendmarker = 1;
@@ -4713,6 +4717,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
break;
MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "TMF IOCB response", QENTRY_LEN, &((isp24xx_statusreq_t *)isp->isp_iocb)[1]);
sp = (isp24xx_statusreq_t *) local;
isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)isp->isp_iocb)[1], sp);
if (sp->req_completion_status == 0) {
@@ -4779,6 +4785,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
ab->abrt_tidhi = lp->portid >> 16;
ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan);
isp_put_24xx_abrt(isp, ab, isp->isp_iocb);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "AB IOCB quest", QENTRY_LEN, isp->isp_iocb);
MEMORYBARRIER(isp, SYNC_IFORDEV, 0, 2 * QENTRY_LEN, chan);
ISP_MEMZERO(&mbs, sizeof (mbs));
@@ -4794,6 +4802,8 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
break;
MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
+ if (isp->isp_dblev & ISP_LOGDEBUG1)
+ isp_print_bytes(isp, "AB IOCB response", QENTRY_LEN, &((isp24xx_abrt_t *)isp->isp_iocb)[1]);
isp_get_24xx_abrt(isp, &((isp24xx_abrt_t *)isp->isp_iocb)[1], ab);
if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) {
return (0);
@@ -6515,6 +6525,8 @@ isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp)
{
const char *reason;
uint8_t sts = sp->req_completion_status & 0xff;
+ fcparam *fcp = FCPARAM(isp, 0);
+ fcportdb_t *lp;
/*
* It was there (maybe)- treat as a selection timeout.
@@ -6532,8 +6544,8 @@ isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp)
* to force a re-login of this unit. If we're on fabric,
* then we'll have to log in again as a matter of course.
*/
- if (FCPARAM(isp, 0)->isp_topo == TOPO_NL_PORT ||
- FCPARAM(isp, 0)->isp_topo == TOPO_FL_PORT) {
+ if (fcp->isp_topo == TOPO_NL_PORT ||
+ fcp->isp_topo == TOPO_FL_PORT) {
mbreg_t mbs;
MBSINIT(&mbs, MBOX_INIT_LIP, MBLOGALL, 0);
if (ISP_CAP_2KLOGIN(isp)) {
@@ -6542,7 +6554,12 @@ isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp)
isp_mboxcmd_qnw(isp, &mbs, 1);
}
if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_SELTIMEOUT);
+ lp = &fcp->portdb[XS_TGT(xs)];
+ if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
+ *XS_STSP(xs) = SCSI_BUSY;
+ XS_SETERR(xs, HBA_TGTBSY);
+ } else
+ XS_SETERR(xs, HBA_SELTIMEOUT);
}
return;
}
@@ -6666,6 +6683,8 @@ isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, long *
{
const char *reason;
uint8_t sts = sp->req_completion_status & 0xff;
+ fcparam *fcp = FCPARAM(isp, XS_CHANNEL(xs));
+ fcportdb_t *lp;
/*
* It was there (maybe)- treat as a selection timeout.
@@ -6683,7 +6702,12 @@ isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, long *
* There is no MBOX_INIT_LIP for the 24XX.
*/
if (XS_NOERR(xs)) {
- XS_SETERR(xs, HBA_SELTIMEOUT);
+ lp = &fcp->portdb[XS_TGT(xs)];
+ if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
+ *XS_STSP(xs) = SCSI_BUSY;
+ XS_SETERR(xs, HBA_TGTBSY);
+ } else
+ XS_SETERR(xs, HBA_SELTIMEOUT);
}
return;
}
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 0473b1b..c6b8dc4 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -1363,7 +1363,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
* and status, don't do it again and do the status portion now.
*/
if (atp->sendst) {
- isp_prt(isp, ISP_LOGTINFO, "[0x%x] now sending synthesized status orig_dl=%u xfered=%u bit=%u",
+ isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] now sending synthesized status orig_dl=%u xfered=%u bit=%u",
cso->tag_id, atp->orig_datalen, atp->bytes_xfered, atp->bytes_in_transit);
xfrlen = 0; /* we already did the data transfer */
atp->sendst = 0;
@@ -2103,7 +2103,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
"%s: [0x%x] no state pointer for lun %jx or wildcard",
__func__, aep->at_rxid, (uintmax_t)lun);
if (lun == 0) {
- isp_endcmd(isp, aep, nphdl, SCSI_STATUS_BUSY, 0);
+ isp_endcmd(isp, aep, nphdl, chan, SCSI_STATUS_BUSY, 0);
} else {
isp_endcmd(isp, aep, nphdl, chan, SCSI_STATUS_CHECK_COND | ECMD_SVALID | (0x5 << 12) | (0x25 << 16), 0);
}
diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c
index 48e0535..f186e50 100644
--- a/sys/dev/isp/isp_library.c
+++ b/sys/dev/isp/isp_library.c
@@ -437,8 +437,8 @@ isp_dump_portdb(ispsoftc_t *isp, int chan)
}
isp_gen_role_str(buf1, sizeof (buf1), lp->prli_word3);
isp_gen_role_str(buf2, sizeof (buf2), lp->new_prli_word3);
- isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s al%d %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x",
- chan, i, lp->handle, dbs[lp->state], lp->autologin, buf1, lp->portid, buf2, lp->new_portid,
+ isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x",
+ chan, i, lp->handle, dbs[lp->state], buf1, lp->portid, buf2, lp->new_portid,
(uint32_t) (lp->node_wwn >> 32), (uint32_t) (lp->node_wwn), (uint32_t) (lp->port_wwn >> 32), (uint32_t) (lp->port_wwn));
}
}
diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c
index c6af888..c5c277f 100644
--- a/sys/dev/isp/isp_target.c
+++ b/sys/dev/isp/isp_target.c
@@ -169,7 +169,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
* Check for and do something with commands whose
* IULEN extends past a single queue entry.
*/
- len = at7iop->at_ta_len & 0xfffff;
+ len = at7iop->at_ta_len & 0x0fff;
if (len > (QENTRY_LEN - 8)) {
len -= (QENTRY_LEN - 8);
isp_prt(isp, ISP_LOGINFO, "long IU length (%d) ignored", len);
@@ -539,13 +539,22 @@ isp_endcmd(ispsoftc_t *isp, ...)
} else if (code & ECMD_SVALID) {
cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
- cto->rsp.m1.ct_resplen = cto->ct_senselen = min(16, MAXRESPLEN_24XX);
+ cto->ct_senselen = min(16, MAXRESPLEN_24XX);
ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
cto->rsp.m1.ct_resp[0] = 0xf0;
cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
cto->rsp.m1.ct_resp[7] = 8;
cto->rsp.m1.ct_resp[12] = (code >> 16) & 0xff;
cto->rsp.m1.ct_resp[13] = (code >> 24) & 0xff;
+ } else if (code & ECMD_RVALID) {
+ cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
+ cto->ct_scsi_status |= (FCP_RSPLEN_VALID << 8);
+ cto->rsp.m1.ct_resplen = 4;
+ ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
+ cto->rsp.m1.ct_resp[0] = (code >> 12) & 0xf;
+ cto->rsp.m1.ct_resp[1] = (code >> 16) & 0xff;
+ cto->rsp.m1.ct_resp[2] = (code >> 24) & 0xff;
+ cto->rsp.m1.ct_resp[3] = 0;
} else {
cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
}
@@ -764,6 +773,7 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
isp_notify_t notify;
static const char f1[] = "%s from PortID 0x%06x lun %x seq 0x%08x";
static const char f2[] = "unknown Task Flag 0x%x lun %x PortID 0x%x tag 0x%08x";
+ fcportdb_t *lp;
uint16_t chan;
uint32_t sid, did;
@@ -774,21 +784,23 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
notify.nt_tagval = aep->at_rxid;
notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
notify.nt_lreserved = aep;
- sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | (aep->at_hdr.s_id[2]);
-
- /* Channel has to derived from D_ID */
+ sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2];
did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2];
- for (chan = 0; chan < isp->isp_nchan; chan++) {
- if (FCPARAM(isp, chan)->isp_portid == did) {
- break;
+ if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) {
+ /* Channel has to be derived from D_ID */
+ isp_find_chan_by_did(isp, did, &chan);
+ if (chan == ISP_NOCHAN) {
+ isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did);
+ isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN, ECMD_TERMINATE, 0);
+ return;
}
+ } else {
+ chan = 0;
}
- if (chan == isp->isp_nchan) {
- isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did);
- /* just drop on the floor */
- return;
- }
- notify.nt_nphdl = NIL_HANDLE; /* unknown here */
+ if (isp_find_pdb_by_portid(isp, chan, sid, &lp))
+ notify.nt_nphdl = lp->handle;
+ else
+ notify.nt_nphdl = NIL_HANDLE;
notify.nt_sid = sid;
notify.nt_did = did;
notify.nt_channel = chan;
@@ -816,6 +828,7 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
} else {
isp_prt(isp, ISP_LOGWARN, f2, aep->at_cmnd.fcp_cmnd_task_management, notify.nt_lun, sid, aep->at_rxid);
notify.nt_ncode = NT_UNKNOWN;
+ isp_endcmd(isp, aep, notify.nt_nphdl, chan, ECMD_RVALID | (0x4 << 12), 0);
return;
}
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h
index a97a04f..6f7f871 100644
--- a/sys/dev/isp/ispvar.h
+++ b/sys/dev/isp/ispvar.h
@@ -380,9 +380,6 @@ typedef struct {
uint16_t handle;
/*
- * A device is 'autologin' if the firmware automatically logs into
- * it (re-logins as needed). Basically, local private loop devices.
- *
* PRLI word 3 parameters contains role as well as other things.
*
* The state is the current state of this entry.
@@ -396,8 +393,7 @@ typedef struct {
*/
uint16_t prli_word3; /* PRLI parameters */
uint16_t new_prli_word3; /* Incoming new PRLI parameters */
- uint16_t : 11,
- autologin : 1, /* F/W does PLOGI/PLOGO */
+ uint16_t : 12,
probational : 1,
state : 3;
uint32_t : 6,
@@ -1147,7 +1143,8 @@ int isp_target_put_atio(ispsoftc_t *, void *);
*/
int isp_endcmd(ispsoftc_t *, ...);
#define ECMD_SVALID 0x100
-#define ECMD_TERMINATE 0x200
+#define ECMD_RVALID 0x200
+#define ECMD_TERMINATE 0x400
/*
* Handle an asynchronous event
diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h
index b3433f7..c4415c1 100644
--- a/sys/dev/mlx5/mlx5_en/en.h
+++ b/sys/dev/mlx5/mlx5_en/en.h
@@ -393,6 +393,8 @@ struct mlx5e_params {
m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining tx packets") \
m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx packets to join") \
m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \
+ m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion event ratio") \
+ m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum completion event ratio") \
m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \
m(+1, u64 cqe_zipping, "cqe_zipping", "0 : CQE zipping disabled")
@@ -498,6 +500,17 @@ struct mlx5e_sq {
/* dirtied @xmit */
u16 pc __aligned(MLX5E_CACHELINE_SIZE);
u16 bf_offset;
+ u16 cev_counter; /* completion event counter */
+ u16 cev_factor; /* completion event factor */
+ u32 cev_next_state; /* next completion event state */
+#define MLX5E_CEV_STATE_INITIAL 0 /* timer not started */
+#define MLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */
+#define MLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */
+ struct callout cev_callout;
+ union {
+ u32 d32[2];
+ u64 d64;
+ } doorbell;
struct mlx5e_sq_stats stats;
struct mlx5e_cq cq;
@@ -745,8 +758,7 @@ int mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv);
void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv);
static inline void
-mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
- struct mlx5e_tx_wqe *wqe, int bf_sz)
+mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe, int bf_sz)
{
u16 ofst = MLX5_BF_OFFSET + sq->bf_offset;
@@ -762,13 +774,13 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
wmb();
if (bf_sz) {
- __iowrite64_copy(sq->uar_bf_map + ofst, &wqe->ctrl, bf_sz);
+ __iowrite64_copy(sq->uar_bf_map + ofst, wqe, bf_sz);
/* flush the write-combining mapped buffer */
wmb();
} else {
- mlx5_write64((__be32 *)&wqe->ctrl, sq->uar_map + ofst, NULL);
+ mlx5_write64(wqe, sq->uar_map + ofst, NULL);
}
sq->bf_offset ^= sq->bf_buf_size;
@@ -788,7 +800,8 @@ void mlx5e_create_ethtool(struct mlx5e_priv *);
void mlx5e_create_stats(struct sysctl_ctx_list *,
struct sysctl_oid_list *, const char *,
const char **, unsigned, u64 *);
-void mlx5e_send_nop(struct mlx5e_sq *, u32, bool);
+void mlx5e_send_nop(struct mlx5e_sq *, u32);
+void mlx5e_sq_cev_timeout(void *);
int mlx5e_refresh_channel_params(struct mlx5e_priv *);
#endif /* _MLX5_EN_H_ */
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
index f7993e9..45500d7 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
@@ -48,6 +48,45 @@ mlx5e_create_stats(struct sysctl_ctx_list *ctx,
}
}
+static void
+mlx5e_ethtool_sync_tx_completion_fact(struct mlx5e_priv *priv)
+{
+ /*
+ * Limit the maximum distance between completion events to
+ * half of the currently set TX queue size.
+ *
+ * The maximum number of queue entries a single IP packet can
+ * consume is given by MLX5_SEND_WQE_MAX_WQEBBS.
+ *
+ * The worst case max value is then given as below:
+ */
+ uint64_t max = priv->params_ethtool.tx_queue_size /
+ (2 * MLX5_SEND_WQE_MAX_WQEBBS);
+
+ /*
+ * Update the maximum completion factor value in case the
+ * tx_queue_size field changed. Ensure we don't overflow
+ * 16-bits.
+ */
+ if (max < 1)
+ max = 1;
+ else if (max > 65535)
+ max = 65535;
+ priv->params_ethtool.tx_completion_fact_max = max;
+
+ /*
+ * Verify that the current TX completion factor is within the
+ * given limits:
+ */
+ if (priv->params_ethtool.tx_completion_fact < 1)
+ priv->params_ethtool.tx_completion_fact = 1;
+ else if (priv->params_ethtool.tx_completion_fact > max)
+ priv->params_ethtool.tx_completion_fact = max;
+}
+
+#define MLX5_PARAM_OFFSET(n) \
+ __offsetof(struct mlx5e_priv, params_ethtool.n)
+
static int
mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
{
@@ -74,129 +113,222 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
error = ENXIO;
goto done;
}
- /* import RX coal time */
- if (priv->params_ethtool.rx_coalesce_usecs < 1)
- priv->params_ethtool.rx_coalesce_usecs = 0;
- else if (priv->params_ethtool.rx_coalesce_usecs >
- MLX5E_FLD_MAX(cqc, cq_period)) {
- priv->params_ethtool.rx_coalesce_usecs =
- MLX5E_FLD_MAX(cqc, cq_period);
- }
- priv->params.rx_cq_moderation_usec = priv->params_ethtool.rx_coalesce_usecs;
-
- /* import RX coal pkts */
- if (priv->params_ethtool.rx_coalesce_pkts < 1)
- priv->params_ethtool.rx_coalesce_pkts = 0;
- else if (priv->params_ethtool.rx_coalesce_pkts >
- MLX5E_FLD_MAX(cqc, cq_max_count)) {
- priv->params_ethtool.rx_coalesce_pkts =
- MLX5E_FLD_MAX(cqc, cq_max_count);
- }
- priv->params.rx_cq_moderation_pkts = priv->params_ethtool.rx_coalesce_pkts;
-
- /* import TX coal time */
- if (priv->params_ethtool.tx_coalesce_usecs < 1)
- priv->params_ethtool.tx_coalesce_usecs = 0;
- else if (priv->params_ethtool.tx_coalesce_usecs >
- MLX5E_FLD_MAX(cqc, cq_period)) {
- priv->params_ethtool.tx_coalesce_usecs =
- MLX5E_FLD_MAX(cqc, cq_period);
- }
- priv->params.tx_cq_moderation_usec = priv->params_ethtool.tx_coalesce_usecs;
-
- /* import TX coal pkts */
- if (priv->params_ethtool.tx_coalesce_pkts < 1)
- priv->params_ethtool.tx_coalesce_pkts = 0;
- else if (priv->params_ethtool.tx_coalesce_pkts >
- MLX5E_FLD_MAX(cqc, cq_max_count)) {
- priv->params_ethtool.tx_coalesce_pkts = MLX5E_FLD_MAX(cqc, cq_max_count);
- }
- priv->params.tx_cq_moderation_pkts = priv->params_ethtool.tx_coalesce_pkts;
-
was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
- if (was_opened) {
- u64 *xarg = priv->params_ethtool.arg + arg2;
-
- if (xarg == &priv->params_ethtool.tx_coalesce_pkts ||
- xarg == &priv->params_ethtool.rx_coalesce_pkts ||
- xarg == &priv->params_ethtool.tx_coalesce_usecs ||
- xarg == &priv->params_ethtool.rx_coalesce_usecs) {
- /* avoid downing and upping the network interface */
+
+ switch (MLX5_PARAM_OFFSET(arg[arg2])) {
+ case MLX5_PARAM_OFFSET(rx_coalesce_usecs):
+ /* import RX coal time */
+ if (priv->params_ethtool.rx_coalesce_usecs < 1)
+ priv->params_ethtool.rx_coalesce_usecs = 0;
+ else if (priv->params_ethtool.rx_coalesce_usecs >
+ MLX5E_FLD_MAX(cqc, cq_period)) {
+ priv->params_ethtool.rx_coalesce_usecs =
+ MLX5E_FLD_MAX(cqc, cq_period);
+ }
+ priv->params.rx_cq_moderation_usec =
+ priv->params_ethtool.rx_coalesce_usecs;
+
+ /* check to avoid down and up the network interface */
+ if (was_opened)
error = mlx5e_refresh_channel_params(priv);
- goto done;
+ break;
+
+ case MLX5_PARAM_OFFSET(rx_coalesce_pkts):
+ /* import RX coal pkts */
+ if (priv->params_ethtool.rx_coalesce_pkts < 1)
+ priv->params_ethtool.rx_coalesce_pkts = 0;
+ else if (priv->params_ethtool.rx_coalesce_pkts >
+ MLX5E_FLD_MAX(cqc, cq_max_count)) {
+ priv->params_ethtool.rx_coalesce_pkts =
+ MLX5E_FLD_MAX(cqc, cq_max_count);
}
- mlx5e_close_locked(priv->ifp);
- }
- /* import TX queue size */
- if (priv->params_ethtool.tx_queue_size <
- (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) {
- priv->params_ethtool.tx_queue_size =
- (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE);
- } else if (priv->params_ethtool.tx_queue_size >
- priv->params_ethtool.tx_queue_size_max) {
+ priv->params.rx_cq_moderation_pkts =
+ priv->params_ethtool.rx_coalesce_pkts;
+
+ /* check to avoid down and up the network interface */
+ if (was_opened)
+ error = mlx5e_refresh_channel_params(priv);
+ break;
+
+ case MLX5_PARAM_OFFSET(tx_coalesce_usecs):
+ /* import TX coal time */
+ if (priv->params_ethtool.tx_coalesce_usecs < 1)
+ priv->params_ethtool.tx_coalesce_usecs = 0;
+ else if (priv->params_ethtool.tx_coalesce_usecs >
+ MLX5E_FLD_MAX(cqc, cq_period)) {
+ priv->params_ethtool.tx_coalesce_usecs =
+ MLX5E_FLD_MAX(cqc, cq_period);
+ }
+ priv->params.tx_cq_moderation_usec =
+ priv->params_ethtool.tx_coalesce_usecs;
+
+ /* check to avoid down and up the network interface */
+ if (was_opened)
+ error = mlx5e_refresh_channel_params(priv);
+ break;
+
+ case MLX5_PARAM_OFFSET(tx_coalesce_pkts):
+ /* import TX coal pkts */
+ if (priv->params_ethtool.tx_coalesce_pkts < 1)
+ priv->params_ethtool.tx_coalesce_pkts = 0;
+ else if (priv->params_ethtool.tx_coalesce_pkts >
+ MLX5E_FLD_MAX(cqc, cq_max_count)) {
+ priv->params_ethtool.tx_coalesce_pkts =
+ MLX5E_FLD_MAX(cqc, cq_max_count);
+ }
+ priv->params.tx_cq_moderation_pkts =
+ priv->params_ethtool.tx_coalesce_pkts;
+
+ /* check to avoid down and up the network interface */
+ if (was_opened)
+ error = mlx5e_refresh_channel_params(priv);
+ break;
+
+ case MLX5_PARAM_OFFSET(tx_queue_size):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* import TX queue size */
+ if (priv->params_ethtool.tx_queue_size <
+ (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) {
+ priv->params_ethtool.tx_queue_size =
+ (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE);
+ } else if (priv->params_ethtool.tx_queue_size >
+ priv->params_ethtool.tx_queue_size_max) {
+ priv->params_ethtool.tx_queue_size =
+ priv->params_ethtool.tx_queue_size_max;
+ }
+ /* store actual TX queue size */
+ priv->params.log_sq_size =
+ order_base_2(priv->params_ethtool.tx_queue_size);
priv->params_ethtool.tx_queue_size =
- priv->params_ethtool.tx_queue_size_max;
- }
- priv->params.log_sq_size =
- order_base_2(priv->params_ethtool.tx_queue_size);
+ 1 << priv->params.log_sq_size;
- /* import RX queue size */
- if (priv->params_ethtool.rx_queue_size <
- (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)) {
- priv->params_ethtool.rx_queue_size =
- (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE);
- } else if (priv->params_ethtool.rx_queue_size >
- priv->params_ethtool.rx_queue_size_max) {
+ /* verify TX completion factor */
+ mlx5e_ethtool_sync_tx_completion_fact(priv);
+
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(rx_queue_size):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* import RX queue size */
+ if (priv->params_ethtool.rx_queue_size <
+ (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)) {
+ priv->params_ethtool.rx_queue_size =
+ (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE);
+ } else if (priv->params_ethtool.rx_queue_size >
+ priv->params_ethtool.rx_queue_size_max) {
+ priv->params_ethtool.rx_queue_size =
+ priv->params_ethtool.rx_queue_size_max;
+ }
+ /* store actual RX queue size */
+ priv->params.log_rq_size =
+ order_base_2(priv->params_ethtool.rx_queue_size);
priv->params_ethtool.rx_queue_size =
- priv->params_ethtool.rx_queue_size_max;
- }
- priv->params.log_rq_size =
- order_base_2(priv->params_ethtool.rx_queue_size);
-
- priv->params.min_rx_wqes = min_t (u16,
- priv->params_ethtool.rx_queue_size - 1,
- MLX5E_PARAMS_DEFAULT_MIN_RX_WQES);
-
- /* import number of channels */
- if (priv->params_ethtool.channels < 1)
- priv->params_ethtool.channels = 1;
- else if (priv->params_ethtool.channels >
- (u64) priv->mdev->priv.eq_table.num_comp_vectors) {
- priv->params_ethtool.channels =
- (u64) priv->mdev->priv.eq_table.num_comp_vectors;
- }
- priv->params.num_channels = priv->params_ethtool.channels;
-
- /* import RX mode */
- if (priv->params_ethtool.rx_coalesce_mode != 0)
- priv->params_ethtool.rx_coalesce_mode = 1;
- priv->params.rx_cq_moderation_mode = priv->params_ethtool.rx_coalesce_mode;
-
- /* import TX mode */
- if (priv->params_ethtool.tx_coalesce_mode != 0)
- priv->params_ethtool.tx_coalesce_mode = 1;
- priv->params.tx_cq_moderation_mode = priv->params_ethtool.tx_coalesce_mode;
-
- /* we always agree to turn off HW LRO - but not always to turn on */
- if (priv->params_ethtool.hw_lro != 0) {
- if ((priv->ifp->if_capenable & IFCAP_LRO) &&
- MLX5_CAP_ETH(priv->mdev, lro_cap)) {
- priv->params.hw_lro_en = 1;
- priv->params_ethtool.hw_lro = 1;
+ 1 << priv->params.log_rq_size;
+
+ /* update least number of RX WQEs */
+ priv->params.min_rx_wqes = min(
+ priv->params_ethtool.rx_queue_size - 1,
+ MLX5E_PARAMS_DEFAULT_MIN_RX_WQES);
+
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(channels):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* import number of channels */
+ if (priv->params_ethtool.channels < 1)
+ priv->params_ethtool.channels = 1;
+ else if (priv->params_ethtool.channels >
+ (u64) priv->mdev->priv.eq_table.num_comp_vectors) {
+ priv->params_ethtool.channels =
+ (u64) priv->mdev->priv.eq_table.num_comp_vectors;
+ }
+ priv->params.num_channels = priv->params_ethtool.channels;
+
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(rx_coalesce_mode):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* import RX coalesce mode */
+ if (priv->params_ethtool.rx_coalesce_mode != 0)
+ priv->params_ethtool.rx_coalesce_mode = 1;
+ priv->params.rx_cq_moderation_mode =
+ priv->params_ethtool.rx_coalesce_mode;
+
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(tx_coalesce_mode):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* import TX coalesce mode */
+ if (priv->params_ethtool.tx_coalesce_mode != 0)
+ priv->params_ethtool.tx_coalesce_mode = 1;
+ priv->params.tx_cq_moderation_mode =
+ priv->params_ethtool.tx_coalesce_mode;
+
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(hw_lro):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* import HW LRO mode */
+ if (priv->params_ethtool.hw_lro != 0) {
+ if ((priv->ifp->if_capenable & IFCAP_LRO) &&
+ MLX5_CAP_ETH(priv->mdev, lro_cap)) {
+ priv->params.hw_lro_en = 1;
+ priv->params_ethtool.hw_lro = 1;
+ } else {
+ priv->params.hw_lro_en = 0;
+ priv->params_ethtool.hw_lro = 0;
+ error = EINVAL;
+
+ if_printf(priv->ifp, "Can't enable HW LRO: "
+ "The HW or SW LRO feature is disabled\n");
+ }
} else {
priv->params.hw_lro_en = 0;
- priv->params_ethtool.hw_lro = 0;
- error = EINVAL;
-
- if_printf(priv->ifp, "Can't enable HW LRO: "
- "The HW or SW LRO feature is disabled");
}
- } else {
- priv->params.hw_lro_en = 0;
- }
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(cqe_zipping):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
- if (&priv->params_ethtool.arg[arg2] ==
- &priv->params_ethtool.cqe_zipping) {
+ /* import CQE zipping mode */
if (priv->params_ethtool.cqe_zipping &&
MLX5_CAP_GEN(priv->mdev, cqe_compression)) {
priv->params.cqe_zipping_en = true;
@@ -205,9 +337,27 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS)
priv->params.cqe_zipping_en = false;
priv->params_ethtool.cqe_zipping = 0;
}
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ case MLX5_PARAM_OFFSET(tx_completion_fact):
+ /* network interface must be down */
+ if (was_opened)
+ mlx5e_close_locked(priv->ifp);
+
+ /* verify parameter */
+ mlx5e_ethtool_sync_tx_completion_fact(priv);
+
+ /* restart network interface, if any */
+ if (was_opened)
+ mlx5e_open_locked(priv->ifp);
+ break;
+
+ default:
+ break;
}
- if (was_opened)
- mlx5e_open_locked(priv->ifp);
done:
PRIV_UNLOCK(priv);
return (error);
@@ -475,6 +625,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv)
priv->params_ethtool.tx_coalesce_pkts = priv->params.tx_cq_moderation_pkts;
priv->params_ethtool.hw_lro = priv->params.hw_lro_en;
priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en;
+ mlx5e_ethtool_sync_tx_completion_fact(priv);
/* create root node */
node = SYSCTL_ADD_NODE(&priv->sysctl_ctx,
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index a76d32e..d71cbb3 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -850,7 +850,6 @@ mlx5e_open_rq(struct mlx5e_channel *c,
struct mlx5e_rq *rq)
{
int err;
- int i;
err = mlx5e_create_rq(c, param, rq);
if (err)
@@ -866,12 +865,6 @@ mlx5e_open_rq(struct mlx5e_channel *c,
c->rq.enabled = 1;
- /*
- * Test send queues, which will trigger
- * "mlx5e_post_rx_wqes()":
- */
- for (i = 0; i != c->num_tc; i++)
- mlx5e_send_nop(&c->sq[i], 1, true);
return (0);
err_disable_rq:
@@ -1185,24 +1178,89 @@ err_destroy_sq:
}
static void
-mlx5e_close_sq(struct mlx5e_sq *sq)
+mlx5e_sq_send_nops_locked(struct mlx5e_sq *sq, int can_sleep)
+{
+ /* fill up remainder with NOPs */
+ while (sq->cev_counter != 0) {
+ while (!mlx5e_sq_has_room_for(sq, 1)) {
+ if (can_sleep != 0) {
+ mtx_unlock(&sq->lock);
+ msleep(4);
+ mtx_lock(&sq->lock);
+ } else {
+ goto done;
+ }
+ }
+ /* send a single NOP */
+ mlx5e_send_nop(sq, 1);
+ wmb();
+ }
+done:
+ /* Check if we need to write the doorbell */
+ if (likely(sq->doorbell.d64 != 0)) {
+ mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0);
+ sq->doorbell.d64 = 0;
+ }
+ return;
+}
+
+void
+mlx5e_sq_cev_timeout(void *arg)
{
+ struct mlx5e_sq *sq = arg;
- /* ensure hw is notified of all pending wqes */
- if (mlx5e_sq_has_room_for(sq, 1))
- mlx5e_send_nop(sq, 1, true);
+ mtx_assert(&sq->lock, MA_OWNED);
- mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
+ /* check next state */
+ switch (sq->cev_next_state) {
+ case MLX5E_CEV_STATE_SEND_NOPS:
+ /* fill TX ring with NOPs, if any */
+ mlx5e_sq_send_nops_locked(sq, 0);
+
+ /* check if completed */
+ if (sq->cev_counter == 0) {
+ sq->cev_next_state = MLX5E_CEV_STATE_INITIAL;
+ return;
+ }
+ break;
+ default:
+ /* send NOPs on next timeout */
+ sq->cev_next_state = MLX5E_CEV_STATE_SEND_NOPS;
+ break;
+ }
+
+ /* restart timer */
+ callout_reset_curcpu(&sq->cev_callout, hz, mlx5e_sq_cev_timeout, sq);
}
static void
mlx5e_close_sq_wait(struct mlx5e_sq *sq)
{
+
+ mtx_lock(&sq->lock);
+ /* teardown event factor timer, if any */
+ sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS;
+ callout_stop(&sq->cev_callout);
+
+ /* send dummy NOPs in order to flush the transmit ring */
+ mlx5e_sq_send_nops_locked(sq, 1);
+ mtx_unlock(&sq->lock);
+
+ /* make sure it is safe to free the callout */
+ callout_drain(&sq->cev_callout);
+
+ /* error out remaining requests */
+ mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
+
/* wait till SQ is empty */
+ mtx_lock(&sq->lock);
while (sq->cc != sq->pc) {
+ mtx_unlock(&sq->lock);
msleep(4);
sq->cq.mcq.comp(&sq->cq.mcq);
+ mtx_lock(&sq->lock);
}
+ mtx_unlock(&sq->lock);
mlx5e_disable_sq(sq);
mlx5e_destroy_sq(sq);
@@ -1412,24 +1470,13 @@ mlx5e_open_sqs(struct mlx5e_channel *c,
return (0);
err_close_sqs:
- for (tc--; tc >= 0; tc--) {
- mlx5e_close_sq(&c->sq[tc]);
+ for (tc--; tc >= 0; tc--)
mlx5e_close_sq_wait(&c->sq[tc]);
- }
return (err);
}
static void
-mlx5e_close_sqs(struct mlx5e_channel *c)
-{
- int tc;
-
- for (tc = 0; tc < c->num_tc; tc++)
- mlx5e_close_sq(&c->sq[tc]);
-}
-
-static void
mlx5e_close_sqs_wait(struct mlx5e_channel *c)
{
int tc;
@@ -1446,9 +1493,19 @@ mlx5e_chan_mtx_init(struct mlx5e_channel *c)
mtx_init(&c->rq.mtx, "mlx5rx", MTX_NETWORK_LOCK, MTX_DEF);
for (tc = 0; tc < c->num_tc; tc++) {
- mtx_init(&c->sq[tc].lock, "mlx5tx", MTX_NETWORK_LOCK, MTX_DEF);
- mtx_init(&c->sq[tc].comp_lock, "mlx5comp", MTX_NETWORK_LOCK,
+ struct mlx5e_sq *sq = c->sq + tc;
+
+ mtx_init(&sq->lock, "mlx5tx", MTX_NETWORK_LOCK, MTX_DEF);
+ mtx_init(&sq->comp_lock, "mlx5comp", MTX_NETWORK_LOCK,
MTX_DEF);
+
+ callout_init_mtx(&sq->cev_callout, &sq->lock, 0);
+
+ sq->cev_factor = c->priv->params_ethtool.tx_completion_fact;
+
+ /* ensure the TX completion event factor is not zero */
+ if (sq->cev_factor == 0)
+ sq->cev_factor = 1;
}
}
@@ -1529,7 +1586,6 @@ mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
return (0);
err_close_sqs:
- mlx5e_close_sqs(c);
mlx5e_close_sqs_wait(c);
err_close_rx_cq:
@@ -1554,7 +1610,6 @@ mlx5e_close_channel(struct mlx5e_channel *volatile *pp)
if (c == NULL)
return;
mlx5e_close_rq(&c->rq);
- mlx5e_close_sqs(c);
}
static void
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
index 483a7e1..29c8b4b 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
@@ -28,8 +28,20 @@
#include "en.h"
#include <machine/atomic.h>
+static inline bool
+mlx5e_do_send_cqe(struct mlx5e_sq *sq)
+{
+ sq->cev_counter++;
+ /* interleave the CQEs */
+ if (sq->cev_counter >= sq->cev_factor) {
+ sq->cev_counter = 0;
+ return (1);
+ }
+ return (0);
+}
+
void
-mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt, bool notify_hw)
+mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt)
{
u16 pi = sq->pc & sq->wq.sz_m1;
struct mlx5e_tx_wqe *wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi);
@@ -38,14 +50,18 @@ mlx5e_send_nop(struct mlx5e_sq *sq, u32 ds_cnt, bool notify_hw)
wqe->ctrl.opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | MLX5_OPCODE_NOP);
wqe->ctrl.qpn_ds = cpu_to_be32((sq->sqn << 8) | ds_cnt);
- wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
+ if (mlx5e_do_send_cqe(sq))
+ wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
+ else
+ wqe->ctrl.fm_ce_se = 0;
+
+ /* Copy data for doorbell */
+ memcpy(sq->doorbell.d32, &wqe->ctrl, sizeof(sq->doorbell.d32));
sq->mbuf[pi].mbuf = NULL;
sq->mbuf[pi].num_bytes = 0;
sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS);
sq->pc += sq->mbuf[pi].num_wqebbs;
- if (notify_hw)
- mlx5e_tx_notify_hw(sq, wqe, 0);
}
#if (__FreeBSD_version >= 1100000)
@@ -206,7 +222,7 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struct mbuf **mbp)
pi = ((~sq->pc) & sq->wq.sz_m1);
if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
/* Send one multi NOP message instead of many */
- mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS, false);
+ mlx5e_send_nop(sq, (pi + 1) * MLX5_SEND_WQEBB_NUM_DS);
pi = ((~sq->pc) & sq->wq.sz_m1);
if (pi < (MLX5_SEND_WQE_MAX_WQEBBS - 1)) {
m_freem(mb);
@@ -340,7 +356,13 @@ skip_dma:
wqe->ctrl.opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | opcode);
wqe->ctrl.qpn_ds = cpu_to_be32((sq->sqn << 8) | ds_cnt);
- wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
+ if (mlx5e_do_send_cqe(sq))
+ wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
+ else
+ wqe->ctrl.fm_ce_se = 0;
+
+ /* Copy data for doorbell */
+ memcpy(sq->doorbell.d32, &wqe->ctrl, sizeof(sq->doorbell.d32));
/* Store pointer to mbuf */
sq->mbuf[pi].mbuf = mb;
@@ -351,8 +373,6 @@ skip_dma:
if (mb != NULL)
bus_dmamap_sync(sq->dma_tag, sq->mbuf[pi].dma_map, BUS_DMASYNC_PREWRITE);
- mlx5e_tx_notify_hw(sq, wqe, 0);
-
sq->stats.packets++;
return (0);
@@ -374,9 +394,10 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget)
*/
sqcc = sq->cc;
- while (budget--) {
+ while (budget > 0) {
struct mlx5_cqe64 *cqe;
struct mbuf *mb;
+ u16 x;
u16 ci;
cqe = mlx5e_get_cqe(&sq->cq);
@@ -385,24 +406,29 @@ mlx5e_poll_tx_cq(struct mlx5e_sq *sq, int budget)
mlx5_cqwq_pop(&sq->cq.wq);
- ci = sqcc & sq->wq.sz_m1;
- mb = sq->mbuf[ci].mbuf;
- sq->mbuf[ci].mbuf = NULL; /* Safety clear */
+ /* update budget according to the event factor */
+ budget -= sq->cev_factor;
- if (mb == NULL) {
- if (sq->mbuf[ci].num_bytes == 0) {
- /* NOP */
- sq->stats.nop++;
- }
- } else {
- bus_dmamap_sync(sq->dma_tag, sq->mbuf[ci].dma_map,
- BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sq->dma_tag, sq->mbuf[ci].dma_map);
+ for (x = 0; x != sq->cev_factor; x++) {
+ ci = sqcc & sq->wq.sz_m1;
+ mb = sq->mbuf[ci].mbuf;
+ sq->mbuf[ci].mbuf = NULL; /* Safety clear */
- /* Free transmitted mbuf */
- m_freem(mb);
+ if (mb == NULL) {
+ if (sq->mbuf[ci].num_bytes == 0) {
+ /* NOP */
+ sq->stats.nop++;
+ }
+ } else {
+ bus_dmamap_sync(sq->dma_tag, sq->mbuf[ci].dma_map,
+ BUS_DMASYNC_POSTWRITE);
+ bus_dmamap_unload(sq->dma_tag, sq->mbuf[ci].dma_map);
+
+ /* Free transmitted mbuf */
+ m_freem(mb);
+ }
+ sqcc += sq->mbuf[ci].num_wqebbs;
}
- sqcc += sq->mbuf[ci].num_wqebbs;
}
mlx5_cqwq_update_db_record(&sq->cq.wq);
@@ -450,6 +476,23 @@ mlx5e_xmit_locked(struct ifnet *ifp, struct mlx5e_sq *sq, struct mbuf *mb)
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
break;
}
+ /* Check if we need to write the doorbell */
+ if (likely(sq->doorbell.d64 != 0)) {
+ mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0);
+ sq->doorbell.d64 = 0;
+ }
+ /*
+ * Check if we need to start the event timer which flushes the
+ * transmit ring on timeout:
+ */
+ if (unlikely(sq->cev_next_state == MLX5E_CEV_STATE_INITIAL &&
+ sq->cev_factor != 1)) {
+ /* start the timer */
+ mlx5e_sq_cev_timeout(sq);
+ } else {
+ /* don't send NOPs yet */
+ sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS;
+ }
return (err);
}
diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c
index 64c0d07..45c0bbd 100644
--- a/sys/dev/mpr/mpr_sas.c
+++ b/sys/dev/mpr/mpr_sas.c
@@ -2469,11 +2469,20 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm)
case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED:
case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED:
/*
- * Since these are generally external (i.e. hopefully
- * transient transport-related) errors, retry these without
- * decrementing the retry count.
+ * These can sometimes be transient transport-related
+ * errors, and sometimes persistent drive-related errors.
+ * We used to retry these without decrementing the retry
+ * count by returning CAM_REQUEUE_REQ. Unfortunately, if
+ * we hit a persistent drive problem that returns one of
+ * these error codes, we would retry indefinitely. So,
+ * return CAM_REQ_CMP_ERROR so that we decrement the retry
+ * count and avoid infinite retries. We're taking the
+ * potential risk of flagging false failures in the event
+ * of a topology-related error (e.g. a SAS expander problem
+ * causes a command addressed to a drive to fail), but
+ * avoiding getting into an infinite retry loop.
*/
- mprsas_set_ccbstatus(ccb, CAM_REQUEUE_REQ);
+ mprsas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
mprsas_log_command(cm, MPR_INFO,
"terminated ioc %x scsi %x state %x xfer %u\n",
le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 4fbdbb2..f3ea8d3 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -2408,11 +2408,20 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm)
case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED:
case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED:
/*
- * Since these are generally external (i.e. hopefully
- * transient transport-related) errors, retry these without
- * decrementing the retry count.
+ * These can sometimes be transient transport-related
+ * errors, and sometimes persistent drive-related errors.
+ * We used to retry these without decrementing the retry
+ * count by returning CAM_REQUEUE_REQ. Unfortunately, if
+ * we hit a persistent drive problem that returns one of
+ * these error codes, we would retry indefinitely. So,
+ * return CAM_REQ_CMP_ERROR so that we decrement the retry
+ * count and avoid infinite retries. We're taking the
+ * potential risk of flagging false failures in the event
+ * of a topology-related error (e.g. a SAS expander problem
+ * causes a command addressed to a drive to fail), but
+ * avoiding getting into an infinite retry loop.
*/
- mpssas_set_ccbstatus(ccb, CAM_REQUEUE_REQ);
+ mpssas_set_ccbstatus(ccb, CAM_REQ_CMP_ERR);
mpssas_log_command(cm, MPS_INFO,
"terminated ioc %x scsi %x state %x xfer %u\n",
le16toh(rep->IOCStatus), rep->SCSIStatus, rep->SCSIState,
diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c
index 6fa4639..0db859a 100644
--- a/sys/dev/mrsas/mrsas.c
+++ b/sys/dev/mrsas/mrsas.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/types.h>
+#include <sys/sysent.h>
#include <sys/kthread.h>
#include <sys/taskqueue.h>
#include <sys/smp.h>
@@ -63,6 +64,7 @@ static d_write_t mrsas_write;
static d_ioctl_t mrsas_ioctl;
static d_poll_t mrsas_poll;
+static void mrsas_ich_startup(void *arg);
static struct mrsas_mgmt_info mrsas_mgmt_info;
static struct mrsas_ident *mrsas_find_ident(device_t);
static int mrsas_setup_msix(struct mrsas_softc *sc);
@@ -80,7 +82,8 @@ static int mrsas_setup_irq(struct mrsas_softc *sc);
static int mrsas_alloc_mem(struct mrsas_softc *sc);
static int mrsas_init_fw(struct mrsas_softc *sc);
static int mrsas_setup_raidmap(struct mrsas_softc *sc);
-static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
+static void megasas_setup_jbod_map(struct mrsas_softc *sc);
+static int megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend);
static int mrsas_clear_intr(struct mrsas_softc *sc);
static int mrsas_get_ctrl_info(struct mrsas_softc *sc);
static void mrsas_update_ext_vd_details(struct mrsas_softc *sc);
@@ -104,8 +107,9 @@ int mrsas_ioc_init(struct mrsas_softc *sc);
int mrsas_bus_scan(struct mrsas_softc *sc);
int mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
int mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd);
-int mrsas_reset_ctrl(struct mrsas_softc *sc);
-int mrsas_wait_for_outstanding(struct mrsas_softc *sc);
+int mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason);
+int mrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t check_reason);
+int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
int
mrsas_issue_blocked_cmd(struct mrsas_softc *sc,
struct mrsas_mfi_cmd *cmd);
@@ -182,6 +186,10 @@ MRSAS_CTLR_ID device_table[] = {
{0x1000, MRSAS_TBOLT, 0xffff, 0xffff, "AVAGO Thunderbolt SAS Controller"},
{0x1000, MRSAS_INVADER, 0xffff, 0xffff, "AVAGO Invader SAS Controller"},
{0x1000, MRSAS_FURY, 0xffff, 0xffff, "AVAGO Fury SAS Controller"},
+ {0x1000, MRSAS_INTRUDER, 0xffff, 0xffff, "AVAGO Intruder SAS Controller"},
+ {0x1000, MRSAS_INTRUDER_24, 0xffff, 0xffff, "AVAGO Intruder_24 SAS Controller"},
+ {0x1000, MRSAS_CUTLASS_52, 0xffff, 0xffff, "AVAGO Cutlass_52 SAS Controller"},
+ {0x1000, MRSAS_CUTLASS_53, 0xffff, 0xffff, "AVAGO Cutlass_53 SAS Controller"},
{0, 0, 0, 0, NULL}
};
@@ -553,6 +561,7 @@ mrsas_get_seq_num(struct mrsas_softc *sc,
{
struct mrsas_mfi_cmd *cmd;
struct mrsas_dcmd_frame *dcmd;
+ u_int8_t do_ocr = 1, retcode = 0;
cmd = mrsas_get_mfi_cmd(sc);
@@ -580,16 +589,24 @@ mrsas_get_seq_num(struct mrsas_softc *sc,
dcmd->sgl.sge32[0].phys_addr = sc->el_info_phys_addr;
dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_log_info);
- mrsas_issue_blocked_cmd(sc, cmd);
+ retcode = mrsas_issue_blocked_cmd(sc, cmd);
+ if (retcode == ETIMEDOUT)
+ goto dcmd_timeout;
+ do_ocr = 0;
/*
* Copy the data back into callers buffer
*/
memcpy(eli, sc->el_info_mem, sizeof(struct mrsas_evt_log_info));
mrsas_free_evt_log_info_cmd(sc);
- mrsas_release_mfi_cmd(cmd);
- return 0;
+dcmd_timeout:
+ if (do_ocr)
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ else
+ mrsas_release_mfi_cmd(cmd);
+
+ return retcode;
}
@@ -812,6 +829,8 @@ mrsas_attach(device_t dev)
struct mrsas_softc *sc = device_get_softc(dev);
uint32_t cmd, bar, error;
+ memset(sc, 0, sizeof(struct mrsas_softc));
+
/* Look up our softc and initialize its fields. */
sc->mrsas_dev = dev;
sc->device_id = pci_get_device(dev);
@@ -851,12 +870,6 @@ mrsas_attach(device_t dev)
mtx_init(&sc->mfi_cmd_pool_lock, "mrsas_mfi_cmd_pool_lock", NULL, MTX_DEF);
mtx_init(&sc->raidmap_lock, "mrsas_raidmap_lock", NULL, MTX_DEF);
- /*
- * Intialize a counting Semaphore to take care no. of concurrent
- * IOCTLs
- */
- sema_init(&sc->ioctl_count_sema, MRSAS_MAX_MFI_CMDS - 5, IOCTL_SEMA_DESCRIPTION);
-
/* Intialize linked list */
TAILQ_INIT(&sc->mrsas_mpt_cmd_list_head);
TAILQ_INIT(&sc->mrsas_mfi_cmd_list_head);
@@ -865,15 +878,6 @@ mrsas_attach(device_t dev)
sc->io_cmds_highwater = 0;
- /* Create a /dev entry for this device. */
- sc->mrsas_cdev = make_dev(&mrsas_cdevsw, device_get_unit(dev), UID_ROOT,
- GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u",
- device_get_unit(dev));
- if (device_get_unit(dev) == 0)
- make_dev_alias(sc->mrsas_cdev, "megaraid_sas_ioctl_node");
- if (sc->mrsas_cdev)
- sc->mrsas_cdev->si_drv1 = sc;
-
sc->adprecovery = MRSAS_HBA_OPERATIONAL;
sc->UnevenSpanSupport = 0;
@@ -883,7 +887,7 @@ mrsas_attach(device_t dev)
if (mrsas_init_fw(sc) != SUCCESS) {
goto attach_fail_fw;
}
- /* Register SCSI mid-layer */
+ /* Register mrsas to CAM layer */
if ((mrsas_cam_attach(sc) != SUCCESS)) {
goto attach_fail_cam;
}
@@ -891,38 +895,28 @@ mrsas_attach(device_t dev)
if (mrsas_setup_irq(sc) != SUCCESS) {
goto attach_fail_irq;
}
- /* Enable Interrupts */
- mrsas_enable_intr(sc);
-
error = mrsas_kproc_create(mrsas_ocr_thread, sc,
&sc->ocr_thread, 0, 0, "mrsas_ocr%d",
device_get_unit(sc->mrsas_dev));
if (error) {
- printf("Error %d starting rescan thread\n", error);
- goto attach_fail_irq;
- }
- mrsas_setup_sysctl(sc);
-
- /* Initiate AEN (Asynchronous Event Notification) */
-
- if (mrsas_start_aen(sc)) {
- printf("Error: start aen failed\n");
- goto fail_start_aen;
+ device_printf(sc->mrsas_dev, "Error %d starting OCR thread\n", error);
+ goto attach_fail_ocr_thread;
}
/*
- * Add this controller to mrsas_mgmt_info structure so that it can be
- * exported to management applications
+ * After FW initialization and OCR thread creation
+ * we will defer the cdev creation, AEN setup on ICH callback
*/
- if (device_get_unit(dev) == 0)
- memset(&mrsas_mgmt_info, 0, sizeof(mrsas_mgmt_info));
-
- mrsas_mgmt_info.count++;
- mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc;
- mrsas_mgmt_info.max_index++;
-
- return (0);
+ sc->mrsas_ich.ich_func = mrsas_ich_startup;
+ sc->mrsas_ich.ich_arg = sc;
+ if (config_intrhook_establish(&sc->mrsas_ich) != 0) {
+ device_printf(sc->mrsas_dev, "Config hook is already established\n");
+ }
+ mrsas_setup_sysctl(sc);
+ return SUCCESS;
-fail_start_aen:
+attach_fail_ocr_thread:
+ if (sc->ocr_thread_active)
+ wakeup(&sc->ocr_chan);
attach_fail_irq:
mrsas_teardown_intr(sc);
attach_fail_cam:
@@ -940,10 +934,7 @@ attach_fail_fw:
mtx_destroy(&sc->mpt_cmd_pool_lock);
mtx_destroy(&sc->mfi_cmd_pool_lock);
mtx_destroy(&sc->raidmap_lock);
- /* Destroy the counting semaphore created for Ioctl */
- sema_destroy(&sc->ioctl_count_sema);
attach_fail:
- destroy_dev(sc->mrsas_cdev);
if (sc->reg_res) {
bus_release_resource(sc->mrsas_dev, SYS_RES_MEMORY,
sc->reg_res_id, sc->reg_res);
@@ -952,6 +943,63 @@ attach_fail:
}
/*
+ * Interrupt config hook
+ */
+static void
+mrsas_ich_startup(void *arg)
+{
+ struct mrsas_softc *sc = (struct mrsas_softc *)arg;
+
+ /*
+ * Intialize a counting Semaphore to take care no. of concurrent IOCTLs
+ */
+ sema_init(&sc->ioctl_count_sema,
+ MRSAS_MAX_MFI_CMDS - 5,
+ IOCTL_SEMA_DESCRIPTION);
+
+ /* Create a /dev entry for mrsas controller. */
+ sc->mrsas_cdev = make_dev(&mrsas_cdevsw, device_get_unit(sc->mrsas_dev), UID_ROOT,
+ GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u",
+ device_get_unit(sc->mrsas_dev));
+
+ if (device_get_unit(sc->mrsas_dev) == 0) {
+ make_dev_alias_p(MAKEDEV_CHECKNAME,
+ &sc->mrsas_linux_emulator_cdev, sc->mrsas_cdev,
+ "megaraid_sas_ioctl_node");
+ }
+ if (sc->mrsas_cdev)
+ sc->mrsas_cdev->si_drv1 = sc;
+
+ /*
+ * Add this controller to mrsas_mgmt_info structure so that it can be
+ * exported to management applications
+ */
+ if (device_get_unit(sc->mrsas_dev) == 0)
+ memset(&mrsas_mgmt_info, 0, sizeof(mrsas_mgmt_info));
+
+ mrsas_mgmt_info.count++;
+ mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc;
+ mrsas_mgmt_info.max_index++;
+
+ /* Enable Interrupts */
+ mrsas_enable_intr(sc);
+
+ /* Initiate AEN (Asynchronous Event Notification) */
+ if (mrsas_start_aen(sc)) {
+ device_printf(sc->mrsas_dev, "Error: AEN registration FAILED !!! "
+ "Further events from the controller will not be communicated.\n"
+ "Either there is some problem in the controller"
+ "or the controller does not support AEN.\n"
+ "Please contact to the SUPPORT TEAM if the problem persists\n");
+ }
+ if (sc->mrsas_ich.ich_arg != NULL) {
+ device_printf(sc->mrsas_dev, "Disestablish mrsas intr hook\n");
+ config_intrhook_disestablish(&sc->mrsas_ich);
+ sc->mrsas_ich.ich_arg = NULL;
+ }
+}
+
+/*
* mrsas_detach: De-allocates and teardown resources
* input: pointer to device struct
*
@@ -969,6 +1017,8 @@ mrsas_detach(device_t dev)
sc->remove_in_progress = 1;
/* Destroy the character device so no other IOCTL will be handled */
+ if ((device_get_unit(dev) == 0) && sc->mrsas_linux_emulator_cdev)
+ destroy_dev(sc->mrsas_linux_emulator_cdev);
destroy_dev(sc->mrsas_cdev);
/*
@@ -989,7 +1039,7 @@ mrsas_detach(device_t dev)
i++;
if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) {
mrsas_dprint(sc, MRSAS_INFO,
- "[%2d]waiting for ocr to be finished\n", i);
+ "[%2d]waiting for OCR to be finished from %s\n", i, __func__);
}
pause("mr_shutdown", hz);
}
@@ -1065,7 +1115,14 @@ mrsas_free_mem(struct mrsas_softc *sc)
if (sc->ld_drv_map[i] != NULL)
free(sc->ld_drv_map[i], M_MRSAS);
}
-
+ for (i = 0; i < 2; i++) {
+ if (sc->jbodmap_phys_addr[i])
+ bus_dmamap_unload(sc->jbodmap_tag[i], sc->jbodmap_dmamap[i]);
+ if (sc->jbodmap_mem[i] != NULL)
+ bus_dmamem_free(sc->jbodmap_tag[i], sc->jbodmap_mem[i], sc->jbodmap_dmamap[i]);
+ if (sc->jbodmap_tag[i] != NULL)
+ bus_dma_tag_destroy(sc->jbodmap_tag[i]);
+ }
/*
* Free version buffer memroy
*/
@@ -1227,9 +1284,7 @@ mrsas_teardown_intr(struct mrsas_softc *sc)
static int
mrsas_suspend(device_t dev)
{
- struct mrsas_softc *sc;
-
- sc = device_get_softc(dev);
+ /* This will be filled when the driver will have hibernation support */
return (0);
}
@@ -1242,9 +1297,7 @@ mrsas_suspend(device_t dev)
static int
mrsas_resume(device_t dev)
{
- struct mrsas_softc *sc;
-
- sc = device_get_softc(dev);
+ /* This will be filled when the driver will have hibernation support */
return (0);
}
@@ -1315,9 +1368,7 @@ mrsas_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td)
i++;
if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) {
mrsas_dprint(sc, MRSAS_INFO,
- "[%2d]waiting for "
- "OCR to be finished %d\n", i,
- sc->ocr_thread_active);
+ "[%2d]waiting for OCR to be finished from %s\n", i, __func__);
}
pause("mr_ioctl", hz);
}
@@ -1481,7 +1532,7 @@ mrsas_isr(void *arg)
* perform the appropriate action. Before we return, we clear the response
* interrupt.
*/
-static int
+int
mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex)
{
Mpi2ReplyDescriptorsUnion_t *desc;
@@ -1578,7 +1629,11 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex)
if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) {
if (sc->msix_enable) {
if ((sc->device_id == MRSAS_INVADER) ||
- (sc->device_id == MRSAS_FURY))
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53))
mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8],
((MSIxIndex & 0x7) << 24) |
sc->last_reply_idx[MSIxIndex]);
@@ -1600,7 +1655,11 @@ mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex)
/* Clear response interrupt */
if (sc->msix_enable) {
if ((sc->device_id == MRSAS_INVADER) ||
- (sc->device_id == MRSAS_FURY)) {
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8],
((MSIxIndex & 0x7) << 24) |
sc->last_reply_idx[MSIxIndex]);
@@ -1684,9 +1743,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc)
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
- MRSAS_MAX_IO_SIZE, /* maxsize */
- MRSAS_MAX_SGL, /* nsegments */
- MRSAS_MAX_IO_SIZE, /* maxsegsize */
+ MAXPHYS, /* maxsize */
+ sc->max_num_sge, /* nsegments */
+ MAXPHYS, /* maxsegsize */
0, /* flags */
NULL, NULL, /* lockfunc, lockarg */
&sc->mrsas_parent_tag /* tag */
@@ -1883,9 +1942,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc)
BUS_SPACE_MAXADDR,
BUS_SPACE_MAXADDR,
NULL, NULL,
- MRSAS_MAX_IO_SIZE,
- MRSAS_MAX_SGL,
- MRSAS_MAX_IO_SIZE,
+ MAXPHYS,
+ sc->max_num_sge, /* nsegments */
+ MAXPHYS,
BUS_DMA_ALLOCNOW,
busdma_lock_mutex,
&sc->io_lock,
@@ -1987,6 +2046,78 @@ ABORT:
return (1);
}
+/**
+ * megasas_setup_jbod_map - setup jbod map for FP seq_number.
+ * @sc: Adapter soft state
+ *
+ * Return 0 on success.
+ */
+void
+megasas_setup_jbod_map(struct mrsas_softc *sc)
+{
+ int i;
+ uint32_t pd_seq_map_sz;
+
+ pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+ (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1));
+
+ if (!sc->ctrl_info->adapterOperations3.useSeqNumJbodFP) {
+ sc->use_seqnum_jbod_fp = 0;
+ return;
+ }
+ if (sc->jbodmap_mem[0])
+ goto skip_alloc;
+
+ for (i = 0; i < 2; i++) {
+ if (bus_dma_tag_create(sc->mrsas_parent_tag,
+ 4, 0,
+ BUS_SPACE_MAXADDR_32BIT,
+ BUS_SPACE_MAXADDR,
+ NULL, NULL,
+ pd_seq_map_sz,
+ 1,
+ pd_seq_map_sz,
+ BUS_DMA_ALLOCNOW,
+ NULL, NULL,
+ &sc->jbodmap_tag[i])) {
+ device_printf(sc->mrsas_dev,
+ "Cannot allocate jbod map tag.\n");
+ return;
+ }
+ if (bus_dmamem_alloc(sc->jbodmap_tag[i],
+ (void **)&sc->jbodmap_mem[i],
+ BUS_DMA_NOWAIT, &sc->jbodmap_dmamap[i])) {
+ device_printf(sc->mrsas_dev,
+ "Cannot allocate jbod map memory.\n");
+ return;
+ }
+ bzero(sc->jbodmap_mem[i], pd_seq_map_sz);
+
+ if (bus_dmamap_load(sc->jbodmap_tag[i], sc->jbodmap_dmamap[i],
+ sc->jbodmap_mem[i], pd_seq_map_sz,
+ mrsas_addr_cb, &sc->jbodmap_phys_addr[i],
+ BUS_DMA_NOWAIT)) {
+ device_printf(sc->mrsas_dev, "Cannot load jbod map memory.\n");
+ return;
+ }
+ if (!sc->jbodmap_mem[i]) {
+ device_printf(sc->mrsas_dev,
+ "Cannot allocate memory for jbod map.\n");
+ sc->use_seqnum_jbod_fp = 0;
+ return;
+ }
+ }
+
+skip_alloc:
+ if (!megasas_sync_pd_seq_num(sc, false) &&
+ !megasas_sync_pd_seq_num(sc, true))
+ sc->use_seqnum_jbod_fp = 1;
+ else
+ sc->use_seqnum_jbod_fp = 0;
+
+ device_printf(sc->mrsas_dev, "Jbod map is supported\n");
+}
+
/*
* mrsas_init_fw: Initialize Firmware
* input: Adapter soft state
@@ -2086,18 +2217,28 @@ mrsas_init_fw(struct mrsas_softc *sc)
if (sc->secure_jbod_support)
device_printf(sc->mrsas_dev, "FW supports SED \n");
+ if (sc->use_seqnum_jbod_fp)
+ device_printf(sc->mrsas_dev, "FW supports JBOD Map \n");
+
if (mrsas_setup_raidmap(sc) != SUCCESS) {
- device_printf(sc->mrsas_dev, "Set up RAID map failed.\n");
- return (1);
+ device_printf(sc->mrsas_dev, "Error: RAID map setup FAILED !!! "
+ "There seems to be some problem in the controller\n"
+ "Please contact to the SUPPORT TEAM if the problem persists\n");
}
+ megasas_setup_jbod_map(sc);
+
/* For pass-thru, get PD/LD list and controller info */
memset(sc->pd_list, 0,
MRSAS_MAX_PD * sizeof(struct mrsas_pd_list));
- mrsas_get_pd_list(sc);
-
+ if (mrsas_get_pd_list(sc) != SUCCESS) {
+ device_printf(sc->mrsas_dev, "Get PD list failed.\n");
+ return (1);
+ }
memset(sc->ld_ids, 0xff, MRSAS_MAX_LD_IDS);
- mrsas_get_ld_list(sc);
-
+ if (mrsas_get_ld_list(sc) != SUCCESS) {
+ device_printf(sc->mrsas_dev, "Get LD lsit failed.\n");
+ return (1);
+ }
/*
* Compute the max allowed sectors per IO: The controller info has
* two limits on max sectors. Driver should use the minimum of these
@@ -2147,7 +2288,7 @@ int
mrsas_init_adapter(struct mrsas_softc *sc)
{
uint32_t status;
- u_int32_t max_cmd;
+ u_int32_t max_cmd, scratch_pad_2;
int ret;
int i = 0;
@@ -2166,13 +2307,33 @@ mrsas_init_adapter(struct mrsas_softc *sc)
sc->request_alloc_sz = sizeof(MRSAS_REQUEST_DESCRIPTOR_UNION) * max_cmd;
sc->reply_alloc_sz = sizeof(MPI2_REPLY_DESCRIPTORS_UNION) * (sc->reply_q_depth);
sc->io_frames_alloc_sz = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE + (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * (max_cmd + 1));
- sc->chain_frames_alloc_sz = 1024 * max_cmd;
+ scratch_pad_2 = mrsas_read_reg(sc, offsetof(mrsas_reg_set,
+ outbound_scratch_pad_2));
+ /*
+ * If scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK is set,
+ * Firmware support extended IO chain frame which is 4 time more
+ * than legacy Firmware. Legacy Firmware - Frame size is (8 * 128) =
+ * 1K 1M IO Firmware - Frame size is (8 * 128 * 4) = 4K
+ */
+ if (scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK)
+ sc->max_chain_frame_sz =
+ ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5)
+ * MEGASAS_1MB_IO;
+ else
+ sc->max_chain_frame_sz =
+ ((scratch_pad_2 & MEGASAS_MAX_CHAIN_SIZE_MASK) >> 5)
+ * MEGASAS_256K_IO;
+
+ sc->chain_frames_alloc_sz = sc->max_chain_frame_sz * max_cmd;
sc->max_sge_in_main_msg = (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE -
offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL)) / 16;
- sc->max_sge_in_chain = MRSAS_MAX_SZ_CHAIN_FRAME / sizeof(MPI2_SGE_IO_UNION);
+ sc->max_sge_in_chain = sc->max_chain_frame_sz / sizeof(MPI2_SGE_IO_UNION);
sc->max_num_sge = sc->max_sge_in_main_msg + sc->max_sge_in_chain - 2;
+ mrsas_dprint(sc, MRSAS_INFO, "Avago Debug: MAX sge 0x%X MAX chain frame size 0x%X \n",
+ sc->max_num_sge, sc->max_chain_frame_sz);
+
/* Used for pass thru MFI frame (DCMD) */
sc->chain_offset_mfi_pthru = offsetof(MRSAS_RAID_SCSI_IO_REQUEST, SGL) / 16;
@@ -2297,7 +2458,11 @@ mrsas_ioc_init(struct mrsas_softc *sc)
/* driver support Extended MSIX */
if ((sc->device_id == MRSAS_INVADER) ||
- (sc->device_id == MRSAS_FURY)) {
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
init_frame->driver_operations.
mfi_capabilities.support_additional_msix = 1;
}
@@ -2310,6 +2475,8 @@ mrsas_ioc_init(struct mrsas_softc *sc)
init_frame->driver_operations.mfi_capabilities.support_ndrive_r1_lb = 1;
init_frame->driver_operations.mfi_capabilities.support_max_255lds = 1;
init_frame->driver_operations.mfi_capabilities.security_protocol_cmds_fw = 1;
+ if (sc->max_chain_frame_sz > MEGASAS_CHAIN_FRAME_SZ_MIN)
+ init_frame->driver_operations.mfi_capabilities.support_ext_io_size = 1;
phys_addr = (bus_addr_t)sc->ioc_init_phys_mem + 1024;
init_frame->queue_info_new_phys_addr_lo = phys_addr;
init_frame->data_xfer_len = sizeof(Mpi2IOCInitRequest_t);
@@ -2412,7 +2579,7 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc *sc)
for (i = 0; i < max_cmd; i++) {
cmd = sc->mpt_cmd_list[i];
offset = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * i;
- chain_offset = 1024 * i;
+ chain_offset = sc->max_chain_frame_sz * i;
sense_offset = MRSAS_SENSE_LEN * i;
memset(cmd, 0, sizeof(struct mrsas_mpt_cmd));
cmd->index = i + 1;
@@ -2623,16 +2790,20 @@ mrsas_ocr_thread(void *arg)
/* Sleep for 1 second and check the queue status */
msleep(&sc->ocr_chan, &sc->sim_lock, PRIBIO,
"mrsas_ocr", sc->mrsas_fw_fault_check_delay * hz);
- if (sc->remove_in_progress) {
+ if (sc->remove_in_progress ||
+ sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) {
mrsas_dprint(sc, MRSAS_OCR,
- "Exit due to shutdown from %s\n", __func__);
+ "Exit due to %s from %s\n",
+ sc->remove_in_progress ? "Shutdown" :
+ "Hardware critical error", __func__);
break;
}
fw_status = mrsas_read_reg(sc,
offsetof(mrsas_reg_set, outbound_scratch_pad));
fw_state = fw_status & MFI_STATE_MASK;
if (fw_state == MFI_STATE_FAULT || sc->do_timedout_reset) {
- device_printf(sc->mrsas_dev, "OCR started due to %s!\n",
+ device_printf(sc->mrsas_dev, "%s started due to %s!\n",
+ sc->disableOnlineCtrlReset ? "Kill Adapter" : "OCR",
sc->do_timedout_reset ? "IO Timeout" :
"FW fault detected");
mtx_lock_spin(&sc->ioctl_lock);
@@ -2640,7 +2811,7 @@ mrsas_ocr_thread(void *arg)
sc->reset_count++;
mtx_unlock_spin(&sc->ioctl_lock);
mrsas_xpt_freeze(sc);
- mrsas_reset_ctrl(sc);
+ mrsas_reset_ctrl(sc, sc->do_timedout_reset);
mrsas_xpt_release(sc);
sc->reset_in_progress = 0;
sc->do_timedout_reset = 0;
@@ -2687,14 +2858,14 @@ mrsas_reset_reply_desc(struct mrsas_softc *sc)
* OCR, Re-fire Managment command and move Controller to Operation state.
*/
int
-mrsas_reset_ctrl(struct mrsas_softc *sc)
+mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason)
{
int retval = SUCCESS, i, j, retry = 0;
u_int32_t host_diag, abs_state, status_reg, reset_adapter;
union ccb *ccb;
struct mrsas_mfi_cmd *mfi_cmd;
struct mrsas_mpt_cmd *mpt_cmd;
- MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc;
+ union mrsas_evt_class_locale class_locale;
if (sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) {
device_printf(sc->mrsas_dev,
@@ -2704,14 +2875,16 @@ mrsas_reset_ctrl(struct mrsas_softc *sc)
mrsas_set_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags);
sc->adprecovery = MRSAS_ADPRESET_SM_INFAULT;
mrsas_disable_intr(sc);
- DELAY(1000 * 1000);
+ msleep(&sc->ocr_chan, &sc->sim_lock, PRIBIO, "mrsas_ocr",
+ sc->mrsas_fw_fault_check_delay * hz);
/* First try waiting for commands to complete */
- if (mrsas_wait_for_outstanding(sc)) {
+ if (mrsas_wait_for_outstanding(sc, reset_reason)) {
mrsas_dprint(sc, MRSAS_OCR,
"resetting adapter from %s.\n",
__func__);
/* Now return commands back to the CAM layer */
+ mtx_unlock(&sc->sim_lock);
for (i = 0; i < sc->max_fw_cmds; i++) {
mpt_cmd = sc->mpt_cmd_list[i];
if (mpt_cmd->ccb_ptr) {
@@ -2721,6 +2894,7 @@ mrsas_reset_ctrl(struct mrsas_softc *sc)
mrsas_atomic_dec(&sc->fw_outstanding);
}
}
+ mtx_lock(&sc->sim_lock);
status_reg = mrsas_read_reg(sc, offsetof(mrsas_reg_set,
outbound_scratch_pad));
@@ -2815,31 +2989,17 @@ mrsas_reset_ctrl(struct mrsas_softc *sc)
mrsas_dprint(sc, MRSAS_OCR, "mrsas_ioc_init() failed!\n");
continue;
}
- /* Re-fire management commands */
for (j = 0; j < sc->max_fw_cmds; j++) {
mpt_cmd = sc->mpt_cmd_list[j];
if (mpt_cmd->sync_cmd_idx != (u_int32_t)MRSAS_ULONG_MAX) {
mfi_cmd = sc->mfi_cmd_list[mpt_cmd->sync_cmd_idx];
- if (mfi_cmd->frame->dcmd.opcode ==
- MR_DCMD_LD_MAP_GET_INFO) {
- mrsas_release_mfi_cmd(mfi_cmd);
- mrsas_release_mpt_cmd(mpt_cmd);
- } else {
- req_desc = mrsas_get_request_desc(sc,
- mfi_cmd->cmd_id.context.smid - 1);
- mrsas_dprint(sc, MRSAS_OCR,
- "Re-fire command DCMD opcode 0x%x index %d\n ",
- mfi_cmd->frame->dcmd.opcode, j);
- if (!req_desc)
- device_printf(sc->mrsas_dev,
- "Cannot build MPT cmd.\n");
- else
- mrsas_fire_cmd(sc, req_desc->addr.u.low,
- req_desc->addr.u.high);
- }
+ mrsas_release_mfi_cmd(mfi_cmd);
+ mrsas_release_mpt_cmd(mpt_cmd);
}
}
+ sc->aen_cmd = NULL;
+
/* Reset load balance info */
memset(sc->load_balance_info, 0,
sizeof(LD_LOAD_BALANCE_INFO) * MAX_LOGICAL_DRIVES_EXT);
@@ -2852,10 +3012,37 @@ mrsas_reset_ctrl(struct mrsas_softc *sc)
if (!mrsas_get_map_info(sc))
mrsas_sync_map_info(sc);
+ megasas_setup_jbod_map(sc);
+
+ memset(sc->pd_list, 0,
+ MRSAS_MAX_PD * sizeof(struct mrsas_pd_list));
+ if (mrsas_get_pd_list(sc) != SUCCESS) {
+ device_printf(sc->mrsas_dev, "Get PD list failed from OCR.\n"
+ "Will get the latest PD LIST after OCR on event.\n");
+ }
+ memset(sc->ld_ids, 0xff, MRSAS_MAX_LD_IDS);
+ if (mrsas_get_ld_list(sc) != SUCCESS) {
+ device_printf(sc->mrsas_dev, "Get LD lsit failed from OCR.\n"
+ "Will get the latest LD LIST after OCR on event.\n");
+ }
mrsas_clear_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags);
mrsas_enable_intr(sc);
sc->adprecovery = MRSAS_HBA_OPERATIONAL;
+ /* Register AEN with FW for last sequence number */
+ class_locale.members.reserved = 0;
+ class_locale.members.locale = MR_EVT_LOCALE_ALL;
+ class_locale.members.class = MR_EVT_CLASS_DEBUG;
+
+ if (mrsas_register_aen(sc, sc->last_seq_num,
+ class_locale.word)) {
+ device_printf(sc->mrsas_dev,
+ "ERROR: AEN registration FAILED from OCR !!! "
+ "Further events from the controller cannot be notified."
+ "Either there is some problem in the controller"
+ "or the controller does not support AEN.\n"
+ "Please contact to the SUPPORT TEAM if the problem persists\n");
+ }
/* Adapter reset completed successfully */
device_printf(sc->mrsas_dev, "Reset successful\n");
retval = SUCCESS;
@@ -2887,7 +3074,7 @@ void
mrsas_kill_hba(struct mrsas_softc *sc)
{
sc->adprecovery = MRSAS_HW_CRITICAL_ERROR;
- pause("mrsas_kill_hba", 1000);
+ DELAY(1000 * 1000);
mrsas_dprint(sc, MRSAS_OCR, "%s\n", __func__);
mrsas_write_reg(sc, offsetof(mrsas_reg_set, doorbell),
MFI_STOP_ADP);
@@ -2933,7 +3120,7 @@ mrsas_complete_outstanding_ioctls(struct mrsas_softc *sc)
* completed.
*/
int
-mrsas_wait_for_outstanding(struct mrsas_softc *sc)
+mrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t check_reason)
{
int i, outstanding, retval = 0;
u_int32_t fw_state, count, MSIxIndex;
@@ -2955,6 +3142,12 @@ mrsas_wait_for_outstanding(struct mrsas_softc *sc)
retval = 1;
goto out;
}
+ if (check_reason == MFI_DCMD_TIMEOUT_OCR) {
+ mrsas_dprint(sc, MRSAS_OCR,
+ "DCMD IO TIMEOUT detected, will reset adapter.\n");
+ retval = 1;
+ goto out;
+ }
outstanding = mrsas_atomic_read(&sc->fw_outstanding);
if (!outstanding)
goto out;
@@ -3012,6 +3205,7 @@ static int
mrsas_get_ctrl_info(struct mrsas_softc *sc)
{
int retcode = 0;
+ u_int8_t do_ocr = 1;
struct mrsas_mfi_cmd *cmd;
struct mrsas_dcmd_frame *dcmd;
@@ -3041,15 +3235,26 @@ mrsas_get_ctrl_info(struct mrsas_softc *sc)
dcmd->sgl.sge32[0].phys_addr = sc->ctlr_info_phys_addr;
dcmd->sgl.sge32[0].length = sizeof(struct mrsas_ctrl_info);
- if (!mrsas_issue_polled(sc, cmd))
- memcpy(sc->ctrl_info, sc->ctlr_info_mem, sizeof(struct mrsas_ctrl_info));
+ retcode = mrsas_issue_polled(sc, cmd);
+ if (retcode == ETIMEDOUT)
+ goto dcmd_timeout;
else
- retcode = 1;
+ memcpy(sc->ctrl_info, sc->ctlr_info_mem, sizeof(struct mrsas_ctrl_info));
+ do_ocr = 0;
mrsas_update_ext_vd_details(sc);
+ sc->use_seqnum_jbod_fp =
+ sc->ctrl_info->adapterOperations3.useSeqNumJbodFP;
+
+dcmd_timeout:
mrsas_free_ctlr_info_cmd(sc);
- mrsas_release_mfi_cmd(cmd);
+
+ if (do_ocr)
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ else
+ mrsas_release_mfi_cmd(cmd);
+
return (retcode);
}
@@ -3168,7 +3373,7 @@ mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
{
struct mrsas_header *frame_hdr = &cmd->frame->hdr;
u_int8_t max_wait = MRSAS_INTERNAL_CMD_WAIT_TIME;
- int i, retcode = 0;
+ int i, retcode = SUCCESS;
frame_hdr->cmd_status = 0xFF;
frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
@@ -3191,12 +3396,12 @@ mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
break;
}
}
- if (frame_hdr->cmd_status != 0) {
- if (frame_hdr->cmd_status == 0xFF)
- device_printf(sc->mrsas_dev, "DCMD timed out after %d seconds.\n", max_wait);
- else
- device_printf(sc->mrsas_dev, "DCMD failed, status = 0x%x\n", frame_hdr->cmd_status);
- retcode = 1;
+ if (frame_hdr->cmd_status == 0xFF) {
+ device_printf(sc->mrsas_dev, "DCMD timed out after %d "
+ "seconds from %s\n", max_wait, __func__);
+ device_printf(sc->mrsas_dev, "DCMD opcode 0x%X\n",
+ cmd->frame->dcmd.opcode);
+ retcode = ETIMEDOUT;
}
return (retcode);
}
@@ -3290,7 +3495,12 @@ mrsas_build_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *mfi_cm
io_req = mpt_cmd->io_request;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
pMpi25IeeeSgeChain64_t sgl_ptr_end = (pMpi25IeeeSgeChain64_t)&io_req->SGL;
sgl_ptr_end += sc->max_sge_in_main_msg - 1;
@@ -3307,7 +3517,7 @@ mrsas_build_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *mfi_cm
mpi25_ieee_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT |
MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR;
- mpi25_ieee_chain->Length = MRSAS_MAX_SZ_CHAIN_FRAME;
+ mpi25_ieee_chain->Length = sc->max_chain_frame_sz;
return (0);
}
@@ -3325,10 +3535,10 @@ mrsas_issue_blocked_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
{
u_int8_t max_wait = MRSAS_INTERNAL_CMD_WAIT_TIME;
unsigned long total_time = 0;
- int retcode = 0;
+ int retcode = SUCCESS;
/* Initialize cmd_status */
- cmd->cmd_status = ECONNREFUSED;
+ cmd->cmd_status = 0xFF;
/* Build MPT-MFI command for issue to FW */
if (mrsas_issue_dcmd(sc, cmd)) {
@@ -3338,18 +3548,30 @@ mrsas_issue_blocked_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
sc->chan = (void *)&cmd;
while (1) {
- if (cmd->cmd_status == ECONNREFUSED) {
+ if (cmd->cmd_status == 0xFF) {
tsleep((void *)&sc->chan, 0, "mrsas_sleep", hz);
} else
break;
- total_time++;
- if (total_time >= max_wait) {
- device_printf(sc->mrsas_dev,
- "Internal command timed out after %d seconds.\n", max_wait);
- retcode = 1;
- break;
+
+ if (!cmd->sync_cmd) { /* cmd->sync will be set for an IOCTL
+ * command */
+ total_time++;
+ if (total_time >= max_wait) {
+ device_printf(sc->mrsas_dev,
+ "Internal command timed out after %d seconds.\n", max_wait);
+ retcode = 1;
+ break;
+ }
}
}
+
+ if (cmd->cmd_status == 0xFF) {
+ device_printf(sc->mrsas_dev, "DCMD timed out after %d "
+ "seconds from %s\n", max_wait, __func__);
+ device_printf(sc->mrsas_dev, "DCMD opcode 0x%X\n",
+ cmd->frame->dcmd.opcode);
+ retcode = ETIMEDOUT;
+ }
return (retcode);
}
@@ -3400,6 +3622,7 @@ mrsas_complete_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd
(cmd->frame->dcmd.mbox.b[1] == 1)) {
sc->fast_path_io = 0;
mtx_lock(&sc->raidmap_lock);
+ sc->map_update_cmd = NULL;
if (cmd_status != 0) {
if (cmd_status != MFI_STAT_NOT_FOUND)
device_printf(sc->mrsas_dev, "map sync failed, status=%x\n", cmd_status);
@@ -3423,6 +3646,28 @@ mrsas_complete_mptmfi_passthru(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd
cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET) {
sc->mrsas_aen_triggered = 0;
}
+ /* FW has an updated PD sequence */
+ if ((cmd->frame->dcmd.opcode ==
+ MR_DCMD_SYSTEM_PD_MAP_GET_INFO) &&
+ (cmd->frame->dcmd.mbox.b[0] == 1)) {
+
+ mtx_lock(&sc->raidmap_lock);
+ sc->jbod_seq_cmd = NULL;
+ mrsas_release_mfi_cmd(cmd);
+
+ if (cmd_status == MFI_STAT_OK) {
+ sc->pd_seq_map_id++;
+ /* Re-register a pd sync seq num cmd */
+ if (megasas_sync_pd_seq_num(sc, true))
+ sc->use_seqnum_jbod_fp = 0;
+ } else {
+ sc->use_seqnum_jbod_fp = 0;
+ device_printf(sc->mrsas_dev,
+ "Jbod map sync failed, status=%x\n", cmd_status);
+ }
+ mtx_unlock(&sc->raidmap_lock);
+ break;
+ }
/* See if got an event notification */
if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT)
mrsas_complete_aen(sc, cmd);
@@ -3454,7 +3699,7 @@ mrsas_wakeup(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd)
{
cmd->cmd_status = cmd->frame->io.cmd_status;
- if (cmd->cmd_status == ECONNREFUSED)
+ if (cmd->cmd_status == 0xFF)
cmd->cmd_status = 0;
sc->chan = (void *)&cmd;
@@ -3485,9 +3730,10 @@ mrsas_shutdown_ctlr(struct mrsas_softc *sc, u_int32_t opcode)
}
if (sc->aen_cmd)
mrsas_issue_blocked_abort_cmd(sc, sc->aen_cmd);
-
if (sc->map_update_cmd)
mrsas_issue_blocked_abort_cmd(sc, sc->map_update_cmd);
+ if (sc->jbod_seq_cmd)
+ mrsas_issue_blocked_abort_cmd(sc, sc->jbod_seq_cmd);
dcmd = &cmd->frame->dcmd;
memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
@@ -3549,6 +3795,85 @@ mrsas_flush_cache(struct mrsas_softc *sc)
return;
}
+int
+megasas_sync_pd_seq_num(struct mrsas_softc *sc, boolean_t pend)
+{
+ int retcode = 0;
+ u_int8_t do_ocr = 1;
+ struct mrsas_mfi_cmd *cmd;
+ struct mrsas_dcmd_frame *dcmd;
+ uint32_t pd_seq_map_sz;
+ struct MR_PD_CFG_SEQ_NUM_SYNC *pd_sync;
+ bus_addr_t pd_seq_h;
+
+ pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
+ (sizeof(struct MR_PD_CFG_SEQ) *
+ (MAX_PHYSICAL_DEVICES - 1));
+
+ cmd = mrsas_get_mfi_cmd(sc);
+ if (!cmd) {
+ device_printf(sc->mrsas_dev,
+ "Cannot alloc for ld map info cmd.\n");
+ return 1;
+ }
+ dcmd = &cmd->frame->dcmd;
+
+ pd_sync = (void *)sc->jbodmap_mem[(sc->pd_seq_map_id & 1)];
+ pd_seq_h = sc->jbodmap_phys_addr[(sc->pd_seq_map_id & 1)];
+ if (!pd_sync) {
+ device_printf(sc->mrsas_dev,
+ "Failed to alloc mem for jbod map info.\n");
+ mrsas_release_mfi_cmd(cmd);
+ return (ENOMEM);
+ }
+ memset(pd_sync, 0, pd_seq_map_sz);
+ memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
+ dcmd->cmd = MFI_CMD_DCMD;
+ dcmd->cmd_status = 0xFF;
+ dcmd->sge_count = 1;
+ dcmd->timeout = 0;
+ dcmd->pad_0 = 0;
+ dcmd->data_xfer_len = (pd_seq_map_sz);
+ dcmd->opcode = (MR_DCMD_SYSTEM_PD_MAP_GET_INFO);
+ dcmd->sgl.sge32[0].phys_addr = (pd_seq_h);
+ dcmd->sgl.sge32[0].length = (pd_seq_map_sz);
+
+ if (pend) {
+ dcmd->mbox.b[0] = MRSAS_DCMD_MBOX_PEND_FLAG;
+ dcmd->flags = (MFI_FRAME_DIR_WRITE);
+ sc->jbod_seq_cmd = cmd;
+ if (mrsas_issue_dcmd(sc, cmd)) {
+ device_printf(sc->mrsas_dev,
+ "Fail to send sync map info command.\n");
+ return 1;
+ } else
+ return 0;
+ } else
+ dcmd->flags = MFI_FRAME_DIR_READ;
+
+ retcode = mrsas_issue_polled(sc, cmd);
+ if (retcode == ETIMEDOUT)
+ goto dcmd_timeout;
+
+ if (pd_sync->count > MAX_PHYSICAL_DEVICES) {
+ device_printf(sc->mrsas_dev,
+ "driver supports max %d JBOD, but FW reports %d\n",
+ MAX_PHYSICAL_DEVICES, pd_sync->count);
+ retcode = -EINVAL;
+ }
+ if (!retcode)
+ sc->pd_seq_map_id++;
+ do_ocr = 0;
+
+dcmd_timeout:
+ if (do_ocr)
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ else
+ mrsas_release_mfi_cmd(cmd);
+
+ return (retcode);
+}
+
/*
* mrsas_get_map_info: Load and validate RAID map input:
* Adapter instance soft state
@@ -3618,14 +3943,11 @@ mrsas_get_ld_map_info(struct mrsas_softc *sc)
dcmd->sgl.sge32[0].phys_addr = map_phys_addr;
dcmd->sgl.sge32[0].length = sc->current_map_sz;
- if (!mrsas_issue_polled(sc, cmd))
- retcode = 0;
- else {
- device_printf(sc->mrsas_dev,
- "Fail to send get LD map info cmd.\n");
- retcode = 1;
- }
- mrsas_release_mfi_cmd(cmd);
+ retcode = mrsas_issue_polled(sc, cmd);
+ if (retcode == ETIMEDOUT)
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ else
+ mrsas_release_mfi_cmd(cmd);
return (retcode);
}
@@ -3710,6 +4032,7 @@ static int
mrsas_get_pd_list(struct mrsas_softc *sc)
{
int retcode = 0, pd_index = 0, pd_count = 0, pd_list_size;
+ u_int8_t do_ocr = 1;
struct mrsas_mfi_cmd *cmd;
struct mrsas_dcmd_frame *dcmd;
struct MR_PD_LIST *pd_list_mem;
@@ -3731,6 +4054,8 @@ mrsas_get_pd_list(struct mrsas_softc *sc)
device_printf(sc->mrsas_dev,
"Cannot alloc dmamap for get PD list cmd\n");
mrsas_release_mfi_cmd(cmd);
+ mrsas_free_tmp_dcmd(tcmd);
+ free(tcmd, M_MRSAS);
return (ENOMEM);
} else {
pd_list_mem = tcmd->tmp_dcmd_mem;
@@ -3751,15 +4076,14 @@ mrsas_get_pd_list(struct mrsas_softc *sc)
dcmd->sgl.sge32[0].phys_addr = pd_list_phys_addr;
dcmd->sgl.sge32[0].length = MRSAS_MAX_PD * sizeof(struct MR_PD_LIST);
- if (!mrsas_issue_polled(sc, cmd))
- retcode = 0;
- else
- retcode = 1;
+ retcode = mrsas_issue_polled(sc, cmd);
+ if (retcode == ETIMEDOUT)
+ goto dcmd_timeout;
/* Get the instance PD list */
pd_count = MRSAS_MAX_PD;
pd_addr = pd_list_mem->addr;
- if (retcode == 0 && pd_list_mem->count < pd_count) {
+ if (pd_list_mem->count < pd_count) {
memset(sc->local_pd_list, 0,
MRSAS_MAX_PD * sizeof(struct mrsas_pd_list));
for (pd_index = 0; pd_index < pd_list_mem->count; pd_index++) {
@@ -3770,15 +4094,22 @@ mrsas_get_pd_list(struct mrsas_softc *sc)
MR_PD_STATE_SYSTEM;
pd_addr++;
}
+ /*
+ * Use mutext/spinlock if pd_list component size increase more than
+ * 32 bit.
+ */
+ memcpy(sc->pd_list, sc->local_pd_list, sizeof(sc->local_pd_list));
+ do_ocr = 0;
}
- /*
- * Use mutext/spinlock if pd_list component size increase more than
- * 32 bit.
- */
- memcpy(sc->pd_list, sc->local_pd_list, sizeof(sc->local_pd_list));
+dcmd_timeout:
mrsas_free_tmp_dcmd(tcmd);
- mrsas_release_mfi_cmd(cmd);
free(tcmd, M_MRSAS);
+
+ if (do_ocr)
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ else
+ mrsas_release_mfi_cmd(cmd);
+
return (retcode);
}
@@ -3794,6 +4125,7 @@ static int
mrsas_get_ld_list(struct mrsas_softc *sc)
{
int ld_list_size, retcode = 0, ld_index = 0, ids = 0;
+ u_int8_t do_ocr = 1;
struct mrsas_mfi_cmd *cmd;
struct mrsas_dcmd_frame *dcmd;
struct MR_LD_LIST *ld_list_mem;
@@ -3814,6 +4146,8 @@ mrsas_get_ld_list(struct mrsas_softc *sc)
device_printf(sc->mrsas_dev,
"Cannot alloc dmamap for get LD list cmd\n");
mrsas_release_mfi_cmd(cmd);
+ mrsas_free_tmp_dcmd(tcmd);
+ free(tcmd, M_MRSAS);
return (ENOMEM);
} else {
ld_list_mem = tcmd->tmp_dcmd_mem;
@@ -3835,18 +4169,16 @@ mrsas_get_ld_list(struct mrsas_softc *sc)
dcmd->sgl.sge32[0].length = sizeof(struct MR_LD_LIST);
dcmd->pad_0 = 0;
- if (!mrsas_issue_polled(sc, cmd))
- retcode = 0;
- else
- retcode = 1;
+ retcode = mrsas_issue_polled(sc, cmd);
+ if (retcode == ETIMEDOUT)
+ goto dcmd_timeout;
#if VD_EXT_DEBUG
printf("Number of LDs %d\n", ld_list_mem->ldCount);
#endif
/* Get the instance LD list */
- if ((retcode == 0) &&
- (ld_list_mem->ldCount <= sc->fw_supported_vd_count)) {
+ if (ld_list_mem->ldCount <= sc->fw_supported_vd_count) {
sc->CurLdCount = ld_list_mem->ldCount;
memset(sc->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT);
for (ld_index = 0; ld_index < ld_list_mem->ldCount; ld_index++) {
@@ -3855,10 +4187,17 @@ mrsas_get_ld_list(struct mrsas_softc *sc)
sc->ld_ids[ids] = ld_list_mem->ldList[ld_index].ref.ld_context.targetId;
}
}
+ do_ocr = 0;
}
+dcmd_timeout:
mrsas_free_tmp_dcmd(tcmd);
- mrsas_release_mfi_cmd(cmd);
free(tcmd, M_MRSAS);
+
+ if (do_ocr)
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ else
+ mrsas_release_mfi_cmd(cmd);
+
return (retcode);
}
@@ -4014,7 +4353,7 @@ mrsas_aen_handler(struct mrsas_softc *sc)
union mrsas_evt_class_locale class_locale;
int doscan = 0;
u_int32_t seq_num;
- int error;
+ int error, fail_aen = 0;
if (sc == NULL) {
printf("invalid instance!\n");
@@ -4023,13 +4362,19 @@ mrsas_aen_handler(struct mrsas_softc *sc)
if (sc->evt_detail_mem) {
switch (sc->evt_detail_mem->code) {
case MR_EVT_PD_INSERTED:
- mrsas_get_pd_list(sc);
- mrsas_bus_scan_sim(sc, sc->sim_1);
+ fail_aen = mrsas_get_pd_list(sc);
+ if (!fail_aen)
+ mrsas_bus_scan_sim(sc, sc->sim_1);
+ else
+ goto skip_register_aen;
doscan = 0;
break;
case MR_EVT_PD_REMOVED:
- mrsas_get_pd_list(sc);
- mrsas_bus_scan_sim(sc, sc->sim_1);
+ fail_aen = mrsas_get_pd_list(sc);
+ if (!fail_aen)
+ mrsas_bus_scan_sim(sc, sc->sim_1);
+ else
+ goto skip_register_aen;
doscan = 0;
break;
case MR_EVT_LD_OFFLINE:
@@ -4039,8 +4384,11 @@ mrsas_aen_handler(struct mrsas_softc *sc)
doscan = 0;
break;
case MR_EVT_LD_CREATED:
- mrsas_get_ld_list(sc);
- mrsas_bus_scan_sim(sc, sc->sim_0);
+ fail_aen = mrsas_get_ld_list(sc);
+ if (!fail_aen)
+ mrsas_bus_scan_sim(sc, sc->sim_0);
+ else
+ goto skip_register_aen;
doscan = 0;
break;
case MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED:
@@ -4057,12 +4405,19 @@ mrsas_aen_handler(struct mrsas_softc *sc)
return;
}
if (doscan) {
- mrsas_get_pd_list(sc);
- mrsas_dprint(sc, MRSAS_AEN, "scanning ...sim 1\n");
- mrsas_bus_scan_sim(sc, sc->sim_1);
- mrsas_get_ld_list(sc);
- mrsas_dprint(sc, MRSAS_AEN, "scanning ...sim 0\n");
- mrsas_bus_scan_sim(sc, sc->sim_0);
+ fail_aen = mrsas_get_pd_list(sc);
+ if (!fail_aen) {
+ mrsas_dprint(sc, MRSAS_AEN, "scanning ...sim 1\n");
+ mrsas_bus_scan_sim(sc, sc->sim_1);
+ } else
+ goto skip_register_aen;
+
+ fail_aen = mrsas_get_ld_list(sc);
+ if (!fail_aen) {
+ mrsas_dprint(sc, MRSAS_AEN, "scanning ...sim 0\n");
+ mrsas_bus_scan_sim(sc, sc->sim_0);
+ } else
+ goto skip_register_aen;
}
seq_num = sc->evt_detail_mem->seq_num + 1;
@@ -4082,6 +4437,9 @@ mrsas_aen_handler(struct mrsas_softc *sc)
if (error)
device_printf(sc->mrsas_dev, "register aen failed error %x\n", error);
+skip_register_aen:
+ return;
+
}
diff --git a/sys/dev/mrsas/mrsas.h b/sys/dev/mrsas/mrsas.h
index 1cfe89e..2c2a341 100644
--- a/sys/dev/mrsas/mrsas.h
+++ b/sys/dev/mrsas/mrsas.h
@@ -80,6 +80,10 @@ __FBSDID("$FreeBSD$");
#define MRSAS_TBOLT 0x005b
#define MRSAS_INVADER 0x005d
#define MRSAS_FURY 0x005f
+#define MRSAS_INTRUDER 0x00ce
+#define MRSAS_INTRUDER_24 0x00cf
+#define MRSAS_CUTLASS_52 0x0052
+#define MRSAS_CUTLASS_53 0x0053
#define MRSAS_PCI_BAR0 0x10
#define MRSAS_PCI_BAR1 0x14
#define MRSAS_PCI_BAR2 0x1C
@@ -102,7 +106,7 @@ __FBSDID("$FreeBSD$");
*/
#define BYTE_ALIGNMENT 1
#define MRSAS_MAX_NAME_LENGTH 32
-#define MRSAS_VERSION "06.707.04.03-fbsd"
+#define MRSAS_VERSION "06.709.07.00-fbsd"
#define MRSAS_ULONG_MAX 0xFFFFFFFFFFFFFFFF
#define MRSAS_DEFAULT_TIMEOUT 0x14 /* Temporarily set */
#define DONE 0
@@ -166,7 +170,9 @@ typedef struct _RAID_CONTEXT {
u_int8_t numSGE;
u_int16_t configSeqNum;
u_int8_t spanArm;
- u_int8_t resvd2[3];
+ u_int8_t priority; /* 0x1D MR_PRIORITY_RANGE */
+ u_int8_t numSGEExt; /* 0x1E 1M IO support */
+ u_int8_t resvd2; /* 0x1F */
} RAID_CONTEXT;
@@ -577,6 +583,7 @@ Mpi2IOCInitRequest_t, MPI2_POINTER pMpi2IOCInitRequest_t;
#define MAX_PHYSICAL_DEVICES 256
#define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES)
#define MR_DCMD_LD_MAP_GET_INFO 0x0300e101
+#define MR_DCMD_SYSTEM_PD_MAP_GET_INFO 0x0200e102
#define MRSAS_MAX_PD_CHANNELS 1
@@ -863,6 +870,22 @@ struct IO_REQUEST_INFO {
u_int8_t pd_after_lb;
};
+/*
+ * define MR_PD_CFG_SEQ structure for system PDs
+ */
+struct MR_PD_CFG_SEQ {
+ u_int16_t seqNum;
+ u_int16_t devHandle;
+ u_int8_t reserved[4];
+} __packed;
+
+struct MR_PD_CFG_SEQ_NUM_SYNC {
+ u_int32_t size;
+ u_int32_t count;
+ struct MR_PD_CFG_SEQ seq[1];
+} __packed;
+
+
typedef struct _MR_LD_TARGET_SYNC {
u_int8_t targetId;
u_int8_t reserved;
@@ -1223,7 +1246,7 @@ enum MR_EVT_ARGS {
/*
* Thunderbolt (and later) Defines
*/
-#define MRSAS_MAX_SZ_CHAIN_FRAME 1024
+#define MEGASAS_CHAIN_FRAME_SZ_MIN 1024
#define MFI_FUSION_ENABLE_INTERRUPT_MASK (0x00000009)
#define MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE 256
#define MRSAS_MPI2_FUNCTION_PASSTHRU_IO_REQUEST 0xF0
@@ -1301,10 +1324,13 @@ typedef enum _REGION_TYPE {
#define MRSAS_SCSI_MAX_CMDS 8
#define MRSAS_SCSI_MAX_CDB_LEN 16
#define MRSAS_SCSI_SENSE_BUFFERSIZE 96
-#define MRSAS_MAX_SGL 70
-#define MRSAS_MAX_IO_SIZE (256 * 1024)
#define MRSAS_INTERNAL_CMDS 32
+#define MEGASAS_MAX_CHAIN_SIZE_UNITS_MASK 0x400000
+#define MEGASAS_MAX_CHAIN_SIZE_MASK 0x3E0
+#define MEGASAS_256K_IO 128
+#define MEGASAS_1MB_IO (MEGASAS_256K_IO * 4)
+
/* Request types */
#define MRSAS_REQ_TYPE_INTERNAL_CMD 0x0
#define MRSAS_REQ_TYPE_AEN_FETCH 0x1
@@ -1927,7 +1953,12 @@ struct mrsas_ctrl_info {
u_int32_t supportCacheBypassModes:1;
u_int32_t supportSecurityonJBOD:1;
u_int32_t discardCacheDuringLDDelete:1;
- u_int32_t reserved:12;
+ u_int32_t supportTTYLogCompression:1;
+ u_int32_t supportCPLDUpdate:1;
+ u_int32_t supportDiskCacheSettingForSysPDs:1;
+ u_int32_t supportExtendedSSCSize:1;
+ u_int32_t useSeqNumJbodFP:1;
+ u_int32_t reserved:7;
} adapterOperations3;
u_int8_t pad[0x800 - 0x7EC]; /* 0x7EC */
@@ -2001,7 +2032,9 @@ typedef union _MFI_CAPABILITIES {
u_int32_t support_ndrive_r1_lb:1;
u_int32_t support_core_affinity:1;
u_int32_t security_protocol_cmds_fw:1;
- u_int32_t reserved:25;
+ u_int32_t support_ext_queue_depth:1;
+ u_int32_t support_ext_io_size:1;
+ u_int32_t reserved:23;
} mfi_capabilities;
u_int32_t reg;
} MFI_CAPABILITIES;
@@ -2435,6 +2468,12 @@ struct mrsas_irq_context {
uint32_t MSIxIndex;
};
+enum MEGASAS_OCR_REASON {
+ FW_FAULT_OCR = 0,
+ SCSIIO_TIMEOUT_OCR = 1,
+ MFI_DCMD_TIMEOUT_OCR = 2,
+};
+
/* Controller management info added to support Linux Emulator */
#define MAX_MGMT_ADAPTERS 1024
@@ -2611,6 +2650,8 @@ typedef struct _MRSAS_DRV_PCI_INFORMATION {
struct mrsas_softc {
device_t mrsas_dev;
struct cdev *mrsas_cdev;
+ struct intr_config_hook mrsas_ich;
+ struct cdev *mrsas_linux_emulator_cdev;
uint16_t device_id;
struct resource *reg_res;
int reg_res_id;
@@ -2669,6 +2710,7 @@ struct mrsas_softc {
int msix_enable;
uint32_t msix_reg_offset[16];
uint8_t mask_interrupts;
+ uint16_t max_chain_frame_sz;
struct mrsas_mpt_cmd **mpt_cmd_list;
struct mrsas_mfi_cmd **mfi_cmd_list;
TAILQ_HEAD(, mrsas_mpt_cmd) mrsas_mpt_cmd_list_head;
@@ -2691,7 +2733,9 @@ struct mrsas_softc {
u_int8_t chain_offset_mfi_pthru;
u_int32_t map_sz;
u_int64_t map_id;
+ u_int64_t pd_seq_map_id;
struct mrsas_mfi_cmd *map_update_cmd;
+ struct mrsas_mfi_cmd *jbod_seq_cmd;
struct mrsas_mfi_cmd *aen_cmd;
u_int8_t fast_path_io;
void *chan;
@@ -2702,6 +2746,12 @@ struct mrsas_softc {
u_int8_t do_timedout_reset;
u_int32_t reset_in_progress;
u_int32_t reset_count;
+
+ bus_dma_tag_t jbodmap_tag[2];
+ bus_dmamap_t jbodmap_dmamap[2];
+ void *jbodmap_mem[2];
+ bus_addr_t jbodmap_phys_addr[2];
+
bus_dma_tag_t raidmap_tag[2];
bus_dmamap_t raidmap_dmamap[2];
void *raidmap_mem[2];
@@ -2745,6 +2795,7 @@ struct mrsas_softc {
LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT];
u_int8_t secure_jbod_support;
+ u_int8_t use_seqnum_jbod_fp;
u_int8_t max256vdSupport;
u_int16_t fw_supported_vd_count;
u_int16_t fw_supported_pd_count;
diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c
index 08f9002..a0d1323 100644
--- a/sys/dev/mrsas/mrsas_cam.c
+++ b/sys/dev/mrsas/mrsas_cam.c
@@ -65,11 +65,14 @@ int
mrsas_map_request(struct mrsas_softc *sc,
struct mrsas_mpt_cmd *cmd, union ccb *ccb);
int
-mrsas_build_ldio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
+mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
union ccb *ccb);
int
-mrsas_build_dcdb(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
- union ccb *ccb, struct cam_sim *sim);
+mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
+ union ccb *ccb);
+int
+mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
+ union ccb *ccb, struct cam_sim *sim, u_int8_t fp_possible);
int
mrsas_setup_io(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
union ccb *ccb, u_int32_t device_id,
@@ -121,6 +124,7 @@ mrsas_get_updated_dev_handle(struct mrsas_softc *sc,
extern u_int8_t
megasas_get_best_arm(PLD_LOAD_BALANCE_INFO lbInfo, u_int8_t arm,
u_int64_t block, u_int32_t count);
+extern int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
/*
@@ -341,7 +345,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb)
else
ccb->cpi.max_target = MRSAS_MAX_LD_IDS - 1;
#if (__FreeBSD_version > 704000)
- ccb->cpi.maxio = MRSAS_MAX_IO_SIZE;
+ ccb->cpi.maxio = sc->max_num_sge * MRSAS_PAGE_SIZE;
#endif
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
@@ -392,7 +396,7 @@ mrsas_scsiio_timeout(void *data)
callout_reset(&cmd->cm_callout, (600000 * hz) / 1000,
mrsas_scsiio_timeout, cmd);
#endif
- sc->do_timedout_reset = 1;
+ sc->do_timedout_reset = SCSIIO_TIMEOUT_OCR;
if (sc->ocr_thread_active)
wakeup(&sc->ocr_chan);
}
@@ -415,6 +419,7 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
struct ccb_hdr *ccb_h = &(ccb->ccb_h);
struct ccb_scsiio *csio = &(ccb->csio);
MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc;
+ u_int8_t cmd_type;
if ((csio->cdb_io.cdb_bytes[0]) == SYNCHRONIZE_CACHE) {
ccb->ccb_h.status = CAM_REQ_CMP;
@@ -458,7 +463,7 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
ccb_h->status = CAM_REQ_INVALID;
goto done;
case CAM_DATA_VADDR:
- if (csio->dxfer_len > MRSAS_MAX_IO_SIZE) {
+ if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) {
mrsas_release_mpt_cmd(cmd);
ccb_h->status = CAM_REQ_TOO_BIG;
goto done;
@@ -468,6 +473,11 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
cmd->data = csio->data_ptr;
break;
case CAM_DATA_BIO:
+ if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) {
+ mrsas_release_mpt_cmd(cmd);
+ ccb_h->status = CAM_REQ_TOO_BIG;
+ goto done;
+ }
cmd->length = csio->dxfer_len;
if (cmd->length)
cmd->data = csio->data_ptr;
@@ -479,7 +489,7 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
#else
if (!(ccb_h->flags & CAM_DATA_PHYS)) { /* Virtual data address */
if (!(ccb_h->flags & CAM_SCATTER_VALID)) {
- if (csio->dxfer_len > MRSAS_MAX_IO_SIZE) {
+ if (csio->dxfer_len > (sc->max_num_sge * MRSAS_PAGE_SIZE)) {
mrsas_release_mpt_cmd(cmd);
ccb_h->status = CAM_REQ_TOO_BIG;
goto done;
@@ -517,19 +527,44 @@ mrsas_startio(struct mrsas_softc *sc, struct cam_sim *sim,
mtx_lock(&sc->raidmap_lock);
/* Check for IO type READ-WRITE targeted for Logical Volume */
- if (mrsas_find_io_type(sim, ccb) == READ_WRITE_LDIO) {
+ cmd_type = mrsas_find_io_type(sim, ccb);
+ switch (cmd_type) {
+ case READ_WRITE_LDIO:
/* Build READ-WRITE IO for Logical Volume */
- if (mrsas_build_ldio(sc, cmd, ccb)) {
- device_printf(sc->mrsas_dev, "Build LDIO failed.\n");
+ if (mrsas_build_ldio_rw(sc, cmd, ccb)) {
+ device_printf(sc->mrsas_dev, "Build RW LDIO failed.\n");
mtx_unlock(&sc->raidmap_lock);
return (1);
}
- } else {
- if (mrsas_build_dcdb(sc, cmd, ccb, sim)) {
- device_printf(sc->mrsas_dev, "Build DCDB failed.\n");
+ break;
+ case NON_READ_WRITE_LDIO:
+ /* Build NON READ-WRITE IO for Logical Volume */
+ if (mrsas_build_ldio_nonrw(sc, cmd, ccb)) {
+ device_printf(sc->mrsas_dev, "Build NON-RW LDIO failed.\n");
mtx_unlock(&sc->raidmap_lock);
return (1);
}
+ break;
+ case READ_WRITE_SYSPDIO:
+ case NON_READ_WRITE_SYSPDIO:
+ if (sc->secure_jbod_support &&
+ (cmd_type == NON_READ_WRITE_SYSPDIO)) {
+ /* Build NON-RW IO for JBOD */
+ if (mrsas_build_syspdio(sc, cmd, ccb, sim, 0)) {
+ device_printf(sc->mrsas_dev,
+ "Build SYSPDIO failed.\n");
+ mtx_unlock(&sc->raidmap_lock);
+ return (1);
+ }
+ } else {
+ /* Build RW IO for JBOD */
+ if (mrsas_build_syspdio(sc, cmd, ccb, sim, 1)) {
+ device_printf(sc->mrsas_dev,
+ "Build SYSPDIO failed.\n");
+ mtx_unlock(&sc->raidmap_lock);
+ return (1);
+ }
+ }
}
mtx_unlock(&sc->raidmap_lock);
@@ -614,7 +649,10 @@ mrsas_get_mpt_cmd(struct mrsas_softc *sc)
if (!TAILQ_EMPTY(&sc->mrsas_mpt_cmd_list_head)) {
cmd = TAILQ_FIRST(&sc->mrsas_mpt_cmd_list_head);
TAILQ_REMOVE(&sc->mrsas_mpt_cmd_list_head, cmd, next);
+ } else {
+ goto out;
}
+
memset((uint8_t *)cmd->io_request, 0, MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE);
cmd->data = NULL;
cmd->length = 0;
@@ -622,8 +660,9 @@ mrsas_get_mpt_cmd(struct mrsas_softc *sc)
cmd->error_code = 0;
cmd->load_balance = 0;
cmd->ccb_ptr = NULL;
- mtx_unlock(&sc->mpt_cmd_pool_lock);
+out:
+ mtx_unlock(&sc->mpt_cmd_pool_lock);
return cmd;
}
@@ -668,7 +707,7 @@ mrsas_get_request_desc(struct mrsas_softc *sc, u_int16_t index)
}
/*
- * mrsas_build_ldio: Builds an LDIO command
+ * mrsas_build_ldio_rw: Builds an LDIO command
* input: Adapter instance soft state
* Pointer to command packet
* Pointer to CCB
@@ -677,7 +716,7 @@ mrsas_get_request_desc(struct mrsas_softc *sc, u_int16_t index)
* built successfully, otherwise it returns a 1.
*/
int
-mrsas_build_ldio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
+mrsas_build_ldio_rw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
union ccb *ccb)
{
struct ccb_hdr *ccb_h = &(ccb->ccb_h);
@@ -701,12 +740,18 @@ mrsas_build_ldio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
io_request->DataLength = cmd->length;
if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) {
- if (cmd->sge_count > MRSAS_MAX_SGL) {
+ if (cmd->sge_count > sc->max_num_sge) {
device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds"
"max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge);
return (FAIL);
}
+ /*
+ * numSGE store lower 8 bit of sge_count. numSGEExt store
+ * higher 8 bit of sge_count
+ */
io_request->RaidContext.numSGE = cmd->sge_count;
+ io_request->RaidContext.numSGEExt = (uint8_t)(cmd->sge_count >> 8);
+
} else {
device_printf(sc->mrsas_dev, "Data map/load failed.\n");
return (FAIL);
@@ -832,7 +877,12 @@ mrsas_setup_io(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
if (io_request->RaidContext.regLockFlags == REGION_TYPE_UNUSED)
cmd->request_desc->SCSIIO.RequestFlags =
(MRSAS_REQ_DESCRIPT_FLAGS_NO_LOCK <<
@@ -861,7 +911,12 @@ mrsas_setup_io(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
cmd->request_desc->SCSIIO.RequestFlags =
(MRSAS_REQ_DESCRIPT_FLAGS_LD_IO <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
if (io_request->RaidContext.regLockFlags == REGION_TYPE_UNUSED)
cmd->request_desc->SCSIIO.RequestFlags =
(MRSAS_REQ_DESCRIPT_FLAGS_NO_LOCK <<
@@ -879,78 +934,141 @@ mrsas_setup_io(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
}
/*
- * mrsas_build_dcdb: Builds an DCDB command
+ * mrsas_build_ldio_nonrw: Builds an LDIO command
* input: Adapter instance soft state
* Pointer to command packet
* Pointer to CCB
*
- * This function builds the DCDB inquiry command. It returns 0 if the command
- * is built successfully, otherwise it returns a 1.
+ * This function builds the LDIO command packet. It returns 0 if the command is
+ * built successfully, otherwise it returns a 1.
*/
int
-mrsas_build_dcdb(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
- union ccb *ccb, struct cam_sim *sim)
+mrsas_build_ldio_nonrw(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
+ union ccb *ccb)
{
struct ccb_hdr *ccb_h = &(ccb->ccb_h);
u_int32_t device_id;
- MR_DRV_RAID_MAP_ALL *map_ptr;
MRSAS_RAID_SCSI_IO_REQUEST *io_request;
io_request = cmd->io_request;
device_id = ccb_h->target_id;
- map_ptr = sc->ld_drv_map[(sc->map_id & 1)];
- /*
- * Check if this is RW for system PD or
- * it's a NON RW for sys PD and there is NO secure jbod FW support
- */
- if (cam_sim_bus(sim) == 1 &&
- sc->pd_list[device_id].driveState == MR_PD_STATE_SYSTEM) {
+ /* FW path for LD Non-RW (SCSI management commands) */
+ io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST;
+ io_request->DevHandle = device_id;
+ cmd->request_desc->SCSIIO.RequestFlags =
+ (MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO <<
+ MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
- io_request->DevHandle =
- map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;
- io_request->RaidContext.RAIDFlags =
- MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD <<
- MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
- cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
- cmd->request_desc->SCSIIO.MSIxIndex =
- sc->msix_vectors ? smp_processor_id() % sc->msix_vectors : 0;
-
- if (sc->secure_jbod_support && (mrsas_find_io_type(sim, ccb) == NON_READ_WRITE_SYSPDIO)) {
- /* system pd firmware path */
- io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST;
- cmd->request_desc->SCSIIO.RequestFlags =
- (MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO << MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
- } else {
- /* system pd fast path */
- io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST;
- io_request->RaidContext.timeoutValue = map_ptr->raidMap.fpPdIoTimeoutSec;
- io_request->RaidContext.regLockFlags = 0;
- io_request->RaidContext.regLockRowLBA = 0;
- io_request->RaidContext.regLockLength = 0;
-
- cmd->request_desc->SCSIIO.RequestFlags =
- (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
- MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
+ io_request->RaidContext.VirtualDiskTgtId = device_id;
+ io_request->LUN[1] = ccb_h->target_lun & 0xF;
+ io_request->DataLength = cmd->length;
- /*
- * NOTE - For system pd RW cmds only IoFlags will be FAST_PATH
- * Because the NON RW cmds will now go via FW Queue
- * and not the Exception queue
- */
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
- io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH;
+ if (mrsas_map_request(sc, cmd, ccb) == SUCCESS) {
+ if (cmd->sge_count > sc->max_num_sge) {
+ device_printf(sc->mrsas_dev, "Error: sge_count (0x%x) exceeds"
+ "max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge);
+ return (1);
}
+ /*
+ * numSGE store lower 8 bit of sge_count. numSGEExt store
+ * higher 8 bit of sge_count
+ */
+ io_request->RaidContext.numSGE = cmd->sge_count;
+ io_request->RaidContext.numSGEExt = (uint8_t)(cmd->sge_count >> 8);
} else {
- /* FW path for SysPD or LD Non-RW (SCSI management commands) */
+ device_printf(sc->mrsas_dev, "Data map/load failed.\n");
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * mrsas_build_syspdio: Builds an DCDB command
+ * input: Adapter instance soft state
+ * Pointer to command packet
+ * Pointer to CCB
+ *
+ * This function builds the DCDB inquiry command. It returns 0 if the command
+ * is built successfully, otherwise it returns a 1.
+ */
+int
+mrsas_build_syspdio(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
+ union ccb *ccb, struct cam_sim *sim, u_int8_t fp_possible)
+{
+ struct ccb_hdr *ccb_h = &(ccb->ccb_h);
+ u_int32_t device_id;
+ MR_DRV_RAID_MAP_ALL *local_map_ptr;
+ MRSAS_RAID_SCSI_IO_REQUEST *io_request;
+ struct MR_PD_CFG_SEQ_NUM_SYNC *pd_sync;
+
+ pd_sync = (void *)sc->jbodmap_mem[(sc->pd_seq_map_id - 1) & 1];
+
+ io_request = cmd->io_request;
+ device_id = ccb_h->target_id;
+ local_map_ptr = sc->ld_drv_map[(sc->map_id & 1)];
+ io_request->RaidContext.RAIDFlags = MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD
+ << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT;
+ io_request->RaidContext.regLockFlags = 0;
+ io_request->RaidContext.regLockRowLBA = 0;
+ io_request->RaidContext.regLockLength = 0;
+
+ /* If FW supports PD sequence number */
+ if (sc->use_seqnum_jbod_fp &&
+ sc->pd_list[device_id].driveType == 0x00) {
+ //printf("Using Drv seq num\n");
+ io_request->RaidContext.VirtualDiskTgtId = device_id + 255;
+ io_request->RaidContext.configSeqNum = pd_sync->seq[device_id].seqNum;
+ io_request->DevHandle = pd_sync->seq[device_id].devHandle;
+ io_request->RaidContext.regLockFlags |=
+ (MR_RL_FLAGS_SEQ_NUM_ENABLE | MR_RL_FLAGS_GRANT_DESTINATION_CUDA);
+ io_request->RaidContext.Type = MPI2_TYPE_CUDA;
+ io_request->RaidContext.nseg = 0x1;
+ } else if (sc->fast_path_io) {
+ //printf("Using LD RAID map\n");
+ io_request->RaidContext.VirtualDiskTgtId = device_id;
+ io_request->RaidContext.configSeqNum = 0;
+ local_map_ptr = sc->ld_drv_map[(sc->map_id & 1)];
+ io_request->DevHandle =
+ local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;
+ } else {
+ //printf("Using FW PATH\n");
+ /* Want to send all IO via FW path */
+ io_request->RaidContext.VirtualDiskTgtId = device_id;
+ io_request->RaidContext.configSeqNum = 0;
+ io_request->DevHandle = 0xFFFF;
+ }
+
+ cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
+ cmd->request_desc->SCSIIO.MSIxIndex =
+ sc->msix_vectors ? smp_processor_id() % sc->msix_vectors : 0;
+
+ if (!fp_possible) {
+ /* system pd firmware path */
io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST;
- io_request->DevHandle = device_id;
cmd->request_desc->SCSIIO.RequestFlags =
(MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO <<
MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
+ io_request->RaidContext.timeoutValue =
+ local_map_ptr->raidMap.fpPdIoTimeoutSec;
+ io_request->RaidContext.VirtualDiskTgtId = device_id;
+ } else {
+ /* system pd fast path */
+ io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST;
+ io_request->RaidContext.timeoutValue = local_map_ptr->raidMap.fpPdIoTimeoutSec;
+
+ /*
+ * NOTE - For system pd RW cmds only IoFlags will be FAST_PATH
+ * Because the NON RW cmds will now go via FW Queue
+ * and not the Exception queue
+ */
+ io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH;
+
+ cmd->request_desc->SCSIIO.RequestFlags =
+ (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
+ MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
}
- io_request->RaidContext.VirtualDiskTgtId = device_id;
io_request->LUN[1] = ccb_h->target_lun & 0xF;
io_request->DataLength = cmd->length;
@@ -960,7 +1078,12 @@ mrsas_build_dcdb(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd,
"max (0x%x) allowed\n", cmd->sge_count, sc->max_num_sge);
return (1);
}
+ /*
+ * numSGE store lower 8 bit of sge_count. numSGEExt store
+ * higher 8 bit of sge_count
+ */
io_request->RaidContext.numSGE = cmd->sge_count;
+ io_request->RaidContext.numSGEExt = (uint8_t)(cmd->sge_count >> 8);
} else {
device_printf(sc->mrsas_dev, "Data map/load failed.\n");
return (1);
@@ -1069,7 +1192,12 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
io_request = cmd->io_request;
sgl_ptr = (pMpi25IeeeSgeChain64_t)&io_request->SGL;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
pMpi25IeeeSgeChain64_t sgl_ptr_end = sgl_ptr;
sgl_ptr_end += sc->max_sge_in_main_msg - 1;
@@ -1080,7 +1208,12 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
sgl_ptr->Address = segs[i].ds_addr;
sgl_ptr->Length = segs[i].ds_len;
sgl_ptr->Flags = 0;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
if (i == nseg - 1)
sgl_ptr->Flags = IEEE_SGE_FLAGS_END_OF_LIST;
}
@@ -1090,7 +1223,12 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
(nseg > sc->max_sge_in_main_msg)) {
pMpi25IeeeSgeChain64_t sg_chain;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) {
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53)) {
if ((cmd->io_request->IoFlags & MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH)
!= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH)
cmd->io_request->ChainOffset = sc->chain_offset_io_request;
@@ -1099,7 +1237,12 @@ mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
} else
cmd->io_request->ChainOffset = sc->chain_offset_io_request;
sg_chain = sgl_ptr;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53))
sg_chain->Flags = IEEE_SGE_FLAGS_CHAIN_ELEMENT;
else
sg_chain->Flags = (IEEE_SGE_FLAGS_CHAIN_ELEMENT | MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR);
@@ -1170,9 +1313,16 @@ mrsas_cmd_done(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd)
static void
mrsas_cam_poll(struct cam_sim *sim)
{
+ int i;
struct mrsas_softc *sc = (struct mrsas_softc *)cam_sim_softc(sim);
- mrsas_isr((void *)sc);
+ if (sc->msix_vectors != 0){
+ for (i=0; i<sc->msix_vectors; i++){
+ mrsas_complete_cmd(sc, i);
+ }
+ } else {
+ mrsas_complete_cmd(sc, 0);
+ }
}
/*
diff --git a/sys/dev/mrsas/mrsas_fp.c b/sys/dev/mrsas/mrsas_fp.c
index 7ae5662..f83d52b 100644
--- a/sys/dev/mrsas/mrsas_fp.c
+++ b/sys/dev/mrsas/mrsas_fp.c
@@ -749,7 +749,12 @@ mr_spanset_get_phy_params(struct mrsas_softc *sc, u_int32_t ld, u_int64_t stripR
u_int32_t logArm, rowMod, armQ, arm;
u_int8_t do_invader = 0;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53))
do_invader = 1;
/* Get row and span from io_info for Uneven Span IO. */
@@ -960,7 +965,12 @@ MR_BuildRaidContext(struct mrsas_softc *sc, struct IO_REQUEST_INFO *io_info,
regSize += stripSize;
}
pRAID_Context->timeoutValue = map->raidMap.fpPdIoTimeoutSec;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53))
pRAID_Context->regLockFlags = (isRead) ? raid->regTypeReqOnRead : raid->regTypeReqOnWrite;
else
pRAID_Context->regLockFlags = (isRead) ? REGION_TYPE_SHARED_READ : raid->regTypeReqOnWrite;
@@ -1309,12 +1319,6 @@ mrsas_set_pd_lba(MRSAS_RAID_SCSI_IO_REQUEST * io_request, u_int8_t cdb_len,
cdb[3] = (u_int8_t)((start_blk >> 16) & 0xff);
cdb[2] = (u_int8_t)((start_blk >> 24) & 0xff);
break;
- case 12:
- cdb[5] = (u_int8_t)(start_blk & 0xff);
- cdb[4] = (u_int8_t)((start_blk >> 8) & 0xff);
- cdb[3] = (u_int8_t)((start_blk >> 16) & 0xff);
- cdb[2] = (u_int8_t)((start_blk >> 24) & 0xff);
- break;
case 16:
cdb[9] = (u_int8_t)(start_blk & 0xff);
cdb[8] = (u_int8_t)((start_blk >> 8) & 0xff);
@@ -1451,7 +1455,12 @@ MR_GetPhyParams(struct mrsas_softc *sc, u_int32_t ld,
u_int32_t rowMod, armQ, arm, logArm;
u_int8_t do_invader = 0;
- if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY))
+ if ((sc->device_id == MRSAS_INVADER) ||
+ (sc->device_id == MRSAS_FURY) ||
+ (sc->device_id == MRSAS_INTRUDER) ||
+ (sc->device_id == MRSAS_INTRUDER_24) ||
+ (sc->device_id == MRSAS_CUTLASS_52) ||
+ (sc->device_id == MRSAS_CUTLASS_53))
do_invader = 1;
row = mega_div64_32(stripRow, raid->rowDataSize);
diff --git a/sys/dev/mrsas/mrsas_ioctl.c b/sys/dev/mrsas/mrsas_ioctl.c
index 3c4dbf9..4939156 100644
--- a/sys/dev/mrsas/mrsas_ioctl.c
+++ b/sys/dev/mrsas/mrsas_ioctl.c
@@ -138,6 +138,11 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd)
kern_sge32 = (struct mrsas_sge32 *)
((unsigned long)cmd->frame + user_ioc->sgl_off);
+ memset(ioctl_data_tag, 0, (sizeof(bus_dma_tag_t) * MAX_IOCTL_SGE));
+ memset(ioctl_data_dmamap, 0, (sizeof(bus_dmamap_t) * MAX_IOCTL_SGE));
+ memset(ioctl_data_mem, 0, (sizeof(void *) * MAX_IOCTL_SGE));
+ memset(ioctl_data_phys_addr, 0, (sizeof(bus_addr_t) * MAX_IOCTL_SGE));
+
/*
* For each user buffer, create a mirror buffer and copy in
*/
@@ -246,7 +251,14 @@ mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd)
* cmd to the SCSI mid-layer
*/
cmd->sync_cmd = 1;
- mrsas_issue_blocked_cmd(sc, cmd);
+ ret = mrsas_issue_blocked_cmd(sc, cmd);
+ if (ret == ETIMEDOUT) {
+ mrsas_dprint(sc, MRSAS_OCR,
+ "IOCTL command is timed out, initiating OCR\n");
+ sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR;
+ ret = EAGAIN;
+ goto out;
+ }
cmd->sync_cmd = 0;
/*
@@ -435,6 +447,17 @@ mrsas_create_frame_pool(struct mrsas_softc *sc)
device_printf(sc->mrsas_dev, "Cannot alloc MFI frame memory\n");
return (ENOMEM);
}
+ /*
+ * For MFI controllers.
+ * max_num_sge = 60
+ * max_sge_sz = 16 byte (sizeof megasas_sge_skinny)
+ * Totl 960 byte (15 MFI frame of 64 byte)
+ *
+ * Fusion adapter require only 3 extra frame.
+ * max_num_sge = 16 (defined as MAX_IOCTL_SGE)
+ * max_sge_sz = 12 byte (sizeof megasas_sge64)
+ * Total 192 byte (3 MFI frame of 64 byte)
+ */
memset(cmd->frame, 0, MRSAS_MFI_FRAME_SIZE);
cmd->frame->io.context = cmd->index;
cmd->frame->io.pad_0 = 0;
diff --git a/sys/dev/sfxge/common/hunt_ev.c b/sys/dev/sfxge/common/ef10_ev.c
index 1a41b49..58582b2 100644
--- a/sys/dev/sfxge/common/hunt_ev.c
+++ b/sys/dev/sfxge/common/ef10_ev.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
#include "mcdi_mon.h"
#endif
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
#if EFSYS_OPT_QSTATS
#define EFX_EV_QSTAT_INCR(_eep, _stat) \
@@ -92,8 +92,7 @@ efx_mcdi_init_evq(
__in unsigned int instance,
__in efsys_mem_t *esmp,
__in size_t nevs,
- __in uint32_t irq,
- __out_opt uint32_t *irqp)
+ __in uint32_t irq)
{
efx_mcdi_req_t req;
uint8_t payload[
@@ -175,8 +174,7 @@ efx_mcdi_init_evq(
goto fail3;
}
- if (irqp != NULL)
- *irqp = MCDI_OUT_DWORD(req, INIT_EVQ_OUT_IRQ);
+ /* NOTE: ignore the returned IRQ param as firmware does not set it. */
return (0);
@@ -209,7 +207,7 @@ efx_mcdi_fini_evq(
MCDI_IN_SET_DWORD(req, FINI_EVQ_IN_INSTANCE, instance);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -275,12 +273,14 @@ ef10_ev_qcreate(
eep->ee_drv_gen = ef10_ev_drv_gen;
eep->ee_mcdi = ef10_ev_mcdi;
+ /* Set up the event queue */
+ irq = index; /* INIT_EVQ expects function-relative vector number */
+
/*
- * Set up the event queue
- * NOTE: ignore the returned IRQ param as firmware does not set it.
+ * Interrupts may be raised for events immediately after the queue is
+ * created. See bug58606.
*/
- irq = index; /* INIT_EVQ expects function-relative vector number */
- if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq, NULL)) != 0)
+ if ((rc = efx_mcdi_init_evq(enp, index, esmp, n, irq)) != 0)
goto fail3;
return (0);
@@ -871,7 +871,9 @@ ef10_ev_mcdi(
*/
enp->en_reset_flags |= EFX_RESET_TXQ_ERR;
- EFSYS_PROBE1(tx_descq_err, uint32_t, MCDI_EV_FIELD(eqp, DATA));
+ EFSYS_PROBE2(tx_descq_err,
+ uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_1),
+ uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_0));
/* Inform the driver that a reset is required. */
eecp->eec_exception(arg, EFX_EXCEPTION_TX_ERROR,
@@ -911,7 +913,9 @@ ef10_ev_mcdi(
*/
enp->en_reset_flags |= EFX_RESET_RXQ_ERR;
- EFSYS_PROBE1(rx_descq_err, uint32_t, MCDI_EV_FIELD(eqp, DATA));
+ EFSYS_PROBE2(rx_descq_err,
+ uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_1),
+ uint32_t, EFX_QWORD_FIELD(*eqp, EFX_DWORD_0));
/* Inform the driver that a reset is required. */
eecp->eec_exception(arg, EFX_EXCEPTION_RX_ERROR,
@@ -985,4 +989,4 @@ ef10_ev_rxlabel_fini(
eersp->eers_rx_mask = 0;
}
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_filter.c b/sys/dev/sfxge/common/ef10_filter.c
index eaa0720..505e386 100644
--- a/sys/dev/sfxge/common/hunt_filter.c
+++ b/sys/dev/sfxge/common/ef10_filter.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
#if EFSYS_OPT_FILTER
@@ -353,7 +353,7 @@ efx_mcdi_filter_op_delete(
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, handle->efh_lo);
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, handle->efh_hi);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -970,7 +970,7 @@ ef10_filter_supported_filters(
{
efx_rc_t rc;
- if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length) != 0))
+ if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length)) != 0)
goto fail1;
return (0);
@@ -982,19 +982,15 @@ fail1:
}
static __checkReturn efx_rc_t
-ef10_filter_unicast_refresh(
+ef10_filter_insert_unicast(
__in efx_nic_t *enp,
__in_ecount(6) uint8_t const *addr,
- __in boolean_t all_unicst,
__in efx_filter_flag_t filter_flags)
{
ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t spec;
efx_rc_t rc;
- if (all_unicst == B_TRUE)
- goto use_uc_def;
-
/* Insert the filter for the local station address */
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
@@ -1002,77 +998,82 @@ ef10_filter_unicast_refresh(
efx_filter_spec_set_eth_local(&spec, EFX_FILTER_SPEC_VID_UNSPEC, addr);
rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
- &eftp->eft_unicst_filter_index);
- if (rc != 0) {
- /*
- * Fall back to an unknown filter. We may be able to subscribe
- * to it even if we couldn't insert the unicast filter.
- */
- goto use_uc_def;
- }
- eftp->eft_unicst_filter_set = B_TRUE;
+ &eftp->eft_unicst_filter_indexes[eftp->eft_unicst_filter_count]);
+ if (rc != 0)
+ goto fail1;
+
+ eftp->eft_unicst_filter_count++;
+ EFSYS_ASSERT(eftp->eft_unicst_filter_count <=
+ EFX_EF10_FILTER_UNICAST_FILTERS_MAX);
return (0);
-use_uc_def:
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+ef10_filter_insert_all_unicast(
+ __in efx_nic_t *enp,
+ __in efx_filter_flag_t filter_flags)
+{
+ ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
+ efx_filter_spec_t spec;
+ efx_rc_t rc;
+
/* Insert the unknown unicast filter */
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
eftp->eft_default_rxq);
efx_filter_spec_set_uc_def(&spec);
rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
- &eftp->eft_unicst_filter_index);
+ &eftp->eft_unicst_filter_indexes[eftp->eft_unicst_filter_count]);
if (rc != 0)
goto fail1;
- eftp->eft_unicst_filter_set = B_TRUE;
+ eftp->eft_unicst_filter_count++;
+ EFSYS_ASSERT(eftp->eft_unicst_filter_count <=
+ EFX_EF10_FILTER_UNICAST_FILTERS_MAX);
return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- if (eftp->eft_unicst_filter_set != B_FALSE) {
- (void) ef10_filter_delete_internal(enp,
- eftp->eft_unicst_filter_index);
-
- eftp->eft_unicst_filter_set = B_FALSE;
- }
-
return (rc);
}
static __checkReturn efx_rc_t
-ef10_filter_multicast_refresh(
+ef10_filter_insert_multicast_list(
__in efx_nic_t *enp,
__in boolean_t mulcst,
- __in boolean_t all_mulcst,
__in boolean_t brdcst,
__in_ecount(6*count) uint8_t const *addrs,
- __in int count,
- __in efx_filter_flag_t filter_flags)
+ __in uint32_t count,
+ __in efx_filter_flag_t filter_flags,
+ __in boolean_t rollback)
{
ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t spec;
uint8_t addr[6];
- unsigned i;
+ uint32_t i;
+ uint32_t filter_index;
+ uint32_t filter_count;
efx_rc_t rc;
- if (all_mulcst == B_TRUE)
- goto use_mc_def;
-
if (mulcst == B_FALSE)
count = 0;
if (count + (brdcst ? 1 : 0) >
EFX_ARRAY_SIZE(eftp->eft_mulcst_filter_indexes)) {
- /* Too many MAC addresses; use unknown multicast filter */
- goto use_mc_def;
+ /* Too many MAC addresses */
+ rc = EINVAL;
+ goto fail1;
}
/* Insert/renew multicast address list filters */
- eftp->eft_mulcst_filter_count = count;
- for (i = 0; i < eftp->eft_mulcst_filter_count; i++) {
+ filter_count = 0;
+ for (i = 0; i < count; i++) {
efx_filter_spec_init_rx(&spec,
EFX_FILTER_PRI_AUTO,
filter_flags,
@@ -1083,16 +1084,21 @@ ef10_filter_multicast_refresh(
&addrs[i * EFX_MAC_ADDR_LEN]);
rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
- &eftp->eft_mulcst_filter_indexes[i]);
- if (rc != 0) {
- /* Rollback, then use unknown multicast filter */
+ &filter_index);
+
+ if (rc == 0) {
+ eftp->eft_mulcst_filter_indexes[filter_count] =
+ filter_index;
+ filter_count++;
+ } else if (rollback == B_TRUE) {
+ /* Only stop upon failure if told to rollback */
goto rollback;
}
+
}
if (brdcst == B_TRUE) {
/* Insert/renew broadcast address filter */
- eftp->eft_mulcst_filter_count++;
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
eftp->eft_default_rxq);
@@ -1102,28 +1108,47 @@ ef10_filter_multicast_refresh(
addr);
rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
- &eftp->eft_mulcst_filter_indexes[
- eftp->eft_mulcst_filter_count - 1]);
- if (rc != 0) {
- /* Rollback, then use unknown multicast filter */
+ &filter_index);
+
+ if (rc == 0) {
+ eftp->eft_mulcst_filter_indexes[filter_count] =
+ filter_index;
+ filter_count++;
+ } else if (rollback == B_TRUE) {
+ /* Only stop upon failure if told to rollback */
goto rollback;
}
}
+ eftp->eft_mulcst_filter_count = filter_count;
+ eftp->eft_using_all_mulcst = B_FALSE;
+
return (0);
rollback:
- /*
- * Rollback by removing any filters we have inserted
- * before inserting the unknown multicast filter.
- */
+ /* Remove any filters we have inserted */
+ i = filter_count;
while (i--) {
(void) ef10_filter_delete_internal(enp,
eftp->eft_mulcst_filter_indexes[i]);
}
eftp->eft_mulcst_filter_count = 0;
-use_mc_def:
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+ef10_filter_insert_all_multicast(
+ __in efx_nic_t *enp,
+ __in efx_filter_flag_t filter_flags)
+{
+ ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
+ efx_filter_spec_t spec;
+ efx_rc_t rc;
+
/* Insert the unknown multicast filter */
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
@@ -1136,6 +1161,7 @@ use_mc_def:
goto fail1;
eftp->eft_mulcst_filter_count = 1;
+ eftp->eft_using_all_mulcst = B_TRUE;
/*
* FIXME: If brdcst == B_FALSE, add a filter to drop broadcast traffic.
@@ -1147,12 +1173,25 @@ fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
+}
+
+static void
+ef10_filter_remove_old(
+ __in efx_nic_t *enp)
+{
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
+ uint32_t i;
+ for (i = 0; i < EFX_ARRAY_SIZE(table->eft_entry); i++) {
+ if (ef10_filter_entry_is_auto_old(table, i)) {
+ (void) ef10_filter_delete_internal(enp, i);
+ }
+ }
}
static __checkReturn efx_rc_t
-hunt_filter_get_workarounds(
+ef10_filter_get_workarounds(
__in efx_nic_t *enp)
{
efx_nic_cfg_t *encp = &enp->en_nic_cfg;
@@ -1202,13 +1241,14 @@ ef10_filter_reconfigure(
__in boolean_t all_mulcst,
__in boolean_t brdcst,
__in_ecount(6*count) uint8_t const *addrs,
- __in int count)
+ __in uint32_t count)
{
+ efx_nic_cfg_t *encp = &enp->en_nic_cfg;
ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
efx_filter_flag_t filter_flags;
unsigned i;
- int all_unicst_rc;
- int all_mulcst_rc;
+ efx_rc_t all_unicst_rc = 0;
+ efx_rc_t all_mulcst_rc = 0;
efx_rc_t rc;
if (table->eft_default_rxq == NULL) {
@@ -1218,11 +1258,12 @@ ef10_filter_reconfigure(
* filters must be removed (ignore errors in case the MC
* has rebooted, which removes hardware filters).
*/
- if (table->eft_unicst_filter_set != B_FALSE) {
+ for (i = 0; i < table->eft_unicst_filter_count; i++) {
(void) ef10_filter_delete_internal(enp,
- table->eft_unicst_filter_index);
- table->eft_unicst_filter_set = B_FALSE;
+ table->eft_unicst_filter_indexes[i]);
}
+ table->eft_unicst_filter_count = 0;
+
for (i = 0; i < table->eft_mulcst_filter_count; i++) {
(void) ef10_filter_delete_internal(enp,
table->eft_mulcst_filter_indexes[i]);
@@ -1238,27 +1279,39 @@ ef10_filter_reconfigure(
filter_flags = 0;
/* Mark old filters which may need to be removed */
- if (table->eft_unicst_filter_set != B_FALSE) {
+ for (i = 0; i < table->eft_unicst_filter_count; i++) {
ef10_filter_set_entry_auto_old(table,
- table->eft_unicst_filter_index);
+ table->eft_unicst_filter_indexes[i]);
}
for (i = 0; i < table->eft_mulcst_filter_count; i++) {
ef10_filter_set_entry_auto_old(table,
table->eft_mulcst_filter_indexes[i]);
}
- /* Insert or renew unicast filters */
- if ((all_unicst_rc = ef10_filter_unicast_refresh(enp, mac_addr,
- all_unicst, filter_flags)) != 0) {
- if (all_unicst == B_FALSE) {
- rc = all_unicst_rc;
+ /*
+ * Insert or renew unicast filters.
+ *
+ * Frimware does not perform chaining on unicast filters. As traffic is
+ * therefore only delivered to the first matching filter, we should
+ * always insert the specific filter for our MAC address, to try and
+ * ensure we get that traffic.
+ *
+ * (If the filter for our MAC address has already been inserted by
+ * another function, we won't receive traffic sent to us, even if we
+ * insert a unicast mismatch filter. To prevent traffic stealing, this
+ * therefore relies on the privilege model only allowing functions to
+ * insert filters for their own MAC address unless explicitly given
+ * additional privileges by the user. This also means that, even on a
+ * priviliged function, inserting a unicast mismatch filter may not
+ * catch all traffic in multi PCI function scenarios.)
+ */
+ table->eft_unicst_filter_count = 0;
+ rc = ef10_filter_insert_unicast(enp, mac_addr, filter_flags);
+ if (all_unicst || (rc != 0)) {
+ all_unicst_rc = ef10_filter_insert_all_unicast(enp,
+ filter_flags);
+ if ((rc != 0) && (all_unicst_rc != 0))
goto fail1;
- }
- /* Retry without all_unicast flag */
- rc = ef10_filter_unicast_refresh(enp, mac_addr,
- B_FALSE, filter_flags);
- if (rc != 0)
- goto fail2;
}
/*
@@ -1266,43 +1319,94 @@ ef10_filter_reconfigure(
* filters, and can only be enabled or disabled when the hardware filter
* table is empty.
*
+ * Chained multicast filters require support from the datapath firmware,
+ * and may not be available (e.g. low-latency variants or old Huntington
+ * firmware).
+ *
* Firmware will reset (FLR) functions which have inserted filters in
* the hardware filter table when the workaround is enabled/disabled.
* Functions without any hardware filters are not reset.
*
* Re-check if the workaround is enabled after adding unicast hardware
- * filters. This ensures that encp->enc_workaround_bug26807 matches the
+ * filters. This ensures that encp->enc_bug26807_workaround matches the
* firmware state, and that later changes to enable/disable the
* workaround will result in this function seeing a reset (FLR).
*
- * FIXME: On Medford mulicast chaining should always be on.
+ * In common-code drivers, we only support multiple PCI function
+ * scenarios with firmware that supports multicast chaining, so we can
+ * assume it is enabled for such cases and hence simplify the filter
+ * insertion logic. Firmware that does not support multicast chaining
+ * does not support multiple PCI function configurations either, so
+ * filter insertion is much simpler and the same strategies can still be
+ * used.
*/
- if ((rc = hunt_filter_get_workarounds(enp)) != 0)
- goto fail3;
+ if ((rc = ef10_filter_get_workarounds(enp)) != 0)
+ goto fail2;
+
+ if ((table->eft_using_all_mulcst != all_mulcst) &&
+ (encp->enc_bug26807_workaround == B_TRUE)) {
+ /*
+ * Multicast filter chaining is enabled, so traffic that matches
+ * more than one multicast filter will be replicated and
+ * delivered to multiple recipients. To avoid this duplicate
+ * delivery, remove old multicast filters before inserting new
+ * multicast filters.
+ */
+ ef10_filter_remove_old(enp);
+ }
/* Insert or renew multicast filters */
- if ((all_mulcst_rc = ef10_filter_multicast_refresh(enp, mulcst,
- all_mulcst, brdcst,
- addrs, count, filter_flags)) != 0) {
- if (all_mulcst == B_FALSE) {
- rc = all_mulcst_rc;
- goto fail4;
+ if (all_mulcst == B_TRUE) {
+ /*
+ * Insert the all multicast filter. If that fails, try to insert
+ * all of our multicast filters (but without rollback on
+ * failure).
+ */
+ all_mulcst_rc = ef10_filter_insert_all_multicast(enp,
+ filter_flags);
+ if (all_mulcst_rc != 0) {
+ rc = ef10_filter_insert_multicast_list(enp, B_TRUE,
+ brdcst, addrs, count, filter_flags, B_FALSE);
+ if (rc != 0)
+ goto fail3;
}
- /* Retry without all_mulcast flag */
- rc = ef10_filter_multicast_refresh(enp, mulcst,
- B_FALSE, brdcst,
- addrs, count, filter_flags);
- if (rc != 0)
- goto fail5;
- }
+ } else {
+ /*
+ * Insert filters for multicast addresses.
+ * If any insertion fails, then rollback and try to insert the
+ * all multicast filter instead.
+ * If that also fails, try to insert all of the multicast
+ * filters (but without rollback on failure).
+ */
+ rc = ef10_filter_insert_multicast_list(enp, mulcst, brdcst,
+ addrs, count, filter_flags, B_TRUE);
+ if (rc != 0) {
+ if ((table->eft_using_all_mulcst == B_FALSE) &&
+ (encp->enc_bug26807_workaround == B_TRUE)) {
+ /*
+ * Multicast filter chaining is on, so remove
+ * old filters before inserting the multicast
+ * all filter to avoid duplicate delivery caused
+ * by packets matching multiple filters.
+ */
+ ef10_filter_remove_old(enp);
+ }
- /* Remove old filters which were not renewed */
- for (i = 0; i < EFX_ARRAY_SIZE(table->eft_entry); i++) {
- if (ef10_filter_entry_is_auto_old(table, i)) {
- (void) ef10_filter_delete_internal(enp, i);
+ rc = ef10_filter_insert_all_multicast(enp,
+ filter_flags);
+ if (rc != 0) {
+ rc = ef10_filter_insert_multicast_list(enp,
+ mulcst, brdcst,
+ addrs, count, filter_flags, B_FALSE);
+ if (rc != 0)
+ goto fail4;
+ }
}
}
+ /* Remove old filters which were not renewed */
+ ef10_filter_remove_old(enp);
+
/* report if any optional flags were rejected */
if (((all_unicst != B_FALSE) && (all_unicst_rc != 0)) ||
((all_mulcst != B_FALSE) && (all_mulcst_rc != 0))) {
@@ -1311,8 +1415,6 @@ ef10_filter_reconfigure(
return (rc);
-fail5:
- EFSYS_PROBE(fail5);
fail4:
EFSYS_PROBE(fail4);
fail3:
@@ -1377,4 +1479,4 @@ ef10_filter_default_rxq_clear(
#endif /* EFSYS_OPT_FILTER */
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/ef10_impl.h b/sys/dev/sfxge/common/ef10_impl.h
index 0c687ae..3b850d2 100644
--- a/sys/dev/sfxge/common/ef10_impl.h
+++ b/sys/dev/sfxge/common/ef10_impl.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Solarflare Communications Inc.
+ * Copyright (c) 2015-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -45,6 +45,993 @@ extern "C" {
#define EF10_MAX_PIOBUF_NBUFS MEDFORD_PIOBUF_NBUFS
#endif
+/*
+ * FIXME: This is just a power of 2 which fits in an MCDI v1 message, and could
+ * possibly be increased, or the write size reported by newer firmware used
+ * instead.
+ */
+#define EF10_NVRAM_CHUNK 0x80
+
+/* Alignment requirement for value written to RX WPTR:
+ * the WPTR must be aligned to an 8 descriptor boundary
+ */
+#define EF10_RX_WPTR_ALIGN 8
+
+/*
+ * Max byte offset into the packet the TCP header must start for the hardware
+ * to be able to parse the packet correctly.
+ */
+#define EF10_TCP_HEADER_OFFSET_LIMIT 208
+
+/* Invalid RSS context handle */
+#define EF10_RSS_CONTEXT_INVALID (0xffffffff)
+
+
+/* EV */
+
+ __checkReturn efx_rc_t
+ef10_ev_init(
+ __in efx_nic_t *enp);
+
+ void
+ef10_ev_fini(
+ __in efx_nic_t *enp);
+
+ __checkReturn efx_rc_t
+ef10_ev_qcreate(
+ __in efx_nic_t *enp,
+ __in unsigned int index,
+ __in efsys_mem_t *esmp,
+ __in size_t n,
+ __in uint32_t id,
+ __in efx_evq_t *eep);
+
+ void
+ef10_ev_qdestroy(
+ __in efx_evq_t *eep);
+
+ __checkReturn efx_rc_t
+ef10_ev_qprime(
+ __in efx_evq_t *eep,
+ __in unsigned int count);
+
+ void
+ef10_ev_qpost(
+ __in efx_evq_t *eep,
+ __in uint16_t data);
+
+ __checkReturn efx_rc_t
+ef10_ev_qmoderate(
+ __in efx_evq_t *eep,
+ __in unsigned int us);
+
+#if EFSYS_OPT_QSTATS
+ void
+ef10_ev_qstats_update(
+ __in efx_evq_t *eep,
+ __inout_ecount(EV_NQSTATS) efsys_stat_t *stat);
+#endif /* EFSYS_OPT_QSTATS */
+
+ void
+ef10_ev_rxlabel_init(
+ __in efx_evq_t *eep,
+ __in efx_rxq_t *erp,
+ __in unsigned int label);
+
+ void
+ef10_ev_rxlabel_fini(
+ __in efx_evq_t *eep,
+ __in unsigned int label);
+
+/* INTR */
+
+ __checkReturn efx_rc_t
+ef10_intr_init(
+ __in efx_nic_t *enp,
+ __in efx_intr_type_t type,
+ __in efsys_mem_t *esmp);
+
+ void
+ef10_intr_enable(
+ __in efx_nic_t *enp);
+
+ void
+ef10_intr_disable(
+ __in efx_nic_t *enp);
+
+ void
+ef10_intr_disable_unlocked(
+ __in efx_nic_t *enp);
+
+ __checkReturn efx_rc_t
+ef10_intr_trigger(
+ __in efx_nic_t *enp,
+ __in unsigned int level);
+
+ void
+ef10_intr_status_line(
+ __in efx_nic_t *enp,
+ __out boolean_t *fatalp,
+ __out uint32_t *qmaskp);
+
+ void
+ef10_intr_status_message(
+ __in efx_nic_t *enp,
+ __in unsigned int message,
+ __out boolean_t *fatalp);
+
+ void
+ef10_intr_fatal(
+ __in efx_nic_t *enp);
+ void
+ef10_intr_fini(
+ __in efx_nic_t *enp);
+
+/* NIC */
+
+extern __checkReturn efx_rc_t
+ef10_nic_probe(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_nic_set_drv_limits(
+ __inout efx_nic_t *enp,
+ __in efx_drv_limits_t *edlp);
+
+extern __checkReturn efx_rc_t
+ef10_nic_get_vi_pool(
+ __in efx_nic_t *enp,
+ __out uint32_t *vi_countp);
+
+extern __checkReturn efx_rc_t
+ef10_nic_get_bar_region(
+ __in efx_nic_t *enp,
+ __in efx_nic_region_t region,
+ __out uint32_t *offsetp,
+ __out size_t *sizep);
+
+extern __checkReturn efx_rc_t
+ef10_nic_reset(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_nic_init(
+ __in efx_nic_t *enp);
+
+#if EFSYS_OPT_DIAG
+
+extern __checkReturn efx_rc_t
+ef10_nic_register_test(
+ __in efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_DIAG */
+
+extern void
+ef10_nic_fini(
+ __in efx_nic_t *enp);
+
+extern void
+ef10_nic_unprobe(
+ __in efx_nic_t *enp);
+
+
+/* MAC */
+
+extern __checkReturn efx_rc_t
+ef10_mac_poll(
+ __in efx_nic_t *enp,
+ __out efx_link_mode_t *link_modep);
+
+extern __checkReturn efx_rc_t
+ef10_mac_up(
+ __in efx_nic_t *enp,
+ __out boolean_t *mac_upp);
+
+extern __checkReturn efx_rc_t
+ef10_mac_addr_set(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_mac_pdu_set(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_mac_pdu_get(
+ __in efx_nic_t *enp,
+ __out size_t *pdu);
+
+extern __checkReturn efx_rc_t
+ef10_mac_reconfigure(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_mac_multicast_list_set(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_mac_filter_default_rxq_set(
+ __in efx_nic_t *enp,
+ __in efx_rxq_t *erp,
+ __in boolean_t using_rss);
+
+extern void
+ef10_mac_filter_default_rxq_clear(
+ __in efx_nic_t *enp);
+
+#if EFSYS_OPT_LOOPBACK
+
+extern __checkReturn efx_rc_t
+ef10_mac_loopback_set(
+ __in efx_nic_t *enp,
+ __in efx_link_mode_t link_mode,
+ __in efx_loopback_type_t loopback_type);
+
+#endif /* EFSYS_OPT_LOOPBACK */
+
+#if EFSYS_OPT_MAC_STATS
+
+extern __checkReturn efx_rc_t
+ef10_mac_stats_update(
+ __in efx_nic_t *enp,
+ __in efsys_mem_t *esmp,
+ __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat,
+ __inout_opt uint32_t *generationp);
+
+#endif /* EFSYS_OPT_MAC_STATS */
+
+
+/* MCDI */
+
+#if EFSYS_OPT_MCDI
+
+extern __checkReturn efx_rc_t
+ef10_mcdi_init(
+ __in efx_nic_t *enp,
+ __in const efx_mcdi_transport_t *mtp);
+
+extern void
+ef10_mcdi_fini(
+ __in efx_nic_t *enp);
+
+extern void
+ef10_mcdi_send_request(
+ __in efx_nic_t *enp,
+ __in void *hdrp,
+ __in size_t hdr_len,
+ __in void *sdup,
+ __in size_t sdu_len);
+
+extern __checkReturn boolean_t
+ef10_mcdi_poll_response(
+ __in efx_nic_t *enp);
+
+extern void
+ef10_mcdi_read_response(
+ __in efx_nic_t *enp,
+ __out_bcount(length) void *bufferp,
+ __in size_t offset,
+ __in size_t length);
+
+extern efx_rc_t
+ef10_mcdi_poll_reboot(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_mcdi_feature_supported(
+ __in efx_nic_t *enp,
+ __in efx_mcdi_feature_id_t id,
+ __out boolean_t *supportedp);
+
+#endif /* EFSYS_OPT_MCDI */
+
+/* NVRAM */
+
+#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buf_read_tlv(
+ __in efx_nic_t *enp,
+ __in_bcount(max_seg_size) caddr_t seg_data,
+ __in size_t max_seg_size,
+ __in uint32_t tag,
+ __deref_out_bcount_opt(*sizep) caddr_t *datap,
+ __out size_t *sizep);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buf_write_tlv(
+ __inout_bcount(partn_size) caddr_t partn_data,
+ __in size_t partn_size,
+ __in uint32_t tag,
+ __in_bcount(tag_size) caddr_t tag_data,
+ __in size_t tag_size,
+ __out size_t *total_lengthp);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_read_tlv(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in uint32_t tag,
+ __deref_out_bcount_opt(*sizep) caddr_t *datap,
+ __out size_t *sizep);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_write_tlv(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in uint32_t tag,
+ __in_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_write_segment_tlv(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in uint32_t tag,
+ __in_bcount(size) caddr_t data,
+ __in size_t size,
+ __in boolean_t all_segments);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_lock(
+ __in efx_nic_t *enp,
+ __in uint32_t partn);
+
+extern void
+ef10_nvram_partn_unlock(
+ __in efx_nic_t *enp,
+ __in uint32_t partn);
+
+#endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
+
+#if EFSYS_OPT_NVRAM
+
+#if EFSYS_OPT_DIAG
+
+extern __checkReturn efx_rc_t
+ef10_nvram_test(
+ __in efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_DIAG */
+
+extern __checkReturn efx_rc_t
+ef10_nvram_type_to_partn(
+ __in efx_nic_t *enp,
+ __in efx_nvram_type_t type,
+ __out uint32_t *partnp);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_size(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __out size_t *sizep);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_rw_start(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __out size_t *chunk_sizep);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_read_mode(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in unsigned int offset,
+ __out_bcount(size) caddr_t data,
+ __in size_t size,
+ __in uint32_t mode);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_read(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in unsigned int offset,
+ __out_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_erase(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in unsigned int offset,
+ __in size_t size);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_write(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in unsigned int offset,
+ __out_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern void
+ef10_nvram_partn_rw_finish(
+ __in efx_nic_t *enp,
+ __in uint32_t partn);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_get_version(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __out uint32_t *subtypep,
+ __out_ecount(4) uint16_t version[4]);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_set_version(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in_ecount(4) uint16_t version[4]);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_validate(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_create(
+ __in efx_nic_t *enp,
+ __in uint16_t partn_type,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size);
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_find_item_start(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ );
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_find_end(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ );
+
+extern __checkReturn __success(return != B_FALSE) boolean_t
+ef10_nvram_buffer_find_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ );
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_get_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(item_max_size, *lengthp)
+ caddr_t itemp,
+ __in size_t item_max_size,
+ __out uint32_t *lengthp
+ );
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_insert_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ );
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_delete_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end
+ );
+
+extern __checkReturn efx_rc_t
+ef10_nvram_buffer_finish(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
+#endif /* EFSYS_OPT_NVRAM */
+
+
+/* PHY */
+
+typedef struct ef10_link_state_s {
+ uint32_t els_adv_cap_mask;
+ uint32_t els_lp_cap_mask;
+ unsigned int els_fcntl;
+ efx_link_mode_t els_link_mode;
+#if EFSYS_OPT_LOOPBACK
+ efx_loopback_type_t els_loopback;
+#endif
+ boolean_t els_mac_up;
+} ef10_link_state_t;
+
+extern void
+ef10_phy_link_ev(
+ __in efx_nic_t *enp,
+ __in efx_qword_t *eqp,
+ __out efx_link_mode_t *link_modep);
+
+extern __checkReturn efx_rc_t
+ef10_phy_get_link(
+ __in efx_nic_t *enp,
+ __out ef10_link_state_t *elsp);
+
+extern __checkReturn efx_rc_t
+ef10_phy_power(
+ __in efx_nic_t *enp,
+ __in boolean_t on);
+
+extern __checkReturn efx_rc_t
+ef10_phy_reconfigure(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_phy_verify(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_phy_oui_get(
+ __in efx_nic_t *enp,
+ __out uint32_t *ouip);
+
+#if EFSYS_OPT_PHY_STATS
+
+extern __checkReturn efx_rc_t
+ef10_phy_stats_update(
+ __in efx_nic_t *enp,
+ __in efsys_mem_t *esmp,
+ __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat);
+
+#endif /* EFSYS_OPT_PHY_STATS */
+
+
+/* TX */
+
+extern __checkReturn efx_rc_t
+ef10_tx_init(
+ __in efx_nic_t *enp);
+
+extern void
+ef10_tx_fini(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qcreate(
+ __in efx_nic_t *enp,
+ __in unsigned int index,
+ __in unsigned int label,
+ __in efsys_mem_t *esmp,
+ __in size_t n,
+ __in uint32_t id,
+ __in uint16_t flags,
+ __in efx_evq_t *eep,
+ __in efx_txq_t *etp,
+ __out unsigned int *addedp);
+
+extern void
+ef10_tx_qdestroy(
+ __in efx_txq_t *etp);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qpost(
+ __in efx_txq_t *etp,
+ __in_ecount(n) efx_buffer_t *eb,
+ __in unsigned int n,
+ __in unsigned int completed,
+ __inout unsigned int *addedp);
+
+extern void
+ef10_tx_qpush(
+ __in efx_txq_t *etp,
+ __in unsigned int added,
+ __in unsigned int pushed);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qpace(
+ __in efx_txq_t *etp,
+ __in unsigned int ns);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qflush(
+ __in efx_txq_t *etp);
+
+extern void
+ef10_tx_qenable(
+ __in efx_txq_t *etp);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qpio_enable(
+ __in efx_txq_t *etp);
+
+extern void
+ef10_tx_qpio_disable(
+ __in efx_txq_t *etp);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qpio_write(
+ __in efx_txq_t *etp,
+ __in_ecount(buf_length) uint8_t *buffer,
+ __in size_t buf_length,
+ __in size_t pio_buf_offset);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qpio_post(
+ __in efx_txq_t *etp,
+ __in size_t pkt_length,
+ __in unsigned int completed,
+ __inout unsigned int *addedp);
+
+extern __checkReturn efx_rc_t
+ef10_tx_qdesc_post(
+ __in efx_txq_t *etp,
+ __in_ecount(n) efx_desc_t *ed,
+ __in unsigned int n,
+ __in unsigned int completed,
+ __inout unsigned int *addedp);
+
+extern void
+ef10_tx_qdesc_dma_create(
+ __in efx_txq_t *etp,
+ __in efsys_dma_addr_t addr,
+ __in size_t size,
+ __in boolean_t eop,
+ __out efx_desc_t *edp);
+
+extern void
+ef10_tx_qdesc_tso_create(
+ __in efx_txq_t *etp,
+ __in uint16_t ipv4_id,
+ __in uint32_t tcp_seq,
+ __in uint8_t tcp_flags,
+ __out efx_desc_t *edp);
+
+extern void
+ef10_tx_qdesc_tso2_create(
+ __in efx_txq_t *etp,
+ __in uint16_t ipv4_id,
+ __in uint32_t tcp_seq,
+ __in uint16_t tcp_mss,
+ __out_ecount(count) efx_desc_t *edp,
+ __in int count);
+
+extern void
+ef10_tx_qdesc_vlantci_create(
+ __in efx_txq_t *etp,
+ __in uint16_t vlan_tci,
+ __out efx_desc_t *edp);
+
+
+#if EFSYS_OPT_QSTATS
+
+extern void
+ef10_tx_qstats_update(
+ __in efx_txq_t *etp,
+ __inout_ecount(TX_NQSTATS) efsys_stat_t *stat);
+
+#endif /* EFSYS_OPT_QSTATS */
+
+typedef uint32_t efx_piobuf_handle_t;
+
+#define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1)
+
+extern __checkReturn efx_rc_t
+ef10_nic_pio_alloc(
+ __inout efx_nic_t *enp,
+ __out uint32_t *bufnump,
+ __out efx_piobuf_handle_t *handlep,
+ __out uint32_t *blknump,
+ __out uint32_t *offsetp,
+ __out size_t *sizep);
+
+extern __checkReturn efx_rc_t
+ef10_nic_pio_free(
+ __inout efx_nic_t *enp,
+ __in uint32_t bufnum,
+ __in uint32_t blknum);
+
+extern __checkReturn efx_rc_t
+ef10_nic_pio_link(
+ __inout efx_nic_t *enp,
+ __in uint32_t vi_index,
+ __in efx_piobuf_handle_t handle);
+
+extern __checkReturn efx_rc_t
+ef10_nic_pio_unlink(
+ __inout efx_nic_t *enp,
+ __in uint32_t vi_index);
+
+
+/* VPD */
+
+#if EFSYS_OPT_VPD
+
+extern __checkReturn efx_rc_t
+ef10_vpd_init(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_size(
+ __in efx_nic_t *enp,
+ __out size_t *sizep);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_read(
+ __in efx_nic_t *enp,
+ __out_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_verify(
+ __in efx_nic_t *enp,
+ __in_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_reinit(
+ __in efx_nic_t *enp,
+ __in_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_get(
+ __in efx_nic_t *enp,
+ __in_bcount(size) caddr_t data,
+ __in size_t size,
+ __inout efx_vpd_value_t *evvp);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_set(
+ __in efx_nic_t *enp,
+ __in_bcount(size) caddr_t data,
+ __in size_t size,
+ __in efx_vpd_value_t *evvp);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_next(
+ __in efx_nic_t *enp,
+ __in_bcount(size) caddr_t data,
+ __in size_t size,
+ __out efx_vpd_value_t *evvp,
+ __inout unsigned int *contp);
+
+extern __checkReturn efx_rc_t
+ef10_vpd_write(
+ __in efx_nic_t *enp,
+ __in_bcount(size) caddr_t data,
+ __in size_t size);
+
+extern void
+ef10_vpd_fini(
+ __in efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_VPD */
+
+
+/* RX */
+
+extern __checkReturn efx_rc_t
+ef10_rx_init(
+ __in efx_nic_t *enp);
+
+#if EFSYS_OPT_RX_SCATTER
+extern __checkReturn efx_rc_t
+ef10_rx_scatter_enable(
+ __in efx_nic_t *enp,
+ __in unsigned int buf_size);
+#endif /* EFSYS_OPT_RX_SCATTER */
+
+
+#if EFSYS_OPT_RX_SCALE
+
+extern __checkReturn efx_rc_t
+ef10_rx_scale_mode_set(
+ __in efx_nic_t *enp,
+ __in efx_rx_hash_alg_t alg,
+ __in efx_rx_hash_type_t type,
+ __in boolean_t insert);
+
+extern __checkReturn efx_rc_t
+ef10_rx_scale_key_set(
+ __in efx_nic_t *enp,
+ __in_ecount(n) uint8_t *key,
+ __in size_t n);
+
+extern __checkReturn efx_rc_t
+ef10_rx_scale_tbl_set(
+ __in efx_nic_t *enp,
+ __in_ecount(n) unsigned int *table,
+ __in size_t n);
+
+extern __checkReturn uint32_t
+ef10_rx_prefix_hash(
+ __in efx_nic_t *enp,
+ __in efx_rx_hash_alg_t func,
+ __in uint8_t *buffer);
+
+#endif /* EFSYS_OPT_RX_SCALE */
+
+extern __checkReturn efx_rc_t
+ef10_rx_prefix_pktlen(
+ __in efx_nic_t *enp,
+ __in uint8_t *buffer,
+ __out uint16_t *lengthp);
+
+extern void
+ef10_rx_qpost(
+ __in efx_rxq_t *erp,
+ __in_ecount(n) efsys_dma_addr_t *addrp,
+ __in size_t size,
+ __in unsigned int n,
+ __in unsigned int completed,
+ __in unsigned int added);
+
+extern void
+ef10_rx_qpush(
+ __in efx_rxq_t *erp,
+ __in unsigned int added,
+ __inout unsigned int *pushedp);
+
+extern __checkReturn efx_rc_t
+ef10_rx_qflush(
+ __in efx_rxq_t *erp);
+
+extern void
+ef10_rx_qenable(
+ __in efx_rxq_t *erp);
+
+extern __checkReturn efx_rc_t
+ef10_rx_qcreate(
+ __in efx_nic_t *enp,
+ __in unsigned int index,
+ __in unsigned int label,
+ __in efx_rxq_type_t type,
+ __in efsys_mem_t *esmp,
+ __in size_t n,
+ __in uint32_t id,
+ __in efx_evq_t *eep,
+ __in efx_rxq_t *erp);
+
+extern void
+ef10_rx_qdestroy(
+ __in efx_rxq_t *erp);
+
+extern void
+ef10_rx_fini(
+ __in efx_nic_t *enp);
+
+#if EFSYS_OPT_FILTER
+
+typedef struct ef10_filter_handle_s {
+ uint32_t efh_lo;
+ uint32_t efh_hi;
+} ef10_filter_handle_t;
+
+typedef struct ef10_filter_entry_s {
+ uintptr_t efe_spec; /* pointer to filter spec plus busy bit */
+ ef10_filter_handle_t efe_handle;
+} ef10_filter_entry_t;
+
+/*
+ * BUSY flag indicates that an update is in progress.
+ * AUTO_OLD flag is used to mark and sweep MAC packet filters.
+ */
+#define EFX_EF10_FILTER_FLAG_BUSY 1U
+#define EFX_EF10_FILTER_FLAG_AUTO_OLD 2U
+#define EFX_EF10_FILTER_FLAGS 3U
+
+/*
+ * Size of the hash table used by the driver. Doesn't need to be the
+ * same size as the hardware's table.
+ */
+#define EFX_EF10_FILTER_TBL_ROWS 8192
+
+/* Only need to allow for one directed and one unknown unicast filter */
+#define EFX_EF10_FILTER_UNICAST_FILTERS_MAX 2
+
+/* Allow for the broadcast address to be added to the multicast list */
+#define EFX_EF10_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1)
+
+typedef struct ef10_filter_table_s {
+ ef10_filter_entry_t eft_entry[EFX_EF10_FILTER_TBL_ROWS];
+ efx_rxq_t * eft_default_rxq;
+ boolean_t eft_using_rss;
+ uint32_t eft_unicst_filter_indexes[
+ EFX_EF10_FILTER_UNICAST_FILTERS_MAX];
+ boolean_t eft_unicst_filter_count;
+ uint32_t eft_mulcst_filter_indexes[
+ EFX_EF10_FILTER_MULTICAST_FILTERS_MAX];
+ uint32_t eft_mulcst_filter_count;
+ boolean_t eft_using_all_mulcst;
+} ef10_filter_table_t;
+
+ __checkReturn efx_rc_t
+ef10_filter_init(
+ __in efx_nic_t *enp);
+
+ void
+ef10_filter_fini(
+ __in efx_nic_t *enp);
+
+ __checkReturn efx_rc_t
+ef10_filter_restore(
+ __in efx_nic_t *enp);
+
+ __checkReturn efx_rc_t
+ef10_filter_add(
+ __in efx_nic_t *enp,
+ __inout efx_filter_spec_t *spec,
+ __in boolean_t may_replace);
+
+ __checkReturn efx_rc_t
+ef10_filter_delete(
+ __in efx_nic_t *enp,
+ __inout efx_filter_spec_t *spec);
+
+extern __checkReturn efx_rc_t
+ef10_filter_supported_filters(
+ __in efx_nic_t *enp,
+ __out uint32_t *list,
+ __out size_t *length);
+
+extern __checkReturn efx_rc_t
+ef10_filter_reconfigure(
+ __in efx_nic_t *enp,
+ __in_ecount(6) uint8_t const *mac_addr,
+ __in boolean_t all_unicst,
+ __in boolean_t mulcst,
+ __in boolean_t all_mulcst,
+ __in boolean_t brdcst,
+ __in_ecount(6*count) uint8_t const *addrs,
+ __in uint32_t count);
+
+extern void
+ef10_filter_get_default_rxq(
+ __in efx_nic_t *enp,
+ __out efx_rxq_t **erpp,
+ __out boolean_t *using_rss);
+
+extern void
+ef10_filter_default_rxq_set(
+ __in efx_nic_t *enp,
+ __in efx_rxq_t *erp,
+ __in boolean_t using_rss);
+
+extern void
+ef10_filter_default_rxq_clear(
+ __in efx_nic_t *enp);
+
+
+#endif /* EFSYS_OPT_FILTER */
+
+extern __checkReturn efx_rc_t
+efx_mcdi_get_function_info(
+ __in efx_nic_t *enp,
+ __out uint32_t *pfp,
+ __out_opt uint32_t *vfp);
+
+extern __checkReturn efx_rc_t
+efx_mcdi_privilege_mask(
+ __in efx_nic_t *enp,
+ __in uint32_t pf,
+ __in uint32_t vf,
+ __out uint32_t *maskp);
+
extern __checkReturn efx_rc_t
efx_mcdi_get_port_assignment(
__in efx_nic_t *enp,
@@ -53,7 +1040,13 @@ efx_mcdi_get_port_assignment(
extern __checkReturn efx_rc_t
efx_mcdi_get_port_modes(
__in efx_nic_t *enp,
- __out uint32_t *modesp);
+ __out uint32_t *modesp,
+ __out_opt uint32_t *current_modep);
+
+extern __checkReturn efx_rc_t
+ef10_nic_get_port_mode_bandwidth(
+ __in uint32_t port_mode,
+ __out uint32_t *bandwidth_mbpsp);
extern __checkReturn efx_rc_t
efx_mcdi_get_mac_address_pf(
@@ -68,7 +1061,9 @@ efx_mcdi_get_mac_address_vf(
extern __checkReturn efx_rc_t
efx_mcdi_get_clock(
__in efx_nic_t *enp,
- __out uint32_t *sys_freqp);
+ __out uint32_t *sys_freqp,
+ __out uint32_t *dpcpu_freqp);
+
extern __checkReturn efx_rc_t
efx_mcdi_get_vector_cfg(
diff --git a/sys/dev/sfxge/common/hunt_intr.c b/sys/dev/sfxge/common/ef10_intr.c
index 7a4293c..2bcc9fb 100644
--- a/sys/dev/sfxge/common/hunt_intr.c
+++ b/sys/dev/sfxge/common/ef10_intr.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
#include "efx_impl.h"
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
__checkReturn efx_rc_t
ef10_intr_init(
@@ -197,4 +197,4 @@ ef10_intr_fini(
_NOTE(ARGUNUSED(enp))
}
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_mac.c b/sys/dev/sfxge/common/ef10_mac.c
index a36a11a..ba80089 100644
--- a/sys/dev/sfxge/common/hunt_mac.c
+++ b/sys/dev/sfxge/common/ef10_mac.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
#include "efx_impl.h"
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
__checkReturn efx_rc_t
ef10_mac_poll(
@@ -199,6 +199,53 @@ fail1:
return (rc);
}
+static __checkReturn efx_rc_t
+efx_mcdi_mtu_get(
+ __in efx_nic_t *enp,
+ __out size_t *mtu)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_SET_MAC_EXT_IN_LEN,
+ MC_CMD_SET_MAC_V2_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_SET_MAC;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_SET_MAC_EXT_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_SET_MAC_V2_OUT_LEN;
+
+ /*
+ * With MC_CMD_SET_MAC_EXT_IN_CONTROL set to 0, this just queries the
+ * MTU. This should always be supported on Medford, but it is not
+ * supported on older Huntington firmware.
+ */
+ MCDI_IN_SET_DWORD(req, SET_MAC_EXT_IN_CONTROL, 0);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+ if (req.emr_out_length_used < MC_CMD_SET_MAC_V2_OUT_MTU_OFST + 4) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ *mtu = MCDI_OUT_DWORD(req, SET_MAC_V2_OUT_MTU);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
__checkReturn efx_rc_t
ef10_mac_pdu_set(
__in efx_nic_t *enp)
@@ -230,6 +277,24 @@ fail1:
return (rc);
}
+ __checkReturn efx_rc_t
+ef10_mac_pdu_get(
+ __in efx_nic_t *enp,
+ __out size_t *pdu)
+{
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_mtu_get(enp, pdu)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
__checkReturn efx_rc_t
ef10_mac_reconfigure(
__in efx_nic_t *enp)
@@ -314,7 +379,7 @@ ef10_mac_multicast_list_set(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
@@ -390,7 +455,7 @@ ef10_mac_loopback_set(
__in efx_loopback_type_t loopback_type)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
efx_loopback_type_t old_loopback_type;
efx_link_mode_t old_loopback_link_mode;
efx_rc_t rc;
@@ -749,4 +814,4 @@ ef10_mac_stats_update(
#endif /* EFSYS_OPT_MAC_STATS */
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/ef10_mcdi.c
index f39e977..f14d35f 100644
--- a/sys/dev/sfxge/common/hunt_mcdi.c
+++ b/sys/dev/sfxge/common/ef10_mcdi.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -213,6 +213,7 @@ ef10_mcdi_poll_reboot(
* this can be handled by common code drivers (and reworked to
* support Siena too).
*/
+ _NOTE(CONSTANTCONDITION)
if (B_FALSE) {
rc = EIO;
goto fail1;
@@ -287,7 +288,6 @@ ef10_mcdi_feature_supported(
default:
rc = ENOTSUP;
goto fail1;
- break;
}
return (0);
diff --git a/sys/dev/sfxge/common/ef10_nic.c b/sys/dev/sfxge/common/ef10_nic.c
new file mode 100644
index 0000000..c607f2d
--- /dev/null
+++ b/sys/dev/sfxge/common/ef10_nic.c
@@ -0,0 +1,1697 @@
+/*-
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of the FreeBSD Project.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "efx.h"
+#include "efx_impl.h"
+#if EFSYS_OPT_MON_MCDI
+#include "mcdi_mon.h"
+#endif
+
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+
+#include "ef10_tlv_layout.h"
+
+ __checkReturn efx_rc_t
+efx_mcdi_get_port_assignment(
+ __in efx_nic_t *enp,
+ __out uint32_t *portp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN,
+ MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN)];
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_PORT_ASSIGNMENT;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ *portp = MCDI_OUT_DWORD(req, GET_PORT_ASSIGNMENT_OUT_PORT);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_mcdi_get_port_modes(
+ __in efx_nic_t *enp,
+ __out uint32_t *modesp,
+ __out_opt uint32_t *current_modep)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_PORT_MODES_IN_LEN,
+ MC_CMD_GET_PORT_MODES_OUT_LEN)];
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_PORT_MODES;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_PORT_MODES_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_PORT_MODES_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ /*
+ * Require only Modes and DefaultMode fields, unless the current mode
+ * was requested (CurrentMode field was added for Medford).
+ */
+ if (req.emr_out_length_used <
+ MC_CMD_GET_PORT_MODES_OUT_CURRENT_MODE_OFST) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+ if ((current_modep != NULL) && (req.emr_out_length_used <
+ MC_CMD_GET_PORT_MODES_OUT_CURRENT_MODE_OFST + 4)) {
+ rc = EMSGSIZE;
+ goto fail3;
+ }
+
+ *modesp = MCDI_OUT_DWORD(req, GET_PORT_MODES_OUT_MODES);
+
+ if (current_modep != NULL) {
+ *current_modep = MCDI_OUT_DWORD(req,
+ GET_PORT_MODES_OUT_CURRENT_MODE);
+ }
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_get_port_mode_bandwidth(
+ __in uint32_t port_mode,
+ __out uint32_t *bandwidth_mbpsp)
+{
+ uint32_t bandwidth;
+ efx_rc_t rc;
+
+ switch (port_mode) {
+ case TLV_PORT_MODE_10G:
+ bandwidth = 10000;
+ break;
+ case TLV_PORT_MODE_10G_10G:
+ bandwidth = 10000 * 2;
+ break;
+ case TLV_PORT_MODE_10G_10G_10G_10G:
+ case TLV_PORT_MODE_10G_10G_10G_10G_Q:
+ case TLV_PORT_MODE_10G_10G_10G_10G_Q2:
+ bandwidth = 10000 * 4;
+ break;
+ case TLV_PORT_MODE_40G:
+ bandwidth = 40000;
+ break;
+ case TLV_PORT_MODE_40G_40G:
+ bandwidth = 40000 * 2;
+ break;
+ case TLV_PORT_MODE_40G_10G_10G:
+ case TLV_PORT_MODE_10G_10G_40G:
+ bandwidth = 40000 + (10000 * 2);
+ break;
+ default:
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ *bandwidth_mbpsp = bandwidth;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+efx_mcdi_vadaptor_alloc(
+ __in efx_nic_t *enp,
+ __in uint32_t port_id)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_VADAPTOR_ALLOC_IN_LEN,
+ MC_CMD_VADAPTOR_ALLOC_OUT_LEN)];
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_vport_id, ==, EVB_PORT_ID_NULL);
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_VADAPTOR_ALLOC;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_VADAPTOR_ALLOC_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_VADAPTOR_ALLOC_OUT_LEN;
+
+ MCDI_IN_SET_DWORD(req, VADAPTOR_ALLOC_IN_UPSTREAM_PORT_ID, port_id);
+ MCDI_IN_POPULATE_DWORD_1(req, VADAPTOR_ALLOC_IN_FLAGS,
+ VADAPTOR_ALLOC_IN_FLAG_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED,
+ enp->en_nic_cfg.enc_allow_set_mac_with_installed_filters ? 1 : 0);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+efx_mcdi_vadaptor_free(
+ __in efx_nic_t *enp,
+ __in uint32_t port_id)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_VADAPTOR_FREE_IN_LEN,
+ MC_CMD_VADAPTOR_FREE_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_VADAPTOR_FREE;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_VADAPTOR_FREE_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_VADAPTOR_FREE_OUT_LEN;
+
+ MCDI_IN_SET_DWORD(req, VADAPTOR_FREE_IN_UPSTREAM_PORT_ID, port_id);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_mcdi_get_mac_address_pf(
+ __in efx_nic_t *enp,
+ __out_ecount_opt(6) uint8_t mac_addrp[6])
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_MAC_ADDRESSES_IN_LEN,
+ MC_CMD_GET_MAC_ADDRESSES_OUT_LEN)];
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_MAC_ADDRESSES;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_MAC_ADDRESSES_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_MAC_ADDRESSES_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_MAC_ADDRESSES_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ if (MCDI_OUT_DWORD(req, GET_MAC_ADDRESSES_OUT_MAC_COUNT) < 1) {
+ rc = ENOENT;
+ goto fail3;
+ }
+
+ if (mac_addrp != NULL) {
+ uint8_t *addrp;
+
+ addrp = MCDI_OUT2(req, uint8_t,
+ GET_MAC_ADDRESSES_OUT_MAC_ADDR_BASE);
+
+ EFX_MAC_ADDR_COPY(mac_addrp, addrp);
+ }
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_mcdi_get_mac_address_vf(
+ __in efx_nic_t *enp,
+ __out_ecount_opt(6) uint8_t mac_addrp[6])
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN,
+ MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX)];
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_VPORT_GET_MAC_ADDRESSES;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX;
+
+ MCDI_IN_SET_DWORD(req, VPORT_GET_MAC_ADDRESSES_IN_VPORT_ID,
+ EVB_PORT_ID_ASSIGNED);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used <
+ MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMIN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ if (MCDI_OUT_DWORD(req,
+ VPORT_GET_MAC_ADDRESSES_OUT_MACADDR_COUNT) < 1) {
+ rc = ENOENT;
+ goto fail3;
+ }
+
+ if (mac_addrp != NULL) {
+ uint8_t *addrp;
+
+ addrp = MCDI_OUT2(req, uint8_t,
+ VPORT_GET_MAC_ADDRESSES_OUT_MACADDR);
+
+ EFX_MAC_ADDR_COPY(mac_addrp, addrp);
+ }
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_mcdi_get_clock(
+ __in efx_nic_t *enp,
+ __out uint32_t *sys_freqp,
+ __out uint32_t *dpcpu_freqp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_CLOCK_IN_LEN,
+ MC_CMD_GET_CLOCK_OUT_LEN)];
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_CLOCK;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_CLOCK_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_CLOCK_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_CLOCK_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ *sys_freqp = MCDI_OUT_DWORD(req, GET_CLOCK_OUT_SYS_FREQ);
+ if (*sys_freqp == 0) {
+ rc = EINVAL;
+ goto fail3;
+ }
+ *dpcpu_freqp = MCDI_OUT_DWORD(req, GET_CLOCK_OUT_DPCPU_FREQ);
+ if (*dpcpu_freqp == 0) {
+ rc = EINVAL;
+ goto fail4;
+ }
+
+ return (0);
+
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_mcdi_get_vector_cfg(
+ __in efx_nic_t *enp,
+ __out_opt uint32_t *vec_basep,
+ __out_opt uint32_t *pf_nvecp,
+ __out_opt uint32_t *vf_nvecp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_VECTOR_CFG_IN_LEN,
+ MC_CMD_GET_VECTOR_CFG_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_VECTOR_CFG;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_VECTOR_CFG_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_VECTOR_CFG_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_VECTOR_CFG_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ if (vec_basep != NULL)
+ *vec_basep = MCDI_OUT_DWORD(req, GET_VECTOR_CFG_OUT_VEC_BASE);
+ if (pf_nvecp != NULL)
+ *pf_nvecp = MCDI_OUT_DWORD(req, GET_VECTOR_CFG_OUT_VECS_PER_PF);
+ if (vf_nvecp != NULL)
+ *vf_nvecp = MCDI_OUT_DWORD(req, GET_VECTOR_CFG_OUT_VECS_PER_VF);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+efx_mcdi_get_capabilities(
+ __in efx_nic_t *enp,
+ __out uint32_t *flagsp,
+ __out uint32_t *flags2p)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN,
+ MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_CAPABILITIES;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_CAPABILITIES_V2_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ *flagsp = MCDI_OUT_DWORD(req, GET_CAPABILITIES_OUT_FLAGS1);
+
+ if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)
+ *flags2p = 0;
+ else
+ *flags2p = MCDI_OUT_DWORD(req, GET_CAPABILITIES_V2_OUT_FLAGS2);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+static __checkReturn efx_rc_t
+efx_mcdi_alloc_vis(
+ __in efx_nic_t *enp,
+ __in uint32_t min_vi_count,
+ __in uint32_t max_vi_count,
+ __out uint32_t *vi_basep,
+ __out uint32_t *vi_countp,
+ __out uint32_t *vi_shiftp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_ALLOC_VIS_IN_LEN,
+ MC_CMD_ALLOC_VIS_OUT_LEN)];
+ efx_rc_t rc;
+
+ if (vi_countp == NULL) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_ALLOC_VIS;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_ALLOC_VIS_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_ALLOC_VIS_OUT_LEN;
+
+ MCDI_IN_SET_DWORD(req, ALLOC_VIS_IN_MIN_VI_COUNT, min_vi_count);
+ MCDI_IN_SET_DWORD(req, ALLOC_VIS_IN_MAX_VI_COUNT, max_vi_count);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail2;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_ALLOC_VIS_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail3;
+ }
+
+ *vi_basep = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_BASE);
+ *vi_countp = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_COUNT);
+
+ /* Report VI_SHIFT if available (always zero for Huntington) */
+ if (req.emr_out_length_used < MC_CMD_ALLOC_VIS_EXT_OUT_LEN)
+ *vi_shiftp = 0;
+ else
+ *vi_shiftp = MCDI_OUT_DWORD(req, ALLOC_VIS_EXT_OUT_VI_SHIFT);
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+static __checkReturn efx_rc_t
+efx_mcdi_free_vis(
+ __in efx_nic_t *enp)
+{
+ efx_mcdi_req_t req;
+ efx_rc_t rc;
+
+ EFX_STATIC_ASSERT(MC_CMD_FREE_VIS_IN_LEN == 0);
+ EFX_STATIC_ASSERT(MC_CMD_FREE_VIS_OUT_LEN == 0);
+
+ req.emr_cmd = MC_CMD_FREE_VIS;
+ req.emr_in_buf = NULL;
+ req.emr_in_length = 0;
+ req.emr_out_buf = NULL;
+ req.emr_out_length = 0;
+
+ efx_mcdi_execute_quiet(enp, &req);
+
+ /* Ignore ELREADY (no allocated VIs, so nothing to free) */
+ if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+static __checkReturn efx_rc_t
+efx_mcdi_alloc_piobuf(
+ __in efx_nic_t *enp,
+ __out efx_piobuf_handle_t *handlep)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_ALLOC_PIOBUF_IN_LEN,
+ MC_CMD_ALLOC_PIOBUF_OUT_LEN)];
+ efx_rc_t rc;
+
+ if (handlep == NULL) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_ALLOC_PIOBUF;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_ALLOC_PIOBUF_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_ALLOC_PIOBUF_OUT_LEN;
+
+ efx_mcdi_execute_quiet(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail2;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_ALLOC_PIOBUF_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail3;
+ }
+
+ *handlep = MCDI_OUT_DWORD(req, ALLOC_PIOBUF_OUT_PIOBUF_HANDLE);
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+efx_mcdi_free_piobuf(
+ __in efx_nic_t *enp,
+ __in efx_piobuf_handle_t handle)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_FREE_PIOBUF_IN_LEN,
+ MC_CMD_FREE_PIOBUF_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_FREE_PIOBUF;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_FREE_PIOBUF_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_FREE_PIOBUF_OUT_LEN;
+
+ MCDI_IN_SET_DWORD(req, FREE_PIOBUF_IN_PIOBUF_HANDLE, handle);
+
+ efx_mcdi_execute_quiet(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+efx_mcdi_link_piobuf(
+ __in efx_nic_t *enp,
+ __in uint32_t vi_index,
+ __in efx_piobuf_handle_t handle)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_LINK_PIOBUF_IN_LEN,
+ MC_CMD_LINK_PIOBUF_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_LINK_PIOBUF;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_LINK_PIOBUF_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_LINK_PIOBUF_OUT_LEN;
+
+ MCDI_IN_SET_DWORD(req, LINK_PIOBUF_IN_PIOBUF_HANDLE, handle);
+ MCDI_IN_SET_DWORD(req, LINK_PIOBUF_IN_TXQ_INSTANCE, vi_index);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
+efx_mcdi_unlink_piobuf(
+ __in efx_nic_t *enp,
+ __in uint32_t vi_index)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_UNLINK_PIOBUF_IN_LEN,
+ MC_CMD_UNLINK_PIOBUF_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_UNLINK_PIOBUF;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_UNLINK_PIOBUF_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_UNLINK_PIOBUF_OUT_LEN;
+
+ MCDI_IN_SET_DWORD(req, UNLINK_PIOBUF_IN_TXQ_INSTANCE, vi_index);
+
+ efx_mcdi_execute_quiet(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static void
+ef10_nic_alloc_piobufs(
+ __in efx_nic_t *enp,
+ __in uint32_t max_piobuf_count)
+{
+ efx_piobuf_handle_t *handlep;
+ unsigned int i;
+
+ EFSYS_ASSERT3U(max_piobuf_count, <=,
+ EFX_ARRAY_SIZE(enp->en_arch.ef10.ena_piobuf_handle));
+
+ enp->en_arch.ef10.ena_piobuf_count = 0;
+
+ for (i = 0; i < max_piobuf_count; i++) {
+ handlep = &enp->en_arch.ef10.ena_piobuf_handle[i];
+
+ if (efx_mcdi_alloc_piobuf(enp, handlep) != 0)
+ goto fail1;
+
+ enp->en_arch.ef10.ena_pio_alloc_map[i] = 0;
+ enp->en_arch.ef10.ena_piobuf_count++;
+ }
+
+ return;
+
+fail1:
+ for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
+ handlep = &enp->en_arch.ef10.ena_piobuf_handle[i];
+
+ efx_mcdi_free_piobuf(enp, *handlep);
+ *handlep = EFX_PIOBUF_HANDLE_INVALID;
+ }
+ enp->en_arch.ef10.ena_piobuf_count = 0;
+}
+
+
+static void
+ef10_nic_free_piobufs(
+ __in efx_nic_t *enp)
+{
+ efx_piobuf_handle_t *handlep;
+ unsigned int i;
+
+ for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
+ handlep = &enp->en_arch.ef10.ena_piobuf_handle[i];
+
+ efx_mcdi_free_piobuf(enp, *handlep);
+ *handlep = EFX_PIOBUF_HANDLE_INVALID;
+ }
+ enp->en_arch.ef10.ena_piobuf_count = 0;
+}
+
+/* Sub-allocate a block from a piobuf */
+ __checkReturn efx_rc_t
+ef10_nic_pio_alloc(
+ __inout efx_nic_t *enp,
+ __out uint32_t *bufnump,
+ __out efx_piobuf_handle_t *handlep,
+ __out uint32_t *blknump,
+ __out uint32_t *offsetp,
+ __out size_t *sizep)
+{
+ efx_nic_cfg_t *encp = &enp->en_nic_cfg;
+ efx_drv_cfg_t *edcp = &enp->en_drv_cfg;
+ uint32_t blk_per_buf;
+ uint32_t buf, blk;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+ EFSYS_ASSERT(bufnump);
+ EFSYS_ASSERT(handlep);
+ EFSYS_ASSERT(blknump);
+ EFSYS_ASSERT(offsetp);
+ EFSYS_ASSERT(sizep);
+
+ if ((edcp->edc_pio_alloc_size == 0) ||
+ (enp->en_arch.ef10.ena_piobuf_count == 0)) {
+ rc = ENOMEM;
+ goto fail1;
+ }
+ blk_per_buf = encp->enc_piobuf_size / edcp->edc_pio_alloc_size;
+
+ for (buf = 0; buf < enp->en_arch.ef10.ena_piobuf_count; buf++) {
+ uint32_t *map = &enp->en_arch.ef10.ena_pio_alloc_map[buf];
+
+ if (~(*map) == 0)
+ continue;
+
+ EFSYS_ASSERT3U(blk_per_buf, <=, (8 * sizeof (*map)));
+ for (blk = 0; blk < blk_per_buf; blk++) {
+ if ((*map & (1u << blk)) == 0) {
+ *map |= (1u << blk);
+ goto done;
+ }
+ }
+ }
+ rc = ENOMEM;
+ goto fail2;
+
+done:
+ *handlep = enp->en_arch.ef10.ena_piobuf_handle[buf];
+ *bufnump = buf;
+ *blknump = blk;
+ *sizep = edcp->edc_pio_alloc_size;
+ *offsetp = blk * (*sizep);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+/* Free a piobuf sub-allocated block */
+ __checkReturn efx_rc_t
+ef10_nic_pio_free(
+ __inout efx_nic_t *enp,
+ __in uint32_t bufnum,
+ __in uint32_t blknum)
+{
+ uint32_t *map;
+ efx_rc_t rc;
+
+ if ((bufnum >= enp->en_arch.ef10.ena_piobuf_count) ||
+ (blknum >= (8 * sizeof (*map)))) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ map = &enp->en_arch.ef10.ena_pio_alloc_map[bufnum];
+ if ((*map & (1u << blknum)) == 0) {
+ rc = ENOENT;
+ goto fail2;
+ }
+ *map &= ~(1u << blknum);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_pio_link(
+ __inout efx_nic_t *enp,
+ __in uint32_t vi_index,
+ __in efx_piobuf_handle_t handle)
+{
+ return (efx_mcdi_link_piobuf(enp, vi_index, handle));
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_pio_unlink(
+ __inout efx_nic_t *enp,
+ __in uint32_t vi_index)
+{
+ return (efx_mcdi_unlink_piobuf(enp, vi_index));
+}
+
+ __checkReturn efx_rc_t
+ef10_get_datapath_caps(
+ __in efx_nic_t *enp)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ uint32_t flags;
+ uint32_t flags2;
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_get_capabilities(enp, &flags, &flags2)) != 0)
+ goto fail1;
+
+#define CAP_FLAG(flags1, field) \
+ ((flags1) & (1 << (MC_CMD_GET_CAPABILITIES_V2_OUT_ ## field ## _LBN)))
+
+#define CAP_FLAG2(flags2, field) \
+ ((flags2) & (1 << (MC_CMD_GET_CAPABILITIES_V2_OUT_ ## field ## _LBN)))
+
+ /*
+ * Huntington RXDP firmware inserts a 0 or 14 byte prefix.
+ * We only support the 14 byte prefix here.
+ */
+ if (CAP_FLAG(flags, RX_PREFIX_LEN_14) == 0) {
+ rc = ENOTSUP;
+ goto fail2;
+ }
+ encp->enc_rx_prefix_size = 14;
+
+ /* Check if the firmware supports TSO */
+ encp->enc_fw_assisted_tso_enabled =
+ CAP_FLAG(flags, TX_TSO) ? B_TRUE : B_FALSE;
+
+ /* Check if the firmware supports FATSOv2 */
+ encp->enc_fw_assisted_tso_v2_enabled =
+ CAP_FLAG2(flags2, TX_TSO_V2) ? B_TRUE : B_FALSE;
+
+ /* Check if the firmware has vadapter/vport/vswitch support */
+ encp->enc_datapath_cap_evb =
+ CAP_FLAG(flags, EVB) ? B_TRUE : B_FALSE;
+
+ /* Check if the firmware supports VLAN insertion */
+ encp->enc_hw_tx_insert_vlan_enabled =
+ CAP_FLAG(flags, TX_VLAN_INSERTION) ? B_TRUE : B_FALSE;
+
+ /* Check if the firmware supports RX event batching */
+ encp->enc_rx_batching_enabled =
+ CAP_FLAG(flags, RX_BATCHING) ? B_TRUE : B_FALSE;
+
+ if (encp->enc_rx_batching_enabled)
+ encp->enc_rx_batch_max = 16;
+
+ /* Check if the firmware supports disabling scatter on RXQs */
+ encp->enc_rx_disable_scatter_supported =
+ CAP_FLAG(flags, RX_DISABLE_SCATTER) ? B_TRUE : B_FALSE;
+
+ /* Check if the firmware supports set mac with running filters */
+ encp->enc_allow_set_mac_with_installed_filters =
+ CAP_FLAG(flags, VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED) ?
+ B_TRUE : B_FALSE;
+
+ /*
+ * Check if firmware supports the extended MC_CMD_SET_MAC, which allows
+ * specifying which parameters to configure.
+ */
+ encp->enc_enhanced_set_mac_supported =
+ CAP_FLAG(flags, SET_MAC_ENHANCED) ? B_TRUE : B_FALSE;
+
+#undef CAP_FLAG
+#undef CAP_FLAG2
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+#define EF10_LEGACY_PF_PRIVILEGE_MASK \
+ (MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_LINK | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_ONLOAD | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_PTP | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_INSECURE_FILTERS | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_UNICAST | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_MULTICAST | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_BROADCAST | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST | \
+ MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS)
+
+#define EF10_LEGACY_VF_PRIVILEGE_MASK 0
+
+
+ __checkReturn efx_rc_t
+ef10_get_privilege_mask(
+ __in efx_nic_t *enp,
+ __out uint32_t *maskp)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ uint32_t mask;
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_privilege_mask(enp, encp->enc_pf, encp->enc_vf,
+ &mask)) != 0) {
+ if (rc != ENOTSUP)
+ goto fail1;
+
+ /* Fallback for old firmware without privilege mask support */
+ if (EFX_PCI_FUNCTION_IS_PF(encp)) {
+ /* Assume PF has admin privilege */
+ mask = EF10_LEGACY_PF_PRIVILEGE_MASK;
+ } else {
+ /* VF is always unprivileged by default */
+ mask = EF10_LEGACY_VF_PRIVILEGE_MASK;
+ }
+ }
+
+ *maskp = mask;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+/*
+ * The external port mapping is a one-based numbering of the external
+ * connectors on the board. It does not distinguish off-board separated
+ * outputs such as multi-headed cables.
+ * The number of ports that map to each external port connector
+ * on the board is determined by the chip family and the port modes to
+ * which the NIC can be configured. The mapping table lists modes with
+ * port numbering requirements in increasing order.
+ */
+static struct {
+ efx_family_t family;
+ uint32_t modes_mask;
+ uint32_t stride;
+} __ef10_external_port_mappings[] = {
+ /* Supported modes requiring 1 output per port */
+ {
+ EFX_FAMILY_HUNTINGTON,
+ (1 << TLV_PORT_MODE_10G) |
+ (1 << TLV_PORT_MODE_10G_10G) |
+ (1 << TLV_PORT_MODE_10G_10G_10G_10G),
+ 1
+ },
+ {
+ EFX_FAMILY_MEDFORD,
+ (1 << TLV_PORT_MODE_10G) |
+ (1 << TLV_PORT_MODE_10G_10G) |
+ (1 << TLV_PORT_MODE_10G_10G_10G_10G),
+ 1
+ },
+ /* Supported modes requiring 2 outputs per port */
+ {
+ EFX_FAMILY_HUNTINGTON,
+ (1 << TLV_PORT_MODE_40G) |
+ (1 << TLV_PORT_MODE_40G_40G) |
+ (1 << TLV_PORT_MODE_40G_10G_10G) |
+ (1 << TLV_PORT_MODE_10G_10G_40G),
+ 2
+ },
+ {
+ EFX_FAMILY_MEDFORD,
+ (1 << TLV_PORT_MODE_40G) |
+ (1 << TLV_PORT_MODE_40G_40G) |
+ (1 << TLV_PORT_MODE_40G_10G_10G) |
+ (1 << TLV_PORT_MODE_10G_10G_40G),
+ 2
+ },
+ /* Supported modes requiring 4 outputs per port */
+ {
+ EFX_FAMILY_MEDFORD,
+ (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) |
+ (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2),
+ 4
+ },
+};
+
+ __checkReturn efx_rc_t
+ef10_external_port_mapping(
+ __in efx_nic_t *enp,
+ __in uint32_t port,
+ __out uint8_t *external_portp)
+{
+ efx_rc_t rc;
+ int i;
+ uint32_t port_modes;
+ uint32_t matches;
+ uint32_t stride = 1; /* default 1-1 mapping */
+
+ if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, NULL)) != 0) {
+ /* No port mode information available - use default mapping */
+ goto out;
+ }
+
+ /*
+ * Infer the internal port -> external port mapping from
+ * the possible port modes for this NIC.
+ */
+ for (i = 0; i < EFX_ARRAY_SIZE(__ef10_external_port_mappings); ++i) {
+ if (__ef10_external_port_mappings[i].family !=
+ enp->en_family)
+ continue;
+ matches = (__ef10_external_port_mappings[i].modes_mask &
+ port_modes);
+ if (matches != 0) {
+ stride = __ef10_external_port_mappings[i].stride;
+ port_modes &= ~matches;
+ }
+ }
+
+ if (port_modes != 0) {
+ /* Some advertised modes are not supported */
+ rc = ENOTSUP;
+ goto fail1;
+ }
+
+out:
+ /*
+ * Scale as required by last matched mode and then convert to
+ * one-based numbering
+ */
+ *external_portp = (uint8_t)(port / stride) + 1;
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+ __checkReturn efx_rc_t
+ef10_nic_probe(
+ __in efx_nic_t *enp)
+{
+ const efx_nic_ops_t *enop = enp->en_enop;
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ /* Read and clear any assertion state */
+ if ((rc = efx_mcdi_read_assertion(enp)) != 0)
+ goto fail1;
+
+ /* Exit the assertion handler */
+ if ((rc = efx_mcdi_exit_assertion_handler(enp)) != 0)
+ if (rc != EACCES)
+ goto fail2;
+
+ if ((rc = efx_mcdi_drv_attach(enp, B_TRUE)) != 0)
+ goto fail3;
+
+ if ((rc = enop->eno_board_cfg(enp)) != 0)
+ if (rc != EACCES)
+ goto fail4;
+
+ /*
+ * Set default driver config limits (based on board config).
+ *
+ * FIXME: For now allocate a fixed number of VIs which is likely to be
+ * sufficient and small enough to allow multiple functions on the same
+ * port.
+ */
+ edcp->edc_min_vi_count = edcp->edc_max_vi_count =
+ MIN(128, MAX(encp->enc_rxq_limit, encp->enc_txq_limit));
+
+ /* The client driver must configure and enable PIO buffer support */
+ edcp->edc_max_piobuf_count = 0;
+ edcp->edc_pio_alloc_size = 0;
+
+#if EFSYS_OPT_MAC_STATS
+ /* Wipe the MAC statistics */
+ if ((rc = efx_mcdi_mac_stats_clear(enp)) != 0)
+ goto fail5;
+#endif
+
+#if EFSYS_OPT_LOOPBACK
+ if ((rc = efx_mcdi_get_loopback_modes(enp)) != 0)
+ goto fail6;
+#endif
+
+#if EFSYS_OPT_MON_STATS
+ if ((rc = mcdi_mon_cfg_build(enp)) != 0) {
+ /* Unprivileged functions do not have access to sensors */
+ if (rc != EACCES)
+ goto fail7;
+ }
+#endif
+
+ encp->enc_features = enp->en_features;
+
+ return (0);
+
+#if EFSYS_OPT_MON_STATS
+fail7:
+ EFSYS_PROBE(fail7);
+#endif
+#if EFSYS_OPT_LOOPBACK
+fail6:
+ EFSYS_PROBE(fail6);
+#endif
+#if EFSYS_OPT_MAC_STATS
+fail5:
+ EFSYS_PROBE(fail5);
+#endif
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_set_drv_limits(
+ __inout efx_nic_t *enp,
+ __in efx_drv_limits_t *edlp)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
+ uint32_t min_evq_count, max_evq_count;
+ uint32_t min_rxq_count, max_rxq_count;
+ uint32_t min_txq_count, max_txq_count;
+ efx_rc_t rc;
+
+ if (edlp == NULL) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ /* Get minimum required and maximum usable VI limits */
+ min_evq_count = MIN(edlp->edl_min_evq_count, encp->enc_evq_limit);
+ min_rxq_count = MIN(edlp->edl_min_rxq_count, encp->enc_rxq_limit);
+ min_txq_count = MIN(edlp->edl_min_txq_count, encp->enc_txq_limit);
+
+ edcp->edc_min_vi_count =
+ MAX(min_evq_count, MAX(min_rxq_count, min_txq_count));
+
+ max_evq_count = MIN(edlp->edl_max_evq_count, encp->enc_evq_limit);
+ max_rxq_count = MIN(edlp->edl_max_rxq_count, encp->enc_rxq_limit);
+ max_txq_count = MIN(edlp->edl_max_txq_count, encp->enc_txq_limit);
+
+ edcp->edc_max_vi_count =
+ MAX(max_evq_count, MAX(max_rxq_count, max_txq_count));
+
+ /*
+ * Check limits for sub-allocated piobuf blocks.
+ * PIO is optional, so don't fail if the limits are incorrect.
+ */
+ if ((encp->enc_piobuf_size == 0) ||
+ (encp->enc_piobuf_limit == 0) ||
+ (edlp->edl_min_pio_alloc_size == 0) ||
+ (edlp->edl_min_pio_alloc_size > encp->enc_piobuf_size)) {
+ /* Disable PIO */
+ edcp->edc_max_piobuf_count = 0;
+ edcp->edc_pio_alloc_size = 0;
+ } else {
+ uint32_t blk_size, blk_count, blks_per_piobuf;
+
+ blk_size =
+ MAX(edlp->edl_min_pio_alloc_size,
+ encp->enc_piobuf_min_alloc_size);
+
+ blks_per_piobuf = encp->enc_piobuf_size / blk_size;
+ EFSYS_ASSERT3U(blks_per_piobuf, <=, 32);
+
+ blk_count = (encp->enc_piobuf_limit * blks_per_piobuf);
+
+ /* A zero max pio alloc count means unlimited */
+ if ((edlp->edl_max_pio_alloc_count > 0) &&
+ (edlp->edl_max_pio_alloc_count < blk_count)) {
+ blk_count = edlp->edl_max_pio_alloc_count;
+ }
+
+ edcp->edc_pio_alloc_size = blk_size;
+ edcp->edc_max_piobuf_count =
+ (blk_count + (blks_per_piobuf - 1)) / blks_per_piobuf;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+ __checkReturn efx_rc_t
+ef10_nic_reset(
+ __in efx_nic_t *enp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_ENTITY_RESET_IN_LEN,
+ MC_CMD_ENTITY_RESET_OUT_LEN)];
+ efx_rc_t rc;
+
+ /* ef10_nic_reset() is called to recover from BADASSERT failures. */
+ if ((rc = efx_mcdi_read_assertion(enp)) != 0)
+ goto fail1;
+ if ((rc = efx_mcdi_exit_assertion_handler(enp)) != 0)
+ goto fail2;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_ENTITY_RESET;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_ENTITY_RESET_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_ENTITY_RESET_OUT_LEN;
+
+ MCDI_IN_POPULATE_DWORD_1(req, ENTITY_RESET_IN_FLAG,
+ ENTITY_RESET_IN_FUNCTION_RESOURCE_RESET, 1);
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail3;
+ }
+
+ /* Clear RX/TX DMA queue errors */
+ enp->en_reset_flags &= ~(EFX_RESET_RXQ_ERR | EFX_RESET_TXQ_ERR);
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_init(
+ __in efx_nic_t *enp)
+{
+ efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
+ uint32_t min_vi_count, max_vi_count;
+ uint32_t vi_count, vi_base, vi_shift;
+ uint32_t i;
+ uint32_t retry;
+ uint32_t delay_us;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ /* Enable reporting of some events (e.g. link change) */
+ if ((rc = efx_mcdi_log_ctrl(enp)) != 0)
+ goto fail1;
+
+ /* Allocate (optional) on-chip PIO buffers */
+ ef10_nic_alloc_piobufs(enp, edcp->edc_max_piobuf_count);
+
+ /*
+ * For best performance, PIO writes should use a write-combined
+ * (WC) memory mapping. Using a separate WC mapping for the PIO
+ * aperture of each VI would be a burden to drivers (and not
+ * possible if the host page size is >4Kbyte).
+ *
+ * To avoid this we use a single uncached (UC) mapping for VI
+ * register access, and a single WC mapping for extra VIs used
+ * for PIO writes.
+ *
+ * Each piobuf must be linked to a VI in the WC mapping, and to
+ * each VI that is using a sub-allocated block from the piobuf.
+ */
+ min_vi_count = edcp->edc_min_vi_count;
+ max_vi_count =
+ edcp->edc_max_vi_count + enp->en_arch.ef10.ena_piobuf_count;
+
+ /* Ensure that the previously attached driver's VIs are freed */
+ if ((rc = efx_mcdi_free_vis(enp)) != 0)
+ goto fail2;
+
+ /*
+ * Reserve VI resources (EVQ+RXQ+TXQ) for this PCIe function. If this
+ * fails then retrying the request for fewer VI resources may succeed.
+ */
+ vi_count = 0;
+ if ((rc = efx_mcdi_alloc_vis(enp, min_vi_count, max_vi_count,
+ &vi_base, &vi_count, &vi_shift)) != 0)
+ goto fail3;
+
+ EFSYS_PROBE2(vi_alloc, uint32_t, vi_base, uint32_t, vi_count);
+
+ if (vi_count < min_vi_count) {
+ rc = ENOMEM;
+ goto fail4;
+ }
+
+ enp->en_arch.ef10.ena_vi_base = vi_base;
+ enp->en_arch.ef10.ena_vi_count = vi_count;
+ enp->en_arch.ef10.ena_vi_shift = vi_shift;
+
+ if (vi_count < min_vi_count + enp->en_arch.ef10.ena_piobuf_count) {
+ /* Not enough extra VIs to map piobufs */
+ ef10_nic_free_piobufs(enp);
+ }
+
+ enp->en_arch.ef10.ena_pio_write_vi_base =
+ vi_count - enp->en_arch.ef10.ena_piobuf_count;
+
+ /* Save UC memory mapping details */
+ enp->en_arch.ef10.ena_uc_mem_map_offset = 0;
+ if (enp->en_arch.ef10.ena_piobuf_count > 0) {
+ enp->en_arch.ef10.ena_uc_mem_map_size =
+ (ER_DZ_TX_PIOBUF_STEP *
+ enp->en_arch.ef10.ena_pio_write_vi_base);
+ } else {
+ enp->en_arch.ef10.ena_uc_mem_map_size =
+ (ER_DZ_TX_PIOBUF_STEP *
+ enp->en_arch.ef10.ena_vi_count);
+ }
+
+ /* Save WC memory mapping details */
+ enp->en_arch.ef10.ena_wc_mem_map_offset =
+ enp->en_arch.ef10.ena_uc_mem_map_offset +
+ enp->en_arch.ef10.ena_uc_mem_map_size;
+
+ enp->en_arch.ef10.ena_wc_mem_map_size =
+ (ER_DZ_TX_PIOBUF_STEP *
+ enp->en_arch.ef10.ena_piobuf_count);
+
+ /* Link piobufs to extra VIs in WC mapping */
+ if (enp->en_arch.ef10.ena_piobuf_count > 0) {
+ for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
+ rc = efx_mcdi_link_piobuf(enp,
+ enp->en_arch.ef10.ena_pio_write_vi_base + i,
+ enp->en_arch.ef10.ena_piobuf_handle[i]);
+ if (rc != 0)
+ break;
+ }
+ }
+
+ /*
+ * Allocate a vAdaptor attached to our upstream vPort/pPort.
+ *
+ * On a VF, this may fail with MC_CMD_ERR_NO_EVB_PORT (ENOENT) if the PF
+ * driver has yet to bring up the EVB port. See bug 56147. In this case,
+ * retry the request several times after waiting a while. The wait time
+ * between retries starts small (10ms) and exponentially increases.
+ * Total wait time is a little over two seconds. Retry logic in the
+ * client driver may mean this whole loop is repeated if it continues to
+ * fail.
+ */
+ retry = 0;
+ delay_us = 10000;
+ while ((rc = efx_mcdi_vadaptor_alloc(enp, EVB_PORT_ID_ASSIGNED)) != 0) {
+ if (EFX_PCI_FUNCTION_IS_PF(&enp->en_nic_cfg) ||
+ (rc != ENOENT)) {
+ /*
+ * Do not retry alloc for PF, or for other errors on
+ * a VF.
+ */
+ goto fail5;
+ }
+
+ /* VF startup before PF is ready. Retry allocation. */
+ if (retry > 5) {
+ /* Too many attempts */
+ rc = EINVAL;
+ goto fail6;
+ }
+ EFSYS_PROBE1(mcdi_no_evb_port_retry, int, retry);
+ EFSYS_SLEEP(delay_us);
+ retry++;
+ if (delay_us < 500000)
+ delay_us <<= 2;
+ }
+
+ enp->en_vport_id = EVB_PORT_ID_ASSIGNED;
+ enp->en_nic_cfg.enc_mcdi_max_payload_length = MCDI_CTL_SDU_LEN_MAX_V2;
+
+ return (0);
+
+fail6:
+ EFSYS_PROBE(fail6);
+fail5:
+ EFSYS_PROBE(fail5);
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+
+ ef10_nic_free_piobufs(enp);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_get_vi_pool(
+ __in efx_nic_t *enp,
+ __out uint32_t *vi_countp)
+{
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ /*
+ * Report VIs that the client driver can use.
+ * Do not include VIs used for PIO buffer writes.
+ */
+ *vi_countp = enp->en_arch.ef10.ena_pio_write_vi_base;
+
+ return (0);
+}
+
+ __checkReturn efx_rc_t
+ef10_nic_get_bar_region(
+ __in efx_nic_t *enp,
+ __in efx_nic_region_t region,
+ __out uint32_t *offsetp,
+ __out size_t *sizep)
+{
+ efx_rc_t rc;
+
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
+
+ /*
+ * TODO: Specify host memory mapping alignment and granularity
+ * in efx_drv_limits_t so that they can be taken into account
+ * when allocating extra VIs for PIO writes.
+ */
+ switch (region) {
+ case EFX_REGION_VI:
+ /* UC mapped memory BAR region for VI registers */
+ *offsetp = enp->en_arch.ef10.ena_uc_mem_map_offset;
+ *sizep = enp->en_arch.ef10.ena_uc_mem_map_size;
+ break;
+
+ case EFX_REGION_PIO_WRITE_VI:
+ /* WC mapped memory BAR region for piobuf writes */
+ *offsetp = enp->en_arch.ef10.ena_wc_mem_map_offset;
+ *sizep = enp->en_arch.ef10.ena_wc_mem_map_size;
+ break;
+
+ default:
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ void
+ef10_nic_fini(
+ __in efx_nic_t *enp)
+{
+ uint32_t i;
+ efx_rc_t rc;
+
+ (void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
+ enp->en_vport_id = 0;
+
+ /* Unlink piobufs from extra VIs in WC mapping */
+ if (enp->en_arch.ef10.ena_piobuf_count > 0) {
+ for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
+ rc = efx_mcdi_unlink_piobuf(enp,
+ enp->en_arch.ef10.ena_pio_write_vi_base + i);
+ if (rc != 0)
+ break;
+ }
+ }
+
+ ef10_nic_free_piobufs(enp);
+
+ (void) efx_mcdi_free_vis(enp);
+ enp->en_arch.ef10.ena_vi_count = 0;
+}
+
+ void
+ef10_nic_unprobe(
+ __in efx_nic_t *enp)
+{
+#if EFSYS_OPT_MON_STATS
+ mcdi_mon_cfg_free(enp);
+#endif /* EFSYS_OPT_MON_STATS */
+ (void) efx_mcdi_drv_attach(enp, B_FALSE);
+}
+
+#if EFSYS_OPT_DIAG
+
+ __checkReturn efx_rc_t
+ef10_nic_register_test(
+ __in efx_nic_t *enp)
+{
+ efx_rc_t rc;
+
+ /* FIXME */
+ _NOTE(ARGUNUSED(enp))
+ _NOTE(CONSTANTCONDITION)
+ if (B_FALSE) {
+ rc = ENOTSUP;
+ goto fail1;
+ }
+ /* FIXME */
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+#endif /* EFSYS_OPT_DIAG */
+
+
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/ef10_nvram.c
index dd471f4..7f93df3 100644
--- a/sys/dev/sfxge/common/hunt_nvram.c
+++ b/sys/dev/sfxge/common/ef10_nvram.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
#if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM
@@ -48,14 +48,34 @@ typedef struct tlv_cursor_s {
uint32_t *limit; /* Last dword of data block */
} tlv_cursor_t;
+typedef struct nvram_partition_s {
+ uint16_t type;
+ uint8_t chip_select;
+ uint8_t flags;
+ /*
+ * The full length of the NVRAM partition.
+ * This is different from tlv_partition_header.total_length,
+ * which can be smaller.
+ */
+ uint32_t length;
+ uint32_t erase_size;
+ uint32_t *data;
+ tlv_cursor_t tlv_cursor;
+} nvram_partition_t;
+
+
static __checkReturn efx_rc_t
tlv_validate_state(
- __in tlv_cursor_t *cursor);
+ __inout tlv_cursor_t *cursor);
-/*
- * Operations on TLV formatted partition data.
- */
+static void
+tlv_init_block(
+ __out uint32_t *block)
+{
+ *block = __CPU_TO_LE_32(TLV_TAG_END);
+}
+
static uint32_t
tlv_tag(
__in tlv_cursor_t *cursor)
@@ -122,9 +142,9 @@ tlv_next_item_ptr(
return (cursor->current + TLV_DWORD_COUNT(length));
}
-static efx_rc_t
+static __checkReturn efx_rc_t
tlv_advance(
- __in tlv_cursor_t *cursor)
+ __inout tlv_cursor_t *cursor)
{
efx_rc_t rc;
@@ -177,7 +197,7 @@ fail1:
static efx_rc_t
tlv_find(
- __in tlv_cursor_t *cursor,
+ __inout tlv_cursor_t *cursor,
__in uint32_t tag)
{
efx_rc_t rc;
@@ -194,7 +214,7 @@ tlv_find(
static __checkReturn efx_rc_t
tlv_validate_state(
- __in tlv_cursor_t *cursor)
+ __inout tlv_cursor_t *cursor)
{
efx_rc_t rc;
@@ -242,31 +262,49 @@ static efx_rc_t
tlv_init_cursor(
__out tlv_cursor_t *cursor,
__in uint32_t *block,
- __in uint32_t *limit)
+ __in uint32_t *limit,
+ __in uint32_t *current)
{
cursor->block = block;
cursor->limit = limit;
- cursor->current = cursor->block;
+ cursor->current = current;
cursor->end = NULL;
return (tlv_validate_state(cursor));
}
-static efx_rc_t
+static __checkReturn efx_rc_t
tlv_init_cursor_from_size(
__out tlv_cursor_t *cursor,
- __in uint8_t *block,
+ __in_bcount(size)
+ uint8_t *block,
__in size_t size)
{
uint32_t *limit;
limit = (uint32_t *)(block + size - sizeof (uint32_t));
- return (tlv_init_cursor(cursor, (uint32_t *)block, limit));
+ return (tlv_init_cursor(cursor, (uint32_t *)block,
+ limit, (uint32_t *)block));
}
-static efx_rc_t
+static __checkReturn efx_rc_t
+tlv_init_cursor_at_offset(
+ __out tlv_cursor_t *cursor,
+ __in_bcount(size)
+ uint8_t *block,
+ __in size_t size,
+ __in size_t offset)
+{
+ uint32_t *limit;
+ uint32_t *current;
+ limit = (uint32_t *)(block + size - sizeof (uint32_t));
+ current = (uint32_t *)(block + offset);
+ return (tlv_init_cursor(cursor, (uint32_t *)block, limit, current));
+}
+
+static __checkReturn efx_rc_t
tlv_require_end(
- __in tlv_cursor_t *cursor)
+ __inout tlv_cursor_t *cursor)
{
uint32_t *pos;
efx_rc_t rc;
@@ -290,7 +328,7 @@ fail1:
static size_t
tlv_block_length_used(
- __in tlv_cursor_t *cursor)
+ __inout tlv_cursor_t *cursor)
{
efx_rc_t rc;
@@ -311,8 +349,34 @@ fail1:
return (0);
}
+static uint32_t *
+tlv_last_segment_end(
+ __in tlv_cursor_t *cursor)
+{
+ tlv_cursor_t segment_cursor;
+ uint32_t *last_segment_end = cursor->block;
+ uint32_t *segment_start = cursor->block;
-static __checkReturn uint32_t *
+ /*
+ * Go through each segment and check that it has an end tag. If there
+ * is no end tag then the previous segment was the last valid one,
+ * so return the pointer to its end tag.
+ */
+ for (;;) {
+ if (tlv_init_cursor(&segment_cursor, segment_start,
+ cursor->limit, segment_start) != 0)
+ break;
+ if (tlv_require_end(&segment_cursor) != 0)
+ break;
+ last_segment_end = segment_cursor.end;
+ segment_start = segment_cursor.end + 1;
+ }
+
+ return (last_segment_end);
+}
+
+
+static uint32_t *
tlv_write(
__in tlv_cursor_t *cursor,
__in uint32_t tag,
@@ -338,12 +402,14 @@ tlv_write(
static __checkReturn efx_rc_t
tlv_insert(
- __in tlv_cursor_t *cursor,
+ __inout tlv_cursor_t *cursor,
__in uint32_t tag,
- __in uint8_t *data,
+ __in_bcount(size)
+ uint8_t *data,
__in size_t size)
{
unsigned int delta;
+ uint32_t *last_segment_end;
efx_rc_t rc;
if ((rc = tlv_validate_state(cursor)) != 0)
@@ -357,15 +423,17 @@ tlv_insert(
goto fail3;
}
+ last_segment_end = tlv_last_segment_end(cursor);
+
delta = TLV_DWORD_COUNT(size);
- if (cursor->end + 1 + delta > cursor->limit) {
+ if (last_segment_end + 1 + delta > cursor->limit) {
rc = ENOSPC;
goto fail4;
}
/* Move data up: new space at cursor->current */
memmove(cursor->current + delta, cursor->current,
- (cursor->end + 1 - cursor->current) * sizeof (uint32_t));
+ (last_segment_end + 1 - cursor->current) * sizeof (uint32_t));
/* Adjust the end pointer */
cursor->end += delta;
@@ -388,16 +456,61 @@ fail1:
}
static __checkReturn efx_rc_t
+tlv_delete(
+ __inout tlv_cursor_t *cursor)
+{
+ unsigned int delta;
+ uint32_t *last_segment_end;
+ efx_rc_t rc;
+
+ if ((rc = tlv_validate_state(cursor)) != 0)
+ goto fail1;
+
+ if (tlv_tag(cursor) == TLV_TAG_END) {
+ rc = EINVAL;
+ goto fail2;
+ }
+
+ delta = TLV_DWORD_COUNT(tlv_length(cursor));
+
+ if ((rc = tlv_require_end(cursor)) != 0)
+ goto fail3;
+
+ last_segment_end = tlv_last_segment_end(cursor);
+
+ /* Shuffle things down, destroying the item at cursor->current */
+ memmove(cursor->current, cursor->current + delta,
+ (last_segment_end + 1 - cursor->current) * sizeof (uint32_t));
+ /* Zero the new space at the end of the TLV chain */
+ memset(last_segment_end + 1 - delta, 0, delta * sizeof (uint32_t));
+ /* Adjust the end pointer */
+ cursor->end -= delta;
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static __checkReturn efx_rc_t
tlv_modify(
- __in tlv_cursor_t *cursor,
+ __inout tlv_cursor_t *cursor,
__in uint32_t tag,
- __in uint8_t *data,
+ __in_bcount(size)
+ uint8_t *data,
__in size_t size)
{
uint32_t *pos;
unsigned int old_ndwords;
unsigned int new_ndwords;
unsigned int delta;
+ uint32_t *last_segment_end;
efx_rc_t rc;
if ((rc = tlv_validate_state(cursor)) != 0)
@@ -418,19 +531,21 @@ tlv_modify(
if ((rc = tlv_require_end(cursor)) != 0)
goto fail4;
+ last_segment_end = tlv_last_segment_end(cursor);
+
if (new_ndwords > old_ndwords) {
/* Expand space used for TLV item */
delta = new_ndwords - old_ndwords;
pos = cursor->current + old_ndwords;
- if (cursor->end + 1 + delta > cursor->limit) {
+ if (last_segment_end + 1 + delta > cursor->limit) {
rc = ENOSPC;
goto fail5;
}
/* Move up: new space at (cursor->current + old_ndwords) */
memmove(pos + delta, pos,
- (cursor->end + 1 - pos) * sizeof (uint32_t));
+ (last_segment_end + 1 - pos) * sizeof (uint32_t));
/* Adjust the end pointer */
cursor->end += delta;
@@ -442,10 +557,11 @@ tlv_modify(
/* Move down: remove words at (cursor->current + new_ndwords) */
memmove(pos, pos + delta,
- (cursor->end + 1 - pos) * sizeof (uint32_t));
+ (last_segment_end + 1 - pos) * sizeof (uint32_t));
/* Zero the new space at the end of the TLV chain */
- memset(cursor->end + 1 - delta, 0, delta * sizeof (uint32_t));
+ memset(last_segment_end + 1 - delta, 0,
+ delta * sizeof (uint32_t));
/* Adjust the end pointer */
cursor->end -= delta;
@@ -470,9 +586,82 @@ fail1:
return (rc);
}
-/* Validate TLV formatted partition contents (before writing to flash) */
+static uint32_t checksum_tlv_partition(
+ __in nvram_partition_t *partition)
+{
+ tlv_cursor_t *cursor;
+ uint32_t *ptr;
+ uint32_t *end;
+ uint32_t csum;
+ size_t len;
+
+ cursor = &partition->tlv_cursor;
+ len = tlv_block_length_used(cursor);
+ EFSYS_ASSERT3U((len & 3), ==, 0);
+
+ csum = 0;
+ ptr = partition->data;
+ end = &ptr[len >> 2];
+
+ while (ptr < end)
+ csum += __LE_TO_CPU_32(*ptr++);
+
+ return (csum);
+}
+
+static __checkReturn efx_rc_t
+tlv_update_partition_len_and_cks(
+ __in tlv_cursor_t *cursor)
+{
+ efx_rc_t rc;
+ nvram_partition_t partition;
+ struct tlv_partition_header *header;
+ struct tlv_partition_trailer *trailer;
+ size_t new_len;
+
+ /*
+ * We just modified the partition, so the total length may not be
+ * valid. Don't use tlv_find(), which performs some sanity checks
+ * that may fail here.
+ */
+ partition.data = cursor->block;
+ memcpy(&partition.tlv_cursor, cursor, sizeof (*cursor));
+ header = (struct tlv_partition_header *)partition.data;
+ /* Sanity check. */
+ if (__LE_TO_CPU_32(header->tag) != TLV_TAG_PARTITION_HEADER) {
+ rc = EFAULT;
+ goto fail1;
+ }
+ new_len = tlv_block_length_used(&partition.tlv_cursor);
+ if (new_len == 0) {
+ rc = EFAULT;
+ goto fail2;
+ }
+ header->total_length = __CPU_TO_LE_32(new_len);
+ /* Ensure the modified partition always has a new generation count. */
+ header->generation = __CPU_TO_LE_32(
+ __LE_TO_CPU_32(header->generation) + 1);
+
+ trailer = (struct tlv_partition_trailer *)((uint8_t *)header +
+ new_len - sizeof (*trailer) - sizeof (uint32_t));
+ trailer->generation = header->generation;
+ trailer->checksum = __CPU_TO_LE_32(
+ __LE_TO_CPU_32(trailer->checksum) -
+ checksum_tlv_partition(&partition));
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+/* Validate buffer contents (before writing to flash) */
__checkReturn efx_rc_t
-efx_nvram_tlv_validate(
+ef10_nvram_buffer_validate(
__in efx_nic_t *enp,
__in uint32_t partn,
__in_bcount(partn_size) caddr_t partn_data,
@@ -568,6 +757,384 @@ fail1:
return (rc);
}
+
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_create(
+ __in efx_nic_t *enp,
+ __in uint16_t partn_type,
+ __in_bcount(partn_size) caddr_t partn_data,
+ __in size_t partn_size)
+{
+ uint32_t *buf = (uint32_t *)partn_data;
+ efx_rc_t rc;
+ tlv_cursor_t cursor;
+ struct tlv_partition_header header;
+ struct tlv_partition_trailer trailer;
+
+ unsigned min_buf_size = sizeof (struct tlv_partition_header) +
+ sizeof (struct tlv_partition_trailer);
+ if (partn_size < min_buf_size) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ memset(buf, 0xff, partn_size);
+
+ tlv_init_block(buf);
+ if ((rc = tlv_init_cursor(&cursor, buf,
+ (uint32_t *)((uint8_t *)buf + partn_size),
+ buf)) != 0) {
+ goto fail2;
+ }
+
+ header.tag = __CPU_TO_LE_32(TLV_TAG_PARTITION_HEADER);
+ header.length = __CPU_TO_LE_32(sizeof (header) - 8);
+ header.type_id = __CPU_TO_LE_16(partn_type);
+ header.preset = 0;
+ header.generation = __CPU_TO_LE_32(1);
+ header.total_length = 0; /* This will be fixed below. */
+ if ((rc = tlv_insert(
+ &cursor, TLV_TAG_PARTITION_HEADER,
+ (uint8_t *)&header.type_id, sizeof (header) - 8)) != 0)
+ goto fail3;
+ if ((rc = tlv_advance(&cursor)) != 0)
+ goto fail4;
+
+ trailer.tag = __CPU_TO_LE_32(TLV_TAG_PARTITION_TRAILER);
+ trailer.length = __CPU_TO_LE_32(sizeof (trailer) - 8);
+ trailer.generation = header.generation;
+ trailer.checksum = 0; /* This will be fixed below. */
+ if ((rc = tlv_insert(&cursor, TLV_TAG_PARTITION_TRAILER,
+ (uint8_t *)&trailer.generation, sizeof (trailer) - 8)) != 0)
+ goto fail5;
+
+ if ((rc = tlv_update_partition_len_and_cks(&cursor)) != 0)
+ goto fail6;
+
+ /* Check that the partition is valid. */
+ if ((rc = ef10_nvram_buffer_validate(enp, partn_type,
+ partn_data, partn_size)) != 0)
+ goto fail7;
+
+ return (0);
+
+fail7:
+ EFSYS_PROBE(fail7);
+fail6:
+ EFSYS_PROBE(fail6);
+fail5:
+ EFSYS_PROBE(fail5);
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+static uint32_t
+byte_offset(
+ __in uint32_t *position,
+ __in uint32_t *base)
+{
+ return (uint32_t)((uint8_t *)position - (uint8_t *)base);
+}
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_find_item_start(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp)
+{
+ // Read past partition header to find start address of the first key
+ tlv_cursor_t cursor;
+ efx_rc_t rc;
+
+ /* A PARTITION_HEADER tag must be the first item (at offset zero) */
+ if ((rc = tlv_init_cursor_from_size(&cursor, (uint8_t *)bufferp,
+ buffer_size)) != 0) {
+ rc = EFAULT;
+ goto fail1;
+ }
+ if (tlv_tag(&cursor) != TLV_TAG_PARTITION_HEADER) {
+ rc = EINVAL;
+ goto fail2;
+ }
+
+ if ((rc = tlv_advance(&cursor)) != 0) {
+ rc = EINVAL;
+ goto fail3;
+ }
+ *startp = byte_offset(cursor.current, cursor.block);
+
+ if ((rc = tlv_require_end(&cursor)) != 0)
+ goto fail4;
+
+ return (0);
+
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_find_end(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp)
+{
+ // Read to end of partition
+ tlv_cursor_t cursor;
+ efx_rc_t rc;
+ uint32_t *segment_used;
+
+ _NOTE(ARGUNUSED(offset))
+
+ if ((rc = tlv_init_cursor_from_size(&cursor, (uint8_t *)bufferp,
+ buffer_size)) != 0) {
+ rc = EFAULT;
+ goto fail1;
+ }
+
+ segment_used = cursor.block;
+
+ /*
+ * Go through each segment and check that it has an end tag. If there
+ * is no end tag then the previous segment was the last valid one,
+ * so return the used space including that end tag.
+ */
+ while (tlv_tag(&cursor) == TLV_TAG_PARTITION_HEADER) {
+ if (tlv_require_end(&cursor) != 0) {
+ if (segment_used == cursor.block) {
+ /*
+ * First segment is corrupt, so there is
+ * no valid data in partition.
+ */
+ rc = EINVAL;
+ goto fail2;
+ }
+ break;
+ }
+ segment_used = cursor.end + 1;
+
+ cursor.current = segment_used;
+ }
+ /* Return space used (including the END tag) */
+ *endp = (segment_used - cursor.block) * sizeof (uint32_t);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+ef10_nvram_buffer_find_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp)
+{
+ // Find TLV at offset and return key start and length
+ tlv_cursor_t cursor;
+ uint8_t *key;
+ uint32_t tag;
+
+ if (tlv_init_cursor_at_offset(&cursor, (uint8_t *)bufferp,
+ buffer_size, offset) != 0) {
+ return (B_FALSE);
+ }
+
+ while ((key = tlv_item(&cursor)) != NULL) {
+ tag = tlv_tag(&cursor);
+ if (tag == TLV_TAG_PARTITION_HEADER ||
+ tag == TLV_TAG_PARTITION_TRAILER) {
+ if (tlv_advance(&cursor) != 0) {
+ break;
+ }
+ continue;
+ }
+ *startp = byte_offset(cursor.current, cursor.block);
+ *lengthp = byte_offset(tlv_next_item_ptr(&cursor),
+ cursor.current);
+ return (B_TRUE);
+ }
+
+ return (B_FALSE);
+}
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_get_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(item_max_size, *lengthp)
+ caddr_t itemp,
+ __in size_t item_max_size,
+ __out uint32_t *lengthp)
+{
+ efx_rc_t rc;
+ tlv_cursor_t cursor;
+ uint32_t item_length;
+
+ if (item_max_size < length) {
+ rc = ENOSPC;
+ goto fail1;
+ }
+
+ if ((rc = tlv_init_cursor_at_offset(&cursor, (uint8_t *)bufferp,
+ buffer_size, offset)) != 0) {
+ goto fail2;
+ }
+
+ item_length = tlv_length(&cursor);
+ if (length < item_length) {
+ rc = ENOSPC;
+ goto fail3;
+ }
+ memcpy(itemp, tlv_value(&cursor), item_length);
+
+ *lengthp = item_length;
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_insert_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp)
+{
+ efx_rc_t rc;
+ tlv_cursor_t cursor;
+
+ if ((rc = tlv_init_cursor_at_offset(&cursor, (uint8_t *)bufferp,
+ buffer_size, offset)) != 0) {
+ goto fail1;
+ }
+
+ rc = tlv_insert(&cursor, TLV_TAG_LICENSE, (uint8_t *)keyp, length);
+
+ if (rc != 0) {
+ goto fail2;
+ }
+
+ *lengthp = byte_offset(tlv_next_item_ptr(&cursor),
+ cursor.current);
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_delete_item(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end)
+{
+ efx_rc_t rc;
+ tlv_cursor_t cursor;
+
+ _NOTE(ARGUNUSED(length, end))
+
+ if ((rc = tlv_init_cursor_at_offset(&cursor, (uint8_t *)bufferp,
+ buffer_size, offset)) != 0) {
+ goto fail1;
+ }
+
+ if ((rc = tlv_delete(&cursor)) != 0)
+ goto fail2;
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_nvram_buffer_finish(
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size)
+{
+ efx_rc_t rc;
+ tlv_cursor_t cursor;
+
+ if ((rc = tlv_init_cursor_from_size(&cursor, (uint8_t *)bufferp,
+ buffer_size)) != 0) {
+ rc = EFAULT;
+ goto fail1;
+ }
+
+ if ((rc = tlv_require_end(&cursor)) != 0)
+ goto fail2;
+
+ if ((rc = tlv_update_partition_len_and_cks(&cursor)) != 0)
+ goto fail3;
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+
/*
* Read and validate a segment from a partition. A segment is a complete
* tlv chain between PARTITION_HEADER and PARTITION_END tags. There may
@@ -1113,7 +1680,7 @@ ef10_nvram_segment_write_tlv(
* Read the segment from NVRAM into the segment_data buffer and validate
* it, returning if it does not validate. This is not a failure unless
* this is the first segment in a partition. In this case the caller
- * must propogate the error.
+ * must propagate the error.
*/
status = ef10_nvram_read_tlv_segment(enp, partn, *partn_offsetp,
*seg_datap, *src_remain_lenp);
@@ -1789,4 +2356,4 @@ ef10_nvram_partn_rw_finish(
#endif /* EFSYS_OPT_NVRAM */
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/ef10_phy.c b/sys/dev/sfxge/common/ef10_phy.c
new file mode 100644
index 0000000..77b2846
--- /dev/null
+++ b/sys/dev/sfxge/common/ef10_phy.c
@@ -0,0 +1,477 @@
+/*-
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of the FreeBSD Project.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "efx.h"
+#include "efx_impl.h"
+
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+
+static void
+mcdi_phy_decode_cap(
+ __in uint32_t mcdi_cap,
+ __out uint32_t *maskp)
+{
+ uint32_t mask;
+
+ mask = 0;
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_10HDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10FDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_10FDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100HDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_100HDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100FDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_100FDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000HDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_1000HDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_1000FDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_10000FDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN))
+ mask |= (1 << EFX_PHY_CAP_40000FDX);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
+ mask |= (1 << EFX_PHY_CAP_PAUSE);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
+ mask |= (1 << EFX_PHY_CAP_ASYM);
+ if (mcdi_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
+ mask |= (1 << EFX_PHY_CAP_AN);
+
+ *maskp = mask;
+}
+
+static void
+mcdi_phy_decode_link_mode(
+ __in efx_nic_t *enp,
+ __in uint32_t link_flags,
+ __in unsigned int speed,
+ __in unsigned int fcntl,
+ __out efx_link_mode_t *link_modep,
+ __out unsigned int *fcntlp)
+{
+ boolean_t fd = !!(link_flags &
+ (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN));
+ boolean_t up = !!(link_flags &
+ (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN));
+
+ _NOTE(ARGUNUSED(enp))
+
+ if (!up)
+ *link_modep = EFX_LINK_DOWN;
+ else if (speed == 40000 && fd)
+ *link_modep = EFX_LINK_40000FDX;
+ else if (speed == 10000 && fd)
+ *link_modep = EFX_LINK_10000FDX;
+ else if (speed == 1000)
+ *link_modep = fd ? EFX_LINK_1000FDX : EFX_LINK_1000HDX;
+ else if (speed == 100)
+ *link_modep = fd ? EFX_LINK_100FDX : EFX_LINK_100HDX;
+ else if (speed == 10)
+ *link_modep = fd ? EFX_LINK_10FDX : EFX_LINK_10HDX;
+ else
+ *link_modep = EFX_LINK_UNKNOWN;
+
+ if (fcntl == MC_CMD_FCNTL_OFF)
+ *fcntlp = 0;
+ else if (fcntl == MC_CMD_FCNTL_RESPOND)
+ *fcntlp = EFX_FCNTL_RESPOND;
+ else if (fcntl == MC_CMD_FCNTL_GENERATE)
+ *fcntlp = EFX_FCNTL_GENERATE;
+ else if (fcntl == MC_CMD_FCNTL_BIDIR)
+ *fcntlp = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE;
+ else {
+ EFSYS_PROBE1(mc_pcol_error, int, fcntl);
+ *fcntlp = 0;
+ }
+}
+
+
+ void
+ef10_phy_link_ev(
+ __in efx_nic_t *enp,
+ __in efx_qword_t *eqp,
+ __out efx_link_mode_t *link_modep)
+{
+ efx_port_t *epp = &(enp->en_port);
+ unsigned int link_flags;
+ unsigned int speed;
+ unsigned int fcntl;
+ efx_link_mode_t link_mode;
+ uint32_t lp_cap_mask;
+
+ /*
+ * Convert the LINKCHANGE speed enumeration into mbit/s, in the
+ * same way as GET_LINK encodes the speed
+ */
+ switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) {
+ case MCDI_EVENT_LINKCHANGE_SPEED_100M:
+ speed = 100;
+ break;
+ case MCDI_EVENT_LINKCHANGE_SPEED_1G:
+ speed = 1000;
+ break;
+ case MCDI_EVENT_LINKCHANGE_SPEED_10G:
+ speed = 10000;
+ break;
+ case MCDI_EVENT_LINKCHANGE_SPEED_40G:
+ speed = 40000;
+ break;
+ default:
+ speed = 0;
+ break;
+ }
+
+ link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS);
+ mcdi_phy_decode_link_mode(enp, link_flags, speed,
+ MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL),
+ &link_mode, &fcntl);
+ mcdi_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP),
+ &lp_cap_mask);
+
+ /*
+ * It's safe to update ep_lp_cap_mask without the driver's port lock
+ * because presumably any concurrently running efx_port_poll() is
+ * only going to arrive at the same value.
+ *
+ * ep_fcntl has two meanings. It's either the link common fcntl
+ * (if the PHY supports AN), or it's the forced link state. If
+ * the former, it's safe to update the value for the same reason as
+ * for ep_lp_cap_mask. If the latter, then just ignore the value,
+ * because we can race with efx_mac_fcntl_set().
+ */
+ epp->ep_lp_cap_mask = lp_cap_mask;
+ epp->ep_fcntl = fcntl;
+
+ *link_modep = link_mode;
+}
+
+ __checkReturn efx_rc_t
+ef10_phy_power(
+ __in efx_nic_t *enp,
+ __in boolean_t power)
+{
+ efx_rc_t rc;
+
+ if (!power)
+ return (0);
+
+ /* Check if the PHY is a zombie */
+ if ((rc = ef10_phy_verify(enp)) != 0)
+ goto fail1;
+
+ enp->en_reset_flags |= EFX_RESET_PHY;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_phy_get_link(
+ __in efx_nic_t *enp,
+ __out ef10_link_state_t *elsp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_LINK_IN_LEN,
+ MC_CMD_GET_LINK_OUT_LEN)];
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_LINK;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_LINK_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_LINK_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_CAP),
+ &elsp->els_adv_cap_mask);
+ mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_LP_CAP),
+ &elsp->els_lp_cap_mask);
+
+ mcdi_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS),
+ MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED),
+ MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL),
+ &elsp->els_link_mode, &elsp->els_fcntl);
+
+#if EFSYS_OPT_LOOPBACK
+ /* Assert the MC_CMD_LOOPBACK and EFX_LOOPBACK namespace agree */
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_NONE == EFX_LOOPBACK_OFF);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_DATA == EFX_LOOPBACK_DATA);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMAC == EFX_LOOPBACK_GMAC);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGMII == EFX_LOOPBACK_XGMII);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGXS == EFX_LOOPBACK_XGXS);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XAUI == EFX_LOOPBACK_XAUI);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMII == EFX_LOOPBACK_GMII);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_SGMII == EFX_LOOPBACK_SGMII);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGBR == EFX_LOOPBACK_XGBR);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XFI == EFX_LOOPBACK_XFI);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XAUI_FAR == EFX_LOOPBACK_XAUI_FAR);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMII_FAR == EFX_LOOPBACK_GMII_FAR);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_SGMII_FAR == EFX_LOOPBACK_SGMII_FAR);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XFI_FAR == EFX_LOOPBACK_XFI_FAR);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GPHY == EFX_LOOPBACK_GPHY);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PHYXS == EFX_LOOPBACK_PHY_XS);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PCS == EFX_LOOPBACK_PCS);
+ EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PMAPMD == EFX_LOOPBACK_PMA_PMD);
+
+ elsp->els_loopback = MCDI_OUT_DWORD(req, GET_LINK_OUT_LOOPBACK_MODE);
+#endif /* EFSYS_OPT_LOOPBACK */
+
+ elsp->els_mac_up = MCDI_OUT_DWORD(req, GET_LINK_OUT_MAC_FAULT) == 0;
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_phy_reconfigure(
+ __in efx_nic_t *enp)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ efx_port_t *epp = &(enp->en_port);
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_SET_LINK_IN_LEN,
+ MC_CMD_SET_LINK_OUT_LEN)];
+ uint32_t cap_mask;
+ unsigned int led_mode;
+ unsigned int speed;
+ efx_rc_t rc;
+
+ if (~encp->enc_func_flags & EFX_NIC_FUNC_LINKCTRL)
+ goto out;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_SET_LINK;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_SET_LINK_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_SET_LINK_OUT_LEN;
+
+ cap_mask = epp->ep_adv_cap_mask;
+ MCDI_IN_POPULATE_DWORD_10(req, SET_LINK_IN_CAP,
+ PHY_CAP_10HDX, (cap_mask >> EFX_PHY_CAP_10HDX) & 0x1,
+ PHY_CAP_10FDX, (cap_mask >> EFX_PHY_CAP_10FDX) & 0x1,
+ PHY_CAP_100HDX, (cap_mask >> EFX_PHY_CAP_100HDX) & 0x1,
+ PHY_CAP_100FDX, (cap_mask >> EFX_PHY_CAP_100FDX) & 0x1,
+ PHY_CAP_1000HDX, (cap_mask >> EFX_PHY_CAP_1000HDX) & 0x1,
+ PHY_CAP_1000FDX, (cap_mask >> EFX_PHY_CAP_1000FDX) & 0x1,
+ PHY_CAP_10000FDX, (cap_mask >> EFX_PHY_CAP_10000FDX) & 0x1,
+ PHY_CAP_PAUSE, (cap_mask >> EFX_PHY_CAP_PAUSE) & 0x1,
+ PHY_CAP_ASYM, (cap_mask >> EFX_PHY_CAP_ASYM) & 0x1,
+ PHY_CAP_AN, (cap_mask >> EFX_PHY_CAP_AN) & 0x1);
+ /* Too many fields for for POPULATE macros, so insert this afterwards */
+ MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+ PHY_CAP_40000FDX, (cap_mask >> EFX_PHY_CAP_40000FDX) & 0x1);
+
+#if EFSYS_OPT_LOOPBACK
+ MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE,
+ epp->ep_loopback_type);
+ switch (epp->ep_loopback_link_mode) {
+ case EFX_LINK_100FDX:
+ speed = 100;
+ break;
+ case EFX_LINK_1000FDX:
+ speed = 1000;
+ break;
+ case EFX_LINK_10000FDX:
+ speed = 10000;
+ break;
+ case EFX_LINK_40000FDX:
+ speed = 40000;
+ break;
+ default:
+ speed = 0;
+ }
+#else
+ MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE, MC_CMD_LOOPBACK_NONE);
+ speed = 0;
+#endif /* EFSYS_OPT_LOOPBACK */
+ MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_SPEED, speed);
+
+#if EFSYS_OPT_PHY_FLAGS
+ MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, epp->ep_phy_flags);
+#else
+ MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, 0);
+#endif /* EFSYS_OPT_PHY_FLAGS */
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ /* And set the blink mode */
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_SET_ID_LED;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_SET_ID_LED_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_SET_ID_LED_OUT_LEN;
+
+#if EFSYS_OPT_PHY_LED_CONTROL
+ switch (epp->ep_phy_led_mode) {
+ case EFX_PHY_LED_DEFAULT:
+ led_mode = MC_CMD_LED_DEFAULT;
+ break;
+ case EFX_PHY_LED_OFF:
+ led_mode = MC_CMD_LED_OFF;
+ break;
+ case EFX_PHY_LED_ON:
+ led_mode = MC_CMD_LED_ON;
+ break;
+ default:
+ EFSYS_ASSERT(0);
+ led_mode = MC_CMD_LED_DEFAULT;
+ }
+
+ MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, led_mode);
+#else
+ MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, MC_CMD_LED_DEFAULT);
+#endif /* EFSYS_OPT_PHY_LED_CONTROL */
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail2;
+ }
+out:
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_phy_verify(
+ __in efx_nic_t *enp)
+{
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_GET_PHY_STATE_IN_LEN,
+ MC_CMD_GET_PHY_STATE_OUT_LEN)];
+ uint32_t state;
+ efx_rc_t rc;
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_GET_PHY_STATE;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_GET_PHY_STATE_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MC_CMD_GET_PHY_STATE_OUT_LEN;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_GET_PHY_STATE_OUT_LEN) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ state = MCDI_OUT_DWORD(req, GET_PHY_STATE_OUT_STATE);
+ if (state != MC_CMD_PHY_STATE_OK) {
+ if (state != MC_CMD_PHY_STATE_ZOMBIE)
+ EFSYS_PROBE1(mc_pcol_error, int, state);
+ rc = ENOTACTIVE;
+ goto fail3;
+ }
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_phy_oui_get(
+ __in efx_nic_t *enp,
+ __out uint32_t *ouip)
+{
+ _NOTE(ARGUNUSED(enp, ouip))
+
+ return (ENOTSUP);
+}
+
+#if EFSYS_OPT_PHY_STATS
+
+ __checkReturn efx_rc_t
+ef10_phy_stats_update(
+ __in efx_nic_t *enp,
+ __in efsys_mem_t *esmp,
+ __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat)
+{
+ /* TBD: no stats support in firmware yet */
+ _NOTE(ARGUNUSED(enp, esmp))
+ memset(stat, 0, EFX_PHY_NSTATS * sizeof (*stat));
+
+ return (0);
+}
+
+#endif /* EFSYS_OPT_PHY_STATS */
+
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_rx.c b/sys/dev/sfxge/common/ef10_rx.c
index 984d48d..3bbee26 100644
--- a/sys/dev/sfxge/common/hunt_rx.c
+++ b/sys/dev/sfxge/common/ef10_rx.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
#include "efx_impl.h"
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
static __checkReturn efx_rc_t
@@ -50,14 +50,15 @@ efx_mcdi_init_rxq(
{
efx_mcdi_req_t req;
uint8_t payload[
- MAX(MC_CMD_INIT_RXQ_IN_LEN(EFX_RXQ_NBUFS(EFX_RXQ_MAXNDESCS)),
- MC_CMD_INIT_RXQ_OUT_LEN)];
+ MC_CMD_INIT_RXQ_IN_LEN(EFX_RXQ_NBUFS(EFX_RXQ_MAXNDESCS))];
int npages = EFX_RXQ_NBUFS(size);
int i;
efx_qword_t *dma_addr;
uint64_t addr;
efx_rc_t rc;
+ /* If this changes, then the payload size might need to change. */
+ EFSYS_ASSERT3U(MC_CMD_INIT_RXQ_OUT_LEN, ==, 0);
EFSYS_ASSERT3U(size, <=, EFX_RXQ_MAXNDESCS);
(void) memset(payload, 0, sizeof (payload));
@@ -127,7 +128,7 @@ efx_mcdi_fini_rxq(
MCDI_IN_SET_DWORD(req, FINI_RXQ_IN_INSTANCE, instance);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if ((req.emr_rc != 0) && (req.emr_rc != MC_CMD_ERR_EALREADY)) {
rc = req.emr_rc;
@@ -249,7 +250,7 @@ efx_mcdi_rss_context_free(
MCDI_IN_SET_DWORD(req, RSS_CONTEXT_FREE_IN_RSS_CONTEXT_ID, rss_context);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -601,6 +602,8 @@ ef10_rx_prefix_pktlen(
__in uint8_t *buffer,
__out uint16_t *lengthp)
{
+ _NOTE(ARGUNUSED(enp))
+
/*
* The RX pseudo-header contains the packet length, excluding the
* pseudo-header. If the hardware receive datapath was operating in
@@ -619,6 +622,8 @@ ef10_rx_prefix_hash(
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer)
{
+ _NOTE(ARGUNUSED(enp))
+
switch (func) {
case EFX_RX_HASHALG_TOEPLITZ:
return (buffer[0] |
@@ -745,7 +750,7 @@ ef10_rx_qcreate(
efx_rc_t rc;
boolean_t disable_scatter;
- _NOTE(ARGUNUSED(erp))
+ _NOTE(ARGUNUSED(id, erp))
EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS == (1 << ESF_DZ_RX_QLABEL_WIDTH));
EFSYS_ASSERT3U(label, <, EFX_EV_RX_NLABELS);
@@ -823,4 +828,4 @@ ef10_rx_fini(
#endif /* EFSYS_OPT_RX_SCALE */
}
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/ef10_tlv_layout.h b/sys/dev/sfxge/common/ef10_tlv_layout.h
index 80364ce..1360f5e 100644
--- a/sys/dev/sfxge/common/ef10_tlv_layout.h
+++ b/sys/dev/sfxge/common/ef10_tlv_layout.h
@@ -54,8 +54,10 @@
* where:
*
* - L is a location, indicating where this tag is expected to be found:
- * 0 for static configuration, or 1 for dynamic configuration. Other
- * values are reserved.
+ * 0: static configuration
+ * 1: dynamic configuration
+ * 2: firmware internal use
+ * 3: license partition
*
* - TTT is a type, which is just a unique value. The same type value
* might appear in both locations, indicating a relationship between
@@ -774,7 +776,40 @@ struct tlv_pcie_link_settings {
uint16_t width; /* Number of lanes */
};
-#define TLV_TAG_LICENSE (0x20800000)
+/* TX event merging config.
+ *
+ * Sets the global maximum number of events for the merging bins, and the
+ * global timeout configuration for the bins, and the global timeout for
+ * empty queues.
+ */
+#define TLV_TAG_TX_EVENT_MERGING_CONFIG (0x10210000)
+struct tlv_tx_event_merging_config {
+ uint32_t tag;
+ uint32_t length;
+ uint32_t max_events;
+#define TLV_TX_EVENT_MERGING_CONFIG_MAX_EVENTS_MAX ((1 << 4) - 1)
+ uint32_t timeout_ns;
+ uint32_t qempty_timeout_ns; /* Medford only */
+};
+#define TLV_TX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7
+#define TLV_TX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 1400
+#define TLV_TX_EVENT_MERGING_QEMPTY_TIMEOUT_NS_DEFAULT 700
+
+/* Tx vFIFO Low latency configuration
+ *
+ * To keep the desired booting behaviour for the switch, it just requires to
+ * know if the low latency mode is enabled.
+ */
+
+#define TLV_TAG_TX_VFIFO_ULL_MODE (0x10220000)
+struct tlv_tx_vfifo_ull_mode {
+ uint32_t tag;
+ uint32_t length;
+ uint8_t mode;
+#define TLV_TX_VFIFO_ULL_MODE_DEFAULT 0
+};
+
+#define TLV_TAG_LICENSE (0x30800000)
typedef struct tlv_license {
uint32_t tag;
@@ -782,4 +817,104 @@ typedef struct tlv_license {
uint8_t data[];
} tlv_license_t;
+/* TSA NIC IP address configuration
+ *
+ * Sets the TSA NIC IP address statically via configuration tool or dynamically
+ * via DHCP via snooping based on the mode selection (0=Static, 1=DHCP, 2=Snoop)
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and will
+ * be moved to a private partition during TSA development. It is not used in any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_TSAN_CONFIG (0x10220000)
+
+#define TLV_TSAN_IP_MODE_STATIC (0)
+#define TLV_TSAN_IP_MODE_DHCP (1)
+#define TLV_TSAN_IP_MODE_SNOOP (2)
+typedef struct tlv_tsan_config {
+ uint32_t tag;
+ uint32_t length;
+ uint32_t mode;
+ uint32_t ip;
+ uint32_t netmask;
+ uint32_t gateway;
+ uint32_t port;
+ uint32_t bind_retry;
+ uint32_t bind_bkout;
+} tlv_tsan_config_t;
+
+/* TSA Controller IP address configuration
+ *
+ * Sets the TSA Controller IP address statically via configuration tool
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and will
+ * be moved to a private partition during TSA development. It is not used in any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_TSAC_CONFIG (0x10230000)
+
+#define TLV_MAX_TSACS (4)
+typedef struct tlv_tsac_config {
+ uint32_t tag;
+ uint32_t length;
+ uint32_t num_tsacs;
+ uint32_t ip[TLV_MAX_TSACS];
+ uint32_t port[TLV_MAX_TSACS];
+} tlv_tsac_config_t;
+
+/* Binding ticket
+ *
+ * Sets the TSA NIC binding ticket used for binding process between the TSA NIC
+ * and the TSA Controller
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and will
+ * be moved to a private partition during TSA development. It is not used in any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_BINDING_TICKET (0x10240000)
+
+typedef struct tlv_binding_ticket {
+ uint32_t tag;
+ uint32_t length;
+ uint8_t bytes[];
+} tlv_binding_ticket_t;
+
+/* Solarflare private key
+ *
+ * Sets the Solareflare private key used for signing during the binding process
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and will
+ * be moved to a private partition during TSA development. It is not used in any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_PIK_SF (0x10250000)
+
+typedef struct tlv_pik_sf {
+ uint32_t tag;
+ uint32_t length;
+ uint8_t bytes[];
+} tlv_pik_sf_t;
+
+/* CA root certificate
+ *
+ * Sets the CA root certificate used for TSA Controller verfication during
+ * TLS connection setup between the TSA NIC and the TSA Controller
+ *
+ * NOTE: This TAG is temporarily placed in the dynamic config partition and will
+ * be moved to a private partition during TSA development. It is not used in any
+ * released code yet.
+ */
+
+#define TLV_TAG_TMP_CA_ROOT_CERT (0x10260000)
+
+typedef struct tlv_ca_root_cert {
+ uint32_t tag;
+ uint32_t length;
+ uint8_t bytes[];
+} tlv_ca_root_cert_t;
+
#endif /* CI_MGMT_TLV_LAYOUT_H */
diff --git a/sys/dev/sfxge/common/hunt_tx.c b/sys/dev/sfxge/common/ef10_tx.c
index baa7444..a4729a1 100755
--- a/sys/dev/sfxge/common/hunt_tx.c
+++ b/sys/dev/sfxge/common/ef10_tx.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
#include "efx_impl.h"
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
#if EFSYS_OPT_QSTATS
#define EFX_TX_QSTAT_INCR(_etp, _stat) \
@@ -149,7 +149,7 @@ efx_mcdi_fini_txq(
MCDI_IN_SET_DWORD(req, FINI_TXQ_IN_INSTANCE, instance);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if ((req.emr_rc != 0) && (req.emr_rc != MC_CMD_ERR_EALREADY)) {
rc = req.emr_rc;
@@ -195,6 +195,7 @@ ef10_tx_qcreate(
efx_qword_t desc;
efx_rc_t rc;
+ _NOTE(ARGUNUSED(id))
if ((rc = efx_mcdi_init_txq(enp, n, eep->ee_index, label, index, flags,
esmp)) != 0)
@@ -569,7 +570,7 @@ ef10_tx_qdesc_dma_create(
}
void
-hunt_tx_qdesc_tso_create(
+ef10_tx_qdesc_tso_create(
__in efx_txq_t *etp,
__in uint16_t ipv4_id,
__in uint32_t tcp_seq,
@@ -648,6 +649,7 @@ ef10_tx_qpace(
/* FIXME */
_NOTE(ARGUNUSED(etp, ns))
+ _NOTE(CONSTANTCONDITION)
if (B_FALSE) {
rc = ENOTSUP;
goto fail1;
@@ -707,4 +709,4 @@ ef10_tx_qstats_update(
#endif /* EFSYS_OPT_QSTATS */
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_vpd.c b/sys/dev/sfxge/common/ef10_vpd.c
index 41b4b83..961f3b6 100644
--- a/sys/dev/sfxge/common/hunt_vpd.c
+++ b/sys/dev/sfxge/common/ef10_vpd.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_VPD
-#if EFSYS_OPT_HUNTINGTON
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
#include "ef10_tlv_layout.h"
@@ -74,7 +74,7 @@ ef10_vpd_init(
tag, &svpd, &svpd_size);
if (rc != 0) {
if (rc == EACCES) {
- /* Unpriviledged functions cannot access VPD */
+ /* Unprivileged functions cannot access VPD */
goto out;
}
goto fail1;
@@ -332,8 +332,11 @@ ef10_vpd_get(
/* And then from the provided data buffer */
if ((rc = efx_vpd_hunk_get(data, size, evvp->evv_tag,
- evvp->evv_keyword, &offset, &length)) != 0)
+ evvp->evv_keyword, &offset, &length)) != 0) {
+ if (rc == ENOENT)
+ return (rc);
goto fail2;
+ }
evvp->evv_length = length;
memcpy(evvp->evv_value, data + offset, length);
@@ -458,6 +461,6 @@ ef10_vpd_fini(
}
}
-#endif /* EFSYS_OPT_HUNTINGTON */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
#endif /* EFSYS_OPT_VPD */
diff --git a/sys/dev/sfxge/common/efsys.h b/sys/dev/sfxge/common/efsys.h
index 14238ad..aef9a07 100644
--- a/sys/dev/sfxge/common/efsys.h
+++ b/sys/dev/sfxge/common/efsys.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
@@ -236,11 +236,9 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map,
#define EFSYS_OPT_NAMES 1
-#define EFSYS_OPT_FALCON 0
-#define EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE 0
#define EFSYS_OPT_SIENA 1
#define EFSYS_OPT_HUNTINGTON 1
-#define EFSYS_OPT_MEDFORD 0
+#define EFSYS_OPT_MEDFORD 1
#ifdef DEBUG
#define EFSYS_OPT_CHECK_REG 1
#else
@@ -251,39 +249,22 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map,
#define EFSYS_OPT_MCDI_LOGGING 0
#define EFSYS_OPT_MCDI_PROXY_AUTH 0
-#define EFSYS_OPT_MAC_FALCON_GMAC 0
-#define EFSYS_OPT_MAC_FALCON_XMAC 0
#define EFSYS_OPT_MAC_STATS 1
#define EFSYS_OPT_LOOPBACK 0
-#define EFSYS_OPT_MON_NULL 0
-#define EFSYS_OPT_MON_LM87 0
-#define EFSYS_OPT_MON_MAX6647 0
#define EFSYS_OPT_MON_MCDI 0
#define EFSYS_OPT_MON_STATS 0
-#define EFSYS_OPT_PHY_NULL 0
-#define EFSYS_OPT_PHY_QT2022C2 0
-#define EFSYS_OPT_PHY_SFX7101 0
-#define EFSYS_OPT_PHY_TXC43128 0
-#define EFSYS_OPT_PHY_SFT9001 0
-#define EFSYS_OPT_PHY_QT2025C 0
#define EFSYS_OPT_PHY_STATS 1
-#define EFSYS_OPT_PHY_PROPS 0
-#define EFSYS_OPT_PHY_BIST 0
#define EFSYS_OPT_BIST 1
#define EFSYS_OPT_PHY_LED_CONTROL 1
#define EFSYS_OPT_PHY_FLAGS 0
#define EFSYS_OPT_VPD 1
#define EFSYS_OPT_NVRAM 1
-#define EFSYS_OPT_NVRAM_FALCON_BOOTROM 0
-#define EFSYS_OPT_NVRAM_SFT9001 0
-#define EFSYS_OPT_NVRAM_SFX7101 0
#define EFSYS_OPT_BOOTCFG 0
-#define EFSYS_OPT_PCIE_TUNE 0
#define EFSYS_OPT_DIAG 0
#define EFSYS_OPT_WOL 1
#define EFSYS_OPT_RX_SCALE 1
@@ -297,6 +278,8 @@ sfxge_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map,
#define EFSYS_OPT_LICENSING 0
+#define EFSYS_OPT_ALLOW_UNCONFIGURED_NIC 0
+
/* ID */
typedef struct __efsys_identifier_s efsys_identifier_t;
@@ -1129,22 +1112,6 @@ typedef struct efsys_lock_s {
_NOTE(CONSTANTCONDITION) \
} while (B_FALSE)
-/* PREEMPT */
-
-#define EFSYS_PREEMPT_DISABLE(_state) \
- do { \
- (_state) = (_state); \
- critical_enter(); \
- _NOTE(CONSTANTCONDITION) \
- } while (B_FALSE)
-
-#define EFSYS_PREEMPT_ENABLE(_state) \
- do { \
- (_state) = (_state); \
- critical_exit(_state); \
- _NOTE(CONSTANTCONDITION) \
- } while (B_FALSE)
-
/* STAT */
typedef uint64_t efsys_stat_t;
diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h
index 14374cf..32a3dfa 100644
--- a/sys/dev/sfxge/common/efx.h
+++ b/sys/dev/sfxge/common/efx.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2006-2015 Solarflare Communications Inc.
+ * Copyright (c) 2006-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,7 @@
#define _SYS_EFX_H
#include "efsys.h"
+#include "efx_check.h"
#include "efx_phy_ids.h"
#ifdef __cplusplus
@@ -58,7 +59,7 @@ typedef __success(return == 0) int efx_rc_t;
typedef enum efx_family_e {
EFX_FAMILY_INVALID,
- EFX_FAMILY_FALCON,
+ EFX_FAMILY_FALCON, /* Obsolete and not supported */
EFX_FAMILY_SIENA,
EFX_FAMILY_HUNTINGTON,
EFX_FAMILY_MEDFORD,
@@ -71,10 +72,6 @@ efx_family(
__in uint16_t devid,
__out efx_family_t *efp);
-extern __checkReturn efx_rc_t
-efx_infer_family(
- __in efsys_bar_t *esbp,
- __out efx_family_t *efp);
#define EFX_PCI_VENID_SFC 0x1924
@@ -148,19 +145,6 @@ extern __checkReturn efx_rc_t
efx_nic_probe(
__in efx_nic_t *enp);
-#if EFSYS_OPT_PCIE_TUNE
-
-extern __checkReturn efx_rc_t
-efx_nic_pcie_tune(
- __in efx_nic_t *enp,
- unsigned int nlanes);
-
-extern __checkReturn efx_rc_t
-efx_nic_pcie_extended_sync(
- __in efx_nic_t *enp);
-
-#endif /* EFSYS_OPT_PCIE_TUNE */
-
extern __checkReturn efx_rc_t
efx_nic_init(
__in efx_nic_t *enp);
@@ -189,6 +173,30 @@ extern void
efx_nic_destroy(
__in efx_nic_t *enp);
+#define EFX_PCIE_LINK_SPEED_GEN1 1
+#define EFX_PCIE_LINK_SPEED_GEN2 2
+#define EFX_PCIE_LINK_SPEED_GEN3 3
+
+typedef enum efx_pcie_link_performance_e {
+ EFX_PCIE_LINK_PERFORMANCE_UNKNOWN_BANDWIDTH,
+ EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_BANDWIDTH,
+ EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_LATENCY,
+ EFX_PCIE_LINK_PERFORMANCE_OPTIMAL
+} efx_pcie_link_performance_t;
+
+extern __checkReturn efx_rc_t
+efx_nic_calculate_pcie_link_bandwidth(
+ __in uint32_t pcie_link_width,
+ __in uint32_t pcie_link_gen,
+ __out uint32_t *bandwidth_mbpsp);
+
+extern __checkReturn efx_rc_t
+efx_nic_check_pcie_link_speed(
+ __in efx_nic_t *enp,
+ __in uint32_t pcie_link_width,
+ __in uint32_t pcie_link_gen,
+ __out efx_pcie_link_performance_t *resultp);
+
#if EFSYS_OPT_MCDI
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
@@ -262,7 +270,6 @@ efx_mcdi_fini(
/* INTR */
-#define EFX_NINTR_FALCON 64
#define EFX_NINTR_SIENA 1024
typedef enum efx_intr_type_e {
@@ -435,18 +442,30 @@ typedef enum efx_link_mode_e {
#define EFX_MAC_SDU_MAX 9202
-#define EFX_MAC_PDU(_sdu) \
- P2ROUNDUP(((_sdu) \
- + /* EtherII */ 14 \
- + /* VLAN */ 4 \
- + /* CRC */ 4 \
- + /* bug16011 */ 16), \
- (1 << 3))
+#define EFX_MAC_PDU_ADJUSTMENT \
+ (/* EtherII */ 14 \
+ + /* VLAN */ 4 \
+ + /* CRC */ 4 \
+ + /* bug16011 */ 16) \
+
+#define EFX_MAC_PDU(_sdu) \
+ P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
+
+/*
+ * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SDU_FROM_PDU() may give
+ * the SDU rounded up slightly.
+ */
+#define EFX_MAC_SDU_FROM_PDU(_pdu) ((_pdu) - EFX_MAC_PDU_ADJUSTMENT)
#define EFX_MAC_PDU_MIN 60
#define EFX_MAC_PDU_MAX EFX_MAC_PDU(EFX_MAC_SDU_MAX)
extern __checkReturn efx_rc_t
+efx_mac_pdu_get(
+ __in efx_nic_t *enp,
+ __out size_t *pdu);
+
+extern __checkReturn efx_rc_t
efx_mac_pdu_set(
__in efx_nic_t *enp,
__in size_t pdu);
@@ -557,9 +576,6 @@ efx_mac_stats_update(
typedef enum efx_mon_type_e {
EFX_MON_INVALID = 0,
- EFX_MON_NULL,
- EFX_MON_LM87,
- EFX_MON_MAX6647,
EFX_MON_SFC90X0,
EFX_MON_SFC91X0,
EFX_MON_SFC92X0,
@@ -583,7 +599,7 @@ efx_mon_init(
#define EFX_MON_STATS_PAGE_SIZE 0x100
#define EFX_MON_MASK_ELEMENT_SIZE 32
-/* START MKCONFIG GENERATED MonitorHeaderStatsBlock c09b13f732431f23 */
+/* START MKCONFIG GENERATED MonitorHeaderStatsBlock 5d4ee5185e419abe */
typedef enum efx_mon_stat_e {
EFX_MON_STAT_2_5V,
EFX_MON_STAT_VCCP1,
@@ -660,6 +676,8 @@ typedef enum efx_mon_stat_e {
EFX_MON_STAT_PHY0_VCC,
EFX_MON_STAT_PHY1_VCC,
EFX_MON_STAT_CONTROLLER_TDIODE_TEMP,
+ EFX_MON_STAT_BOARD_FRONT_TEMP,
+ EFX_MON_STAT_BOARD_BACK_TEMP,
EFX_MON_NSTATS
} efx_mon_stat_t;
@@ -701,15 +719,6 @@ efx_mon_fini(
/* PHY */
-#define PMA_PMD_MMD 1
-#define PCS_MMD 3
-#define PHY_XS_MMD 4
-#define DTE_XS_MMD 5
-#define AN_MMD 7
-#define CL22EXT_MMD 29
-
-#define MAXMMD ((1 << 5) - 1)
-
extern __checkReturn efx_rc_t
efx_phy_verify(
__in efx_nic_t *enp);
@@ -961,33 +970,6 @@ efx_phy_stats_update(
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-
-#if EFSYS_OPT_NAMES
-
-extern const char *
-efx_phy_prop_name(
- __in efx_nic_t *enp,
- __in unsigned int id);
-
-#endif /* EFSYS_OPT_NAMES */
-
-#define EFX_PHY_PROP_DEFAULT 0x00000001
-
-extern __checkReturn efx_rc_t
-efx_phy_prop_get(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t flags,
- __out uint32_t *valp);
-
-extern __checkReturn efx_rc_t
-efx_phy_prop_set(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t val);
-
-#endif /* EFSYS_OPT_PHY_PROPS */
#if EFSYS_OPT_BIST
@@ -1124,9 +1106,6 @@ typedef struct efx_nic_cfg_s {
#if EFSYS_OPT_PHY_STATS
uint64_t enc_phy_stat_mask;
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
- unsigned int enc_phy_nprops;
-#endif /* EFSYS_OPT_PHY_PROPS */
#if EFSYS_OPT_SIENA
uint8_t enc_mcdi_mdio_channel;
#if EFSYS_OPT_PHY_STATS
@@ -1173,6 +1152,9 @@ typedef struct efx_nic_cfg_s {
uint32_t enc_mcdi_max_payload_length;
/* VPD may be per-PF or global */
boolean_t enc_vpd_is_global;
+ /* Minimum unidirectional bandwidth in Mb/s to max out all ports */
+ uint32_t enc_required_pcie_bandwidth_mbps;
+ uint32_t enc_max_pcie_link_gen;
} efx_nic_cfg_t;
#define EFX_PCI_FUNCTION_IS_PF(_encp) ((_encp)->enc_vf == 0xffff)
@@ -1382,11 +1364,10 @@ efx_nvram_set_version(
__in efx_nvram_type_t type,
__in_ecount(4) uint16_t version[4]);
-/* Validate contents of TLV formatted partition */
extern __checkReturn efx_rc_t
-efx_nvram_tlv_validate(
+efx_nvram_validate(
__in efx_nic_t *enp,
- __in uint32_t partn,
+ __in efx_nvram_type_t type,
__in_bcount(partn_size) caddr_t partn_data,
__in size_t partn_size);
@@ -2345,6 +2326,10 @@ extern void
efx_lic_fini(
__in efx_nic_t *enp);
+extern __checkReturn boolean_t
+efx_lic_check_support(
+ __in efx_nic_t *enp);
+
extern __checkReturn efx_rc_t
efx_lic_update_licenses(
__in efx_nic_t *enp);
@@ -2369,6 +2354,97 @@ efx_lic_get_id(
__out_opt uint8_t *bufferp);
+extern __checkReturn efx_rc_t
+efx_lic_find_start(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ );
+
+extern __checkReturn efx_rc_t
+efx_lic_find_end(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ );
+
+extern __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_find_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ );
+
+extern __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_validate_key(
+ __in efx_nic_t *enp,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length
+ );
+
+extern __checkReturn efx_rc_t
+efx_lic_read_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(key_max_size, *lengthp)
+ caddr_t keyp,
+ __in size_t key_max_size,
+ __out uint32_t *lengthp
+ );
+
+extern __checkReturn efx_rc_t
+efx_lic_write_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_delete_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end,
+ __out uint32_t *deltap
+ );
+
+extern __checkReturn efx_rc_t
+efx_lic_create_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
+extern __checkReturn efx_rc_t
+efx_lic_finish_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
#endif /* EFSYS_OPT_LICENSING */
diff --git a/sys/dev/sfxge/common/efx_bootcfg.c b/sys/dev/sfxge/common/efx_bootcfg.c
index 16ee337..90ee1e4 100644
--- a/sys/dev/sfxge/common/efx_bootcfg.c
+++ b/sys/dev/sfxge/common/efx_bootcfg.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_check.h b/sys/dev/sfxge/common/efx_check.h
index d6b7cf4..ee473c4 100644
--- a/sys/dev/sfxge/common/efx_check.h
+++ b/sys/dev/sfxge/common/efx_check.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,10 @@
* from client code (and do not reappear in merges from other branches).
*/
+#ifdef EFSYS_OPT_FALCON
+# error "FALCON is obsolete and is not supported."
+#endif
+
/* Support NVRAM based boot config */
#if EFSYS_OPT_BOOTCFG
# if !EFSYS_OPT_NVRAM
@@ -52,47 +56,40 @@
/* Verify chip implements accessed registers */
#if EFSYS_OPT_CHECK_REG
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "CHECK_REG requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "CHECK_REG requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_CHECK_REG */
/* Decode fatal errors */
#if EFSYS_OPT_DECODE_INTR_FATAL
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
-# error "INTR_FATAL requires FALCON or SIENA"
+# if !EFSYS_OPT_SIENA
+# error "INTR_FATAL requires SIENA"
# endif
#endif /* EFSYS_OPT_DECODE_INTR_FATAL */
/* Support diagnostic hardware tests */
#if EFSYS_OPT_DIAG
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "DIAG requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "DIAG requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_DIAG */
/* Support optimized EVQ data access */
#if EFSYS_OPT_EV_PREFETCH
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "EV_PREFETCH requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "EV_PREFETCH requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_EV_PREFETCH */
-/* Support overriding the NVRAM and VPD configuration */
-#if EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE
-# if !EFSYS_OPT_FALCON
-# error "FALCON_NIC_CFG_OVERRIDE requires FALCON"
-# endif
-#endif /* EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE */
+#ifdef EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE
+# error "FALCON_NIC_CFG_OVERRIDE is obsolete and is not supported."
+#endif
/* Support hardware packet filters */
#if EFSYS_OPT_FILTER
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "FILTER requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "FILTER requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_FILTER */
@@ -104,31 +101,23 @@
/* Support hardware loopback modes */
#if EFSYS_OPT_LOOPBACK
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "LOOPBACK requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "LOOPBACK requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_LOOPBACK */
-/* Support Falcon GMAC */
-#if EFSYS_OPT_MAC_FALCON_GMAC
-# if !EFSYS_OPT_FALCON
-# error "MAC_FALCON_GMAC requires FALCON"
-# endif
-#endif /* EFSYS_OPT_MAC_FALCON_GMAC */
+#ifdef EFSYS_OPT_MAC_FALCON_GMAC
+# error "MAC_FALCON_GMAC is obsolete and is not supported."
+#endif
-/* Support Falcon XMAC */
-#if EFSYS_OPT_MAC_FALCON_XMAC
-# if !EFSYS_OPT_FALCON
-# error "MAC_FALCON_XMAC requires FALCON"
-# endif
-#endif /* EFSYS_OPT_MAC_FALCON_XMAC */
+#ifdef EFSYS_OPT_MAC_FALCON_XMAC
+# error "MAC_FALCON_XMAC is obsolete and is not supported."
+#endif
/* Support MAC statistics */
#if EFSYS_OPT_MAC_STATS
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "MAC_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "MAC_STATS requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_MAC_STATS */
@@ -159,42 +148,30 @@
# endif
#endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
-/* Support LM87 monitor */
-#if EFSYS_OPT_MON_LM87
-# if !EFSYS_OPT_FALCON
-# error "MON_LM87 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_MON_LM87 */
+#ifdef EFSYS_OPT_MON_LM87
+# error "MON_LM87 is obsolete and is not supported."
+#endif
-/* Support MAX6647 monitor */
-#if EFSYS_OPT_MON_MAX6647
-# if !EFSYS_OPT_FALCON
-# error "MON_MAX6647 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_MON_MAX6647 */
+#ifdef EFSYS_OPT_MON_MAX6647
+# error "MON_MAX6647 is obsolete and is not supported."
+#endif
-/* Support null monitor */
-#if EFSYS_OPT_MON_NULL
-# if !EFSYS_OPT_FALCON
-# error "MON_NULL requires FALCON"
-# endif
-#endif /* EFSYS_OPT_MON_NULL */
+#ifdef EFSYS_OPT_MON_NULL
+# error "MON_NULL is obsolete and is not supported."
+#endif
-/* Obsolete option */
#ifdef EFSYS_OPT_MON_SIENA
# error "MON_SIENA is obsolete (replaced by MON_MCDI)."
-#endif /* EFSYS_OPT_MON_SIENA*/
+#endif
-/* Obsolete option */
#ifdef EFSYS_OPT_MON_HUNTINGTON
# error "MON_HUNTINGTON is obsolete (replaced by MON_MCDI)."
-#endif /* EFSYS_OPT_MON_HUNTINGTON*/
+#endif
/* Support monitor statistics (voltage/temperature) */
#if EFSYS_OPT_MON_STATS
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "MON_STATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "MON_STATS requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_MON_STATS */
@@ -208,176 +185,124 @@
/* Support printable names for statistics */
#if EFSYS_OPT_NAMES
# if !(EFSYS_OPT_LOOPBACK || EFSYS_OPT_MAC_STATS || EFSYS_OPT_MCDI || \
- EFSYS_MON_STATS || EFSYS_OPT_PHY_PROPS || EFSYS_OPT_PHY_STATS || \
- EFSYS_OPT_QSTATS)
-# error "NAMES requires LOOPBACK or xxxSTATS or MCDI or PHY_PROPS"
+ EFSYS_MON_STATS || EFSYS_OPT_PHY_STATS || EFSYS_OPT_QSTATS)
+# error "NAMES requires LOOPBACK or xxxSTATS or MCDI"
# endif
#endif /* EFSYS_OPT_NAMES */
/* Support non volatile configuration */
#if EFSYS_OPT_NVRAM
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "NVRAM requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "NVRAM requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_NVRAM */
-/* Support Falcon bootrom */
-#if EFSYS_OPT_NVRAM_FALCON_BOOTROM
-# if !EFSYS_OPT_NVRAM
-# error "NVRAM_FALCON_BOOTROM requires NVRAM"
-# endif
-# if !EFSYS_OPT_FALCON
-# error "NVRAM_FALCON_BOOTROM requires FALCON"
-# endif
-#endif /* EFSYS_OPT_NVRAM_FALCON_BOOTROM */
+#ifdef EFSYS_OPT_NVRAM_FALCON_BOOTROM
+# error "NVRAM_FALCON_BOOTROM is obsolete and is not supported."
+#endif
-/* Support NVRAM config for SFT9001 */
-#if EFSYS_OPT_NVRAM_SFT9001
-# if !EFSYS_OPT_NVRAM
-# error "NVRAM_SFT9001 requires NVRAM"
-# endif
-# if !EFSYS_OPT_FALCON
-# error "NVRAM_SFT9001 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_NVRAM_SFT9001 */
+#ifdef EFSYS_OPT_NVRAM_SFT9001
+# error "NVRAM_SFT9001 is obsolete and is not supported."
+#endif
-/* Support NVRAM config for SFX7101 */
-#if EFSYS_OPT_NVRAM_SFX7101
-# if !EFSYS_OPT_NVRAM
-# error "NVRAM_SFX7101 requires NVRAM"
-# endif
-# if !EFSYS_OPT_FALCON
-# error "NVRAM_SFX7101 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_NVRAM_SFX7101 */
+#ifdef EFSYS_OPT_NVRAM_SFX7101
+# error "NVRAM_SFX7101 is obsolete and is not supported."
+#endif
-/* Support PCIe interface tuning */
-#if EFSYS_OPT_PCIE_TUNE
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
-# error "PCIE_TUNE requires FALCON or SIENA"
-# endif
-#endif /* EFSYS_OPT_PCIE_TUNE */
+#ifdef EFSYS_OPT_PCIE_TUNE
+# error "PCIE_TUNE is obsolete and is not supported."
+#endif
-/* Obsolete option */
-#if EFSYS_OPT_PHY_BIST
-# error "PHY_BIST is obsolete (replaced by BIST)."
-#endif /* EFSYS_OPT_PHY_BIST */
+#ifdef EFSYS_OPT_PHY_BIST
+# error "PHY_BIST is obsolete (replaced by BIST)."
+#endif
/* Support PHY flags */
#if EFSYS_OPT_PHY_FLAGS
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
-# error "PHY_FLAGS requires FALCON or SIENA"
+# if !EFSYS_OPT_SIENA
+# error "PHY_FLAGS requires SIENA"
# endif
#endif /* EFSYS_OPT_PHY_FLAGS */
/* Support for PHY LED control */
#if EFSYS_OPT_PHY_LED_CONTROL
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
-# error "PHY_LED_CONTROL requires FALCON or SIENA"
+# if !EFSYS_OPT_SIENA
+# error "PHY_LED_CONTROL requires SIENA"
# endif
#endif /* EFSYS_OPT_PHY_LED_CONTROL */
-/* Support NULL PHY */
-#if EFSYS_OPT_PHY_NULL
-# if !EFSYS_OPT_FALCON
-# error "PHY_NULL requires FALCON"
-# endif
-#endif /* EFSYS_OPT_PHY_NULL */
+#ifdef EFSYS_OPT_PHY_NULL
+# error "PHY_NULL is obsolete and is not supported."
+#endif
-/* Obsolete option */
#ifdef EFSYS_OPT_PHY_PM8358
-# error "EFSYS_OPT_PHY_PM8358 is obsolete and is not supported."
+# error "PHY_PM8358 is obsolete and is not supported."
#endif
-/* Support PHY properties */
-#if EFSYS_OPT_PHY_PROPS
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
-# error "PHY_PROPS requires FALCON or SIENA"
-# endif
-#endif /* EFSYS_OPT_PHY_PROPS */
+#ifdef EFSYS_OPT_PHY_PROPS
+# error "PHY_PROPS is obsolete and is not supported."
+#endif
-/* Support QT2022C2 PHY */
-#if EFSYS_OPT_PHY_QT2022C2
-# if !EFSYS_OPT_FALCON
-# error "PHY_QT2022C2 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_PHY_QT2022C2 */
+#ifdef EFSYS_OPT_PHY_QT2022C2
+# error "PHY_QT2022C2 is obsolete and is not supported."
+#endif
-/* Support QT2025C PHY (Wakefield NIC) */
-#if EFSYS_OPT_PHY_QT2025C
-# if !EFSYS_OPT_FALCON
-# error "PHY_QT2025C requires FALCON"
-# endif
-#endif /* EFSYS_OPT_PHY_QT2025C */
+#ifdef EFSYS_OPT_PHY_QT2025C
+# error "PHY_QT2025C is obsolete and is not supported."
+#endif
-/* Support SFT9001 PHY (Starbolt NIC) */
-#if EFSYS_OPT_PHY_SFT9001
-# if !EFSYS_OPT_FALCON
-# error "PHY_SFT9001 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_PHY_SFT9001 */
+#ifdef EFSYS_OPT_PHY_SFT9001
+# error "PHY_SFT9001 is obsolete and is not supported."
+#endif
-/* Support SFX7101 PHY (SFE4001 NIC) */
-#if EFSYS_OPT_PHY_SFX7101
-# if !EFSYS_OPT_FALCON
-# error "PHY_SFX7101 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_PHY_SFX7101 */
+#ifdef EFSYS_OPT_PHY_SFX7101
+# error "PHY_SFX7101 is obsolete and is not supported."
+#endif
/* Support PHY statistics */
#if EFSYS_OPT_PHY_STATS
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA)
-# error "PHY_STATS requires FALCON or SIENA"
+# if !EFSYS_OPT_SIENA
+# error "PHY_STATS requires SIENA"
# endif
#endif /* EFSYS_OPT_PHY_STATS */
-/* Support TXC43128 PHY (SFE4003 NIC) */
-#if EFSYS_OPT_PHY_TXC43128
-# if !EFSYS_OPT_FALCON
-# error "PHY_TXC43128 requires FALCON"
-# endif
-#endif /* EFSYS_OPT_PHY_TXC43128 */
+#ifdef EFSYS_OPT_PHY_TXC43128
+# error "PHY_TXC43128 is obsolete and is not supported."
+#endif
/* Support EVQ/RXQ/TXQ statistics */
#if EFSYS_OPT_QSTATS
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "QSTATS requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "QSTATS requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_QSTATS */
-/* Obsolete option */
#ifdef EFSYS_OPT_RX_HDR_SPLIT
# error "RX_HDR_SPLIT is obsolete and is not supported"
-#endif /* EFSYS_OPT_RX_HDR_SPLIT */
+#endif
/* Support receive scaling (RSS) */
#if EFSYS_OPT_RX_SCALE
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "RX_SCALE requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "RX_SCALE requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_RX_SCALE */
/* Support receive scatter DMA */
#if EFSYS_OPT_RX_SCATTER
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "RX_SCATTER requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "RX_SCATTER requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_RX_SCATTER */
-/* Obsolete option */
#ifdef EFSYS_OPT_STAT_NAME
# error "STAT_NAME is obsolete (replaced by NAMES)."
#endif
/* Support PCI Vital Product Data (VPD) */
#if EFSYS_OPT_VPD
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "VPD requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "VPD requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_VPD */
@@ -388,16 +313,14 @@
# endif
#endif /* EFSYS_OPT_WOL */
-/* Obsolete option */
#ifdef EFSYS_OPT_MCAST_FILTER_LIST
# error "MCAST_FILTER_LIST is obsolete and is not supported"
-#endif /* EFSYS_OPT_MCAST_FILTER_LIST */
+#endif
/* Support BIST */
#if EFSYS_OPT_BIST
-# if !(EFSYS_OPT_FALCON || EFSYS_OPT_SIENA || \
- EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
-# error "BIST requires FALCON or SIENA or HUNTINGTON or MEDFORD"
+# if !(EFSYS_OPT_SIENA || EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+# error "BIST requires SIENA or HUNTINGTON or MEDFORD"
# endif
#endif /* EFSYS_OPT_BIST */
@@ -411,5 +334,12 @@
# endif
#endif /* EFSYS_OPT_LICENSING */
+/* Support adapters with missing static config (for factory use only) */
+#if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC
+# if !EFSYS_OPT_MEDFORD
+# error "ALLOW_UNCONFIGURED_NIC requires MEDFORD"
+# endif
+#endif /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */
+
#endif /* _SYS_EFX_CHECK_H */
diff --git a/sys/dev/sfxge/common/efx_crc32.c b/sys/dev/sfxge/common/efx_crc32.c
index 23d77ae..779fa63 100644
--- a/sys/dev/sfxge/common/efx_crc32.c
+++ b/sys/dev/sfxge/common/efx_crc32.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2013-2015 Solarflare Communications Inc.
+ * Copyright (c) 2013-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_ev.c b/sys/dev/sfxge/common/efx_ev.c
index 037dbfa..5e3bc40 100644
--- a/sys/dev/sfxge/common/efx_ev.c
+++ b/sys/dev/sfxge/common/efx_ev.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,18 +53,18 @@ __FBSDID("$FreeBSD$");
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_ev_init(
+siena_ev_init(
__in efx_nic_t *enp);
static void
-falconsiena_ev_fini(
+siena_ev_fini(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
-falconsiena_ev_qcreate(
+siena_ev_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in efsys_mem_t *esmp,
@@ -73,73 +73,58 @@ falconsiena_ev_qcreate(
__in efx_evq_t *eep);
static void
-falconsiena_ev_qdestroy(
+siena_ev_qdestroy(
__in efx_evq_t *eep);
static __checkReturn efx_rc_t
-falconsiena_ev_qprime(
+siena_ev_qprime(
__in efx_evq_t *eep,
__in unsigned int count);
static void
-falconsiena_ev_qpoll(
+siena_ev_qpoll(
__in efx_evq_t *eep,
__inout unsigned int *countp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg);
static void
-falconsiena_ev_qpost(
+siena_ev_qpost(
__in efx_evq_t *eep,
__in uint16_t data);
static __checkReturn efx_rc_t
-falconsiena_ev_qmoderate(
+siena_ev_qmoderate(
__in efx_evq_t *eep,
__in unsigned int us);
#if EFSYS_OPT_QSTATS
static void
-falconsiena_ev_qstats_update(
+siena_ev_qstats_update(
__in efx_evq_t *eep,
__inout_ecount(EV_NQSTATS) efsys_stat_t *stat);
#endif
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
-
-#if EFSYS_OPT_FALCON
-static efx_ev_ops_t __efx_ev_falcon_ops = {
- falconsiena_ev_init, /* eevo_init */
- falconsiena_ev_fini, /* eevo_fini */
- falconsiena_ev_qcreate, /* eevo_qcreate */
- falconsiena_ev_qdestroy, /* eevo_qdestroy */
- falconsiena_ev_qprime, /* eevo_qprime */
- falconsiena_ev_qpost, /* eevo_qpost */
- falconsiena_ev_qmoderate, /* eevo_qmoderate */
-#if EFSYS_OPT_QSTATS
- falconsiena_ev_qstats_update, /* eevo_qstats_update */
-#endif
-};
-#endif /* EFSYS_OPT_FALCON */
+#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_SIENA
-static efx_ev_ops_t __efx_ev_siena_ops = {
- falconsiena_ev_init, /* eevo_init */
- falconsiena_ev_fini, /* eevo_fini */
- falconsiena_ev_qcreate, /* eevo_qcreate */
- falconsiena_ev_qdestroy, /* eevo_qdestroy */
- falconsiena_ev_qprime, /* eevo_qprime */
- falconsiena_ev_qpost, /* eevo_qpost */
- falconsiena_ev_qmoderate, /* eevo_qmoderate */
+static const efx_ev_ops_t __efx_ev_siena_ops = {
+ siena_ev_init, /* eevo_init */
+ siena_ev_fini, /* eevo_fini */
+ siena_ev_qcreate, /* eevo_qcreate */
+ siena_ev_qdestroy, /* eevo_qdestroy */
+ siena_ev_qprime, /* eevo_qprime */
+ siena_ev_qpost, /* eevo_qpost */
+ siena_ev_qmoderate, /* eevo_qmoderate */
#if EFSYS_OPT_QSTATS
- falconsiena_ev_qstats_update, /* eevo_qstats_update */
+ siena_ev_qstats_update, /* eevo_qstats_update */
#endif
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_ev_ops_t __efx_ev_ef10_ops = {
+static const efx_ev_ops_t __efx_ev_ef10_ops = {
ef10_ev_init, /* eevo_init */
ef10_ev_fini, /* eevo_fini */
ef10_ev_qcreate, /* eevo_qcreate */
@@ -158,7 +143,7 @@ static efx_ev_ops_t __efx_ev_ef10_ops = {
efx_ev_init(
__in efx_nic_t *enp)
{
- efx_ev_ops_t *eevop;
+ const efx_ev_ops_t *eevop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -170,27 +155,21 @@ efx_ev_init(
}
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- eevop = (efx_ev_ops_t *)&__efx_ev_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- eevop = (efx_ev_ops_t *)&__efx_ev_siena_ops;
+ eevop = &__efx_ev_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops;
+ eevop = &__efx_ev_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- eevop = (efx_ev_ops_t *)&__efx_ev_ef10_ops;
+ eevop = &__efx_ev_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -224,7 +203,7 @@ fail1:
efx_ev_fini(
__in efx_nic_t *enp)
{
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -249,7 +228,7 @@ efx_ev_qcreate(
__in uint32_t id,
__deref_out efx_evq_t **eepp)
{
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_evq_t *eep;
efx_rc_t rc;
@@ -272,16 +251,27 @@ efx_ev_qcreate(
eep->ee_mask = n - 1;
eep->ee_esmp = esmp;
- if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, eep)) != 0)
- goto fail2;
-
+ /*
+ * Set outputs before the queue is created because interrupts may be
+ * raised for events immediately after the queue is created, before the
+ * function call below returns. See bug58606.
+ *
+ * The eepp pointer passed in by the client must therefore point to data
+ * shared with the client's event processing context.
+ */
enp->en_ev_qcount++;
*eepp = eep;
+ if ((rc = eevop->eevo_qcreate(enp, index, esmp, n, id, eep)) != 0)
+ goto fail2;
+
return (0);
fail2:
EFSYS_PROBE(fail2);
+
+ *eepp = NULL;
+ enp->en_ev_qcount--;
EFSYS_KMEM_FREE(enp->en_esip, sizeof (efx_evq_t), eep);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
@@ -293,7 +283,7 @@ efx_ev_qdestroy(
__in efx_evq_t *eep)
{
efx_nic_t *enp = eep->ee_enp;
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
@@ -312,7 +302,7 @@ efx_ev_qprime(
__in unsigned int count)
{
efx_nic_t *enp = eep->ee_enp;
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
efx_rc_t rc;
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
@@ -395,7 +385,7 @@ efx_ev_qpoll(
EFX_STATIC_ASSERT(ESE_DZ_EV_CODE_MCDI_EV ==
FSE_AZ_EV_CODE_MCDI_EVRESPONSE);
#endif
- falconsiena_ev_qpoll(eep, countp, eecp, arg);
+ siena_ev_qpoll(eep, countp, eecp, arg);
}
void
@@ -404,7 +394,7 @@ efx_ev_qpost(
__in uint16_t data)
{
efx_nic_t *enp = eep->ee_enp;
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
@@ -420,7 +410,7 @@ efx_ev_qmoderate(
__in unsigned int us)
{
efx_nic_t *enp = eep->ee_enp;
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
efx_rc_t rc;
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
@@ -442,7 +432,7 @@ efx_ev_qstats_update(
__inout_ecount(EV_NQSTATS) efsys_stat_t *stat)
{ efx_nic_t *enp = eep->ee_enp;
- efx_ev_ops_t *eevop = enp->en_eevop;
+ const efx_ev_ops_t *eevop = enp->en_eevop;
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
@@ -451,10 +441,10 @@ efx_ev_qstats_update(
#endif /* EFSYS_OPT_QSTATS */
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_ev_init(
+siena_ev_init(
__in efx_nic_t *enp)
{
efx_oword_t oword;
@@ -472,7 +462,7 @@ falconsiena_ev_init(
}
static __checkReturn boolean_t
-falconsiena_ev_rx_not_ok(
+siena_ev_rx_not_ok(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in uint32_t label,
@@ -562,13 +552,12 @@ falconsiena_ev_rx_not_ok(
}
static __checkReturn boolean_t
-falconsiena_ev_rx(
+siena_ev_rx(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg)
{
- efx_nic_t *enp = eep->ee_enp;
uint32_t id;
uint32_t size;
uint32_t label;
@@ -598,8 +587,7 @@ falconsiena_ev_rx(
hdr_type = EFX_QWORD_FIELD(*eqp, FSF_AZ_RX_EV_HDR_TYPE);
- is_v6 = (enp->en_family != EFX_FAMILY_FALCON &&
- EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_IPV6_PKT) != 0);
+ is_v6 = (EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_IPV6_PKT) != 0);
/*
* If packet is marked as OK and packet type is TCP/IP or
@@ -659,7 +647,7 @@ falconsiena_ev_rx(
/* Detect errors included in the FSF_AZ_RX_EV_PKT_OK indication */
if (!ok) {
- ignore = falconsiena_ev_rx_not_ok(eep, eqp, label, id, &flags);
+ ignore = siena_ev_rx_not_ok(eep, eqp, label, id, &flags);
if (ignore) {
EFSYS_PROBE4(rx_complete, uint32_t, label, uint32_t, id,
uint32_t, size, uint16_t, flags);
@@ -692,7 +680,7 @@ falconsiena_ev_rx(
* (which clears PKT_OK). If this is set, then don't trust
* the PKT_TYPE field.
*/
- if (enp->en_family != EFX_FAMILY_FALCON && !ok) {
+ if (!ok) {
uint32_t parse_err;
parse_err = EFX_QWORD_FIELD(*eqp, FSF_CZ_RX_EV_PKT_NOT_PARSED);
@@ -718,7 +706,7 @@ falconsiena_ev_rx(
}
static __checkReturn boolean_t
-falconsiena_ev_tx(
+siena_ev_tx(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -765,33 +753,21 @@ falconsiena_ev_tx(
}
static __checkReturn boolean_t
-falconsiena_ev_global(
+siena_ev_global(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg)
{
- efx_nic_t *enp = eep->ee_enp;
- efx_port_t *epp = &(enp->en_port);
- boolean_t should_abort;
+ _NOTE(ARGUNUSED(eqp, eecp, arg))
EFX_EV_QSTAT_INCR(eep, EV_GLOBAL);
- should_abort = B_FALSE;
-
- /* Check for a link management event */
- if (EFX_QWORD_FIELD(*eqp, FSF_BZ_GLB_EV_XG_MNT_INTR) != 0) {
- EFX_EV_QSTAT_INCR(eep, EV_GLOBAL_MNT);
- EFSYS_PROBE(xg_mgt);
-
- epp->ep_mac_poll_needed = B_TRUE;
- }
-
- return (should_abort);
+ return (B_FALSE);
}
static __checkReturn boolean_t
-falconsiena_ev_driver(
+siena_ev_driver(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -920,7 +896,7 @@ falconsiena_ev_driver(
}
static __checkReturn boolean_t
-falconsiena_ev_drv_gen(
+siena_ev_drv_gen(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -948,7 +924,7 @@ falconsiena_ev_drv_gen(
#if EFSYS_OPT_MCDI
static __checkReturn boolean_t
-falconsiena_ev_mcdi(
+siena_ev_mcdi(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -1053,7 +1029,7 @@ out:
#endif /* EFSYS_OPT_MCDI */
static __checkReturn efx_rc_t
-falconsiena_ev_qprime(
+siena_ev_qprime(
__in efx_evq_t *eep,
__in unsigned int count)
{
@@ -1074,7 +1050,7 @@ falconsiena_ev_qprime(
#define EFX_EV_BATCH 8
static void
-falconsiena_ev_qpoll(
+siena_ev_qpoll(
__in efx_evq_t *eep,
__inout unsigned int *countp,
__in const efx_ev_callbacks_t *eecp,
@@ -1207,7 +1183,7 @@ falconsiena_ev_qpoll(
}
static void
-falconsiena_ev_qpost(
+siena_ev_qpost(
__in efx_evq_t *eep,
__in uint16_t data)
{
@@ -1226,7 +1202,7 @@ falconsiena_ev_qpost(
}
static __checkReturn efx_rc_t
-falconsiena_ev_qmoderate(
+siena_ev_qmoderate(
__in efx_evq_t *eep,
__in unsigned int us)
{
@@ -1243,14 +1219,9 @@ falconsiena_ev_qmoderate(
/* If the value is zero then disable the timer */
if (us == 0) {
- if (enp->en_family == EFX_FAMILY_FALCON)
- EFX_POPULATE_DWORD_2(dword,
- FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_DIS,
- FRF_AB_TC_TIMER_VAL, 0);
- else
- EFX_POPULATE_DWORD_2(dword,
- FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_DIS,
- FRF_CZ_TC_TIMER_VAL, 0);
+ EFX_POPULATE_DWORD_2(dword,
+ FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_DIS,
+ FRF_CZ_TC_TIMER_VAL, 0);
} else {
uint32_t timer_val;
@@ -1261,14 +1232,9 @@ falconsiena_ev_qmoderate(
if (timer_val > 0)
timer_val--;
- if (enp->en_family == EFX_FAMILY_FALCON)
- EFX_POPULATE_DWORD_2(dword,
- FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_INT_HLDOFF,
- FRF_AB_TIMER_VAL, timer_val);
- else
- EFX_POPULATE_DWORD_2(dword,
- FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF,
- FRF_CZ_TC_TIMER_VAL, timer_val);
+ EFX_POPULATE_DWORD_2(dword,
+ FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF,
+ FRF_CZ_TC_TIMER_VAL, timer_val);
}
locked = (eep->ee_index == 0) ? 1 : 0;
@@ -1285,7 +1251,7 @@ fail1:
}
static __checkReturn efx_rc_t
-falconsiena_ev_qcreate(
+siena_ev_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in efsys_mem_t *esmp,
@@ -1298,6 +1264,8 @@ falconsiena_ev_qcreate(
efx_oword_t oword;
efx_rc_t rc;
+ _NOTE(ARGUNUSED(esmp))
+
EFX_STATIC_ASSERT(ISP2(EFX_EVQ_MAXNEVS));
EFX_STATIC_ASSERT(ISP2(EFX_EVQ_MINNEVS));
@@ -1326,20 +1294,18 @@ falconsiena_ev_qcreate(
}
/* Set up the handler table */
- eep->ee_rx = falconsiena_ev_rx;
- eep->ee_tx = falconsiena_ev_tx;
- eep->ee_driver = falconsiena_ev_driver;
- eep->ee_global = falconsiena_ev_global;
- eep->ee_drv_gen = falconsiena_ev_drv_gen;
+ eep->ee_rx = siena_ev_rx;
+ eep->ee_tx = siena_ev_tx;
+ eep->ee_driver = siena_ev_driver;
+ eep->ee_global = siena_ev_global;
+ eep->ee_drv_gen = siena_ev_drv_gen;
#if EFSYS_OPT_MCDI
- eep->ee_mcdi = falconsiena_ev_mcdi;
+ eep->ee_mcdi = siena_ev_mcdi;
#endif /* EFSYS_OPT_MCDI */
/* Set up the new event queue */
- if (enp->en_family != EFX_FAMILY_FALCON) {
- EFX_POPULATE_OWORD_1(oword, FRF_CZ_TIMER_Q_EN, 1);
- EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, index, &oword, B_TRUE);
- }
+ EFX_POPULATE_OWORD_1(oword, FRF_CZ_TIMER_Q_EN, 1);
+ EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, index, &oword, B_TRUE);
EFX_POPULATE_OWORD_3(oword, FRF_AZ_EVQ_EN, 1, FRF_AZ_EVQ_SIZE, size,
FRF_AZ_EVQ_BUF_BASE_ID, id);
@@ -1362,7 +1328,7 @@ fail1:
return (rc);
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_QSTATS
#if EFSYS_OPT_NAMES
@@ -1421,11 +1387,11 @@ efx_ev_qstat_name(
#endif /* EFSYS_OPT_NAMES */
#endif /* EFSYS_OPT_QSTATS */
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
#if EFSYS_OPT_QSTATS
static void
-falconsiena_ev_qstats_update(
+siena_ev_qstats_update(
__in efx_evq_t *eep,
__inout_ecount(EV_NQSTATS) efsys_stat_t *stat)
{
@@ -1441,7 +1407,7 @@ falconsiena_ev_qstats_update(
#endif /* EFSYS_OPT_QSTATS */
static void
-falconsiena_ev_qdestroy(
+siena_ev_qdestroy(
__in efx_evq_t *eep)
{
efx_nic_t *enp = eep->ee_enp;
@@ -1453,18 +1419,15 @@ falconsiena_ev_qdestroy(
EFX_BAR_TBL_WRITEO(enp, FR_AZ_EVQ_PTR_TBL,
eep->ee_index, &oword, B_TRUE);
- if (enp->en_family != EFX_FAMILY_FALCON) {
- EFX_ZERO_OWORD(oword);
- EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL,
- eep->ee_index, &oword, B_TRUE);
- }
+ EFX_ZERO_OWORD(oword);
+ EFX_BAR_TBL_WRITEO(enp, FR_AZ_TIMER_TBL, eep->ee_index, &oword, B_TRUE);
}
static void
-falconsiena_ev_fini(
+siena_ev_fini(
__in efx_nic_t *enp)
{
_NOTE(ARGUNUSED(enp))
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
diff --git a/sys/dev/sfxge/common/efx_filter.c b/sys/dev/sfxge/common/efx_filter.c
index a4b59cc..242a772 100644
--- a/sys/dev/sfxge/common/efx_filter.c
+++ b/sys/dev/sfxge/common/efx_filter.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,65 +37,53 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_FILTER
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_filter_init(
+siena_filter_init(
__in efx_nic_t *enp);
static void
-falconsiena_filter_fini(
+siena_filter_fini(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
-falconsiena_filter_restore(
+siena_filter_restore(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
-falconsiena_filter_add(
+siena_filter_add(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec,
__in boolean_t may_replace);
static __checkReturn efx_rc_t
-falconsiena_filter_delete(
+siena_filter_delete(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec);
static __checkReturn efx_rc_t
-falconsiena_filter_supported_filters(
+siena_filter_supported_filters(
__in efx_nic_t *enp,
__out uint32_t *list,
__out size_t *length);
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
-
-#if EFSYS_OPT_FALCON
-static efx_filter_ops_t __efx_filter_falcon_ops = {
- falconsiena_filter_init, /* efo_init */
- falconsiena_filter_fini, /* efo_fini */
- falconsiena_filter_restore, /* efo_restore */
- falconsiena_filter_add, /* efo_add */
- falconsiena_filter_delete, /* efo_delete */
- falconsiena_filter_supported_filters, /* efo_supported_filters */
- NULL, /* efo_reconfigure */
-};
-#endif /* EFSYS_OPT_FALCON */
+#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_SIENA
-static efx_filter_ops_t __efx_filter_siena_ops = {
- falconsiena_filter_init, /* efo_init */
- falconsiena_filter_fini, /* efo_fini */
- falconsiena_filter_restore, /* efo_restore */
- falconsiena_filter_add, /* efo_add */
- falconsiena_filter_delete, /* efo_delete */
- falconsiena_filter_supported_filters, /* efo_supported_filters */
- NULL, /* efo_reconfigure */
+static const efx_filter_ops_t __efx_filter_siena_ops = {
+ siena_filter_init, /* efo_init */
+ siena_filter_fini, /* efo_fini */
+ siena_filter_restore, /* efo_restore */
+ siena_filter_add, /* efo_add */
+ siena_filter_delete, /* efo_delete */
+ siena_filter_supported_filters, /* efo_supported_filters */
+ NULL, /* efo_reconfigure */
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_filter_ops_t __efx_filter_ef10_ops = {
+static const efx_filter_ops_t __efx_filter_ef10_ops = {
ef10_filter_init, /* efo_init */
ef10_filter_fini, /* efo_fini */
ef10_filter_restore, /* efo_restore */
@@ -111,7 +99,7 @@ efx_filter_insert(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec)
{
- efx_filter_ops_t *efop = enp->en_efop;
+ const efx_filter_ops_t *efop = enp->en_efop;
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_FILTER);
EFSYS_ASSERT3P(spec, !=, NULL);
@@ -125,7 +113,7 @@ efx_filter_remove(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec)
{
- efx_filter_ops_t *efop = enp->en_efop;
+ const efx_filter_ops_t *efop = enp->en_efop;
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_FILTER);
EFSYS_ASSERT3P(spec, !=, NULL);
@@ -161,7 +149,7 @@ fail1:
efx_filter_init(
__in efx_nic_t *enp)
{
- efx_filter_ops_t *efop;
+ const efx_filter_ops_t *efop;
efx_rc_t rc;
/* Check that efx_filter_spec_t is 64 bytes. */
@@ -172,27 +160,21 @@ efx_filter_init(
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_FILTER));
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- efop = (efx_filter_ops_t *)&__efx_filter_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- efop = (efx_filter_ops_t *)&__efx_filter_siena_ops;
+ efop = &__efx_filter_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- efop = (efx_filter_ops_t *)&__efx_filter_ef10_ops;
+ efop = &__efx_filter_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- efop = (efx_filter_ops_t *)&__efx_filter_ef10_ops;
+ efop = &__efx_filter_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -266,7 +248,7 @@ efx_filter_reconfigure(
__in boolean_t all_mulcst,
__in boolean_t brdcst,
__in_ecount(6*count) uint8_t const *addrs,
- __in int count)
+ __in uint32_t count)
{
efx_rc_t rc;
@@ -428,7 +410,7 @@ efx_filter_spec_set_mc_def(
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
/*
* "Fudge factors" - difference between programmed value and actual depth.
@@ -446,8 +428,8 @@ efx_filter_spec_set_mc_def(
#define FILTER_CTL_SRCH_MAX 200
static __checkReturn efx_rc_t
-falconsiena_filter_spec_from_gen_spec(
- __out falconsiena_filter_spec_t *fs_spec,
+siena_filter_spec_from_gen_spec(
+ __out siena_filter_spec_t *sf_spec,
__in efx_filter_spec_t *gen_spec)
{
efx_rc_t rc;
@@ -465,8 +447,8 @@ falconsiena_filter_spec_from_gen_spec(
goto fail1;
}
- fs_spec->fsfs_flags = gen_spec->efs_flags;
- fs_spec->fsfs_dmaq_id = gen_spec->efs_dmaq_id;
+ sf_spec->sfs_flags = gen_spec->efs_flags;
+ sf_spec->sfs_dmaq_id = gen_spec->efs_dmaq_id;
switch (gen_spec->efs_match_flags) {
case EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
@@ -491,24 +473,24 @@ falconsiena_filter_spec_from_gen_spec(
switch (gen_spec->efs_ip_proto) {
case EFX_IPPROTO_TCP:
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
- fs_spec->fsfs_type = (is_full ?
- EFX_FS_FILTER_TX_TCP_FULL :
- EFX_FS_FILTER_TX_TCP_WILD);
+ sf_spec->sfs_type = (is_full ?
+ EFX_SIENA_FILTER_TX_TCP_FULL :
+ EFX_SIENA_FILTER_TX_TCP_WILD);
} else {
- fs_spec->fsfs_type = (is_full ?
- EFX_FS_FILTER_RX_TCP_FULL :
- EFX_FS_FILTER_RX_TCP_WILD);
+ sf_spec->sfs_type = (is_full ?
+ EFX_SIENA_FILTER_RX_TCP_FULL :
+ EFX_SIENA_FILTER_RX_TCP_WILD);
}
break;
case EFX_IPPROTO_UDP:
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
- fs_spec->fsfs_type = (is_full ?
- EFX_FS_FILTER_TX_UDP_FULL :
- EFX_FS_FILTER_TX_UDP_WILD);
+ sf_spec->sfs_type = (is_full ?
+ EFX_SIENA_FILTER_TX_UDP_FULL :
+ EFX_SIENA_FILTER_TX_UDP_WILD);
} else {
- fs_spec->fsfs_type = (is_full ?
- EFX_FS_FILTER_RX_UDP_FULL :
- EFX_FS_FILTER_RX_UDP_WILD);
+ sf_spec->sfs_type = (is_full ?
+ EFX_SIENA_FILTER_RX_UDP_FULL :
+ EFX_SIENA_FILTER_RX_UDP_WILD);
}
break;
default:
@@ -531,7 +513,8 @@ falconsiena_filter_spec_from_gen_spec(
host2 = gen_spec->efs_loc_host.eo_u32[0];
}
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
- if (fs_spec->fsfs_type == EFX_FS_FILTER_TX_UDP_WILD) {
+ if (sf_spec->sfs_type ==
+ EFX_SIENA_FILTER_TX_UDP_WILD) {
port1 = rport;
port2 = gen_spec->efs_loc_port;
} else {
@@ -539,7 +522,8 @@ falconsiena_filter_spec_from_gen_spec(
port2 = rport;
}
} else {
- if (fs_spec->fsfs_type == EFX_FS_FILTER_RX_UDP_WILD) {
+ if (sf_spec->sfs_type ==
+ EFX_SIENA_FILTER_RX_UDP_WILD) {
port1 = gen_spec->efs_loc_port;
port2 = rport;
} else {
@@ -547,9 +531,9 @@ falconsiena_filter_spec_from_gen_spec(
port2 = gen_spec->efs_loc_port;
}
}
- fs_spec->fsfs_dword[0] = (host1 << 16) | port1;
- fs_spec->fsfs_dword[1] = (port2 << 16) | (host1 >> 16);
- fs_spec->fsfs_dword[2] = host2;
+ sf_spec->sfs_dword[0] = (host1 << 16) | port1;
+ sf_spec->sfs_dword[1] = (port2 << 16) | (host1 >> 16);
+ sf_spec->sfs_dword[2] = host2;
break;
}
@@ -558,21 +542,21 @@ falconsiena_filter_spec_from_gen_spec(
/* Fall through */
case EFX_FILTER_MATCH_LOC_MAC:
if (gen_spec->efs_flags & EFX_FILTER_FLAG_TX) {
- fs_spec->fsfs_type = (is_full ?
- EFX_FS_FILTER_TX_MAC_FULL :
- EFX_FS_FILTER_TX_MAC_WILD);
+ sf_spec->sfs_type = (is_full ?
+ EFX_SIENA_FILTER_TX_MAC_FULL :
+ EFX_SIENA_FILTER_TX_MAC_WILD);
} else {
- fs_spec->fsfs_type = (is_full ?
- EFX_FS_FILTER_RX_MAC_FULL :
- EFX_FS_FILTER_RX_MAC_WILD);
+ sf_spec->sfs_type = (is_full ?
+ EFX_SIENA_FILTER_RX_MAC_FULL :
+ EFX_SIENA_FILTER_RX_MAC_WILD);
}
- fs_spec->fsfs_dword[0] = is_full ? gen_spec->efs_outer_vid : 0;
- fs_spec->fsfs_dword[1] =
+ sf_spec->sfs_dword[0] = is_full ? gen_spec->efs_outer_vid : 0;
+ sf_spec->sfs_dword[1] =
gen_spec->efs_loc_mac[2] << 24 |
gen_spec->efs_loc_mac[3] << 16 |
gen_spec->efs_loc_mac[4] << 8 |
gen_spec->efs_loc_mac[5];
- fs_spec->fsfs_dword[2] =
+ sf_spec->sfs_dword[2] =
gen_spec->efs_loc_mac[0] << 8 |
gen_spec->efs_loc_mac[1];
break;
@@ -604,7 +588,7 @@ fail1:
* key derived from the n-tuple.
*/
static uint16_t
-falconsiena_filter_tbl_hash(
+siena_filter_tbl_hash(
__in uint32_t key)
{
uint16_t tmp;
@@ -627,116 +611,112 @@ falconsiena_filter_tbl_hash(
* increments from the first possible entry selected by the hash.
*/
static uint16_t
-falconsiena_filter_tbl_increment(
+siena_filter_tbl_increment(
__in uint32_t key)
{
return ((uint16_t)(key * 2 - 1));
}
static __checkReturn boolean_t
-falconsiena_filter_test_used(
- __in falconsiena_filter_tbl_t *fsftp,
+siena_filter_test_used(
+ __in siena_filter_tbl_t *sftp,
__in unsigned int index)
{
- EFSYS_ASSERT3P(fsftp->fsft_bitmap, !=, NULL);
- return ((fsftp->fsft_bitmap[index / 32] & (1 << (index % 32))) != 0);
+ EFSYS_ASSERT3P(sftp->sft_bitmap, !=, NULL);
+ return ((sftp->sft_bitmap[index / 32] & (1 << (index % 32))) != 0);
}
static void
-falconsiena_filter_set_used(
- __in falconsiena_filter_tbl_t *fsftp,
+siena_filter_set_used(
+ __in siena_filter_tbl_t *sftp,
__in unsigned int index)
{
- EFSYS_ASSERT3P(fsftp->fsft_bitmap, !=, NULL);
- fsftp->fsft_bitmap[index / 32] |= (1 << (index % 32));
- ++fsftp->fsft_used;
+ EFSYS_ASSERT3P(sftp->sft_bitmap, !=, NULL);
+ sftp->sft_bitmap[index / 32] |= (1 << (index % 32));
+ ++sftp->sft_used;
}
static void
-falconsiena_filter_clear_used(
- __in falconsiena_filter_tbl_t *fsftp,
+siena_filter_clear_used(
+ __in siena_filter_tbl_t *sftp,
__in unsigned int index)
{
- EFSYS_ASSERT3P(fsftp->fsft_bitmap, !=, NULL);
- fsftp->fsft_bitmap[index / 32] &= ~(1 << (index % 32));
+ EFSYS_ASSERT3P(sftp->sft_bitmap, !=, NULL);
+ sftp->sft_bitmap[index / 32] &= ~(1 << (index % 32));
- --fsftp->fsft_used;
- EFSYS_ASSERT3U(fsftp->fsft_used, >=, 0);
+ --sftp->sft_used;
+ EFSYS_ASSERT3U(sftp->sft_used, >=, 0);
}
-static falconsiena_filter_tbl_id_t
-falconsiena_filter_tbl_id(
- __in falconsiena_filter_type_t type)
+static siena_filter_tbl_id_t
+siena_filter_tbl_id(
+ __in siena_filter_type_t type)
{
- falconsiena_filter_tbl_id_t tbl_id;
+ siena_filter_tbl_id_t tbl_id;
switch (type) {
- case EFX_FS_FILTER_RX_TCP_FULL:
- case EFX_FS_FILTER_RX_TCP_WILD:
- case EFX_FS_FILTER_RX_UDP_FULL:
- case EFX_FS_FILTER_RX_UDP_WILD:
- tbl_id = EFX_FS_FILTER_TBL_RX_IP;
+ case EFX_SIENA_FILTER_RX_TCP_FULL:
+ case EFX_SIENA_FILTER_RX_TCP_WILD:
+ case EFX_SIENA_FILTER_RX_UDP_FULL:
+ case EFX_SIENA_FILTER_RX_UDP_WILD:
+ tbl_id = EFX_SIENA_FILTER_TBL_RX_IP;
break;
-#if EFSYS_OPT_SIENA
- case EFX_FS_FILTER_RX_MAC_FULL:
- case EFX_FS_FILTER_RX_MAC_WILD:
- tbl_id = EFX_FS_FILTER_TBL_RX_MAC;
+ case EFX_SIENA_FILTER_RX_MAC_FULL:
+ case EFX_SIENA_FILTER_RX_MAC_WILD:
+ tbl_id = EFX_SIENA_FILTER_TBL_RX_MAC;
break;
- case EFX_FS_FILTER_TX_TCP_FULL:
- case EFX_FS_FILTER_TX_TCP_WILD:
- case EFX_FS_FILTER_TX_UDP_FULL:
- case EFX_FS_FILTER_TX_UDP_WILD:
- tbl_id = EFX_FS_FILTER_TBL_TX_IP;
+ case EFX_SIENA_FILTER_TX_TCP_FULL:
+ case EFX_SIENA_FILTER_TX_TCP_WILD:
+ case EFX_SIENA_FILTER_TX_UDP_FULL:
+ case EFX_SIENA_FILTER_TX_UDP_WILD:
+ tbl_id = EFX_SIENA_FILTER_TBL_TX_IP;
break;
- case EFX_FS_FILTER_TX_MAC_FULL:
- case EFX_FS_FILTER_TX_MAC_WILD:
- tbl_id = EFX_FS_FILTER_TBL_TX_MAC;
+ case EFX_SIENA_FILTER_TX_MAC_FULL:
+ case EFX_SIENA_FILTER_TX_MAC_WILD:
+ tbl_id = EFX_SIENA_FILTER_TBL_TX_MAC;
break;
-#endif /* EFSYS_OPT_SIENA */
default:
EFSYS_ASSERT(B_FALSE);
- tbl_id = EFX_FS_FILTER_NTBLS;
+ tbl_id = EFX_SIENA_FILTER_NTBLS;
break;
}
return (tbl_id);
}
static void
-falconsiena_filter_reset_search_depth(
- __inout falconsiena_filter_t *fsfp,
- __in falconsiena_filter_tbl_id_t tbl_id)
+siena_filter_reset_search_depth(
+ __inout siena_filter_t *sfp,
+ __in siena_filter_tbl_id_t tbl_id)
{
switch (tbl_id) {
- case EFX_FS_FILTER_TBL_RX_IP:
- fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_FULL] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_WILD] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_FULL] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_WILD] = 0;
+ case EFX_SIENA_FILTER_TBL_RX_IP:
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_FULL] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_WILD] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_FULL] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_WILD] = 0;
break;
-#if EFSYS_OPT_SIENA
- case EFX_FS_FILTER_TBL_RX_MAC:
- fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_FULL] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_WILD] = 0;
+ case EFX_SIENA_FILTER_TBL_RX_MAC:
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_FULL] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_WILD] = 0;
break;
- case EFX_FS_FILTER_TBL_TX_IP:
- fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_FULL] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_WILD] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_FULL] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_WILD] = 0;
+ case EFX_SIENA_FILTER_TBL_TX_IP:
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_FULL] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_WILD] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_FULL] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_WILD] = 0;
break;
- case EFX_FS_FILTER_TBL_TX_MAC:
- fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_FULL] = 0;
- fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_WILD] = 0;
+ case EFX_SIENA_FILTER_TBL_TX_MAC:
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_FULL] = 0;
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_WILD] = 0;
break;
-#endif /* EFSYS_OPT_SIENA */
default:
EFSYS_ASSERT(B_FALSE);
@@ -745,79 +725,77 @@ falconsiena_filter_reset_search_depth(
}
static void
-falconsiena_filter_push_rx_limits(
+siena_filter_push_rx_limits(
__in efx_nic_t *enp)
{
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
efx_oword_t oword;
EFX_BAR_READO(enp, FR_AZ_RX_FILTER_CTL_REG, &oword);
EFX_SET_OWORD_FIELD(oword, FRF_AZ_TCP_FULL_SRCH_LIMIT,
- fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_FULL] +
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_FULL] +
FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(oword, FRF_AZ_TCP_WILD_SRCH_LIMIT,
- fsfp->fsf_depth[EFX_FS_FILTER_RX_TCP_WILD] +
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_TCP_WILD] +
FILTER_CTL_SRCH_FUDGE_WILD);
EFX_SET_OWORD_FIELD(oword, FRF_AZ_UDP_FULL_SRCH_LIMIT,
- fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_FULL] +
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_FULL] +
FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(oword, FRF_AZ_UDP_WILD_SRCH_LIMIT,
- fsfp->fsf_depth[EFX_FS_FILTER_RX_UDP_WILD] +
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_UDP_WILD] +
FILTER_CTL_SRCH_FUDGE_WILD);
-#if EFSYS_OPT_SIENA
- if (fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_MAC].fsft_size) {
+ if (sfp->sf_tbl[EFX_SIENA_FILTER_TBL_RX_MAC].sft_size) {
EFX_SET_OWORD_FIELD(oword,
FRF_CZ_ETHERNET_FULL_SEARCH_LIMIT,
- fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_FULL] +
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_FULL] +
FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(oword,
FRF_CZ_ETHERNET_WILDCARD_SEARCH_LIMIT,
- fsfp->fsf_depth[EFX_FS_FILTER_RX_MAC_WILD] +
+ sfp->sf_depth[EFX_SIENA_FILTER_RX_MAC_WILD] +
FILTER_CTL_SRCH_FUDGE_WILD);
}
-#endif /* EFSYS_OPT_SIENA */
EFX_BAR_WRITEO(enp, FR_AZ_RX_FILTER_CTL_REG, &oword);
}
static void
-falconsiena_filter_push_tx_limits(
+siena_filter_push_tx_limits(
__in efx_nic_t *enp)
{
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
efx_oword_t oword;
EFX_BAR_READO(enp, FR_AZ_TX_CFG_REG, &oword);
- if (fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_IP].fsft_size != 0) {
+ if (sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_IP].sft_size != 0) {
EFX_SET_OWORD_FIELD(oword,
FRF_CZ_TX_TCPIP_FILTER_FULL_SEARCH_RANGE,
- fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_FULL] +
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_FULL] +
FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(oword,
FRF_CZ_TX_TCPIP_FILTER_WILD_SEARCH_RANGE,
- fsfp->fsf_depth[EFX_FS_FILTER_TX_TCP_WILD] +
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_TCP_WILD] +
FILTER_CTL_SRCH_FUDGE_WILD);
EFX_SET_OWORD_FIELD(oword,
FRF_CZ_TX_UDPIP_FILTER_FULL_SEARCH_RANGE,
- fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_FULL] +
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_FULL] +
FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(oword,
FRF_CZ_TX_UDPIP_FILTER_WILD_SEARCH_RANGE,
- fsfp->fsf_depth[EFX_FS_FILTER_TX_UDP_WILD] +
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_UDP_WILD] +
FILTER_CTL_SRCH_FUDGE_WILD);
}
- if (fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_MAC].fsft_size != 0) {
+ if (sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_MAC].sft_size != 0) {
EFX_SET_OWORD_FIELD(
oword, FRF_CZ_TX_ETH_FILTER_FULL_SEARCH_RANGE,
- fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_FULL] +
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_FULL] +
FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(
oword, FRF_CZ_TX_ETH_FILTER_WILD_SEARCH_RANGE,
- fsfp->fsf_depth[EFX_FS_FILTER_TX_MAC_WILD] +
+ sfp->sf_depth[EFX_SIENA_FILTER_TX_MAC_WILD] +
FILTER_CTL_SRCH_FUDGE_WILD);
}
@@ -826,77 +804,73 @@ falconsiena_filter_push_tx_limits(
/* Build a filter entry and return its n-tuple key. */
static __checkReturn uint32_t
-falconsiena_filter_build(
+siena_filter_build(
__out efx_oword_t *filter,
- __in falconsiena_filter_spec_t *spec)
+ __in siena_filter_spec_t *spec)
{
uint32_t dword3;
uint32_t key;
- uint8_t type = spec->fsfs_type;
- uint32_t flags = spec->fsfs_flags;
+ uint8_t type = spec->sfs_type;
+ uint32_t flags = spec->sfs_flags;
- switch (falconsiena_filter_tbl_id(type)) {
- case EFX_FS_FILTER_TBL_RX_IP: {
- boolean_t is_udp = (type == EFX_FS_FILTER_RX_UDP_FULL ||
- type == EFX_FS_FILTER_RX_UDP_WILD);
+ switch (siena_filter_tbl_id(type)) {
+ case EFX_SIENA_FILTER_TBL_RX_IP: {
+ boolean_t is_udp = (type == EFX_SIENA_FILTER_RX_UDP_FULL ||
+ type == EFX_SIENA_FILTER_RX_UDP_WILD);
EFX_POPULATE_OWORD_7(*filter,
FRF_BZ_RSS_EN,
(flags & EFX_FILTER_FLAG_RX_RSS) ? 1 : 0,
FRF_BZ_SCATTER_EN,
(flags & EFX_FILTER_FLAG_RX_SCATTER) ? 1 : 0,
FRF_AZ_TCP_UDP, is_udp,
- FRF_AZ_RXQ_ID, spec->fsfs_dmaq_id,
- EFX_DWORD_2, spec->fsfs_dword[2],
- EFX_DWORD_1, spec->fsfs_dword[1],
- EFX_DWORD_0, spec->fsfs_dword[0]);
+ FRF_AZ_RXQ_ID, spec->sfs_dmaq_id,
+ EFX_DWORD_2, spec->sfs_dword[2],
+ EFX_DWORD_1, spec->sfs_dword[1],
+ EFX_DWORD_0, spec->sfs_dword[0]);
dword3 = is_udp;
break;
}
-#if EFSYS_OPT_SIENA
- case EFX_FS_FILTER_TBL_RX_MAC: {
- boolean_t is_wild = (type == EFX_FS_FILTER_RX_MAC_WILD);
+ case EFX_SIENA_FILTER_TBL_RX_MAC: {
+ boolean_t is_wild = (type == EFX_SIENA_FILTER_RX_MAC_WILD);
EFX_POPULATE_OWORD_7(*filter,
FRF_CZ_RMFT_RSS_EN,
(flags & EFX_FILTER_FLAG_RX_RSS) ? 1 : 0,
FRF_CZ_RMFT_SCATTER_EN,
(flags & EFX_FILTER_FLAG_RX_SCATTER) ? 1 : 0,
- FRF_CZ_RMFT_RXQ_ID, spec->fsfs_dmaq_id,
+ FRF_CZ_RMFT_RXQ_ID, spec->sfs_dmaq_id,
FRF_CZ_RMFT_WILDCARD_MATCH, is_wild,
- FRF_CZ_RMFT_DEST_MAC_DW1, spec->fsfs_dword[2],
- FRF_CZ_RMFT_DEST_MAC_DW0, spec->fsfs_dword[1],
- FRF_CZ_RMFT_VLAN_ID, spec->fsfs_dword[0]);
+ FRF_CZ_RMFT_DEST_MAC_DW1, spec->sfs_dword[2],
+ FRF_CZ_RMFT_DEST_MAC_DW0, spec->sfs_dword[1],
+ FRF_CZ_RMFT_VLAN_ID, spec->sfs_dword[0]);
dword3 = is_wild;
break;
}
-#endif /* EFSYS_OPT_SIENA */
- case EFX_FS_FILTER_TBL_TX_IP: {
- boolean_t is_udp = (type == EFX_FS_FILTER_TX_UDP_FULL ||
- type == EFX_FS_FILTER_TX_UDP_WILD);
+ case EFX_SIENA_FILTER_TBL_TX_IP: {
+ boolean_t is_udp = (type == EFX_SIENA_FILTER_TX_UDP_FULL ||
+ type == EFX_SIENA_FILTER_TX_UDP_WILD);
EFX_POPULATE_OWORD_5(*filter,
FRF_CZ_TIFT_TCP_UDP, is_udp,
- FRF_CZ_TIFT_TXQ_ID, spec->fsfs_dmaq_id,
- EFX_DWORD_2, spec->fsfs_dword[2],
- EFX_DWORD_1, spec->fsfs_dword[1],
- EFX_DWORD_0, spec->fsfs_dword[0]);
- dword3 = is_udp | spec->fsfs_dmaq_id << 1;
+ FRF_CZ_TIFT_TXQ_ID, spec->sfs_dmaq_id,
+ EFX_DWORD_2, spec->sfs_dword[2],
+ EFX_DWORD_1, spec->sfs_dword[1],
+ EFX_DWORD_0, spec->sfs_dword[0]);
+ dword3 = is_udp | spec->sfs_dmaq_id << 1;
break;
}
-#if EFSYS_OPT_SIENA
- case EFX_FS_FILTER_TBL_TX_MAC: {
- boolean_t is_wild = (type == EFX_FS_FILTER_TX_MAC_WILD);
+ case EFX_SIENA_FILTER_TBL_TX_MAC: {
+ boolean_t is_wild = (type == EFX_SIENA_FILTER_TX_MAC_WILD);
EFX_POPULATE_OWORD_5(*filter,
- FRF_CZ_TMFT_TXQ_ID, spec->fsfs_dmaq_id,
+ FRF_CZ_TMFT_TXQ_ID, spec->sfs_dmaq_id,
FRF_CZ_TMFT_WILDCARD_MATCH, is_wild,
- FRF_CZ_TMFT_SRC_MAC_DW1, spec->fsfs_dword[2],
- FRF_CZ_TMFT_SRC_MAC_DW0, spec->fsfs_dword[1],
- FRF_CZ_TMFT_VLAN_ID, spec->fsfs_dword[0]);
- dword3 = is_wild | spec->fsfs_dmaq_id << 1;
+ FRF_CZ_TMFT_SRC_MAC_DW1, spec->sfs_dword[2],
+ FRF_CZ_TMFT_SRC_MAC_DW0, spec->sfs_dword[1],
+ FRF_CZ_TMFT_VLAN_ID, spec->sfs_dword[0]);
+ dword3 = is_wild | spec->sfs_dmaq_id << 1;
break;
}
-#endif /* EFSYS_OPT_SIENA */
default:
EFSYS_ASSERT(B_FALSE);
@@ -904,53 +878,51 @@ falconsiena_filter_build(
}
key =
- spec->fsfs_dword[0] ^
- spec->fsfs_dword[1] ^
- spec->fsfs_dword[2] ^
+ spec->sfs_dword[0] ^
+ spec->sfs_dword[1] ^
+ spec->sfs_dword[2] ^
dword3;
return (key);
}
static __checkReturn efx_rc_t
-falconsiena_filter_push_entry(
+siena_filter_push_entry(
__inout efx_nic_t *enp,
- __in falconsiena_filter_type_t type,
+ __in siena_filter_type_t type,
__in int index,
__in efx_oword_t *eop)
{
efx_rc_t rc;
switch (type) {
- case EFX_FS_FILTER_RX_TCP_FULL:
- case EFX_FS_FILTER_RX_TCP_WILD:
- case EFX_FS_FILTER_RX_UDP_FULL:
- case EFX_FS_FILTER_RX_UDP_WILD:
+ case EFX_SIENA_FILTER_RX_TCP_FULL:
+ case EFX_SIENA_FILTER_RX_TCP_WILD:
+ case EFX_SIENA_FILTER_RX_UDP_FULL:
+ case EFX_SIENA_FILTER_RX_UDP_WILD:
EFX_BAR_TBL_WRITEO(enp, FR_AZ_RX_FILTER_TBL0, index,
eop, B_TRUE);
break;
-#if EFSYS_OPT_SIENA
- case EFX_FS_FILTER_RX_MAC_FULL:
- case EFX_FS_FILTER_RX_MAC_WILD:
+ case EFX_SIENA_FILTER_RX_MAC_FULL:
+ case EFX_SIENA_FILTER_RX_MAC_WILD:
EFX_BAR_TBL_WRITEO(enp, FR_CZ_RX_MAC_FILTER_TBL0, index,
eop, B_TRUE);
break;
- case EFX_FS_FILTER_TX_TCP_FULL:
- case EFX_FS_FILTER_TX_TCP_WILD:
- case EFX_FS_FILTER_TX_UDP_FULL:
- case EFX_FS_FILTER_TX_UDP_WILD:
+ case EFX_SIENA_FILTER_TX_TCP_FULL:
+ case EFX_SIENA_FILTER_TX_TCP_WILD:
+ case EFX_SIENA_FILTER_TX_UDP_FULL:
+ case EFX_SIENA_FILTER_TX_UDP_WILD:
EFX_BAR_TBL_WRITEO(enp, FR_CZ_TX_FILTER_TBL0, index,
eop, B_TRUE);
break;
- case EFX_FS_FILTER_TX_MAC_FULL:
- case EFX_FS_FILTER_TX_MAC_WILD:
+ case EFX_SIENA_FILTER_TX_MAC_FULL:
+ case EFX_SIENA_FILTER_TX_MAC_WILD:
EFX_BAR_TBL_WRITEO(enp, FR_CZ_TX_MAC_FILTER_TBL0, index,
eop, B_TRUE);
break;
-#endif /* EFSYS_OPT_SIENA */
default:
EFSYS_ASSERT(B_FALSE);
@@ -965,34 +937,34 @@ fail1:
static __checkReturn boolean_t
-falconsiena_filter_equal(
- __in const falconsiena_filter_spec_t *left,
- __in const falconsiena_filter_spec_t *right)
+siena_filter_equal(
+ __in const siena_filter_spec_t *left,
+ __in const siena_filter_spec_t *right)
{
- falconsiena_filter_tbl_id_t tbl_id;
+ siena_filter_tbl_id_t tbl_id;
- tbl_id = falconsiena_filter_tbl_id(left->fsfs_type);
+ tbl_id = siena_filter_tbl_id(left->sfs_type);
- if (left->fsfs_type != right->fsfs_type)
+ if (left->sfs_type != right->sfs_type)
return (B_FALSE);
- if (memcmp(left->fsfs_dword, right->fsfs_dword,
- sizeof (left->fsfs_dword)))
+ if (memcmp(left->sfs_dword, right->sfs_dword,
+ sizeof (left->sfs_dword)))
return (B_FALSE);
- if ((tbl_id == EFX_FS_FILTER_TBL_TX_IP ||
- tbl_id == EFX_FS_FILTER_TBL_TX_MAC) &&
- left->fsfs_dmaq_id != right->fsfs_dmaq_id)
+ if ((tbl_id == EFX_SIENA_FILTER_TBL_TX_IP ||
+ tbl_id == EFX_SIENA_FILTER_TBL_TX_MAC) &&
+ left->sfs_dmaq_id != right->sfs_dmaq_id)
return (B_FALSE);
return (B_TRUE);
}
static __checkReturn efx_rc_t
-falconsiena_filter_search(
- __in falconsiena_filter_tbl_t *fsftp,
- __in falconsiena_filter_spec_t *spec,
+siena_filter_search(
+ __in siena_filter_tbl_t *sftp,
+ __in siena_filter_spec_t *spec,
__in uint32_t key,
__in boolean_t for_insert,
__out int *filter_index,
@@ -1000,10 +972,10 @@ falconsiena_filter_search(
{
unsigned hash, incr, filter_idx, depth;
- hash = falconsiena_filter_tbl_hash(key);
- incr = falconsiena_filter_tbl_increment(key);
+ hash = siena_filter_tbl_hash(key);
+ incr = siena_filter_tbl_increment(key);
- filter_idx = hash & (fsftp->fsft_size - 1);
+ filter_idx = hash & (sftp->sft_size - 1);
depth = 1;
for (;;) {
@@ -1011,9 +983,9 @@ falconsiena_filter_search(
* Return success if entry is used and matches this spec
* or entry is unused and we are trying to insert.
*/
- if (falconsiena_filter_test_used(fsftp, filter_idx) ?
- falconsiena_filter_equal(spec,
- &fsftp->fsft_spec[filter_idx]) :
+ if (siena_filter_test_used(sftp, filter_idx) ?
+ siena_filter_equal(spec,
+ &sftp->sft_spec[filter_idx]) :
for_insert) {
*filter_index = filter_idx;
*depth_required = depth;
@@ -1024,128 +996,119 @@ falconsiena_filter_search(
if (depth == FILTER_CTL_SRCH_MAX)
return (for_insert ? EBUSY : ENOENT);
- filter_idx = (filter_idx + incr) & (fsftp->fsft_size - 1);
+ filter_idx = (filter_idx + incr) & (sftp->sft_size - 1);
++depth;
}
}
static void
-falconsiena_filter_clear_entry(
+siena_filter_clear_entry(
__in efx_nic_t *enp,
- __in falconsiena_filter_tbl_t *fsftp,
+ __in siena_filter_tbl_t *sftp,
__in int index)
{
efx_oword_t filter;
- if (falconsiena_filter_test_used(fsftp, index)) {
- falconsiena_filter_clear_used(fsftp, index);
+ if (siena_filter_test_used(sftp, index)) {
+ siena_filter_clear_used(sftp, index);
EFX_ZERO_OWORD(filter);
- falconsiena_filter_push_entry(enp,
- fsftp->fsft_spec[index].fsfs_type,
+ siena_filter_push_entry(enp,
+ sftp->sft_spec[index].sfs_type,
index, &filter);
- memset(&fsftp->fsft_spec[index],
- 0, sizeof (fsftp->fsft_spec[0]));
+ memset(&sftp->sft_spec[index],
+ 0, sizeof (sftp->sft_spec[0]));
}
}
void
-falconsiena_filter_tbl_clear(
+siena_filter_tbl_clear(
__in efx_nic_t *enp,
- __in falconsiena_filter_tbl_id_t tbl_id)
+ __in siena_filter_tbl_id_t tbl_id)
{
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
- falconsiena_filter_tbl_t *fsftp = &fsfp->fsf_tbl[tbl_id];
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
+ siena_filter_tbl_t *sftp = &sfp->sf_tbl[tbl_id];
int index;
int state;
EFSYS_LOCK(enp->en_eslp, state);
- for (index = 0; index < fsftp->fsft_size; ++index) {
- falconsiena_filter_clear_entry(enp, fsftp, index);
+ for (index = 0; index < sftp->sft_size; ++index) {
+ siena_filter_clear_entry(enp, sftp, index);
}
- if (fsftp->fsft_used == 0)
- falconsiena_filter_reset_search_depth(fsfp, tbl_id);
+ if (sftp->sft_used == 0)
+ siena_filter_reset_search_depth(sfp, tbl_id);
EFSYS_UNLOCK(enp->en_eslp, state);
}
static __checkReturn efx_rc_t
-falconsiena_filter_init(
+siena_filter_init(
__in efx_nic_t *enp)
{
- falconsiena_filter_t *fsfp;
- falconsiena_filter_tbl_t *fsftp;
+ siena_filter_t *sfp;
+ siena_filter_tbl_t *sftp;
int tbl_id;
efx_rc_t rc;
- EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (falconsiena_filter_t), fsfp);
+ EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (siena_filter_t), sfp);
- if (!fsfp) {
+ if (!sfp) {
rc = ENOMEM;
goto fail1;
}
- enp->en_filter.ef_falconsiena_filter = fsfp;
+ enp->en_filter.ef_siena_filter = sfp;
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_IP];
- fsftp->fsft_size = FR_AZ_RX_FILTER_TBL0_ROWS;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
-#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_IP];
- fsftp->fsft_size = FR_AZ_RX_FILTER_TBL0_ROWS;
+ sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_RX_IP];
+ sftp->sft_size = FR_AZ_RX_FILTER_TBL0_ROWS;
- fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_RX_MAC];
- fsftp->fsft_size = FR_CZ_RX_MAC_FILTER_TBL0_ROWS;
+ sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_RX_MAC];
+ sftp->sft_size = FR_CZ_RX_MAC_FILTER_TBL0_ROWS;
- fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_IP];
- fsftp->fsft_size = FR_CZ_TX_FILTER_TBL0_ROWS;
+ sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_IP];
+ sftp->sft_size = FR_CZ_TX_FILTER_TBL0_ROWS;
- fsftp = &fsfp->fsf_tbl[EFX_FS_FILTER_TBL_TX_MAC];
- fsftp->fsft_size = FR_CZ_TX_MAC_FILTER_TBL0_ROWS;
+ sftp = &sfp->sf_tbl[EFX_SIENA_FILTER_TBL_TX_MAC];
+ sftp->sft_size = FR_CZ_TX_MAC_FILTER_TBL0_ROWS;
break;
-#endif /* EFSYS_OPT_SIENA */
default:
rc = ENOTSUP;
goto fail2;
}
- for (tbl_id = 0; tbl_id < EFX_FS_FILTER_NTBLS; tbl_id++) {
+ for (tbl_id = 0; tbl_id < EFX_SIENA_FILTER_NTBLS; tbl_id++) {
unsigned int bitmap_size;
- fsftp = &fsfp->fsf_tbl[tbl_id];
- if (fsftp->fsft_size == 0)
+ sftp = &sfp->sf_tbl[tbl_id];
+ if (sftp->sft_size == 0)
continue;
- EFX_STATIC_ASSERT(sizeof (fsftp->fsft_bitmap[0]) ==
+ EFX_STATIC_ASSERT(sizeof (sftp->sft_bitmap[0]) ==
sizeof (uint32_t));
bitmap_size =
- (fsftp->fsft_size + (sizeof (uint32_t) * 8) - 1) / 8;
+ (sftp->sft_size + (sizeof (uint32_t) * 8) - 1) / 8;
- EFSYS_KMEM_ALLOC(enp->en_esip, bitmap_size, fsftp->fsft_bitmap);
- if (!fsftp->fsft_bitmap) {
+ EFSYS_KMEM_ALLOC(enp->en_esip, bitmap_size, sftp->sft_bitmap);
+ if (!sftp->sft_bitmap) {
rc = ENOMEM;
goto fail3;
}
EFSYS_KMEM_ALLOC(enp->en_esip,
- fsftp->fsft_size * sizeof (*fsftp->fsft_spec),
- fsftp->fsft_spec);
- if (!fsftp->fsft_spec) {
+ sftp->sft_size * sizeof (*sftp->sft_spec),
+ sftp->sft_spec);
+ if (!sftp->sft_spec) {
rc = ENOMEM;
goto fail4;
}
- memset(fsftp->fsft_spec, 0,
- fsftp->fsft_size * sizeof (*fsftp->fsft_spec));
+ memset(sftp->sft_spec, 0,
+ sftp->sft_size * sizeof (*sftp->sft_spec));
}
return (0);
@@ -1158,7 +1121,7 @@ fail3:
fail2:
EFSYS_PROBE(fail2);
- falconsiena_filter_fini(enp);
+ siena_filter_fini(enp);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
@@ -1166,53 +1129,53 @@ fail1:
}
static void
-falconsiena_filter_fini(
+siena_filter_fini(
__in efx_nic_t *enp)
{
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
- falconsiena_filter_tbl_id_t tbl_id;
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
+ siena_filter_tbl_id_t tbl_id;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
- if (fsfp == NULL)
+ if (sfp == NULL)
return;
- for (tbl_id = 0; tbl_id < EFX_FS_FILTER_NTBLS; tbl_id++) {
- falconsiena_filter_tbl_t *fsftp = &fsfp->fsf_tbl[tbl_id];
+ for (tbl_id = 0; tbl_id < EFX_SIENA_FILTER_NTBLS; tbl_id++) {
+ siena_filter_tbl_t *sftp = &sfp->sf_tbl[tbl_id];
unsigned int bitmap_size;
- EFX_STATIC_ASSERT(sizeof (fsftp->fsft_bitmap[0]) ==
+ EFX_STATIC_ASSERT(sizeof (sftp->sft_bitmap[0]) ==
sizeof (uint32_t));
bitmap_size =
- (fsftp->fsft_size + (sizeof (uint32_t) * 8) - 1) / 8;
+ (sftp->sft_size + (sizeof (uint32_t) * 8) - 1) / 8;
- if (fsftp->fsft_bitmap != NULL) {
+ if (sftp->sft_bitmap != NULL) {
EFSYS_KMEM_FREE(enp->en_esip, bitmap_size,
- fsftp->fsft_bitmap);
- fsftp->fsft_bitmap = NULL;
+ sftp->sft_bitmap);
+ sftp->sft_bitmap = NULL;
}
- if (fsftp->fsft_spec != NULL) {
- EFSYS_KMEM_FREE(enp->en_esip, fsftp->fsft_size *
- sizeof (*fsftp->fsft_spec), fsftp->fsft_spec);
- fsftp->fsft_spec = NULL;
+ if (sftp->sft_spec != NULL) {
+ EFSYS_KMEM_FREE(enp->en_esip, sftp->sft_size *
+ sizeof (*sftp->sft_spec), sftp->sft_spec);
+ sftp->sft_spec = NULL;
}
}
- EFSYS_KMEM_FREE(enp->en_esip, sizeof (falconsiena_filter_t),
- enp->en_filter.ef_falconsiena_filter);
+ EFSYS_KMEM_FREE(enp->en_esip, sizeof (siena_filter_t),
+ enp->en_filter.ef_siena_filter);
}
/* Restore filter state after a reset */
static __checkReturn efx_rc_t
-falconsiena_filter_restore(
+siena_filter_restore(
__in efx_nic_t *enp)
{
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
- falconsiena_filter_tbl_id_t tbl_id;
- falconsiena_filter_tbl_t *fsftp;
- falconsiena_filter_spec_t *spec;
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
+ siena_filter_tbl_id_t tbl_id;
+ siena_filter_tbl_t *sftp;
+ siena_filter_spec_t *spec;
efx_oword_t filter;
int filter_idx;
int state;
@@ -1220,25 +1183,25 @@ falconsiena_filter_restore(
EFSYS_LOCK(enp->en_eslp, state);
- for (tbl_id = 0; tbl_id < EFX_FS_FILTER_NTBLS; tbl_id++) {
- fsftp = &fsfp->fsf_tbl[tbl_id];
+ for (tbl_id = 0; tbl_id < EFX_SIENA_FILTER_NTBLS; tbl_id++) {
+ sftp = &sfp->sf_tbl[tbl_id];
for (filter_idx = 0;
- filter_idx < fsftp->fsft_size;
+ filter_idx < sftp->sft_size;
filter_idx++) {
- if (!falconsiena_filter_test_used(fsftp, filter_idx))
+ if (!siena_filter_test_used(sftp, filter_idx))
continue;
- spec = &fsftp->fsft_spec[filter_idx];
- if ((rc = falconsiena_filter_build(&filter, spec)) != 0)
+ spec = &sftp->sft_spec[filter_idx];
+ if ((rc = siena_filter_build(&filter, spec)) != 0)
goto fail1;
- if ((rc = falconsiena_filter_push_entry(enp,
- spec->fsfs_type, filter_idx, &filter)) != 0)
+ if ((rc = siena_filter_push_entry(enp,
+ spec->sfs_type, filter_idx, &filter)) != 0)
goto fail2;
}
}
- falconsiena_filter_push_rx_limits(enp);
- falconsiena_filter_push_tx_limits(enp);
+ siena_filter_push_rx_limits(enp);
+ siena_filter_push_tx_limits(enp);
EFSYS_UNLOCK(enp->en_eslp, state);
@@ -1256,17 +1219,17 @@ fail1:
}
static __checkReturn efx_rc_t
-falconsiena_filter_add(
+siena_filter_add(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec,
__in boolean_t may_replace)
{
efx_rc_t rc;
- falconsiena_filter_spec_t fs_spec;
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
- falconsiena_filter_tbl_id_t tbl_id;
- falconsiena_filter_tbl_t *fsftp;
- falconsiena_filter_spec_t *saved_fs_spec;
+ siena_filter_spec_t sf_spec;
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
+ siena_filter_tbl_id_t tbl_id;
+ siena_filter_tbl_t *sftp;
+ siena_filter_spec_t *saved_sf_spec;
efx_oword_t filter;
int filter_idx;
unsigned int depth;
@@ -1276,48 +1239,48 @@ falconsiena_filter_add(
EFSYS_ASSERT3P(spec, !=, NULL);
- if ((rc = falconsiena_filter_spec_from_gen_spec(&fs_spec, spec)) != 0)
+ if ((rc = siena_filter_spec_from_gen_spec(&sf_spec, spec)) != 0)
goto fail1;
- tbl_id = falconsiena_filter_tbl_id(fs_spec.fsfs_type);
- fsftp = &fsfp->fsf_tbl[tbl_id];
+ tbl_id = siena_filter_tbl_id(sf_spec.sfs_type);
+ sftp = &sfp->sf_tbl[tbl_id];
- if (fsftp->fsft_size == 0) {
+ if (sftp->sft_size == 0) {
rc = EINVAL;
goto fail2;
}
- key = falconsiena_filter_build(&filter, &fs_spec);
+ key = siena_filter_build(&filter, &sf_spec);
EFSYS_LOCK(enp->en_eslp, state);
- rc = falconsiena_filter_search(fsftp, &fs_spec, key, B_TRUE,
+ rc = siena_filter_search(sftp, &sf_spec, key, B_TRUE,
&filter_idx, &depth);
if (rc != 0)
goto fail3;
- EFSYS_ASSERT3U(filter_idx, <, fsftp->fsft_size);
- saved_fs_spec = &fsftp->fsft_spec[filter_idx];
+ EFSYS_ASSERT3U(filter_idx, <, sftp->sft_size);
+ saved_sf_spec = &sftp->sft_spec[filter_idx];
- if (falconsiena_filter_test_used(fsftp, filter_idx)) {
+ if (siena_filter_test_used(sftp, filter_idx)) {
if (may_replace == B_FALSE) {
rc = EEXIST;
goto fail4;
}
}
- falconsiena_filter_set_used(fsftp, filter_idx);
- *saved_fs_spec = fs_spec;
-
- if (fsfp->fsf_depth[fs_spec.fsfs_type] < depth) {
- fsfp->fsf_depth[fs_spec.fsfs_type] = depth;
- if (tbl_id == EFX_FS_FILTER_TBL_TX_IP ||
- tbl_id == EFX_FS_FILTER_TBL_TX_MAC)
- falconsiena_filter_push_tx_limits(enp);
+ siena_filter_set_used(sftp, filter_idx);
+ *saved_sf_spec = sf_spec;
+
+ if (sfp->sf_depth[sf_spec.sfs_type] < depth) {
+ sfp->sf_depth[sf_spec.sfs_type] = depth;
+ if (tbl_id == EFX_SIENA_FILTER_TBL_TX_IP ||
+ tbl_id == EFX_SIENA_FILTER_TBL_TX_MAC)
+ siena_filter_push_tx_limits(enp);
else
- falconsiena_filter_push_rx_limits(enp);
+ siena_filter_push_rx_limits(enp);
}
- falconsiena_filter_push_entry(enp, fs_spec.fsfs_type,
+ siena_filter_push_entry(enp, sf_spec.sfs_type,
filter_idx, &filter);
EFSYS_UNLOCK(enp->en_eslp, state);
@@ -1339,15 +1302,15 @@ fail1:
}
static __checkReturn efx_rc_t
-falconsiena_filter_delete(
+siena_filter_delete(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec)
{
efx_rc_t rc;
- falconsiena_filter_spec_t fs_spec;
- falconsiena_filter_t *fsfp = enp->en_filter.ef_falconsiena_filter;
- falconsiena_filter_tbl_id_t tbl_id;
- falconsiena_filter_tbl_t *fsftp;
+ siena_filter_spec_t sf_spec;
+ siena_filter_t *sfp = enp->en_filter.ef_siena_filter;
+ siena_filter_tbl_id_t tbl_id;
+ siena_filter_tbl_t *sftp;
efx_oword_t filter;
int filter_idx;
unsigned int depth;
@@ -1356,24 +1319,24 @@ falconsiena_filter_delete(
EFSYS_ASSERT3P(spec, !=, NULL);
- if ((rc = falconsiena_filter_spec_from_gen_spec(&fs_spec, spec)) != 0)
+ if ((rc = siena_filter_spec_from_gen_spec(&sf_spec, spec)) != 0)
goto fail1;
- tbl_id = falconsiena_filter_tbl_id(fs_spec.fsfs_type);
- fsftp = &fsfp->fsf_tbl[tbl_id];
+ tbl_id = siena_filter_tbl_id(sf_spec.sfs_type);
+ sftp = &sfp->sf_tbl[tbl_id];
- key = falconsiena_filter_build(&filter, &fs_spec);
+ key = siena_filter_build(&filter, &sf_spec);
EFSYS_LOCK(enp->en_eslp, state);
- rc = falconsiena_filter_search(fsftp, &fs_spec, key, B_FALSE,
+ rc = siena_filter_search(sftp, &sf_spec, key, B_FALSE,
&filter_idx, &depth);
if (rc != 0)
goto fail2;
- falconsiena_filter_clear_entry(enp, fsftp, filter_idx);
- if (fsftp->fsft_used == 0)
- falconsiena_filter_reset_search_depth(fsfp, tbl_id);
+ siena_filter_clear_entry(enp, sftp, filter_idx);
+ if (sftp->sft_used == 0)
+ siena_filter_reset_search_depth(sfp, tbl_id);
EFSYS_UNLOCK(enp->en_eslp, state);
return (0);
@@ -1390,7 +1353,7 @@ fail1:
#define MAX_SUPPORTED 4
static __checkReturn efx_rc_t
-falconsiena_filter_supported_filters(
+siena_filter_supported_filters(
__in efx_nic_t *enp,
__out uint32_t *list,
__out size_t *length)
@@ -1434,6 +1397,6 @@ fail1:
#undef MAX_SUPPORTED
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
#endif /* EFSYS_OPT_FILTER */
diff --git a/sys/dev/sfxge/common/efx_hash.c b/sys/dev/sfxge/common/efx_hash.c
index db8b12c..808351f 100644
--- a/sys/dev/sfxge/common/efx_hash.c
+++ b/sys/dev/sfxge/common/efx_hash.c
@@ -10,7 +10,7 @@
* ...You can use this free for any purpose. It's in the public domain.
* It has no warranty."
*
- * Copyright (c) 2014-2015 Solarflare Communications Inc.
+ * Copyright (c) 2014-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h
index 5495b15..43e9492 100644
--- a/sys/dev/sfxge/common/efx_impl.h
+++ b/sys/dev/sfxge/common/efx_impl.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,6 @@
#ifndef _SYS_EFX_IMPL_H
#define _SYS_EFX_IMPL_H
-#include "efsys.h"
#include "efx.h"
#include "efx_regs.h"
#include "efx_regs_ef10.h"
@@ -43,12 +42,6 @@
#define ESE_DZ_EV_CODE_DRV_GEN_EV FSE_AZ_EV_CODE_DRV_GEN_EV
#endif
-#include "efx_check.h"
-
-
-#if EFSYS_OPT_FALCON
-#include "falcon_impl.h"
-#endif /* EFSYS_OPT_FALCON */
#if EFSYS_OPT_SIENA
#include "siena_impl.h"
@@ -83,18 +76,14 @@ extern "C" {
#define EFX_MOD_MON 0x00000400
#define EFX_MOD_WOL 0x00000800
#define EFX_MOD_FILTER 0x00001000
-#define EFX_MOD_PKTFILTER 0x00002000
-#define EFX_MOD_LIC 0x00004000
+#define EFX_MOD_LIC 0x00002000
-#define EFX_RESET_MAC 0x00000001
-#define EFX_RESET_PHY 0x00000002
-#define EFX_RESET_RXQ_ERR 0x00000004
-#define EFX_RESET_TXQ_ERR 0x00000008
+#define EFX_RESET_PHY 0x00000001
+#define EFX_RESET_RXQ_ERR 0x00000002
+#define EFX_RESET_TXQ_ERR 0x00000004
typedef enum efx_mac_type_e {
EFX_MAC_INVALID = 0,
- EFX_MAC_FALCON_GMAC,
- EFX_MAC_FALCON_XMAC,
EFX_MAC_SIENA,
EFX_MAC_HUNTINGTON,
EFX_MAC_MEDFORD,
@@ -190,11 +179,11 @@ typedef struct efx_rx_ops_s {
} efx_rx_ops_t;
typedef struct efx_mac_ops_s {
- efx_rc_t (*emo_reset)(efx_nic_t *); /* optional */
efx_rc_t (*emo_poll)(efx_nic_t *, efx_link_mode_t *);
efx_rc_t (*emo_up)(efx_nic_t *, boolean_t *);
efx_rc_t (*emo_addr_set)(efx_nic_t *);
efx_rc_t (*emo_pdu_set)(efx_nic_t *);
+ efx_rc_t (*emo_pdu_get)(efx_nic_t *, size_t *);
efx_rc_t (*emo_reconfigure)(efx_nic_t *);
efx_rc_t (*emo_multicast_list_set)(efx_nic_t *);
efx_rc_t (*emo_filter_default_rxq_set)(efx_nic_t *,
@@ -218,23 +207,11 @@ typedef struct efx_phy_ops_s {
efx_rc_t (*epo_reset)(efx_nic_t *);
efx_rc_t (*epo_reconfigure)(efx_nic_t *);
efx_rc_t (*epo_verify)(efx_nic_t *);
- efx_rc_t (*epo_uplink_check)(efx_nic_t *,
- boolean_t *); /* optional */
- efx_rc_t (*epo_downlink_check)(efx_nic_t *, efx_link_mode_t *,
- unsigned int *, uint32_t *);
efx_rc_t (*epo_oui_get)(efx_nic_t *, uint32_t *);
#if EFSYS_OPT_PHY_STATS
efx_rc_t (*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
uint32_t *);
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- const char *(*epo_prop_name)(efx_nic_t *, unsigned int);
-#endif /* EFSYS_OPT_PHY_PROPS */
- efx_rc_t (*epo_prop_get)(efx_nic_t *, unsigned int, uint32_t,
- uint32_t *);
- efx_rc_t (*epo_prop_set)(efx_nic_t *, unsigned int, uint32_t);
-#endif /* EFSYS_OPT_PHY_PROPS */
#if EFSYS_OPT_BIST
efx_rc_t (*epo_bist_enable_offline)(efx_nic_t *);
efx_rc_t (*epo_bist_start)(efx_nic_t *, efx_bist_type_t);
@@ -256,7 +233,7 @@ typedef struct efx_filter_ops_s {
efx_rc_t (*efo_supported_filters)(efx_nic_t *, uint32_t *, size_t *);
efx_rc_t (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
boolean_t, boolean_t, boolean_t,
- uint8_t const *, int);
+ uint8_t const *, uint32_t);
} efx_filter_ops_t;
extern __checkReturn efx_rc_t
@@ -268,7 +245,7 @@ efx_filter_reconfigure(
__in boolean_t all_mulcst,
__in boolean_t brdcst,
__in_ecount(6*count) uint8_t const *addrs,
- __in int count);
+ __in uint32_t count);
#endif /* EFSYS_OPT_FILTER */
@@ -306,31 +283,16 @@ typedef struct efx_port_s {
uint32_t ep_lp_cap_mask;
uint32_t ep_default_adv_cap_mask;
uint32_t ep_phy_cap_mask;
-#if EFSYS_OPT_PHY_TXC43128 || EFSYS_OPT_PHY_QT2025C
- union {
- struct {
- unsigned int bug10934_count;
- } ep_txc43128;
- struct {
- unsigned int bug17190_count;
- } ep_qt2025c;
- };
-#endif
- boolean_t ep_mac_poll_needed; /* falcon only */
- boolean_t ep_mac_up; /* falcon only */
- uint32_t ep_fwver; /* falcon only */
boolean_t ep_mac_drain;
boolean_t ep_mac_stats_pending;
#if EFSYS_OPT_BIST
efx_bist_type_t ep_current_bist;
#endif
- efx_mac_ops_t *ep_emop;
- efx_phy_ops_t *ep_epop;
+ const efx_mac_ops_t *ep_emop;
+ const efx_phy_ops_t *ep_epop;
} efx_port_t;
typedef struct efx_mon_ops_s {
- efx_rc_t (*emo_reset)(efx_nic_t *);
- efx_rc_t (*emo_reconfigure)(efx_nic_t *);
#if EFSYS_OPT_MON_STATS
efx_rc_t (*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
efx_mon_stat_value_t *);
@@ -338,8 +300,8 @@ typedef struct efx_mon_ops_s {
} efx_mon_ops_t;
typedef struct efx_mon_s {
- efx_mon_type_t em_type;
- efx_mon_ops_t *em_emop;
+ efx_mon_type_t em_type;
+ const efx_mon_ops_t *em_emop;
} efx_mon_t;
typedef struct efx_intr_ops_s {
@@ -356,10 +318,10 @@ typedef struct efx_intr_ops_s {
} efx_intr_ops_t;
typedef struct efx_intr_s {
- efx_intr_ops_t *ei_eiop;
- efsys_mem_t *ei_esmp;
- efx_intr_type_t ei_type;
- unsigned int ei_level;
+ const efx_intr_ops_t *ei_eiop;
+ efsys_mem_t *ei_esmp;
+ efx_intr_type_t ei_type;
+ unsigned int ei_level;
} efx_intr_t;
typedef struct efx_nic_ops_s {
@@ -372,7 +334,6 @@ typedef struct efx_nic_ops_s {
efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t,
uint32_t *, size_t *);
#if EFSYS_OPT_DIAG
- efx_rc_t (*eno_sram_test)(efx_nic_t *, efx_sram_pattern_fn_t);
efx_rc_t (*eno_register_test)(efx_nic_t *);
#endif /* EFSYS_OPT_DIAG */
void (*eno_fini)(efx_nic_t *);
@@ -394,68 +355,64 @@ typedef struct efx_nic_ops_s {
#if EFSYS_OPT_FILTER
-typedef struct falconsiena_filter_spec_s {
- uint8_t fsfs_type;
- uint32_t fsfs_flags;
- uint32_t fsfs_dmaq_id;
- uint32_t fsfs_dword[3];
-} falconsiena_filter_spec_t;
-
-typedef enum falconsiena_filter_type_e {
- EFX_FS_FILTER_RX_TCP_FULL, /* TCP/IPv4 4-tuple {dIP,dTCP,sIP,sTCP} */
- EFX_FS_FILTER_RX_TCP_WILD, /* TCP/IPv4 dest {dIP,dTCP, -, -} */
- EFX_FS_FILTER_RX_UDP_FULL, /* UDP/IPv4 4-tuple {dIP,dUDP,sIP,sUDP} */
- EFX_FS_FILTER_RX_UDP_WILD, /* UDP/IPv4 dest {dIP,dUDP, -, -} */
+typedef struct siena_filter_spec_s {
+ uint8_t sfs_type;
+ uint32_t sfs_flags;
+ uint32_t sfs_dmaq_id;
+ uint32_t sfs_dword[3];
+} siena_filter_spec_t;
+
+typedef enum siena_filter_type_e {
+ EFX_SIENA_FILTER_RX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
+ EFX_SIENA_FILTER_RX_TCP_WILD, /* TCP/IPv4 {dIP,dTCP, -, -} */
+ EFX_SIENA_FILTER_RX_UDP_FULL, /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */
+ EFX_SIENA_FILTER_RX_UDP_WILD, /* UDP/IPv4 {dIP,dUDP, -, -} */
+ EFX_SIENA_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */
+ EFX_SIENA_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */
+
+ EFX_SIENA_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
+ EFX_SIENA_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */
+ EFX_SIENA_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
+ EFX_SIENA_FILTER_TX_UDP_WILD, /* UDP/IPv4 { -, -,sIP,sUDP} */
+ EFX_SIENA_FILTER_TX_MAC_FULL, /* Ethernet {sMAC,VLAN} */
+ EFX_SIENA_FILTER_TX_MAC_WILD, /* Ethernet {sMAC, -} */
+
+ EFX_SIENA_FILTER_NTYPES
+} siena_filter_type_t;
+
+typedef enum siena_filter_tbl_id_e {
+ EFX_SIENA_FILTER_TBL_RX_IP = 0,
+ EFX_SIENA_FILTER_TBL_RX_MAC,
+ EFX_SIENA_FILTER_TBL_TX_IP,
+ EFX_SIENA_FILTER_TBL_TX_MAC,
+ EFX_SIENA_FILTER_NTBLS
+} siena_filter_tbl_id_t;
+
+typedef struct siena_filter_tbl_s {
+ int sft_size; /* number of entries */
+ int sft_used; /* active count */
+ uint32_t *sft_bitmap; /* active bitmap */
+ siena_filter_spec_t *sft_spec; /* array of saved specs */
+} siena_filter_tbl_t;
+
+typedef struct siena_filter_s {
+ siena_filter_tbl_t sf_tbl[EFX_SIENA_FILTER_NTBLS];
+ unsigned int sf_depth[EFX_SIENA_FILTER_NTYPES];
+} siena_filter_t;
+typedef struct efx_filter_s {
#if EFSYS_OPT_SIENA
- EFX_FS_FILTER_RX_MAC_FULL, /* Ethernet {dMAC,VLAN} */
- EFX_FS_FILTER_RX_MAC_WILD, /* Ethernet {dMAC, -} */
-
- EFX_FS_FILTER_TX_TCP_FULL, /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
- EFX_FS_FILTER_TX_TCP_WILD, /* TCP/IPv4 { -, -,sIP,sTCP} */
- EFX_FS_FILTER_TX_UDP_FULL, /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
- EFX_FS_FILTER_TX_UDP_WILD, /* UDP/IPv4 source (host, port) */
-
- EFX_FS_FILTER_TX_MAC_FULL, /* Ethernet source (MAC address, VLAN ID) */
- EFX_FS_FILTER_TX_MAC_WILD, /* Ethernet source (MAC address) */
+ siena_filter_t *ef_siena_filter;
#endif /* EFSYS_OPT_SIENA */
-
- EFX_FS_FILTER_NTYPES
-} falconsiena_filter_type_t;
-
-typedef enum falconsiena_filter_tbl_id_e {
- EFX_FS_FILTER_TBL_RX_IP = 0,
- EFX_FS_FILTER_TBL_RX_MAC,
- EFX_FS_FILTER_TBL_TX_IP,
- EFX_FS_FILTER_TBL_TX_MAC,
- EFX_FS_FILTER_NTBLS
-} falconsiena_filter_tbl_id_t;
-
-typedef struct falconsiena_filter_tbl_s {
- int fsft_size; /* number of entries */
- int fsft_used; /* active count */
- uint32_t *fsft_bitmap; /* active bitmap */
- falconsiena_filter_spec_t *fsft_spec; /* array of saved specs */
-} falconsiena_filter_tbl_t;
-
-typedef struct falconsiena_filter_s {
- falconsiena_filter_tbl_t fsf_tbl[EFX_FS_FILTER_NTBLS];
- unsigned int fsf_depth[EFX_FS_FILTER_NTYPES];
-} falconsiena_filter_t;
-
-typedef struct efx_filter_s {
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
- falconsiena_filter_t *ef_falconsiena_filter;
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
ef10_filter_table_t *ef_ef10_filter_table;
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
} efx_filter_t;
extern void
-falconsiena_filter_tbl_clear(
+siena_filter_tbl_clear(
__in efx_nic_t *enp,
- __in falconsiena_filter_tbl_id_t tbl);
+ __in siena_filter_tbl_id_t tbl);
#endif /* EFSYS_OPT_FILTER */
@@ -473,7 +430,7 @@ typedef struct efx_mcdi_ops_s {
} efx_mcdi_ops_t;
typedef struct efx_mcdi_s {
- efx_mcdi_ops_t *em_emcop;
+ const efx_mcdi_ops_t *em_emcop;
const efx_mcdi_transport_t *em_emtp;
efx_mcdi_iface_t em_emip;
} efx_mcdi_t;
@@ -500,6 +457,8 @@ typedef struct efx_nvram_ops_s {
uint32_t *, uint16_t *);
efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t,
uint16_t *);
+ efx_rc_t (*envo_buffer_validate)(efx_nic_t *, uint32_t,
+ caddr_t, size_t);
} efx_nvram_ops_t;
#endif /* EFSYS_OPT_NVRAM */
@@ -602,6 +561,27 @@ typedef struct efx_lic_ops_s {
efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
size_t *, uint8_t *);
+ efx_rc_t (*elo_find_start)
+ (efx_nic_t *, caddr_t, size_t, uint32_t *);
+ efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t,
+ uint32_t , uint32_t *);
+ boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t,
+ uint32_t, uint32_t *, uint32_t *);
+ boolean_t (*elo_validate_key)(efx_nic_t *,
+ caddr_t, uint32_t);
+ efx_rc_t (*elo_read_key)(efx_nic_t *,
+ caddr_t, size_t, uint32_t, uint32_t,
+ caddr_t, size_t, uint32_t *);
+ efx_rc_t (*elo_write_key)(efx_nic_t *,
+ caddr_t, size_t, uint32_t,
+ caddr_t, uint32_t, uint32_t *);
+ efx_rc_t (*elo_delete_key)(efx_nic_t *,
+ caddr_t, size_t, uint32_t,
+ uint32_t, uint32_t, uint32_t *);
+ efx_rc_t (*elo_create_partition)(efx_nic_t *,
+ caddr_t, size_t);
+ efx_rc_t (*elo_finish_partition)(efx_nic_t *,
+ caddr_t, size_t);
} efx_lic_ops_t;
#endif
@@ -631,23 +611,23 @@ struct efx_nic_s {
uint32_t en_ev_qcount;
uint32_t en_rx_qcount;
uint32_t en_tx_qcount;
- efx_nic_ops_t *en_enop;
- efx_ev_ops_t *en_eevop;
- efx_tx_ops_t *en_etxop;
- efx_rx_ops_t *en_erxop;
+ const efx_nic_ops_t *en_enop;
+ const efx_ev_ops_t *en_eevop;
+ const efx_tx_ops_t *en_etxop;
+ const efx_rx_ops_t *en_erxop;
#if EFSYS_OPT_FILTER
efx_filter_t en_filter;
- efx_filter_ops_t *en_efop;
+ const efx_filter_ops_t *en_efop;
#endif /* EFSYS_OPT_FILTER */
#if EFSYS_OPT_MCDI
efx_mcdi_t en_mcdi;
#endif /* EFSYS_OPT_MCDI */
#if EFSYS_OPT_NVRAM
efx_nvram_type_t en_nvram_locked;
- efx_nvram_ops_t *en_envop;
+ const efx_nvram_ops_t *en_envop;
#endif /* EFSYS_OPT_NVRAM */
#if EFSYS_OPT_VPD
- efx_vpd_ops_t *en_evpdop;
+ const efx_vpd_ops_t *en_evpdop;
#endif /* EFSYS_OPT_VPD */
#if EFSYS_OPT_RX_SCALE
efx_rx_hash_support_t en_hash_support;
@@ -656,27 +636,10 @@ struct efx_nic_s {
#endif /* EFSYS_OPT_RX_SCALE */
uint32_t en_vport_id;
#if EFSYS_OPT_LICENSING
- efx_lic_ops_t *en_elop;
+ const efx_lic_ops_t *en_elop;
+ boolean_t en_licensing_supported;
#endif
union {
-#if EFSYS_OPT_FALCON
- struct {
- falcon_spi_dev_t enu_fsd[FALCON_SPI_NTYPES];
- falcon_i2c_t enu_fip;
- boolean_t enu_i2c_locked;
-#if EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE
- const uint8_t *enu_forced_cfg;
-#endif /* EFSYS_OPT_FALCON_NIC_CFG_OVERRIDE */
- uint8_t enu_mon_devid;
-#if EFSYS_OPT_PCIE_TUNE
- unsigned int enu_nlanes;
-#endif /* EFSYS_OPT_PCIE_TUNE */
- uint16_t enu_board_rev;
- boolean_t enu_internal_sram;
- uint8_t enu_sram_num_bank;
- uint8_t enu_sram_bank_size;
- } falcon;
-#endif /* EFSYS_OPT_FALCON */
#if EFSYS_OPT_SIENA
struct {
#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
@@ -750,7 +713,6 @@ struct efx_evq_s {
#define EFX_EVQ_MAGIC 0x08081997
-#define EFX_EVQ_FALCON_TIMER_QUANTUM_NS 4968 /* 621 cycles */
#define EFX_EVQ_SIENA_TIMER_QUANTUM_NS 6144 /* 768 cycles */
struct efx_rxq_s {
@@ -814,10 +776,6 @@ struct efx_txq_s {
char rev; \
\
switch ((_enp)->en_family) { \
- case EFX_FAMILY_FALCON: \
- rev = 'B'; \
- break; \
- \
case EFX_FAMILY_SIENA: \
rev = 'C'; \
break; \
diff --git a/sys/dev/sfxge/common/efx_intr.c b/sys/dev/sfxge/common/efx_intr.c
index eb570fc..ee9301d 100644
--- a/sys/dev/sfxge/common/efx_intr.c
+++ b/sys/dev/sfxge/common/efx_intr.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,89 +35,75 @@ __FBSDID("$FreeBSD$");
#include "efx_impl.h"
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_intr_init(
+siena_intr_init(
__in efx_nic_t *enp,
__in efx_intr_type_t type,
__in efsys_mem_t *esmp);
static void
-falconsiena_intr_enable(
+siena_intr_enable(
__in efx_nic_t *enp);
static void
-falconsiena_intr_disable(
+siena_intr_disable(
__in efx_nic_t *enp);
static void
-falconsiena_intr_disable_unlocked(
+siena_intr_disable_unlocked(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
-falconsiena_intr_trigger(
+siena_intr_trigger(
__in efx_nic_t *enp,
__in unsigned int level);
static void
-falconsiena_intr_fini(
+siena_intr_fini(
__in efx_nic_t *enp);
static void
-falconsiena_intr_status_line(
+siena_intr_status_line(
__in efx_nic_t *enp,
__out boolean_t *fatalp,
__out uint32_t *qmaskp);
static void
-falconsiena_intr_status_message(
+siena_intr_status_message(
__in efx_nic_t *enp,
__in unsigned int message,
__out boolean_t *fatalp);
static void
-falconsiena_intr_fatal(
+siena_intr_fatal(
__in efx_nic_t *enp);
static __checkReturn boolean_t
-falconsiena_intr_check_fatal(
+siena_intr_check_fatal(
__in efx_nic_t *enp);
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
-
+#endif /* EFSYS_OPT_SIENA */
-#if EFSYS_OPT_FALCON
-static efx_intr_ops_t __efx_intr_falcon_ops = {
- falconsiena_intr_init, /* eio_init */
- falconsiena_intr_enable, /* eio_enable */
- falconsiena_intr_disable, /* eio_disable */
- falconsiena_intr_disable_unlocked, /* eio_disable_unlocked */
- falconsiena_intr_trigger, /* eio_trigger */
- falconsiena_intr_status_line, /* eio_status_line */
- falconsiena_intr_status_message, /* eio_status_message */
- falconsiena_intr_fatal, /* eio_fatal */
- falconsiena_intr_fini, /* eio_fini */
-};
-#endif /* EFSYS_OPT_FALCON */
#if EFSYS_OPT_SIENA
-static efx_intr_ops_t __efx_intr_siena_ops = {
- falconsiena_intr_init, /* eio_init */
- falconsiena_intr_enable, /* eio_enable */
- falconsiena_intr_disable, /* eio_disable */
- falconsiena_intr_disable_unlocked, /* eio_disable_unlocked */
- falconsiena_intr_trigger, /* eio_trigger */
- falconsiena_intr_status_line, /* eio_status_line */
- falconsiena_intr_status_message, /* eio_status_message */
- falconsiena_intr_fatal, /* eio_fatal */
- falconsiena_intr_fini, /* eio_fini */
+static const efx_intr_ops_t __efx_intr_siena_ops = {
+ siena_intr_init, /* eio_init */
+ siena_intr_enable, /* eio_enable */
+ siena_intr_disable, /* eio_disable */
+ siena_intr_disable_unlocked, /* eio_disable_unlocked */
+ siena_intr_trigger, /* eio_trigger */
+ siena_intr_status_line, /* eio_status_line */
+ siena_intr_status_message, /* eio_status_message */
+ siena_intr_fatal, /* eio_fatal */
+ siena_intr_fini, /* eio_fini */
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_intr_ops_t __efx_intr_ef10_ops = {
+static const efx_intr_ops_t __efx_intr_ef10_ops = {
ef10_intr_init, /* eio_init */
ef10_intr_enable, /* eio_enable */
ef10_intr_disable, /* eio_disable */
@@ -137,7 +123,7 @@ efx_intr_init(
__in efsys_mem_t *esmp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop;
+ const efx_intr_ops_t *eiop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -155,27 +141,21 @@ efx_intr_init(
enp->en_mod_flags |= EFX_MOD_INTR;
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- eiop = (efx_intr_ops_t *)&__efx_intr_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- eiop = (efx_intr_ops_t *)&__efx_intr_siena_ops;
+ eiop = &__efx_intr_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- eiop = (efx_intr_ops_t *)&__efx_intr_ef10_ops;
+ eiop = &__efx_intr_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- eiop = (efx_intr_ops_t *)&__efx_intr_ef10_ops;
+ eiop = &__efx_intr_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -207,7 +187,7 @@ efx_intr_fini(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
@@ -223,7 +203,7 @@ efx_intr_enable(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -236,7 +216,7 @@ efx_intr_disable(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -249,7 +229,7 @@ efx_intr_disable_unlocked(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -264,7 +244,7 @@ efx_intr_trigger(
__in unsigned int level)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -279,7 +259,7 @@ efx_intr_status_line(
__out uint32_t *qmaskp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -294,7 +274,7 @@ efx_intr_status_message(
__out boolean_t *fatalp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -307,7 +287,7 @@ efx_intr_fatal(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
- efx_intr_ops_t *eiop = eip->ei_eiop;
+ const efx_intr_ops_t *eiop = eip->ei_eiop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
@@ -320,10 +300,10 @@ efx_intr_fatal(
/* ************************************************************************* */
/* ************************************************************************* */
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_intr_init(
+siena_intr_init(
__in efx_nic_t *enp,
__in efx_intr_type_t type,
__in efsys_mem_t *esmp)
@@ -364,7 +344,7 @@ falconsiena_intr_init(
}
static void
-falconsiena_intr_enable(
+siena_intr_enable(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
@@ -378,7 +358,7 @@ falconsiena_intr_enable(
}
static void
-falconsiena_intr_disable(
+siena_intr_disable(
__in efx_nic_t *enp)
{
efx_oword_t oword;
@@ -391,7 +371,7 @@ falconsiena_intr_disable(
}
static void
-falconsiena_intr_disable_unlocked(
+siena_intr_disable_unlocked(
__in efx_nic_t *enp)
{
efx_oword_t oword;
@@ -404,7 +384,7 @@ falconsiena_intr_disable_unlocked(
}
static __checkReturn efx_rc_t
-falconsiena_intr_trigger(
+siena_intr_trigger(
__in efx_nic_t *enp,
__in unsigned int level)
{
@@ -417,24 +397,9 @@ falconsiena_intr_trigger(
/* bug16757: No event queues can be initialized */
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_EV));
- switch (enp->en_family) {
- case EFX_FAMILY_FALCON:
- if (level >= EFX_NINTR_FALCON) {
- rc = EINVAL;
- goto fail1;
- }
- break;
-
- case EFX_FAMILY_SIENA:
- if (level >= EFX_NINTR_SIENA) {
- rc = EINVAL;
- goto fail1;
- }
- break;
-
- default:
- EFSYS_ASSERT(B_FALSE);
- break;
+ if (level >= EFX_NINTR_SIENA) {
+ rc = EINVAL;
+ goto fail1;
}
if (level > EFX_MASK32(FRF_AZ_KER_INT_LEVE_SEL))
@@ -472,7 +437,7 @@ fail1:
}
static __checkReturn boolean_t
-falconsiena_intr_check_fatal(
+siena_intr_check_fatal(
__in efx_nic_t *enp)
{
efx_intr_t *eip = &(enp->en_intr);
@@ -496,7 +461,7 @@ falconsiena_intr_check_fatal(
}
static void
-falconsiena_intr_status_line(
+siena_intr_status_line(
__in efx_nic_t *enp,
__out boolean_t *fatalp,
__out uint32_t *qmaskp)
@@ -517,13 +482,13 @@ falconsiena_intr_status_line(
EFSYS_PROBE1(qmask, uint32_t, *qmaskp);
if (*qmaskp & (1U << eip->ei_level))
- *fatalp = falconsiena_intr_check_fatal(enp);
+ *fatalp = siena_intr_check_fatal(enp);
else
*fatalp = B_FALSE;
}
static void
-falconsiena_intr_status_message(
+siena_intr_status_message(
__in efx_nic_t *enp,
__in unsigned int message,
__out boolean_t *fatalp)
@@ -534,14 +499,14 @@ falconsiena_intr_status_message(
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_INTR);
if (message == eip->ei_level)
- *fatalp = falconsiena_intr_check_fatal(enp);
+ *fatalp = siena_intr_check_fatal(enp);
else
*fatalp = B_FALSE;
}
static void
-falconsiena_intr_fatal(
+siena_intr_fatal(
__in efx_nic_t *enp)
{
#if EFSYS_OPT_DECODE_INTR_FATAL
@@ -597,7 +562,7 @@ falconsiena_intr_fatal(
}
static void
-falconsiena_intr_fini(
+siena_intr_fini(
__in efx_nic_t *enp)
{
efx_oword_t oword;
@@ -607,4 +572,4 @@ falconsiena_intr_fini(
EFX_BAR_WRITEO(enp, FR_AZ_INT_ADR_REG_KER, &oword);
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
diff --git a/sys/dev/sfxge/common/efx_lic.c b/sys/dev/sfxge/common/efx_lic.c
index 33c8aba..127ead95 100644
--- a/sys/dev/sfxge/common/efx_lic.c
+++ b/sys/dev/sfxge/common/efx_lic.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,104 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_LICENSING
+#include "ef10_tlv_layout.h"
+
+#if EFSYS_OPT_SIENA | EFSYS_OPT_HUNTINGTON
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_find_start(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_find_end(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ );
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v1v2_find_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v1v2_validate_key(
+ __in efx_nic_t *enp,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_read_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(key_max_size, *lengthp)
+ caddr_t keyp,
+ __in size_t key_max_size,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_write_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_delete_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end,
+ __out uint32_t *deltap
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_create_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_finish_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
+#endif /* EFSYS_OPT_HUNTINGTON | EFSYS_OPT_SIENA */
+
+
#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
@@ -47,11 +145,20 @@ efx_mcdi_fc_license_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp);
-static efx_lic_ops_t __efx_lic_v1_ops = {
+static const efx_lic_ops_t __efx_lic_v1_ops = {
efx_mcdi_fc_license_update_license, /* elo_update_licenses */
efx_mcdi_fc_license_get_key_stats, /* elo_get_key_stats */
NULL, /* elo_app_state */
NULL, /* elo_get_id */
+ efx_lic_v1v2_find_start, /* elo_find_start */
+ efx_lic_v1v2_find_end, /* elo_find_end */
+ efx_lic_v1v2_find_key, /* elo_find_key */
+ efx_lic_v1v2_validate_key, /* elo_validate_key */
+ efx_lic_v1v2_read_key, /* elo_read_key */
+ efx_lic_v1v2_write_key, /* elo_write_key */
+ efx_lic_v1v2_delete_key, /* elo_delete_key */
+ efx_lic_v1v2_create_partition, /* elo_create_partition */
+ efx_lic_v1v2_finish_partition, /* elo_finish_partition */
};
#endif /* EFSYS_OPT_SIENA */
@@ -73,11 +180,20 @@ efx_mcdi_licensed_app_state(
__in uint64_t app_id,
__out boolean_t *licensedp);
-static efx_lic_ops_t __efx_lic_v2_ops = {
+static const efx_lic_ops_t __efx_lic_v2_ops = {
efx_mcdi_licensing_update_licenses, /* elo_update_licenses */
efx_mcdi_licensing_get_key_stats, /* elo_get_key_stats */
efx_mcdi_licensed_app_state, /* elo_app_state */
NULL, /* elo_get_id */
+ efx_lic_v1v2_find_start, /* elo_find_start */
+ efx_lic_v1v2_find_end, /* elo_find_end */
+ efx_lic_v1v2_find_key, /* elo_find_key */
+ efx_lic_v1v2_validate_key, /* elo_validate_key */
+ efx_lic_v1v2_read_key, /* elo_read_key */
+ efx_lic_v1v2_write_key, /* elo_write_key */
+ efx_lic_v1v2_delete_key, /* elo_delete_key */
+ efx_lic_v1v2_create_partition, /* elo_create_partition */
+ efx_lic_v1v2_finish_partition, /* elo_finish_partition */
};
#endif /* EFSYS_OPT_HUNTINGTON */
@@ -108,11 +224,111 @@ efx_mcdi_licensing_v3_get_id(
__out_bcount_part_opt(buffer_size, *lengthp)
uint8_t *bufferp);
-static efx_lic_ops_t __efx_lic_v3_ops = {
+ __checkReturn efx_rc_t
+efx_lic_v3_find_start(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v3_find_end(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ );
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v3_find_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v3_validate_key(
+ __in efx_nic_t *enp,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v3_read_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(key_max_size, *lengthp)
+ caddr_t keyp,
+ __in size_t key_max_size,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v3_write_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v3_delete_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end,
+ __out uint32_t *deltap
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v3_create_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
+ __checkReturn efx_rc_t
+efx_lic_v3_finish_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ );
+
+static const efx_lic_ops_t __efx_lic_v3_ops = {
efx_mcdi_licensing_v3_update_licenses, /* elo_update_licenses */
efx_mcdi_licensing_v3_report_license, /* elo_get_key_stats */
efx_mcdi_licensing_v3_app_state, /* elo_app_state */
efx_mcdi_licensing_v3_get_id, /* elo_get_id */
+ efx_lic_v3_find_start, /* elo_find_start*/
+ efx_lic_v3_find_end, /* elo_find_end */
+ efx_lic_v3_find_key, /* elo_find_key */
+ efx_lic_v3_validate_key, /* elo_validate_key */
+ efx_lic_v3_read_key, /* elo_read_key */
+ efx_lic_v3_write_key, /* elo_write_key */
+ efx_lic_v3_delete_key, /* elo_delete_key */
+ efx_lic_v3_create_partition, /* elo_create_partition */
+ efx_lic_v3_finish_partition, /* elo_finish_partition */
};
#endif /* EFSYS_OPT_MEDFORD */
@@ -133,12 +349,15 @@ efx_mcdi_fc_license_update_license(
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
(void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_FC_OP_LICENSE;
+ req.emr_cmd = MC_CMD_FC;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_FC_IN_LICENSE_LEN;
req.emr_out_buf = payload;
req.emr_out_length = 0;
+ MCDI_IN_SET_DWORD(req, FC_IN_CMD,
+ MC_CMD_FC_OP_LICENSE);
+
MCDI_IN_SET_DWORD(req, FC_IN_LICENSE_OP,
MC_CMD_FC_IN_LICENSE_UPDATE_LICENSE);
@@ -177,16 +396,19 @@ efx_mcdi_fc_license_get_key_stats(
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
(void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_FC_OP_LICENSE;
+ req.emr_cmd = MC_CMD_FC;
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_FC_IN_LICENSE_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_FC_OUT_LICENSE_LEN;
+ MCDI_IN_SET_DWORD(req, FC_IN_CMD,
+ MC_CMD_FC_OP_LICENSE);
+
MCDI_IN_SET_DWORD(req, FC_IN_LICENSE_OP,
MC_CMD_FC_IN_LICENSE_GET_KEY_STATS);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -223,6 +445,267 @@ fail1:
#endif /* EFSYS_OPT_SIENA */
+/* V1 and V2 Partition format - based on a 16-bit TLV format */
+
+#if EFSYS_OPT_SIENA | EFSYS_OPT_HUNTINGTON
+
+/*
+ * V1/V2 format - defined in SF-108542-TC section 4.2:
+ * Type (T): 16bit - revision/HMAC algorithm
+ * Length (L): 16bit - value length in bytes
+ * Value (V): L bytes - payload
+ */
+#define EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX (256)
+#define EFX_LICENSE_V1V2_HEADER_LENGTH (2*sizeof(uint16_t))
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_find_start(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ )
+{
+ _NOTE(ARGUNUSED(enp, bufferp, buffer_size))
+
+ *startp = 0;
+ return (0);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_find_end(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ )
+{
+ _NOTE(ARGUNUSED(enp, bufferp, buffer_size))
+
+ *endp = offset + EFX_LICENSE_V1V2_HEADER_LENGTH;
+ return (0);
+}
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v1v2_find_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ )
+{
+ boolean_t found;
+ uint16_t tlv_type;
+ uint16_t tlv_length;
+
+ _NOTE(ARGUNUSED(enp))
+
+ if((size_t)buffer_size - offset < EFX_LICENSE_V1V2_HEADER_LENGTH)
+ goto fail1;
+
+ tlv_type = __LE_TO_CPU_16(((uint16_t*)&bufferp[offset])[0]);
+ tlv_length = __LE_TO_CPU_16(((uint16_t*)&bufferp[offset])[1]);
+ if ((tlv_length > EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX) ||
+ (tlv_type == 0 && tlv_length == 0)) {
+ found = B_FALSE;
+ } else {
+ *startp = offset;
+ *lengthp = tlv_length + EFX_LICENSE_V1V2_HEADER_LENGTH;
+ found = B_TRUE;
+ }
+ return (found);
+
+fail1:
+ EFSYS_PROBE(fail1);
+
+ return (B_FALSE);
+}
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v1v2_validate_key(
+ __in efx_nic_t *enp,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+ uint16_t tlv_type;
+ uint16_t tlv_length;
+
+ _NOTE(ARGUNUSED(enp))
+
+ if (length < EFX_LICENSE_V1V2_HEADER_LENGTH) {
+ goto fail1;
+ }
+
+ tlv_type = __LE_TO_CPU_16(((uint16_t*)keyp)[0]);
+ tlv_length = __LE_TO_CPU_16(((uint16_t*)keyp)[1]);
+
+ if(tlv_length > EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX) {
+ goto fail2;
+ }
+ if (tlv_type == 0) {
+ goto fail3;
+ }
+ if ((tlv_length + EFX_LICENSE_V1V2_HEADER_LENGTH) != length) {
+ goto fail4;
+ }
+
+ return (B_TRUE);
+
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE(fail1);
+
+ return (B_FALSE);
+}
+
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_read_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(key_max_size, *lengthp)
+ caddr_t keyp,
+ __in size_t key_max_size,
+ __out uint32_t *lengthp
+ )
+{
+ efx_rc_t rc;
+
+ _NOTE(ARGUNUSED(enp))
+ EFSYS_ASSERT(length <= (EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX +
+ EFX_LICENSE_V1V2_HEADER_LENGTH));
+
+ if (key_max_size < length) {
+ rc = ENOSPC;
+ goto fail1;
+ }
+ memcpy(keyp, &bufferp[offset], length);
+
+ *lengthp = length;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_write_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ )
+{
+ efx_rc_t rc;
+
+ _NOTE(ARGUNUSED(enp))
+ EFSYS_ASSERT(length <= (EFX_LICENSE_V1V2_PAYLOAD_LENGTH_MAX +
+ EFX_LICENSE_V1V2_HEADER_LENGTH));
+
+ // Ensure space for terminator remains
+ if ((offset + length) >
+ (buffer_size - EFX_LICENSE_V1V2_HEADER_LENGTH) ) {
+ rc = ENOSPC;
+ goto fail1;
+ }
+
+ memcpy(bufferp + offset, keyp, length);
+
+ *lengthp = length;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_delete_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end,
+ __out uint32_t *deltap
+ )
+{
+ efx_rc_t rc;
+ uint32_t move_start = offset + length;
+ uint32_t move_length = end - move_start;
+
+ _NOTE(ARGUNUSED(enp))
+ EFSYS_ASSERT(end <= buffer_size);
+
+ // Shift everything after the key down
+ memmove(bufferp + offset, bufferp + move_start, move_length);
+
+ *deltap = length;
+
+ return (0);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_create_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ )
+{
+ _NOTE(ARGUNUSED(enp))
+ EFSYS_ASSERT(EFX_LICENSE_V1V2_HEADER_LENGTH <= buffer_size);
+
+ // Write terminator
+ memset(bufferp, '\0', EFX_LICENSE_V1V2_HEADER_LENGTH);
+ return (0);
+}
+
+
+ __checkReturn efx_rc_t
+efx_lic_v1v2_finish_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ )
+{
+ _NOTE(ARGUNUSED(enp, bufferp, buffer_size))
+
+ return (0);
+}
+
+#endif /* EFSYS_OPT_HUNTINGTON | EFSYS_OPT_SIENA */
+
+
/* V2 Licensing - used by Huntington family only. See SF-113611-TC */
#if EFSYS_OPT_HUNTINGTON
@@ -452,7 +935,7 @@ efx_mcdi_licensing_v3_report_license(
MCDI_IN_SET_DWORD(req, LICENSING_V3_IN_OP,
MC_CMD_LICENSING_V3_IN_OP_REPORT_LICENSE);
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -575,11 +1058,11 @@ efx_mcdi_licensing_v3_get_id(
req.emr_in_buf = bufferp;
req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
req.emr_out_buf = bufferp;
- req.emr_out_length = MIN(buffer_size, MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN);
+ req.emr_out_length = MIN(buffer_size, MC_CMD_LICENSING_GET_ID_V3_OUT_LENMAX);
(void) memset(bufferp, 0, req.emr_out_length);
}
- efx_mcdi_execute(enp, &req);
+ efx_mcdi_execute_quiet(enp, &req);
if (req.emr_rc != 0) {
rc = req.emr_rc;
@@ -617,6 +1100,228 @@ fail1:
return (rc);
}
+/* V3 format uses Huntington TLV format partition. See SF-108797-SW */
+#define EFX_LICENSE_V3_KEY_LENGTH_MIN (64)
+#define EFX_LICENSE_V3_KEY_LENGTH_MAX (160)
+
+ __checkReturn efx_rc_t
+efx_lic_v3_find_start(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ )
+{
+ _NOTE(ARGUNUSED(enp))
+
+ return ef10_nvram_buffer_find_item_start(bufferp, buffer_size, startp);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v3_find_end(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ )
+{
+ _NOTE(ARGUNUSED(enp))
+
+ return ef10_nvram_buffer_find_end(bufferp, buffer_size, offset, endp);
+}
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v3_find_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ )
+{
+ _NOTE(ARGUNUSED(enp))
+
+ return ef10_nvram_buffer_find_item(bufferp, buffer_size,
+ offset, startp, lengthp);
+}
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_v3_validate_key(
+ __in efx_nic_t *enp,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length
+ )
+{
+ // Check key is a valid V3 key
+ efx_rc_t rc;
+ uint8_t key_type;
+ uint8_t key_length;
+
+ _NOTE(ARGUNUSED(enp))
+
+ if (length < EFX_LICENSE_V3_KEY_LENGTH_MIN) {
+ goto fail1;
+ }
+
+ if (length > EFX_LICENSE_V3_KEY_LENGTH_MAX) {
+ goto fail2;
+ }
+
+ key_type = ((uint8_t*)keyp)[0];
+ key_length = ((uint8_t*)keyp)[1];
+
+ if (key_type < 3) {
+ goto fail3;
+ }
+ if (key_length > length) {
+ goto fail4;
+ }
+ return (B_TRUE);
+
+fail4:
+ EFSYS_PROBE(fail4);
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE(fail1);
+
+ return (B_FALSE);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v3_read_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(key_max_size, *lengthp)
+ caddr_t keyp,
+ __in size_t key_max_size,
+ __out uint32_t *lengthp
+ )
+{
+ _NOTE(ARGUNUSED(enp))
+
+ return ef10_nvram_buffer_get_item(bufferp, buffer_size,
+ offset, length, keyp, key_max_size, lengthp);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v3_write_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ )
+{
+ _NOTE(ARGUNUSED(enp))
+ EFSYS_ASSERT(length <= EFX_LICENSE_V3_KEY_LENGTH_MAX);
+
+ return ef10_nvram_buffer_insert_item(bufferp, buffer_size,
+ offset, keyp, length, lengthp);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v3_delete_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end,
+ __out uint32_t *deltap
+ )
+{
+ efx_rc_t rc;
+
+ _NOTE(ARGUNUSED(enp))
+
+ if ((rc = ef10_nvram_buffer_delete_item(bufferp,
+ buffer_size, offset, length, end)) != 0) {
+ goto fail1;
+ }
+
+ *deltap = length;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v3_create_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ )
+{
+ efx_rc_t rc;
+
+ // Construct empty partition
+ if ((rc = ef10_nvram_buffer_create(enp,
+ NVRAM_PARTITION_TYPE_LICENSE,
+ bufferp, buffer_size)) != 0) {
+ rc = EFAULT;
+ goto fail1;
+ }
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_v3_finish_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ )
+{
+ efx_rc_t rc;
+
+ if ((rc = ef10_nvram_buffer_finish(bufferp,
+ buffer_size)) != 0) {
+ goto fail1;
+ }
+
+ // Validate completed partition
+ if ((rc = ef10_nvram_buffer_validate(enp, NVRAM_PARTITION_TYPE_LICENSE,
+ bufferp, buffer_size)) != 0) {
+ goto fail2;
+ }
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
#endif /* EFSYS_OPT_MEDFORD */
@@ -624,7 +1329,8 @@ fail1:
efx_lic_init(
__in efx_nic_t *enp)
{
- efx_lic_ops_t *elop;
+ const efx_lic_ops_t *elop;
+ efx_key_stats_t eks;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -635,19 +1341,19 @@ efx_lic_init(
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- elop = (efx_lic_ops_t *)&__efx_lic_v1_ops;
+ elop = &__efx_lic_v1_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- elop = (efx_lic_ops_t *)&__efx_lic_v2_ops;
+ elop = &__efx_lic_v2_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- elop = (efx_lic_ops_t *)&__efx_lic_v3_ops;
+ elop = &__efx_lic_v3_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -660,6 +1366,13 @@ efx_lic_init(
enp->en_elop = elop;
enp->en_mod_flags |= EFX_MOD_LIC;
+ /* Probe for support */
+ if (efx_lic_get_key_stats(enp, &eks) == 0) {
+ enp->en_licensing_supported = B_TRUE;
+ } else {
+ enp->en_licensing_supported = B_FALSE;
+ }
+
return (0);
fail1:
@@ -668,11 +1381,22 @@ fail1:
return (rc);
}
+extern __checkReturn boolean_t
+efx_lic_check_support(
+ __in efx_nic_t *enp)
+{
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ return enp->en_licensing_supported;
+}
+
void
efx_lic_fini(
__in efx_nic_t *enp)
{
- efx_lic_ops_t *elop = enp->en_elop;
+ const efx_lic_ops_t *elop = enp->en_elop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
@@ -687,7 +1411,7 @@ efx_lic_fini(
efx_lic_update_licenses(
__in efx_nic_t *enp)
{
- efx_lic_ops_t *elop = enp->en_elop;
+ const efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -709,7 +1433,7 @@ efx_lic_get_key_stats(
__in efx_nic_t *enp,
__out efx_key_stats_t *eksp)
{
- efx_lic_ops_t *elop = enp->en_elop;
+ const efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -732,23 +1456,20 @@ efx_lic_app_state(
__in uint64_t app_id,
__out boolean_t *licensedp)
{
- efx_lic_ops_t *elop = enp->en_elop;
+ const efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
- if (elop->elo_app_state == NULL) {
- rc = ENOTSUP;
- goto fail1;
- }
+ if (elop->elo_app_state == NULL)
+ return (ENOTSUP);
+
if ((rc = elop->elo_app_state(enp, app_id, licensedp)) != 0)
- goto fail2;
+ goto fail1;
return (0);
-fail2:
- EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
@@ -764,25 +1485,274 @@ efx_lic_get_id(
__out_opt uint8_t *bufferp
)
{
- efx_lic_ops_t *elop = enp->en_elop;
+ const efx_lic_ops_t *elop = enp->en_elop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
- if (elop->elo_get_id == NULL) {
- rc = ENOTSUP;
- goto fail1;
- }
+ if (elop->elo_get_id == NULL)
+ return (ENOTSUP);
if ((rc = elop->elo_get_id(enp, buffer_size, typep,
lengthp, bufferp)) != 0)
- goto fail2;
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+/* Buffer management API - abstracts varying TLV format used for License partition */
+
+ __checkReturn efx_rc_t
+efx_lic_find_start(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __out uint32_t *startp
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_find_start(enp, bufferp, buffer_size, startp)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_find_end(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *endp
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_find_end(enp, bufferp, buffer_size, offset, endp)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_find_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __out uint32_t *startp,
+ __out uint32_t *lengthp
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ boolean_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ EFSYS_ASSERT(bufferp);
+ EFSYS_ASSERT(startp);
+ EFSYS_ASSERT(lengthp);
+
+ return (elop->elo_find_key(enp, bufferp, buffer_size, offset,
+ startp, lengthp));
+}
+
+
+/* Validate that the buffer contains a single key in a recognised format.
+** An empty or terminator buffer is not accepted as a valid key.
+*/
+ __checkReturn __success(return != B_FALSE) boolean_t
+efx_lic_validate_key(
+ __in efx_nic_t *enp,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ boolean_t rc;
+ uint16_t tlv_type;
+ uint16_t tlv_length;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_validate_key(enp, keyp, length)) == B_FALSE)
+ goto fail1;
+
+ return (B_TRUE);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_read_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __out_bcount_part(key_max_size, *lengthp)
+ caddr_t keyp,
+ __in size_t key_max_size,
+ __out uint32_t *lengthp
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_read_key(enp, bufferp, buffer_size, offset,
+ length, keyp, key_max_size, lengthp)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_write_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in_bcount(length) caddr_t keyp,
+ __in uint32_t length,
+ __out uint32_t *lengthp
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_write_key(enp, bufferp, buffer_size, offset,
+ keyp, length, lengthp)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_delete_key(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size,
+ __in uint32_t offset,
+ __in uint32_t length,
+ __in uint32_t end,
+ __out uint32_t *deltap
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_delete_key(enp, bufferp, buffer_size, offset,
+ length, end, deltap)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+efx_lic_create_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_create_partition(enp, bufferp, buffer_size)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+ __checkReturn efx_rc_t
+efx_lic_finish_partition(
+ __in efx_nic_t *enp,
+ __in_bcount(buffer_size)
+ caddr_t bufferp,
+ __in size_t buffer_size
+ )
+{
+ const efx_lic_ops_t *elop = enp->en_elop;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+ if ((rc = elop->elo_finish_partition(enp, bufferp, buffer_size)) != 0)
+ goto fail1;
return (0);
-fail2:
- EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
diff --git a/sys/dev/sfxge/common/efx_mac.c b/sys/dev/sfxge/common/efx_mac.c
index 4868c4b..0b17351 100644
--- a/sys/dev/sfxge/common/efx_mac.c
+++ b/sys/dev/sfxge/common/efx_mac.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,75 +34,23 @@ __FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
-#if EFSYS_OPT_MAC_FALCON_GMAC
-#include "falcon_gmac.h"
-#endif
-
-#if EFSYS_OPT_MAC_FALCON_XMAC
-#include "falcon_xmac.h"
-#endif
-
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_mac_multicast_list_set(
+siena_mac_multicast_list_set(
__in efx_nic_t *enp);
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
-
-#if EFSYS_OPT_MAC_FALCON_GMAC
-static efx_mac_ops_t __efx_falcon_gmac_ops = {
- falcon_gmac_reset, /* emo_reset */
- falcon_mac_poll, /* emo_poll */
- falcon_mac_up, /* emo_up */
- falcon_gmac_reconfigure, /* emo_addr_set */
- falcon_gmac_reconfigure, /* emo_pdu_set */
- falcon_gmac_reconfigure, /* emo_reconfigure */
- falconsiena_mac_multicast_list_set, /* emo_multicast_list_set */
- NULL, /* emo_filter_set_default_rxq */
- NULL, /* emo_filter_default_rxq_clear */
-#if EFSYS_OPT_LOOPBACK
- falcon_mac_loopback_set, /* emo_loopback_set */
-#endif /* EFSYS_OPT_LOOPBACK */
-#if EFSYS_OPT_MAC_STATS
- falcon_mac_stats_upload, /* emo_stats_upload */
- NULL, /* emo_stats_periodic */
- falcon_gmac_stats_update /* emo_stats_update */
-#endif /* EFSYS_OPT_MAC_STATS */
-};
-#endif /* EFSYS_OPT_MAC_FALCON_GMAC */
-
-#if EFSYS_OPT_MAC_FALCON_XMAC
-static efx_mac_ops_t __efx_falcon_xmac_ops = {
- falcon_xmac_reset, /* emo_reset */
- falcon_mac_poll, /* emo_poll */
- falcon_mac_up, /* emo_up */
- falcon_xmac_reconfigure, /* emo_addr_set */
- falcon_xmac_reconfigure, /* emo_pdu_set */
- falcon_xmac_reconfigure, /* emo_reconfigure */
- falconsiena_mac_multicast_list_set, /* emo_multicast_list_set */
- NULL, /* emo_filter_set_default_rxq */
- NULL, /* emo_filter_default_rxq_clear */
-#if EFSYS_OPT_LOOPBACK
- falcon_mac_loopback_set, /* emo_loopback_set */
-#endif /* EFSYS_OPT_LOOPBACK */
-#if EFSYS_OPT_MAC_STATS
- falcon_mac_stats_upload, /* emo_stats_upload */
- NULL, /* emo_stats_periodic */
- falcon_xmac_stats_update /* emo_stats_update */
-#endif /* EFSYS_OPT_MAC_STATS */
-};
-#endif /* EFSYS_OPT_MAC_FALCON_XMAC */
+#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_SIENA
-static efx_mac_ops_t __efx_siena_mac_ops = {
- NULL, /* emo_reset */
+static const efx_mac_ops_t __efx_siena_mac_ops = {
siena_mac_poll, /* emo_poll */
siena_mac_up, /* emo_up */
siena_mac_reconfigure, /* emo_addr_set */
siena_mac_reconfigure, /* emo_pdu_set */
+ siena_mac_pdu_get, /* emo_pdu_get */
siena_mac_reconfigure, /* emo_reconfigure */
- falconsiena_mac_multicast_list_set, /* emo_multicast_list_set */
+ siena_mac_multicast_list_set, /* emo_multicast_list_set */
NULL, /* emo_filter_set_default_rxq */
NULL, /* emo_filter_default_rxq_clear */
#if EFSYS_OPT_LOOPBACK
@@ -117,12 +65,12 @@ static efx_mac_ops_t __efx_siena_mac_ops = {
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_mac_ops_t __efx_ef10_mac_ops = {
- NULL, /* emo_reset */
+static const efx_mac_ops_t __efx_ef10_mac_ops = {
ef10_mac_poll, /* emo_poll */
ef10_mac_up, /* emo_up */
ef10_mac_addr_set, /* emo_addr_set */
ef10_mac_pdu_set, /* emo_pdu_set */
+ ef10_mac_pdu_get, /* emo_pdu_get */
ef10_mac_reconfigure, /* emo_reconfigure */
ef10_mac_multicast_list_set, /* emo_multicast_list_set */
ef10_mac_filter_default_rxq_set, /* emo_filter_default_rxq_set */
@@ -139,48 +87,13 @@ static efx_mac_ops_t __efx_ef10_mac_ops = {
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
-static efx_mac_ops_t *__efx_mac_ops[] = {
- /* [EFX_MAC_INVALID] */
- NULL,
- /* [EFX_MAC_FALCON_GMAC] */
-#if EFSYS_OPT_MAC_FALCON_GMAC
- &__efx_falcon_gmac_ops,
-#else
- NULL,
-#endif
- /* [EFX_MAC_FALCON_XMAC] */
-#if EFSYS_OPT_MAC_FALCON_XMAC
- &__efx_falcon_xmac_ops,
-#else
- NULL,
-#endif
- /* [EFX_MAC_SIENA] */
-#if EFSYS_OPT_SIENA
- &__efx_siena_mac_ops,
-#else
- NULL,
-#endif
- /* [EFX_MAC_HUNTINGTON] */
-#if EFSYS_OPT_HUNTINGTON
- &__efx_ef10_mac_ops,
-#else
- NULL,
-#endif
- /* [EFX_MAC_MEDFORD] */
-#if EFSYS_OPT_MEDFORD
- &__efx_ef10_mac_ops,
-#else
- NULL,
-#endif
-};
-
__checkReturn efx_rc_t
efx_mac_pdu_set(
__in efx_nic_t *enp,
__in size_t pdu)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
uint32_t old_pdu;
efx_rc_t rc;
@@ -218,13 +131,33 @@ fail1:
return (rc);
}
+ __checkReturn efx_rc_t
+efx_mac_pdu_get(
+ __in efx_nic_t *enp,
+ __out size_t *pdu)
+{
+ efx_port_t *epp = &(enp->en_port);
+ const efx_mac_ops_t *emop = epp->ep_emop;
+ efx_rc_t rc;
+
+ if ((rc = emop->emo_pdu_get(enp, pdu)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
__checkReturn efx_rc_t
efx_mac_addr_set(
__in efx_nic_t *enp,
__in uint8_t *addr)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
uint8_t old_addr[6];
uint32_t oui;
efx_rc_t rc;
@@ -272,7 +205,7 @@ efx_mac_filter_set(
__in boolean_t brdcst)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
boolean_t old_all_unicst;
boolean_t old_mulcst;
boolean_t old_all_mulcst;
@@ -314,7 +247,7 @@ efx_mac_drain(
__in boolean_t enabled)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -326,21 +259,11 @@ efx_mac_drain(
epp->ep_mac_drain = enabled;
- if (enabled && emop->emo_reset != NULL) {
- if ((rc = emop->emo_reset(enp)) != 0)
- goto fail1;
-
- EFSYS_ASSERT(enp->en_reset_flags & EFX_RESET_MAC);
- enp->en_reset_flags &= ~EFX_RESET_PHY;
- }
-
if ((rc = emop->emo_reconfigure(enp)) != 0)
- goto fail2;
+ goto fail1;
return (0);
-fail2:
- EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
@@ -353,7 +276,7 @@ efx_mac_up(
__out boolean_t *mac_upp)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -377,8 +300,8 @@ efx_mac_fcntl_set(
__in boolean_t autoneg)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
unsigned int old_fcntl;
boolean_t old_autoneg;
unsigned int old_adv_cap;
@@ -477,7 +400,7 @@ efx_mac_multicast_list_set(
__in int count)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
uint8_t *old_mulcst_addr_list = NULL;
uint32_t old_mulcst_addr_count;
efx_rc_t rc;
@@ -553,7 +476,7 @@ efx_mac_filter_default_rxq_set(
__in boolean_t using_rss)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -578,7 +501,7 @@ efx_mac_filter_default_rxq_clear(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
@@ -698,7 +621,7 @@ efx_mac_stats_upload(
__in efsys_mem_t *esmp)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -731,7 +654,7 @@ efx_mac_stats_periodic(
__in boolean_t events)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -766,7 +689,7 @@ efx_mac_stats_update(
__inout_opt uint32_t *generationp)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -788,85 +711,43 @@ efx_mac_select(
{
efx_port_t *epp = &(enp->en_port);
efx_mac_type_t type = EFX_MAC_INVALID;
- efx_mac_ops_t *emop;
+ const efx_mac_ops_t *emop;
int rc = EINVAL;
+ switch (enp->en_family) {
#if EFSYS_OPT_SIENA
- if (enp->en_family == EFX_FAMILY_SIENA) {
+ case EFX_FAMILY_SIENA:
+ emop = &__efx_siena_mac_ops;
type = EFX_MAC_SIENA;
- goto chosen;
- }
-#endif
+ break;
+#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
- if (enp->en_family == EFX_FAMILY_HUNTINGTON) {
+ case EFX_FAMILY_HUNTINGTON:
+ emop = &__efx_ef10_mac_ops;
type = EFX_MAC_HUNTINGTON;
- goto chosen;
- }
-#endif
+ break;
+#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
- if (enp->en_family == EFX_FAMILY_MEDFORD) {
+ case EFX_FAMILY_MEDFORD:
+ emop = &__efx_ef10_mac_ops;
type = EFX_MAC_MEDFORD;
- goto chosen;
- }
-#endif
-
-#if EFSYS_OPT_FALCON
- switch (epp->ep_link_mode) {
-#if EFSYS_OPT_MAC_FALCON_GMAC
- case EFX_LINK_100HDX:
- case EFX_LINK_100FDX:
- case EFX_LINK_1000HDX:
- case EFX_LINK_1000FDX:
- type = EFX_MAC_FALCON_GMAC;
- goto chosen;
-#endif /* EFSYS_OPT_FALCON_GMAC */
-
-#if EFSYS_OPT_MAC_FALCON_XMAC
- case EFX_LINK_10000FDX:
- type = EFX_MAC_FALCON_XMAC;
- goto chosen;
-#endif /* EFSYS_OPT_FALCON_XMAC */
+ break;
+#endif /* EFSYS_OPT_MEDFORD */
default:
-#if EFSYS_OPT_MAC_FALCON_GMAC && EFSYS_OPT_MAC_FALCON_XMAC
- /* Only initialise a MAC supported by the PHY */
- if (epp->ep_phy_cap_mask &
- ((1 << EFX_PHY_CAP_1000FDX) |
- (1 << EFX_PHY_CAP_1000HDX) |
- (1 << EFX_PHY_CAP_100FDX) |
- (1 << EFX_PHY_CAP_100HDX) |
- (1 << EFX_PHY_CAP_10FDX) |
- (1 << EFX_PHY_CAP_10FDX)))
- type = EFX_MAC_FALCON_GMAC;
- else
- type = EFX_MAC_FALCON_XMAC;
-#elif EFSYS_OPT_MAC_FALCON_GMAC
- type = EFX_MAC_FALCON_GMAC;
-#else
- type = EFX_MAC_FALCON_XMAC;
-#endif
- goto chosen;
+ rc = EINVAL;
+ goto fail1;
}
-#endif /* EFSYS_OPT_FALCON */
-chosen:
EFSYS_ASSERT(type != EFX_MAC_INVALID);
EFSYS_ASSERT3U(type, <, EFX_MAC_NTYPES);
- emop = epp->ep_emop = (efx_mac_ops_t *)__efx_mac_ops[type];
EFSYS_ASSERT(emop != NULL);
+ epp->ep_emop = emop;
epp->ep_mac_type = type;
- if (emop->emo_reset != NULL) {
- if ((rc = emop->emo_reset(enp)) != 0)
- goto fail1;
-
- EFSYS_ASSERT(enp->en_reset_flags & EFX_RESET_MAC);
- enp->en_reset_flags &= ~EFX_RESET_MAC;
- }
-
return (0);
fail1:
@@ -876,13 +757,13 @@ fail1:
}
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
#define EFX_MAC_HASH_BITS (1 << 8)
/* Compute the multicast hash as used on Falcon and Siena. */
static void
-falconsiena_mac_multicast_hash_compute(
+siena_mac_multicast_hash_compute(
__in_ecount(6*count) uint8_t const *addrs,
__in int count,
__out efx_oword_t *hash_low,
@@ -912,11 +793,11 @@ falconsiena_mac_multicast_hash_compute(
}
static __checkReturn efx_rc_t
-falconsiena_mac_multicast_list_set(
+siena_mac_multicast_list_set(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_oword_t old_hash[2];
efx_rc_t rc;
@@ -925,10 +806,11 @@ falconsiena_mac_multicast_list_set(
memcpy(old_hash, epp->ep_multicst_hash, sizeof (old_hash));
- falconsiena_mac_multicast_hash_compute(epp->ep_mulcst_addr_list,
- epp->ep_mulcst_addr_count,
- &epp->ep_multicst_hash[0],
- &epp->ep_multicst_hash[1]);
+ siena_mac_multicast_hash_compute(
+ epp->ep_mulcst_addr_list,
+ epp->ep_mulcst_addr_count,
+ &epp->ep_multicst_hash[0],
+ &epp->ep_multicst_hash[1]);
if ((rc = emop->emo_reconfigure(enp)) != 0)
goto fail1;
@@ -943,4 +825,4 @@ fail1:
return (rc);
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c
index bb9d9cf..e7e5f94 100644
--- a/sys/dev/sfxge/common/efx_mcdi.c
+++ b/sys/dev/sfxge/common/efx_mcdi.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2008-2015 Solarflare Communications Inc.
+ * Copyright (c) 2008-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_SIENA
-static efx_mcdi_ops_t __efx_mcdi_siena_ops = {
+static const efx_mcdi_ops_t __efx_mcdi_siena_ops = {
siena_mcdi_init, /* emco_init */
siena_mcdi_send_request, /* emco_send_request */
siena_mcdi_poll_reboot, /* emco_poll_reboot */
@@ -73,7 +73,7 @@ static efx_mcdi_ops_t __efx_mcdi_siena_ops = {
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_mcdi_ops_t __efx_mcdi_ef10_ops = {
+static const efx_mcdi_ops_t __efx_mcdi_ef10_ops = {
ef10_mcdi_init, /* emco_init */
ef10_mcdi_send_request, /* emco_send_request */
ef10_mcdi_poll_reboot, /* emco_poll_reboot */
@@ -92,35 +92,28 @@ efx_mcdi_init(
__in efx_nic_t *enp,
__in const efx_mcdi_transport_t *emtp)
{
- efx_mcdi_ops_t *emcop;
+ const efx_mcdi_ops_t *emcop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, ==, 0);
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- emcop = NULL;
- emtp = NULL;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- emcop = (efx_mcdi_ops_t *)&__efx_mcdi_siena_ops;
+ emcop = &__efx_mcdi_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- emcop = (efx_mcdi_ops_t *)&__efx_mcdi_ef10_ops;
+ emcop = &__efx_mcdi_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- emcop = (efx_mcdi_ops_t *)&__efx_mcdi_ef10_ops;
+ emcop = &__efx_mcdi_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -168,7 +161,7 @@ efx_mcdi_fini(
__in efx_nic_t *enp)
{
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, ==, EFX_MOD_MCDI);
@@ -204,7 +197,7 @@ efx_mcdi_send_request(
__in void *sdup,
__in size_t sdu_len)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
emcop->emco_send_request(enp, hdrp, hdr_len, sdup, sdu_len);
}
@@ -213,7 +206,7 @@ static efx_rc_t
efx_mcdi_poll_reboot(
__in efx_nic_t *enp)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
efx_rc_t rc;
rc = emcop->emco_poll_reboot(enp);
@@ -224,7 +217,7 @@ static boolean_t
efx_mcdi_poll_response(
__in efx_nic_t *enp)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
boolean_t available;
available = emcop->emco_poll_response(enp);
@@ -238,7 +231,7 @@ efx_mcdi_read_response(
__in size_t offset,
__in size_t length)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
emcop->emco_read_response(enp, bufferp, offset, length);
}
@@ -526,6 +519,11 @@ efx_mcdi_request_poll(
if ((rc = efx_mcdi_poll_reboot(enp)) != 0) {
emip->emi_pending_req = NULL;
EFSYS_UNLOCK(enp->en_eslp, state);
+
+ /* Reboot/Assertion */
+ if (rc == EIO || rc == EINTR)
+ efx_mcdi_raise_exception(enp, emrp, rc);
+
goto fail1;
}
}
@@ -542,6 +540,9 @@ efx_mcdi_request_poll(
/* Request complete */
emip->emi_pending_req = NULL;
+ /* Ensure stale MCDI requests fail after an MC reboot. */
+ emip->emi_new_epoch = B_FALSE;
+
EFSYS_UNLOCK(enp->en_eslp, state);
if ((rc = emrp->emr_rc) != 0)
@@ -557,10 +558,6 @@ fail1:
if (!emrp->emr_quiet)
EFSYS_PROBE1(fail1, efx_rc_t, rc);
- /* Reboot/Assertion */
- if (rc == EIO || rc == EINTR)
- efx_mcdi_raise_exception(enp, emrp, rc);
-
return (B_TRUE);
}
@@ -639,6 +636,8 @@ efx_mcdi_request_errcode(
return (EALREADY);
/* MCDI v2 */
+ case MC_CMD_ERR_EEXIST:
+ return (EEXIST);
#ifdef MC_CMD_ERR_EAGAIN
case MC_CMD_ERR_EAGAIN:
return (EAGAIN);
@@ -1435,10 +1434,6 @@ efx_mcdi_get_phy_cfg(
(1 << EFX_PHY_LED_ON));
#endif /* EFSYS_OPT_PHY_LED_CONTROL */
-#if EFSYS_OPT_PHY_PROPS
- encp->enc_phy_nprops = 0;
-#endif /* EFSYS_OPT_PHY_PROPS */
-
/* Get the media type of the fixed port, if recognised. */
EFX_STATIC_ASSERT(MC_CMD_MEDIA_XAUI == EFX_PHY_MEDIA_XAUI);
EFX_STATIC_ASSERT(MC_CMD_MEDIA_CX4 == EFX_PHY_MEDIA_CX4);
@@ -1497,7 +1492,7 @@ efx_mcdi_firmware_update_supported(
__in efx_nic_t *enp,
__out boolean_t *supportedp)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
efx_rc_t rc;
if (emcop != NULL) {
@@ -1522,7 +1517,7 @@ efx_mcdi_macaddr_change_supported(
__in efx_nic_t *enp,
__out boolean_t *supportedp)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
efx_rc_t rc;
if (emcop != NULL) {
@@ -1547,7 +1542,7 @@ efx_mcdi_link_control_supported(
__in efx_nic_t *enp,
__out boolean_t *supportedp)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
efx_rc_t rc;
if (emcop != NULL) {
@@ -1572,7 +1567,7 @@ efx_mcdi_mac_spoofing_supported(
__in efx_nic_t *enp,
__out boolean_t *supportedp)
{
- efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
+ const efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
efx_rc_t rc;
if (emcop != NULL) {
diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h
index a96bd77..ffa50f1 100644
--- a/sys/dev/sfxge/common/efx_mcdi.h
+++ b/sys/dev/sfxge/common/efx_mcdi.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_mon.c b/sys/dev/sfxge/common/efx_mon.c
index 9803b43..13aedac 100644
--- a/sys/dev/sfxge/common/efx_mon.c
+++ b/sys/dev/sfxge/common/efx_mon.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,18 +34,6 @@ __FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
-#if EFSYS_OPT_MON_NULL
-#include "nullmon.h"
-#endif
-
-#if EFSYS_OPT_MON_LM87
-#include "lm87.h"
-#endif
-
-#if EFSYS_OPT_MON_MAX6647
-#include "max6647.h"
-#endif
-
#if EFSYS_OPT_MON_MCDI
#include "mcdi_mon.h"
#endif
@@ -54,11 +42,8 @@ __FBSDID("$FreeBSD$");
static const char *__efx_mon_name[] = {
"",
- "nullmon",
- "lm87",
- "max6647",
"sfx90x0",
- "sfx91x0"
+ "sfx91x0",
"sfx92x0"
};
@@ -77,40 +62,8 @@ efx_mon_name(
#endif /* EFSYS_OPT_NAMES */
-#if EFSYS_OPT_MON_NULL
-static efx_mon_ops_t __efx_mon_null_ops = {
- nullmon_reset, /* emo_reset */
- nullmon_reconfigure, /* emo_reconfigure */
-#if EFSYS_OPT_MON_STATS
- nullmon_stats_update /* emo_stats_update */
-#endif /* EFSYS_OPT_MON_STATS */
-};
-#endif
-
-#if EFSYS_OPT_MON_LM87
-static efx_mon_ops_t __efx_mon_lm87_ops = {
- lm87_reset, /* emo_reset */
- lm87_reconfigure, /* emo_reconfigure */
-#if EFSYS_OPT_MON_STATS
- lm87_stats_update /* emo_stats_update */
-#endif /* EFSYS_OPT_MON_STATS */
-};
-#endif
-
-#if EFSYS_OPT_MON_MAX6647
-static efx_mon_ops_t __efx_mon_max6647_ops = {
- max6647_reset, /* emo_reset */
- max6647_reconfigure, /* emo_reconfigure */
-#if EFSYS_OPT_MON_STATS
- max6647_stats_update /* emo_stats_update */
-#endif /* EFSYS_OPT_MON_STATS */
-};
-#endif
-
#if EFSYS_OPT_MON_MCDI
-static efx_mon_ops_t __efx_mon_mcdi_ops = {
- NULL, /* emo_reset */
- NULL, /* emo_reconfigure */
+static const efx_mon_ops_t __efx_mon_mcdi_ops = {
#if EFSYS_OPT_MON_STATS
mcdi_mon_stats_update /* emo_stats_update */
#endif /* EFSYS_OPT_MON_STATS */
@@ -124,7 +77,7 @@ efx_mon_init(
{
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_mon_t *emp = &(enp->en_mon);
- efx_mon_ops_t *emop;
+ const efx_mon_ops_t *emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -141,21 +94,6 @@ efx_mon_init(
EFSYS_ASSERT(encp->enc_mon_type != EFX_MON_INVALID);
switch (emp->em_type) {
-#if EFSYS_OPT_MON_NULL
- case EFX_MON_NULL:
- emop = &__efx_mon_null_ops;
- break;
-#endif
-#if EFSYS_OPT_MON_LM87
- case EFX_MON_LM87:
- emop = &__efx_mon_lm87_ops;
- break;
-#endif
-#if EFSYS_OPT_MON_MAX6647
- case EFX_MON_MAX6647:
- emop = &__efx_mon_max6647_ops;
- break;
-#endif
#if EFSYS_OPT_MON_MCDI
case EFX_MON_SFC90X0:
case EFX_MON_SFC91X0:
@@ -168,29 +106,11 @@ efx_mon_init(
goto fail2;
}
- if (emop->emo_reset != NULL) {
- if ((rc = emop->emo_reset(enp)) != 0)
- goto fail3;
- }
-
- if (emop->emo_reconfigure != NULL) {
- if ((rc = emop->emo_reconfigure(enp)) != 0)
- goto fail4;
- }
-
emp->em_emop = emop;
return (0);
-fail4:
- EFSYS_PROBE(fail5);
-
- if (emop->emo_reset != NULL)
- (void) emop->emo_reset(enp);
-
-fail3:
- EFSYS_PROBE(fail4);
fail2:
- EFSYS_PROBE(fail3);
+ EFSYS_PROBE(fail2);
emp->em_type = EFX_MON_INVALID;
@@ -206,7 +126,7 @@ fail1:
#if EFSYS_OPT_NAMES
-/* START MKCONFIG GENERATED MonitorStatNamesBlock 01ee3ea01f23a0c4 */
+/* START MKCONFIG GENERATED MonitorStatNamesBlock 31f437eafb0b0437 */
static const char *__mon_stat_name[] = {
"value_2_5v",
"value_vccp1",
@@ -283,6 +203,8 @@ static const char *__mon_stat_name[] = {
"phy0_vcc",
"phy1_vcc",
"controller_tdiode_temp",
+ "board_front_temp",
+ "board_back_temp",
};
/* END MKCONFIG GENERATED MonitorStatNamesBlock */
@@ -308,7 +230,7 @@ efx_mon_stats_update(
__inout_ecount(EFX_MON_NSTATS) efx_mon_stat_value_t *values)
{
efx_mon_t *emp = &(enp->en_mon);
- efx_mon_ops_t *emop = emp->em_emop;
+ const efx_mon_ops_t *emop = emp->em_emop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_MON);
@@ -323,8 +245,6 @@ efx_mon_fini(
__in efx_nic_t *enp)
{
efx_mon_t *emp = &(enp->en_mon);
- efx_mon_ops_t *emop = emp->em_emop;
- efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
@@ -332,12 +252,6 @@ efx_mon_fini(
emp->em_emop = NULL;
- if (emop->emo_reset != NULL) {
- rc = emop->emo_reset(enp);
- if (rc != 0)
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
- }
-
emp->em_type = EFX_MON_INVALID;
enp->en_mod_flags &= ~EFX_MOD_MON;
diff --git a/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c
index dd28ece..18ce3f1 100644
--- a/sys/dev/sfxge/common/efx_nic.c
+++ b/sys/dev/sfxge/common/efx_nic.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,12 +42,6 @@ efx_family(
{
if (venid == EFX_PCI_VENID_SFC) {
switch (devid) {
-#if EFSYS_OPT_FALCON
- case EFX_PCI_DEVID_FALCON:
- *efp = EFX_FAMILY_FALCON;
- return (0);
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_PCI_DEVID_SIENA_F1_UNINIT:
/*
@@ -101,6 +95,7 @@ efx_family(
return (0);
#endif /* EFSYS_OPT_MEDFORD */
+ case EFX_PCI_DEVID_FALCON: /* Obsolete, not supported */
default:
break;
}
@@ -110,64 +105,6 @@ efx_family(
return (ENOTSUP);
}
-/*
- * To support clients which aren't provided with any PCI context infer
- * the hardware family by inspecting the hardware. Obviously the caller
- * must be damn sure they're really talking to a supported device.
- */
- __checkReturn efx_rc_t
-efx_infer_family(
- __in efsys_bar_t *esbp,
- __out efx_family_t *efp)
-{
- efx_family_t family;
- efx_oword_t oword;
- unsigned int portnum;
- efx_rc_t rc;
-
- EFSYS_BAR_READO(esbp, FR_AZ_CS_DEBUG_REG_OFST, &oword, B_TRUE);
- portnum = EFX_OWORD_FIELD(oword, FRF_CZ_CS_PORT_NUM);
- if ((portnum == 1) || (portnum == 2)) {
-#if EFSYS_OPT_SIENA
- family = EFX_FAMILY_SIENA;
- goto out;
-#endif
- } else if (portnum == 0) {
- efx_dword_t dword;
- uint32_t hw_rev;
-
- EFSYS_BAR_READD(esbp, ER_DZ_BIU_HW_REV_ID_REG_OFST, &dword,
- B_TRUE);
- hw_rev = EFX_DWORD_FIELD(dword, ERF_DZ_HW_REV_ID);
- if (hw_rev == ER_DZ_BIU_HW_REV_ID_REG_RESET) {
-#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
- /*
- * BIU_HW_REV_ID is the same for Huntington and Medford.
- * Assume Huntington, as Medford is very similar.
- */
- family = EFX_FAMILY_HUNTINGTON;
- goto out;
-#endif
- } else {
-#if EFSYS_OPT_FALCON
- family = EFX_FAMILY_FALCON;
- goto out;
-#endif
- }
- }
- rc = ENOTSUP;
- goto fail1;
-
-out:
- if (efp != NULL)
- *efp = family;
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
#define EFX_BIU_MAGIC0 0x01234567
#define EFX_BIU_MAGIC1 0xfedcba98
@@ -240,29 +177,9 @@ fail1:
return (rc);
}
-#if EFSYS_OPT_FALCON
-
-static efx_nic_ops_t __efx_nic_falcon_ops = {
- falcon_nic_probe, /* eno_probe */
- NULL, /* eno_board_cfg */
- NULL, /* eno_set_drv_limits */
- falcon_nic_reset, /* eno_reset */
- falcon_nic_init, /* eno_init */
- NULL, /* eno_get_vi_pool */
- NULL, /* eno_get_bar_region */
-#if EFSYS_OPT_DIAG
- falcon_sram_test, /* eno_sram_test */
- falcon_nic_register_test, /* eno_register_test */
-#endif /* EFSYS_OPT_DIAG */
- falcon_nic_fini, /* eno_fini */
- falcon_nic_unprobe, /* eno_unprobe */
-};
-
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
-static efx_nic_ops_t __efx_nic_siena_ops = {
+static const efx_nic_ops_t __efx_nic_siena_ops = {
siena_nic_probe, /* eno_probe */
NULL, /* eno_board_cfg */
NULL, /* eno_set_drv_limits */
@@ -271,7 +188,6 @@ static efx_nic_ops_t __efx_nic_siena_ops = {
NULL, /* eno_get_vi_pool */
NULL, /* eno_get_bar_region */
#if EFSYS_OPT_DIAG
- siena_sram_test, /* eno_sram_test */
siena_nic_register_test, /* eno_register_test */
#endif /* EFSYS_OPT_DIAG */
siena_nic_fini, /* eno_fini */
@@ -282,7 +198,7 @@ static efx_nic_ops_t __efx_nic_siena_ops = {
#if EFSYS_OPT_HUNTINGTON
-static efx_nic_ops_t __efx_nic_hunt_ops = {
+static const efx_nic_ops_t __efx_nic_hunt_ops = {
ef10_nic_probe, /* eno_probe */
hunt_board_cfg, /* eno_board_cfg */
ef10_nic_set_drv_limits, /* eno_set_drv_limits */
@@ -291,7 +207,6 @@ static efx_nic_ops_t __efx_nic_hunt_ops = {
ef10_nic_get_vi_pool, /* eno_get_vi_pool */
ef10_nic_get_bar_region, /* eno_get_bar_region */
#if EFSYS_OPT_DIAG
- ef10_sram_test, /* eno_sram_test */
ef10_nic_register_test, /* eno_register_test */
#endif /* EFSYS_OPT_DIAG */
ef10_nic_fini, /* eno_fini */
@@ -302,7 +217,7 @@ static efx_nic_ops_t __efx_nic_hunt_ops = {
#if EFSYS_OPT_MEDFORD
-static efx_nic_ops_t __efx_nic_medford_ops = {
+static const efx_nic_ops_t __efx_nic_medford_ops = {
ef10_nic_probe, /* eno_probe */
medford_board_cfg, /* eno_board_cfg */
ef10_nic_set_drv_limits, /* eno_set_drv_limits */
@@ -311,7 +226,6 @@ static efx_nic_ops_t __efx_nic_medford_ops = {
ef10_nic_get_vi_pool, /* eno_get_vi_pool */
ef10_nic_get_bar_region, /* eno_get_bar_region */
#if EFSYS_OPT_DIAG
- ef10_sram_test, /* eno_sram_test */
ef10_nic_register_test, /* eno_register_test */
#endif /* EFSYS_OPT_DIAG */
ef10_nic_fini, /* eno_fini */
@@ -346,16 +260,9 @@ efx_nic_create(
enp->en_magic = EFX_NIC_MAGIC;
switch (family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- enp->en_enop = (efx_nic_ops_t *)&__efx_nic_falcon_ops;
- enp->en_features = 0;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- enp->en_enop = (efx_nic_ops_t *)&__efx_nic_siena_ops;
+ enp->en_enop = &__efx_nic_siena_ops;
enp->en_features =
EFX_FEATURE_IPV6 |
EFX_FEATURE_LFSR_HASH_INSERT |
@@ -371,7 +278,7 @@ efx_nic_create(
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- enp->en_enop = (efx_nic_ops_t *)&__efx_nic_hunt_ops;
+ enp->en_enop = &__efx_nic_hunt_ops;
/* FIXME: Add WOL support */
enp->en_features =
EFX_FEATURE_IPV6 |
@@ -388,7 +295,7 @@ efx_nic_create(
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- enp->en_enop = (efx_nic_ops_t *)&__efx_nic_medford_ops;
+ enp->en_enop = &__efx_nic_medford_ops;
/*
* FW_ASSISTED_TSO ommitted as Medford only supports firmware
* assisted TSO version 2, not the v1 scheme used on Huntington.
@@ -400,7 +307,8 @@ efx_nic_create(
EFX_FEATURE_MCDI |
EFX_FEATURE_MAC_HEADER_FILTERS |
EFX_FEATURE_MCDI_DMA |
- EFX_FEATURE_PIO_BUFFERS;
+ EFX_FEATURE_PIO_BUFFERS |
+ EFX_FEATURE_FW_ASSISTED_TSO_V2;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -436,7 +344,7 @@ fail1:
efx_nic_probe(
__in efx_nic_t *enp)
{
- efx_nic_ops_t *enop;
+ const efx_nic_ops_t *enop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -467,48 +375,12 @@ fail1:
return (rc);
}
-#if EFSYS_OPT_PCIE_TUNE
-
- __checkReturn efx_rc_t
-efx_nic_pcie_tune(
- __in efx_nic_t *enp,
- unsigned int nlanes)
-{
- EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
- EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
- EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_NIC));
-
-#if EFSYS_OPT_FALCON
- if (enp->en_family == EFX_FAMILY_FALCON)
- return (falcon_nic_pcie_tune(enp, nlanes));
-#endif
- return (ENOTSUP);
-}
-
- __checkReturn efx_rc_t
-efx_nic_pcie_extended_sync(
- __in efx_nic_t *enp)
-{
- EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
- EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
- EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_NIC));
-
-#if EFSYS_OPT_SIENA
- if (enp->en_family == EFX_FAMILY_SIENA)
- return (siena_nic_pcie_extended_sync(enp));
-#endif
-
- return (ENOTSUP);
-}
-
-#endif /* EFSYS_OPT_PCIE_TUNE */
-
__checkReturn efx_rc_t
efx_nic_set_drv_limits(
__inout efx_nic_t *enp,
__in efx_drv_limits_t *edlp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -534,7 +406,7 @@ efx_nic_get_bar_region(
__out uint32_t *offsetp,
__out size_t *sizep)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -569,7 +441,7 @@ efx_nic_get_vi_pool(
__out uint32_t *rxq_countp,
__out uint32_t *txq_countp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
efx_nic_cfg_t *encp = &enp->en_nic_cfg;
efx_rc_t rc;
@@ -606,7 +478,7 @@ fail1:
efx_nic_init(
__in efx_nic_t *enp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -636,7 +508,7 @@ fail1:
efx_nic_fini(
__in efx_nic_t *enp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROBE);
@@ -655,7 +527,7 @@ efx_nic_fini(
efx_nic_unprobe(
__in efx_nic_t *enp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
#if EFSYS_OPT_MCDI
@@ -701,14 +573,14 @@ efx_nic_destroy(
efx_nic_reset(
__in efx_nic_t *enp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
unsigned int mod_flags;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROBE);
/*
- * All modules except the MCDI, PROBE, NVRAM, VPD, MON, LIC
+ * All modules except the MCDI, PROBE, NVRAM, VPD, MON
* (which we do not reset here) must have been shut down or never
* initialized.
*
@@ -718,7 +590,7 @@ efx_nic_reset(
*/
mod_flags = enp->en_mod_flags;
mod_flags &= ~(EFX_MOD_MCDI | EFX_MOD_PROBE | EFX_MOD_NVRAM |
- EFX_MOD_VPD | EFX_MOD_MON | EFX_MOD_LIC);
+ EFX_MOD_VPD | EFX_MOD_MON);
EFSYS_ASSERT3U(mod_flags, ==, 0);
if (mod_flags != 0) {
rc = EINVAL;
@@ -728,8 +600,6 @@ efx_nic_reset(
if ((rc = enop->eno_reset(enp)) != 0)
goto fail2;
- enp->en_reset_flags |= EFX_RESET_MAC;
-
return (0);
fail2:
@@ -755,7 +625,7 @@ efx_nic_cfg_get(
efx_nic_register_test(
__in efx_nic_t *enp)
{
- efx_nic_ops_t *enop = enp->en_enop;
+ const efx_nic_ops_t *enop = enp->en_enop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -1095,3 +965,101 @@ fail1:
}
#endif /* EFSYS_OPT_LOOPBACK */
+
+ __checkReturn efx_rc_t
+efx_nic_calculate_pcie_link_bandwidth(
+ __in uint32_t pcie_link_width,
+ __in uint32_t pcie_link_gen,
+ __out uint32_t *bandwidth_mbpsp)
+{
+ uint32_t lane_bandwidth;
+ uint32_t total_bandwidth;
+ efx_rc_t rc;
+
+ if ((pcie_link_width == 0) || (pcie_link_width > 16) ||
+ !ISP2(pcie_link_width)) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ switch (pcie_link_gen) {
+ case EFX_PCIE_LINK_SPEED_GEN1:
+ /* 2.5 Gb/s raw bandwidth with 8b/10b encoding */
+ lane_bandwidth = 2000;
+ break;
+ case EFX_PCIE_LINK_SPEED_GEN2:
+ /* 5.0 Gb/s raw bandwidth with 8b/10b encoding */
+ lane_bandwidth = 4000;
+ break;
+ case EFX_PCIE_LINK_SPEED_GEN3:
+ /* 8.0 Gb/s raw bandwidth with 128b/130b encoding */
+ lane_bandwidth = 7877;
+ break;
+ default:
+ rc = EINVAL;
+ goto fail2;
+ }
+
+ total_bandwidth = lane_bandwidth * pcie_link_width;
+ *bandwidth_mbpsp = total_bandwidth;
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
+ __checkReturn efx_rc_t
+efx_nic_check_pcie_link_speed(
+ __in efx_nic_t *enp,
+ __in uint32_t pcie_link_width,
+ __in uint32_t pcie_link_gen,
+ __out efx_pcie_link_performance_t *resultp)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ uint32_t bandwidth;
+ efx_pcie_link_performance_t result;
+ efx_rc_t rc;
+
+ if ((encp->enc_required_pcie_bandwidth_mbps == 0) ||
+ (pcie_link_width == 0) || (pcie_link_width == 32) ||
+ (pcie_link_gen == 0)) {
+ /*
+ * No usable info on what is required and/or in use. In virtual
+ * machines, sometimes the PCIe link width is reported as 0 or
+ * 32, or the speed as 0.
+ */
+ result = EFX_PCIE_LINK_PERFORMANCE_UNKNOWN_BANDWIDTH;
+ goto out;
+ }
+
+ /* Calculate the available bandwidth in megabits per second */
+ rc = efx_nic_calculate_pcie_link_bandwidth(pcie_link_width,
+ pcie_link_gen, &bandwidth);
+ if (rc != 0)
+ goto fail1;
+
+ if (bandwidth < encp->enc_required_pcie_bandwidth_mbps) {
+ result = EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_BANDWIDTH;
+ } else if (pcie_link_gen < encp->enc_max_pcie_link_gen) {
+ /* The link provides enough bandwidth but not optimal latency */
+ result = EFX_PCIE_LINK_PERFORMANCE_SUBOPTIMAL_LATENCY;
+ } else {
+ result = EFX_PCIE_LINK_PERFORMANCE_OPTIMAL;
+ }
+
+out:
+ *resultp = result;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c
index 272e6c7..a17cd78 100644
--- a/sys/dev/sfxge/common/efx_nvram.c
+++ b/sys/dev/sfxge/common/efx_nvram.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,28 +36,9 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_NVRAM
-#if EFSYS_OPT_FALCON
-
-static efx_nvram_ops_t __efx_nvram_falcon_ops = {
-#if EFSYS_OPT_DIAG
- falcon_nvram_test, /* envo_test */
-#endif /* EFSYS_OPT_DIAG */
- falcon_nvram_type_to_partn, /* envo_type_to_partn */
- falcon_nvram_partn_size, /* envo_partn_size */
- falcon_nvram_partn_rw_start, /* envo_partn_rw_start */
- falcon_nvram_partn_read, /* envo_partn_read */
- falcon_nvram_partn_erase, /* envo_partn_erase */
- falcon_nvram_partn_write, /* envo_partn_write */
- falcon_nvram_partn_rw_finish, /* envo_partn_rw_finish */
- falcon_nvram_partn_get_version, /* envo_partn_get_version */
- falcon_nvram_partn_set_version, /* envo_partn_set_version */
-};
-
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
-static efx_nvram_ops_t __efx_nvram_siena_ops = {
+static const efx_nvram_ops_t __efx_nvram_siena_ops = {
#if EFSYS_OPT_DIAG
siena_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
@@ -70,13 +51,14 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
siena_nvram_partn_rw_finish, /* envo_partn_rw_finish */
siena_nvram_partn_get_version, /* envo_partn_get_version */
siena_nvram_partn_set_version, /* envo_partn_set_version */
+ NULL, /* envo_partn_validate */
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_nvram_ops_t __efx_nvram_ef10_ops = {
+static const efx_nvram_ops_t __efx_nvram_ef10_ops = {
#if EFSYS_OPT_DIAG
ef10_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
@@ -89,6 +71,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
ef10_nvram_partn_rw_finish, /* envo_partn_rw_finish */
ef10_nvram_partn_get_version, /* envo_partn_get_version */
ef10_nvram_partn_set_version, /* envo_partn_set_version */
+ ef10_nvram_buffer_validate, /* envo_buffer_validate */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@@ -97,7 +80,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
efx_nvram_init(
__in efx_nic_t *enp)
{
- efx_nvram_ops_t *envop;
+ const efx_nvram_ops_t *envop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -105,27 +88,21 @@ efx_nvram_init(
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_NVRAM));
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- envop = (efx_nvram_ops_t *)&__efx_nvram_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- envop = (efx_nvram_ops_t *)&__efx_nvram_siena_ops;
+ envop = &__efx_nvram_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- envop = (efx_nvram_ops_t *)&__efx_nvram_ef10_ops;
+ envop = &__efx_nvram_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- envop = (efx_nvram_ops_t *)&__efx_nvram_ef10_ops;
+ envop = &__efx_nvram_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -152,7 +129,7 @@ fail1:
efx_nvram_test(
__in efx_nic_t *enp)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -177,7 +154,7 @@ efx_nvram_size(
__in efx_nvram_type_t type,
__out size_t *sizep)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
@@ -210,7 +187,7 @@ efx_nvram_get_version(
__out uint32_t *subtypep,
__out_ecount(4) uint16_t version[4])
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
@@ -243,7 +220,7 @@ efx_nvram_rw_start(
__in efx_nvram_type_t type,
__out_opt size_t *chunk_sizep)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
@@ -281,7 +258,7 @@ efx_nvram_read_chunk(
__out_bcount(size) caddr_t data,
__in size_t size)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
@@ -314,7 +291,7 @@ efx_nvram_erase(
__in efx_nic_t *enp,
__in efx_nvram_type_t type)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
unsigned int offset = 0;
size_t size = 0;
uint32_t partn;
@@ -357,7 +334,7 @@ efx_nvram_write_chunk(
__in_bcount(size) caddr_t data,
__in size_t size)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
@@ -390,7 +367,7 @@ efx_nvram_rw_finish(
__in efx_nic_t *enp,
__in efx_nvram_type_t type)
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -413,7 +390,7 @@ efx_nvram_set_version(
__in efx_nvram_type_t type,
__in_ecount(4) uint16_t version[4])
{
- efx_nvram_ops_t *envop = enp->en_envop;
+ const efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
@@ -446,6 +423,44 @@ fail1:
return (rc);
}
+/* Validate buffer contents (before writing to flash) */
+ __checkReturn efx_rc_t
+efx_nvram_validate(
+ __in efx_nic_t *enp,
+ __in efx_nvram_type_t type,
+ __in_bcount(partn_size) caddr_t partn_data,
+ __in size_t partn_size)
+{
+ const efx_nvram_ops_t *envop = enp->en_envop;
+ uint32_t partn;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
+
+ EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
+
+
+ if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
+ goto fail1;
+
+ if (envop->envo_type_to_partn != NULL &&
+ ((rc = envop->envo_buffer_validate(enp, partn,
+ partn_data, partn_size)) != 0))
+ goto fail2;
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
void
efx_nvram_fini(
__in efx_nic_t *enp)
diff --git a/sys/dev/sfxge/common/efx_phy.c b/sys/dev/sfxge/common/efx_phy.c
index 3fd4e08..a265d7c 100644
--- a/sys/dev/sfxge/common/efx_phy.c
+++ b/sys/dev/sfxge/common/efx_phy.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,229 +33,18 @@ __FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
-#if EFSYS_OPT_FALCON
-#include "falcon_nvram.h"
-#endif
-
-#if EFSYS_OPT_MAC_FALCON_XMAC
-#include "falcon_xmac.h"
-#endif
-
-#if EFSYS_OPT_MAC_FALCON_GMAC
-#include "falcon_gmac.h"
-#endif
-
-#if EFSYS_OPT_PHY_NULL
-#include "nullphy.h"
-#endif
-
-#if EFSYS_OPT_PHY_QT2022C2
-#include "qt2022c2.h"
-#endif
-
-#if EFSYS_OPT_PHY_SFX7101
-#include "sfx7101.h"
-#endif
-
-#if EFSYS_OPT_PHY_TXC43128
-#include "txc43128.h"
-#endif
-
-#if EFSYS_OPT_PHY_SFT9001
-#include "sft9001.h"
-#endif
-
-#if EFSYS_OPT_PHY_QT2025C
-#include "qt2025c.h"
-#endif
-
-#if EFSYS_OPT_PHY_NULL
-static efx_phy_ops_t __efx_phy_null_ops = {
- NULL, /* epo_power */
- nullphy_reset, /* epo_reset */
- nullphy_reconfigure, /* epo_reconfigure */
- nullphy_verify, /* epo_verify */
- NULL, /* epo_uplink_check */
- nullphy_downlink_check, /* epo_downlink_check */
- nullphy_oui_get, /* epo_oui_get */
-#if EFSYS_OPT_PHY_STATS
- nullphy_stats_update, /* epo_stats_update */
-#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- nullphy_prop_name, /* epo_prop_name */
-#endif
- nullphy_prop_get, /* epo_prop_get */
- nullphy_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
-#if EFSYS_OPT_BIST
- NULL, /* epo_bist_enable_offline */
- NULL, /* epo_bist_start */
- NULL, /* epo_bist_poll */
- NULL, /* epo_bist_stop */
-#endif /* EFSYS_OPT_BIST */
-};
-#endif /* EFSYS_OPT_PHY_NULL */
-
-#if EFSYS_OPT_PHY_QT2022C2
-static efx_phy_ops_t __efx_phy_qt2022c2_ops = {
- NULL, /* epo_power */
- qt2022c2_reset, /* epo_reset */
- qt2022c2_reconfigure, /* epo_reconfigure */
- qt2022c2_verify, /* epo_verify */
- qt2022c2_uplink_check, /* epo_uplink_check */
- qt2022c2_downlink_check, /* epo_downlink_check */
- qt2022c2_oui_get, /* epo_oui_get */
-#if EFSYS_OPT_PHY_STATS
- qt2022c2_stats_update, /* epo_stats_update */
-#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- qt2022c2_prop_name, /* epo_prop_name */
-#endif
- qt2022c2_prop_get, /* epo_prop_get */
- qt2022c2_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
-#if EFSYS_OPT_BIST
- NULL, /* epo_bist_enable_offline */
- NULL, /* epo_bist_start */
- NULL, /* epo_bist_poll */
- NULL, /* epo_bist_stop */
-#endif /* EFSYS_OPT_BIST */
-};
-#endif /* EFSYS_OPT_PHY_QT2022C2 */
-
-#if EFSYS_OPT_PHY_SFX7101
-static efx_phy_ops_t __efx_phy_sfx7101_ops = {
- sfx7101_power, /* epo_power */
- sfx7101_reset, /* epo_reset */
- sfx7101_reconfigure, /* epo_reconfigure */
- sfx7101_verify, /* epo_verify */
- sfx7101_uplink_check, /* epo_uplink_check */
- sfx7101_downlink_check, /* epo_downlink_check */
- sfx7101_oui_get, /* epo_oui_get */
-#if EFSYS_OPT_PHY_STATS
- sfx7101_stats_update, /* epo_stats_update */
-#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- sfx7101_prop_name, /* epo_prop_name */
-#endif
- sfx7101_prop_get, /* epo_prop_get */
- sfx7101_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
-#if EFSYS_OPT_BIST
- NULL, /* epo_bist_enable_offline */
- NULL, /* epo_bist_start */
- NULL, /* epo_bist_poll */
- NULL, /* epo_bist_stop */
-#endif /* EFSYS_OPT_BIST */
-};
-#endif /* EFSYS_OPT_PHY_SFX7101 */
-
-#if EFSYS_OPT_PHY_TXC43128
-static efx_phy_ops_t __efx_phy_txc43128_ops = {
- NULL, /* epo_power */
- txc43128_reset, /* epo_reset */
- txc43128_reconfigure, /* epo_reconfigure */
- txc43128_verify, /* epo_verify */
- txc43128_uplink_check, /* epo_uplink_check */
- txc43128_downlink_check, /* epo_downlink_check */
- txc43128_oui_get, /* epo_oui_get */
-#if EFSYS_OPT_PHY_STATS
- txc43128_stats_update, /* epo_stats_update */
-#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- txc43128_prop_name, /* epo_prop_name */
-#endif
- txc43128_prop_get, /* epo_prop_get */
- txc43128_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
-#if EFSYS_OPT_BIST
- NULL, /* epo_bist_enable_offline */
- NULL, /* epo_bist_start */
- NULL, /* epo_bist_poll */
- NULL, /* epo_bist_stop */
-#endif /* EFSYS_OPT_BIST */
-};
-#endif /* EFSYS_OPT_PHY_TXC43128 */
-
-#if EFSYS_OPT_PHY_SFT9001
-static efx_phy_ops_t __efx_phy_sft9001_ops = {
- NULL, /* epo_power */
- sft9001_reset, /* epo_reset */
- sft9001_reconfigure, /* epo_reconfigure */
- sft9001_verify, /* epo_verify */
- sft9001_uplink_check, /* epo_uplink_check */
- sft9001_downlink_check, /* epo_downlink_check */
- sft9001_oui_get, /* epo_oui_get */
-#if EFSYS_OPT_PHY_STATS
- sft9001_stats_update, /* epo_stats_update */
-#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- sft9001_prop_name, /* epo_prop_name */
-#endif
- sft9001_prop_get, /* epo_prop_get */
- sft9001_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
-#if EFSYS_OPT_BIST
- NULL, /* epo_bist_enable_offline */
- sft9001_bist_start, /* epo_bist_start */
- sft9001_bist_poll, /* epo_bist_poll */
- sft9001_bist_stop, /* epo_bist_stop */
-#endif /* EFSYS_OPT_BIST */
-};
-#endif /* EFSYS_OPT_PHY_SFT9001 */
-
-#if EFSYS_OPT_PHY_QT2025C
-static efx_phy_ops_t __efx_phy_qt2025c_ops = {
- NULL, /* epo_power */
- qt2025c_reset, /* epo_reset */
- qt2025c_reconfigure, /* epo_reconfigure */
- qt2025c_verify, /* epo_verify */
- qt2025c_uplink_check, /* epo_uplink_check */
- qt2025c_downlink_check, /* epo_downlink_check */
- qt2025c_oui_get, /* epo_oui_get */
-#if EFSYS_OPT_PHY_STATS
- qt2025c_stats_update, /* epo_stats_update */
-#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- qt2025c_prop_name, /* epo_prop_name */
-#endif
- qt2025c_prop_get, /* epo_prop_get */
- qt2025c_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
-#if EFSYS_OPT_BIST
- NULL, /* epo_bist_enable_offline */
- NULL, /* epo_bist_start */
- NULL, /* epo_bist_poll */
- NULL, /* epo_bist_stop */
-#endif /* EFSYS_OPT_BIST */
-};
-#endif /* EFSYS_OPT_PHY_QT2025C */
+
#if EFSYS_OPT_SIENA
-static efx_phy_ops_t __efx_phy_siena_ops = {
+static const efx_phy_ops_t __efx_phy_siena_ops = {
siena_phy_power, /* epo_power */
NULL, /* epo_reset */
siena_phy_reconfigure, /* epo_reconfigure */
siena_phy_verify, /* epo_verify */
- NULL, /* epo_uplink_check */
- NULL, /* epo_downlink_check */
siena_phy_oui_get, /* epo_oui_get */
#if EFSYS_OPT_PHY_STATS
siena_phy_stats_update, /* epo_stats_update */
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- siena_phy_prop_name, /* epo_prop_name */
-#endif
- siena_phy_prop_get, /* epo_prop_get */
- siena_phy_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
#if EFSYS_OPT_BIST
NULL, /* epo_bist_enable_offline */
siena_phy_bist_start, /* epo_bist_start */
@@ -266,24 +55,15 @@ static efx_phy_ops_t __efx_phy_siena_ops = {
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_phy_ops_t __efx_phy_ef10_ops = {
+static const efx_phy_ops_t __efx_phy_ef10_ops = {
ef10_phy_power, /* epo_power */
NULL, /* epo_reset */
ef10_phy_reconfigure, /* epo_reconfigure */
ef10_phy_verify, /* epo_verify */
- NULL, /* epo_uplink_check */
- NULL, /* epo_downlink_check */
ef10_phy_oui_get, /* epo_oui_get */
#if EFSYS_OPT_PHY_STATS
ef10_phy_stats_update, /* epo_stats_update */
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-#if EFSYS_OPT_NAMES
- ef10_phy_prop_name, /* epo_prop_name */
-#endif
- ef10_phy_prop_get, /* epo_prop_get */
- ef10_phy_prop_set, /* epo_prop_set */
-#endif /* EFSYS_OPT_PHY_PROPS */
#if EFSYS_OPT_BIST
/* FIXME: Are these BIST methods appropriate for Medford? */
hunt_bist_enable_offline, /* epo_bist_enable_offline */
@@ -300,7 +80,7 @@ efx_phy_probe(
{
efx_port_t *epp = &(enp->en_port);
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- efx_phy_ops_t *epop;
+ const efx_phy_ops_t *epop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -310,59 +90,19 @@ efx_phy_probe(
/* Hook in operations structure */
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- switch (epp->ep_phy_type) {
-#if EFSYS_OPT_PHY_NULL
- case PHY_TYPE_NONE_DECODE:
- epop = (efx_phy_ops_t *)&__efx_phy_null_ops;
- break;
-#endif
-#if EFSYS_OPT_PHY_QT2022C2
- case PHY_TYPE_QT2022C2_DECODE:
- epop = (efx_phy_ops_t *)&__efx_phy_qt2022c2_ops;
- break;
-#endif
-#if EFSYS_OPT_PHY_SFX7101
- case PHY_TYPE_SFX7101_DECODE:
- epop = (efx_phy_ops_t *)&__efx_phy_sfx7101_ops;
- break;
-#endif
-#if EFSYS_OPT_PHY_TXC43128
- case PHY_TYPE_TXC43128_DECODE:
- epop = (efx_phy_ops_t *)&__efx_phy_txc43128_ops;
- break;
-#endif
-#if EFSYS_OPT_PHY_SFT9001
- case PHY_TYPE_SFT9001A_DECODE:
- case PHY_TYPE_SFT9001B_DECODE:
- epop = (efx_phy_ops_t *)&__efx_phy_sft9001_ops;
- break;
-#endif
-#if EFSYS_OPT_PHY_QT2025C
- case EFX_PHY_QT2025C:
- epop = (efx_phy_ops_t *)&__efx_phy_qt2025c_ops;
- break;
-#endif
- default:
- rc = ENOTSUP;
- goto fail1;
- }
- break;
-#endif /* EFSYS_OPT_FALCON */
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- epop = (efx_phy_ops_t *)&__efx_phy_siena_ops;
+ epop = &__efx_phy_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- epop = (efx_phy_ops_t *)&__efx_phy_ef10_ops;
+ epop = &__efx_phy_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- epop = (efx_phy_ops_t *)&__efx_phy_ef10_ops;
+ epop = &__efx_phy_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
@@ -388,7 +128,7 @@ efx_phy_verify(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
@@ -405,7 +145,7 @@ efx_phy_led_set(
{
efx_nic_cfg_t *encp = (&enp->en_nic_cfg);
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
uint32_t mask;
efx_rc_t rc;
@@ -474,7 +214,7 @@ efx_phy_adv_cap_set(
__in uint32_t mask)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
uint32_t old_mask;
efx_rc_t rc;
@@ -536,7 +276,7 @@ efx_phy_oui_get(
__out uint32_t *ouip)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
@@ -669,7 +409,7 @@ efx_phy_stats_update(
__inout_ecount(EFX_PHY_NSTATS) uint32_t *stat)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
@@ -679,55 +419,6 @@ efx_phy_stats_update(
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-
-#if EFSYS_OPT_NAMES
- const char *
-efx_phy_prop_name(
- __in efx_nic_t *enp,
- __in unsigned int id)
-{
- efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
-
- EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
- EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
-
- return (epop->epo_prop_name(enp, id));
-}
-#endif /* EFSYS_OPT_NAMES */
-
- __checkReturn efx_rc_t
-efx_phy_prop_get(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t flags,
- __out uint32_t *valp)
-{
- efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
-
- EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
- EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
-
- return (epop->epo_prop_get(enp, id, flags, valp));
-}
-
- __checkReturn efx_rc_t
-efx_phy_prop_set(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t val)
-{
- efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
-
- EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
- EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT);
-
- return (epop->epo_prop_set(enp, id, val));
-}
-#endif /* EFSYS_OPT_PHY_STATS */
#if EFSYS_OPT_BIST
@@ -736,7 +427,7 @@ efx_bist_enable_offline(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -766,7 +457,7 @@ efx_bist_start(
__in efx_bist_type_t type)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -805,7 +496,7 @@ efx_bist_poll(
__in size_t count)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -840,7 +531,7 @@ efx_bist_stop(
__in efx_bist_type_t type)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
diff --git a/sys/dev/sfxge/common/efx_phy_ids.h b/sys/dev/sfxge/common/efx_phy_ids.h
index e062519..d3d0235 100644
--- a/sys/dev/sfxge/common/efx_phy_ids.h
+++ b/sys/dev/sfxge/common/efx_phy_ids.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2013-2015 Solarflare Communications Inc.
+ * Copyright (c) 2013-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_port.c b/sys/dev/sfxge/common/efx_port.c
index ca2a69b..440f0a0 100644
--- a/sys/dev/sfxge/common/efx_port.c
+++ b/sys/dev/sfxge/common/efx_port.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@ efx_port_init(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -55,7 +55,6 @@ efx_port_init(
epp->ep_mac_type = EFX_MAC_INVALID;
epp->ep_link_mode = EFX_LINK_UNKNOWN;
- epp->ep_mac_poll_needed = B_TRUE;
epp->ep_mac_drain = B_TRUE;
/* Configure the MAC */
@@ -105,7 +104,7 @@ efx_port_poll(
__out_opt efx_link_mode_t *link_modep)
{
efx_port_t *epp = &(enp->en_port);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_link_mode_t ignore_link_mode;
efx_rc_t rc;
@@ -139,7 +138,7 @@ efx_port_loopback_set(
{
efx_port_t *epp = &(enp->en_port);
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- efx_mac_ops_t *emop = epp->ep_emop;
+ const efx_mac_ops_t *emop = epp->ep_emop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -235,7 +234,7 @@ efx_port_fini(
__in efx_nic_t *enp)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
@@ -247,7 +246,6 @@ efx_port_fini(
epp->ep_emop = NULL;
epp->ep_mac_type = EFX_MAC_INVALID;
epp->ep_mac_drain = B_FALSE;
- epp->ep_mac_poll_needed = B_FALSE;
/* Turn off the PHY */
if (epop->epo_power != NULL)
diff --git a/sys/dev/sfxge/common/efx_regs.h b/sys/dev/sfxge/common/efx_regs.h
index 5ece431..b817db7 100644
--- a/sys/dev/sfxge/common/efx_regs.h
+++ b/sys/dev/sfxge/common/efx_regs.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_regs_ef10.h b/sys/dev/sfxge/common/efx_regs_ef10.h
index 43745e5..df03a96 100644
--- a/sys/dev/sfxge/common/efx_regs_ef10.h
+++ b/sys/dev/sfxge/common/efx_regs_ef10.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_regs_mcdi.h b/sys/dev/sfxge/common/efx_regs_mcdi.h
index a1d76ab..00a80b4 100644
--- a/sys/dev/sfxge/common/efx_regs_mcdi.h
+++ b/sys/dev/sfxge/common/efx_regs_mcdi.h
@@ -721,6 +721,12 @@
#define FCDI_EVENT_CODE_PTP_STATUS 0x9
/* enum: Port id config to map MC-FC port idx */
#define FCDI_EVENT_CODE_PORT_CONFIG 0xa
+/* enum: Boot result or error code */
+#define FCDI_EVENT_CODE_BOOT_RESULT 0xb
+#define FCDI_EVENT_REBOOT_SRC_LBN 36
+#define FCDI_EVENT_REBOOT_SRC_WIDTH 8
+#define FCDI_EVENT_REBOOT_FC_FW 0x0 /* enum */
+#define FCDI_EVENT_REBOOT_FC_BOOTLOADER 0x1 /* enum */
#define FCDI_EVENT_ASSERT_INSTR_ADDRESS_OFST 0
#define FCDI_EVENT_ASSERT_INSTR_ADDRESS_LBN 0
#define FCDI_EVENT_ASSERT_INSTR_ADDRESS_WIDTH 32
@@ -752,6 +758,11 @@
#define FCDI_EVENT_PORT_CONFIG_DATA_OFST 0
#define FCDI_EVENT_PORT_CONFIG_DATA_LBN 0
#define FCDI_EVENT_PORT_CONFIG_DATA_WIDTH 32
+#define FCDI_EVENT_BOOT_RESULT_OFST 0
+/* Enum values, see field(s): */
+/* MC_CMD_AOE/MC_CMD_AOE_OUT_INFO/FC_BOOT_RESULT */
+#define FCDI_EVENT_BOOT_RESULT_LBN 0
+#define FCDI_EVENT_BOOT_RESULT_WIDTH 32
/* FCDI_EXTENDED_EVENT_PPS structuredef: Extended FCDI event to send PPS events
* to the MC. Note that this structure | is overlayed over a normal FCDI event
@@ -3350,6 +3361,8 @@
#define MC_CMD_AOE_OUT_INFO_FC_BOOT_FAIL_BAD_CHECKSUM 0x4
/* enum: Bad BSP */
#define MC_CMD_AOE_OUT_INFO_FC_BOOT_FAIL_BAD_BSP 0x5
+/* enum: Flash mode is invalid */
+#define MC_CMD_AOE_OUT_INFO_FC_BOOT_FAIL_INVALID_FLASH_MODE 0x6
/* enum: FC application loaded and execution attempted */
#define MC_CMD_AOE_OUT_INFO_FC_BOOT_APP_EXECUTE 0x80
/* enum: FC application Started */
@@ -5480,6 +5493,14 @@
/* MC_CMD_SET_MAC_OUT msgresponse */
#define MC_CMD_SET_MAC_OUT_LEN 0
+/* MC_CMD_SET_MAC_V2_OUT msgresponse */
+#define MC_CMD_SET_MAC_V2_OUT_LEN 4
+/* MTU as configured after processing the request. See comment at
+ * MC_CMD_SET_MAC_IN/MTU. To query MTU without doing any changes, set CONTROL
+ * to 0.
+ */
+#define MC_CMD_SET_MAC_V2_OUT_MTU_OFST 0
+
/***********************************/
/* MC_CMD_PHY_STATS
@@ -6552,6 +6573,10 @@
#define MC_CMD_SENSOR_PHY1_VCC 0x4d
/* enum: Controller die temperature (TDIODE): degC */
#define MC_CMD_SENSOR_CONTROLLER_TDIODE_TEMP 0x4e
+/* enum: Board temperature (front): degC */
+#define MC_CMD_SENSOR_BOARD_FRONT_TEMP 0x4f
+/* enum: Board temperature (back): degC */
+#define MC_CMD_SENSOR_BOARD_BACK_TEMP 0x50
/* MC_CMD_SENSOR_INFO_ENTRY_TYPEDEF */
#define MC_CMD_SENSOR_ENTRY_OFST 4
#define MC_CMD_SENSOR_ENTRY_LEN 8
@@ -7904,6 +7929,8 @@
#define LICENSED_FEATURES_TX_SNIFF_WIDTH 1
#define LICENSED_FEATURES_PROXY_FILTER_OPS_LBN 8
#define LICENSED_FEATURES_PROXY_FILTER_OPS_WIDTH 1
+#define LICENSED_FEATURES_EVENT_CUT_THROUGH_LBN 9
+#define LICENSED_FEATURES_EVENT_CUT_THROUGH_WIDTH 1
#define LICENSED_FEATURES_MASK_LBN 0
#define LICENSED_FEATURES_MASK_WIDTH 64
@@ -8072,6 +8099,8 @@
#define MC_CMD_INIT_EVQ_IN_FLAG_RX_MERGE_WIDTH 1
#define MC_CMD_INIT_EVQ_IN_FLAG_TX_MERGE_LBN 5
#define MC_CMD_INIT_EVQ_IN_FLAG_TX_MERGE_WIDTH 1
+#define MC_CMD_INIT_EVQ_IN_FLAG_USE_TIMER_LBN 6
+#define MC_CMD_INIT_EVQ_IN_FLAG_USE_TIMER_WIDTH 1
#define MC_CMD_INIT_EVQ_IN_TMR_MODE_OFST 20
/* enum: Disabled */
#define MC_CMD_INIT_EVQ_IN_TMR_MODE_DIS 0x0
@@ -9197,6 +9226,15 @@
* client
*/
#define MC_CMD_GET_PARSER_DISP_INFO_IN_OP_GET_RESTRICTIONS 0x2
+/* enum: read properties relating to security rules (Medford-only; for use by
+ * SolarSecure apps, not directly by drivers. See SF-114946-SW.)
+ */
+#define MC_CMD_GET_PARSER_DISP_INFO_IN_OP_GET_SECURITY_RULE_INFO 0x3
+/* enum: read the list of supported RX filter matches for VXLAN/NVGRE
+ * encapsulated frames, which follow a different match sequence to normal
+ * frames (Medford only)
+ */
+#define MC_CMD_GET_PARSER_DISP_INFO_IN_OP_GET_SUPPORTED_ENCAP_RX_MATCHES 0x4
/* MC_CMD_GET_PARSER_DISP_INFO_OUT msgresponse */
#define MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMIN 8
@@ -9227,6 +9265,39 @@
#define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_LBN 0
#define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_WIDTH 1
+/* MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT msgresponse:
+ * GET_PARSER_DISP_INFO response format for OP_GET_SECURITY_RULE_INFO.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_LEN 36
+/* identifies the type of operation requested */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_OFST 0
+/* Enum values, see field(s): */
+/* MC_CMD_GET_PARSER_DISP_INFO_IN/OP */
+/* a version number representing the set of rule lookups that are implemented
+ * by the currently running firmware
+ */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_OFST 4
+/* enum: implements lookup sequences described in SF-114946-SW draft C */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_SF_114946_SW_C 0x0
+/* the number of nodes in the subnet map */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_OFST 8
+/* the number of entries in one subnet map node */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_OFST 12
+/* minimum valid value for a subnet ID in a subnet map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_OFST 16
+/* maximum valid value for a subnet ID in a subnet map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_OFST 20
+/* the number of entries in the local and remote port range maps */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_OFST 24
+/* minimum valid value for a portrange ID in a port range map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_OFST 28
+/* maximum valid value for a portrange ID in a port range map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_OFST 32
+
/***********************************/
/* MC_CMD_PARSER_DISP_RW
@@ -10084,6 +10155,8 @@
#define MC_CMD_GET_CAPABILITIES_OUT_TXDP_TEST_FW_TSO_EDIT 0x101
/* enum: TXDP Test firmware image 2 */
#define MC_CMD_GET_CAPABILITIES_OUT_TXDP_TEST_FW_PACKET_EDITS 0x102
+/* enum: TXDP CSR bus test firmware */
+#define MC_CMD_GET_CAPABILITIES_OUT_TXDP_TEST_FW_CSR 0x103
#define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_VERSION_OFST 8
#define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_VERSION_LEN 2
#define MC_CMD_GET_CAPABILITIES_OUT_RXPD_FW_VERSION_REV_LBN 0
@@ -10162,7 +10235,7 @@
#define MC_CMD_GET_CAPABILITIES_V2_IN_LEN 0
/* MC_CMD_GET_CAPABILITIES_V2_OUT msgresponse */
-#define MC_CMD_GET_CAPABILITIES_V2_OUT_LEN 26
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_LEN 72
/* First word of flags. */
#define MC_CMD_GET_CAPABILITIES_V2_OUT_FLAGS1_OFST 0
#define MC_CMD_GET_CAPABILITIES_V2_OUT_VPORT_RECONFIGURE_LBN 3
@@ -10267,6 +10340,8 @@
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_TEST_FW_TSO_EDIT 0x101
/* enum: TXDP Test firmware image 2 */
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_TEST_FW_PACKET_EDITS 0x102
+/* enum: TXDP CSR bus test firmware */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_TXDP_TEST_FW_CSR 0x103
#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_OFST 8
#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_LEN 2
#define MC_CMD_GET_CAPABILITIES_V2_OUT_RXPD_FW_VERSION_REV_LBN 0
@@ -10346,11 +10421,67 @@
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_WIDTH 1
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_ENCAP_LBN 1
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_ENCAP_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVQ_TIMER_CTRL_LBN 2
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVQ_TIMER_CTRL_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVENT_CUT_THROUGH_LBN 3
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_EVENT_CUT_THROUGH_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_CUT_THROUGH_LBN 4
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_CUT_THROUGH_WIDTH 1
/* Number of FATSOv2 contexts per datapath supported by this NIC. Not present
* on older firmware (check the length).
*/
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_N_CONTEXTS_OFST 24
#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_TSO_V2_N_CONTEXTS_LEN 2
+/* One byte per PF containing the number of the external port assigned to this
+ * PF, indexed by PF number. Special values indicate that a PF is either not
+ * present or not assigned.
+ */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_PFS_TO_PORTS_ASSIGNMENT_OFST 26
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_PFS_TO_PORTS_ASSIGNMENT_LEN 1
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_PFS_TO_PORTS_ASSIGNMENT_NUM 16
+/* enum: The caller is not permitted to access information on this PF. */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_ACCESS_NOT_PERMITTED 0xff
+/* enum: PF does not exist. */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_PF_NOT_PRESENT 0xfe
+/* enum: PF does exist but is not assigned to any external port. */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_PF_NOT_ASSIGNED 0xfd
+/* enum: This value indicates that PF is assigned, but it cannot be expressed
+ * in this field. It is intended for a possible future situation where a more
+ * complex scheme of PFs to ports mapping is being used. The future driver
+ * should look for a new field supporting the new scheme. The current/old
+ * driver should treat this value as PF_NOT_ASSIGNED.
+ */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_INCOMPATIBLE_ASSIGNMENT 0xfc
+/* One byte per PF containing the number of its VFs, indexed by PF number. A
+ * special value indicates that a PF is not present.
+ */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_VFS_PER_PF_OFST 42
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_VFS_PER_PF_LEN 1
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_VFS_PER_PF_NUM 16
+/* enum: The caller is not permitted to access information on this PF. */
+/* MC_CMD_GET_CAPABILITIES_V2_OUT_ACCESS_NOT_PERMITTED 0xff */
+/* enum: PF does not exist. */
+/* MC_CMD_GET_CAPABILITIES_V2_OUT_PF_NOT_PRESENT 0xfe */
+/* Number of VIs available for each external port */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_VIS_PER_PORT_OFST 58
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_VIS_PER_PORT_LEN 2
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_VIS_PER_PORT_NUM 4
+/* Size of RX descriptor cache expressed as binary logarithm The actual size
+ * equals (2 ^ RX_DESC_CACHE_SIZE)
+ */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_DESC_CACHE_SIZE_OFST 66
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_RX_DESC_CACHE_SIZE_LEN 1
+/* Size of TX descriptor cache expressed as binary logarithm The actual size
+ * equals (2 ^ TX_DESC_CACHE_SIZE)
+ */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_DESC_CACHE_SIZE_OFST 67
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_TX_DESC_CACHE_SIZE_LEN 1
+/* Total number of available PIO buffers */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_PIO_BUFFS_OFST 68
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_NUM_PIO_BUFFS_LEN 2
+/* Size of a single PIO buffer */
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_SIZE_PIO_BUFF_OFST 70
+#define MC_CMD_GET_CAPABILITIES_V2_OUT_SIZE_PIO_BUFF_LEN 2
/***********************************/
@@ -13762,4 +13893,661 @@
/* MC_CMD_PREPARE_SIGNED_OUT msgresponse */
#define MC_CMD_PREPARE_SIGNED_OUT_LEN 0
+
+/***********************************/
+/* MC_CMD_SET_SECURITY_RULE
+ * Set blacklist and/or whitelist action for a particular match criteria.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_SET_SECURITY_RULE 0x10f
+#undef MC_CMD_0x10f_PRIVILEGE_CTG
+
+#define MC_CMD_0x10f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_SET_SECURITY_RULE_IN msgrequest */
+#define MC_CMD_SET_SECURITY_RULE_IN_LEN 92
+/* fields to include in match criteria */
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_LBN 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_LBN 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_LBN 2
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_LBN 3
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_LBN 4
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_LBN 5
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_LBN 6
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_LBN 7
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_LBN 8
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_LBN 9
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_LBN 10
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_LBN 11
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_LBN 12
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_LBN 13
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_LBN 14
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_WIDTH 1
+/* remote MAC address to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_OFST 4
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_LEN 6
+/* remote port to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_OFST 10
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_LEN 2
+/* local MAC address to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_OFST 12
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_LEN 6
+/* local port to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_OFST 18
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_LEN 2
+/* Ethernet type to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_OFST 20
+#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_LEN 2
+/* Inner VLAN tag to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_OFST 22
+#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_LEN 2
+/* Outer VLAN tag to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_OFST 24
+#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_LEN 2
+/* IP protocol to match (in low byte; set high byte to 0) */
+#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_OFST 26
+#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_LEN 2
+/* Physical port to match (as little-endian 32-bit value) */
+#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_OFST 28
+/* Reserved; set to 0 */
+#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_OFST 32
+/* remote IP address to match (as bytes in network order; set last 12 bytes to
+ * 0 for IPv4 address)
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_OFST 36
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_LEN 16
+/* local IP address to match (as bytes in network order; set last 12 bytes to 0
+ * for IPv4 address)
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_OFST 52
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_LEN 16
+/* remote subnet ID to match (as little-endian 32-bit value); note that remote
+ * subnets are matched by mapping the remote IP address to a "subnet ID" via a
+ * data structure which must already have been configured using
+ * MC_CMD_SUBNET_MAP_SET_NODE appropriately
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_OFST 68
+/* remote portrange ID to match (as little-endian 32-bit value); note that
+ * remote port ranges are matched by mapping the remote port to a "portrange
+ * ID" via a data structure which must already have been configured using
+ * MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_OFST 72
+/* local portrange ID to match (as little-endian 32-bit value); note that local
+ * port ranges are matched by mapping the local port to a "portrange ID" via a
+ * data structure which must already have been configured using
+ * MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_OFST 76
+/* set the action for transmitted packets matching this rule */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_OFST 80
+/* enum: make no decision */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_NONE 0x0
+/* enum: decide to accept the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_WHITELIST 0x1
+/* enum: decide to drop the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_BLACKLIST 0x2
+/* enum: do not change the current TX action */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_UNCHANGED 0xffffffff
+/* set the action for received packets matching this rule */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_OFST 84
+/* enum: make no decision */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_NONE 0x0
+/* enum: decide to accept the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_WHITELIST 0x1
+/* enum: decide to drop the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_BLACKLIST 0x2
+/* enum: do not change the current RX action */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_UNCHANGED 0xffffffff
+/* counter ID to associate with this rule; IDs are allocated using
+ * MC_CMD_SECURITY_RULE_COUNTER_ALLOC
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_OFST 88
+/* enum: special value for the null counter ID */
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_NONE 0x0
+
+/* MC_CMD_SET_SECURITY_RULE_OUT msgresponse */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LEN 28
+/* new reference count for uses of counter ID */
+#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_OFST 0
+/* constructed match bits for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_OFST 4
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_LEN 12
+/* constructed discriminator bits for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_OFST 16
+/* base location for probes for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_OFST 20
+/* step for probes for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_OFST 24
+
+
+/***********************************/
+/* MC_CMD_RESET_SECURITY_RULES
+ * Reset all blacklist and whitelist actions for a particular physical port, or
+ * all ports. (Medford-only; for use by SolarSecure apps, not directly by
+ * drivers. See SF-114946-SW.) NOTE - this message definition is provisional.
+ * It has not yet been used in any released code and may change during
+ * development. This note will be removed once it is regarded as stable.
+ */
+#define MC_CMD_RESET_SECURITY_RULES 0x110
+#undef MC_CMD_0x110_PRIVILEGE_CTG
+
+#define MC_CMD_0x110_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_RESET_SECURITY_RULES_IN msgrequest */
+#define MC_CMD_RESET_SECURITY_RULES_IN_LEN 4
+/* index of physical port to reset (or ALL_PHYSICAL_PORTS to reset all) */
+#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_OFST 0
+/* enum: special value to reset all physical ports */
+#define MC_CMD_RESET_SECURITY_RULES_IN_ALL_PHYSICAL_PORTS 0xffffffff
+
+/* MC_CMD_RESET_SECURITY_RULES_OUT msgresponse */
+#define MC_CMD_RESET_SECURITY_RULES_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_GET_SECURITY_RULESET_VERSION
+ * Return a large hash value representing a "version" of the complete set of
+ * currently active blacklist / whitelist rules and associated data structures.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION 0x111
+#undef MC_CMD_0x111_PRIVILEGE_CTG
+
+#define MC_CMD_0x111_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_GET_SECURITY_RULESET_VERSION_IN msgrequest */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_IN_LEN 0
+
+/* MC_CMD_GET_SECURITY_RULESET_VERSION_OUT msgresponse */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMIN 1
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX 252
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LEN(num) (0+1*(num))
+/* Opaque hash value; length may vary depending on the hash scheme used */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_OFST 0
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_LEN 1
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MINNUM 1
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM 252
+
+
+/***********************************/
+/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC
+ * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
+ * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
+ * NOTE - this message definition is provisional. It has not yet been used in
+ * any released code and may change during development. This note will be
+ * removed once it is regarded as stable.
+ */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC 0x112
+#undef MC_CMD_0x112_PRIVILEGE_CTG
+
+#define MC_CMD_0x112_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN msgrequest */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_LEN 4
+/* the number of new counter IDs to request */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_OFST 0
+
+/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT msgresponse */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMIN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX 252
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LEN(num) (4+4*(num))
+/* the number of new counter IDs allocated (may be less than the number
+ * requested if resources are unavailable)
+ */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_OFST 0
+/* new counter ID(s) */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_OFST 4
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_LEN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MINNUM 0
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM 62
+
+
+/***********************************/
+/* MC_CMD_SECURITY_RULE_COUNTER_FREE
+ * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
+ * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
+ * NOTE - this message definition is provisional. It has not yet been used in
+ * any released code and may change during development. This note will be
+ * removed once it is regarded as stable.
+ */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE 0x113
+#undef MC_CMD_0x113_PRIVILEGE_CTG
+
+#define MC_CMD_0x113_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_SECURITY_RULE_COUNTER_FREE_IN msgrequest */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMIN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX 252
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LEN(num) (4+4*(num))
+/* the number of counter IDs to free */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_OFST 0
+/* the counter ID(s) to free */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_OFST 4
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_LEN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MINNUM 0
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM 62
+
+/* MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT msgresponse */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_SUBNET_MAP_SET_NODE
+ * Atomically update a trie node in the map of subnets to subnet IDs. The
+ * constants in the descriptions of the fields of this message may be retrieved
+ * by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO. (Medford-
+ * only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_SUBNET_MAP_SET_NODE 0x114
+#undef MC_CMD_0x114_PRIVILEGE_CTG
+
+#define MC_CMD_0x114_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_SUBNET_MAP_SET_NODE_IN msgrequest */
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMIN 6
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX 252
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LEN(num) (4+2*(num))
+/* node to update in the range 0 .. SUBNET_MAP_NUM_NODES-1 */
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_OFST 0
+/* SUBNET_MAP_NUM_ENTRIES_PER_NODE new entries; each entry is either a pointer
+ * to the next node, expressed as an offset in the trie memory (i.e. node ID
+ * multiplied by SUBNET_MAP_NUM_ENTRIES_PER_NODE), or a leaf value in the range
+ * SUBNET_ID_MIN .. SUBNET_ID_MAX
+ */
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_OFST 4
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_LEN 2
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MINNUM 1
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM 124
+
+/* MC_CMD_SUBNET_MAP_SET_NODE_OUT msgresponse */
+#define MC_CMD_SUBNET_MAP_SET_NODE_OUT_LEN 0
+
+/* PORTRANGE_TREE_ENTRY structuredef */
+#define PORTRANGE_TREE_ENTRY_LEN 4
+/* key for branch nodes (<= key takes left branch, > key takes right branch),
+ * or magic value for leaf nodes
+ */
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_OFST 0
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LEN 2
+#define PORTRANGE_TREE_ENTRY_LEAF_NODE_KEY 0xffff /* enum */
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LBN 0
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_WIDTH 16
+/* final portrange ID for leaf nodes (don't care for branch nodes) */
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_OFST 2
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LEN 2
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LBN 16
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_WIDTH 16
+
+
+/***********************************/
+/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
+ * Atomically update the entire tree mapping remote port ranges to portrange
+ * IDs. The constants in the descriptions of the fields of this message may be
+ * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE 0x115
+#undef MC_CMD_0x115_PRIVILEGE_CTG
+
+#define MC_CMD_0x115_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN msgrequest */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
+/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
+ * PORTRANGE_TREE_ENTRY
+ */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
+
+/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
+ * Atomically update the entire tree mapping remote port ranges to portrange
+ * IDs. The constants in the descriptions of the fields of this message may be
+ * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE 0x116
+#undef MC_CMD_0x116_PRIVILEGE_CTG
+
+#define MC_CMD_0x116_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN msgrequest */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
+/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
+ * PORTRANGE_TREE_ENTRY
+ */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
+
+/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
+
+/* TUNNEL_ENCAP_UDP_PORT_ENTRY structuredef */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_LEN 4
+/* UDP port (the standard ports are named below but any port may be used) */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_UDP_PORT_OFST 0
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_UDP_PORT_LEN 2
+/* enum: the IANA allocated UDP port for VXLAN */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_IANA_VXLAN_UDP_PORT 0x12b5
+/* enum: the IANA allocated UDP port for Geneve */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_IANA_GENEVE_UDP_PORT 0x17c1
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_UDP_PORT_LBN 0
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_UDP_PORT_WIDTH 16
+/* tunnel encapsulation protocol (only those named below are supported) */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_PROTOCOL_OFST 2
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_PROTOCOL_LEN 2
+/* enum: This port will be used for VXLAN on both IPv4 and IPv6 */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_VXLAN 0x0
+/* enum: This port will be used for Geneve on both IPv4 and IPv6 */
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_GENEVE 0x1
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_PROTOCOL_LBN 16
+#define TUNNEL_ENCAP_UDP_PORT_ENTRY_PROTOCOL_WIDTH 16
+
+
+/***********************************/
+/* MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS
+ * Configure UDP ports for tunnel encapsulation hardware acceleration. The
+ * parser-dispatcher will attempt to parse traffic on these ports as tunnel
+ * encapsulation PDUs and filter them using the tunnel encapsulation filter
+ * chain rather than the standard filter chain. Note that this command can
+ * cause all functions to see a reset. (Available on Medford only.)
+ */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS 0x117
+#undef MC_CMD_0x117_PRIVILEGE_CTG
+
+#define MC_CMD_0x117_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN msgrequest */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMIN 4
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMAX 68
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LEN(num) (4+4*(num))
+/* Flags */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_FLAGS_OFST 0
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_FLAGS_LEN 2
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_UNLOADING_LBN 0
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_UNLOADING_WIDTH 1
+/* The number of entries in the ENTRIES array */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_NUM_ENTRIES_OFST 2
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_NUM_ENTRIES_LEN 2
+/* Entries defining the UDP port to protocol mapping, each laid out as a
+ * TUNNEL_ENCAP_UDP_PORT_ENTRY
+ */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_ENTRIES_OFST 4
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_ENTRIES_LEN 4
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_ENTRIES_MINNUM 0
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_ENTRIES_MAXNUM 16
+
+/* MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT msgresponse */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_LEN 2
+/* Flags */
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_FLAGS_OFST 0
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_FLAGS_LEN 2
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_RESETTING_LBN 0
+#define MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_RESETTING_WIDTH 1
+
+
+/***********************************/
+/* MC_CMD_RX_BALANCING
+ * Configure a port upconverter to distribute the packets on both RX engines.
+ * Packets are distributed based on a table with the destination vFIFO. The
+ * index of the table is a hash of source and destination of IPV4 and VLAN
+ * priority.
+ */
+#define MC_CMD_RX_BALANCING 0x118
+#undef MC_CMD_0x118_PRIVILEGE_CTG
+
+#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_RX_BALANCING_IN msgrequest */
+#define MC_CMD_RX_BALANCING_IN_LEN 4
+/* The RX port whose upconverter table will be modified */
+#define MC_CMD_RX_BALANCING_IN_PORT_OFST 0
+#define MC_CMD_RX_BALANCING_IN_PORT_LEN 1
+/* The VLAN priority associated to the table index and vFIFO */
+#define MC_CMD_RX_BALANCING_IN_PRIORITY_OFST 1
+#define MC_CMD_RX_BALANCING_IN_PRIORITY_LEN 1
+/* The resulting bit of SRC^DST for indexing the table */
+#define MC_CMD_RX_BALANCING_IN_SRC_DST_OFST 2
+#define MC_CMD_RX_BALANCING_IN_SRC_DST_LEN 1
+/* The RX engine to which the vFIFO in the table entry will point to */
+#define MC_CMD_RX_BALANCING_IN_ENG_OFST 3
+#define MC_CMD_RX_BALANCING_IN_ENG_LEN 1
+
+/* MC_CMD_RX_BALANCING_OUT msgresponse */
+#define MC_CMD_RX_BALANCING_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_TSA_BIND
+ * TSAN - TSAC binding communication protocol. Refer to SF-115479-TC for more
+ * info in respect to the binding protocol. Note- This MCDI command is only
+ * available over a TLS secure connection between the TSAN and TSAC, and is not
+ * available to host software.
+ */
+#define MC_CMD_TSA_BIND 0x119
+
+/* MC_CMD_TSA_BIND_IN msgrequest: Protocol operation code */
+#define MC_CMD_TSA_BIND_IN_LEN 4
+#define MC_CMD_TSA_BIND_IN_OP_OFST 0
+/* enum: Retrieve the TSAN ID from a TSAN. TSAN ID is a unique identifier for
+ * the network adapter. More specifically, TSAN ID equals the MAC address of
+ * the network adapter. TSAN ID is used as part of the TSAN authentication
+ * protocol. Refer to SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_OP_GET_ID 0x1
+/* enum: Get a binding ticket from the TSAN. The binding ticket is used as part
+ * of the binding procedure to authorize the binding of an adapter to a TSAID.
+ * Refer to SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_OP_GET_TICKET 0x2
+/* enum: Opcode associated with the propagation of a private key that TSAN uses
+ * as part of post-binding authentication procedure. More specifically, TSAN
+ * uses this key for a signing operation. TSAC uses the counterpart public key
+ * to verify the signature. Note - The post-binding authentication occurs when
+ * the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer to
+ * SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_OP_SET_KEY 0x3
+/* enum: Request an unbinding operation. Note- TSAN clears the binding ticket
+ * from the Nvram section.
+ */
+#define MC_CMD_TSA_BIND_OP_UNBIND 0x4
+
+/* MC_CMD_TSA_BIND_IN_GET_ID msgrequest */
+#define MC_CMD_TSA_BIND_IN_GET_ID_LEN 20
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_GET_ID_OP_OFST 0
+/* Cryptographic nonce that TSAC generates and sends to TSAN. TSAC generates
+ * the nonce every time as part of the TSAN post-binding authentication
+ * procedure when the TSAN-TSAC connection terminates and TSAN does need to re-
+ * connect to the TSAC. Refer to SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_OFST 4
+#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_LEN 16
+
+/* MC_CMD_TSA_BIND_IN_GET_TICKET msgrequest */
+#define MC_CMD_TSA_BIND_IN_GET_TICKET_LEN 4
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_OFST 0
+
+/* MC_CMD_TSA_BIND_IN_SET_KEY msgrequest */
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMIN 5
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX 252
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LEN(num) (4+1*(num))
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_OFST 0
+/* This data blob contains the private key generated by the TSAC. TSAN uses
+ * this key for a signing operation. Note- This private key is used in
+ * conjunction with the post-binding TSAN authentication procedure that occurs
+ * when the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer
+ * to SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_OFST 4
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_LEN 1
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MINNUM 1
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM 248
+
+/* MC_CMD_TSA_BIND_IN_UNBIND msgrequest: Asks for the un-binding procedure */
+#define MC_CMD_TSA_BIND_IN_UNBIND_LEN 6
+/* TSAN unique identifier for the network adapter */
+#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_OFST 0
+#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_LEN 6
+
+/* MC_CMD_TSA_BIND_OUT_GET_ID msgresponse */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 11
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX 252
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (10+1*(num))
+/* The operation completion code. */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_OFST 0
+/* TSAN unique identifier for the network adapter */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 4
+#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_LEN 6
+/* The signature data blob. The signature is computed against the message
+ * formed by TSAN ID concatenated with the NONCE value. Refer to SF-115479-TC
+ * for more information also in respect to the private keys that are used to
+ * sign the message based on TSAN pre/post-binding authentication procedure.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 10
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_LEN 1
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MINNUM 1
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 242
+
+/* MC_CMD_TSA_BIND_OUT_GET_TICKET msgresponse */
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMIN 5
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX 252
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LEN(num) (4+1*(num))
+/* The operation completion code. */
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_OFST 0
+/* The ticket represents the data blob construct that TSAN sends to TSAC as
+ * part of the binding protocol. From the TSAN perspective the ticket is an
+ * opaque construct. For more info refer to SF-115479-TC.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_OFST 4
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_LEN 1
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MINNUM 1
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM 248
+
+/* MC_CMD_TSA_BIND_OUT_SET_KEY msgresponse */
+#define MC_CMD_TSA_BIND_OUT_SET_KEY_LEN 4
+/* The operation completion code. */
+#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_OFST 0
+
+/* MC_CMD_TSA_BIND_OUT_UNBIND msgresponse */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_LEN 8
+/* Same as MC_CMD_ERR field, but included as 0 in success cases */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_OFST 0
+/* Extra status information */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_OFST 4
+/* enum: Unbind successful. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_OK_UNBOUND 0x0
+/* enum: TSANID mismatch */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_BAD_TSANID 0x1
+/* enum: Unable to remove the binding ticket from persistent storage. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_REMOVE_TICKET 0x2
+/* enum: TSAN is not bound to a binding ticket. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_NOT_BOUND 0x3
+
+
+/***********************************/
+/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE
+ * Manage the persistent NVRAM cache of security rules created with
+ * MC_CMD_SET_SECURITY_RULE. Note that the cache is not automatically updated
+ * as rules are added or removed; the active ruleset must be explicitly
+ * committed to the cache. The cache may also be explicitly invalidated,
+ * without affecting the currently active ruleset. When the cache is valid, it
+ * will be loaded at power on or MC reboot, instead of the default ruleset.
+ * Rollback of the currently active ruleset to the cached version (when it is
+ * valid) is also supported. (Medford-only; for use by SolarSecure apps, not
+ * directly by drivers. See SF-114946-SW.) NOTE - this message definition is
+ * provisional. It has not yet been used in any released code and may change
+ * during development. This note will be removed once it is regarded as stable.
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE 0x11a
+#undef MC_CMD_0x11a_PRIVILEGE_CTG
+
+#define MC_CMD_0x11a_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN msgrequest */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_LEN 4
+/* the operation to perform */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_OFST 0
+/* enum: reports the ruleset version that is cached in persistent storage but
+ * performs no other action
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_GET_CACHED_VERSION 0x0
+/* enum: rolls back the active state to the cached version. (May fail with
+ * ENOENT if there is no valid cached version.)
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_ROLLBACK 0x1
+/* enum: commits the active state to the persistent cache */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_COMMIT 0x2
+/* enum: invalidates the persistent cache without affecting the active state */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_INVALIDATE 0x3
+
+/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT msgresponse */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMIN 5
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX 252
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LEN(num) (4+1*(num))
+/* indicates whether the persistent cache is valid (after completion of the
+ * requested operation in the case of rollback, commit, or invalidate)
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_OFST 0
+/* enum: persistent cache is invalid (the VERSION field will be empty in this
+ * case)
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_INVALID 0x0
+/* enum: persistent cache is valid */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_VALID 0x1
+/* cached ruleset version (after completion of the requested operation, in the
+ * case of rollback, commit, or invalidate) as an opaque hash value in the same
+ * form as MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_OFST 4
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_LEN 1
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MINNUM 1
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM 248
+
#endif /* _SIENA_MC_DRIVER_PCOL_H */
diff --git a/sys/dev/sfxge/common/efx_regs_pci.h b/sys/dev/sfxge/common/efx_regs_pci.h
index a5fd45b..f274b0b 100644
--- a/sys/dev/sfxge/common/efx_regs_pci.h
+++ b/sys/dev/sfxge/common/efx_regs_pci.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c
index 8ebe205..4a3b76e 100644
--- a/sys/dev/sfxge/common/efx_rx.c
+++ b/sys/dev/sfxge/common/efx_rx.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,45 +35,45 @@ __FBSDID("$FreeBSD$");
#include "efx_impl.h"
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_rx_init(
+siena_rx_init(
__in efx_nic_t *enp);
static void
-falconsiena_rx_fini(
+siena_rx_fini(
__in efx_nic_t *enp);
#if EFSYS_OPT_RX_SCATTER
static __checkReturn efx_rc_t
-falconsiena_rx_scatter_enable(
+siena_rx_scatter_enable(
__in efx_nic_t *enp,
__in unsigned int buf_size);
#endif /* EFSYS_OPT_RX_SCATTER */
#if EFSYS_OPT_RX_SCALE
static __checkReturn efx_rc_t
-falconsiena_rx_scale_mode_set(
+siena_rx_scale_mode_set(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t alg,
__in efx_rx_hash_type_t type,
__in boolean_t insert);
static __checkReturn efx_rc_t
-falconsiena_rx_scale_key_set(
+siena_rx_scale_key_set(
__in efx_nic_t *enp,
__in_ecount(n) uint8_t *key,
__in size_t n);
static __checkReturn efx_rc_t
-falconsiena_rx_scale_tbl_set(
+siena_rx_scale_tbl_set(
__in efx_nic_t *enp,
__in_ecount(n) unsigned int *table,
__in size_t n);
static __checkReturn uint32_t
-falconsiena_rx_prefix_hash(
+siena_rx_prefix_hash(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer);
@@ -81,13 +81,13 @@ falconsiena_rx_prefix_hash(
#endif /* EFSYS_OPT_RX_SCALE */
static __checkReturn efx_rc_t
-falconsiena_rx_prefix_pktlen(
+siena_rx_prefix_pktlen(
__in efx_nic_t *enp,
__in uint8_t *buffer,
__out uint16_t *lengthp);
static void
-falconsiena_rx_qpost(
+siena_rx_qpost(
__in efx_rxq_t *erp,
__in_ecount(n) efsys_dma_addr_t *addrp,
__in size_t size,
@@ -96,21 +96,21 @@ falconsiena_rx_qpost(
__in unsigned int added);
static void
-falconsiena_rx_qpush(
+siena_rx_qpush(
__in efx_rxq_t *erp,
__in unsigned int added,
__inout unsigned int *pushedp);
static __checkReturn efx_rc_t
-falconsiena_rx_qflush(
+siena_rx_qflush(
__in efx_rxq_t *erp);
static void
-falconsiena_rx_qenable(
+siena_rx_qenable(
__in efx_rxq_t *erp);
static __checkReturn efx_rc_t
-falconsiena_rx_qcreate(
+siena_rx_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
@@ -122,60 +122,37 @@ falconsiena_rx_qcreate(
__in efx_rxq_t *erp);
static void
-falconsiena_rx_qdestroy(
+siena_rx_qdestroy(
__in efx_rxq_t *erp);
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
-
+#endif /* EFSYS_OPT_SIENA */
-#if EFSYS_OPT_FALCON
-static efx_rx_ops_t __efx_rx_falcon_ops = {
- falconsiena_rx_init, /* erxo_init */
- falconsiena_rx_fini, /* erxo_fini */
-#if EFSYS_OPT_RX_SCATTER
- falconsiena_rx_scatter_enable, /* erxo_scatter_enable */
-#endif
-#if EFSYS_OPT_RX_SCALE
- falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */
- falconsiena_rx_scale_key_set, /* erxo_scale_key_set */
- falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */
- falconsiena_rx_prefix_hash, /* erxo_prefix_hash */
-#endif
- falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */
- falconsiena_rx_qpost, /* erxo_qpost */
- falconsiena_rx_qpush, /* erxo_qpush */
- falconsiena_rx_qflush, /* erxo_qflush */
- falconsiena_rx_qenable, /* erxo_qenable */
- falconsiena_rx_qcreate, /* erxo_qcreate */
- falconsiena_rx_qdestroy, /* erxo_qdestroy */
-};
-#endif /* EFSYS_OPT_FALCON */
#if EFSYS_OPT_SIENA
-static efx_rx_ops_t __efx_rx_siena_ops = {
- falconsiena_rx_init, /* erxo_init */
- falconsiena_rx_fini, /* erxo_fini */
+static const efx_rx_ops_t __efx_rx_siena_ops = {
+ siena_rx_init, /* erxo_init */
+ siena_rx_fini, /* erxo_fini */
#if EFSYS_OPT_RX_SCATTER
- falconsiena_rx_scatter_enable, /* erxo_scatter_enable */
+ siena_rx_scatter_enable, /* erxo_scatter_enable */
#endif
#if EFSYS_OPT_RX_SCALE
- falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */
- falconsiena_rx_scale_key_set, /* erxo_scale_key_set */
- falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */
- falconsiena_rx_prefix_hash, /* erxo_prefix_hash */
+ siena_rx_scale_mode_set, /* erxo_scale_mode_set */
+ siena_rx_scale_key_set, /* erxo_scale_key_set */
+ siena_rx_scale_tbl_set, /* erxo_scale_tbl_set */
+ siena_rx_prefix_hash, /* erxo_prefix_hash */
#endif
- falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */
- falconsiena_rx_qpost, /* erxo_qpost */
- falconsiena_rx_qpush, /* erxo_qpush */
- falconsiena_rx_qflush, /* erxo_qflush */
- falconsiena_rx_qenable, /* erxo_qenable */
- falconsiena_rx_qcreate, /* erxo_qcreate */
- falconsiena_rx_qdestroy, /* erxo_qdestroy */
+ siena_rx_prefix_pktlen, /* erxo_prefix_pktlen */
+ siena_rx_qpost, /* erxo_qpost */
+ siena_rx_qpush, /* erxo_qpush */
+ siena_rx_qflush, /* erxo_qflush */
+ siena_rx_qenable, /* erxo_qenable */
+ siena_rx_qcreate, /* erxo_qcreate */
+ siena_rx_qdestroy, /* erxo_qdestroy */
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_rx_ops_t __efx_rx_ef10_ops = {
+static const efx_rx_ops_t __efx_rx_ef10_ops = {
ef10_rx_init, /* erxo_init */
ef10_rx_fini, /* erxo_fini */
#if EFSYS_OPT_RX_SCATTER
@@ -202,7 +179,7 @@ static efx_rx_ops_t __efx_rx_ef10_ops = {
efx_rx_init(
__inout efx_nic_t *enp)
{
- efx_rx_ops_t *erxop;
+ const efx_rx_ops_t *erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -219,27 +196,21 @@ efx_rx_init(
}
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- erxop = (efx_rx_ops_t *)&__efx_rx_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- erxop = (efx_rx_ops_t *)&__efx_rx_siena_ops;
+ erxop = &__efx_rx_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- erxop = (efx_rx_ops_t *)&__efx_rx_ef10_ops;
+ erxop = &__efx_rx_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- erxop = (efx_rx_ops_t *)&__efx_rx_ef10_ops;
+ erxop = &__efx_rx_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -274,7 +245,7 @@ fail1:
efx_rx_fini(
__in efx_nic_t *enp)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
@@ -293,7 +264,7 @@ efx_rx_scatter_enable(
__in efx_nic_t *enp,
__in unsigned int buf_size)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -370,7 +341,7 @@ efx_rx_scale_mode_set(
__in efx_rx_hash_type_t type,
__in boolean_t insert)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -397,7 +368,7 @@ efx_rx_scale_key_set(
__in_ecount(n) uint8_t *key,
__in size_t n)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -422,7 +393,7 @@ efx_rx_scale_tbl_set(
__in_ecount(n) unsigned int *table,
__in size_t n)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -450,7 +421,7 @@ efx_rx_qpost(
__in unsigned int added)
{
efx_nic_t *enp = erp->er_enp;
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC);
@@ -464,7 +435,7 @@ efx_rx_qpush(
__inout unsigned int *pushedp)
{
efx_nic_t *enp = erp->er_enp;
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC);
@@ -476,7 +447,7 @@ efx_rx_qflush(
__in efx_rxq_t *erp)
{
efx_nic_t *enp = erp->er_enp;
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
efx_rc_t rc;
EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC);
@@ -497,7 +468,7 @@ efx_rx_qenable(
__in efx_rxq_t *erp)
{
efx_nic_t *enp = erp->er_enp;
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC);
@@ -516,7 +487,7 @@ efx_rx_qcreate(
__in efx_evq_t *eep,
__deref_out efx_rxq_t **erpp)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
efx_rxq_t *erp;
efx_rc_t rc;
@@ -561,7 +532,7 @@ efx_rx_qdestroy(
__in efx_rxq_t *erp)
{
efx_nic_t *enp = erp->er_enp;
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC);
@@ -574,7 +545,7 @@ efx_psuedo_hdr_pkt_length_get(
__in uint8_t *buffer,
__out uint16_t *lengthp)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
return (erxop->erxo_prefix_pktlen(enp, buffer, lengthp));
}
@@ -586,17 +557,17 @@ efx_psuedo_hdr_hash_get(
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer)
{
- efx_rx_ops_t *erxop = enp->en_erxop;
+ const efx_rx_ops_t *erxop = enp->en_erxop;
EFSYS_ASSERT3U(enp->en_hash_support, ==, EFX_RX_HASH_AVAILABLE);
return (erxop->erxo_prefix_hash(enp, func, buffer));
}
#endif /* EFSYS_OPT_RX_SCALE */
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_rx_init(
+siena_rx_init(
__in efx_nic_t *enp)
{
efx_oword_t oword;
@@ -633,7 +604,7 @@ falconsiena_rx_init(
#if EFSYS_OPT_RX_SCATTER
static __checkReturn efx_rc_t
-falconsiena_rx_scatter_enable(
+siena_rx_scatter_enable(
__in efx_nic_t *enp,
__in unsigned int buf_size)
{
@@ -721,11 +692,6 @@ fail1:
do { \
efx_oword_t oword; \
\
- if ((_enp)->en_family == EFX_FAMILY_FALCON) { \
- (_rc) = ((_ip) || (_tcp)) ? ENOTSUP : 0; \
- break; \
- } \
- \
EFX_BAR_READO((_enp), FR_CZ_RX_RSS_IPV6_REG3, &oword); \
EFX_SET_OWORD_FIELD(oword, \
FRF_CZ_RX_RSS_IPV6_THASH_ENABLE, 1); \
@@ -744,7 +710,7 @@ fail1:
#if EFSYS_OPT_RX_SCALE
static __checkReturn efx_rc_t
-falconsiena_rx_scale_mode_set(
+siena_rx_scale_mode_set(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t alg,
__in efx_rx_hash_type_t type,
@@ -791,7 +757,7 @@ fail1:
#if EFSYS_OPT_RX_SCALE
static __checkReturn efx_rc_t
-falconsiena_rx_scale_key_set(
+siena_rx_scale_key_set(
__in efx_nic_t *enp,
__in_ecount(n) uint8_t *key,
__in size_t n)
@@ -828,8 +794,6 @@ falconsiena_rx_scale_key_set(
if ((enp->en_features & EFX_FEATURE_IPV6) == 0)
goto done;
- EFSYS_ASSERT3U(enp->en_family, !=, EFX_FAMILY_FALCON);
-
byte = 0;
/* Write Toeplitz IPv6 hash key 3 */
@@ -918,7 +882,7 @@ fail1:
#if EFSYS_OPT_RX_SCALE
static __checkReturn efx_rc_t
-falconsiena_rx_scale_tbl_set(
+siena_rx_scale_tbl_set(
__in efx_nic_t *enp,
__in_ecount(n) unsigned int *table,
__in size_t n)
@@ -996,11 +960,13 @@ fail1:
#if EFSYS_OPT_RX_SCALE
static __checkReturn uint32_t
-falconsiena_rx_prefix_hash(
+siena_rx_prefix_hash(
__in efx_nic_t *enp,
__in efx_rx_hash_alg_t func,
__in uint8_t *buffer)
{
+ _NOTE(ARGUNUSED(enp))
+
switch (func) {
case EFX_RX_HASHALG_TOEPLITZ:
return ((buffer[12] << 24) |
@@ -1019,11 +985,13 @@ falconsiena_rx_prefix_hash(
#endif /* EFSYS_OPT_RX_SCALE */
static __checkReturn efx_rc_t
-falconsiena_rx_prefix_pktlen(
+siena_rx_prefix_pktlen(
__in efx_nic_t *enp,
__in uint8_t *buffer,
__out uint16_t *lengthp)
{
+ _NOTE(ARGUNUSED(enp, buffer, lengthp))
+
/* Not supported by Falcon/Siena hardware */
EFSYS_ASSERT(0);
return (ENOTSUP);
@@ -1031,7 +999,7 @@ falconsiena_rx_prefix_pktlen(
static void
-falconsiena_rx_qpost(
+siena_rx_qpost(
__in efx_rxq_t *erp,
__in_ecount(n) efsys_dma_addr_t *addrp,
__in size_t size,
@@ -1069,7 +1037,7 @@ falconsiena_rx_qpost(
}
static void
-falconsiena_rx_qpush(
+siena_rx_qpush(
__in efx_rxq_t *erp,
__in unsigned int added,
__inout unsigned int *pushedp)
@@ -1101,7 +1069,7 @@ falconsiena_rx_qpush(
}
static __checkReturn efx_rc_t
-falconsiena_rx_qflush(
+siena_rx_qflush(
__in efx_rxq_t *erp)
{
efx_nic_t *enp = erp->er_enp;
@@ -1119,7 +1087,7 @@ falconsiena_rx_qflush(
}
static void
-falconsiena_rx_qenable(
+siena_rx_qenable(
__in efx_rxq_t *erp)
{
efx_nic_t *enp = erp->er_enp;
@@ -1139,7 +1107,7 @@ falconsiena_rx_qenable(
}
static __checkReturn efx_rc_t
-falconsiena_rx_qcreate(
+siena_rx_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
@@ -1156,6 +1124,8 @@ falconsiena_rx_qcreate(
boolean_t jumbo;
efx_rc_t rc;
+ _NOTE(ARGUNUSED(esmp))
+
EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS ==
(1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH));
EFSYS_ASSERT3U(label, <, EFX_EV_RX_NLABELS);
@@ -1229,7 +1199,7 @@ fail1:
}
static void
-falconsiena_rx_qdestroy(
+siena_rx_qdestroy(
__in efx_rxq_t *erp)
{
efx_nic_t *enp = erp->er_enp;
@@ -1249,10 +1219,10 @@ falconsiena_rx_qdestroy(
}
static void
-falconsiena_rx_fini(
+siena_rx_fini(
__in efx_nic_t *enp)
{
_NOTE(ARGUNUSED(enp))
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
diff --git a/sys/dev/sfxge/common/efx_sram.c b/sys/dev/sfxge/common/efx_sram.c
index f2a7b78..beb24a4 100644
--- a/sys/dev/sfxge/common/efx_sram.c
+++ b/sys/dev/sfxge/common/efx_sram.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -310,7 +310,6 @@ efx_sram_test(
__in efx_nic_t *enp,
__in efx_pattern_type_t type)
{
- efx_nic_ops_t *enop = enp->en_enop;
efx_sram_pattern_fn_t func;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -321,11 +320,15 @@ efx_sram_test(
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_TX));
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_EV));
+ /* SRAM testing is only available on Siena. */
+ if (enp->en_family != EFX_FAMILY_SIENA)
+ return (0);
+
/* Select pattern generator */
EFSYS_ASSERT3U(type, <, EFX_PATTERN_NTYPES);
func = __efx_sram_pattern_fns[type];
- return (enop->eno_sram_test(enp, func));
+ return (siena_sram_test(enp, func));
}
#endif /* EFSYS_OPT_DIAG */
diff --git a/sys/dev/sfxge/common/efx_tx.c b/sys/dev/sfxge/common/efx_tx.c
index 168fde4..c270784 100644
--- a/sys/dev/sfxge/common/efx_tx.c
+++ b/sys/dev/sfxge/common/efx_tx.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,18 +44,18 @@ __FBSDID("$FreeBSD$");
#define EFX_TX_QSTAT_INCR(_etp, _stat)
#endif
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_tx_init(
+siena_tx_init(
__in efx_nic_t *enp);
static void
-falconsiena_tx_fini(
+siena_tx_fini(
__in efx_nic_t *enp);
static __checkReturn efx_rc_t
-falconsiena_tx_qcreate(
+siena_tx_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
@@ -68,11 +68,11 @@ falconsiena_tx_qcreate(
__out unsigned int *addedp);
static void
-falconsiena_tx_qdestroy(
+siena_tx_qdestroy(
__in efx_txq_t *etp);
static __checkReturn efx_rc_t
-falconsiena_tx_qpost(
+siena_tx_qpost(
__in efx_txq_t *etp,
__in_ecount(n) efx_buffer_t *eb,
__in unsigned int n,
@@ -80,26 +80,26 @@ falconsiena_tx_qpost(
__inout unsigned int *addedp);
static void
-falconsiena_tx_qpush(
+siena_tx_qpush(
__in efx_txq_t *etp,
__in unsigned int added,
__in unsigned int pushed);
static __checkReturn efx_rc_t
-falconsiena_tx_qpace(
+siena_tx_qpace(
__in efx_txq_t *etp,
__in unsigned int ns);
static __checkReturn efx_rc_t
-falconsiena_tx_qflush(
+siena_tx_qflush(
__in efx_txq_t *etp);
static void
-falconsiena_tx_qenable(
+siena_tx_qenable(
__in efx_txq_t *etp);
__checkReturn efx_rc_t
-falconsiena_tx_qdesc_post(
+siena_tx_qdesc_post(
__in efx_txq_t *etp,
__in_ecount(n) efx_desc_t *ed,
__in unsigned int n,
@@ -107,7 +107,7 @@ falconsiena_tx_qdesc_post(
__inout unsigned int *addedp);
void
-falconsiena_tx_qdesc_dma_create(
+siena_tx_qdesc_dma_create(
__in efx_txq_t *etp,
__in efsys_dma_addr_t addr,
__in size_t size,
@@ -116,68 +116,42 @@ falconsiena_tx_qdesc_dma_create(
#if EFSYS_OPT_QSTATS
static void
-falconsiena_tx_qstats_update(
+siena_tx_qstats_update(
__in efx_txq_t *etp,
__inout_ecount(TX_NQSTATS) efsys_stat_t *stat);
#endif
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
-
+#endif /* EFSYS_OPT_SIENA */
-#if EFSYS_OPT_FALCON
-static efx_tx_ops_t __efx_tx_falcon_ops = {
- falconsiena_tx_init, /* etxo_init */
- falconsiena_tx_fini, /* etxo_fini */
- falconsiena_tx_qcreate, /* etxo_qcreate */
- falconsiena_tx_qdestroy, /* etxo_qdestroy */
- falconsiena_tx_qpost, /* etxo_qpost */
- falconsiena_tx_qpush, /* etxo_qpush */
- falconsiena_tx_qpace, /* etxo_qpace */
- falconsiena_tx_qflush, /* etxo_qflush */
- falconsiena_tx_qenable, /* etxo_qenable */
- NULL, /* etxo_qpio_enable */
- NULL, /* etxo_qpio_disable */
- NULL, /* etxo_qpio_write */
- NULL, /* etxo_qpio_post */
- falconsiena_tx_qdesc_post, /* etxo_qdesc_post */
- falconsiena_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
- NULL, /* etxo_qdesc_tso_create */
- NULL, /* etxo_qdesc_tso2_create */
- NULL, /* etxo_qdesc_vlantci_create */
-#if EFSYS_OPT_QSTATS
- falconsiena_tx_qstats_update, /* etxo_qstats_update */
-#endif
-};
-#endif /* EFSYS_OPT_FALCON */
#if EFSYS_OPT_SIENA
-static efx_tx_ops_t __efx_tx_siena_ops = {
- falconsiena_tx_init, /* etxo_init */
- falconsiena_tx_fini, /* etxo_fini */
- falconsiena_tx_qcreate, /* etxo_qcreate */
- falconsiena_tx_qdestroy, /* etxo_qdestroy */
- falconsiena_tx_qpost, /* etxo_qpost */
- falconsiena_tx_qpush, /* etxo_qpush */
- falconsiena_tx_qpace, /* etxo_qpace */
- falconsiena_tx_qflush, /* etxo_qflush */
- falconsiena_tx_qenable, /* etxo_qenable */
+static const efx_tx_ops_t __efx_tx_siena_ops = {
+ siena_tx_init, /* etxo_init */
+ siena_tx_fini, /* etxo_fini */
+ siena_tx_qcreate, /* etxo_qcreate */
+ siena_tx_qdestroy, /* etxo_qdestroy */
+ siena_tx_qpost, /* etxo_qpost */
+ siena_tx_qpush, /* etxo_qpush */
+ siena_tx_qpace, /* etxo_qpace */
+ siena_tx_qflush, /* etxo_qflush */
+ siena_tx_qenable, /* etxo_qenable */
NULL, /* etxo_qpio_enable */
NULL, /* etxo_qpio_disable */
NULL, /* etxo_qpio_write */
NULL, /* etxo_qpio_post */
- falconsiena_tx_qdesc_post, /* etxo_qdesc_post */
- falconsiena_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
+ siena_tx_qdesc_post, /* etxo_qdesc_post */
+ siena_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
NULL, /* etxo_qdesc_tso_create */
NULL, /* etxo_qdesc_tso2_create */
NULL, /* etxo_qdesc_vlantci_create */
#if EFSYS_OPT_QSTATS
- falconsiena_tx_qstats_update, /* etxo_qstats_update */
+ siena_tx_qstats_update, /* etxo_qstats_update */
#endif
};
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
-static efx_tx_ops_t __efx_tx_hunt_ops = {
+static const efx_tx_ops_t __efx_tx_hunt_ops = {
ef10_tx_init, /* etxo_init */
ef10_tx_fini, /* etxo_fini */
ef10_tx_qcreate, /* etxo_qcreate */
@@ -193,7 +167,7 @@ static efx_tx_ops_t __efx_tx_hunt_ops = {
ef10_tx_qpio_post, /* etxo_qpio_post */
ef10_tx_qdesc_post, /* etxo_qdesc_post */
ef10_tx_qdesc_dma_create, /* etxo_qdesc_dma_create */
- hunt_tx_qdesc_tso_create, /* etxo_qdesc_tso_create */
+ ef10_tx_qdesc_tso_create, /* etxo_qdesc_tso_create */
ef10_tx_qdesc_tso2_create, /* etxo_qdesc_tso2_create */
ef10_tx_qdesc_vlantci_create, /* etxo_qdesc_vlantci_create */
#if EFSYS_OPT_QSTATS
@@ -203,7 +177,7 @@ static efx_tx_ops_t __efx_tx_hunt_ops = {
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
-static efx_tx_ops_t __efx_tx_medford_ops = {
+static const efx_tx_ops_t __efx_tx_medford_ops = {
ef10_tx_init, /* etxo_init */
ef10_tx_fini, /* etxo_fini */
ef10_tx_qcreate, /* etxo_qcreate */
@@ -232,7 +206,7 @@ static efx_tx_ops_t __efx_tx_medford_ops = {
efx_tx_init(
__in efx_nic_t *enp)
{
- efx_tx_ops_t *etxop;
+ const efx_tx_ops_t *etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -249,27 +223,21 @@ efx_tx_init(
}
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- etxop = (efx_tx_ops_t *)&__efx_tx_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- etxop = (efx_tx_ops_t *)&__efx_tx_siena_ops;
+ etxop = &__efx_tx_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- etxop = (efx_tx_ops_t *)&__efx_tx_hunt_ops;
+ etxop = &__efx_tx_hunt_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- etxop = (efx_tx_ops_t *)&__efx_tx_medford_ops;
+ etxop = &__efx_tx_medford_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -306,7 +274,7 @@ fail1:
efx_tx_fini(
__in efx_nic_t *enp)
{
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC);
@@ -332,7 +300,7 @@ efx_tx_qcreate(
__deref_out efx_txq_t **etpp,
__out unsigned int *addedp)
{
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_txq_t *etp;
efx_rc_t rc;
@@ -381,7 +349,7 @@ efx_tx_qdestroy(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -403,7 +371,7 @@ efx_tx_qpost(
__inout unsigned int *addedp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -426,7 +394,7 @@ efx_tx_qpush(
__in unsigned int pushed)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -439,7 +407,7 @@ efx_tx_qpace(
__in unsigned int ns)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -459,7 +427,7 @@ efx_tx_qflush(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -479,7 +447,7 @@ efx_tx_qenable(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -491,7 +459,7 @@ efx_tx_qpio_enable(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -523,7 +491,7 @@ efx_tx_qpio_disable(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -539,7 +507,7 @@ efx_tx_qpio_write(
__in size_t pio_buf_offset)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -566,7 +534,7 @@ efx_tx_qpio_post(
__inout unsigned int *addedp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -594,7 +562,7 @@ efx_tx_qdesc_post(
__inout unsigned int *addedp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
efx_rc_t rc;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -619,7 +587,7 @@ efx_tx_qdesc_dma_create(
__out efx_desc_t *edp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
EFSYS_ASSERT(etxop->etxo_qdesc_dma_create != NULL);
@@ -636,7 +604,7 @@ efx_tx_qdesc_tso_create(
__out efx_desc_t *edp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
EFSYS_ASSERT(etxop->etxo_qdesc_tso_create != NULL);
@@ -654,7 +622,7 @@ efx_tx_qdesc_tso2_create(
__in int count)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
EFSYS_ASSERT(etxop->etxo_qdesc_tso2_create != NULL);
@@ -669,7 +637,7 @@ efx_tx_qdesc_vlantci_create(
__out efx_desc_t *edp)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
EFSYS_ASSERT(etxop->etxo_qdesc_vlantci_create != NULL);
@@ -685,7 +653,7 @@ efx_tx_qstats_update(
__inout_ecount(TX_NQSTATS) efsys_stat_t *stat)
{
efx_nic_t *enp = etp->et_enp;
- efx_tx_ops_t *etxop = enp->en_etxop;
+ const efx_tx_ops_t *etxop = enp->en_etxop;
EFSYS_ASSERT3U(etp->et_magic, ==, EFX_TXQ_MAGIC);
@@ -694,10 +662,10 @@ efx_tx_qstats_update(
#endif
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
-falconsiena_tx_init(
+siena_tx_init(
__in efx_nic_t *enp)
{
efx_oword_t oword;
@@ -760,7 +728,7 @@ falconsiena_tx_init(
} while (B_FALSE)
static __checkReturn efx_rc_t
-falconsiena_tx_qpost(
+siena_tx_qpost(
__in efx_txq_t *etp,
__in_ecount(n) efx_buffer_t *eb,
__in unsigned int n,
@@ -798,7 +766,7 @@ fail1:
}
static void
-falconsiena_tx_qpush(
+siena_tx_qpush(
__in efx_txq_t *etp,
__in unsigned int added,
__in unsigned int pushed)
@@ -829,7 +797,7 @@ falconsiena_tx_qpush(
#define EFX_TX_PACE_CLOCK_BASE 104
static __checkReturn efx_rc_t
-falconsiena_tx_qpace(
+siena_tx_qpace(
__in efx_txq_t *etp,
__in unsigned int ns)
{
@@ -872,7 +840,7 @@ fail1:
}
static __checkReturn efx_rc_t
-falconsiena_tx_qflush(
+siena_tx_qflush(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
@@ -892,7 +860,7 @@ falconsiena_tx_qflush(
}
static void
-falconsiena_tx_qenable(
+siena_tx_qenable(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
@@ -916,7 +884,7 @@ falconsiena_tx_qenable(
}
static __checkReturn efx_rc_t
-falconsiena_tx_qcreate(
+siena_tx_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in unsigned int label,
@@ -933,6 +901,8 @@ falconsiena_tx_qcreate(
uint32_t size;
efx_rc_t rc;
+ _NOTE(ARGUNUSED(esmp))
+
EFX_STATIC_ASSERT(EFX_EV_TX_NLABELS ==
(1 << FRF_AZ_TX_DESCQ_LABEL_WIDTH));
EFSYS_ASSERT3U(label, <, EFX_EV_TX_NLABELS);
@@ -991,7 +961,7 @@ fail1:
}
__checkReturn efx_rc_t
-falconsiena_tx_qdesc_post(
+siena_tx_qdesc_post(
__in efx_txq_t *etp,
__in_ecount(n) efx_desc_t *ed,
__in unsigned int n,
@@ -1032,7 +1002,7 @@ fail1:
}
void
-falconsiena_tx_qdesc_dma_create(
+siena_tx_qdesc_dma_create(
__in efx_txq_t *etp,
__in efsys_dma_addr_t addr,
__in size_t size,
@@ -1055,7 +1025,7 @@ falconsiena_tx_qdesc_dma_create(
(uint32_t)(addr >> 32));
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_QSTATS
#if EFSYS_OPT_NAMES
@@ -1080,11 +1050,11 @@ efx_tx_qstat_name(
#endif /* EFSYS_OPT_NAMES */
#endif /* EFSYS_OPT_QSTATS */
-#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA
+#if EFSYS_OPT_SIENA
#if EFSYS_OPT_QSTATS
static void
-falconsiena_tx_qstats_update(
+siena_tx_qstats_update(
__in efx_txq_t *etp,
__inout_ecount(TX_NQSTATS) efsys_stat_t *stat)
{
@@ -1100,7 +1070,7 @@ falconsiena_tx_qstats_update(
#endif /* EFSYS_OPT_QSTATS */
static void
-falconsiena_tx_qdestroy(
+siena_tx_qdestroy(
__in efx_txq_t *etp)
{
efx_nic_t *enp = etp->et_enp;
@@ -1114,10 +1084,10 @@ falconsiena_tx_qdestroy(
}
static void
-falconsiena_tx_fini(
+siena_tx_fini(
__in efx_nic_t *enp)
{
_NOTE(ARGUNUSED(enp))
}
-#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */
+#endif /* EFSYS_OPT_SIENA */
diff --git a/sys/dev/sfxge/common/efx_types.h b/sys/dev/sfxge/common/efx_types.h
index ae4c6d9..4289145 100644
--- a/sys/dev/sfxge/common/efx_types.h
+++ b/sys/dev/sfxge/common/efx_types.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/efx_vpd.c b/sys/dev/sfxge/common/efx_vpd.c
index ebeddfe..091dfb5 100644
--- a/sys/dev/sfxge/common/efx_vpd.c
+++ b/sys/dev/sfxge/common/efx_vpd.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,26 +54,9 @@ __FBSDID("$FreeBSD$");
#define TAG_NAME_VPD_R_DECODE 0x10
#define TAG_NAME_VPD_W_DECODE 0x11
-#if EFSYS_OPT_FALCON
-
-static efx_vpd_ops_t __efx_vpd_falcon_ops = {
- NULL, /* evpdo_init */
- falcon_vpd_size, /* evpdo_size */
- falcon_vpd_read, /* evpdo_read */
- falcon_vpd_verify, /* evpdo_verify */
- NULL, /* evpdo_reinit */
- falcon_vpd_get, /* evpdo_get */
- falcon_vpd_set, /* evpdo_set */
- falcon_vpd_next, /* evpdo_next */
- falcon_vpd_write, /* evpdo_write */
- NULL, /* evpdo_fini */
-};
-
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
-static efx_vpd_ops_t __efx_vpd_siena_ops = {
+static const efx_vpd_ops_t __efx_vpd_siena_ops = {
siena_vpd_init, /* evpdo_init */
siena_vpd_size, /* evpdo_size */
siena_vpd_read, /* evpdo_read */
@@ -90,7 +73,7 @@ static efx_vpd_ops_t __efx_vpd_siena_ops = {
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
-static efx_vpd_ops_t __efx_vpd_ef10_ops = {
+static const efx_vpd_ops_t __efx_vpd_ef10_ops = {
ef10_vpd_init, /* evpdo_init */
ef10_vpd_size, /* evpdo_size */
ef10_vpd_read, /* evpdo_read */
@@ -109,7 +92,7 @@ static efx_vpd_ops_t __efx_vpd_ef10_ops = {
efx_vpd_init(
__in efx_nic_t *enp)
{
- efx_vpd_ops_t *evpdop;
+ const efx_vpd_ops_t *evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -117,27 +100,21 @@ efx_vpd_init(
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_VPD));
switch (enp->en_family) {
-#if EFSYS_OPT_FALCON
- case EFX_FAMILY_FALCON:
- evpdop = (efx_vpd_ops_t *)&__efx_vpd_falcon_ops;
- break;
-#endif /* EFSYS_OPT_FALCON */
-
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
- evpdop = (efx_vpd_ops_t *)&__efx_vpd_siena_ops;
+ evpdop = &__efx_vpd_siena_ops;
break;
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_HUNTINGTON
case EFX_FAMILY_HUNTINGTON:
- evpdop = (efx_vpd_ops_t *)&__efx_vpd_ef10_ops;
+ evpdop = &__efx_vpd_ef10_ops;
break;
#endif /* EFSYS_OPT_HUNTINGTON */
#if EFSYS_OPT_MEDFORD
case EFX_FAMILY_MEDFORD:
- evpdop = (efx_vpd_ops_t *)&__efx_vpd_ef10_ops;
+ evpdop = &__efx_vpd_ef10_ops;
break;
#endif /* EFSYS_OPT_MEDFORD */
@@ -170,7 +147,7 @@ efx_vpd_size(
__in efx_nic_t *enp,
__out size_t *sizep)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -193,7 +170,7 @@ efx_vpd_read(
__out_bcount(size) caddr_t data,
__in size_t size)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -216,7 +193,7 @@ efx_vpd_verify(
__in_bcount(size) caddr_t data,
__in size_t size)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -239,7 +216,7 @@ efx_vpd_reinit(
__in_bcount(size) caddr_t data,
__in size_t size)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -270,14 +247,18 @@ efx_vpd_get(
__in size_t size,
__inout efx_vpd_value_t *evvp)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_VPD);
- if ((rc = evpdop->evpdo_get(enp, data, size, evvp)) != 0)
+ if ((rc = evpdop->evpdo_get(enp, data, size, evvp)) != 0) {
+ if (rc == ENOENT)
+ return (rc);
+
goto fail1;
+ }
return (0);
@@ -294,7 +275,7 @@ efx_vpd_set(
__in size_t size,
__in efx_vpd_value_t *evvp)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -319,7 +300,7 @@ efx_vpd_next(
__out efx_vpd_value_t *evvp,
__inout unsigned int *contp)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -342,7 +323,7 @@ efx_vpd_write(
__in_bcount(size) caddr_t data,
__in size_t size)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -1022,7 +1003,7 @@ fail1:
efx_vpd_fini(
__in efx_nic_t *enp)
{
- efx_vpd_ops_t *evpdop = enp->en_evpdop;
+ const efx_vpd_ops_t *evpdop = enp->en_evpdop;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
diff --git a/sys/dev/sfxge/common/efx_wol.c b/sys/dev/sfxge/common/efx_wol.c
index aea3c55..dd1a85f 100644
--- a/sys/dev/sfxge/common/efx_wol.c
+++ b/sys/dev/sfxge/common/efx_wol.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h
index 49ecbea..1ec2909 100644
--- a/sys/dev/sfxge/common/hunt_impl.h
+++ b/sys/dev/sfxge/common/hunt_impl.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,503 +42,36 @@
extern "C" {
#endif
-/*
- * FIXME: This is just a power of 2 which fits in an MCDI v1 message, and could
- * possibly be increased, or the write size reported by newer firmware used
- * instead.
- */
-#define EF10_NVRAM_CHUNK 0x80
-
-/* Alignment requirement for value written to RX WPTR:
- * the WPTR must be aligned to an 8 descriptor boundary
- */
-#define EF10_RX_WPTR_ALIGN 8
-
-/*
- * Max byte offset into the packet the TCP header must start for the hardware
- * to be able to parse the packet correctly.
- * FIXME: Move to ef10_impl.h when it is included in all driver builds.
- */
-#define EF10_TCP_HEADER_OFFSET_LIMIT 208
-
-/* Invalid RSS context handle */
-#define EF10_RSS_CONTEXT_INVALID (0xffffffff)
-
-
-/* EV */
-
- __checkReturn efx_rc_t
-ef10_ev_init(
- __in efx_nic_t *enp);
-
- void
-ef10_ev_fini(
- __in efx_nic_t *enp);
-
- __checkReturn efx_rc_t
-ef10_ev_qcreate(
- __in efx_nic_t *enp,
- __in unsigned int index,
- __in efsys_mem_t *esmp,
- __in size_t n,
- __in uint32_t id,
- __in efx_evq_t *eep);
-
- void
-ef10_ev_qdestroy(
- __in efx_evq_t *eep);
-
- __checkReturn efx_rc_t
-ef10_ev_qprime(
- __in efx_evq_t *eep,
- __in unsigned int count);
-
- void
-ef10_ev_qpost(
- __in efx_evq_t *eep,
- __in uint16_t data);
-
- __checkReturn efx_rc_t
-ef10_ev_qmoderate(
- __in efx_evq_t *eep,
- __in unsigned int us);
-
-#if EFSYS_OPT_QSTATS
- void
-ef10_ev_qstats_update(
- __in efx_evq_t *eep,
- __inout_ecount(EV_NQSTATS) efsys_stat_t *stat);
-#endif /* EFSYS_OPT_QSTATS */
-
- void
-ef10_ev_rxlabel_init(
- __in efx_evq_t *eep,
- __in efx_rxq_t *erp,
- __in unsigned int label);
-
- void
-ef10_ev_rxlabel_fini(
- __in efx_evq_t *eep,
- __in unsigned int label);
-
-/* INTR */
-
- __checkReturn efx_rc_t
-ef10_intr_init(
- __in efx_nic_t *enp,
- __in efx_intr_type_t type,
- __in efsys_mem_t *esmp);
-
- void
-ef10_intr_enable(
- __in efx_nic_t *enp);
-
- void
-ef10_intr_disable(
- __in efx_nic_t *enp);
-
- void
-ef10_intr_disable_unlocked(
- __in efx_nic_t *enp);
+/* Missing register definitions */
+#ifndef ER_DZ_TX_PIOBUF_OFST
+#define ER_DZ_TX_PIOBUF_OFST 0x00001000
+#endif
+#ifndef ER_DZ_TX_PIOBUF_STEP
+#define ER_DZ_TX_PIOBUF_STEP 8192
+#endif
+#ifndef ER_DZ_TX_PIOBUF_ROWS
+#define ER_DZ_TX_PIOBUF_ROWS 2048
+#endif
- __checkReturn efx_rc_t
-ef10_intr_trigger(
- __in efx_nic_t *enp,
- __in unsigned int level);
+#ifndef ER_DZ_TX_PIOBUF_SIZE
+#define ER_DZ_TX_PIOBUF_SIZE 2048
+#endif
- void
-ef10_intr_status_line(
- __in efx_nic_t *enp,
- __out boolean_t *fatalp,
- __out uint32_t *qmaskp);
+#define HUNT_PIOBUF_NBUFS (16)
+#define HUNT_PIOBUF_SIZE (ER_DZ_TX_PIOBUF_SIZE)
- void
-ef10_intr_status_message(
- __in efx_nic_t *enp,
- __in unsigned int message,
- __out boolean_t *fatalp);
+#define HUNT_MIN_PIO_ALLOC_SIZE (HUNT_PIOBUF_SIZE / 32)
- void
-ef10_intr_fatal(
- __in efx_nic_t *enp);
- void
-ef10_intr_fini(
- __in efx_nic_t *enp);
/* NIC */
extern __checkReturn efx_rc_t
-ef10_nic_probe(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
hunt_board_cfg(
__in efx_nic_t *enp);
-extern __checkReturn efx_rc_t
-ef10_nic_set_drv_limits(
- __inout efx_nic_t *enp,
- __in efx_drv_limits_t *edlp);
-
-extern __checkReturn efx_rc_t
-ef10_nic_get_vi_pool(
- __in efx_nic_t *enp,
- __out uint32_t *vi_countp);
-
-extern __checkReturn efx_rc_t
-ef10_nic_get_bar_region(
- __in efx_nic_t *enp,
- __in efx_nic_region_t region,
- __out uint32_t *offsetp,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
-ef10_nic_reset(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_nic_init(
- __in efx_nic_t *enp);
-
-#if EFSYS_OPT_DIAG
-
-extern __checkReturn efx_rc_t
-ef10_nic_register_test(
- __in efx_nic_t *enp);
-
-#endif /* EFSYS_OPT_DIAG */
-
-extern void
-ef10_nic_fini(
- __in efx_nic_t *enp);
-
-extern void
-ef10_nic_unprobe(
- __in efx_nic_t *enp);
-
-
-/* MAC */
-
-extern __checkReturn efx_rc_t
-ef10_mac_poll(
- __in efx_nic_t *enp,
- __out efx_link_mode_t *link_modep);
-
-extern __checkReturn efx_rc_t
-ef10_mac_up(
- __in efx_nic_t *enp,
- __out boolean_t *mac_upp);
-
-extern __checkReturn efx_rc_t
-ef10_mac_addr_set(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_mac_pdu_set(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_mac_reconfigure(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_mac_multicast_list_set(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_mac_filter_default_rxq_set(
- __in efx_nic_t *enp,
- __in efx_rxq_t *erp,
- __in boolean_t using_rss);
-
-extern void
-ef10_mac_filter_default_rxq_clear(
- __in efx_nic_t *enp);
-
-#if EFSYS_OPT_LOOPBACK
-
-extern __checkReturn efx_rc_t
-ef10_mac_loopback_set(
- __in efx_nic_t *enp,
- __in efx_link_mode_t link_mode,
- __in efx_loopback_type_t loopback_type);
-
-#endif /* EFSYS_OPT_LOOPBACK */
-
-#if EFSYS_OPT_MAC_STATS
-
-extern __checkReturn efx_rc_t
-ef10_mac_stats_update(
- __in efx_nic_t *enp,
- __in efsys_mem_t *esmp,
- __inout_ecount(EFX_MAC_NSTATS) efsys_stat_t *stat,
- __inout_opt uint32_t *generationp);
-
-#endif /* EFSYS_OPT_MAC_STATS */
-
-
-/* MCDI */
-
-#if EFSYS_OPT_MCDI
-
-extern __checkReturn efx_rc_t
-ef10_mcdi_init(
- __in efx_nic_t *enp,
- __in const efx_mcdi_transport_t *mtp);
-
-extern void
-ef10_mcdi_fini(
- __in efx_nic_t *enp);
-
-extern void
-ef10_mcdi_send_request(
- __in efx_nic_t *enp,
- __in void *hdrp,
- __in size_t hdr_len,
- __in void *sdup,
- __in size_t sdu_len);
-
-extern __checkReturn boolean_t
-ef10_mcdi_poll_response(
- __in efx_nic_t *enp);
-
-extern void
-ef10_mcdi_read_response(
- __in efx_nic_t *enp,
- __out_bcount(length) void *bufferp,
- __in size_t offset,
- __in size_t length);
-
-extern efx_rc_t
-ef10_mcdi_poll_reboot(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_mcdi_feature_supported(
- __in efx_nic_t *enp,
- __in efx_mcdi_feature_id_t id,
- __out boolean_t *supportedp);
-
-#endif /* EFSYS_OPT_MCDI */
-
-/* NVRAM */
-
-#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
-
-extern __checkReturn efx_rc_t
-ef10_nvram_buf_read_tlv(
- __in efx_nic_t *enp,
- __in_bcount(max_seg_size) caddr_t seg_data,
- __in size_t max_seg_size,
- __in uint32_t tag,
- __deref_out_bcount_opt(*sizep) caddr_t *datap,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_buf_write_tlv(
- __inout_bcount(partn_size) caddr_t partn_data,
- __in size_t partn_size,
- __in uint32_t tag,
- __in_bcount(tag_size) caddr_t tag_data,
- __in size_t tag_size,
- __out size_t *total_lengthp);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_read_tlv(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in uint32_t tag,
- __deref_out_bcount_opt(*sizep) caddr_t *datap,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_write_tlv(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in uint32_t tag,
- __in_bcount(size) caddr_t data,
- __in size_t size);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_write_segment_tlv(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in uint32_t tag,
- __in_bcount(size) caddr_t data,
- __in size_t size,
- __in boolean_t all_segments);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_lock(
- __in efx_nic_t *enp,
- __in uint32_t partn);
-
-extern void
-ef10_nvram_partn_unlock(
- __in efx_nic_t *enp,
- __in uint32_t partn);
-
-#endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
-
-#if EFSYS_OPT_NVRAM
-
-#if EFSYS_OPT_DIAG
-
-extern __checkReturn efx_rc_t
-ef10_nvram_test(
- __in efx_nic_t *enp);
-
-#endif /* EFSYS_OPT_DIAG */
-
-extern __checkReturn efx_rc_t
-ef10_nvram_type_to_partn(
- __in efx_nic_t *enp,
- __in efx_nvram_type_t type,
- __out uint32_t *partnp);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_size(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_rw_start(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __out size_t *chunk_sizep);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_read_mode(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in unsigned int offset,
- __out_bcount(size) caddr_t data,
- __in size_t size,
- __in uint32_t mode);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_read(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in unsigned int offset,
- __out_bcount(size) caddr_t data,
- __in size_t size);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_erase(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in unsigned int offset,
- __in size_t size);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_write(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in unsigned int offset,
- __out_bcount(size) caddr_t data,
- __in size_t size);
-
-extern void
-ef10_nvram_partn_rw_finish(
- __in efx_nic_t *enp,
- __in uint32_t partn);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_get_version(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __out uint32_t *subtypep,
- __out_ecount(4) uint16_t version[4]);
-
-extern __checkReturn efx_rc_t
-ef10_nvram_partn_set_version(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __in_ecount(4) uint16_t version[4]);
-
-#endif /* EFSYS_OPT_NVRAM */
-
/* PHY */
-typedef struct ef10_link_state_s {
- uint32_t els_adv_cap_mask;
- uint32_t els_lp_cap_mask;
- unsigned int els_fcntl;
- efx_link_mode_t els_link_mode;
-#if EFSYS_OPT_LOOPBACK
- efx_loopback_type_t els_loopback;
-#endif
- boolean_t els_mac_up;
-} ef10_link_state_t;
-
-extern void
-ef10_phy_link_ev(
- __in efx_nic_t *enp,
- __in efx_qword_t *eqp,
- __out efx_link_mode_t *link_modep);
-
-extern __checkReturn efx_rc_t
-ef10_phy_get_link(
- __in efx_nic_t *enp,
- __out ef10_link_state_t *elsp);
-
-extern __checkReturn efx_rc_t
-ef10_phy_power(
- __in efx_nic_t *enp,
- __in boolean_t on);
-
-extern __checkReturn efx_rc_t
-ef10_phy_reconfigure(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_phy_verify(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_phy_oui_get(
- __in efx_nic_t *enp,
- __out uint32_t *ouip);
-
-#if EFSYS_OPT_PHY_STATS
-
-extern __checkReturn efx_rc_t
-ef10_phy_stats_update(
- __in efx_nic_t *enp,
- __in efsys_mem_t *esmp,
- __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat);
-
-#endif /* EFSYS_OPT_PHY_STATS */
-
-#if EFSYS_OPT_PHY_PROPS
-
-#if EFSYS_OPT_NAMES
-
-extern const char *
-ef10_phy_prop_name(
- __in efx_nic_t *enp,
- __in unsigned int id);
-
-#endif /* EFSYS_OPT_NAMES */
-
-extern __checkReturn efx_rc_t
-ef10_phy_prop_get(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t flags,
- __out uint32_t *valp);
-
-extern __checkReturn efx_rc_t
-ef10_phy_prop_set(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t val);
-
-#endif /* EFSYS_OPT_PHY_PROPS */
-
#if EFSYS_OPT_BIST
extern __checkReturn efx_rc_t
@@ -569,481 +102,6 @@ hunt_bist_stop(
#endif /* EFSYS_OPT_BIST */
-/* SRAM */
-
-#if EFSYS_OPT_DIAG
-
-extern __checkReturn efx_rc_t
-ef10_sram_test(
- __in efx_nic_t *enp,
- __in efx_sram_pattern_fn_t func);
-
-#endif /* EFSYS_OPT_DIAG */
-
-
-/* TX */
-
-extern __checkReturn efx_rc_t
-ef10_tx_init(
- __in efx_nic_t *enp);
-
-extern void
-ef10_tx_fini(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qcreate(
- __in efx_nic_t *enp,
- __in unsigned int index,
- __in unsigned int label,
- __in efsys_mem_t *esmp,
- __in size_t n,
- __in uint32_t id,
- __in uint16_t flags,
- __in efx_evq_t *eep,
- __in efx_txq_t *etp,
- __out unsigned int *addedp);
-
-extern void
-ef10_tx_qdestroy(
- __in efx_txq_t *etp);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qpost(
- __in efx_txq_t *etp,
- __in_ecount(n) efx_buffer_t *eb,
- __in unsigned int n,
- __in unsigned int completed,
- __inout unsigned int *addedp);
-
-extern void
-ef10_tx_qpush(
- __in efx_txq_t *etp,
- __in unsigned int added,
- __in unsigned int pushed);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qpace(
- __in efx_txq_t *etp,
- __in unsigned int ns);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qflush(
- __in efx_txq_t *etp);
-
-extern void
-ef10_tx_qenable(
- __in efx_txq_t *etp);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qpio_enable(
- __in efx_txq_t *etp);
-
-extern void
-ef10_tx_qpio_disable(
- __in efx_txq_t *etp);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qpio_write(
- __in efx_txq_t *etp,
- __in_ecount(buf_length) uint8_t *buffer,
- __in size_t buf_length,
- __in size_t pio_buf_offset);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qpio_post(
- __in efx_txq_t *etp,
- __in size_t pkt_length,
- __in unsigned int completed,
- __inout unsigned int *addedp);
-
-extern __checkReturn efx_rc_t
-ef10_tx_qdesc_post(
- __in efx_txq_t *etp,
- __in_ecount(n) efx_desc_t *ed,
- __in unsigned int n,
- __in unsigned int completed,
- __inout unsigned int *addedp);
-
-extern void
-ef10_tx_qdesc_dma_create(
- __in efx_txq_t *etp,
- __in efsys_dma_addr_t addr,
- __in size_t size,
- __in boolean_t eop,
- __out efx_desc_t *edp);
-
-extern void
-hunt_tx_qdesc_tso_create(
- __in efx_txq_t *etp,
- __in uint16_t ipv4_id,
- __in uint32_t tcp_seq,
- __in uint8_t tcp_flags,
- __out efx_desc_t *edp);
-
-extern void
-ef10_tx_qdesc_tso2_create(
- __in efx_txq_t *etp,
- __in uint16_t ipv4_id,
- __in uint32_t tcp_seq,
- __in uint16_t tcp_mss,
- __out_ecount(count) efx_desc_t *edp,
- __in int count);
-
-extern void
-ef10_tx_qdesc_vlantci_create(
- __in efx_txq_t *etp,
- __in uint16_t vlan_tci,
- __out efx_desc_t *edp);
-
-
-#if EFSYS_OPT_QSTATS
-
-extern void
-ef10_tx_qstats_update(
- __in efx_txq_t *etp,
- __inout_ecount(TX_NQSTATS) efsys_stat_t *stat);
-
-#endif /* EFSYS_OPT_QSTATS */
-
-/* PIO */
-
-/* Missing register definitions */
-#ifndef ER_DZ_TX_PIOBUF_OFST
-#define ER_DZ_TX_PIOBUF_OFST 0x00001000
-#endif
-#ifndef ER_DZ_TX_PIOBUF_STEP
-#define ER_DZ_TX_PIOBUF_STEP 8192
-#endif
-#ifndef ER_DZ_TX_PIOBUF_ROWS
-#define ER_DZ_TX_PIOBUF_ROWS 2048
-#endif
-
-#ifndef ER_DZ_TX_PIOBUF_SIZE
-#define ER_DZ_TX_PIOBUF_SIZE 2048
-#endif
-
-#define HUNT_PIOBUF_NBUFS (16)
-#define HUNT_PIOBUF_SIZE (ER_DZ_TX_PIOBUF_SIZE)
-
-#define HUNT_MIN_PIO_ALLOC_SIZE (HUNT_PIOBUF_SIZE / 32)
-
-#define EF10_LEGACY_PF_PRIVILEGE_MASK \
- (MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_LINK | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_ONLOAD | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_PTP | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_INSECURE_FILTERS | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_UNICAST | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_MULTICAST | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_BROADCAST | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST | \
- MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS)
-
-#define EF10_LEGACY_VF_PRIVILEGE_MASK 0
-
-typedef uint32_t efx_piobuf_handle_t;
-
-#define EFX_PIOBUF_HANDLE_INVALID ((efx_piobuf_handle_t) -1)
-
-extern __checkReturn efx_rc_t
-ef10_nic_pio_alloc(
- __inout efx_nic_t *enp,
- __out uint32_t *bufnump,
- __out efx_piobuf_handle_t *handlep,
- __out uint32_t *blknump,
- __out uint32_t *offsetp,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
-ef10_nic_pio_free(
- __inout efx_nic_t *enp,
- __in uint32_t bufnum,
- __in uint32_t blknum);
-
-extern __checkReturn efx_rc_t
-ef10_nic_pio_link(
- __inout efx_nic_t *enp,
- __in uint32_t vi_index,
- __in efx_piobuf_handle_t handle);
-
-extern __checkReturn efx_rc_t
-ef10_nic_pio_unlink(
- __inout efx_nic_t *enp,
- __in uint32_t vi_index);
-
-
-/* VPD */
-
-#if EFSYS_OPT_VPD
-
-extern __checkReturn efx_rc_t
-ef10_vpd_init(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_size(
- __in efx_nic_t *enp,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_read(
- __in efx_nic_t *enp,
- __out_bcount(size) caddr_t data,
- __in size_t size);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_verify(
- __in efx_nic_t *enp,
- __in_bcount(size) caddr_t data,
- __in size_t size);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_reinit(
- __in efx_nic_t *enp,
- __in_bcount(size) caddr_t data,
- __in size_t size);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_get(
- __in efx_nic_t *enp,
- __in_bcount(size) caddr_t data,
- __in size_t size,
- __inout efx_vpd_value_t *evvp);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_set(
- __in efx_nic_t *enp,
- __in_bcount(size) caddr_t data,
- __in size_t size,
- __in efx_vpd_value_t *evvp);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_next(
- __in efx_nic_t *enp,
- __in_bcount(size) caddr_t data,
- __in size_t size,
- __out efx_vpd_value_t *evvp,
- __inout unsigned int *contp);
-
-extern __checkReturn efx_rc_t
-ef10_vpd_write(
- __in efx_nic_t *enp,
- __in_bcount(size) caddr_t data,
- __in size_t size);
-
-extern void
-ef10_vpd_fini(
- __in efx_nic_t *enp);
-
-#endif /* EFSYS_OPT_VPD */
-
-
-/* RX */
-
-extern __checkReturn efx_rc_t
-ef10_rx_init(
- __in efx_nic_t *enp);
-
-#if EFSYS_OPT_RX_SCATTER
-extern __checkReturn efx_rc_t
-ef10_rx_scatter_enable(
- __in efx_nic_t *enp,
- __in unsigned int buf_size);
-#endif /* EFSYS_OPT_RX_SCATTER */
-
-
-#if EFSYS_OPT_RX_SCALE
-
-extern __checkReturn efx_rc_t
-ef10_rx_scale_mode_set(
- __in efx_nic_t *enp,
- __in efx_rx_hash_alg_t alg,
- __in efx_rx_hash_type_t type,
- __in boolean_t insert);
-
-extern __checkReturn efx_rc_t
-ef10_rx_scale_key_set(
- __in efx_nic_t *enp,
- __in_ecount(n) uint8_t *key,
- __in size_t n);
-
-extern __checkReturn efx_rc_t
-ef10_rx_scale_tbl_set(
- __in efx_nic_t *enp,
- __in_ecount(n) unsigned int *table,
- __in size_t n);
-
-extern __checkReturn uint32_t
-ef10_rx_prefix_hash(
- __in efx_nic_t *enp,
- __in efx_rx_hash_alg_t func,
- __in uint8_t *buffer);
-
-#endif /* EFSYS_OPT_RX_SCALE */
-
-extern __checkReturn efx_rc_t
-ef10_rx_prefix_pktlen(
- __in efx_nic_t *enp,
- __in uint8_t *buffer,
- __out uint16_t *lengthp);
-
-extern void
-ef10_rx_qpost(
- __in efx_rxq_t *erp,
- __in_ecount(n) efsys_dma_addr_t *addrp,
- __in size_t size,
- __in unsigned int n,
- __in unsigned int completed,
- __in unsigned int added);
-
-extern void
-ef10_rx_qpush(
- __in efx_rxq_t *erp,
- __in unsigned int added,
- __inout unsigned int *pushedp);
-
-extern __checkReturn efx_rc_t
-ef10_rx_qflush(
- __in efx_rxq_t *erp);
-
-extern void
-ef10_rx_qenable(
- __in efx_rxq_t *erp);
-
-extern __checkReturn efx_rc_t
-ef10_rx_qcreate(
- __in efx_nic_t *enp,
- __in unsigned int index,
- __in unsigned int label,
- __in efx_rxq_type_t type,
- __in efsys_mem_t *esmp,
- __in size_t n,
- __in uint32_t id,
- __in efx_evq_t *eep,
- __in efx_rxq_t *erp);
-
-extern void
-ef10_rx_qdestroy(
- __in efx_rxq_t *erp);
-
-extern void
-ef10_rx_fini(
- __in efx_nic_t *enp);
-
-#if EFSYS_OPT_FILTER
-
-typedef struct ef10_filter_handle_s {
- uint32_t efh_lo;
- uint32_t efh_hi;
-} ef10_filter_handle_t;
-
-typedef struct ef10_filter_entry_s {
- uintptr_t efe_spec; /* pointer to filter spec plus busy bit */
- ef10_filter_handle_t efe_handle;
-} ef10_filter_entry_t;
-
-/*
- * BUSY flag indicates that an update is in progress.
- * AUTO_OLD flag is used to mark and sweep MAC packet filters.
- */
-#define EFX_EF10_FILTER_FLAG_BUSY 1U
-#define EFX_EF10_FILTER_FLAG_AUTO_OLD 2U
-#define EFX_EF10_FILTER_FLAGS 3U
-
-/*
- * Size of the hash table used by the driver. Doesn't need to be the
- * same size as the hardware's table.
- */
-#define EFX_EF10_FILTER_TBL_ROWS 8192
-
-/* Allow for the broadcast address to be added to the multicast list */
-#define EFX_EF10_FILTER_MULTICAST_FILTERS_MAX (EFX_MAC_MULTICAST_LIST_MAX + 1)
-
-typedef struct ef10_filter_table_s {
- ef10_filter_entry_t eft_entry[EFX_EF10_FILTER_TBL_ROWS];
- efx_rxq_t * eft_default_rxq;
- boolean_t eft_using_rss;
- uint32_t eft_unicst_filter_index;
- boolean_t eft_unicst_filter_set;
- uint32_t eft_mulcst_filter_indexes[
- EFX_EF10_FILTER_MULTICAST_FILTERS_MAX];
- uint32_t eft_mulcst_filter_count;
-} ef10_filter_table_t;
-
- __checkReturn efx_rc_t
-ef10_filter_init(
- __in efx_nic_t *enp);
-
- void
-ef10_filter_fini(
- __in efx_nic_t *enp);
-
- __checkReturn efx_rc_t
-ef10_filter_restore(
- __in efx_nic_t *enp);
-
- __checkReturn efx_rc_t
-ef10_filter_add(
- __in efx_nic_t *enp,
- __inout efx_filter_spec_t *spec,
- __in boolean_t may_replace);
-
- __checkReturn efx_rc_t
-ef10_filter_delete(
- __in efx_nic_t *enp,
- __inout efx_filter_spec_t *spec);
-
-extern __checkReturn efx_rc_t
-ef10_filter_supported_filters(
- __in efx_nic_t *enp,
- __out uint32_t *list,
- __out size_t *length);
-
-extern __checkReturn efx_rc_t
-ef10_filter_reconfigure(
- __in efx_nic_t *enp,
- __in_ecount(6) uint8_t const *mac_addr,
- __in boolean_t all_unicst,
- __in boolean_t mulcst,
- __in boolean_t all_mulcst,
- __in boolean_t brdcst,
- __in_ecount(6*count) uint8_t const *addrs,
- __in int count);
-
-extern void
-ef10_filter_get_default_rxq(
- __in efx_nic_t *enp,
- __out efx_rxq_t **erpp,
- __out boolean_t *using_rss);
-
-extern void
-ef10_filter_default_rxq_set(
- __in efx_nic_t *enp,
- __in efx_rxq_t *erp,
- __in boolean_t using_rss);
-
-extern void
-ef10_filter_default_rxq_clear(
- __in efx_nic_t *enp);
-
-
-#endif /* EFSYS_OPT_FILTER */
-
-extern __checkReturn efx_rc_t
-efx_mcdi_get_function_info(
- __in efx_nic_t *enp,
- __out uint32_t *pfp,
- __out_opt uint32_t *vfp);
-
-extern __checkReturn efx_rc_t
-efx_mcdi_privilege_mask(
- __in efx_nic_t *enp,
- __in uint32_t pf,
- __in uint32_t vf,
- __out uint32_t *maskp);
-
#ifdef __cplusplus
}
#endif
diff --git a/sys/dev/sfxge/common/hunt_nic.c b/sys/dev/sfxge/common/hunt_nic.c
index 7f0c068..486e424 100644
--- a/sys/dev/sfxge/common/hunt_nic.c
+++ b/sys/dev/sfxge/common/hunt_nic.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,925 +41,53 @@ __FBSDID("$FreeBSD$");
#include "ef10_tlv_layout.h"
- __checkReturn efx_rc_t
-efx_mcdi_get_port_assignment(
- __in efx_nic_t *enp,
- __out uint32_t *portp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN,
- MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN)];
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_PORT_ASSIGNMENT;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- *portp = MCDI_OUT_DWORD(req, GET_PORT_ASSIGNMENT_OUT_PORT);
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-efx_mcdi_get_port_modes(
+static __checkReturn efx_rc_t
+hunt_nic_get_required_pcie_bandwidth(
__in efx_nic_t *enp,
- __out uint32_t *modesp)
+ __out uint32_t *bandwidth_mbpsp)
{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_PORT_MODES_IN_LEN,
- MC_CMD_GET_PORT_MODES_OUT_LEN)];
+ uint32_t port_modes;
+ uint32_t max_port_mode;
+ uint32_t bandwidth;
efx_rc_t rc;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_PORT_MODES;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_PORT_MODES_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_PORT_MODES_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
/*
- * Require only Modes and DefaultMode fields.
- * (CurrentMode field was added for Medford)
+ * On Huntington, the firmware may not give us the current port mode, so
+ * we need to go by the set of available port modes and assume the most
+ * capable mode is in use.
*/
- if (req.emr_out_length_used <
- MC_CMD_GET_PORT_MODES_OUT_CURRENT_MODE_OFST) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- *modesp = MCDI_OUT_DWORD(req, GET_PORT_MODES_OUT_MODES);
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
-static __checkReturn efx_rc_t
-efx_mcdi_vadaptor_alloc(
- __in efx_nic_t *enp,
- __in uint32_t port_id)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_VADAPTOR_ALLOC_IN_LEN,
- MC_CMD_VADAPTOR_ALLOC_OUT_LEN)];
- efx_rc_t rc;
-
- EFSYS_ASSERT3U(enp->en_vport_id, ==, EVB_PORT_ID_NULL);
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_VADAPTOR_ALLOC;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_VADAPTOR_ALLOC_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_VADAPTOR_ALLOC_OUT_LEN;
-
- MCDI_IN_SET_DWORD(req, VADAPTOR_ALLOC_IN_UPSTREAM_PORT_ID, port_id);
- MCDI_IN_POPULATE_DWORD_1(req, VADAPTOR_ALLOC_IN_FLAGS,
- VADAPTOR_ALLOC_IN_FLAG_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED,
- enp->en_nic_cfg.enc_allow_set_mac_with_installed_filters ? 1 : 0);
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-static __checkReturn efx_rc_t
-efx_mcdi_vadaptor_free(
- __in efx_nic_t *enp,
- __in uint32_t port_id)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_VADAPTOR_FREE_IN_LEN,
- MC_CMD_VADAPTOR_FREE_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_VADAPTOR_FREE;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_VADAPTOR_FREE_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_VADAPTOR_FREE_OUT_LEN;
-
- MCDI_IN_SET_DWORD(req, VADAPTOR_FREE_IN_UPSTREAM_PORT_ID, port_id);
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-efx_mcdi_get_mac_address_pf(
- __in efx_nic_t *enp,
- __out_ecount_opt(6) uint8_t mac_addrp[6])
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_MAC_ADDRESSES_IN_LEN,
- MC_CMD_GET_MAC_ADDRESSES_OUT_LEN)];
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_MAC_ADDRESSES;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_MAC_ADDRESSES_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_MAC_ADDRESSES_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_MAC_ADDRESSES_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- if (MCDI_OUT_DWORD(req, GET_MAC_ADDRESSES_OUT_MAC_COUNT) < 1) {
- rc = ENOENT;
- goto fail3;
- }
-
- if (mac_addrp != NULL) {
- uint8_t *addrp;
-
- addrp = MCDI_OUT2(req, uint8_t,
- GET_MAC_ADDRESSES_OUT_MAC_ADDR_BASE);
-
- EFX_MAC_ADDR_COPY(mac_addrp, addrp);
- }
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-efx_mcdi_get_mac_address_vf(
- __in efx_nic_t *enp,
- __out_ecount_opt(6) uint8_t mac_addrp[6])
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN,
- MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX)];
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_VPORT_GET_MAC_ADDRESSES;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX;
-
- MCDI_IN_SET_DWORD(req, VPORT_GET_MAC_ADDRESSES_IN_VPORT_ID,
- EVB_PORT_ID_ASSIGNED);
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used <
- MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMIN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- if (MCDI_OUT_DWORD(req,
- VPORT_GET_MAC_ADDRESSES_OUT_MACADDR_COUNT) < 1) {
- rc = ENOENT;
- goto fail3;
- }
-
- if (mac_addrp != NULL) {
- uint8_t *addrp;
-
- addrp = MCDI_OUT2(req, uint8_t,
- VPORT_GET_MAC_ADDRESSES_OUT_MACADDR);
-
- EFX_MAC_ADDR_COPY(mac_addrp, addrp);
- }
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-efx_mcdi_get_clock(
- __in efx_nic_t *enp,
- __out uint32_t *sys_freqp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_CLOCK_IN_LEN,
- MC_CMD_GET_CLOCK_OUT_LEN)];
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_CLOCK;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_CLOCK_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_CLOCK_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_CLOCK_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- *sys_freqp = MCDI_OUT_DWORD(req, GET_CLOCK_OUT_SYS_FREQ);
- if (*sys_freqp == 0) {
- rc = EINVAL;
- goto fail3;
- }
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-efx_mcdi_get_vector_cfg(
- __in efx_nic_t *enp,
- __out_opt uint32_t *vec_basep,
- __out_opt uint32_t *pf_nvecp,
- __out_opt uint32_t *vf_nvecp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_VECTOR_CFG_IN_LEN,
- MC_CMD_GET_VECTOR_CFG_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_VECTOR_CFG;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_VECTOR_CFG_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_VECTOR_CFG_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_VECTOR_CFG_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- if (vec_basep != NULL)
- *vec_basep = MCDI_OUT_DWORD(req, GET_VECTOR_CFG_OUT_VEC_BASE);
- if (pf_nvecp != NULL)
- *pf_nvecp = MCDI_OUT_DWORD(req, GET_VECTOR_CFG_OUT_VECS_PER_PF);
- if (vf_nvecp != NULL)
- *vf_nvecp = MCDI_OUT_DWORD(req, GET_VECTOR_CFG_OUT_VECS_PER_VF);
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-static __checkReturn efx_rc_t
-efx_mcdi_get_capabilities(
- __in efx_nic_t *enp,
- __out uint32_t *flagsp,
- __out uint32_t *flags2p)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN,
- MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_CAPABILITIES;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_CAPABILITIES_V2_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- *flagsp = MCDI_OUT_DWORD(req, GET_CAPABILITIES_OUT_FLAGS1);
-
- if (req.emr_out_length_used < MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)
- *flags2p = 0;
- else
- *flags2p = MCDI_OUT_DWORD(req, GET_CAPABILITIES_V2_OUT_FLAGS2);
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
-static __checkReturn efx_rc_t
-efx_mcdi_alloc_vis(
- __in efx_nic_t *enp,
- __in uint32_t min_vi_count,
- __in uint32_t max_vi_count,
- __out uint32_t *vi_basep,
- __out uint32_t *vi_countp,
- __out uint32_t *vi_shiftp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_ALLOC_VIS_IN_LEN,
- MC_CMD_ALLOC_VIS_OUT_LEN)];
- efx_rc_t rc;
-
- if (vi_countp == NULL) {
- rc = EINVAL;
- goto fail1;
- }
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_ALLOC_VIS;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_ALLOC_VIS_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_ALLOC_VIS_OUT_LEN;
-
- MCDI_IN_SET_DWORD(req, ALLOC_VIS_IN_MIN_VI_COUNT, min_vi_count);
- MCDI_IN_SET_DWORD(req, ALLOC_VIS_IN_MAX_VI_COUNT, max_vi_count);
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail2;
- }
-
- if (req.emr_out_length_used < MC_CMD_ALLOC_VIS_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail3;
- }
-
- *vi_basep = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_BASE);
- *vi_countp = MCDI_OUT_DWORD(req, ALLOC_VIS_OUT_VI_COUNT);
-
- /* Report VI_SHIFT if available (always zero for Huntington) */
- if (req.emr_out_length_used < MC_CMD_ALLOC_VIS_EXT_OUT_LEN)
- *vi_shiftp = 0;
- else
- *vi_shiftp = MCDI_OUT_DWORD(req, ALLOC_VIS_EXT_OUT_VI_SHIFT);
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
-static __checkReturn efx_rc_t
-efx_mcdi_free_vis(
- __in efx_nic_t *enp)
-{
- efx_mcdi_req_t req;
- efx_rc_t rc;
-
- EFX_STATIC_ASSERT(MC_CMD_FREE_VIS_IN_LEN == 0);
- EFX_STATIC_ASSERT(MC_CMD_FREE_VIS_OUT_LEN == 0);
-
- req.emr_cmd = MC_CMD_FREE_VIS;
- req.emr_in_buf = NULL;
- req.emr_in_length = 0;
- req.emr_out_buf = NULL;
- req.emr_out_length = 0;
-
- efx_mcdi_execute_quiet(enp, &req);
-
- /* Ignore ELREADY (no allocated VIs, so nothing to free) */
- if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
-static __checkReturn efx_rc_t
-efx_mcdi_alloc_piobuf(
- __in efx_nic_t *enp,
- __out efx_piobuf_handle_t *handlep)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_ALLOC_PIOBUF_IN_LEN,
- MC_CMD_ALLOC_PIOBUF_OUT_LEN)];
- efx_rc_t rc;
-
- if (handlep == NULL) {
- rc = EINVAL;
- goto fail1;
- }
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_ALLOC_PIOBUF;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_ALLOC_PIOBUF_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_ALLOC_PIOBUF_OUT_LEN;
-
- efx_mcdi_execute_quiet(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail2;
- }
-
- if (req.emr_out_length_used < MC_CMD_ALLOC_PIOBUF_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail3;
- }
-
- *handlep = MCDI_OUT_DWORD(req, ALLOC_PIOBUF_OUT_PIOBUF_HANDLE);
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-static __checkReturn efx_rc_t
-efx_mcdi_free_piobuf(
- __in efx_nic_t *enp,
- __in efx_piobuf_handle_t handle)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_FREE_PIOBUF_IN_LEN,
- MC_CMD_FREE_PIOBUF_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_FREE_PIOBUF;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_FREE_PIOBUF_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_FREE_PIOBUF_OUT_LEN;
-
- MCDI_IN_SET_DWORD(req, FREE_PIOBUF_IN_PIOBUF_HANDLE, handle);
-
- efx_mcdi_execute_quiet(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-static __checkReturn efx_rc_t
-efx_mcdi_link_piobuf(
- __in efx_nic_t *enp,
- __in uint32_t vi_index,
- __in efx_piobuf_handle_t handle)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_LINK_PIOBUF_IN_LEN,
- MC_CMD_LINK_PIOBUF_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_LINK_PIOBUF;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_LINK_PIOBUF_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_LINK_PIOBUF_OUT_LEN;
-
- MCDI_IN_SET_DWORD(req, LINK_PIOBUF_IN_PIOBUF_HANDLE, handle);
- MCDI_IN_SET_DWORD(req, LINK_PIOBUF_IN_TXQ_INSTANCE, vi_index);
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-static __checkReturn efx_rc_t
-efx_mcdi_unlink_piobuf(
- __in efx_nic_t *enp,
- __in uint32_t vi_index)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_UNLINK_PIOBUF_IN_LEN,
- MC_CMD_UNLINK_PIOBUF_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_UNLINK_PIOBUF;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_UNLINK_PIOBUF_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_UNLINK_PIOBUF_OUT_LEN;
-
- MCDI_IN_SET_DWORD(req, UNLINK_PIOBUF_IN_TXQ_INSTANCE, vi_index);
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
+ if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, NULL)) != 0) {
+ /* No port mode info available */
+ bandwidth = 0;
+ goto out;
}
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-static void
-ef10_nic_alloc_piobufs(
- __in efx_nic_t *enp,
- __in uint32_t max_piobuf_count)
-{
- efx_piobuf_handle_t *handlep;
- unsigned int i;
- efx_rc_t rc;
-
- EFSYS_ASSERT3U(max_piobuf_count, <=,
- EFX_ARRAY_SIZE(enp->en_arch.ef10.ena_piobuf_handle));
-
- enp->en_arch.ef10.ena_piobuf_count = 0;
-
- for (i = 0; i < max_piobuf_count; i++) {
- handlep = &enp->en_arch.ef10.ena_piobuf_handle[i];
-
- if ((rc = efx_mcdi_alloc_piobuf(enp, handlep)) != 0)
+ if (port_modes & (1 << TLV_PORT_MODE_40G_40G)) {
+ /*
+ * This needs the full PCIe bandwidth (and could use
+ * more) - roughly 64 Gbit/s for 8 lanes of Gen3.
+ */
+ if ((rc = efx_nic_calculate_pcie_link_bandwidth(8,
+ EFX_PCIE_LINK_SPEED_GEN3, &bandwidth)) != 0)
goto fail1;
-
- enp->en_arch.ef10.ena_pio_alloc_map[i] = 0;
- enp->en_arch.ef10.ena_piobuf_count++;
- }
-
- return;
-
-fail1:
- for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
- handlep = &enp->en_arch.ef10.ena_piobuf_handle[i];
-
- efx_mcdi_free_piobuf(enp, *handlep);
- *handlep = EFX_PIOBUF_HANDLE_INVALID;
- }
- enp->en_arch.ef10.ena_piobuf_count = 0;
-}
-
-
-static void
-ef10_nic_free_piobufs(
- __in efx_nic_t *enp)
-{
- efx_piobuf_handle_t *handlep;
- unsigned int i;
-
- for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
- handlep = &enp->en_arch.ef10.ena_piobuf_handle[i];
-
- efx_mcdi_free_piobuf(enp, *handlep);
- *handlep = EFX_PIOBUF_HANDLE_INVALID;
- }
- enp->en_arch.ef10.ena_piobuf_count = 0;
-}
-
-/* Sub-allocate a block from a piobuf */
- __checkReturn efx_rc_t
-ef10_nic_pio_alloc(
- __inout efx_nic_t *enp,
- __out uint32_t *bufnump,
- __out efx_piobuf_handle_t *handlep,
- __out uint32_t *blknump,
- __out uint32_t *offsetp,
- __out size_t *sizep)
-{
- efx_nic_cfg_t *encp = &enp->en_nic_cfg;
- efx_drv_cfg_t *edcp = &enp->en_drv_cfg;
- uint32_t blk_per_buf;
- uint32_t buf, blk;
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
- EFSYS_ASSERT(bufnump);
- EFSYS_ASSERT(handlep);
- EFSYS_ASSERT(blknump);
- EFSYS_ASSERT(offsetp);
- EFSYS_ASSERT(sizep);
-
- if ((edcp->edc_pio_alloc_size == 0) ||
- (enp->en_arch.ef10.ena_piobuf_count == 0)) {
- rc = ENOMEM;
- goto fail1;
- }
- blk_per_buf = encp->enc_piobuf_size / edcp->edc_pio_alloc_size;
-
- for (buf = 0; buf < enp->en_arch.ef10.ena_piobuf_count; buf++) {
- uint32_t *map = &enp->en_arch.ef10.ena_pio_alloc_map[buf];
-
- if (~(*map) == 0)
- continue;
-
- EFSYS_ASSERT3U(blk_per_buf, <=, (8 * sizeof (*map)));
- for (blk = 0; blk < blk_per_buf; blk++) {
- if ((*map & (1u << blk)) == 0) {
- *map |= (1u << blk);
- goto done;
- }
+ } else {
+ if (port_modes & (1 << TLV_PORT_MODE_40G)) {
+ max_port_mode = TLV_PORT_MODE_40G;
+ } else if (port_modes & (1 << TLV_PORT_MODE_10G_10G_10G_10G)) {
+ max_port_mode = TLV_PORT_MODE_10G_10G_10G_10G;
+ } else {
+ /* Assume two 10G ports */
+ max_port_mode = TLV_PORT_MODE_10G_10G;
}
- }
- rc = ENOMEM;
- goto fail2;
-
-done:
- *handlep = enp->en_arch.ef10.ena_piobuf_handle[buf];
- *bufnump = buf;
- *blknump = blk;
- *sizep = edcp->edc_pio_alloc_size;
- *offsetp = blk * (*sizep);
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-/* Free a piobuf sub-allocated block */
- __checkReturn efx_rc_t
-ef10_nic_pio_free(
- __inout efx_nic_t *enp,
- __in uint32_t bufnum,
- __in uint32_t blknum)
-{
- uint32_t *map;
- efx_rc_t rc;
-
- if ((bufnum >= enp->en_arch.ef10.ena_piobuf_count) ||
- (blknum >= (8 * sizeof (*map)))) {
- rc = EINVAL;
- goto fail1;
- }
-
- map = &enp->en_arch.ef10.ena_pio_alloc_map[bufnum];
- if ((*map & (1u << blknum)) == 0) {
- rc = ENOENT;
- goto fail2;
- }
- *map &= ~(1u << blknum);
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_nic_pio_link(
- __inout efx_nic_t *enp,
- __in uint32_t vi_index,
- __in efx_piobuf_handle_t handle)
-{
- return (efx_mcdi_link_piobuf(enp, vi_index, handle));
-}
-
- __checkReturn efx_rc_t
-ef10_nic_pio_unlink(
- __inout efx_nic_t *enp,
- __in uint32_t vi_index)
-{
- return (efx_mcdi_unlink_piobuf(enp, vi_index));
-}
- __checkReturn efx_rc_t
-ef10_get_datapath_caps(
- __in efx_nic_t *enp)
-{
- efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- uint32_t flags;
- uint32_t flags2;
- efx_rc_t rc;
-
- if ((rc = efx_mcdi_get_capabilities(enp, &flags, &flags2)) != 0)
- goto fail1;
-
-#define CAP_FLAG(flags1, field) \
- ((flags1) & (1 << (MC_CMD_GET_CAPABILITIES_V2_OUT_ ## field ## _LBN)))
-
-#define CAP_FLAG2(flags2, field) \
- ((flags2) & (1 << (MC_CMD_GET_CAPABILITIES_V2_OUT_ ## field ## _LBN)))
-
- /*
- * Huntington RXDP firmware inserts a 0 or 14 byte prefix.
- * We only support the 14 byte prefix here.
- */
- if (CAP_FLAG(flags, RX_PREFIX_LEN_14) == 0) {
- rc = ENOTSUP;
- goto fail2;
+ if ((rc = ef10_nic_get_port_mode_bandwidth(max_port_mode,
+ &bandwidth)) != 0)
+ goto fail2;
}
- encp->enc_rx_prefix_size = 14;
-
- /* Check if the firmware supports TSO */
- encp->enc_fw_assisted_tso_enabled =
- CAP_FLAG(flags, TX_TSO) ? B_TRUE : B_FALSE;
-
- /* Check if the firmware supports FATSOv2 */
- encp->enc_fw_assisted_tso_v2_enabled =
- CAP_FLAG2(flags2, TX_TSO_V2) ? B_TRUE : B_FALSE;
-
- /* Check if the firmware has vadapter/vport/vswitch support */
- encp->enc_datapath_cap_evb =
- CAP_FLAG(flags, EVB) ? B_TRUE : B_FALSE;
-
- /* Check if the firmware supports VLAN insertion */
- encp->enc_hw_tx_insert_vlan_enabled =
- CAP_FLAG(flags, TX_VLAN_INSERTION) ? B_TRUE : B_FALSE;
-
- /* Check if the firmware supports RX event batching */
- encp->enc_rx_batching_enabled =
- CAP_FLAG(flags, RX_BATCHING) ? B_TRUE : B_FALSE;
-
- if (encp->enc_rx_batching_enabled)
- encp->enc_rx_batch_max = 16;
-
- /* Check if the firmware supports disabling scatter on RXQs */
- encp->enc_rx_disable_scatter_supported =
- CAP_FLAG(flags, RX_DISABLE_SCATTER) ? B_TRUE : B_FALSE;
-
- /* Check if the firmware supports set mac with running filters */
- encp->enc_allow_set_mac_with_installed_filters =
- CAP_FLAG(flags, VADAPTOR_PERMIT_SET_MAC_WHEN_FILTERS_INSTALLED) ?
- B_TRUE : B_FALSE;
-
- /*
- * Check if firmware supports the extended MC_CMD_SET_MAC, which allows
- * specifying which parameters to configure.
- */
- encp->enc_enhanced_set_mac_supported =
- CAP_FLAG(flags, SET_MAC_ENHANCED) ? B_TRUE : B_FALSE;
-#undef CAP_FLAG
-#undef CAP_FLAG2
+out:
+ *bandwidth_mbpsp = bandwidth;
return (0);
@@ -971,150 +99,6 @@ fail1:
return (rc);
}
-
- __checkReturn efx_rc_t
-ef10_get_privilege_mask(
- __in efx_nic_t *enp,
- __out uint32_t *maskp)
-{
- efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- uint32_t mask;
- efx_rc_t rc;
-
- if ((rc = efx_mcdi_privilege_mask(enp, encp->enc_pf, encp->enc_vf,
- &mask)) != 0) {
- if (rc != ENOTSUP)
- goto fail1;
-
- /* Fallback for old firmware without privilege mask support */
- if (EFX_PCI_FUNCTION_IS_PF(encp)) {
- /* Assume PF has admin privilege */
- mask = EF10_LEGACY_PF_PRIVILEGE_MASK;
- } else {
- /* VF is always unprivileged by default */
- mask = EF10_LEGACY_VF_PRIVILEGE_MASK;
- }
- }
-
- *maskp = mask;
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
-/*
- * The external port mapping is a one-based numbering of the external
- * connectors on the board. It does not distinguish off-board separated
- * outputs such as multi-headed cables.
- * The number of ports that map to each external port connector
- * on the board is determined by the chip family and the port modes to
- * which the NIC can be configured. The mapping table lists modes with
- * port numbering requirements in increasing order.
- */
-static struct {
- efx_family_t family;
- uint32_t modes_mask;
- uint32_t stride;
-} __ef10_external_port_mappings[] = {
- /* Supported modes requiring 1 output per port */
- {
- EFX_FAMILY_HUNTINGTON,
- (1 << TLV_PORT_MODE_10G) |
- (1 << TLV_PORT_MODE_10G_10G) |
- (1 << TLV_PORT_MODE_10G_10G_10G_10G),
- 1
- },
- {
- EFX_FAMILY_MEDFORD,
- (1 << TLV_PORT_MODE_10G) |
- (1 << TLV_PORT_MODE_10G_10G) |
- (1 << TLV_PORT_MODE_10G_10G_10G_10G),
- 1
- },
- /* Supported modes requiring 2 outputs per port */
- {
- EFX_FAMILY_HUNTINGTON,
- (1 << TLV_PORT_MODE_40G) |
- (1 << TLV_PORT_MODE_40G_40G) |
- (1 << TLV_PORT_MODE_40G_10G_10G) |
- (1 << TLV_PORT_MODE_10G_10G_40G),
- 2
- },
- {
- EFX_FAMILY_MEDFORD,
- (1 << TLV_PORT_MODE_40G) |
- (1 << TLV_PORT_MODE_40G_40G) |
- (1 << TLV_PORT_MODE_40G_10G_10G) |
- (1 << TLV_PORT_MODE_10G_10G_40G),
- 2
- },
- /* Supported modes requiring 4 outputs per port */
- {
- EFX_FAMILY_MEDFORD,
- (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q) |
- (1 << TLV_PORT_MODE_10G_10G_10G_10G_Q2),
- 4
- },
-};
-
- __checkReturn efx_rc_t
-ef10_external_port_mapping(
- __in efx_nic_t *enp,
- __in uint32_t port,
- __out uint8_t *external_portp)
-{
- efx_rc_t rc;
- int i;
- uint32_t port_modes;
- uint32_t matches;
- uint32_t stride = 1; /* default 1-1 mapping */
-
- if ((rc = efx_mcdi_get_port_modes(enp, &port_modes)) != 0) {
- /* No port mode information available - use default mapping */
- goto out;
- }
-
- /*
- * Infer the internal port -> external port mapping from
- * the possible port modes for this NIC.
- */
- for (i = 0; i < EFX_ARRAY_SIZE(__ef10_external_port_mappings); ++i) {
- if (__ef10_external_port_mappings[i].family !=
- enp->en_family)
- continue;
- matches = (__ef10_external_port_mappings[i].modes_mask &
- port_modes);
- if (matches != 0) {
- stride = __ef10_external_port_mappings[i].stride;
- port_modes &= ~matches;
- }
- }
-
- if (port_modes != 0) {
- /* Some advertised modes are not supported */
- rc = ENOTSUP;
- goto fail1;
- }
-
-out:
- /*
- * Scale as required by last matched mode and then convert to
- * one-based numbering
- */
- *external_portp = (uint8_t)(port / stride) + 1;
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
__checkReturn efx_rc_t
hunt_board_cfg(
__in efx_nic_t *enp)
@@ -1130,8 +114,9 @@ hunt_board_cfg(
uint32_t vf;
uint32_t mask;
uint32_t flags;
- uint32_t sysclk;
+ uint32_t sysclk, dpcpu_clk;
uint32_t base, nvec;
+ uint32_t bandwidth;
efx_rc_t rc;
if ((rc = efx_mcdi_get_port_assignment(enp, &port)) != 0)
@@ -1289,13 +274,13 @@ hunt_board_cfg(
goto fail10;
}
- /* Get sysclk frequency (in MHz). */
- if ((rc = efx_mcdi_get_clock(enp, &sysclk)) != 0)
+ /* Get clock frequencies (in MHz). */
+ if ((rc = efx_mcdi_get_clock(enp, &sysclk, &dpcpu_clk)) != 0)
goto fail11;
/*
- * The timer quantum is 1536 sysclk cycles, documented for the
- * EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
+ * The Huntington timer quantum is 1536 sysclk cycles, documented for
+ * the EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
*/
encp->enc_evq_timer_quantum_ns = 1536000UL / sysclk; /* 1536 cycles */
if (encp->enc_bug35388_workaround) {
@@ -1361,8 +346,17 @@ hunt_board_cfg(
*/
encp->enc_tx_tso_tcp_header_offset_limit = EF10_TCP_HEADER_OFFSET_LIMIT;
+ if ((rc = hunt_nic_get_required_pcie_bandwidth(enp, &bandwidth)) != 0)
+ goto fail15;
+ encp->enc_required_pcie_bandwidth_mbps = bandwidth;
+
+ /* All Huntington devices have a PCIe Gen3, 8 lane connector */
+ encp->enc_max_pcie_link_gen = EFX_PCIE_LINK_SPEED_GEN3;
+
return (0);
+fail15:
+ EFSYS_PROBE(fail15);
fail14:
EFSYS_PROBE(fail14);
fail13:
@@ -1396,502 +390,4 @@ fail1:
}
- __checkReturn efx_rc_t
-ef10_nic_probe(
- __in efx_nic_t *enp)
-{
- efx_nic_ops_t *enop = enp->en_enop;
- efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- /* Read and clear any assertion state */
- if ((rc = efx_mcdi_read_assertion(enp)) != 0)
- goto fail1;
-
- /* Exit the assertion handler */
- if ((rc = efx_mcdi_exit_assertion_handler(enp)) != 0)
- if (rc != EACCES)
- goto fail2;
-
- if ((rc = efx_mcdi_drv_attach(enp, B_TRUE)) != 0)
- goto fail3;
-
- if ((rc = enop->eno_board_cfg(enp)) != 0)
- if (rc != EACCES)
- goto fail4;
-
- /*
- * Set default driver config limits (based on board config).
- *
- * FIXME: For now allocate a fixed number of VIs which is likely to be
- * sufficient and small enough to allow multiple functions on the same
- * port.
- */
- edcp->edc_min_vi_count = edcp->edc_max_vi_count =
- MIN(128, MAX(encp->enc_rxq_limit, encp->enc_txq_limit));
-
- /* The client driver must configure and enable PIO buffer support */
- edcp->edc_max_piobuf_count = 0;
- edcp->edc_pio_alloc_size = 0;
-
-#if EFSYS_OPT_MAC_STATS
- /* Wipe the MAC statistics */
- if ((rc = efx_mcdi_mac_stats_clear(enp)) != 0)
- goto fail5;
-#endif
-
-#if EFSYS_OPT_LOOPBACK
- if ((rc = efx_mcdi_get_loopback_modes(enp)) != 0)
- goto fail6;
-#endif
-
-#if EFSYS_OPT_MON_STATS
- if ((rc = mcdi_mon_cfg_build(enp)) != 0) {
- /* Unprivileged functions do not have access to sensors */
- if (rc != EACCES)
- goto fail7;
- }
-#endif
-
- encp->enc_features = enp->en_features;
-
- return (0);
-
-#if EFSYS_OPT_MON_STATS
-fail7:
- EFSYS_PROBE(fail7);
-#endif
-#if EFSYS_OPT_LOOPBACK
-fail6:
- EFSYS_PROBE(fail6);
-#endif
-#if EFSYS_OPT_MAC_STATS
-fail5:
- EFSYS_PROBE(fail5);
-#endif
-fail4:
- EFSYS_PROBE(fail4);
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_nic_set_drv_limits(
- __inout efx_nic_t *enp,
- __in efx_drv_limits_t *edlp)
-{
- efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
- uint32_t min_evq_count, max_evq_count;
- uint32_t min_rxq_count, max_rxq_count;
- uint32_t min_txq_count, max_txq_count;
- efx_rc_t rc;
-
- if (edlp == NULL) {
- rc = EINVAL;
- goto fail1;
- }
-
- /* Get minimum required and maximum usable VI limits */
- min_evq_count = MIN(edlp->edl_min_evq_count, encp->enc_evq_limit);
- min_rxq_count = MIN(edlp->edl_min_rxq_count, encp->enc_rxq_limit);
- min_txq_count = MIN(edlp->edl_min_txq_count, encp->enc_txq_limit);
-
- edcp->edc_min_vi_count =
- MAX(min_evq_count, MAX(min_rxq_count, min_txq_count));
-
- max_evq_count = MIN(edlp->edl_max_evq_count, encp->enc_evq_limit);
- max_rxq_count = MIN(edlp->edl_max_rxq_count, encp->enc_rxq_limit);
- max_txq_count = MIN(edlp->edl_max_txq_count, encp->enc_txq_limit);
-
- edcp->edc_max_vi_count =
- MAX(max_evq_count, MAX(max_rxq_count, max_txq_count));
-
- /*
- * Check limits for sub-allocated piobuf blocks.
- * PIO is optional, so don't fail if the limits are incorrect.
- */
- if ((encp->enc_piobuf_size == 0) ||
- (encp->enc_piobuf_limit == 0) ||
- (edlp->edl_min_pio_alloc_size == 0) ||
- (edlp->edl_min_pio_alloc_size > encp->enc_piobuf_size)) {
- /* Disable PIO */
- edcp->edc_max_piobuf_count = 0;
- edcp->edc_pio_alloc_size = 0;
- } else {
- uint32_t blk_size, blk_count, blks_per_piobuf;
-
- blk_size =
- MAX(edlp->edl_min_pio_alloc_size,
- encp->enc_piobuf_min_alloc_size);
-
- blks_per_piobuf = encp->enc_piobuf_size / blk_size;
- EFSYS_ASSERT3U(blks_per_piobuf, <=, 32);
-
- blk_count = (encp->enc_piobuf_limit * blks_per_piobuf);
-
- /* A zero max pio alloc count means unlimited */
- if ((edlp->edl_max_pio_alloc_count > 0) &&
- (edlp->edl_max_pio_alloc_count < blk_count)) {
- blk_count = edlp->edl_max_pio_alloc_count;
- }
-
- edcp->edc_pio_alloc_size = blk_size;
- edcp->edc_max_piobuf_count =
- (blk_count + (blks_per_piobuf - 1)) / blks_per_piobuf;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-
- __checkReturn efx_rc_t
-ef10_nic_reset(
- __in efx_nic_t *enp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_ENTITY_RESET_IN_LEN,
- MC_CMD_ENTITY_RESET_OUT_LEN)];
- efx_rc_t rc;
-
- /* ef10_nic_reset() is called to recover from BADASSERT failures. */
- if ((rc = efx_mcdi_read_assertion(enp)) != 0)
- goto fail1;
- if ((rc = efx_mcdi_exit_assertion_handler(enp)) != 0)
- goto fail2;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_ENTITY_RESET;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_ENTITY_RESET_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_ENTITY_RESET_OUT_LEN;
-
- MCDI_IN_POPULATE_DWORD_1(req, ENTITY_RESET_IN_FLAG,
- ENTITY_RESET_IN_FUNCTION_RESOURCE_RESET, 1);
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail3;
- }
-
- /* Clear RX/TX DMA queue errors */
- enp->en_reset_flags &= ~(EFX_RESET_RXQ_ERR | EFX_RESET_TXQ_ERR);
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_nic_init(
- __in efx_nic_t *enp)
-{
- efx_drv_cfg_t *edcp = &(enp->en_drv_cfg);
- uint32_t min_vi_count, max_vi_count;
- uint32_t vi_count, vi_base, vi_shift;
- uint32_t i;
- uint32_t retry;
- uint32_t delay_us;
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- /* Enable reporting of some events (e.g. link change) */
- if ((rc = efx_mcdi_log_ctrl(enp)) != 0)
- goto fail1;
-
- /* Allocate (optional) on-chip PIO buffers */
- ef10_nic_alloc_piobufs(enp, edcp->edc_max_piobuf_count);
-
- /*
- * For best performance, PIO writes should use a write-combined
- * (WC) memory mapping. Using a separate WC mapping for the PIO
- * aperture of each VI would be a burden to drivers (and not
- * possible if the host page size is >4Kbyte).
- *
- * To avoid this we use a single uncached (UC) mapping for VI
- * register access, and a single WC mapping for extra VIs used
- * for PIO writes.
- *
- * Each piobuf must be linked to a VI in the WC mapping, and to
- * each VI that is using a sub-allocated block from the piobuf.
- */
- min_vi_count = edcp->edc_min_vi_count;
- max_vi_count =
- edcp->edc_max_vi_count + enp->en_arch.ef10.ena_piobuf_count;
-
- /* Ensure that the previously attached driver's VIs are freed */
- if ((rc = efx_mcdi_free_vis(enp)) != 0)
- goto fail2;
-
- /*
- * Reserve VI resources (EVQ+RXQ+TXQ) for this PCIe function. If this
- * fails then retrying the request for fewer VI resources may succeed.
- */
- vi_count = 0;
- if ((rc = efx_mcdi_alloc_vis(enp, min_vi_count, max_vi_count,
- &vi_base, &vi_count, &vi_shift)) != 0)
- goto fail3;
-
- EFSYS_PROBE2(vi_alloc, uint32_t, vi_base, uint32_t, vi_count);
-
- if (vi_count < min_vi_count) {
- rc = ENOMEM;
- goto fail4;
- }
-
- enp->en_arch.ef10.ena_vi_base = vi_base;
- enp->en_arch.ef10.ena_vi_count = vi_count;
- enp->en_arch.ef10.ena_vi_shift = vi_shift;
-
- if (vi_count < min_vi_count + enp->en_arch.ef10.ena_piobuf_count) {
- /* Not enough extra VIs to map piobufs */
- ef10_nic_free_piobufs(enp);
- }
-
- enp->en_arch.ef10.ena_pio_write_vi_base =
- vi_count - enp->en_arch.ef10.ena_piobuf_count;
-
- /* Save UC memory mapping details */
- enp->en_arch.ef10.ena_uc_mem_map_offset = 0;
- if (enp->en_arch.ef10.ena_piobuf_count > 0) {
- enp->en_arch.ef10.ena_uc_mem_map_size =
- (ER_DZ_TX_PIOBUF_STEP *
- enp->en_arch.ef10.ena_pio_write_vi_base);
- } else {
- enp->en_arch.ef10.ena_uc_mem_map_size =
- (ER_DZ_TX_PIOBUF_STEP *
- enp->en_arch.ef10.ena_vi_count);
- }
-
- /* Save WC memory mapping details */
- enp->en_arch.ef10.ena_wc_mem_map_offset =
- enp->en_arch.ef10.ena_uc_mem_map_offset +
- enp->en_arch.ef10.ena_uc_mem_map_size;
-
- enp->en_arch.ef10.ena_wc_mem_map_size =
- (ER_DZ_TX_PIOBUF_STEP *
- enp->en_arch.ef10.ena_piobuf_count);
-
- /* Link piobufs to extra VIs in WC mapping */
- if (enp->en_arch.ef10.ena_piobuf_count > 0) {
- for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
- rc = efx_mcdi_link_piobuf(enp,
- enp->en_arch.ef10.ena_pio_write_vi_base + i,
- enp->en_arch.ef10.ena_piobuf_handle[i]);
- if (rc != 0)
- break;
- }
- }
-
- /*
- * Allocate a vAdaptor attached to our upstream vPort/pPort.
- *
- * On a VF, this may fail with MC_CMD_ERR_NO_EVB_PORT (ENOENT) if the PF
- * driver has yet to bring up the EVB port. See bug 56147. In this case,
- * retry the request several times after waiting a while. The wait time
- * between retries starts small (10ms) and exponentially increases.
- * Total wait time is a little over two seconds. Retry logic in the
- * client driver may mean this whole loop is repeated if it continues to
- * fail.
- */
- retry = 0;
- delay_us = 10000;
- while ((rc = efx_mcdi_vadaptor_alloc(enp, EVB_PORT_ID_ASSIGNED)) != 0) {
- if (EFX_PCI_FUNCTION_IS_PF(&enp->en_nic_cfg) ||
- (rc != ENOENT)) {
- /*
- * Do not retry alloc for PF, or for other errors on
- * a VF.
- */
- goto fail5;
- }
-
- /* VF startup before PF is ready. Retry allocation. */
- if (retry > 5) {
- /* Too many attempts */
- rc = EINVAL;
- goto fail6;
- }
- EFSYS_PROBE1(mcdi_no_evb_port_retry, int, retry);
- EFSYS_SLEEP(delay_us);
- retry++;
- if (delay_us < 500000)
- delay_us <<= 2;
- }
-
- enp->en_vport_id = EVB_PORT_ID_ASSIGNED;
- enp->en_nic_cfg.enc_mcdi_max_payload_length = MCDI_CTL_SDU_LEN_MAX_V2;
-
- return (0);
-
-fail6:
- EFSYS_PROBE(fail6);
-fail5:
- EFSYS_PROBE(fail5);
-fail4:
- EFSYS_PROBE(fail4);
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-
- ef10_nic_free_piobufs(enp);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_nic_get_vi_pool(
- __in efx_nic_t *enp,
- __out uint32_t *vi_countp)
-{
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- /*
- * Report VIs that the client driver can use.
- * Do not include VIs used for PIO buffer writes.
- */
- *vi_countp = enp->en_arch.ef10.ena_pio_write_vi_base;
-
- return (0);
-}
-
- __checkReturn efx_rc_t
-ef10_nic_get_bar_region(
- __in efx_nic_t *enp,
- __in efx_nic_region_t region,
- __out uint32_t *offsetp,
- __out size_t *sizep)
-{
- efx_rc_t rc;
-
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
- enp->en_family == EFX_FAMILY_MEDFORD);
-
- /*
- * TODO: Specify host memory mapping alignment and granularity
- * in efx_drv_limits_t so that they can be taken into account
- * when allocating extra VIs for PIO writes.
- */
- switch (region) {
- case EFX_REGION_VI:
- /* UC mapped memory BAR region for VI registers */
- *offsetp = enp->en_arch.ef10.ena_uc_mem_map_offset;
- *sizep = enp->en_arch.ef10.ena_uc_mem_map_size;
- break;
-
- case EFX_REGION_PIO_WRITE_VI:
- /* WC mapped memory BAR region for piobuf writes */
- *offsetp = enp->en_arch.ef10.ena_wc_mem_map_offset;
- *sizep = enp->en_arch.ef10.ena_wc_mem_map_size;
- break;
-
- default:
- rc = EINVAL;
- goto fail1;
- }
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- void
-ef10_nic_fini(
- __in efx_nic_t *enp)
-{
- uint32_t i;
- efx_rc_t rc;
-
- (void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
- enp->en_vport_id = 0;
-
- /* Unlink piobufs from extra VIs in WC mapping */
- if (enp->en_arch.ef10.ena_piobuf_count > 0) {
- for (i = 0; i < enp->en_arch.ef10.ena_piobuf_count; i++) {
- rc = efx_mcdi_unlink_piobuf(enp,
- enp->en_arch.ef10.ena_pio_write_vi_base + i);
- if (rc != 0)
- break;
- }
- }
-
- ef10_nic_free_piobufs(enp);
-
- (void) efx_mcdi_free_vis(enp);
- enp->en_arch.ef10.ena_vi_count = 0;
-}
-
- void
-ef10_nic_unprobe(
- __in efx_nic_t *enp)
-{
-#if EFSYS_OPT_MON_STATS
- mcdi_mon_cfg_free(enp);
-#endif /* EFSYS_OPT_MON_STATS */
- (void) efx_mcdi_drv_attach(enp, B_FALSE);
-}
-
-#if EFSYS_OPT_DIAG
-
- __checkReturn efx_rc_t
-ef10_nic_register_test(
- __in efx_nic_t *enp)
-{
- efx_rc_t rc;
-
- /* FIXME */
- _NOTE(ARGUNUSED(enp))
- if (B_FALSE) {
- rc = ENOTSUP;
- goto fail1;
- }
- /* FIXME */
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-#endif /* EFSYS_OPT_DIAG */
-
-
-
#endif /* EFSYS_OPT_HUNTINGTON */
diff --git a/sys/dev/sfxge/common/hunt_phy.c b/sys/dev/sfxge/common/hunt_phy.c
index a6b7faa..63e6011 100644
--- a/sys/dev/sfxge/common/hunt_phy.c
+++ b/sys/dev/sfxge/common/hunt_phy.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,485 +36,6 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_HUNTINGTON
-static void
-mcdi_phy_decode_cap(
- __in uint32_t mcdi_cap,
- __out uint32_t *maskp)
-{
- uint32_t mask;
-
- mask = 0;
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
- mask |= (1 << EFX_PHY_CAP_10HDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10FDX_LBN))
- mask |= (1 << EFX_PHY_CAP_10FDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100HDX_LBN))
- mask |= (1 << EFX_PHY_CAP_100HDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100FDX_LBN))
- mask |= (1 << EFX_PHY_CAP_100FDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000HDX_LBN))
- mask |= (1 << EFX_PHY_CAP_1000HDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
- mask |= (1 << EFX_PHY_CAP_1000FDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
- mask |= (1 << EFX_PHY_CAP_10000FDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN))
- mask |= (1 << EFX_PHY_CAP_40000FDX);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
- mask |= (1 << EFX_PHY_CAP_PAUSE);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
- mask |= (1 << EFX_PHY_CAP_ASYM);
- if (mcdi_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
- mask |= (1 << EFX_PHY_CAP_AN);
-
- *maskp = mask;
-}
-
-static void
-mcdi_phy_decode_link_mode(
- __in efx_nic_t *enp,
- __in uint32_t link_flags,
- __in unsigned int speed,
- __in unsigned int fcntl,
- __out efx_link_mode_t *link_modep,
- __out unsigned int *fcntlp)
-{
- boolean_t fd = !!(link_flags &
- (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN));
- boolean_t up = !!(link_flags &
- (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN));
-
- _NOTE(ARGUNUSED(enp))
-
- if (!up)
- *link_modep = EFX_LINK_DOWN;
- else if (speed == 40000 && fd)
- *link_modep = EFX_LINK_40000FDX;
- else if (speed == 10000 && fd)
- *link_modep = EFX_LINK_10000FDX;
- else if (speed == 1000)
- *link_modep = fd ? EFX_LINK_1000FDX : EFX_LINK_1000HDX;
- else if (speed == 100)
- *link_modep = fd ? EFX_LINK_100FDX : EFX_LINK_100HDX;
- else if (speed == 10)
- *link_modep = fd ? EFX_LINK_10FDX : EFX_LINK_10HDX;
- else
- *link_modep = EFX_LINK_UNKNOWN;
-
- if (fcntl == MC_CMD_FCNTL_OFF)
- *fcntlp = 0;
- else if (fcntl == MC_CMD_FCNTL_RESPOND)
- *fcntlp = EFX_FCNTL_RESPOND;
- else if (fcntl == MC_CMD_FCNTL_GENERATE)
- *fcntlp = EFX_FCNTL_GENERATE;
- else if (fcntl == MC_CMD_FCNTL_BIDIR)
- *fcntlp = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE;
- else {
- EFSYS_PROBE1(mc_pcol_error, int, fcntl);
- *fcntlp = 0;
- }
-}
-
-
- void
-ef10_phy_link_ev(
- __in efx_nic_t *enp,
- __in efx_qword_t *eqp,
- __out efx_link_mode_t *link_modep)
-{
- efx_port_t *epp = &(enp->en_port);
- unsigned int link_flags;
- unsigned int speed;
- unsigned int fcntl;
- efx_link_mode_t link_mode;
- uint32_t lp_cap_mask;
-
- /*
- * Convert the LINKCHANGE speed enumeration into mbit/s, in the
- * same way as GET_LINK encodes the speed
- */
- switch (MCDI_EV_FIELD(eqp, LINKCHANGE_SPEED)) {
- case MCDI_EVENT_LINKCHANGE_SPEED_100M:
- speed = 100;
- break;
- case MCDI_EVENT_LINKCHANGE_SPEED_1G:
- speed = 1000;
- break;
- case MCDI_EVENT_LINKCHANGE_SPEED_10G:
- speed = 10000;
- break;
- case MCDI_EVENT_LINKCHANGE_SPEED_40G:
- speed = 40000;
- break;
- default:
- speed = 0;
- break;
- }
-
- link_flags = MCDI_EV_FIELD(eqp, LINKCHANGE_LINK_FLAGS);
- mcdi_phy_decode_link_mode(enp, link_flags, speed,
- MCDI_EV_FIELD(eqp, LINKCHANGE_FCNTL),
- &link_mode, &fcntl);
- mcdi_phy_decode_cap(MCDI_EV_FIELD(eqp, LINKCHANGE_LP_CAP),
- &lp_cap_mask);
-
- /*
- * It's safe to update ep_lp_cap_mask without the driver's port lock
- * because presumably any concurrently running efx_port_poll() is
- * only going to arrive at the same value.
- *
- * ep_fcntl has two meanings. It's either the link common fcntl
- * (if the PHY supports AN), or it's the forced link state. If
- * the former, it's safe to update the value for the same reason as
- * for ep_lp_cap_mask. If the latter, then just ignore the value,
- * because we can race with efx_mac_fcntl_set().
- */
- epp->ep_lp_cap_mask = lp_cap_mask;
- epp->ep_fcntl = fcntl;
-
- *link_modep = link_mode;
-}
-
- __checkReturn efx_rc_t
-ef10_phy_power(
- __in efx_nic_t *enp,
- __in boolean_t power)
-{
- efx_rc_t rc;
-
- if (!power)
- return (0);
-
- /* Check if the PHY is a zombie */
- if ((rc = ef10_phy_verify(enp)) != 0)
- goto fail1;
-
- enp->en_reset_flags |= EFX_RESET_PHY;
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_phy_get_link(
- __in efx_nic_t *enp,
- __out ef10_link_state_t *elsp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_LINK_IN_LEN,
- MC_CMD_GET_LINK_OUT_LEN)];
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_LINK;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_LINK_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_LINK_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_LINK_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_CAP),
- &elsp->els_adv_cap_mask);
- mcdi_phy_decode_cap(MCDI_OUT_DWORD(req, GET_LINK_OUT_LP_CAP),
- &elsp->els_lp_cap_mask);
-
- mcdi_phy_decode_link_mode(enp, MCDI_OUT_DWORD(req, GET_LINK_OUT_FLAGS),
- MCDI_OUT_DWORD(req, GET_LINK_OUT_LINK_SPEED),
- MCDI_OUT_DWORD(req, GET_LINK_OUT_FCNTL),
- &elsp->els_link_mode, &elsp->els_fcntl);
-
-#if EFSYS_OPT_LOOPBACK
- /* Assert the MC_CMD_LOOPBACK and EFX_LOOPBACK namespace agree */
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_NONE == EFX_LOOPBACK_OFF);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_DATA == EFX_LOOPBACK_DATA);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMAC == EFX_LOOPBACK_GMAC);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGMII == EFX_LOOPBACK_XGMII);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGXS == EFX_LOOPBACK_XGXS);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XAUI == EFX_LOOPBACK_XAUI);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMII == EFX_LOOPBACK_GMII);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_SGMII == EFX_LOOPBACK_SGMII);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XGBR == EFX_LOOPBACK_XGBR);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XFI == EFX_LOOPBACK_XFI);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XAUI_FAR == EFX_LOOPBACK_XAUI_FAR);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GMII_FAR == EFX_LOOPBACK_GMII_FAR);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_SGMII_FAR == EFX_LOOPBACK_SGMII_FAR);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_XFI_FAR == EFX_LOOPBACK_XFI_FAR);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_GPHY == EFX_LOOPBACK_GPHY);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PHYXS == EFX_LOOPBACK_PHY_XS);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PCS == EFX_LOOPBACK_PCS);
- EFX_STATIC_ASSERT(MC_CMD_LOOPBACK_PMAPMD == EFX_LOOPBACK_PMA_PMD);
-
- elsp->els_loopback = MCDI_OUT_DWORD(req, GET_LINK_OUT_LOOPBACK_MODE);
-#endif /* EFSYS_OPT_LOOPBACK */
-
- elsp->els_mac_up = MCDI_OUT_DWORD(req, GET_LINK_OUT_MAC_FAULT) == 0;
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_phy_reconfigure(
- __in efx_nic_t *enp)
-{
- efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- efx_port_t *epp = &(enp->en_port);
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_SET_LINK_IN_LEN,
- MC_CMD_SET_LINK_OUT_LEN)];
- uint32_t cap_mask;
- unsigned int led_mode;
- unsigned int speed;
- efx_rc_t rc;
-
- if (~encp->enc_func_flags & EFX_NIC_FUNC_LINKCTRL)
- goto out;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_SET_LINK;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_SET_LINK_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_SET_LINK_OUT_LEN;
-
- cap_mask = epp->ep_adv_cap_mask;
- MCDI_IN_POPULATE_DWORD_10(req, SET_LINK_IN_CAP,
- PHY_CAP_10HDX, (cap_mask >> EFX_PHY_CAP_10HDX) & 0x1,
- PHY_CAP_10FDX, (cap_mask >> EFX_PHY_CAP_10FDX) & 0x1,
- PHY_CAP_100HDX, (cap_mask >> EFX_PHY_CAP_100HDX) & 0x1,
- PHY_CAP_100FDX, (cap_mask >> EFX_PHY_CAP_100FDX) & 0x1,
- PHY_CAP_1000HDX, (cap_mask >> EFX_PHY_CAP_1000HDX) & 0x1,
- PHY_CAP_1000FDX, (cap_mask >> EFX_PHY_CAP_1000FDX) & 0x1,
- PHY_CAP_10000FDX, (cap_mask >> EFX_PHY_CAP_10000FDX) & 0x1,
- PHY_CAP_PAUSE, (cap_mask >> EFX_PHY_CAP_PAUSE) & 0x1,
- PHY_CAP_ASYM, (cap_mask >> EFX_PHY_CAP_ASYM) & 0x1,
- PHY_CAP_AN, (cap_mask >> EFX_PHY_CAP_AN) & 0x1);
- /* Too many fields for for POPULATE macros, so insert this afterwards */
- MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
- PHY_CAP_40000FDX, (cap_mask >> EFX_PHY_CAP_40000FDX) & 0x1);
-
-#if EFSYS_OPT_LOOPBACK
- MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE,
- epp->ep_loopback_type);
- switch (epp->ep_loopback_link_mode) {
- case EFX_LINK_100FDX:
- speed = 100;
- break;
- case EFX_LINK_1000FDX:
- speed = 1000;
- break;
- case EFX_LINK_10000FDX:
- speed = 10000;
- break;
- case EFX_LINK_40000FDX:
- speed = 40000;
- break;
- default:
- speed = 0;
- }
-#else
- MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE, MC_CMD_LOOPBACK_NONE);
- speed = 0;
-#endif /* EFSYS_OPT_LOOPBACK */
- MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_SPEED, speed);
-
-#if EFSYS_OPT_PHY_FLAGS
- MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, epp->ep_phy_flags);
-#else
- MCDI_IN_SET_DWORD(req, SET_LINK_IN_FLAGS, 0);
-#endif /* EFSYS_OPT_PHY_FLAGS */
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- /* And set the blink mode */
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_SET_ID_LED;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_SET_ID_LED_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_SET_ID_LED_OUT_LEN;
-
-#if EFSYS_OPT_PHY_LED_CONTROL
- switch (epp->ep_phy_led_mode) {
- case EFX_PHY_LED_DEFAULT:
- led_mode = MC_CMD_LED_DEFAULT;
- break;
- case EFX_PHY_LED_OFF:
- led_mode = MC_CMD_LED_OFF;
- break;
- case EFX_PHY_LED_ON:
- led_mode = MC_CMD_LED_ON;
- break;
- default:
- EFSYS_ASSERT(0);
- led_mode = MC_CMD_LED_DEFAULT;
- }
-
- MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, led_mode);
-#else
- MCDI_IN_SET_DWORD(req, SET_ID_LED_IN_STATE, MC_CMD_LED_DEFAULT);
-#endif /* EFSYS_OPT_PHY_LED_CONTROL */
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail2;
- }
-out:
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_phy_verify(
- __in efx_nic_t *enp)
-{
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_GET_PHY_STATE_IN_LEN,
- MC_CMD_GET_PHY_STATE_OUT_LEN)];
- uint32_t state;
- efx_rc_t rc;
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_GET_PHY_STATE;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_GET_PHY_STATE_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MC_CMD_GET_PHY_STATE_OUT_LEN;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_GET_PHY_STATE_OUT_LEN) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- state = MCDI_OUT_DWORD(req, GET_PHY_STATE_OUT_STATE);
- if (state != MC_CMD_PHY_STATE_OK) {
- if (state != MC_CMD_PHY_STATE_ZOMBIE)
- EFSYS_PROBE1(mc_pcol_error, int, state);
- rc = ENOTACTIVE;
- goto fail3;
- }
-
- return (0);
-
-fail3:
- EFSYS_PROBE(fail3);
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_phy_oui_get(
- __in efx_nic_t *enp,
- __out uint32_t *ouip)
-{
- _NOTE(ARGUNUSED(enp, ouip))
-
- return (ENOTSUP);
-}
-
-#if EFSYS_OPT_PHY_STATS
-
- __checkReturn efx_rc_t
-ef10_phy_stats_update(
- __in efx_nic_t *enp,
- __in efsys_mem_t *esmp,
- __inout_ecount(EFX_PHY_NSTATS) uint32_t *stat)
-{
- /* TBD: no stats support in firmware yet */
- _NOTE(ARGUNUSED(enp, esmp))
- memset(stat, 0, EFX_PHY_NSTATS * sizeof (*stat));
-
- return (0);
-}
-
-#endif /* EFSYS_OPT_PHY_STATS */
-
-#if EFSYS_OPT_PHY_PROPS
-
-#if EFSYS_OPT_NAMES
-
- const char *
-ef10_phy_prop_name(
- __in efx_nic_t *enp,
- __in unsigned int id)
-{
- _NOTE(ARGUNUSED(enp, id))
-
- return (NULL);
-}
-
-#endif /* EFSYS_OPT_NAMES */
-
- __checkReturn efx_rc_t
-ef10_phy_prop_get(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t flags,
- __out uint32_t *valp)
-{
- _NOTE(ARGUNUSED(enp, id, flags, valp))
-
- return (ENOTSUP);
-}
-
- __checkReturn efx_rc_t
-ef10_phy_prop_set(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t val)
-{
- _NOTE(ARGUNUSED(enp, id, val))
-
- return (ENOTSUP);
-}
-
-#endif /* EFSYS_OPT_PHY_PROPS */
-
#if EFSYS_OPT_BIST
__checkReturn efx_rc_t
@@ -571,6 +92,8 @@ hunt_bist_poll(
uint32_t result;
efx_rc_t rc;
+ _NOTE(ARGUNUSED(type))
+
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_POLL_BIST;
req.emr_in_buf = payload;
diff --git a/sys/dev/sfxge/common/hunt_sram.c b/sys/dev/sfxge/common/hunt_sram.c
deleted file mode 100644
index 1e35991..0000000
--- a/sys/dev/sfxge/common/hunt_sram.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of the FreeBSD Project.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "efx.h"
-#include "efx_impl.h"
-
-#if EFSYS_OPT_HUNTINGTON
-
-
-#if EFSYS_OPT_DIAG
-
- __checkReturn efx_rc_t
-ef10_sram_test(
- __in efx_nic_t *enp,
- __in efx_sram_pattern_fn_t func)
-{
- efx_rc_t rc;
-
- /* FIXME */
- _NOTE(ARGUNUSED(enp))
- _NOTE(ARGUNUSED(func))
- if (B_FALSE) {
- rc = ENOTSUP;
- goto fail1;
- }
- /* FIXME */
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-#endif /* EFSYS_OPT_DIAG */
-
-#endif /* EFSYS_OPT_HUNTINGTON */
diff --git a/sys/dev/sfxge/common/mcdi_mon.c b/sys/dev/sfxge/common/mcdi_mon.c
index 4c7f961..a379515 100644
--- a/sys/dev/sfxge/common/mcdi_mon.c
+++ b/sys/dev/sfxge/common/mcdi_mon.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -155,6 +155,8 @@ static const struct mcdi_sensor_map_s {
STAT(Px, PHY0_VCC), /* 0x4c PHY0_VCC */
STAT(Px, PHY1_VCC), /* 0x4d PHY1_VCC */
STAT(Px, CONTROLLER_TDIODE_TEMP), /* 0x4e CONTROLLER_TDIODE_TEMP */
+ STAT(Px, BOARD_FRONT_TEMP), /* 0x4f BOARD_FRONT_TEMP */
+ STAT(Px, BOARD_BACK_TEMP), /* 0x50 BOARD_BACK_TEMP */
};
#define MCDI_STATIC_SENSOR_ASSERT(_field) \
@@ -365,7 +367,7 @@ efx_mcdi_sensor_info_npages(
goto fail1;
}
} while (MCDI_OUT_DWORD(req, SENSOR_INFO_OUT_MASK) &
- (1 << MC_CMD_SENSOR_PAGE0_NEXT));
+ (1U << MC_CMD_SENSOR_PAGE0_NEXT));
*npagesp = page;
diff --git a/sys/dev/sfxge/common/mcdi_mon.h b/sys/dev/sfxge/common/mcdi_mon.h
index 440a887..ce93160 100644
--- a/sys/dev/sfxge/common/mcdi_mon.h
+++ b/sys/dev/sfxge/common/mcdi_mon.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/medford_impl.h b/sys/dev/sfxge/common/medford_impl.h
index 59ea35f..3e71eb0 100644
--- a/sys/dev/sfxge/common/medford_impl.h
+++ b/sys/dev/sfxge/common/medford_impl.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Solarflare Communications Inc.
+ * Copyright (c) 2015-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/medford_nic.c b/sys/dev/sfxge/common/medford_nic.c
index 7c176b5..0942bd7 100644
--- a/sys/dev/sfxge/common/medford_nic.c
+++ b/sys/dev/sfxge/common/medford_nic.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Solarflare Communications Inc.
+ * Copyright (c) 2015-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,11 +33,9 @@ __FBSDID("$FreeBSD$");
#include "efx.h"
#include "efx_impl.h"
-#include "mcdi_mon.h"
-#if EFSYS_OPT_MEDFORD
-#include "ef10_tlv_layout.h"
+#if EFSYS_OPT_MEDFORD
static __checkReturn efx_rc_t
efx_mcdi_get_rxdp_config(
@@ -97,6 +95,38 @@ fail1:
return (rc);
}
+static __checkReturn efx_rc_t
+medford_nic_get_required_pcie_bandwidth(
+ __in efx_nic_t *enp,
+ __out uint32_t *bandwidth_mbpsp)
+{
+ uint32_t port_modes;
+ uint32_t current_mode;
+ uint32_t bandwidth;
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
+ &current_mode)) != 0) {
+ /* No port mode info available. */
+ bandwidth = 0;
+ goto out;
+ }
+
+ if ((rc = ef10_nic_get_port_mode_bandwidth(current_mode,
+ &bandwidth)) != 0)
+ goto fail1;
+
+out:
+ *bandwidth_mbpsp = bandwidth;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
__checkReturn efx_rc_t
medford_board_cfg(
__in efx_nic_t *enp)
@@ -111,10 +141,10 @@ medford_board_cfg(
uint32_t pf;
uint32_t vf;
uint32_t mask;
- uint32_t flags;
- uint32_t sysclk;
+ uint32_t sysclk, dpcpu_clk;
uint32_t base, nvec;
uint32_t end_padding;
+ uint32_t bandwidth;
efx_rc_t rc;
/*
@@ -150,6 +180,12 @@ medford_board_cfg(
/* MAC address for this function */
if (EFX_PCI_FUNCTION_IS_PF(encp)) {
rc = efx_mcdi_get_mac_address_pf(enp, mac_addr);
+#if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC
+ /* Disable static config checking for Medford NICs, ONLY
+ * for manufacturing test and setup at the factory, to
+ * allow the static config to be installed.
+ */
+#else /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */
if ((rc == 0) && (mac_addr[0] & 0x02)) {
/*
* If the static config does not include a global MAC
@@ -159,6 +195,7 @@ medford_board_cfg(
*/
rc = EINVAL;
}
+#endif /* EFSYS_OPT_ALLOW_UNCONFIGURED_NIC */
} else {
rc = efx_mcdi_get_mac_address_vf(enp, mac_addr);
}
@@ -201,15 +238,15 @@ medford_board_cfg(
/* Chained multicast is always enabled on Medford */
encp->enc_bug26807_workaround = B_TRUE;
- /* Get sysclk frequency (in MHz). */
- if ((rc = efx_mcdi_get_clock(enp, &sysclk)) != 0)
+ /* Get clock frequencies (in MHz). */
+ if ((rc = efx_mcdi_get_clock(enp, &sysclk, &dpcpu_clk)) != 0)
goto fail8;
/*
- * The timer quantum is 1536 sysclk cycles, documented for the
- * EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
+ * The Medford timer quantum is 1536 dpcpu_clk cycles, documented for
+ * the EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
*/
- encp->enc_evq_timer_quantum_ns = 1536000UL / sysclk; /* 1536 cycles */
+ encp->enc_evq_timer_quantum_ns = 1536000UL / dpcpu_clk; /* 1536 cycles */
encp->enc_evq_timer_max_us = (encp->enc_evq_timer_quantum_ns <<
FRF_CZ_TC_TIMER_VAL_WIDTH) / 1000;
@@ -278,8 +315,16 @@ medford_board_cfg(
*/
encp->enc_vpd_is_global = B_TRUE;
+ rc = medford_nic_get_required_pcie_bandwidth(enp, &bandwidth);
+ if (rc != 0)
+ goto fail13;
+ encp->enc_required_pcie_bandwidth_mbps = bandwidth;
+ encp->enc_max_pcie_link_gen = EFX_PCIE_LINK_SPEED_GEN3;
+
return (0);
+fail13:
+ EFSYS_PROBE(fail13);
fail12:
EFSYS_PROBE(fail12);
fail11:
diff --git a/sys/dev/sfxge/common/siena_flash.h b/sys/dev/sfxge/common/siena_flash.h
index 143a14e..4558f15 100644
--- a/sys/dev/sfxge/common/siena_flash.h
+++ b/sys/dev/sfxge/common/siena_flash.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007-2015 Solarflare Communications Inc.
+ * Copyright (c) 2007-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/siena_impl.h b/sys/dev/sfxge/common/siena_impl.h
index 4c80cd6..7160f77 100644
--- a/sys/dev/sfxge/common/siena_impl.h
+++ b/sys/dev/sfxge/common/siena_impl.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,31 +42,12 @@
extern "C" {
#endif
-#if EFSYS_OPT_PHY_PROPS
-
-/* START MKCONFIG GENERATED SienaPhyHeaderPropsBlock a8db1f8eb5106efd */
-typedef enum siena_phy_prop_e {
- SIENA_PHY_NPROPS
-} siena_phy_prop_t;
-
-/* END MKCONFIG GENERATED SienaPhyHeaderPropsBlock */
-
-#endif /* EFSYS_OPT_PHY_PROPS */
-
#define SIENA_NVRAM_CHUNK 0x80
extern __checkReturn efx_rc_t
siena_nic_probe(
__in efx_nic_t *enp);
-#if EFSYS_OPT_PCIE_TUNE
-
-extern __checkReturn efx_rc_t
-siena_nic_pcie_extended_sync(
- __in efx_nic_t *enp);
-
-#endif
-
extern __checkReturn efx_rc_t
siena_nic_reset(
__in efx_nic_t *enp);
@@ -368,32 +349,6 @@ siena_phy_stats_update(
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-
-#if EFSYS_OPT_NAMES
-
-extern const char *
-siena_phy_prop_name(
- __in efx_nic_t *enp,
- __in unsigned int id);
-
-#endif /* EFSYS_OPT_NAMES */
-
-extern __checkReturn efx_rc_t
-siena_phy_prop_get(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t flags,
- __out uint32_t *valp);
-
-extern __checkReturn efx_rc_t
-siena_phy_prop_set(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t val);
-
-#endif /* EFSYS_OPT_PHY_PROPS */
-
#if EFSYS_OPT_BIST
extern __checkReturn efx_rc_t
@@ -433,6 +388,11 @@ extern __checkReturn efx_rc_t
siena_mac_reconfigure(
__in efx_nic_t *enp);
+extern __checkReturn efx_rc_t
+siena_mac_pdu_get(
+ __in efx_nic_t *enp,
+ __out size_t *pdu);
+
#if EFSYS_OPT_LOOPBACK
extern __checkReturn efx_rc_t
diff --git a/sys/dev/sfxge/common/siena_mac.c b/sys/dev/sfxge/common/siena_mac.c
index 12ecffd..2042f06 100644
--- a/sys/dev/sfxge/common/siena_mac.c
+++ b/sys/dev/sfxge/common/siena_mac.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -158,8 +158,17 @@ siena_mac_reconfigure(
* so we always add bit 0xff to the mask (bit 0x7f in the
* second octword).
*/
- if (epp->ep_brdcst)
+ if (epp->ep_brdcst) {
+ /*
+ * NOTE: due to constant folding, some of this evaluates
+ * to null expressions, giving E_EXPR_NULL_EFFECT during
+ * lint on Illumos. No good way to fix this without
+ * explicit coding the individual word/bit setting.
+ * So just suppress lint for this one line.
+ */
+ /* LINTED */
EFX_SET_OWORD_BIT(multicast_hash[1], 0x7f);
+ }
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_SET_MCAST_HASH;
@@ -197,7 +206,7 @@ siena_mac_loopback_set(
__in efx_loopback_type_t loopback_type)
{
efx_port_t *epp = &(enp->en_port);
- efx_phy_ops_t *epop = epp->ep_epop;
+ const efx_phy_ops_t *epop = epp->ep_epop;
efx_loopback_type_t old_loopback_type;
efx_link_mode_t old_loopback_link_mode;
efx_rc_t rc;
@@ -432,4 +441,12 @@ siena_mac_stats_update(
#endif /* EFSYS_OPT_MAC_STATS */
+ __checkReturn efx_rc_t
+siena_mac_pdu_get(
+ __in efx_nic_t *enp,
+ __out size_t *pdu)
+{
+ return (ENOTSUP);
+}
+
#endif /* EFSYS_OPT_SIENA */
diff --git a/sys/dev/sfxge/common/siena_mcdi.c b/sys/dev/sfxge/common/siena_mcdi.c
index 4fb2b6c..a9bc1ca 100644
--- a/sys/dev/sfxge/common/siena_mcdi.c
+++ b/sys/dev/sfxge/common/siena_mcdi.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2015 Solarflare Communications Inc.
+ * Copyright (c) 2012-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -174,6 +174,8 @@ siena_mcdi_init(
unsigned int portnum;
efx_rc_t rc;
+ _NOTE(ARGUNUSED(mtp))
+
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
/* Determine the port number to use for MCDI */
@@ -212,6 +214,7 @@ fail1:
siena_mcdi_fini(
__in efx_nic_t *enp)
{
+ _NOTE(ARGUNUSED(enp))
}
__checkReturn efx_rc_t
@@ -234,7 +237,6 @@ siena_mcdi_feature_supported(
default:
rc = ENOTSUP;
goto fail1;
- break;
}
return (0);
diff --git a/sys/dev/sfxge/common/siena_nic.c b/sys/dev/sfxge/common/siena_nic.c
index 59e1283..b809a4d 100644
--- a/sys/dev/sfxge/common/siena_nic.c
+++ b/sys/dev/sfxge/common/siena_nic.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -78,28 +78,6 @@ fail1:
return (rc);
}
-#if EFSYS_OPT_PCIE_TUNE
-
- __checkReturn efx_rc_t
-siena_nic_pcie_extended_sync(
- __in efx_nic_t *enp)
-{
- efx_rc_t rc;
-
- if ((rc = efx_mcdi_set_workaround(enp, MC_CMD_WORKAROUND_BUG17230,
- B_TRUE, NULL) != 0))
- goto fail1;
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
-#endif /* EFSYS_OPT_PCIE_TUNE */
-
static __checkReturn efx_rc_t
siena_board_cfg(
__in efx_nic_t *enp)
@@ -172,6 +150,10 @@ siena_board_cfg(
encp->enc_fw_assisted_tso_v2_enabled = B_FALSE;
encp->enc_allow_set_mac_with_installed_filters = B_TRUE;
+ /* Siena supports two 10G ports, and 8 lanes of PCIe Gen2 */
+ encp->enc_required_pcie_bandwidth_mbps = 2 * 10000;
+ encp->enc_max_pcie_link_gen = EFX_PCIE_LINK_SPEED_GEN2;
+
return (0);
fail2:
diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c
index 9708e0c..de6fd01 100644
--- a/sys/dev/sfxge/common/siena_nvram.c
+++ b/sys/dev/sfxge/common/siena_nvram.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/siena_phy.c b/sys/dev/sfxge/common/siena_phy.c
index 920314a..b3f1a35 100644
--- a/sys/dev/sfxge/common/siena_phy.c
+++ b/sys/dev/sfxge/common/siena_phy.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -592,47 +592,6 @@ fail1:
#endif /* EFSYS_OPT_PHY_STATS */
-#if EFSYS_OPT_PHY_PROPS
-
-#if EFSYS_OPT_NAMES
-
-extern const char *
-siena_phy_prop_name(
- __in efx_nic_t *enp,
- __in unsigned int id)
-{
- _NOTE(ARGUNUSED(enp, id))
-
- return (NULL);
-}
-
-#endif /* EFSYS_OPT_NAMES */
-
-extern __checkReturn efx_rc_t
-siena_phy_prop_get(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t flags,
- __out uint32_t *valp)
-{
- _NOTE(ARGUNUSED(enp, id, flags, valp))
-
- return (ENOTSUP);
-}
-
-extern __checkReturn efx_rc_t
-siena_phy_prop_set(
- __in efx_nic_t *enp,
- __in unsigned int id,
- __in uint32_t val)
-{
- _NOTE(ARGUNUSED(enp, id, val))
-
- return (ENOTSUP);
-}
-
-#endif /* EFSYS_OPT_PHY_PROPS */
-
#if EFSYS_OPT_BIST
__checkReturn efx_rc_t
diff --git a/sys/dev/sfxge/common/siena_sram.c b/sys/dev/sfxge/common/siena_sram.c
index 762de42..6f4dbf4 100644
--- a/sys/dev/sfxge/common/siena_sram.c
+++ b/sys/dev/sfxge/common/siena_sram.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/common/siena_vpd.c b/sys/dev/sfxge/common/siena_vpd.c
index 7a7ce67..6fb4ca9 100644
--- a/sys/dev/sfxge/common/siena_vpd.c
+++ b/sys/dev/sfxge/common/siena_vpd.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2015 Solarflare Communications Inc.
+ * Copyright (c) 2009-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -436,8 +436,12 @@ siena_vpd_get(
/* And then from the provided data buffer */
if ((rc = efx_vpd_hunk_get(data, size, evvp->evv_tag,
- evvp->evv_keyword, &offset, &length)) != 0)
+ evvp->evv_keyword, &offset, &length)) != 0) {
+ if (rc == ENOENT)
+ return (rc);
+
goto fail2;
+ }
evvp->evv_length = length;
memcpy(evvp->evv_value, data + offset, length);
diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c
index b112a1e..6275d1b 100644
--- a/sys/dev/sfxge/sfxge.c
+++ b/sys/dev/sfxge/sfxge.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
@@ -1174,6 +1174,11 @@ sfxge_probe(device_t dev)
return (0);
}
+ if (family == EFX_FAMILY_MEDFORD) {
+ device_set_desc(dev, "Solarflare SFC9200 family");
+ return (0);
+ }
+
DBGPRINT(dev, "impossible controller family %d", family);
return (ENXIO);
}
diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h
index 9cf8f07..e7a0899 100644
--- a/sys/dev/sfxge/sfxge.h
+++ b/sys/dev/sfxge/sfxge.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
@@ -112,6 +112,43 @@
#define SFXGE_ETHERTYPE_LOOPBACK 0x9000 /* Xerox loopback */
+
+#define SFXGE_MAGIC_RESERVED 0x8000
+
+#define SFXGE_MAGIC_DMAQ_LABEL_WIDTH 6
+#define SFXGE_MAGIC_DMAQ_LABEL_MASK \
+ ((1 << SFXGE_MAGIC_DMAQ_LABEL_WIDTH) - 1)
+
+enum sfxge_sw_ev {
+ SFXGE_SW_EV_RX_QFLUSH_DONE = 1,
+ SFXGE_SW_EV_RX_QFLUSH_FAILED,
+ SFXGE_SW_EV_RX_QREFILL,
+ SFXGE_SW_EV_TX_QFLUSH_DONE,
+};
+
+#define SFXGE_SW_EV_MAGIC(_sw_ev) \
+ (SFXGE_MAGIC_RESERVED | ((_sw_ev) << SFXGE_MAGIC_DMAQ_LABEL_WIDTH))
+
+static inline uint16_t
+sfxge_sw_ev_mk_magic(enum sfxge_sw_ev sw_ev, unsigned int label)
+{
+ KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
+ ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
+ return SFXGE_SW_EV_MAGIC(sw_ev) | label;
+}
+
+static inline uint16_t
+sfxge_sw_ev_rxq_magic(enum sfxge_sw_ev sw_ev, struct sfxge_rxq *rxq)
+{
+ return sfxge_sw_ev_mk_magic(sw_ev, 0);
+}
+
+static inline uint16_t
+sfxge_sw_ev_txq_magic(enum sfxge_sw_ev sw_ev, struct sfxge_txq *txq)
+{
+ return sfxge_sw_ev_mk_magic(sw_ev, txq->type);
+}
+
enum sfxge_evq_state {
SFXGE_EVQ_UNINITIALIZED = 0,
SFXGE_EVQ_INITIALIZED,
diff --git a/sys/dev/sfxge/sfxge_dma.c b/sys/dev/sfxge/sfxge_dma.c
index 4f9f749..882fb82 100644
--- a/sys/dev/sfxge/sfxge_dma.c
+++ b/sys/dev/sfxge/sfxge_dma.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
diff --git a/sys/dev/sfxge/sfxge_ev.c b/sys/dev/sfxge/sfxge_ev.c
index bc2dca7..c3cd324 100644
--- a/sys/dev/sfxge/sfxge_ev.c
+++ b/sys/dev/sfxge/sfxge_ev.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
@@ -202,7 +202,6 @@ sfxge_ev_rxq_flush_done(void *arg, uint32_t rxq_index)
struct sfxge_softc *sc;
struct sfxge_rxq *rxq;
unsigned int index;
- unsigned int label;
uint16_t magic;
evq = (struct sfxge_evq *)arg;
@@ -221,11 +220,7 @@ sfxge_ev_rxq_flush_done(void *arg, uint32_t rxq_index)
}
evq = sc->evq[index];
-
- label = 0;
- KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
- ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != level"));
- magic = SFXGE_MAGIC_RX_QFLUSH_DONE | label;
+ magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QFLUSH_DONE, rxq);
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
("evq not started"));
@@ -241,7 +236,6 @@ sfxge_ev_rxq_flush_failed(void *arg, uint32_t rxq_index)
struct sfxge_softc *sc;
struct sfxge_rxq *rxq;
unsigned int index;
- unsigned int label;
uint16_t magic;
evq = (struct sfxge_evq *)arg;
@@ -255,11 +249,7 @@ sfxge_ev_rxq_flush_failed(void *arg, uint32_t rxq_index)
/* Resend a software event on the correct queue */
index = rxq->index;
evq = sc->evq[index];
-
- label = 0;
- KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
- ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
- magic = SFXGE_MAGIC_RX_QFLUSH_FAILED | label;
+ magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QFLUSH_FAILED, rxq);
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
("evq not started"));
@@ -326,7 +316,6 @@ sfxge_ev_txq_flush_done(void *arg, uint32_t txq_index)
struct sfxge_evq *evq;
struct sfxge_softc *sc;
struct sfxge_txq *txq;
- unsigned int label;
uint16_t magic;
evq = (struct sfxge_evq *)arg;
@@ -346,11 +335,7 @@ sfxge_ev_txq_flush_done(void *arg, uint32_t txq_index)
/* Resend a software event on the correct queue */
evq = sc->evq[txq->evq_index];
-
- label = txq->type;
- KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
- ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
- magic = SFXGE_MAGIC_TX_QFLUSH_DONE | label;
+ magic = sfxge_sw_ev_txq_magic(SFXGE_SW_EV_TX_QFLUSH_DONE, txq);
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
("evq not started"));
@@ -375,19 +360,19 @@ sfxge_ev_software(void *arg, uint16_t magic)
magic &= ~SFXGE_MAGIC_DMAQ_LABEL_MASK;
switch (magic) {
- case SFXGE_MAGIC_RX_QFLUSH_DONE:
+ case SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QFLUSH_DONE):
sfxge_rx_qflush_done(sfxge_get_rxq_by_label(evq, label));
break;
- case SFXGE_MAGIC_RX_QFLUSH_FAILED:
+ case SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QFLUSH_FAILED):
sfxge_rx_qflush_failed(sfxge_get_rxq_by_label(evq, label));
break;
- case SFXGE_MAGIC_RX_QREFILL:
+ case SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QREFILL):
sfxge_rx_qrefill(sfxge_get_rxq_by_label(evq, label));
break;
- case SFXGE_MAGIC_TX_QFLUSH_DONE: {
+ case SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_TX_QFLUSH_DONE): {
struct sfxge_txq *txq = sfxge_get_txq_by_label(evq, label);
KASSERT(txq != NULL, ("txq == NULL"));
diff --git a/sys/dev/sfxge/sfxge_intr.c b/sys/dev/sfxge/sfxge_intr.c
index 20f4d53..4a6a273 100644
--- a/sys/dev/sfxge/sfxge_intr.c
+++ b/sys/dev/sfxge/sfxge_intr.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
diff --git a/sys/dev/sfxge/sfxge_ioc.h b/sys/dev/sfxge/sfxge_ioc.h
index bf079c8..77d4fa5 100644
--- a/sys/dev/sfxge/sfxge_ioc.h
+++ b/sys/dev/sfxge/sfxge_ioc.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2014-2015 Solarflare Communications Inc.
+ * Copyright (c) 2014-2016 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/sfxge/sfxge_mcdi.c b/sys/dev/sfxge/sfxge_mcdi.c
index 3a85c28..02b59ac 100644
--- a/sys/dev/sfxge/sfxge_mcdi.c
+++ b/sys/dev/sfxge/sfxge_mcdi.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
diff --git a/sys/dev/sfxge/sfxge_nvram.c b/sys/dev/sfxge/sfxge_nvram.c
index c4fa224..17aeea9 100644
--- a/sys/dev/sfxge/sfxge_nvram.c
+++ b/sys/dev/sfxge/sfxge_nvram.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications, Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications, Inc.
* All rights reserved.
*
* This software was developed in part by OKTET Labs Ltd. under contract for
diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c
index 277752a..709ed78 100644
--- a/sys/dev/sfxge/sfxge_port.c
+++ b/sys/dev/sfxge/sfxge_port.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c
index 7b3228d..9fcccad 100644
--- a/sys/dev/sfxge/sfxge_rx.c
+++ b/sys/dev/sfxge/sfxge_rx.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
@@ -179,8 +179,7 @@ sfxge_rx_post_refill(void *arg)
sc = rxq->sc;
index = rxq->index;
evq = sc->evq[index];
-
- magic = SFXGE_MAGIC_RX_QREFILL | index;
+ magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QREFILL, rxq);
/* This is guaranteed due to the start/stop order of rx and ev */
KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
@@ -843,7 +842,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop)
if (rx_desc->flags & EFX_PKT_PREFIX_LEN) {
uint16_t tmp_size;
int rc;
- rc = efx_psuedo_hdr_pkt_length_get(sc->enp,
+ rc = efx_psuedo_hdr_pkt_length_get(sc->enp,
mtod(m, uint8_t *),
&tmp_size);
KASSERT(rc == 0, ("cannot get packet length: %d", rc));
@@ -1110,7 +1109,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
EFSYS_ASSERT(ISP2(align));
sc->rx_buffer_size = P2ROUNDUP(sc->rx_buffer_size, align);
- /*
+ /*
* Standard mbuf zones only guarantee pointer-size alignment;
* we need extra space to align to the cache line
*/
diff --git a/sys/dev/sfxge/sfxge_rx.h b/sys/dev/sfxge/sfxge_rx.h
index e870ed5..2196c4e 100644
--- a/sys/dev/sfxge/sfxge_rx.h
+++ b/sys/dev/sfxge/sfxge_rx.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
@@ -43,24 +43,6 @@
#define SFXGE_LRO 1
#endif
-#define SFXGE_MAGIC_RESERVED 0x8000
-
-#define SFXGE_MAGIC_DMAQ_LABEL_WIDTH 6
-#define SFXGE_MAGIC_DMAQ_LABEL_MASK \
- ((1 << SFXGE_MAGIC_DMAQ_LABEL_WIDTH) - 1)
-
-#define SFXGE_MAGIC_RX_QFLUSH_DONE \
- (SFXGE_MAGIC_RESERVED | (1 << SFXGE_MAGIC_DMAQ_LABEL_WIDTH))
-
-#define SFXGE_MAGIC_RX_QFLUSH_FAILED \
- (SFXGE_MAGIC_RESERVED | (2 << SFXGE_MAGIC_DMAQ_LABEL_WIDTH))
-
-#define SFXGE_MAGIC_RX_QREFILL \
- (SFXGE_MAGIC_RESERVED | (3 << SFXGE_MAGIC_DMAQ_LABEL_WIDTH))
-
-#define SFXGE_MAGIC_TX_QFLUSH_DONE \
- (SFXGE_MAGIC_RESERVED | (4 << SFXGE_MAGIC_DMAQ_LABEL_WIDTH))
-
#define SFXGE_RX_SCALE_MAX EFX_MAXRSS
struct sfxge_rx_sw_desc {
diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c
index 6ae5a07..caaa067 100644
--- a/sys/dev/sfxge/sfxge_tx.c
+++ b/sys/dev/sfxge/sfxge_tx.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
diff --git a/sys/dev/sfxge/sfxge_tx.h b/sys/dev/sfxge/sfxge_tx.h
index ce5d3c4..c53279b 100644
--- a/sys/dev/sfxge/sfxge_tx.h
+++ b/sys/dev/sfxge/sfxge_tx.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010-2015 Solarflare Communications Inc.
+ * Copyright (c) 2010-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by Philip Paeps under contract for
diff --git a/sys/dev/sfxge/sfxge_version.h b/sys/dev/sfxge/sfxge_version.h
index dbc23ba..ab0ad54 100644
--- a/sys/dev/sfxge/sfxge_version.h
+++ b/sys/dev/sfxge/sfxge_version.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2015 Solarflare Communications Inc.
+ * Copyright (c) 2015-2016 Solarflare Communications Inc.
* All rights reserved.
*
* This software was developed in part by OKTET Labs under contract for
@@ -36,6 +36,6 @@
#ifndef _SFXGE_VERSION_H
#define _SFXGE_VERSION_H
-#define SFXGE_VERSION_STRING "v4.8.0.1019"
+#define SFXGE_VERSION_STRING "v4.8.0.1071"
#endif /* _SFXGE_DRIVER_VERSION_H */
diff --git a/sys/dev/usb/net/uhso.c b/sys/dev/usb/net/uhso.c
index 1795993..e614582 100644
--- a/sys/dev/usb/net/uhso.c
+++ b/sys/dev/usb/net/uhso.c
@@ -1223,6 +1223,7 @@ uhso_mux_write_callback(struct usb_xfer *xfer, usb_error_t error)
ht->ht_muxport);
/* FALLTHROUGH */
case USB_ST_SETUP:
+tr_setup:
pc = usbd_xfer_get_frame(xfer, 1);
if (ucom_get_data(&sc->sc_ucom[ht->ht_muxport], pc,
0, 32, &actlen)) {
@@ -1253,7 +1254,8 @@ uhso_mux_write_callback(struct usb_xfer *xfer, usb_error_t error)
UHSO_DPRINTF(0, "error: %s\n", usbd_errstr(error));
if (error == USB_ERR_CANCELLED)
break;
- break;
+ usbd_xfer_set_stall(xfer);
+ goto tr_setup;
}
}
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index 7231230..2973fa4 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -229,7 +229,7 @@ usb_ref_device(struct usb_cdev_privdata *cpd,
* We need to grab the enumeration SX-lock before
* grabbing the FIFO refs to avoid deadlock at detach!
*/
- crd->do_unlock = usbd_enum_lock(cpd->udev);
+ crd->do_unlock = usbd_enum_lock_sig(cpd->udev);
mtx_lock(&usb_ref_lock);
@@ -237,6 +237,12 @@ usb_ref_device(struct usb_cdev_privdata *cpd,
* Set "is_uref" after grabbing the default SX lock
*/
crd->is_uref = 1;
+
+ /* check for signal */
+ if (crd->do_unlock > 1) {
+ crd->do_unlock = 0;
+ goto error;
+ }
}
/* check if we are doing an open */
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index 3e29aa4..639d461 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -1777,7 +1777,9 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus,
scratch_ptr = udev->scratch.data;
- if (udev->ddesc.iManufacturer ||
+ if (udev->flags.no_strings) {
+ err = USB_ERR_INVAL;
+ } else if (udev->ddesc.iManufacturer ||
udev->ddesc.iProduct ||
udev->ddesc.iSerialNumber) {
/* read out the language ID string */
@@ -2738,7 +2740,7 @@ usbd_device_attached(struct usb_device *udev)
/*
* The following function locks enumerating the given USB device. If
* the lock is already grabbed this function returns zero. Else a
- * non-zero value is returned.
+ * a value of one is returned.
*/
uint8_t
usbd_enum_lock(struct usb_device *udev)
@@ -2757,6 +2759,27 @@ usbd_enum_lock(struct usb_device *udev)
return (1);
}
+#if USB_HAVE_UGEN
+/*
+ * This function is the same like usbd_enum_lock() except a value of
+ * 255 is returned when a signal is pending:
+ */
+uint8_t
+usbd_enum_lock_sig(struct usb_device *udev)
+{
+ if (sx_xlocked(&udev->enum_sx))
+ return (0);
+ if (sx_xlock_sig(&udev->enum_sx))
+ return (255);
+ if (sx_xlock_sig(&udev->sr_sx)) {
+ sx_xunlock(&udev->enum_sx);
+ return (255);
+ }
+ mtx_lock(&Giant);
+ return (1);
+}
+#endif
+
/* The following function unlocks enumerating the given USB device. */
void
diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h
index 5a94998..7a979bb 100644
--- a/sys/dev/usb/usb_device.h
+++ b/sys/dev/usb/usb_device.h
@@ -314,6 +314,9 @@ void usb_set_device_state(struct usb_device *, enum usb_dev_state);
enum usb_dev_state usb_get_device_state(struct usb_device *);
uint8_t usbd_enum_lock(struct usb_device *);
+#if USB_HAVE_UGEN
+uint8_t usbd_enum_lock_sig(struct usb_device *);
+#endif
void usbd_enum_unlock(struct usb_device *);
void usbd_sr_lock(struct usb_device *);
void usbd_sr_unlock(struct usb_device *);
diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c
index 4723a63..288e7bc 100644
--- a/sys/fs/devfs/devfs_devs.c
+++ b/sys/fs/devfs/devfs_devs.c
@@ -127,16 +127,11 @@ devfs_alloc(int flags)
return (NULL);
cdp->cdp_dirents = &cdp->cdp_dirent0;
- cdp->cdp_dirent0 = NULL;
- cdp->cdp_maxdirent = 0;
- cdp->cdp_inode = 0;
cdev = &cdp->cdp_c;
-
LIST_INIT(&cdev->si_children);
vfs_timestamp(&ts);
cdev->si_atime = cdev->si_mtime = cdev->si_ctime = ts;
- cdev->si_cred = NULL;
return (cdev);
}
diff --git a/sys/fs/fuse/fuse_file.c b/sys/fs/fuse/fuse_file.c
index d9fb67b..376e5f5 100644
--- a/sys/fs/fuse/fuse_file.c
+++ b/sys/fs/fuse/fuse_file.c
@@ -141,7 +141,17 @@ fuse_filehandle_open(struct vnode *vp,
foo = fdi.answ;
fuse_filehandle_init(vp, fufh_type, fufhp, foo->fh);
- fuse_vnode_open(vp, foo->open_flags, td);
+
+ /*
+ * For WRONLY opens, force DIRECT_IO. This is necessary
+ * since writing a partial block through the buffer cache
+ * will result in a read of the block and that read won't
+ * be allowed by the WRONLY open.
+ */
+ if (fufh_type == FUFH_WRONLY)
+ fuse_vnode_open(vp, foo->open_flags | FOPEN_DIRECT_IO, td);
+ else
+ fuse_vnode_open(vp, foo->open_flags, td);
out:
fdisp_destroy(&fdi);
@@ -206,6 +216,28 @@ fuse_filehandle_valid(struct vnode *vp, fufh_type_t fufh_type)
return FUFH_IS_VALID(fufh);
}
+/*
+ * Check for a valid file handle, first the type requested, but if that
+ * isn't valid, try for FUFH_RDWR.
+ * Return the FUFH type that is valid or FUFH_INVALID if there are none.
+ * This is a variant of fuse_filehandle_vaild() analogous to
+ * fuse_filehandle_getrw().
+ */
+fufh_type_t
+fuse_filehandle_validrw(struct vnode *vp, fufh_type_t fufh_type)
+{
+ struct fuse_vnode_data *fvdat = VTOFUD(vp);
+ struct fuse_filehandle *fufh;
+
+ fufh = &fvdat->fufh[fufh_type];
+ if (FUFH_IS_VALID(fufh) != 0)
+ return (fufh_type);
+ fufh = &fvdat->fufh[FUFH_RDWR];
+ if (FUFH_IS_VALID(fufh) != 0)
+ return (FUFH_RDWR);
+ return (FUFH_INVALID);
+}
+
int
fuse_filehandle_get(struct vnode *vp, fufh_type_t fufh_type,
struct fuse_filehandle **fufhp)
diff --git a/sys/fs/fuse/fuse_file.h b/sys/fs/fuse/fuse_file.h
index 7d605ee..097cf18 100644
--- a/sys/fs/fuse/fuse_file.h
+++ b/sys/fs/fuse/fuse_file.h
@@ -137,6 +137,7 @@ fuse_filehandle_xlate_to_oflags(fufh_type_t type)
}
int fuse_filehandle_valid(struct vnode *vp, fufh_type_t fufh_type);
+fufh_type_t fuse_filehandle_validrw(struct vnode *vp, fufh_type_t fufh_type);
int fuse_filehandle_get(struct vnode *vp, fufh_type_t fufh_type,
struct fuse_filehandle **fufhp);
int fuse_filehandle_getrw(struct vnode *vp, fufh_type_t fufh_type,
diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c
index a6119dd..3d6dd8f 100644
--- a/sys/fs/fuse/fuse_node.c
+++ b/sys/fs/fuse/fuse_node.c
@@ -289,7 +289,9 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
* XXXIP: Handle fd based DIRECT_IO
*/
if (fuse_open_flags & FOPEN_DIRECT_IO) {
+ ASSERT_VOP_ELOCKED(vp, __func__);
VTOFUD(vp)->flag |= FN_DIRECTIO;
+ fuse_io_invalbuf(vp, td);
} else {
VTOFUD(vp)->flag &= ~FN_DIRECTIO;
}
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
index f2d0188..1398ed1 100644
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -335,8 +335,9 @@ fuse_vnop_create(struct vop_create_args *ap)
/* XXX: Will we ever want devices ? */
if ((vap->va_type != VREG)) {
- MPASS(vap->va_type != VFIFO);
- goto bringup;
+ printf("fuse_vnop_create: unsupported va_type %d\n",
+ vap->va_type);
+ return (EINVAL);
}
debug_printf("parent nid = %ju, mode = %x\n", (uintmax_t)parentnid,
mode);
@@ -364,7 +365,7 @@ fuse_vnop_create(struct vop_create_args *ap)
debug_printf("create: got err=%d from daemon\n", err);
goto out;
}
-bringup:
+
feo = fdip->answ;
if ((err = fuse_internal_checkentry(feo, VREG))) {
@@ -1125,6 +1126,7 @@ fuse_vnop_open(struct vop_open_args *ap)
struct fuse_vnode_data *fvdat;
int error, isdir = 0;
+ int32_t fuse_open_flags;
FS_DEBUG2G("inode=%ju mode=0x%x\n", (uintmax_t)VTOI(vp), mode);
@@ -1136,14 +1138,24 @@ fuse_vnop_open(struct vop_open_args *ap)
if (vnode_isdir(vp)) {
isdir = 1;
}
+ fuse_open_flags = 0;
if (isdir) {
fufh_type = FUFH_RDONLY;
} else {
fufh_type = fuse_filehandle_xlate_from_fflags(mode);
- }
-
- if (fuse_filehandle_valid(vp, fufh_type)) {
- fuse_vnode_open(vp, 0, td);
+ /*
+ * For WRONLY opens, force DIRECT_IO. This is necessary
+ * since writing a partial block through the buffer cache
+ * will result in a read of the block and that read won't
+ * be allowed by the WRONLY open.
+ */
+ if (fufh_type == FUFH_WRONLY ||
+ (fvdat->flag & FN_DIRECTIO) != 0)
+ fuse_open_flags = FOPEN_DIRECT_IO;
+ }
+
+ if (fuse_filehandle_validrw(vp, fufh_type) != FUFH_INVALID) {
+ fuse_vnode_open(vp, fuse_open_flags, td);
return 0;
}
error = fuse_filehandle_open(vp, fufh_type, NULL, td, cred);
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 0264182..4532ca4 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -2416,8 +2416,6 @@ nfsrvd_lockt(struct nfsrv_descript *nd, __unused int isdgram,
if (!nd->nd_repstat)
nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, &cf, clientid,
&stateid, exp, nd, p);
- if (stp)
- FREE((caddr_t)stp, M_NFSDSTATE);
if (nd->nd_repstat) {
if (nd->nd_repstat == NFSERR_DENIED) {
NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
@@ -2439,6 +2437,8 @@ nfsrvd_lockt(struct nfsrv_descript *nd, __unused int isdgram,
}
}
vput(vp);
+ if (stp)
+ FREE((caddr_t)stp, M_NFSDSTATE);
NFSEXITCODE2(0, nd);
return (0);
nfsmout:
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index a633f72..c0e65d5 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -486,13 +486,7 @@ cpu_set_syscall_retval(struct thread *td, int error)
break;
default:
- if (td->td_proc->p_sysent->sv_errsize) {
- if (error >= td->td_proc->p_sysent->sv_errsize)
- error = -1; /* XXX */
- else
- error = td->td_proc->p_sysent->sv_errtbl[error];
- }
- td->td_frame->tf_eax = error;
+ td->td_frame->tf_eax = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_eflags |= PSL_C;
break;
}
diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h
index cc5da24..3717c9f 100644
--- a/sys/i386/linux/linux_proto.h
+++ b/sys/i386/linux/linux_proto.h
@@ -478,16 +478,16 @@ struct linux_sysctl_args {
};
struct linux_sched_setparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_getparam_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_setscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
- char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
+ char param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];
};
struct linux_sched_getscheduler_args {
char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c
index 7feba47..f02f34f 100644
--- a/sys/i386/linux/linux_systrace_args.c
+++ b/sys/i386/linux/linux_systrace_args.c
@@ -1085,7 +1085,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 154: {
struct linux_sched_setparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
- uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1093,7 +1093,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 155: {
struct linux_sched_getparam_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
- uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[1] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 2;
break;
}
@@ -1102,7 +1102,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct linux_sched_setscheduler_args *p = params;
iarg[0] = p->pid; /* l_pid_t */
iarg[1] = p->policy; /* l_int */
- uarg[2] = (intptr_t) p->param; /* struct l_sched_param * */
+ uarg[2] = (intptr_t) p->param; /* struct sched_param * */
*n_args = 3;
break;
}
@@ -4072,7 +4072,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
@@ -4085,7 +4085,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_pid_t";
break;
case 1:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
@@ -4101,7 +4101,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "l_int";
break;
case 2:
- p = "struct l_sched_param *";
+ p = "struct sched_param *";
break;
default:
break;
diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master
index 1032ef0..7ec3154 100644
--- a/sys/i386/linux/syscalls.master
+++ b/sys/i386/linux/syscalls.master
@@ -270,12 +270,12 @@
152 AUE_MLOCKALL NOPROTO { int mlockall(int how); }
153 AUE_MUNLOCKALL NOPROTO { int munlockall(void); }
154 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
155 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
156 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \
l_pid_t pid, l_int policy, \
- struct l_sched_param *param); }
+ struct sched_param *param); }
157 AUE_SCHED_GETSCHEDULER STD { int linux_sched_getscheduler( \
l_pid_t pid); }
158 AUE_NULL NOPROTO { int sched_yield(void); }
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 867c263..fbad175 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -362,7 +362,7 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
if (sbt == 0)
sbt = tick_sbt;
- if (cold || kdb_active) {
+ if (cold || kdb_active || SCHEDULER_STOPPED()) {
/*
* We delay one second at a time to avoid overflowing the
* system specific DELAY() function(s):
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index aecf554..bef5829 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2197,6 +2197,7 @@ cvtstat(st, ost)
struct ostat *ost;
{
+ bzero(ost, sizeof(*ost));
ost->st_dev = st->st_dev;
ost->st_ino = st->st_ino;
ost->st_mode = st->st_mode;
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index b1c1299..f17ae89 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1372,6 +1372,8 @@ vn_truncate(struct file *fp, off_t length, struct ucred *active_cred,
if (error == 0) {
VATTR_NULL(&vattr);
vattr.va_size = length;
+ if ((fp->f_flag & O_FSYNC) != 0)
+ vattr.va_vaflags |= VA_SYNC;
error = VOP_SETATTR(vp, &vattr, fp->f_cred);
}
out:
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 5135093..9d075d1 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -155,6 +155,7 @@ SUBDIR= \
${_iir} \
${_imgact_binmisc} \
${_io} \
+ ${_ioat} \
${_ipoib} \
${_ipdivert} \
${_ipfilter} \
@@ -723,6 +724,7 @@ _if_ndis= if_ndis
_igb= igb
_iir= iir
_io= io
+_ioat= ioat
_ipmi= ipmi
.if ${MK_OFED} != "no" || defined(ALL_MODULES)
_ipoib= ipoib
diff --git a/sys/modules/ioat/Makefile b/sys/modules/ioat/Makefile
new file mode 100644
index 0000000..5a2c417
--- /dev/null
+++ b/sys/modules/ioat/Makefile
@@ -0,0 +1,15 @@
+# ioat Loadable Kernel Module
+#
+# $FreeBSD$
+
+IOAT_SRC_PATH = ${.CURDIR}/../..
+
+.PATH: ${IOAT_SRC_PATH}/dev/ioat
+
+KMOD= ioat
+SRCS= ioat.c ioat_test.c
+SRCS+= device_if.h bus_if.h pci_if.h
+
+CFLAGS+= -I${IOAT_SRC_PATH}
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/sfxge/Makefile b/sys/modules/sfxge/Makefile
index ba4108b..cc00d3a 100644
--- a/sys/modules/sfxge/Makefile
+++ b/sys/modules/sfxge/Makefile
@@ -31,11 +31,11 @@ SRCS+= siena_mac.c siena_mcdi.c siena_nic.c siena_nvram.c siena_phy.c
SRCS+= siena_sram.c siena_vpd.c
SRCS+= siena_flash.h siena_impl.h
+SRCS+= ef10_ev.c ef10_filter.c ef10_intr.c ef10_mac.c ef10_mcdi.c ef10_nic.c
+SRCS+= ef10_nvram.c ef10_phy.c ef10_rx.c ef10_tx.c ef10_vpd.c
SRCS+= ef10_impl.h
-SRCS+= hunt_ev.c hunt_intr.c hunt_mac.c hunt_mcdi.c hunt_nic.c
-SRCS+= hunt_nvram.c hunt_rx.c hunt_phy.c hunt_sram.c hunt_tx.c hunt_vpd.c
-SRCS+= hunt_filter.c
+SRCS+= hunt_nic.c hunt_phy.c
SRCS+= hunt_impl.h
SRCS+= medford_nic.c
diff --git a/sys/net/if.c b/sys/net/if.c
index 5c2dda3..e03584f 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -116,7 +116,8 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link_state_change, CTLFLAG_RW,
/* Log promiscuous mode change events */
static int log_promisc_mode_change = 1;
-SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RW,
+TUNABLE_INT("net.link.log_promisc_mode_change", &log_promisc_mode_change);
+SYSCTL_INT(_net_link, OID_AUTO, log_promisc_mode_change, CTLFLAG_RDTUN,
&log_promisc_mode_change, 1,
"log promiscuous mode change events");
diff --git a/sys/netinet/ip_dummynet.h b/sys/netinet/ip_dummynet.h
index 1c09197..202f1e2 100644
--- a/sys/netinet/ip_dummynet.h
+++ b/sys/netinet/ip_dummynet.h
@@ -104,6 +104,7 @@ enum { /* user flags */
DN_HAS_PROFILE = 0x0010, /* a link has a profile */
DN_IS_RED = 0x0020,
DN_IS_GENTLE_RED= 0x0040,
+ DN_IS_ECN = 0x0080,
DN_PIPE_CMD = 0x1000, /* pipe config... */
};
diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c
index a67cf0a..90e2ccf 100644
--- a/sys/netpfil/ipfw/ip_dn_io.c
+++ b/sys/netpfil/ipfw/ip_dn_io.c
@@ -337,6 +337,8 @@ red_drops (struct dn_queue *q, int len)
return (0); /* accept packet */
}
if (q->avg >= fs->max_th) { /* average queue >= max threshold */
+ if (fs->fs.flags & DN_IS_ECN)
+ return (1);
if (fs->fs.flags & DN_IS_GENTLE_RED) {
/*
* According to Gentle-RED, if avg is greater than
@@ -352,6 +354,8 @@ red_drops (struct dn_queue *q, int len)
return (1);
}
} else if (q->avg > fs->min_th) {
+ if (fs->fs.flags & DN_IS_ECN)
+ return (1);
/*
* We compute p_b using the linear dropping function
* p_b = c_1 * avg - c_2
@@ -384,6 +388,70 @@ red_drops (struct dn_queue *q, int len)
}
/*
+ * ECN/ECT Processing (partially adopted from altq)
+ */
+static int
+ecn_mark(struct mbuf* m)
+{
+ struct ip *ip;
+ ip = mtod(m, struct ip *);
+
+ switch (ip->ip_v) {
+ case IPVERSION:
+ {
+ u_int8_t otos;
+ int sum;
+
+ if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_NOTECT)
+ return (0); /* not-ECT */
+ if ((ip->ip_tos & IPTOS_ECN_MASK) == IPTOS_ECN_CE)
+ return (1); /* already marked */
+
+ /*
+ * ecn-capable but not marked,
+ * mark CE and update checksum
+ */
+ otos = ip->ip_tos;
+ ip->ip_tos |= IPTOS_ECN_CE;
+ /*
+ * update checksum (from RFC1624)
+ * HC' = ~(~HC + ~m + m')
+ */
+ sum = ~ntohs(ip->ip_sum) & 0xffff;
+ sum += (~otos & 0xffff) + ip->ip_tos;
+ sum = (sum >> 16) + (sum & 0xffff);
+ sum += (sum >> 16); /* add carry */
+ ip->ip_sum = htons(~sum & 0xffff);
+ return (1);
+ }
+#ifdef INET6
+ case (IPV6_VERSION >> 4):
+ {
+ struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+ u_int32_t flowlabel;
+
+ flowlabel = ntohl(ip6->ip6_flow);
+ if ((flowlabel >> 28) != 6)
+ return (0); /* version mismatch! */
+ if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
+ (IPTOS_ECN_NOTECT << 20))
+ return (0); /* not-ECT */
+ if ((flowlabel & (IPTOS_ECN_MASK << 20)) ==
+ (IPTOS_ECN_CE << 20))
+ return (1); /* already marked */
+ /*
+ * ecn-capable but not marked, mark CE
+ */
+ flowlabel |= (IPTOS_ECN_CE << 20);
+ ip6->ip6_flow = htonl(flowlabel);
+ return (1);
+ }
+#endif
+ }
+ return (0);
+}
+
+/*
* Enqueue a packet in q, subject to space and queue management policy
* (whose parameters are in q->fs).
* Update stats for the queue and the scheduler.
@@ -414,8 +482,10 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop)
goto drop;
if (f->plr && random() < f->plr)
goto drop;
- if (f->flags & DN_IS_RED && red_drops(q, m->m_pkthdr.len))
- goto drop;
+ if (f->flags & DN_IS_RED && red_drops(q, m->m_pkthdr.len)) {
+ if (!(f->flags & DN_IS_ECN) || !ecn_mark(m))
+ goto drop;
+ }
if (f->flags & DN_QSIZE_BYTES) {
if (q->ni.len_bytes > f->qsize)
goto drop;
@@ -427,14 +497,14 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop)
q->ni.len_bytes += len;
ni->length++;
ni->len_bytes += len;
- return 0;
+ return (0);
drop:
io_pkt_drop++;
q->ni.drops++;
ni->drops++;
FREE_PKT(m);
- return 1;
+ return (1);
}
/*
diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c
index 57216be..420b491 100644
--- a/sys/netpfil/ipfw/ip_dummynet.c
+++ b/sys/netpfil/ipfw/ip_dummynet.c
@@ -1073,7 +1073,10 @@ config_red(struct dn_fsk *fs)
fs->min_th = SCALE(fs->fs.min_th);
fs->max_th = SCALE(fs->fs.max_th);
- fs->c_1 = fs->max_p / (fs->fs.max_th - fs->fs.min_th);
+ if (fs->fs.max_th == fs->fs.min_th)
+ fs->c_1 = fs->max_p;
+ else
+ fs->c_1 = SCALE((int64_t)(fs->max_p)) / (fs->fs.max_th - fs->fs.min_th);
fs->c_2 = SCALE_MUL(fs->c_1, SCALE(fs->fs.min_th));
if (fs->fs.flags & DN_IS_GENTLE_RED) {
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index b925960..3559909 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -434,7 +434,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent,
*(struct pf_fragment_cmp *)frag = *key;
frag->fr_flags = 0;
- frag->fr_timeout = time_second;
+ frag->fr_timeout = time_uptime;
frag->fr_maxlen = frent->fe_len;
TAILQ_INIT(&frag->fr_queue);
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
index 55bc165..7a2848a 100644
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/endian.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/sockio.h>
@@ -154,6 +155,7 @@ struct bootpc_ifcontext {
int dhcpquerytype; /* dhcp type sent */
struct in_addr dhcpserver;
int gotdhcpserver;
+ uint16_t mtu;
};
#define TAG_MAXLEN 1024
@@ -195,6 +197,7 @@ struct bootpc_globalcontext {
#define TAG_ROUTERS 3 /* Routers (in order of preference) */
#define TAG_HOSTNAME 12 /* Client host name */
#define TAG_ROOT 17 /* Root path */
+#define TAG_INTF_MTU 26 /* Interface MTU Size (RFC2132) */
/* DHCP specific tags */
#define TAG_OVERLOAD 52 /* Option Overload */
@@ -269,7 +272,7 @@ static int bootpc_call(struct bootpc_globalcontext *gctx,
static void bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx,
struct thread *td);
-static int bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
+static void bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
struct bootpc_globalcontext *gctx, struct thread *td);
static void bootpc_decode_reply(struct nfsv3_diskless *nd,
@@ -1004,33 +1007,41 @@ bootpc_shutdown_interface(struct bootpc_ifcontext *ifctx, struct thread *td)
panic("%s: SIOCDIFADDR, error=%d", __func__, error);
}
-static int
+static void
bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
struct bootpc_globalcontext *gctx, struct thread *td)
{
int error;
- struct sockaddr_in defdst;
- struct sockaddr_in defmask;
struct sockaddr_in *sin;
struct ifreq *ifr;
struct in_aliasreq *ifra;
struct sockaddr_in *myaddr;
struct sockaddr_in *netmask;
- struct sockaddr_in *gw;
ifr = &ifctx->ireq;
ifra = &ifctx->iareq;
myaddr = &ifctx->myaddr;
netmask = &ifctx->netmask;
- gw = &ifctx->gw;
if (bootpc_ifctx_isresolved(ifctx) == 0) {
/* Shutdown interfaces where BOOTP failed */
bootpc_shutdown_interface(ifctx, td);
- return (0);
+ return;
}
- printf("Adjusted interface %s\n", ifctx->ireq.ifr_name);
+ printf("Adjusted interface %s", ifctx->ireq.ifr_name);
+
+ /* Do BOOTP interface options */
+ if (ifctx->mtu != 0) {
+ printf(" (MTU=%d%s)", ifctx->mtu,
+ (ifctx->mtu > 1514) ? "/JUMBO" : "");
+ ifr->ifr_mtu = ifctx->mtu;
+ error = ifioctl(bootp_so, SIOCSIFMTU, (caddr_t) ifr, td);
+ if (error != 0)
+ panic("%s: SIOCSIFMTU, error=%d", __func__, error);
+ }
+ printf("\n");
+
/*
* Do enough of ifconfig(8) so that the chosen interface
* can talk to the servers. (just set the address)
@@ -1050,24 +1061,48 @@ bootpc_adjust_interface(struct bootpc_ifcontext *ifctx,
error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td);
if (error != 0)
panic("%s: SIOCAIFADDR, error=%d", __func__, error);
+}
+
+static void
+bootpc_add_default_route(struct bootpc_ifcontext *ifctx)
+{
+ int error;
+ struct sockaddr_in defdst;
+ struct sockaddr_in defmask;
- /* Add new default route */
+ if (ifctx->gw.sin_addr.s_addr == htonl(INADDR_ANY))
+ return;
- if (ifctx->gotgw != 0 || gctx->gotgw == 0) {
- clear_sinaddr(&defdst);
- clear_sinaddr(&defmask);
- /* XXX MRT just table 0 */
- error = rtrequest_fib(RTM_ADD,
- (struct sockaddr *) &defdst, (struct sockaddr *) gw,
- (struct sockaddr *) &defmask,
- (RTF_UP | RTF_GATEWAY | RTF_STATIC), NULL, RT_DEFAULT_FIB);
- if (error != 0) {
- printf("%s: RTM_ADD, error=%d\n", __func__, error);
- return (error);
- }
+ clear_sinaddr(&defdst);
+ clear_sinaddr(&defmask);
+
+ error = rtrequest_fib(RTM_ADD, (struct sockaddr *)&defdst,
+ (struct sockaddr *) &ifctx->gw, (struct sockaddr *)&defmask,
+ (RTF_UP | RTF_GATEWAY | RTF_STATIC), NULL, RT_DEFAULT_FIB);
+ if (error != 0) {
+ printf("%s: RTM_ADD, error=%d\n", __func__, error);
}
+}
+
+static void
+bootpc_remove_default_route(struct bootpc_ifcontext *ifctx)
+{
+ int error;
+ struct sockaddr_in defdst;
+ struct sockaddr_in defmask;
+
+ if (ifctx->gw.sin_addr.s_addr == htonl(INADDR_ANY))
+ return;
+
+ clear_sinaddr(&defdst);
+ clear_sinaddr(&defmask);
- return (0);
+ error = rtrequest_fib(RTM_DELETE, (struct sockaddr *)&defdst,
+ (struct sockaddr *) &ifctx->gw, (struct sockaddr *)&defmask,
+ (RTF_UP | RTF_GATEWAY | RTF_STATIC), NULL, RT_DEFAULT_FIB);
+ if (error != 0) {
+ printf("%s: RTM_DELETE, error=%d\n", __func__, error);
+ }
}
static int
@@ -1459,6 +1494,8 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
if (p == NULL) {
p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
TAG_ROOT);
+ if (p != NULL)
+ ifctx->gotrootpath = 1;
}
#ifdef ROOTDEVNAME
if ((p == NULL || (boothowto & RB_DFLTROOT) != 0) &&
@@ -1478,7 +1515,6 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
}
printf("rootfs %s ", p);
gctx->gotrootpath = 1;
- ifctx->gotrootpath = 1;
gctx->setrootfs = ifctx;
p = bootpc_tag(&gctx->tag, &ifctx->reply,
@@ -1518,6 +1554,11 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
p[i] = '\0';
}
+ p = bootpc_tag(&gctx->tag, &ifctx->reply, ifctx->replylen,
+ TAG_INTF_MTU);
+ if (p != NULL) {
+ ifctx->mtu = be16dec(p);
+ }
printf("\n");
@@ -1529,10 +1570,6 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
else
ifctx->netmask.sin_addr.s_addr = htonl(IN_CLASSC_NET);
}
- if (ifctx->gotgw == 0) {
- /* Use proxyarp */
- ifctx->gw.sin_addr.s_addr = ifctx->myaddr.sin_addr.s_addr;
- }
}
void
@@ -1724,9 +1761,11 @@ retry:
setenv("boot.netif.name", ifctx->ifp->if_xname);
+ bootpc_add_default_route(ifctx);
error = md_mount(&nd->root_saddr, nd->root_hostnam,
nd->root_fh, &nd->root_fhsize,
&nd->root_args, td);
+ bootpc_remove_default_route(ifctx);
if (error != 0) {
if (gctx->any_root_overrides == 0)
panic("nfs_boot: mount root, error=%d", error);
@@ -1747,6 +1786,7 @@ retry:
ifctx->myaddr.sin_addr.s_addr |
~ ifctx->netmask.sin_addr.s_addr;
bcopy(&ifctx->netmask, &nd->myif.ifra_mask, sizeof(ifctx->netmask));
+ bcopy(&ifctx->gw, &nd->mygateway, sizeof(ifctx->gw));
out:
while((ifctx = STAILQ_FIRST(&gctx->interfaces)) != NULL) {
diff --git a/sys/ofed/include/linux/etherdevice.h b/sys/ofed/include/linux/etherdevice.h
index c50dc5d..a975bd0 100644
--- a/sys/ofed/include/linux/etherdevice.h
+++ b/sys/ofed/include/linux/etherdevice.h
@@ -37,6 +37,9 @@
#include <linux/types.h>
+#include <sys/random.h>
+#include <sys/libkern.h>
+
#define ETH_MODULE_SFF_8079 1
#define ETH_MODULE_SFF_8079_LEN 256
#define ETH_MODULE_SFF_8472 2
@@ -113,4 +116,31 @@ static inline void ether_addr_copy(u8 *dst, const u8 *src)
memcpy(dst, src, 6);
}
+static inline bool
+ether_addr_equal(const u8 *pa, const u8 *pb)
+{
+ return (memcmp(pa, pb, 6) == 0);
+}
+
+static inline bool
+ether_addr_equal_64bits(const u8 *pa, const u8 *pb)
+{
+ return (memcmp(pa, pb, 6) == 0);
+}
+
+static inline void
+eth_broadcast_addr(u8 *pa)
+{
+ memset(pa, 0xff, 6);
+}
+
+static inline void
+random_ether_addr(u8 * dst)
+{
+ read_random(dst, 6);
+
+ dst[0] &= 0xfe;
+ dst[0] |= 0x02;
+}
+
#endif /* _LINUX_ETHERDEVICE */
diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c
index d53773c..a053a1a 100644
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -901,11 +901,7 @@ cpu_set_syscall_retval(struct thread *td, int error)
tf->srr0 -= 4;
break;
default:
- if (p->p_sysent->sv_errsize) {
- error = (error < p->p_sysent->sv_errsize) ?
- p->p_sysent->sv_errtbl[error] : -1;
- }
- tf->fixreg[FIRSTARG] = error;
+ tf->fixreg[FIRSTARG] = SV_ABI_ERRNO(p, error);
tf->cr |= 0x10000000; /* Set summary overflow */
break;
}
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index 60e4a2f..056a1b3 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -196,13 +196,7 @@ cpu_set_syscall_retval(struct thread *td, int error)
break;
default:
- if (td->td_proc->p_sysent->sv_errsize) {
- if (error >= td->td_proc->p_sysent->sv_errsize)
- error = -1; /* XXX */
- else
- error = td->td_proc->p_sysent->sv_errtbl[error];
- }
- td->td_frame->tf_out[0] = error;
+ td->td_frame->tf_out[0] = SV_ABI_ERRNO(td->td_proc, error);
td->td_frame->tf_tstate |= TSTATE_XCC_C;
break;
}
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h
index 8436ba3..747b8ff 100644
--- a/sys/sys/sysent.h
+++ b/sys/sys/sysent.h
@@ -141,6 +141,8 @@ struct sysentvec {
#define SV_SHP 0x010000
#define SV_ABI_MASK 0xff
+#define SV_ABI_ERRNO(p, e) ((p)->p_sysent->sv_errsize <= 0 ? e : \
+ ((e) >= (p)->p_sysent->sv_errsize ? -1 : (p)->p_sysent->sv_errtbl[e]))
#define SV_PROC_FLAG(p, x) ((p)->p_sysent->sv_flags & (x))
#define SV_PROC_ABI(p) ((p)->p_sysent->sv_flags & SV_ABI_MASK)
#define SV_CURPROC_FLAG(x) SV_PROC_FLAG(curproc, x)
@@ -152,8 +154,6 @@ struct sysentvec {
#ifdef _KERNEL
extern struct sysentvec aout_sysvec;
-extern struct sysentvec elf_freebsd_sysvec;
-extern struct sysentvec null_sysvec;
extern struct sysent sysent[];
extern const char *syscallnames[];
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index d3d79aba..93037ae 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -286,6 +286,7 @@ struct vattr {
*/
#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */
#define VA_EXCLUSIVE 0x02 /* exclusive create request */
+#define VA_SYNC 0x04 /* O_SYNC truncation */
/*
* Flags for ioflag. (high 16 bits used to ask for read-ahead and
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 608f876..ca92da2 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -562,7 +562,7 @@ extclean:
softdep_journal_freeblocks(ip, cred, length, IO_EXT);
else
softdep_setup_freeblocks(ip, length, IO_EXT);
- return (ffs_update(vp, !DOINGASYNC(vp)));
+ return (ffs_update(vp, (flags & IO_SYNC) != 0 || !DOINGASYNC(vp)));
}
/*
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index a46ce4c..fe07ff0 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -512,7 +512,7 @@ ffs_mount(struct mount *mp)
* We need the name for the mount point (also used for
* "last mounted on") copied in. If an error occurs,
* the mount point is discarded by the upper level code.
- * Note that vfs_mount() populates f_mntonname for us.
+ * Note that vfs_mount_alloc() populates f_mntonname for us.
*/
if ((error = ffs_mountfs(devvp, mp, td)) != 0) {
vrele(devvp);
@@ -764,23 +764,31 @@ ffs_mountfs(devvp, mp, td)
cred = td ? td->td_ucred : NOCRED;
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
+ KASSERT(devvp->v_type == VCHR, ("reclaimed devvp"));
dev = devvp->v_rdev;
- dev_ref(dev);
+ if (atomic_cmpset_acq_ptr((uintptr_t *)&dev->si_mountpt, 0,
+ (uintptr_t)mp) == 0) {
+ VOP_UNLOCK(devvp, 0);
+ return (EBUSY);
+ }
DROP_GIANT();
g_topology_lock();
error = g_vfs_open(devvp, &cp, "ffs", ronly ? 0 : 1);
g_topology_unlock();
PICKUP_GIANT();
+ if (error != 0) {
+ atomic_store_rel_ptr((uintptr_t *)&dev->si_mountpt, 0);
+ VOP_UNLOCK(devvp, 0);
+ return (error);
+ }
+ dev_ref(dev);
+ devvp->v_bufobj.bo_ops = &ffs_ops;
VOP_UNLOCK(devvp, 0);
- if (error)
- goto out;
- if (devvp->v_rdev->si_iosize_max != 0)
- mp->mnt_iosize_max = devvp->v_rdev->si_iosize_max;
+ if (dev->si_iosize_max != 0)
+ mp->mnt_iosize_max = dev->si_iosize_max;
if (mp->mnt_iosize_max > MAXPHYS)
mp->mnt_iosize_max = MAXPHYS;
- devvp->v_bufobj.bo_ops = &ffs_ops;
-
fs = NULL;
sblockloc = 0;
/*
@@ -1049,8 +1057,6 @@ ffs_mountfs(devvp, mp, td)
ffs_flushfiles(mp, FORCECLOSE, td);
goto out;
}
- if (devvp->v_type == VCHR && devvp->v_rdev != NULL)
- devvp->v_rdev->si_mountpt = mp;
if (fs->fs_snapinum[0] != 0)
ffs_snapshot_mount(mp);
fs->fs_fmod = 1;
@@ -1058,7 +1064,7 @@ ffs_mountfs(devvp, mp, td)
(void) ffs_sbupdate(ump, MNT_WAIT, 0);
}
/*
- * Initialize filesystem stat information in mount struct.
+ * Initialize filesystem state information in mount struct.
*/
MNT_ILOCK(mp);
mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
@@ -1100,6 +1106,7 @@ out:
free(ump, M_UFSMNT);
mp->mnt_data = NULL;
}
+ atomic_store_rel_ptr((uintptr_t *)&dev->si_mountpt, 0);
dev_rel(dev);
return (error);
}
@@ -1285,8 +1292,7 @@ ffs_unmount(mp, mntflags)
g_vfs_close(ump->um_cp);
g_topology_unlock();
PICKUP_GIANT();
- if (ump->um_devvp->v_type == VCHR && ump->um_devvp->v_rdev != NULL)
- ump->um_devvp->v_rdev->si_mountpt = NULL;
+ atomic_store_rel_ptr((uintptr_t *)&ump->um_dev->si_mountpt, 0);
vrele(ump->um_devvp);
dev_rel(ump->um_dev);
mtx_destroy(UFS_MTX(ump));
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index 85ab35a..c563300 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1131,9 +1131,9 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename)
if (tvp != NULL)
VOP_UNLOCK(tvp, 0);
error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff,
- IO_NORMAL | IO_SYNC, cr);
+ IO_NORMAL | (DOINGASYNC(dvp) ? 0 : IO_SYNC), cr);
if (error != 0)
- vprint("ufs_direnter: failted to truncate", dvp);
+ vprint("ufs_direnter: failed to truncate", dvp);
#ifdef UFS_DIRHASH
if (error == 0 && dp->i_dirhash != NULL)
ufsdirhash_dirtrunc(dp, dp->i_endoff);
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 392a626..3d91a71 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -626,7 +626,8 @@ ufs_setattr(ap)
*/
return (0);
}
- if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL,
+ if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL |
+ ((vap->va_vaflags & VA_SYNC) != 0 ? IO_SYNC : 0),
cred)) != 0)
return (error);
}
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index de2dff2..7fc922e 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -732,8 +732,6 @@ faultin(p)
* This swapin algorithm attempts to swap-in processes only if there
* is enough space for them. Of course, if a process waits for a long
* time, it will be swapped in anyway.
- *
- * Giant is held on entry.
*/
void
swapper(void)
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index e9d1280..5ea59b3 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -1673,11 +1673,11 @@ vm_object_qcollapse(vm_object_t object)
void
vm_object_collapse(vm_object_t object)
{
+ vm_object_t backing_object, new_backing_object;
+
VM_OBJECT_ASSERT_WLOCKED(object);
-
- while (TRUE) {
- vm_object_t backing_object;
+ while (TRUE) {
/*
* Verify that the conditions are right for collapse:
*
@@ -1703,14 +1703,13 @@ vm_object_collapse(vm_object_t object)
break;
}
- if (
- object->paging_in_progress != 0 ||
- backing_object->paging_in_progress != 0
- ) {
+ if (object->paging_in_progress != 0 ||
+ backing_object->paging_in_progress != 0) {
vm_object_qcollapse(object);
VM_OBJECT_WUNLOCK(backing_object);
break;
}
+
/*
* We know that we can either collapse the backing object (if
* the parent is the only reference to it) or (perhaps) have
@@ -1722,6 +1721,9 @@ vm_object_collapse(vm_object_t object)
* case.
*/
if (backing_object->ref_count == 1) {
+ vm_object_pip_add(object, 1);
+ vm_object_pip_add(backing_object, 1);
+
/*
* If there is exactly one reference to the backing
* object, we can collapse it into the parent.
@@ -1793,15 +1795,15 @@ vm_object_collapse(vm_object_t object)
KASSERT(backing_object->ref_count == 1, (
"backing_object %p was somehow re-referenced during collapse!",
backing_object));
+ vm_object_pip_wakeup(backing_object);
backing_object->type = OBJT_DEAD;
backing_object->ref_count = 0;
VM_OBJECT_WUNLOCK(backing_object);
vm_object_destroy(backing_object);
+ vm_object_pip_wakeup(object);
object_collapses++;
} else {
- vm_object_t new_backing_object;
-
/*
* If we do not entirely shadow the backing object,
* there is nothing we can do so we give up.
@@ -2130,6 +2132,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset,
*/
if (!reserved && !swap_reserve_by_cred(ptoa(next_size),
prev_object->cred)) {
+ VM_OBJECT_WUNLOCK(prev_object);
return (FALSE);
}
prev_object->charge += ptoa(next_size);
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 243b11f..512151b 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1838,8 +1838,10 @@ retry:
m < &m_ret[npages]; m++) {
if ((req & VM_ALLOC_WIRED) != 0)
m->wire_count = 0;
- if (m >= m_tmp)
+ if (m >= m_tmp) {
m->object = NULL;
+ m->oflags |= VPO_UNMANAGED;
+ }
vm_page_free(m);
}
return (NULL);
@@ -2580,7 +2582,8 @@ vm_page_cache(vm_page_t m)
cache_was_empty = vm_radix_is_empty(&object->cache);
if (vm_radix_insert(&object->cache, m)) {
mtx_unlock(&vm_page_queue_free_mtx);
- if (object->resident_page_count == 0)
+ if (object->type == OBJT_VNODE &&
+ object->resident_page_count == 0)
vdrop(object->handle);
m->object = NULL;
vm_page_free(m);
diff --git a/tools/tools/ioat/Makefile b/tools/tools/ioat/Makefile
new file mode 100644
index 0000000..62771ad
--- /dev/null
+++ b/tools/tools/ioat/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+PROG= ioatcontrol
+MAN= ioatcontrol.8
+CFLAGS+= -I${.CURDIR:H:H:H}/sys/dev/ioat
+WARNS?= 6
+#LIBADD= util
+LDADD= -lutil
+
+.include <bsd.prog.mk>
diff --git a/tools/tools/ioat/ioatcontrol.8 b/tools/tools/ioat/ioatcontrol.8
new file mode 100644
index 0000000..9e156fd
--- /dev/null
+++ b/tools/tools/ioat/ioatcontrol.8
@@ -0,0 +1,182 @@
+.\" Copyright (c) 2015 EMC / Isilon Storage Division
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 14, 2015
+.Dt IOATCONTROL 8
+.Os
+.Sh NAME
+.Nm ioatcontrol
+.Nd Userspace tool to test
+.Xr ioat 4
+.Sh SYNOPSIS
+.Nm
+.Op Fl c Ar period
+.Op Fl E
+.Op Fl f
+.Op Fl m
+.Op Fl V
+.Op Fl z
+.Ar channel_number
+.Ar num_txns
+.Ar [ bufsize
+.Ar [ chain-len
+.Ar [ duration ] ] ]
+.Nm
+.Fl r
+.Op Fl c Ar period
+.Op Fl v
+.Op Fl V
+.Op Fl w
+.Op Fl z
+.Ar channel_number
+.Ar address
+.Ar [ bufsize ]
+.Sh DESCRIPTION
+.Nm
+allows one to issue some number of test operations to the
+.Xr ioat 4
+driver on a specific hardware channel.
+The arguments are as follows:
+.Bl -tag -width Ds
+.It Fl c Ar period
+Configure the channel's interrupt coalescing period, in microseconds.
+.It Fl E
+Test non-contiguous 8k copy.
+.It Fl f
+Test block fill (by default,
+.Nm
+tests copy)
+.It Fl m
+Test memcpy instead of DMA.
+.It Fl V
+Verify copies/fills for accuracy
+.It Fl z
+Zero device statistics before running test.
+.El
+.Pp
+Alternatively one can use
+.Nm
+.Fl r
+to issue DMA to or from a specific
+.Ar address .
+The arguments in "raw" mode are:
+.Bl -tag -width Ds
+.It Fl c Ar period
+As above.
+.It Fl v
+.Ar address
+is a kernel virtual address (by default,
+.Ar address
+is assumed to be a physical address)
+.It Fl V
+Dump the resulting hex to syslog
+.It Fl w
+Write to the specified
+.Ar address
+(by default,
+.Nm
+.Fl r
+reads)
+.It Fl z
+As above.
+.El
+.Pp
+.Nm
+operates in one of two modes; if the
+.Ar duration
+argument is passed,
+.Nm
+tries to estimate the copy rate in bytes per second by running
+.Ar num_txns
+repeatedly in loop.
+If
+.Ar duration
+is not passed,
+.Nm
+only runs through
+.Ar num_txns
+once and prints the total bytes copied, as well as error information.
+.Pp
+The
+.Ar bufsize
+argument determines the size of buffers to use for each
+.Fn ioat_copy
+invocation.
+The default is 256 KB.
+In raw mode, the default is 4 KB.
+.Pp
+The
+.Ar chain-len
+argument determines the number of copies to chain together in a single DMA
+transaction.
+The default is 1, and the maximum is currently 4.
+.Pp
+The
+.Ar duration
+argument specifies an approximate time limit for the test, in milliseconds.
+.Pp
+The test will allocate two chunks of memory for each component of each
+transaction's chain.
+It will initialize them with specific data patterns.
+During the test, it submits DMA requests to copy between pairs of buffers.
+If the
+.Fl V
+flag was specified, it will compare the contents in the callback for a copy
+error.
+.Sh FILES
+.Pa /dev/ioat_test
+.Pp
+The interface between
+.Nm
+and
+.Xr ioat 4 .
+.Xr ioat 4
+exposes it with
+.Cd hw.ioat.enable_ioat_test=1 .
+.Sh DIAGNOSTICS
+The wait channel
+.Va test_submit
+indicates that the test code has enqueued all requested transactions and is
+waiting on the IOAT hardware to complete one before issuing another operation.
+.Sh SEE ALSO
+.Xr ioat 4
+.Sh HISTORY
+The
+.Xr ioat 4
+driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+The
+.Xr ioat 4
+driver and
+.Nm
+tool were developed by
+.An \&Jim Harris Aq Mt jimharris@FreeBSD.org ,
+.An \&Carl Delsey Aq Mt carl.r.delsey@intel.com ,
+and
+.An \&Conrad Meyer Aq Mt cem@FreeBSD.org .
+This manual page was written by
+.An \&Conrad Meyer Aq Mt cem@FreeBSD.org .
diff --git a/tools/tools/ioat/ioatcontrol.c b/tools/tools/ioat/ioatcontrol.c
new file mode 100644
index 0000000..32decc7
--- /dev/null
+++ b/tools/tools/ioat/ioatcontrol.c
@@ -0,0 +1,258 @@
+/*-
+ * Copyright (C) 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include <libutil.h>
+
+#include "ioat_test.h"
+
+static int prettyprint(struct ioat_test *);
+
+static void
+usage(void)
+{
+
+ printf("Usage: %s [-E|-f|-m] OPTIONS <channel #> <txns> [<bufsize> "
+ "[<chain-len> [duration]]]\n", getprogname());
+ printf(" %s -r [-v] OPTIONS <channel #> <addr> [<bufsize>]\n\n",
+ getprogname());
+ printf(" OPTIONS:\n");
+ printf(" -c <period> - Enable interrupt coalescing (us)\n");
+ printf(" -V - Enable verification\n");
+ printf(" -z - Zero device stats before test\n");
+ exit(EX_USAGE);
+}
+
+static void
+main_raw(struct ioat_test *t, int argc, char **argv)
+{
+ int fd;
+
+ /* Raw DMA defaults */
+ t->testkind = IOAT_TEST_RAW_DMA;
+ t->transactions = 1;
+ t->chain_depth = 1;
+ t->buffer_size = 4 * 1024;
+
+ t->raw_target = strtoull(argv[1], NULL, 0);
+ if (t->raw_target == 0) {
+ printf("Target shoudln't be NULL\n");
+ exit(EX_USAGE);
+ }
+
+ if (argc >= 3) {
+ t->buffer_size = atoi(argv[2]);
+ if (t->buffer_size == 0) {
+ printf("Buffer size must be greater than zero\n");
+ exit(EX_USAGE);
+ }
+ }
+
+ fd = open("/dev/ioat_test", O_RDWR);
+ if (fd < 0) {
+ printf("Cannot open /dev/ioat_test\n");
+ exit(EX_UNAVAILABLE);
+ }
+
+ (void)ioctl(fd, IOAT_DMATEST, t);
+ close(fd);
+
+ exit(prettyprint(t));
+}
+
+int
+main(int argc, char **argv)
+{
+ struct ioat_test t;
+ int fd, ch;
+ bool fflag, rflag, Eflag, mflag;
+ unsigned modeflags;
+
+ fflag = rflag = Eflag = mflag = false;
+ modeflags = 0;
+
+ while ((ch = getopt(argc, argv, "c:EfmrvVwz")) != -1) {
+ switch (ch) {
+ case 'c':
+ t.coalesce_period = atoi(optarg);
+ break;
+ case 'E':
+ Eflag = true;
+ modeflags++;
+ break;
+ case 'f':
+ fflag = true;
+ modeflags++;
+ break;
+ case 'm':
+ mflag = true;
+ modeflags++;
+ break;
+ case 'r':
+ rflag = true;
+ modeflags++;
+ break;
+ case 'v':
+ t.raw_is_virtual = true;
+ break;
+ case 'V':
+ t.verify = true;
+ break;
+ case 'w':
+ t.raw_write = true;
+ break;
+ case 'z':
+ t.zero_stats = true;
+ break;
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 2)
+ usage();
+
+ if (modeflags > 1) {
+ printf("Invalid: Cannot use >1 mode flag (-E, -f, -m, or -r)\n");
+ usage();
+ }
+
+ /* Defaults for optional args */
+ t.buffer_size = 256 * 1024;
+ t.chain_depth = 2;
+ t.duration = 0;
+ t.testkind = IOAT_TEST_DMA;
+
+ if (fflag)
+ t.testkind = IOAT_TEST_FILL;
+ else if (Eflag) {
+ t.testkind = IOAT_TEST_DMA_8K;
+ t.buffer_size = 8 * 1024;
+ } else if (mflag)
+ t.testkind = IOAT_TEST_MEMCPY;
+
+ t.channel_index = atoi(argv[0]);
+ if (t.channel_index > 8) {
+ printf("Channel number must be between 0 and 7.\n");
+ return (EX_USAGE);
+ }
+
+ if (rflag) {
+ main_raw(&t, argc, argv);
+ return (EX_OK);
+ }
+
+ t.transactions = atoi(argv[1]);
+
+ if (argc >= 3) {
+ t.buffer_size = atoi(argv[2]);
+ if (t.buffer_size == 0) {
+ printf("Buffer size must be greater than zero\n");
+ return (EX_USAGE);
+ }
+ }
+
+ if (argc >= 4) {
+ t.chain_depth = atoi(argv[3]);
+ if (t.chain_depth < 1) {
+ printf("Chain length must be greater than zero\n");
+ return (EX_USAGE);
+ }
+ }
+
+ if (argc >= 5) {
+ t.duration = atoi(argv[4]);
+ if (t.duration < 1) {
+ printf("Duration must be greater than zero\n");
+ return (EX_USAGE);
+ }
+ }
+
+ fd = open("/dev/ioat_test", O_RDWR);
+ if (fd < 0) {
+ printf("Cannot open /dev/ioat_test\n");
+ return (EX_UNAVAILABLE);
+ }
+
+ (void)ioctl(fd, IOAT_DMATEST, &t);
+ close(fd);
+
+ return (prettyprint(&t));
+}
+
+static int
+prettyprint(struct ioat_test *t)
+{
+ char bps[10], bytesh[10];
+ uintmax_t bytes;
+
+ if (t->status[IOAT_TEST_NO_DMA_ENGINE] != 0 ||
+ t->status[IOAT_TEST_NO_MEMORY] != 0 ||
+ t->status[IOAT_TEST_MISCOMPARE] != 0) {
+ printf("Errors:\n");
+ if (t->status[IOAT_TEST_NO_DMA_ENGINE] != 0)
+ printf("\tNo DMA engine present: %u\n",
+ (unsigned)t->status[IOAT_TEST_NO_DMA_ENGINE]);
+ if (t->status[IOAT_TEST_NO_MEMORY] != 0)
+ printf("\tOut of memory: %u\n",
+ (unsigned)t->status[IOAT_TEST_NO_MEMORY]);
+ if (t->status[IOAT_TEST_MISCOMPARE] != 0)
+ printf("\tMiscompares: %u\n",
+ (unsigned)t->status[IOAT_TEST_MISCOMPARE]);
+ }
+
+ printf("Processed %u txns\n", (unsigned)t->status[IOAT_TEST_OK] /
+ t->chain_depth);
+ bytes = (uintmax_t)t->buffer_size * t->status[IOAT_TEST_OK];
+
+ humanize_number(bytesh, sizeof(bytesh), (int64_t)bytes, "B",
+ HN_AUTOSCALE, HN_DECIMAL);
+ if (t->duration) {
+ humanize_number(bps, sizeof(bps),
+ (int64_t)1000 * bytes / t->duration, "B/s", HN_AUTOSCALE,
+ HN_DECIMAL);
+ printf("%ju (%s) copied in %u ms (%s)\n", bytes, bytesh,
+ (unsigned)t->duration, bps);
+ } else
+ printf("%ju (%s) copied\n", bytes, bytesh);
+
+ return (EX_OK);
+}
diff --git a/usr.bin/mt/mt.1 b/usr.bin/mt/mt.1
index 33c1c18..7af3d2b 100644
--- a/usr.bin/mt/mt.1
+++ b/usr.bin/mt/mt.1
@@ -29,7 +29,7 @@
.\" @(#)mt.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd March 3, 2014
+.Dd May 20, 2016
.Dt MT 1
.Os
.Sh NAME
@@ -517,6 +517,7 @@ Value Width Tracks Density Code Type Reference Note
0x55 12.7 (0.5) 5120 20,670 (525,018) C 3592A5 (unencrypted)
0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5
0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6
+0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7
0x71 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (encrypted)
0x72 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (encrypted)
0x73 12.7 (0.5) 1152 13,452 (341,681) C 3592A3 (encrypted)
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 91fd7b9..950e30d 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -369,7 +369,7 @@ substitute(struct s_command *cp)
{
SPACE tspace;
regex_t *re;
- regoff_t re_off, slen;
+ regoff_t slen;
int lastempty, n;
char *s;
@@ -390,61 +390,55 @@ substitute(struct s_command *cp)
n = cp->u.s->n;
lastempty = 1;
- switch (n) {
- case 0: /* Global */
- do {
- if (lastempty || match[0].rm_so != match[0].rm_eo) {
- /* Locate start of replaced string. */
- re_off = match[0].rm_so;
- /* Copy leading retained string. */
- cspace(&SS, s, re_off, APPEND);
- /* Add in regular expression. */
- regsub(&SS, s, cp->u.s->new);
- }
+ do {
+ /* Copy the leading retained string. */
+ if (n <= 1 && match[0].rm_so)
+ cspace(&SS, s, match[0].rm_so, APPEND);
- /* Move past this match. */
- if (match[0].rm_so != match[0].rm_eo) {
- s += match[0].rm_eo;
- slen -= match[0].rm_eo;
- lastempty = 0;
+ /* Skip zero-length matches right after other matches. */
+ if (lastempty || match[0].rm_so ||
+ match[0].rm_so != match[0].rm_eo) {
+ if (n <= 1) {
+ /* Want this match: append replacement. */
+ regsub(&SS, s, cp->u.s->new);
+ if (n == 1)
+ n = -1;
} else {
- if (match[0].rm_so < slen)
- cspace(&SS, s + match[0].rm_so, 1,
- APPEND);
- s += match[0].rm_so + 1;
- slen -= match[0].rm_so + 1;
- lastempty = 1;
+ /* Want a later match: append original. */
+ if (match[0].rm_eo)
+ cspace(&SS, s, match[0].rm_eo, APPEND);
+ n--;
}
- } while (slen >= 0 && regexec_e(re, s, REG_NOTBOL, 0, slen));
- /* Copy trailing retained string. */
- if (slen > 0)
- cspace(&SS, s, slen, APPEND);
- break;
- default: /* Nth occurrence */
- while (--n) {
- if (match[0].rm_eo == match[0].rm_so)
- match[0].rm_eo = match[0].rm_so + 1;
- s += match[0].rm_eo;
- slen -= match[0].rm_eo;
- if (slen < 0)
- return (0);
- if (!regexec_e(re, s, REG_NOTBOL, 0, slen))
- return (0);
}
- /* FALLTHROUGH */
- case 1: /* 1st occurrence */
- /* Locate start of replaced string. */
- re_off = match[0].rm_so + (s - ps);
- /* Copy leading retained string. */
- cspace(&SS, ps, re_off, APPEND);
- /* Add in regular expression. */
- regsub(&SS, s, cp->u.s->new);
- /* Copy trailing retained string. */
+
+ /* Move past this match. */
s += match[0].rm_eo;
slen -= match[0].rm_eo;
+
+ /*
+ * After a zero-length match, advance one byte,
+ * and at the end of the line, terminate.
+ */
+ if (match[0].rm_so == match[0].rm_eo) {
+ if (*s == '\0' || *s == '\n')
+ slen = -1;
+ else
+ slen--;
+ if (*s != '\0')
+ cspace(&SS, s++, 1, APPEND);
+ lastempty = 1;
+ } else
+ lastempty = 0;
+
+ } while (n >= 0 && slen >= 0 && regexec_e(re, s, REG_NOTBOL, 0, slen));
+
+ /* Did not find the requested number of matches. */
+ if (n > 1)
+ return (0);
+
+ /* Copy the trailing retained string. */
+ if (slen > 0)
cspace(&SS, s, slen, APPEND);
- break;
- }
/*
* Swap the substitute space and the pattern space, and make sure
diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1
index 277535e..6f0c06f 100644
--- a/usr.bin/sed/sed.1
+++ b/usr.bin/sed/sed.1
@@ -31,7 +31,7 @@
.\" @(#)sed.1 8.2 (Berkeley) 12/30/93
.\" $FreeBSD$
.\"
-.Dd June 20, 2014
+.Dd May 10, 2016
.Dt SED 1
.Os
.Sh NAME
@@ -198,7 +198,7 @@ option was specified);
a context address
that consists of a regular expression preceded and followed by a
delimiter. The closing delimiter can also optionally be followed by the
-.Dq i
+.Dq I
character, to indicate that the regular expression is to be matched
in a case-insensitive way.
.El
diff --git a/usr.sbin/acpi/acpidb/acpidb.c b/usr.sbin/acpi/acpidb/acpidb.c
index b3d0021..7f4e49f 100644
--- a/usr.sbin/acpi/acpidb/acpidb.c
+++ b/usr.sbin/acpi/acpidb/acpidb.c
@@ -383,8 +383,7 @@ load_dsdt(const char *dsdtfile)
char filetmp[PATH_MAX];
u_int8_t *code;
struct stat sb;
- int fd, fd2;
- int error;
+ int dounlink, error, fd;
fd = open(dsdtfile, O_RDONLY, 0);
if (fd == -1) {
@@ -397,11 +396,13 @@ load_dsdt(const char *dsdtfile)
return (-1);
}
code = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0);
+ close(fd);
if (code == NULL) {
perror("mmap");
return (-1);
}
if ((error = AcpiInitializeSubsystem()) != AE_OK) {
+ munmap(code, (size_t)sb.st_size);
return (-1);
}
@@ -409,21 +410,30 @@ load_dsdt(const char *dsdtfile)
* make sure DSDT data contains table header or not.
*/
if (strncmp((char *)code, "DSDT", 4) == 0) {
- strncpy(filetmp, dsdtfile, sizeof(filetmp));
+ dounlink = 0;
+ strlcpy(filetmp, dsdtfile, sizeof(filetmp));
} else {
+ dounlink = 1;
mode_t mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
dummy_dsdt_table.Length = sizeof(ACPI_TABLE_HEADER) + sb.st_size;
- snprintf(filetmp, sizeof(filetmp), "%s.tmp", dsdtfile);
- fd2 = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
- if (fd2 == -1) {
+ if ((size_t)snprintf(filetmp, sizeof(filetmp), "%s.tmp",
+ dsdtfile) > sizeof(filetmp) - 1) {
+ fprintf(stderr, "file name too long\n");
+ munmap(code, (size_t)sb.st_size);
+ return (-1);
+ }
+ fd = open(filetmp, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ if (fd == -1) {
perror("open");
+ munmap(code, (size_t)sb.st_size);
return (-1);
}
- write(fd2, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER));
+ write(fd, &dummy_dsdt_table, sizeof(ACPI_TABLE_HEADER));
- write(fd2, code, sb.st_size);
- close(fd2);
+ write(fd, code, sb.st_size);
+ close(fd);
}
+ munmap(code, (size_t)sb.st_size);
/*
* Install the virtual machine version of address space handlers.
@@ -484,7 +494,7 @@ load_dsdt(const char *dsdtfile)
AcpiGbl_DebuggerConfiguration = 0;
AcpiDbUserCommands(':', NULL);
- if (strcmp(dsdtfile, filetmp) != 0) {
+ if (dounlink) {
unlink(filetmp);
}
diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index 3c2b302..44f8dca 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -1465,27 +1465,34 @@ dsdt_save_file(char *outfile, ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
void
aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
{
- char buf[PATH_MAX], tmpstr[PATH_MAX];
+ char buf[PATH_MAX], tmpstr[PATH_MAX], wrkdir[PATH_MAX];
+ const char *iname = "/acpdump.din";
+ const char *oname = "/acpdump.dsl";
const char *tmpdir;
- char *tmpext;
FILE *fp;
size_t len;
- int fd;
+ int fd, status;
+ pid_t pid;
tmpdir = getenv("TMPDIR");
if (tmpdir == NULL)
tmpdir = _PATH_TMP;
- strncpy(tmpstr, tmpdir, sizeof(tmpstr));
- if (realpath(tmpstr, buf) == NULL) {
+ if (realpath(tmpdir, buf) == NULL) {
perror("realpath tmp dir");
return;
}
- strncpy(tmpstr, buf, sizeof(tmpstr));
- strncat(tmpstr, "/acpidump.", sizeof(tmpstr) - strlen(buf));
- len = strlen(tmpstr);
- tmpext = tmpstr + len;
- strncpy(tmpext, "XXXXXX", sizeof(tmpstr) - len);
- fd = mkstemp(tmpstr);
+ len = sizeof(wrkdir) - strlen(iname);
+ if ((size_t)snprintf(wrkdir, len, "%s/acpidump.XXXXXX", buf) > len-1 ) {
+ fprintf(stderr, "$TMPDIR too long\n");
+ return;
+ }
+ if (mkdtemp(wrkdir) == NULL) {
+ perror("mkdtemp tmp working dir");
+ return;
+ }
+ assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, iname)
+ <= sizeof(tmpstr) - 1);
+ fd = open(tmpstr, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
if (fd < 0) {
perror("iasl tmp file");
return;
@@ -1494,28 +1501,46 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
close(fd);
/* Run iasl -d on the temp file */
- if (fork() == 0) {
+ if ((pid = fork()) == 0) {
close(STDOUT_FILENO);
if (vflag == 0)
close(STDERR_FILENO);
execl("/usr/sbin/iasl", "iasl", "-d", tmpstr, NULL);
err(1, "exec");
}
-
- wait(NULL);
- unlink(tmpstr);
+ if (pid > 0)
+ wait(&status);
+ if (unlink(tmpstr) < 0) {
+ perror("unlink");
+ goto out;
+ }
+ if (pid < 0) {
+ perror("fork");
+ goto out;
+ }
+ if (status != 0) {
+ fprintf(stderr, "iast exit status = %d\n", status);
+ }
/* Dump iasl's output to stdout */
- strncpy(tmpext, "dsl", sizeof(tmpstr) - len);
+ assert((size_t)snprintf(tmpstr, sizeof(tmpstr), "%s%s", wrkdir, oname)
+ <= sizeof(tmpstr) -1);
fp = fopen(tmpstr, "r");
- unlink(tmpstr);
+ if (unlink(tmpstr) < 0) {
+ perror("unlink");
+ goto out;
+ }
if (fp == NULL) {
perror("iasl tmp file (read)");
- return;
+ goto out;
}
while ((len = fread(buf, 1, sizeof(buf), fp)) > 0)
fwrite(buf, 1, len, stdout);
fclose(fp);
+
+ out:
+ if (rmdir(wrkdir) < 0)
+ perror("rmdir");
}
void
diff --git a/usr.sbin/bsnmpd/bsnmpd/Makefile b/usr.sbin/bsnmpd/bsnmpd/Makefile
index 3e6df47..1724cea 100644
--- a/usr.sbin/bsnmpd/bsnmpd/Makefile
+++ b/usr.sbin/bsnmpd/bsnmpd/Makefile
@@ -16,7 +16,6 @@ XSYM= snmpMIB begemotSnmpdModuleTable begemotSnmpd begemotTrapSinkTable \
freeBSD freeBSDVersion
CLEANFILES= oid.h tree.c tree.h
MAN= bsnmpd.1 snmpmod.3
-NO_WERROR=
FILESGROUPS= BMIBS DEFS
@@ -27,7 +26,7 @@ DEFSDIR= ${SHAREDIR}/snmp/defs
CFLAGS+= -DSNMPTREE_TYPES
CFLAGS+= -I${CONTRIB}/lib -I${CONTRIB}/snmpd -I. -DUSE_LIBBEGEMOT
-CFLAGS+= -DUSE_TCPWRAPPERS -DQUADFMT='"llu"' -DQUADXFMT='"llx"'
+CFLAGS+= -DUSE_TCPWRAPPERS
CFLAGS+= -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_ERR_H -DHAVE_STRLCPY
DPADD= ${LIBBEGEMOT} ${LIBBSNMP} ${LIBWRAP}
LDADD= -lbegemot -lbsnmp -lwrap
@@ -49,4 +48,7 @@ MANFILTER= sed -e 's%@MODPATH@%${LIBDIR}/%g' \
-e 's%@DEFPATH@%${DEFSDIR}/%g' \
-e 's%@MIBSPATH@%${BMIBSDIR}/%g'
+NO_WCAST_ALIGN= yes
+WARNS?= 6
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
index fb0c7e5..28e2b58 100644
--- a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
+++ b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
@@ -500,7 +500,7 @@ snmptool_walk(struct snmp_toolinfo *snmptoolctx)
outputs += rc;
snmp_pdu_free(&resp);
- if (rc < resp.nbindings)
+ if ((u_int)rc < resp.nbindings)
break;
snmpwalk_nextpdu_create(op,
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
index 4f71c58..3833098 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
@@ -56,12 +56,11 @@ snmp_mapping_init(void)
{
struct snmp_mappings *m;
- if ((m = malloc(sizeof(struct snmp_mappings))) == NULL) {
+ if ((m = calloc(1, sizeof(struct snmp_mappings))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (NULL);
}
- memset(m, 0, sizeof(struct snmp_mappings));
return (m);
}
@@ -269,21 +268,18 @@ enum_pair_insert(struct enum_pairs *headp, int32_t enum_val, char *enum_str)
{
struct enum_pair *e_new;
- if ((e_new = malloc(sizeof(struct enum_pair))) == NULL) {
+ if ((e_new = calloc(1, sizeof(struct enum_pair))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
- memset(e_new, 0, sizeof(struct enum_pair));
-
- if ((e_new->enum_str = malloc(strlen(enum_str) + 1)) == NULL) {
+ if ((e_new->enum_str = strdup(enum_str)) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
free(e_new);
return (-1);
}
e_new->enum_val = enum_val;
- strlcpy(e_new->enum_str, enum_str, strlen(enum_str) + 1);
STAILQ_INSERT_TAIL(headp, e_new, link);
return (1);
@@ -482,13 +478,11 @@ snmp_syntax_insert(struct snmp_idxlist *headp, struct enum_pairs *enums,
{
struct index *idx;
- if ((idx = malloc(sizeof(struct index))) == NULL) {
+ if ((idx = calloc(1, sizeof(struct index))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
- memset(idx, 0, sizeof(struct index));
-
if (snmp_index_insert(headp, idx) < 0) {
free(idx);
return (-1);
@@ -558,18 +552,16 @@ snmp_enumtc_init(char *name)
{
struct enum_type *enum_tc;
- if ((enum_tc = malloc(sizeof(struct enum_type))) == NULL) {
+ if ((enum_tc = calloc(1, sizeof(struct enum_type))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (NULL);
}
- memset(enum_tc, 0, sizeof(struct enum_type));
- if ((enum_tc->name = malloc(strlen(name) + 1)) == NULL) {
+ if ((enum_tc->name = strdup(name)) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
free(enum_tc);
return (NULL);
}
- strlcpy(enum_tc->name, name, strlen(name) + 1);
return (enum_tc);
}
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
index 54644d6..6d83078 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
@@ -778,11 +778,11 @@ parse_ntp_ts(struct snmp_value *sv, char *val)
saved_errno = errno;
v = strtoul(val, &endptr, 10);
if (errno != 0 || (v / 1000) > 9) {
- saved_errno = errno;
+ errno = saved_errno;
warnx("Integer value %s not supported", val);
return (-1);
} else
- saved_errno = errno;
+ errno = saved_errno;
if (*endptr != '.') {
warnx("Failed reading octet - %s", val);
@@ -799,11 +799,11 @@ parse_ntp_ts(struct snmp_value *sv, char *val)
saved_errno = errno;
v = strtoul(val, &endptr, 10);
if (errno != 0 || (v / 1000) > 9) {
- saved_errno = errno;
+ errno = saved_errno;
warnx("Integer value %s not supported", val);
return (-1);
} else
- saved_errno = errno;
+ errno = saved_errno;
for (i = 0, d = 1000; i < 4; i++) {
ntp_ts[i + 4] = v / d;
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
index 1f59f71..959de71 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
@@ -251,7 +251,7 @@ add_filename(struct snmp_toolinfo *snmptoolctx, const char *filename,
return (0);
}
- if ((fstring = malloc(strlen(filename) + 1)) == NULL) {
+ if ((fstring = strdup(filename)) == NULL) {
warnx("malloc() failed - %s", strerror(errno));
return (-1);
}
@@ -264,7 +264,6 @@ add_filename(struct snmp_toolinfo *snmptoolctx, const char *filename,
if (cut != NULL)
asn_append_oid(&(entry->cut), cut);
- strlcpy(fstring, filename, strlen(filename) + 1);
entry->name = fstring;
entry->done = done;
SLIST_INSERT_HEAD(&snmptoolctx->filelist, entry, link);
@@ -1060,7 +1059,7 @@ snmp_oid2asn_oid(struct snmp_toolinfo *snmptoolctx, char *str,
struct asn_oid *oid)
{
int32_t i;
- char string[MAXSTR], *endptr;
+ char string[MAXSTR + 1], *endptr;
struct snmp_object obj;
for (i = 0; i < MAXSTR; i++)
@@ -1076,7 +1075,6 @@ snmp_oid2asn_oid(struct snmp_toolinfo *snmptoolctx, char *str,
return (NULL);
} else {
strlcpy(string, str, i + 1);
- string[i] = '\0';
if (snmp_lookup_enumoid(snmptoolctx, &obj, string) < 0) {
warnx("Unknown string - %s", string);
return (NULL);
diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c
index 9284eb5..095affd 100644
--- a/usr.sbin/camdd/camdd.c
+++ b/usr.sbin/camdd/camdd.c
@@ -1079,9 +1079,7 @@ camdd_probe_file(int fd, struct camdd_io_opts *io_opts, int retry_count,
retval = fstat(fd, &file_dev->sb);
if (retval != 0) {
warn("Cannot stat %s", dev->device_name);
- goto bailout;
- camdd_free_dev(dev);
- dev = NULL;
+ goto bailout_error;
}
if (S_ISREG(file_dev->sb.st_mode)) {
file_dev->file_type = CAMDD_FILE_REG;
@@ -1383,6 +1381,11 @@ camdd_probe_pass(struct cam_device *cam_dev, struct camdd_io_opts *io_opts,
block_len = scsi_4btoul(rcaplong.length);
rcap_done:
+ if (block_len == 0) {
+ warnx("Sector size for %s%u is 0, cannot continue",
+ cam_dev->device_name, cam_dev->dev_unit_num);
+ goto bailout_error;
+ }
bzero(&(&ccb->ccb_h)[1],
sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr));
diff --git a/usr.sbin/extattr/Makefile b/usr.sbin/extattr/Makefile
index 8e2b5f7..9f5721d 100644
--- a/usr.sbin/extattr/Makefile
+++ b/usr.sbin/extattr/Makefile
@@ -1,8 +1,12 @@
# $FreeBSD$
+.include <bsd.own.mk>
+
PROG= rmextattr
MAN= rmextattr.8
+LDADD= -lsbuf
+
LINKS+= ${BINDIR}/rmextattr ${BINDIR}/getextattr
LINKS+= ${BINDIR}/rmextattr ${BINDIR}/setextattr
LINKS+= ${BINDIR}/rmextattr ${BINDIR}/lsextattr
@@ -11,4 +15,8 @@ MLINKS+= rmextattr.8 setextattr.8
MLINKS+= rmextattr.8 getextattr.8
MLINKS+= rmextattr.8 lsextattr.8
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/extattr/rmextattr.8 b/usr.sbin/extattr/rmextattr.8
index c51fa6d..3b0988f 100644
--- a/usr.sbin/extattr/rmextattr.8
+++ b/usr.sbin/extattr/rmextattr.8
@@ -31,7 +31,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 30, 2000
+.Dd April 27, 2016
.Dt RMEXTATTR 8
.Os
.Sh NAME
@@ -61,6 +61,12 @@
.Ar attrname
.Ar attrvalue
.Ar filename ...
+.Nm setextattr
+.Fl i
+.Op Fl fhnq
+.Ar attrnamespace
+.Ar attrname
+.Ar filename ...
.Sh DESCRIPTION
These
utilities
@@ -91,6 +97,9 @@ the remaining arguments.
(No follow.)
If the file is a symbolic link, perform the operation on the
link itself rather than the file that the link points to.
+.It Fl i
+(From stdin.)
+Read attribute data from stdin instead of as an argument.
.It Fl n
.Dv ( NUL Ns
-terminate.)
@@ -99,6 +108,7 @@ link itself rather than the file that the link points to.
.It Fl q
(Quiet.)
Do not print out the pathname and suppress error messages.
+When given twice, print only the attribute value, with no trailing newline.
.It Fl s
(Stringify.)
Escape nonprinting characters and put quotes around the output.
@@ -109,7 +119,9 @@ Print the output in hexadecimal.
.Sh EXAMPLES
.Bd -literal
setextattr system md5 `md5 -q /boot/kernel/kernel` /boot/kernel/kernel
+md5 -q /boot/kernel/kernel | setextattr -i system md5 /boot/kernel/kernel
getextattr system md5 /boot/kernel/kernel
+getextattr -qq system md5 /boot/kernel/kernel | od -x
lsextattr system /boot/kernel/kernel
rmextattr system md5 /boot/kernel/kernel
.Ed
@@ -129,7 +141,3 @@ to be associated with each file or directory.
.Sh AUTHORS
.An Robert N M Watson
.An Poul-Henning Kamp
-.Sh BUGS
-The
-.Nm setextattr
-utility can only be used to set attributes to strings.
diff --git a/usr.sbin/extattr/rmextattr.c b/usr.sbin/extattr/rmextattr.c
index c061943..4373fd6 100644
--- a/usr.sbin/extattr/rmextattr.c
+++ b/usr.sbin/extattr/rmextattr.c
@@ -37,6 +37,7 @@
*/
#include <sys/types.h>
+#include <sys/sbuf.h>
#include <sys/uio.h>
#include <sys/extattr.h>
@@ -64,6 +65,8 @@ usage(void)
case EASET:
fprintf(stderr, "usage: setextattr [-fhnq] attrnamespace");
fprintf(stderr, " attrname attrvalue filename ...\n");
+ fprintf(stderr, " or setextattr -i [-fhnq] attrnamespace");
+ fprintf(stderr, " attrname filename ...\n");
exit(-1);
case EARM:
fprintf(stderr, "usage: rmextattr [-fhq] attrnamespace");
@@ -99,24 +102,28 @@ mkbuf(char **buf, int *oldlen, int newlen)
int
main(int argc, char *argv[])
{
- char *buf, *visbuf, *p;
+#define STDIN_BUF_SZ 1024
+ char stdin_data[STDIN_BUF_SZ];
+ char *p;
const char *options, *attrname;
size_t len;
ssize_t ret;
- int buflen, visbuflen, ch, error, i, arg_counter, attrnamespace,
- minargc;
+ int ch, error, i, arg_counter, attrnamespace, minargc;
+ char *visbuf = NULL;
+ int visbuflen = 0;
+ char *buf = NULL;
+ int buflen = 0;
+ struct sbuf *attrvalue = NULL;
int flag_force = 0;
int flag_nofollow = 0;
int flag_null = 0;
- int flag_quiet = 0;
+ int count_quiet = 0;
+ int flag_from_stdin = 0;
int flag_string = 0;
int flag_hex = 0;
- visbuflen = buflen = 0;
- visbuf = buf = NULL;
-
p = basename(argv[0]);
if (p == NULL)
p = argv[0];
@@ -126,8 +133,8 @@ main(int argc, char *argv[])
minargc = 3;
} else if (!strcmp(p, "setextattr")) {
what = EASET;
- options = "fhnq";
- minargc = 4;
+ options = "fhinq";
+ minargc = 3;
} else if (!strcmp(p, "rmextattr")) {
what = EARM;
options = "fhq";
@@ -148,11 +155,14 @@ main(int argc, char *argv[])
case 'h':
flag_nofollow = 1;
break;
+ case 'i':
+ flag_from_stdin = 1;
+ break;
case 'n':
flag_null = 1;
break;
case 'q':
- flag_quiet = 1;
+ count_quiet += 1;
break;
case 's':
flag_string = 1;
@@ -169,6 +179,9 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
+ if (what == EASET && flag_from_stdin == 0)
+ minargc++;
+
if (argc < minargc)
usage();
@@ -184,9 +197,15 @@ main(int argc, char *argv[])
attrname = NULL;
if (what == EASET) {
- mkbuf(&buf, &buflen, strlen(argv[0]) + 1);
- strcpy(buf, argv[0]);
- argc--; argv++;
+ attrvalue = sbuf_new_auto();
+ if (flag_from_stdin) {
+ while ((error = read(0, stdin_data, STDIN_BUF_SZ)) > 0)
+ sbuf_bcat(attrvalue, stdin_data, error);
+ } else {
+ sbuf_cpy(attrvalue, argv[0]);
+ argc--; argv++;
+ }
+ sbuf_finish(attrvalue);
}
for (arg_counter = 0; arg_counter < argc; arg_counter++) {
@@ -202,15 +221,17 @@ main(int argc, char *argv[])
continue;
break;
case EASET:
- len = strlen(buf) + flag_null;
+ len = sbuf_len(attrvalue) + flag_null;
if (flag_nofollow)
ret = extattr_set_link(argv[arg_counter],
- attrnamespace, attrname, buf, len);
+ attrnamespace, attrname,
+ sbuf_data(attrvalue), len);
else
ret = extattr_set_file(argv[arg_counter],
- attrnamespace, attrname, buf, len);
+ attrnamespace, attrname,
+ sbuf_data(attrvalue), len);
if (ret >= 0) {
- if ((size_t)ret != len && !flag_quiet) {
+ if ((size_t)ret != len && !count_quiet) {
warnx("Set %zd bytes of %zu for %s",
ret, len, attrname);
}
@@ -235,7 +256,7 @@ main(int argc, char *argv[])
attrnamespace, buf, buflen);
if (ret < 0)
break;
- if (!flag_quiet)
+ if (!count_quiet)
printf("%s\t", argv[arg_counter]);
for (i = 0; i < ret; i += ch + 1) {
/* The attribute name length is unsigned. */
@@ -243,7 +264,7 @@ main(int argc, char *argv[])
printf("%s%*.*s", i ? "\t" : "",
ch, ch, buf + i + 1);
}
- if (!flag_quiet || ret > 0)
+ if (!count_quiet || ret > 0)
printf("\n");
continue;
case EAGET:
@@ -264,29 +285,27 @@ main(int argc, char *argv[])
attrnamespace, attrname, buf, buflen);
if (ret < 0)
break;
- if (!flag_quiet)
+ if (!count_quiet)
printf("%s\t", argv[arg_counter]);
if (flag_string) {
mkbuf(&visbuf, &visbuflen, ret * 4 + 1);
strvisx(visbuf, buf, ret,
VIS_SAFE | VIS_WHITE);
- printf("\"%s\"\n", visbuf);
- continue;
+ printf("\"%s\"", visbuf);
} else if (flag_hex) {
for (i = 0; i < ret; i++)
printf("%s%02x", i ? " " : "",
- buf[i]);
- printf("\n");
- continue;
+ (unsigned char)buf[i]);
} else {
fwrite(buf, ret, 1, stdout);
- printf("\n");
- continue;
}
+ if (count_quiet < 2)
+ printf("\n");
+ continue;
default:
break;
}
- if (!flag_quiet)
+ if (!count_quiet)
warn("%s: failed", argv[arg_counter]);
if (flag_force)
continue;
diff --git a/usr.sbin/extattr/tests/Makefile b/usr.sbin/extattr/tests/Makefile
new file mode 100644
index 0000000..ca8200e
--- /dev/null
+++ b/usr.sbin/extattr/tests/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.sbin/extattr
+
+ATF_TESTS_SH= extattr_test
+
+.include <bsd.test.mk>
diff --git a/usr.sbin/extattr/tests/extattr_test.sh b/usr.sbin/extattr/tests/extattr_test.sh
new file mode 100755
index 0000000..d9c0c71
--- /dev/null
+++ b/usr.sbin/extattr/tests/extattr_test.sh
@@ -0,0 +1,335 @@
+#
+# Copyright (c) 2016 Spectra Logic Corp
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case bad_namespace
+bad_namespace_head() {
+ atf_set "descr" "Can't set attributes for nonexistent namespaces"
+}
+bad_namespace_body() {
+ touch foo
+ atf_check -s not-exit:0 -e match:"Invalid argument" \
+ setextattr badnamespace myattr X foo
+ atf_check -s not-exit:0 -e match:"Invalid argument" \
+ lsextattr -q badnamespace foo
+}
+
+atf_test_case hex
+hex_head() {
+ atf_set "descr" "Set and get attribute values in hexadecimal"
+}
+hex_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr user myattr XYZ foo
+ atf_check -s exit:0 -o inline:"58 59 5a\n" \
+ getextattr -qx user myattr foo
+}
+
+atf_test_case hex_nonascii
+hex_nonascii_head() {
+ atf_set "descr" "Get binary attribute values in hexadecimal"
+}
+hex_nonascii_body() {
+ touch foo
+ BINSTUFF=`echo $'\x20\x30\x40\x55\x66\x70\x81\xa2\xb3\xee\xff'`
+ atf_check -s exit:0 -o empty setextattr user myattr "$BINSTUFF" foo
+ getextattr user myattr foo
+ atf_check -s exit:0 -o inline:"20 30 40 55 66 70 81 a2 b3 ee ff\n" \
+ getextattr -qx user myattr foo
+}
+
+atf_test_case long_name
+long_name_head() {
+ atf_set "descr" "A maximum length attribute name"
+}
+long_name_body() {
+ # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208965
+ atf_expect_fail "BUG 208965 extattr(2) doesn't allow maxlen attr names"
+
+ ATTRNAME=`jot -b X -s "" 255 0`
+ touch foo
+ atf_check -s exit:0 -o empty setextattr user $ATTRNAME myvalue foo
+ atf_check -s exit:0 -o inline:"${ATTRNAME}\n" lsextattr -q user foo
+ atf_check -s exit:0 -o inline:"myvalue\n" \
+ getextattr -q user ${ATTRNAME} foo
+ atf_check -s exit:0 -o empty rmextattr user ${ATTRNAME} foo
+ atf_check -s exit:0 -o empty lsextattr -q user foo
+}
+
+atf_test_case loud
+loud_head() {
+ atf_set "descr" "Loud (non -q) output for each command"
+}
+loud_body() {
+ touch foo
+ # setextattr(8) and friends print hard tabs. Use printf to convert
+ # them to spaces before checking the output.
+ atf_check -s exit:0 -o empty setextattr user myattr myvalue foo
+ atf_check -s exit:0 -o inline:"foo myattr" \
+ printf "%s %s" $(lsextattr user foo)
+ atf_check -s exit:0 -o inline:"foo myvalue" \
+ printf "%s %s" $(getextattr user myattr foo)
+ atf_check -s exit:0 -o empty rmextattr user myattr foo
+ atf_check -s exit:0 -o inline:"foo" printf %s $(lsextattr user foo)
+}
+
+atf_test_case noattrs
+noattrs_head() {
+ atf_set "descr" "A file with no extended attributes"
+}
+noattrs_body() {
+ touch foo
+ atf_check -s exit:0 -o empty lsextattr -q user foo
+}
+
+atf_test_case nonexistent_file
+nonexistent_file_head() {
+ atf_set "descr" "A file that does not exist"
+}
+nonexistent_file_body() {
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ lsextattr user foo
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ setextattr user myattr myvalue foo
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ getextattr user myattr foo
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ rmextattr user myattr foo
+}
+
+atf_test_case null
+null_head() {
+ atf_set "descr" "NUL-terminate an attribute value"
+}
+null_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr -n user myattr myvalue foo
+ atf_check -s exit:0 -o inline:"myvalue\0\n" getextattr -q user myattr foo
+}
+
+atf_test_case one_user_attr
+one_user_attr_head() {
+ atf_set "descr" "A file with one extended attribute"
+}
+one_user_attr_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr user myattr myvalue foo
+ atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q user foo
+ atf_check -s exit:0 -o inline:"myvalue\n" getextattr -q user myattr foo
+ atf_check -s exit:0 -o empty rmextattr user myattr foo
+ atf_check -s exit:0 -o empty lsextattr -q user foo
+}
+
+atf_test_case one_system_attr
+one_system_attr_head() {
+ atf_set "descr" "A file with one extended attribute"
+ atf_set "require.user" "root"
+}
+one_system_attr_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr system myattr myvalue foo
+ atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q system foo
+ atf_check -s exit:0 -o inline:"myvalue\n" getextattr -q system myattr foo
+ atf_check -s exit:0 -o empty rmextattr system myattr foo
+ atf_check -s exit:0 -o empty lsextattr -q system foo
+}
+
+atf_test_case stdin
+stdin_head() {
+ atf_set "descr" "Set attribute value from stdin"
+}
+stdin_body() {
+ dd if=/dev/random of=infile bs=1k count=8
+ touch foo
+ setextattr -i user myattr foo < infile || atf_fail "setextattr failed"
+ atf_check -s exit:0 -o inline:"myattr\n" lsextattr -q user foo
+ getextattr -qq user myattr foo > outfile || atf_fail "getextattr failed"
+ atf_check -s exit:0 cmp -s infile outfile
+}
+
+atf_test_case stringify
+stringify_head() {
+ atf_set "descr" "Stringify the output of getextattr"
+}
+stringify_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr user myattr "my value" foo
+ atf_check -s exit:0 -o inline:"\"my\\\040value\"\n" \
+ getextattr -qs user myattr foo
+}
+
+atf_test_case symlink
+symlink_head() {
+ atf_set "descr" "A symlink to an ordinary file"
+}
+symlink_body() {
+ touch foo
+ ln -s foo foolink
+ atf_check -s exit:0 -o empty setextattr user myattr myvalue foolink
+ atf_check -s exit:0 -o inline:"myvalue\n" \
+ getextattr -q user myattr foolink
+ atf_check -s exit:0 -o inline:"myvalue\n" getextattr -q user myattr foo
+}
+
+atf_test_case symlink_nofollow
+symlink_nofollow_head() {
+ atf_set "descr" "Operating directly on a symlink"
+}
+symlink_nofollow_body() {
+ touch foo
+ ln -s foo foolink
+ # Check that with -h we can operate directly on the link
+ atf_check -s exit:0 -o empty setextattr -h user myattr myvalue foolink
+ atf_check -s exit:0 -o inline:"myvalue\n" \
+ getextattr -qh user myattr foolink
+ atf_check -s exit:1 -e match:"Attribute not found" \
+ getextattr user myattr foolink
+ atf_check -s exit:1 -e match:"Attribute not found" \
+ getextattr user myattr foo
+
+ # Check that with -h we cannot operate on the destination file
+ atf_check -s exit:0 -o empty setextattr user otherattr othervalue foo
+ atf_check -s exit:1 getextattr -qh user otherattr foolink
+}
+
+atf_test_case system_and_user_attrs
+system_and_user_attrs_head() {
+ atf_set "descr" "A file with both system and user extended attributes"
+ atf_set "require.user" "root"
+}
+system_and_user_attrs_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr user userattr userval foo
+ atf_check -s exit:0 -o empty setextattr system sysattr sysval foo
+ atf_check -s exit:0 -o inline:"userattr\n" lsextattr -q user foo
+ atf_check -s exit:0 -o inline:"sysattr\n" lsextattr -q system foo
+
+ atf_check -s exit:0 -o inline:"userval\n" getextattr -q user userattr foo
+ atf_check -s exit:0 -o inline:"sysval\n" getextattr -q system sysattr foo
+ atf_check -s exit:0 -o empty rmextattr user userattr foo
+ atf_check -s exit:0 -o empty rmextattr system sysattr foo
+ atf_check -s exit:0 -o empty lsextattr -q user foo
+ atf_check -s exit:0 -o empty lsextattr -q system foo
+}
+
+atf_test_case two_files
+two_files_head() {
+ atf_set "descr" "Manipulate two files"
+}
+two_files_body() {
+ touch foo bar
+ atf_check -s exit:0 -o empty setextattr user myattr myvalue foo bar
+ atf_check -s exit:0 -o inline:"foo\tmyattr\nbar\tmyattr\n" \
+ lsextattr user foo bar
+ atf_check -s exit:0 \
+ -o inline:"foo\tmyvalue\nbar\tmyvalue\n" \
+ getextattr user myattr foo bar
+ atf_check -s exit:0 -o empty rmextattr user myattr foo bar
+ atf_check -s exit:0 -o empty lsextattr -q user foo bar
+}
+
+atf_test_case two_files_force
+two_files_force_head() {
+ atf_set "descr" "Manipulate two files. The first does not exist"
+}
+two_files_force_body() {
+ touch bar
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ setextattr user myattr myvalue foo bar
+ atf_check -s exit:0 -e ignore setextattr -f user myattr myvalue foo bar
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ lsextattr user foo bar
+ atf_check -s exit:0 -e ignore -o inline:"bar\tmyattr\n" \
+ lsextattr -f user foo bar
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ getextattr user myattr foo bar
+ atf_check -s exit:0 -e ignore \
+ -o inline:"bar\tmyvalue\n" \
+ getextattr -f user myattr foo bar
+ atf_check -s exit:1 -e match:"No such file or directory" \
+ rmextattr user myattr foo bar
+ atf_check -s exit:0 -e ignore \
+ rmextattr -f user myattr foo bar
+ atf_check -s exit:0 -o empty lsextattr -q user bar
+}
+
+atf_test_case two_user_attrs
+two_user_attrs_head() {
+ atf_set "descr" "A file with two extended attributes"
+}
+two_user_attrs_body() {
+ touch foo
+ atf_check -s exit:0 -o empty setextattr user myattr1 myvalue1 foo
+ atf_check -s exit:0 -o empty setextattr user myattr2 myvalue2 foo
+ # lsextattr could return the attributes in any order, so we must be
+ # careful how we compare them.
+ raw_output=`lsextattr -q user foo` || atf_fail "lsextattr failed"
+ tabless_output=`printf "%s %s" ${raw_output}`
+ if [ "myattr1 myattr2" != "${tabless_output}" -a \
+ "myattr2 myattr1" != "${tabless_output}" ]; then
+ atf_fail "lsextattr printed ${tabless_output}"
+ fi
+ atf_check -s exit:0 -o inline:"myvalue1\n" getextattr -q user myattr1 foo
+ atf_check -s exit:0 -o inline:"myvalue2\n" getextattr -q user myattr2 foo
+ atf_check -s exit:0 -o empty rmextattr user myattr2 foo
+ atf_check -s exit:0 -o empty rmextattr user myattr1 foo
+ atf_check -s exit:0 -o empty lsextattr -q user foo
+}
+
+atf_test_case unprivileged_user_cannot_set_system_attr
+unprivileged_user_cannot_set_system_attr_head() {
+ atf_set "descr" "Unprivileged users can't set system attributes"
+ atf_set "require.user" "unprivileged"
+}
+unprivileged_user_cannot_set_system_attr_body() {
+ touch foo
+ atf_check -s exit:1 -e match:"Operation not permitted" \
+ setextattr system myattr myvalue foo
+}
+
+
+atf_init_test_cases() {
+ atf_add_test_case bad_namespace
+ atf_add_test_case hex
+ atf_add_test_case hex_nonascii
+ atf_add_test_case long_name
+ atf_add_test_case loud
+ atf_add_test_case noattrs
+ atf_add_test_case nonexistent_file
+ atf_add_test_case null
+ atf_add_test_case symlink_nofollow
+ atf_add_test_case one_user_attr
+ atf_add_test_case one_system_attr
+ atf_add_test_case stdin
+ atf_add_test_case stringify
+ atf_add_test_case symlink
+ atf_add_test_case symlink_nofollow
+ atf_add_test_case system_and_user_attrs
+ atf_add_test_case two_files
+ atf_add_test_case two_files_force
+ atf_add_test_case two_user_attrs
+ atf_add_test_case unprivileged_user_cannot_set_system_attr
+}
diff --git a/usr.sbin/ntp/config.h b/usr.sbin/ntp/config.h
index 30988ea..d11819c 100644
--- a/usr.sbin/ntp/config.h
+++ b/usr.sbin/ntp/config.h
@@ -1449,7 +1449,7 @@
#define PACKAGE_NAME "ntp"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "ntp 4.2.8p7"
+#define PACKAGE_STRING "ntp 4.2.8p8"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntp"
@@ -1458,7 +1458,7 @@
#define PACKAGE_URL "http://www.ntp.org./"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "4.2.8p7"
+#define PACKAGE_VERSION "4.2.8p8"
/* data dir */
#define PERLLIBDIR "/usr/local/share/ntp/lib"
@@ -1639,7 +1639,7 @@ typedef unsigned int uintptr_t;
/* #undef USE_UDP_SIGPOLL */
/* Version number of package */
-#define VERSION "4.2.8p7"
+#define VERSION "4.2.8p8"
/* vsnprintf expands "%m" to strerror(errno) */
/* #undef VSNPRINTF_PERCENT_M */
@@ -1816,5 +1816,5 @@ typedef union mpinfou {
/*
* FreeBSD specific: Explicitly specify date/time for reproducible build.
*/
-#define MKREPRO_DATE "Apr 27 2016"
-#define MKREPRO_TIME "05:53:49"
+#define MKREPRO_DATE "Jun 03 2016"
+#define MKREPRO_TIME "06:34:37"
diff --git a/usr.sbin/ntp/doc/ntp-keygen.8 b/usr.sbin/ntp/doc/ntp-keygen.8
index 4b58a4c..bb7972a 100644
--- a/usr.sbin/ntp/doc/ntp-keygen.8
+++ b/usr.sbin/ntp/doc/ntp-keygen.8
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_KEYGEN 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:30:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:39:43 AM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntp.conf.5 b/usr.sbin/ntp/doc/ntp.conf.5
index 4e45240..42af4a5 100644
--- a/usr.sbin/ntp/doc/ntp.conf.5
+++ b/usr.sbin/ntp/doc/ntp.conf.5
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_CONF 5 File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:36 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:16 AM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
@@ -2442,6 +2442,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2451,6 +2452,7 @@ The default value is 46, signifying Expedited Forwarding.
.Cm calibrate | Cm kernel |
.Cm mode7 | Cm monitor |
.Cm ntp | Cm stats |
+.Cm peer_clear_digest_early |
.Cm unpeer_crypto_early | Cm unpeer_crypto_nak_early | Cm unpeer_digest_early
.Oc
.Xc
@@ -2518,6 +2520,26 @@ closes the feedback loop, which is useful for testing.
The default for
this flag is
.Ic enable .
+.It Cm peer_clear_digest_early
+By default, if
+.Xr ntpd 8
+is using autokey and it
+receives a crypto\-NAK packet that
+passes the duplicate packet and origin timestamp checks
+the peer variables are immediately cleared.
+While this is generally a feature
+as it allows for quick recovery if a server key has changed,
+a properly forged and appropriately delivered crypto\-NAK packet
+can be used in a DoS attack.
+If you have active noticable problems with this type of DoS attack
+then you should consider
+disabling this option.
+You can check your
+.Cm peerstats
+file for evidence of any of these attacks.
+The
+default for this flag is
+.Ic enable .
.It Cm stats
Enables the statistics facility.
See the
diff --git a/usr.sbin/ntp/doc/ntp.keys.5 b/usr.sbin/ntp/doc/ntp.keys.5
index 6fb04bf..06cf644 100644
--- a/usr.sbin/ntp/doc/ntp.keys.5
+++ b/usr.sbin/ntp/doc/ntp.keys.5
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTP_KEYS 5 File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:20 AM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntpd.8 b/usr.sbin/ntp/doc/ntpd.8
index d7e6650..bb51eb3 100644
--- a/usr.sbin/ntp/doc/ntpd.8
+++ b/usr.sbin/ntp/doc/ntpd.8
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPD 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:28:41 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:22 AM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntpdc.8 b/usr.sbin/ntp/doc/ntpdc.8
index 7b73651..39de44d 100644
--- a/usr.sbin/ntp/doc/ntpdc.8
+++ b/usr.sbin/ntp/doc/ntpdc.8
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPDC 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:36:58 AM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntpq.8 b/usr.sbin/ntp/doc/ntpq.8
index 6f2d080..60e66de 100644
--- a/usr.sbin/ntp/doc/ntpq.8
+++ b/usr.sbin/ntp/doc/ntpq.8
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt NTPQ 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:29:41 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:37:48 AM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/sntp.8 b/usr.sbin/ntp/doc/sntp.8
index a0172a3..c0ab263 100644
--- a/usr.sbin/ntp/doc/sntp.8
+++ b/usr.sbin/ntp/doc/sntp.8
@@ -1,11 +1,11 @@
-.Dd April 26 2016
+.Dd June 2 2016
.Dt SNTP 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed April 26, 2016 at 08:21:15 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed June 2, 2016 at 07:20:03 AM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/scripts/mkver b/usr.sbin/ntp/scripts/mkver
index 373bb5f..5318024 100755
--- a/usr.sbin/ntp/scripts/mkver
+++ b/usr.sbin/ntp/scripts/mkver
@@ -6,7 +6,7 @@ PROG=${1-UNKNOWN}
ConfStr="$PROG"
-ConfStr="$ConfStr 4.2.8p7"
+ConfStr="$ConfStr 4.2.8p8"
case "$CSET" in
'') ;;
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c
index cea8533..5299ce6 100644
--- a/usr.sbin/tzsetup/tzsetup.c
+++ b/usr.sbin/tzsetup/tzsetup.c
@@ -837,7 +837,9 @@ install_zoneinfo(const char *zoneinfo)
FILE *f;
char path_zoneinfo_file[MAXPATHLEN];
- sprintf(path_zoneinfo_file, "%s/%s", path_zoneinfo, zoneinfo);
+ if ((size_t)snprintf(path_zoneinfo_file, sizeof(path_zoneinfo_file),
+ "%s/%s", path_zoneinfo, zoneinfo) >= sizeof(path_zoneinfo_file))
+ errx(1, "%s/%s name too long", path_zoneinfo, zoneinfo);
rv = install_zoneinfo_file(path_zoneinfo_file);
/* Save knowledge for later */
diff --git a/usr.sbin/ypserv/yp_dnslookup.c b/usr.sbin/ypserv/yp_dnslookup.c
index dfb5594..947df59 100644
--- a/usr.sbin/ypserv/yp_dnslookup.c
+++ b/usr.sbin/ypserv/yp_dnslookup.c
@@ -489,9 +489,6 @@ yp_async_lookup_addr(struct svc_req *rqstp, char *addr, int af)
yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
return(YP_TRUE);
- if ((q = yp_malloc_dnsent()) == NULL)
- return(YP_YPERR);
-
switch (af) {
case AF_INET:
if (inet_aton(addr, (struct in_addr *)uaddr) != 1)
@@ -516,6 +513,9 @@ yp_async_lookup_addr(struct svc_req *rqstp, char *addr, int af)
return(YP_YPERR);
}
+ if ((q = yp_malloc_dnsent()) == NULL)
+ return(YP_YPERR);
+
if (debug)
yp_error("DNS address is: %s", buf);
diff --git a/usr.sbin/ypserv/yp_server.c b/usr.sbin/ypserv/yp_server.c
index ba20c3cd..304fd50 100644
--- a/usr.sbin/ypserv/yp_server.c
+++ b/usr.sbin/ypserv/yp_server.c
@@ -711,6 +711,7 @@ yp_maplist_create(const char *domain)
yp_error("strdup() failed: %s",strerror(errno));
closedir(dird);
yp_maplist_free(yp_maplist);
+ free(cur);
return(NULL);
}
cur->next = yp_maplist;
OpenPOWER on IntegriCloud