summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-05-03 08:54:29 -0300
committerRenato Botelho <renato@netgate.com>2016-05-03 08:54:29 -0300
commit394097451eda898069e18b8dc01759b5ec2d19ff (patch)
tree978e78c476a93a5940d7c55d55bda811eccb7165
parentdc2ad254d56f40487511f4b9a56bf3f58e7603b4 (diff)
parenta3473a1d98b6f6af1dcc11c4f0189686a81dabbb (diff)
downloadFreeBSD-src-394097451eda898069e18b8dc01759b5ec2d19ff.zip
FreeBSD-src-394097451eda898069e18b8dc01759b5ec2d19ff.tar.gz
Merge remote-tracking branch 'origin/master' into devel-11
-rw-r--r--ObsoleteFiles.inc3
-rw-r--r--bin/tests/Makefile3
-rw-r--r--cddl/lib/tests/Makefile3
-rw-r--r--cddl/sbin/tests/Makefile3
-rw-r--r--cddl/tests/Makefile3
-rw-r--r--cddl/usr.bin/tests/Makefile3
-rw-r--r--cddl/usr.sbin/tests/Makefile3
-rw-r--r--contrib/subversion/CHANGES135
-rw-r--r--contrib/subversion/INSTALL88
-rw-r--r--contrib/subversion/Makefile.in16
-rw-r--r--contrib/subversion/NOTICE2
-rw-r--r--contrib/subversion/build-outputs.mk9
-rwxr-xr-xcontrib/subversion/configure30
-rw-r--r--contrib/subversion/subversion/include/svn_client.h8
-rw-r--r--contrib/subversion/subversion/include/svn_config.h17
-rw-r--r--contrib/subversion/subversion/include/svn_fs.h72
-rw-r--r--contrib/subversion/subversion/include/svn_version.h6
-rw-r--r--contrib/subversion/subversion/libsvn_client/externals.c36
-rw-r--r--contrib/subversion/subversion/libsvn_client/merge.c42
-rw-r--r--contrib/subversion/subversion/libsvn_client/patch.c33
-rw-r--r--contrib/subversion/subversion/libsvn_diff/binary_diff.c12
-rw-r--r--contrib/subversion/subversion/libsvn_fs_base/dag.c10
-rw-r--r--contrib/subversion/subversion/libsvn_fs_base/fs.h6
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/cached_data.c8
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/dag.c54
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/fs.h12
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c86
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/fs_fs.h13
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h2
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/transaction.c3
-rw-r--r--contrib/subversion/subversion/libsvn_fs_fs/tree.c4
-rw-r--r--contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h2
-rw-r--r--contrib/subversion/subversion/libsvn_ra_local/ra_plugin.c9
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/commit.c68
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c4
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/merge.c16
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/multistatus.c10
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/ra_serf.h18
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/replay.c1
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/serf.c58
-rw-r--r--contrib/subversion/subversion/libsvn_ra_serf/util.c26
-rw-r--r--contrib/subversion/subversion/libsvn_ra_svn/client.c7
-rw-r--r--contrib/subversion/subversion/libsvn_ra_svn/deprecated.c3
-rw-r--r--contrib/subversion/subversion/libsvn_ra_svn/marshal.c4
-rw-r--r--contrib/subversion/subversion/libsvn_repos/dump.c24
-rw-r--r--contrib/subversion/subversion/libsvn_repos/log.c2
-rw-r--r--contrib/subversion/subversion/libsvn_repos/repos.c15
-rw-r--r--contrib/subversion/subversion/libsvn_subr/auth.c4
-rw-r--r--contrib/subversion/subversion/libsvn_subr/cache-membuffer.c37
-rw-r--r--contrib/subversion/subversion/libsvn_subr/eol.c17
-rw-r--r--contrib/subversion/subversion/libsvn_subr/gpg_agent.c38
-rw-r--r--contrib/subversion/subversion/libsvn_subr/internal_statements.h2
-rw-r--r--contrib/subversion/subversion/libsvn_subr/prompt.c3
-rw-r--r--contrib/subversion/subversion/libsvn_subr/sqlite.c1
-rw-r--r--contrib/subversion/subversion/libsvn_subr/string.c4
-rw-r--r--contrib/subversion/subversion/libsvn_subr/utf_validate.c79
-rw-r--r--contrib/subversion/subversion/libsvn_subr/version.c2
-rw-r--r--contrib/subversion/subversion/libsvn_wc/deprecated.c2
-rw-r--r--contrib/subversion/subversion/libsvn_wc/wc-checks.h2
-rw-r--r--contrib/subversion/subversion/libsvn_wc/wc-metadata.h2
-rw-r--r--contrib/subversion/subversion/libsvn_wc/wc-queries.h5
-rw-r--r--contrib/subversion/subversion/libsvn_wc/wc-queries.sql5
-rw-r--r--contrib/subversion/subversion/libsvn_wc/wc_db_pristine.c9
-rw-r--r--contrib/subversion/subversion/svn/conflict-callbacks.c4
-rw-r--r--contrib/subversion/subversion/svn/diff-cmd.c29
-rw-r--r--contrib/subversion/subversion/svn/lock-cmd.c39
-rw-r--r--contrib/subversion/subversion/svn/unlock-cmd.c40
-rw-r--r--contrib/subversion/subversion/svnlook/svnlook.c75
-rw-r--r--contrib/subversion/subversion/svnserve/cyrus_auth.c2
-rw-r--r--contrib/subversion/win-tests.py4
-rw-r--r--etc/defaults/rc.conf1
-rw-r--r--etc/devd/usb.conf24
-rw-r--r--etc/mtree/BSD.tests.dist2
-rw-r--r--etc/ntp/leap-seconds2
-rw-r--r--etc/protocols2
-rw-r--r--etc/rc.d/Makefile2
-rwxr-xr-xetc/rc.d/SERVERS2
-rwxr-xr-xetc/rc.d/kdc1
-rwxr-xr-xetc/rc.d/savecore1
-rwxr-xr-xetc/rc.d/sendmail4
-rw-r--r--etc/rc.initdiskless2
-rw-r--r--gnu/lib/tests/Makefile3
-rw-r--r--gnu/tests/Makefile3
-rw-r--r--gnu/usr.bin/Makefile1
-rw-r--r--gnu/usr.bin/sdiff/Makefile28
-rw-r--r--gnu/usr.bin/sdiff/Makefile.depend18
-rw-r--r--gnu/usr.bin/sdiff/sdiff.c.diff11
-rw-r--r--gnu/usr.bin/tests/Makefile3
-rw-r--r--include/arpa/nameser.h2
-rw-r--r--include/rpcsvc/klm_prot.x2
-rw-r--r--lib/atf/libatf-c/tests/detail/Makefile3
-rw-r--r--lib/atf/tests/Makefile3
-rw-r--r--lib/atf/tests/test-programs/Makefile3
-rw-r--r--lib/libc/amd64/string/strcmp.S2
-rw-r--r--lib/libc/iconv/iconv-internal.h2
-rw-r--r--lib/libc/include/compat.h2
-rw-r--r--lib/libc/include/reentrant.h2
-rw-r--r--lib/libc/locale/collate.c2
-rw-r--r--lib/libc/locale/nl_langinfo.c2
-rw-r--r--lib/libc/nameser/ns_samedomain.c2
-rw-r--r--lib/libc/net/getaddrinfo.c2
-rw-r--r--lib/libc/net/gethostnamadr.c2
-rw-r--r--lib/libc/net/getnetnamadr.c2
-rw-r--r--lib/libc/net/name6.c4
-rw-r--r--lib/libc/net/nscachedcli.c2
-rw-r--r--lib/libc/net/res_config.h2
-rw-r--r--lib/libc/posix1e/acl_delete_entry.c2
-rw-r--r--lib/libc/posix1e/acl_support.c2
-rw-r--r--lib/libc/regex/regcomp.c2
-rw-r--r--lib/libc/resolv/res_comp.c2
-rw-r--r--lib/libc/resolv/res_findzonecut.c2
-rw-r--r--lib/libc/resolv/res_init.c4
-rw-r--r--lib/libc/rpc/README2
-rw-r--r--lib/libc/rpc/clnt_dg.c6
-rw-r--r--lib/libc/rpc/clnt_vc.c4
-rw-r--r--lib/libc/rpc/getnetconfig.c2
-rw-r--r--lib/libc/rpc/svc.c2
-rw-r--r--lib/libc/rpc/svc_simple.c4
-rw-r--r--lib/libc/rpc/svc_vc.c2
-rw-r--r--lib/libc/sparc64/fpu/fpu_reg.h2
-rw-r--r--lib/libc/stdio/vfscanf.c2
-rw-r--r--lib/libc/stdlib/heapsort.c2
-rw-r--r--lib/libc/stdlib/strfmon.c4
-rw-r--r--lib/libc/string/wcscoll.c2
-rw-r--r--lib/libc/sys/kqueue.265
-rw-r--r--lib/libc/sys/wait.22
-rw-r--r--lib/libc/tests/nss/getproto_test.c4
-rw-r--r--lib/libc/tests/nss/getrpc_test.c4
-rw-r--r--lib/libcam/scsi_cmdparse.c79
-rw-r--r--lib/libedit/chartype.h4
-rw-r--r--lib/libedit/refresh.c2
-rw-r--r--lib/libfetch/common.c4
-rw-r--r--lib/libgssapi/gss_accept_sec_context.c2
-rw-r--r--lib/libkiconv/quirks.c4
-rw-r--r--lib/libkvm/Makefile6
-rw-r--r--lib/libkvm/kvm.33
-rw-r--r--lib/libkvm/kvm.c4
-rw-r--r--lib/libkvm/kvm.h1
-rw-r--r--lib/libkvm/kvm_amd64.c1
-rw-r--r--lib/libkvm/kvm_file.c226
-rw-r--r--lib/libkvm/kvm_getfiles.387
-rw-r--r--lib/libkvm/kvm_pcpu.c2
-rw-r--r--lib/libkvm/kvm_proc.c15
-rw-r--r--lib/libkvm/kvm_sparc64.c2
-rw-r--r--lib/libkvm/kvm_vnet.c4
-rw-r--r--lib/libpmc/libpmc.c2
-rw-r--r--lib/libsdp/sdp.h2
-rw-r--r--lib/libusb/libusb20_desc.c2
-rw-r--r--lib/libutil/pw_util.c3
-rw-r--r--lib/libvmmapi/vmmapi.h2
-rw-r--r--lib/msun/src/k_rem_pio2.c2
-rw-r--r--lib/msun/src/s_cbrt.c2
-rw-r--r--lib/tests/Makefile3
-rw-r--r--libexec/atf/atf-sh/tests/Makefile3
-rw-r--r--libexec/atf/tests/Makefile3
-rw-r--r--libexec/ftpd/ftpd.c2
-rw-r--r--libexec/ftpd/popen.c2
-rw-r--r--libexec/rtld-elf/malloc.c2
-rw-r--r--libexec/rtld-elf/rtld.c2
-rw-r--r--libexec/tests/Makefile5
-rwxr-xr-xrelease/picobsd/build/picobsd2
-rw-r--r--release/picobsd/tinyware/ns/ns.c2
-rw-r--r--sbin/camcontrol/camcontrol.c3
-rw-r--r--sbin/camcontrol/fwdownload.c2
-rw-r--r--sbin/dump/main.c2
-rw-r--r--sbin/dumpfs/dumpfs.c3
-rw-r--r--sbin/fdisk/fdisk.c30
-rw-r--r--sbin/fdisk_pc98/fdisk.c2
-rw-r--r--sbin/fsck_ffs/fsutil.c8
-rw-r--r--sbin/fsck_ffs/inode.c4
-rw-r--r--sbin/fsck_ffs/pass2.c4
-rw-r--r--sbin/fsck_ffs/setup.c3
-rw-r--r--sbin/fsck_ffs/suj.c2
-rw-r--r--sbin/geom/class/virstor/geom_virstor.c2
-rw-r--r--sbin/growfs/debug.c3
-rw-r--r--sbin/growfs/growfs.c3
-rw-r--r--sbin/hastd/hooks.c3
-rw-r--r--sbin/ipfw/ipfw2.c4
-rw-r--r--sbin/ipfw/ipv6.c2
-rw-r--r--sbin/newfs/mkfs.c8
-rw-r--r--sbin/newfs_nandfs/newfs_nandfs.c2
-rw-r--r--sbin/pfctl/parse.y2
-rw-r--r--sbin/recoverdisk/recoverdisk.c4
-rw-r--r--sbin/restore/dirs.c16
-rw-r--r--sbin/restore/extern.h6
-rw-r--r--sbin/restore/interactive.c4
-rw-r--r--sbin/restore/main.c3
-rw-r--r--sbin/restore/symtab.c6
-rw-r--r--sbin/restore/tape.c46
-rw-r--r--sbin/swapon/swapon.c2
-rw-r--r--sbin/tests/Makefile3
-rw-r--r--secure/lib/tests/Makefile3
-rw-r--r--secure/libexec/tests/Makefile3
-rw-r--r--secure/tests/Makefile3
-rw-r--r--secure/usr.bin/tests/Makefile3
-rw-r--r--secure/usr.sbin/tests/Makefile3
-rw-r--r--share/examples/ipfilter/ipf-howto.txt6
-rw-r--r--share/examples/kld/cdev/test/Makefile2
-rw-r--r--share/examples/tests/Makefile3
-rw-r--r--share/examples/tests/tests/Makefile3
-rw-r--r--share/examples/tests/tests/atf/Makefile3
-rw-r--r--share/examples/tests/tests/plain/Makefile3
-rw-r--r--share/man/man4/cxgbe.42
-rw-r--r--share/man/man4/ds3231.44
-rw-r--r--share/man/man4/ng_car.46
-rw-r--r--share/man/man4/ng_nat.42
-rw-r--r--share/man/man4/random.42
-rw-r--r--share/man/man4/uplcom.42
-rw-r--r--share/man/man5/rc.conf.511
-rw-r--r--share/man/man7/build.718
-rw-r--r--share/man/man9/bus_activate_resource.953
-rw-r--r--share/man/man9/bus_alloc_resource.910
-rw-r--r--share/man/man9/counter.92
-rw-r--r--share/man/man9/fpu_kern.92
-rw-r--r--share/man/man9/hash.92
-rw-r--r--share/man/man9/hashinit.924
-rw-r--r--share/man/man9/lock.92
-rw-r--r--share/man/man9/pci.92
-rw-r--r--share/man/man9/sysctl.98
-rw-r--r--share/man/man9/timeout.92
-rw-r--r--share/man/man9/zone.92
-rw-r--r--share/mk/bsd.cpu.mk4
-rw-r--r--share/mk/bsd.files.mk2
-rw-r--r--share/mk/bsd.subdir.mk2
-rw-r--r--share/mk/local.gendirdeps.mk2
-rw-r--r--share/tests/Makefile3
-rw-r--r--sys/amd64/conf/NOTES5
-rw-r--r--sys/arm/allwinner/allwinner_machdep.c8
-rw-r--r--sys/arm/allwinner/aw_nmi.c3
-rw-r--r--sys/arm/allwinner/timer.c26
-rw-r--r--sys/arm/arm/generic_timer.c56
-rw-r--r--sys/arm/arm/machdep.c22
-rw-r--r--sys/arm/arm/platform.c38
-rw-r--r--sys/arm/at91/at91_pmc.c2
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_machdep.c4
-rw-r--r--sys/arm/conf/A101
-rw-r--r--sys/arm/conf/ALLWINNER1
-rw-r--r--sys/arm/conf/NOTES4
-rw-r--r--sys/arm/conf/VIRT1
-rw-r--r--sys/arm/freescale/imx/imx51_machdep.c2
-rw-r--r--sys/arm/freescale/imx/imx53_machdep.c2
-rw-r--r--sys/arm/freescale/imx/imx6_machdep.c6
-rw-r--r--sys/arm/include/machdep.h5
-rw-r--r--sys/arm/include/platformvar.h37
-rw-r--r--sys/arm/nvidia/tegra124/tegra124_machdep.c2
-rw-r--r--sys/arm/qemu/virt_machdep.c2
-rw-r--r--sys/arm/ti/ti_adc.c411
-rw-r--r--sys/arm/ti/ti_adcreg.h38
-rw-r--r--sys/arm/ti/ti_adcvar.h13
-rw-r--r--sys/arm/ti/ti_machdep.c4
-rw-r--r--sys/boot/arm/at91/bootiic/env_vars.c2
-rw-r--r--sys/boot/arm/at91/bootspi/env_vars.c2
-rw-r--r--sys/boot/arm/at91/libat91/at91rm9200.h6
-rw-r--r--sys/boot/arm/at91/libat91/mci_device.h10
-rw-r--r--sys/boot/common/bcache.c47
-rw-r--r--sys/boot/efi/boot1/boot1.c4
-rw-r--r--sys/boot/efi/include/amd64/efibind.h2
-rw-r--r--sys/boot/efi/include/arm/efibind.h2
-rw-r--r--sys/boot/efi/include/arm64/efibind.h4
-rw-r--r--sys/boot/efi/include/efiuga.h2
-rw-r--r--sys/boot/efi/include/i386/efibind.h2
-rw-r--r--sys/boot/efi/libefi/efipart.c10
-rw-r--r--sys/boot/efi/loader/main.c2
-rw-r--r--sys/boot/fdt/Makefile2
-rw-r--r--sys/boot/fdt/fdt_loader_cmd.c129
-rw-r--r--sys/boot/fdt/fdt_overlay.c438
-rw-r--r--sys/boot/fdt/fdt_overlay.h34
-rw-r--r--sys/boot/fdt/fdt_platform.h2
-rw-r--r--sys/boot/forth/delay.4th2
-rw-r--r--sys/boot/forth/loader.4th4
-rw-r--r--sys/boot/forth/loader.conf2
-rw-r--r--sys/boot/forth/menu.4th4
-rw-r--r--sys/boot/forth/support.4th10
-rw-r--r--sys/boot/i386/libfirewire/dconsole.c2
-rw-r--r--sys/boot/i386/libfirewire/fwohci.c4
-rw-r--r--sys/boot/i386/libi386/amd64_tramp.S2
-rw-r--r--sys/boot/i386/libi386/bioscd.c29
-rw-r--r--sys/boot/i386/libi386/biosdisk.c12
-rw-r--r--sys/boot/i386/libi386/pxe.h6
-rw-r--r--sys/boot/i386/zfsboot/zfsboot.c13
-rw-r--r--sys/boot/ofw/common/main.c2
-rw-r--r--sys/boot/pc98/boot0.5/disk.s2
-rw-r--r--sys/boot/pc98/boot0.5/putssjis.s2
-rw-r--r--sys/boot/pc98/boot0.5/support.s2
-rw-r--r--sys/boot/uboot/fdt/uboot_fdt.c22
-rw-r--r--sys/cam/cam.h4
-rw-r--r--sys/cam/cam_periph.c2
-rw-r--r--sys/cam/cam_queue.c2
-rw-r--r--sys/cam/cam_xpt.c4
-rw-r--r--sys/cam/ctl/ctl.c4
-rw-r--r--sys/cam/ctl/ctl_frontend_cam_sim.c2
-rw-r--r--sys/cam/ctl/ctl_frontend_ioctl.c2
-rw-r--r--sys/cam/ctl/ctl_io.h2
-rw-r--r--sys/cam/ctl/ctl_ioctl.h6
-rw-r--r--sys/cam/scsi/scsi_all.c8
-rw-r--r--sys/cam/scsi/scsi_all.h4
-rw-r--r--sys/cam/scsi/scsi_ch.h4
-rw-r--r--sys/cam/scsi/scsi_da.c4
-rw-r--r--sys/cam/scsi/scsi_low.h4
-rw-r--r--sys/cam/scsi/scsi_sa.c2
-rw-r--r--sys/cam/scsi/scsi_xpt.c4
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c214
-rw-r--r--sys/cddl/dev/dtrace/x86/dis_tables.c2
-rw-r--r--sys/compat/linux/check_internal_locks.d2
-rw-r--r--sys/compat/linux/linux_fork.c2
-rw-r--r--sys/compat/linux/linux_misc.c2
-rw-r--r--sys/compat/linux/linux_socket.h2
-rw-r--r--sys/compat/linux/trace_futexes.d2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/dma-mapping.h2
-rw-r--r--sys/compat/linuxkpi/common/include/linux/dmapool.h2
-rw-r--r--sys/compat/linuxkpi/common/src/linux_radix.c2
-rw-r--r--sys/compat/linuxkpi/common/src/linux_usb.c2
-rw-r--r--sys/compat/ndis/kern_ndis.c2
-rw-r--r--sys/compat/ndis/ndis_var.h6
-rw-r--r--sys/compat/ndis/ntoskrnl_var.h6
-rw-r--r--sys/compat/ndis/subr_hal.c2
-rw-r--r--sys/compat/ndis/subr_ntoskrnl.c2
-rw-r--r--sys/compat/ndis/subr_pe.c2
-rw-r--r--sys/compat/x86bios/x86bios.c2
-rw-r--r--sys/compat/x86bios/x86bios.h2
-rw-r--r--sys/conf/NOTES10
-rw-r--r--sys/conf/files4
-rw-r--r--sys/conf/options.arm1
-rw-r--r--sys/contrib/dev/acpica/components/hardware/hwregs.c225
-rw-r--r--sys/ddb/db_examine.c23
-rw-r--r--sys/ddb/db_output.c3
-rw-r--r--sys/ddb/db_textdump.c2
-rw-r--r--sys/dev/aac/aac_cam.c4
-rw-r--r--sys/dev/aac/aac_debug.c2
-rw-r--r--sys/dev/aac/aac_disk.c2
-rw-r--r--sys/dev/aac/aacreg.h2
-rw-r--r--sys/dev/aacraid/aacraid_cam.c2
-rw-r--r--sys/dev/aacraid/aacraid_debug.c2
-rw-r--r--sys/dev/aacraid/aacraid_reg.h2
-rw-r--r--sys/dev/acpi_support/acpi_hp.c3
-rw-r--r--sys/dev/acpi_support/acpi_ibm.c2
-rw-r--r--sys/dev/acpica/acpi.c2
-rw-r--r--sys/dev/acpica/acpi_cpu.c5
-rw-r--r--sys/dev/acpica/acpiio.h2
-rw-r--r--sys/dev/advansys/advansys.c4
-rw-r--r--sys/dev/advansys/advlib.c2
-rw-r--r--sys/dev/advansys/advlib.h6
-rw-r--r--sys/dev/advansys/adwlib.h4
-rw-r--r--sys/dev/aha/aha.c8
-rw-r--r--sys/dev/ahb/ahb.c4
-rw-r--r--sys/dev/ahb/ahbreg.h2
-rw-r--r--sys/dev/ahci/ahci.c2
-rw-r--r--sys/dev/ahci/ahci.h4
-rw-r--r--sys/dev/alpm/alpm.c2
-rw-r--r--sys/dev/altera/atse/if_atse.c6
-rw-r--r--sys/dev/amr/amr.c4
-rw-r--r--sys/dev/an/if_an.c2
-rw-r--r--sys/dev/an/if_anreg.h2
-rw-r--r--sys/dev/asmc/asmc.c58
-rw-r--r--sys/dev/asmc/asmcvar.h35
-rw-r--r--sys/dev/ata/ata-all.c2
-rw-r--r--sys/dev/ata/ata-sata.c2
-rw-r--r--sys/dev/ata/chipsets/ata-ite.c2
-rw-r--r--sys/dev/ath/ath_dfs/null/dfs_null.c2
-rw-r--r--sys/dev/ath/ath_hal/ah.c2
-rw-r--r--sys/dev/ath/ath_hal/ah.h4
-rw-r--r--sys/dev/ath/ath_hal/ah_regdomain.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5211/ar5211_reset.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar2316.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar2317.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar2413.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar2425.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_attach.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_power.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5212_reset.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5212/ar5413.c4
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_cal.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c2
-rw-r--r--sys/dev/ath/ath_hal/ar5416/ar5416reg.h8
-rw-r--r--sys/dev/ath/ath_hal/ar9002/ar9280_olc.c2
-rw-r--r--sys/dev/ath/if_ath.c16
-rw-r--r--sys/dev/ath/if_ath_ioctl.c2
-rw-r--r--sys/dev/ath/if_ath_lna_div.c2
-rw-r--r--sys/dev/ath/if_ath_pci.c2
-rw-r--r--sys/dev/ath/if_ath_rx.c2
-rw-r--r--sys/dev/ath/if_ath_sysctl.c6
-rw-r--r--sys/dev/ath/if_ath_tx.c6
-rw-r--r--sys/dev/ath/if_ath_tx_ht.c34
-rw-r--r--sys/dev/ath/if_athioctl.h4
-rw-r--r--sys/dev/ath/if_athvar.h2
-rw-r--r--sys/dev/atkbdc/psm.c6
-rw-r--r--sys/dev/bce/if_bce.c4
-rw-r--r--sys/dev/bce/if_bcereg.h4
-rw-r--r--sys/dev/bhnd/bcma/bcma_bhndb.c1
-rw-r--r--sys/dev/bhnd/bcmsrom_fmt.h2
-rw-r--r--sys/dev/bhnd/bhnd.h6
-rw-r--r--sys/dev/bhnd/bhnd_ids.h8
-rw-r--r--sys/dev/bhnd/bhnd_subr.c3
-rw-r--r--sys/dev/bhnd/bhndb/bhndb.c2
-rw-r--r--sys/dev/bhnd/bhndb/bhndb_hwdata.c4
-rw-r--r--sys/dev/bhnd/cores/chipc/chipc.c1
-rw-r--r--sys/dev/bhnd/cores/pci/bhnd_pci.c4
-rw-r--r--sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c1
-rw-r--r--sys/dev/bhnd/cores/pci/bhnd_pcib.c3
-rw-r--r--sys/dev/bhnd/siba/siba.c2
-rw-r--r--sys/dev/bhnd/siba/siba_bhndb.c3
-rw-r--r--sys/dev/bhnd/siba/siba_subr.c2
-rw-r--r--sys/dev/bktr/CHANGELOG.TXT4
-rw-r--r--sys/dev/bktr/bktr_audio.c10
-rw-r--r--sys/dev/bktr/bktr_card.c2
-rw-r--r--sys/dev/bktr/bktr_core.c8
-rw-r--r--sys/dev/bktr/bktr_os.c6
-rw-r--r--sys/dev/bktr/bktr_os.h2
-rw-r--r--sys/dev/bktr/msp34xx.c4
-rw-r--r--sys/dev/buslogic/bt.c8
-rw-r--r--sys/dev/buslogic/bt_eisa.c2
-rw-r--r--sys/dev/bwi/if_bwi.c4
-rw-r--r--sys/dev/bwn/if_bwn.c7277
-rw-r--r--sys/dev/bwn/if_bwn_debug.h66
-rw-r--r--sys/dev/bwn/if_bwn_misc.h65
-rw-r--r--sys/dev/bwn/if_bwn_phy_g.c3600
-rw-r--r--sys/dev/bwn/if_bwn_phy_g.h57
-rw-r--r--sys/dev/bwn/if_bwn_phy_lp.c3707
-rw-r--r--sys/dev/bwn/if_bwn_phy_lp.h50
-rw-r--r--sys/dev/bwn/if_bwnreg.h6
-rw-r--r--sys/dev/bxe/bxe.c10
-rw-r--r--sys/dev/bxe/bxe_elink.c12
-rw-r--r--sys/dev/bxe/bxe_stats.c2
-rw-r--r--sys/dev/bxe/bxe_stats.h4
-rw-r--r--sys/dev/bxe/ecore_hsi.h30
-rw-r--r--sys/dev/bxe/ecore_init.h2
-rw-r--r--sys/dev/bxe/ecore_sp.h2
-rw-r--r--sys/dev/cardbus/cardbus_cis.c2
-rw-r--r--sys/dev/ce/ceddk.c2
-rw-r--r--sys/dev/ce/if_ce.c2
-rw-r--r--sys/dev/cesa/cesa.c6
-rw-r--r--sys/dev/ciss/ciss.c6
-rw-r--r--sys/dev/ciss/cissvar.h2
-rw-r--r--sys/dev/cmx/cmx.c4
-rw-r--r--sys/dev/cmx/cmx_pccard.c2
-rw-r--r--sys/dev/cp/if_cp.c2
-rw-r--r--sys/dev/cs/if_cs.c2
-rw-r--r--sys/dev/cx/csigma.c2
-rw-r--r--sys/dev/cx/if_cx.c2
-rw-r--r--sys/dev/cxgb/common/cxgb_t3_hw.c10
-rw-r--r--sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c2
-rw-r--r--sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h2
-rw-r--r--sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c2
-rw-r--r--sys/dev/cxgbe/adapter.h2
-rw-r--r--sys/dev/cxgbe/common/t4_hw.c6
-rw-r--r--sys/dev/cxgbe/cxgbei/cxgbei.c2
-rw-r--r--sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt4
-rw-r--r--sys/dev/cxgbe/firmware/t4fw_interface.h4
-rw-r--r--sys/dev/cxgbe/firmware/t5fw_cfg_fpga.txt4
-rw-r--r--sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt4
-rw-r--r--sys/dev/cxgbe/offload.h2
-rw-r--r--sys/dev/cxgbe/t4_ioctl.h2
-rw-r--r--sys/dev/cxgbe/t4_l2t.c2
-rw-r--r--sys/dev/cxgbe/t4_main.c4
-rw-r--r--sys/dev/cxgbe/t4_mp_ring.c2
-rw-r--r--sys/dev/cxgbe/t4_netmap.c2
-rw-r--r--sys/dev/cxgbe/t4_sge.c4
-rw-r--r--sys/dev/de/dc21040reg.h2
-rw-r--r--sys/dev/de/if_de.c2
-rw-r--r--sys/dev/de/if_devar.h2
-rw-r--r--sys/dev/dpt/dpt.h4
-rw-r--r--sys/dev/dpt/dpt_scsi.c8
-rw-r--r--sys/dev/drm/drm.h2
-rw-r--r--sys/dev/drm/drm_bufs.c2
-rw-r--r--sys/dev/drm/drm_vm.c2
-rw-r--r--sys/dev/drm/i915_drv.h2
-rw-r--r--sys/dev/drm/mach64_state.c4
-rw-r--r--sys/dev/drm/mga_dma.c2
-rw-r--r--sys/dev/drm/mga_drm.h2
-rw-r--r--sys/dev/drm/radeon_cp.c2
-rw-r--r--sys/dev/drm/radeon_drm.h2
-rw-r--r--sys/dev/drm/radeon_drv.h2
-rw-r--r--sys/dev/drm/radeon_state.c4
-rw-r--r--sys/dev/drm/savage_bci.c2
-rw-r--r--sys/dev/drm/savage_drm.h2
-rw-r--r--sys/dev/drm2/drm_vm.c2
-rw-r--r--sys/dev/drm2/i915/i915_drm.h2
-rw-r--r--sys/dev/drm2/i915/i915_drv.h2
-rw-r--r--sys/dev/drm2/i915/i915_gem.c4
-rw-r--r--sys/dev/drm2/i915/i915_gem_gtt.c2
-rw-r--r--sys/dev/drm2/i915/intel_display.c4
-rw-r--r--sys/dev/drm2/i915/intel_dp.c2
-rw-r--r--sys/dev/drm2/radeon/atombios.h16
-rw-r--r--sys/dev/drm2/radeon/evergreen.c2
-rw-r--r--sys/dev/drm2/radeon/radeon_device.c6
-rw-r--r--sys/dev/drm2/radeon/radeon_fb.c2
-rw-r--r--sys/dev/drm2/radeon/radeon_fence.c4
-rw-r--r--sys/dev/drm2/radeon/radeon_gart.c2
-rw-r--r--sys/dev/drm2/radeon/radeon_gem.c2
-rw-r--r--sys/dev/drm2/radeon/radeon_kms.c2
-rw-r--r--sys/dev/drm2/radeon/radeon_legacy_crtc.c2
-rw-r--r--sys/dev/drm2/ttm/ttm_bo_vm.c4
-rw-r--r--sys/dev/drm2/ttm/ttm_page_alloc_dma.c4
-rw-r--r--sys/dev/dwc/if_dwcvar.h2
-rw-r--r--sys/dev/ed/if_edreg.h2
-rw-r--r--sys/dev/esp/esp_pci.c2
-rw-r--r--sys/dev/esp/ncr53c9xvar.h2
-rw-r--r--sys/dev/et/if_et.c2
-rw-r--r--sys/dev/et/if_etreg.h2
-rw-r--r--sys/dev/etherswitch/e6000sw/e6000sw.c2
-rw-r--r--sys/dev/fatm/if_fatm.c8
-rw-r--r--sys/dev/fatm/if_fatmreg.h2
-rw-r--r--sys/dev/fatm/if_fatmvar.h2
-rw-r--r--sys/dev/fb/fb.c2
-rw-r--r--sys/dev/fb/machfb.c2
-rw-r--r--sys/dev/fb/splash.c2
-rw-r--r--sys/dev/fb/vesa.c2
-rw-r--r--sys/dev/fb/vga.c6
-rw-r--r--sys/dev/fdc/fdc.c2
-rw-r--r--sys/dev/fdt/fdt_static_dtb.S2
-rw-r--r--sys/dev/fe/if_fe_isa.c2
-rw-r--r--sys/dev/fe/mb86960.h2
-rw-r--r--sys/dev/firewire/firewire.c2
-rw-r--r--sys/dev/firewire/fwdev.c3
-rw-r--r--sys/dev/firewire/fwohci.c10
-rw-r--r--sys/dev/firewire/if_fwip.c2
-rw-r--r--sys/dev/firewire/sbp_targ.c2
-rw-r--r--sys/dev/fxp/if_fxp.c6
-rw-r--r--sys/dev/fxp/rcvbundl.h2
-rw-r--r--sys/dev/hatm/if_hatm.c2
-rw-r--r--sys/dev/hatm/if_hatm_rx.c2
-rw-r--r--sys/dev/hatm/if_hatm_tx.c2
-rw-r--r--sys/dev/hifn/hifn7751var.h2
-rw-r--r--sys/dev/hptiop/hptiop.c2
-rw-r--r--sys/dev/hptmv/array.h2
-rw-r--r--sys/dev/hptmv/command.h2
-rw-r--r--sys/dev/hptmv/entry.c4
-rw-r--r--sys/dev/hptmv/hptintf.h2
-rw-r--r--sys/dev/hptmv/mvOs.h2
-rw-r--r--sys/dev/hptnr/hptintf.h8
-rw-r--r--sys/dev/hptrr/hptintf.h8
-rw-r--r--sys/dev/hwpmc/hwpmc_core.h2
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c14
-rw-r--r--sys/dev/hwpmc/pmc_events.h2
-rw-r--r--sys/dev/hyperv/include/hyperv.h2
-rw-r--r--sys/dev/hyperv/utilities/hv_kvp.c4
-rw-r--r--sys/dev/ic/cd180.h2
-rw-r--r--sys/dev/ichiic/ig4_iic.c2
-rw-r--r--sys/dev/ichiic/ig4_reg.h4
-rw-r--r--sys/dev/ida/idareg.h2
-rw-r--r--sys/dev/if_ndis/if_ndis.c4
-rw-r--r--sys/dev/iicbus/ds133x.c2
-rw-r--r--sys/dev/iicbus/if_ic.c2
-rw-r--r--sys/dev/iicbus/iiconf.h2
-rw-r--r--sys/dev/iicbus/twsi/twsi.c2
-rw-r--r--sys/dev/iir/iir.c2
-rw-r--r--sys/dev/intpm/intpm.c2
-rw-r--r--sys/dev/ips/ips.c2
-rw-r--r--sys/dev/isci/isci_controller.c2
-rw-r--r--sys/dev/isci/isci_io_request.c6
-rw-r--r--sys/dev/isci/isci_timer.c2
-rw-r--r--sys/dev/isci/scil/intel_sas.h2
-rw-r--r--sys/dev/isci/scil/sati_callbacks.h10
-rw-r--r--sys/dev/isci/scil/sati_design.h2
-rw-r--r--sys/dev/isci/scil/sati_device.h2
-rw-r--r--sys/dev/isci/scil/sati_log_sense.c6
-rw-r--r--sys/dev/isci/scil/sati_move.c6
-rw-r--r--sys/dev/isci/scil/sati_translator_sequence.h4
-rw-r--r--sys/dev/isci/scil/sati_util.c2
-rw-r--r--sys/dev/isci/scil/sci_base_phy.h2
-rw-r--r--sys/dev/isci/scil/sci_fast_list.h2
-rw-r--r--sys/dev/isci/scil/sci_simple_list.h4
-rw-r--r--sys/dev/isci/scil/scic_config_parameters.h2
-rw-r--r--sys/dev/isci/scil/scic_controller.h2
-rw-r--r--sys/dev/isci/scil/scic_phy.h2
-rw-r--r--sys/dev/isci/scil/scic_sds_controller.c6
-rw-r--r--sys/dev/isci/scil/scic_sds_controller.h4
-rw-r--r--sys/dev/isci/scil/scic_sds_phy.c36
-rw-r--r--sys/dev/isci/scil/scic_sds_phy_registers.h2
-rw-r--r--sys/dev/isci/scil/scic_sds_port.c4
-rw-r--r--sys/dev/isci/scil/scic_sds_port.h2
-rw-r--r--sys/dev/isci/scil/scic_sds_port_configuration_agent.c4
-rw-r--r--sys/dev/isci/scil/scic_sds_remote_device.c2
-rw-r--r--sys/dev/isci/scil/scic_sds_remote_node_context.c2
-rw-r--r--sys/dev/isci/scil/scic_sds_remote_node_table.c2
-rw-r--r--sys/dev/isci/scil/scic_sds_request.c16
-rw-r--r--sys/dev/isci/scil/scic_sds_smp_request.c6
-rw-r--r--sys/dev/isci/scil/scic_sds_ssp_request.c4
-rw-r--r--sys/dev/isci/scil/scic_sds_stp_packet_request.c4
-rw-r--r--sys/dev/isci/scil/scic_sds_stp_remote_device.c2
-rw-r--r--sys/dev/isci/scil/scic_sds_stp_request.c8
-rw-r--r--sys/dev/isci/scil/scic_sds_stp_request.h2
-rw-r--r--sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c2
-rw-r--r--sys/dev/isci/scil/scic_task_request.h2
-rw-r--r--sys/dev/isci/scil/scic_user_callback.h10
-rw-r--r--sys/dev/isci/scil/scif_config_parameters.h2
-rw-r--r--sys/dev/isci/scil/scif_domain.h2
-rw-r--r--sys/dev/isci/scil/scif_io_request.h4
-rw-r--r--sys/dev/isci/scil/scif_sas_design.h2
-rw-r--r--sys/dev/isci/scil/scif_sas_domain.c6
-rw-r--r--sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c2
-rw-r--r--sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c8
-rw-r--r--sys/dev/isci/scil/scif_sas_stp_remote_device.c2
-rw-r--r--sys/dev/isci/scil/scif_sas_stp_task_request.c2
-rw-r--r--sys/dev/isci/scil/scif_user_callback.h6
-rw-r--r--sys/dev/isci/scil/scu_registers.h14
-rw-r--r--sys/dev/isci/scil/scu_task_context.h10
-rw-r--r--sys/dev/iscsi_initiator/isc_cam.c2
-rw-r--r--sys/dev/iscsi_initiator/isc_soc.c2
-rw-r--r--sys/dev/iscsi_initiator/iscsi.c2
-rw-r--r--sys/dev/isp/DriverManual.txt8
-rw-r--r--sys/dev/isp/isp.c4
-rw-r--r--sys/dev/isp/ispvar.h6
-rw-r--r--sys/dev/iwi/if_iwi.c2
-rw-r--r--sys/dev/iwi/if_iwireg.h2
-rw-r--r--sys/dev/iwm/if_iwm.c190
-rw-r--r--sys/dev/iwm/if_iwmreg.h10
-rw-r--r--sys/dev/iwm/if_iwmvar.h5
-rw-r--r--sys/dev/iwn/if_iwn.c116
-rw-r--r--sys/dev/ixgb/ixgb_ee.c2
-rw-r--r--sys/dev/ixgb/ixgb_hw.c2
-rw-r--r--sys/dev/jme/if_jmereg.h2
-rw-r--r--sys/dev/jme/if_jmevar.h2
-rw-r--r--sys/dev/kbd/kbd.c4
-rw-r--r--sys/dev/lge/if_lge.c2
-rw-r--r--sys/dev/lmc/if_lmc.c2
-rw-r--r--sys/dev/lmc/if_lmc.h4
-rw-r--r--sys/dev/malo/if_malo.c2
-rw-r--r--sys/dev/mfi/mfi.c4
-rw-r--r--sys/dev/mfi/mfi_tbolt.c4
-rw-r--r--sys/dev/mge/if_mgevar.h2
-rw-r--r--sys/dev/mlx/mlx_disk.c2
-rw-r--r--sys/dev/mlx5/driver.h2
-rw-r--r--sys/dev/mlx5/mlx5_core/mlx5_eq.c10
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_main.c10
-rw-r--r--sys/dev/mly/mly.c2
-rw-r--r--sys/dev/mly/mlyreg.h4
-rw-r--r--sys/dev/mmc/mmcreg.h2
-rw-r--r--sys/dev/mn/if_mn.c2
-rw-r--r--sys/dev/mpr/mpi/mpi2_history.txt2
-rw-r--r--sys/dev/mpr/mpi/mpi2_init.h2
-rw-r--r--sys/dev/mpr/mpr.c2
-rw-r--r--sys/dev/mpr/mpr_mapping.h2
-rw-r--r--sys/dev/mpr/mpr_sas_lsi.c2
-rw-r--r--sys/dev/mps/mpi/mpi2_history.txt2
-rw-r--r--sys/dev/mps/mpi/mpi2_init.h2
-rw-r--r--sys/dev/mps/mps.c8
-rw-r--r--sys/dev/mps/mps_config.c2
-rw-r--r--sys/dev/mps/mps_mapping.h2
-rw-r--r--sys/dev/mps/mps_sas.c6
-rw-r--r--sys/dev/mps/mps_sas_lsi.c2
-rw-r--r--sys/dev/mpt/mpilib/mpi_cnfg.h2
-rw-r--r--sys/dev/mpt/mpilib/mpi_log_fc.h4
-rw-r--r--sys/dev/mpt/mpilib/mpi_log_sas.h14
-rw-r--r--sys/dev/mpt/mpt.c2
-rw-r--r--sys/dev/mpt/mpt.h6
-rw-r--r--sys/dev/mrsas/mrsas.c4
-rw-r--r--sys/dev/mrsas/mrsas_cam.c2
-rw-r--r--sys/dev/msk/if_msk.c2
-rw-r--r--sys/dev/msk/if_mskreg.h6
-rw-r--r--sys/dev/mvs/mvs.c4
-rw-r--r--sys/dev/mvs/mvs.h2
-rw-r--r--sys/dev/mwl/if_mwl.c2
-rw-r--r--sys/dev/mwl/if_mwlvar.h3
-rw-r--r--sys/dev/mwl/mwlhal.h4
-rw-r--r--sys/dev/nand/nfc_fsl.c2
-rw-r--r--sys/dev/ncr/ncr.c14
-rw-r--r--sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c2
-rw-r--r--sys/dev/netmap/netmap.c6
-rw-r--r--sys/dev/netmap/netmap_generic.c2
-rw-r--r--sys/dev/netmap/netmap_offloadings.c2
-rw-r--r--sys/dev/nge/if_nge.c2
-rw-r--r--sys/dev/nsp/nsp.c2
-rw-r--r--sys/dev/ntb/ntb_hw/ntb_hw.c4
-rw-r--r--sys/dev/otus/if_otus.c169
-rw-r--r--sys/dev/otus/if_otusreg.h4
-rw-r--r--sys/dev/patm/if_patmvar.h2
-rw-r--r--sys/dev/pccbb/pccbb.c2
-rw-r--r--sys/dev/pccbb/pccbb_pci.c4
-rw-r--r--sys/dev/pcf/pcf_isa.c2
-rw-r--r--sys/dev/pci/hostb_pci.c2
-rw-r--r--sys/dev/pci/pci.c10
-rw-r--r--sys/dev/pdq/pdq.c2
-rw-r--r--sys/dev/ppbus/lpt.c2
-rw-r--r--sys/dev/ppbus/ppb_1284.c20
-rw-r--r--sys/dev/ppbus/vpo.c2
-rw-r--r--sys/dev/ppbus/vpoio.c2
-rw-r--r--sys/dev/qlxgb/qla_def.h2
-rw-r--r--sys/dev/qlxgb/qla_hw.c6
-rw-r--r--sys/dev/qlxgb/qla_isr.c2
-rw-r--r--sys/dev/qlxgbe/ql_def.h2
-rw-r--r--sys/dev/qlxgbe/ql_hw.c4
-rw-r--r--sys/dev/qlxge/qls_def.h2
-rw-r--r--sys/dev/qlxge/qls_hw.c4
-rw-r--r--sys/dev/qlxge/qls_isr.c2
-rw-r--r--sys/dev/ral/rt2560.c6
-rw-r--r--sys/dev/ral/rt2661.c2
-rw-r--r--sys/dev/ral/rt2860.c2
-rw-r--r--sys/dev/random/fortuna.c2
-rw-r--r--sys/dev/random/yarrow.c6
-rw-r--r--sys/dev/rc/rc.c2
-rw-r--r--sys/dev/rl/if_rlreg.h2
-rw-r--r--sys/dev/rtwn/if_rtwn.c2
-rw-r--r--sys/dev/sbni/if_sbni.c2
-rw-r--r--sys/dev/sf/if_sf.c4
-rw-r--r--sys/dev/sfxge/common/efx_bootcfg.c2
-rw-r--r--sys/dev/sfxge/common/efx_nic.c2
-rw-r--r--sys/dev/sfxge/common/efx_regs_mcdi.h6
-rw-r--r--sys/dev/sfxge/common/hunt_nvram.c2
-rw-r--r--sys/dev/sfxge/common/siena_nvram.c2
-rw-r--r--sys/dev/sfxge/common/siena_vpd.c2
-rw-r--r--sys/dev/sfxge/sfxge_rx.c2
-rw-r--r--sys/dev/sfxge/sfxge_tx.c2
-rw-r--r--sys/dev/si/si.c2
-rw-r--r--sys/dev/si/si.h2
-rw-r--r--sys/dev/siis/siis.c2
-rw-r--r--sys/dev/siis/siis.h2
-rw-r--r--sys/dev/sio/sio.c2
-rw-r--r--sys/dev/sk/if_sk.c2
-rw-r--r--sys/dev/sk/yukonreg.h2
-rw-r--r--sys/dev/sn/if_sn.c2
-rw-r--r--sys/dev/sn/if_snreg.h4
-rw-r--r--sys/dev/snc/dp83932.c4
-rw-r--r--sys/dev/snc/dp83932var.h2
-rw-r--r--sys/dev/sym/sym_hipd.c6
-rw-r--r--sys/dev/syscons/scmouse.c6
-rw-r--r--sys/dev/syscons/scvgarndr.c2
-rw-r--r--sys/dev/syscons/syscons.c2
-rw-r--r--sys/dev/ti/if_ti.c8
-rw-r--r--sys/dev/ti/if_tireg.h6
-rw-r--r--sys/dev/tl/if_tl.c2
-rw-r--r--sys/dev/tpm/tpm.c4
-rw-r--r--sys/dev/tpm/tpm_acpi.c2
-rw-r--r--sys/dev/trm/trm.c4
-rw-r--r--sys/dev/trm/trm.h2
-rw-r--r--sys/dev/tsec/if_tsec.h6
-rw-r--r--sys/dev/twe/twe.c2
-rw-r--r--sys/dev/twe/twevar.h2
-rw-r--r--sys/dev/tws/tws_cam.c2
-rw-r--r--sys/dev/tws/tws_hdm.c4
-rw-r--r--sys/dev/tx/if_tx.c4
-rw-r--r--sys/dev/tx/if_txreg.h2
-rw-r--r--sys/dev/uart/uart_bus_fdt.c2
-rw-r--r--sys/dev/uart/uart_dev_lpc.c4
-rw-r--r--sys/dev/uart/uart_dev_ns8250.c6
-rw-r--r--sys/dev/urtwn/if_urtwn.c2
-rw-r--r--sys/dev/usb/controller/at91dci.c2
-rw-r--r--sys/dev/usb/controller/dwc_otg.c2
-rw-r--r--sys/dev/usb/controller/ehci.c2
-rw-r--r--sys/dev/usb/controller/ohci.c2
-rw-r--r--sys/dev/usb/controller/uhci.c2
-rw-r--r--sys/dev/usb/controller/xhcireg.h6
-rw-r--r--sys/dev/usb/input/ums.c2
-rw-r--r--sys/dev/usb/input/wsp.c2
-rw-r--r--sys/dev/usb/misc/udbp.c2
-rw-r--r--sys/dev/usb/net/if_cue.c2
-rw-r--r--sys/dev/usb/net/if_mos.c2
-rw-r--r--sys/dev/usb/net/if_rue.c2
-rw-r--r--sys/dev/usb/net/if_urndis.c2
-rw-r--r--sys/dev/usb/serial/ulpt.c2
-rw-r--r--sys/dev/usb/serial/umcs.h32
-rw-r--r--sys/dev/usb/serial/uvisor.c2
-rw-r--r--sys/dev/usb/storage/rio500_usb.h2
-rw-r--r--sys/dev/usb/storage/umass.c2
-rw-r--r--sys/dev/usb/template/usb_template.c4
-rw-r--r--sys/dev/usb/usb_cdc.h2
-rw-r--r--sys/dev/usb/usb_dev.c2
-rw-r--r--sys/dev/usb/usb_device.c4
-rw-r--r--sys/dev/usb/usb_handle_request.c2
-rw-r--r--sys/dev/usb/usb_hid.c2
-rw-r--r--sys/dev/usb/usb_hub.c6
-rw-r--r--sys/dev/usb/usb_transfer.c4
-rw-r--r--sys/dev/usb/usbdevs2
-rw-r--r--sys/dev/usb/usbdi.h2
-rw-r--r--sys/dev/usb/wlan/if_rsu.c2
-rw-r--r--sys/dev/usb/wlan/if_rum.c40
-rw-r--r--sys/dev/usb/wlan/if_run.c8
-rw-r--r--sys/dev/usb/wlan/if_uath.c2
-rw-r--r--sys/dev/usb/wlan/if_upgt.c2
-rw-r--r--sys/dev/usb/wlan/if_ural.c2
-rw-r--r--sys/dev/usb/wlan/if_urtw.c2
-rw-r--r--sys/dev/usb/wlan/if_zyd.c2
-rw-r--r--sys/dev/virtio/console/virtio_console.c2
-rw-r--r--sys/dev/vt/hw/vga/vt_vga.c2
-rw-r--r--sys/dev/vt/vt_core.c4
-rw-r--r--sys/dev/vx/if_vx.c4
-rw-r--r--sys/dev/vx/if_vx_eisa.c2
-rw-r--r--sys/dev/vxge/include/vxge-queue.h8
-rw-r--r--sys/dev/vxge/include/vxgehal-ll.h12
-rw-r--r--sys/dev/vxge/include/vxgehal-mgmt.h12
-rw-r--r--sys/dev/vxge/include/vxgehal-mgmtaux.h8
-rw-r--r--sys/dev/vxge/include/vxgehal-stats.h2
-rw-r--r--sys/dev/vxge/vxgehal/vxge-queue.c4
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-device.c2
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-fifo.c4
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-mgmt.c8
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-mgmtaux.c8
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-regs.h6
-rw-r--r--sys/dev/vxge/vxgehal/vxgehal-virtualpath.c6
-rw-r--r--sys/dev/wbwd/wbwd.c2
-rw-r--r--sys/dev/wi/if_wavelan_ieee.h2
-rw-r--r--sys/dev/wi/if_wi.c2
-rw-r--r--sys/dev/wi/if_wireg.h4
-rw-r--r--sys/dev/wl/if_wl.c8
-rw-r--r--sys/dev/wpi/if_wpi.c53
-rw-r--r--sys/dev/wtap/if_wtap.c2
-rw-r--r--sys/dev/wtap/if_wtap_module.c4
-rw-r--r--sys/dev/wtap/plugins/visibility.c2
-rw-r--r--sys/dev/xe/if_xereg.h2
-rw-r--r--sys/dev/xen/balloon/balloon.c2
-rw-r--r--sys/dev/xen/blkback/blkback.c14
-rw-r--r--sys/dev/xen/blkfront/blkfront.c4
-rw-r--r--sys/dev/xen/blkfront/block.h2
-rw-r--r--sys/dev/xen/control/control.c16
-rw-r--r--sys/dev/xen/netback/netback.c4
-rw-r--r--sys/dev/xen/netback/netback_unit_tests.c2
-rw-r--r--sys/dev/xen/timer/timer.c55
-rw-r--r--sys/dev/xen/xenstore/xenstore.c4
-rw-r--r--sys/dev/xen/xenstore/xenstore_dev.c2
-rw-r--r--sys/dev/xl/if_xl.c2
-rw-r--r--sys/fs/ext2fs/ext2_inode.c2
-rw-r--r--sys/fs/fdescfs/fdesc.h2
-rw-r--r--sys/fs/fdescfs/fdesc_vfsops.c15
-rw-r--r--sys/fs/fdescfs/fdesc_vnops.c60
-rw-r--r--sys/fs/fuse/fuse_io.c4
-rw-r--r--sys/fs/fuse/fuse_vnops.c8
-rw-r--r--sys/fs/msdosfs/msdosfs_conv.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_fat.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_lookup.c4
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c2
-rw-r--r--sys/fs/nandfs/nandfs_fs.h2
-rw-r--r--sys/fs/nandfs/nandfs_subr.h2
-rw-r--r--sys/fs/nandfs/nandfs_sufile.c2
-rw-r--r--sys/fs/nandfs/nandfs_vfsops.c4
-rw-r--r--sys/fs/nandfs/nandfs_vnops.c4
-rw-r--r--sys/fs/nfs/nfs_commonport.c2
-rw-r--r--sys/fs/nfs/nfsport.h2
-rw-r--r--sys/fs/nfs/nfsrvstate.h2
-rw-r--r--sys/fs/nfsclient/nfs_clbio.c10
-rw-r--r--sys/fs/nfsclient/nfs_clkdtrace.c2
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c10
-rw-r--r--sys/fs/nfsclient/nfs_clstate.c2
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c2
-rw-r--r--sys/fs/nfsclient/nfs_clvnops.c2
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c6
-rw-r--r--sys/fs/nfsserver/nfs_nfsdstate.c12
-rw-r--r--sys/fs/nullfs/null_vnops.c2
-rw-r--r--sys/fs/smbfs/smbfs_io.c2
-rw-r--r--sys/fs/smbfs/smbfs_subr.h2
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c2
-rw-r--r--sys/fs/udf/osta.h2
-rw-r--r--sys/geom/bde/g_bde_lock.c2
-rw-r--r--sys/geom/geom_bsd_enc.c2
-rw-r--r--sys/geom/geom_ccd.c4
-rw-r--r--sys/geom/geom_dev.c6
-rw-r--r--sys/geom/geom_disk.c2
-rw-r--r--sys/geom/geom_kern.c2
-rw-r--r--sys/geom/geom_mbr_enc.c2
-rw-r--r--sys/geom/geom_sunlabel_enc.c2
-rw-r--r--sys/geom/journal/g_journal.c6
-rw-r--r--sys/geom/journal/g_journal.h2
-rw-r--r--sys/geom/mirror/g_mirror.c4
-rw-r--r--sys/geom/part/g_part_bsd64.c2
-rw-r--r--sys/geom/part/g_part_if.m2
-rw-r--r--sys/geom/part/g_part_ldm.c2
-rw-r--r--sys/geom/raid/g_raid_ctl.c6
-rw-r--r--sys/geom/raid/md_ddf.c2
-rw-r--r--sys/geom/raid/tr_raid1.c6
-rw-r--r--sys/geom/raid/tr_raid1e.c2
-rw-r--r--sys/geom/raid3/g_raid3.c2
-rw-r--r--sys/geom/vinum/geom_vinum_drive.c2
-rw-r--r--sys/geom/vinum/geom_vinum_subr.c2
-rw-r--r--sys/geom/virstor/g_virstor.c11
-rw-r--r--sys/i386/bios/smapi.c2
-rw-r--r--sys/i386/conf/NOTES5
-rw-r--r--sys/i386/include/xen/hypercall.h4
-rw-r--r--sys/isa/rtc.h1
-rw-r--r--sys/kern/bus_if.m8
-rw-r--r--sys/kern/imgact_binmisc.c2
-rw-r--r--sys/kern/inflate.c4
-rw-r--r--sys/kern/kern_condvar.c2
-rw-r--r--sys/kern/kern_descrip.c8
-rw-r--r--sys/kern/kern_exec.c2
-rw-r--r--sys/kern/kern_fork.c2
-rw-r--r--sys/kern/kern_jail.c4
-rw-r--r--sys/kern/kern_linker.c4
-rw-r--r--sys/kern/kern_lock.c6
-rw-r--r--sys/kern/kern_lockf.c20
-rw-r--r--sys/kern/kern_mbuf.c2
-rw-r--r--sys/kern/kern_mtxpool.c2
-rw-r--r--sys/kern/kern_prot.c4
-rw-r--r--sys/kern/kern_rctl.c2
-rw-r--r--sys/kern/kern_rmlock.c2
-rw-r--r--sys/kern/kern_sysctl.c4
-rw-r--r--sys/kern/kern_tc.c2
-rw-r--r--sys/kern/kern_timeout.c2
-rw-r--r--sys/kern/link_elf_obj.c2
-rw-r--r--sys/kern/linker_if.m2
-rw-r--r--sys/kern/sched_4bsd.c2
-rw-r--r--sys/kern/subr_blist.c4
-rw-r--r--sys/kern/subr_bus.c2
-rw-r--r--sys/kern/subr_devstat.c2
-rw-r--r--sys/kern/subr_hash.c29
-rw-r--r--sys/kern/subr_intr.c4
-rw-r--r--sys/kern/subr_mbpool.c2
-rw-r--r--sys/kern/subr_mchain.c2
-rw-r--r--sys/kern/subr_msgbuf.c2
-rw-r--r--sys/kern/subr_prof.c2
-rw-r--r--sys/kern/subr_scanf.c2
-rw-r--r--sys/kern/subr_uio.c2
-rw-r--r--sys/kern/subr_unit.c89
-rw-r--r--sys/kern/subr_witness.c2
-rw-r--r--sys/kern/sys_socket.c7
-rw-r--r--sys/kern/sysv_sem.c2
-rw-r--r--sys/kern/tty.c2
-rw-r--r--sys/kern/tty_pts.c2
-rw-r--r--sys/kern/uipc_domain.c1
-rw-r--r--sys/kern/uipc_mbuf2.c2
-rw-r--r--sys/kern/uipc_socket.c13
-rw-r--r--sys/kern/vfs_bio.c29
-rw-r--r--sys/kern/vfs_cache.c4
-rw-r--r--sys/kern/vfs_cluster.c2
-rw-r--r--sys/kern/vfs_lookup.c2
-rw-r--r--sys/kern/vfs_mountroot.c2
-rw-r--r--sys/kern/vfs_subr.c29
-rw-r--r--sys/kern/vfs_vnops.c2
-rw-r--r--sys/kern/vnode_if.src2
-rw-r--r--sys/libkern/crc32.c2
-rw-r--r--sys/mips/atheros/ar934x_chip.c2
-rw-r--r--sys/mips/atheros/qca953x_chip.c2
-rw-r--r--sys/mips/atheros/qca955x_chip.c2
-rw-r--r--sys/mips/include/param.h2
-rw-r--r--sys/mips/mips/pmap.c14
-rw-r--r--sys/modules/bhnd/Makefile2
-rw-r--r--sys/modules/bhnd/bcma_bhndb/Makefile2
-rw-r--r--sys/modules/bhnd/bhndb/Makefile3
-rw-r--r--sys/modules/bhnd/nvram/Makefile2
-rw-r--r--sys/modules/bhnd/siba_bhndb/Makefile2
-rw-r--r--sys/modules/bwn/Makefile3
-rw-r--r--sys/net/if_vxlan.c2
-rw-r--r--sys/net80211/_ieee80211.h3
-rw-r--r--sys/net80211/ieee80211.c264
-rw-r--r--sys/net80211/ieee80211_adhoc.c3
-rw-r--r--sys/net80211/ieee80211_freebsd.h2
-rw-r--r--sys/net80211/ieee80211_ioctl.c12
-rw-r--r--sys/net80211/ieee80211_regdomain.c112
-rw-r--r--sys/net80211/ieee80211_var.h8
-rw-r--r--sys/netgraph/atm/ng_atm.c2
-rw-r--r--sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c4
-rw-r--r--sys/netgraph/bluetooth/hci/ng_hci_cmds.c2
-rw-r--r--sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h4
-rw-r--r--sys/netgraph/bluetooth/include/ng_hci.h6
-rw-r--r--sys/netgraph/bluetooth/include/ng_l2cap.h4
-rw-r--r--sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c2
-rw-r--r--sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c4
-rw-r--r--sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c2
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c6
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c4
-rw-r--r--sys/netgraph/bluetooth/socket/ng_btsocket_sco.c4
-rw-r--r--sys/netgraph/netflow/ng_netflow.c2
-rw-r--r--sys/netgraph/netflow/ng_netflow.h2
-rw-r--r--sys/netgraph/netgraph.h6
-rw-r--r--sys/netgraph/ng_base.c4
-rw-r--r--sys/netgraph/ng_bridge.c2
-rw-r--r--sys/netgraph/ng_car.c18
-rw-r--r--sys/netgraph/ng_car.h4
-rw-r--r--sys/netgraph/ng_etf.c2
-rw-r--r--sys/netgraph/ng_ether.c2
-rw-r--r--sys/netgraph/ng_frame_relay.c2
-rw-r--r--sys/netgraph/ng_gif.c2
-rw-r--r--sys/netgraph/ng_gif_demux.c2
-rw-r--r--sys/netgraph/ng_ksocket.c6
-rw-r--r--sys/netgraph/ng_l2tp.h2
-rw-r--r--sys/netgraph/ng_lmi.c4
-rw-r--r--sys/netgraph/ng_one2many.c2
-rw-r--r--sys/netgraph/ng_ppp.c8
-rw-r--r--sys/netgraph/ng_pppoe.c4
-rw-r--r--sys/netgraph/ng_pptpgre.c2
-rw-r--r--sys/netgraph/ng_sample.c8
-rw-r--r--sys/netgraph/ng_source.c2
-rw-r--r--sys/netgraph/ng_split.h2
-rw-r--r--sys/netgraph/ng_tee.c4
-rw-r--r--sys/netgraph/ng_tty.c2
-rw-r--r--sys/netgraph/ng_vjc.c2
-rw-r--r--sys/netgraph/ng_vlan.c6
-rw-r--r--sys/netinet/ip_icmp.h5
-rw-r--r--sys/netinet/sctp_asconf.c3
-rw-r--r--sys/netinet/sctp_bsd_addr.c2
-rw-r--r--sys/netinet/sctp_cc_functions.c14
-rw-r--r--sys/netinet/sctp_constants.h8
-rw-r--r--sys/netinet/sctp_indata.c12
-rw-r--r--sys/netinet/sctp_input.c28
-rw-r--r--sys/netinet/sctp_lock_bsd.h2
-rw-r--r--sys/netinet/sctp_output.c32
-rw-r--r--sys/netinet/sctp_pcb.c26
-rw-r--r--sys/netinet/sctp_pcb.h10
-rw-r--r--sys/netinet/sctp_structs.h2
-rw-r--r--sys/netinet/sctp_timer.c8
-rw-r--r--sys/netinet/sctp_usrreq.c5
-rw-r--r--sys/netinet/sctputil.c276
-rw-r--r--sys/netinet/tcp_lro.c30
-rw-r--r--sys/netinet/tcp_syncache.c16
-rw-r--r--sys/netinet/udp_usrreq.c21
-rw-r--r--sys/netinet/udp_var.h8
-rw-r--r--sys/netinet6/sctp6_usrreq.c4
-rw-r--r--sys/netinet6/udp6_usrreq.c23
-rw-r--r--sys/nfs/krpc_subr.c2
-rw-r--r--sys/nfs/nfs_nfssvc.c2
-rw-r--r--sys/pc98/conf/NOTES5
-rw-r--r--sys/powerpc/conf/NOTES4
-rw-r--r--sys/powerpc/powerpc/exec_machdep.c6
-rw-r--r--sys/rpc/clnt_dg.c4
-rw-r--r--sys/sparc64/conf/NOTES1
-rw-r--r--sys/sys/buf.h8
-rw-r--r--sys/sys/conf.h2
-rw-r--r--sys/sys/protosw.h3
-rw-r--r--sys/sys/socketvar.h1
-rw-r--r--sys/sys/systm.h2
-rw-r--r--sys/ufs/ffs/ffs_alloc.c6
-rw-r--r--sys/ufs/ffs/ffs_softdep.c4
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c2
-rw-r--r--sys/ufs/ffs/fs.h4
-rw-r--r--sys/ufs/ufs/dirhash.h2
-rw-r--r--sys/ufs/ufs/ufs_acl.c2
-rw-r--r--sys/vm/device_pager.c18
-rw-r--r--sys/vm/swap_pager.c4
-rw-r--r--sys/vm/uma_core.c6
-rw-r--r--sys/vm/uma_int.h2
-rw-r--r--sys/vm/vm_glue.c4
-rw-r--r--sys/vm/vm_map.c2
-rw-r--r--sys/vm/vm_object.c2
-rw-r--r--sys/vm/vm_page.c4
-rw-r--r--sys/vm/vm_page.h2
-rw-r--r--sys/vm/vm_pageout.c4
-rw-r--r--sys/vm/vnode_pager.c6
-rw-r--r--sys/x86/isa/atrtc.c49
-rw-r--r--tests/Makefile3
-rw-r--r--tests/etc/Makefile3
-rw-r--r--tests/sys/kern/Makefile10
-rw-r--r--tools/build/mk/Makefile.boot2
-rw-r--r--tools/regression/sockets/so_setfib/so_setfib.c2
-rw-r--r--tools/tools/fixwhite/fixwhite.12
-rw-r--r--tools/tools/fixwhite/fixwhite.c2
-rw-r--r--tools/tools/ipw/ipwstats.c4
-rwxr-xr-xtools/tools/nanobsd/defaults.sh4
-rw-r--r--tools/tools/nanobsd/dhcpd/common2
-rw-r--r--tools/tools/nanobsd/embedded/README6
-rw-r--r--tools/tools/nanobsd/embedded/common2
-rw-r--r--tools/tools/netmap/pkt-gen.8179
-rwxr-xr-xtools/tools/shlib-compat/shlib-compat.py2
-rw-r--r--tools/tools/wtap/vis_map/vis_map.c2
-rw-r--r--tools/tools/wtap/wtap/wtap.c2
-rw-r--r--usr.bin/Makefile1
-rw-r--r--usr.bin/iscsictl/iscsictl.c2
-rw-r--r--usr.bin/localedef/charmap.c2
-rw-r--r--usr.bin/localedef/collate.c2
-rw-r--r--usr.bin/localedef/scanner.c2
-rw-r--r--usr.bin/localedef/time.c2
-rw-r--r--usr.bin/localedef/wide.c2
-rw-r--r--usr.bin/m4/eval.c2
-rw-r--r--usr.bin/newgrp/newgrp.c5
-rw-r--r--usr.bin/sdiff/Makefile16
-rw-r--r--usr.bin/sdiff/common.c24
-rw-r--r--usr.bin/sdiff/common.h9
-rw-r--r--usr.bin/sdiff/edit.c209
-rw-r--r--usr.bin/sdiff/extern.h12
-rw-r--r--usr.bin/sdiff/sdiff.1174
-rw-r--r--usr.bin/sdiff/sdiff.c1185
-rw-r--r--usr.bin/sdiff/tests/Makefile38
-rw-r--r--usr.bin/sdiff/tests/d_dot.in1
-rw-r--r--usr.bin/sdiff/tests/d_flags_l.out102
-rw-r--r--usr.bin/sdiff/tests/d_flags_s.out79
-rw-r--r--usr.bin/sdiff/tests/d_flags_w.out102
-rw-r--r--usr.bin/sdiff/tests/d_iflags_a1.out100
-rw-r--r--usr.bin/sdiff/tests/d_iflags_a2.out96
-rw-r--r--usr.bin/sdiff/tests/d_iflags_b1.out69
-rw-r--r--usr.bin/sdiff/tests/d_iflags_b2.out65
-rw-r--r--usr.bin/sdiff/tests/d_iflags_c1.out99
-rw-r--r--usr.bin/sdiff/tests/d_iflags_c2.out94
-rw-r--r--usr.bin/sdiff/tests/d_iflags_d1.out69
-rw-r--r--usr.bin/sdiff/tests/d_iflags_d2.out65
-rw-r--r--usr.bin/sdiff/tests/d_input172
-rw-r--r--usr.bin/sdiff/tests/d_input269
-rw-r--r--usr.bin/sdiff/tests/d_oneline.in1
-rw-r--r--usr.bin/sdiff/tests/d_oneline_a.out1
-rw-r--r--usr.bin/sdiff/tests/d_oneline_b.out1
-rw-r--r--usr.bin/sdiff/tests/d_same.out72
-rw-r--r--usr.bin/sdiff/tests/d_short.out15
-rw-r--r--usr.bin/sdiff/tests/d_tabends.in17
-rw-r--r--usr.bin/sdiff/tests/d_tabends_a.out17
-rw-r--r--usr.bin/sdiff/tests/d_tabends_b.out17
-rw-r--r--usr.bin/sdiff/tests/d_tabends_c.out17
-rw-r--r--usr.bin/sdiff/tests/d_tabs.out102
-rw-r--r--usr.bin/sdiff/tests/d_tabs1.in72
-rw-r--r--usr.bin/sdiff/tests/d_tabs2.in69
-rwxr-xr-xusr.bin/sdiff/tests/sdiff.sh207
-rw-r--r--usr.bin/svn/Makefile.inc2
-rw-r--r--usr.bin/svn/svn_private_config.h6
-rw-r--r--usr.bin/tests/Makefile3
-rw-r--r--usr.bin/timeout/tests/timeout.sh2
-rw-r--r--usr.bin/timeout/timeout.c2
-rw-r--r--usr.bin/whereis/whereis.c2
-rw-r--r--usr.bin/xlint/lint2/chk.c2
-rw-r--r--usr.sbin/bluetooth/btpand/btpand.c2
-rw-r--r--usr.sbin/bluetooth/hccontrol/node.c2
-rw-r--r--usr.sbin/bsdconfig/share/common.subr4
-rw-r--r--usr.sbin/bsdconfig/share/dialog.subr8
-rw-r--r--usr.sbin/bsdconfig/share/geom.subr2
-rw-r--r--usr.sbin/bsdconfig/share/media/tcpip.subr2
-rw-r--r--usr.sbin/bsdconfig/share/packages/index.subr6
-rw-r--r--usr.sbin/bsdconfig/share/packages/packages.subr4
-rw-r--r--usr.sbin/bsdconfig/startup/share/rcconf.subr8
-rw-r--r--usr.sbin/bsdconfig/startup/share/rcvar.subr8
-rwxr-xr-xusr.sbin/bsdinstall/scripts/netconfig_ipv42
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot2
-rw-r--r--usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c7
-rw-r--r--usr.sbin/camdd/camdd.c2
-rw-r--r--usr.sbin/cron/cron/cron.c4
-rw-r--r--usr.sbin/cron/cron/popen.c2
-rw-r--r--usr.sbin/ctladm/ctladm.c2
-rw-r--r--usr.sbin/extattr/tests/Makefile4
-rw-r--r--usr.sbin/gssd/gssd.c2
-rw-r--r--usr.sbin/inetd/inetd.c2
-rw-r--r--usr.sbin/jail/jail.811
-rw-r--r--usr.sbin/jail/jailparse.y2
-rw-r--r--usr.sbin/lpr/common_source/common.c2
-rw-r--r--usr.sbin/lpr/lpc/lpc.c2
-rw-r--r--usr.sbin/lpr/lpd/recvjob.c4
-rw-r--r--usr.sbin/makefs/ffs/mkfs.c5
-rw-r--r--usr.sbin/mountd/mountd.c2
-rw-r--r--usr.sbin/nandsim/nandsim_cfgparse.c2
-rw-r--r--usr.sbin/pmcstat/pmcpl_calltree.c2
-rw-r--r--usr.sbin/pmcstat/pmcstat_log.c2
-rw-r--r--usr.sbin/quot/quot.c4
-rw-r--r--usr.sbin/rpcbind/rpcb_svc_com.c2
-rw-r--r--usr.sbin/rtadvd/rtadvd.c2
-rw-r--r--usr.sbin/tests/Makefile3
1129 files changed, 16662 insertions, 10910 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index a90e0f2..ef27380 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -38,6 +38,9 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20160430: kvm_getfiles(3) removed from kvm(3)
+OLD_LIBS+=usr/lib/libkvm.so.6
+OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz
# 20160423: remove mroute6d
OLD_FILES+=etc/rc.d/mroute6d
# 20160419: rename units.lib -> definitions.units
diff --git a/bin/tests/Makefile b/bin/tests/Makefile
index 609357e..06058a0 100644
--- a/bin/tests/Makefile
+++ b/bin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/cddl/lib/tests/Makefile b/cddl/lib/tests/Makefile
index 609357e..06058a0 100644
--- a/cddl/lib/tests/Makefile
+++ b/cddl/lib/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/cddl/sbin/tests/Makefile b/cddl/sbin/tests/Makefile
index 609357e..06058a0 100644
--- a/cddl/sbin/tests/Makefile
+++ b/cddl/sbin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/cddl/tests/Makefile b/cddl/tests/Makefile
index 609357e..06058a0 100644
--- a/cddl/tests/Makefile
+++ b/cddl/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/cddl/usr.bin/tests/Makefile b/cddl/usr.bin/tests/Makefile
index 609357e..06058a0 100644
--- a/cddl/usr.bin/tests/Makefile
+++ b/cddl/usr.bin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/cddl/usr.sbin/tests/Makefile b/cddl/usr.sbin/tests/Makefile
index 609357e..06058a0 100644
--- a/cddl/usr.sbin/tests/Makefile
+++ b/cddl/usr.sbin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/contrib/subversion/CHANGES b/contrib/subversion/CHANGES
index 05a6870..ddaef67 100644
--- a/contrib/subversion/CHANGES
+++ b/contrib/subversion/CHANGES
@@ -1,3 +1,91 @@
+Version 1.9.4
+(28 Apr 2016, from /branches/1.9.x)
+http://svn.apache.org/repos/asf/subversion/tags/1.9.4
+
+ User-visible changes:
+ - Client-side bugfixes:
+ * diff: support '--summarize --ignore-properties' (part of issue #4567)
+ * checkout: fix performance regression on NFS (r1710167)
+ * gpg-agent: properly handle passwords with percent characters (issue #4611)
+ * svn-graph.pl: fix assertion about a non-canonical path (r1729060 et al)
+ * hot-backup.py: better input validation (r1721174, r1721175)
+ * commit: abort on Ctrl-C in plaintext password prompt (issue #4624)
+ * diff: produce proper forward binary diffs with --git (r1704292, r1704573)
+ * ra_serf: fix deleting directories with many files (issue #4557)
+
+ - Server-side bugfixes:
+ * improve documentation for AuthzSVNGroupsFile and groups-db (r1730856)
+ * fsfs: reduce peak memory usage when listing large directories (r1725180)
+ * fsfs: fix a rare source of incomplete dump files and reports (r1717876)
+
+ - Client-side and server-side bugfixes:
+ * update INSTALL documentation file (r1703470 et al)
+ * fix potential memory access bugs (r1722860 et al)
+ * fix potential out of bounds read in svn_repos_get_logs5() (r1738259)
+
+ - Bindings bugfixes:
+ * ignore absent nodes in javahl version of svn status -u (r1720643)
+
+ Developer-visible changes:
+ - General:
+ * fix ruby test suite to work with test-unit gem (r1714790)
+ * allow building against KDE4 without conflict with KDE5 (r1734926)
+ * fix update_tests.py#76 with SVNPathAuthz short_circuit (r1736432)
+ * build system tweaks:
+ * tweak how symbolic error names in maintainer mode (r1735179)
+ * fix inconsistent behavior of inherited property API (r1717874 et al)
+
+ - API changes:
+ * properly interpret parameters in svn_wc_get_diff_editor6() (r1728308)
+
+
+Version 1.9.3
+(15 Dec 2015, from /branches/1.9.x)
+http://svn.apache.org/repos/asf/subversion/tags/1.9.3
+
+ User-visible changes:
+ - Client-side bugfixes:
+ * svn: fix possible crash in auth credentials cache (r1705328)
+ * cleanup: avoid unneeded memory growth during pristine cleanup (r1706241)
+ * diff: fix crash when repository is on server root (r1705060 et al)
+ * fix translations for commit notifications (r1709389, r1709562)
+ * ra_serf: fix crash in multistatus parser (r1706323, r1706324)
+ * svn: report lock/unlock errors as failures (r1701598 et al)
+ * svn: cleanup user deleted external registrations (r1705843, r1710558)
+ * svn: allow simple resolving of binary file text conflicts (r1703581)
+ * svnlook: properly remove tempfiles on diff errors (r1711346)
+ * ra_serf: report built- and run-time versions of libserf (r1704847)
+ * ra_serf: set Content-Type header in outgoing requests (r1715224 et al)
+ * svn: fix merging deletes of svn:eol-style CRLF/CR files (r1703689 et al)
+ * ra_local: disable zero-copy code path (r1718167)
+
+ - Server-side bugfixes:
+ * mod_dav_svn: fix heap overflow with skel-encoded requests (CVE-2015-5343)
+ * mod_authz_svn: fix authz with mod_auth_kerb/mod_auth_ntlm (issue #4602)
+ * mod_dav_svn: fix display of process ID in cache statistics (r1709553)
+ * mod_dav_svn: use LimitXMLRequestBody for skel-encoded requests (r1687812)
+ * svnadmin dump: preserve no-op changes (r1709388 et al, issue #4598)
+ * fsfs: avoid unneeded I/O when opening transactions (r1715793)
+
+ - Client-side and server-side bugfixes:
+ * fix heap overflow in svn:// protocol parser (CVE-2015-5259)
+
+ - Bindings bugfixes:
+ * javahl: fix ABI incompatibilty with 1.8 (r1710104)
+ * javahl: allow non-absolute paths in SVNClient.vacuum (r1710215, r1710290)
+
+ Developer-visible changes:
+ - General:
+ * fix patch filter invocation in svn_client_patch() (r1706783)
+ * add @since information to config defines (r1706983, r1706999)
+ * fix running the tests in compatibility mode (r1706375)
+ * clarify documentation of svn_fs_node_created_rev() (r1717154)
+
+ - API changes:
+ * fix overflow detection in svn_stringbuf_remove and _replace (r1714358)
+ * don't ignore some of the parameters to svn_ra_svn_create_conn3 (r1714314)
+
+
Version 1.9.2
(30 Sep 2015, from /branches/1.9.x)
http://svn.apache.org/repos/asf/subversion/tags/1.9.2
@@ -118,7 +206,7 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.0
* fsfs: enable dir and prop deltas by default for formats that support
it (r1555286)
* fsfs: avoid out of date errors from files in a directory changing when
- you change a property on the directory (r1558224)
+ you change a property on the directory (issue #2118)
* fsfs: temporary transaction properties are preserved when commit is
interrupted (r1549907 et al)
* fsfs: speed up transaction creation (r1544719)
@@ -794,6 +882,51 @@ http://svn.apache.org/repos/asf/subversion/tags/1.9.0
* javahl: allow compiling with a C++11 compiler (r1684412)
+Version 1.8.16
+(28 Apr 2016, from /branches/1.8.x)
+http://svn.apache.org/repos/asf/subversion/tags/1.8.16
+
+ User-visible changes:
+ - Server-side bugfixes:
+ * mod_authz_svn: fix authz with mod_auth_kerb/mod_auth_ntlm (issue #4602)
+ * dump: don't write broken dump files in some ambiguously encoded fsfs
+ repositories (issue #4554)
+
+ - Client-side and server-side bugfixes:
+ * update INSTALL documentation file (r1703470, r1703475)
+
+ Developer-visible changes:
+ - General:
+ * fix javahl test suite to work on a symlinked RAM disk (r1539230)
+ * fix ruby test suite to work with test-unit gem (r1714790)
+
+
+Version 1.8.15
+(15 Dec 2015, from /branches/1.8.x)
+http://svn.apache.org/repos/asf/subversion/tags/1.8.15
+
+ User-visible changes:
+ - Client-side bugfixes:
+ * gpg-agent: fix crash with non-canonical $HOME (r1691928, issue #4584)
+
+ - Client-side and server-side bugfixes:
+ * fix a segfault with old style text delta (r1618472 et al)
+
+ - Server-side bugfixes:
+ * mod_dav_svn: fix heap overflow with skel-encoded requests (CVE-2015-5343)
+ * fsfs: reduce memory allocation with Apache (r1591005 et al)
+ * mod_dav_svn: emit first log items as soon as possible (r1666965 et al)
+ * mod_dav_svn: use LimitXMLRequestBody for skel-encoded requests (r1687812)
+
+ - Bindings bugfixes:
+ * swig: fix memory corruption in svn_client_copy_source_t (r1694929)
+
+ Developer-visible changes:
+ - General:
+ * better configure-time detection of httpd authz fix (r1687304 et al)
+ * fix compilation with apr 1.2.x (r1701237)
+
+
Version 1.8.14
(5 Aug 2015, from /branches/1.8.x)
http://svn.apache.org/repos/asf/subversion/tags/1.8.14
diff --git a/contrib/subversion/INSTALL b/contrib/subversion/INSTALL
index 7688b70..3ff1670 100644
--- a/contrib/subversion/INSTALL
+++ b/contrib/subversion/INSTALL
@@ -3,7 +3,7 @@
A Quick Guide
======================================
-$LastChangedDate: 2015-07-26 23:03:10 +0000 (Sun, 26 Jul 2015) $
+$LastChangedDate: 2015-12-12 04:00:43 +0000 (Sat, 12 Dec 2015) $
Contents:
@@ -199,48 +199,6 @@ I. INTRODUCTION
Apache Portable Runtime (APR) and the APR Utility (APR-util)
libraries.
-
- ****************************************************************
- ** IMPORTANT ISSUE ABOUT APR VERSIONS: READ THIS **
- ** IF UPGRADING FROM MUCH OLDER SUBVERSION **
- ****************************************************************
- | |
- | APR 0.9.X and 1.X are binary-incompatible. |
- | |
- | This means: |
- | |
- | - if you are already using Subversion with APR 0.9.X, and |
- | then upgrade your libapr to 1.X without rebuilding |
- | Subversion, things will break and segfault. |
- | |
- | - if your Subversion server libraries are linked to one |
- | version of APR, but your Apache server is linked to a |
- | different version, things will break and segfault. |
- | |
- | Subversion distribution dependencies: |
- | ------------------------------------- |
- | |
- | For a long time, Subversion's main distribution contained |
- | APR and APR-UTIL (both 0.9.x), plus a few other things that |
- | we couldn't count on the installation system having. But |
- | nowadays, Subversion's requirements are no longer exotic, |
- | and so our main distribution contains just the Subversion |
- | source code itself -- people compiling Subversion are |
- | expected to either have the APR libraries already installed |
- | on their system, or to be capable of fetching them easily. |
- | |
- | Note that it's *perfectly* safe to use APR 1.X from the |
- | beginning. In fact, we recommend it. If you're building |
- | Subversion for the first time, there's no compatibility |
- | issue to worry about, so grab the latest version of APR. |
- | |
- | If you already have a Subversion installation using APR |
- | 0.9.x, it's still possible to move to APR 1.X safely. Just |
- | be sure to recompile Subversion (and Apache httpd if |
- | necessary) after upgrading APR! |
- |______________________________________________________________|
-
-
If you do not have a pre-installed APR and APR-util, you will need
to get these yourself:
@@ -960,14 +918,6 @@ II. INSTALLATION
This step is only required for building the server dso modules.
- The Subversion gen-make.py script must be run before building Apache or
- Apache and Subversion will be running incompatible versions of apr.
-
- C:>cd src-%DIR%
- C:>python gen-make.py -t dsp --with-httpd=..\httpd-2.0.58
- --with-berkeley-db=db4-win32 --with-openssl=..\openssl-0.9.7f
- --with-zlib=..\zlib --with-libintl=..\svn-win32-libintl
- C:>cd ..
C:>set APACHEDIR=C:\Program Files\Apache Group\Apache2
C:>msdev httpd-2.0.58\apache.dsw /MAKE "BuildBin - Win32 Release"
@@ -1042,7 +992,6 @@ II. INSTALLATION
The Apache/APR projects required by Subversion are:
apr-util\libaprutil.dsp, apr\libapr.dsp,
apr-iconv\libapriconv.dsp, apr-util\xml\expat\lib\xml.dsp,
- apr-util\uri\gen_uri_delims.dsp (for APR 0.9.x),
apr-iconv\ccs\libapriconv_ccs_modules.dsp, and
apr-iconv\ces\libapriconv_ces_modules.dsp.
* If the server dso modules are being built and tested Apache must not
@@ -1168,33 +1117,13 @@ III. BUILDING A SUBVERSION SERVER
1. Obtaining and Installing Apache 2
Subversion tries to compile against the latest released version
- of Apache httpd 2.X. The easiest thing for you to do is download
+ of Apache httpd 2.2+. The easiest thing for you to do is download
a source tarball of the latest release and unpack that.
-
- ****************************************************************
- ** IMPORTANT ISSUE ABOUT APACHE VERSIONS: READ THIS. **
- ** **
- ****************************************************************
- | |
- | First, be sure to read the APR version warning box, back in |
- | section I.C.1, which explains that APR 0.9.x and 1.X are |
- | binary-incompatible. |
- | |
- | Apache HTTPD 2.0 uses APR 0.9.x. |
- | Apache HTTPD 2.2 uses APR 1.2.x. |
- | |
- | We recommend using the latest Apache. However, whatever |
- | version you choose, you *must* ensure that Subversion |
- | and Apache are using the same version of APR. If you don't, |
- | things will segfault and break. |
- |______________________________________________________________|
-
-
- If you have questions about the Apache httpd 2.0 build, please consult
+ If you have questions about the Apache httpd 2.2 build, please consult
the httpd install documentation:
- http://httpd.apache.org/docs-2.0/install.html
+ http://httpd.apache.org/docs-2.2/install.html
At the top of the httpd tree:
@@ -1240,7 +1169,7 @@ III. BUILDING A SUBVERSION SERVER
---------------------------------------------------------
Go back into your subversion working copy and run ./autogen.sh if
- you need to. Then, assuming Apache httpd 2.0 is installed in the
+ you need to. Then, assuming Apache httpd 2.2 is installed in the
standard location, run:
$ ./configure
@@ -1250,7 +1179,7 @@ III. BUILDING A SUBVERSION SERVER
look for other libsvn_*.so libraries on your system.
If you see a warning message that the build of mod_dav_svn is
- being skipped, this may be because you have Apache httpd 2.X
+ being skipped, this may be because you have Apache httpd 2.x
installed in a non-standard location. You can use the
"--with-apxs=" option to locate the apxs script:
@@ -1292,7 +1221,7 @@ III. BUILDING A SUBVERSION SERVER
/usr/local/apache2/conf/httpd.conf to reflect your setup.
At a minimum you should look at the User, Group and ServerName
directives. Full details on setting up apache can be found at:
- http://httpd.apache.org/docs-2.0/
+ http://httpd.apache.org/docs-2.2/
First, your httpd.conf needs to load the mod_dav_svn module.
If you pass --enable-mod-activation to Subversion's configure,
@@ -1346,6 +1275,7 @@ III. BUILDING A SUBVERSION SERVER
Require group svn_readers
</Limit>
+ ### FIXME Tutorials section refers to old 2.0 docs
These are only a few simple examples. For a complete tutorial
on Apache access control, please consider taking a look at the
tutorials found under "Security" on the following page:
@@ -1372,7 +1302,7 @@ III. BUILDING A SUBVERSION SERVER
NOTE: If you are unfamiliar with an Apache directive, or not exactly
sure about what it does, don't hesitate to look it up in the
- documentation: http://httpd.apache.org/docs-2.0/mod/directives.html.
+ documentation: http://httpd.apache.org/docs-2.2/mod/directives.html.
NOTE: Make sure that the user 'nobody' (or whatever UID the
httpd process runs as) has permission to read and write the
diff --git a/contrib/subversion/Makefile.in b/contrib/subversion/Makefile.in
index da622bd..e63a09c 100644
--- a/contrib/subversion/Makefile.in
+++ b/contrib/subversion/Makefile.in
@@ -917,13 +917,15 @@ swig-rb: autogen-swig-rb
check-swig-rb: swig-rb svnserve
$(TEST_SHLIB_VAR_SWIG_RB) \
cd $(SWIG_RB_DIR); \
- if [ "$(RUBY_MAJOR)" -eq 1 -a "$(RUBY_MINOR)" -lt 9 ] ; then \
- $(RUBY) -I $(SWIG_RB_SRC_DIR) \
- $(SWIG_RB_SRC_DIR)/test/run-test.rb \
- --verbose=$(SWIG_RB_TEST_VERBOSE); \
- else \
- $(RUBY) -I $(SWIG_RB_SRC_DIR) \
- $(SWIG_RB_SRC_DIR)/test/run-test.rb; \
+ check_rb() { \
+ $(RUBY) -I $(SWIG_RB_SRC_DIR) $(SWIG_RB_SRC_DIR)/test/run-test.rb "$$@"; \
+ }; \
+ if check_rb --help 2>&1 | grep -q -- --collector; then \
+ check_rb --collector=dir --verbose=$(SWIG_RB_TEST_VERBOSE); \
+ elif [ "$(RUBY_MAJOR)" -eq 1 -a "$(RUBY_MINOR)" -lt 9 ] ; then \
+ check_rb --verbose=$(SWIG_RB_TEST_VERBOSE); \
+ else \
+ check_rb; \
fi
EXTRACLEAN_SWIG_RB=rm -f $(SWIG_RB_SRC_DIR)/svn_*.c $(SWIG_RB_SRC_DIR)/core.c
diff --git a/contrib/subversion/NOTICE b/contrib/subversion/NOTICE
index fa36287..0c4fe7d 100644
--- a/contrib/subversion/NOTICE
+++ b/contrib/subversion/NOTICE
@@ -1,5 +1,5 @@
Apache Subversion
-Copyright 2015 The Apache Software Foundation
+Copyright 2016 The Apache Software Foundation
This product includes software developed by many people, and distributed
under Contributor License Agreements to The Apache Software Foundation
diff --git a/contrib/subversion/build-outputs.mk b/contrib/subversion/build-outputs.mk
index 2f51a56..68acf27 100644
--- a/contrib/subversion/build-outputs.mk
+++ b/contrib/subversion/build-outputs.mk
@@ -521,8 +521,8 @@ subversion/bindings/cxxhl/libsvncxxhl-1.la: $(libsvncxxhl_DEPS)
cd subversion/bindings/cxxhl && $(LINK_CXX_LIB) $(libsvncxxhl_LDFLAGS) -o libsvncxxhl-1.la $(LT_NO_UNDEFINED) $(libsvncxxhl_OBJECTS) ../../../subversion/libsvn_repos/libsvn_repos-1.la ../../../subversion/libsvn_client/libsvn_client-1.la ../../../subversion/libsvn_wc/libsvn_wc-1.la ../../../subversion/libsvn_ra/libsvn_ra-1.la ../../../subversion/libsvn_delta/libsvn_delta-1.la ../../../subversion/libsvn_diff/libsvn_diff-1.la ../../../subversion/libsvn_subr/libsvn_subr-1.la ../../../subversion/libsvn_fs/libsvn_fs-1.la $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS) $(LIBS)
libsvnjavahl_PATH = subversion/bindings/javahl/native
-libsvnjavahl_DEPS = $(javahl_java_DEPS) $(javahl_callback_javah_DEPS) $(javahl_remote_javah_DEPS) $(javahl_types_javah_DEPS) $(javahl_util_javah_DEPS) $(javahl_javah_DEPS) subversion/bindings/javahl/native/Array.lo subversion/bindings/javahl/native/AuthnCallback.lo subversion/bindings/javahl/native/BlameCallback.lo subversion/bindings/javahl/native/ChangelistCallback.lo subversion/bindings/javahl/native/ClientContext.lo subversion/bindings/javahl/native/CommitCallback.lo subversion/bindings/javahl/native/CommitEditor.lo subversion/bindings/javahl/native/CommitMessage.lo subversion/bindings/javahl/native/CopySources.lo subversion/bindings/javahl/native/CreateJ.lo subversion/bindings/javahl/native/Credential.lo subversion/bindings/javahl/native/DiffOptions.lo subversion/bindings/javahl/native/DiffSummaryReceiver.lo subversion/bindings/javahl/native/EditorCallbacks.lo subversion/bindings/javahl/native/EditorProxy.lo subversion/bindings/javahl/native/EnumMapper.lo subversion/bindings/javahl/native/ExternalItem.lo subversion/bindings/javahl/native/File.lo subversion/bindings/javahl/native/ImportFilterCallback.lo subversion/bindings/javahl/native/InfoCallback.lo subversion/bindings/javahl/native/InputStream.lo subversion/bindings/javahl/native/Iterator.lo subversion/bindings/javahl/native/JNIByteArray.lo subversion/bindings/javahl/native/JNICriticalSection.lo subversion/bindings/javahl/native/JNIMutex.lo subversion/bindings/javahl/native/JNIStackElement.lo subversion/bindings/javahl/native/JNIStringHolder.lo subversion/bindings/javahl/native/JNIUtil.lo subversion/bindings/javahl/native/ListCallback.lo subversion/bindings/javahl/native/LockTokenTable.lo subversion/bindings/javahl/native/LogMessageCallback.lo subversion/bindings/javahl/native/MessageReceiver.lo subversion/bindings/javahl/native/NativeStream.lo subversion/bindings/javahl/native/OperationContext.lo subversion/bindings/javahl/native/OutputStream.lo subversion/bindings/javahl/native/PatchCallback.lo subversion/bindings/javahl/native/Path.lo subversion/bindings/javahl/native/Pool.lo subversion/bindings/javahl/native/Prompter.lo subversion/bindings/javahl/native/PropertyTable.lo subversion/bindings/javahl/native/ProplistCallback.lo subversion/bindings/javahl/native/RemoteSession.lo subversion/bindings/javahl/native/RemoteSessionContext.lo subversion/bindings/javahl/native/ReposFreezeAction.lo subversion/bindings/javahl/native/ReposNotifyCallback.lo subversion/bindings/javahl/native/ReposVerifyCallback.lo subversion/bindings/javahl/native/Revision.lo subversion/bindings/javahl/native/RevisionRange.lo subversion/bindings/javahl/native/RevisionRangeList.lo subversion/bindings/javahl/native/SVNBase.lo subversion/bindings/javahl/native/SVNClient.lo subversion/bindings/javahl/native/SVNRepos.lo subversion/bindings/javahl/native/StateReporter.lo subversion/bindings/javahl/native/StatusCallback.lo subversion/bindings/javahl/native/StringArray.lo subversion/bindings/javahl/native/SubversionException.lo subversion/bindings/javahl/native/Targets.lo subversion/bindings/javahl/native/Utility.lo subversion/bindings/javahl/native/VersionExtended.lo subversion/bindings/javahl/native/deprecated.lo subversion/bindings/javahl/native/jniwrapper/jni_base.lo subversion/bindings/javahl/native/jniwrapper/jni_channel.lo subversion/bindings/javahl/native/jniwrapper/jni_class_cache.lo subversion/bindings/javahl/native/jniwrapper/jni_io_stream.lo subversion/bindings/javahl/native/jniwrapper/jni_iterator.lo subversion/bindings/javahl/native/jniwrapper/jni_list.lo subversion/bindings/javahl/native/jniwrapper/jni_string_map.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_RevisionRangeList.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_RuntimeVersion.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_Version.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_TunnelChannel.lo subversion/libsvn_repos/libsvn_repos-1.la subversion/libsvn_client/libsvn_client-1.la subversion/libsvn_wc/libsvn_wc-1.la subversion/libsvn_ra/libsvn_ra-1.la subversion/libsvn_delta/libsvn_delta-1.la subversion/libsvn_diff/libsvn_diff-1.la subversion/libsvn_subr/libsvn_subr-1.la subversion/libsvn_fs/libsvn_fs-1.la
-libsvnjavahl_OBJECTS = Array.lo AuthnCallback.lo BlameCallback.lo ChangelistCallback.lo ClientContext.lo CommitCallback.lo CommitEditor.lo CommitMessage.lo CopySources.lo CreateJ.lo Credential.lo DiffOptions.lo DiffSummaryReceiver.lo EditorCallbacks.lo EditorProxy.lo EnumMapper.lo ExternalItem.lo File.lo ImportFilterCallback.lo InfoCallback.lo InputStream.lo Iterator.lo JNIByteArray.lo JNICriticalSection.lo JNIMutex.lo JNIStackElement.lo JNIStringHolder.lo JNIUtil.lo ListCallback.lo LockTokenTable.lo LogMessageCallback.lo MessageReceiver.lo NativeStream.lo OperationContext.lo OutputStream.lo PatchCallback.lo Path.lo Pool.lo Prompter.lo PropertyTable.lo ProplistCallback.lo RemoteSession.lo RemoteSessionContext.lo ReposFreezeAction.lo ReposNotifyCallback.lo ReposVerifyCallback.lo Revision.lo RevisionRange.lo RevisionRangeList.lo SVNBase.lo SVNClient.lo SVNRepos.lo StateReporter.lo StatusCallback.lo StringArray.lo SubversionException.lo Targets.lo Utility.lo VersionExtended.lo deprecated.lo jniwrapper/jni_base.lo jniwrapper/jni_channel.lo jniwrapper/jni_class_cache.lo jniwrapper/jni_io_stream.lo jniwrapper/jni_iterator.lo jniwrapper/jni_list.lo jniwrapper/jni_string_map.lo org_apache_subversion_javahl_SVNClient.lo org_apache_subversion_javahl_SVNRepos.lo org_apache_subversion_javahl_remote_CommitEditor.lo org_apache_subversion_javahl_remote_RemoteFactory.lo org_apache_subversion_javahl_remote_RemoteSession.lo org_apache_subversion_javahl_remote_StateReporter.lo org_apache_subversion_javahl_types_RevisionRangeList.lo org_apache_subversion_javahl_types_RuntimeVersion.lo org_apache_subversion_javahl_types_Version.lo org_apache_subversion_javahl_types_VersionExtended.lo org_apache_subversion_javahl_util_ConfigImpl_Category.lo org_apache_subversion_javahl_util_ConfigLib.lo org_apache_subversion_javahl_util_DiffLib.lo org_apache_subversion_javahl_util_PropLib.lo org_apache_subversion_javahl_util_SubstLib.lo org_apache_subversion_javahl_util_TunnelChannel.lo
+libsvnjavahl_DEPS = $(javahl_java_DEPS) $(javahl_callback_javah_DEPS) $(javahl_remote_javah_DEPS) $(javahl_types_javah_DEPS) $(javahl_util_javah_DEPS) $(javahl_javah_DEPS) subversion/bindings/javahl/native/Array.lo subversion/bindings/javahl/native/AuthnCallback.lo subversion/bindings/javahl/native/BlameCallback.lo subversion/bindings/javahl/native/ChangelistCallback.lo subversion/bindings/javahl/native/ClientContext.lo subversion/bindings/javahl/native/CommitCallback.lo subversion/bindings/javahl/native/CommitEditor.lo subversion/bindings/javahl/native/CommitMessage.lo subversion/bindings/javahl/native/CopySources.lo subversion/bindings/javahl/native/CreateJ.lo subversion/bindings/javahl/native/Credential.lo subversion/bindings/javahl/native/DiffOptions.lo subversion/bindings/javahl/native/DiffSummaryReceiver.lo subversion/bindings/javahl/native/EditorCallbacks.lo subversion/bindings/javahl/native/EditorProxy.lo subversion/bindings/javahl/native/EnumMapper.lo subversion/bindings/javahl/native/ExternalItem.lo subversion/bindings/javahl/native/File.lo subversion/bindings/javahl/native/ImportFilterCallback.lo subversion/bindings/javahl/native/InfoCallback.lo subversion/bindings/javahl/native/InputStream.lo subversion/bindings/javahl/native/Iterator.lo subversion/bindings/javahl/native/JNIByteArray.lo subversion/bindings/javahl/native/JNICriticalSection.lo subversion/bindings/javahl/native/JNIMutex.lo subversion/bindings/javahl/native/JNIStackElement.lo subversion/bindings/javahl/native/JNIStringHolder.lo subversion/bindings/javahl/native/JNIUtil.lo subversion/bindings/javahl/native/ListCallback.lo subversion/bindings/javahl/native/LockTokenTable.lo subversion/bindings/javahl/native/LogMessageCallback.lo subversion/bindings/javahl/native/MessageReceiver.lo subversion/bindings/javahl/native/NativeStream.lo subversion/bindings/javahl/native/OperationContext.lo subversion/bindings/javahl/native/OutputStream.lo subversion/bindings/javahl/native/PatchCallback.lo subversion/bindings/javahl/native/Path.lo subversion/bindings/javahl/native/Pool.lo subversion/bindings/javahl/native/Prompter.lo subversion/bindings/javahl/native/PropertyTable.lo subversion/bindings/javahl/native/ProplistCallback.lo subversion/bindings/javahl/native/RemoteSession.lo subversion/bindings/javahl/native/RemoteSessionContext.lo subversion/bindings/javahl/native/ReposFreezeAction.lo subversion/bindings/javahl/native/ReposNotifyCallback.lo subversion/bindings/javahl/native/ReposVerifyCallback.lo subversion/bindings/javahl/native/Revision.lo subversion/bindings/javahl/native/RevisionRange.lo subversion/bindings/javahl/native/RevisionRangeList.lo subversion/bindings/javahl/native/SVNBase.lo subversion/bindings/javahl/native/SVNClient.lo subversion/bindings/javahl/native/SVNRepos.lo subversion/bindings/javahl/native/StateReporter.lo subversion/bindings/javahl/native/StatusCallback.lo subversion/bindings/javahl/native/StringArray.lo subversion/bindings/javahl/native/SubversionException.lo subversion/bindings/javahl/native/Targets.lo subversion/bindings/javahl/native/Utility.lo subversion/bindings/javahl/native/VersionExtended.lo subversion/bindings/javahl/native/deprecated.lo subversion/bindings/javahl/native/jniwrapper/jni_base.lo subversion/bindings/javahl/native/jniwrapper/jni_channel.lo subversion/bindings/javahl/native/jniwrapper/jni_class_cache.lo subversion/bindings/javahl/native/jniwrapper/jni_io_stream.lo subversion/bindings/javahl/native/jniwrapper/jni_iterator.lo subversion/bindings/javahl/native/jniwrapper/jni_list.lo subversion/bindings/javahl/native/jniwrapper/jni_string_map.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_RevisionRangeList.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_RuntimeVersion.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_Version.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_types_VersionExtended.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_PropLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_SubstLib.lo subversion/bindings/javahl/native/org_apache_subversion_javahl_util_TunnelChannel.lo subversion/libsvn_repos/libsvn_repos-1.la subversion/libsvn_client/libsvn_client-1.la subversion/libsvn_wc/libsvn_wc-1.la subversion/libsvn_ra/libsvn_ra-1.la subversion/libsvn_delta/libsvn_delta-1.la subversion/libsvn_diff/libsvn_diff-1.la subversion/libsvn_subr/libsvn_subr-1.la subversion/libsvn_fs/libsvn_fs-1.la
+libsvnjavahl_OBJECTS = Array.lo AuthnCallback.lo BlameCallback.lo ChangelistCallback.lo ClientContext.lo CommitCallback.lo CommitEditor.lo CommitMessage.lo CopySources.lo CreateJ.lo Credential.lo DiffOptions.lo DiffSummaryReceiver.lo EditorCallbacks.lo EditorProxy.lo EnumMapper.lo ExternalItem.lo File.lo ImportFilterCallback.lo InfoCallback.lo InputStream.lo Iterator.lo JNIByteArray.lo JNICriticalSection.lo JNIMutex.lo JNIStackElement.lo JNIStringHolder.lo JNIUtil.lo ListCallback.lo LockTokenTable.lo LogMessageCallback.lo MessageReceiver.lo NativeStream.lo OperationContext.lo OutputStream.lo PatchCallback.lo Path.lo Pool.lo Prompter.lo PropertyTable.lo ProplistCallback.lo RemoteSession.lo RemoteSessionContext.lo ReposFreezeAction.lo ReposNotifyCallback.lo ReposVerifyCallback.lo Revision.lo RevisionRange.lo RevisionRangeList.lo SVNBase.lo SVNClient.lo SVNRepos.lo StateReporter.lo StatusCallback.lo StringArray.lo SubversionException.lo Targets.lo Utility.lo VersionExtended.lo deprecated.lo jniwrapper/jni_base.lo jniwrapper/jni_channel.lo jniwrapper/jni_class_cache.lo jniwrapper/jni_io_stream.lo jniwrapper/jni_iterator.lo jniwrapper/jni_list.lo jniwrapper/jni_string_map.lo org_apache_subversion_javahl_NativeResources.lo org_apache_subversion_javahl_SVNClient.lo org_apache_subversion_javahl_SVNRepos.lo org_apache_subversion_javahl_remote_CommitEditor.lo org_apache_subversion_javahl_remote_RemoteFactory.lo org_apache_subversion_javahl_remote_RemoteSession.lo org_apache_subversion_javahl_remote_StateReporter.lo org_apache_subversion_javahl_types_RevisionRangeList.lo org_apache_subversion_javahl_types_RuntimeVersion.lo org_apache_subversion_javahl_types_Version.lo org_apache_subversion_javahl_types_VersionExtended.lo org_apache_subversion_javahl_util_ConfigImpl_Category.lo org_apache_subversion_javahl_util_ConfigLib.lo org_apache_subversion_javahl_util_DiffLib.lo org_apache_subversion_javahl_util_PropLib.lo org_apache_subversion_javahl_util_SubstLib.lo org_apache_subversion_javahl_util_TunnelChannel.lo
subversion/bindings/javahl/native/libsvnjavahl-1.la: $(libsvnjavahl_DEPS)
cd subversion/bindings/javahl/native && $(LINK_JAVAHL_CXX) $(libsvnjavahl_LDFLAGS) -o libsvnjavahl-1.la $(LT_NO_UNDEFINED) $(libsvnjavahl_OBJECTS) ../../../../subversion/libsvn_repos/libsvn_repos-1.la ../../../../subversion/libsvn_client/libsvn_client-1.la ../../../../subversion/libsvn_wc/libsvn_wc-1.la ../../../../subversion/libsvn_ra/libsvn_ra-1.la ../../../../subversion/libsvn_delta/libsvn_delta-1.la ../../../../subversion/libsvn_diff/libsvn_diff-1.la ../../../../subversion/libsvn_subr/libsvn_subr-1.la ../../../../subversion/libsvn_fs/libsvn_fs-1.la $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS) $(SVN_JAVA_SDK_LIBS) $(LIBS)
@@ -2268,6 +2268,9 @@ subversion/bindings/javahl/native/jniwrapper/jni_list.lo: subversion/bindings/ja
subversion/bindings/javahl/native/jniwrapper/jni_string_map.lo: subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp subversion/bindings/javahl/native/jniwrapper/jni_env.hpp subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp subversion/bindings/javahl/native/jniwrapper/jni_iterator.hpp subversion/bindings/javahl/native/jniwrapper/jni_object.hpp subversion/bindings/javahl/native/jniwrapper/jni_string.hpp subversion/bindings/javahl/native/jniwrapper/jni_string_map.hpp subversion/svn_private_config.h
$(COMPILE_JAVAHL_CXX) $(canonicalized_srcdir)subversion/bindings/javahl/native/jniwrapper/jni_string_map.cpp
+subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.lo: subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp subversion/bindings/javahl/include/org_apache_subversion_javahl_NativeResources.h
+ $(COMPILE_JAVAHL_CXX) $(canonicalized_srcdir)subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp
+
subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.lo: subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp subversion/bindings/javahl/include/org_apache_subversion_javahl_SVNClient.h subversion/bindings/javahl/native/Array.h subversion/bindings/javahl/native/BlameCallback.h subversion/bindings/javahl/native/ChangelistCallback.h subversion/bindings/javahl/native/ClientContext.h subversion/bindings/javahl/native/CommitCallback.h subversion/bindings/javahl/native/CommitMessage.h subversion/bindings/javahl/native/CopySources.h subversion/bindings/javahl/native/CreateJ.h subversion/bindings/javahl/native/DiffOptions.h subversion/bindings/javahl/native/DiffSummaryReceiver.h subversion/bindings/javahl/native/EnumMapper.h subversion/bindings/javahl/native/ImportFilterCallback.h subversion/bindings/javahl/native/InfoCallback.h subversion/bindings/javahl/native/JNIByteArray.h subversion/bindings/javahl/native/JNIStackElement.h subversion/bindings/javahl/native/JNIStringHolder.h subversion/bindings/javahl/native/JNIUtil.h subversion/bindings/javahl/native/ListCallback.h subversion/bindings/javahl/native/LogMessageCallback.h subversion/bindings/javahl/native/OperationContext.h subversion/bindings/javahl/native/OutputStream.h subversion/bindings/javahl/native/PatchCallback.h subversion/bindings/javahl/native/Path.h subversion/bindings/javahl/native/Pool.h subversion/bindings/javahl/native/Prompter.h subversion/bindings/javahl/native/PropertyTable.h subversion/bindings/javahl/native/ProplistCallback.h subversion/bindings/javahl/native/Revision.h subversion/bindings/javahl/native/RevisionRange.h subversion/bindings/javahl/native/SVNBase.h subversion/bindings/javahl/native/SVNClient.h subversion/bindings/javahl/native/StatusCallback.h subversion/bindings/javahl/native/StringArray.h subversion/bindings/javahl/native/Targets.h subversion/bindings/javahl/native/VersionExtended.h subversion/bindings/javahl/native/jniwrapper/jni_env.hpp subversion/bindings/javahl/native/jniwrapper/jni_globalref.hpp subversion/bindings/javahl/native/version.h subversion/include/private/svn_atomic.h subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_client.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_opt.h subversion/include/svn_pools.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/include/svn_wc.h subversion/svn_private_config.h
$(COMPILE_JAVAHL_CXX) $(canonicalized_srcdir)subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
@@ -3139,7 +3142,7 @@ subversion/mod_dav_svn/reports/update.lo: subversion/mod_dav_svn/reports/update.
subversion/mod_dav_svn/repos.lo: subversion/mod_dav_svn/repos.c subversion/include/mod_authz_svn.h subversion/include/mod_dav_svn.h subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fspath.h subversion/include/private/svn_log.h subversion/include/private/svn_repos_private.h subversion/include/private/svn_skel.h subversion/include/private/svn_sorts_private.h subversion/include/private/svn_string_private.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_ctype.h subversion/include/svn_dav.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_ra.h subversion/include/svn_repos.h subversion/include/svn_sorts.h subversion/include/svn_string.h subversion/include/svn_subst.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/include/svn_xml.h subversion/mod_dav_svn/dav_svn.h
if $(INSTALL_APACHE_MODS) ; then $(COMPILE_APACHE_MOD) $(canonicalized_srcdir)subversion/mod_dav_svn/repos.c ; else echo "fake" > subversion/mod_dav_svn/repos.lo ; fi
-subversion/mod_dav_svn/status.lo: subversion/mod_dav_svn/status.c subversion/include/mod_authz_svn.h subversion/include/private/svn_cache.h subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_skel.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_iter.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_xml.h subversion/mod_dav_svn/dav_svn.h
+subversion/mod_dav_svn/status.lo: subversion/mod_dav_svn/status.c subversion/include/mod_authz_svn.h subversion/include/private/svn_cache.h subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_skel.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_iter.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_xml.h subversion/mod_dav_svn/dav_svn.h subversion/svn_private_config.h
if $(INSTALL_APACHE_MODS) ; then $(COMPILE_APACHE_MOD) $(canonicalized_srcdir)subversion/mod_dav_svn/status.c ; else echo "fake" > subversion/mod_dav_svn/status.lo ; fi
subversion/mod_dav_svn/util.lo: subversion/mod_dav_svn/util.c subversion/include/mod_authz_svn.h subversion/include/private/svn_dav_protocol.h subversion/include/private/svn_debug.h subversion/include/private/svn_fspath.h subversion/include/private/svn_skel.h subversion/include/svn_base64.h subversion/include/svn_checksum.h subversion/include/svn_dav.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_xml.h subversion/mod_dav_svn/dav_svn.h
diff --git a/contrib/subversion/configure b/contrib/subversion/configure
index 5d24eb9..19fee6e 100755
--- a/contrib/subversion/configure
+++ b/contrib/subversion/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for subversion 1.9.2.
+# Generated by GNU Autoconf 2.69 for subversion 1.9.4.
#
# Report bugs to <http://subversion.apache.org/>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='subversion'
PACKAGE_TARNAME='subversion'
-PACKAGE_VERSION='1.9.2'
-PACKAGE_STRING='subversion 1.9.2'
+PACKAGE_VERSION='1.9.4'
+PACKAGE_STRING='subversion 1.9.4'
PACKAGE_BUGREPORT='http://subversion.apache.org/'
PACKAGE_URL=''
@@ -1471,7 +1471,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 subversion 1.9.2 to adapt to many kinds of systems.
+\`configure' configures subversion 1.9.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1537,7 +1537,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of subversion 1.9.2:";;
+ short | recursive ) echo "Configuration of subversion 1.9.4:";;
esac
cat <<\_ACEOF
@@ -1751,7 +1751,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-subversion configure 1.9.2
+subversion configure 1.9.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2295,7 +2295,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 subversion $as_me 1.9.2, which was
+It was created by subversion $as_me 1.9.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2675,8 +2675,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.2" >&5
-$as_echo "$as_me: Configuring Subversion 1.9.2" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.4" >&5
+$as_echo "$as_me: Configuring Subversion 1.9.4" >&6;}
abs_srcdir="`cd $srcdir && pwd`"
@@ -20314,16 +20314,16 @@ $as_echo_n "checking for KWallet... " >&6; }
fi
done
qt_include_dirs="`$PKG_CONFIG --cflags-only-I QtCore QtDBus QtGui`"
- kde_dir="`$KDE4_CONFIG --prefix`"
- SVN_KWALLET_INCLUDES="$DBUS_CPPFLAGS $qt_include_dirs -I$kde_dir/include"
+ kde_incdir="`$KDE4_CONFIG --install include`"
+ SVN_KWALLET_INCLUDES="$DBUS_CPPFLAGS $qt_include_dirs -I$kde_incdir"
qt_libs_other_options="`$PKG_CONFIG --libs-only-other QtCore QtDBus QtGui`"
SVN_KWALLET_LIBS="$DBUS_LIBS -lQtCore -lQtDBus -lQtGui -lkdecore -lkdeui $qt_libs_other_options"
CXXFLAGS="$CXXFLAGS $SVN_KWALLET_INCLUDES"
LIBS="$LIBS $SVN_KWALLET_LIBS"
qt_lib_dirs="`$PKG_CONFIG --libs-only-L QtCore QtDBus QtGui`"
- kde_lib_suffix="`$KDE4_CONFIG --libsuffix`"
+ kde_libdir="`$KDE4_CONFIG --install lib`"
LDFLAGS="$old_LDFLAGS `
- input_flags="$qt_lib_dirs -L$kde_dir/lib$kde_lib_suffix"
+ input_flags="$qt_lib_dirs -L$kde_libdir"
output_flags=""
filtered_dirs="/lib /lib64 /usr/lib /usr/lib64"
for flag in $input_flags; do
@@ -26750,7 +26750,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 subversion $as_me 1.9.2, which was
+This file was extended by subversion $as_me 1.9.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -26816,7 +26816,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="\\
-subversion config.status 1.9.2
+subversion config.status 1.9.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/contrib/subversion/subversion/include/svn_client.h b/contrib/subversion/subversion/include/svn_client.h
index 6719e3e..cb0f49d 100644
--- a/contrib/subversion/subversion/include/svn_client.h
+++ b/contrib/subversion/subversion/include/svn_client.h
@@ -4098,16 +4098,16 @@ svn_client_mergeinfo_log_eligible(const char *path_or_url,
* @{
*/
-/** Recursively vacuum a working copy directory @a dir, removing unnecessary
- * data.
+/** Recursively vacuum a working copy directory @a dir_abspath,
+ * removing unnecessary data.
*
* If @a include_externals is @c TRUE, recurse into externals and vacuum them
* as well.
*
* If @a remove_unversioned_items is @c TRUE, remove unversioned items
- * in @a dir after successful working copy cleanup.
+ * in @a dir_abspath after successful working copy cleanup.
* If @a remove_ignored_items is @c TRUE, remove ignored unversioned items
- * in @a dir after successful working copy cleanup.
+ * in @a dir_abspath after successful working copy cleanup.
*
* If @a fix_recorded_timestamps is @c TRUE, this function fixes recorded
* timestamps for unmodified files in the working copy, reducing comparision
diff --git a/contrib/subversion/subversion/include/svn_config.h b/contrib/subversion/subversion/include/svn_config.h
index b4dc848..5ad3b0b 100644
--- a/contrib/subversion/subversion/include/svn_config.h
+++ b/contrib/subversion/subversion/include/svn_config.h
@@ -76,18 +76,27 @@ typedef struct svn_config_t svn_config_t;
#define SVN_CONFIG_OPTION_HTTP_PROXY_EXCEPTIONS "http-proxy-exceptions"
#define SVN_CONFIG_OPTION_HTTP_TIMEOUT "http-timeout"
#define SVN_CONFIG_OPTION_HTTP_COMPRESSION "http-compression"
+/** @deprecated Not used since 1.8. */
#define SVN_CONFIG_OPTION_NEON_DEBUG_MASK "neon-debug-mask"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_HTTP_AUTH_TYPES "http-auth-types"
#define SVN_CONFIG_OPTION_SSL_AUTHORITY_FILES "ssl-authority-files"
#define SVN_CONFIG_OPTION_SSL_TRUST_DEFAULT_CA "ssl-trust-default-ca"
#define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_FILE "ssl-client-cert-file"
#define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_PASSWORD "ssl-client-cert-password"
+/** @deprecated Not used since 1.8.
+ * @since New in 1.5. */
#define SVN_CONFIG_OPTION_SSL_PKCS11_PROVIDER "ssl-pkcs11-provider"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_HTTP_LIBRARY "http-library"
+/** @since New in 1.1. */
#define SVN_CONFIG_OPTION_STORE_PASSWORDS "store-passwords"
+/** @since New in 1.6. */
#define SVN_CONFIG_OPTION_STORE_PLAINTEXT_PASSWORDS "store-plaintext-passwords"
#define SVN_CONFIG_OPTION_STORE_AUTH_CREDS "store-auth-creds"
+/** @since New in 1.6. */
#define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP "store-ssl-client-cert-pp"
+/** @since New in 1.6. */
#define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
"store-ssl-client-cert-pp-plaintext"
#define SVN_CONFIG_OPTION_USERNAME "username"
@@ -123,6 +132,7 @@ typedef struct svn_config_t svn_config_t;
#define SVN_CONFIG_OPTION_DIFF_EXTENSIONS "diff-extensions"
#define SVN_CONFIG_OPTION_DIFF3_CMD "diff3-cmd"
#define SVN_CONFIG_OPTION_DIFF3_HAS_PROGRAM_ARG "diff3-has-program-arg"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_MERGE_TOOL_CMD "merge-tool-cmd"
#define SVN_CONFIG_SECTION_MISCELLANY "miscellany"
#define SVN_CONFIG_OPTION_GLOBAL_IGNORES "global-ignores"
@@ -133,8 +143,11 @@ typedef struct svn_config_t svn_config_t;
#define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS "enable-auto-props"
/** @since New in 1.9. */
#define SVN_CONFIG_OPTION_ENABLE_MAGIC_FILE "enable-magic-file"
+/** @since New in 1.2. */
#define SVN_CONFIG_OPTION_NO_UNLOCK "no-unlock"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_MIMETYPES_FILE "mime-types-file"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_PRESERVED_CF_EXTS "preserved-conflict-file-exts"
/** @since New in 1.7. */
#define SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS "interactive-conflicts"
@@ -172,9 +185,13 @@ typedef struct svn_config_t svn_config_t;
#define SVN_CONFIG_OPTION_FORCE_USERNAME_CASE "force-username-case"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_HOOKS_ENV "hooks-env"
+/** @since New in 1.5. */
#define SVN_CONFIG_SECTION_SASL "sasl"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_USE_SASL "use-sasl"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_MIN_SSF "min-encryption"
+/** @since New in 1.5. */
#define SVN_CONFIG_OPTION_MAX_SSF "max-encryption"
/* For repository password database */
diff --git a/contrib/subversion/subversion/include/svn_fs.h b/contrib/subversion/subversion/include/svn_fs.h
index 7773ac6..e34146d 100644
--- a/contrib/subversion/subversion/include/svn_fs.h
+++ b/contrib/subversion/subversion/include/svn_fs.h
@@ -1759,12 +1759,15 @@ svn_fs_node_relation(svn_fs_node_relation_t *relation,
const char *path_b,
apr_pool_t *scratch_pool);
-/** Set @a *revision to the revision in which @a path under @a root was
- * created. Use @a pool for any temporary allocations. @a *revision will
+/** Set @a *revision to the revision in which the node-revision identified
+ * by @a path under @a root was created; that is, to the revision in which
+ * @a path under @a root was last modified. @a *revision will
* be set to #SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes
* under a transaction root). Note that the root of an unmodified transaction
* is not itself considered to be modified; in that case, return the revision
* upon which the transaction was based.
+ *
+ * Use @a pool for any temporary allocations.
*/
svn_error_t *
svn_fs_node_created_rev(svn_revnum_t *revision,
@@ -1861,6 +1864,15 @@ svn_fs_change_node_prop(svn_fs_root_t *root,
* both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a scratch_pool.
*
+ * @note For the purposes of preserving accurate history, certain bits of
+ * code (such as the repository dump code) need to care about the distinction
+ * between situations when the properties are "different" and "have changed
+ * across two points in history". We have a pair of functions that can
+ * answer both of these questions, svn_fs_props_different() and
+ * svn_fs_props_changed(). See issue 4598 for more details.
+ *
+ * @see svn_fs_props_changed
+ *
* @since New in 1.9.
*/
svn_error_t *
@@ -1872,9 +1884,7 @@ svn_fs_props_different(svn_boolean_t *different_p,
apr_pool_t *scratch_pool);
-/** Determine if the properties of two path/root combinations are different.
- * In contrast to #svn_fs_props_different, we only perform a quick test and
- * allow for false positives.
+/** Determine if the properties of two path/root combinations have changed.
*
* Set @a *changed_p to #TRUE if the properties at @a path1 under @a root1
* differ from those at @a path2 under @a root2, or set it to #FALSE if they
@@ -1882,15 +1892,19 @@ svn_fs_props_different(svn_boolean_t *different_p,
* both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a pool.
*
- * @note The behavior is implementation dependent in that the false
- * positives reported may differ from release to release and backend to
- * backend. There is also no guarantee that there will be false positives
- * at all.
+ * @note For the purposes of preserving accurate history, certain bits of
+ * code (such as the repository dump code) need to care about the distinction
+ * between situations when the properties are "different" and "have changed
+ * across two points in history". We have a pair of functions that can
+ * answer both of these questions, svn_fs_props_different() and
+ * svn_fs_props_changed(). See issue 4598 for more details.
+ *
+ * @note This function can currently return false negatives for FSFS:
+ * If @a root1 and @a root2 were both transaction roots and the proplists
+ * of both paths had been changed in their respective transactions,
+ * @a changed_p would be set to #FALSE.
*
- * @note Prior to Subversion 1.9, this function would return false negatives
- * for FSFS: If @a root1 and @a root2 were both transaction roots
- * and the proplists of both paths had been changed in their respective
- * transactions, @a changed_p would be set to #FALSE.
+ * @see svn_fs_props_different
*/
svn_error_t *
svn_fs_props_changed(svn_boolean_t *changed_p,
@@ -2410,7 +2424,7 @@ svn_fs_apply_text(svn_stream_t **contents_p,
apr_pool_t *pool);
-/** Check if the contents of two root/path combos have changed.
+/** Check if the contents of two root/path combos are different.
*
* Set @a *different_p to #TRUE if the file contents at @a path1 under
* @a root1 differ from those at @a path2 under @a root2, or set it to
@@ -2418,6 +2432,16 @@ svn_fs_apply_text(svn_stream_t **contents_p,
* respective roots, and both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a scratch_pool.
*
+ * @note For the purposes of preserving accurate history, certain bits of
+ * code (such as the repository dump code) need to care about the distinction
+ * between situations when two files have "different" content and when the
+ * contents of a given file "have changed" across two points in its history.
+ * We have a pair of functions that can answer both of these questions,
+ * svn_fs_contents_different() and svn_fs_contents_changed(). See issue
+ * 4598 for more details.
+ *
+ * @see svn_fs_contents_changed
+ *
* @since New in 1.9.
*/
svn_error_t *
@@ -2428,9 +2452,7 @@ svn_fs_contents_different(svn_boolean_t *different_p,
const char *path2,
apr_pool_t *scratch_pool);
-/** Check if the contents of two root/path combos have changed. In
- * contrast to #svn_fs_contents_different, we only perform a quick test
- * and allow for false positives.
+/** Check if the contents of two root/path combos have changed.
*
* Set @a *changed_p to #TRUE if the file contents at @a path1 under
* @a root1 differ from those at @a path2 under @a root2, or set it to
@@ -2438,10 +2460,18 @@ svn_fs_contents_different(svn_boolean_t *different_p,
* respective roots, and both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a pool.
*
- * @note The behavior is implementation dependent in that the false
- * positives reported may differ from release to release and backend to
- * backend. There is also no guarantee that there will be false positives
- * at all.
+ * @note svn_fs_contents_changed() was not designed to be used to detect
+ * when two files have different content, but really to detect when the
+ * contents of a given file have changed across two points in its history.
+ * For the purposes of preserving accurate history, certain bits of code
+ * (such as the repository dump code) need to care about this distinction.
+ * For example, it's not an error from the FS API point of view to call
+ * svn_fs_apply_textdelta() and explicitly set a file's contents to exactly
+ * what they were before the edit was made. We have a pair of functions
+ * that can answer both of these questions, svn_fs_contents_changed() and
+ * svn_fs_contents_different(). See issue 4598 for more details.
+ *
+ * @see svn_fs_contents_different
*/
svn_error_t *
svn_fs_contents_changed(svn_boolean_t *changed_p,
diff --git a/contrib/subversion/subversion/include/svn_version.h b/contrib/subversion/subversion/include/svn_version.h
index 254bfc6..92ce825 100644
--- a/contrib/subversion/subversion/include/svn_version.h
+++ b/contrib/subversion/subversion/include/svn_version.h
@@ -70,7 +70,7 @@ extern "C" {
*
* @since New in 1.1.
*/
-#define SVN_VER_PATCH 2
+#define SVN_VER_PATCH 4
/** @deprecated Provided for backward compatibility with the 1.0 API. */
@@ -93,7 +93,7 @@ extern "C" {
*
* Always change this at the same time as SVN_VER_NUMTAG.
*/
-#define SVN_VER_TAG " (r1703836)"
+#define SVN_VER_TAG " (r1740329)"
/** Number tag: a string describing the version.
@@ -117,7 +117,7 @@ extern "C" {
* file version. Its value remains 0 in the repository except in release
* tags where it is the revision from which the tag was created.
*/
-#define SVN_VER_REVISION 1703836
+#define SVN_VER_REVISION 1740329
/* Version strings composed from the above definitions. */
diff --git a/contrib/subversion/subversion/libsvn_client/externals.c b/contrib/subversion/subversion/libsvn_client/externals.c
index e503715..851b260 100644
--- a/contrib/subversion/subversion/libsvn_client/externals.c
+++ b/contrib/subversion/subversion/libsvn_client/externals.c
@@ -231,6 +231,42 @@ switch_dir_external(const char *local_abspath,
if (node_url)
{
+ svn_boolean_t is_wcroot;
+
+ SVN_ERR(svn_wc__is_wcroot(&is_wcroot, ctx->wc_ctx, local_abspath,
+ pool));
+
+ if (! is_wcroot)
+ {
+ /* This can't be a directory external! */
+
+ err = svn_wc__external_remove(ctx->wc_ctx, defining_abspath,
+ local_abspath,
+ TRUE /* declaration_only */,
+ ctx->cancel_func, ctx->cancel_baton,
+ pool);
+
+ if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ /* New external... No problem that we can't remove it */
+ svn_error_clear(err);
+ err = NULL;
+ }
+ else if (err)
+ return svn_error_trace(err);
+
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("The external '%s' defined in %s at '%s' "
+ "cannot be checked out because '%s' is "
+ "already a versioned path."),
+ url_from_externals_definition,
+ SVN_PROP_EXTERNALS,
+ svn_dirent_local_style(defining_abspath,
+ pool),
+ svn_dirent_local_style(local_abspath,
+ pool));
+ }
+
/* If we have what appears to be a version controlled
subdir, and its top-level URL matches that of our
externals definition, perform an update. */
diff --git a/contrib/subversion/subversion/libsvn_client/merge.c b/contrib/subversion/subversion/libsvn_client/merge.c
index e912682..e243575 100644
--- a/contrib/subversion/subversion/libsvn_client/merge.c
+++ b/contrib/subversion/subversion/libsvn_client/merge.c
@@ -2349,17 +2349,47 @@ files_same_p(svn_boolean_t *same,
{
svn_stream_t *mine_stream;
svn_stream_t *older_stream;
- svn_opt_revision_t working_rev = { svn_opt_revision_working, { 0 } };
+ svn_string_t *special = svn_hash_gets(working_props, SVN_PROP_SPECIAL);
+ svn_string_t *eol_style = svn_hash_gets(working_props, SVN_PROP_EOL_STYLE);
+ svn_string_t *keywords = svn_hash_gets(working_props, SVN_PROP_KEYWORDS);
/* Compare the file content, translating 'mine' to 'normal' form. */
- if (svn_prop_get_value(working_props, SVN_PROP_SPECIAL) != NULL)
+ if (special != NULL)
SVN_ERR(svn_subst_read_specialfile(&mine_stream, mine_abspath,
scratch_pool, scratch_pool));
else
- SVN_ERR(svn_client__get_normalized_stream(&mine_stream, wc_ctx,
- mine_abspath, &working_rev,
- FALSE, TRUE, NULL, NULL,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_stream_open_readonly(&mine_stream, mine_abspath,
+ scratch_pool, scratch_pool));
+
+ if (!special && (eol_style || keywords))
+ {
+ apr_hash_t *kw = NULL;
+ const char *eol = NULL;
+ svn_subst_eol_style_t style;
+
+ /* We used to use svn_client__get_normalized_stream() here, but
+ that doesn't work in 100% of the cases because it doesn't
+ convert EOLs to the repository form; just to '\n'.
+ */
+
+ if (eol_style)
+ {
+ svn_subst_eol_style_from_value(&style, &eol, eol_style->data);
+
+ if (style == svn_subst_eol_style_native)
+ eol = SVN_SUBST_NATIVE_EOL_STR;
+ else if (style != svn_subst_eol_style_fixed
+ && style != svn_subst_eol_style_none)
+ return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
+ }
+
+ if (keywords)
+ SVN_ERR(svn_subst_build_keywords3(&kw, keywords->data, "", "",
+ "", 0, "", scratch_pool));
+
+ mine_stream = svn_subst_stream_translated(
+ mine_stream, eol, FALSE, kw, FALSE, scratch_pool);
+ }
SVN_ERR(svn_stream_open_readonly(&older_stream, older_abspath,
scratch_pool, scratch_pool));
diff --git a/contrib/subversion/subversion/libsvn_client/patch.c b/contrib/subversion/subversion/libsvn_client/patch.c
index d70e83c..6d8d0a4 100644
--- a/contrib/subversion/subversion/libsvn_client/patch.c
+++ b/contrib/subversion/subversion/libsvn_client/patch.c
@@ -209,9 +209,6 @@ typedef struct patch_target_t {
/* True if the target had to be skipped for some reason. */
svn_boolean_t skipped;
- /* True if the target has been filtered by the patch callback. */
- svn_boolean_t filtered;
-
/* True if at least one hunk was rejected. */
svn_boolean_t had_rejects;
@@ -489,6 +486,8 @@ resolve_target_path(patch_target_t *target,
SVN_ERR(svn_wc__node_was_moved_away(&moved_to_abspath, NULL,
wc_ctx, target->local_abspath,
result_pool, scratch_pool));
+ /* ### BUG: moved_to_abspath contains the target where the op-root was
+ ### moved to... not the target itself! */
if (moved_to_abspath)
{
target->local_abspath = moved_to_abspath;
@@ -2264,8 +2263,6 @@ apply_one_patch(patch_target_t **patch_target, svn_patch_t *patch,
int strip_count,
svn_boolean_t ignore_whitespace,
svn_boolean_t remove_tempfiles,
- svn_client_patch_func_t patch_func,
- void *patch_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *result_pool, apr_pool_t *scratch_pool)
@@ -2285,19 +2282,6 @@ apply_one_patch(patch_target_t **patch_target, svn_patch_t *patch,
return SVN_NO_ERROR;
}
- if (patch_func)
- {
- SVN_ERR(patch_func(patch_baton, &target->filtered,
- target->canon_path_from_patchfile,
- target->patched_path, target->reject_path,
- scratch_pool));
- if (target->filtered)
- {
- *patch_target = target;
- return SVN_NO_ERROR;
- }
- }
-
iterpool = svn_pool_create(scratch_pool);
/* Match hunks. */
for (i = 0; i < patch->hunks->nelts; i++)
@@ -3164,14 +3148,23 @@ apply_patches(/* The path to the patch file. */
if (patch)
{
patch_target_t *target;
+ svn_boolean_t filtered = FALSE;
SVN_ERR(apply_one_patch(&target, patch, abs_wc_path,
ctx->wc_ctx, strip_count,
ignore_whitespace, remove_tempfiles,
- patch_func, patch_baton,
ctx->cancel_func, ctx->cancel_baton,
iterpool, iterpool));
- if (! target->filtered)
+
+ if (!target->skipped && patch_func)
+ {
+ SVN_ERR(patch_func(patch_baton, &filtered,
+ target->canon_path_from_patchfile,
+ target->patched_path, target->reject_path,
+ iterpool));
+ }
+
+ if (! filtered)
{
/* Save info we'll still need when we're done patching. */
patch_target_info_t *target_info =
diff --git a/contrib/subversion/subversion/libsvn_diff/binary_diff.c b/contrib/subversion/subversion/libsvn_diff/binary_diff.c
index d42b2e5..035794d 100644
--- a/contrib/subversion/subversion/libsvn_diff/binary_diff.c
+++ b/contrib/subversion/subversion/libsvn_diff/binary_diff.c
@@ -194,22 +194,22 @@ svn_diff_output_binary(svn_stream_t *output_stream,
SVN_ERR(svn_stream_puts(output_stream, "GIT binary patch" APR_EOL_STR));
- /* ### git would first calculate if a git-delta original->latest would be
+ /* ### git would first calculate if a git-delta latest->original would be
shorter than the zipped data. For now lets assume that it is not
and just dump the literal data */
- SVN_ERR(write_literal(original_full,
- svn_stream_from_aprfile2(original_apr, FALSE, subpool),
+ SVN_ERR(write_literal(latest_full,
+ svn_stream_from_aprfile2(latest_apr, FALSE, subpool),
output_stream,
cancel_func, cancel_baton,
scratch_pool));
svn_pool_clear(subpool);
SVN_ERR(svn_stream_puts(output_stream, APR_EOL_STR));
- /* ### git would first calculate if a git-delta latest->original would be
+ /* ### git would first calculate if a git-delta original->latest would be
shorter than the zipped data. For now lets assume that it is not
and just dump the literal data */
- SVN_ERR(write_literal(latest_full,
- svn_stream_from_aprfile2(latest_apr, FALSE, subpool),
+ SVN_ERR(write_literal(original_full,
+ svn_stream_from_aprfile2(original_apr, FALSE, subpool),
output_stream,
cancel_func, cancel_baton,
scratch_pool));
diff --git a/contrib/subversion/subversion/libsvn_fs_base/dag.c b/contrib/subversion/subversion/libsvn_fs_base/dag.c
index e530fb2..7c79dc2 100644
--- a/contrib/subversion/subversion/libsvn_fs_base/dag.c
+++ b/contrib/subversion/subversion/libsvn_fs_base/dag.c
@@ -1657,8 +1657,14 @@ svn_fs_base__things_different(svn_boolean_t *props_changed,
/* Compare contents keys and their (optional) uniquifiers. */
if (contents_changed != NULL)
- *contents_changed = (! svn_fs_base__same_keys(noderev1->data_key,
- noderev2->data_key));
+ *contents_changed =
+ (! (svn_fs_base__same_keys(noderev1->data_key,
+ noderev2->data_key)
+ /* Technically, these uniquifiers aren't used and "keys",
+ but keys are base-36 stringified numbers, so we'll take
+ this liberty. */
+ && (svn_fs_base__same_keys(noderev1->data_key_uniquifier,
+ noderev2->data_key_uniquifier))));
return SVN_NO_ERROR;
}
diff --git a/contrib/subversion/subversion/libsvn_fs_base/fs.h b/contrib/subversion/subversion/libsvn_fs_base/fs.h
index bdbced3..cc89116 100644
--- a/contrib/subversion/subversion/libsvn_fs_base/fs.h
+++ b/contrib/subversion/subversion/libsvn_fs_base/fs.h
@@ -195,11 +195,7 @@ typedef struct node_revision_t
only because one or both of us decided to pick up a shared
representation after-the-fact." May be NULL (if this node
revision isn't using a shared rep, or isn't the original
- "assignee" of a shared rep).
-
- This is no longer used by the 1.9 code but we have to keep
- reading and writing it to remain compatible with 1.8, and
- earlier, that require it. */
+ "assignee" of a shared rep). */
const char *data_key_uniquifier;
/* representation key for this node's text-data-in-progess (files
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c b/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c
index 1618f07..948870e 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c
+++ b/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c
@@ -2558,8 +2558,12 @@ svn_fs_fs__rep_contents_dir(apr_array_header_t **entries_p,
SVN_ERR(get_dir_contents(entries_p, fs, noderev, result_pool,
scratch_pool));
- /* Update the cache, if we are to use one. */
- if (cache)
+ /* Update the cache, if we are to use one.
+ *
+ * Don't even attempt to serialize very large directories; it would cause
+ * an unnecessary memory allocation peak. 150 bytes/entry is about right.
+ */
+ if (cache && svn_cache__is_cachable(cache, 150 * (*entries_p)->nelts))
SVN_ERR(svn_cache__set(cache, key, *entries_p, scratch_pool));
return SVN_NO_ERROR;
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/dag.c b/contrib/subversion/subversion/libsvn_fs_fs/dag.c
index 78d1b23..d21c17c 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/dag.c
+++ b/contrib/subversion/subversion/libsvn_fs_fs/dag.c
@@ -1307,34 +1307,58 @@ svn_fs_fs__dag_things_different(svn_boolean_t *props_changed,
apr_pool_t *pool)
{
node_revision_t *noderev1, *noderev2;
- svn_fs_t *fs;
- svn_boolean_t same;
/* If we have no place to store our results, don't bother doing
anything. */
if (! props_changed && ! contents_changed)
return SVN_NO_ERROR;
- fs = svn_fs_fs__dag_get_fs(node1);
-
/* The node revision skels for these two nodes. */
SVN_ERR(get_node_revision(&noderev1, node1));
SVN_ERR(get_node_revision(&noderev2, node2));
- /* Compare property keys. */
- if (props_changed != NULL)
+ if (strict)
{
- SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, noderev1, noderev2,
- strict, pool));
- *props_changed = !same;
- }
+ /* In strict mode, compare text and property representations in the
+ svn_fs_contents_different() / svn_fs_props_different() manner.
- /* Compare contents keys. */
- if (contents_changed != NULL)
+ See the "No-op changes no longer dumped by 'svnadmin dump' in 1.9"
+ discussion (http://svn.haxx.se/dev/archive-2015-09/0269.shtml) and
+ issue #4598 (https://issues.apache.org/jira/browse/SVN-4598). */
+ svn_fs_t *fs = svn_fs_fs__dag_get_fs(node1);
+ svn_boolean_t same;
+
+ /* Compare property keys. */
+ if (props_changed != NULL)
+ {
+ SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, noderev1,
+ noderev2, pool));
+ *props_changed = !same;
+ }
+
+ /* Compare contents keys. */
+ if (contents_changed != NULL)
+ {
+ SVN_ERR(svn_fs_fs__file_text_rep_equal(&same, fs, noderev1,
+ noderev2, pool));
+ *contents_changed = !same;
+ }
+ }
+ else
{
- SVN_ERR(svn_fs_fs__file_text_rep_equal(&same, fs, noderev1, noderev2,
- strict, pool));
- *contents_changed = !same;
+ /* Otherwise, compare representation keys -- as in Subversion 1.8. */
+
+ /* Compare property keys. */
+ if (props_changed != NULL)
+ *props_changed =
+ !svn_fs_fs__noderev_same_rep_key(noderev1->prop_rep,
+ noderev2->prop_rep);
+
+ /* Compare contents keys. */
+ if (contents_changed != NULL)
+ *contents_changed =
+ !svn_fs_fs__noderev_same_rep_key(noderev1->data_rep,
+ noderev2->data_rep);
}
return SVN_NO_ERROR;
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/fs.h b/contrib/subversion/subversion/libsvn_fs_fs/fs.h
index 221db1a..c75eafb 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/fs.h
+++ b/contrib/subversion/subversion/libsvn_fs_fs/fs.h
@@ -478,10 +478,6 @@ typedef struct fs_fs_data_t
/*** Filesystem Transaction ***/
typedef struct transaction_t
{
- /* property list (const char * name, svn_string_t * value).
- may be NULL if there are no properties. */
- apr_hash_t *proplist;
-
/* node revision id of the root node. */
const svn_fs_id_t *root_id;
@@ -536,13 +532,7 @@ typedef struct representation_t
/* For rep-sharing, we need a way of uniquifying node-revs which share the
same representation (see svn_fs_fs__noderev_same_rep_key() ). So, we
store the original txn of the node rev (not the rep!), along with some
- intra-node uniqification content.
-
- This is no longer used by the 1.9 code but we have to keep
- reading and writing it for old formats to remain compatible with
- 1.8, and earlier, that require it. We also read/write it in
- format 7 even though it is not currently required by any code
- that handles that format. */
+ intra-node uniqification content. */
struct
{
/* unique context, i.e. txn ID, in which the noderev (!) got created */
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c b/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c
index c2eaf5c..1d32672 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c
+++ b/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c
@@ -1414,19 +1414,37 @@ svn_fs_fs__file_length(svn_filesize_t *length,
return SVN_NO_ERROR;
}
+svn_boolean_t
+svn_fs_fs__noderev_same_rep_key(representation_t *a,
+ representation_t *b)
+{
+ if (a == b)
+ return TRUE;
+
+ if (a == NULL || b == NULL)
+ return FALSE;
+
+ if (a->item_index != b->item_index)
+ return FALSE;
+
+ if (a->revision != b->revision)
+ return FALSE;
+
+ return memcmp(&a->uniquifier, &b->uniquifier, sizeof(a->uniquifier)) == 0;
+}
+
svn_error_t *
svn_fs_fs__file_text_rep_equal(svn_boolean_t *equal,
svn_fs_t *fs,
node_revision_t *a,
node_revision_t *b,
- svn_boolean_t strict,
apr_pool_t *scratch_pool)
{
svn_stream_t *contents_a, *contents_b;
representation_t *rep_a = a->data_rep;
representation_t *rep_b = b->data_rep;
- svn_boolean_t a_empty = !rep_a || rep_a->expanded_size == 0;
- svn_boolean_t b_empty = !rep_b || rep_b->expanded_size == 0;
+ svn_boolean_t a_empty = !rep_a;
+ svn_boolean_t b_empty = !rep_b;
/* This makes sure that neither rep will be NULL later on */
if (a_empty && b_empty)
@@ -1435,28 +1453,6 @@ svn_fs_fs__file_text_rep_equal(svn_boolean_t *equal,
return SVN_NO_ERROR;
}
- if (a_empty != b_empty)
- {
- *equal = FALSE;
- return SVN_NO_ERROR;
- }
-
- /* File text representations always know their checksums - even in a txn. */
- if (memcmp(rep_a->md5_digest, rep_b->md5_digest, sizeof(rep_a->md5_digest)))
- {
- *equal = FALSE;
- return SVN_NO_ERROR;
- }
-
- /* Paranoia. Compare SHA1 checksums because that's the level of
- confidence we require for e.g. the working copy. */
- if (rep_a->has_sha1 && rep_b->has_sha1)
- {
- *equal = memcmp(rep_a->sha1_digest, rep_b->sha1_digest,
- sizeof(rep_a->sha1_digest)) == 0;
- return SVN_NO_ERROR;
- }
-
/* Same path in same rev or txn? */
if (svn_fs_fs__id_eq(a->id, b->id))
{
@@ -1464,17 +1460,28 @@ svn_fs_fs__file_text_rep_equal(svn_boolean_t *equal,
return SVN_NO_ERROR;
}
- /* Old repositories may not have the SHA1 checksum handy.
- This check becomes expensive. Skip it unless explicitly required.
-
- We already have seen that the ID is different, so produce a likely
- false negative as allowed by the API description - even though the
- MD5 matched, there is an extremely slim chance that the SHA1 wouldn't.
- */
- if (!strict)
+ /* Beware of the combination NULL rep and possibly empty rep.
+ * Due to EXPANDED_SIZE not being reliable, we can't easily detect empty
+ * reps. So, we can only take further shortcuts if both reps are given. */
+ if (!a_empty && !b_empty)
{
- *equal = FALSE;
- return SVN_NO_ERROR;
+ /* File text representations always know their checksums -
+ * even in a txn. */
+ if (memcmp(rep_a->md5_digest, rep_b->md5_digest,
+ sizeof(rep_a->md5_digest)))
+ {
+ *equal = FALSE;
+ return SVN_NO_ERROR;
+ }
+
+ /* Paranoia. Compare SHA1 checksums because that's the level of
+ confidence we require for e.g. the working copy. */
+ if (rep_a->has_sha1 && rep_b->has_sha1)
+ {
+ *equal = memcmp(rep_a->sha1_digest, rep_b->sha1_digest,
+ sizeof(rep_a->sha1_digest)) == 0;
+ return SVN_NO_ERROR;
+ }
}
SVN_ERR(svn_fs_fs__get_contents(&contents_a, fs, rep_a, TRUE,
@@ -1492,7 +1499,6 @@ svn_fs_fs__prop_rep_equal(svn_boolean_t *equal,
svn_fs_t *fs,
node_revision_t *a,
node_revision_t *b,
- svn_boolean_t strict,
apr_pool_t *scratch_pool)
{
representation_t *rep_a = a->prop_rep;
@@ -1526,14 +1532,6 @@ svn_fs_fs__prop_rep_equal(svn_boolean_t *equal,
return SVN_NO_ERROR;
}
- /* Skip the expensive bits unless we are in strict mode.
- Simply assume that there is a difference. */
- if (!strict)
- {
- *equal = FALSE;
- return SVN_NO_ERROR;
- }
-
/* At least one of the reps has been modified in a txn.
Fetch and compare them. */
SVN_ERR(svn_fs_fs__get_proplist(&proplist_a, fs, a, scratch_pool));
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.h b/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.h
index 1be993a..b6c94c7 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.h
+++ b/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.h
@@ -81,28 +81,29 @@ svn_error_t *svn_fs_fs__file_length(svn_filesize_t *length,
node_revision_t *noderev,
apr_pool_t *pool);
+/* Return TRUE if the representation keys in A and B both point to the
+ same representation, else return FALSE. */
+svn_boolean_t svn_fs_fs__noderev_same_rep_key(representation_t *a,
+ representation_t *b);
+
/* Set *EQUAL to TRUE if the text representations in A and B within FS
- have equal contents, else set it to FALSE. If STRICT is not set, allow
- for false negatives.
+ have equal contents, else set it to FALSE.
Use SCRATCH_POOL for temporary allocations. */
svn_error_t *
svn_fs_fs__file_text_rep_equal(svn_boolean_t *equal,
svn_fs_t *fs,
node_revision_t *a,
node_revision_t *b,
- svn_boolean_t strict,
apr_pool_t *scratch_pool);
/* Set *EQUAL to TRUE if the property representations in A and B within FS
- have equal contents, else set it to FALSE. If STRICT is not set, allow
- for false negatives.
+ have equal contents, else set it to FALSE.
Use SCRATCH_POOL for temporary allocations. */
svn_error_t *
svn_fs_fs__prop_rep_equal(svn_boolean_t *equal,
svn_fs_t *fs,
node_revision_t *a,
node_revision_t *b,
- svn_boolean_t strict,
apr_pool_t *scratch_pool);
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h b/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h
index 0375859..56692c9 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h
+++ b/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h
@@ -1,4 +1,4 @@
-/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.2/subversion/libsvn_fs_fs/token-map.h.
+/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_fs_fs/token-map.h.
* Do not edit this file -- edit the source and rerun gen-make.py */
#define STMT_CREATE_SCHEMA 0
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/transaction.c b/contrib/subversion/subversion/libsvn_fs_fs/transaction.c
index c6b2d25..3968c6f 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/transaction.c
+++ b/contrib/subversion/subversion/libsvn_fs_fs/transaction.c
@@ -1247,9 +1247,6 @@ svn_fs_fs__get_txn(transaction_t **txn_p,
svn_fs_id_t *root_id;
txn = apr_pcalloc(pool, sizeof(*txn));
- txn->proplist = apr_hash_make(pool);
-
- SVN_ERR(get_txn_proplist(txn->proplist, fs, txn_id, pool));
root_id = svn_fs_fs__id_txn_create_root(txn_id, pool);
SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs, root_id, pool, pool));
diff --git a/contrib/subversion/subversion/libsvn_fs_fs/tree.c b/contrib/subversion/subversion/libsvn_fs_fs/tree.c
index 66de1f8..0047bef 100644
--- a/contrib/subversion/subversion/libsvn_fs_fs/tree.c
+++ b/contrib/subversion/subversion/libsvn_fs_fs/tree.c
@@ -1900,13 +1900,13 @@ merge(svn_stringbuf_t *conflict_p,
/* Now compare the prop-keys of the skels. Note that just because
the keys are different -doesn't- mean the proplists have
different contents. */
- SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, src_nr, anc_nr, TRUE, pool));
+ SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, src_nr, anc_nr, pool));
if (! same)
return conflict_err(conflict_p, target_path);
/* The directory entries got changed in the repository but the directory
properties did not. */
- SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, tgt_nr, anc_nr, TRUE, pool));
+ SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, tgt_nr, anc_nr, pool));
if (! same)
{
/* There is an incoming prop change for this directory.
diff --git a/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h b/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h
index 44c49f1..21d56f1 100644
--- a/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h
+++ b/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h
@@ -1,4 +1,4 @@
-/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.2/subversion/libsvn_fs_x/token-map.h.
+/* This file is automatically generated from rep-cache-db.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_fs_x/token-map.h.
* Do not edit this file -- edit the source and rerun gen-make.py */
#define STMT_CREATE_SCHEMA 0
diff --git a/contrib/subversion/subversion/libsvn_ra_local/ra_plugin.c b/contrib/subversion/subversion/libsvn_ra_local/ra_plugin.c
index cc4a72b..bb09162 100644
--- a/contrib/subversion/subversion/libsvn_ra_local/ra_plugin.c
+++ b/contrib/subversion/subversion/libsvn_ra_local/ra_plugin.c
@@ -360,8 +360,13 @@ make_reporter(svn_ra_session_t *session,
edit_baton,
NULL,
NULL,
- 1024 * 1024, /* process-local transfers
- should be fast */
+ 0, /* Disable zero-copy codepath, because
+ RA API users are unaware about the
+ zero-copy code path limitation (do
+ not access FSFS data structures
+ and, hence, caches). See notes
+ to svn_repos_begin_report3() for
+ additional details. */
result_pool));
/* Wrap the report baton given us by the repos layer with our own
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/commit.c b/contrib/subversion/subversion/libsvn_ra_serf/commit.c
index ec3bce94..b1e81c7 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/commit.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/commit.c
@@ -101,6 +101,8 @@ typedef struct delete_context_t {
svn_revnum_t revision;
commit_context_t *commit_ctx;
+
+ svn_boolean_t non_recursive_if; /* Only create a non-recursive If header */
} delete_context_t;
/* Represents a directory. */
@@ -841,6 +843,7 @@ proppatch_resource(svn_ra_serf__session_t *session,
handler->body_delegate = create_proppatch_body;
handler->body_delegate_baton = proppatch;
+ handler->body_type = "text/xml";
handler->response_handler = svn_ra_serf__handle_multistatus_only;
handler->response_baton = handler;
@@ -1101,8 +1104,15 @@ setup_delete_headers(serf_bucket_t *headers,
serf_bucket_headers_set(headers, SVN_DAV_VERSION_NAME_HEADER,
apr_ltoa(pool, del->revision));
- SVN_ERR(setup_if_header_recursive(&added, headers, del->commit_ctx,
- del->relpath, pool));
+ if (! del->non_recursive_if)
+ SVN_ERR(setup_if_header_recursive(&added, headers, del->commit_ctx,
+ del->relpath, pool));
+ else
+ {
+ SVN_ERR(maybe_set_lock_token_header(headers, del->commit_ctx,
+ del->relpath, pool));
+ added = TRUE;
+ }
if (added && del->commit_ctx->keep_locks)
serf_bucket_headers_setn(headers, SVN_DAV_OPTIONS_HEADER,
@@ -1402,6 +1412,28 @@ open_root(void *edit_baton,
return SVN_NO_ERROR;
}
+/* Implements svn_ra_serf__request_body_delegate_t */
+static svn_error_t *
+create_delete_body(serf_bucket_t **body_bkt,
+ void *baton,
+ serf_bucket_alloc_t *alloc,
+ apr_pool_t *pool /* request pool */,
+ apr_pool_t *scratch_pool)
+{
+ delete_context_t *ctx = baton;
+ serf_bucket_t *body;
+
+ body = serf_bucket_aggregate_create(alloc);
+
+ svn_ra_serf__add_xml_header_buckets(body, alloc);
+
+ svn_ra_serf__merge_lock_token_list(ctx->commit_ctx->lock_tokens,
+ ctx->relpath, body, alloc, pool);
+
+ *body_bkt = body;
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
delete_entry(const char *path,
svn_revnum_t revision,
@@ -1445,9 +1477,37 @@ delete_entry(const char *path,
handler->method = "DELETE";
handler->path = delete_target;
+ handler->no_fail_on_http_failure_status = TRUE;
SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+ if (handler->sline.code == 400)
+ {
+ /* Try again with non-standard body to overcome Apache Httpd
+ header limit */
+ delete_ctx->non_recursive_if = TRUE;
+
+ handler = svn_ra_serf__create_handler(dir->commit_ctx->session, pool);
+
+ handler->response_handler = svn_ra_serf__expect_empty_body;
+ handler->response_baton = handler;
+
+ handler->header_delegate = setup_delete_headers;
+ handler->header_delegate_baton = delete_ctx;
+
+ handler->method = "DELETE";
+ handler->path = delete_target;
+
+ handler->body_type = "text/xml";
+ handler->body_delegate = create_delete_body;
+ handler->body_delegate_baton = delete_ctx;
+
+ SVN_ERR(svn_ra_serf__context_run_one(handler, pool));
+ }
+
+ if (handler->server_error)
+ return svn_ra_serf__server_error_create(handler, pool);
+
/* 204 No Content: item successfully deleted */
if (handler->sline.code != 204)
return svn_error_trace(svn_ra_serf__unexpected_status(handler));
@@ -1539,7 +1599,9 @@ add_directory(const char *path,
handler->header_delegate = setup_copy_dir_headers;
handler->header_delegate_baton = dir;
}
-
+ /* We have the same problem as with DELETE here: if there are too many
+ locks, the request fails. But in this case there is no way to retry
+ with a non-standard request. #### How to fix? */
SVN_ERR(svn_ra_serf__context_run_one(handler, dir->pool));
if (handler->sline.code != 201)
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c b/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c
index 40acc5d..6edafb1 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c
@@ -143,9 +143,7 @@ iprops_closed(svn_ra_serf__xml_estate_t *xes,
return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
iprops_ctx->curr_iprop->path_or_url =
- svn_path_url_add_component2(iprops_ctx->repos_root_url,
- cdata->data,
- iprops_ctx->pool);
+ apr_pstrdup(iprops_ctx->pool, cdata->data);
}
else if (leaving_state == IPROPS_PROPNAME)
{
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/merge.c b/contrib/subversion/subversion/libsvn_ra_serf/merge.c
index 2465b8f..0a2fd54 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/merge.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/merge.c
@@ -285,12 +285,12 @@ setup_merge_headers(serf_bucket_t *headers,
return SVN_NO_ERROR;
}
-static void
-merge_lock_token_list(apr_hash_t *lock_tokens,
- const char *parent,
- serf_bucket_t *body,
- serf_bucket_alloc_t *alloc,
- apr_pool_t *pool)
+void
+svn_ra_serf__merge_lock_token_list(apr_hash_t *lock_tokens,
+ const char *parent,
+ serf_bucket_t *body,
+ serf_bucket_alloc_t *alloc,
+ apr_pool_t *pool)
{
apr_hash_index_t *hi;
@@ -378,7 +378,8 @@ create_merge_body(serf_bucket_t **bkt,
"D:creator-displayname", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:prop");
- merge_lock_token_list(ctx->lock_tokens, NULL, body_bkt, alloc, pool);
+ svn_ra_serf__merge_lock_token_list(ctx->lock_tokens, NULL, body_bkt,
+ alloc, pool);
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:merge");
@@ -426,6 +427,7 @@ svn_ra_serf__run_merge(const svn_commit_info_t **commit_info,
handler->path = merge_ctx->merge_url;
handler->body_delegate = create_merge_body;
handler->body_delegate_baton = merge_ctx;
+ handler->body_type = "text/xml";
handler->header_delegate = setup_merge_headers;
handler->header_delegate_baton = merge_ctx;
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/multistatus.c b/contrib/subversion/subversion/libsvn_ra_serf/multistatus.c
index 5b4c8fd..9c269c3 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/multistatus.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/multistatus.c
@@ -315,7 +315,7 @@ multistatus_closed(svn_ra_serf__xml_estate_t *xes,
svn_ra_serf__xml_note(xes, MS_RESPONSE, "errcode", errcode);
break;
case MS_RESPONSE:
- if ((status = svn_hash_gets(attrs, "status")) != NULL)
+ if ((status = svn_hash__get_cstring(attrs, "status", NULL)) != NULL)
{
error_item_t *item;
@@ -369,7 +369,7 @@ multistatus_closed(svn_ra_serf__xml_estate_t *xes,
break;
case MS_PROPSTAT:
- if ((status = svn_hash_gets(attrs, "status")) != NULL)
+ if ((status = svn_hash__get_cstring(attrs, "status", NULL)) != NULL)
{
apr_hash_t *response_attrs;
error_item_t *item;
@@ -428,7 +428,8 @@ multistatus_closed(svn_ra_serf__xml_estate_t *xes,
item->http_status = server_error->handler->sline.code;
/* Do we have a mod_dav specific message? */
- item->message = svn_hash_gets(attrs, "human-readable");
+ item->message = svn_hash__get_cstring(attrs, "human-readable",
+ NULL);
if (item->message)
{
@@ -442,9 +443,6 @@ multistatus_closed(svn_ra_serf__xml_estate_t *xes,
item->message = apr_pstrdup(server_error->pool, item->message);
}
- else
- item->message = apr_pstrdup(server_error->pool,
- svn_hash_gets(attrs, "description"));
APR_ARRAY_PUSH(server_error->items, error_item_t *) = item;
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/ra_serf.h b/contrib/subversion/subversion/libsvn_ra_serf/ra_serf.h
index 510a6b5..fcef737 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/ra_serf.h
+++ b/contrib/subversion/subversion/libsvn_ra_serf/ra_serf.h
@@ -1022,6 +1022,13 @@ svn_ra_serf__svnname_from_wirename(const char *ns,
/** MERGE-related functions **/
+void
+svn_ra_serf__merge_lock_token_list(apr_hash_t *lock_tokens,
+ const char *parent,
+ serf_bucket_t *body,
+ serf_bucket_alloc_t *alloc,
+ apr_pool_t *pool);
+
/* Create an MERGE request aimed at the SESSION url, requesting the
merge of the resource identified by MERGE_RESOURCE_URL.
LOCK_TOKENS is a hash mapping paths to lock tokens owned by the
@@ -1538,6 +1545,17 @@ svn_ra_serf__create_bucket_with_eagain(const char *data,
apr_size_t len,
serf_bucket_alloc_t *allocator);
+/* Parse a given URL_STR, fill in all supplied fields of URI
+ * structure.
+ *
+ * This function is a compatibility wrapper around apr_uri_parse().
+ * Different apr-util versions set apr_uri_t.path to either NULL or ""
+ * for root paths, and serf expects to see "/". This function always
+ * sets URI.path to "/" for these paths. */
+svn_error_t *
+svn_ra_serf__uri_parse(apr_uri_t *uri,
+ const char *url_str,
+ apr_pool_t *result_pool);
#if defined(SVN_DEBUG)
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/replay.c b/contrib/subversion/subversion/libsvn_ra_serf/replay.c
index d9a2ed6..8d2da69 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/replay.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/replay.c
@@ -756,6 +756,7 @@ svn_ra_serf__replay_range(svn_ra_session_t *ra_session,
handler->path = replay_target;
handler->body_delegate = create_replay_body;
handler->body_delegate_baton = rev_ctx;
+ handler->body_type = "text/xml";
handler->done_delegate = replay_done;
handler->done_delegate_baton = rev_ctx;
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/serf.c b/contrib/subversion/subversion/libsvn_ra_serf/serf.c
index ab28ca0..3c47d5e 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/serf.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/serf.c
@@ -64,7 +64,7 @@ ra_serf_version(void)
#define RA_SERF_DESCRIPTION_VER \
N_("Module for accessing a repository via WebDAV protocol using serf.\n" \
- " - using serf %d.%d.%d")
+ " - using serf %d.%d.%d (compiled with %d.%d.%d)")
/* Implements svn_ra__vtable_t.get_description(). */
static const char *
@@ -73,7 +73,12 @@ ra_serf_get_description(apr_pool_t *pool)
int major, minor, patch;
serf_lib_version(&major, &minor, &patch);
- return apr_psprintf(pool, _(RA_SERF_DESCRIPTION_VER), major, minor, patch);
+ return apr_psprintf(pool, _(RA_SERF_DESCRIPTION_VER),
+ major, minor, patch,
+ SERF_MAJOR_VERSION,
+ SERF_MINOR_VERSION,
+ SERF_PATCH_VERSION
+ );
}
/* Implements svn_ra__vtable_t.get_schemes(). */
@@ -509,19 +514,8 @@ svn_ra_serf__open(svn_ra_session_t *session,
serf_sess->pool));
- status = apr_uri_parse(serf_sess->pool, session_URL, &url);
- if (status)
- {
- return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
- _("Illegal URL '%s'"),
- session_URL);
- }
- /* Depending the version of apr-util in use, for root paths url.path
- will be NULL or "", where serf requires "/". */
- if (url.path == NULL || url.path[0] == '\0')
- {
- url.path = apr_pstrdup(serf_sess->pool, "/");
- }
+ SVN_ERR(svn_ra_serf__uri_parse(&url, session_URL, serf_sess->pool));
+
if (!url.port)
{
url.port = apr_uri_port_of_scheme(url.scheme);
@@ -741,18 +735,15 @@ ra_serf_dup_session(svn_ra_session_t *new_session,
new_sess->repos_root_str = apr_pstrdup(result_pool,
new_sess->repos_root_str);
- status = apr_uri_parse(result_pool, new_sess->repos_root_str,
- &new_sess->repos_root);
- if (status)
- return svn_ra_serf__wrap_err(status, NULL);
+ SVN_ERR(svn_ra_serf__uri_parse(&new_sess->repos_root,
+ new_sess->repos_root_str,
+ result_pool));
new_sess->session_url_str = apr_pstrdup(result_pool, new_session_url);
- status = apr_uri_parse(result_pool, new_sess->session_url_str,
- &new_sess->session_url);
-
- if (status)
- return svn_ra_serf__wrap_err(status, NULL);
+ SVN_ERR(svn_ra_serf__uri_parse(&new_sess->session_url,
+ new_sess->session_url_str,
+ result_pool));
/* svn_boolean_t supports_inline_props */
/* supports_rev_rsrc_replay */
@@ -799,7 +790,6 @@ svn_ra_serf__reparent(svn_ra_session_t *ra_session,
{
svn_ra_serf__session_t *session = ra_session->priv;
apr_uri_t new_url;
- apr_status_t status;
/* If it's the URL we already have, wave our hands and do nothing. */
if (strcmp(session->session_url_str, url) == 0)
@@ -821,25 +811,11 @@ svn_ra_serf__reparent(svn_ra_session_t *ra_session,
"URL '%s'"), url, session->repos_root_str);
}
- status = apr_uri_parse(pool, url, &new_url);
- if (status)
- {
- return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
- _("Illegal repository URL '%s'"), url);
- }
+ SVN_ERR(svn_ra_serf__uri_parse(&new_url, url, pool));
- /* Depending the version of apr-util in use, for root paths url.path
- will be NULL or "", where serf requires "/". */
/* ### Maybe we should use a string buffer for these strings so we
### don't allocate memory in the session on every reparent? */
- if (new_url.path == NULL || new_url.path[0] == '\0')
- {
- session->session_url.path = apr_pstrdup(session->pool, "/");
- }
- else
- {
- session->session_url.path = apr_pstrdup(session->pool, new_url.path);
- }
+ session->session_url.path = apr_pstrdup(session->pool, new_url.path);
session->session_url_str = apr_pstrdup(session->pool, url);
return SVN_NO_ERROR;
diff --git a/contrib/subversion/subversion/libsvn_ra_serf/util.c b/contrib/subversion/subversion/libsvn_ra_serf/util.c
index 98f1f4a..5490dde 100644
--- a/contrib/subversion/subversion/libsvn_ra_serf/util.c
+++ b/contrib/subversion/subversion/libsvn_ra_serf/util.c
@@ -1949,3 +1949,29 @@ svn_ra_serf__create_handler(svn_ra_serf__session_t *session,
return handler;
}
+svn_error_t *
+svn_ra_serf__uri_parse(apr_uri_t *uri,
+ const char *url_str,
+ apr_pool_t *result_pool)
+{
+ apr_status_t status;
+
+ status = apr_uri_parse(result_pool, url_str, uri);
+ if (status)
+ {
+ /* Do not use returned error status in error message because currently
+ apr_uri_parse() returns APR_EGENERAL for all parsing errors. */
+ return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
+ _("Illegal URL '%s'"),
+ url_str);
+ }
+
+ /* Depending the version of apr-util in use, for root paths uri.path
+ will be NULL or "", where serf requires "/". */
+ if (uri->path == NULL || uri->path[0] == '\0')
+ {
+ uri->path = apr_pstrdup(result_pool, "/");
+ }
+
+ return SVN_NO_ERROR;
+}
diff --git a/contrib/subversion/subversion/libsvn_ra_svn/client.c b/contrib/subversion/subversion/libsvn_ra_svn/client.c
index c83f25d..9ea59d2 100644
--- a/contrib/subversion/subversion/libsvn_ra_svn/client.c
+++ b/contrib/subversion/subversion/libsvn_ra_svn/client.c
@@ -1191,7 +1191,6 @@ parse_iproplist(apr_array_header_t **inherited_props,
{
int i;
- const char *repos_root_url;
apr_pool_t *iterpool;
if (iproplist == NULL)
@@ -1204,8 +1203,6 @@ parse_iproplist(apr_array_header_t **inherited_props,
return SVN_NO_ERROR;
}
- SVN_ERR(ra_svn_get_repos_root(session, &repos_root_url, scratch_pool));
-
*inherited_props = apr_array_make(
result_pool, iproplist->nelts, sizeof(svn_prop_inherited_item_t *));
@@ -1231,9 +1228,7 @@ parse_iproplist(apr_array_header_t **inherited_props,
SVN_ERR(svn_ra_svn__parse_tuple(elt->u.list, iterpool, "cl",
&parent_rel_path, &iprop_list));
SVN_ERR(svn_ra_svn__parse_proplist(iprop_list, iterpool, &iprops));
- new_iprop->path_or_url = svn_path_url_add_component2(repos_root_url,
- parent_rel_path,
- result_pool);
+ new_iprop->path_or_url = apr_pstrdup(result_pool, parent_rel_path);
new_iprop->prop_hash = svn_hash__make(result_pool);
for (hi = apr_hash_first(iterpool, iprops);
hi;
diff --git a/contrib/subversion/subversion/libsvn_ra_svn/deprecated.c b/contrib/subversion/subversion/libsvn_ra_svn/deprecated.c
index ad2ad58..7f0c8fd 100644
--- a/contrib/subversion/subversion/libsvn_ra_svn/deprecated.c
+++ b/contrib/subversion/subversion/libsvn_ra_svn/deprecated.c
@@ -256,7 +256,8 @@ svn_ra_svn_create_conn3(apr_socket_t *sock,
out_stream = svn_stream_from_aprfile2(out_file, FALSE, pool);
return svn_ra_svn_create_conn4(sock, in_stream, out_stream,
- compression_level, 0, 0, pool);
+ compression_level, zero_copy_limit,
+ error_check_interval, pool);
}
svn_ra_svn_conn_t *
diff --git a/contrib/subversion/subversion/libsvn_ra_svn/marshal.c b/contrib/subversion/subversion/libsvn_ra_svn/marshal.c
index 55e3c1f..0778269 100644
--- a/contrib/subversion/subversion/libsvn_ra_svn/marshal.c
+++ b/contrib/subversion/subversion/libsvn_ra_svn/marshal.c
@@ -944,6 +944,7 @@ static svn_error_t *read_string(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
apr_size_t len = (apr_size_t)len64;
apr_size_t readbuf_len;
char *dest;
+ apr_size_t buflen;
/* We can't store strings longer than the maximum size of apr_size_t,
* so check for wrapping */
@@ -951,8 +952,9 @@ static svn_error_t *read_string(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
_("String length larger than maximum"));
+ buflen = conn->read_end - conn->read_ptr;
/* Shorter strings can be copied directly from the read buffer. */
- if (conn->read_ptr + len <= conn->read_end)
+ if (len <= buflen)
{
item->kind = SVN_RA_SVN_STRING;
item->u.string = svn_string_ncreate(conn->read_ptr, len, pool);
diff --git a/contrib/subversion/subversion/libsvn_repos/dump.c b/contrib/subversion/subversion/libsvn_repos/dump.c
index af7b617..78cd78b 100644
--- a/contrib/subversion/subversion/libsvn_repos/dump.c
+++ b/contrib/subversion/subversion/libsvn_repos/dump.c
@@ -1164,13 +1164,13 @@ dump_node(struct edit_baton *eb,
svn_fs_root_fs(eb->fs_root),
compare_rev, pool));
- SVN_ERR(svn_fs_props_different(&must_dump_props,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_props_changed(&must_dump_props,
+ compare_root, compare_path,
+ eb->fs_root, path, pool));
if (kind == svn_node_file)
- SVN_ERR(svn_fs_contents_different(&must_dump_text,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_contents_changed(&must_dump_text,
+ compare_root, compare_path,
+ eb->fs_root, path, pool));
break;
case svn_node_action_delete:
@@ -1293,16 +1293,16 @@ dump_node(struct edit_baton *eb,
/* Need to decide if the copied node had any extra textual or
property mods as well. */
- SVN_ERR(svn_fs_props_different(&must_dump_props,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_props_changed(&must_dump_props,
+ compare_root, compare_path,
+ eb->fs_root, path, pool));
if (kind == svn_node_file)
{
svn_checksum_t *checksum;
const char *hex_digest;
- SVN_ERR(svn_fs_contents_different(&must_dump_text,
- compare_root, compare_path,
- eb->fs_root, path, pool));
+ SVN_ERR(svn_fs_contents_changed(&must_dump_text,
+ compare_root, compare_path,
+ eb->fs_root, path, pool));
SVN_ERR(svn_fs_file_checksum(&checksum, svn_checksum_md5,
compare_root, compare_path,
diff --git a/contrib/subversion/subversion/libsvn_repos/log.c b/contrib/subversion/subversion/libsvn_repos/log.c
index d6845a0..82caf02 100644
--- a/contrib/subversion/subversion/libsvn_repos/log.c
+++ b/contrib/subversion/subversion/libsvn_repos/log.c
@@ -2127,7 +2127,7 @@ do_logs(svn_fs_t *fs,
if (added_mergeinfo || deleted_mergeinfo)
{
svn_revnum_t *cur_rev =
- apr_pmemdup(pool, &current, sizeof(cur_rev));
+ apr_pmemdup(pool, &current, sizeof(*cur_rev));
struct added_deleted_mergeinfo *add_and_del_mergeinfo =
apr_palloc(pool, sizeof(*add_and_del_mergeinfo));
diff --git a/contrib/subversion/subversion/libsvn_repos/repos.c b/contrib/subversion/subversion/libsvn_repos/repos.c
index 9cbe073..dc0caf5 100644
--- a/contrib/subversion/subversion/libsvn_repos/repos.c
+++ b/contrib/subversion/subversion/libsvn_repos/repos.c
@@ -848,11 +848,16 @@ create_conf(svn_repos_t *repos, apr_pool_t *pool)
"### no path-based access control is done." NL
"### Uncomment the line below to use the default authorization file." NL
"# authz-db = " SVN_REPOS__CONF_AUTHZ NL
-"### The groups-db option controls the location of the groups file." NL
-"### Unless you specify a path starting with a /, the file's location is" NL
-"### relative to the directory containing this file. The specified path" NL
-"### may be a repository relative URL (^/) or an absolute file:// URL to a" NL
-"### text file in a Subversion repository." NL
+"### The groups-db option controls the location of the file with the" NL
+"### group definitions and allows maintaining groups separately from the" NL
+"### authorization rules. The groups-db file is of the same format as the" NL
+"### authz-db file and should contain a single [groups] section with the" NL
+"### group definitions. If the option is enabled, the authz-db file cannot" NL
+"### contain a [groups] section. Unless you specify a path starting with" NL
+"### a /, the file's location is relative to the directory containing this" NL
+"### file. The specified path may be a repository relative URL (^/) or an" NL
+"### absolute file:// URL to a text file in a Subversion repository." NL
+"### This option is not being used by default." NL
"# groups-db = " SVN_REPOS__CONF_GROUPS NL
"### This option specifies the authentication realm of the repository." NL
"### If two repositories have the same authentication realm, they should" NL
diff --git a/contrib/subversion/subversion/libsvn_subr/auth.c b/contrib/subversion/subversion/libsvn_subr/auth.c
index 2cd83c4..303c41e 100644
--- a/contrib/subversion/subversion/libsvn_subr/auth.c
+++ b/contrib/subversion/subversion/libsvn_subr/auth.c
@@ -371,7 +371,9 @@ svn_auth_next_credentials(void **credentials,
if (creds != NULL)
{
/* Put the creds in the cache */
- svn_hash_sets(auth_baton->creds_cache, state->cache_key, creds);
+ svn_hash_sets(auth_baton->creds_cache,
+ apr_pstrdup(auth_baton->pool, state->cache_key),
+ creds);
break;
}
diff --git a/contrib/subversion/subversion/libsvn_subr/cache-membuffer.c b/contrib/subversion/subversion/libsvn_subr/cache-membuffer.c
index 8aeaf77..87ac961 100644
--- a/contrib/subversion/subversion/libsvn_subr/cache-membuffer.c
+++ b/contrib/subversion/subversion/libsvn_subr/cache-membuffer.c
@@ -139,6 +139,10 @@
#endif
/* For more efficient copy operations, let's align all data items properly.
+ * Since we can't portably align pointers, this is rather the item size
+ * granularity which ensures *relative* alignment within the cache - still
+ * giving us decent copy speeds on most machines.
+ *
* Must be a power of 2.
*/
#define ITEM_ALIGNMENT 16
@@ -632,10 +636,6 @@ struct svn_membuffer_t
*/
#define ALIGN_VALUE(value) (((value) + ITEM_ALIGNMENT-1) & -ITEM_ALIGNMENT)
-/* Align POINTER value to the next ITEM_ALIGNMENT boundary.
- */
-#define ALIGN_POINTER(pointer) ((void*)ALIGN_VALUE((apr_size_t)(char*)(pointer)))
-
/* If locking is supported for CACHE, acquire a read lock for it.
*/
static svn_error_t *
@@ -1643,28 +1643,6 @@ ensure_data_insertable_l1(svn_membuffer_t *cache, apr_size_t size)
* right answer. */
}
-/* Mimic apr_pcalloc in APR_POOL_DEBUG mode, i.e. handle failed allocations
- * (e.g. OOM) properly: Allocate at least SIZE bytes from POOL and zero
- * the content of the allocated memory if ZERO has been set. Return NULL
- * upon failed allocations.
- *
- * Also, satisfy our buffer alignment needs for performance reasons.
- */
-static void* secure_aligned_alloc(apr_pool_t *pool,
- apr_size_t size,
- svn_boolean_t zero)
-{
- void* memory = apr_palloc(pool, size + ITEM_ALIGNMENT);
- if (memory != NULL)
- {
- memory = ALIGN_POINTER(memory);
- if (zero)
- memset(memory, 0, size);
- }
-
- return memory;
-}
-
svn_error_t *
svn_cache__membuffer_cache_create(svn_membuffer_t **cache,
apr_size_t total_size,
@@ -1822,10 +1800,11 @@ svn_cache__membuffer_cache_create(svn_membuffer_t **cache,
c[seg].l2.last = NO_INDEX;
c[seg].l2.next = NO_INDEX;
c[seg].l2.start_offset = c[seg].l1.size;
- c[seg].l2.size = data_size - c[seg].l1.size;
+ c[seg].l2.size = ALIGN_VALUE(data_size) - c[seg].l1.size;
c[seg].l2.current_data = c[seg].l2.start_offset;
- c[seg].data = secure_aligned_alloc(pool, (apr_size_t)data_size, FALSE);
+ /* This cast is safe because DATA_SIZE <= MAX_SEGMENT_SIZE. */
+ c[seg].data = apr_palloc(pool, (apr_size_t)ALIGN_VALUE(data_size));
c[seg].data_used = 0;
c[seg].max_entry_size = max_entry_size;
@@ -2204,7 +2183,7 @@ membuffer_cache_get_internal(svn_membuffer_t *cache,
}
size = ALIGN_VALUE(entry->size) - entry->key.key_len;
- *buffer = ALIGN_POINTER(apr_palloc(result_pool, size + ITEM_ALIGNMENT-1));
+ *buffer = apr_palloc(result_pool, size);
memcpy(*buffer, cache->data + entry->offset + entry->key.key_len, size);
#ifdef SVN_DEBUG_CACHE_MEMBUFFER
diff --git a/contrib/subversion/subversion/libsvn_subr/eol.c b/contrib/subversion/subversion/libsvn_subr/eol.c
index 417d90a..e63cf11 100644
--- a/contrib/subversion/subversion/libsvn_subr/eol.c
+++ b/contrib/subversion/subversion/libsvn_subr/eol.c
@@ -33,20 +33,7 @@
char *
svn_eol__find_eol_start(char *buf, apr_size_t len)
{
-#if !SVN_UNALIGNED_ACCESS_IS_OK
-
- /* On some systems, we need to make sure that BUF is properly aligned
- * for chunky data access. This overhead is still justified because
- * only lines tend to be tens of chars long.
- */
- for (; (len > 0) && ((apr_uintptr_t)buf) & (sizeof(apr_uintptr_t)-1)
- ; ++buf, --len)
- {
- if (*buf == '\n' || *buf == '\r')
- return buf;
- }
-
-#endif
+#if SVN_UNALIGNED_ACCESS_IS_OK
/* Scan the input one machine word at a time. */
for (; len > sizeof(apr_uintptr_t)
@@ -71,6 +58,8 @@ svn_eol__find_eol_start(char *buf, apr_size_t len)
break;
}
+#endif
+
/* The remaining odd bytes will be examined the naive way: */
for (; len > 0; ++buf, --len)
{
diff --git a/contrib/subversion/subversion/libsvn_subr/gpg_agent.c b/contrib/subversion/subversion/libsvn_subr/gpg_agent.c
index 96021c5..d53eec4 100644
--- a/contrib/subversion/subversion/libsvn_subr/gpg_agent.c
+++ b/contrib/subversion/subversion/libsvn_subr/gpg_agent.c
@@ -103,6 +103,40 @@ escape_blanks(char *str)
return str;
}
+#define is_hex(c) (((c) >= '0' && (c) <= '9') || ((c) >= 'A' && (c) <= 'F'))
+#define hex_to_int(c) ((c) < '9' ? (c) - '0' : (c) - 'A' + 10)
+
+/* Modify STR in-place. '%', CR and LF are always percent escaped,
+ other characters may be percent escaped, always using uppercase
+ hex, see https://www.gnupg.org/documentation/manuals/assuan.pdf */
+static char *
+unescape_assuan(char *str)
+{
+ char *s = str;
+
+ while (s[0])
+ {
+ if (s[0] == '%' && is_hex(s[1]) && is_hex(s[2]))
+ {
+ char *s2 = s;
+ char val = hex_to_int(s[1]) * 16 + hex_to_int(s[2]);
+
+ s2[0] = val;
+ ++s2;
+
+ while (s2[2])
+ {
+ s2[0] = s2[2];
+ ++s2;
+ }
+ s2[0] = '\0';
+ }
+ ++s;
+ }
+
+ return str;
+}
+
/* Generate the string CACHE_ID_P based on the REALMSTRING allocated in
* RESULT_POOL using SCRATCH_POOL for temporary allocations. This is similar
* to other password caching mechanisms. */
@@ -379,7 +413,7 @@ password_get_gpg_agent(svn_boolean_t *done,
apr_pool_t *pool)
{
int sd;
- const char *p = NULL;
+ char *p = NULL;
char *ep = NULL;
char *buffer;
const char *request = NULL;
@@ -452,7 +486,7 @@ password_get_gpg_agent(svn_boolean_t *done,
if (ep != NULL)
*ep = '\0';
- *password = p;
+ *password = unescape_assuan(p);
*done = TRUE;
return SVN_NO_ERROR;
diff --git a/contrib/subversion/subversion/libsvn_subr/internal_statements.h b/contrib/subversion/subversion/libsvn_subr/internal_statements.h
index 3c8e459..93251a4 100644
--- a/contrib/subversion/subversion/libsvn_subr/internal_statements.h
+++ b/contrib/subversion/subversion/libsvn_subr/internal_statements.h
@@ -1,4 +1,4 @@
-/* This file is automatically generated from internal_statements.sql and .dist_sandbox/subversion-1.9.2/subversion/libsvn_subr/token-map.h.
+/* This file is automatically generated from internal_statements.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_subr/token-map.h.
* Do not edit this file -- edit the source and rerun gen-make.py */
#define STMT_INTERNAL_SAVEPOINT_SVN 0
diff --git a/contrib/subversion/subversion/libsvn_subr/prompt.c b/contrib/subversion/subversion/libsvn_subr/prompt.c
index e00fa0c..8f24b42 100644
--- a/contrib/subversion/subversion/libsvn_subr/prompt.c
+++ b/contrib/subversion/subversion/libsvn_subr/prompt.c
@@ -831,9 +831,8 @@ plaintext_prompt_helper(svn_boolean_t *may_save_plaintext,
{
if (err->apr_err == SVN_ERR_CANCELLED)
{
- svn_error_clear(err);
*may_save_plaintext = FALSE;
- return SVN_NO_ERROR;
+ return err;
}
else
return err;
diff --git a/contrib/subversion/subversion/libsvn_subr/sqlite.c b/contrib/subversion/subversion/libsvn_subr/sqlite.c
index 6dddc8d..18d1c49 100644
--- a/contrib/subversion/subversion/libsvn_subr/sqlite.c
+++ b/contrib/subversion/subversion/libsvn_subr/sqlite.c
@@ -1171,6 +1171,7 @@ svn_sqlite__open(svn_sqlite__db_t **db, const char *path,
affects application(read: Subversion) performance/behavior. */
"PRAGMA foreign_keys=OFF;" /* SQLITE_DEFAULT_FOREIGN_KEYS*/
"PRAGMA locking_mode = NORMAL;" /* SQLITE_DEFAULT_LOCKING_MODE */
+ /* Testing shows TRUNCATE is faster than DELETE on Windows. */
"PRAGMA journal_mode = TRUNCATE;"
),
*db);
diff --git a/contrib/subversion/subversion/libsvn_subr/string.c b/contrib/subversion/subversion/libsvn_subr/string.c
index 29176d6..43a1a4e 100644
--- a/contrib/subversion/subversion/libsvn_subr/string.c
+++ b/contrib/subversion/subversion/libsvn_subr/string.c
@@ -677,7 +677,7 @@ svn_stringbuf_remove(svn_stringbuf_t *str,
{
if (pos > str->len)
pos = str->len;
- if (pos + count > str->len)
+ if (count > str->len - pos)
count = str->len - pos;
memmove(str->data + pos, str->data + pos + count, str->len - pos - count + 1);
@@ -705,7 +705,7 @@ svn_stringbuf_replace(svn_stringbuf_t *str,
if (pos > str->len)
pos = str->len;
- if (pos + old_count > str->len)
+ if (old_count > str->len - pos)
old_count = str->len - pos;
if (old_count < new_count)
diff --git a/contrib/subversion/subversion/libsvn_subr/utf_validate.c b/contrib/subversion/subversion/libsvn_subr/utf_validate.c
index 90e529e..0aab81c 100644
--- a/contrib/subversion/subversion/libsvn_subr/utf_validate.c
+++ b/contrib/subversion/subversion/libsvn_subr/utf_validate.c
@@ -258,24 +258,7 @@ static const char machine [9][14] = {
static const char *
first_non_fsm_start_char(const char *data, apr_size_t max_len)
{
-#if !SVN_UNALIGNED_ACCESS_IS_OK
-
- /* On some systems, we need to make sure that buf is properly aligned
- * for chunky data access.
- */
- if ((apr_uintptr_t)data & (sizeof(apr_uintptr_t)-1))
- {
- apr_size_t len = (~(apr_uintptr_t)data) & (sizeof(apr_uintptr_t)-1);
- if (len > max_len)
- len = max_len;
- max_len -= len;
-
- for (; len > 0; ++data, --len)
- if ((unsigned char)*data >= 0x80)
- return data;
- }
-
-#endif
+#if SVN_UNALIGNED_ACCESS_IS_OK
/* Scan the input one machine word at a time. */
for (; max_len > sizeof(apr_uintptr_t)
@@ -283,55 +266,11 @@ first_non_fsm_start_char(const char *data, apr_size_t max_len)
if (*(const apr_uintptr_t *)data & SVN__BIT_7_SET)
break;
- /* The remaining odd bytes will be examined the naive way: */
- for (; max_len > 0; ++data, --max_len)
- if ((unsigned char)*data >= 0x80)
- break;
-
- return data;
-}
-
-/* Scan the C string in *DATA for chars that are not in the octet
- * category 0 (FSM_START). Return the position of either the such
- * char or of the terminating NUL.
- */
-static const char *
-first_non_fsm_start_char_cstring(const char *data)
-{
- /* We need to make sure that BUF is properly aligned for chunky data
- * access because we don't know the string's length. Unaligned chunk
- * read access beyond the NUL terminator could therefore result in a
- * segfault.
- */
- for (; (apr_uintptr_t)data & (sizeof(apr_uintptr_t)-1); ++data)
- if (*data == 0 || (unsigned char)*data >= 0x80)
- return data;
-
- /* Scan the input one machine word at a time. */
-#ifndef SVN_UTF_NO_UNINITIALISED_ACCESS
- /* This may read allocated but uninitialised bytes beyond the
- terminating null. Any such bytes are always readable and this
- code operates correctly whatever the uninitialised values happen
- to be. However memory checking tools such as valgrind and GCC
- 4.8's address santitizer will object so this bit of code can be
- disabled at compile time. */
- for (; ; data += sizeof(apr_uintptr_t))
- {
- /* Check for non-ASCII chars: */
- apr_uintptr_t chunk = *(const apr_uintptr_t *)data;
- if (chunk & SVN__BIT_7_SET)
- break;
-
- /* This is the well-known strlen test: */
- chunk |= (chunk & SVN__LOWER_7BITS_SET) + SVN__LOWER_7BITS_SET;
- if ((chunk & SVN__BIT_7_SET) != SVN__BIT_7_SET)
- break;
- }
#endif
/* The remaining odd bytes will be examined the naive way: */
- for (; ; ++data)
- if (*data == 0 || (unsigned char)*data >= 0x80)
+ for (; max_len > 0; ++data, --max_len)
+ if ((unsigned char)*data >= 0x80)
break;
return data;
@@ -359,20 +298,10 @@ svn_utf__last_valid(const char *data, apr_size_t len)
svn_boolean_t
svn_utf__cstring_is_valid(const char *data)
{
- int state = FSM_START;
-
if (!data)
return FALSE;
- data = first_non_fsm_start_char_cstring(data);
-
- while (*data)
- {
- unsigned char octet = *data++;
- int category = octet_category[octet];
- state = machine[state][category];
- }
- return state == FSM_START;
+ return svn_utf__is_valid(data, strlen(data));
}
svn_boolean_t
diff --git a/contrib/subversion/subversion/libsvn_subr/version.c b/contrib/subversion/subversion/libsvn_subr/version.c
index 4a5ab68..070808a 100644
--- a/contrib/subversion/subversion/libsvn_subr/version.c
+++ b/contrib/subversion/subversion/libsvn_subr/version.c
@@ -136,7 +136,7 @@ svn_version_extended(svn_boolean_t verbose,
info->build_time = NULL;
info->build_host = SVN_BUILD_HOST;
info->copyright = apr_pstrdup
- (pool, _("Copyright (C) 2015 The Apache Software Foundation.\n"
+ (pool, _("Copyright (C) 2016 The Apache Software Foundation.\n"
"This software consists of contributions made by many people;\n"
"see the NOTICE file for more information.\n"
"Subversion is open source software, see "
diff --git a/contrib/subversion/subversion/libsvn_wc/deprecated.c b/contrib/subversion/subversion/libsvn_wc/deprecated.c
index e6db568..dcb5e42 100644
--- a/contrib/subversion/subversion/libsvn_wc/deprecated.c
+++ b/contrib/subversion/subversion/libsvn_wc/deprecated.c
@@ -2051,7 +2051,7 @@ svn_wc_get_diff_editor6(const svn_delta_editor_t **editor,
wc_ctx,
anchor_abspath, target,
depth,
- use_git_diff_format, use_text_base,
+ ignore_ancestry, use_text_base,
reverse_order, server_performs_filtering,
changelist_filter,
diff_processor,
diff --git a/contrib/subversion/subversion/libsvn_wc/wc-checks.h b/contrib/subversion/subversion/libsvn_wc/wc-checks.h
index 5888626..35f1533 100644
--- a/contrib/subversion/subversion/libsvn_wc/wc-checks.h
+++ b/contrib/subversion/subversion/libsvn_wc/wc-checks.h
@@ -1,4 +1,4 @@
-/* This file is automatically generated from wc-checks.sql and .dist_sandbox/subversion-1.9.2/subversion/libsvn_wc/token-map.h.
+/* This file is automatically generated from wc-checks.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_wc/token-map.h.
* Do not edit this file -- edit the source and rerun gen-make.py */
#define STMT_VERIFICATION_TRIGGERS 0
diff --git a/contrib/subversion/subversion/libsvn_wc/wc-metadata.h b/contrib/subversion/subversion/libsvn_wc/wc-metadata.h
index 8367adc..7b74d83 100644
--- a/contrib/subversion/subversion/libsvn_wc/wc-metadata.h
+++ b/contrib/subversion/subversion/libsvn_wc/wc-metadata.h
@@ -1,4 +1,4 @@
-/* This file is automatically generated from wc-metadata.sql and .dist_sandbox/subversion-1.9.2/subversion/libsvn_wc/token-map.h.
+/* This file is automatically generated from wc-metadata.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_wc/token-map.h.
* Do not edit this file -- edit the source and rerun gen-make.py */
#define STMT_CREATE_SCHEMA 0
diff --git a/contrib/subversion/subversion/libsvn_wc/wc-queries.h b/contrib/subversion/subversion/libsvn_wc/wc-queries.h
index 523a6a1..ad5ccb57 100644
--- a/contrib/subversion/subversion/libsvn_wc/wc-queries.h
+++ b/contrib/subversion/subversion/libsvn_wc/wc-queries.h
@@ -1,4 +1,4 @@
-/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.9.2/subversion/libsvn_wc/token-map.h.
+/* This file is automatically generated from wc-queries.sql and .dist_sandbox/subversion-1.9.4/subversion/libsvn_wc/token-map.h.
* Do not edit this file -- edit the source and rerun gen-make.py */
#define STMT_SELECT_NODE_INFO 0
@@ -1623,7 +1623,8 @@
#define STMT_PRAGMA_LOCKING_MODE 151
#define STMT_151_INFO {"STMT_PRAGMA_LOCKING_MODE", NULL}
#define STMT_151 \
- "PRAGMA locking_mode = exclusive " \
+ "PRAGMA locking_mode = exclusive; " \
+ "PRAGMA journal_mode = DELETE " \
""
#define STMT_INSERT_ACTUAL_NODE 152
diff --git a/contrib/subversion/subversion/libsvn_wc/wc-queries.sql b/contrib/subversion/subversion/libsvn_wc/wc-queries.sql
index 5d8dbe3..3a8bf92 100644
--- a/contrib/subversion/subversion/libsvn_wc/wc-queries.sql
+++ b/contrib/subversion/subversion/libsvn_wc/wc-queries.sql
@@ -1286,7 +1286,10 @@ WHERE (wc_id = ?1 AND local_relpath = ?2)
OR (wc_id = ?1 AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
-- STMT_PRAGMA_LOCKING_MODE
-PRAGMA locking_mode = exclusive
+PRAGMA locking_mode = exclusive;
+/* Testing shows DELETE is faster than TRUNCATE on NFS and
+ exclusive-locking is mostly used on remote file systems. */
+PRAGMA journal_mode = DELETE
/* ------------------------------------------------------------------------- */
diff --git a/contrib/subversion/subversion/libsvn_wc/wc_db_pristine.c b/contrib/subversion/subversion/libsvn_wc/wc_db_pristine.c
index bdfd46a..9118d70 100644
--- a/contrib/subversion/subversion/libsvn_wc/wc_db_pristine.c
+++ b/contrib/subversion/subversion/libsvn_wc/wc_db_pristine.c
@@ -870,6 +870,7 @@ pristine_cleanup_wcroot(svn_wc__db_wcroot_t *wcroot,
{
svn_sqlite__stmt_t *stmt;
svn_error_t *err = NULL;
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
/* Find each unreferenced pristine in the DB and remove it. */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -879,16 +880,20 @@ pristine_cleanup_wcroot(svn_wc__db_wcroot_t *wcroot,
svn_boolean_t have_row;
const svn_checksum_t *sha1_checksum;
+ svn_pool_clear(iterpool);
+
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (! have_row)
break;
SVN_ERR(svn_sqlite__column_checksum(&sha1_checksum, stmt, 0,
- scratch_pool));
+ iterpool));
err = pristine_remove_if_unreferenced(wcroot, sha1_checksum,
- scratch_pool);
+ iterpool);
}
+ svn_pool_destroy(iterpool);
+
return svn_error_trace(
svn_error_compose_create(err, svn_sqlite__reset(stmt)));
}
diff --git a/contrib/subversion/subversion/svn/conflict-callbacks.c b/contrib/subversion/subversion/svn/conflict-callbacks.c
index 356f59d..a9cb39a 100644
--- a/contrib/subversion/subversion/svn/conflict-callbacks.c
+++ b/contrib/subversion/subversion/svn/conflict-callbacks.c
@@ -775,7 +775,7 @@ handle_text_conflict(svn_wc_conflict_result_t *result,
}
else
{
- if (knows_something)
+ if (knows_something || desc->is_binary)
*next_option++ = "r";
/* The 'mine-full' option selects the ".mine" file so only offer
@@ -994,7 +994,7 @@ handle_text_conflict(svn_wc_conflict_result_t *result,
the file if they've edited it, or at least looked at
the diff. */
if (opt->choice == svn_wc_conflict_choose_merged
- && ! knows_something)
+ && ! knows_something && diff_allowed)
{
SVN_ERR(svn_cmdline_fprintf(
stderr, iterpool,
diff --git a/contrib/subversion/subversion/svn/diff-cmd.c b/contrib/subversion/subversion/svn/diff-cmd.c
index 7a84736..71853c7 100644
--- a/contrib/subversion/subversion/svn/diff-cmd.c
+++ b/contrib/subversion/subversion/svn/diff-cmd.c
@@ -82,6 +82,7 @@ kind_to_word(svn_client_diff_summarize_kind_t kind)
struct summarize_baton_t
{
const char *anchor;
+ svn_boolean_t ignore_properties;
};
/* Print summary information about a given change as XML, implements the
@@ -98,6 +99,11 @@ summarize_xml(const svn_client_diff_summarize_t *summary,
* baton, and appending the target's relative path. */
const char *path = b->anchor;
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool);
+ const char *prop_change;
+
+ if (b->ignore_properties &&
+ summary->summarize_kind == svn_client_diff_summarize_kind_normal)
+ return SVN_NO_ERROR;
/* Tack on the target path, so we can differentiate between different parts
* of the output when we're given multiple targets. */
@@ -114,10 +120,14 @@ summarize_xml(const svn_client_diff_summarize_t *summary,
path = svn_dirent_local_style(path, pool);
}
+ prop_change = summary->prop_changed ? "modified" : "none";
+ if (b->ignore_properties)
+ prop_change = "none";
+
svn_xml_make_open_tag(&sb, pool, svn_xml_protect_pcdata, "path",
"kind", svn_cl__node_kind_str_xml(summary->node_kind),
"item", kind_to_word(summary->summarize_kind),
- "props", summary->prop_changed ? "modified" : "none",
+ "props", prop_change,
SVN_VA_NULL);
svn_xml_escape_cdata_cstring(&sb, path, pool);
@@ -135,6 +145,11 @@ summarize_regular(const svn_client_diff_summarize_t *summary,
{
struct summarize_baton_t *b = baton;
const char *path = b->anchor;
+ char prop_change;
+
+ if (b->ignore_properties &&
+ summary->summarize_kind == svn_client_diff_summarize_kind_normal)
+ return SVN_NO_ERROR;
/* Tack on the target path, so we can differentiate between different parts
* of the output when we're given multiple targets. */
@@ -155,11 +170,13 @@ summarize_regular(const svn_client_diff_summarize_t *summary,
* thus the blank spaces where information that is not relevant to
* a diff summary would go. */
- SVN_ERR(svn_cmdline_printf(pool,
- "%c%c %s\n",
+ prop_change = summary->prop_changed ? 'M' : ' ';
+ if (b->ignore_properties)
+ prop_change = ' ';
+
+ SVN_ERR(svn_cmdline_printf(pool, "%c%c %s\n",
kind_to_char(summary->summarize_kind),
- summary->prop_changed ? 'M' : ' ',
- path));
+ prop_change, path));
return svn_cmdline_fflush(stdout);
}
@@ -395,6 +412,7 @@ svn_cl__diff(apr_getopt_t *os,
if (opt_state->diff.summarize)
{
summarize_baton.anchor = target1;
+ summarize_baton.ignore_properties = ignore_properties;
SVN_ERR(svn_client_diff_summarize2(
target1,
@@ -447,6 +465,7 @@ svn_cl__diff(apr_getopt_t *os,
if (opt_state->diff.summarize)
{
summarize_baton.anchor = truepath;
+ summarize_baton.ignore_properties = ignore_properties;
SVN_ERR(svn_client_diff_summarize_peg2(
truepath,
&peg_revision,
diff --git a/contrib/subversion/subversion/svn/lock-cmd.c b/contrib/subversion/subversion/svn/lock-cmd.c
index c2795da..e527ff8 100644
--- a/contrib/subversion/subversion/svn/lock-cmd.c
+++ b/contrib/subversion/subversion/svn/lock-cmd.c
@@ -80,6 +80,29 @@ get_comment(const char **comment, svn_client_ctx_t *ctx,
return SVN_NO_ERROR;
}
+/* Baton for notify_lock_handler */
+struct notify_lock_baton_t
+{
+ void *inner_baton;
+ svn_wc_notify_func2_t inner_notify;
+ svn_boolean_t had_failure;
+};
+
+/* Implements svn_wc_notify_func2_t for svn_cl__lock */
+static void
+notify_lock_handler(void *baton,
+ const svn_wc_notify_t *notify,
+ apr_pool_t *scratch_pool)
+{
+ struct notify_lock_baton_t *nlb = baton;
+
+ if (notify->action == svn_wc_notify_failed_lock)
+ nlb->had_failure = TRUE;
+
+ if (nlb->inner_notify)
+ nlb->inner_notify(nlb->inner_baton, notify, scratch_pool);
+}
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__lock(apr_getopt_t *os,
@@ -90,6 +113,7 @@ svn_cl__lock(apr_getopt_t *os,
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
apr_array_header_t *targets;
const char *comment;
+ struct notify_lock_baton_t nlb;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -106,5 +130,18 @@ svn_cl__lock(apr_getopt_t *os,
SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
- return svn_client_lock(targets, comment, opt_state->force, ctx, pool);
+ nlb.inner_notify = ctx->notify_func2;
+ nlb.inner_baton = ctx->notify_baton2;
+ nlb.had_failure = FALSE;
+
+ ctx->notify_func2 = notify_lock_handler;
+ ctx->notify_baton2 = &nlb;
+
+ SVN_ERR(svn_client_lock(targets, comment, opt_state->force, ctx, pool));
+
+ if (nlb.had_failure)
+ return svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("One or more locks could not be obtained"));
+
+ return SVN_NO_ERROR;
}
diff --git a/contrib/subversion/subversion/svn/unlock-cmd.c b/contrib/subversion/subversion/svn/unlock-cmd.c
index 0f94d2a..3818d1f 100644
--- a/contrib/subversion/subversion/svn/unlock-cmd.c
+++ b/contrib/subversion/subversion/svn/unlock-cmd.c
@@ -39,6 +39,29 @@
/*** Code. ***/
+/* Baton for notify_unlock_handler */
+struct notify_unlock_baton_t
+{
+ void *inner_baton;
+ svn_wc_notify_func2_t inner_notify;
+ svn_boolean_t had_failure;
+};
+
+/* Implements svn_wc_notify_func2_t for svn_cl__unlock */
+static void
+notify_unlock_handler(void *baton,
+ const svn_wc_notify_t *notify,
+ apr_pool_t *scratch_pool)
+{
+ struct notify_unlock_baton_t *nub = baton;
+
+ if (notify->action == svn_wc_notify_failed_unlock)
+ nub->had_failure = TRUE;
+
+ if (nub->inner_notify)
+ nub->inner_notify(nub->inner_baton, notify, scratch_pool);
+}
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
@@ -49,6 +72,7 @@ svn_cl__unlock(apr_getopt_t *os,
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
apr_array_header_t *targets;
+ struct notify_unlock_baton_t nub;
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -63,6 +87,18 @@ svn_cl__unlock(apr_getopt_t *os,
SVN_ERR(svn_cl__assert_homogeneous_target_type(targets));
- return svn_error_trace(
- svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
+ nub.inner_notify = ctx->notify_func2;
+ nub.inner_baton = ctx->notify_baton2;
+ nub.had_failure = FALSE;
+
+ ctx->notify_func2 = notify_unlock_handler;
+ ctx->notify_baton2 = &nub;
+
+ SVN_ERR(svn_client_unlock(targets, opt_state->force, ctx, scratch_pool));
+
+ if (nub.had_failure)
+ return svn_error_create(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("One or more locks could not be released"));
+
+ return SVN_NO_ERROR;
}
diff --git a/contrib/subversion/subversion/svnlook/svnlook.c b/contrib/subversion/subversion/svnlook/svnlook.c
index e06933f..53ff297 100644
--- a/contrib/subversion/subversion/svnlook/svnlook.c
+++ b/contrib/subversion/subversion/svnlook/svnlook.c
@@ -674,7 +674,8 @@ dump_contents(svn_stream_t *stream,
non-textual data -- in this case, the *IS_BINARY flag is set and no
temporary files are created.
- Use POOL for all that allocation goodness. */
+ TMPFILE1 and TMPFILE2 will be removed when RESULT_POOL is destroyed.
+ */
static svn_error_t *
prepare_tmpfiles(const char **tmpfile1,
const char **tmpfile2,
@@ -683,8 +684,8 @@ prepare_tmpfiles(const char **tmpfile1,
const char *path1,
svn_fs_root_t *root2,
const char *path2,
- const char *tmpdir,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_string_t *mimetype;
svn_stream_t *stream;
@@ -701,7 +702,7 @@ prepare_tmpfiles(const char **tmpfile1,
if (root1)
{
SVN_ERR(svn_fs_node_prop(&mimetype, root1, path1,
- SVN_PROP_MIME_TYPE, pool));
+ SVN_PROP_MIME_TYPE, scratch_pool));
if (mimetype && svn_mime_type_is_binary(mimetype->data))
{
*is_binary = TRUE;
@@ -711,7 +712,7 @@ prepare_tmpfiles(const char **tmpfile1,
if (root2)
{
SVN_ERR(svn_fs_node_prop(&mimetype, root2, path2,
- SVN_PROP_MIME_TYPE, pool));
+ SVN_PROP_MIME_TYPE, scratch_pool));
if (mimetype && svn_mime_type_is_binary(mimetype->data))
{
*is_binary = TRUE;
@@ -721,17 +722,15 @@ prepare_tmpfiles(const char **tmpfile1,
/* Now, prepare the two temporary files, each of which will either
be empty, or will have real contents. */
- SVN_ERR(svn_stream_open_unique(&stream, tmpfile1,
- tmpdir,
- svn_io_file_del_none,
- pool, pool));
- SVN_ERR(dump_contents(stream, root1, path1, pool));
-
- SVN_ERR(svn_stream_open_unique(&stream, tmpfile2,
- tmpdir,
- svn_io_file_del_none,
- pool, pool));
- SVN_ERR(dump_contents(stream, root2, path2, pool));
+ SVN_ERR(svn_stream_open_unique(&stream, tmpfile1, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, scratch_pool));
+ SVN_ERR(dump_contents(stream, root1, path1, scratch_pool));
+
+ SVN_ERR(svn_stream_open_unique(&stream, tmpfile2, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, scratch_pool));
+ SVN_ERR(dump_contents(stream, root2, path2, scratch_pool));
return SVN_NO_ERROR;
}
@@ -830,7 +829,6 @@ print_diff_tree(svn_stream_t *out_stream,
const char *path /* UTF-8! */,
const char *base_path /* UTF-8! */,
const svnlook_ctxt_t *c,
- const char *tmpdir,
apr_pool_t *pool)
{
const char *orig_path = NULL, *new_path = NULL;
@@ -839,7 +837,7 @@ print_diff_tree(svn_stream_t *out_stream,
svn_boolean_t is_copy = FALSE;
svn_boolean_t binary = FALSE;
svn_boolean_t diff_header_printed = FALSE;
- apr_pool_t *subpool;
+ apr_pool_t *iterpool;
svn_stringbuf_t *header;
SVN_ERR(check_cancel(NULL));
@@ -900,7 +898,7 @@ print_diff_tree(svn_stream_t *out_stream,
do_diff = TRUE;
SVN_ERR(prepare_tmpfiles(&orig_path, &new_path, &binary,
base_root, base_path, root, path,
- tmpdir, pool));
+ pool, pool));
}
else if (c->diff_copy_from && node->action == 'A' && is_copy)
{
@@ -909,7 +907,7 @@ print_diff_tree(svn_stream_t *out_stream,
do_diff = TRUE;
SVN_ERR(prepare_tmpfiles(&orig_path, &new_path, &binary,
base_root, base_path, root, path,
- tmpdir, pool));
+ pool, pool));
}
}
else if (! c->no_diff_added && node->action == 'A')
@@ -918,14 +916,14 @@ print_diff_tree(svn_stream_t *out_stream,
orig_empty = TRUE;
SVN_ERR(prepare_tmpfiles(&orig_path, &new_path, &binary,
NULL, base_path, root, path,
- tmpdir, pool));
+ pool, pool));
}
else if (! c->no_diff_deleted && node->action == 'D')
{
do_diff = TRUE;
SVN_ERR(prepare_tmpfiles(&orig_path, &new_path, &binary,
base_root, base_path, NULL, path,
- tmpdir, pool));
+ pool, pool));
}
/* The header for the copy case has already been created, and we don't
@@ -1091,12 +1089,6 @@ print_diff_tree(svn_stream_t *out_stream,
}
}
- /* Make sure we delete any temporary files. */
- if (orig_path)
- SVN_ERR(svn_io_remove_file2(orig_path, FALSE, pool));
- if (new_path)
- SVN_ERR(svn_io_remove_file2(new_path, FALSE, pool));
-
/*** Now handle property diffs ***/
if ((node->prop_mod) && (node->action != 'D') && (! c->ignore_properties))
{
@@ -1143,26 +1135,21 @@ print_diff_tree(svn_stream_t *out_stream,
}
/* Return here if the node has no children. */
- node = node->child;
- if (! node)
+ if (! node->child)
return SVN_NO_ERROR;
/* Recursively handle the node's children. */
- subpool = svn_pool_create(pool);
- SVN_ERR(print_diff_tree(out_stream, encoding, root, base_root, node,
- svn_dirent_join(path, node->name, subpool),
- svn_dirent_join(base_path, node->name, subpool),
- c, tmpdir, subpool));
- while (node->sibling)
+ iterpool = svn_pool_create(pool);
+ for (node = node->child; node; node = node->sibling)
{
- svn_pool_clear(subpool);
- node = node->sibling;
+ svn_pool_clear(iterpool);
+
SVN_ERR(print_diff_tree(out_stream, encoding, root, base_root, node,
- svn_dirent_join(path, node->name, subpool),
- svn_dirent_join(base_path, node->name, subpool),
- c, tmpdir, subpool));
+ svn_dirent_join(path, node->name, iterpool),
+ svn_dirent_join(base_path, node->name, iterpool),
+ c, iterpool));
}
- svn_pool_destroy(subpool);
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -1525,12 +1512,10 @@ do_diff(svnlook_ctxt_t *c, apr_pool_t *pool)
SVN_ERR(generate_delta_tree(&tree, c->repos, root, base_rev_id, pool));
if (tree)
{
- const char *tmpdir;
svn_stream_t *out_stream;
const char *encoding = svn_cmdline_output_encoding(pool);
SVN_ERR(svn_fs_revision_root(&base_root, c->fs, base_rev_id, pool));
- SVN_ERR(svn_io_temp_dir(&tmpdir, pool));
/* This fflush() might seem odd, but it was added to deal
with this bug report:
@@ -1559,7 +1544,7 @@ do_diff(svnlook_ctxt_t *c, apr_pool_t *pool)
SVN_ERR(svn_stream_for_stdout(&out_stream, pool));
SVN_ERR(print_diff_tree(out_stream, encoding, root, base_root, tree,
- "", "", c, tmpdir, pool));
+ "", "", c, pool));
}
return SVN_NO_ERROR;
}
diff --git a/contrib/subversion/subversion/svnserve/cyrus_auth.c b/contrib/subversion/subversion/svnserve/cyrus_auth.c
index 98d9ced..40f4228 100644
--- a/contrib/subversion/subversion/svnserve/cyrus_auth.c
+++ b/contrib/subversion/subversion/svnserve/cyrus_auth.c
@@ -74,6 +74,8 @@ static int canonicalize_username(sasl_conn_t *conn,
{
/* The only valid realm is user_realm (i.e. the repository's realm).
If the user gave us another realm, complain. */
+ if (realm_len != inlen-(pos-in+1))
+ return SASL_BADPROT;
if (strncmp(pos+1, user_realm, inlen-(pos-in+1)) != 0)
return SASL_BADPROT;
}
diff --git a/contrib/subversion/win-tests.py b/contrib/subversion/win-tests.py
index 2057db5..9c9daa3 100644
--- a/contrib/subversion/win-tests.py
+++ b/contrib/subversion/win-tests.py
@@ -25,7 +25,7 @@ For a list of options, run this script with the --help option.
"""
# $HeadURL: http://svn.apache.org/repos/asf/subversion/branches/1.9.x/win-tests.py $
-# $LastChangedRevision: 1703828 $
+# $LastChangedRevision: 1718291 $
import os, sys, subprocess
import filecmp
@@ -226,7 +226,7 @@ for opt, val in opts:
enable_sasl = 1
base_url = "svn://localhost/"
elif opt == '--server-minor-version':
- server_minor_version = val
+ server_minor_version = int(val)
elif opt == '--bin':
svn_bin = val
elif opt in ('-p', '--parallel'):
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 0959c18..a48bcea 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -603,6 +603,7 @@ chkprintcap_enable="NO" # Run chkprintcap(8) before running lpd.
chkprintcap_flags="-d" # Create missing directories by default.
dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO).
dumpdir="/var/crash" # Directory where crash dumps are to be stored
+savecore_enable="YES" # Extract core from dump devices if any
savecore_flags="-m 10" # Used if dumpdev is enabled above, and present.
# By default, only the 10 most recent kernel dumps
# are saved.
diff --git a/etc/devd/usb.conf b/etc/devd/usb.conf
index 56f1a5f..45e28fe 100644
--- a/etc/devd/usb.conf
+++ b/etc/devd/usb.conf
@@ -1721,7 +1721,7 @@ nomatch 32 {
match "bus" "uhub[0-9]+";
match "mode" "host";
match "vendor" "0x07b8";
- match "product" "(0x8178|0x8188|0x8189)";
+ match "product" "(0x8178|0x8179|0x8188|0x8189)";
action "kldload -n if_urtwn";
};
@@ -3161,7 +3161,23 @@ nomatch 32 {
match "bus" "uhub[0-9]+";
match "mode" "host";
match "vendor" "0x0df6";
- match "product" "(0x0052|0x005c|0x0061)";
+ match "product" "0x0052";
+ action "kldload -n if_urtwn";
+};
+
+nomatch 32 {
+ match "bus" "uhub[0-9]+";
+ match "mode" "host";
+ match "vendor" "0x0df6";
+ match "product" "0x0056";
+ action "kldload -n if_axe";
+};
+
+nomatch 32 {
+ match "bus" "uhub[0-9]+";
+ match "mode" "host";
+ match "vendor" "0x0df6";
+ match "product" "(0x005c|0x0061)";
action "kldload -n if_urtwn";
};
@@ -4633,7 +4649,7 @@ nomatch 32 {
match "bus" "uhub[0-9]+";
match "mode" "host";
match "vendor" "0x17e9";
- match "product" "(0x0059|0x0100|0x0117|0x0136|0x0138|0x0141|0x015a|0x0198|0x019b|0x01ba|0x01bb|0x01d4|0x01d7|0x01e2|0x0215|0x024c|0x02a9|0x0377|0x03e0|0x401a)";
+ match "product" "(0x0059|0x0100|0x0117|0x0136|0x0138|0x0141|0x015a|0x0198|0x019b|0x01ba|0x01bb|0x01d4|0x01d7|0x01e2|0x0215|0x024c|0x02a9|0x02e9|0x0377|0x03e0|0x401a)";
action "kldload -n udl";
};
@@ -5801,5 +5817,5 @@ nomatch 32 {
action "kldload -n umass";
};
-# 2719 USB entries processed
+# 2722 USB entries processed
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index 6cbe422..4b3dce9 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -608,6 +608,8 @@
..
printf
..
+ sdiff
+ ..
sed
regress.multitest.out
..
diff --git a/etc/ntp/leap-seconds b/etc/ntp/leap-seconds
index 8fa6225..79d8e15 100644
--- a/etc/ntp/leap-seconds
+++ b/etc/ntp/leap-seconds
@@ -46,7 +46,7 @@
# by the International Bureau of Weights and Measures
# (BIPM). See www.bipm.fr for more information.
#
-# 3. The current defintion of the relationship between UTC
+# 3. The current definition of the relationship between UTC
# and TAI dates from 1 January 1972. A number of different
# time scales were in use before than epoch, and it can be
# quite difficult to compute precise timestamps and time
diff --git a/etc/protocols b/etc/protocols
index 20dd889..05702d4 100644
--- a/etc/protocols
+++ b/etc/protocols
@@ -43,7 +43,7 @@ merit-inp 32 MERIT-INP # MERIT Internodal Protocol
dccp 33 DCCP # Datagram Congestion Control Protocol
3pc 34 3PC # Third Party Connect Protocol
idpr 35 IDPR # Inter-Domain Policy Routing Protocol
-xtp 36 XTP # Xpress Tranfer Protocol
+xtp 36 XTP # Xpress Transfer Protocol
ddp 37 DDP # Datagram Delivery Protocol
idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto
tp++ 39 TP++ # TP++ Transport Protocol
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index 0784c3a..c34fd46 100644
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -295,7 +295,7 @@ FILESGROUPS+= SMRCD
SMRCD= sendmail
.endif
SMRCDDIR= /etc/rc.d
-SMRCDDIRMODE= ${BINMODE}
+SMRCDMODE= ${BINMODE}
SMRCDPACKAGE= sendmail
.if ${MK_TIMED} != "no"
diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS
index 7cd156a..1cf019a 100755
--- a/etc/rc.d/SERVERS
+++ b/etc/rc.d/SERVERS
@@ -4,7 +4,7 @@
#
# PROVIDE: SERVERS
-# REQUIRE: mountcritremote abi ldconfig savecore watchdogd kdc
+# REQUIRE: mountcritremote abi ldconfig savecore watchdogd
# This is a dummy dependency, for early-start servers relying on
# some basic configuration.
diff --git a/etc/rc.d/kdc b/etc/rc.d/kdc
index f85e5f4..c2747ae 100755
--- a/etc/rc.d/kdc
+++ b/etc/rc.d/kdc
@@ -5,6 +5,7 @@
# PROVIDE: kdc
# REQUIRE: NETWORKING
+# BEFORE: SERVERS
# KEYWORD: shutdown
. /etc/rc.subr
diff --git a/etc/rc.d/savecore b/etc/rc.d/savecore
index 56a34ff..bfc61bc 100755
--- a/etc/rc.d/savecore
+++ b/etc/rc.d/savecore
@@ -10,6 +10,7 @@
. /etc/rc.subr
name="savecore"
+rcvar="savecore_enable"
desc="Save a core dump of the operating system"
start_cmd="savecore_start"
start_precmd="savecore_prestart"
diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail
index 18b6b33..e228a0c 100755
--- a/etc/rc.d/sendmail
+++ b/etc/rc.d/sendmail
@@ -79,7 +79,7 @@ sendmail_cert_create()
crlnumber = \$dir/crlnumber # the current crl number
crl = \$dir/crl.pem # The current CRL
private_key = \$dir/cakey.pem
- x509_extensions = usr_cert # The extentions to add to the cert
+ x509_extensions = usr_cert # The extensions to add to the cert
name_opt = ca_default # Subject Name options
cert_opt = ca_default # Certificate field options
default_days = 365 # how long to certify for
@@ -100,7 +100,7 @@ sendmail_cert_create()
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
- x509_extensions = v3_ca # The extentions to add to the self signed cert
+ x509_extensions = v3_ca # The extensions to add to the self signed cert
string_mask = utf8only
prompt = no
[ req_distinguished_name ]
diff --git a/etc/rc.initdiskless b/etc/rc.initdiskless
index cfb9214..ae91f28 100644
--- a/etc/rc.initdiskless
+++ b/etc/rc.initdiskless
@@ -103,7 +103,7 @@
# will be created. In case of multiple entries for the same
# directory M, the last one in the scanning order is used.
# NOTE: If you only need to create a memory filesystem but not
-# initialize it from a template, it is preferrable to specify
+# initialize it from a template, it is preferable to specify
# it in fstab e.g. as "md /tmp mfs -s=30m,rw 0 0"
#
# /conf/T/SUBDIR.cpio.gz
diff --git a/gnu/lib/tests/Makefile b/gnu/lib/tests/Makefile
index 609357e..06058a0 100644
--- a/gnu/lib/tests/Makefile
+++ b/gnu/lib/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/gnu/tests/Makefile b/gnu/tests/Makefile
index 609357e..06058a0 100644
--- a/gnu/tests/Makefile
+++ b/gnu/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile
index 518000d..63cbd0b 100644
--- a/gnu/usr.bin/Makefile
+++ b/gnu/usr.bin/Makefile
@@ -13,7 +13,6 @@ SUBDIR= ${_binutils} \
grep \
${_groff} \
${_rcs} \
- sdiff \
${_tests}
SUBDIR_DEPEND_gdb= ${_binutils}
diff --git a/gnu/usr.bin/sdiff/Makefile b/gnu/usr.bin/sdiff/Makefile
deleted file mode 100644
index efadcf2..0000000
--- a/gnu/usr.bin/sdiff/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# $FreeBSD$
-
-DIFFSRC=${.CURDIR}/../../../contrib/diff/src
-.PATH: ${DIFFSRC} \
- ${.CURDIR}/../../../contrib/diff/lib \
- ${.CURDIR}/../../../contrib/diff/man
-
-PROG= sdiff
-SRCS= sdiff.c version-etc.c \
- error.c xmalloc.c c-stack.c basename.c strtoumax.c \
- exitfail.c
-
-# Important for ctype macros!
-CFLAGS+=-funsigned-char
-
-CFLAGS+=-I${.CURDIR}/../../../contrib/diff
-CFLAGS+=-I${.CURDIR}/../../../contrib/diff/src
-CFLAGS+=-I${.CURDIR}/../../../contrib/diff/lib
-CFLAGS+=-DHAVE_CONFIG_H
-CFLAGS+=-DDEFAULT_DIFF_PROGRAM=\"/usr/bin/diff\"
-
-.for f in sdiff.c
-${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff
- patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f}
-CLEANFILES+= ${f}
-.endfor
-
-.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/sdiff/Makefile.depend b/gnu/usr.bin/sdiff/Makefile.depend
deleted file mode 100644
index 3646e2e..0000000
--- a/gnu/usr.bin/sdiff/Makefile.depend
+++ /dev/null
@@ -1,18 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- gnu/lib/csu \
- gnu/lib/libgcc \
- include \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
diff --git a/gnu/usr.bin/sdiff/sdiff.c.diff b/gnu/usr.bin/sdiff/sdiff.c.diff
deleted file mode 100644
index bdb208b..0000000
--- a/gnu/usr.bin/sdiff/sdiff.c.diff
+++ /dev/null
@@ -1,11 +0,0 @@
-$FreeBSD$
---- sdiff.c.orig 2004-04-12 15:44:35.000000000 +0800
-+++ sdiff.c 2007-06-15 14:53:08.790433972 +0800
-@@ -455,7 +455,6 @@
- initialize_main (&argc, &argv);
- program_name = argv[0];
- setlocale (LC_ALL, "");
-- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
- c_stack_action (cleanup);
-
diff --git a/gnu/usr.bin/tests/Makefile b/gnu/usr.bin/tests/Makefile
index 609357e..06058a0 100644
--- a/gnu/usr.bin/tests/Makefile
+++ b/gnu/usr.bin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 448edd7..ef47b20 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -106,7 +106,7 @@ typedef enum __ns_sect {
} ns_sect;
/*%
- * Network name (compressed or not) type. Equivilent to a pointer when used
+ * Network name (compressed or not) type. Equivalent to a pointer when used
* in a function prototype. Can be const'd.
*/
typedef u_char ns_nname[NS_MAXNNAME];
diff --git a/include/rpcsvc/klm_prot.x b/include/rpcsvc/klm_prot.x
index e0dfa82..5860f32 100644
--- a/include/rpcsvc/klm_prot.x
+++ b/include/rpcsvc/klm_prot.x
@@ -34,7 +34,7 @@
* Copyright (C) 1986 Sun Microsystems, Inc.
*
* protocol used between the UNIX kernel (the "client") and the
- * local lock manager. The local lock manager is a deamon running
+ * local lock manager. The local lock manager is a daemon running
* above the kernel.
*/
diff --git a/lib/atf/libatf-c/tests/detail/Makefile b/lib/atf/libatf-c/tests/detail/Makefile
index 296d2dd..13f3819 100644
--- a/lib/atf/libatf-c/tests/detail/Makefile
+++ b/lib/atf/libatf-c/tests/detail/Makefile
@@ -2,8 +2,9 @@
.include <bsd.init.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/lib/atf/tests/Makefile b/lib/atf/tests/Makefile
index ee99804..44ed728 100644
--- a/lib/atf/tests/Makefile
+++ b/lib/atf/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTSDIR= ${TESTSBASE}/lib/atf
TESTS+= Kyuafile
diff --git a/lib/atf/tests/test-programs/Makefile b/lib/atf/tests/test-programs/Makefile
index 24f7b79..4d756cf 100644
--- a/lib/atf/tests/test-programs/Makefile
+++ b/lib/atf/tests/test-programs/Makefile
@@ -2,8 +2,9 @@
.include <bsd.init.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTSDIR= ${TESTSBASE}/lib/atf/test-programs
TESTS+= Kyuafile
diff --git a/lib/libc/amd64/string/strcmp.S b/lib/libc/amd64/string/strcmp.S
index 07009c1..787e1e0 100644
--- a/lib/libc/amd64/string/strcmp.S
+++ b/lib/libc/amd64/string/strcmp.S
@@ -29,7 +29,7 @@ ENTRY(strcmp)
jmp .Ldone
/*
- * Check whether s2 is aligned to a word boundry. If it is, we
+ * Check whether s2 is aligned to a word boundary. If it is, we
* can compare by words. Otherwise we have to compare by bytes.
*/
.Ls1aligned:
diff --git a/lib/libc/iconv/iconv-internal.h b/lib/libc/iconv/iconv-internal.h
index 9937f09..214a8ad 100644
--- a/lib/libc/iconv/iconv-internal.h
+++ b/lib/libc/iconv/iconv-internal.h
@@ -27,7 +27,7 @@
*/
/*
- * Interal prototypes for our back-end functions.
+ * Internal prototypes for our back-end functions.
*/
size_t __bsd___iconv(iconv_t, char **, size_t *, char **,
size_t *, __uint32_t, size_t *);
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index e83d13c..d0abfdf 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -28,7 +28,7 @@
*/
/*
- * This file defines compatiblity symbol versions for old system calls. It
+ * This file defines compatibility symbol versions for old system calls. It
* is included in all generated system call files.
*/
diff --git a/lib/libc/include/reentrant.h b/lib/libc/include/reentrant.h
index 22a2325..423c9f6 100644
--- a/lib/libc/include/reentrant.h
+++ b/lib/libc/include/reentrant.h
@@ -49,7 +49,7 @@
* One approach for thread safety is to provide discrete versions of the
* library: one thread safe, the other not. The disadvantage of this is
* that libc is rather large, and two copies of a library which are 99%+
- * identical is not an efficent use of resources.
+ * identical is not an efficient use of resources.
*
* Another approach is to provide a single thread safe library. However,
* it should not add significant run time or code size overhead to non-
diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c
index d0ed152..0236630 100644
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -322,7 +322,7 @@ _collate_lookup(struct xlocale_collate *table, const wchar_t *t, int *len,
*len = 1;
/*
- * Check for composites such as dipthongs that collate as a
+ * Check for composites such as diphthongs that collate as a
* single element (aka chains or collating-elements).
*/
if (((p2 = chainsearch(table, t, &l)) != NULL) &&
diff --git a/lib/libc/locale/nl_langinfo.c b/lib/libc/locale/nl_langinfo.c
index e3b370a..7f19a57 100644
--- a/lib/libc/locale/nl_langinfo.c
+++ b/lib/libc/locale/nl_langinfo.c
@@ -153,7 +153,7 @@ nl_langinfo_l(nl_item item, locale_t loc)
break;
/*
* YESSTR and NOSTR items marked with LEGACY are available, but not
- * recomended by SUSv2 to be used in portable applications since
+ * recommended by SUSv2 to be used in portable applications since
* they're subject to remove in future specification editions.
*/
case YESSTR: /* LEGACY */
diff --git a/lib/libc/nameser/ns_samedomain.c b/lib/libc/nameser/ns_samedomain.c
index 4470cd0..549b773 100644
--- a/lib/libc/nameser/ns_samedomain.c
+++ b/lib/libc/nameser/ns_samedomain.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
* Check whether a name belongs to a domain.
*
* Inputs:
- *\li a - the domain whose ancestory is being verified
+ *\li a - the domain whose ancestry is being verified
*\li b - the potential ancestor we're checking against
*
* Return:
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index c399b84..0f82fd3 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -472,7 +472,7 @@ getaddrinfo(const char *hostname, const char *servname,
/*
* RFC 3493: AI_ALL and AI_V4MAPPED are effective only against
* AF_INET6 query. They need to be ignored if specified in other
- * occassions.
+ * occasions.
*/
switch (pai->ai_flags & (AI_ALL | AI_V4MAPPED)) {
case AI_V4MAPPED:
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index 6bbe270..9286e39 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
static int gethostbyname_internal(const char *, int, struct hostent *, char *,
size_t, struct hostent **, int *, res_state);
-/* Host lookup order if nsswitch.conf is broken or nonexistant */
+/* Host lookup order if nsswitch.conf is broken or nonexistent */
static const ns_src default_src[] = {
{ NSSRC_FILES, NS_SUCCESS },
{ NSSRC_DNS, NS_SUCCESS },
diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c
index 4d2fb38..e08f891 100644
--- a/lib/libc/net/getnetnamadr.c
+++ b/lib/libc/net/getnetnamadr.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
#include "nscache.h"
#endif
-/* Network lookup order if nsswitch.conf is broken or nonexistant */
+/* Network lookup order if nsswitch.conf is broken or nonexistent */
static const ns_src default_src[] = {
{ NSSRC_FILES, NS_SUCCESS },
{ NSSRC_DNS, NS_SUCCESS },
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 0023eca..10f4c0e 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -239,8 +239,8 @@ getipnodebyname(const char *name, int af, int flags, int *errp)
/*
* TODO:
* Note that implementation dependent test for address
- * configuration should be done everytime called
- * (or apropriate interval),
+ * configuration should be done every time called
+ * (or appropriate interval),
* because addresses will be dynamically assigned or deleted.
*/
_close(s);
diff --git a/lib/libc/net/nscachedcli.c b/lib/libc/net/nscachedcli.c
index 2ceacb7..35dbe20 100644
--- a/lib/libc/net/nscachedcli.c
+++ b/lib/libc/net/nscachedcli.c
@@ -95,7 +95,7 @@ safe_write(struct cached_connection_ *connection, const void *data,
/*
* safe_read reads data from connection and tries to do it in the very safe
- * and stable way. It uses kevent to ensure, that the data are availabe for
+ * and stable way. It uses kevent to ensure, that the data are available for
* reading. If the amount of data to be read is too large, then they would
* be splitted.
*/
diff --git a/lib/libc/net/res_config.h b/lib/libc/net/res_config.h
index 05909bc..51b609b 100644
--- a/lib/libc/net/res_config.h
+++ b/lib/libc/net/res_config.h
@@ -2,5 +2,5 @@
#define DEBUG 1 /* enable debugging code (needed for dig) */
#define RESOLVSORT /* allow sorting of addresses in gethostbyname */
-#undef SUNSECURITY /* verify gethostbyaddr() calls - WE DONT NEED IT */
+#undef SUNSECURITY /* verify gethostbyaddr() calls - WE DON'T NEED IT */
#define MULTI_PTRS_ARE_ALIASES 1 /* fold multiple PTR records into aliases */
diff --git a/lib/libc/posix1e/acl_delete_entry.c b/lib/libc/posix1e/acl_delete_entry.c
index 09b4507..4564dde 100644
--- a/lib/libc/posix1e/acl_delete_entry.c
+++ b/lib/libc/posix1e/acl_delete_entry.c
@@ -111,7 +111,7 @@ acl_delete_entry(acl_t acl, acl_entry_t entry_d)
sizeof(struct acl_entry));
acl->ats_cur_entry = 0;
- /* Continue with the loop to remove all maching entries. */
+ /* Continue with the loop to remove all matching entries. */
found = 1;
} else
i++;
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c
index 9f5404c..00848cb 100644
--- a/lib/libc/posix1e/acl_support.c
+++ b/lib/libc/posix1e/acl_support.c
@@ -367,7 +367,7 @@ _posix1e_acl_add_entry(acl_t acl, acl_tag_t tag, uid_t id, acl_perm_t perm)
/*
* Convert "old" type - ACL_TYPE_{ACCESS,DEFAULT}_OLD - into its "new"
- * counterpart. It's neccessary for the old (pre-NFSv4 ACLs) binaries
+ * counterpart. It's necessary for the old (pre-NFSv4 ACLs) binaries
* to work with new libc and kernel. Fixing 'type' for old binaries with
* old libc and new kernel is being done by kern/vfs_acl.c:type_unold().
*/
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 2f2d827..aa9ca9e 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -578,7 +578,7 @@ p_simp_re(struct parse *p,
sopno subno;
# define BACKSL (1<<CHAR_BIT)
- pos = HERE(); /* repetion op, if any, covers from here */
+ pos = HERE(); /* repetition op, if any, covers from here */
assert(MORE()); /* caller should have ensured this */
c = GETNEXT();
diff --git a/lib/libc/resolv/res_comp.c b/lib/libc/resolv/res_comp.c
index d82ef80..514a524 100644
--- a/lib/libc/resolv/res_comp.c
+++ b/lib/libc/resolv/res_comp.c
@@ -85,7 +85,7 @@ __FBSDID("$FreeBSD$");
/*%
* Expand compressed domain name 'src' to full domain name.
*
- * \li 'msg' is a pointer to the begining of the message,
+ * \li 'msg' is a pointer to the beginning of the message,
* \li 'eom' points to the first location after the message,
* \li 'dst' is a pointer to a buffer of size 'dstsiz' for the result.
* \li Return size of compressed name or -1 if there was an error.
diff --git a/lib/libc/resolv/res_findzonecut.c b/lib/libc/resolv/res_findzonecut.c
index 92ed5a3..515be11 100644
--- a/lib/libc/resolv/res_findzonecut.c
+++ b/lib/libc/resolv/res_findzonecut.c
@@ -119,7 +119,7 @@ static void res_dprintf(const char *, ...) ISC_FORMAT_PRINTF(1, 2);
* notes:
*\li this function calls res_nsend() which means it depends on correctly
* functioning recursive nameservers (usually defined in /etc/resolv.conf
- * or its local equivilent).
+ * or its local equivalent).
*
*\li we start by asking for an SOA<dname,class>. if we get one as an
* answer, that just means <dname,class> is a zone top, which is fine.
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index 1e7d9fe..8b58559 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -144,7 +144,7 @@ static u_int32_t net_mask(struct in_addr);
* there will have precedence. Otherwise, the server address is set to
* INADDR_ANY and the default domain name comes from the gethostname().
*
- * An interrim version of this code (BIND 4.9, pre-4.4BSD) used 127.0.0.1
+ * An interim version of this code (BIND 4.9, pre-4.4BSD) used 127.0.0.1
* rather than INADDR_ANY ("0.0.0.0") as the default name server address
* since it was noted that INADDR_ANY actually meant ``the first interface
* you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface,
@@ -167,7 +167,7 @@ res_ninit(res_state statp) {
return (__res_vinit(statp, 0));
}
-/*% This function has to be reachable by res_data.c but not publically. */
+/*% This function has to be reachable by res_data.c but not publicly. */
int
__res_vinit(res_state statp, int preinit) {
FILE *fp;
diff --git a/lib/libc/rpc/README b/lib/libc/rpc/README
index c915fad..129fe00 100644
--- a/lib/libc/rpc/README
+++ b/lib/libc/rpc/README
@@ -72,7 +72,7 @@ WHAT'S NEW IN THIS RELEASE: TIRPCSRC 2.3
The previous release was TIRPCSRC 2.0.
1. This release is based on Solaris 2.3. The previous release was
- based on Solaris 2.0. This release contains a siginificant number of
+ based on Solaris 2.0. This release contains a significant number of
bug fixes and other enhancements over TIRPCSRC 2.0.
2. The RPC library is thread safe for all client-side interfaces
diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c
index 274a255..3967773 100644
--- a/lib/libc/rpc/clnt_dg.c
+++ b/lib/libc/rpc/clnt_dg.c
@@ -582,7 +582,7 @@ get_reply:
}
} /* end successful completion */
/*
- * If unsuccesful AND error is an authentication error
+ * If unsuccessful AND error is an authentication error
* then refresh credentials and try again, else break
*/
else if (cu->cu_error.re_status == RPC_AUTHERROR)
@@ -742,7 +742,7 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
/*
* This RELIES on the information that, in the call body,
* the version number field is the fifth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
*(u_int32_t *)info =
@@ -759,7 +759,7 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
/*
* This RELIES on the information that, in the call body,
* the program number field is the fourth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
*(u_int32_t *)info =
diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c
index 8673a2b..1bc1500 100644
--- a/lib/libc/rpc/clnt_vc.c
+++ b/lib/libc/rpc/clnt_vc.c
@@ -601,7 +601,7 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
/*
* This RELIES on the information that, in the call body,
* the version number field is the fifth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
@@ -615,7 +615,7 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
/*
* This RELIES on the information that, in the call body,
* the program number field is the fourth field from the
- * begining of the RPC header. MUST be changed if the
+ * beginning of the RPC header. MUST be changed if the
* call_struct is changed
*/
ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
diff --git a/lib/libc/rpc/getnetconfig.c b/lib/libc/rpc/getnetconfig.c
index 6d668bf..8d7bdf3 100644
--- a/lib/libc/rpc/getnetconfig.c
+++ b/lib/libc/rpc/getnetconfig.c
@@ -405,7 +405,7 @@ endnetconfig(void *handlep)
}
/*
- * Noone needs these entries anymore, then frees them.
+ * No one needs these entries anymore, then frees them.
* Make sure all info in netconfig_info structure has been reinitialized.
*/
q = ni.head;
diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c
index d68fa9f..507d2e2 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
* The services list
* Each entry represents a set of procedures (an rpc program).
* The dispatch routine takes request structs and runs the
- * apropriate procedure.
+ * appropriate procedure.
*/
static struct svc_callout {
struct svc_callout *sc_next;
diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c
index 1c60950..46ada77 100644
--- a/lib/libc/rpc/svc_simple.c
+++ b/lib/libc/rpc/svc_simple.c
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
/*
* This interface creates a virtual listener for all the services
- * started thru rpc_reg(). It listens on the same endpoint for
+ * started through rpc_reg(). It listens on the same endpoint for
* all the services and then executes the corresponding service
* for the given prognum and procnum.
*/
@@ -229,7 +229,7 @@ rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
mutex_unlock(&proglst_lock);
if (done == FALSE) {
- warnx("%s cant find suitable transport for %s",
+ warnx("%s can't find suitable transport for %s",
rpc_reg_msg, nettype);
return (-1);
}
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c
index 0f1c5bf..936e2a1 100644
--- a/lib/libc/rpc/svc_vc.c
+++ b/lib/libc/rpc/svc_vc.c
@@ -262,7 +262,7 @@ makefd_xprt(int fd, u_int sendsize, u_int recvsize)
xprt, read_vc, write_vc);
xprt->xp_p1 = cd;
xprt->xp_verf.oa_base = cd->verf_body;
- svc_vc_ops(xprt); /* truely deals with calls */
+ svc_vc_ops(xprt); /* truly deals with calls */
xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
xprt->xp_fd = fd;
if (__rpc_fd2sockinfo(fd, &si) && __rpc_sockinfo2netid(&si, &netid))
diff --git a/lib/libc/sparc64/fpu/fpu_reg.h b/lib/libc/sparc64/fpu/fpu_reg.h
index b8b7229..8798d60 100644
--- a/lib/libc/sparc64/fpu/fpu_reg.h
+++ b/lib/libc/sparc64/fpu/fpu_reg.h
@@ -51,7 +51,7 @@ typedef void (fp_ldst64_fn)(u_int64_t *);
/*
* These are the functions that are actually used in the fpu emulation code to
* access the fp registers. They are usually not used more than once, so
- * cacheing needs not be done here.
+ * caching needs not be done here.
*/
static __inline u_int32_t
__fpu_getreg(int r)
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index b537263..e94e3bd 100644
--- a/lib/libc/stdio/vfscanf.c
+++ b/lib/libc/stdio/vfscanf.c
@@ -864,7 +864,7 @@ doswitch:
* z', but treats `a-a' as `the letter a, the
* character -, and the letter a'.
*
- * For compatibility, the `-' is not considerd
+ * For compatibility, the `-' is not considered
* to define a range if the character following
* it is either a close bracket (required by ANSI)
* or is not numerically greater than the character
diff --git a/lib/libc/stdlib/heapsort.c b/lib/libc/stdlib/heapsort.c
index a7a4a26..db0a953 100644
--- a/lib/libc/stdlib/heapsort.c
+++ b/lib/libc/stdlib/heapsort.c
@@ -102,7 +102,7 @@ typedef DECLARE_BLOCK(int, heapsort_block, const void *, const void *);
* Select the top of the heap and 'heapify'. Since by far the most expensive
* action is the call to the compar function, a considerable optimization
* in the average case can be achieved due to the fact that k, the displaced
- * elememt, is ususally quite small, so it would be preferable to first
+ * elememt, is usually quite small, so it would be preferable to first
* heapify, always maintaining the invariant that the larger child is copied
* over its parent's record.
*
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
index 689c78b..af038fe 100644
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
#define SIGN_POSN_USED 0x02 /* '+' or '(' usage flag */
#define LOCALE_POSN 0x04 /* use locale defined +/- (default) */
#define PARENTH_POSN 0x08 /* enclose negative amount in () */
-#define SUPRESS_CURR_SYMBOL 0x10 /* supress the currency from output */
+#define SUPRESS_CURR_SYMBOL 0x10 /* suppress the currency from output */
#define LEFT_JUSTIFY 0x20 /* left justify */
#define USE_INTL_CURRENCY 0x40 /* use international currency symbol */
#define IS_NEGATIVE 0x80 /* is argument value negative ? */
@@ -580,7 +580,7 @@ __format_grouped_double(double value, int *flags,
}
bufend = rslt + bufsize - 1; /* reserve space for trailing '\0' */
- /* skip spaces at beggining */
+ /* skip spaces at beginning */
padded = 0;
while (avalue[padded] == ' ') {
padded++;
diff --git a/lib/libc/string/wcscoll.c b/lib/libc/string/wcscoll.c
index ee0e72a..a3e959d 100644
--- a/lib/libc/string/wcscoll.c
+++ b/lib/libc/string/wcscoll.c
@@ -65,7 +65,7 @@ wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t locale)
* safely. You absolutely have to run this pass by pass,
* because some passes will be ignored for a given character,
* while others will not. Simpler locales will benefit from
- * having fewer passes, and most comparisions should resolve
+ * having fewer passes, and most comparisons should resolve
* during the primary pass anyway.
*
* Note that we do one final extra pass at the end to pick
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
index ca94852..221f451 100644
--- a/lib/libc/sys/kqueue.2
+++ b/lib/libc/sys/kqueue.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 4, 2015
+.Dd May 2, 2016
.Dt KQUEUE 2
.Os
.Sh NAME
@@ -376,11 +376,21 @@ was called on the file referenced by the descriptor.
.It Dv NOTE_WRITE
A write occurred on the file referenced by the descriptor.
.It Dv NOTE_EXTEND
-The file referenced by the descriptor was extended.
+For regular file, the file referenced by the descriptor was extended.
+.Pp
+For directory, reports that a directory entry was added or removed,
+as the result of rename operation.
+The
+.Dv NOTE_EXTEND
+event is not reported when a name is changed inside the directory.
.It Dv NOTE_ATTRIB
The file referenced by the descriptor had its attributes changed.
.It Dv NOTE_LINK
The link count on the file changed.
+In particular, the
+.Dv NOTE_LINK
+event is reported if a subdirectory was created or deleted inside
+the directory referenced by the descriptor.
.It Dv NOTE_RENAME
The file referenced by the descriptor was renamed.
.It Dv NOTE_REVOKE
@@ -603,6 +613,57 @@ will be set to indicate the error condition.
If the time limit expires, then
.Fn kevent
returns 0.
+.Sh EXAMPLES
+.Bd -literal -compact
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+ struct kevent event; /* Event we want to monitor */
+ struct kevent tevent; /* Event triggered */
+ int kq, fd, ret;
+
+ if (argc != 2)
+ err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
+ fd = open(argv[1], O_RDONLY);
+ if (fd == -1)
+ err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
+
+ /* Create kqueue. */
+ kq = kqueue();
+ if (kq == -1)
+ err(EXIT_FAILURE, "kqueue() failed");
+
+ /* Initialize kevent structure. */
+ EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
+ 0, NULL);
+ /* Attach event to the kqueue. */
+ ret = kevent(kq, &event, 1, NULL, 0, NULL);
+ if (ret == -1)
+ err(EXIT_FAILURE, "kevent register");
+ if (event.flags & EV_ERROR)
+ errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
+
+ for (;;) {
+ /* Sleep until something happens. */
+ ret = kevent(kq, NULL, 0, &tevent, 1, NULL);
+ if (ret == -1) {
+ err(EXIT_FAILURE, "kevent wait");
+ } else if (ret > 0) {
+ printf("Something was written in '%s'\en", argv[1]);
+ }
+ }
+}
+.Ed
.Sh ERRORS
The
.Fn kqueue
diff --git a/lib/libc/sys/wait.2 b/lib/libc/sys/wait.2
index a45e78a..687bc18 100644
--- a/lib/libc/sys/wait.2
+++ b/lib/libc/sys/wait.2
@@ -154,7 +154,7 @@ The separate
and
.Fa id
arguments support many other types of
-identifers in addition to process IDs and process group IDs.
+identifiers in addition to process IDs and process group IDs.
.Bl -bullet -offset indent
.It
If
diff --git a/lib/libc/tests/nss/getproto_test.c b/lib/libc/tests/nss/getproto_test.c
index fdb6804..5ae8555 100644
--- a/lib/libc/tests/nss/getproto_test.c
+++ b/lib/libc/tests/nss/getproto_test.c
@@ -315,8 +315,8 @@ errfin:
}
/* protoent_check_ambiguity() is needed when one port+proto is associated with
- * more than one peice (these cases are usually marked as PROBLEM in
- * /etc/peices. This functions is needed also when one peice+proto is
+ * more than one piece (these cases are usually marked as PROBLEM in
+ * /etc/peices. This functions is needed also when one piece+proto is
* associated with several ports. We have to check all the protoent structures
* to make sure that pe really exists and correct */
static int
diff --git a/lib/libc/tests/nss/getrpc_test.c b/lib/libc/tests/nss/getrpc_test.c
index 89de986..54e04b2 100644
--- a/lib/libc/tests/nss/getrpc_test.c
+++ b/lib/libc/tests/nss/getrpc_test.c
@@ -317,8 +317,8 @@ errfin:
}
/* rpcent_check_ambiguity() is needed when one port+rpc is associated with
- * more than one peice (these cases are usually marked as PROBLEM in
- * /etc/peices. This functions is needed also when one peice+rpc is
+ * more than one piece (these cases are usually marked as PROBLEM in
+ * /etc/peices. This functions is needed also when one piece+rpc is
* associated with several ports. We have to check all the rpcent structures
* to make sure that rpc really exists and correct */
static int
diff --git a/lib/libcam/scsi_cmdparse.c b/lib/libcam/scsi_cmdparse.c
index 3d977e1..4a322ba 100644
--- a/lib/libcam/scsi_cmdparse.c
+++ b/lib/libcam/scsi_cmdparse.c
@@ -102,7 +102,7 @@ __FBSDID("$FreeBSD$");
static int
do_buff_decode(u_int8_t *databuf, size_t len,
void (*arg_put)(void *, int , void *, int, char *),
- void *puthook, const char *fmt, va_list ap)
+ void *puthook, const char *fmt, va_list *ap)
{
int assigned = 0;
int width;
@@ -128,7 +128,7 @@ do_buff_decode(u_int8_t *databuf, size_t len,
(void *)((long)(ARG)), width, \
field_name); \
else \
- *(va_arg(ap, int *)) = (ARG); \
+ *(va_arg(*ap, int *)) = (ARG); \
assigned++; \
} \
field_name[0] = 0; \
@@ -255,7 +255,7 @@ do_buff_decode(u_int8_t *databuf, size_t len,
databuf, width, field_name);
else {
char *dest;
- dest = va_arg(ap, char *);
+ dest = va_arg(*ap, char *);
bcopy(databuf, dest, width);
if (letter == 'z') {
char *p;
@@ -287,7 +287,7 @@ do_buff_decode(u_int8_t *databuf, size_t len,
* can't have a variable seek when you are using
* "arg_put".
*/
- width = (arg_put) ? 0 : va_arg(ap, int);
+ width = (arg_put) ? 0 : va_arg(*ap, int);
fmt++;
} else {
width = strtol(fmt, &intendp, 10);
@@ -539,7 +539,7 @@ next_field(const char **pp, char *fmt, int *width_p, int *value_p, char *name,
static int
do_encode(u_char *buff, size_t vec_max, size_t *used,
int (*arg_get)(void *, char *), void *gethook, const char *fmt,
- va_list ap)
+ va_list *ap)
{
int ind;
int shift;
@@ -564,7 +564,7 @@ do_encode(u_char *buff, size_t vec_max, size_t *used,
else
value = arg_get ?
(*arg_get)(gethook, field_name) :
- va_arg(ap, int);
+ va_arg(*ap, int);
}
#if 0
@@ -662,11 +662,16 @@ int
csio_decode(struct ccb_scsiio *csio, const char *fmt, ...)
{
va_list ap;
+ int retval;
va_start(ap, fmt);
- return(do_buff_decode(csio->data_ptr, (size_t)csio->dxfer_len,
- 0, 0, fmt, ap));
+ retval = do_buff_decode(csio->data_ptr, (size_t)csio->dxfer_len, 0, 0,
+ fmt, &ap);
+
+ va_end(ap);
+
+ return (retval);
}
int
@@ -674,29 +679,31 @@ csio_decode_visit(struct ccb_scsiio *csio, const char *fmt,
void (*arg_put)(void *, int, void *, int, char *),
void *puthook)
{
- va_list ap;
/*
* We need some way to output things; we can't do it without
* the arg_put function.
*/
if (arg_put == NULL)
- return(-1);
-
- bzero(&ap, sizeof(ap));
+ return (-1);
- return(do_buff_decode(csio->data_ptr, (size_t)csio->dxfer_len,
- arg_put, puthook, fmt, ap));
+ return (do_buff_decode(csio->data_ptr, (size_t)csio->dxfer_len,
+ arg_put, puthook, fmt, NULL));
}
int
buff_decode(u_int8_t *buff, size_t len, const char *fmt, ...)
{
va_list ap;
+ int retval;
va_start(ap, fmt);
- return(do_buff_decode(buff, len, 0, 0, fmt, ap));
+ retval = do_buff_decode(buff, len, 0, 0, fmt, &ap);
+
+ va_end(ap);
+
+ return (retval);
}
int
@@ -704,7 +711,6 @@ buff_decode_visit(u_int8_t *buff, size_t len, const char *fmt,
void (*arg_put)(void *, int, void *, int, char *),
void *puthook)
{
- va_list ap;
/*
* We need some way to output things; we can't do it without
@@ -713,9 +719,7 @@ buff_decode_visit(u_int8_t *buff, size_t len, const char *fmt,
if (arg_put == NULL)
return(-1);
- bzero(&ap, sizeof(ap));
-
- return(do_buff_decode(buff, len, arg_put, puthook, fmt, ap));
+ return (do_buff_decode(buff, len, arg_put, puthook, fmt, NULL));
}
/*
@@ -732,15 +736,15 @@ csio_build(struct ccb_scsiio *csio, u_int8_t *data_ptr, u_int32_t dxfer_len,
va_list ap;
if (csio == NULL)
- return(0);
+ return (0);
bzero(csio, sizeof(struct ccb_scsiio));
va_start(ap, cmd_spec);
if ((retval = do_encode(csio->cdb_io.cdb_bytes, SCSI_MAX_CDBLEN,
- &cmdlen, NULL, NULL, cmd_spec, ap)) == -1)
- return(retval);
+ &cmdlen, NULL, NULL, cmd_spec, &ap)) == -1)
+ goto done;
cam_fill_csio(csio,
/* retries */ retry_count,
@@ -753,7 +757,10 @@ csio_build(struct ccb_scsiio *csio, u_int8_t *data_ptr, u_int32_t dxfer_len,
/* cdb_len */ cmdlen,
/* timeout */ timeout ? timeout : 5000);
- return(retval);
+done:
+ va_end(ap);
+
+ return (retval);
}
int
@@ -762,7 +769,6 @@ csio_build_visit(struct ccb_scsiio *csio, u_int8_t *data_ptr,
int timeout, const char *cmd_spec,
int (*arg_get)(void *hook, char *field_name), void *gethook)
{
- va_list ap;
size_t cmdlen;
int retval;
@@ -776,12 +782,10 @@ csio_build_visit(struct ccb_scsiio *csio, u_int8_t *data_ptr,
if (arg_get == NULL)
return(-1);
- bzero(&ap, sizeof(ap));
-
bzero(csio, sizeof(struct ccb_scsiio));
if ((retval = do_encode(csio->cdb_io.cdb_bytes, SCSI_MAX_CDBLEN,
- &cmdlen, arg_get, gethook, cmd_spec, ap)) == -1)
+ &cmdlen, arg_get, gethook, cmd_spec, NULL)) == -1)
return(retval);
cam_fill_csio(csio,
@@ -802,20 +806,24 @@ int
csio_encode(struct ccb_scsiio *csio, const char *fmt, ...)
{
va_list ap;
+ int retval;
if (csio == NULL)
- return(0);
+ return (0);
va_start(ap, fmt);
- return(do_encode(csio->data_ptr, csio->dxfer_len, 0, 0, 0, fmt, ap));
+ retval = do_encode(csio->data_ptr, csio->dxfer_len, 0, 0, 0, fmt, &ap);
+
+ va_end(ap);
+
+ return (retval);
}
int
buff_encode_visit(u_int8_t *buff, size_t len, const char *fmt,
int (*arg_get)(void *hook, char *field_name), void *gethook)
{
- va_list ap;
/*
* We need something to encode, but we can't get it without the
@@ -824,16 +832,13 @@ buff_encode_visit(u_int8_t *buff, size_t len, const char *fmt,
if (arg_get == NULL)
return(-1);
- bzero(&ap, sizeof(ap));
-
- return(do_encode(buff, len, 0, arg_get, gethook, fmt, ap));
+ return (do_encode(buff, len, 0, arg_get, gethook, fmt, NULL));
}
int
csio_encode_visit(struct ccb_scsiio *csio, const char *fmt,
int (*arg_get)(void *hook, char *field_name), void *gethook)
{
- va_list ap;
/*
* We need something to encode, but we can't get it without the
@@ -842,8 +847,6 @@ csio_encode_visit(struct ccb_scsiio *csio, const char *fmt,
if (arg_get == NULL)
return(-1);
- bzero(&ap, sizeof(ap));
-
- return(do_encode(csio->data_ptr, csio->dxfer_len, 0, arg_get,
- gethook, fmt, ap));
+ return (do_encode(csio->data_ptr, csio->dxfer_len, 0, arg_get,
+ gethook, fmt, NULL));
}
diff --git a/lib/libedit/chartype.h b/lib/libedit/chartype.h
index 17ca5f3..1445681 100644
--- a/lib/libedit/chartype.h
+++ b/lib/libedit/chartype.h
@@ -204,11 +204,11 @@ protected size_t ct_enc_width(Char);
#endif
#ifndef NARROWCHAR
-/* Encode a characted into the destination buffer, provided there is sufficent
+/* Encode a characted into the destination buffer, provided there is sufficient
* buffer space available. Returns the number of bytes used up (zero if the
* character cannot be encoded, -1 if there was not enough space available). */
-/* The maximum buffer size to hold the most unwieldly visual representation,
+/* The maximum buffer size to hold the most unwieldy visual representation,
* in this case \U+nnnnn. */
#define VISUAL_WIDTH_MAX ((size_t)8)
diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c
index c85e845..cd516f6 100644
--- a/lib/libedit/refresh.c
+++ b/lib/libedit/refresh.c
@@ -561,7 +561,7 @@ re_update_line(EditLine *el, Char *old, Char *new, int i)
nls = ++n;
/*
- * find same begining and same end
+ * find same beginning and same end
*/
osb = ols;
nsb = nls;
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index 76dc4f9..00f8b92 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -471,7 +471,7 @@ fetch_ssl_hname_match(const char *h, size_t hlen, const char *m,
if (!fetch_ssl_hname_equal(hdot - delta, delta,
mdot1 - delta, delta))
return (0);
- /* all tests succeded, it's a match */
+ /* all tests succeeded, it's a match */
return (1);
}
@@ -1349,7 +1349,7 @@ fetch_netrc_auth(struct url *url)
* which the proxy should not be consulted; the contents is a comma-,
* or space-separated list of domain names. A single asterisk will
* override all proxy variables and no transactions will be proxied
- * (for compatability with lynx and curl, see the discussion at
+ * (for compatibility with lynx and curl, see the discussion at
* <http://curl.haxx.se/mail/archive_pre_oct_99/0009.html>).
*/
int
diff --git a/lib/libgssapi/gss_accept_sec_context.c b/lib/libgssapi/gss_accept_sec_context.c
index 930da7f..0fa739c 100644
--- a/lib/libgssapi/gss_accept_sec_context.c
+++ b/lib/libgssapi/gss_accept_sec_context.c
@@ -135,7 +135,7 @@ choose_mech(const gss_buffer_t input, gss_OID mech_oid)
return (GSS_S_COMPLETE);
} else if (input->length == 0) {
/*
- * There is the a wierd mode of SPNEGO (in CIFS and
+ * There is the a weird mode of SPNEGO (in CIFS and
* SASL GSS-SPENGO where the first token is zero
* length and the acceptor returns a mech_list, lets
* hope that is what is happening now.
diff --git a/lib/libkiconv/quirks.c b/lib/libkiconv/quirks.c
index d1cc607..54b6153 100644
--- a/lib/libkiconv/quirks.c
+++ b/lib/libkiconv/quirks.c
@@ -41,10 +41,10 @@
*
* For example, the eucJP and Unocode mapping rule is based on
* the JIS standard. Since Microsoft uses cp932 for Unicode mapping
- * witch is not truly based on the JIS standard, reading a file
+ * which is not truly based on the JIS standard, reading a file
* system created by Microsoft Windows family using eucJP/Unicode
* mapping rule will cause a problem. That's why we define eucJP-ms here.
- * The eucJP-ms has been defined by The Open Group Japan Vendor Coucil.
+ * The eucJP-ms has been defined by The Open Group Japan Vendor Council.
*
* Well, Apple Mac OS also has their own Unicode mappings,
* but we won't require these quirks here, because HFS doesn't have
diff --git a/lib/libkvm/Makefile b/lib/libkvm/Makefile
index 0fdeec9..dc611a4 100644
--- a/lib/libkvm/Makefile
+++ b/lib/libkvm/Makefile
@@ -5,12 +5,12 @@ PACKAGE=lib${LIB}
LIB= kvm
SHLIBDIR?= /lib
-SHLIB_MAJOR= 6
+SHLIB_MAJOR= 7
CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
WARNS?= 3
-SRCS= kvm.c kvm_cptime.c kvm_file.c kvm_getloadavg.c \
+SRCS= kvm.c kvm_cptime.c kvm_getloadavg.c \
kvm_getswapinfo.c kvm_pcpu.c kvm_proc.c kvm_vnet.c \
kvm_minidump_aarch64.c \
kvm_amd64.c kvm_minidump_amd64.c \
@@ -23,7 +23,7 @@ INCS= kvm.h
LIBADD= elf
-MAN= kvm.3 kvm_getcptime.3 kvm_geterr.3 kvm_getfiles.3 kvm_getloadavg.3 \
+MAN= kvm.3 kvm_getcptime.3 kvm_geterr.3 kvm_getloadavg.3 \
kvm_getpcpu.3 kvm_getprocs.3 kvm_getswapinfo.3 kvm_native.3 \
kvm_nlist.3 kvm_open.3 kvm_read.3
diff --git a/lib/libkvm/kvm.3 b/lib/libkvm/kvm.3
index 3838177..7dd2851 100644
--- a/lib/libkvm/kvm.3
+++ b/lib/libkvm/kvm.3
@@ -32,7 +32,7 @@
.\" @(#)kvm.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd November 27, 2015
+.Dd April 30, 2016
.Dt KVM 3
.Os
.Sh NAME
@@ -144,7 +144,6 @@ and
.Xr kvm_getargv 3 ,
.Xr kvm_getenvv 3 ,
.Xr kvm_geterr 3 ,
-.Xr kvm_getfiles 3 ,
.Xr kvm_getloadavg 3 ,
.Xr kvm_getprocs 3 ,
.Xr kvm_getswapinfo 3 ,
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index de21f39..5ad8dcc 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -237,7 +237,7 @@ _kvm_is_minidump(kvm_t *kd)
* header from the core before treating it as an ELF header.
*
* We can add that here if we can get a change to libelf to support
- * an inital offset into the file. Alternatively we could patch
+ * an initial offset into the file. Alternatively we could patch
* savecore to extract cores from a regular file instead.
*/
int
@@ -756,7 +756,7 @@ kvm_nlist2(kvm_t *kd, struct kvm_nlist *nl)
{
/*
- * If called via the public interface, permit intialization of
+ * If called via the public interface, permit initialization of
* further virtualized modules on demand.
*/
return (_kvm_nlist(kd, nl, 1));
diff --git a/lib/libkvm/kvm.h b/lib/libkvm/kvm.h
index a3d1364..8b66180 100644
--- a/lib/libkvm/kvm.h
+++ b/lib/libkvm/kvm.h
@@ -82,7 +82,6 @@ char **kvm_getargv(kvm_t *, const struct kinfo_proc *, int);
int kvm_getcptime(kvm_t *, long *);
char **kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);
char *kvm_geterr(kvm_t *);
-char *kvm_getfiles(kvm_t *, int, int, int *);
int kvm_getloadavg(kvm_t *, double [], int);
int kvm_getmaxcpu(kvm_t *);
int kvm_getncpus(kvm_t *);
diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c
index 57a8728..32cef2f 100644
--- a/lib/libkvm/kvm_amd64.c
+++ b/lib/libkvm/kvm_amd64.c
@@ -159,6 +159,7 @@ _amd64_initvtop(kvm_t *kd)
}
if (kvm_read2(kd, pa, PML4, AMD64_PAGE_SIZE) != AMD64_PAGE_SIZE) {
_kvm_err(kd, kd->program, "cannot read KPML4phys");
+ free(PML4);
return (-1);
}
kd->vmst->PML4 = PML4;
diff --git a/lib/libkvm/kvm_file.c b/lib/libkvm/kvm_file.c
deleted file mode 100644
index 12fe6da..0000000
--- a/lib/libkvm/kvm_file.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*-
- * Copyright (c) 1989, 1992, 1993
- * The Regents of the University of California. 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.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)kvm_file.c 8.1 (Berkeley) 6/4/93";
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * File list interface for kvm. pstat, fstat and netstat are
- * users of this code, so we've factored it out into a separate module.
- * Thus, we keep this grunge out of the other kvm applications (i.e.,
- * most other applications are interested only in open/close/read/nlist).
- */
-
-#include <sys/param.h>
-#include <sys/user.h>
-#include <sys/proc.h>
-#define _WANT_FILE /* make file.h give us 'struct file' */
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <nlist.h>
-#include <kvm.h>
-
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-
-#include <sys/sysctl.h>
-
-#include <limits.h>
-#include <ndbm.h>
-#include <paths.h>
-#include <stdlib.h>
-
-#include "kvm_private.h"
-
-#define KREAD(kd, addr, obj) \
- (kvm_read(kd, addr, obj, sizeof(*obj)) != sizeof(*obj))
-
-#define KREADN(kd, addr, obj, cnt) \
- (kvm_read(kd, addr, obj, (cnt)) != (ssize_t)(cnt))
-
-/*
- * Get file structures.
- */
-static int
-kvm_deadfiles(kvm_t *kd, int op __unused, int arg __unused, long allproc_o,
- int nprocs __unused)
-{
- struct proc proc;
- struct filedesc filed;
- int buflen = kd->arglen, ocnt = 0, n = 0, once = 0, i;
- struct file **ofiles;
- struct file *fp;
- struct proc *p;
- char *where = kd->argspc;
-
- if (buflen < (int)(sizeof(struct file *) + sizeof(struct file)))
- return (0);
- if (KREAD(kd, allproc_o, &p)) {
- _kvm_err(kd, kd->program, "cannot read allproc");
- return (0);
- }
- for (; p != NULL; p = LIST_NEXT(&proc, p_list)) {
- if (KREAD(kd, (u_long)p, &proc)) {
- _kvm_err(kd, kd->program, "can't read proc at %p", p);
- goto fail;
- }
- if (proc.p_state == PRS_NEW)
- continue;
- if (proc.p_fd == NULL)
- continue;
- if (KREAD(kd, (u_long)p->p_fd, &filed)) {
- _kvm_err(kd, kd->program, "can't read filedesc at %p",
- p->p_fd);
- goto fail;
- }
- if (filed.fd_lastfile + 1 > ocnt) {
- ocnt = filed.fd_lastfile + 1;
- free(ofiles);
- ofiles = (struct file **)_kvm_malloc(kd,
- ocnt * sizeof(struct file *));
- if (ofiles == 0)
- return (0);
- }
- if (KREADN(kd, (u_long)filed.fd_ofiles, ofiles,
- ocnt * sizeof(struct file *))) {
- _kvm_err(kd, kd->program, "can't read ofiles at %p",
- filed.fd_ofiles);
- return (0);
- }
- for (i = 0; i <= filed.fd_lastfile; i++) {
- if ((fp = ofiles[i]) == NULL)
- continue;
- /*
- * copyout filehead (legacy)
- */
- if (!once) {
- *(struct file **)kd->argspc = fp;
- *(struct file **)where = fp;
- buflen -= sizeof (fp);
- where += sizeof (fp);
- once = 1;
- }
- if (buflen < (int)sizeof(struct file))
- goto fail;
- if (KREAD(kd, (long)fp, ((struct file *)where))) {
- _kvm_err(kd, kd->program, "can't read kfp");
- goto fail;
- }
- buflen -= sizeof (struct file);
- fp = (struct file *)where;
- where += sizeof (struct file);
- n++;
- }
- }
- free(ofiles);
- return (n);
-fail:
- free(ofiles);
- return (0);
-
-}
-
-char *
-kvm_getfiles(kvm_t *kd, int op, int arg, int *cnt)
-{
- int mib[2], st, n, nfiles, nprocs;
- size_t size;
-
- _kvm_syserr(kd, kd->program, "kvm_getfiles has been broken for years");
- return (0);
- if (ISALIVE(kd)) {
- size = 0;
- mib[0] = CTL_KERN;
- mib[1] = KERN_FILE;
- st = sysctl(mib, 2, NULL, &size, NULL, 0);
- if (st == -1) {
- _kvm_syserr(kd, kd->program, "kvm_getfiles");
- return (0);
- }
- if (kd->argspc == 0)
- kd->argspc = (char *)_kvm_malloc(kd, size);
- else if (kd->arglen < (int)size)
- kd->argspc = (char *)_kvm_realloc(kd, kd->argspc, size);
- if (kd->argspc == 0)
- return (0);
- kd->arglen = size;
- st = sysctl(mib, 2, kd->argspc, &size, NULL, 0);
- if (st != 0) {
- _kvm_syserr(kd, kd->program, "kvm_getfiles");
- return (0);
- }
- nfiles = size / sizeof(struct xfile);
- } else {
- struct nlist nl[4], *p;
-
- nl[0].n_name = "_allproc";
- nl[1].n_name = "_nprocs";
- nl[2].n_name = "_nfiles";
- nl[3].n_name = 0;
-
- if (kvm_nlist(kd, nl) != 0) {
- for (p = nl; p->n_type != 0; ++p)
- ;
- _kvm_err(kd, kd->program,
- "%s: no such symbol", p->n_name);
- return (0);
- }
- if (KREAD(kd, nl[1].n_value, &nprocs)) {
- _kvm_err(kd, kd->program, "can't read nprocs");
- return (0);
- }
- if (KREAD(kd, nl[2].n_value, &nfiles)) {
- _kvm_err(kd, kd->program, "can't read nfiles");
- return (0);
- }
- size = sizeof(void *) + (nfiles + 10) * sizeof(struct file);
- if (kd->argspc == 0)
- kd->argspc = (char *)_kvm_malloc(kd, size);
- else if (kd->arglen < (int)size)
- kd->argspc = (char *)_kvm_realloc(kd, kd->argspc, size);
- if (kd->argspc == 0)
- return (0);
- kd->arglen = size;
- n = kvm_deadfiles(kd, op, arg, nl[0].n_value, nprocs);
- if (n != nfiles) {
- _kvm_err(kd, kd->program, "inconsistant nfiles");
- return (0);
- }
- nfiles = n;
- }
- *cnt = nfiles;
- return (kd->argspc);
-}
diff --git a/lib/libkvm/kvm_getfiles.3 b/lib/libkvm/kvm_getfiles.3
deleted file mode 100644
index 22bfd92..0000000
--- a/lib/libkvm/kvm_getfiles.3
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" Copyright (c) 1992, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software developed by the Computer Systems
-.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
-.\" BG 91-66 and contributed to Berkeley.
-.\"
-.\" 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.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)kvm_getfiles.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd April 19, 1994
-.Dt KVM_GETFILES 3
-.Os
-.Sh NAME
-.Nm kvm_getfiles
-.Nd survey open files
-.Sh LIBRARY
-.Lb libkvm
-.Sh SYNOPSIS
-.In kvm.h
-.In sys/types.h
-.Fd #define _KERNEL
-.In sys/file.h
-.Fd #undef _KERNEL
-.\" .Fa kvm_t *kd
-.Ft char *
-.Fn kvm_getfiles "kvm_t *kd" "int op" "int arg" "int *cnt"
-.Sh DESCRIPTION
-The
-.Fn kvm_getfiles
-function returns a (sub-)set of the open files in the kernel indicated by
-.Fa kd .
-The
-.Fa op
-and
-.Fa arg
-arguments constitute a predicate which limits the set of files
-returned.
-No predicates are currently defined.
-.Pp
-The number of files found is returned in the reference parameter
-.Fa cnt .
-The files are returned as a contiguous array of file structures,
-preceded by the address of the first file entry in the kernel.
-This memory is owned by kvm and is not guaranteed to be persistent across
-subsequent kvm library calls.
-Data should be copied out if it needs to be
-saved.
-.Sh RETURN VALUES
-The
-.Fn kvm_getfiles
-function will return NULL on failure.
-.Sh SEE ALSO
-.Xr kvm 3 ,
-.Xr kvm_close 3 ,
-.Xr kvm_geterr 3 ,
-.Xr kvm_nlist 3 ,
-.Xr kvm_open 3 ,
-.Xr kvm_openfiles 3 ,
-.Xr kvm_read 3 ,
-.Xr kvm_write 3
-.Sh BUGS
-This routine does not belong in the kvm interface.
diff --git a/lib/libkvm/kvm_pcpu.c b/lib/libkvm/kvm_pcpu.c
index eaea7e4..68dd363 100644
--- a/lib/libkvm/kvm_pcpu.c
+++ b/lib/libkvm/kvm_pcpu.c
@@ -266,7 +266,7 @@ _kvm_dpcpu_init(kvm_t *kd)
}
/*
- * Check whether the dpcpu module has been initialized sucessfully or not,
+ * Check whether the dpcpu module has been initialized successfully or not,
* initialize it if permitted.
*/
int
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 1eb9872..5cd0493 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -666,6 +666,7 @@ kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, int env, int nchr)
static char *buf, *p;
static char **bufp;
static int argc;
+ char **nbufp;
if (!ISALIVE(kd)) {
_kvm_err(kd, kd->program,
@@ -681,9 +682,15 @@ kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, int env, int nchr)
_kvm_err(kd, kd->program, "cannot allocate memory");
return (NULL);
}
- buflen = nchr;
argc = 32;
bufp = malloc(sizeof(char *) * argc);
+ if (bufp == NULL) {
+ free(buf);
+ buf = NULL;
+ _kvm_err(kd, kd->program, "cannot allocate memory");
+ return (NULL);
+ }
+ buflen = nchr;
} else if (nchr > buflen) {
p = realloc(buf, nchr);
if (p != NULL) {
@@ -716,8 +723,10 @@ kvm_argv(kvm_t *kd, const struct kinfo_proc *kp, int env, int nchr)
p += strlen(p) + 1;
if (i >= argc) {
argc += argc;
- bufp = realloc(bufp,
- sizeof(char *) * argc);
+ nbufp = realloc(bufp, sizeof(char *) * argc);
+ if (nbufp == NULL)
+ return (NULL);
+ bufp = nbufp;
}
} while (p < buf + bufsz);
bufp[i++] = 0;
diff --git a/lib/libkvm/kvm_sparc64.c b/lib/libkvm/kvm_sparc64.c
index 97cb516..d8d897e 100644
--- a/lib/libkvm/kvm_sparc64.c
+++ b/lib/libkvm/kvm_sparc64.c
@@ -134,7 +134,6 @@ _sparc64_initvtop(kvm_t *kd)
struct sparc64_dump_reg *regs;
struct vmstate *vm;
size_t regsz;
- uint64_t pa;
int i;
vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm));
@@ -151,7 +150,6 @@ _sparc64_initvtop(kvm_t *kd)
hdr.dh_tsb_size = be64toh(hdr.dh_tsb_size);
hdr.dh_tsb_mask = be64toh(hdr.dh_tsb_mask);
hdr.dh_nregions = be32toh(hdr.dh_nregions);
- pa = hdr.dh_tsb_pa;
regsz = hdr.dh_nregions * sizeof(*regs);
regs = _kvm_malloc(kd, regsz);
diff --git a/lib/libkvm/kvm_vnet.c b/lib/libkvm/kvm_vnet.c
index d9bdf55..817462c 100644
--- a/lib/libkvm/kvm_vnet.c
+++ b/lib/libkvm/kvm_vnet.c
@@ -127,7 +127,7 @@ _kvm_vnet_selectpid(kvm_t *kd, pid_t pid)
/*
* First, find the process for this pid. If we are working on a
- * dump, either locate the thread dumptid is refering to or proc0.
+ * dump, either locate the thread dumptid is referring to or proc0.
* Based on either, take the address of the ucred.
*/
credp = 0;
@@ -208,7 +208,7 @@ _kvm_vnet_selectpid(kvm_t *kd, pid_t pid)
}
/*
- * Check whether the vnet module has been initialized sucessfully
+ * Check whether the vnet module has been initialized successfully
* or not, initialize it if permitted.
*/
int
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index 39deec6..0e54b68 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -3240,7 +3240,7 @@ pmc_init(void)
if (PMC_CALL(GETMODULEVERSION, &abi_version) < 0)
return (pmc_syscall = -1);
- /* ignore patch & minor numbers for the comparision */
+ /* ignore patch & minor numbers for the comparison */
if ((abi_version & 0xFF000000) != (PMC_VERSION & 0xFF000000)) {
errno = EPROGMISMATCH;
return (pmc_syscall = -1);
diff --git a/lib/libsdp/sdp.h b/lib/libsdp/sdp.h
index 35dbea7..3bc144e 100644
--- a/lib/libsdp/sdp.h
+++ b/lib/libsdp/sdp.h
@@ -561,7 +561,7 @@ void sdp_print (uint32_t level, uint8_t const *start,
* bdaddr_t bdaddr; local BD_ADDR (or ANY)
* profile data[pdu->len - sizeof(uuid) - sizeof(bdaddr)]
*
- * in successful reponse additional data will contain 4 bytes record handle
+ * in successful response additional data will contain 4 bytes record handle
*
*
* SDP_PDU_SERVICE_UNREGISTER_REQUEST
diff --git a/lib/libusb/libusb20_desc.c b/lib/libusb/libusb20_desc.c
index a403182..c285193 100644
--- a/lib/libusb/libusb20_desc.c
+++ b/lib/libusb/libusb20_desc.c
@@ -135,7 +135,7 @@ libusb20_parse_config_desc(const void *config_desc)
/*
* Make a copy of the config descriptor, so that the caller can free
- * the inital config descriptor pointer!
+ * the initial config descriptor pointer!
*/
memcpy((void *)(lub_endpoint + nendpoint), config_desc, pcdesc.len);
diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c
index af749d5..2838871 100644
--- a/lib/libutil/pw_util.c
+++ b/lib/libutil/pw_util.c
@@ -58,7 +58,6 @@ static const char rcsid[] =
#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <libgen.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
@@ -315,7 +314,7 @@ pw_edit(int notsetuid)
(void)setuid(getuid());
}
errno = 0;
- execlp(editor, basename(editor), tempname, (char *)NULL);
+ execlp(editor, editor, tempname, (char *)NULL);
_exit(errno);
default:
/* parent */
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index 57f8c56..98eee60 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -176,7 +176,7 @@ int vm_get_hpet_capabilities(struct vmctx *ctx, uint32_t *capabilities);
/*
* Translate the GLA range [gla,gla+len) into GPA segments in 'iov'.
- * The 'iovcnt' should be big enough to accomodate all GPA segments.
+ * The 'iovcnt' should be big enough to accommodate all GPA segments.
*
* retval fault Interpretation
* 0 0 Success
diff --git a/lib/msun/src/k_rem_pio2.c b/lib/msun/src/k_rem_pio2.c
index 3942441..d8af97e 100644
--- a/lib/msun/src/k_rem_pio2.c
+++ b/lib/msun/src/k_rem_pio2.c
@@ -83,7 +83,7 @@ __FBSDID("$FreeBSD$");
* jk+1 must be 2 larger than you might expect so that our
* recomputation test works. (Up to 24 bits in the integer
* part (the 24 bits of it that we compute) and 23 bits in
- * the fraction part may be lost to cancelation before we
+ * the fraction part may be lost to cancellation before we
* recompute.)
*
* jz local integer variable indicating the number of
diff --git a/lib/msun/src/s_cbrt.c b/lib/msun/src/s_cbrt.c
index 910f75b..30ffe5f 100644
--- a/lib/msun/src/s_cbrt.c
+++ b/lib/msun/src/s_cbrt.c
@@ -59,7 +59,7 @@ cbrt(double x)
* error of about 1 in 16. Adding a bias of -0.03306235651 to the
* (e%3+m)/3 term reduces the error to about 1 in 32. With the IEEE
* floating point representation, for finite positive normal values,
- * ordinary integer divison of the value in bits magically gives
+ * ordinary integer division of the value in bits magically gives
* almost exactly the RHS of the above provided we first subtract the
* exponent bias (1023 for doubles) and later add it back. We do the
* subtraction virtually to keep e >= 0 so that ordinary integer
diff --git a/lib/tests/Makefile b/lib/tests/Makefile
index 609357e..06058a0 100644
--- a/lib/tests/Makefile
+++ b/lib/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/libexec/atf/atf-sh/tests/Makefile b/libexec/atf/atf-sh/tests/Makefile
index db2200b..b52c88d 100644
--- a/libexec/atf/atf-sh/tests/Makefile
+++ b/libexec/atf/atf-sh/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.init.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/libexec/atf/tests/Makefile b/libexec/atf/tests/Makefile
index 609357e..06058a0 100644
--- a/libexec/atf/tests/Makefile
+++ b/libexec/atf/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index b3c78f6..b9c9069 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -2048,7 +2048,7 @@ pdata_err:
} while (0)
/*
- * Tranfer the contents of "instr" to "outstr" peer using the appropriate
+ * Transfer the contents of "instr" to "outstr" peer using the appropriate
* encapsulation of the data subject to Mode, Structure, and Type.
*
* NB: Form isn't handled.
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c
index 5620a79..2dad033 100644
--- a/libexec/ftpd/popen.c
+++ b/libexec/ftpd/popen.c
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
#define MAXGLOBARGS 1000
/*
- * Special version of popen which avoids call to shell. This ensures noone
+ * Special version of popen which avoids call to shell. This ensures no one
* may create a pipe to a hidden program as a side effect of a list or dir
* command.
*/
diff --git a/libexec/rtld-elf/malloc.c b/libexec/rtld-elf/malloc.c
index 0b3850b..a277d87 100644
--- a/libexec/rtld-elf/malloc.c
+++ b/libexec/rtld-elf/malloc.c
@@ -328,7 +328,7 @@ free(cp)
* old malloc man page, it realloc's an already freed block. Usually
* this is the last block it freed; occasionally it might be farther
* back. We have to search all the free lists for the block in order
- * to determine its bucket: 1st we make one pass thru the lists
+ * to determine its bucket: 1st we make one pass through the lists
* checking only the first block in each; if that fails we search
* ``realloc_srchlen'' blocks in each list for a match (the variable
* is extern so the caller can modify it). If that fails we just copy
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index ba8c4a0..b7811cb 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -822,7 +822,7 @@ origin_subst_one(Obj_Entry *obj, char *real, const char *kw,
kw_len = strlen(kw);
/*
- * First, count the number of the keyword occurences, to
+ * First, count the number of the keyword occurrences, to
* preallocate the final string.
*/
for (p = real, subst_count = 0;; p = p1 + kw_len, subst_count++) {
diff --git a/libexec/tests/Makefile b/libexec/tests/Makefile
index 04afe9a..06058a0 100644
--- a/libexec/tests/Makefile
+++ b/libexec/tests/Makefile
@@ -2,10 +2,11 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
-TEST+= Kyuafile
+TESTS+= Kyuafile
.PATH: ${SRCTOP}/tests
KYUAFILE= yes
diff --git a/release/picobsd/build/picobsd b/release/picobsd/build/picobsd
index 2b04be4..7948351 100755
--- a/release/picobsd/build/picobsd
+++ b/release/picobsd/build/picobsd
@@ -363,7 +363,7 @@ do_install() {
return
fi
dialog --title "Build ${THETYPE} completed" --inputbox \
-"\nThe build process was completed successfuly.\n\
+"\nThe build process was completed successfully.\n\
`cat .build.reply` \n\n\
Now we are going to install the image on the floppy.\n\
Please insert a blank floppy in /dev/fd0.\\n
diff --git a/release/picobsd/tinyware/ns/ns.c b/release/picobsd/tinyware/ns/ns.c
index a4b3b5e..ac8e6fa 100644
--- a/release/picobsd/tinyware/ns/ns.c
+++ b/release/picobsd/tinyware/ns/ns.c
@@ -700,7 +700,7 @@ stats(char *proto)
return 0;
if (pflag) {
if (proto == NULL) {
- fprintf(stderr, "Option '-p' requires paramter.\n");
+ fprintf(stderr, "Option '-p' requires parameter.\n");
usage();
exit(-1);
}
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 8deef3b..6c9228e 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -814,9 +814,6 @@ scsidoinquiry(struct cam_device *device, int argc, char **argv,
if (arglist & CAM_ARG_GET_SERIAL)
scsiserial(device, retry_count, timeout);
- if (error != 0)
- return(error);
-
if (arglist & CAM_ARG_GET_XFERRATE)
error = camxferrate(device);
diff --git a/sbin/camcontrol/fwdownload.c b/sbin/camcontrol/fwdownload.c
index 2c2d12a..fc09450 100644
--- a/sbin/camcontrol/fwdownload.c
+++ b/sbin/camcontrol/fwdownload.c
@@ -216,7 +216,7 @@ static struct fw_vendor vendors_list[] = {
* since we won't actually send a WRITE BUFFER with any of the
* listed parameters. If a SATA device is behind a SAS controller,
* the SCSI to ATA translation code (at least for LSI) doesn't
- * generaly translate a SCSI WRITE BUFFER into an ATA DOWNLOAD
+ * generally translate a SCSI WRITE BUFFER into an ATA DOWNLOAD
* MICROCODE command. So, we use the SCSI ATA PASS_THROUGH command
* to send the ATA DOWNLOAD MICROCODE command instead.
*/
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index ee18f82..ee02728 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -267,7 +267,7 @@ main(int argc, char *argv[])
}
if (blocksperfile)
- blocksperfile = blocksperfile / ntrec * ntrec; /* round down */
+ blocksperfile = rounddown(blocksperfile, ntrec);
else if (!unlimited) {
/*
* Determine how to default tape size and density
diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c
index ce69ba1..ab76db6 100644
--- a/sbin/dumpfs/dumpfs.c
+++ b/sbin/dumpfs/dumpfs.c
@@ -353,8 +353,7 @@ dumpcg(void)
for (i = 1; i < afs.fs_contigsumsize; i++) {
if ((i - 1) % 8 == 0)
printf("\nclusters %d-%d:", i,
- afs.fs_contigsumsize - 1 < i + 7 ?
- afs.fs_contigsumsize - 1 : i + 7);
+ MIN(afs.fs_contigsumsize - 1, i + 7));
printf("\t%d", cg_clustersum(&acg)[i]);
}
printf("\nclusters size %d and over: %d\n",
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 819c1c7..4dc846e 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -67,8 +67,6 @@ static char lbuf[LBUF];
#define Decimal(str, ans, tmp, maxval) if (decimal(str, &tmp, ans, maxval)) ans = tmp
-#define RoundCyl(x) ((((x) + cylsecs - 1) / cylsecs) * cylsecs)
-
#define MAX_SEC_SIZE 2048 /* maximum section size that is supported */
#define MIN_SEC_SIZE 512 /* the sector size to start sensing at */
static int secsize = 0; /* the sensed sector size */
@@ -387,7 +385,7 @@ main(int argc, char *argv[])
partp->dp_typ = DOSPTYP_386BSD;
partp->dp_flag = ACTIVE;
partp->dp_start = dos_sectors;
- partp->dp_size = (disksecs / dos_cylsecs) * dos_cylsecs -
+ partp->dp_size = rounddown(disksecs, dos_cylsecs) -
dos_sectors;
dos(partp);
if (v_flag)
@@ -540,11 +538,11 @@ init_sector0(unsigned long start)
partp->dp_typ = DOSPTYP_386BSD;
partp->dp_flag = ACTIVE;
- start = ((start + dos_sectors - 1) / dos_sectors) * dos_sectors;
+ start = roundup(start, dos_sectors);
if(start == 0)
start = dos_sectors;
partp->dp_start = start;
- partp->dp_size = (disksecs / dos_cylsecs) * dos_cylsecs - start;
+ partp->dp_size = rounddown(disksecs, dos_cylsecs) - start;
dos(partp);
}
@@ -1188,8 +1186,8 @@ process_partition(CMD *command)
prev_partp->dp_size;
}
if (partp->dp_start % dos_sectors != 0) {
- prev_head_boundary = partp->dp_start /
- dos_sectors * dos_sectors;
+ prev_head_boundary = rounddown(partp->dp_start,
+ dos_sectors);
partp->dp_start = prev_head_boundary +
dos_sectors;
}
@@ -1203,15 +1201,15 @@ process_partition(CMD *command)
if (command->args[3].arg_str != NULL) {
if (strcmp(command->args[3].arg_str, "*") == 0)
- partp->dp_size = ((disksecs / dos_cylsecs) *
- dos_cylsecs) - partp->dp_start;
+ partp->dp_size = rounddown(disksecs, dos_cylsecs) -
+ partp->dp_start;
else {
partp->dp_size = str2sectors(command->args[3].arg_str);
if (partp->dp_size == NO_DISK_SECTORS)
break;
}
- prev_cyl_boundary = ((partp->dp_start + partp->dp_size) /
- dos_cylsecs) * dos_cylsecs;
+ prev_cyl_boundary = rounddown(partp->dp_start + partp->dp_size,
+ dos_cylsecs);
if (prev_cyl_boundary > partp->dp_start)
partp->dp_size = prev_cyl_boundary - partp->dp_start;
} else
@@ -1235,7 +1233,7 @@ process_partition(CMD *command)
* Adjust start upwards, if necessary, to fall on a head boundary.
*/
if (partp->dp_start % dos_sectors != 0) {
- prev_head_boundary = partp->dp_start / dos_sectors * dos_sectors;
+ prev_head_boundary = rounddown(partp->dp_start, dos_sectors);
if (max_end < dos_sectors ||
prev_head_boundary > max_end - dos_sectors) {
/*
@@ -1259,8 +1257,8 @@ process_partition(CMD *command)
* Adjust size downwards, if necessary, to fall on a cylinder
* boundary.
*/
- prev_cyl_boundary =
- ((partp->dp_start + partp->dp_size) / dos_cylsecs) * dos_cylsecs;
+ prev_cyl_boundary = rounddown(partp->dp_start + partp->dp_size,
+ dos_cylsecs);
if (prev_cyl_boundary > partp->dp_start)
adj_size = prev_cyl_boundary - partp->dp_start;
else {
@@ -1451,7 +1449,7 @@ sanitize_partition(struct dos_partition *partp)
* Adjust start upwards, if necessary, to fall on a head boundary.
*/
if (start % dos_sectors != 0) {
- prev_head_boundary = start / dos_sectors * dos_sectors;
+ prev_head_boundary = rounddown(start, dos_sectors);
if (max_end < dos_sectors ||
prev_head_boundary >= max_end - dos_sectors) {
/*
@@ -1468,7 +1466,7 @@ sanitize_partition(struct dos_partition *partp)
* Adjust size downwards, if necessary, to fall on a cylinder
* boundary.
*/
- prev_cyl_boundary = ((start + size) / dos_cylsecs) * dos_cylsecs;
+ prev_cyl_boundary = rounddown(start + size, dos_cylsecs);
if (prev_cyl_boundary > start)
size = prev_cyl_boundary - start;
else {
diff --git a/sbin/fdisk_pc98/fdisk.c b/sbin/fdisk_pc98/fdisk.c
index 8196d85..7b84053 100644
--- a/sbin/fdisk_pc98/fdisk.c
+++ b/sbin/fdisk_pc98/fdisk.c
@@ -63,8 +63,6 @@ static char lbuf[LBUF];
#define Decimal(str, ans, tmp) if (decimal(str, &tmp, ans)) ans = tmp
#define String(str, ans, len) {char *z = ans; char **dflt = &z; if (string(str, dflt)) strncpy(ans, *dflt, len); }
-#define RoundCyl(x) ((((x) + cylsecs - 1) / cylsecs) * cylsecs)
-
#define MAX_SEC_SIZE 2048 /* maximum section size that is supported */
#define MIN_SEC_SIZE 512 /* the sector size to start sensing at */
static int secsize = 0; /* the sensed sector size */
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index 713c9d4..52a982f 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -365,8 +365,7 @@ flush(int fd, struct bufarea *bp)
for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) {
blwrite(fswritefd, (char *)sblock.fs_csp + i,
fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag),
- sblock.fs_cssize - i < sblock.fs_bsize ?
- sblock.fs_cssize - i : sblock.fs_bsize);
+ MIN(sblock.fs_cssize - i, sblock.fs_bsize));
}
}
@@ -673,7 +672,7 @@ blzero(int fd, ufs2_daddr_t blk, long size)
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK BLK", blk);
while (size > 0) {
- len = size > ZEROBUFSIZE ? ZEROBUFSIZE : size;
+ len = MIN(ZEROBUFSIZE, size);
if (write(fd, zero, len) != len)
rwerror("WRITE BLK", blk);
blk += len / dev_bsize;
@@ -718,8 +717,7 @@ check_cgmagic(int cg, struct bufarea *cgbp)
cgp->cg_magic = CG_MAGIC;
cgp->cg_cgx = cg;
cgp->cg_niblk = sblock.fs_ipg;
- cgp->cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ?
- sblock.fs_ipg : 2 * INOPB(&sblock);
+ cgp->cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock));
if (cgbase(&sblock, cg) + sblock.fs_fpg < sblock.fs_size)
cgp->cg_ndblk = sblock.fs_fpg;
else
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index e938178..0d78814 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -293,7 +293,7 @@ ginode(ino_t inumber)
if (pbp != NULL)
pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
- startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
+ startinum = rounddown(inumber, INOPB(&sblock));
}
if (sblock.fs_magic == FS_UFS1_MAGIC)
return ((union dinode *)
@@ -465,7 +465,7 @@ cacheino(union dinode *dp, ino_t inumber)
inp->i_number = inumber;
inp->i_isize = DIP(dp, di_size);
inp->i_numblks = blks;
- for (i = 0; i < (blks < NDADDR ? blks : NDADDR); i++)
+ for (i = 0; i < MIN(blks, NDADDR); i++)
inp->i_blks[i] = DIP(dp, di_db[i]);
if (blks > NDADDR)
for (i = 0; i < NIADDR; i++)
diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c
index 82c3b94..36a41ac 100644
--- a/sbin/fsck_ffs/pass2.c
+++ b/sbin/fsck_ffs/pass2.c
@@ -182,9 +182,7 @@ pass2(void)
memset(dp, 0, sizeof(struct ufs2_dinode));
DIP_SET(dp, di_mode, IFDIR);
DIP_SET(dp, di_size, inp->i_isize);
- for (i = 0;
- i < (inp->i_numblks<NDADDR ? inp->i_numblks : NDADDR);
- i++)
+ for (i = 0; i < MIN(inp->i_numblks, NDADDR); i++)
DIP_SET(dp, di_db[i], inp->i_blks[i]);
if (inp->i_numblks > NDADDR)
for (i = 0; i < NIADDR; i++)
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 494e503..ff7e9ef 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -245,8 +245,7 @@ setup(char *dev)
goto badsb;
}
for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) {
- size = sblock.fs_cssize - i < sblock.fs_bsize ?
- sblock.fs_cssize - i : sblock.fs_bsize;
+ size = MIN(sblock.fs_cssize - i, sblock.fs_bsize);
readcnt[sblk.b_type]++;
if (blread(fsreadfd, (char *)sblock.fs_csp + i,
fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag),
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index 58949c9..b265dfc 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -911,7 +911,7 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
* certain we hit a valid record and not some junk in the middle
* of a file name. Stop when we reach or pass the expected offset.
*/
- dpoff = (doff / DIRBLKSIZ) * DIRBLKSIZ;
+ dpoff = rounddown(doff, DIRBLKSIZ);
do {
dp = (struct direct *)&block[dpoff];
if (dpoff == doff)
diff --git a/sbin/geom/class/virstor/geom_virstor.c b/sbin/geom/class/virstor/geom_virstor.c
index 15a5676..7b83852 100644
--- a/sbin/geom/class/virstor/geom_virstor.c
+++ b/sbin/geom/class/virstor/geom_virstor.c
@@ -255,7 +255,7 @@ virstor_label(struct gctl_req *req)
if (md.md_chunk_size % MAXPHYS != 0) {
/* XXX: This is not strictly needed, but it's convenient to
* impose some limitations on it, so why not MAXPHYS. */
- size_t new_size = (md.md_chunk_size / MAXPHYS) * MAXPHYS;
+ size_t new_size = rounddown(md.md_chunk_size, MAXPHYS);
if (new_size < md.md_chunk_size)
new_size += MAXPHYS;
fprintf(stderr, "Resizing chunk size to be a multiple of "
diff --git a/sbin/growfs/debug.c b/sbin/growfs/debug.c
index 55e2b13..d371013 100644
--- a/sbin/growfs/debug.c
+++ b/sbin/growfs/debug.c
@@ -518,7 +518,8 @@ dbg_dump_frmap(struct fs *sb, const char *comment, struct cg *cgr)
cp = (unsigned char *)cg_blksfree(cgr);
if (sb->fs_old_nspf)
- e = howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT);
+ e = howmany(sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf,
+ CHAR_BIT);
else
e = 0;
for (j = 0; j < e; j += 32) {
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 5d13a3c..6d633a2 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -348,8 +348,7 @@ initcg(int cylno, time_t modtime, int fso, unsigned int Nflag)
acg.cg_magic = CG_MAGIC;
acg.cg_cgx = cylno;
acg.cg_niblk = sblock.fs_ipg;
- acg.cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ?
- sblock.fs_ipg : 2 * INOPB(&sblock);
+ acg.cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock));
acg.cg_ndblk = dmax - cbase;
if (sblock.fs_contigsumsize > 0)
acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
diff --git a/sbin/hastd/hooks.c b/sbin/hastd/hooks.c
index b1886ca..8cff3bf 100644
--- a/sbin/hastd/hooks.c
+++ b/sbin/hastd/hooks.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fcntl.h>
-#include <libgen.h>
#include <paths.h>
#include <signal.h>
#include <stdbool.h>
@@ -352,7 +351,7 @@ hook_execv(const char *path, va_list ap)
return;
memset(args, 0, sizeof(args));
- args[0] = basename(path);
+ args[0] = __DECONST(char *, path);
for (ii = 1; ii < sizeof(args) / sizeof(args[0]); ii++) {
args[ii] = va_arg(ap, char *);
if (args[ii] == NULL)
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 21b6229..5389268 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -82,7 +82,7 @@ int ipfw_socket = -1;
* Check if we have enough space in cmd buffer. Note that since
* first 8? u32 words are reserved by reserved header, full cmd
* buffer can't be used, so we need to protect from buffer overrun
- * only. At the beginnig, cblen is less than actual buffer size by
+ * only. At the beginning, cblen is less than actual buffer size by
* size of ipfw_insn_u32 instruction + 1 u32 work. This eliminates need
* for checking small instructions fitting in given range.
* We also (ab)use the fact that ipfw_insn is always the first field
@@ -4929,7 +4929,7 @@ table_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx)
* Rules in reply are modified to store their actual ruleset number.
*
* (*1) TLVs inside IPFW_TLV_TBL_LIST needs to be sorted ascending
- * accoring to their idx field and there has to be no duplicates.
+ * according to their idx field and there has to be no duplicates.
* (*2) Numbered rules inside IPFW_TLV_RULE_LIST needs to be sorted ascending.
* (*3) Each ip_fw structure needs to be aligned to u64 boundary.
*/
diff --git a/sbin/ipfw/ipv6.c b/sbin/ipfw/ipv6.c
index c04dd70..6d884ee 100644
--- a/sbin/ipfw/ipv6.c
+++ b/sbin/ipfw/ipv6.c
@@ -325,7 +325,7 @@ lookup_host6 (char *host, struct in6_addr *ip6addr)
* any matches any IP6. Actually returns an empty instruction.
* me returns O_IP6_*_ME
*
- * 03f1::234:123:0342 single IP6 addres
+ * 03f1::234:123:0342 single IP6 address
* 03f1::234:123:0342/24 address/mask
* 03f1::234:123:0342/24,03f1::234:123:0343/ List of address
*
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index ee6ed96..b736978 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -613,8 +613,7 @@ restart:
}
for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize)
wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)),
- sblock.fs_cssize - i < sblock.fs_bsize ?
- sblock.fs_cssize - i : sblock.fs_bsize,
+ MIN(sblock.fs_cssize - i, sblock.fs_bsize),
((char *)fscs) + i);
/*
* Update information about this partition in pack
@@ -660,8 +659,7 @@ initcg(int cylno, time_t utime)
acg.cg_magic = CG_MAGIC;
acg.cg_cgx = cylno;
acg.cg_niblk = sblock.fs_ipg;
- acg.cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ?
- sblock.fs_ipg : 2 * INOPB(&sblock);
+ acg.cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock));
acg.cg_ndblk = dmax - cbase;
if (sblock.fs_contigsumsize > 0)
acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
@@ -771,7 +769,7 @@ initcg(int cylno, time_t utime)
* Write out the duplicate super block, the cylinder group map
* and two blocks worth of inodes in a single write.
*/
- start = sblock.fs_bsize > SBLOCKSIZE ? sblock.fs_bsize : SBLOCKSIZE;
+ start = MAX(sblock.fs_bsize, SBLOCKSIZE);
bcopy((char *)&acg, &iobuf[start], sblock.fs_cgsize);
start += sblock.fs_bsize;
dp1 = (struct ufs1_dinode *)(&iobuf[start]);
diff --git a/sbin/newfs_nandfs/newfs_nandfs.c b/sbin/newfs_nandfs/newfs_nandfs.c
index 8ec285d..c9e0927 100644
--- a/sbin/newfs_nandfs/newfs_nandfs.c
+++ b/sbin/newfs_nandfs/newfs_nandfs.c
@@ -132,7 +132,7 @@ static uint32_t nuserfiles;
static uint32_t seg_nblocks;
static uint32_t seg_endblock;
-#define SIZE_TO_BLOCK(size) (((size) + (blocksize - 1)) / blocksize)
+#define SIZE_TO_BLOCK(size) howmany(size, blocksize)
static uint32_t
nandfs_first_block(void)
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 7cbaa53..8123998 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -6470,7 +6470,7 @@ rt_tableid_max(void)
/*
* As the OpenBSD code only compares > and not >= we need to adjust
* here given we only accept values of 0..n and want to avoid #ifdefs
- * in the grammer.
+ * in the grammar.
*/
return (fibs - 1);
#else
diff --git a/sbin/recoverdisk/recoverdisk.c b/sbin/recoverdisk/recoverdisk.c
index af0d88e..ac2788a 100644
--- a/sbin/recoverdisk/recoverdisk.c
+++ b/sbin/recoverdisk/recoverdisk.c
@@ -207,7 +207,7 @@ main(int argc, char * const argv[])
sectorsize = stripesize;
minsize = sectorsize;
- bigsize = (bigsize / sectorsize) * sectorsize;
+ bigsize = rounddown(bigsize, sectorsize);
error = ioctl(fdr, DIOCGMEDIASIZE, &t);
if (error < 0)
@@ -222,7 +222,7 @@ main(int argc, char * const argv[])
for (ch = 0; (bigsize >> ch) > minsize; ch++)
continue;
medsize = bigsize >> (ch / 2);
- medsize = (medsize / minsize) * minsize;
+ medsize = rounddown(medsize, minsize);
fprintf(stderr, "Bigsize = %zu, medsize = %zu, minsize = %zu\n",
bigsize, medsize, minsize);
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index dcf2840..57b0523 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -85,7 +85,7 @@ struct modeinfo {
mode_t mode;
uid_t uid;
gid_t gid;
- int flags;
+ u_int flags;
int extsize;
};
@@ -115,8 +115,8 @@ static struct inotab *allocinotab(struct context *, long);
static void flushent(void);
static struct inotab *inotablookup(ino_t);
static RST_DIR *opendirfile(const char *);
-static void putdir(char *, long);
-static void putdirattrs(char *, long);
+static void putdir(char *, size_t);
+static void putdirattrs(char *, size_t);
static void putent(struct direct *);
static void rst_seekdir(RST_DIR *, long, long);
static long rst_telldir(RST_DIR *);
@@ -323,10 +323,10 @@ searchdir(ino_t inum, char *name)
* Put the directory entries in the directory file
*/
static void
-putdir(char *buf, long size)
+putdir(char *buf, size_t size)
{
struct direct *dp;
- long loc, i;
+ size_t loc, i;
for (loc = 0; loc < size; ) {
dp = (struct direct *)(buf + loc);
@@ -356,12 +356,12 @@ putdir(char *buf, long size)
"reclen not multiple of 4 ");
if (dp->d_reclen < DIRSIZ(0, dp))
vprintf(stdout,
- "reclen less than DIRSIZ (%d < %zu) ",
+ "reclen less than DIRSIZ (%u < %zu) ",
dp->d_reclen, DIRSIZ(0, dp));
#if NAME_MAX < 255
if (dp->d_namlen > NAME_MAX)
vprintf(stdout,
- "reclen name too big (%d > %d) ",
+ "reclen name too big (%u > %u) ",
dp->d_namlen, NAME_MAX);
#endif
vprintf(stdout, "\n");
@@ -418,7 +418,7 @@ flushent(void)
* Save extended attributes for a directory entry to a file.
*/
static void
-putdirattrs(char *buf, long size)
+putdirattrs(char *buf, size_t size)
{
if (mf != NULL && fwrite(buf, size, 1, mf) != 1)
diff --git a/sbin/restore/extern.h b/sbin/restore/extern.h
index 7b744e2..9b319ca 100644
--- a/sbin/restore/extern.h
+++ b/sbin/restore/extern.h
@@ -54,8 +54,8 @@ void freeentry(struct entry *);
void freename(char *);
int genliteraldir(char *, ino_t);
char *gentempname(struct entry *);
-void getfile(void (*)(char *, long), void (*)(char *, long),
- void (*)(char *, long));
+void getfile(void (*)(char *, size_t), void (*)(char *, size_t),
+ void (*)(char *, size_t));
void getvol(long);
void initsymtable(char *);
int inodetype(ino_t);
@@ -98,7 +98,7 @@ void swabst(u_char *, u_char *);
void treescan(char *, ino_t, long (*)(char *, ino_t, int));
ino_t upperbnd(ino_t);
long verifyfile(char *, ino_t, int);
-void xtrnull(char *, long);
+void xtrnull(char *, size_t);
/* From ../dump/dumprmt.c */
void rmtclose(void);
diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c
index 05d1a58..6f4c02e 100644
--- a/sbin/restore/interactive.c
+++ b/sbin/restore/interactive.c
@@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$");
#include "restore.h"
#include "extern.h"
-#define round(a, b) (((a) + (b) - 1) / (b) * (b))
-
/*
* Things to handle interruptions.
*/
@@ -671,7 +669,7 @@ formatf(struct afile *list, int nentry)
columns = 81 / width;
if (columns == 0)
columns = 1;
- lines = (nentry + columns - 1) / columns;
+ lines = howmany(nentry, columns);
for (i = 0; i < lines; i++) {
for (j = 0; j < columns; j++) {
fp = &list[j * lines + i];
diff --git a/sbin/restore/main.c b/sbin/restore/main.c
index 91f4a83..d74e59e 100644
--- a/sbin/restore/main.c
+++ b/sbin/restore/main.c
@@ -366,7 +366,8 @@ obsolete(int *argcp, char **argvp[])
if (flags) {
*p = '\0';
*nargv++ = flagsp;
- }
+ } else
+ free(flagsp);
/* Copy remaining arguments. */
while ((*nargv++ = *argv++));
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index 7da7cc3..0713ff0 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -535,9 +535,8 @@ initsymtable(char *filename)
vprintf(stdout, "Initialize symbol table.\n");
if (filename == NULL) {
entrytblsize = maxino / HASHFACTOR;
- entry = (struct entry **)
- calloc((unsigned)entrytblsize, sizeof(struct entry *));
- if (entry == (struct entry **)NULL)
+ entry = calloc((unsigned)entrytblsize, sizeof(struct entry *));
+ if (entry == NULL)
panic("no memory for entry table\n");
ep = addentry(".", ROOTINO, NODE);
ep->e_flags |= NEW;
@@ -560,6 +559,7 @@ initsymtable(char *filename)
fprintf(stderr, "read: %s\n", strerror(errno));
panic("cannot read symbol table file %s\n", filename);
}
+ (void)close(fd);
switch (command) {
case 'r':
/*
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index 3c0a510..f66f8b4 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -104,10 +104,10 @@ static int checksum(int *);
static void findinode(struct s_spcl *);
static void findtapeblksize(void);
static char *setupextattr(int);
-static void xtrattr(char *, long);
+static void xtrattr(char *, size_t);
static void set_extattr_link(char *, void *, int);
static void set_extattr_fd(int, char *, void *, int);
-static void skiphole(void (*)(char *, long), long *);
+static void skiphole(void (*)(char *, size_t), size_t *);
static int gethead(struct s_spcl *);
static void readtape(char *);
static void setdumpnum(void);
@@ -115,12 +115,12 @@ static u_long swabl(u_long);
static u_char *swablong(u_char *, int);
static u_char *swabshort(u_char *, int);
static void terminateinput(void);
-static void xtrfile(char *, long);
-static void xtrlnkfile(char *, long);
-static void xtrlnkskip(char *, long);
-static void xtrmap(char *, long);
-static void xtrmapskip(char *, long);
-static void xtrskip(char *, long);
+static void xtrfile(char *, size_t);
+static void xtrlnkfile(char *, size_t);
+static void xtrlnkskip(char *, size_t);
+static void xtrmap(char *, size_t);
+static void xtrmapskip(char *, size_t);
+static void xtrskip(char *, size_t);
/*
* Set up an input source
@@ -566,7 +566,7 @@ printdumpinfo(void)
int
extractfile(char *name)
{
- int flags;
+ u_int flags;
uid_t uid;
gid_t gid;
mode_t mode;
@@ -932,7 +932,7 @@ skipfile(void)
* Skip a hole in an output file
*/
static void
-skiphole(void (*skip)(char *, long), long *seekpos)
+skiphole(void (*skip)(char *, size_t), size_t *seekpos)
{
char buf[MAXBSIZE];
@@ -949,14 +949,14 @@ skiphole(void (*skip)(char *, long), long *seekpos)
* to the skip function.
*/
void
-getfile(void (*datafill)(char *, long), void (*attrfill)(char *, long),
- void (*skip)(char *, long))
+getfile(void (*datafill)(char *, size_t), void (*attrfill)(char *, size_t),
+ void (*skip)(char *, size_t))
{
int i;
- off_t size;
- long seekpos;
+ volatile off_t size;
+ size_t seekpos;
int curblk, attrsize;
- void (*fillit)(char *, long);
+ void (*fillit)(char *, size_t);
char buf[MAXBSIZE / TP_BSIZE][TP_BSIZE];
char junk[TP_BSIZE];
@@ -1093,7 +1093,7 @@ setupextattr(int extsize)
* Extract the next block of extended attributes.
*/
static void
-xtrattr(char *buf, long size)
+xtrattr(char *buf, size_t size)
{
if (extloc + size > extbufsize)
@@ -1106,7 +1106,7 @@ xtrattr(char *buf, long size)
* Write out the next block of a file.
*/
static void
-xtrfile(char *buf, long size)
+xtrfile(char *buf, size_t size)
{
if (Nflag)
@@ -1123,7 +1123,7 @@ xtrfile(char *buf, long size)
*/
/* ARGSUSED */
static void
-xtrskip(char *buf, long size)
+xtrskip(char *buf, size_t size)
{
if (lseek(ofile, size, SEEK_CUR) == -1) {
@@ -1138,7 +1138,7 @@ xtrskip(char *buf, long size)
* Collect the next block of a symbolic link.
*/
static void
-xtrlnkfile(char *buf, long size)
+xtrlnkfile(char *buf, size_t size)
{
pathlen += size;
@@ -1155,7 +1155,7 @@ xtrlnkfile(char *buf, long size)
*/
/* ARGSUSED */
static void
-xtrlnkskip(char *buf, long size)
+xtrlnkskip(char *buf, size_t size)
{
fprintf(stderr, "unallocated block in symbolic link %s\n",
@@ -1167,7 +1167,7 @@ xtrlnkskip(char *buf, long size)
* Collect the next block of a bit map.
*/
static void
-xtrmap(char *buf, long size)
+xtrmap(char *buf, size_t size)
{
memmove(map, buf, size);
@@ -1179,7 +1179,7 @@ xtrmap(char *buf, long size)
*/
/* ARGSUSED */
static void
-xtrmapskip(char *buf, long size)
+xtrmapskip(char *buf, size_t size)
{
panic("hole in map\n");
@@ -1191,7 +1191,7 @@ xtrmapskip(char *buf, long size)
*/
/* ARGSUSED */
void
-xtrnull(char *buf, long size)
+xtrnull(char *buf, size_t size)
{
return;
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c
index 03b2b09..0c534ad 100644
--- a/sbin/swapon/swapon.c
+++ b/sbin/swapon/swapon.c
@@ -428,7 +428,7 @@ swap_on_off_geli(const char *name, char *mntops, int doingall)
free(args);
if (error) {
- /* error occured during creation. */
+ /* error occurred during creation. */
if (qflag == 0)
warnx("%s: Invalid parameters", name);
return (NULL);
diff --git a/sbin/tests/Makefile b/sbin/tests/Makefile
index 609357e..06058a0 100644
--- a/sbin/tests/Makefile
+++ b/sbin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/secure/lib/tests/Makefile b/secure/lib/tests/Makefile
index 609357e..06058a0 100644
--- a/secure/lib/tests/Makefile
+++ b/secure/lib/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/secure/libexec/tests/Makefile b/secure/libexec/tests/Makefile
index 609357e..06058a0 100644
--- a/secure/libexec/tests/Makefile
+++ b/secure/libexec/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/secure/tests/Makefile b/secure/tests/Makefile
index 609357e..06058a0 100644
--- a/secure/tests/Makefile
+++ b/secure/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/secure/usr.bin/tests/Makefile b/secure/usr.bin/tests/Makefile
index 609357e..06058a0 100644
--- a/secure/usr.bin/tests/Makefile
+++ b/secure/usr.bin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/secure/usr.sbin/tests/Makefile b/secure/usr.sbin/tests/Makefile
index 609357e..06058a0 100644
--- a/secure/usr.sbin/tests/Makefile
+++ b/secure/usr.sbin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/share/examples/ipfilter/ipf-howto.txt b/share/examples/ipfilter/ipf-howto.txt
index 54187ae..95b69dc 100644
--- a/share/examples/ipfilter/ipf-howto.txt
+++ b/share/examples/ipfilter/ipf-howto.txt
@@ -1036,11 +1036,11 @@ In this case, the server is running no services. Infact,
it's not a server, it's a client. And this client doesn't
want unauthorized packets entering its IP stack at all.
However, the client wants full access to the internet and
-the reply packets that such privledge entails. This simple
+the reply packets that such privilege entails. This simple
ruleset creates state entries for every new outgoing TCP
session. Again, since a state entry is created, these new
TCP sessions are free to talk back and forth as they please
-without the hinderance or inspection of the firewall rule-
+without the hindrance or inspection of the firewall rule-
set. We mentioned that this also works for UDP and ICMP:
block in quick on tun0 all
@@ -1271,7 +1271,7 @@ forgeries and allow fragments:
This works because every packet that should be allowed
through makes it into the state table before the blocking
rules are reached. The only scan this won't detect is a SYN
-scan itself. If you're truely worried about that, you might
+scan itself. If you're truly worried about that, you might
even want to log all initial SYN packets.
3.6. Responding To a Blocked Packet
diff --git a/share/examples/kld/cdev/test/Makefile b/share/examples/kld/cdev/test/Makefile
index eebf54d..b108a69 100644
--- a/share/examples/kld/cdev/test/Makefile
+++ b/share/examples/kld/cdev/test/Makefile
@@ -73,7 +73,7 @@ WARNS?= 5
MODSTAT= /sbin/kldstat
load:
- @echo "This test program will call the sample kld characer device ";
+ @echo "This test program will call the sample kld character device ";
@echo "driver."
@echo
@echo "The sample driver will display a message on the"
diff --git a/share/examples/tests/Makefile b/share/examples/tests/Makefile
index c543aa3..77d89a4 100644
--- a/share/examples/tests/Makefile
+++ b/share/examples/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/share/examples/tests/tests/Makefile b/share/examples/tests/tests/Makefile
index c417531..08b6049 100644
--- a/share/examples/tests/tests/Makefile
+++ b/share/examples/tests/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
# Directory into which the Kyuafile provided by this directory will be
diff --git a/share/examples/tests/tests/atf/Makefile b/share/examples/tests/tests/atf/Makefile
index ef96dcb..6628a21 100644
--- a/share/examples/tests/tests/atf/Makefile
+++ b/share/examples/tests/tests/atf/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/share/examples/tests/tests/plain/Makefile b/share/examples/tests/tests/plain/Makefile
index 0b82397..e01de61 100644
--- a/share/examples/tests/tests/plain/Makefile
+++ b/share/examples/tests/tests/plain/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/share/man/man4/cxgbe.4 b/share/man/man4/cxgbe.4
index ea17f35..9821797 100644
--- a/share/man/man4/cxgbe.4
+++ b/share/man/man4/cxgbe.4
@@ -236,7 +236,7 @@ long as it is compatible with the driver and is a different version than
the one already on the card.
The default is 1.
.It Va hw.cxgbe.fl_pktshift
-The number of bytes of padding inserted before the begining of an Ethernet
+The number of bytes of padding inserted before the beginning of an Ethernet
frame in the receive buffer.
The default value of 2 ensures that the Ethernet payload (usually the IP header)
is at a 4 byte aligned address.
diff --git a/share/man/man4/ds3231.4 b/share/man/man4/ds3231.4
index 6fdcccc..4059a88 100644
--- a/share/man/man4/ds3231.4
+++ b/share/man/man4/ds3231.4
@@ -65,9 +65,9 @@ dev.ds3231.0.32khz_enable: 1
.It Va dev.ds3231.%d.temperature
The read-only value of the current temperature read by the RTC.
.It Va dev.ds3231.%d.temp_conv
-Start a new temperature convertion.
+Start a new temperature conversion.
When read as 1, a temperature conversion is in progress.
-When read as 0 and then set to 1, a temperature convertion is started.
+When read as 0 and then set to 1, a temperature conversion is started.
The temperature conversion runs automatically on power up and once every 64
seconds afterward.
.It Va dev.ds3231.%d.bbsqw
diff --git a/share/man/man4/ng_car.4 b/share/man/man4/ng_car.4
index ade4649..5950b99 100644
--- a/share/man/man4/ng_car.4
+++ b/share/man/man4/ng_car.4
@@ -123,9 +123,9 @@ Return current node configuration as
.Vt "struct ng_car_bulkconf"
.Bd -literal
struct ng_car_hookconf {
- uint64_t cbs; /* Commited burst size (bytes) */
+ uint64_t cbs; /* Committed burst size (bytes) */
uint64_t ebs; /* Exceeded/Peak burst size (bytes) */
- uint64_t cir; /* Commited information rate (bits/s) */
+ uint64_t cir; /* Committed information rate (bits/s) */
uint64_t pir; /* Peak information rate (bits/s) */
uint8_t green_action; /* Action for green packets */
uint8_t yellow_action; /* Action for yellow packets */
@@ -162,7 +162,7 @@ Return node statistics as
.Bd -literal
struct ng_car_hookstats {
uint64_t passed_pkts; /* Counter for passed packets */
- uint64_t droped_pkts; /* Counter for droped packets */
+ uint64_t droped_pkts; /* Counter for dropped packets */
uint64_t green_pkts; /* Counter for green packets */
uint64_t yellow_pkts; /* Counter for yellow packets */
uint64_t red_pkts; /* Counter for red packets */
diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4
index e0d056d..d7ddc89 100644
--- a/share/man/man4/ng_nat.4
+++ b/share/man/man4/ng_nat.4
@@ -259,7 +259,7 @@ struct ng_nat_libalias_info {
.Ed
In case of
.Nm
-failed to retreive a certain counter
+failed to retrieve a certain counter
from its
.Xr libalias
instance, the corresponding field is returned as
diff --git a/share/man/man4/random.4 b/share/man/man4/random.4
index bd7dec9..5e5388f 100644
--- a/share/man/man4/random.4
+++ b/share/man/man4/random.4
@@ -113,7 +113,7 @@ all settings are read-only.
The
.Pa kern.random.fortuna.minpoolsize
sysctl is used
-to set the seed threshhold.
+to set the seed threshold.
A smaller number gives a faster seed,
but a less secure one.
In practice,
diff --git a/share/man/man4/uplcom.4 b/share/man/man4/uplcom.4
index 6ed2038..d386261 100644
--- a/share/man/man4/uplcom.4
+++ b/share/man/man4/uplcom.4
@@ -98,7 +98,7 @@ HAL Corporation Crossam2+USB IR commander
.It
Hama USB RS-232 Serial Adapter
.It
-Hamlet exagerate XURS232
+Hamlet exaggerate XURS232
.It
HP LD220 Point-Of-Sale (POS) Display
.It
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 6025db4..ae4972e 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 28, 2016
+.Dd April 30, 2016
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -3511,6 +3511,12 @@ to not run
at boot time when
.Va dumpdir
is set.
+.It Va savecore_enable
+.Pq Vt bool
+If set to
+.Dq Li NO ,
+disable automatic extraction of the crash dump from the
+.Va dumpdev .
.It Va savecore_flags
.Pq Vt str
If crash dumps are enabled, these are the flags to pass to the
@@ -3862,6 +3868,9 @@ The names specified in this list control the jail startup order.
instances missing from
.Va jail_list
must be started manually.
+Note that a jail's
+.Va depend
+parameter in the configuration file may override this list.
.It Va jail_reverse_stop
.Pq Vt bool
When set to
diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index a605c28..9c27574 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 14, 2016
+.Dd April 28, 2016
.Dt BUILD 7
.Os
.Sh NAME
@@ -195,6 +195,12 @@ Build everything but the kernel, configure files in
.Pa etc ,
and
.Pa release .
+The object directory can be changed from the default
+.Pa /usr/obj
+by setting the
+.Pa MAKEOBJDIRPREFIX
+.Xr make 1
+variable.
The actual build location prefix used is
.Pa ${MAKEOBJDIRPREFIX}${.CURDIR}
for native builds, and
@@ -278,6 +284,12 @@ are:
.Bl -tag -width ".Cm distributekernel"
.It Cm buildkernel
Rebuild the kernel and the kernel modules.
+The object directory can be changed from the default
+.Pa /usr/obj
+by setting the
+.Pa MAKEOBJDIRPREFIX
+.Xr make 1
+variable.
.It Cm installkernel
Install the kernel and the kernel modules to directory
.Pa ${DESTDIR}/boot/kernel ,
@@ -347,7 +359,7 @@ should be set as with
.Dq Li "make installworld" .
.It Cm delete-old-libs
Delete obsolete base system libraries interactively.
-This target should only be used if no 3rd party software uses these
+This target should only be used if no third party software uses these
libraries.
When
.Li -DBATCH_DELETE_OLD_FILES
@@ -560,7 +572,7 @@ on built objects.
.It Va NO_SHARE
If set, the build does not descend into the
.Pa /usr/src/share
-subdirectory (i.e., manpages, locale data files, timezone data files and
+subdirectory (i.e., manual pages, locale data files, timezone data files and
other
.Pa /usr/src/share
files will not be rebuild from their sources).
diff --git a/share/man/man9/bus_activate_resource.9 b/share/man/man9/bus_activate_resource.9
index 12d202c..0bf7bdf 100644
--- a/share/man/man9/bus_activate_resource.9
+++ b/share/man/man9/bus_activate_resource.9
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 28, 2003
+.Dd April 28, 2016
.Dt BUS_ACTIVATE_RESOURCE 9
.Os
.Sh NAME
@@ -52,8 +52,12 @@
.Sh DESCRIPTION
These functions activate or deactivate a previously allocated resource.
In general, resources must be activated before they can be accessed by
-the driver so that the bus driver can map the resource into the
-devices space.
+the driver.
+Bus drivers may perform additional actions to ensure that the resource is
+ready to be accessed.
+For example,
+the PCI bus driver enables memory decoding in a PCI device's command register
+when activating a memory resource.
.Pp
The arguments are as follows:
.Bl -tag -width indent
@@ -65,6 +69,8 @@ The type of resource you want to allocate.
It is one of:
.Pp
.Bl -tag -width ".Dv SYS_RES_MEMORY" -compact
+.It Dv PCI_RES_BUS
+for PCI bus numbers
.It Dv SYS_RES_IRQ
for IRQs
.It Dv SYS_RES_DRQ
@@ -82,6 +88,47 @@ A pointer to the
returned by
.Xr bus_alloc_resource 9 .
.El
+.Ss Resource Mapping
+Resources which can be mapped for CPU access by a
+.Xr bus_space
+tag and handle will create a mapping of the entire resource when activated.
+The tag and handle for this mapping are stored in
+.Fa r
+and can be retrieved via
+.Xr rman_get_bustag 9
+and
+.Xr rman_get_bushandle 9 .
+These can be used with the
+.Xr bus_space 9
+API to access device registers or memory described by
+.Fa r .
+If the mapping is associated with a virtual address,
+the virtual address can be retrieved via
+.Xr rman_get_virtual 9 .
+.Pp
+A wrapper API for
+.Xr bus_space 9
+is also provided that accepts the associated resource as the first argument
+in place of the
+.Xr bus_space 9
+tag and handle.
+The functions in this wrapper API are named similarly to the
+.Xr bus_space 9
+API except that
+.Dq _space
+is removed from their name.
+For example,
+.Fn bus_read_4
+can be used in place of
+.Fn bus_space_read_4 .
+The wrapper API is preferred in new drivers.
+.Pp
+These two statements both read a 32-bit register at the start of a
+resource:
+.Bd -literal
+ bus_space_read_4(rman_get_bustag(res), rman_get_bushandle(res), 0);
+ bus_read_4(res, 0);
+.Ed
.Sh RETURN VALUES
Zero is returned on success, otherwise an error is returned.
.Sh SEE ALSO
diff --git a/share/man/man9/bus_alloc_resource.9 b/share/man/man9/bus_alloc_resource.9
index 2e5d506..ccb7117 100644
--- a/share/man/man9/bus_alloc_resource.9
+++ b/share/man/man9/bus_alloc_resource.9
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 23, 2016
+.Dd April 28, 2016
.Dt BUS_ALLOC_RESOURCE 9
.Os
.Sh NAME
@@ -95,6 +95,8 @@ Before allocation, the resource is owned by the parent bus.
is the type of resource you want to allocate.
It is one of:
.Bl -tag -width SYS_RES_MEMORY
+.It Dv PCI_RES_BUS
+for PCI bus numbers
.It Dv SYS_RES_IRQ
for IRQs
.It Dv SYS_RES_DRQ
@@ -111,7 +113,7 @@ For ISA this is an index into an array of resources that have been setup
for this device by either the PnP mechanism, or via the hints mechanism.
For PCCARD, this is an index into the array of resources described by the PC Card's
CIS entry.
-For PCI, the offset into pci config space which has the BAR to use to access
+For PCI, the offset into PCI config space which has the BAR to use to access
the resource.
The bus methods are free to change the RIDs that they are given as a parameter.
You must not depend on the value you gave it earlier.
@@ -152,6 +154,8 @@ The resource still needs to be activated with
.Xr bus_activate_resource 9 .
.It Dv RF_ACTIVE
activate resource atomically.
+.It Dv RF_PREFETCHABLE
+resource is prefetchable.
.It Dv RF_SHAREABLE
resource permits contemporaneous sharing.
It should always be set unless you know that the resource cannot be shared.
@@ -162,8 +166,6 @@ For example,
cannot share IRQs while
.Xr cardbus 4
can.
-.It Dv RF_TIMESHARE
-resource permits time-division sharing.
.El
.El
.Sh RETURN VALUES
diff --git a/share/man/man9/counter.9 b/share/man/man9/counter.9
index 0fcf2ad..a89d14d 100644
--- a/share/man/man9/counter.9
+++ b/share/man/man9/counter.9
@@ -80,7 +80,7 @@ update faster than simple arithmetic on the global variable.
Thus
.Nm
is considered suitable for accounting in the performance-critical
-code pathes.
+code paths.
.Bl -tag -width indent
.It Fn counter_u64_alloc wait
Allocate a new 64-bit unsigned counter.
diff --git a/share/man/man9/fpu_kern.9 b/share/man/man9/fpu_kern.9
index 748e6fc..92204d2 100644
--- a/share/man/man9/fpu_kern.9
+++ b/share/man/man9/fpu_kern.9
@@ -139,7 +139,7 @@ function ends the region started by
.Fn fpu_kern_enter .
The uses of FPU in the kernel after the call to
.Fn fpu_kern_leave
-are erronous until the next call to
+are erroneous until the next call to
.Fn fpu_kern_enter
is performed.
The function takes the
diff --git a/share/man/man9/hash.9 b/share/man/man9/hash.9
index 3276fd1..9dade6c 100644
--- a/share/man/man9/hash.9
+++ b/share/man/man9/hash.9
@@ -139,7 +139,7 @@ uses same hashing algorithm as the
.Fn jenkins_hash
function, but works only on
.Ft uint32_t
-sized arrays, thus is simplier and faster.
+sized arrays, thus is simpler and faster.
It accepts an array of
.Ft uint32_t
values in its first argument and size of this array in the second argument.
diff --git a/share/man/man9/hashinit.9 b/share/man/man9/hashinit.9
index 65ef10e..5357a95e 100644
--- a/share/man/man9/hashinit.9
+++ b/share/man/man9/hashinit.9
@@ -25,11 +25,11 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 23, 2016
+.Dd April 29, 2016
.Dt HASHINIT 9
.Os
.Sh NAME
-.Nm hashinit , hashinit_flags , hashdestroy , phashinit
+.Nm hashinit , hashinit_flags , hashdestroy , phashinit , phashinit_flags
.Nd manage kernel hash tables
.Sh SYNOPSIS
.In sys/malloc.h
@@ -45,12 +45,14 @@
.Fn hashdestroy "void *hashtbl" "struct malloc_type *type" "u_long hashmask"
.Ft "void *"
.Fn phashinit "int nelements" "struct malloc_type *type" "u_long *nentries"
+.Fn phashinit_flags "int nelements" "struct malloc_type *type" "u_long *nentries" "int flags"
.Sh DESCRIPTION
The
.Fn hashinit ,
-.Fn hashinit_flags
-and
+.Fn hashinit_flags ,
.Fn phashinit
+and
+.Fn phashinit_flags
functions allocate space for hash tables of size given by the argument
.Fa nelements .
.Pp
@@ -71,6 +73,12 @@ function operates like
but also accepts an additional argument
.Fa flags
which control various options during allocation.
+.Fn phashinit_flags
+function operates like
+.Fn phashinit
+but also accepts an additional argument
+.Fa flags
+which control various options during allocation.
Allocated hash tables are contiguous arrays of
.Xr LIST_HEAD 3
entries, allocated using
@@ -100,13 +108,19 @@ must be used with one of the following values.
.It Dv HASH_NOWAIT
Any malloc performed by the
.Fn hashinit_flags
+and
+.Fn phashinit_flags
function will not be allowed to wait, and therefore may fail.
.It Dv HASH_WAITOK
Any malloc performed by
.Fn hashinit_flags
+and
+.Fn phashinit_flags
function is allowed to wait for memory.
This is also the behavior of
-.Fn hashinit .
+.Fn hashinit
+and
+.Fn phashinit .
.El
.Sh IMPLEMENTATION NOTES
The largest prime hash value chosen by
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9
index 69afdc4..3ac23db 100644
--- a/share/man/man9/lock.9
+++ b/share/man/man9/lock.9
@@ -215,7 +215,7 @@ The flag allows exclusive requests to preempt the current shared request
even if the current thread owns shared locks.
This is safe since shared lock is guaranteed to not recurse, and is used
when thread is known to held unrelated shared locks, to not cause
-unneccessary starvation. An example is
+unnecessary starvation. An example is
.Dv vp
locking in VFS
.Xr lookup 9 ,
diff --git a/share/man/man9/pci.9 b/share/man/man9/pci.9
index ac7b28b..0e1024c 100644
--- a/share/man/man9/pci.9
+++ b/share/man/man9/pci.9
@@ -761,7 +761,7 @@ function assigns the
.Fa *count
messages allocated to the first
.Fa *count
-table indicies.
+table indices.
If
.Fn pci_alloc_msix
is not able to allocate any messages,
diff --git a/share/man/man9/sysctl.9 b/share/man/man9/sysctl.9
index ba1ffd9..097cc97d 100644
--- a/share/man/man9/sysctl.9
+++ b/share/man/man9/sysctl.9
@@ -616,14 +616,14 @@ flags to be set indicating the read and write disposition of the sysctl:
This is a read-only sysctl.
.It Dv CTLFLAG_RDTUN
This is a read-only sysctl and tunable which is tried fetched once
-from the system enviroment early during module load or system boot.
+from the system environment early during module load or system boot.
.It Dv CTLFLAG_WR
This is a writable sysctl.
.It Dv CTLFLAG_RW
This sysctl is readable and writable.
.It Dv CTLFLAG_RWTUN
This is a readable and writeable sysctl and tunable which is tried
-fetched once from the system enviroment early during module load or
+fetched once from the system environment early during module load or
system boot.
.It Dv CTLFLAG_NOFETCH
In case the node is marked as a tunable using the CTLFLAG_[XX]TUN,
@@ -647,7 +647,7 @@ When iterating the sysctl name space, do not list this sysctl.
.It Dv CTLFLAG_TUN
Advisory flag that a system tunable also exists for this variable.
The initial sysctl value is tried fetched once from the system
-enviroment early during module load or system boot.
+environment early during module load or system boot.
.It Dv CTLFLAG_DYN
Dynamically created OIDs automatically get this flag set.
.It Dv CTLFLAG_VNET
@@ -697,7 +697,7 @@ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
* the variable pointer and size are provided, as well as a format
* string for sysctl(8).
*/
-static l_fp pps_freq; /* scaled frequence offset (ns/s) */
+static l_fp pps_freq; /* scaled frequency offset (ns/s) */
SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD,
&pps_freq, sizeof(pps_freq), "I", "");
diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9
index 3f5b4dc..ee30942 100644
--- a/share/man/man9/timeout.9
+++ b/share/man/man9/timeout.9
@@ -239,7 +239,7 @@ The function
cancels a callout
.Fa c
if it is currently pending.
-If the callout is pending and successfuly stopped, then
+If the callout is pending and successfully stopped, then
.Fn callout_stop
returns a value of one.
If the callout is not set, or
diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9
index c974800..5047107 100644
--- a/share/man/man9/zone.9
+++ b/share/man/man9/zone.9
@@ -187,7 +187,7 @@ This flag requires either
or
.Dv UMA_ZONE_HASH ,
since subsystem requires a mechanism to find a book-keeping structure
-to an item beeing freed.
+to an item being freed.
The subsystem may choose to prefer offpage book-keeping for certain zones
implicitly.
.It Dv UMA_ZONE_ZINIT
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index 11a469d..7081c9e 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -122,10 +122,10 @@ _CPUCFLAGS = -march=armv7 -DARM_ARCH_6=1 -mfpu=vfp
_CPUCFLAGS = -march=${CPUTYPE}
. else
# Common values for FreeBSD
-# arm: (any arm v4 or v5 processor you are targetting)
+# arm: (any arm v4 or v5 processor you are targeting)
# arm920t, arm926ej-s, marvell-pj4, fa526, fa626,
# fa606te, fa626te, fa726te
-# armv6: (any arm v7 or v8 processor you are targetting and the arm1176jzf-s)
+# armv6: (any arm v7 or v8 processor you are targeting and the arm1176jzf-s)
# arm1176jzf-s, generic-armv7-a, cortex-a5, cortex-a7, cortex-a8,
# cortex-a9, cortex-a12, cortex-a15, cortex-a17, cortex-a53, cortex-a57,
# cortex-a72, exynos-m1
diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk
index fa395f8..b84cd84 100644
--- a/share/mk/bsd.files.mk
+++ b/share/mk/bsd.files.mk
@@ -9,7 +9,7 @@ __<bsd.files.mk>__:
FILESGROUPS?= FILES
-_FILESGROUPS= ${FILESGROUPS:C,[/*],_,g}
+_FILESGROUPS= ${FILESGROUPS:C,[/*],_,g:u}
.for group in ${_FILESGROUPS}
# Add in foo.yes and remove duplicates from all the groups
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index fa6c6d4..ba31e82 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -16,7 +16,7 @@
#
# SUBDIR A list of subdirectories that should be built as well.
# Each of the targets will execute the same target in the
-# subdirectories. SUBDIR.yes is automatically appeneded
+# subdirectories. SUBDIR.yes is automatically appended
# to this list.
#
# +++ targets +++
diff --git a/share/mk/local.gendirdeps.mk b/share/mk/local.gendirdeps.mk
index ac22471..b477c9b 100644
--- a/share/mk/local.gendirdeps.mk
+++ b/share/mk/local.gendirdeps.mk
@@ -3,7 +3,7 @@
# we need a keyword, this noise is to prevent it being expanded
GENDIRDEPS_HEADER= echo '\# ${FreeBSD:L:@v@$$$v$$ @:M*F*}';
-# supress optional/auto dependecies
+# suppress optional/auto dependencies
# local.dirdeps.mk will put them in if necessary
GENDIRDEPS_FILTER+= \
Nbin/cat.host \
diff --git a/share/tests/Makefile b/share/tests/Makefile
index 6448a41..f3c2ef3 100644
--- a/share/tests/Makefile
+++ b/share/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
TESTSDIR= ${TESTSBASE}/share
diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES
index c87ad64..604a1a3 100644
--- a/sys/amd64/conf/NOTES
+++ b/sys/amd64/conf/NOTES
@@ -177,11 +177,6 @@ options MAXMEM=(128*1024)
#options BROKEN_KEYBOARD_RESET
#
-# PCI bus & PCI options:
-#
-device pci
-
-#
# AGP GART support
device agp
diff --git a/sys/arm/allwinner/allwinner_machdep.c b/sys/arm/allwinner/allwinner_machdep.c
index b916580..e5c8eb8 100644
--- a/sys/arm/allwinner/allwinner_machdep.c
+++ b/sys/arm/allwinner/allwinner_machdep.c
@@ -148,7 +148,7 @@ static platform_method_t a10_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10");
+FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10", 200);
#endif
#if defined(SOC_ALLWINNER_A20)
@@ -163,7 +163,7 @@ static platform_method_t a20_methods[] = {
#endif
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20");
+FDT_PLATFORM_DEF(a20, "a20", 0, "allwinner,sun7i-a20", 200);
#endif
#if defined(SOC_ALLWINNER_A31)
@@ -178,7 +178,7 @@ static platform_method_t a31_methods[] = {
#endif
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31");
+FDT_PLATFORM_DEF(a31, "a31", 0, "allwinner,sun6i-a31", 200);
#endif
#if defined(SOC_ALLWINNER_A31S)
@@ -193,7 +193,7 @@ static platform_method_t a31s_methods[] = {
#endif
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s");
+FDT_PLATFORM_DEF(a31s, "a31s", 0, "allwinner,sun6i-a31s", 200);
#endif
u_int
diff --git a/sys/arm/allwinner/aw_nmi.c b/sys/arm/allwinner/aw_nmi.c
index 6c350cc..1cdd50e 100644
--- a/sys/arm/allwinner/aw_nmi.c
+++ b/sys/arm/allwinner/aw_nmi.c
@@ -277,8 +277,11 @@ aw_nmi_teardown_intr(device_t dev, struct intr_irqsrc *isrc,
static void
aw_nmi_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
{
+ struct aw_nmi_softc *sc;
+ sc = device_get_softc(dev);
aw_nmi_disable_intr(dev, isrc);
+ SC_NMI_WRITE(sc, NMI_IRQ_PENDING_REG, NMI_IRQ_ACK);
}
static void
diff --git a/sys/arm/allwinner/timer.c b/sys/arm/allwinner/timer.c
index d25aa3c..790b8e4 100644
--- a/sys/arm/allwinner/timer.c
+++ b/sys/arm/allwinner/timer.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
+#include <machine/machdep.h>
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
@@ -100,11 +101,12 @@ static int a10_timer_timer_stop(struct eventtimer *);
static uint64_t timer_read_counter64(void);
-static int a10_timer_initialized = 0;
static int a10_timer_hardclock(void *);
static int a10_timer_probe(device_t);
static int a10_timer_attach(device_t);
+static delay_func a10_timer_delay;
+
static struct timecounter a10_timer_timecounter = {
.tc_name = "a10_timer timer0",
.tc_get_timecount = a10_timer_get_timecount,
@@ -209,8 +211,10 @@ a10_timer_attach(device_t dev)
sc->et.et_priv = sc;
et_register(&sc->et);
- if (device_get_unit(dev) == 0)
+ if (device_get_unit(dev) == 0) {
+ arm_set_delay(a10_timer_delay, sc);
a10_timer_sc = sc;
+ }
a10_timer_timecounter.tc_frequency = sc->timer0_freq;
tc_init(&a10_timer_timecounter);
@@ -224,8 +228,6 @@ a10_timer_attach(device_t dev)
a10_timer_timecounter.tc_frequency);
}
- a10_timer_initialized = 1;
-
return (0);
}
@@ -352,23 +354,15 @@ static devclass_t a10_timer_devclass;
EARLY_DRIVER_MODULE(a10_timer, simplebus, a10_timer_driver, a10_timer_devclass, 0, 0,
BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
-void
-DELAY(int usec)
+static void
+a10_timer_delay(int usec, void *arg)
{
- uint32_t counter;
+ struct a10_timer_softc *sc = arg;
uint64_t end, now;
- if (!a10_timer_initialized) {
- for (; usec > 0; usec--)
- for (counter = 50; counter > 0; counter--)
- cpufunc_nullop();
- return;
- }
-
now = timer_read_counter64();
- end = now + (a10_timer_sc->timer0_freq / 1000000) * (usec + 1);
+ end = now + (sc->timer0_freq / 1000000) * (usec + 1);
while (now < end)
now = timer_read_counter64();
}
-
diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c
index e14b870..6e6fcea 100644
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$");
#include <machine/intr.h>
#include <machine/md_var.h>
+#ifdef MULTIDELAY
+#include <machine/machdep.h> /* For arm_set_delay */
+#endif
+
#ifdef FDT
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
@@ -126,6 +130,7 @@ static struct timecounter arm_tmr_timecount = {
static uint32_t arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th,
struct timecounter *tc);
+static void arm_tmr_do_delay(int usec, void *);
static int
get_freq(void)
@@ -419,6 +424,10 @@ arm_tmr_attach(device_t dev)
sc->et.et_priv = sc;
et_register(&sc->et);
+#ifdef MULTIDELAY
+ arm_set_delay(arm_tmr_do_delay, sc);
+#endif
+
return (0);
}
@@ -463,27 +472,13 @@ EARLY_DRIVER_MODULE(timer, acpi, arm_tmr_acpi_driver, arm_tmr_acpi_devclass,
0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
#endif
-void
-DELAY(int usec)
+static void
+arm_tmr_do_delay(int usec, void *arg)
{
+ struct arm_tmr_softc *sc = arg;
int32_t counts, counts_per_usec;
uint32_t first, last;
- /*
- * Check the timers are setup, if not just
- * use a for loop for the meantime
- */
- if (arm_tmr_sc == NULL) {
- for (; usec > 0; usec--)
- for (counts = 200; counts > 0; counts--)
- /*
- * Prevent the compiler from optimizing
- * out the loop
- */
- cpufunc_nullop();
- return;
- }
-
/* Get the number of times to count */
counts_per_usec = ((arm_tmr_timecount.tc_frequency / 1000000) + 1);
@@ -498,15 +493,38 @@ DELAY(int usec)
else
counts = usec * counts_per_usec;
- first = get_cntxct(arm_tmr_sc->physical);
+ first = get_cntxct(sc->physical);
while (counts > 0) {
- last = get_cntxct(arm_tmr_sc->physical);
+ last = get_cntxct(sc->physical);
counts -= (int32_t)(last - first);
first = last;
}
}
+#ifndef MULTIDELAY
+void
+DELAY(int usec)
+{
+ int32_t counts;
+
+ /*
+ * Check the timers are setup, if not just
+ * use a for loop for the meantime
+ */
+ if (arm_tmr_sc == NULL) {
+ for (; usec > 0; usec--)
+ for (counts = 200; counts > 0; counts--)
+ /*
+ * Prevent the compiler from optimizing
+ * out the loop
+ */
+ cpufunc_nullop();
+ } else
+ arm_tmr_do_delay(usec, arm_tmr_sc);
+}
+#endif
+
static uint32_t
arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th,
struct timecounter *tc)
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index a147dc3..453c197 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -243,6 +243,10 @@ uint32_t memstart[LBABI_MAX_BANKS];
uint32_t memsize[LBABI_MAX_BANKS];
uint32_t membanks;
#endif
+#ifdef MULTIDELAY
+static delay_func *delay_impl;
+static void *delay_arg;
+#endif
static uint32_t board_revision;
/* hex representation of uint64_t */
@@ -550,6 +554,24 @@ arm_generic_initclocks(void)
}
__weak_reference(arm_generic_initclocks, cpu_initclocks);
+#ifdef MULTIDELAY
+void
+arm_set_delay(delay_func *impl, void *arg)
+{
+
+ KASSERT(impl != NULL, ("No DELAY implementation"));
+ delay_impl = impl;
+ delay_arg = arg;
+}
+
+void
+DELAY(int usec)
+{
+
+ delay_impl(usec, delay_arg);
+}
+#endif
+
int
fill_regs(struct thread *td, struct reg *regs)
{
diff --git a/sys/arm/arm/platform.c b/sys/arm/arm/platform.c
index 658473e..ba23598 100644
--- a/sys/arm/arm/platform.c
+++ b/sys/arm/arm/platform.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus_dma.h>
#include <machine/cpu.h>
#include <machine/intr.h>
+#include <machine/machdep.h>
#include <machine/md_var.h>
#include <machine/platform.h>
#include <machine/platformvar.h>
@@ -75,6 +76,10 @@ SYSCTL_STRING(_hw, OID_AUTO, platform, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, plat_nam
*/
SET_DECLARE(platform_set, platform_def_t);
+#ifdef MULTIDELAY
+static delay_func platform_delay;
+#endif
+
void
platform_probe_and_attach(void)
{
@@ -100,8 +105,9 @@ platform_probe_and_attach(void)
* Take care of compiling the selected class, and
* then statically initialise the MMU object
*/
- kobj_class_compile_static(platp, &plat_kernel_kops);
- kobj_init_static((kobj_t)plat_obj, platp);
+ kobj_class_compile_static((kobj_class_t)platp,
+ &plat_kernel_kops);
+ kobj_init_static((kobj_t)plat_obj, (kobj_class_t)platp);
plat_obj->cls = platp;
@@ -141,10 +147,16 @@ platform_probe_and_attach(void)
* correct one, and then attach.
*/
- kobj_class_compile_static(plat_def_impl, &plat_kernel_kops);
- kobj_init_static((kobj_t)plat_obj, plat_def_impl);
+ kobj_class_compile_static((kobj_class_t)plat_def_impl,
+ &plat_kernel_kops);
+ kobj_init_static((kobj_t)plat_obj, (kobj_class_t)plat_def_impl);
- strlcpy(plat_name,plat_def_impl->name,sizeof(plat_name));
+ strlcpy(plat_name, plat_def_impl->name, sizeof(plat_name));
+
+#ifdef MULTIDELAY
+ /* Set a default delay function */
+ arm_set_delay(platform_delay, NULL);
+#endif
PLATFORM_ATTACH(plat_obj);
}
@@ -177,6 +189,22 @@ platform_late_init(void)
PLATFORM_LATE_INIT(plat_obj);
}
+#ifdef MULTIDELAY
+static void
+platform_delay(int usec, void *arg __unused)
+{
+ int counts;
+
+ for (; usec > 0; usec--)
+ for (counts = plat_obj->cls->delay_count; counts > 0; counts--)
+ /*
+ * Prevent the compiler from optimizing
+ * out the loop
+ */
+ cpufunc_nullop();
+}
+#endif
+
#if defined(SMP) && defined(PLATFORM_SMP)
void
platform_mp_setmaxid(void)
diff --git a/sys/arm/at91/at91_pmc.c b/sys/arm/at91/at91_pmc.c
index a97849b..88810a6 100644
--- a/sys/arm/at91/at91_pmc.c
+++ b/sys/arm/at91/at91_pmc.c
@@ -506,7 +506,7 @@ at91_pmc_sense_main_clock(void)
* AT91C_MAIN_CLOCK in the kernel config file.
*/
if (ckgr_val >= 21000000)
- return ((ckgr_val + 250) / 500 * 500);
+ return (rounddown(ckgr_val + 250, 500));
/*
* Try to find the standard frequency that match best.
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
index 70d078a..811c108 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
@@ -142,7 +142,7 @@ static platform_method_t bcm2835_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b");
+FDT_PLATFORM_DEF(bcm2835, "bcm2835", 0, "raspberrypi,model-b", 0);
#endif
#ifdef SOC_BCM2836
@@ -153,5 +153,5 @@ static platform_method_t bcm2836_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709");
+FDT_PLATFORM_DEF(bcm2836, "bcm2836", 0, "brcm,bcm2709", 0);
#endif
diff --git a/sys/arm/conf/A10 b/sys/arm/conf/A10
index 4f15941..a648f37 100644
--- a/sys/arm/conf/A10
+++ b/sys/arm/conf/A10
@@ -30,6 +30,7 @@ options SOC_ALLWINNER_A10
options HZ=100
options SCHED_4BSD # 4BSD scheduler
options PLATFORM
+options MULTIDELAY
# Debugging for use in -current
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
diff --git a/sys/arm/conf/ALLWINNER b/sys/arm/conf/ALLWINNER
index dc62ccd..9bb0e0a 100644
--- a/sys/arm/conf/ALLWINNER
+++ b/sys/arm/conf/ALLWINNER
@@ -34,6 +34,7 @@ options SCHED_ULE # ULE scheduler
options SMP # Enable multiple cores
options PLATFORM
options PLATFORM_SMP
+options MULTIDELAY
# Debugging for use in -current
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
diff --git a/sys/arm/conf/NOTES b/sys/arm/conf/NOTES
index 3cd43af..ebb5d04 100644
--- a/sys/arm/conf/NOTES
+++ b/sys/arm/conf/NOTES
@@ -36,8 +36,6 @@ options SOC_MV_DISCOVERY
options SOC_MV_KIRKWOOD
options SOC_MV_ORION
-device pci
-
device at91_board_bwct
device at91_board_ethernut5
device at91_board_hl200
@@ -82,9 +80,7 @@ nodevice star_saver
nodevice warp_saver
nodevice cxgbe
-nodevice pcii
nodevice snd_cmi
-nodevice tnt4882
#
# Enable the kernel DTrace hooks which are required to load the DTrace
diff --git a/sys/arm/conf/VIRT b/sys/arm/conf/VIRT
index 374af87..ba73b59 100644
--- a/sys/arm/conf/VIRT
+++ b/sys/arm/conf/VIRT
@@ -28,6 +28,7 @@ options SCHED_ULE # 4BSD scheduler
options PLATFORM
options PLATFORM_SMP
options SMP # Enable multiple cores
+options MULTIDELAY
# Debugging for use in -current
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
diff --git a/sys/arm/freescale/imx/imx51_machdep.c b/sys/arm/freescale/imx/imx51_machdep.c
index c498bff..748cb10 100644
--- a/sys/arm/freescale/imx/imx51_machdep.c
+++ b/sys/arm/freescale/imx/imx51_machdep.c
@@ -101,4 +101,4 @@ static platform_method_t imx51_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(imx51, "i.MX51", 0, "fsl,imx51");
+FDT_PLATFORM_DEF(imx51, "i.MX51", 0, "fsl,imx51", 0);
diff --git a/sys/arm/freescale/imx/imx53_machdep.c b/sys/arm/freescale/imx/imx53_machdep.c
index 63dd949..96d0f5a 100644
--- a/sys/arm/freescale/imx/imx53_machdep.c
+++ b/sys/arm/freescale/imx/imx53_machdep.c
@@ -101,5 +101,5 @@ static platform_method_t imx53_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(imx53, "i.MX53", 0, "fsl,imx53");
+FDT_PLATFORM_DEF(imx53, "i.MX53", 0, "fsl,imx53", 0);
diff --git a/sys/arm/freescale/imx/imx6_machdep.c b/sys/arm/freescale/imx/imx6_machdep.c
index 8c767e1..7a4311d 100644
--- a/sys/arm/freescale/imx/imx6_machdep.c
+++ b/sys/arm/freescale/imx/imx6_machdep.c
@@ -354,6 +354,6 @@ static platform_method_t imx6_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF2(imx6, imx6s, "i.MX6 Solo", 0, "fsl,imx6s");
-FDT_PLATFORM_DEF2(imx6, imx6d, "i.MX6 Dual", 0, "fsl,imx6d");
-FDT_PLATFORM_DEF2(imx6, imx6q, "i.MX6 Quad", 0, "fsl,imx6q");
+FDT_PLATFORM_DEF2(imx6, imx6s, "i.MX6 Solo", 0, "fsl,imx6s", 0);
+FDT_PLATFORM_DEF2(imx6, imx6d, "i.MX6 Dual", 0, "fsl,imx6d", 0);
+FDT_PLATFORM_DEF2(imx6, imx6q, "i.MX6 Quad", 0, "fsl,imx6q", 0);
diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h
index b156efe..24c8a95 100644
--- a/sys/arm/include/machdep.h
+++ b/sys/arm/include/machdep.h
@@ -49,4 +49,9 @@ void board_set_revision(uint32_t);
int arm_predict_branch(void *, u_int, register_t, register_t *,
u_int (*)(void*, int), u_int (*)(void*, vm_offset_t, u_int*));
+#ifdef MULTIDELAY
+typedef void delay_func(int, void *);
+void arm_set_delay(delay_func *, void *);
+#endif
+
#endif /* !_MACHINE_MACHDEP_H_ */
diff --git a/sys/arm/include/platformvar.h b/sys/arm/include/platformvar.h
index cfee255..1199dfa 100644
--- a/sys/arm/include/platformvar.h
+++ b/sys/arm/include/platformvar.h
@@ -53,6 +53,13 @@
#include <sys/kobj.h>
#include <sys/linker_set.h>
+struct platform_class {
+ KOBJ_CLASS_FIELDS;
+
+ /* How many times to loop to delay approximately 1us */
+ int delay_count;
+};
+
struct platform_kobj {
/*
* A platform instance is a kernel object
@@ -60,11 +67,15 @@ struct platform_kobj {
KOBJ_FIELDS;
/* Platform class, for access to class specific data */
- struct kobj_class *cls;
+ struct platform_class *cls;
+};
+
+struct platform_data {
+ int delay_count;
};
typedef struct platform_kobj *platform_t;
-typedef struct kobj_class platform_def_t;
+typedef struct platform_class platform_def_t;
#define platform_method_t kobj_method_t
#define PLATFORMMETHOD KOBJMETHOD
@@ -83,7 +94,20 @@ typedef struct fdt_platform_class fdt_platform_def_t;
extern platform_method_t fdt_platform_methods[];
-#define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, size, compatible) \
+#ifdef MULTIDELAY
+#define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay > 0)
+#else
+#define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay == 0)
+#endif
+
+#define PLATFORM_DATA(NAME, delay) \
+static struct platform_data NAME ## _platc = { \
+ .delay_count = delay; \
+};
+
+#define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, size, compatible, \
+ delay) \
+FDT_PLATFORM_CTASSERT(delay); \
static fdt_platform_def_t VAR_NAME ## _fdt_platform = { \
.name = NAME_STR, \
.methods = fdt_platform_methods, \
@@ -96,12 +120,15 @@ static platform_def_t VAR_NAME ## _platform = { \
NAME ## _methods, \
size, \
VAR_NAME ## _baseclasses, \
+ delay, \
}; \
DATA_SET(platform_set, VAR_NAME ## _platform)
-#define FDT_PLATFORM_DEF(NAME, NAME_STR, size, compatible) \
- FDT_PLATFORM_DEF2(NAME, NAME, NAME_STR, size, compatible)
+#define FDT_PLATFORM_DEF(NAME, NAME_STR, size, compatible, delay) \
+ FDT_PLATFORM_DEF2(NAME, NAME, NAME_STR, size, compatible, delay)
#endif
+bool arm_tmr_timed_wait(platform_t, int);
+
#endif /* _MACHINE_PLATFORMVAR_H_ */
diff --git a/sys/arm/nvidia/tegra124/tegra124_machdep.c b/sys/arm/nvidia/tegra124/tegra124_machdep.c
index 9dbce99..70c31da 100644
--- a/sys/arm/nvidia/tegra124/tegra124_machdep.c
+++ b/sys/arm/nvidia/tegra124/tegra124_machdep.c
@@ -170,4 +170,4 @@ static platform_method_t tegra124_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(tegra124, "Nvidia Jetson-TK1", 0, "nvidia,jetson-tk1");
+FDT_PLATFORM_DEF(tegra124, "Nvidia Jetson-TK1", 0, "nvidia,jetson-tk1", 0);
diff --git a/sys/arm/qemu/virt_machdep.c b/sys/arm/qemu/virt_machdep.c
index ddbfd64..95cc225 100644
--- a/sys/arm/qemu/virt_machdep.c
+++ b/sys/arm/qemu/virt_machdep.c
@@ -96,4 +96,4 @@ static platform_method_t virt_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(virt, "virt", 0, "linux,dummy-virt");
+FDT_PLATFORM_DEF(virt, "virt", 0, "linux,dummy-virt", 1);
diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c
index f11091f..c73b092 100644
--- a/sys/arm/ti/ti_adc.c
+++ b/sys/arm/ti/ti_adc.c
@@ -31,17 +31,23 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
+#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
+#include <sys/condvar.h>
#include <sys/resource.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
+#include <sys/selinfo.h>
+#include <sys/poll.h>
+#include <sys/uio.h>
#include <machine/bus.h>
+#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -50,16 +56,26 @@ __FBSDID("$FreeBSD$");
#include <arm/ti/ti_adcreg.h>
#include <arm/ti/ti_adcvar.h>
+#undef DEBUG_TSC
+
+#define DEFAULT_CHARGE_DELAY 0x400
+#define STEPDLY_OPEN 0x98
+
+#define ORDER_XP 0
+#define ORDER_XN 1
+#define ORDER_YP 2
+#define ORDER_YN 3
+
/* Define our 8 steps, one for each input channel. */
static struct ti_adc_input ti_adc_inputs[TI_ADC_NPINS] = {
- { .stepconfig = ADC_STEPCFG1, .stepdelay = ADC_STEPDLY1 },
- { .stepconfig = ADC_STEPCFG2, .stepdelay = ADC_STEPDLY2 },
- { .stepconfig = ADC_STEPCFG3, .stepdelay = ADC_STEPDLY3 },
- { .stepconfig = ADC_STEPCFG4, .stepdelay = ADC_STEPDLY4 },
- { .stepconfig = ADC_STEPCFG5, .stepdelay = ADC_STEPDLY5 },
- { .stepconfig = ADC_STEPCFG6, .stepdelay = ADC_STEPDLY6 },
- { .stepconfig = ADC_STEPCFG7, .stepdelay = ADC_STEPDLY7 },
- { .stepconfig = ADC_STEPCFG8, .stepdelay = ADC_STEPDLY8 },
+ { .stepconfig = ADC_STEPCFG(1), .stepdelay = ADC_STEPDLY(1) },
+ { .stepconfig = ADC_STEPCFG(2), .stepdelay = ADC_STEPDLY(2) },
+ { .stepconfig = ADC_STEPCFG(3), .stepdelay = ADC_STEPDLY(3) },
+ { .stepconfig = ADC_STEPCFG(4), .stepdelay = ADC_STEPDLY(4) },
+ { .stepconfig = ADC_STEPCFG(5), .stepdelay = ADC_STEPDLY(5) },
+ { .stepconfig = ADC_STEPCFG(6), .stepdelay = ADC_STEPDLY(6) },
+ { .stepconfig = ADC_STEPCFG(7), .stepdelay = ADC_STEPDLY(7) },
+ { .stepconfig = ADC_STEPCFG(8), .stepdelay = ADC_STEPDLY(8) },
};
static int ti_adc_samples[5] = { 0, 2, 4, 8, 16 };
@@ -67,6 +83,7 @@ static int ti_adc_samples[5] = { 0, 2, 4, 8, 16 };
static void
ti_adc_enable(struct ti_adc_softc *sc)
{
+ uint32_t reg;
TI_ADC_LOCK_ASSERT(sc);
@@ -75,10 +92,28 @@ ti_adc_enable(struct ti_adc_softc *sc)
/* Enable the FIFO0 threshold and the end of sequence interrupt. */
ADC_WRITE4(sc, ADC_IRQENABLE_SET,
- ADC_IRQ_FIFO0_THRES | ADC_IRQ_END_OF_SEQ);
-
+ ADC_IRQ_FIFO0_THRES | ADC_IRQ_FIFO1_THRES | ADC_IRQ_END_OF_SEQ);
+
+ reg = ADC_CTRL_STEP_WP | ADC_CTRL_STEP_ID;
+ if (sc->sc_tsc_wires > 0) {
+ reg |= ADC_CTRL_TSC_ENABLE;
+ switch (sc->sc_tsc_wires) {
+ case 4:
+ reg |= ADC_CTRL_TSC_4WIRE;
+ break;
+ case 5:
+ reg |= ADC_CTRL_TSC_5WIRE;
+ break;
+ case 8:
+ reg |= ADC_CTRL_TSC_8WIRE;
+ break;
+ default:
+ break;
+ }
+ }
+ reg |= ADC_CTRL_ENABLE;
/* Enable the ADC. Run thru enabled steps, start the conversions. */
- ADC_WRITE4(sc, ADC_CTRL, ADC_READ4(sc, ADC_CTRL) | ADC_CTRL_ENABLE);
+ ADC_WRITE4(sc, ADC_CTRL, reg);
sc->sc_last_state = 1;
}
@@ -102,7 +137,7 @@ ti_adc_disable(struct ti_adc_softc *sc)
/* Disable the FIFO0 threshold and the end of sequence interrupt. */
ADC_WRITE4(sc, ADC_IRQENABLE_CLR,
- ADC_IRQ_FIFO0_THRES | ADC_IRQ_END_OF_SEQ);
+ ADC_IRQ_FIFO0_THRES | ADC_IRQ_FIFO1_THRES | ADC_IRQ_END_OF_SEQ);
/* ACK any pending interrupt. */
ADC_WRITE4(sc, ADC_IRQSTATUS, ADC_READ4(sc, ADC_IRQSTATUS));
@@ -114,20 +149,27 @@ ti_adc_disable(struct ti_adc_softc *sc)
count = ADC_READ4(sc, ADC_FIFO0COUNT) & ADC_FIFO_COUNT_MSK;
}
+ count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK;
+ while (count > 0) {
+ data = ADC_READ4(sc, ADC_FIFO1DATA);
+ count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK;
+ }
+
sc->sc_last_state = 0;
}
static int
ti_adc_setup(struct ti_adc_softc *sc)
{
- int ain;
+ int ain, i;
uint32_t enabled;
TI_ADC_LOCK_ASSERT(sc);
/* Check for enabled inputs. */
- enabled = 0;
- for (ain = 0; ain < TI_ADC_NPINS; ain++) {
+ enabled = sc->sc_tsc_enabled;
+ for (i = 0; i < sc->sc_adc_nchannels; i++) {
+ ain = sc->sc_adc_channels[i];
if (ti_adc_inputs[ain].enable)
enabled |= (1U << (ain + 1));
}
@@ -182,13 +224,15 @@ ti_adc_input_setup(struct ti_adc_softc *sc, int32_t ain)
static void
ti_adc_reset(struct ti_adc_softc *sc)
{
- int ain;
+ int ain, i;
TI_ADC_LOCK_ASSERT(sc);
/* Disable all the inputs. */
- for (ain = 0; ain < TI_ADC_NPINS; ain++)
+ for (i = 0; i < sc->sc_adc_nchannels; i++) {
+ ain = sc->sc_adc_channels[i];
ti_adc_inputs[ain].enable = 0;
+ }
}
static int
@@ -345,31 +389,127 @@ ti_adc_read_data(struct ti_adc_softc *sc)
}
}
+static int
+cmp_values(const void *a, const void *b)
+{
+ const uint32_t *v1, *v2;
+ v1 = a;
+ v2 = b;
+ if (*v1 < *v2)
+ return -1;
+ if (*v1 > *v2)
+ return 1;
+
+ return (0);
+}
+
+static void
+ti_adc_tsc_read_data(struct ti_adc_softc *sc)
+{
+ int count;
+ uint32_t data[16];
+ uint32_t x, y;
+ int i, start, end;
+
+ TI_ADC_LOCK_ASSERT(sc);
+
+ /* Read the available data. */
+ count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK;
+ if (count == 0)
+ return;
+
+ i = 0;
+ while (count > 0) {
+ data[i++] = ADC_READ4(sc, ADC_FIFO1DATA) & ADC_FIFO_DATA_MSK;
+ count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK;
+ }
+
+ if (sc->sc_coord_readouts > 3) {
+ start = 1;
+ end = sc->sc_coord_readouts - 1;
+ qsort(data, sc->sc_coord_readouts,
+ sizeof(data[0]), &cmp_values);
+ qsort(&data[sc->sc_coord_readouts + 2],
+ sc->sc_coord_readouts,
+ sizeof(data[0]), &cmp_values);
+ }
+ else {
+ start = 0;
+ end = sc->sc_coord_readouts;
+ }
+
+ x = y = 0;
+ for (i = start; i < end; i++)
+ y += data[i];
+ y /= (end - start);
+
+ for (i = sc->sc_coord_readouts + 2 + start; i < sc->sc_coord_readouts + 2 + end; i++)
+ x += data[i];
+ x /= (end - start);
+
+#ifdef DEBUG_TSC
+ device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y);
+#endif
+ /* TODO: That's where actual event reporting should take place */
+}
+
+static void
+ti_adc_intr_locked(struct ti_adc_softc *sc, uint32_t status)
+{
+ /* Read the available data. */
+ if (status & ADC_IRQ_FIFO0_THRES)
+ ti_adc_read_data(sc);
+}
+
+static void
+ti_adc_tsc_intr_locked(struct ti_adc_softc *sc, uint32_t status)
+{
+ /* Read the available data. */
+ if (status & ADC_IRQ_FIFO1_THRES)
+ ti_adc_tsc_read_data(sc);
+
+}
+
static void
ti_adc_intr(void *arg)
{
struct ti_adc_softc *sc;
- uint32_t status;
+ uint32_t status, rawstatus;
sc = (struct ti_adc_softc *)arg;
+ TI_ADC_LOCK(sc);
+
+ rawstatus = ADC_READ4(sc, ADC_IRQSTATUS_RAW);
status = ADC_READ4(sc, ADC_IRQSTATUS);
- if (status == 0)
- return;
- if (status & ~(ADC_IRQ_FIFO0_THRES | ADC_IRQ_END_OF_SEQ))
- device_printf(sc->sc_dev, "stray interrupt: %#x\n", status);
- TI_ADC_LOCK(sc);
- /* ACK the interrupt. */
- ADC_WRITE4(sc, ADC_IRQSTATUS, status);
+ if (rawstatus & ADC_IRQ_HW_PEN_ASYNC) {
+ sc->sc_pen_down = 1;
+ status |= ADC_IRQ_HW_PEN_ASYNC;
+ ADC_WRITE4(sc, ADC_IRQENABLE_CLR,
+ ADC_IRQ_HW_PEN_ASYNC);
+ }
+
+ if (rawstatus & ADC_IRQ_PEN_UP) {
+ sc->sc_pen_down = 0;
+ status |= ADC_IRQ_PEN_UP;
+ }
- /* Read the available data. */
if (status & ADC_IRQ_FIFO0_THRES)
- ti_adc_read_data(sc);
+ ti_adc_intr_locked(sc, status);
+
+ if (status & ADC_IRQ_FIFO1_THRES)
+ ti_adc_tsc_intr_locked(sc, status);
+
+ if (status) {
+ /* ACK the interrupt. */
+ ADC_WRITE4(sc, ADC_IRQSTATUS, status);
+ }
/* Start the next conversion ? */
if (status & ADC_IRQ_END_OF_SEQ)
ti_adc_setup(sc);
+
TI_ADC_UNLOCK(sc);
}
@@ -380,7 +520,7 @@ ti_adc_sysctl_init(struct ti_adc_softc *sc)
struct sysctl_ctx_list *ctx;
struct sysctl_oid *tree_node, *inp_node, *inpN_node;
struct sysctl_oid_list *tree, *inp_tree, *inpN_tree;
- int ain;
+ int ain, i;
/*
* Add per-pin sysctl tree/handlers.
@@ -395,7 +535,8 @@ ti_adc_sysctl_init(struct ti_adc_softc *sc)
CTLFLAG_RD, NULL, "ADC inputs");
inp_tree = SYSCTL_CHILDREN(inp_node);
- for (ain = 0; ain < TI_ADC_NPINS; ain++) {
+ for (i = 0; i < sc->sc_adc_nchannels; i++) {
+ ain = sc->sc_adc_channels[i];
snprintf(pinbuf, sizeof(pinbuf), "%d", ain);
inpN_node = SYSCTL_ADD_NODE(ctx, inp_tree, OID_AUTO, pinbuf,
@@ -420,11 +561,12 @@ ti_adc_sysctl_init(struct ti_adc_softc *sc)
static void
ti_adc_inputs_init(struct ti_adc_softc *sc)
{
- int ain;
+ int ain, i;
struct ti_adc_input *input;
TI_ADC_LOCK(sc);
- for (ain = 0; ain < TI_ADC_NPINS; ain++) {
+ for (i = 0; i < sc->sc_adc_nchannels; i++) {
+ ain = sc->sc_adc_channels[i];
input = &ti_adc_inputs[ain];
input->sc = sc;
input->input = ain;
@@ -437,29 +579,126 @@ ti_adc_inputs_init(struct ti_adc_softc *sc)
}
static void
-ti_adc_idlestep_init(struct ti_adc_softc *sc)
+ti_adc_tsc_init(struct ti_adc_softc *sc)
{
- uint32_t val;
+ int i, start_step, end_step;
+ uint32_t stepconfig, val;
+ TI_ADC_LOCK(sc);
+
+ /* X coordinates */
+ stepconfig = ADC_STEP_FIFO1 | (4 << ADC_STEP_AVG_SHIFT) |
+ ADC_STEP_MODE_HW_ONESHOT | sc->sc_xp_bit;
+ if (sc->sc_tsc_wires == 4)
+ stepconfig |= ADC_STEP_INP(sc->sc_yp_inp) | sc->sc_xn_bit;
+ else if (sc->sc_tsc_wires == 5)
+ stepconfig |= ADC_STEP_INP(4) |
+ sc->sc_xn_bit | sc->sc_yn_bit | sc->sc_yp_bit;
+ else if (sc->sc_tsc_wires == 8)
+ stepconfig |= ADC_STEP_INP(sc->sc_yp_inp) | sc->sc_xn_bit;
+
+ start_step = ADC_STEPS - sc->sc_coord_readouts + 1;
+ end_step = start_step + sc->sc_coord_readouts - 1;
+ for (i = start_step; i <= end_step; i++) {
+ ADC_WRITE4(sc, ADC_STEPCFG(i), stepconfig);
+ ADC_WRITE4(sc, ADC_STEPDLY(i), STEPDLY_OPEN);
+ }
+
+ /* Y coordinates */
+ stepconfig = ADC_STEP_FIFO1 | (4 << ADC_STEP_AVG_SHIFT) |
+ ADC_STEP_MODE_HW_ONESHOT | sc->sc_yn_bit |
+ ADC_STEP_INM(8);
+ if (sc->sc_tsc_wires == 4)
+ stepconfig |= ADC_STEP_INP(sc->sc_xp_inp) | sc->sc_yp_bit;
+ else if (sc->sc_tsc_wires == 5)
+ stepconfig |= ADC_STEP_INP(4) |
+ sc->sc_xp_bit | sc->sc_xn_bit | sc->sc_yp_bit;
+ else if (sc->sc_tsc_wires == 8)
+ stepconfig |= ADC_STEP_INP(sc->sc_xp_inp) | sc->sc_yp_bit;
+
+ start_step = ADC_STEPS - (sc->sc_coord_readouts*2 + 2) + 1;
+ end_step = start_step + sc->sc_coord_readouts - 1;
+ for (i = start_step; i <= end_step; i++) {
+ ADC_WRITE4(sc, ADC_STEPCFG(i), stepconfig);
+ ADC_WRITE4(sc, ADC_STEPDLY(i), STEPDLY_OPEN);
+ }
+
+ /* Charge config */
val = ADC_READ4(sc, ADC_IDLECONFIG);
+ ADC_WRITE4(sc, ADC_TC_CHARGE_STEPCONFIG, val);
+ ADC_WRITE4(sc, ADC_TC_CHARGE_DELAY, sc->sc_charge_delay);
+
+ /* 2 steps for Z */
+ start_step = ADC_STEPS - (sc->sc_coord_readouts + 2) + 1;
+ stepconfig = ADC_STEP_FIFO1 | (4 << ADC_STEP_AVG_SHIFT) |
+ ADC_STEP_MODE_HW_ONESHOT | sc->sc_yp_bit |
+ sc->sc_xn_bit | ADC_STEP_INP(sc->sc_xp_inp) |
+ ADC_STEP_INM(8);
+ ADC_WRITE4(sc, ADC_STEPCFG(start_step), stepconfig);
+ ADC_WRITE4(sc, ADC_STEPDLY(start_step), STEPDLY_OPEN);
+ start_step++;
+ stepconfig |= ADC_STEP_INP(sc->sc_yn_inp);
+ ADC_WRITE4(sc, ADC_STEPCFG(start_step), stepconfig);
+ ADC_WRITE4(sc, ADC_STEPDLY(start_step), STEPDLY_OPEN);
+
+ ADC_WRITE4(sc, ADC_FIFO1THRESHOLD, (sc->sc_coord_readouts*2 + 2) - 1);
+
+ sc->sc_tsc_enabled = 1;
+ start_step = ADC_STEPS - (sc->sc_coord_readouts*2 + 2) + 1;
+ end_step = ADC_STEPS;
+ for (i = start_step; i <= end_step; i++) {
+ sc->sc_tsc_enabled |= (1 << i);
+ }
- /* Set single ended operation. */
- val &= ~ADC_STEP_DIFF_CNTRL;
- /* Set the negative voltage reference. */
- val &= ~ADC_STEP_RFM_MSK;
+ TI_ADC_UNLOCK(sc);
+}
- /* Set the positive voltage reference. */
- val &= ~ADC_STEP_RFP_MSK;
+static void
+ti_adc_idlestep_init(struct ti_adc_softc *sc)
+{
+ uint32_t val;
- /* Connect the input to VREFN. */
- val &= ~ADC_STEP_INP_MSK;
- val |= ADC_STEP_IN_VREFN << ADC_STEP_INP_SHIFT;
+ val = ADC_STEP_YNN_SW | ADC_STEP_INM(8) | ADC_STEP_INP(8) | ADC_STEP_YPN_SW;
ADC_WRITE4(sc, ADC_IDLECONFIG, val);
}
static int
+ti_adc_config_wires(struct ti_adc_softc *sc, int *wire_configs, int nwire_configs)
+{
+ int i;
+ int wire, ai;
+
+ for (i = 0; i < nwire_configs; i++) {
+ wire = wire_configs[i] & 0xf;
+ ai = (wire_configs[i] >> 4) & 0xf;
+ switch (wire) {
+ case ORDER_XP:
+ sc->sc_xp_bit = ADC_STEP_XPP_SW;
+ sc->sc_xp_inp = ai;
+ break;
+ case ORDER_XN:
+ sc->sc_xn_bit = ADC_STEP_XNN_SW;
+ sc->sc_xn_inp = ai;
+ break;
+ case ORDER_YP:
+ sc->sc_yp_bit = ADC_STEP_YPP_SW;
+ sc->sc_yp_inp = ai;
+ break;
+ case ORDER_YN:
+ sc->sc_yn_bit = ADC_STEP_YNN_SW;
+ sc->sc_yn_inp = ai;
+ break;
+ default:
+ device_printf(sc->sc_dev, "Invalid wire config\n");
+ return (-1);
+ }
+ }
+ return (0);
+}
+
+static int
ti_adc_probe(device_t dev)
{
@@ -473,17 +712,68 @@ ti_adc_probe(device_t dev)
static int
ti_adc_attach(device_t dev)
{
- int err, rid;
+ int err, rid, i;
struct ti_adc_softc *sc;
- uint32_t reg, rev;
+ uint32_t rev, reg;
+ phandle_t node, child;
+ pcell_t cell;
+ int *channels;
+ int nwire_configs;
+ int *wire_configs;
sc = device_get_softc(dev);
sc->sc_dev = dev;
- /* Activate the ADC_TSC module. */
- err = ti_prcm_clk_enable(TSC_ADC_CLK);
- if (err)
- return (err);
+ node = ofw_bus_get_node(dev);
+
+ sc->sc_tsc_wires = 0;
+ sc->sc_coord_readouts = 1;
+ sc->sc_x_plate_resistance = 0;
+ sc->sc_charge_delay = DEFAULT_CHARGE_DELAY;
+ /* Read "tsc" node properties */
+ child = ofw_bus_find_child(node, "tsc");
+ if (child != 0) {
+ if ((OF_getprop(child, "ti,wires", &cell, sizeof(cell))) > 0)
+ sc->sc_tsc_wires = fdt32_to_cpu(cell);
+ if ((OF_getprop(child, "ti,coordinate-readouts", &cell, sizeof(cell))) > 0)
+ sc->sc_coord_readouts = fdt32_to_cpu(cell);
+ if ((OF_getprop(child, "ti,x-plate-resistance", &cell, sizeof(cell))) > 0)
+ sc->sc_x_plate_resistance = fdt32_to_cpu(cell);
+ if ((OF_getprop(child, "ti,charge-delay", &cell, sizeof(cell))) > 0)
+ sc->sc_charge_delay = fdt32_to_cpu(cell);
+ nwire_configs = OF_getencprop_alloc(child, "ti,wire-config",
+ sizeof(*wire_configs), (void **)&wire_configs);
+ if (nwire_configs != sc->sc_tsc_wires) {
+ device_printf(sc->sc_dev,
+ "invalid nubmer of ti,wire-config: %d (should be %d)\n",
+ nwire_configs, sc->sc_tsc_wires);
+ free(wire_configs, M_OFWPROP);
+ return (EINVAL);
+ }
+ err = ti_adc_config_wires(sc, wire_configs, nwire_configs);
+ free(wire_configs, M_OFWPROP);
+ if (err)
+ return (EINVAL);
+ }
+
+ /* Read "adc" node properties */
+ child = ofw_bus_find_child(node, "adc");
+ if (child != 0) {
+ sc->sc_adc_nchannels = OF_getencprop_alloc(child, "ti,adc-channels",
+ sizeof(*channels), (void **)&channels);
+ if (sc->sc_adc_nchannels > 0) {
+ for (i = 0; i < sc->sc_adc_nchannels; i++)
+ sc->sc_adc_channels[i] = channels[i];
+ free(channels, M_OFWPROP);
+ }
+ }
+
+ /* Sanity check FDT data */
+ if (sc->sc_tsc_wires + sc->sc_adc_nchannels > TI_ADC_NPINS) {
+ device_printf(dev, "total number of chanels (%d) is larger than %d\n",
+ sc->sc_tsc_wires + sc->sc_adc_nchannels, TI_ADC_NPINS);
+ return (ENXIO);
+ }
rid = 0;
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
@@ -493,6 +783,11 @@ ti_adc_attach(device_t dev)
return (ENXIO);
}
+ /* Activate the ADC_TSC module. */
+ err = ti_prcm_clk_enable(TSC_ADC_CLK);
+ if (err)
+ return (err);
+
rid = 0;
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_ACTIVE);
@@ -521,25 +816,29 @@ ti_adc_attach(device_t dev)
rev & ADC_REV_MINOR_MSK,
(rev & ADC_REV_CUSTOM_MSK) >> ADC_REV_CUSTOM_SHIFT);
- /*
- * Disable the step write protect and make it store the step ID for
- * the captured data on FIFO.
- */
reg = ADC_READ4(sc, ADC_CTRL);
ADC_WRITE4(sc, ADC_CTRL, reg | ADC_CTRL_STEP_WP | ADC_CTRL_STEP_ID);
/*
- * Set the ADC prescaler to 2400 (yes, the actual value written here
- * is 2400 - 1).
- * This sets the ADC clock to ~10Khz (CLK_M_OSC / 2400).
+ * Set the ADC prescaler to 2400 if touchscreen is not enabled
+ * and to 24 if it is. This sets the ADC clock to ~10Khz and
+ * ~1Mhz respectively (CLK_M_OSC / prescaler).
*/
- ADC_WRITE4(sc, ADC_CLKDIV, 2399);
+ if (sc->sc_tsc_wires)
+ ADC_WRITE4(sc, ADC_CLKDIV, 24 - 1);
+ else
+ ADC_WRITE4(sc, ADC_CLKDIV, 2400 - 1);
TI_ADC_LOCK_INIT(sc);
ti_adc_idlestep_init(sc);
ti_adc_inputs_init(sc);
ti_adc_sysctl_init(sc);
+ ti_adc_tsc_init(sc);
+
+ TI_ADC_LOCK(sc);
+ ti_adc_setup(sc);
+ TI_ADC_UNLOCK(sc);
return (0);
}
diff --git a/sys/arm/ti/ti_adcreg.h b/sys/arm/ti/ti_adcreg.h
index 1772f25..ee15f16 100644
--- a/sys/arm/ti/ti_adcreg.h
+++ b/sys/arm/ti/ti_adcreg.h
@@ -60,6 +60,10 @@
#define ADC_IRQ_END_OF_SEQ (1 << 1)
#define ADC_IRQ_HW_PEN_ASYNC (1 << 0)
#define ADC_CTRL 0x040
+#define ADC_CTRL_TSC_ENABLE (1 << 7)
+#define ADC_CTRL_TSC_4WIRE (1 << 5)
+#define ADC_CTRL_TSC_5WIRE (2 << 5)
+#define ADC_CTRL_TSC_8WIRE (3 << 5)
#define ADC_CTRL_STEP_WP (1 << 2)
#define ADC_CTRL_STEP_ID (1 << 1)
#define ADC_CTRL_ENABLE (1 << 0)
@@ -67,22 +71,12 @@
#define ADC_CLKDIV 0x04c
#define ADC_STEPENABLE 0x054
#define ADC_IDLECONFIG 0x058
-#define ADC_STEPCFG1 0x064
-#define ADC_STEPDLY1 0x068
-#define ADC_STEPCFG2 0x06c
-#define ADC_STEPDLY2 0x070
-#define ADC_STEPCFG3 0x074
-#define ADC_STEPDLY3 0x078
-#define ADC_STEPCFG4 0x07c
-#define ADC_STEPDLY4 0x080
-#define ADC_STEPCFG5 0x084
-#define ADC_STEPDLY5 0x088
-#define ADC_STEPCFG6 0x08c
-#define ADC_STEPDLY6 0x090
-#define ADC_STEPCFG7 0x094
-#define ADC_STEPDLY7 0x098
-#define ADC_STEPCFG8 0x09c
-#define ADC_STEPDLY8 0x0a0
+#define ADC_TC_CHARGE_STEPCONFIG 0x05C
+#define ADC_TC_CHARGE_DELAY 0x060
+#define ADC_STEPS 16
+#define ADC_STEPCFG(n) (0x064 + (8*((n)-1)))
+#define ADC_STEPDLY(n) (0x068 + (8*((n)-1)))
+#define ADC_STEP_FIFO1 (1 << 26)
#define ADC_STEP_DIFF_CNTRL (1 << 25)
#define ADC_STEP_RFM_MSK 0x01800000
#define ADC_STEP_RFM_SHIFT 23
@@ -92,8 +86,10 @@
#define ADC_STEP_RFM_VREFN 3
#define ADC_STEP_INP_MSK 0x00780000
#define ADC_STEP_INP_SHIFT 19
+#define ADC_STEP_INP(i) ((i) << ADC_STEP_INP_SHIFT)
#define ADC_STEP_INM_MSK 0x00078000
#define ADC_STEP_INM_SHIFT 15
+#define ADC_STEP_INM(i) ((i) << ADC_STEP_INM_SHIFT)
#define ADC_STEP_IN_VREFN 8
#define ADC_STEP_RFP_MSK 0x00007000
#define ADC_STEP_RFP_SHIFT 12
@@ -102,16 +98,26 @@
#define ADC_STEP_RFP_YPLL 2
#define ADC_STEP_RFP_VREFP 3
#define ADC_STEP_RFP_INTREF 4
+#define ADC_STEP_YPN_SW (1 << 10)
+#define ADC_STEP_YNN_SW (1 << 8)
+#define ADC_STEP_YPP_SW (1 << 7)
+#define ADC_STEP_XNN_SW (1 << 6)
+#define ADC_STEP_XPP_SW (1 << 5)
#define ADC_STEP_AVG_MSK 0x0000001c
#define ADC_STEP_AVG_SHIFT 2
#define ADC_STEP_MODE_MSK 0x00000003
#define ADC_STEP_MODE_ONESHOT 0x00000000
#define ADC_STEP_MODE_CONTINUOUS 0x00000001
+#define ADC_STEP_MODE_HW_ONESHOT 0x00000002
+#define ADC_STEP_MODE_HW_CONTINUOUS 0x00000003
#define ADC_STEP_SAMPLE_DELAY 0xff000000
#define ADC_STEP_OPEN_DELAY 0x0003ffff
#define ADC_FIFO0COUNT 0x0e4
#define ADC_FIFO0THRESHOLD 0x0e8
+#define ADC_FIFO1COUNT 0x0f0
+#define ADC_FIFO1THRESHOLD 0x0f4
#define ADC_FIFO0DATA 0x100
+#define ADC_FIFO1DATA 0x200
#define ADC_FIFO_COUNT_MSK 0x0000007f
#define ADC_FIFO_STEP_ID_MSK 0x000f0000
#define ADC_FIFO_STEP_ID_SHIFT 16
diff --git a/sys/arm/ti/ti_adcvar.h b/sys/arm/ti/ti_adcvar.h
index 409ec7b..0cd0c34 100644
--- a/sys/arm/ti/ti_adcvar.h
+++ b/sys/arm/ti/ti_adcvar.h
@@ -42,6 +42,19 @@ struct ti_adc_softc {
struct resource *sc_mem_res;
struct resource *sc_irq_res;
void *sc_intrhand;
+ int sc_tsc_wires;
+ int sc_tsc_wire_config[TI_ADC_NPINS];
+ int sc_coord_readouts;
+ int sc_x_plate_resistance;
+ int sc_charge_delay;
+ int sc_adc_nchannels;
+ int sc_adc_channels[TI_ADC_NPINS];
+ int sc_xp_bit, sc_xp_inp;
+ int sc_xn_bit, sc_xn_inp;
+ int sc_yp_bit, sc_yp_inp;
+ int sc_yn_bit, sc_yn_inp;
+ uint32_t sc_tsc_enabled;
+ int sc_pen_down;
};
struct ti_adc_input {
diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c
index 696bf61..f8d5395 100644
--- a/sys/arm/ti/ti_machdep.c
+++ b/sys/arm/ti/ti_machdep.c
@@ -128,7 +128,7 @@ static platform_method_t omap4_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430");
+FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,omap4430", 0);
#endif
#if defined(SOC_TI_AM335X)
@@ -139,5 +139,5 @@ static platform_method_t am335x_methods[] = {
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x");
+FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 0);
#endif
diff --git a/sys/boot/arm/at91/bootiic/env_vars.c b/sys/boot/arm/at91/bootiic/env_vars.c
index f402a43..ac0b4f9 100644
--- a/sys/boot/arm/at91/bootiic/env_vars.c
+++ b/sys/boot/arm/at91/bootiic/env_vars.c
@@ -41,7 +41,7 @@ static int currentOffset;
/*
* .KB_C_FN_DEFINITION_START
* int ReadCharFromEnvironment(char *)
- * This private function reads characters from the enviroment variables
+ * This private function reads characters from the environment variables
* to service the command prompt during auto-boot or just to setup the
* default environment. Returns positive value if valid character was
* set in the pointer. Returns negative value to signal input stream
diff --git a/sys/boot/arm/at91/bootspi/env_vars.c b/sys/boot/arm/at91/bootspi/env_vars.c
index 7ab250e..29b819b 100644
--- a/sys/boot/arm/at91/bootspi/env_vars.c
+++ b/sys/boot/arm/at91/bootspi/env_vars.c
@@ -41,7 +41,7 @@ static int currentOffset;
/*
* .KB_C_FN_DEFINITION_START
* int ReadCharFromEnvironment(char *)
- * This private function reads characters from the enviroment variables
+ * This private function reads characters from the environment variables
* to service the command prompt during auto-boot or just to setup the
* default environment. Returns positive value if valid character was
* set in the pointer. Returns negative value to signal input stream
diff --git a/sys/boot/arm/at91/libat91/at91rm9200.h b/sys/boot/arm/at91/libat91/at91rm9200.h
index 80d44c8..42dc969 100644
--- a/sys/boot/arm/at91/libat91/at91rm9200.h
+++ b/sys/boot/arm/at91/libat91/at91rm9200.h
@@ -474,7 +474,7 @@ typedef struct _AT91S_ST {
#define AT91C_ST_CRTV (0xFFFFFu << 0) // (ST) Current Real-time Value
// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Power Management Controler
+// SOFTWARE API DEFINITION FOR Power Management Controller
// *****************************************************************************
typedef struct _AT91S_PMC {
AT91_REG PMC_SCER; // System Clock Enable Register
@@ -547,7 +547,7 @@ typedef struct _AT91S_PMC {
// -------- PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register --------
// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Clock Generator Controler
+// SOFTWARE API DEFINITION FOR Clock Generator Controller
// *****************************************************************************
typedef struct _AT91S_CKGR {
AT91_REG CKGR_MOR; // Main Oscillator Register
@@ -590,7 +590,7 @@ typedef struct _AT91S_CKGR {
#define AT91C_CKGR_USB_PLL (0x1u << 29) // (CKGR) PLL Use
// *****************************************************************************
-// SOFTWARE API DEFINITION FOR Parallel Input Output Controler
+// SOFTWARE API DEFINITION FOR Parallel Input Output Controller
// *****************************************************************************
typedef struct _AT91S_PIO {
AT91_REG PIO_PER; // PIO Enable Register
diff --git a/sys/boot/arm/at91/libat91/mci_device.h b/sys/boot/arm/at91/libat91/mci_device.h
index c2b75ad..9f2f665 100644
--- a/sys/boot/arm/at91/libat91/mci_device.h
+++ b/sys/boot/arm/at91/libat91/mci_device.h
@@ -106,15 +106,15 @@ typedef struct _AT91S_MciDevice
///////////////////////////////////////////////////////////////////////////////
#define AT91C_CMD_SEND_OK 0 // Command ok
#define AT91C_CMD_SEND_ERROR -1 // Command failed
-#define AT91C_INIT_OK 2 // Init Successfull
+#define AT91C_INIT_OK 2 // Init Successful
#define AT91C_INIT_ERROR 3 // Init Failed
-#define AT91C_READ_OK 4 // Read Successfull
+#define AT91C_READ_OK 4 // Read Successful
#define AT91C_READ_ERROR 5 // Read Failed
-#define AT91C_WRITE_OK 6 // Write Successfull
+#define AT91C_WRITE_OK 6 // Write Successful
#define AT91C_WRITE_ERROR 7 // Write Failed
-#define AT91C_ERASE_OK 8 // Erase Successfull
+#define AT91C_ERASE_OK 8 // Erase Successful
#define AT91C_ERASE_ERROR 9 // Erase Failed
-#define AT91C_CARD_SELECTED_OK 10 // Card Selection Successfull
+#define AT91C_CARD_SELECTED_OK 10 // Card Selection Successful
#define AT91C_CARD_SELECTED_ERROR 11 // Card Selection Failed
#define AT91C_MCI_SR_ERROR (AT91C_MCI_UNRE | AT91C_MCI_OVRE | AT91C_MCI_DTOE | \
diff --git a/sys/boot/common/bcache.c b/sys/boot/common/bcache.c
index e5cf75b..4bb9082 100644
--- a/sys/boot/common/bcache.c
+++ b/sys/boot/common/bcache.c
@@ -272,20 +272,43 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
for (i = 0; i < p_size; i++) {
bcache_invalidate(bc, p_blk + i);
}
+
r_size = 0;
+ /*
+ * with read-ahead, it may happen we are attempting to read past
+ * disk end, as bcache has no information about disk size.
+ * in such case we should get partial read if some blocks can be
+ * read or error, if no blocks can be read.
+ * in either case we should return the data in bcache and only
+ * return error if there is no data.
+ */
result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, 0,
p_size * bcache_blksize, p_buf, &r_size);
- if (result)
- goto done;
-
r_size /= bcache_blksize;
for (i = 0; i < r_size; i++)
bcache_insert(bc, p_blk + i);
- bcache_rablks += ra;
- bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, buf,
- size);
+ /* update ra statistics */
+ if (r_size != 0) {
+ if (r_size < p_size)
+ bcache_rablks += (p_size - r_size);
+ else
+ bcache_rablks += ra;
+ }
+
+ /* check how much data can we copy */
+ for (i = 0; i < nblk; i++) {
+ if (BCACHE_LOOKUP(bc, (daddr_t)(blk + i)))
+ break;
+ }
+
+ size = i * bcache_blksize;
+ if (size != 0) {
+ bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset,
+ buf, size);
+ result = 0;
+ }
done:
if ((result == 0) && (rsize != NULL))
@@ -349,8 +372,16 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
ret = read_strategy(devdata, rw, blk, offset,
csize, buf+total, &isize);
- if (ret != 0)
- return (ret);
+
+ /*
+ * we may have error from read ahead, if we have read some data
+ * return partial read.
+ */
+ if (ret != 0 || isize == 0) {
+ if (total != 0)
+ ret = 0;
+ break;
+ }
blk += (offset+isize) / bcache_blksize;
offset = 0;
total += isize;
diff --git a/sys/boot/efi/boot1/boot1.c b/sys/boot/efi/boot1/boot1.c
index 1b84d41..7383387 100644
--- a/sys/boot/efi/boot1/boot1.c
+++ b/sys/boot/efi/boot1/boot1.c
@@ -103,8 +103,8 @@ nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath)
/*
* device_paths_match returns TRUE if the imgpath isn't NULL and all nodes
- * in imgpath and devpath match up to their respect occurances of a media
- * node, FALSE otherwise.
+ * in imgpath and devpath match up to their respective occurrences of a
+ * media node, FALSE otherwise.
*/
static BOOLEAN
device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath)
diff --git a/sys/boot/efi/include/amd64/efibind.h b/sys/boot/efi/include/amd64/efibind.h
index d7a8dc0..8cfce5b 100644
--- a/sys/boot/efi/include/amd64/efibind.h
+++ b/sys/boot/efi/include/amd64/efibind.h
@@ -238,7 +238,7 @@ typedef uint64_t UINTN;
#else // EFI_NT_EMULATOR
//
-// When build similiar to FW, then link everything together as
+// When building similar to FW, link everything together as
// one big module.
//
diff --git a/sys/boot/efi/include/arm/efibind.h b/sys/boot/efi/include/arm/efibind.h
index 85537ad..177032a 100644
--- a/sys/boot/efi/include/arm/efibind.h
+++ b/sys/boot/efi/include/arm/efibind.h
@@ -34,7 +34,7 @@ Abstract:
//
-// Make sure we are useing the correct packing rules per EFI specification
+// Make sure we are using the correct packing rules per EFI specification
//
#ifndef __GNUC__
#pragma pack()
diff --git a/sys/boot/efi/include/arm64/efibind.h b/sys/boot/efi/include/arm64/efibind.h
index 142f162..4751e2e 100644
--- a/sys/boot/efi/include/arm64/efibind.h
+++ b/sys/boot/efi/include/arm64/efibind.h
@@ -176,7 +176,7 @@ typedef uint64_t UINTN;
#define VOLATILE volatile
//
-// BugBug: Need to find out if this is portable accross compliers.
+// BugBug: Need to find out if this is portable across compilers.
//
void __mfa (void);
#define MEMORY_FENCE() __mfa()
@@ -190,7 +190,7 @@ void __mfa (void);
#endif
//
-// When build similiar to FW, then link everything together as
+// When build similar to FW, then link everything together as
// one big module.
//
diff --git a/sys/boot/efi/include/efiuga.h b/sys/boot/efi/include/efiuga.h
index 6dfaf50..28c738e 100644
--- a/sys/boot/efi/include/efiuga.h
+++ b/sys/boot/efi/include/efiuga.h
@@ -139,7 +139,7 @@ typedef enum {
@retval EFI_SUCCESS - The Blt operation completed.
@retval EFI_INVALID_PARAMETER - BltOperation is not valid.
- @retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer.
+ @retval EFI_DEVICE_ERROR - A hardware error occurred writting to the video buffer.
--*/
typedef
diff --git a/sys/boot/efi/include/i386/efibind.h b/sys/boot/efi/include/i386/efibind.h
index 6e5a716..0f1d4f1 100644
--- a/sys/boot/efi/include/i386/efibind.h
+++ b/sys/boot/efi/include/i386/efibind.h
@@ -234,7 +234,7 @@ typedef uint32_t UINTN;
#else // EFI_NT_EMULATOR
//
-// When build similiar to FW, then link everything together as
+// When build similar to FW, then link everything together as
// one big module.
//
diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c
index 2cf009a..da420bf 100644
--- a/sys/boot/efi/libefi/efipart.c
+++ b/sys/boot/efi/libefi/efipart.c
@@ -321,6 +321,15 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset,
if (size == 0 || (size % 512) != 0)
return (EIO);
+ off = blk * 512;
+ /* make sure we don't read past disk end */
+ if ((off + size) / blkio->Media->BlockSize - 1 >
+ blkio->Media->LastBlock) {
+ size = blkio->Media->LastBlock + 1 -
+ off / blkio->Media->BlockSize;
+ size = size * blkio->Media->BlockSize;
+ }
+
if (rsize != NULL)
*rsize = size;
@@ -335,7 +344,6 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset,
return (ENOMEM);
error = 0;
- off = blk * 512;
blk = off / blkio->Media->BlockSize;
blkoff = off % blkio->Media->BlockSize;
blksz = blkio->Media->BlockSize - blkoff;
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c
index 91b39b1..2efffce 100644
--- a/sys/boot/efi/loader/main.c
+++ b/sys/boot/efi/loader/main.c
@@ -74,7 +74,7 @@ static void efi_zfs_probe(void);
/*
* Need this because EFI uses UTF-16 unicode string constants, but we
- * use UTF-8. We can't use printf due to the possiblity of \0 and we
+ * use UTF-8. We can't use printf due to the possibility of \0 and we
* don't support support wide characters either.
*/
static void
diff --git a/sys/boot/fdt/Makefile b/sys/boot/fdt/Makefile
index 22d8da5..ce11dbb 100644
--- a/sys/boot/fdt/Makefile
+++ b/sys/boot/fdt/Makefile
@@ -10,7 +10,7 @@ SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \
fdt_empty_tree.c
# Loader's fdt commands extension sources.
-SRCS+= fdt_loader_cmd.c
+SRCS+= fdt_loader_cmd.c fdt_overlay.c
CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/
diff --git a/sys/boot/fdt/fdt_loader_cmd.c b/sys/boot/fdt/fdt_loader_cmd.c
index 8cd8ab5..1ad9a23 100644
--- a/sys/boot/fdt/fdt_loader_cmd.c
+++ b/sys/boot/fdt/fdt_loader_cmd.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include "bootstrap.h"
#include "fdt_platform.h"
+#include "fdt_overlay.h"
#ifdef DEBUG
#define debugf(fmt, args...) do { printf("%s(): ", __func__); \
@@ -157,7 +158,7 @@ fdt_find_static_dtb()
}
/*
- * The most efficent way to find a symbol would be to calculate a
+ * The most efficient way to find a symbol would be to calculate a
* hash, find proper bucket and chain, and thus find a symbol.
* However, that would involve code duplication (e.g. for hash
* function). So we're using simpler and a bit slower way: we're
@@ -276,6 +277,128 @@ fdt_load_dtb_file(const char * filename)
return (0);
}
+static int
+fdt_load_dtb_overlay(const char * filename)
+{
+ struct preloaded_file *bfp, *oldbfp;
+ struct fdt_header header;
+ int err;
+
+ debugf("fdt_load_dtb_overlay(%s)\n", filename);
+
+ oldbfp = file_findfile(filename, "dtbo");
+
+ /* Attempt to load and validate a new dtb from a file. */
+ if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) {
+ printf("failed to load file '%s'\n", filename);
+ return (1);
+ }
+
+ COPYOUT(bfp->f_addr, &header, sizeof(header));
+ err = fdt_check_header(&header);
+
+ if (err < 0) {
+ file_discard(bfp);
+ if (err == -FDT_ERR_BADVERSION)
+ printf("incompatible blob version: %d, should be: %d\n",
+ fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION);
+
+ else
+ printf("error validating blob: %s\n",
+ fdt_strerror(err));
+ return (1);
+ }
+
+ /* A new dtb was validated, discard any previous file. */
+ if (oldbfp)
+ file_discard(oldbfp);
+
+ return (0);
+}
+
+int
+fdt_load_dtb_overlays(const char * filenames)
+{
+ char *names;
+ char *name;
+ char *comaptr;
+
+ debugf("fdt_load_dtb_overlay(%s)\n", filenames);
+
+ names = strdup(filenames);
+ if (names == NULL)
+ return (1);
+ name = names;
+ do {
+ comaptr = strchr(name, ',');
+ if (comaptr)
+ *comaptr = '\0';
+ fdt_load_dtb_overlay(name);
+ name = comaptr + 1;
+ } while(comaptr);
+
+ free(names);
+ return (0);
+}
+
+void
+fdt_apply_overlays()
+{
+ struct preloaded_file *fp;
+ size_t overlays_size, max_overlay_size, new_fdtp_size;
+ void *new_fdtp;
+ void *overlay;
+ int rv;
+
+ if ((fdtp == NULL) || (fdtp_size == 0))
+ return;
+
+ overlays_size = 0;
+ max_overlay_size = 0;
+ for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) {
+ if (max_overlay_size < fp->f_size)
+ max_overlay_size = fp->f_size;
+ overlays_size += fp->f_size;
+ }
+
+ /* Nothing to apply */
+ if (overlays_size == 0)
+ return;
+
+ /* It's actually more than enough */
+ new_fdtp_size = fdtp_size + overlays_size;
+ new_fdtp = malloc(new_fdtp_size);
+ if (new_fdtp == NULL) {
+ printf("failed to allocate memory for DTB blob with overlays\n");
+ return;
+ }
+
+ overlay = malloc(max_overlay_size);
+ if (overlay == NULL) {
+ printf("failed to allocate memory for DTB blob with overlays\n");
+ free(new_fdtp);
+ return;
+ }
+
+ rv = fdt_open_into(fdtp, new_fdtp, new_fdtp_size);
+ if (rv != 0) {
+ printf("failed to open DTB blob for applying overlays\n");
+ return;
+ }
+
+ for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) {
+ printf("applying DTB overlay '%s'\n", fp->f_name);
+ COPYOUT(fp->f_addr, overlay, fp->f_size);
+ fdt_overlay_apply(new_fdtp, overlay, fp->f_size);
+ }
+
+ free(fdtp);
+ fdtp = new_fdtp;
+ fdtp_size = new_fdtp_size;
+
+ free(overlay);
+}
+
int
fdt_setup_fdtp()
{
@@ -529,7 +652,7 @@ fdt_fixup_memory(struct fdt_mem_region *region, size_t num)
if (fdt_get_mem_rsv(fdtp, i, &rstart, &rsize))
break;
if (rsize) {
- /* Ensure endianess, and put cells into a buffer */
+ /* Ensure endianness, and put cells into a buffer */
if (addr_cells == 2)
*(uint64_t *)buf =
cpu_to_fdt64(rstart);
@@ -578,7 +701,7 @@ fdt_fixup_memory(struct fdt_mem_region *region, size_t num)
for (i = 0; i < num; i++) {
curmr = &region[i];
if (curmr->size != 0) {
- /* Ensure endianess, and put cells into a buffer */
+ /* Ensure endianness, and put cells into a buffer */
if (addr_cells == 2)
*(uint64_t *)buf =
cpu_to_fdt64(curmr->start);
diff --git a/sys/boot/fdt/fdt_overlay.c b/sys/boot/fdt/fdt_overlay.c
new file mode 100644
index 0000000..a19f06e
--- /dev/null
+++ b/sys/boot/fdt/fdt_overlay.c
@@ -0,0 +1,438 @@
+/*-
+ * Copyright (c) 2015 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
+ * 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 <stand.h>
+#include <libfdt.h>
+
+#include "fdt_overlay.h"
+
+/*
+ * Get max phandle
+ */
+static uint32_t
+fdt_max_phandle(void *fdtp)
+{
+ int o, depth;
+ uint32_t max_phandle, phandle;
+
+ depth = 1;
+ o = fdt_path_offset(fdtp, "/");
+ max_phandle = fdt_get_phandle(fdtp, o);
+ for (depth = 0; (o >= 0) && (depth >= 0); o = fdt_next_node(fdtp, o, &depth)) {
+ phandle = fdt_get_phandle(fdtp, o);
+ if (max_phandle < phandle)
+ max_phandle = phandle;
+ }
+
+ return max_phandle;
+}
+
+/*
+ * Returns exact memory location specified by fixup in format
+ * /path/to/node:property:offset
+ */
+static void *
+fdt_get_fixup_location(void *fdtp, const char *fixup)
+{
+ char *path, *prop, *offsetp, *endp;
+ int prop_offset, o, proplen;
+ void *result;
+
+ result = 0;
+
+ path = strdup(fixup);
+ prop = strchr(path, ':');
+ if (prop == NULL) {
+ printf("missing property part in \"%s\"\n", fixup);
+ result = NULL;
+ goto out;
+ }
+
+ *prop = 0;
+ prop++;
+
+ offsetp = strchr(prop, ':');
+ if (offsetp == NULL) {
+ printf("missing offset part in \"%s\"\n", fixup);
+ result = NULL;
+ goto out;
+ }
+
+ *offsetp = 0;
+ offsetp++;
+
+ prop_offset = strtoul(offsetp, &endp, 10);
+ if (*endp != '\0') {
+ printf("\"%s\" is not valid number\n", offsetp);
+ result = NULL;
+ goto out;
+ }
+
+ o = fdt_path_offset(fdtp, path);
+ if (o < 0) {
+ printf("path \"%s\" not found\n", path);
+ result = NULL;
+ goto out;
+ }
+
+ result = fdt_getprop_w(fdtp, o, prop, &proplen);
+ if (result == NULL){
+ printf("property \"%s\" not found in \"%s\" node\n", prop, path);
+ result = NULL;
+ goto out;
+ }
+
+ if (proplen < prop_offset + sizeof(uint32_t)) {
+ printf("%s: property length is too small for fixup\n", fixup);
+ result = NULL;
+ goto out;
+ }
+
+ result = (char*)result + prop_offset;
+
+out:
+ free(path);
+ return (result);
+}
+
+/*
+ * Process one entry in __fixups__ { } node
+ * @fixups is property value, array of NUL-terminated strings
+ * with fixup locations
+ * @fixups_len length of the fixups array in bytes
+ * @phandle is value for these locations
+ */
+static int
+fdt_do_one_fixup(void *fdtp, const char *fixups, int fixups_len, int phandle)
+{
+ void *fixup_pos;
+ uint32_t val;
+
+ val = cpu_to_fdt32(phandle);
+
+ while (fixups_len > 0) {
+ fixup_pos = fdt_get_fixup_location(fdtp, fixups);
+ if (fixup_pos != NULL)
+ memcpy(fixup_pos, &val, sizeof(val));
+
+ fixups_len -= strlen(fixups) + 1;
+ fixups += strlen(fixups) + 1;
+ }
+
+ return (0);
+}
+
+/*
+ * Increase u32 value at pos by offset
+ */
+static void
+fdt_increase_u32(void *pos, uint32_t offset)
+{
+ uint32_t val;
+
+ memcpy(&val, pos, sizeof(val));
+ val = cpu_to_fdt32(fdt32_to_cpu(val) + offset);
+ memcpy(pos, &val, sizeof(val));
+}
+
+/*
+ * Process local fixups
+ * @fixups is property value, array of NUL-terminated strings
+ * with fixup locations
+ * @fixups_len length of the fixups array in bytes
+ * @offset value these locations should be increased by
+ */
+static int
+fdt_do_local_fixup(void *fdtp, const char *fixups, int fixups_len, int offset)
+{
+ void *fixup_pos;
+
+ while (fixups_len > 0) {
+ fixup_pos = fdt_get_fixup_location(fdtp, fixups);
+ if (fixup_pos != NULL)
+ fdt_increase_u32(fixup_pos, offset);
+
+ fixups_len -= strlen(fixups) + 1;
+ fixups += strlen(fixups) + 1;
+ }
+
+ return (0);
+}
+
+/*
+ * Increase node phandle by phandle_offset
+ */
+static void
+fdt_increase_phandle(void *fdtp, int node_offset, uint32_t phandle_offset)
+{
+ int proplen;
+ void *phandle_pos, *node_pos;
+
+ node_pos = (char*)fdtp + node_offset;
+
+ phandle_pos = fdt_getprop_w(fdtp, node_offset, "phandle", &proplen);
+ if (phandle_pos)
+ fdt_increase_u32(phandle_pos, phandle_offset);
+ phandle_pos = fdt_getprop_w(fdtp, node_offset, "linux,phandle", &proplen);
+ if (phandle_pos)
+ fdt_increase_u32(phandle_pos, phandle_offset);
+}
+
+/*
+ * Increase all phandles by offset
+ */
+static void
+fdt_increase_phandles(void *fdtp, uint32_t offset)
+{
+ int o, depth;
+
+ o = fdt_path_offset(fdtp, "/");
+ for (depth = 0; (o >= 0) && (depth >= 0); o = fdt_next_node(fdtp, o, &depth)) {
+ fdt_increase_phandle(fdtp, o, offset);
+ }
+}
+
+/*
+ * Overlay one node defined by <overlay_fdtp, overlay_o> over <main_fdtp, target_o>
+ */
+static void
+fdt_overlay_node(void *main_fdtp, int target_o, void *overlay_fdtp, int overlay_o)
+{
+ int len, o, depth;
+ const char *name;
+ const void *val;
+ int target_subnode_o;
+
+ /* Overlay properties */
+ for (o = fdt_first_property_offset(overlay_fdtp, overlay_o);
+ o >= 0; o = fdt_next_property_offset(overlay_fdtp, o)) {
+ val = fdt_getprop_by_offset(overlay_fdtp, o, &name, &len);
+ if (val)
+ fdt_setprop(main_fdtp, target_o, name, val, len);
+ }
+
+ /* Now overlay nodes */
+ o = overlay_o;
+ for (depth = 0; (o >= 0) && (depth >= 0);
+ o = fdt_next_node(overlay_fdtp, o, &depth)) {
+ if (depth != 1)
+ continue;
+ /* Check if there is node with the same name */
+ name = fdt_get_name(overlay_fdtp, o, NULL);
+ target_subnode_o = fdt_subnode_offset(main_fdtp, target_o, name);
+ if (target_subnode_o < 0) {
+ /* create new subnode and run merge recursively */
+ target_subnode_o = fdt_add_subnode(main_fdtp, target_o, name);
+ if (target_subnode_o < 0) {
+ printf("failed to create subnode \"%s\": %d\n",
+ name, target_subnode_o);
+ return;
+ }
+ }
+
+ fdt_overlay_node(main_fdtp, target_subnode_o,
+ overlay_fdtp, o);
+ }
+}
+
+/*
+ * Apply one overlay fragment
+ */
+static void
+fdt_apply_fragment(void *main_fdtp, void *overlay_fdtp, int fragment_o)
+{
+ uint32_t target;
+ const char *target_path;
+ const void *val;
+ int target_node_o, overlay_node_o;
+
+ target_node_o = -1;
+ val = fdt_getprop(overlay_fdtp, fragment_o, "target", NULL);
+ if (val) {
+ memcpy(&target, val, sizeof(target));
+ target = fdt32_to_cpu(target);
+ target_node_o = fdt_node_offset_by_phandle(main_fdtp, target);
+ if (target_node_o < 0) {
+ printf("failed to find target %04x\n", target);
+ return;
+ }
+ }
+
+ if (target_node_o < 0) {
+ target_path = fdt_getprop(overlay_fdtp, fragment_o, "target-path", NULL);
+ if (target_path == NULL)
+ return;
+
+ target_node_o = fdt_path_offset(main_fdtp, target_path);
+ if (target_node_o < 0) {
+ printf("failed to find target-path %s\n", target_path);
+ return;
+ }
+ }
+
+ if (target_node_o < 0)
+ return;
+
+ overlay_node_o = fdt_subnode_offset(overlay_fdtp, fragment_o, "__overlay__");
+ if (overlay_node_o < 0) {
+ printf("missing __overlay__ sub-node\n");
+ return;
+ }
+
+ fdt_overlay_node(main_fdtp, target_node_o, overlay_fdtp, overlay_node_o);
+}
+
+/*
+ * Handle __fixups__ node in overlay DTB
+ */
+static int
+fdt_overlay_do_fixups(void *main_fdtp, void *overlay_fdtp)
+{
+ int main_symbols_o, symbol_o, overlay_fixups_o;
+ int fixup_prop_o;
+ int len;
+ const char *fixups, *name;
+ const char *symbol_path;
+ uint32_t phandle;
+
+ main_symbols_o = fdt_path_offset(main_fdtp, "/__symbols__");
+ overlay_fixups_o = fdt_path_offset(overlay_fdtp, "/__fixups__");
+
+ if (main_symbols_o < 0)
+ return (-1);
+ if (overlay_fixups_o < 0)
+ return (-1);
+
+ for (fixup_prop_o = fdt_first_property_offset(overlay_fdtp, overlay_fixups_o);
+ fixup_prop_o >= 0;
+ fixup_prop_o = fdt_next_property_offset(overlay_fdtp, fixup_prop_o)) {
+ fixups = fdt_getprop_by_offset(overlay_fdtp, fixup_prop_o, &name, &len);
+ symbol_path = fdt_getprop(main_fdtp, main_symbols_o, name, NULL);
+ if (symbol_path == NULL) {
+ printf("couldn't find \"%s\" symbol in main dtb\n", name);
+ return (-1);
+ }
+ symbol_o = fdt_path_offset(main_fdtp, symbol_path);
+ if (symbol_o < 0) {
+ printf("couldn't find \"%s\" path in main dtb\n", symbol_path);
+ return (-1);
+ }
+ phandle = fdt_get_phandle(main_fdtp, symbol_o);
+ if (fdt_do_one_fixup(overlay_fdtp, fixups, len, phandle) < 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Handle __local_fixups__ node in overlay DTB
+ */
+static int
+fdt_overlay_do_local_fixups(void *main_fdtp, void *overlay_fdtp)
+{
+ int overlay_local_fixups_o;
+ int len;
+ const char *fixups;
+ uint32_t phandle_offset;
+
+ overlay_local_fixups_o = fdt_path_offset(overlay_fdtp, "/__local_fixups__");
+
+ if (overlay_local_fixups_o < 0)
+ return (-1);
+
+ phandle_offset = fdt_max_phandle(main_fdtp);
+ fdt_increase_phandles(overlay_fdtp, phandle_offset);
+ fixups = fdt_getprop_w(overlay_fdtp, overlay_local_fixups_o, "fixup", &len);
+ if (fixups) {
+ if (fdt_do_local_fixup(overlay_fdtp, fixups, len, phandle_offset) < 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Apply all fragments to main DTB
+ */
+static int
+fdt_overlay_apply_fragments(void *main_fdtp, void *overlay_fdtp)
+{
+ int o, depth;
+
+ o = fdt_path_offset(overlay_fdtp, "/");
+ for (depth = 0; (o >= 0) && (depth >= 0); o = fdt_next_node(overlay_fdtp, o, &depth)) {
+ if (depth != 1)
+ continue;
+
+ fdt_apply_fragment(main_fdtp, overlay_fdtp, o);
+ }
+
+ return (0);
+}
+
+int
+fdt_overlay_apply(void *main_fdtp, void *overlay_fdtp, size_t overlay_length)
+{
+ void *overlay_copy;
+ int rv;
+
+ rv = 0;
+
+ /* We modify overlay in-place, so we need writable copy */
+ overlay_copy = malloc(overlay_length);
+ if (overlay_copy == NULL) {
+ printf("failed to allocate memory for overlay copy\n");
+ return (-1);
+ }
+
+ memcpy(overlay_copy, overlay_fdtp, overlay_length);
+
+ if (fdt_overlay_do_fixups(main_fdtp, overlay_copy) < 0) {
+ printf("failed to perform fixups in overlay\n");
+ rv = -1;
+ goto out;
+ }
+
+ if (fdt_overlay_do_local_fixups(main_fdtp, overlay_copy) < 0) {
+ printf("failed to perform local fixups in overlay\n");
+ rv = -1;
+ goto out;
+ }
+
+ if (fdt_overlay_apply_fragments(main_fdtp, overlay_copy) < 0) {
+ printf("failed to apply fragments\n");
+ rv = -1;
+ }
+
+out:
+ free(overlay_copy);
+
+ return (rv);
+}
diff --git a/sys/boot/fdt/fdt_overlay.h b/sys/boot/fdt/fdt_overlay.h
new file mode 100644
index 0000000..0f91343
--- /dev/null
+++ b/sys/boot/fdt/fdt_overlay.h
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2015 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
+ * 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$
+ */
+
+#ifndef FDT_OVERLAY_H
+#define FDT_OVERLAY_H
+
+int fdt_overlay_apply(void *main_fdtp, void *overlay_fdtp, size_t overlay_length);
+
+#endif /* FDT_OVERLAY_H */
diff --git a/sys/boot/fdt/fdt_platform.h b/sys/boot/fdt/fdt_platform.h
index cad7602..eae940a 100644
--- a/sys/boot/fdt/fdt_platform.h
+++ b/sys/boot/fdt/fdt_platform.h
@@ -43,8 +43,10 @@ void fdt_fixup_cpubusfreqs(unsigned long, unsigned long);
void fdt_fixup_ethernet(const char *, char *, int);
void fdt_fixup_memory(struct fdt_mem_region *, size_t);
void fdt_fixup_stdout(const char *);
+void fdt_apply_overlays(void);
int fdt_load_dtb_addr(struct fdt_header *);
int fdt_load_dtb_file(const char *);
+int fdt_load_dtb_overlays(const char *);
int fdt_setup_fdtp(void);
/* The platform library needs to implement these functions */
diff --git a/sys/boot/forth/delay.4th b/sys/boot/forth/delay.4th
index 56dfcf0..28cfa5c 100644
--- a/sys/boot/forth/delay.4th
+++ b/sys/boot/forth/delay.4th
@@ -66,7 +66,7 @@ only forth definitions also delay-processing
false delay_showdots ! \ reset to zero and read from environment
s" delay_showdots" getenv dup -1 <> if
- 2drop \ don't need the value, just existance
+ 2drop \ don't need the value, just existence
true delay_showdots !
else
drop
diff --git a/sys/boot/forth/loader.4th b/sys/boot/forth/loader.4th
index ad4042e..8df8cbb 100644
--- a/sys/boot/forth/loader.4th
+++ b/sys/boot/forth/loader.4th
@@ -136,7 +136,7 @@ only forth definitions also support-functions
\ ***** start
\
\ Initializes support.4th global variables, sets loader_conf_files,
-\ processes conf files, and, if any one such file was succesfully
+\ processes conf files, and, if any one such file was successfully
\ read to the end, loads kernel and modules.
: start ( -- ) ( throws: abort & user-defined )
@@ -144,7 +144,7 @@ only forth definitions also support-functions
include_conf_files
include_nextboot_file
\ Will *NOT* try to load kernel and modules if no configuration file
- \ was succesfully loaded!
+ \ was successfully loaded!
any_conf_read? if
s" loader_delay" getenv -1 = if
load_xen_throw
diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf
index 9162055..a56666c 100644
--- a/sys/boot/forth/loader.conf
+++ b/sys/boot/forth/loader.conf
@@ -159,7 +159,7 @@ module_path="/boot/modules" # Set the module search path
#kern.cam.boot_delay="10000" # Delay (in ms) of root mount for CAM bus
# registration, useful for USB sticks as root
#kern.cam.scsi_delay="2000" # Delay (in ms) before probing SCSI
-#kern.ipc.maxsockets="" # Set the maximum number of sockets avaliable
+#kern.ipc.maxsockets="" # Set the maximum number of sockets available
#kern.ipc.nmbclusters="" # Set the number of mbuf clusters
#kern.ipc.nsfbufs="" # Set the number of sendfile(2) bufs
#net.inet.tcp.tcbhashsize="" # Set the value of TCBHASHSIZE
diff --git a/sys/boot/forth/menu.4th b/sys/boot/forth/menu.4th
index 1f95b66..fb4eb41 100644
--- a/sys/boot/forth/menu.4th
+++ b/sys/boot/forth/menu.4th
@@ -282,7 +282,7 @@ also menu-infrastructure definitions
;
\ This function parses $kernels into variables that are used by the menu to
-\ display wich kernel to boot when the [overloaded] `boot' word is interpreted.
+\ display which kernel to boot when the [overloaded] `boot' word is interpreted.
\ Used internally by menu-create, you need not (nor should you) call this
\ directly.
\
@@ -790,7 +790,7 @@ also menu-infrastructure definitions
again
;
-: menu-erase ( -- ) \ Erases menu and resets positioning variable to positon 1.
+: menu-erase ( -- ) \ Erases menu and resets positioning variable to position 1.
\ Clear the screen area associated with the interactive menu
menuX @ menuY @
diff --git a/sys/boot/forth/support.4th b/sys/boot/forth/support.4th
index 3a8e1f2..aac258d 100644
--- a/sys/boot/forth/support.4th
+++ b/sys/boot/forth/support.4th
@@ -56,7 +56,7 @@
\ string conf_files configuration files to be loaded
\ cell modules_options pointer to first module information
\ value verbose? indicates if user wants a verbose loading
-\ value any_conf_read? indicates if a conf file was succesfully read
+\ value any_conf_read? indicates if a conf file was successfully read
\
\ Other exported words:
\ note, strlen is internal
@@ -960,7 +960,7 @@ only forth also support-functions definitions
string current_file_name_ref \ used to print the file name
-\ Indicates if any conf file was succesfully read
+\ Indicates if any conf file was successfully read
0 value any_conf_read?
@@ -1133,7 +1133,7 @@ string current_file_name_ref \ used to print the file name
then
else
after_load
- load_succesful_message true \ Succesful, do not retry
+ load_succesful_message true \ Successful, do not retry
then
until
;
@@ -1325,7 +1325,7 @@ also builtins
\ 1. /boot/path
\ 2. path
\
-\ The module_path variable is overridden if load is succesful, by
+\ The module_path variable is overridden if load is successful, by
\ prepending the successful path.
: load_from_directory ( path len 1 | flags len' path len 2 -- flag )
@@ -1412,7 +1412,7 @@ also builtins
\ will first be tried as a full path, and, next, search on the
\ directories pointed by module_path.
\
-\ The module_path variable is overridden if load is succesful, by
+\ The module_path variable is overridden if load is successful, by
\ prepending the successful path.
: load_directory_or_file ( path len 1 | flags len' path len 2 -- flag )
diff --git a/sys/boot/i386/libfirewire/dconsole.c b/sys/boot/i386/libfirewire/dconsole.c
index 16645e2..1528faf 100644
--- a/sys/boot/i386/libfirewire/dconsole.c
+++ b/sys/boot/i386/libfirewire/dconsole.c
@@ -53,7 +53,7 @@ uint32_t dcons_paddr;
* that is mapped at the very early boot state.
* - We expect identiy map only for regions before KERNLOAD
* (i386:4MB amd64:1MB).
- * - It seems that heap in conventional memory(640KB) is not sufficent
+ * - It seems that heap in conventional memory(640KB) is not sufficient
* and we move it to high address as LOADER_SUPPORT_BZIP2.
* - BSS is placed in conventional memory.
*/
diff --git a/sys/boot/i386/libfirewire/fwohci.c b/sys/boot/i386/libfirewire/fwohci.c
index 326e44b..567abcf 100644
--- a/sys/boot/i386/libfirewire/fwohci.c
+++ b/sys/boot/i386/libfirewire/fwohci.c
@@ -217,7 +217,7 @@ fwohci_reset(struct fwohci_softc *sc, device_t dev)
/* Disable interrupts */
OWRITE(sc, FWOHCI_INTMASKCLR, ~0);
- /* FLUSH FIFO and reset Transmitter/Reciever */
+ /* FLUSH FIFO and reset Transmitter/Receiver */
OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_RESET);
if (firewire_debug)
device_printf(dev, "resetting OHCI...");
@@ -297,7 +297,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev)
return (ENXIO);
#if 0
-/* SID recieve buffer must align 2^11 */
+/* SID receive buffer must align 2^11 */
#define OHCI_SIDSIZE (1 << 11)
sc->sid_buf = fwdma_malloc(&sc->fc, OHCI_SIDSIZE, OHCI_SIDSIZE,
&sc->sid_dma, BUS_DMA_WAITOK);
diff --git a/sys/boot/i386/libi386/amd64_tramp.S b/sys/boot/i386/libi386/amd64_tramp.S
index fe0cf83..6359b90 100644
--- a/sys/boot/i386/libi386/amd64_tramp.S
+++ b/sys/boot/i386/libi386/amd64_tramp.S
@@ -96,7 +96,7 @@ amd64_tramp:
orl $CR0_PG, %eax
movl %eax, %cr0
- /* Now we're in compatability mode. set %cs for long mode */
+ /* Now we're in compatibility mode. set %cs for long mode */
movl $VTOP(gdtdesc), %eax
movl VTOP(entry_hi), %esi
movl VTOP(entry_lo), %edi
diff --git a/sys/boot/i386/libi386/bioscd.c b/sys/boot/i386/libi386/bioscd.c
index c387513..6d1d1e1 100644
--- a/sys/boot/i386/libi386/bioscd.c
+++ b/sys/boot/i386/libi386/bioscd.c
@@ -271,14 +271,25 @@ bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
if (rsize)
*rsize = 0;
- if (blks && bc_read(unit, dblk, blks, buf)) {
+ if ((blks = bc_read(unit, dblk, blks, buf)) < 0) {
DEBUG("read error");
return (EIO);
+ } else {
+ if (size / BIOSCD_SECSIZE > blks) {
+ if (rsize)
+ *rsize = blks * BIOSCD_SECSIZE;
+ return (0);
+ }
}
#ifdef BD_SUPPORT_FRAGS
DEBUG("frag read %d from %lld+%d to %p",
fragsize, dblk, blks, buf + (blks * BIOSCD_SECSIZE));
- if (fragsize && bc_read(unit, dblk + blks, 1, fragbuf)) {
+ if (fragsize && bc_read(unit, dblk + blks, 1, fragbuf) != 1) {
+ if (blks) {
+ if (rsize)
+ *rsize = blks * BIOSCD_SECSIZE;
+ return (0);
+ }
DEBUG("frag read error");
return(EIO);
}
@@ -292,6 +303,7 @@ bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
/* Max number of sectors to bounce-buffer at a time. */
#define CD_BOUNCEBUF 8
+/* return negative value for an error, otherwise blocks read */
static int
bc_read(int unit, daddr_t dblk, int blks, caddr_t dest)
{
@@ -368,6 +380,8 @@ bc_read(int unit, daddr_t dblk, int blks, caddr_t dest)
result = V86_CY(v86.efl);
if (result == 0)
break;
+ /* fall back to 1 sector read */
+ x = 1;
}
#ifdef DISK_DEBUG
@@ -376,6 +390,11 @@ bc_read(int unit, daddr_t dblk, int blks, caddr_t dest)
DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p,
VTOP(p), result ? "failed" : "ok");
DEBUG("unit %d status 0x%x", unit, error);
+
+ /* still an error? break off */
+ if (result != 0)
+ break;
+
if (bbuf != NULL)
bcopy(bbuf, p, x * BIOSCD_SECSIZE);
p += (x * BIOSCD_SECSIZE);
@@ -384,7 +403,11 @@ bc_read(int unit, daddr_t dblk, int blks, caddr_t dest)
}
/* hexdump(dest, (blks * BIOSCD_SECSIZE)); */
- return(0);
+
+ if (blks - resid == 0)
+ return (-1); /* read failed */
+
+ return (blks - resid);
}
/*
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 4dfb6f8..e5b7835 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -508,6 +508,18 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
if (rsize)
*rsize = 0;
+ if (dblk >= BD(dev).bd_sectors) {
+ DEBUG("IO past disk end %llu", (unsigned long long)dblk);
+ return (EIO);
+ }
+
+ if (dblk + blks > BD(dev).bd_sectors) {
+ /* perform partial read */
+ blks = BD(dev).bd_sectors - dblk;
+ size = blks * BD(dev).bd_sectorsize;
+ DEBUG("short read %d", blks);
+ }
+
switch(rw){
case F_READ:
DEBUG("read %d from %lld to %p", blks, dblk, buf);
diff --git a/sys/boot/i386/libi386/pxe.h b/sys/boot/i386/libi386/pxe.h
index 651bdcd..9729562 100644
--- a/sys/boot/i386/libi386/pxe.h
+++ b/sys/boot/i386/libi386/pxe.h
@@ -226,7 +226,7 @@ typedef struct {
#define PXENV_UNDI_SET_STATION_ADDRESS 0x000A
typedef struct {
PXENV_STATUS_t Status;
- MAC_ADDR StationAddress; /* Temp MAC addres to use */
+ MAC_ADDR StationAddress; /* Temp MAC address to use */
} PACKED t_PXENV_UNDI_SET_STATION_ADDR;
#define PXENV_UNDI_SET_PACKET_FILTER 0x000B
@@ -330,7 +330,7 @@ typedef struct {
PXENV_STATUS_t Status;
uint16_t FuncFlag; /* PXENV_UNDI_ISR_OUT_xxx */
uint16_t BufferLength; /* Length of Frame */
- uint16_t FrameLength; /* Total length of reciever frame */
+ uint16_t FrameLength; /* Total length of receiver frame */
uint16_t FrameHeaderLength; /* Length of the media header in Frame */
SEGOFF16_t Frame; /* receive buffer */
uint8_t ProtType; /* Protocol type */
@@ -344,7 +344,7 @@ typedef struct {
# define PXENV_UNDI_ISR_OUT_NOT_OUTS 1
/*
- * one of these will bre returnd for PXEND_UNDI_ISR_IN_PROCESS
+ * one of these will bre returned for PXEND_UNDI_ISR_IN_PROCESS
* and PXENV_UNDI_ISR_IN_GET_NEXT
*/
# define PXENV_UNDI_ISR_OUT_DONE 0
diff --git a/sys/boot/i386/zfsboot/zfsboot.c b/sys/boot/i386/zfsboot/zfsboot.c
index 71d6cfa..2562aab 100644
--- a/sys/boot/i386/zfsboot/zfsboot.c
+++ b/sys/boot/i386/zfsboot/zfsboot.c
@@ -224,21 +224,18 @@ vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes)
while (bytes > 0) {
nb = bytes / DEV_BSIZE;
- if (nb > READ_BUF_SIZE / DEV_BSIZE)
- nb = READ_BUF_SIZE / DEV_BSIZE;
/*
* Ensure that the read size plus the leading offset does not
* exceed the size of the read buffer.
*/
- if (nb * DEV_BSIZE + diff > READ_BUF_SIZE)
- nb -= diff / DEV_BSIZE;
+ if (nb > (READ_BUF_SIZE - diff) / DEV_BSIZE)
+ nb = (READ_BUF_SIZE - diff) / DEV_BSIZE;
/*
* Round the number of blocks to read up to the nearest multiple
* of DEV_GELIBOOT_BSIZE.
*/
- alignnb = nb + (diff / DEV_BSIZE) +
- (DEV_GELIBOOT_BSIZE / DEV_BSIZE - 1) & ~
- (unsigned int)(DEV_GELIBOOT_BSIZE / DEV_BSIZE - 1);
+ alignnb = roundup2(nb * DEV_BSIZE + diff, DEV_GELIBOOT_BSIZE)
+ / DEV_BSIZE;
if (drvread(dsk, dmadat->rdbuf, alignlba, alignnb))
return -1;
@@ -451,7 +448,7 @@ probe_drive(struct dsk *dsk)
}
/*
- * Probe all GPT partitions for the presense of ZFS pools. We
+ * Probe all GPT partitions for the presence of ZFS pools. We
* return the spa_t for the first we find (if requested). This
* will have the effect of booting from the first pool on the
* disk.
diff --git a/sys/boot/ofw/common/main.c b/sys/boot/ofw/common/main.c
index 0913f0c..b15df5f 100644
--- a/sys/boot/ofw/common/main.c
+++ b/sys/boot/ofw/common/main.c
@@ -98,7 +98,7 @@ main(int (*openfirm)(void *))
char **bargv;
/*
- * Initalise the Open Firmware routines by giving them the entry point.
+ * Initialise the Open Firmware routines by giving them the entry point.
*/
OF_init(openfirm);
diff --git a/sys/boot/pc98/boot0.5/disk.s b/sys/boot/pc98/boot0.5/disk.s
index 162dce9..6e80348 100644
--- a/sys/boot/pc98/boot0.5/disk.s
+++ b/sys/boot/pc98/boot0.5/disk.s
@@ -249,7 +249,7 @@ scsi_loop:
movb %ah, %bl
shlw %bx
shlw %bx
- addw $0x460, %bx # SCSI paramter block
+ addw $0x460, %bx # SCSI parameter block
call read_biosparam
orb %dl, %dl
jz no_scsi_unit
diff --git a/sys/boot/pc98/boot0.5/putssjis.s b/sys/boot/pc98/boot0.5/putssjis.s
index 4a75b97..221b9e6 100644
--- a/sys/boot/pc98/boot0.5/putssjis.s
+++ b/sys/boot/pc98/boot0.5/putssjis.s
@@ -33,7 +33,7 @@
#
# Display string with Shift-JIS support
- # %si: addres of string, %di: T-VRAM address, %cx: count
+ # %si: address of string, %di: T-VRAM address, %cx: count
#
# Absolute address of putssjis_entry must be 0x1243.
diff --git a/sys/boot/pc98/boot0.5/support.s b/sys/boot/pc98/boot0.5/support.s
index 65f5a9a..df1115b 100644
--- a/sys/boot/pc98/boot0.5/support.s
+++ b/sys/boot/pc98/boot0.5/support.s
@@ -55,7 +55,7 @@ read_biosparam:
ret
#
-# Write one byte to BIOS paramter block
+# Write one byte to BIOS parameter block
# %bx offset
# %dl value
#
diff --git a/sys/boot/uboot/fdt/uboot_fdt.c b/sys/boot/uboot/fdt/uboot_fdt.c
index 6b646f6..1865310 100644
--- a/sys/boot/uboot/fdt/uboot_fdt.c
+++ b/sys/boot/uboot/fdt/uboot_fdt.c
@@ -45,6 +45,7 @@ fdt_platform_load_dtb(void)
struct fdt_header *hdr;
const char *s;
char *p;
+ int rv;
/*
* If the U-boot environment contains a variable giving the address of a
@@ -68,6 +69,8 @@ fdt_platform_load_dtb(void)
}
}
+ rv = 1;
+
/*
* Try to get FDT filename first from loader env and then from u-boot env
*/
@@ -79,11 +82,21 @@ fdt_platform_load_dtb(void)
if (s != NULL && *s != '\0') {
if (fdt_load_dtb_file(s) == 0) {
printf("Loaded DTB from file '%s'.\n", s);
- return (0);
+ rv = 0;
}
}
- return (1);
+ if (rv == 0) {
+ s = getenv("fdt_overlays");
+ if (s == NULL)
+ s = ub_env_get("fdt_overlays");
+ if (s != NULL && *s != '\0') {
+ printf("Loading DTB overlays: '%s'\n", s);
+ fdt_load_dtb_overlays(s);
+ }
+ }
+
+ return (rv);
}
void
@@ -99,6 +112,9 @@ fdt_platform_fixups(void)
eth_no = 0;
ethstr = NULL;
+ /* Apply overlays before anything else */
+ fdt_apply_overlays();
+
/* Acquire sys_info */
si = ub_get_sys_info();
@@ -141,7 +157,7 @@ fdt_platform_fixups(void)
if (n != 0) {
/*
- * Find the lenght of the interface id by
+ * Find the length of the interface id by
* taking in to account the first 3 and
* last 4 characters.
*/
diff --git a/sys/cam/cam.h b/sys/cam/cam.h
index 63f83c7..ec4df8b 100644
--- a/sys/cam/cam.h
+++ b/sys/cam/cam.h
@@ -77,7 +77,7 @@ typedef enum {
CAM_RL_VALUES
} cam_rl;
/*
- * The generation number is incremented everytime a new entry is entered into
+ * The generation number is incremented every time a new entry is entered into
* the queue giving round robin per priority level scheduling.
*/
typedef struct {
@@ -118,7 +118,7 @@ typedef enum {
enum {
SF_RETRY_UA = 0x01, /* Retry UNIT ATTENTION conditions. */
SF_NO_PRINT = 0x02, /* Never print error status. */
- SF_QUIET_IR = 0x04, /* Be quiet about Illegal Request reponses */
+ SF_QUIET_IR = 0x04, /* Be quiet about Illegal Request responses */
SF_PRINT_ALWAYS = 0x08, /* Always print error status. */
SF_NO_RECOVERY = 0x10, /* Don't do active error recovery. */
SF_NO_RETRY = 0x20, /* Don't do any retries. */
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 85b2ff9..b1686bc 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1604,7 +1604,7 @@ sense_error_done:
/*
* Generic error handler. Peripheral drivers usually filter
- * out the errors that they handle in a unique mannor, then
+ * out the errors that they handle in a unique manner, then
* call this function.
*/
int
diff --git a/sys/cam/cam_queue.c b/sys/cam/cam_queue.c
index b67f687..3959c3d 100644
--- a/sys/cam/cam_queue.c
+++ b/sys/cam/cam_queue.c
@@ -122,7 +122,7 @@ camq_resize(struct camq *queue, int new_size)
cam_pinfo **new_array;
KASSERT(new_size >= queue->entries, ("camq_resize: "
- "New queue size can't accomodate queued entries (%d < %d).",
+ "New queue size can't accommodate queued entries (%d < %d).",
new_size, queue->entries));
new_array = (cam_pinfo **)malloc(new_size * sizeof(cam_pinfo *),
M_CAMQ, M_NOWAIT);
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index d22eda2..9f51487 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -863,7 +863,7 @@ xpt_init(void *dummy)
xsoftc.boot_delay = CAM_BOOT_DELAY;
#endif
/*
- * The xpt layer is, itself, the equivelent of a SIM.
+ * The xpt layer is, itself, the equivalent of a SIM.
* Allow 16 ccbs in the ccb pool for it. This should
* give decent parallelism when we probe busses and
* perform other XPT functions.
@@ -892,7 +892,7 @@ xpt_init(void *dummy)
/*
* Looking at the XPT from the SIM layer, the XPT is
- * the equivelent of a peripheral driver. Allocate
+ * the equivalent of a peripheral driver. Allocate
* a peripheral driver entry for us.
*/
if ((status = xpt_create_path(&path, NULL, CAM_XPT_PATH_ID,
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index d6331b9..83e2289 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -5980,7 +5980,7 @@ ctl_debugconf_sp_sense_handler(struct ctl_scsiio *ctsio,
case SMS_PAGE_CTRL_DEFAULT >> 6:
case SMS_PAGE_CTRL_SAVED >> 6:
/*
- * We don't update the changable or default bits for this page.
+ * We don't update the changeable or default bits for this page.
*/
break;
case SMS_PAGE_CTRL_CURRENT >> 6:
@@ -10223,7 +10223,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio)
*
* Therefore we set the HiSup bit here.
*
- * The reponse format is 2, per SPC-3.
+ * The response format is 2, per SPC-3.
*/
inq_ptr->response_format = SID_HiSup | 2;
diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c
index 9f9ea15..2166f45 100644
--- a/sys/cam/ctl/ctl_frontend_cam_sim.c
+++ b/sys/cam/ctl/ctl_frontend_cam_sim.c
@@ -106,7 +106,7 @@ static void cfcs_async(void *callback_arg, uint32_t code,
struct cfcs_softc cfcs_softc;
/*
- * This is primarly intended to allow for error injection to test the CAM
+ * This is primarily intended to allow for error injection to test the CAM
* sense data and sense residual handling code. This sets the maximum
* amount of SCSI sense data that we will report to CAM.
*/
diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c
index 6ef2f66..97f29f1 100644
--- a/sys/cam/ctl/ctl_frontend_ioctl.c
+++ b/sys/cam/ctl/ctl_frontend_ioctl.c
@@ -339,7 +339,7 @@ cfi_submit_wait(union ctl_io *io)
mtx_lock(&params.ioctl_mtx);
/*
* Check the state here, and don't sleep if the state has
- * already changed (i.e. wakeup has already occured, but we
+ * already changed (i.e. wakeup has already occurred, but we
* weren't waiting yet).
*/
if (params.state == last_state) {
diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h
index 21db94a..bad030f 100644
--- a/sys/cam/ctl/ctl_io.h
+++ b/sys/cam/ctl/ctl_io.h
@@ -80,7 +80,7 @@ typedef enum {
/*
* WARNING: Keep the data in/out/none flags where they are. They're used
- * in conjuction with ctl_cmd_flags. See comment above ctl_cmd_flags
+ * in conjunction with ctl_cmd_flags. See comment above ctl_cmd_flags
* definition in ctl_private.h.
*/
typedef enum {
diff --git a/sys/cam/ctl/ctl_ioctl.h b/sys/cam/ctl/ctl_ioctl.h
index 7a6fc78..40bd183 100644
--- a/sys/cam/ctl/ctl_ioctl.h
+++ b/sys/cam/ctl/ctl_ioctl.h
@@ -313,7 +313,7 @@ typedef enum {
*
* namelen: Length of the name field, including the terminating NUL.
*
- * name: Name of the paramter. This must be NUL-terminated.
+ * name: Name of the parameter. This must be NUL-terminated.
*
* flags: Flags for the parameter, see above for values.
*
@@ -485,7 +485,7 @@ struct ctl_lun_req {
* NEED_MORE_SPACE: The allocated length of the entries field is too
* small for the available data.
*
- * ERROR: An error occured, look at the error string for a
+ * ERROR: An error occurred, look at the error string for a
* description of the error.
*/
typedef enum {
@@ -573,7 +573,7 @@ struct ctl_req {
*
* OK: Request completed successfully.
*
- * ERROR: An error occured, look at the error string for a
+ * ERROR: An error occurred, look at the error string for a
* description of the error.
*
* CTL_ISCSI_LIST_NEED_MORE_SPACE:
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 2b9d4b5..35aecb9 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -3644,7 +3644,7 @@ scsi_desc_iterate(struct scsi_sense_data_desc *sense, u_int sense_len,
/*
* The length of data actually returned may be different than the
- * extra_len recorded in the sturcture.
+ * extra_len recorded in the structure.
*/
desc_len = sense_len -offsetof(struct scsi_sense_data_desc, sense_desc);
@@ -5505,7 +5505,7 @@ scsi_calc_syncsrate(u_int period_factor)
}
/*
- * Return the SCSI sync parameter that corresponsd to
+ * Return the SCSI sync parameter that corresponds to
* the passed in period in 10ths of ns.
*/
u_int
@@ -5956,7 +5956,7 @@ scsi_parse_transportid_64bit(int proto_id, char *id_str,
break;
default:
if (error_str != NULL) {
- snprintf(error_str, error_str_len, "%s: unsupoprted "
+ snprintf(error_str, error_str_len, "%s: unsupported "
"protocol %d", __func__, proto_id);
}
retval = 1;
@@ -8704,7 +8704,7 @@ scsi_static_inquiry_match(caddr_t inqbuffer, caddr_t table_entry)
* \return 0 on a match, -1 otherwise.
*
* Treat rhs and lhs as arrays of vpd device id descriptors. Walk lhs matching
- * agains each element in rhs until all data are exhausted or we have found
+ * against each element in rhs until all data are exhausted or we have found
* a match.
*/
int
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index 6e97a27..075629b 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -3146,7 +3146,7 @@ struct scsi_sense_info
/*
* Command-specific information depends on the command for which the
- * reported condition occured.
+ * reported condition occurred.
*
* Note that any changes to the field names or positions in this structure,
* even reserved fields, should be accompanied by an examination of the
@@ -3381,7 +3381,7 @@ struct scsi_sense_forwarded
/*
* Vendor-specific sense descriptor. The desc_type field will be in the
- * range bewteen MIN and MAX inclusive.
+ * range between MIN and MAX inclusive.
*/
struct scsi_sense_vendor
{
diff --git a/sys/cam/scsi/scsi_ch.h b/sys/cam/scsi/scsi_ch.h
index fd317d2..9d1ffb7 100644
--- a/sys/cam/scsi/scsi_ch.h
+++ b/sys/cam/scsi/scsi_ch.h
@@ -333,7 +333,7 @@ struct scsi_send_volume_tag_parameters {
/*
* Device capabilities page.
*
- * This page defines characteristics of the elemenet types in the
+ * This page defines characteristics of the element types in the
* medium changer device.
*
* Note in the definitions below, the following abbreviations are
@@ -341,7 +341,7 @@ struct scsi_send_volume_tag_parameters {
* MT Medium transport element (picker)
* ST Storage transport element (slot)
* IE Import/export element (portal)
- * DT Data tranfer element (tape/disk drive)
+ * DT Data transfer element (tape/disk drive)
*/
struct page_device_capabilities {
u_int8_t pg_code; /* page code (0x1f) */
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 2157676..b20d004 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -2966,7 +2966,7 @@ cmd6workaround(union ccb *ccb)
*
* While we will attempt to choose an alternative delete method
* this may result in short deletes if the existing delete
- * requests from geom are big for the new method choosen.
+ * requests from geom are big for the new method chosen.
*
* This method assumes that the error which triggered this
* will not retry the io otherwise a panic will occur
@@ -3421,7 +3421,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
* Based on older SBC-3 spec revisions
* any of the UNMAP methods "may" be
* available via LBP given this flag so
- * we flag all of them as availble and
+ * we flag all of them as available and
* then remove those which further
* probes confirm aren't available
* later.
diff --git a/sys/cam/scsi/scsi_low.h b/sys/cam/scsi/scsi_low.h
index 8d82eff..7d05b20 100644
--- a/sys/cam/scsi/scsi_low.h
+++ b/sys/cam/scsi/scsi_low.h
@@ -146,7 +146,7 @@ struct slccb {
*****************************************/
struct sc_p ccb_scp; /* given */
struct sc_p ccb_sscp; /* saved scsi data pointer */
- int ccb_datalen; /* transfered data counter */
+ int ccb_datalen; /* transferred data counter */
/*****************************************
* Msgout
@@ -165,7 +165,7 @@ struct slccb {
#define CCB_STARTQ 0x0010
#define CCB_POLLED 0x0100 /* polling ccb */
#define CCB_NORETRY 0x0200 /* do NOT retry */
-#define CCB_AUTOSENSE 0x0400 /* do a sence after CA */
+#define CCB_AUTOSENSE 0x0400 /* do a sense after CA */
#define CCB_URGENT 0x0800 /* an urgent ccb */
#define CCB_NOSDONE 0x1000 /* do not call an os done routine */
#define CCB_SCSIIO 0x2000 /* a normal scsi io coming from upper layer */
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index fa3745b..3166b8a 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -2862,7 +2862,7 @@ samount(struct cam_periph *periph, int oflags, struct cdev *dev)
softc = (struct sa_softc *)periph->softc;
/*
- * This should determine if something has happend since the last
+ * This should determine if something has happened since the last
* open/mount that would invalidate the mount. We do *not* want
* to retry this command- we just want the status. But we only
* do this if we're mounted already- if we're not mounted,
diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c
index 0dcd872..94441a9 100644
--- a/sys/cam/scsi/scsi_xpt.c
+++ b/sys/cam/scsi/scsi_xpt.c
@@ -456,7 +456,7 @@ static struct scsi_quirk_entry scsi_quirk_table[] =
},
{
/*
- * The Hitachi CJ series with J8A8 firmware apparantly has
+ * The Hitachi CJ series with J8A8 firmware apparently has
* problems with tagged commands.
* PR: 23536
* Reported by: amagai@nue.org
@@ -2431,7 +2431,7 @@ scsi_devise_transport(struct cam_path *path)
path->device->transport_version =
otherdev->transport_version;
} else {
- /* Until we know better, opt for safty */
+ /* Until we know better, opt for safety */
path->device->protocol_version = 2;
if (path->device->transport == XPORT_SPI)
path->device->transport_version = 2;
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
index a92a54b..4f5b2a8 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
@@ -61,6 +61,9 @@ static int vdev_geom_bio_delete_disable;
SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RWTUN,
&vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE");
+/* Declare local functions */
+static void vdev_geom_detach(struct g_consumer *cp, boolean_t open_for_read);
+
/*
* Thread local storage used to indicate when a thread is probing geoms
* for their guids. If NULL, this thread is not tasting geoms. If non NULL,
@@ -168,6 +171,17 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd)
g_topology_assert();
ZFS_LOG(1, "Attaching to %s.", pp->name);
+
+ if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) {
+ ZFS_LOG(1, "Failing attach of %s. Incompatible sectorsize %d\n",
+ pp->name, pp->sectorsize);
+ return (NULL);
+ } else if (pp->mediasize < SPA_MINDEVSIZE) {
+ ZFS_LOG(1, "Failing attach of %s. Incompatible mediasize %ju\n",
+ pp->name, pp->mediasize);
+ return (NULL);
+ }
+
/* Do we have geom already? No? Create one. */
LIST_FOREACH(gp, &zfs_vdev_class.geom, geom) {
if (gp->flags & G_GEOM_WITHER)
@@ -185,14 +199,14 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd)
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_attach failed: %d\n", __func__,
__LINE__, error);
- g_wither_geom(gp, ENXIO);
+ vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
error = g_access(cp, 1, 0, 1);
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_access failed: %d\n", __func__,
__LINE__, error);
- g_wither_geom(gp, ENXIO);
+ vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
ZFS_LOG(1, "Created geom and consumer for %s.", pp->name);
@@ -210,15 +224,14 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd)
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_attach failed: %d\n",
__func__, __LINE__, error);
- g_destroy_consumer(cp);
+ vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
error = g_access(cp, 1, 0, 1);
if (error != 0) {
ZFS_LOG(1, "%s(%d): g_access failed: %d\n",
__func__, __LINE__, error);
- g_detach(cp);
- g_destroy_consumer(cp);
+ vdev_geom_detach(cp, B_FALSE);
return (NULL);
}
ZFS_LOG(1, "Created consumer for %s.", pp->name);
@@ -244,39 +257,37 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd)
* 2) Set it to a linked list of vdevs, not just a single vdev
*/
cp->private = vd;
- vd->vdev_tsd = cp;
+ if (vd != NULL)
+ vd->vdev_tsd = cp;
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
return (cp);
}
static void
-vdev_geom_close_locked(vdev_t *vd)
+vdev_geom_detach(struct g_consumer *cp, boolean_t open_for_read)
{
struct g_geom *gp;
- struct g_consumer *cp;
+ vdev_t *vd;
g_topology_assert();
- cp = vd->vdev_tsd;
- if (cp == NULL)
- return;
+ ZFS_LOG(1, "Detaching consumer. Provider %s.",
+ cp->provider && cp->provider->name ? cp->provider->name : "NULL");
- ZFS_LOG(1, "Closing access to %s.", cp->provider->name);
- KASSERT(vd->vdev_tsd == cp, ("%s: vdev_tsd is not cp", __func__));
- vd->vdev_tsd = NULL;
- vd->vdev_delayed_close = B_FALSE;
+ vd = cp->private;
cp->private = NULL;
gp = cp->geom;
- g_access(cp, -1, 0, -1);
+ if (open_for_read)
+ g_access(cp, -1, 0, -1);
/* Destroy consumer on last close. */
if (cp->acr == 0 && cp->ace == 0) {
if (cp->acw > 0)
g_access(cp, 0, -cp->acw, 0);
if (cp->provider != NULL) {
- ZFS_LOG(1, "Destroyed consumer to %s.",
- cp->provider->name);
+ ZFS_LOG(1, "Destroying consumer to %s.",
+ cp->provider->name ? cp->provider->name : "NULL");
g_detach(cp);
}
g_destroy_consumer(cp);
@@ -289,6 +300,24 @@ vdev_geom_close_locked(vdev_t *vd)
}
static void
+vdev_geom_close_locked(vdev_t *vd)
+{
+ struct g_consumer *cp;
+
+ g_topology_assert();
+
+ cp = vd->vdev_tsd;
+ vd->vdev_tsd = NULL;
+ vd->vdev_delayed_close = B_FALSE;
+ if (cp == NULL)
+ return;
+
+ ZFS_LOG(1, "Closing access to %s.", cp->provider->name);
+
+ vdev_geom_detach(cp, B_TRUE);
+}
+
+static void
nvlist_get_guids(nvlist_t *list, uint64_t *pguid, uint64_t *vguid)
{
@@ -331,13 +360,6 @@ vdev_geom_io(struct g_consumer *cp, int cmd, void *data, off_t offset, off_t siz
return (error);
}
-static void
-vdev_geom_taste_orphan(struct g_consumer *cp)
-{
- ZFS_LOG(0, "WARNING: Orphan %s while tasting its VDev GUID.",
- cp->provider->name);
-}
-
static int
vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
{
@@ -470,41 +492,12 @@ ignore:
nvlist_free(cfg);
}
-static int
-vdev_geom_attach_taster(struct g_consumer *cp, struct g_provider *pp)
-{
- int error;
-
- if (pp->flags & G_PF_WITHER)
- return (EINVAL);
- g_attach(cp, pp);
- error = g_access(cp, 1, 0, 0);
- if (error == 0) {
- if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize))
- error = EINVAL;
- else if (pp->mediasize < SPA_MINDEVSIZE)
- error = EINVAL;
- if (error != 0)
- g_access(cp, -1, 0, 0);
- }
- if (error != 0)
- g_detach(cp);
- return (error);
-}
-
-static void
-vdev_geom_detach_taster(struct g_consumer *cp)
-{
- g_access(cp, -1, 0, 0);
- g_detach(cp);
-}
-
int
vdev_geom_read_pool_label(const char *name,
nvlist_t ***configs, uint64_t *count)
{
struct g_class *mp;
- struct g_geom *gp, *zgp;
+ struct g_geom *gp;
struct g_provider *pp;
struct g_consumer *zcp;
nvlist_t *vdev_cfg;
@@ -514,11 +507,6 @@ vdev_geom_read_pool_label(const char *name,
DROP_GIANT();
g_topology_lock();
- zgp = g_new_geomf(&zfs_vdev_class, "zfs::vdev::taste");
- /* This orphan function should be never called. */
- zgp->orphan = vdev_geom_taste_orphan;
- zcp = g_new_consumer(zgp);
-
*configs = NULL;
*count = 0;
pool_guid = 0;
@@ -531,12 +519,13 @@ vdev_geom_read_pool_label(const char *name,
LIST_FOREACH(pp, &gp->provider, provider) {
if (pp->flags & G_PF_WITHER)
continue;
- if (vdev_geom_attach_taster(zcp, pp) != 0)
+ zcp = vdev_geom_attach(pp, NULL);
+ if (zcp == NULL)
continue;
g_topology_unlock();
error = vdev_geom_read_config(zcp, &vdev_cfg);
g_topology_lock();
- vdev_geom_detach_taster(zcp);
+ vdev_geom_detach(zcp, B_TRUE);
if (error)
continue;
ZFS_LOG(1, "successfully read vdev config");
@@ -546,9 +535,6 @@ vdev_geom_read_pool_label(const char *name,
}
}
}
-
- g_destroy_consumer(zcp);
- g_destroy_geom(zgp);
g_topology_unlock();
PICKUP_GIANT();
@@ -570,21 +556,55 @@ vdev_geom_read_guids(struct g_consumer *cp, uint64_t *pguid, uint64_t *vguid)
}
}
+static boolean_t
+vdev_attach_ok(vdev_t *vd, struct g_provider *pp)
+{
+ uint64_t pool_guid;
+ uint64_t vdev_guid;
+ struct g_consumer *zcp;
+ boolean_t pool_ok;
+ boolean_t vdev_ok;
+
+ zcp = vdev_geom_attach(pp, NULL);
+ if (zcp == NULL) {
+ ZFS_LOG(1, "Unable to attach tasting instance to %s.",
+ pp->name);
+ return (B_FALSE);
+ }
+ g_topology_unlock();
+ vdev_geom_read_guids(zcp, &pool_guid, &vdev_guid);
+ g_topology_lock();
+ vdev_geom_detach(zcp, B_TRUE);
+
+ /*
+ * Check that the label's vdev guid matches the desired guid. If the
+ * label has a pool guid, check that it matches too. (Inactive spares
+ * and L2ARCs do not have any pool guid in the label.)
+ */
+ if ((pool_guid == 0 || pool_guid == spa_guid(vd->vdev_spa)) &&
+ vdev_guid == vd->vdev_guid) {
+ ZFS_LOG(1, "guids match for provider %s.", vd->vdev_path);
+ return (B_TRUE);
+ } else {
+ ZFS_LOG(1, "guid mismatch for provider %s: "
+ "%ju:%ju != %ju:%ju.", vd->vdev_path,
+ (uintmax_t)spa_guid(vd->vdev_spa),
+ (uintmax_t)vd->vdev_guid,
+ (uintmax_t)pool_guid, (uintmax_t)vdev_guid);
+ return (B_FALSE);
+ }
+}
+
static struct g_consumer *
vdev_geom_attach_by_guids(vdev_t *vd)
{
struct g_class *mp;
- struct g_geom *gp, *zgp;
+ struct g_geom *gp;
struct g_provider *pp;
- struct g_consumer *cp, *zcp;
- uint64_t pguid, vguid;
+ struct g_consumer *cp;
g_topology_assert();
- zgp = g_new_geomf(&zfs_vdev_class, "zfs::vdev::taste");
- zgp->orphan = vdev_geom_taste_orphan;
- zcp = g_new_consumer(zgp);
-
cp = NULL;
LIST_FOREACH(mp, &g_classes, class) {
if (mp == &zfs_vdev_class)
@@ -593,22 +613,7 @@ vdev_geom_attach_by_guids(vdev_t *vd)
if (gp->flags & G_GEOM_WITHER)
continue;
LIST_FOREACH(pp, &gp->provider, provider) {
- if (vdev_geom_attach_taster(zcp, pp) != 0)
- continue;
- g_topology_unlock();
- vdev_geom_read_guids(zcp, &pguid, &vguid);
- g_topology_lock();
- vdev_geom_detach_taster(zcp);
- /*
- * Check that the label's vdev guid matches the
- * desired guid. If the label has a pool guid,
- * check that it matches too. (Inactive spares
- * and L2ARCs do not have any pool guid in the
- * label.)
- */
- if ((pguid != 0 &&
- pguid != spa_guid(vd->vdev_spa)) ||
- vguid != vd->vdev_guid)
+ if (!vdev_attach_ok(vd, pp))
continue;
cp = vdev_geom_attach(pp, vd);
if (cp == NULL) {
@@ -625,8 +630,6 @@ vdev_geom_attach_by_guids(vdev_t *vd)
break;
}
end:
- g_destroy_consumer(zcp);
- g_destroy_geom(zgp);
return (cp);
}
@@ -667,7 +670,6 @@ vdev_geom_open_by_path(vdev_t *vd, int check_guid)
{
struct g_provider *pp;
struct g_consumer *cp;
- uint64_t pguid, vguid;
g_topology_assert();
@@ -675,34 +677,8 @@ vdev_geom_open_by_path(vdev_t *vd, int check_guid)
pp = g_provider_by_name(vd->vdev_path + sizeof("/dev/") - 1);
if (pp != NULL) {
ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path);
- cp = vdev_geom_attach(pp, vd);
- if (cp != NULL && check_guid && ISP2(pp->sectorsize) &&
- pp->sectorsize <= VDEV_PAD_SIZE) {
- g_topology_unlock();
- vdev_geom_read_guids(cp, &pguid, &vguid);
- g_topology_lock();
- /*
- * Check that the label's vdev guid matches the
- * desired guid. If the label has a pool guid,
- * check that it matches too. (Inactive spares
- * and L2ARCs do not have any pool guid in the
- * label.)
- */
- if ((pguid != 0 &&
- pguid != spa_guid(vd->vdev_spa)) ||
- vguid != vd->vdev_guid) {
- vdev_geom_close_locked(vd);
- cp = NULL;
- ZFS_LOG(1, "guid mismatch for provider %s: "
- "%ju:%ju != %ju:%ju.", vd->vdev_path,
- (uintmax_t)spa_guid(vd->vdev_spa),
- (uintmax_t)vd->vdev_guid,
- (uintmax_t)pguid, (uintmax_t)vguid);
- } else {
- ZFS_LOG(1, "guid match for provider %s.",
- vd->vdev_path);
- }
- }
+ if (!check_guid || vdev_attach_ok(vd, pp))
+ cp = vdev_geom_attach(pp, vd);
}
return (cp);
diff --git a/sys/cddl/dev/dtrace/x86/dis_tables.c b/sys/cddl/dev/dtrace/x86/dis_tables.c
index 0319fc7..184d4f7 100644
--- a/sys/cddl/dev/dtrace/x86/dis_tables.c
+++ b/sys/cddl/dev/dtrace/x86/dis_tables.c
@@ -1182,7 +1182,7 @@ const instable_t dis_op0F38[256] = {
/* [78] */ INVALID, INVALID, INVALID, INVALID,
/* [7C] */ INVALID, INVALID, INVALID, INVALID,
-/* [80] */ TNSy("invept", RM_66r), TNSy("invvpid", RM_66r),INVALID, INVALID,
+/* [80] */ TNSy("invept", RM_66r), TNSy("invvpid", RM_66r),TNSy("invpcid", RM_66r),INVALID,
/* [84] */ INVALID, INVALID, INVALID, INVALID,
/* [88] */ INVALID, INVALID, INVALID, INVALID,
/* [8C] */ INVALID, INVALID, INVALID, INVALID,
diff --git a/sys/compat/linux/check_internal_locks.d b/sys/compat/linux/check_internal_locks.d
index b9d7c61..644323e 100644
--- a/sys/compat/linux/check_internal_locks.d
+++ b/sys/compat/linux/check_internal_locks.d
@@ -64,7 +64,7 @@ linuxulator*:locks:futex_mtx:locked
linuxulator*:locks:futex_mtx:unlock
/check[probefunc] == 0/
{
- printf("ERROR: unlock attemt of unlocked %s (%p),", probefunc, arg0);
+ printf("ERROR: unlock attempt of unlocked %s (%p),", probefunc, arg0);
printf(" missing SDT probe in kernel, or dtrace program started");
printf(" while the %s was already held (race condition).", probefunc);
printf(" Stack trace follows:");
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index 94d9df5..de1d041 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -163,7 +163,7 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args)
ff |= RFSIGSHARE;
/*
* XXX: In Linux, sharing of fs info (chroot/cwd/umask)
- * and open files is independant. In FreeBSD, its in one
+ * and open files is independent. In FreeBSD, its in one
* structure but in reality it does not cause any problems
* because both of these flags are usually set together.
*/
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 98a842c..bd3d6aa 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -199,7 +199,7 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args)
#endif
secs = args->secs;
/*
- * Linux alarm() is always successfull. Limit secs to INT32_MAX / 2
+ * Linux alarm() is always successful. Limit secs to INT32_MAX / 2
* to match kern_setitimer()'s limit to avoid error from it.
*
* XXX. Linux limit secs to INT_MAX on 32 and does not limit on 64-bit
diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h
index 25c0ec3..63fae69 100644
--- a/sys/compat/linux/linux_socket.h
+++ b/sys/compat/linux/linux_socket.h
@@ -79,7 +79,7 @@ struct l_cmsghdr {
l_int cmsg_type;
};
-/* Ancilliary data object information macros */
+/* Ancillary data object information macros */
#define LINUX_CMSG_ALIGN(len) roundup2(len, sizeof(l_ulong))
#define LINUX_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + \
diff --git a/sys/compat/linux/trace_futexes.d b/sys/compat/linux/trace_futexes.d
index bd9dac6..d8879fc7 100644
--- a/sys/compat/linux/trace_futexes.d
+++ b/sys/compat/linux/trace_futexes.d
@@ -120,7 +120,7 @@ linuxulator*:locks:futex_mtx:locked
linuxulator*:locks:futex_mtx:unlock
/check[probefunc, arg0] == 0/
{
- printf("ERROR: unlock attemt of unlocked %s (%p),", probefunc, arg0);
+ printf("ERROR: unlock attempt of unlocked %s (%p),", probefunc, arg0);
printf(" missing SDT probe in kernel, or dtrace program started");
printf(" while the %s was already held (race condition).", probefunc);
printf(" Stack trace follows:");
diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
index f18f53d..87bc25e 100644
--- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
@@ -115,7 +115,7 @@ dma_set_coherent_mask(struct device *dev, u64 mask)
if (!dma_supported(dev, mask))
return -EIO;
- /* XXX Currently we don't support a seperate coherent mask. */
+ /* XXX Currently we don't support a separate coherent mask. */
return 0;
}
diff --git a/sys/compat/linuxkpi/common/include/linux/dmapool.h b/sys/compat/linuxkpi/common/include/linux/dmapool.h
index 3ea2d5b..0253d6f 100644
--- a/sys/compat/linuxkpi/common/include/linux/dmapool.h
+++ b/sys/compat/linuxkpi/common/include/linux/dmapool.h
@@ -50,7 +50,7 @@ dma_pool_create(char *name, struct device *dev, size_t size,
pool = kmalloc(sizeof(*pool), GFP_KERNEL);
align--;
/*
- * XXX Eventually this could use a seperate allocf to honor boundary
+ * XXX Eventually this could use a separate allocf to honor boundary
* and physical address requirements of the device.
*/
pool->pool_zone = uma_zcreate(name, size, NULL, NULL, NULL, NULL,
diff --git a/sys/compat/linuxkpi/common/src/linux_radix.c b/sys/compat/linuxkpi/common/src/linux_radix.c
index 1cd9e45..6a8bd11 100644
--- a/sys/compat/linuxkpi/common/src/linux_radix.c
+++ b/sys/compat/linuxkpi/common/src/linux_radix.c
@@ -187,7 +187,7 @@ radix_tree_insert(struct radix_tree_root *root, unsigned long index, void *item)
if (temp[idx] == NULL) {
while(idx--)
free(temp[idx], M_RADIX);
- /* check if we should free the root node aswell */
+ /* Check if we should free the root node as well. */
if (root->rnode->count == 0) {
free(root->rnode, M_RADIX);
root->rnode = NULL;
diff --git a/sys/compat/linuxkpi/common/src/linux_usb.c b/sys/compat/linuxkpi/common/src/linux_usb.c
index b7ef538..54a7abb 100644
--- a/sys/compat/linuxkpi/common/src/linux_usb.c
+++ b/sys/compat/linuxkpi/common/src/linux_usb.c
@@ -649,7 +649,7 @@ done:
* Return values:
* 0: Success
* < 0: Failure
- * > 0: Acutal length
+ * > 0: Actual length
*------------------------------------------------------------------------*/
int
usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index 90e79b0..47874e8 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -717,7 +717,7 @@ ndis_ptom(m0, p)
* send routine.
*
* NDIS packets consist of two parts: an ndis_packet structure,
- * which is vaguely analagous to the pkthdr portion of an mbuf,
+ * which is vaguely analogous to the pkthdr portion of an mbuf,
* and one or more ndis_buffer structures, which define the
* actual memory segments in which the packet data resides.
* We need to allocate one ndis_buffer for each mbuf in a chain,
diff --git a/sys/compat/ndis/ndis_var.h b/sys/compat/ndis/ndis_var.h
index e837dc1..80b4920 100644
--- a/sys/compat/ndis/ndis_var.h
+++ b/sys/compat/ndis/ndis_var.h
@@ -1042,7 +1042,7 @@ struct ndis_request {
uint32_t nr_bytesneeded;
} ndis_set_information;
} ndis_data;
- /* NDIS 5.0 extentions */
+ /* NDIS 5.0 extensions */
uint8_t nr_ndis_rsvd[9 * sizeof(void *)];
union {
uint8_t nr_callmgr_rsvd[2 * sizeof(void *)];
@@ -1444,7 +1444,7 @@ struct ndis_miniport_characteristics {
void * nmc_setinfo_func;
void * nmc_transferdata_func;
- /* NDIS 4.0 extentions */
+ /* NDIS 4.0 extensions */
void * nmc_return_packet_func;
void * nmc_sendmulti_func;
@@ -1459,7 +1459,7 @@ struct ndis_miniport_characteristics {
void * nmc_comultisend_func;
void * nmc_corequest_func;
- /* NDIS 5.1 extentions */
+ /* NDIS 5.1 extensions */
void * nmc_canceltxpkts_handler;
void * nmc_pnpevent_handler;
diff --git a/sys/compat/ndis/ntoskrnl_var.h b/sys/compat/ndis/ntoskrnl_var.h
index f5efc6e..48ddcd9 100644
--- a/sys/compat/ndis/ntoskrnl_var.h
+++ b/sys/compat/ndis/ntoskrnl_var.h
@@ -670,13 +670,13 @@ struct kuser_shared_data {
* created and maintained by bus drivers. For example, the PCI
* bus driver might detect two PCI ethernet cards on a given
* bus. The PCI bus driver will then allocate two device_objects
- * for its own internal bookeeping purposes. This is analagous
+ * for its own internal bookeeping purposes. This is analogous
* to the device_t that the FreeBSD PCI code allocates and passes
* into each PCI driver's probe and attach routines.
*
* When an ethernet driver claims one of the ethernet cards
* on the bus, it will create its own device_object. This is
- * the Functional Device Object. This object is analagous to the
+ * the Functional Device Object. This object is analogous to the
* device-specific softc structure.
*/
@@ -962,7 +962,7 @@ struct io_stack_location {
/*
* There's a big-ass union here in the actual Windows
- * definition of the stucture, but it contains stuff
+ * definition of the structure, but it contains stuff
* that doesn't really apply to BSD, and defining it
* all properly would require duplicating over a dozen
* other structures that we'll never use. Since the
diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c
index 62d97ad..7bb3f28 100644
--- a/sys/compat/ndis/subr_hal.c
+++ b/sys/compat/ndis/subr_hal.c
@@ -274,7 +274,7 @@ READ_PORT_BUFFER_UCHAR(port, val, cnt)
* KeAcquireSpinLock() and KeReleaseSpinLock(), but these are just
* macros that call KfAcquireSpinLock() and KfReleaseSpinLock().
* KefAcquireSpinLockAtDpcLevel() and KefReleaseSpinLockFromDpcLevel()
- * perform the lock aquisition/release functions without doing the
+ * perform the lock acquisition/release functions without doing the
* IRQL manipulation, and are used when one is already running at
* DISPATCH_LEVEL. Make sense? Good.
*
diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c
index f6d5ac4..224c032 100644
--- a/sys/compat/ndis/subr_ntoskrnl.c
+++ b/sys/compat/ndis/subr_ntoskrnl.c
@@ -722,7 +722,7 @@ IoGetDriverObjectExtension(drv, clid)
/*
* Sanity check. Our dummy bus drivers don't have
- * any driver extentions.
+ * any driver extensions.
*/
if (drv->dro_driverext == NULL)
diff --git a/sys/compat/ndis/subr_pe.c b/sys/compat/ndis/subr_pe.c
index fcbaef2..47bef25 100644
--- a/sys/compat/ndis/subr_pe.c
+++ b/sys/compat/ndis/subr_pe.c
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
/*
* This file contains routines for relocating and dynamically linking
* executable object code files in the Windows(r) PE (Portable Executable)
- * format. In Windows, anything with a .EXE, .DLL or .SYS extention is
+ * format. In Windows, anything with a .EXE, .DLL or .SYS extension is
* considered an executable, and all such files have some structures in
* common. The PE format was apparently based largely on COFF but has
* mutated significantly over time. We are mainly concerned with .SYS files,
diff --git a/sys/compat/x86bios/x86bios.c b/sys/compat/x86bios/x86bios.c
index e86c965..d991738 100644
--- a/sys/compat/x86bios/x86bios.c
+++ b/sys/compat/x86bios/x86bios.c
@@ -119,7 +119,7 @@ void *
x86bios_alloc(uint32_t *offset, size_t size, int flags)
{
void *vaddr;
- int i;
+ u_int i;
if (offset == NULL || size == 0)
return (NULL);
diff --git a/sys/compat/x86bios/x86bios.h b/sys/compat/x86bios/x86bios.h
index 491367d..f12c800 100644
--- a/sys/compat/x86bios/x86bios.h
+++ b/sys/compat/x86bios/x86bios.h
@@ -27,7 +27,7 @@
*/
/*
* x86 registers were borrowed from x86emu.h x86emu_regs.h
- * for compatability.
+ * for compatibility.
*/
#ifndef _X86BIOS_H_
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index d986a65..f1553bf 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1405,6 +1405,16 @@ options MSGBUF_SIZE=40960
#####################################################################
+# HARDWARE BUS CONFIGURATION
+
+#
+# PCI bus & PCI options:
+#
+device pci
+options PCI_IOV # PCI SR-IOV support
+
+
+#####################################################################
# HARDWARE DEVICE CONFIGURATION
# For ISA the required hints are listed.
diff --git a/sys/conf/files b/sys/conf/files
index 1298286..33de771 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1132,6 +1132,10 @@ dev/bwi/if_bwi_pci.c optional bwi pci
# XXX Work around clang warning, until maintainer approves fix.
dev/bwn/if_bwn.c optional bwn siba_bwn \
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
+dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \
+ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
+dev/bwn/if_bwn_phy_lp.c optional bwn siba_bwn \
+ compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
dev/cardbus/cardbus.c optional cardbus
dev/cardbus/cardbus_cis.c optional cardbus
dev/cardbus/cardbus_device.c optional cardbus
diff --git a/sys/conf/options.arm b/sys/conf/options.arm
index 4737b80..8a14da1 100644
--- a/sys/conf/options.arm
+++ b/sys/conf/options.arm
@@ -32,6 +32,7 @@ KERNBASE opt_global.h
KERNVIRTADDR opt_global.h
LINUX_BOOT_ABI opt_global.h
LOADERRAMADDR opt_global.h
+MULTIDELAY opt_global.h
PHYSADDR opt_global.h
PLATFORM opt_global.h
PLATFORM_SMP opt_global.h
diff --git a/sys/contrib/dev/acpica/components/hardware/hwregs.c b/sys/contrib/dev/acpica/components/hardware/hwregs.c
index ad879d7..ebb4ce7 100644
--- a/sys/contrib/dev/acpica/components/hardware/hwregs.c
+++ b/sys/contrib/dev/acpica/components/hardware/hwregs.c
@@ -54,11 +54,6 @@
/* Local Prototypes */
-static UINT8
-AcpiHwGetAccessBitWidth (
- ACPI_GENERIC_ADDRESS *Reg,
- UINT8 MaxBitWidth);
-
static ACPI_STATUS
AcpiHwReadMultiple (
UINT32 *Value,
@@ -76,43 +71,6 @@ AcpiHwWriteMultiple (
/******************************************************************************
*
- * FUNCTION: AcpiHwGetAccessBitWidth
- *
- * PARAMETERS: Reg - GAS register structure
- * MaxBitWidth - Max BitWidth supported (32 or 64)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Obtain optimal access bit width
- *
- ******************************************************************************/
-
-static UINT8
-AcpiHwGetAccessBitWidth (
- ACPI_GENERIC_ADDRESS *Reg,
- UINT8 MaxBitWidth)
-{
-
- if (!Reg->AccessWidth)
- {
- if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO)
- {
- return (32);
- }
- else
- {
- return (MaxBitWidth);
- }
- }
- else
- {
- return (1 << (Reg->AccessWidth + 2));
- }
-}
-
-
-/******************************************************************************
- *
* FUNCTION: AcpiHwValidateRegister
*
* PARAMETERS: Reg - GAS register structure
@@ -134,6 +92,7 @@ AcpiHwValidateRegister (
UINT64 *Address)
{
UINT8 BitWidth;
+ UINT8 BitEnd;
UINT8 AccessWidth;
@@ -176,8 +135,11 @@ AcpiHwValidateRegister (
/* Validate the BitWidth, convert AccessWidth into number of bits */
- AccessWidth = AcpiHwGetAccessBitWidth (Reg, MaxBitWidth);
- BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth);
+ BitEnd = Reg->BitOffset + Reg->BitWidth;
+ AccessWidth = Reg->AccessWidth ? Reg->AccessWidth : 1;
+ AccessWidth = 1 << (AccessWidth + 2);
+ BitWidth = ACPI_ROUND_UP (BitEnd, AccessWidth) -
+ ACPI_ROUND_DOWN (Reg->BitOffset, AccessWidth);
if (MaxBitWidth < BitWidth)
{
ACPI_WARNING ((AE_INFO,
@@ -204,7 +166,10 @@ AcpiHwValidateRegister (
* 64-bit values is not needed.
*
* LIMITATIONS: <These limitations also apply to AcpiHwWrite>
+ * BitWidth must be exactly 8, 16, or 32.
* SpaceID must be SystemMemory or SystemIO.
+ * BitOffset and AccessWidth are currently ignored, as there has
+ * not been a need to implement these.
*
******************************************************************************/
@@ -214,12 +179,7 @@ AcpiHwRead (
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
- UINT8 AccessWidth;
- UINT32 BitWidth;
- UINT8 BitOffset;
UINT64 Value64;
- UINT32 Value32;
- UINT8 Index;
ACPI_STATUS Status;
@@ -234,64 +194,30 @@ AcpiHwRead (
return (Status);
}
- /*
- * Initialize entire 32-bit return value to zero, convert AccessWidth
- * into number of bits based
- */
+ /* Initialize entire 32-bit return value to zero */
+
*Value = 0;
- AccessWidth = AcpiHwGetAccessBitWidth (Reg, 32);
- BitWidth = Reg->BitOffset + Reg->BitWidth;
- BitOffset = Reg->BitOffset;
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
- Index = 0;
- while (BitWidth)
+ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
{
- if (BitOffset > AccessWidth)
- {
- Value32 = 0;
- BitOffset -= AccessWidth;
- }
- else
- {
- if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
- {
- Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
- Address + Index * ACPI_DIV_8 (AccessWidth),
- &Value64, AccessWidth);
- Value32 = (UINT32) Value64;
- }
- else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
- {
- Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
- Address + Index * ACPI_DIV_8 (AccessWidth),
- &Value32, AccessWidth);
- }
-
- if (BitOffset)
- {
- Value32 &= ACPI_MASK_BITS_BELOW (BitOffset);
- BitOffset = 0;
- }
- if (BitWidth < AccessWidth)
- {
- Value32 &= ACPI_MASK_BITS_ABOVE (BitWidth);
- }
- }
+ Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
+ Address, &Value64, Reg->BitWidth);
- ACPI_SET_BITS (Value, Index * AccessWidth,
- ACPI_MASK_BITS_ABOVE_32 (AccessWidth), Value32);
-
- BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
- Index++;
+ *Value = (UINT32) Value64;
+ }
+ else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+ {
+ Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
+ Address, Value, Reg->BitWidth);
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
- *Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
+ *Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
@@ -319,12 +245,6 @@ AcpiHwWrite (
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
- UINT8 AccessWidth;
- UINT32 BitWidth;
- UINT8 BitOffset;
- UINT64 Value64;
- UINT32 NewValue32, OldValue32;
- UINT8 Index;
ACPI_STATUS Status;
@@ -339,109 +259,24 @@ AcpiHwWrite (
return (Status);
}
- /* Convert AccessWidth into number of bits based */
-
- AccessWidth = AcpiHwGetAccessBitWidth (Reg, 32);
- BitWidth = Reg->BitOffset + Reg->BitWidth;
- BitOffset = Reg->BitOffset;
-
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
- Index = 0;
- while (BitWidth)
+ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
{
- NewValue32 = ACPI_GET_BITS (&Value, Index * AccessWidth,
- ACPI_MASK_BITS_ABOVE_32 (AccessWidth));
-
- if (BitOffset > AccessWidth)
- {
- BitOffset -= AccessWidth;
- }
- else
- {
- if (BitOffset)
- {
- NewValue32 &= ACPI_MASK_BITS_BELOW (BitOffset);
- }
-
- if (BitWidth < AccessWidth)
- {
- NewValue32 &= ACPI_MASK_BITS_ABOVE (BitWidth);
- }
-
- if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
- {
- if (BitOffset || BitWidth < AccessWidth)
- {
- /*
- * Read old values in order not to modify the bits that
- * are beyond the register BitWidth/BitOffset setting.
- */
- Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
- Address + Index * ACPI_DIV_8 (AccessWidth),
- &Value64, AccessWidth);
- OldValue32 = (UINT32) Value64;
-
- if (BitOffset)
- {
- OldValue32 &= ACPI_MASK_BITS_ABOVE (BitOffset + 1);
- BitOffset = 0;
- }
-
- if (BitWidth < AccessWidth)
- {
- OldValue32 &= ACPI_MASK_BITS_BELOW (BitWidth - 1);
- }
-
- NewValue32 |= OldValue32;
- }
-
- Value64 = (UINT64) NewValue32;
- Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
- Address + Index * ACPI_DIV_8 (AccessWidth),
- Value64, AccessWidth);
- }
- else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
- {
- if (BitOffset || BitWidth < AccessWidth)
- {
- /*
- * Read old values in order not to modify the bits that
- * are beyond the register BitWidth/BitOffset setting.
- */
- Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
- Address + Index * ACPI_DIV_8 (AccessWidth),
- &OldValue32, AccessWidth);
-
- if (BitOffset)
- {
- OldValue32 &= ACPI_MASK_BITS_ABOVE (BitOffset + 1);
- BitOffset = 0;
- }
-
- if (BitWidth < AccessWidth)
- {
- OldValue32 &= ACPI_MASK_BITS_BELOW (BitWidth - 1);
- }
-
- NewValue32 |= OldValue32;
- }
-
- Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
- Address + Index * ACPI_DIV_8 (AccessWidth),
- NewValue32, AccessWidth);
- }
- }
-
- BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
- Index++;
+ Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
+ Address, (UINT64) Value, Reg->BitWidth);
+ }
+ else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+ {
+ Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
+ Address, Value, Reg->BitWidth);
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
- Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
+ Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c
index a41fcb5..3eff396 100644
--- a/sys/ddb/db_examine.c
+++ b/sys/ddb/db_examine.c
@@ -89,15 +89,6 @@ db_examine(db_addr_t addr, char *fmt, int count)
case 'g':
size = 8;
break;
- case 'a': /* address */
- size = sizeof(void *);
- /* always forces a new line */
- if (db_print_position() != 0)
- db_printf("\n");
- db_prev = addr;
- db_printsym(addr, DB_STGY_ANY);
- db_printf(":\t");
- break;
default:
if (db_print_position() == 0) {
/* Print the address. */
@@ -108,6 +99,18 @@ db_examine(db_addr_t addr, char *fmt, int count)
width = size * 4;
switch (c) {
+ case 'a': /* address */
+ size = sizeof(void *);
+ value = db_get_value(addr, size, TRUE);
+ addr += size;
+ db_printsym(value, DB_STGY_ANY);
+ break;
+ case 'p':
+ size = sizeof(void *);
+ value = db_get_value(addr, size, TRUE);
+ addr += size;
+ db_printf("%p", (void *)value);
+ break;
case 'r': /* signed, current radix */
value = db_get_value(addr, size, true);
addr += size;
@@ -173,7 +176,7 @@ db_examine(db_addr_t addr, char *fmt, int count)
default:
break;
}
- if (db_print_position() != 0)
+ if (db_print_position() != 0 || c == 'a' || c == 'p')
db_end_line(1);
break;
}
diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c
index a2afb6a..109c7a5 100644
--- a/sys/ddb/db_output.c
+++ b/sys/ddb/db_output.c
@@ -71,8 +71,7 @@ struct dbputchar_arg {
static int db_output_position = 0; /* output column */
static int db_last_non_space = 0; /* last non-space character */
db_expr_t db_tab_stop_width = 8; /* how wide are tab stops? */
-#define NEXT_TAB(i) \
- ((((i) + db_tab_stop_width) / db_tab_stop_width) * db_tab_stop_width)
+#define NEXT_TAB(i) rounddown((i) + db_tab_stop_width, db_tab_stop_width)
db_expr_t db_max_width = 79; /* output line width */
db_expr_t db_lines_per_page = 20; /* lines per page */
volatile int db_pager_quit; /* user requested quit */
diff --git a/sys/ddb/db_textdump.c b/sys/ddb/db_textdump.c
index a1a99f4..aeeeec8 100644
--- a/sys/ddb/db_textdump.c
+++ b/sys/ddb/db_textdump.c
@@ -52,7 +52,7 @@
* TODO
* ----
*
- * - Allow subsytems to register to submit files for inclusion in the text
+ * - Allow subsystems to register to submit files for inclusion in the text
* dump in a generic way.
*/
diff --git a/sys/dev/aac/aac_cam.c b/sys/dev/aac/aac_cam.c
index 8ec26aa..1b5e230 100644
--- a/sys/dev/aac/aac_cam.c
+++ b/sys/dev/aac/aac_cam.c
@@ -555,7 +555,7 @@ aac_cam_fix_inquiry(struct aac_softc *sc, union ccb *ccb)
/*
* Some aac(4) adapters will always report that a direct
* access device is offline in response to a INQUIRY
- * command that does not retreive vital product data.
+ * command that does not retrieve vital product data.
* Force the qualifier to connected so that upper layers
* correctly recognize that a disk is present.
*/
@@ -590,7 +590,7 @@ aac_cam_complete(struct aac_command *cm)
} else {
/*
* The SRB error codes just happen to match the CAM error
- * codes. How convienient!
+ * codes. How convenient!
*/
ccb->ccb_h.status = srbr->srb_status;
diff --git a/sys/dev/aac/aac_debug.c b/sys/dev/aac/aac_debug.c
index 353c6fa..6dd84f5 100644
--- a/sys/dev/aac/aac_debug.c
+++ b/sys/dev/aac/aac_debug.c
@@ -351,7 +351,7 @@ aac_print_aif(struct aac_softc *sc, struct aac_aif_command *aif)
device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
aif->data.EN.data.ECLE.eventType);
break;
- case AifEnDiskSetEvent: /* A disk set event occured. */
+ case AifEnDiskSetEvent: /* A disk set event occurred. */
device_printf(sc->aac_dev, "(DiskSetEvent) event %d "
"diskset %jd creator %jd\n",
aif->data.EN.data.EDS.eventType,
diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c
index 394e057..89c0fa6 100644
--- a/sys/dev/aac/aac_disk.c
+++ b/sys/dev/aac/aac_disk.c
@@ -88,7 +88,7 @@ DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, NULL, NULL);
* Handle open from generic layer.
*
* This is called by the diskslice code on first open in order to get the
- * basic device geometry paramters.
+ * basic device geometry parameters.
*/
static int
aac_disk_open(struct disk *dp)
diff --git a/sys/dev/aac/aacreg.h b/sys/dev/aac/aacreg.h
index 9959778..70859bb 100644
--- a/sys/dev/aac/aacreg.h
+++ b/sys/dev/aac/aacreg.h
@@ -886,7 +886,7 @@ typedef enum {
AifEnSMARTEvent, /* SMART Event */
AifEnBatteryNeedsRecond, /* The battery needs reconditioning */
AifEnClusterEvent, /* Some cluster event */
- AifEnDiskSetEvent, /* A disk set event occured. */
+ AifEnDiskSetEvent, /* A disk set event occurred. */
AifEnContainerScsiEvent, /* a container event with no. and scsi id */
AifEnPicBatteryEvent, /* An event gen. by pic_battery.c for an ABM */
AifEnExpEvent, /* Exp. Event Type to replace CTPopUp messages */
diff --git a/sys/dev/aacraid/aacraid_cam.c b/sys/dev/aacraid/aacraid_cam.c
index 394b67d..58db62c 100644
--- a/sys/dev/aacraid/aacraid_cam.c
+++ b/sys/dev/aacraid/aacraid_cam.c
@@ -1181,7 +1181,7 @@ aac_cam_complete(struct aac_command *cm)
} else {
/*
* The SRB error codes just happen to match the CAM error
- * codes. How convienient!
+ * codes. How convenient!
*/
ccb->ccb_h.status = srbr->srb_status;
diff --git a/sys/dev/aacraid/aacraid_debug.c b/sys/dev/aacraid/aacraid_debug.c
index 6062d72..db3bab5 100644
--- a/sys/dev/aacraid/aacraid_debug.c
+++ b/sys/dev/aacraid/aacraid_debug.c
@@ -265,7 +265,7 @@ aacraid_print_aif(struct aac_softc *sc, struct aac_aif_command *aif)
device_printf(sc->aac_dev, "(ClusterEvent) event %d\n",
aif->data.EN.data.ECLE.eventType);
break;
- case AifEnDiskSetEvent: /* A disk set event occured. */
+ case AifEnDiskSetEvent: /* A disk set event occurred. */
device_printf(sc->aac_dev, "(DiskSetEvent) event %d "
"diskset %jd creator %jd\n",
aif->data.EN.data.EDS.eventType,
diff --git a/sys/dev/aacraid/aacraid_reg.h b/sys/dev/aacraid/aacraid_reg.h
index 682d400..b02d193 100644
--- a/sys/dev/aacraid/aacraid_reg.h
+++ b/sys/dev/aacraid/aacraid_reg.h
@@ -875,7 +875,7 @@ typedef enum {
AifEnSMARTEvent, /* SMART Event */
AifEnBatteryNeedsRecond, /* The battery needs reconditioning */
AifEnClusterEvent, /* Some cluster event */
- AifEnDiskSetEvent, /* A disk set event occured. */
+ AifEnDiskSetEvent, /* A disk set event occurred. */
AifEnContainerScsiEvent, /* a container event with no. and scsi id */
AifEnPicBatteryEvent, /* An event gen. by pic_battery.c for an ABM */
AifEnExpEvent, /* Exp. Event Type to replace CTPopUp messages */
diff --git a/sys/dev/acpi_support/acpi_hp.c b/sys/dev/acpi_support/acpi_hp.c
index 2828038..ec85896 100644
--- a/sys/dev/acpi_support/acpi_hp.c
+++ b/sys/dev/acpi_support/acpi_hp.c
@@ -1033,7 +1033,8 @@ acpi_hp_hex_decode(char* buffer)
UINT8 *uin;
UINT8 uout;
- if (((int)length/2)*2 == length || length < 10) return;
+ if (rounddown((int)length, 2) == length || length < 10)
+ return;
for (i = 0; i<length; ++i) {
if (!((i+1)%3)) {
diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c
index 735065a..bb9aac6 100644
--- a/sys/dev/acpi_support/acpi_ibm.c
+++ b/sys/dev/acpi_support/acpi_ibm.c
@@ -839,7 +839,7 @@ acpi_ibm_sysctl_init(struct acpi_ibm_softc *sc, int method)
case ACPI_IBM_METHOD_BRIGHTNESS:
case ACPI_IBM_METHOD_VOLUME:
case ACPI_IBM_METHOD_MUTE:
- /* EC is required here, which was aready checked before */
+ /* EC is required here, which was already checked before */
return (TRUE);
case ACPI_IBM_METHOD_THINKLIGHT:
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 84468e5..326fc71 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1965,7 +1965,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status)
* Since we scan from \, be sure to skip system scope objects.
* \_SB_ and \_TZ_ are defined in ACPICA as devices to work around
* BIOS bugs. For example, \_SB_ is to allow \_SB_._INI to be run
- * during the intialization and \_TZ_ is to support Notify() on it.
+ * during the initialization and \_TZ_ is to support Notify() on it.
*/
if (strcmp(handle_str, "\\_SB_") == 0 ||
strcmp(handle_str, "\\_TZ_") == 0)
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 625cd54..218da4e 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -429,7 +429,8 @@ acpi_cpu_postattach(void *unused __unused)
}
attached = 0;
for (i = 0; i < n; i++)
- if (device_is_attached(devices[i]))
+ if (device_is_attached(devices[i]) &&
+ device_get_driver(devices[i]) == &acpi_cpu_driver)
attached = 1;
for (i = 0; i < n; i++)
bus_generic_probe(devices[i]);
@@ -640,7 +641,7 @@ acpi_cpu_shutdown(device_t dev)
disable_idle(device_get_softc(dev));
/*
- * CPU devices are not truely detached and remain referenced,
+ * CPU devices are not truly detached and remain referenced,
* so their resources are not freed.
*/
diff --git a/sys/dev/acpica/acpiio.h b/sys/dev/acpica/acpiio.h
index c65028f..dad4287 100644
--- a/sys/dev/acpica/acpiio.h
+++ b/sys/dev/acpica/acpiio.h
@@ -64,7 +64,7 @@ struct acpi_bif {
char model[ACPI_CMBAT_MAXSTRLEN]; /* model identifier */
char serial[ACPI_CMBAT_MAXSTRLEN]; /* Serial number */
char type[ACPI_CMBAT_MAXSTRLEN]; /* Type */
- char oeminfo[ACPI_CMBAT_MAXSTRLEN]; /* OEM infomation */
+ char oeminfo[ACPI_CMBAT_MAXSTRLEN]; /* OEM information */
};
struct acpi_bst {
diff --git a/sys/dev/advansys/advansys.c b/sys/dev/advansys/advansys.c
index 1eaa9a4..12ffd81 100644
--- a/sys/dev/advansys/advansys.c
+++ b/sys/dev/advansys/advansys.c
@@ -633,7 +633,7 @@ adv_timeout(void *arg)
* means that the driver attempts to clear only one error
* condition at a time. In general, timeouts that occur
* close together are related anyway, so there is no benefit
- * in attempting to handle errors in parrallel. Timeouts will
+ * in attempting to handle errors in parallel. Timeouts will
* be reinstated when the recovery process ends.
*/
adv_set_state(adv, ADV_IN_TIMEOUT);
@@ -1123,7 +1123,7 @@ adv_done(struct adv_softc *adv, union ccb *ccb, u_int done_stat,
* from this initiator are in effect, but this
* ignores multi-initiator setups and there is
* evidence that the firmware gets its per-device
- * transaction counts screwed up occassionally.
+ * transaction counts screwed up occasionally.
*/
ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR;
if ((ccb->ccb_h.flags & CAM_TAG_ACTION_VALID) != 0
diff --git a/sys/dev/advansys/advlib.c b/sys/dev/advansys/advlib.c
index 9080876..75d6884 100644
--- a/sys/dev/advansys/advlib.c
+++ b/sys/dev/advansys/advlib.c
@@ -2060,7 +2060,7 @@ adv_reset_bus(struct adv_softc *adv, int initiate_bus_reset)
/*offset*/0, ADV_TRANS_CUR);
ADV_OUTW(adv, ADV_REG_PROG_COUNTER, ADV_MCODE_START_ADDR);
- /* Tell the XPT layer that a bus reset occured */
+ /* Tell the XPT layer that a bus reset occurred */
if (adv->path != NULL)
xpt_async(AC_BUS_RESET, adv->path, NULL);
diff --git a/sys/dev/advansys/advlib.h b/sys/dev/advansys/advlib.h
index 00573ac..6952ca9 100644
--- a/sys/dev/advansys/advlib.h
+++ b/sys/dev/advansys/advlib.h
@@ -228,7 +228,7 @@ struct adv_ccb_info {
#define ADV_CSW_SCSI_RESET_LATCH 0x0002
#define ADV_CSW_INT_PENDING 0x0001
/*
- * XXX I don't understand the relevence of the naming
+ * XXX I don't understand the relevance of the naming
* convention change here. What does CIW stand for?
* Perhaps this is to differentiate read and write
* values?
@@ -590,7 +590,7 @@ struct adv_scsiq_1 {
u_int8_t target_lun; /* LUN - taken from our xs */
u_int32_t data_addr; /*
- * physical addres of first
+ * physical address of first
* (possibly only) segment
* to transfer.
*/
@@ -793,7 +793,7 @@ u_int16_t adv_read_lram_16(struct adv_softc *adv, u_int16_t addr);
void adv_write_lram_16(struct adv_softc *adv, u_int16_t addr,
u_int16_t value);
-/* Intialization */
+/* Initialization */
int adv_find_signature(struct resource *res);
void adv_lib_init(struct adv_softc *adv);
diff --git a/sys/dev/advansys/adwlib.h b/sys/dev/advansys/adwlib.h
index 09a0155..a730985 100644
--- a/sys/dev/advansys/adwlib.h
+++ b/sys/dev/advansys/adwlib.h
@@ -563,7 +563,7 @@ typedef enum {
ADW_FENONE = 0x0000,
ADW_ULTRA = 0x0001, /* Supports 20MHz Transfers */
ADW_ULTRA2 = 0x0002, /* Supports 40MHz Transfers */
- ADW_DT = 0x0004, /* Supports Double Transistion REQ/ACK*/
+ ADW_DT = 0x0004, /* Supports Double Transition REQ/ACK */
ADW_WIDE = 0x0008, /* Wide Channel */
ADW_ASC3550_FE = ADW_ULTRA,
ADW_ASC38C0800_FE = ADW_ULTRA2,
@@ -801,7 +801,7 @@ carrierbtov(struct adw_softc *adw, u_int32_t baddr)
return (carrierbotov(adw, baddr - adw->carrier_busbase));
}
-/* Intialization */
+/* Initialization */
int adw_find_signature(struct adw_softc *adw);
void adw_reset_chip(struct adw_softc *adw);
int adw_reset_bus(struct adw_softc *adw);
diff --git a/sys/dev/aha/aha.c b/sys/dev/aha/aha.c
index f35fe4b..1c767b6 100644
--- a/sys/dev/aha/aha.c
+++ b/sys/dev/aha/aha.c
@@ -301,7 +301,7 @@ aha_probe(struct aha_softc* aha)
* This really should be replaced with the esetup command, since
* that appears to be more reliable. This becomes more and more
* true over time as we discover more cards that don't read the
- * geometry register consistantly.
+ * geometry register consistently.
*/
if (aha->boardid <= 0x42) {
/* Wait 10ms before reading */
@@ -1161,7 +1161,7 @@ ahadone(struct aha_softc *aha, struct aha_ccb *accb, aha_mbi_comp_code_t comp_co
struct ccb_hdr *ccb_h;
cam_status error;
- /* Notify all clients that a BDR occured */
+ /* Notify all clients that a BDR occurred */
error = xpt_create_path(&path, /*periph*/NULL,
cam_sim_path(aha->sim), accb->hccb.target,
CAM_LUN_WILDCARD);
@@ -1204,7 +1204,7 @@ ahadone(struct aha_softc *aha, struct aha_ccb *accb, aha_mbi_comp_code_t comp_co
break;
case AMBI_ABORT:
case AMBI_ERROR:
- /* An error occured */
+ /* An error occurred */
if (accb->hccb.opcode < INITIATOR_CCB_WRESID)
csio->resid = 0;
else
@@ -1747,7 +1747,7 @@ ahatimeout(void *arg)
* means that the driver attempts to clear only one error
* condition at a time. In general, timeouts that occur
* close together are related anyway, so there is no benefit
- * in attempting to handle errors in parrallel. Timeouts will
+ * in attempting to handle errors in parallel. Timeouts will
* be reinstated when the recovery process ends.
*/
if ((accb->flags & ACCB_DEVICE_RESET) == 0) {
diff --git a/sys/dev/ahb/ahb.c b/sys/dev/ahb/ahb.c
index 21c5f65..1135b04 100644
--- a/sys/dev/ahb/ahb.c
+++ b/sys/dev/ahb/ahb.c
@@ -885,7 +885,7 @@ ahbintr_locked(struct ahb_softc *ahb)
xpt_async(AC_BUS_RESET, ahb->path, NULL);
break;
}
- printf("Unsupported initiator selection AEN occured\n");
+ printf("Unsupported initiator selection AEN occurred\n");
break;
case INTSTAT_IMMED_OK:
case INTSTAT_IMMED_ERR:
@@ -1235,7 +1235,7 @@ ahbtimeout(void *arg)
* means that the driver attempts to clear only one error
* condition at a time. In general, timeouts that occur
* close together are related anyway, so there is no benefit
- * in attempting to handle errors in parrallel. Timeouts will
+ * in attempting to handle errors in parallel. Timeouts will
* be reinstated when the recovery process ends.
*/
if ((ecb->state & ECB_DEVICE_RESET) == 0) {
diff --git a/sys/dev/ahb/ahbreg.h b/sys/dev/ahb/ahbreg.h
index 23501ee..dabf409 100644
--- a/sys/dev/ahb/ahbreg.h
+++ b/sys/dev/ahb/ahbreg.h
@@ -64,7 +64,7 @@
#define RSTBUS 0x10
#define BUSDEF 0x0C4
-#define B0uS 0x00 /* give up bus immediatly */
+#define B0uS 0x00 /* give up bus immediately */
#define B4uS 0x01 /* delay 4uSec. */
#define B8uS 0x02 /* delay 8uSec. */
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index 9a47f3b..d1d3d6b 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -1303,7 +1303,7 @@ ahci_ch_intr_main(struct ahci_channel *ch, uint32_t istatus)
err = 0;
port = -1;
}
- /* Complete all successfull commands. */
+ /* Complete all successful commands. */
ok = ch->rslots & ~cstatus;
for (i = 0; i < ch->numslots; i++) {
if ((ok >> i) & 1)
diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h
index 868a376..e2a1caf 100644
--- a/sys/dev/ahci/ahci.h
+++ b/sys/dev/ahci/ahci.h
@@ -444,7 +444,7 @@ struct ahci_channel {
int numtslotspd[16];/* Number of tagged slots per dev */
int numhslots; /* Number of held slots */
int recoverycmd; /* Our READ LOG active */
- int fatalerr; /* Fatal error happend */
+ int fatalerr; /* Fatal error happened */
int resetting; /* Hard-reset in progress. */
int resetpolldiv; /* Hard-reset poll divider. */
int listening; /* SUD bit is cleared. */
@@ -465,7 +465,7 @@ struct ahci_enclosure {
device_t dev; /* Device handle */
struct resource *r_memc; /* Control register */
struct resource *r_memt; /* Transmit buffer */
- struct resource *r_memr; /* Recieve buffer */
+ struct resource *r_memr; /* Receive buffer */
struct cam_sim *sim;
struct cam_path *path;
struct mtx mtx; /* state lock */
diff --git a/sys/dev/alpm/alpm.c b/sys/dev/alpm/alpm.c
index 53b2f9d..428ea69 100644
--- a/sys/dev/alpm/alpm.c
+++ b/sys/dev/alpm/alpm.c
@@ -202,7 +202,7 @@ alpm_attach(device_t dev)
printf(" 55K");
break;
default:
- printf("unkown");
+ printf("unknown");
break;
}
printf("\n");
diff --git a/sys/dev/altera/atse/if_atse.c b/sys/dev/altera/atse/if_atse.c
index 5e37ad2..f5a461b0 100644
--- a/sys/dev/altera/atse/if_atse.c
+++ b/sys/dev/altera/atse/if_atse.c
@@ -146,7 +146,7 @@ a_onchip_fifo_mem_core_read(struct resource *res, uint32_t off,
return (val4);
}
-/* The FIFO does an endian convertion, so we must not do it as well. */
+/* The FIFO does an endian conversion, so we must not do it as well. */
/* XXX-BZ in fact we should do a htobe32 so le would be fine as well? */
#define ATSE_TX_DATA_WRITE(sc, val4) \
bus_write_4((sc)->atse_tx_mem_res, A_ONCHIP_FIFO_MEM_CORE_DATA, val4)
@@ -169,8 +169,8 @@ a_onchip_fifo_mem_core_read(struct resource *res, uint32_t off,
A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_FILL_LEVEL, \
"RX_FILL", __func__, __LINE__)
-/* The FIFO does an endian convertion, so we must not do it as well. */
-/* XXX-BZ in fact we shoudl do a htobe32 so le would be fine as well? */
+/* The FIFO does an endian conversion, so we must not do it as well. */
+/* XXX-BZ in fact we should do a htobe32 so le would be fine as well? */
#define ATSE_RX_DATA_READ(sc) \
bus_read_4((sc)->atse_rx_mem_res, A_ONCHIP_FIFO_MEM_CORE_DATA)
#define ATSE_RX_META_READ(sc) \
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c
index 16cbeec..09d47f7 100644
--- a/sys/dev/amr/amr.c
+++ b/sys/dev/amr/amr.c
@@ -525,7 +525,7 @@ shutdown_out:
/*
* Bug-for-bug compatibility with Linux!
* Some apps will send commands with inlen and outlen set to 0,
- * even though they expect data to be transfered to them from the
+ * even though they expect data to be transferred to them from the
* card. Linux accidentally allows this by allocating a 4KB
* buffer for the transfer anyways, but it then throws it away
* without copying it back to the app.
@@ -1784,7 +1784,7 @@ amr_start(struct amr_command *ac)
/* Now we have a slot, we can map the command (unmapped in amr_complete). */
if ((error = amr_mapcmd(ac)) == ENOMEM) {
/*
- * Memroy resources are short, so free the slot and let this be tried
+ * Memory resources are short, so free the slot and let this be tried
* later.
*/
amr_freeslot(ac);
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c
index 1f37b59..a85136b 100644
--- a/sys/dev/an/if_an.c
+++ b/sys/dev/an/if_an.c
@@ -426,7 +426,7 @@ int an_alloc_memory(device_t dev, int rid, int size)
}
/*
- * Allocate a auxilary memory resource with the given resource id.
+ * Allocate a auxiliary memory resource with the given resource id.
*/
int an_alloc_aux_memory(device_t dev, int rid, int size)
{
diff --git a/sys/dev/an/if_anreg.h b/sys/dev/an/if_anreg.h
index 279e65b..0004e8e 100644
--- a/sys/dev/an/if_anreg.h
+++ b/sys/dev/an/if_anreg.h
@@ -276,7 +276,7 @@ struct an_reply {
#define AN_EV_ALLOC 0x0008 /* async alloc/reclaim completed */
#define AN_EV_TX_CPY 0x0400
#define AN_EV_TX_EXC 0x0004 /* async xmit completed with failure */
-#define AN_EV_TX 0x0002 /* async xmit completed succesfully */
+#define AN_EV_TX 0x0002 /* async xmit completed successfully */
#define AN_EV_RX 0x0001 /* async rx completed */
#define AN_INTRS(x) \
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 9c8c89a..bbe8bfd 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
static int asmc_probe(device_t dev);
static int asmc_attach(device_t dev);
static int asmc_detach(device_t dev);
+static int asmc_resume(device_t dev);
/*
* SMC functions.
@@ -137,10 +138,18 @@ static struct asmc_model *asmc_match(device_t dev);
#define ASMC_SMS_FUNCS asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \
asmc_mb_sysctl_sms_z
+#define ASMC_SMS_FUNCS_DISABLED NULL,NULL,NULL
+
#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \
asmc_mb_sysctl_fanminspeed, \
asmc_mb_sysctl_fanmaxspeed, \
asmc_mb_sysctl_fantargetspeed
+
+#define ASMC_FAN_FUNCS2 asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, NULL, \
+ asmc_mb_sysctl_fanminspeed, \
+ asmc_mb_sysctl_fanmaxspeed, \
+ asmc_mb_sysctl_fantargetspeed
+
#define ASMC_LIGHT_FUNCS asmc_mbp_sysctl_light_left, \
asmc_mbp_sysctl_light_right, \
asmc_mbp_sysctl_light_control
@@ -158,6 +167,12 @@ struct asmc_model asmc_models[] = {
ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
},
+ {
+ "MacBook3,1", "Apple SMC MacBook Core 2 Duo",
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_MB31_TEMPS, ASMC_MB31_TEMPNAMES, ASMC_MB31_TEMPDESCS
+ },
+
{
"MacBookPro1,1", "Apple SMC MacBook Pro Core Duo (15-inch)",
ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
@@ -260,12 +275,30 @@ struct asmc_model asmc_models[] = {
ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS
},
+ {
+ "MacBookAir5,1", "Apple SMC MacBook Air 11-inch (Mid 2012)",
+ ASMC_SMS_FUNCS_DISABLED,
+ ASMC_FAN_FUNCS2,
+ ASMC_LIGHT_FUNCS,
+ ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS
+ },
+
+ {
+ "MacBookAir5,2", "Apple SMC MacBook Air 13-inch (Mid 2012)",
+ ASMC_SMS_FUNCS_DISABLED,
+ ASMC_FAN_FUNCS2,
+ ASMC_LIGHT_FUNCS,
+ ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS
+ },
+
{ NULL, NULL }
};
#undef ASMC_SMS_FUNCS
+#undef ASMC_SMS_FUNCS_DISABLED
#undef ASMC_FAN_FUNCS
+#undef ASMC_FAN_FUNCS2
#undef ASMC_LIGHT_FUNCS
/*
@@ -275,6 +308,7 @@ static device_method_t asmc_methods[] = {
DEVMETHOD(device_probe, asmc_probe),
DEVMETHOD(device_attach, asmc_attach),
DEVMETHOD(device_detach, asmc_detach),
+ DEVMETHOD(device_resume, asmc_resume),
{ 0, 0 }
};
@@ -301,6 +335,8 @@ static char *asmc_ids[] = { "APP0001", NULL };
static devclass_t asmc_devclass;
+static unsigned int light_control = 0;
+
DRIVER_MODULE(asmc, acpi, asmc_driver, asmc_devclass, NULL, NULL);
MODULE_DEPEND(asmc, acpi, 1, 1, 1);
@@ -581,6 +617,17 @@ asmc_detach(device_t dev)
return (0);
}
+static int
+asmc_resume(device_t dev)
+{
+ uint8_t buf[2];
+ buf[0] = light_control;
+ buf[1] = 0x00;
+ asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
+ return (0);
+}
+
+
#ifdef DEBUG
void asmc_dumpall(device_t dev)
{
@@ -603,7 +650,7 @@ asmc_init(device_t dev)
goto nosms;
/*
- * We are ready to recieve interrupts from the SMS.
+ * We are ready to receive interrupts from the SMS.
*/
buf[0] = 0x01;
ASMC_DPRINTF(("intok key\n"));
@@ -879,7 +926,7 @@ out:
snprintf(buf, sizeof(buf), "key %d is: %s, type %s "
"(len %d), data", number, key, type, maxlen);
for (i = 0; i < maxlen; i++) {
- snprintf(buf2, sizeof(buf), " %02x", v[i]);
+ snprintf(buf2, sizeof(buf2), " %02x", v[i]);
strlcat(buf, buf2, sizeof(buf));
}
strlcat(buf, " \n", sizeof(buf));
@@ -1324,17 +1371,16 @@ asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS)
device_t dev = (device_t) arg1;
uint8_t buf[2];
int error;
- static unsigned int level;
int v;
- v = level;
+ v = light_control;
error = sysctl_handle_int(oidp, &v, 0, req);
if (error == 0 && req->newptr != NULL) {
if (v < 0 || v > 255)
return (EINVAL);
- level = v;
- buf[0] = level;
+ light_control = v;
+ buf[0] = light_control;
buf[1] = 0x00;
asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
}
diff --git a/sys/dev/asmc/asmcvar.h b/sys/dev/asmc/asmcvar.h
index 368575b..f67ee16 100644
--- a/sys/dev/asmc/asmcvar.h
+++ b/sys/dev/asmc/asmcvar.h
@@ -144,7 +144,19 @@ struct asmc_softc {
"Northbridge Point 2", "Heatsink 1", \
"Heatsink 2", "Memory Bank A", }
-#define ASMC_MBP_TEMPS { "TB0T", "Th0H", "Th1H", "Tm0P", \
+#define ASMC_MB31_TEMPS { "TB0T", "TN0P", "Th0H", "Th1H", \
+ "TM0P", NULL }
+
+#define ASMC_MB31_TEMPNAMES { "enclosure", "northbridge1", \
+ "heatsink1", "heatsink2", \
+ "memory", }
+
+#define ASMC_MB31_TEMPDESCS { "Enclosure Bottomside", \
+ "Northbridge Point 1", \
+ "Heatsink 1","Heatsink 2" \
+ "Memory Bank A", }
+
+#define ASMC_MBP_TEMPS { "TB0T", "Th0H", "Th1H", "Tm0P", \
"TG0H", "TG0P", "TG0T", NULL }
#define ASMC_MBP_TEMPNAMES { "enclosure", "heatsink1", \
@@ -337,3 +349,24 @@ struct asmc_softc {
#define ASMC_MBA3_TEMPDESCS { "Enclosure Bottom", "TB1T", "TB2T", \
"TC0D", "TC0E", "TC0P" }
+
+#define ASMC_MBA5_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", \
+ "TC0D", "TC0E", "TC0F", "TC0P", \
+ "TC1C", "TC2C", "TCGC", "TCSA", \
+ "TCXC", "THSP", "TM0P", "TPCD", \
+ "Ta0P", "Th1H", "Tm0P", "Tm1P", \
+ "Ts0P", "Ts0S", NULL }
+
+#define ASMC_MBA5_TEMPNAMES { "enclosure1", "enclosure2", "enclosure3", "TC0C", \
+ "cpudiode", "cputemp1", "cputemp2", "cpuproximity", \
+ "cpucore1", "cpucore2", "cpupeci", "pecisa", \
+ "TCXC", "THSP", "memorybank", "pchdie", \
+ "Ta0P", "heatpipe", "mainboardproximity1", "mainboardproximity2", \
+ "palmrest", "memoryproximity" }
+
+#define ASMC_MBA5_TEMPDESCS { "Enclosure Bottom 1", "Enclosure Bottom 2", "Enclosure Bottom 3", "TC0C",\
+ "CPU Diode", "CPU Temp 1", "CPU Temp 2", "CPU Proximity", \
+ "CPU Core 1", "CPU Core 2", "CPU Peci Core", "PECI SA", \
+ "TCXC", "THSP", "Memory Bank A", "PCH Die", \
+ "Ta0P", "Heatpipe", "Mainboard Proximity 1", "Mainboard Proximity 2", \
+ "Palm Rest", "Memory Proximity" }
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 8e7ca08..889c37b 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -426,7 +426,7 @@ ata_default_registers(device_t dev)
void
ata_udelay(int interval)
{
- /* for now just use DELAY, the timer/sleep subsytems are not there yet */
+ /* for now just use DELAY, the timer/sleep subsystems are not there yet */
if (1 || interval < (1000000/hz) || ata_delayed_attach)
DELAY(interval);
else
diff --git a/sys/dev/ata/ata-sata.c b/sys/dev/ata/ata-sata.c
index c31175d..2df5cb5 100644
--- a/sys/dev/ata/ata-sata.c
+++ b/sys/dev/ata/ata-sata.c
@@ -297,7 +297,7 @@ ata_pm_identify(device_t dev)
/* get PM revision data */
if (ch->hw.pm_read(dev, ATA_PM, 1, &pm_revision)) {
- device_printf(dev, "error getting PM revison data\n");
+ device_printf(dev, "error getting PM revision data\n");
return;
}
diff --git a/sys/dev/ata/chipsets/ata-ite.c b/sys/dev/ata/chipsets/ata-ite.c
index f204e7a..44370de 100644
--- a/sys/dev/ata/chipsets/ata-ite.c
+++ b/sys/dev/ata/chipsets/ata-ite.c
@@ -103,7 +103,7 @@ ata_ite_chipinit(device_t dev)
pci_write_config(dev, 0x56, 0x31, 1);
ctlr->setmode = ata_ite_821x_setmode;
- /* No timing restrictions initally. */
+ /* No timing restrictions initially. */
ctlr->chipset_data = NULL;
}
ctlr->ch_attach = ata_ite_ch_attach;
diff --git a/sys/dev/ath/ath_dfs/null/dfs_null.c b/sys/dev/ath/ath_dfs/null/dfs_null.c
index c980a79..e31a61d 100644
--- a/sys/dev/ath/ath_dfs/null/dfs_null.c
+++ b/sys/dev/ath/ath_dfs/null/dfs_null.c
@@ -181,7 +181,7 @@ ath_dfs_process_phy_err(struct ath_softc *sc, struct mbuf *m,
}
/*
- * Process the radar events and determine whether a DFS event has occured.
+ * Process the radar events and determine whether a DFS event has occurred.
*
* This is designed to run outside of the RX processing path.
* The RX path will call ath_dfs_tasklet_needed() to see whether
diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c
index 8333f10..e14feb2 100644
--- a/sys/dev/ath/ath_hal/ah.c
+++ b/sys/dev/ath/ath_hal/ah.c
@@ -362,7 +362,7 @@ ath_hal_computetxtime(struct ath_hal *ah,
kbps = rates->info[rateix].rateKbps;
/*
- * index can be invalid duting dynamic Turbo transitions.
+ * index can be invalid during dynamic Turbo transitions.
* XXX
*/
if (kbps == 0)
diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h
index 76f37d6..cb98888 100644
--- a/sys/dev/ath/ath_hal/ah.h
+++ b/sys/dev/ath/ath_hal/ah.h
@@ -414,7 +414,7 @@ typedef enum {
/* Allow all mcast/bcast frames */
/*
- * Magic RX filter flags that aren't targetting hardware bits
+ * Magic RX filter flags that aren't targeting hardware bits
* but instead the HAL sets individual bits - eg PHYERR will result
* in OFDM/CCK timing error frames being received.
*/
@@ -1224,7 +1224,7 @@ typedef struct {
/*
* slotted mode only. rx_clear and bt_ant decision
* will be held the entire time that BT_ACTIVE is asserted,
- * otherwise the decision is made before every slot boundry.
+ * otherwise the decision is made before every slot boundary.
*/
HAL_BOOL bt_hold_rxclear;
} HAL_BT_COEX_CONFIG;
diff --git a/sys/dev/ath/ath_hal/ah_regdomain.c b/sys/dev/ath/ath_hal/ah_regdomain.c
index fb0c841..4f374c4 100644
--- a/sys/dev/ath/ath_hal/ah_regdomain.c
+++ b/sys/dev/ath/ath_hal/ah_regdomain.c
@@ -490,7 +490,7 @@ getchannels(struct ath_hal *ah,
break;
default:
HALDEBUG(ah, HAL_DEBUG_REGDOMAIN,
- "%s: Unkonwn HAL mode 0x%x\n", __func__, cm->mode);
+ "%s: Unknown HAL mode 0x%x\n", __func__, cm->mode);
continue;
}
if (isChanBitMaskZero(channelBM))
diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
index 14c2087..a4f3680 100644
--- a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
+++ b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c
@@ -913,7 +913,7 @@ getNoiseFloorThresh(struct ath_hal *ah, const struct ieee80211_channel *chan,
}
/*
- * Read the NF and check it against the noise floor threshhold
+ * Read the NF and check it against the noise floor threshold
*
* Returns: TRUE if the NF is good
*/
diff --git a/sys/dev/ath/ath_hal/ar5212/ar2316.c b/sys/dev/ath/ath_hal/ar5212/ar2316.c
index 9bfc482..4589938 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar2316.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar2316.c
@@ -373,9 +373,9 @@ ar2316getGainBoundariesAndPdadcsForPowers(struct ath_hal *ah, uint16_t channel,
* change pwr_I_0 to signed 5-bits.
*/
int16_t Pmin_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on. */
+ /* to accommodate -ve power levels later on. */
int16_t Pmax_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on */
+ /* to accommodate -ve power levels later on */
uint16_t numVpd = 0;
uint16_t Vpd_step;
int16_t tmpVal ;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar2317.c b/sys/dev/ath/ath_hal/ar5212/ar2317.c
index fdf88e3..0db8c32 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar2317.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar2317.c
@@ -351,9 +351,9 @@ ar2317getGainBoundariesAndPdadcsForPowers(struct ath_hal *ah, uint16_t channel,
* change pwr_I_0 to signed 5-bits.
*/
int16_t Pmin_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on. */
+ /* to accommodate -ve power levels later on. */
int16_t Pmax_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on */
+ /* to accommodate -ve power levels later on */
uint16_t numVpd = 0;
uint16_t Vpd_step;
int16_t tmpVal ;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar2413.c b/sys/dev/ath/ath_hal/ar5212/ar2413.c
index e069444..1034b2b 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar2413.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar2413.c
@@ -367,9 +367,9 @@ ar2413getGainBoundariesAndPdadcsForPowers(struct ath_hal *ah, uint16_t channel,
* change pwr_I_0 to signed 5-bits.
*/
int16_t Pmin_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on. */
+ /* to accommodate -ve power levels later on. */
int16_t Pmax_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on */
+ /* to accommodate -ve power levels later on */
uint16_t numVpd = 0;
uint16_t Vpd_step;
int16_t tmpVal ;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar2425.c b/sys/dev/ath/ath_hal/ar5212/ar2425.c
index e487489..e310801 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar2425.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar2425.c
@@ -372,9 +372,9 @@ ar2425getGainBoundariesAndPdadcsForPowers(struct ath_hal *ah, uint16_t channel,
* change pwr_I_0 to signed 5-bits.
*/
static int16_t Pmin_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on. */
+ /* to accommodate -ve power levels later on. */
static int16_t Pmax_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on */
+ /* to accommodate -ve power levels later on */
uint16_t numVpd = 0;
uint16_t Vpd_step;
int16_t tmpVal ;
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
index a95f244..189e916 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c
@@ -885,7 +885,7 @@ ar5212FillCapabilityInfo(struct ath_hal *ah)
pCap->halRfSilentSupport = AH_TRUE;
}
- /* NB: this is a guess, noone seems to know the answer */
+ /* NB: this is a guess, no one seems to know the answer */
ahpriv->ah_rxornIsFatal =
(AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_VENICE);
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_power.c b/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
index 3068510..dc91796 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
@@ -51,7 +51,7 @@ ar5212SetPowerModeAwake(struct ath_hal *ah, int setChip)
* which when blindly written back with OS_REG_RMW_FIELD
* enables the MIB interrupt for the sleep performance
* counters. This can result in an interrupt storm when
- * ANI is in operation as noone knows to turn off the MIB
+ * ANI is in operation as no one knows to turn off the MIB
* interrupt cause.
*/
scr = OS_REG_READ(ah, AR_SCR);
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
index d53d86c..6a76f43 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c
@@ -1385,7 +1385,7 @@ ar5212GetNfHistMid(const int16_t calData[AR512_NF_CAL_HIST_MAX])
}
/*
- * Read the NF and check it against the noise floor threshhold
+ * Read the NF and check it against the noise floor threshold
*/
int16_t
ar5212GetNf(struct ath_hal *ah, struct ieee80211_channel *chan)
diff --git a/sys/dev/ath/ath_hal/ar5212/ar5413.c b/sys/dev/ath/ath_hal/ar5212/ar5413.c
index ab6cc65..f7251e2 100644
--- a/sys/dev/ath/ath_hal/ar5212/ar5413.c
+++ b/sys/dev/ath/ath_hal/ar5212/ar5413.c
@@ -411,9 +411,9 @@ ar5413getGainBoundariesAndPdadcsForPowers(struct ath_hal *ah, uint16_t channel,
* change pwr_I_0 to signed 5-bits.
*/
int16_t Pmin_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on. */
+ /* to accommodate -ve power levels later on. */
int16_t Pmax_t2[MAX_NUM_PDGAINS_PER_CHANNEL];
- /* to accomodate -ve power levels later on */
+ /* to accommodate -ve power levels later on */
uint16_t numVpd = 0;
uint16_t Vpd_step;
int16_t tmpVal ;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c b/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c
index c73b0ee..f610575 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_btcoex.c
@@ -95,7 +95,7 @@ ar5416BTCoexSetWeights(struct ath_hal *ah, u_int32_t stompType)
struct ath_hal_5416 *ahp = AH5416(ah);
if (AR_SREV_KIWI_10_OR_LATER(ah)) {
- /* TODO: TX RX seperate is not enabled. */
+ /* TODO: TX RX separate is not enabled. */
switch (stompType) {
case HAL_BT_COEX_STOMP_ALL:
ahp->ah_btCoexBTWeight = AR5416_BT_WGHT;
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
index 35bb8d4..f71629b 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
@@ -772,7 +772,7 @@ ar5416SanitizeNF(struct ath_hal *ah, int16_t *nf)
/*
- * Read the NF and check it against the noise floor threshhold
+ * Read the NF and check it against the noise floor threshold
*
* Return 0 if the NF calibration hadn't finished, 0 if it was
* invalid, or > 0 for a valid NF reading.
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c b/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c
index 6bdd722..1a936e0 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c
@@ -119,7 +119,7 @@ ar5416ConfigureSpectralScan(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss)
} else {
if (ss->ss_count != HAL_SPECTRAL_PARAM_NOVAL) {
/*
- * In Merlin, for continous scan, scan_count = 128.
+ * In Merlin, for continuous scan, scan_count = 128.
* In case of Kiwi, this value should be 0
*/
if (ss->ss_count == 128)
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
index 47e8c35..88ba2b3 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
@@ -807,7 +807,7 @@ ar5416ProcTxDesc(struct ath_hal *ah,
}
/*
- * These fields are not used. Zero these to preserve compatability
+ * These fields are not used. Zero these to preserve compatibility
* with existing drivers.
*/
ts->ts_virtcol = MS(ads->ds_ctl1, AR_VirtRetryCnt);
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
index 0ee1e70..de424be 100644
--- a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
+++ b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
@@ -277,10 +277,10 @@
#define AR_PCIE_PM_CTRL_ENA 0x00080000
#define AR_AHB_EXACT_WR_EN 0x00000000 /* write exact bytes */
-#define AR_AHB_BUF_WR_EN 0x00000001 /* buffer write upto cacheline*/
+#define AR_AHB_BUF_WR_EN 0x00000001 /* buffer write up to cacheline*/
#define AR_AHB_EXACT_RD_EN 0x00000000 /* read exact bytes */
-#define AR_AHB_CACHELINE_RD_EN 0x00000002 /* read upto end of cacheline */
-#define AR_AHB_PREFETCH_RD_EN 0x00000004 /* prefetch upto page boundary*/
+#define AR_AHB_CACHELINE_RD_EN 0x00000002 /* read up to end of cacheline */
+#define AR_AHB_PREFETCH_RD_EN 0x00000004 /* prefetch up to page boundary*/
#define AR_AHB_PAGE_SIZE_1K 0x00000000 /* set page-size as 1k */
#define AR_AHB_PAGE_SIZE_2K 0x00000008 /* set page-size as 2k */
#define AR_AHB_PAGE_SIZE_4K 0x00000010 /* set page-size as 4k */
@@ -518,7 +518,7 @@
#define AR_PCU_FORCE_QUIET_COLL 0x00040000 /* kill xmit for channel change */
#define AR_PCU_BT_ANT_PREVENT_RX 0x00100000
#define AR_PCU_BT_ANT_PREVENT_RX_S 20
-#define AR_PCU_TBTT_PROTECT 0x00200000 /* no xmit upto tbtt+20 uS */
+#define AR_PCU_TBTT_PROTECT 0x00200000 /* no xmit up to tbtt+20 uS */
#define AR_PCU_CLEAR_VMF 0x01000000 /* clear vmf mode (fast cc)*/
#define AR_PCU_CLEAR_BA_VALID 0x04000000 /* clear ba state */
#define AR_PCU_SEL_EVM 0x08000000 /* select EVM data or PLCP header */
diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c b/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c
index 361930b..334ca60 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c
@@ -328,7 +328,7 @@ ar9280SetPowerCalTable(struct ath_hal *ah, struct ar5416eeprom *pEepData,
* uses this to calculate the PDADC delta during
* calibration ; 0 here effectively stops the
* temperature compensation calibration from
- * occuring.
+ * occurring.
*/
AH5416(ah)->initPDADC = 0;
}
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index ab7cec3..87daaf3 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2698,7 +2698,7 @@ ath_txrx_start(struct ath_softc *sc)
}
/*
- * Grab the reset lock, and wait around until noone else
+ * Grab the reset lock, and wait around until no one else
* is trying to do anything with it.
*
* This is totally horrible but we can't hold this lock for
@@ -2782,7 +2782,7 @@ ath_reset(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
ATH_PCU_UNLOCK_ASSERT(sc);
ATH_UNLOCK_ASSERT(sc);
- /* Try to (stop any further TX/RX from occuring */
+ /* Try to (stop any further TX/RX from occurring */
taskqueue_block(sc->sc_tq);
/*
@@ -2826,7 +2826,7 @@ ath_reset(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
/*
* Should now wait for pending TX/RX to complete
- * and block future ones from occuring. This needs to be
+ * and block future ones from occurring. This needs to be
* done before the TX queue is drained.
*/
ath_draintxq(sc, reset_type); /* stop xmit side */
@@ -3676,7 +3676,7 @@ ath_bstuck_proc(void *arg, int pending)
sc->sc_stats.ast_bstuck++;
/*
* This assumes that there's no simultaneous channel mode change
- * occuring.
+ * occurring.
*/
ath_reset(sc, ATH_RESET_NOLOSS);
}
@@ -4737,7 +4737,7 @@ ath_tx_freebuf(struct ath_softc *sc, struct ath_buf *bf, int status)
/*
* Make sure that we only sync/unload if there's an mbuf.
* If not (eg we cloned a buffer), the unload will have already
- * occured.
+ * occurred.
*/
if (bf->bf_m != NULL) {
bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap,
@@ -5076,7 +5076,7 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
ATH_PCU_UNLOCK_ASSERT(sc);
ATH_UNLOCK_ASSERT(sc);
- /* (Try to) stop TX/RX from occuring */
+ /* (Try to) stop TX/RX from occurring */
taskqueue_block(sc->sc_tq);
ATH_PCU_LOCK(sc);
@@ -5857,7 +5857,7 @@ ath_newassoc(struct ieee80211_node *ni, int isnew)
* If we're reassociating, make sure that any paused queues
* get unpaused.
*
- * Now, we may hvae frames in the hardware queue for this node.
+ * Now, we may have frames in the hardware queue for this node.
* So if we are reassociating and there are frames in the queue,
* we need to go through the cleanup path to ensure that they're
* marked as non-aggregate.
@@ -6068,7 +6068,7 @@ ath_setcurmode(struct ath_softc *sc, enum ieee80211_phymode mode)
sc->sc_currates = rt;
sc->sc_curmode = mode;
/*
- * All protection frames are transmited at 2Mb/s for
+ * All protection frames are transmitted at 2Mb/s for
* 11g, otherwise at 1Mb/s.
*/
if (mode == IEEE80211_MODE_11G)
diff --git a/sys/dev/ath/if_ath_ioctl.c b/sys/dev/ath/if_ath_ioctl.c
index b084aac..1128c18 100644
--- a/sys/dev/ath/if_ath_ioctl.c
+++ b/sys/dev/ath/if_ath_ioctl.c
@@ -163,7 +163,7 @@ bad:
* Diagnostic interface to the HAL. This is used by various
* tools to do things like retrieve register contents for
* debugging. The mechanism is intentionally opaque so that
- * it can change frequently w/o concern for compatiblity.
+ * it can change frequently w/o concern for compatibility.
*/
static int
ath_ioctl_diag(struct ath_softc *sc, struct ath_diag *ad)
diff --git a/sys/dev/ath/if_ath_lna_div.c b/sys/dev/ath/if_ath_lna_div.c
index 5c770c0..5c102fb 100644
--- a/sys/dev/ath/if_ath_lna_div.c
+++ b/sys/dev/ath/if_ath_lna_div.c
@@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
#include <dev/ath/if_ath_debug.h>
#include <dev/ath/if_ath_lna_div.h>
-/* Linux compability macros */
+/* Linux compatibility macros */
/*
* XXX these don't handle rounding, underflow, overflow, wrapping!
*/
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index bc4f7f0..88cbaff 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -82,7 +82,7 @@ struct ath_pci_softc {
/*
* XXX eventually this should be some system level definition
- * so modules will hvae probe/attach information like USB.
+ * so modules will have probe/attach information like USB.
* But for now..
*/
struct pci_device_id {
diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c
index 5270830..cacd8f8 100644
--- a/sys/dev/ath/if_ath_rx.c
+++ b/sys/dev/ath/if_ath_rx.c
@@ -802,7 +802,7 @@ rx_accept:
* This code should be removed once the actual
* root cause of the issue has been identified.
* For example, it may be that the rs_antenna
- * field is only valid for the lsat frame of
+ * field is only valid for the last frame of
* an aggregate and it just happens that it is
* "mostly" right. (This is a general statement -
* the majority of the statistics are only valid
diff --git a/sys/dev/ath/if_ath_sysctl.c b/sys/dev/ath/if_ath_sysctl.c
index 9dff210..ab829df 100644
--- a/sys/dev/ath/if_ath_sysctl.c
+++ b/sys/dev/ath/if_ath_sysctl.c
@@ -1285,6 +1285,12 @@ ath_sysctl_stats_attach(struct ath_softc *sc)
SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_stbc",
CTLFLAG_RD, &sc->sc_stats.ast_rx_stbc, 0,
"Number of STBC frames received");
+ SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_stbc",
+ CTLFLAG_RD, &sc->sc_stats.ast_tx_stbc, 0,
+ "Number of STBC frames transmitted");
+ SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_ldpc",
+ CTLFLAG_RD, &sc->sc_stats.ast_tx_ldpc, 0,
+ "Number of LDPC frames transmitted");
/* Attach the RX phy error array */
ath_sysctl_stats_attach_rxphyerr(sc, child);
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
index 7350bb0..d08df69 100644
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -3125,7 +3125,7 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni,
* If we're not doing A-MPDU, be prepared to direct dispatch
* up to both limits if possible. This particular corner
* case may end up with packet starvation between aggregate
- * traffic and non-aggregate traffic: we wnat to ensure
+ * traffic and non-aggregate traffic: we want to ensure
* that non-aggregate stations get a few frames queued to the
* hardware before the aggregate station(s) get their chance.
*
@@ -3949,7 +3949,7 @@ ath_tx_tid_reset(struct ath_softc *sc, struct ath_tid *tid)
* XXX TODO: it may just be enough to walk the HWQs and mark
* frames for that node as non-aggregate; or mark the ath_node
* with something that indicates that aggregation is no longer
- * occuring. Then we can just toss the BAW complaints and
+ * occurring. Then we can just toss the BAW complaints and
* do a complete hard reset of state here - no pause, no
* complete counter, etc.
*/
@@ -4876,7 +4876,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc *sc, struct ath_buf *bf_first,
/* AR5416 BA bug; this requires an interface reset */
if (isaggr && tx_ok && (! hasba)) {
- DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR,
+ device_printf(sc->sc_dev,
"%s: AR5416 bug: hasba=%d; txok=%d, isaggr=%d, "
"seq_st=%d\n",
__func__, hasba, tx_ok, isaggr, seq_st);
diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c
index a20607e..75e949a 100644
--- a/sys/dev/ath/if_ath_tx_ht.c
+++ b/sys/dev/ath/if_ath_tx_ht.c
@@ -227,6 +227,21 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
struct ath_rc_series *rc = bf->bf_state.bfs_rc;
uint8_t rate;
int i;
+ int do_ldpc;
+ int do_stbc;
+
+ /*
+ * We only do LDPC if the rate is 11n, both we and the
+ * receiver support LDPC and it's enabled.
+ *
+ * It's a global flag, not a per-try flag, so we clear
+ * it if any of the rate entries aren't 11n.
+ */
+ do_ldpc = 0;
+ if ((ni->ni_vap->iv_htcaps & IEEE80211_HTCAP_LDPC) &&
+ (ni->ni_htcap & IEEE80211_HTCAP_LDPC))
+ do_ldpc = 1;
+ do_stbc = 0;
for (i = 0; i < ATH_RC_NUM; i++) {
rc[i].flags = 0;
@@ -250,6 +265,12 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
(HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA))
rc[i].flags |= ATH_RC_RTSCTS_FLAG;
+ /*
+ * If we can't do LDPC, don't.
+ */
+ if (! IS_HT_RATE(rate))
+ do_ldpc = 0;
+
/* Only enable shortgi, 2040, dual-stream if HT is set */
if (IS_HT_RATE(rate)) {
rc[i].flags |= ATH_RC_HT_FLAG;
@@ -281,6 +302,7 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
(sc->sc_cur_txchainmask > 1) &&
HT_RC_2_STREAMS(rate) == 1) {
rc[i].flags |= ATH_RC_STBC_FLAG;
+ do_stbc = 1;
}
/*
@@ -324,6 +346,18 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
"%s: i=%d, rate=0x%x, flags=0x%x, max4ms=%d\n",
__func__, i, rate, rc[i].flags, rc[i].max4msframelen);
}
+
+ /*
+ * LDPC is a global flag, so ...
+ */
+ if (do_ldpc) {
+ bf->bf_state.bfs_txflags |= HAL_TXDESC_LDPC;
+ sc->sc_stats.ast_tx_ldpc++;
+ }
+
+ if (do_stbc) {
+ sc->sc_stats.ast_tx_stbc++;
+ }
}
/*
diff --git a/sys/dev/ath/if_athioctl.h b/sys/dev/ath/if_athioctl.h
index e9ce887..7b69ab5 100644
--- a/sys/dev/ath/if_athioctl.h
+++ b/sys/dev/ath/if_athioctl.h
@@ -166,7 +166,9 @@ struct ath_stats {
u_int32_t ast_tx_node_psq_overflow;
u_int32_t ast_rx_stbc; /* RX STBC frame */
u_int32_t ast_tx_nodeq_overflow; /* node sw queue overflow */
- u_int32_t ast_pad[12];
+ u_int32_t ast_tx_ldpc; /* TX LDPC frame */
+ u_int32_t ast_tx_stbc; /* TX STBC frame */
+ u_int32_t ast_pad[10];
};
#define SIOCGATHSTATS _IOWR('i', 137, struct ifreq)
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index b0ab2d1..9052ebe 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -126,7 +126,7 @@ struct ath_tid {
TAILQ_HEAD(,ath_buf) tid_q; /* pending buffers */
struct ath_node *an; /* pointer to parent */
int tid; /* tid */
- int ac; /* which AC gets this trafic */
+ int ac; /* which AC gets this traffic */
int hwq_depth; /* how many buffers are on HW */
u_int axq_depth; /* SW queue depth */
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c
index b5c4856..56a5c62 100644
--- a/sys/dev/atkbdc/psm.c
+++ b/sys/dev/atkbdc/psm.c
@@ -1807,7 +1807,7 @@ psmread(struct cdev *dev, struct uio *uio, int flag)
if ((sc->state & PSM_VALID) == 0)
return (EIO);
- /* block until mouse activity occured */
+ /* block until mouse activity occurred */
s = spltty();
while (sc->queue.count <= 0) {
if (dev != sc->bdev) {
@@ -3008,7 +3008,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *ms,
if (synaction->queue_len < synaction->window_min)
goto SYNAPTICS_END;
- /* Is a scrolling action occuring? */
+ /* Is a scrolling action occurring? */
if (!synaction->in_taphold && !synaction->in_vscroll) {
/*
* A scrolling action must not conflict with a tap
@@ -3518,7 +3518,7 @@ psmsoftintr(void *arg)
case MOUSE_MODEL_NETSCROLL:
/*
- * three addtional bytes encode buttons and
+ * three additional bytes encode buttons and
* wheel events
*/
ms.button |= (pb->ipacket[3] & MOUSE_PS2_BUTTON3DOWN) ?
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index cfc091f..0b406e2 100644
--- a/sys/dev/bce/if_bce.c
+++ b/sys/dev/bce/if_bce.c
@@ -2361,7 +2361,7 @@ bce_nvram_erase_page(struct bce_softc *sc, u32 offset)
BCE_NVM_COMMAND_DOIT;
/*
- * Clear the DONE bit separately, set the NVRAM adress to erase,
+ * Clear the DONE bit separately, set the NVRAM address to erase,
* and issue the erase command.
*/
REG_WR(sc, BCE_NVM_COMMAND, BCE_NVM_COMMAND_DONE);
@@ -7957,7 +7957,7 @@ bce_intr(void *xsc)
goto bce_intr_exit;
}
- /* Ack the interrupt and stop others from occuring. */
+ /* Ack the interrupt and stop others from occurring. */
REG_WR(sc, BCE_PCICFG_INT_ACK_CMD,
BCE_PCICFG_INT_ACK_CMD_USE_INT_HC_PARAM |
BCE_PCICFG_INT_ACK_CMD_MASK_INT);
diff --git a/sys/dev/bce/if_bcereg.h b/sys/dev/bce/if_bcereg.h
index 8ed58d5..2f166ea 100644
--- a/sys/dev/bce/if_bcereg.h
+++ b/sys/dev/bce/if_bcereg.h
@@ -6089,7 +6089,7 @@ struct l2_fhdr {
/****************************************************************************/
/* The following definitions refer to pre-defined locations in processor */
/* memory space which allows the driver to enable particular functionality */
-/* within the firmware or read specfic information about the running */
+/* within the firmware or read specific information about the running */
/* firmware. */
/****************************************************************************/
@@ -6174,7 +6174,7 @@ struct l2_fhdr {
#define RX_IDX(x) ((x) & USABLE_RX_BD_PER_PAGE)
/*
- * To accomodate jumbo frames, the page chain should
+ * To accommodate jumbo frames, the page chain should
* be 4 times larger than the receive chain.
*/
#define DEFAULT_PG_PAGES (DEFAULT_RX_PAGES * 4)
diff --git a/sys/dev/bhnd/bcma/bcma_bhndb.c b/sys/dev/bhnd/bcma/bcma_bhndb.c
index bb617b0..ec8b647 100644
--- a/sys/dev/bhnd/bcma/bcma_bhndb.c
+++ b/sys/dev/bhnd/bcma/bcma_bhndb.c
@@ -180,4 +180,5 @@ DRIVER_MODULE(bcma_bhndb, bhndb, bcma_bhndb_driver, bhnd_devclass, NULL, NULL);
MODULE_VERSION(bcma_bhndb, 1);
MODULE_DEPEND(bcma_bhndb, bcma, 1, 1, 1);
+MODULE_DEPEND(bcma_bhndb, bhnd, 1, 1, 1);
MODULE_DEPEND(bcma_bhndb, bhndb, 1, 1, 1);
diff --git a/sys/dev/bhnd/bcmsrom_fmt.h b/sys/dev/bhnd/bcmsrom_fmt.h
index 10f00e4..66c2b9d 100644
--- a/sys/dev/bhnd/bcmsrom_fmt.h
+++ b/sys/dev/bhnd/bcmsrom_fmt.h
@@ -311,7 +311,7 @@
/* SISO PA parameters are in the path0 spaces */
#define SROM8_SISO 96
-/* Legacy names for SISO PA paramters */
+/* Legacy names for SISO PA parameters */
#define SROM8_W0_ITTMAXP (SROM8_SISO + SROM8_2G_ITT_MAXP)
#define SROM8_W0_PAB0 (SROM8_SISO + SROM8_2G_PA)
#define SROM8_W0_PAB1 (SROM8_SISO + SROM8_2G_PA + 1)
diff --git a/sys/dev/bhnd/bhnd.h b/sys/dev/bhnd/bhnd.h
index 5a3e992..7589556 100644
--- a/sys/dev/bhnd/bhnd.h
+++ b/sys/dev/bhnd/bhnd.h
@@ -449,7 +449,7 @@ bhnd_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
* BHND_BUS_ALLOC_RESOURCE.
*
* @retval 0 success
- * @retval non-zero an error occured while activating the resource.
+ * @retval non-zero an error occurred while activating the resource.
*/
static inline int
bhnd_activate_resource(device_t dev, int type, int rid,
@@ -469,7 +469,7 @@ bhnd_activate_resource(device_t dev, int type, int rid,
* BHND_BUS_ALLOC_RESOURCE.
*
* @retval 0 success
- * @retval non-zero an error occured while activating the resource.
+ * @retval non-zero an error occurred while activating the resource.
*/
static inline int
bhnd_deactivate_resource(device_t dev, int type, int rid,
@@ -489,7 +489,7 @@ bhnd_deactivate_resource(device_t dev, int type, int rid,
* BHND_ALLOC_RESOURCE.
*
* @retval 0 success
- * @retval non-zero an error occured while activating the resource.
+ * @retval non-zero an error occurred while activating the resource.
*/
static inline int
bhnd_release_resource(device_t dev, int type, int rid,
diff --git a/sys/dev/bhnd/bhnd_ids.h b/sys/dev/bhnd/bhnd_ids.h
index fdbc6ff..e28e53b 100644
--- a/sys/dev/bhnd/bhnd_ids.h
+++ b/sys/dev/bhnd/bhnd_ids.h
@@ -421,14 +421,14 @@
#define BHND_PKGID_BCM4314PCIE (8 | 2) /* 4314 QFN PCI (ARM-less) package id */
#define BHND_PKGID_BCM4314SDIO_ARM (8 | 3) /* 4314 QFN SDIO (ARM-less) package id */
#define BHND_PKGID_BCM4314SDIO_FPBGA (8 | 4) /* 4314 FpBGA SDIO package id */
-#define BHND_PKGID_BCM4314DEV (8 | 6) /* 4314 Developement package id */
+#define BHND_PKGID_BCM4314DEV (8 | 6) /* 4314 Development package id */
#define BHND_PKGID_BCM4707 1 /* 4707 package id */
#define BHND_PKGID_BCM4708 2 /* 4708 package id */
#define BHND_PKGID_BCM4709 0 /* 4709 package id */
#define BHND_PKGID_BCM4335_WLCSP (0x0) /* WLCSP Module/Mobile SDIO/HSIC. */
-#define BHND_PKGID_BCM4335_FCBGA (0x1) /* FCBGA PC/Embeded/Media PCIE/SDIO */
+#define BHND_PKGID_BCM4335_FCBGA (0x1) /* FCBGA PC/Embedded/Media PCIE/SDIO */
#define BHND_PKGID_BCM4335_WLBGA (0x2) /* WLBGA COB/Mobile SDIO/HSIC. */
#define BHND_PKGID_BCM4335_FCBGAD (0x3) /* FCBGA Debug Debug/Dev All if's. */
#define BHND_PKGID_PKG_MASK_BCM4335 (0x3)
@@ -645,8 +645,8 @@
#define BHND_BFL3_RCAL_WAR 0x00000008 /* acphy, rcal war active on this board (4335a0) */
#define BHND_BFL3_TXGAINTBLID 0x00000070 /* acphy, txgain table id */
#define BHND_BFL3_TXGAINTBLID_SHIFT 0x4 /* acphy, txgain table id shift bit */
-#define BHND_BFL3_TSSI_DIV_WAR 0x00000080 /* acphy, Seperate paparam for 20/40/80 */
-#define BHND_BFL3_TSSI_DIV_WAR_SHIFT 0x7 /* acphy, Seperate paparam for 20/40/80 shift bit */
+#define BHND_BFL3_TSSI_DIV_WAR 0x00000080 /* acphy, Separate paparam for 20/40/80 */
+#define BHND_BFL3_TSSI_DIV_WAR_SHIFT 0x7 /* acphy, Separate paparam for 20/40/80 shift bit */
#define BHND_BFL3_FEMTBL_FROM_NVRAM 0x00000100 /* acphy, femctrl table is read from nvram */
#define BHND_BFL3_FEMTBL_FROM_NVRAM_SHIFT 0x8 /* acphy, femctrl table is read from nvram */
#define BHND_BFL3_AGC_CFG_2G 0x00000200 /* acphy, gain control configuration for 2G */
diff --git a/sys/dev/bhnd/bhnd_subr.c b/sys/dev/bhnd/bhnd_subr.c
index 04dcf69..1d5557b 100644
--- a/sys/dev/bhnd/bhnd_subr.c
+++ b/sys/dev/bhnd/bhnd_subr.c
@@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/bus.h>
#include <sys/systm.h>
@@ -889,4 +890,4 @@ bhnd_bus_generic_deactivate_resource(device_t dev, device_t child,
child, type, rid, r));
return (EINVAL);
-}; \ No newline at end of file
+};
diff --git a/sys/dev/bhnd/bhndb/bhndb.c b/sys/dev/bhnd/bhndb/bhndb.c
index f635384..3deae00 100644
--- a/sys/dev/bhnd/bhndb/bhndb.c
+++ b/sys/dev/bhnd/bhndb/bhndb.c
@@ -1515,7 +1515,7 @@ bhndb_get_resource_list(device_t dev, device_t child)
* Default bhndb(4) implementation of BHND_BUS_ACTIVATE_RESOURCE().
*
* For BHNDB_ADDRSPACE_NATIVE children, all resources may be assumed to
- * be actived by the bridge.
+ * be activated by the bridge.
*
* For BHNDB_ADDRSPACE_BRIDGED children, attempts to activate a static register
* window, a dynamic register window, or configures @p r as an indirect
diff --git a/sys/dev/bhnd/bhndb/bhndb_hwdata.c b/sys/dev/bhnd/bhndb/bhndb_hwdata.c
index dd973e9..7cbb21f 100644
--- a/sys/dev/bhnd/bhndb/bhndb_hwdata.c
+++ b/sys/dev/bhnd/bhndb/bhndb_hwdata.c
@@ -130,7 +130,7 @@ const struct bhndb_hw_priority bhndb_bcma_priority_table[] = {
/*
* Default Core Behavior
*
- * All other cores are assumed to require effecient runtime access to
+ * All other cores are assumed to require efficient runtime access to
* the default device port, and if supported by the bus, an agent port.
*/
BHNDB_CLASS_PRIO(INVALID, -1, DEFAULT,
@@ -183,7 +183,7 @@ const struct bhndb_hw_priority bhndb_siba_priority_table[] = {
/*
* Default Core Behavior
*
- * All other cores are assumed to require effecient runtime access to
+ * All other cores are assumed to require efficient runtime access to
* the device port.
*/
BHNDB_CLASS_PRIO(INVALID, -1, DEFAULT,
diff --git a/sys/dev/bhnd/cores/chipc/chipc.c b/sys/dev/bhnd/cores/chipc/chipc.c
index f48fe6d..eac1dcb 100644
--- a/sys/dev/bhnd/cores/chipc/chipc.c
+++ b/sys/dev/bhnd/cores/chipc/chipc.c
@@ -306,4 +306,5 @@ static device_method_t chipc_methods[] = {
DEFINE_CLASS_0(bhnd_chipc, chipc_driver, chipc_methods, sizeof(struct chipc_softc));
DRIVER_MODULE(bhnd_chipc, bhnd, chipc_driver, bhnd_chipc_devclass, 0, 0);
+MODULE_DEPEND(bhnd_chipc, bhnd, 1, 1, 1);
MODULE_VERSION(bhnd_chipc, 1);
diff --git a/sys/dev/bhnd/cores/pci/bhnd_pci.c b/sys/dev/bhnd/cores/pci/bhnd_pci.c
index 7488082..3b14ba2 100644
--- a/sys/dev/bhnd/cores/pci/bhnd_pci.c
+++ b/sys/dev/bhnd/cores/pci/bhnd_pci.c
@@ -543,6 +543,6 @@ static device_method_t bhnd_pci_methods[] = {
};
DEFINE_CLASS_0(bhnd_pci, bhnd_pci_driver, bhnd_pci_methods, sizeof(struct bhnd_pci_softc));
-
-MODULE_VERSION(bhnd_pci, 1);
+MODULE_DEPEND(bhnd_pci, bhnd, 1, 1, 1);
MODULE_DEPEND(bhnd_pci, pci, 1, 1, 1);
+MODULE_VERSION(bhnd_pci, 1);
diff --git a/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c b/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c
index cebe9bf..7d1cb9f 100644
--- a/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c
+++ b/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c
@@ -449,4 +449,5 @@ DEFINE_CLASS_1(bhnd_pci_hostb, bhnd_pci_hostb_driver, bhnd_pci_hostb_methods,
DRIVER_MODULE(bhnd_hostb, bhnd, bhnd_pci_hostb_driver, bhnd_hostb_devclass, 0, 0);
MODULE_VERSION(bhnd_pci_hostb, 1);
+MODULE_DEPEND(bhnd_pci_hostb, bhnd, 1, 1, 1);
MODULE_DEPEND(bhnd_pci_hostb, bhnd_pci, 1, 1, 1);
diff --git a/sys/dev/bhnd/cores/pci/bhnd_pcib.c b/sys/dev/bhnd/cores/pci/bhnd_pcib.c
index 53a9152..7549a0e 100644
--- a/sys/dev/bhnd/cores/pci/bhnd_pcib.c
+++ b/sys/dev/bhnd/cores/pci/bhnd_pcib.c
@@ -90,5 +90,6 @@ DEFINE_CLASS_1(bhnd_pcib, bhnd_pcib_driver, bhnd_pcib_methods, sizeof(struct bhn
DRIVER_MODULE(bhnd_pcib, bhnd, bhnd_pcib_driver, bhnd_hostb_devclass, 0, 0);
MODULE_VERSION(bhnd_pcib, 1);
+MODULE_DEPEND(bhnd_pcib, bhnd, 1, 1, 1);
+MODULE_DEPEND(bhnd_pcib, bhnd_pci, 1, 1, 1);
MODULE_DEPEND(bhnd_pcib, pci, 1, 1, 1);
-MODULE_DEPEND(bhnd_pcib, bhnd_pci_mdio, 1, 1, 1);
diff --git a/sys/dev/bhnd/siba/siba.c b/sys/dev/bhnd/siba/siba.c
index 9e837e3f..4e0c34a 100644
--- a/sys/dev/bhnd/siba/siba.c
+++ b/sys/dev/bhnd/siba/siba.c
@@ -420,7 +420,7 @@ siba_register_addrspaces(device_t dev, struct siba_devinfo *di,
/* Region numbers must be assigned in order, but our siba address
* space IDs may be sparsely allocated; thus, we track
- * the region index seperately. */
+ * the region index separately. */
region_num = 0;
/* Register the device address space entries */
diff --git a/sys/dev/bhnd/siba/siba_bhndb.c b/sys/dev/bhnd/siba/siba_bhndb.c
index 3628c68..0e348b6 100644
--- a/sys/dev/bhnd/siba/siba_bhndb.c
+++ b/sys/dev/bhnd/siba/siba_bhndb.c
@@ -179,4 +179,5 @@ DRIVER_MODULE(siba_bhndb, bhndb, siba_bhndb_driver, bhnd_devclass, NULL, NULL);
MODULE_VERSION(siba_bhndb, 1);
MODULE_DEPEND(siba_bhndb, siba, 1, 1, 1);
-MODULE_DEPEND(siba_bhndb, bhndb, 1, 1, 1); \ No newline at end of file
+MODULE_DEPEND(siba_bhndb, bhnd, 1, 1, 1);
+MODULE_DEPEND(siba_bhndb, bhndb, 1, 1, 1);
diff --git a/sys/dev/bhnd/siba/siba_subr.c b/sys/dev/bhnd/siba/siba_subr.c
index 5e9b028..555c603 100644
--- a/sys/dev/bhnd/siba/siba_subr.c
+++ b/sys/dev/bhnd/siba/siba_subr.c
@@ -337,7 +337,7 @@ siba_admatch_offset(uint8_t addrspace)
* @param[out] size The parsed size.
*
* @retval 0 success
- * @retval non-zero a parse error occured.
+ * @retval non-zero a parse error occurred.
*/
int
siba_parse_admatch(uint32_t am, uint32_t *addr, uint32_t *size)
diff --git a/sys/dev/bktr/CHANGELOG.TXT b/sys/dev/bktr/CHANGELOG.TXT
index 5cd1929..bead697 100644
--- a/sys/dev/bktr/CHANGELOG.TXT
+++ b/sys/dev/bktr/CHANGELOG.TXT
@@ -356,7 +356,7 @@
BSDI code removed. Will be restored later.
1.70 12 July 1999 Roger Hardiman <roger@freebsd.org>
- Reorganise OS device dependant parts (based on a port to
+ Reorganise OS device dependent parts (based on a port to
linux by Brad Parker).
Make the driver compile on FreeBSD 2.2.x systems again.
Change number of VBI lines from 16 to 12 for NTSC formats.
@@ -368,7 +368,7 @@
Matt Brown <matt@dqc.org> added MSP3430G DBX initialisation.
1.71 30 Aug 1999 Roger Hardiman <roger@freebsd.org>
- Small cleanup of OS dependant code. Remove NPCI usage.
+ Small cleanup of OS dependent code. Remove NPCI usage.
Fix bug in AVerMedia detection.
Update VBI support for the AleVT Teletext package. Parts
from Juha Nurmela's driver <Juha.Nurmela@quicknet.inet.fi>
diff --git a/sys/dev/bktr/bktr_audio.c b/sys/dev/bktr/bktr_audio.c
index 6cfe576..ea2b458 100644
--- a/sys/dev/bktr/bktr_audio.c
+++ b/sys/dev/bktr/bktr_audio.c
@@ -132,7 +132,7 @@ set_audio( bktr_ptr_t bktr, int cmd )
else
#endif /* AUDIOMUX_DISCOVER */
- /* check for existance of audio MUXes */
+ /* check for existence of audio MUXes */
if ( !bktr->card.audiomuxs[ 4 ] )
return( -1 );
@@ -308,7 +308,7 @@ init_BTSC( bktr_ptr_t bktr )
/*
* setup the dbx chip
- * XXX FIXME: alot of work to be done here, this merely unmutes it.
+ * XXX FIXME: a lot of work to be done here, this merely unmutes it.
*/
int
set_BTSC( bktr_ptr_t bktr, int control )
@@ -471,7 +471,7 @@ void msp_read_id( bktr_ptr_t bktr ){
* For the MSP3430G, we use fast autodetect mode
* For the MSP3410/3415 there are two schemes for this
* a) Fast autodetection - the chip is put into autodetect mode, and the function
- * returns immediatly. This works in most cases and is the Default Mode.
+ * returns immediately. This works in most cases and is the Default Mode.
* b) Slow mode. The function sets the MSP3410/3415 chip, then waits for feedback from
* the chip and re-programs it if needed.
*/
@@ -561,7 +561,7 @@ void msp_autodetect( bktr_ptr_t bktr ) {
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0020);/* Loudspeaker set stereo*/
/*
set spatial effect strength to 50% enlargement
- set spatial effect mode b, stereo basewidth enlargment only
+ set spatial effect mode b, stereo basewidth enlargement only
*/
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x3f28);
} else if (stereo > 0x8000) { /* bilingual mode */
@@ -573,7 +573,7 @@ void msp_autodetect( bktr_ptr_t bktr ) {
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0030);/* Loudspeaker */
/*
set spatial effect strength to 50% enlargement
- set spatial effect mode a, stereo basewidth enlargment
+ set spatial effect mode a, stereo basewidth enlargement
and pseudo stereo effect with automatic high-pass filter
*/
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x3f08);
diff --git a/sys/dev/bktr/bktr_card.c b/sys/dev/bktr/bktr_card.c
index e59ebbe..be76fb3 100644
--- a/sys/dev/bktr/bktr_card.c
+++ b/sys/dev/bktr/bktr_card.c
@@ -1217,7 +1217,7 @@ checkTuner:
} /* end switch(card) */
- /* At this point, a goto checkDBX has not occured */
+ /* At this point, a goto checkDBX has not occurred */
/* We have not been able to select a Tuner */
/* Some cards make use of the tuner address to */
/* identify the make/model of tuner */
diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c
index 67f3ab1..e069778 100644
--- a/sys/dev/bktr/bktr_core.c
+++ b/sys/dev/bktr/bktr_core.c
@@ -256,7 +256,7 @@ typedef u_char bool_t;
*/
#define MAX_VBI_LINES 16 /* Maximum for all vidoe formats */
-#define VBI_LINE_SIZE 2048 /* Store upto 2048 bytes per line */
+#define VBI_LINE_SIZE 2048 /* Store up to 2048 bytes per line */
#define VBI_BUFFER_ITEMS 20 /* Number of frames we buffer */
#define VBI_DATA_SIZE (VBI_LINE_SIZE * MAX_VBI_LINES * 2)
#define VBI_BUFFER_SIZE (VBI_DATA_SIZE * VBI_BUFFER_ITEMS)
@@ -626,7 +626,7 @@ bktr_store_address(unit, BKTR_MEM_BUF, buf);
init_audio_devices( bktr );
#ifdef BKTR_NEW_MSP34XX_DRIVER
- /* setup the kenrel thread */
+ /* setup the kernel thread */
err = msp_attach( bktr );
if ( err != 0 ) /* error doing kernel thread stuff, disable msp3400c */
bktr->card.msp3400c = 0;
@@ -1786,7 +1786,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thr
&& bktr->video.addr == 0) {
/*****************************/
-/* *** OS Dependant code *** */
+/* *** OS Dependent code *** */
/*****************************/
#if defined(__NetBSD__) || defined(__OpenBSD__)
bus_dmamap_t dmamap;
@@ -2369,7 +2369,7 @@ common_ioctl( bktr_ptr_t bktr, ioctl_cmd_t cmd, caddr_t arg )
/* Tuner is MUX0, RCA is MUX1, S-Video is MUX2 */
/* On the Hauppauge bt878 boards, */
/* Tuner is MUX0, RCA is MUX3 */
- /* Unfortunatly Meteor driver codes DEV_RCA as DEV_0, so we */
+ /* Unfortunately Meteor driver codes DEV_RCA as DEV_0, so we */
/* stick with this system in our Meteor Emulation */
switch(*(unsigned long *)arg & METEOR_DEV_MASK) {
diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c
index e8c0f7b..aa41454 100644
--- a/sys/dev/bktr/bktr_os.c
+++ b/sys/dev/bktr/bktr_os.c
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
- * bktr_os : This has all the Operating System dependant code,
+ * bktr_os : This has all the Operating System dependent code,
* probe/attach and open/close/ioctl/read/mmap
* memory allocation
* PCI bus interfacing
@@ -395,12 +395,12 @@ bktr_attach( device_t dev )
fun = fun | 1; /* Enable writes to the sub-system vendor ID */
#if defined( BKTR_430_FX_MODE )
- if (bootverbose) printf("Using 430 FX chipset compatibilty mode\n");
+ if (bootverbose) printf("Using 430 FX chipset compatibility mode\n");
fun = fun | 2; /* Enable Intel 430 FX compatibility mode */
#endif
#if defined( BKTR_SIS_VIA_MODE )
- if (bootverbose) printf("Using SiS/VIA chipset compatibilty mode\n");
+ if (bootverbose) printf("Using SiS/VIA chipset compatibility mode\n");
fun = fun | 4; /* Enable SiS/VIA compatibility mode (useful for
OPTi chipset motherboards too */
#endif
diff --git a/sys/dev/bktr/bktr_os.h b/sys/dev/bktr/bktr_os.h
index 1cd708d..6456616 100644
--- a/sys/dev/bktr/bktr_os.h
+++ b/sys/dev/bktr/bktr_os.h
@@ -6,7 +6,7 @@
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
- * bktr_os : This has all the Operating System dependant code.
+ * bktr_os : This has all the Operating System dependent code.
*
*/
diff --git a/sys/dev/bktr/msp34xx.c b/sys/dev/bktr/msp34xx.c
index 65cf0e1..8c45e67 100644
--- a/sys/dev/bktr/msp34xx.c
+++ b/sys/dev/bktr/msp34xx.c
@@ -39,7 +39,7 @@
*
* FM-Mono
* should work. The stereo modes are backward compatible to FM-mono,
- * therefore FM-Mono should be allways available.
+ * therefore FM-Mono should be always available.
*
* FM-Stereo (B/G, used in germany)
* should work, with autodetect
@@ -226,7 +226,7 @@ static struct MSP_INIT_DATA_DEM {
MSP_CARRIER(10.7), MSP_CARRIER(10.7),
0x00d0, 0x0480, 0x0020, 0x3000 },
- /* Terrestial FM-mono + FM-stereo */
+ /* Terrestrial FM-mono + FM-stereo */
{ { 3, 18, 27, 48, 66, 72 }, { 3, 18, 27, 48, 66, 72 },
MSP_CARRIER(5.5), MSP_CARRIER(5.5),
0x00d0, 0x0480, 0x0030, 0x3000},
diff --git a/sys/dev/buslogic/bt.c b/sys/dev/buslogic/bt.c
index 5276051..b0a0d91 100644
--- a/sys/dev/buslogic/bt.c
+++ b/sys/dev/buslogic/bt.c
@@ -1578,7 +1578,7 @@ btdone(struct bt_softc *bt, struct bt_ccb *bccb, bt_mbi_comp_code_t comp_code)
struct ccb_hdr *ccb_h;
cam_status error;
- /* Notify all clients that a BDR occured */
+ /* Notify all clients that a BDR occurred */
error = xpt_create_path(&path, /*periph*/NULL,
cam_sim_path(bt->sim),
bccb->hccb.target_id,
@@ -1624,12 +1624,12 @@ btdone(struct bt_softc *bt, struct bt_ccb *bccb, bt_mbi_comp_code_t comp_code)
case BMBI_ABORT:
case BMBI_ERROR:
if (bootverbose) {
- printf("bt: ccb %p - error %x occured. "
+ printf("bt: ccb %p - error %x occurred. "
"btstat = %x, sdstat = %x\n",
(void *)bccb, comp_code, bccb->hccb.btstat,
bccb->hccb.sdstat);
}
- /* An error occured */
+ /* An error occurred */
switch(bccb->hccb.btstat) {
case BTSTAT_DATARUN_ERROR:
if (bccb->hccb.data_len == 0) {
@@ -2317,7 +2317,7 @@ bttimeout(void *arg)
* means that the driver attempts to clear only one error
* condition at a time. In general, timeouts that occur
* close together are related anyway, so there is no benefit
- * in attempting to handle errors in parrallel. Timeouts will
+ * in attempting to handle errors in parallel. Timeouts will
* be reinstated when the recovery process ends.
*/
if ((bccb->flags & BCCB_DEVICE_RESET) == 0) {
diff --git a/sys/dev/buslogic/bt_eisa.c b/sys/dev/buslogic/bt_eisa.c
index 6a61d7a..e68d2f7 100644
--- a/sys/dev/buslogic/bt_eisa.c
+++ b/sys/dev/buslogic/bt_eisa.c
@@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
#define EISA_IRQ_TYPE 0x08D
#define LEVEL 0x40
-/* Definitions for the AMI Series 48 controler */
+/* Definitions for the AMI Series 48 controller */
#define AMI_EISA_IOSIZE 0x500 /* Two separate ranges?? */
#define AMI_EISA_SLOT_OFFSET 0x800
#define AMI_EISA_IOCONF 0x000
diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c
index 00e89f3..45706e8 100644
--- a/sys/dev/bwi/if_bwi.c
+++ b/sys/dev/bwi/if_bwi.c
@@ -356,7 +356,7 @@ bwi_attach(struct bwi_softc *sc)
device_t dev = sc->sc_dev;
struct bwi_mac *mac;
struct bwi_phy *phy;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int i, error;
BWI_LOCK_INIT(sc);
@@ -3747,7 +3747,7 @@ bwi_rx_radiotap(struct bwi_softc *sc, struct mbuf *m,
if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED)
sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_WEP;
- sc->sc_rx_th.wr_tsf = hdr->rxh_tsf; /* No endian convertion */
+ sc->sc_rx_th.wr_tsf = hdr->rxh_tsf; /* No endian conversion */
sc->sc_rx_th.wr_rate = rate;
sc->sc_rx_th.wr_antsignal = rssi;
sc->sc_rx_th.wr_antnoise = noise;
diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c
index 644bb2d..de1bf71 100644
--- a/sys/dev/bwn/if_bwn.c
+++ b/sys/dev/bwn/if_bwn.c
@@ -75,6 +75,11 @@ __FBSDID("$FreeBSD$");
#include <dev/bwn/if_bwnreg.h>
#include <dev/bwn/if_bwnvar.h>
+#include <dev/bwn/if_bwn_debug.h>
+#include <dev/bwn/if_bwn_misc.h>
+#include <dev/bwn/if_bwn_phy_g.h>
+#include <dev/bwn/if_bwn_phy_lp.h>
+
static SYSCTL_NODE(_hw, OID_AUTO, bwn, CTLFLAG_RD, 0,
"Broadcom driver parameters");
@@ -86,33 +91,6 @@ static SYSCTL_NODE(_hw, OID_AUTO, bwn, CTLFLAG_RD, 0,
static int bwn_debug = 0;
SYSCTL_INT(_hw_bwn, OID_AUTO, debug, CTLFLAG_RWTUN, &bwn_debug, 0,
"Broadcom debugging printfs");
-enum {
- BWN_DEBUG_XMIT = 0x00000001, /* basic xmit operation */
- BWN_DEBUG_RECV = 0x00000002, /* basic recv operation */
- BWN_DEBUG_STATE = 0x00000004, /* 802.11 state transitions */
- BWN_DEBUG_TXPOW = 0x00000008, /* tx power processing */
- BWN_DEBUG_RESET = 0x00000010, /* reset processing */
- BWN_DEBUG_OPS = 0x00000020, /* bwn_ops processing */
- BWN_DEBUG_BEACON = 0x00000040, /* beacon handling */
- BWN_DEBUG_WATCHDOG = 0x00000080, /* watchdog timeout */
- BWN_DEBUG_INTR = 0x00000100, /* ISR */
- BWN_DEBUG_CALIBRATE = 0x00000200, /* periodic calibration */
- BWN_DEBUG_NODE = 0x00000400, /* node management */
- BWN_DEBUG_LED = 0x00000800, /* led management */
- BWN_DEBUG_CMD = 0x00001000, /* cmd submission */
- BWN_DEBUG_LO = 0x00002000, /* LO */
- BWN_DEBUG_FW = 0x00004000, /* firmware */
- BWN_DEBUG_WME = 0x00008000, /* WME */
- BWN_DEBUG_RF = 0x00010000, /* RF */
- BWN_DEBUG_FATAL = 0x80000000, /* fatal errors */
- BWN_DEBUG_ANY = 0xffffffff
-};
-#define DPRINTF(sc, m, fmt, ...) do { \
- if (sc->sc_debug & (m)) \
- printf(fmt, __VA_ARGS__); \
-} while (0)
-#else
-#define DPRINTF(sc, m, fmt, ...) do { (void) sc; } while (0)
#endif
static int bwn_bfp = 0; /* use "Bad Frames Preemption" */
@@ -142,40 +120,9 @@ static void bwn_parent(struct ieee80211com *);
static void bwn_start(struct bwn_softc *);
static int bwn_transmit(struct ieee80211com *, struct mbuf *);
static int bwn_attach_core(struct bwn_mac *);
-static void bwn_reset_core(struct bwn_mac *, uint32_t);
static int bwn_phy_getinfo(struct bwn_mac *, int);
static int bwn_chiptest(struct bwn_mac *);
static int bwn_setup_channels(struct bwn_mac *, int, int);
-static int bwn_phy_g_attach(struct bwn_mac *);
-static void bwn_phy_g_detach(struct bwn_mac *);
-static void bwn_phy_g_init_pre(struct bwn_mac *);
-static int bwn_phy_g_prepare_hw(struct bwn_mac *);
-static int bwn_phy_g_init(struct bwn_mac *);
-static void bwn_phy_g_exit(struct bwn_mac *);
-static uint16_t bwn_phy_g_read(struct bwn_mac *, uint16_t);
-static void bwn_phy_g_write(struct bwn_mac *, uint16_t,
- uint16_t);
-static uint16_t bwn_phy_g_rf_read(struct bwn_mac *, uint16_t);
-static void bwn_phy_g_rf_write(struct bwn_mac *, uint16_t,
- uint16_t);
-static int bwn_phy_g_hwpctl(struct bwn_mac *);
-static void bwn_phy_g_rf_onoff(struct bwn_mac *, int);
-static int bwn_phy_g_switch_channel(struct bwn_mac *, uint32_t);
-static uint32_t bwn_phy_g_get_default_chan(struct bwn_mac *);
-static void bwn_phy_g_set_antenna(struct bwn_mac *, int);
-static int bwn_phy_g_im(struct bwn_mac *, int);
-static int bwn_phy_g_recalc_txpwr(struct bwn_mac *, int);
-static void bwn_phy_g_set_txpwr(struct bwn_mac *);
-static void bwn_phy_g_task_15s(struct bwn_mac *);
-static void bwn_phy_g_task_60s(struct bwn_mac *);
-static uint16_t bwn_phy_g_txctl(struct bwn_mac *);
-static void bwn_phy_switch_analog(struct bwn_mac *, int);
-static uint16_t bwn_shm_read_2(struct bwn_mac *, uint16_t, uint16_t);
-static void bwn_shm_write_2(struct bwn_mac *, uint16_t, uint16_t,
- uint16_t);
-static uint32_t bwn_shm_read_4(struct bwn_mac *, uint16_t, uint16_t);
-static void bwn_shm_write_4(struct bwn_mac *, uint16_t, uint16_t,
- uint32_t);
static void bwn_shm_ctlword(struct bwn_mac *, uint16_t,
uint16_t);
static void bwn_addchannels(struct ieee80211_channel [], int, int *,
@@ -204,8 +151,6 @@ static void bwn_core_start(struct bwn_mac *);
static void bwn_core_exit(struct bwn_mac *);
static void bwn_bt_disable(struct bwn_mac *);
static int bwn_chip_init(struct bwn_mac *);
-static uint64_t bwn_hf_read(struct bwn_mac *);
-static void bwn_hf_write(struct bwn_mac *, uint64_t);
static void bwn_set_txretry(struct bwn_mac *, int, int);
static void bwn_rate_init(struct bwn_mac *);
static void bwn_set_phytxctl(struct bwn_mac *);
@@ -320,49 +265,6 @@ static struct bwn_dma_ring *bwn_dma_ringsetup(struct bwn_mac *,
static struct bwn_dma_ring *bwn_dma_parse_cookie(struct bwn_mac *,
const struct bwn_txstatus *, uint16_t, int *);
static void bwn_dma_free(struct bwn_mac *);
-static void bwn_phy_g_init_sub(struct bwn_mac *);
-static uint8_t bwn_has_hwpctl(struct bwn_mac *);
-static void bwn_phy_init_b5(struct bwn_mac *);
-static void bwn_phy_init_b6(struct bwn_mac *);
-static void bwn_phy_init_a(struct bwn_mac *);
-static void bwn_loopback_calcgain(struct bwn_mac *);
-static uint16_t bwn_rf_init_bcm2050(struct bwn_mac *);
-static void bwn_lo_g_init(struct bwn_mac *);
-static void bwn_lo_g_adjust(struct bwn_mac *);
-static void bwn_lo_get_powervector(struct bwn_mac *);
-static struct bwn_lo_calib *bwn_lo_calibset(struct bwn_mac *,
- const struct bwn_bbatt *, const struct bwn_rfatt *);
-static void bwn_lo_write(struct bwn_mac *, struct bwn_loctl *);
-static void bwn_phy_hwpctl_init(struct bwn_mac *);
-static void bwn_phy_g_switch_chan(struct bwn_mac *, int, uint8_t);
-static void bwn_phy_g_set_txpwr_sub(struct bwn_mac *,
- const struct bwn_bbatt *, const struct bwn_rfatt *,
- uint8_t);
-static void bwn_phy_g_set_bbatt(struct bwn_mac *, uint16_t);
-static uint16_t bwn_rf_2050_rfoverval(struct bwn_mac *, uint16_t, uint32_t);
-static void bwn_spu_workaround(struct bwn_mac *, uint8_t);
-static void bwn_wa_init(struct bwn_mac *);
-static void bwn_ofdmtab_write_2(struct bwn_mac *, uint16_t, uint16_t,
- uint16_t);
-static void bwn_dummy_transmission(struct bwn_mac *, int, int);
-static void bwn_ofdmtab_write_4(struct bwn_mac *, uint16_t, uint16_t,
- uint32_t);
-static void bwn_gtab_write(struct bwn_mac *, uint16_t, uint16_t,
- uint16_t);
-static void bwn_ram_write(struct bwn_mac *, uint16_t, uint32_t);
-static void bwn_mac_suspend(struct bwn_mac *);
-static void bwn_mac_enable(struct bwn_mac *);
-static void bwn_psctl(struct bwn_mac *, uint32_t);
-static int16_t bwn_nrssi_read(struct bwn_mac *, uint16_t);
-static void bwn_nrssi_offset(struct bwn_mac *);
-static void bwn_nrssi_threshold(struct bwn_mac *);
-static void bwn_nrssi_slope_11g(struct bwn_mac *);
-static void bwn_set_all_gains(struct bwn_mac *, int16_t, int16_t,
- int16_t);
-static void bwn_set_original_gains(struct bwn_mac *);
-static void bwn_hwpctl_early_init(struct bwn_mac *);
-static void bwn_hwpctl_init_gphy(struct bwn_mac *);
-static uint16_t bwn_phy_g_chan2freq(uint8_t);
static int bwn_fw_gets(struct bwn_mac *, enum bwn_fwtype);
static int bwn_fw_get(struct bwn_mac *, enum bwn_fwtype,
const char *, struct bwn_fwfile *);
@@ -371,7 +273,6 @@ static void bwn_do_release_fw(struct bwn_fwfile *);
static uint16_t bwn_fwcaps_read(struct bwn_mac *);
static int bwn_fwinitvals_write(struct bwn_mac *,
const struct bwn_fwinitvals *, size_t, size_t);
-static int bwn_switch_channel(struct bwn_mac *, int);
static uint16_t bwn_ant2phy(int);
static void bwn_mac_write_bssid(struct bwn_mac *);
static void bwn_mac_setfilter(struct bwn_mac *, uint16_t,
@@ -419,12 +320,6 @@ static void bwn_plcp_genhdr(struct bwn_plcp4 *, const uint16_t,
const uint8_t);
static uint8_t bwn_antenna_sanitize(struct bwn_mac *, uint8_t);
static uint8_t bwn_get_fbrate(uint8_t);
-static int bwn_phy_shm_tssi_read(struct bwn_mac *, uint16_t);
-static void bwn_phy_g_setatt(struct bwn_mac *, int *, int *);
-static void bwn_phy_lock(struct bwn_mac *);
-static void bwn_phy_unlock(struct bwn_mac *);
-static void bwn_rf_lock(struct bwn_mac *);
-static void bwn_rf_unlock(struct bwn_mac *);
static void bwn_txpwr(void *, int);
static void bwn_tasks(void *);
static void bwn_task_15s(struct bwn_mac *);
@@ -437,7 +332,6 @@ static void bwn_rx_radiotap(struct bwn_mac *, struct mbuf *,
const struct bwn_rxhdr4 *, struct bwn_plcp6 *, int,
int, int);
static void bwn_tsf_read(struct bwn_mac *, uint64_t *);
-static void bwn_phy_g_dc_lookup_init(struct bwn_mac *, uint8_t);
static void bwn_set_slot_time(struct bwn_mac *, uint16_t);
static void bwn_watchdog(void *);
static void bwn_dma_stop(struct bwn_mac *);
@@ -452,84 +346,6 @@ static void bwn_led_blink_end(void *);
static void bwn_rfswitch(void *);
static void bwn_rf_turnon(struct bwn_mac *);
static void bwn_rf_turnoff(struct bwn_mac *);
-static void bwn_phy_lp_init_pre(struct bwn_mac *);
-static int bwn_phy_lp_init(struct bwn_mac *);
-static uint16_t bwn_phy_lp_read(struct bwn_mac *, uint16_t);
-static void bwn_phy_lp_write(struct bwn_mac *, uint16_t, uint16_t);
-static void bwn_phy_lp_maskset(struct bwn_mac *, uint16_t, uint16_t,
- uint16_t);
-static uint16_t bwn_phy_lp_rf_read(struct bwn_mac *, uint16_t);
-static void bwn_phy_lp_rf_write(struct bwn_mac *, uint16_t, uint16_t);
-static void bwn_phy_lp_rf_onoff(struct bwn_mac *, int);
-static int bwn_phy_lp_switch_channel(struct bwn_mac *, uint32_t);
-static uint32_t bwn_phy_lp_get_default_chan(struct bwn_mac *);
-static void bwn_phy_lp_set_antenna(struct bwn_mac *, int);
-static void bwn_phy_lp_task_60s(struct bwn_mac *);
-static void bwn_phy_lp_readsprom(struct bwn_mac *);
-static void bwn_phy_lp_bbinit(struct bwn_mac *);
-static void bwn_phy_lp_txpctl_init(struct bwn_mac *);
-static void bwn_phy_lp_calib(struct bwn_mac *);
-static void bwn_phy_lp_switch_analog(struct bwn_mac *, int);
-static int bwn_phy_lp_b2062_switch_channel(struct bwn_mac *, uint8_t);
-static int bwn_phy_lp_b2063_switch_channel(struct bwn_mac *, uint8_t);
-static void bwn_phy_lp_set_anafilter(struct bwn_mac *, uint8_t);
-static void bwn_phy_lp_set_gaintbl(struct bwn_mac *, uint32_t);
-static void bwn_phy_lp_digflt_save(struct bwn_mac *);
-static void bwn_phy_lp_get_txpctlmode(struct bwn_mac *);
-static void bwn_phy_lp_set_txpctlmode(struct bwn_mac *, uint8_t);
-static void bwn_phy_lp_bugfix(struct bwn_mac *);
-static void bwn_phy_lp_digflt_restore(struct bwn_mac *);
-static void bwn_phy_lp_tblinit(struct bwn_mac *);
-static void bwn_phy_lp_bbinit_r2(struct bwn_mac *);
-static void bwn_phy_lp_bbinit_r01(struct bwn_mac *);
-static void bwn_phy_lp_b2062_init(struct bwn_mac *);
-static void bwn_phy_lp_b2063_init(struct bwn_mac *);
-static void bwn_phy_lp_rxcal_r2(struct bwn_mac *);
-static void bwn_phy_lp_rccal_r12(struct bwn_mac *);
-static void bwn_phy_lp_set_rccap(struct bwn_mac *);
-static uint32_t bwn_phy_lp_roundup(uint32_t, uint32_t, uint8_t);
-static void bwn_phy_lp_b2062_reset_pllbias(struct bwn_mac *);
-static void bwn_phy_lp_b2062_vco_calib(struct bwn_mac *);
-static void bwn_tab_write_multi(struct bwn_mac *, uint32_t, int,
- const void *);
-static void bwn_tab_read_multi(struct bwn_mac *, uint32_t, int, void *);
-static struct bwn_txgain
- bwn_phy_lp_get_txgain(struct bwn_mac *);
-static uint8_t bwn_phy_lp_get_bbmult(struct bwn_mac *);
-static void bwn_phy_lp_set_txgain(struct bwn_mac *, struct bwn_txgain *);
-static void bwn_phy_lp_set_bbmult(struct bwn_mac *, uint8_t);
-static void bwn_phy_lp_set_trsw_over(struct bwn_mac *, uint8_t, uint8_t);
-static void bwn_phy_lp_set_rxgain(struct bwn_mac *, uint32_t);
-static void bwn_phy_lp_set_deaf(struct bwn_mac *, uint8_t);
-static int bwn_phy_lp_calc_rx_iq_comp(struct bwn_mac *, uint16_t);
-static void bwn_phy_lp_clear_deaf(struct bwn_mac *, uint8_t);
-static void bwn_phy_lp_tblinit_r01(struct bwn_mac *);
-static void bwn_phy_lp_tblinit_r2(struct bwn_mac *);
-static void bwn_phy_lp_tblinit_txgain(struct bwn_mac *);
-static void bwn_tab_write(struct bwn_mac *, uint32_t, uint32_t);
-static void bwn_phy_lp_b2062_tblinit(struct bwn_mac *);
-static void bwn_phy_lp_b2063_tblinit(struct bwn_mac *);
-static int bwn_phy_lp_loopback(struct bwn_mac *);
-static void bwn_phy_lp_set_rxgain_idx(struct bwn_mac *, uint16_t);
-static void bwn_phy_lp_ddfs_turnon(struct bwn_mac *, int, int, int, int,
- int);
-static uint8_t bwn_phy_lp_rx_iq_est(struct bwn_mac *, uint16_t, uint8_t,
- struct bwn_phy_lp_iq_est *);
-static void bwn_phy_lp_ddfs_turnoff(struct bwn_mac *);
-static uint32_t bwn_tab_read(struct bwn_mac *, uint32_t);
-static void bwn_phy_lp_set_txgain_dac(struct bwn_mac *, uint16_t);
-static void bwn_phy_lp_set_txgain_pa(struct bwn_mac *, uint16_t);
-static void bwn_phy_lp_set_txgain_override(struct bwn_mac *);
-static uint16_t bwn_phy_lp_get_pa_gain(struct bwn_mac *);
-static uint8_t bwn_nbits(int32_t);
-static void bwn_phy_lp_gaintbl_write_multi(struct bwn_mac *, int, int,
- struct bwn_txgain_entry *);
-static void bwn_phy_lp_gaintbl_write(struct bwn_mac *, int,
- struct bwn_txgain_entry);
-static void bwn_phy_lp_gaintbl_write_r2(struct bwn_mac *, int,
- struct bwn_txgain_entry);
-static void bwn_phy_lp_gaintbl_write_r01(struct bwn_mac *, int,
- struct bwn_txgain_entry);
static void bwn_sysctl_node(struct bwn_softc *);
static struct resource_spec bwn_res_spec_legacy[] = {
@@ -612,238 +428,6 @@ static const struct bwn_channelinfo bwn_chantable_n = {
.nchannels = 110
};
-static const uint8_t bwn_b2063_chantable_data[33][12] = {
- { 0x6f, 0x3c, 0x3c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
- { 0x6f, 0x2c, 0x2c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
- { 0x6f, 0x1c, 0x1c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
- { 0x6e, 0x1c, 0x1c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
- { 0x6e, 0xc, 0xc, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
- { 0x6a, 0xc, 0xc, 0, 0x2, 0x5, 0xd, 0xd, 0x77, 0x80, 0x20, 0 },
- { 0x6a, 0xc, 0xc, 0, 0x1, 0x5, 0xd, 0xc, 0x77, 0x80, 0x20, 0 },
- { 0x6a, 0xc, 0xc, 0, 0x1, 0x4, 0xc, 0xc, 0x77, 0x80, 0x20, 0 },
- { 0x69, 0xc, 0xc, 0, 0x1, 0x4, 0xc, 0xc, 0x77, 0x70, 0x20, 0 },
- { 0x69, 0xc, 0xc, 0, 0x1, 0x4, 0xb, 0xc, 0x77, 0x70, 0x20, 0 },
- { 0x69, 0xc, 0xc, 0, 0, 0x4, 0xb, 0xb, 0x77, 0x60, 0x20, 0 },
- { 0x69, 0xc, 0xc, 0, 0, 0x3, 0xa, 0xb, 0x77, 0x60, 0x20, 0 },
- { 0x69, 0xc, 0xc, 0, 0, 0x3, 0xa, 0xa, 0x77, 0x60, 0x20, 0 },
- { 0x68, 0xc, 0xc, 0, 0, 0x2, 0x9, 0x9, 0x77, 0x60, 0x20, 0 },
- { 0x68, 0xc, 0xc, 0, 0, 0x1, 0x8, 0x8, 0x77, 0x50, 0x10, 0 },
- { 0x67, 0xc, 0xc, 0, 0, 0, 0x8, 0x8, 0x77, 0x50, 0x10, 0 },
- { 0x64, 0xc, 0xc, 0, 0, 0, 0x2, 0x1, 0x77, 0x20, 0, 0 },
- { 0x64, 0xc, 0xc, 0, 0, 0, 0x1, 0x1, 0x77, 0x20, 0, 0 },
- { 0x63, 0xc, 0xc, 0, 0, 0, 0x1, 0, 0x77, 0x10, 0, 0 },
- { 0x63, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0x10, 0, 0 },
- { 0x62, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0x10, 0, 0 },
- { 0x62, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
- { 0x61, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
- { 0x60, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
- { 0x6e, 0xc, 0xc, 0, 0x9, 0xe, 0xf, 0xf, 0x77, 0xc0, 0x50, 0 },
- { 0x6e, 0xc, 0xc, 0, 0x9, 0xd, 0xf, 0xf, 0x77, 0xb0, 0x50, 0 },
- { 0x6e, 0xc, 0xc, 0, 0x8, 0xc, 0xf, 0xf, 0x77, 0xb0, 0x50, 0 },
- { 0x6d, 0xc, 0xc, 0, 0x8, 0xc, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
- { 0x6d, 0xc, 0xc, 0, 0x8, 0xb, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
- { 0x6d, 0xc, 0xc, 0, 0x8, 0xa, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
- { 0x6c, 0xc, 0xc, 0, 0x7, 0x9, 0xf, 0xf, 0x77, 0x90, 0x40, 0 },
- { 0x6c, 0xc, 0xc, 0, 0x6, 0x8, 0xf, 0xf, 0x77, 0x90, 0x40, 0 },
- { 0x6c, 0xc, 0xc, 0, 0x5, 0x8, 0xf, 0xf, 0x77, 0x90, 0x40, 0 }
-};
-
-static const struct bwn_b206x_chan bwn_b2063_chantable[] = {
- { 1, 2412, bwn_b2063_chantable_data[0] },
- { 2, 2417, bwn_b2063_chantable_data[0] },
- { 3, 2422, bwn_b2063_chantable_data[0] },
- { 4, 2427, bwn_b2063_chantable_data[1] },
- { 5, 2432, bwn_b2063_chantable_data[1] },
- { 6, 2437, bwn_b2063_chantable_data[1] },
- { 7, 2442, bwn_b2063_chantable_data[1] },
- { 8, 2447, bwn_b2063_chantable_data[1] },
- { 9, 2452, bwn_b2063_chantable_data[2] },
- { 10, 2457, bwn_b2063_chantable_data[2] },
- { 11, 2462, bwn_b2063_chantable_data[3] },
- { 12, 2467, bwn_b2063_chantable_data[3] },
- { 13, 2472, bwn_b2063_chantable_data[3] },
- { 14, 2484, bwn_b2063_chantable_data[4] },
- { 34, 5170, bwn_b2063_chantable_data[5] },
- { 36, 5180, bwn_b2063_chantable_data[6] },
- { 38, 5190, bwn_b2063_chantable_data[7] },
- { 40, 5200, bwn_b2063_chantable_data[8] },
- { 42, 5210, bwn_b2063_chantable_data[9] },
- { 44, 5220, bwn_b2063_chantable_data[10] },
- { 46, 5230, bwn_b2063_chantable_data[11] },
- { 48, 5240, bwn_b2063_chantable_data[12] },
- { 52, 5260, bwn_b2063_chantable_data[13] },
- { 56, 5280, bwn_b2063_chantable_data[14] },
- { 60, 5300, bwn_b2063_chantable_data[14] },
- { 64, 5320, bwn_b2063_chantable_data[15] },
- { 100, 5500, bwn_b2063_chantable_data[16] },
- { 104, 5520, bwn_b2063_chantable_data[17] },
- { 108, 5540, bwn_b2063_chantable_data[18] },
- { 112, 5560, bwn_b2063_chantable_data[19] },
- { 116, 5580, bwn_b2063_chantable_data[20] },
- { 120, 5600, bwn_b2063_chantable_data[21] },
- { 124, 5620, bwn_b2063_chantable_data[21] },
- { 128, 5640, bwn_b2063_chantable_data[22] },
- { 132, 5660, bwn_b2063_chantable_data[22] },
- { 136, 5680, bwn_b2063_chantable_data[22] },
- { 140, 5700, bwn_b2063_chantable_data[23] },
- { 149, 5745, bwn_b2063_chantable_data[23] },
- { 153, 5765, bwn_b2063_chantable_data[23] },
- { 157, 5785, bwn_b2063_chantable_data[23] },
- { 161, 5805, bwn_b2063_chantable_data[23] },
- { 165, 5825, bwn_b2063_chantable_data[23] },
- { 184, 4920, bwn_b2063_chantable_data[24] },
- { 188, 4940, bwn_b2063_chantable_data[25] },
- { 192, 4960, bwn_b2063_chantable_data[26] },
- { 196, 4980, bwn_b2063_chantable_data[27] },
- { 200, 5000, bwn_b2063_chantable_data[28] },
- { 204, 5020, bwn_b2063_chantable_data[29] },
- { 208, 5040, bwn_b2063_chantable_data[30] },
- { 212, 5060, bwn_b2063_chantable_data[31] },
- { 216, 5080, bwn_b2063_chantable_data[32] }
-};
-
-static const uint8_t bwn_b2062_chantable_data[22][12] = {
- { 0xff, 0xff, 0xb5, 0x1b, 0x24, 0x32, 0x32, 0x88, 0x88, 0, 0, 0 },
- { 0, 0x22, 0x20, 0x84, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0x11, 0x10, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0x11, 0x20, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0x11, 0x10, 0x84, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0x11, 0, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0x63, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0x62, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0x30, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0x20, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0x10, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
- { 0, 0, 0, 0, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
- { 0x55, 0x77, 0x90, 0xf7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x44, 0x77, 0x80, 0xe7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x44, 0x66, 0x80, 0xe7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x33, 0x66, 0x70, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x22, 0x55, 0x60, 0xd7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x22, 0x55, 0x60, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x22, 0x44, 0x50, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
- { 0x11, 0x44, 0x50, 0xa5, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
- { 0, 0x44, 0x40, 0xb6, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 }
-};
-
-static const struct bwn_b206x_chan bwn_b2062_chantable[] = {
- { 1, 2412, bwn_b2062_chantable_data[0] },
- { 2, 2417, bwn_b2062_chantable_data[0] },
- { 3, 2422, bwn_b2062_chantable_data[0] },
- { 4, 2427, bwn_b2062_chantable_data[0] },
- { 5, 2432, bwn_b2062_chantable_data[0] },
- { 6, 2437, bwn_b2062_chantable_data[0] },
- { 7, 2442, bwn_b2062_chantable_data[0] },
- { 8, 2447, bwn_b2062_chantable_data[0] },
- { 9, 2452, bwn_b2062_chantable_data[0] },
- { 10, 2457, bwn_b2062_chantable_data[0] },
- { 11, 2462, bwn_b2062_chantable_data[0] },
- { 12, 2467, bwn_b2062_chantable_data[0] },
- { 13, 2472, bwn_b2062_chantable_data[0] },
- { 14, 2484, bwn_b2062_chantable_data[0] },
- { 34, 5170, bwn_b2062_chantable_data[1] },
- { 38, 5190, bwn_b2062_chantable_data[2] },
- { 42, 5210, bwn_b2062_chantable_data[2] },
- { 46, 5230, bwn_b2062_chantable_data[3] },
- { 36, 5180, bwn_b2062_chantable_data[4] },
- { 40, 5200, bwn_b2062_chantable_data[5] },
- { 44, 5220, bwn_b2062_chantable_data[6] },
- { 48, 5240, bwn_b2062_chantable_data[3] },
- { 52, 5260, bwn_b2062_chantable_data[3] },
- { 56, 5280, bwn_b2062_chantable_data[3] },
- { 60, 5300, bwn_b2062_chantable_data[7] },
- { 64, 5320, bwn_b2062_chantable_data[8] },
- { 100, 5500, bwn_b2062_chantable_data[9] },
- { 104, 5520, bwn_b2062_chantable_data[10] },
- { 108, 5540, bwn_b2062_chantable_data[10] },
- { 112, 5560, bwn_b2062_chantable_data[10] },
- { 116, 5580, bwn_b2062_chantable_data[11] },
- { 120, 5600, bwn_b2062_chantable_data[12] },
- { 124, 5620, bwn_b2062_chantable_data[12] },
- { 128, 5640, bwn_b2062_chantable_data[12] },
- { 132, 5660, bwn_b2062_chantable_data[12] },
- { 136, 5680, bwn_b2062_chantable_data[12] },
- { 140, 5700, bwn_b2062_chantable_data[12] },
- { 149, 5745, bwn_b2062_chantable_data[12] },
- { 153, 5765, bwn_b2062_chantable_data[12] },
- { 157, 5785, bwn_b2062_chantable_data[12] },
- { 161, 5805, bwn_b2062_chantable_data[12] },
- { 165, 5825, bwn_b2062_chantable_data[12] },
- { 184, 4920, bwn_b2062_chantable_data[13] },
- { 188, 4940, bwn_b2062_chantable_data[14] },
- { 192, 4960, bwn_b2062_chantable_data[15] },
- { 196, 4980, bwn_b2062_chantable_data[16] },
- { 200, 5000, bwn_b2062_chantable_data[17] },
- { 204, 5020, bwn_b2062_chantable_data[18] },
- { 208, 5040, bwn_b2062_chantable_data[19] },
- { 212, 5060, bwn_b2062_chantable_data[20] },
- { 216, 5080, bwn_b2062_chantable_data[21] }
-};
-
-/* for LP PHY */
-static const struct bwn_rxcompco bwn_rxcompco_5354[] = {
- { 1, -66, 15 }, { 2, -66, 15 }, { 3, -66, 15 }, { 4, -66, 15 },
- { 5, -66, 15 }, { 6, -66, 15 }, { 7, -66, 14 }, { 8, -66, 14 },
- { 9, -66, 14 }, { 10, -66, 14 }, { 11, -66, 14 }, { 12, -66, 13 },
- { 13, -66, 13 }, { 14, -66, 13 },
-};
-
-/* for LP PHY */
-static const struct bwn_rxcompco bwn_rxcompco_r12[] = {
- { 1, -64, 13 }, { 2, -64, 13 }, { 3, -64, 13 }, { 4, -64, 13 },
- { 5, -64, 12 }, { 6, -64, 12 }, { 7, -64, 12 }, { 8, -64, 12 },
- { 9, -64, 12 }, { 10, -64, 11 }, { 11, -64, 11 }, { 12, -64, 11 },
- { 13, -64, 11 }, { 14, -64, 10 }, { 34, -62, 24 }, { 38, -62, 24 },
- { 42, -62, 24 }, { 46, -62, 23 }, { 36, -62, 24 }, { 40, -62, 24 },
- { 44, -62, 23 }, { 48, -62, 23 }, { 52, -62, 23 }, { 56, -62, 22 },
- { 60, -62, 22 }, { 64, -62, 22 }, { 100, -62, 16 }, { 104, -62, 16 },
- { 108, -62, 15 }, { 112, -62, 14 }, { 116, -62, 14 }, { 120, -62, 13 },
- { 124, -62, 12 }, { 128, -62, 12 }, { 132, -62, 12 }, { 136, -62, 11 },
- { 140, -62, 10 }, { 149, -61, 9 }, { 153, -61, 9 }, { 157, -61, 9 },
- { 161, -61, 8 }, { 165, -61, 8 }, { 184, -62, 25 }, { 188, -62, 25 },
- { 192, -62, 25 }, { 196, -62, 25 }, { 200, -62, 25 }, { 204, -62, 25 },
- { 208, -62, 25 }, { 212, -62, 25 }, { 216, -62, 26 },
-};
-
-static const struct bwn_rxcompco bwn_rxcompco_r2 = { 0, -64, 0 };
-
-static const uint8_t bwn_tab_sigsq_tbl[] = {
- 0xde, 0xdc, 0xda, 0xd8, 0xd6, 0xd4, 0xd2, 0xcf, 0xcd,
- 0xca, 0xc7, 0xc4, 0xc1, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
- 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0x00,
- 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
- 0xbe, 0xbe, 0xbe, 0xbe, 0xc1, 0xc4, 0xc7, 0xca, 0xcd,
- 0xcf, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
-};
-
-static const uint8_t bwn_tab_pllfrac_tbl[] = {
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80,
- 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
-};
-
-static const uint16_t bwn_tabl_iqlocal_tbl[] = {
- 0x0200, 0x0300, 0x0400, 0x0600, 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002,
- 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0300, 0x0400, 0x0600,
- 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006,
- 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-};
-
-static const uint16_t bwn_tab_noise_g1[] = BWN_TAB_NOISE_G1;
-static const uint16_t bwn_tab_noise_g2[] = BWN_TAB_NOISE_G2;
-static const uint16_t bwn_tab_noisescale_g1[] = BWN_TAB_NOISESCALE_G1;
-static const uint16_t bwn_tab_noisescale_g2[] = BWN_TAB_NOISESCALE_G2;
-static const uint16_t bwn_tab_noisescale_g3[] = BWN_TAB_NOISESCALE_G3;
-const uint8_t bwn_bitrev_table[256] = BWN_BITREV_TABLE;
-
#define VENDOR_LED_ACT(vendor) \
{ \
.vid = PCI_VENDOR_##vendor, \
@@ -1665,7 +1249,7 @@ fail:
return (error);
}
-static void
+void
bwn_reset_core(struct bwn_mac *mac, uint32_t flags)
{
struct bwn_softc *sc = mac->mac_sc;
@@ -1835,7 +1419,7 @@ bwn_setup_channels(struct bwn_mac *mac, int have_bg, int have_a)
return (ic->ic_nchans == 0 ? ENXIO : 0);
}
-static uint32_t
+uint32_t
bwn_shm_read_4(struct bwn_mac *mac, uint16_t way, uint16_t offset)
{
uint32_t ret;
@@ -1861,7 +1445,7 @@ out:
return (ret);
}
-static uint16_t
+uint16_t
bwn_shm_read_2(struct bwn_mac *mac, uint16_t way, uint16_t offset)
{
uint16_t ret;
@@ -1897,7 +1481,7 @@ bwn_shm_ctlword(struct bwn_mac *mac, uint16_t way,
BWN_WRITE_4(mac, BWN_SHM_CONTROL, control);
}
-static void
+void
bwn_shm_write_4(struct bwn_mac *mac, uint16_t way, uint16_t offset,
uint32_t value)
{
@@ -1920,7 +1504,7 @@ bwn_shm_write_4(struct bwn_mac *mac, uint16_t way, uint16_t offset,
BWN_WRITE_4(mac, BWN_SHM_DATA, value);
}
-static void
+void
bwn_shm_write_2(struct bwn_mac *mac, uint16_t way, uint16_t offset,
uint16_t value)
{
@@ -2002,683 +1586,6 @@ bwn_addchannels(struct ieee80211_channel chans[], int maxchans, int *nchans,
}
static int
-bwn_phy_g_attach(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- unsigned int i;
- int16_t pab0, pab1, pab2;
- static int8_t bwn_phy_g_tssi2dbm_table[] = BWN_PHY_G_TSSI2DBM_TABLE;
- int8_t bg;
-
- bg = (int8_t)siba_sprom_get_tssi_bg(sc->sc_dev);
- pab0 = (int16_t)siba_sprom_get_pa0b0(sc->sc_dev);
- pab1 = (int16_t)siba_sprom_get_pa0b1(sc->sc_dev);
- pab2 = (int16_t)siba_sprom_get_pa0b2(sc->sc_dev);
-
- if ((siba_get_chipid(sc->sc_dev) == 0x4301) && (phy->rf_ver != 0x2050))
- device_printf(sc->sc_dev, "not supported anymore\n");
-
- pg->pg_flags = 0;
- if (pab0 == 0 || pab1 == 0 || pab2 == 0 || pab0 == -1 || pab1 == -1 ||
- pab2 == -1) {
- pg->pg_idletssi = 52;
- pg->pg_tssi2dbm = bwn_phy_g_tssi2dbm_table;
- return (0);
- }
-
- pg->pg_idletssi = (bg == 0 || bg == -1) ? 62 : bg;
- pg->pg_tssi2dbm = (uint8_t *)malloc(64, M_DEVBUF, M_NOWAIT | M_ZERO);
- if (pg->pg_tssi2dbm == NULL) {
- device_printf(sc->sc_dev, "failed to allocate buffer\n");
- return (ENOMEM);
- }
- for (i = 0; i < 64; i++) {
- int32_t m1, m2, f, q, delta;
- int8_t j = 0;
-
- m1 = BWN_TSSI2DBM(16 * pab0 + i * pab1, 32);
- m2 = MAX(BWN_TSSI2DBM(32768 + i * pab2, 256), 1);
- f = 256;
-
- do {
- if (j > 15) {
- device_printf(sc->sc_dev,
- "failed to generate tssi2dBm\n");
- free(pg->pg_tssi2dbm, M_DEVBUF);
- return (ENOMEM);
- }
- q = BWN_TSSI2DBM(f * 4096 - BWN_TSSI2DBM(m2 * f, 16) *
- f, 2048);
- delta = abs(q - f);
- f = q;
- j++;
- } while (delta >= 2);
-
- pg->pg_tssi2dbm[i] = MIN(MAX(BWN_TSSI2DBM(m1 * f, 8192), -127),
- 128);
- }
-
- pg->pg_flags |= BWN_PHY_G_FLAG_TSSITABLE_ALLOC;
- return (0);
-}
-
-static void
-bwn_phy_g_detach(struct bwn_mac *mac)
-{
- struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
-
- if (pg->pg_flags & BWN_PHY_G_FLAG_TSSITABLE_ALLOC) {
- free(pg->pg_tssi2dbm, M_DEVBUF);
- pg->pg_tssi2dbm = NULL;
- }
- pg->pg_flags = 0;
-}
-
-static void
-bwn_phy_g_init_pre(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- void *tssi2dbm;
- int idletssi;
- unsigned int i;
-
- tssi2dbm = pg->pg_tssi2dbm;
- idletssi = pg->pg_idletssi;
-
- memset(pg, 0, sizeof(*pg));
-
- pg->pg_tssi2dbm = tssi2dbm;
- pg->pg_idletssi = idletssi;
-
- memset(pg->pg_minlowsig, 0xff, sizeof(pg->pg_minlowsig));
-
- for (i = 0; i < N(pg->pg_nrssi); i++)
- pg->pg_nrssi[i] = -1000;
- for (i = 0; i < N(pg->pg_nrssi_lt); i++)
- pg->pg_nrssi_lt[i] = i;
- pg->pg_lofcal = 0xffff;
- pg->pg_initval = 0xffff;
- pg->pg_immode = BWN_IMMODE_NONE;
- pg->pg_ofdmtab_dir = BWN_OFDMTAB_DIR_UNKNOWN;
- pg->pg_avgtssi = 0xff;
-
- pg->pg_loctl.tx_bias = 0xff;
- TAILQ_INIT(&pg->pg_loctl.calib_list);
-}
-
-static int
-bwn_phy_g_prepare_hw(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- static const struct bwn_rfatt rfatt0[] = {
- { 3, 0 }, { 1, 0 }, { 5, 0 }, { 7, 0 }, { 9, 0 }, { 2, 0 },
- { 0, 0 }, { 4, 0 }, { 6, 0 }, { 8, 0 }, { 1, 1 }, { 2, 1 },
- { 3, 1 }, { 4, 1 }
- };
- static const struct bwn_rfatt rfatt1[] = {
- { 2, 1 }, { 4, 1 }, { 6, 1 }, { 8, 1 }, { 10, 1 }, { 12, 1 },
- { 14, 1 }
- };
- static const struct bwn_rfatt rfatt2[] = {
- { 0, 1 }, { 2, 1 }, { 4, 1 }, { 6, 1 }, { 8, 1 }, { 9, 1 },
- { 9, 1 }
- };
- static const struct bwn_bbatt bbatt_0[] = {
- { 0 }, { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 }
- };
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
-
- if (phy->rf_ver == 0x2050 && phy->rf_rev < 6)
- pg->pg_bbatt.att = 0;
- else
- pg->pg_bbatt.att = 2;
-
- /* prepare Radio Attenuation */
- pg->pg_rfatt.padmix = 0;
-
- if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM &&
- siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BCM4309G) {
- if (siba_get_pci_revid(sc->sc_dev) < 0x43) {
- pg->pg_rfatt.att = 2;
- goto done;
- } else if (siba_get_pci_revid(sc->sc_dev) < 0x51) {
- pg->pg_rfatt.att = 3;
- goto done;
- }
- }
-
- if (phy->type == BWN_PHYTYPE_A) {
- pg->pg_rfatt.att = 0x60;
- goto done;
- }
-
- switch (phy->rf_ver) {
- case 0x2050:
- switch (phy->rf_rev) {
- case 0:
- pg->pg_rfatt.att = 5;
- goto done;
- case 1:
- if (phy->type == BWN_PHYTYPE_G) {
- if (siba_get_pci_subvendor(sc->sc_dev) ==
- SIBA_BOARDVENDOR_BCM &&
- siba_get_pci_subdevice(sc->sc_dev) ==
- SIBA_BOARD_BCM4309G &&
- siba_get_pci_revid(sc->sc_dev) >= 30)
- pg->pg_rfatt.att = 3;
- else if (siba_get_pci_subvendor(sc->sc_dev) ==
- SIBA_BOARDVENDOR_BCM &&
- siba_get_pci_subdevice(sc->sc_dev) ==
- SIBA_BOARD_BU4306)
- pg->pg_rfatt.att = 3;
- else
- pg->pg_rfatt.att = 1;
- } else {
- if (siba_get_pci_subvendor(sc->sc_dev) ==
- SIBA_BOARDVENDOR_BCM &&
- siba_get_pci_subdevice(sc->sc_dev) ==
- SIBA_BOARD_BCM4309G &&
- siba_get_pci_revid(sc->sc_dev) >= 30)
- pg->pg_rfatt.att = 7;
- else
- pg->pg_rfatt.att = 6;
- }
- goto done;
- case 2:
- if (phy->type == BWN_PHYTYPE_G) {
- if (siba_get_pci_subvendor(sc->sc_dev) ==
- SIBA_BOARDVENDOR_BCM &&
- siba_get_pci_subdevice(sc->sc_dev) ==
- SIBA_BOARD_BCM4309G &&
- siba_get_pci_revid(sc->sc_dev) >= 30)
- pg->pg_rfatt.att = 3;
- else if (siba_get_pci_subvendor(sc->sc_dev) ==
- SIBA_BOARDVENDOR_BCM &&
- siba_get_pci_subdevice(sc->sc_dev) ==
- SIBA_BOARD_BU4306)
- pg->pg_rfatt.att = 5;
- else if (siba_get_chipid(sc->sc_dev) == 0x4320)
- pg->pg_rfatt.att = 4;
- else
- pg->pg_rfatt.att = 3;
- } else
- pg->pg_rfatt.att = 6;
- goto done;
- case 3:
- pg->pg_rfatt.att = 5;
- goto done;
- case 4:
- case 5:
- pg->pg_rfatt.att = 1;
- goto done;
- case 6:
- case 7:
- pg->pg_rfatt.att = 5;
- goto done;
- case 8:
- pg->pg_rfatt.att = 0xa;
- pg->pg_rfatt.padmix = 1;
- goto done;
- case 9:
- default:
- pg->pg_rfatt.att = 5;
- goto done;
- }
- break;
- case 0x2053:
- switch (phy->rf_rev) {
- case 1:
- pg->pg_rfatt.att = 6;
- goto done;
- }
- break;
- }
- pg->pg_rfatt.att = 5;
-done:
- pg->pg_txctl = (bwn_phy_g_txctl(mac) << 4);
-
- if (!bwn_has_hwpctl(mac)) {
- lo->rfatt.array = rfatt0;
- lo->rfatt.len = N(rfatt0);
- lo->rfatt.min = 0;
- lo->rfatt.max = 9;
- goto genbbatt;
- }
- if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) {
- lo->rfatt.array = rfatt1;
- lo->rfatt.len = N(rfatt1);
- lo->rfatt.min = 0;
- lo->rfatt.max = 14;
- goto genbbatt;
- }
- lo->rfatt.array = rfatt2;
- lo->rfatt.len = N(rfatt2);
- lo->rfatt.min = 0;
- lo->rfatt.max = 9;
-genbbatt:
- lo->bbatt.array = bbatt_0;
- lo->bbatt.len = N(bbatt_0);
- lo->bbatt.min = 0;
- lo->bbatt.max = 8;
-
- BWN_READ_4(mac, BWN_MACCTL);
- if (phy->rev == 1) {
- phy->gmode = 0;
- bwn_reset_core(mac, 0);
- bwn_phy_g_init_sub(mac);
- phy->gmode = 1;
- bwn_reset_core(mac, BWN_TGSLOW_SUPPORT_G);
- }
- return (0);
-}
-
-static uint16_t
-bwn_phy_g_txctl(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
-
- if (phy->rf_ver != 0x2050)
- return (0);
- if (phy->rf_rev == 1)
- return (BWN_TXCTL_PA2DB | BWN_TXCTL_TXMIX);
- if (phy->rf_rev < 6)
- return (BWN_TXCTL_PA2DB);
- if (phy->rf_rev == 8)
- return (BWN_TXCTL_TXMIX);
- return (0);
-}
-
-static int
-bwn_phy_g_init(struct bwn_mac *mac)
-{
-
- bwn_phy_g_init_sub(mac);
- return (0);
-}
-
-static void
-bwn_phy_g_exit(struct bwn_mac *mac)
-{
- struct bwn_txpwr_loctl *lo = &mac->mac_phy.phy_g.pg_loctl;
- struct bwn_lo_calib *cal, *tmp;
-
- if (lo == NULL)
- return;
- TAILQ_FOREACH_SAFE(cal, &lo->calib_list, list, tmp) {
- TAILQ_REMOVE(&lo->calib_list, cal, list);
- free(cal, M_DEVBUF);
- }
-}
-
-static uint16_t
-bwn_phy_g_read(struct bwn_mac *mac, uint16_t reg)
-{
-
- BWN_WRITE_2(mac, BWN_PHYCTL, reg);
- return (BWN_READ_2(mac, BWN_PHYDATA));
-}
-
-static void
-bwn_phy_g_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
-{
-
- BWN_WRITE_2(mac, BWN_PHYCTL, reg);
- BWN_WRITE_2(mac, BWN_PHYDATA, value);
-}
-
-static uint16_t
-bwn_phy_g_rf_read(struct bwn_mac *mac, uint16_t reg)
-{
-
- KASSERT(reg != 1, ("%s:%d: fail", __func__, __LINE__));
- BWN_WRITE_2(mac, BWN_RFCTL, reg | 0x80);
- return (BWN_READ_2(mac, BWN_RFDATALO));
-}
-
-static void
-bwn_phy_g_rf_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
-{
-
- KASSERT(reg != 1, ("%s:%d: fail", __func__, __LINE__));
- BWN_WRITE_2(mac, BWN_RFCTL, reg);
- BWN_WRITE_2(mac, BWN_RFDATALO, value);
-}
-
-static int
-bwn_phy_g_hwpctl(struct bwn_mac *mac)
-{
-
- return (mac->mac_phy.rev >= 6);
-}
-
-static void
-bwn_phy_g_rf_onoff(struct bwn_mac *mac, int on)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- unsigned int channel;
- uint16_t rfover, rfoverval;
-
- if (on) {
- if (phy->rf_on)
- return;
-
- BWN_PHY_WRITE(mac, 0x15, 0x8000);
- BWN_PHY_WRITE(mac, 0x15, 0xcc00);
- BWN_PHY_WRITE(mac, 0x15, (phy->gmode ? 0xc0 : 0x0));
- if (pg->pg_flags & BWN_PHY_G_FLAG_RADIOCTX_VALID) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER,
- pg->pg_radioctx_over);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- pg->pg_radioctx_overval);
- pg->pg_flags &= ~BWN_PHY_G_FLAG_RADIOCTX_VALID;
- }
- channel = phy->chan;
- bwn_phy_g_switch_chan(mac, 6, 1);
- bwn_phy_g_switch_chan(mac, channel, 0);
- return;
- }
-
- rfover = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
- rfoverval = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
- pg->pg_radioctx_over = rfover;
- pg->pg_radioctx_overval = rfoverval;
- pg->pg_flags |= BWN_PHY_G_FLAG_RADIOCTX_VALID;
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, rfover | 0x008c);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfoverval & 0xff73);
-}
-
-static int
-bwn_phy_g_switch_channel(struct bwn_mac *mac, uint32_t newchan)
-{
-
- if ((newchan < 1) || (newchan > 14))
- return (EINVAL);
- bwn_phy_g_switch_chan(mac, newchan, 0);
-
- return (0);
-}
-
-static uint32_t
-bwn_phy_g_get_default_chan(struct bwn_mac *mac)
-{
-
- return (1);
-}
-
-static void
-bwn_phy_g_set_antenna(struct bwn_mac *mac, int antenna)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- uint64_t hf;
- int autodiv = 0;
- uint16_t tmp;
-
- if (antenna == BWN_ANTAUTO0 || antenna == BWN_ANTAUTO1)
- autodiv = 1;
-
- hf = bwn_hf_read(mac) & ~BWN_HF_UCODE_ANTDIV_HELPER;
- bwn_hf_write(mac, hf);
-
- BWN_PHY_WRITE(mac, BWN_PHY_BBANDCFG,
- (BWN_PHY_READ(mac, BWN_PHY_BBANDCFG) & ~BWN_PHY_BBANDCFG_RXANT) |
- ((autodiv ? BWN_ANTAUTO1 : antenna)
- << BWN_PHY_BBANDCFG_RXANT_SHIFT));
-
- if (autodiv) {
- tmp = BWN_PHY_READ(mac, BWN_PHY_ANTDWELL);
- if (antenna == BWN_ANTAUTO1)
- tmp &= ~BWN_PHY_ANTDWELL_AUTODIV1;
- else
- tmp |= BWN_PHY_ANTDWELL_AUTODIV1;
- BWN_PHY_WRITE(mac, BWN_PHY_ANTDWELL, tmp);
- }
- tmp = BWN_PHY_READ(mac, BWN_PHY_ANTWRSETT);
- if (autodiv)
- tmp |= BWN_PHY_ANTWRSETT_ARXDIV;
- else
- tmp &= ~BWN_PHY_ANTWRSETT_ARXDIV;
- BWN_PHY_WRITE(mac, BWN_PHY_ANTWRSETT, tmp);
- if (phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM61,
- BWN_PHY_READ(mac, BWN_PHY_OFDM61) | BWN_PHY_OFDM61_10);
- BWN_PHY_WRITE(mac, BWN_PHY_DIVSRCHGAINBACK,
- (BWN_PHY_READ(mac, BWN_PHY_DIVSRCHGAINBACK) & 0xff00) |
- 0x15);
- if (phy->rev == 2)
- BWN_PHY_WRITE(mac, BWN_PHY_ADIVRELATED, 8);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_ADIVRELATED,
- (BWN_PHY_READ(mac, BWN_PHY_ADIVRELATED) & 0xff00) |
- 8);
- }
- if (phy->rev >= 6)
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM9B, 0xdc);
-
- hf |= BWN_HF_UCODE_ANTDIV_HELPER;
- bwn_hf_write(mac, hf);
-}
-
-static int
-bwn_phy_g_im(struct bwn_mac *mac, int mode)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s: fail", __func__));
- KASSERT(mode == BWN_IMMODE_NONE, ("%s: fail", __func__));
-
- if (phy->rev == 0 || !phy->gmode)
- return (ENODEV);
-
- pg->pg_aci_wlan_automatic = 0;
- return (0);
-}
-
-static int
-bwn_phy_g_recalc_txpwr(struct bwn_mac *mac, int ignore_tssi)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- unsigned int tssi;
- int cck, ofdm;
- int power;
- int rfatt, bbatt;
- unsigned int max;
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s: fail", __func__));
-
- cck = bwn_phy_shm_tssi_read(mac, BWN_SHARED_TSSI_CCK);
- ofdm = bwn_phy_shm_tssi_read(mac, BWN_SHARED_TSSI_OFDM_G);
- if (cck < 0 && ofdm < 0) {
- if (ignore_tssi == 0)
- return (BWN_TXPWR_RES_DONE);
- cck = 0;
- ofdm = 0;
- }
- tssi = (cck < 0) ? ofdm : ((ofdm < 0) ? cck : (cck + ofdm) / 2);
- if (pg->pg_avgtssi != 0xff)
- tssi = (tssi + pg->pg_avgtssi) / 2;
- pg->pg_avgtssi = tssi;
- KASSERT(tssi < BWN_TSSI_MAX, ("%s:%d: fail", __func__, __LINE__));
-
- max = siba_sprom_get_maxpwr_bg(sc->sc_dev);
- if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL)
- max -= 3;
- if (max >= 120) {
- device_printf(sc->sc_dev, "invalid max TX-power value\n");
- max = 80;
- siba_sprom_set_maxpwr_bg(sc->sc_dev, max);
- }
-
- power = MIN(MAX((phy->txpower < 0) ? 0 : (phy->txpower << 2), 0), max) -
- (pg->pg_tssi2dbm[MIN(MAX(pg->pg_idletssi - pg->pg_curtssi +
- tssi, 0x00), 0x3f)]);
- if (power == 0)
- return (BWN_TXPWR_RES_DONE);
-
- rfatt = -((power + 7) / 8);
- bbatt = (-(power / 2)) - (4 * rfatt);
- if ((rfatt == 0) && (bbatt == 0))
- return (BWN_TXPWR_RES_DONE);
- pg->pg_bbatt_delta = bbatt;
- pg->pg_rfatt_delta = rfatt;
- return (BWN_TXPWR_RES_NEED_ADJUST);
-}
-
-static void
-bwn_phy_g_set_txpwr(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- int rfatt, bbatt;
- uint8_t txctl;
-
- bwn_mac_suspend(mac);
-
- BWN_ASSERT_LOCKED(sc);
-
- bbatt = pg->pg_bbatt.att;
- bbatt += pg->pg_bbatt_delta;
- rfatt = pg->pg_rfatt.att;
- rfatt += pg->pg_rfatt_delta;
-
- bwn_phy_g_setatt(mac, &bbatt, &rfatt);
- txctl = pg->pg_txctl;
- if ((phy->rf_ver == 0x2050) && (phy->rf_rev == 2)) {
- if (rfatt <= 1) {
- if (txctl == 0) {
- txctl = BWN_TXCTL_PA2DB | BWN_TXCTL_TXMIX;
- rfatt += 2;
- bbatt += 2;
- } else if (siba_sprom_get_bf_lo(sc->sc_dev) &
- BWN_BFL_PACTRL) {
- bbatt += 4 * (rfatt - 2);
- rfatt = 2;
- }
- } else if (rfatt > 4 && txctl) {
- txctl = 0;
- if (bbatt < 3) {
- rfatt -= 3;
- bbatt += 2;
- } else {
- rfatt -= 2;
- bbatt -= 2;
- }
- }
- }
- pg->pg_txctl = txctl;
- bwn_phy_g_setatt(mac, &bbatt, &rfatt);
- pg->pg_rfatt.att = rfatt;
- pg->pg_bbatt.att = bbatt;
-
- DPRINTF(sc, BWN_DEBUG_TXPOW, "%s: adjust TX power\n", __func__);
-
- bwn_phy_lock(mac);
- bwn_rf_lock(mac);
- bwn_phy_g_set_txpwr_sub(mac, &pg->pg_bbatt, &pg->pg_rfatt,
- pg->pg_txctl);
- bwn_rf_unlock(mac);
- bwn_phy_unlock(mac);
-
- bwn_mac_enable(mac);
-}
-
-static void
-bwn_phy_g_task_15s(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- unsigned long expire, now;
- struct bwn_lo_calib *cal, *tmp;
- uint8_t expired = 0;
-
- bwn_mac_suspend(mac);
-
- if (lo == NULL)
- goto fail;
-
- BWN_GETTIME(now);
- if (bwn_has_hwpctl(mac)) {
- expire = now - BWN_LO_PWRVEC_EXPIRE;
- if (ieee80211_time_before(lo->pwr_vec_read_time, expire)) {
- bwn_lo_get_powervector(mac);
- bwn_phy_g_dc_lookup_init(mac, 0);
- }
- goto fail;
- }
-
- expire = now - BWN_LO_CALIB_EXPIRE;
- TAILQ_FOREACH_SAFE(cal, &lo->calib_list, list, tmp) {
- if (!ieee80211_time_before(cal->calib_time, expire))
- continue;
- if (BWN_BBATTCMP(&cal->bbatt, &pg->pg_bbatt) &&
- BWN_RFATTCMP(&cal->rfatt, &pg->pg_rfatt)) {
- KASSERT(!expired, ("%s:%d: fail", __func__, __LINE__));
- expired = 1;
- }
-
- DPRINTF(sc, BWN_DEBUG_LO, "expired BB %u RF %u %u I %d Q %d\n",
- cal->bbatt.att, cal->rfatt.att, cal->rfatt.padmix,
- cal->ctl.i, cal->ctl.q);
-
- TAILQ_REMOVE(&lo->calib_list, cal, list);
- free(cal, M_DEVBUF);
- }
- if (expired || TAILQ_EMPTY(&lo->calib_list)) {
- cal = bwn_lo_calibset(mac, &pg->pg_bbatt,
- &pg->pg_rfatt);
- if (cal == NULL) {
- device_printf(sc->sc_dev,
- "failed to recalibrate LO\n");
- goto fail;
- }
- TAILQ_INSERT_TAIL(&lo->calib_list, cal, list);
- bwn_lo_write(mac, &cal->ctl);
- }
-
-fail:
- bwn_mac_enable(mac);
-}
-
-static void
-bwn_phy_g_task_60s(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_softc *sc = mac->mac_sc;
- uint8_t old = phy->chan;
-
- if (!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI))
- return;
-
- bwn_mac_suspend(mac);
- bwn_nrssi_slope_11g(mac);
- if ((phy->rf_ver == 0x2050) && (phy->rf_rev == 8)) {
- bwn_switch_channel(mac, (old >= 8) ? 1 : 13);
- bwn_switch_channel(mac, old);
- }
- bwn_mac_enable(mac);
-}
-
-static void
-bwn_phy_switch_analog(struct bwn_mac *mac, int on)
-{
-
- BWN_WRITE_2(mac, BWN_PHY0, on ? 0 : 0xf4);
-}
-
-static int
bwn_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
const struct ieee80211_bpf_params *params)
{
@@ -3273,7 +2180,7 @@ bwn_chip_init(struct bwn_mac *mac)
}
/* read hostflags */
-static uint64_t
+uint64_t
bwn_hf_read(struct bwn_mac *mac)
{
uint64_t ret;
@@ -3286,7 +2193,7 @@ bwn_hf_read(struct bwn_mac *mac)
return (ret);
}
-static void
+void
bwn_hf_write(struct bwn_mac *mac, uint64_t value)
{
@@ -4606,1085 +3513,7 @@ bwn_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error)
}
}
-static void
-bwn_phy_g_init_sub(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- uint16_t i, tmp;
-
- if (phy->rev == 1)
- bwn_phy_init_b5(mac);
- else
- bwn_phy_init_b6(mac);
-
- if (phy->rev >= 2 || phy->gmode)
- bwn_phy_init_a(mac);
-
- if (phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL, 0);
- }
- if (phy->rev == 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xc0);
- }
- if (phy->rev > 5) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x400);
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xc0);
- }
- if (phy->gmode || phy->rev >= 2) {
- tmp = BWN_PHY_READ(mac, BWN_PHY_VERSION_OFDM);
- tmp &= BWN_PHYVER_VERSION;
- if (tmp == 3 || tmp == 5) {
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc2), 0x1816);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc3), 0x8006);
- }
- if (tmp == 5) {
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xcc), 0x00ff,
- 0x1f00);
- }
- }
- if ((phy->rev <= 2 && phy->gmode) || phy->rev >= 2)
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x7e), 0x78);
- if (phy->rf_rev == 8) {
- BWN_PHY_SET(mac, BWN_PHY_EXTG(0x01), 0x80);
- BWN_PHY_SET(mac, BWN_PHY_OFDM(0x3e), 0x4);
- }
- if (BWN_HAS_LOOPBACK(phy))
- bwn_loopback_calcgain(mac);
-
- if (phy->rf_rev != 8) {
- if (pg->pg_initval == 0xffff)
- pg->pg_initval = bwn_rf_init_bcm2050(mac);
- else
- BWN_RF_WRITE(mac, 0x0078, pg->pg_initval);
- }
- bwn_lo_g_init(mac);
- if (BWN_HAS_TXMAG(phy)) {
- BWN_RF_WRITE(mac, 0x52,
- (BWN_RF_READ(mac, 0x52) & 0xff00)
- | pg->pg_loctl.tx_bias |
- pg->pg_loctl.tx_magn);
- } else {
- BWN_RF_SETMASK(mac, 0x52, 0xfff0, pg->pg_loctl.tx_bias);
- }
- if (phy->rev >= 6) {
- BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x36), 0x0fff,
- (pg->pg_loctl.tx_bias << 12));
- }
- if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL)
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8075);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x807f);
- if (phy->rev < 2)
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x101);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x202);
- if (phy->gmode || phy->rev >= 2) {
- bwn_lo_g_adjust(mac);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078);
- }
-
- if (!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI)) {
- for (i = 0; i < 64; i++) {
- BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_CTRL, i);
- BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_DATA,
- (uint16_t)MIN(MAX(bwn_nrssi_read(mac, i) - 0xffff,
- -32), 31));
- }
- bwn_nrssi_threshold(mac);
- } else if (phy->gmode || phy->rev >= 2) {
- if (pg->pg_nrssi[0] == -1000) {
- KASSERT(pg->pg_nrssi[1] == -1000,
- ("%s:%d: fail", __func__, __LINE__));
- bwn_nrssi_slope_11g(mac);
- } else
- bwn_nrssi_threshold(mac);
- }
- if (phy->rf_rev == 8)
- BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x05), 0x3230);
- bwn_phy_hwpctl_init(mac);
- if ((siba_get_chipid(sc->sc_dev) == 0x4306
- && siba_get_chippkg(sc->sc_dev) == 2) || 0) {
- BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0xbfff);
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xc3), 0x7fff);
- }
-}
-
-static uint8_t
-bwn_has_hwpctl(struct bwn_mac *mac)
-{
-
- if (mac->mac_phy.hwpctl == 0 || mac->mac_phy.use_hwpctl == NULL)
- return (0);
- return (mac->mac_phy.use_hwpctl(mac));
-}
-
-static void
-bwn_phy_init_b5(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- uint16_t offset, value;
- uint8_t old_channel;
-
- if (phy->analog == 1)
- BWN_RF_SET(mac, 0x007a, 0x0050);
- if ((siba_get_pci_subvendor(sc->sc_dev) != SIBA_BOARDVENDOR_BCM) &&
- (siba_get_pci_subdevice(sc->sc_dev) != SIBA_BOARD_BU4306)) {
- value = 0x2120;
- for (offset = 0x00a8; offset < 0x00c7; offset++) {
- BWN_PHY_WRITE(mac, offset, value);
- value += 0x202;
- }
- }
- BWN_PHY_SETMASK(mac, 0x0035, 0xf0ff, 0x0700);
- if (phy->rf_ver == 0x2050)
- BWN_PHY_WRITE(mac, 0x0038, 0x0667);
-
- if (phy->gmode || phy->rev >= 2) {
- if (phy->rf_ver == 0x2050) {
- BWN_RF_SET(mac, 0x007a, 0x0020);
- BWN_RF_SET(mac, 0x0051, 0x0004);
- }
- BWN_WRITE_2(mac, BWN_PHY_RADIO, 0x0000);
-
- BWN_PHY_SET(mac, 0x0802, 0x0100);
- BWN_PHY_SET(mac, 0x042b, 0x2000);
-
- BWN_PHY_WRITE(mac, 0x001c, 0x186a);
-
- BWN_PHY_SETMASK(mac, 0x0013, 0x00ff, 0x1900);
- BWN_PHY_SETMASK(mac, 0x0035, 0xffc0, 0x0064);
- BWN_PHY_SETMASK(mac, 0x005d, 0xff80, 0x000a);
- }
-
- if (mac->mac_flags & BWN_MAC_FLAG_BADFRAME_PREEMP)
- BWN_PHY_SET(mac, BWN_PHY_RADIO_BITFIELD, (1 << 11));
-
- if (phy->analog == 1) {
- BWN_PHY_WRITE(mac, 0x0026, 0xce00);
- BWN_PHY_WRITE(mac, 0x0021, 0x3763);
- BWN_PHY_WRITE(mac, 0x0022, 0x1bc3);
- BWN_PHY_WRITE(mac, 0x0023, 0x06f9);
- BWN_PHY_WRITE(mac, 0x0024, 0x037e);
- } else
- BWN_PHY_WRITE(mac, 0x0026, 0xcc00);
- BWN_PHY_WRITE(mac, 0x0030, 0x00c6);
- BWN_WRITE_2(mac, 0x03ec, 0x3f22);
-
- if (phy->analog == 1)
- BWN_PHY_WRITE(mac, 0x0020, 0x3e1c);
- else
- BWN_PHY_WRITE(mac, 0x0020, 0x301c);
-
- if (phy->analog == 0)
- BWN_WRITE_2(mac, 0x03e4, 0x3000);
-
- old_channel = phy->chan;
- bwn_phy_g_switch_chan(mac, 7, 0);
-
- if (phy->rf_ver != 0x2050) {
- BWN_RF_WRITE(mac, 0x0075, 0x0080);
- BWN_RF_WRITE(mac, 0x0079, 0x0081);
- }
-
- BWN_RF_WRITE(mac, 0x0050, 0x0020);
- BWN_RF_WRITE(mac, 0x0050, 0x0023);
-
- if (phy->rf_ver == 0x2050) {
- BWN_RF_WRITE(mac, 0x0050, 0x0020);
- BWN_RF_WRITE(mac, 0x005a, 0x0070);
- }
-
- BWN_RF_WRITE(mac, 0x005b, 0x007b);
- BWN_RF_WRITE(mac, 0x005c, 0x00b0);
- BWN_RF_SET(mac, 0x007a, 0x0007);
-
- bwn_phy_g_switch_chan(mac, old_channel, 0);
- BWN_PHY_WRITE(mac, 0x0014, 0x0080);
- BWN_PHY_WRITE(mac, 0x0032, 0x00ca);
- BWN_PHY_WRITE(mac, 0x002a, 0x88a3);
-
- bwn_phy_g_set_txpwr_sub(mac, &pg->pg_bbatt, &pg->pg_rfatt,
- pg->pg_txctl);
-
- if (phy->rf_ver == 0x2050)
- BWN_RF_WRITE(mac, 0x005d, 0x000d);
-
- BWN_WRITE_2(mac, 0x03e4, (BWN_READ_2(mac, 0x03e4) & 0xffc0) | 0x0004);
-}
-
-static void
-bwn_loopback_calcgain(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- uint16_t backup_phy[16] = { 0 };
- uint16_t backup_radio[3];
- uint16_t backup_bband;
- uint16_t i, j, loop_i_max;
- uint16_t trsw_rx;
- uint16_t loop1_outer_done, loop1_inner_done;
-
- backup_phy[0] = BWN_PHY_READ(mac, BWN_PHY_CRS0);
- backup_phy[1] = BWN_PHY_READ(mac, BWN_PHY_CCKBBANDCFG);
- backup_phy[2] = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
- backup_phy[3] = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
- if (phy->rev != 1) {
- backup_phy[4] = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVER);
- backup_phy[5] = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVERVAL);
- }
- backup_phy[6] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x5a));
- backup_phy[7] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x59));
- backup_phy[8] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x58));
- backup_phy[9] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x0a));
- backup_phy[10] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x03));
- backup_phy[11] = BWN_PHY_READ(mac, BWN_PHY_LO_MASK);
- backup_phy[12] = BWN_PHY_READ(mac, BWN_PHY_LO_CTL);
- backup_phy[13] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x2b));
- backup_phy[14] = BWN_PHY_READ(mac, BWN_PHY_PGACTL);
- backup_phy[15] = BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
- backup_bband = pg->pg_bbatt.att;
- backup_radio[0] = BWN_RF_READ(mac, 0x52);
- backup_radio[1] = BWN_RF_READ(mac, 0x43);
- backup_radio[2] = BWN_RF_READ(mac, 0x7a);
-
- BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x3fff);
- BWN_PHY_SET(mac, BWN_PHY_CCKBBANDCFG, 0x8000);
- BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0002);
- BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xfffd);
- BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0001);
- BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xfffe);
- if (phy->rev != 1) {
- BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0001);
- BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffe);
- BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0002);
- BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffd);
- }
- BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x000c);
- BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x000c);
- BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0030);
- BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xffcf, 0x10);
-
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0780);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d);
-
- BWN_PHY_SET(mac, BWN_PHY_CCK(0x0a), 0x2000);
- if (phy->rev != 1) {
- BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0004);
- BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffb);
- }
- BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x03), 0xff9f, 0x40);
-
- if (phy->rf_rev == 8)
- BWN_RF_WRITE(mac, 0x43, 0x000f);
- else {
- BWN_RF_WRITE(mac, 0x52, 0);
- BWN_RF_SETMASK(mac, 0x43, 0xfff0, 0x9);
- }
- bwn_phy_g_set_bbatt(mac, 11);
-
- if (phy->rev >= 3)
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc020);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8020);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, 0);
-
- BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x2b), 0xffc0, 0x01);
- BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x2b), 0xc0ff, 0x800);
-
- BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0100);
- BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xcfff);
-
- if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) {
- if (phy->rev >= 7) {
- BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0800);
- BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x8000);
- }
- }
- BWN_RF_MASK(mac, 0x7a, 0x00f7);
-
- j = 0;
- loop_i_max = (phy->rf_rev == 8) ? 15 : 9;
- for (i = 0; i < loop_i_max; i++) {
- for (j = 0; j < 16; j++) {
- BWN_RF_WRITE(mac, 0x43, i);
- BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xf0ff,
- (j << 8));
- BWN_PHY_SETMASK(mac, BWN_PHY_PGACTL, 0x0fff, 0xa000);
- BWN_PHY_SET(mac, BWN_PHY_PGACTL, 0xf000);
- DELAY(20);
- if (BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE) >= 0xdfc)
- goto done0;
- }
- }
-done0:
- loop1_outer_done = i;
- loop1_inner_done = j;
- if (j >= 8) {
- BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x30);
- trsw_rx = 0x1b;
- for (j = j - 8; j < 16; j++) {
- BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xf0ff, j << 8);
- BWN_PHY_SETMASK(mac, BWN_PHY_PGACTL, 0x0fff, 0xa000);
- BWN_PHY_SET(mac, BWN_PHY_PGACTL, 0xf000);
- DELAY(20);
- trsw_rx -= 3;
- if (BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE) >= 0xdfc)
- goto done1;
- }
- } else
- trsw_rx = 0x18;
-done1:
-
- if (phy->rev != 1) {
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, backup_phy[4]);
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL, backup_phy[5]);
- }
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), backup_phy[6]);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), backup_phy[7]);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), backup_phy[8]);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x0a), backup_phy[9]);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x03), backup_phy[10]);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, backup_phy[11]);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, backup_phy[12]);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), backup_phy[13]);
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, backup_phy[14]);
-
- bwn_phy_g_set_bbatt(mac, backup_bband);
-
- BWN_RF_WRITE(mac, 0x52, backup_radio[0]);
- BWN_RF_WRITE(mac, 0x43, backup_radio[1]);
- BWN_RF_WRITE(mac, 0x7a, backup_radio[2]);
-
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, backup_phy[2] | 0x0003);
- DELAY(10);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, backup_phy[2]);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, backup_phy[3]);
- BWN_PHY_WRITE(mac, BWN_PHY_CRS0, backup_phy[0]);
- BWN_PHY_WRITE(mac, BWN_PHY_CCKBBANDCFG, backup_phy[1]);
-
- pg->pg_max_lb_gain =
- ((loop1_inner_done * 6) - (loop1_outer_done * 4)) - 11;
- pg->pg_trsw_rx_gain = trsw_rx * 2;
-}
-
-static uint16_t
-bwn_rf_init_bcm2050(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- uint32_t tmp1 = 0, tmp2 = 0;
- uint16_t rcc, i, j, pgactl, cck0, cck1, cck2, cck3, rfover, rfoverval,
- analogover, analogoverval, crs0, classctl, lomask, loctl, syncctl,
- radio0, radio1, radio2, reg0, reg1, reg2, radio78, reg, index;
- static const uint8_t rcc_table[] = {
- 0x02, 0x03, 0x01, 0x0f,
- 0x06, 0x07, 0x05, 0x0f,
- 0x0a, 0x0b, 0x09, 0x0f,
- 0x0e, 0x0f, 0x0d, 0x0f,
- };
-
- loctl = lomask = reg0 = classctl = crs0 = analogoverval = analogover =
- rfoverval = rfover = cck3 = 0;
- radio0 = BWN_RF_READ(mac, 0x43);
- radio1 = BWN_RF_READ(mac, 0x51);
- radio2 = BWN_RF_READ(mac, 0x52);
- pgactl = BWN_PHY_READ(mac, BWN_PHY_PGACTL);
- cck0 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x5a));
- cck1 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x59));
- cck2 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x58));
-
- if (phy->type == BWN_PHYTYPE_B) {
- cck3 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x30));
- reg0 = BWN_READ_2(mac, 0x3ec);
-
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), 0xff);
- BWN_WRITE_2(mac, 0x3ec, 0x3f3f);
- } else if (phy->gmode || phy->rev >= 2) {
- rfover = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
- rfoverval = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
- analogover = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVER);
- analogoverval = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVERVAL);
- crs0 = BWN_PHY_READ(mac, BWN_PHY_CRS0);
- classctl = BWN_PHY_READ(mac, BWN_PHY_CLASSCTL);
-
- BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0003);
- BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffc);
- BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x7fff);
- BWN_PHY_MASK(mac, BWN_PHY_CLASSCTL, 0xfffc);
- if (BWN_HAS_LOOPBACK(phy)) {
- lomask = BWN_PHY_READ(mac, BWN_PHY_LO_MASK);
- loctl = BWN_PHY_READ(mac, BWN_PHY_LO_CTL);
- if (phy->rev >= 3)
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc020);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8020);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, 0);
- }
-
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVERVAL,
- BWN_LPD(0, 1, 1)));
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER,
- bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVER, 0));
- }
- BWN_WRITE_2(mac, 0x3e2, BWN_READ_2(mac, 0x3e2) | 0x8000);
-
- syncctl = BWN_PHY_READ(mac, BWN_PHY_SYNCCTL);
- BWN_PHY_MASK(mac, BWN_PHY_SYNCCTL, 0xff7f);
- reg1 = BWN_READ_2(mac, 0x3e6);
- reg2 = BWN_READ_2(mac, 0x3f4);
-
- if (phy->analog == 0)
- BWN_WRITE_2(mac, 0x03e6, 0x0122);
- else {
- if (phy->analog >= 2)
- BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x03), 0xffbf, 0x40);
- BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
- (BWN_READ_2(mac, BWN_CHANNEL_EXT) | 0x2000));
- }
-
- reg = BWN_RF_READ(mac, 0x60);
- index = (reg & 0x001e) >> 1;
- rcc = (((rcc_table[index] << 1) | (reg & 0x0001)) | 0x0020);
-
- if (phy->type == BWN_PHYTYPE_B)
- BWN_RF_WRITE(mac, 0x78, 0x26);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVERVAL,
- BWN_LPD(0, 1, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xbfaf);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x1403);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVERVAL,
- BWN_LPD(0, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xbfa0);
- BWN_RF_SET(mac, 0x51, 0x0004);
- if (phy->rf_rev == 8)
- BWN_RF_WRITE(mac, 0x43, 0x1f);
- else {
- BWN_RF_WRITE(mac, 0x52, 0);
- BWN_RF_SETMASK(mac, 0x43, 0xfff0, 0x0009);
- }
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
-
- for (i = 0; i < 16; i++) {
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0480);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
- DELAY(10);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xefb0);
- DELAY(10);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 0)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xfff0);
- DELAY(20);
- tmp1 += BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
- }
- DELAY(10);
-
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
- tmp1++;
- tmp1 >>= 9;
-
- for (i = 0; i < 16; i++) {
- radio78 = (BWN_BITREV4(i) << 1) | 0x0020;
- BWN_RF_WRITE(mac, 0x78, radio78);
- DELAY(10);
- for (j = 0; j < 16; j++) {
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0d80);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
- DELAY(10);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xefb0);
- DELAY(10);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 0)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xfff0);
- DELAY(10);
- tmp2 += BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
- if (phy->gmode || phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
- bwn_rf_2050_rfoverval(mac,
- BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
- }
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
- }
- tmp2++;
- tmp2 >>= 8;
- if (tmp1 < tmp2)
- break;
- }
-
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pgactl);
- BWN_RF_WRITE(mac, 0x51, radio1);
- BWN_RF_WRITE(mac, 0x52, radio2);
- BWN_RF_WRITE(mac, 0x43, radio0);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), cck0);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), cck1);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), cck2);
- BWN_WRITE_2(mac, 0x3e6, reg1);
- if (phy->analog != 0)
- BWN_WRITE_2(mac, 0x3f4, reg2);
- BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, syncctl);
- bwn_spu_workaround(mac, phy->chan);
- if (phy->type == BWN_PHYTYPE_B) {
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), cck3);
- BWN_WRITE_2(mac, 0x3ec, reg0);
- } else if (phy->gmode) {
- BWN_WRITE_2(mac, BWN_PHY_RADIO,
- BWN_READ_2(mac, BWN_PHY_RADIO)
- & 0x7fff);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, rfover);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfoverval);
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, analogover);
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL,
- analogoverval);
- BWN_PHY_WRITE(mac, BWN_PHY_CRS0, crs0);
- BWN_PHY_WRITE(mac, BWN_PHY_CLASSCTL, classctl);
- if (BWN_HAS_LOOPBACK(phy)) {
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, lomask);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, loctl);
- }
- }
-
- return ((i > 15) ? radio78 : rcc);
-}
-
-static void
-bwn_phy_init_b6(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- uint16_t offset, val;
- uint8_t old_channel;
-
- KASSERT(!(phy->rf_rev == 6 || phy->rf_rev == 7),
- ("%s:%d: fail", __func__, __LINE__));
-
- BWN_PHY_WRITE(mac, 0x003e, 0x817a);
- BWN_RF_WRITE(mac, 0x007a, BWN_RF_READ(mac, 0x007a) | 0x0058);
- if (phy->rf_rev == 4 || phy->rf_rev == 5) {
- BWN_RF_WRITE(mac, 0x51, 0x37);
- BWN_RF_WRITE(mac, 0x52, 0x70);
- BWN_RF_WRITE(mac, 0x53, 0xb3);
- BWN_RF_WRITE(mac, 0x54, 0x9b);
- BWN_RF_WRITE(mac, 0x5a, 0x88);
- BWN_RF_WRITE(mac, 0x5b, 0x88);
- BWN_RF_WRITE(mac, 0x5d, 0x88);
- BWN_RF_WRITE(mac, 0x5e, 0x88);
- BWN_RF_WRITE(mac, 0x7d, 0x88);
- bwn_hf_write(mac,
- bwn_hf_read(mac) | BWN_HF_TSSI_RESET_PSM_WORKAROUN);
- }
- if (phy->rf_rev == 8) {
- BWN_RF_WRITE(mac, 0x51, 0);
- BWN_RF_WRITE(mac, 0x52, 0x40);
- BWN_RF_WRITE(mac, 0x53, 0xb7);
- BWN_RF_WRITE(mac, 0x54, 0x98);
- BWN_RF_WRITE(mac, 0x5a, 0x88);
- BWN_RF_WRITE(mac, 0x5b, 0x6b);
- BWN_RF_WRITE(mac, 0x5c, 0x0f);
- if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_ALTIQ) {
- BWN_RF_WRITE(mac, 0x5d, 0xfa);
- BWN_RF_WRITE(mac, 0x5e, 0xd8);
- } else {
- BWN_RF_WRITE(mac, 0x5d, 0xf5);
- BWN_RF_WRITE(mac, 0x5e, 0xb8);
- }
- BWN_RF_WRITE(mac, 0x0073, 0x0003);
- BWN_RF_WRITE(mac, 0x007d, 0x00a8);
- BWN_RF_WRITE(mac, 0x007c, 0x0001);
- BWN_RF_WRITE(mac, 0x007e, 0x0008);
- }
- for (val = 0x1e1f, offset = 0x0088; offset < 0x0098; offset++) {
- BWN_PHY_WRITE(mac, offset, val);
- val -= 0x0202;
- }
- for (val = 0x3e3f, offset = 0x0098; offset < 0x00a8; offset++) {
- BWN_PHY_WRITE(mac, offset, val);
- val -= 0x0202;
- }
- for (val = 0x2120, offset = 0x00a8; offset < 0x00c8; offset++) {
- BWN_PHY_WRITE(mac, offset, (val & 0x3f3f));
- val += 0x0202;
- }
- if (phy->type == BWN_PHYTYPE_G) {
- BWN_RF_SET(mac, 0x007a, 0x0020);
- BWN_RF_SET(mac, 0x0051, 0x0004);
- BWN_PHY_SET(mac, 0x0802, 0x0100);
- BWN_PHY_SET(mac, 0x042b, 0x2000);
- BWN_PHY_WRITE(mac, 0x5b, 0);
- BWN_PHY_WRITE(mac, 0x5c, 0);
- }
-
- old_channel = phy->chan;
- bwn_phy_g_switch_chan(mac, (old_channel >= 8) ? 1 : 13, 0);
-
- BWN_RF_WRITE(mac, 0x0050, 0x0020);
- BWN_RF_WRITE(mac, 0x0050, 0x0023);
- DELAY(40);
- if (phy->rf_rev < 6 || phy->rf_rev == 8) {
- BWN_RF_WRITE(mac, 0x7c, BWN_RF_READ(mac, 0x7c) | 0x0002);
- BWN_RF_WRITE(mac, 0x50, 0x20);
- }
- if (phy->rf_rev <= 2) {
- BWN_RF_WRITE(mac, 0x7c, 0x20);
- BWN_RF_WRITE(mac, 0x5a, 0x70);
- BWN_RF_WRITE(mac, 0x5b, 0x7b);
- BWN_RF_WRITE(mac, 0x5c, 0xb0);
- }
- BWN_RF_SETMASK(mac, 0x007a, 0x00f8, 0x0007);
-
- bwn_phy_g_switch_chan(mac, old_channel, 0);
-
- BWN_PHY_WRITE(mac, 0x0014, 0x0200);
- if (phy->rf_rev >= 6)
- BWN_PHY_WRITE(mac, 0x2a, 0x88c2);
- else
- BWN_PHY_WRITE(mac, 0x2a, 0x8ac0);
- BWN_PHY_WRITE(mac, 0x0038, 0x0668);
- bwn_phy_g_set_txpwr_sub(mac, &pg->pg_bbatt, &pg->pg_rfatt,
- pg->pg_txctl);
- if (phy->rf_rev <= 5)
- BWN_PHY_SETMASK(mac, 0x5d, 0xff80, 0x0003);
- if (phy->rf_rev <= 2)
- BWN_RF_WRITE(mac, 0x005d, 0x000d);
-
- if (phy->analog == 4) {
- BWN_WRITE_2(mac, 0x3e4, 9);
- BWN_PHY_MASK(mac, 0x61, 0x0fff);
- } else
- BWN_PHY_SETMASK(mac, 0x0002, 0xffc0, 0x0004);
- if (phy->type == BWN_PHYTYPE_B)
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- else if (phy->type == BWN_PHYTYPE_G)
- BWN_WRITE_2(mac, 0x03e6, 0x0);
-}
-
-static void
-bwn_phy_init_a(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_softc *sc = mac->mac_sc;
-
- KASSERT(phy->type == BWN_PHYTYPE_A || phy->type == BWN_PHYTYPE_G,
- ("%s:%d: fail", __func__, __LINE__));
-
- if (phy->rev >= 6) {
- if (phy->type == BWN_PHYTYPE_A)
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x1b), ~0x1000);
- if (BWN_PHY_READ(mac, BWN_PHY_ENCORE) & BWN_PHY_ENCORE_EN)
- BWN_PHY_SET(mac, BWN_PHY_ENCORE, 0x0010);
- else
- BWN_PHY_MASK(mac, BWN_PHY_ENCORE, ~0x1010);
- }
-
- bwn_wa_init(mac);
-
- if (phy->type == BWN_PHYTYPE_G &&
- (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL))
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x6e), 0xe000, 0x3cf);
-}
-
-static void
-bwn_wa_write_noisescale(struct bwn_mac *mac, const uint16_t *nst)
-{
- int i;
-
- for (i = 0; i < BWN_TAB_NOISESCALE_SIZE; i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_NOISESCALE, i, nst[i]);
-}
-
-static void
-bwn_wa_agc(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
-
- if (phy->rev == 1) {
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 0, 254);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 1, 13);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 2, 19);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 3, 25);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 0, 0x2710);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 1, 0x9b83);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 2, 0x9b83);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 3, 0x0f8d);
- BWN_PHY_WRITE(mac, BWN_PHY_LMS, 4);
- } else {
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 0, 254);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 1, 13);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 2, 19);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 3, 25);
- }
-
- BWN_PHY_SETMASK(mac, BWN_PHY_CCKSHIFTBITS_WA, (uint16_t)~0xff00,
- 0x5700);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1a), ~0x007f, 0x000f);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1a), ~0x3f80, 0x2b80);
- BWN_PHY_SETMASK(mac, BWN_PHY_ANTWRSETT, 0xf0ff, 0x0300);
- BWN_RF_SET(mac, 0x7a, 0x0008);
- BWN_PHY_SETMASK(mac, BWN_PHY_N1P1GAIN, ~0x000f, 0x0008);
- BWN_PHY_SETMASK(mac, BWN_PHY_P1P2GAIN, ~0x0f00, 0x0600);
- BWN_PHY_SETMASK(mac, BWN_PHY_N1N2GAIN, ~0x0f00, 0x0700);
- BWN_PHY_SETMASK(mac, BWN_PHY_N1P1GAIN, ~0x0f00, 0x0100);
- if (phy->rev == 1)
- BWN_PHY_SETMASK(mac, BWN_PHY_N1N2GAIN, ~0x000f, 0x0007);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x88), ~0x00ff, 0x001c);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x88), ~0x3f00, 0x0200);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x96), ~0x00ff, 0x001c);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x89), ~0x00ff, 0x0020);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x89), ~0x3f00, 0x0200);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x82), ~0x00ff, 0x002e);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x96), (uint16_t)~0xff00, 0x1a00);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x81), ~0x00ff, 0x0028);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x81), (uint16_t)~0xff00, 0x2c00);
- if (phy->rev == 1) {
- BWN_PHY_WRITE(mac, BWN_PHY_PEAK_COUNT, 0x092b);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1b), ~0x001e, 0x0002);
- } else {
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x1b), ~0x001e);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x1f), 0x287a);
- BWN_PHY_SETMASK(mac, BWN_PHY_LPFGAINCTL, ~0x000f, 0x0004);
- if (phy->rev >= 6) {
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x22), 0x287a);
- BWN_PHY_SETMASK(mac, BWN_PHY_LPFGAINCTL,
- (uint16_t)~0xf000, 0x3000);
- }
- }
- BWN_PHY_SETMASK(mac, BWN_PHY_DIVSRCHIDX, 0x8080, 0x7874);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8e), 0x1c00);
- if (phy->rev == 1) {
- BWN_PHY_SETMASK(mac, BWN_PHY_DIVP1P2GAIN, ~0x0f00, 0x0600);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8b), 0x005e);
- BWN_PHY_SETMASK(mac, BWN_PHY_ANTWRSETT, ~0x00ff, 0x001e);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8d), 0x0002);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 0, 0);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 1, 7);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 2, 16);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 3, 28);
- } else {
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 0, 0);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 1, 7);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 2, 16);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 3, 28);
- }
- if (phy->rev >= 6) {
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x26), ~0x0003);
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x26), ~0x1000);
- }
- BWN_PHY_READ(mac, BWN_PHY_VERSION_OFDM);
-}
-
-static void
-bwn_wa_grev1(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- int i;
- static const uint16_t bwn_tab_finefreqg[] = BWN_TAB_FINEFREQ_G;
- static const uint32_t bwn_tab_retard[] = BWN_TAB_RETARD;
- static const uint32_t bwn_tab_rotor[] = BWN_TAB_ROTOR;
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
-
- /* init CRSTHRES and ANTDWELL */
- if (phy->rev == 1) {
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1_R1, 0x4f19);
- } else if (phy->rev == 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x1861);
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0271);
- BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
- } else {
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x0098);
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0070);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc9), 0x0080);
- BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
- }
- BWN_PHY_SETMASK(mac, BWN_PHY_CRS0, ~0x03c0, 0xd000);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x2c), 0x005a);
- BWN_PHY_WRITE(mac, BWN_PHY_CCKSHIFTBITS, 0x0026);
-
- /* XXX support PHY-A??? */
- for (i = 0; i < N(bwn_tab_finefreqg); i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DACRFPABB, i,
- bwn_tab_finefreqg[i]);
-
- /* XXX support PHY-A??? */
- if (phy->rev == 1)
- for (i = 0; i < N(bwn_tab_noise_g1); i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
- bwn_tab_noise_g1[i]);
- else
- for (i = 0; i < N(bwn_tab_noise_g2); i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
- bwn_tab_noise_g2[i]);
-
-
- for (i = 0; i < N(bwn_tab_rotor); i++)
- bwn_ofdmtab_write_4(mac, BWN_OFDMTAB_ROTOR, i,
- bwn_tab_rotor[i]);
-
- /* XXX support PHY-A??? */
- if (phy->rev >= 6) {
- if (BWN_PHY_READ(mac, BWN_PHY_ENCORE) &
- BWN_PHY_ENCORE_EN)
- bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g3);
- else
- bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g2);
- } else
- bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g1);
-
- for (i = 0; i < N(bwn_tab_retard); i++)
- bwn_ofdmtab_write_4(mac, BWN_OFDMTAB_ADVRETARD, i,
- bwn_tab_retard[i]);
-
- if (phy->rev == 1) {
- for (i = 0; i < 16; i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI_R1,
- i, 0x0020);
- } else {
- for (i = 0; i < 32; i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI, i, 0x0820);
- }
-
- bwn_wa_agc(mac);
-}
-
-static void
-bwn_wa_grev26789(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- int i;
- static const uint16_t bwn_tab_sigmasqr2[] = BWN_TAB_SIGMASQR2;
- uint16_t ofdmrev;
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
-
- bwn_gtab_write(mac, BWN_GTAB_ORIGTR, 0, 0xc480);
-
- /* init CRSTHRES and ANTDWELL */
- if (phy->rev == 1)
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1_R1, 0x4f19);
- else if (phy->rev == 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x1861);
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0271);
- BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
- } else {
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x0098);
- BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0070);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc9), 0x0080);
- BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
- }
-
- for (i = 0; i < 64; i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_RSSI, i, i);
-
- /* XXX support PHY-A??? */
- if (phy->rev == 1)
- for (i = 0; i < N(bwn_tab_noise_g1); i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
- bwn_tab_noise_g1[i]);
- else
- for (i = 0; i < N(bwn_tab_noise_g2); i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
- bwn_tab_noise_g2[i]);
-
- /* XXX support PHY-A??? */
- if (phy->rev >= 6) {
- if (BWN_PHY_READ(mac, BWN_PHY_ENCORE) &
- BWN_PHY_ENCORE_EN)
- bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g3);
- else
- bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g2);
- } else
- bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g1);
-
- for (i = 0; i < N(bwn_tab_sigmasqr2); i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_MINSIGSQ, i,
- bwn_tab_sigmasqr2[i]);
-
- if (phy->rev == 1) {
- for (i = 0; i < 16; i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI_R1, i,
- 0x0020);
- } else {
- for (i = 0; i < 32; i++)
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI, i, 0x0820);
- }
-
- bwn_wa_agc(mac);
-
- ofdmrev = BWN_PHY_READ(mac, BWN_PHY_VERSION_OFDM) & BWN_PHYVER_VERSION;
- if (ofdmrev > 2) {
- if (phy->type == BWN_PHYTYPE_A)
- BWN_PHY_WRITE(mac, BWN_PHY_PWRDOWN, 0x1808);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_PWRDOWN, 0x1000);
- } else {
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 3, 0x1044);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 4, 0x7201);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 6, 0x0040);
- }
-
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_0F, 2, 15);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_0F, 3, 20);
-}
-
-static void
-bwn_wa_init(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_softc *sc = mac->mac_sc;
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
-
- switch (phy->rev) {
- case 1:
- bwn_wa_grev1(mac);
- break;
- case 2:
- case 6:
- case 7:
- case 8:
- case 9:
- bwn_wa_grev26789(mac);
- break;
- default:
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
-
- if (siba_get_pci_subvendor(sc->sc_dev) != SIBA_BOARDVENDOR_BCM ||
- siba_get_pci_subdevice(sc->sc_dev) != SIBA_BOARD_BU4306 ||
- siba_get_pci_revid(sc->sc_dev) != 0x17) {
- if (phy->rev < 2) {
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX_R1, 1,
- 0x0002);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX_R1, 2,
- 0x0001);
- } else {
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 1, 0x0002);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 2, 0x0001);
- if ((siba_sprom_get_bf_lo(sc->sc_dev) &
- BWN_BFL_EXTLNA) &&
- (phy->rev >= 7)) {
- BWN_PHY_MASK(mac, BWN_PHY_EXTG(0x11), 0xf7ff);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
- 0x0020, 0x0001);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
- 0x0021, 0x0001);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
- 0x0022, 0x0001);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
- 0x0023, 0x0000);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
- 0x0000, 0x0000);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
- 0x0003, 0x0002);
- }
- }
- }
- if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM) {
- BWN_PHY_WRITE(mac, BWN_PHY_GTABCTL, 0x3120);
- BWN_PHY_WRITE(mac, BWN_PHY_GTABDATA, 0xc480);
- }
-
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_11, 0, 0);
- bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_11, 1, 0);
-}
-
-static void
-bwn_ofdmtab_write_2(struct bwn_mac *mac, uint16_t table, uint16_t offset,
- uint16_t value)
-{
- struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
- uint16_t addr;
-
- addr = table + offset;
- if ((pg->pg_ofdmtab_dir != BWN_OFDMTAB_DIR_WRITE) ||
- (addr - 1 != pg->pg_ofdmtab_addr)) {
- BWN_PHY_WRITE(mac, BWN_PHY_OTABLECTL, addr);
- pg->pg_ofdmtab_dir = BWN_OFDMTAB_DIR_WRITE;
- }
- pg->pg_ofdmtab_addr = addr;
- BWN_PHY_WRITE(mac, BWN_PHY_OTABLEI, value);
-}
-
-static void
-bwn_ofdmtab_write_4(struct bwn_mac *mac, uint16_t table, uint16_t offset,
- uint32_t value)
-{
- struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
- uint16_t addr;
-
- addr = table + offset;
- if ((pg->pg_ofdmtab_dir != BWN_OFDMTAB_DIR_WRITE) ||
- (addr - 1 != pg->pg_ofdmtab_addr)) {
- BWN_PHY_WRITE(mac, BWN_PHY_OTABLECTL, addr);
- pg->pg_ofdmtab_dir = BWN_OFDMTAB_DIR_WRITE;
- }
- pg->pg_ofdmtab_addr = addr;
-
- BWN_PHY_WRITE(mac, BWN_PHY_OTABLEI, value);
- BWN_PHY_WRITE(mac, BWN_PHY_OTABLEQ, (value >> 16));
-}
-
-static void
-bwn_gtab_write(struct bwn_mac *mac, uint16_t table, uint16_t offset,
- uint16_t value)
-{
-
- BWN_PHY_WRITE(mac, BWN_PHY_GTABCTL, table + offset);
- BWN_PHY_WRITE(mac, BWN_PHY_GTABDATA, value);
-}
-
-static void
+void
bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon)
{
struct bwn_phy *phy = &mac->mac_phy;
@@ -5711,9 +3540,12 @@ bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon)
BWN_WRITE_2(mac, 0x0568, 0x0000);
BWN_WRITE_2(mac, 0x07c0,
(siba_get_revid(sc->sc_dev) < 11) ? 0x0000 : 0x0100);
- value = ((phy->type == BWN_PHYTYPE_A) ? 0x41 : 0x40);
+
+ value = (ofdm ? 0x41 : 0x40);
BWN_WRITE_2(mac, 0x050c, value);
- if (phy->type == BWN_PHYTYPE_LP)
+
+ if (phy->type == BWN_PHYTYPE_N || phy->type == BWN_PHYTYPE_LP ||
+ phy->type == BWN_PHYTYPE_LCN)
BWN_WRITE_2(mac, 0x0514, 0x1a02);
BWN_WRITE_2(mac, 0x0508, 0x0000);
BWN_WRITE_2(mac, 0x050a, 0x0000);
@@ -5721,10 +3553,24 @@ bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon)
BWN_WRITE_2(mac, 0x056a, 0x0014);
BWN_WRITE_2(mac, 0x0568, 0x0826);
BWN_WRITE_2(mac, 0x0500, 0x0000);
- if (phy->type == BWN_PHYTYPE_LP)
+
+ /* XXX TODO: n phy pa override? */
+
+ switch (phy->type) {
+ case BWN_PHYTYPE_N:
+ case BWN_PHYTYPE_LCN:
+ BWN_WRITE_2(mac, 0x0502, 0x00d0);
+ break;
+ case BWN_PHYTYPE_LP:
BWN_WRITE_2(mac, 0x0502, 0x0050);
- else
+ break;
+ default:
BWN_WRITE_2(mac, 0x0502, 0x0030);
+ break;
+ }
+
+ /* flush */
+ BWN_READ_2(mac, 0x0502);
if (phy->rf_ver == 0x2050 && phy->rf_rev <= 0x5)
BWN_RF_WRITE(mac, 0x0051, 0x0017);
@@ -5750,7 +3596,7 @@ bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon)
BWN_RF_WRITE(mac, 0x0051, 0x0037);
}
-static void
+void
bwn_ram_write(struct bwn_mac *mac, uint16_t offset, uint32_t val)
{
uint32_t macctl;
@@ -5766,769 +3612,7 @@ bwn_ram_write(struct bwn_mac *mac, uint16_t offset, uint32_t val)
BWN_WRITE_4(mac, BWN_RAM_DATA, val);
}
-static void
-bwn_lo_write(struct bwn_mac *mac, struct bwn_loctl *ctl)
-{
- uint16_t value;
-
- KASSERT(mac->mac_phy.type == BWN_PHYTYPE_G,
- ("%s:%d: fail", __func__, __LINE__));
-
- value = (uint8_t) (ctl->q);
- value |= ((uint8_t) (ctl->i)) << 8;
- BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, value);
-}
-
-static uint16_t
-bwn_lo_calcfeed(struct bwn_mac *mac,
- uint16_t lna, uint16_t pga, uint16_t trsw_rx)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_softc *sc = mac->mac_sc;
- uint16_t rfover;
- uint16_t feedthrough;
-
- if (phy->gmode) {
- lna <<= BWN_PHY_RFOVERVAL_LNA_SHIFT;
- pga <<= BWN_PHY_RFOVERVAL_PGA_SHIFT;
-
- KASSERT((lna & ~BWN_PHY_RFOVERVAL_LNA) == 0,
- ("%s:%d: fail", __func__, __LINE__));
- KASSERT((pga & ~BWN_PHY_RFOVERVAL_PGA) == 0,
- ("%s:%d: fail", __func__, __LINE__));
-
- trsw_rx &= (BWN_PHY_RFOVERVAL_TRSWRX | BWN_PHY_RFOVERVAL_BW);
-
- rfover = BWN_PHY_RFOVERVAL_UNK | pga | lna | trsw_rx;
- if ((siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) &&
- phy->rev > 6)
- rfover |= BWN_PHY_RFOVERVAL_EXTLNA;
-
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xe300);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfover);
- DELAY(10);
- rfover |= BWN_PHY_RFOVERVAL_BW_LBW;
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfover);
- DELAY(10);
- rfover |= BWN_PHY_RFOVERVAL_BW_LPF;
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfover);
- DELAY(10);
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xf300);
- } else {
- pga |= BWN_PHY_PGACTL_UNKNOWN;
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pga);
- DELAY(10);
- pga |= BWN_PHY_PGACTL_LOWBANDW;
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pga);
- DELAY(10);
- pga |= BWN_PHY_PGACTL_LPF;
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pga);
- }
- DELAY(21);
- feedthrough = BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
-
- return (feedthrough);
-}
-
-static uint16_t
-bwn_lo_txctl_regtable(struct bwn_mac *mac,
- uint16_t *value, uint16_t *pad_mix_gain)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- uint16_t reg, v, padmix;
-
- if (phy->type == BWN_PHYTYPE_B) {
- v = 0x30;
- if (phy->rf_rev <= 5) {
- reg = 0x43;
- padmix = 0;
- } else {
- reg = 0x52;
- padmix = 5;
- }
- } else {
- if (phy->rev >= 2 && phy->rf_rev == 8) {
- reg = 0x43;
- v = 0x10;
- padmix = 2;
- } else {
- reg = 0x52;
- v = 0x30;
- padmix = 5;
- }
- }
- if (value)
- *value = v;
- if (pad_mix_gain)
- *pad_mix_gain = padmix;
-
- return (reg);
-}
-
-static void
-bwn_lo_measure_txctl_values(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- uint16_t reg, mask;
- uint16_t trsw_rx, pga;
- uint16_t rf_pctl_reg;
-
- static const uint8_t tx_bias_values[] = {
- 0x09, 0x08, 0x0a, 0x01, 0x00,
- 0x02, 0x05, 0x04, 0x06,
- };
- static const uint8_t tx_magn_values[] = {
- 0x70, 0x40,
- };
-
- if (!BWN_HAS_LOOPBACK(phy)) {
- rf_pctl_reg = 6;
- trsw_rx = 2;
- pga = 0;
- } else {
- int lb_gain;
-
- trsw_rx = 0;
- lb_gain = pg->pg_max_lb_gain / 2;
- if (lb_gain > 10) {
- rf_pctl_reg = 0;
- pga = abs(10 - lb_gain) / 6;
- pga = MIN(MAX(pga, 0), 15);
- } else {
- int cmp_val;
- int tmp;
-
- pga = 0;
- cmp_val = 0x24;
- if ((phy->rev >= 2) &&
- (phy->rf_ver == 0x2050) && (phy->rf_rev == 8))
- cmp_val = 0x3c;
- tmp = lb_gain;
- if ((10 - lb_gain) < cmp_val)
- tmp = (10 - lb_gain);
- if (tmp < 0)
- tmp += 6;
- else
- tmp += 3;
- cmp_val /= 4;
- tmp /= 4;
- if (tmp >= cmp_val)
- rf_pctl_reg = cmp_val;
- else
- rf_pctl_reg = tmp;
- }
- }
- BWN_RF_SETMASK(mac, 0x43, 0xfff0, rf_pctl_reg);
- bwn_phy_g_set_bbatt(mac, 2);
-
- reg = bwn_lo_txctl_regtable(mac, &mask, NULL);
- mask = ~mask;
- BWN_RF_MASK(mac, reg, mask);
-
- if (BWN_HAS_TXMAG(phy)) {
- int i, j;
- int feedthrough;
- int min_feedth = 0xffff;
- uint8_t tx_magn, tx_bias;
-
- for (i = 0; i < N(tx_magn_values); i++) {
- tx_magn = tx_magn_values[i];
- BWN_RF_SETMASK(mac, 0x52, 0xff0f, tx_magn);
- for (j = 0; j < N(tx_bias_values); j++) {
- tx_bias = tx_bias_values[j];
- BWN_RF_SETMASK(mac, 0x52, 0xfff0, tx_bias);
- feedthrough = bwn_lo_calcfeed(mac, 0, pga,
- trsw_rx);
- if (feedthrough < min_feedth) {
- lo->tx_bias = tx_bias;
- lo->tx_magn = tx_magn;
- min_feedth = feedthrough;
- }
- if (lo->tx_bias == 0)
- break;
- }
- BWN_RF_WRITE(mac, 0x52,
- (BWN_RF_READ(mac, 0x52)
- & 0xff00) | lo->tx_bias | lo->
- tx_magn);
- }
- } else {
- lo->tx_magn = 0;
- lo->tx_bias = 0;
- BWN_RF_MASK(mac, 0x52, 0xfff0);
- }
-
- BWN_GETTIME(lo->txctl_measured_time);
-}
-
-static void
-bwn_lo_get_powervector(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- int i;
- uint64_t tmp;
- uint64_t power_vector = 0;
-
- for (i = 0; i < 8; i += 2) {
- tmp = bwn_shm_read_2(mac, BWN_SHARED, 0x310 + i);
- power_vector |= (tmp << (i * 8));
- bwn_shm_write_2(mac, BWN_SHARED, 0x310 + i, 0);
- }
- if (power_vector)
- lo->power_vector = power_vector;
-
- BWN_GETTIME(lo->pwr_vec_read_time);
-}
-
-static void
-bwn_lo_measure_gain_values(struct bwn_mac *mac, int16_t max_rx_gain,
- int use_trsw_rx)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- uint16_t tmp;
-
- if (max_rx_gain < 0)
- max_rx_gain = 0;
-
- if (BWN_HAS_LOOPBACK(phy)) {
- int trsw_rx = 0;
- int trsw_rx_gain;
-
- if (use_trsw_rx) {
- trsw_rx_gain = pg->pg_trsw_rx_gain / 2;
- if (max_rx_gain >= trsw_rx_gain) {
- trsw_rx_gain = max_rx_gain - trsw_rx_gain;
- trsw_rx = 0x20;
- }
- } else
- trsw_rx_gain = max_rx_gain;
- if (trsw_rx_gain < 9) {
- pg->pg_lna_lod_gain = 0;
- } else {
- pg->pg_lna_lod_gain = 1;
- trsw_rx_gain -= 8;
- }
- trsw_rx_gain = MIN(MAX(trsw_rx_gain, 0), 0x2d);
- pg->pg_pga_gain = trsw_rx_gain / 3;
- if (pg->pg_pga_gain >= 5) {
- pg->pg_pga_gain -= 5;
- pg->pg_lna_gain = 2;
- } else
- pg->pg_lna_gain = 0;
- } else {
- pg->pg_lna_gain = 0;
- pg->pg_trsw_rx_gain = 0x20;
- if (max_rx_gain >= 0x14) {
- pg->pg_lna_lod_gain = 1;
- pg->pg_pga_gain = 2;
- } else if (max_rx_gain >= 0x12) {
- pg->pg_lna_lod_gain = 1;
- pg->pg_pga_gain = 1;
- } else if (max_rx_gain >= 0xf) {
- pg->pg_lna_lod_gain = 1;
- pg->pg_pga_gain = 0;
- } else {
- pg->pg_lna_lod_gain = 0;
- pg->pg_pga_gain = 0;
- }
- }
-
- tmp = BWN_RF_READ(mac, 0x7a);
- if (pg->pg_lna_lod_gain == 0)
- tmp &= ~0x0008;
- else
- tmp |= 0x0008;
- BWN_RF_WRITE(mac, 0x7a, tmp);
-}
-
-static void
-bwn_lo_save(struct bwn_mac *mac, struct bwn_lo_g_value *sav)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- struct timespec ts;
- uint16_t tmp;
-
- if (bwn_has_hwpctl(mac)) {
- sav->phy_lomask = BWN_PHY_READ(mac, BWN_PHY_LO_MASK);
- sav->phy_extg = BWN_PHY_READ(mac, BWN_PHY_EXTG(0x01));
- sav->phy_dacctl_hwpctl = BWN_PHY_READ(mac, BWN_PHY_DACCTL);
- sav->phy_cck4 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x14));
- sav->phy_hpwr_tssictl = BWN_PHY_READ(mac, BWN_PHY_HPWR_TSSICTL);
-
- BWN_PHY_SET(mac, BWN_PHY_HPWR_TSSICTL, 0x100);
- BWN_PHY_SET(mac, BWN_PHY_EXTG(0x01), 0x40);
- BWN_PHY_SET(mac, BWN_PHY_DACCTL, 0x40);
- BWN_PHY_SET(mac, BWN_PHY_CCK(0x14), 0x200);
- }
- if (phy->type == BWN_PHYTYPE_B &&
- phy->rf_ver == 0x2050 && phy->rf_rev < 6) {
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x16), 0x410);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x17), 0x820);
- }
- if (phy->rev >= 2) {
- sav->phy_analogover = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVER);
- sav->phy_analogoverval =
- BWN_PHY_READ(mac, BWN_PHY_ANALOGOVERVAL);
- sav->phy_rfover = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
- sav->phy_rfoverval = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
- sav->phy_classctl = BWN_PHY_READ(mac, BWN_PHY_CLASSCTL);
- sav->phy_cck3 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x3e));
- sav->phy_crs0 = BWN_PHY_READ(mac, BWN_PHY_CRS0);
-
- BWN_PHY_MASK(mac, BWN_PHY_CLASSCTL, 0xfffc);
- BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x7fff);
- BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0003);
- BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffc);
- if (phy->type == BWN_PHYTYPE_G) {
- if ((phy->rev >= 7) &&
- (siba_sprom_get_bf_lo(sc->sc_dev) &
- BWN_BFL_EXTLNA)) {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x933);
- } else {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x133);
- }
- } else {
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0);
- }
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x3e), 0);
- }
- sav->reg0 = BWN_READ_2(mac, 0x3f4);
- sav->reg1 = BWN_READ_2(mac, 0x3e2);
- sav->rf0 = BWN_RF_READ(mac, 0x43);
- sav->rf1 = BWN_RF_READ(mac, 0x7a);
- sav->phy_pgactl = BWN_PHY_READ(mac, BWN_PHY_PGACTL);
- sav->phy_cck2 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x2a));
- sav->phy_syncctl = BWN_PHY_READ(mac, BWN_PHY_SYNCCTL);
- sav->phy_dacctl = BWN_PHY_READ(mac, BWN_PHY_DACCTL);
-
- if (!BWN_HAS_TXMAG(phy)) {
- sav->rf2 = BWN_RF_READ(mac, 0x52);
- sav->rf2 &= 0x00f0;
- }
- if (phy->type == BWN_PHYTYPE_B) {
- sav->phy_cck0 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x30));
- sav->phy_cck1 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x06));
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), 0x00ff);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x06), 0x3f3f);
- } else {
- BWN_WRITE_2(mac, 0x3e2, BWN_READ_2(mac, 0x3e2)
- | 0x8000);
- }
- BWN_WRITE_2(mac, 0x3f4, BWN_READ_2(mac, 0x3f4)
- & 0xf000);
-
- tmp =
- (phy->type == BWN_PHYTYPE_G) ? BWN_PHY_LO_MASK : BWN_PHY_CCK(0x2e);
- BWN_PHY_WRITE(mac, tmp, 0x007f);
-
- tmp = sav->phy_syncctl;
- BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, tmp & 0xff7f);
- tmp = sav->rf1;
- BWN_RF_WRITE(mac, 0x007a, tmp & 0xfff0);
-
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2a), 0x8a3);
- if (phy->type == BWN_PHYTYPE_G ||
- (phy->type == BWN_PHYTYPE_B &&
- phy->rf_ver == 0x2050 && phy->rf_rev >= 6)) {
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x1003);
- } else
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x0802);
- if (phy->rev >= 2)
- bwn_dummy_transmission(mac, 0, 1);
- bwn_phy_g_switch_chan(mac, 6, 0);
- BWN_RF_READ(mac, 0x51);
- if (phy->type == BWN_PHYTYPE_G)
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0);
-
- nanouptime(&ts);
- if (ieee80211_time_before(lo->txctl_measured_time,
- (ts.tv_nsec / 1000000 + ts.tv_sec * 1000) - BWN_LO_TXCTL_EXPIRE))
- bwn_lo_measure_txctl_values(mac);
-
- if (phy->type == BWN_PHYTYPE_G && phy->rev >= 3)
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc078);
- else {
- if (phy->type == BWN_PHYTYPE_B)
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8078);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078);
- }
-}
-
-static void
-bwn_lo_restore(struct bwn_mac *mac, struct bwn_lo_g_value *sav)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- uint16_t tmp;
-
- if (phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xe300);
- tmp = (pg->pg_pga_gain << 8);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa0);
- DELAY(5);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa2);
- DELAY(2);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa3);
- } else {
- tmp = (pg->pg_pga_gain | 0xefa0);
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, tmp);
- }
- if (phy->type == BWN_PHYTYPE_G) {
- if (phy->rev >= 3)
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0xc078);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8078);
- if (phy->rev >= 2)
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x0202);
- else
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x0101);
- }
- BWN_WRITE_2(mac, 0x3f4, sav->reg0);
- BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, sav->phy_pgactl);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2a), sav->phy_cck2);
- BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, sav->phy_syncctl);
- BWN_PHY_WRITE(mac, BWN_PHY_DACCTL, sav->phy_dacctl);
- BWN_RF_WRITE(mac, 0x43, sav->rf0);
- BWN_RF_WRITE(mac, 0x7a, sav->rf1);
- if (!BWN_HAS_TXMAG(phy)) {
- tmp = sav->rf2;
- BWN_RF_SETMASK(mac, 0x52, 0xff0f, tmp);
- }
- BWN_WRITE_2(mac, 0x3e2, sav->reg1);
- if (phy->type == BWN_PHYTYPE_B &&
- phy->rf_ver == 0x2050 && phy->rf_rev <= 5) {
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), sav->phy_cck0);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x06), sav->phy_cck1);
- }
- if (phy->rev >= 2) {
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, sav->phy_analogover);
- BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL,
- sav->phy_analogoverval);
- BWN_PHY_WRITE(mac, BWN_PHY_CLASSCTL, sav->phy_classctl);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, sav->phy_rfover);
- BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, sav->phy_rfoverval);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x3e), sav->phy_cck3);
- BWN_PHY_WRITE(mac, BWN_PHY_CRS0, sav->phy_crs0);
- }
- if (bwn_has_hwpctl(mac)) {
- tmp = (sav->phy_lomask & 0xbfff);
- BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, tmp);
- BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x01), sav->phy_extg);
- BWN_PHY_WRITE(mac, BWN_PHY_DACCTL, sav->phy_dacctl_hwpctl);
- BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x14), sav->phy_cck4);
- BWN_PHY_WRITE(mac, BWN_PHY_HPWR_TSSICTL, sav->phy_hpwr_tssictl);
- }
- bwn_phy_g_switch_chan(mac, sav->old_channel, 1);
-}
-
-static int
-bwn_lo_probe_loctl(struct bwn_mac *mac,
- struct bwn_loctl *probe, struct bwn_lo_g_sm *d)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_loctl orig, test;
- struct bwn_loctl prev = { -100, -100 };
- static const struct bwn_loctl modifiers[] = {
- { 1, 1,}, { 1, 0,}, { 1, -1,}, { 0, -1,},
- { -1, -1,}, { -1, 0,}, { -1, 1,}, { 0, 1,}
- };
- int begin, end, lower = 0, i;
- uint16_t feedth;
-
- if (d->curstate == 0) {
- begin = 1;
- end = 8;
- } else if (d->curstate % 2 == 0) {
- begin = d->curstate - 1;
- end = d->curstate + 1;
- } else {
- begin = d->curstate - 2;
- end = d->curstate + 2;
- }
- if (begin < 1)
- begin += 8;
- if (end > 8)
- end -= 8;
-
- memcpy(&orig, probe, sizeof(struct bwn_loctl));
- i = begin;
- d->curstate = i;
- while (1) {
- KASSERT(i >= 1 && i <= 8, ("%s:%d: fail", __func__, __LINE__));
- memcpy(&test, &orig, sizeof(struct bwn_loctl));
- test.i += modifiers[i - 1].i * d->multipler;
- test.q += modifiers[i - 1].q * d->multipler;
- if ((test.i != prev.i || test.q != prev.q) &&
- (abs(test.i) <= 16 && abs(test.q) <= 16)) {
- bwn_lo_write(mac, &test);
- feedth = bwn_lo_calcfeed(mac, pg->pg_lna_gain,
- pg->pg_pga_gain, pg->pg_trsw_rx_gain);
- if (feedth < d->feedth) {
- memcpy(probe, &test,
- sizeof(struct bwn_loctl));
- lower = 1;
- d->feedth = feedth;
- if (d->nmeasure < 2 && !BWN_HAS_LOOPBACK(phy))
- break;
- }
- }
- memcpy(&prev, &test, sizeof(prev));
- if (i == end)
- break;
- if (i == 8)
- i = 1;
- else
- i++;
- d->curstate = i;
- }
-
- return (lower);
-}
-
-static void
-bwn_lo_probe_sm(struct bwn_mac *mac, struct bwn_loctl *loctl, int *rxgain)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_lo_g_sm d;
- struct bwn_loctl probe;
- int lower, repeat, cnt = 0;
- uint16_t feedth;
-
- d.nmeasure = 0;
- d.multipler = 1;
- if (BWN_HAS_LOOPBACK(phy))
- d.multipler = 3;
-
- memcpy(&d.loctl, loctl, sizeof(struct bwn_loctl));
- repeat = (BWN_HAS_LOOPBACK(phy)) ? 4 : 1;
-
- do {
- bwn_lo_write(mac, &d.loctl);
- feedth = bwn_lo_calcfeed(mac, pg->pg_lna_gain,
- pg->pg_pga_gain, pg->pg_trsw_rx_gain);
- if (feedth < 0x258) {
- if (feedth >= 0x12c)
- *rxgain += 6;
- else
- *rxgain += 3;
- feedth = bwn_lo_calcfeed(mac, pg->pg_lna_gain,
- pg->pg_pga_gain, pg->pg_trsw_rx_gain);
- }
- d.feedth = feedth;
- d.curstate = 0;
- do {
- KASSERT(d.curstate >= 0 && d.curstate <= 8,
- ("%s:%d: fail", __func__, __LINE__));
- memcpy(&probe, &d.loctl,
- sizeof(struct bwn_loctl));
- lower = bwn_lo_probe_loctl(mac, &probe, &d);
- if (!lower)
- break;
- if ((probe.i == d.loctl.i) && (probe.q == d.loctl.q))
- break;
- memcpy(&d.loctl, &probe, sizeof(struct bwn_loctl));
- d.nmeasure++;
- } while (d.nmeasure < 24);
- memcpy(loctl, &d.loctl, sizeof(struct bwn_loctl));
-
- if (BWN_HAS_LOOPBACK(phy)) {
- if (d.feedth > 0x1194)
- *rxgain -= 6;
- else if (d.feedth < 0x5dc)
- *rxgain += 3;
- if (cnt == 0) {
- if (d.feedth <= 0x5dc) {
- d.multipler = 1;
- cnt++;
- } else
- d.multipler = 2;
- } else if (cnt == 2)
- d.multipler = 1;
- }
- bwn_lo_measure_gain_values(mac, *rxgain, BWN_HAS_LOOPBACK(phy));
- } while (++cnt < repeat);
-}
-
-static struct bwn_lo_calib *
-bwn_lo_calibset(struct bwn_mac *mac,
- const struct bwn_bbatt *bbatt, const struct bwn_rfatt *rfatt)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_loctl loctl = { 0, 0 };
- struct bwn_lo_calib *cal;
- struct bwn_lo_g_value sval = { 0 };
- int rxgain;
- uint16_t pad, reg, value;
-
- sval.old_channel = phy->chan;
- bwn_mac_suspend(mac);
- bwn_lo_save(mac, &sval);
-
- reg = bwn_lo_txctl_regtable(mac, &value, &pad);
- BWN_RF_SETMASK(mac, 0x43, 0xfff0, rfatt->att);
- BWN_RF_SETMASK(mac, reg, ~value, (rfatt->padmix ? value :0));
-
- rxgain = (rfatt->att * 2) + (bbatt->att / 2);
- if (rfatt->padmix)
- rxgain -= pad;
- if (BWN_HAS_LOOPBACK(phy))
- rxgain += pg->pg_max_lb_gain;
- bwn_lo_measure_gain_values(mac, rxgain, BWN_HAS_LOOPBACK(phy));
- bwn_phy_g_set_bbatt(mac, bbatt->att);
- bwn_lo_probe_sm(mac, &loctl, &rxgain);
-
- bwn_lo_restore(mac, &sval);
- bwn_mac_enable(mac);
-
- cal = malloc(sizeof(*cal), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (!cal) {
- device_printf(mac->mac_sc->sc_dev, "out of memory\n");
- return (NULL);
- }
- memcpy(&cal->bbatt, bbatt, sizeof(*bbatt));
- memcpy(&cal->rfatt, rfatt, sizeof(*rfatt));
- memcpy(&cal->ctl, &loctl, sizeof(loctl));
-
- BWN_GETTIME(cal->calib_time);
-
- return (cal);
-}
-
-static struct bwn_lo_calib *
-bwn_lo_get_calib(struct bwn_mac *mac, const struct bwn_bbatt *bbatt,
- const struct bwn_rfatt *rfatt)
-{
- struct bwn_txpwr_loctl *lo = &mac->mac_phy.phy_g.pg_loctl;
- struct bwn_lo_calib *c;
-
- TAILQ_FOREACH(c, &lo->calib_list, list) {
- if (!BWN_BBATTCMP(&c->bbatt, bbatt))
- continue;
- if (!BWN_RFATTCMP(&c->rfatt, rfatt))
- continue;
- return (c);
- }
-
- c = bwn_lo_calibset(mac, bbatt, rfatt);
- if (!c)
- return (NULL);
- TAILQ_INSERT_TAIL(&lo->calib_list, c, list);
-
- return (c);
-}
-
-static void
-bwn_phy_g_dc_lookup_init(struct bwn_mac *mac, uint8_t update)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- const struct bwn_rfatt *rfatt;
- const struct bwn_bbatt *bbatt;
- uint64_t pvector;
- int i;
- int rf_offset, bb_offset;
- uint8_t changed = 0;
-
- KASSERT(BWN_DC_LT_SIZE == 32, ("%s:%d: fail", __func__, __LINE__));
- KASSERT(lo->rfatt.len * lo->bbatt.len <= 64,
- ("%s:%d: fail", __func__, __LINE__));
-
- pvector = lo->power_vector;
- if (!update && !pvector)
- return;
-
- bwn_mac_suspend(mac);
-
- for (i = 0; i < BWN_DC_LT_SIZE * 2; i++) {
- struct bwn_lo_calib *cal;
- int idx;
- uint16_t val;
-
- if (!update && !(pvector & (((uint64_t)1ULL) << i)))
- continue;
- bb_offset = i / lo->rfatt.len;
- rf_offset = i % lo->rfatt.len;
- bbatt = &(lo->bbatt.array[bb_offset]);
- rfatt = &(lo->rfatt.array[rf_offset]);
-
- cal = bwn_lo_calibset(mac, bbatt, rfatt);
- if (!cal) {
- device_printf(sc->sc_dev, "LO: Could not "
- "calibrate DC table entry\n");
- continue;
- }
- val = (uint8_t)(cal->ctl.q);
- val |= ((uint8_t)(cal->ctl.i)) << 4;
- free(cal, M_DEVBUF);
-
- idx = i / 2;
- if (i % 2)
- lo->dc_lt[idx] = (lo->dc_lt[idx] & 0x00ff)
- | ((val & 0x00ff) << 8);
- else
- lo->dc_lt[idx] = (lo->dc_lt[idx] & 0xff00)
- | (val & 0x00ff);
- changed = 1;
- }
- if (changed) {
- for (i = 0; i < BWN_DC_LT_SIZE; i++)
- BWN_PHY_WRITE(mac, 0x3a0 + i, lo->dc_lt[i]);
- }
- bwn_mac_enable(mac);
-}
-
-static void
-bwn_lo_fixup_rfatt(struct bwn_rfatt *rf)
-{
-
- if (!rf->padmix)
- return;
- if ((rf->att != 1) && (rf->att != 2) && (rf->att != 3))
- rf->att = 4;
-}
-
-static void
-bwn_lo_g_adjust(struct bwn_mac *mac)
-{
- struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
- struct bwn_lo_calib *cal;
- struct bwn_rfatt rf;
-
- memcpy(&rf, &pg->pg_rfatt, sizeof(rf));
- bwn_lo_fixup_rfatt(&rf);
-
- cal = bwn_lo_get_calib(mac, &pg->pg_bbatt, &rf);
- if (!cal)
- return;
- bwn_lo_write(mac, &cal->ctl);
-}
-
-static void
-bwn_lo_g_init(struct bwn_mac *mac)
-{
-
- if (!bwn_has_hwpctl(mac))
- return;
-
- bwn_lo_get_powervector(mac);
- bwn_phy_g_dc_lookup_init(mac, 1);
-}
-
-static void
+void
bwn_mac_suspend(struct bwn_mac *mac)
{
struct bwn_softc *sc = mac->mac_sc;
@@ -6562,7 +3646,7 @@ out:
mac->mac_suspended++;
}
-static void
+void
bwn_mac_enable(struct bwn_mac *mac)
{
struct bwn_softc *sc = mac->mac_sc;
@@ -6587,7 +3671,7 @@ bwn_mac_enable(struct bwn_mac *mac)
}
}
-static void
+void
bwn_psctl(struct bwn_mac *mac, uint32_t flags)
{
struct bwn_softc *sc = mac->mac_sc;
@@ -6616,828 +3700,6 @@ bwn_psctl(struct bwn_mac *mac, uint32_t flags)
}
}
-static int16_t
-bwn_nrssi_read(struct bwn_mac *mac, uint16_t offset)
-{
-
- BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_CTRL, offset);
- return ((int16_t)BWN_PHY_READ(mac, BWN_PHY_NRSSI_DATA));
-}
-
-static void
-bwn_nrssi_threshold(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- int32_t a, b;
- int16_t tmp16;
- uint16_t tmpu16;
-
- KASSERT(phy->type == BWN_PHYTYPE_G, ("%s: fail", __func__));
-
- if (phy->gmode && (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI)) {
- if (!pg->pg_aci_wlan_automatic && pg->pg_aci_enable) {
- a = 0x13;
- b = 0x12;
- } else {
- a = 0xe;
- b = 0x11;
- }
-
- a = a * (pg->pg_nrssi[1] - pg->pg_nrssi[0]);
- a += (pg->pg_nrssi[0] << 6);
- a += (a < 32) ? 31 : 32;
- a = a >> 6;
- a = MIN(MAX(a, -31), 31);
-
- b = b * (pg->pg_nrssi[1] - pg->pg_nrssi[0]);
- b += (pg->pg_nrssi[0] << 6);
- if (b < 32)
- b += 31;
- else
- b += 32;
- b = b >> 6;
- b = MIN(MAX(b, -31), 31);
-
- tmpu16 = BWN_PHY_READ(mac, 0x048a) & 0xf000;
- tmpu16 |= ((uint32_t)b & 0x0000003f);
- tmpu16 |= (((uint32_t)a & 0x0000003f) << 6);
- BWN_PHY_WRITE(mac, 0x048a, tmpu16);
- return;
- }
-
- tmp16 = bwn_nrssi_read(mac, 0x20);
- if (tmp16 >= 0x20)
- tmp16 -= 0x40;
- BWN_PHY_SETMASK(mac, 0x048a, 0xf000, (tmp16 < 3) ? 0x09eb : 0x0aed);
-}
-
-static void
-bwn_nrssi_slope_11g(struct bwn_mac *mac)
-{
-#define SAVE_RF_MAX 3
-#define SAVE_PHY_COMM_MAX 4
-#define SAVE_PHY3_MAX 8
- static const uint16_t save_rf_regs[SAVE_RF_MAX] =
- { 0x7a, 0x52, 0x43 };
- static const uint16_t save_phy_comm_regs[SAVE_PHY_COMM_MAX] =
- { 0x15, 0x5a, 0x59, 0x58 };
- static const uint16_t save_phy3_regs[SAVE_PHY3_MAX] = {
- 0x002e, 0x002f, 0x080f, BWN_PHY_G_LOCTL,
- 0x0801, 0x0060, 0x0014, 0x0478
- };
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- int32_t i, tmp32, phy3_idx = 0;
- uint16_t delta, tmp;
- uint16_t save_rf[SAVE_RF_MAX];
- uint16_t save_phy_comm[SAVE_PHY_COMM_MAX];
- uint16_t save_phy3[SAVE_PHY3_MAX];
- uint16_t ant_div, phy0, chan_ex;
- int16_t nrssi0, nrssi1;
-
- KASSERT(phy->type == BWN_PHYTYPE_G,
- ("%s:%d: fail", __func__, __LINE__));
-
- if (phy->rf_rev >= 9)
- return;
- if (phy->rf_rev == 8)
- bwn_nrssi_offset(mac);
-
- BWN_PHY_MASK(mac, BWN_PHY_G_CRS, 0x7fff);
- BWN_PHY_MASK(mac, 0x0802, 0xfffc);
-
- /*
- * Save RF/PHY registers for later restoration
- */
- ant_div = BWN_READ_2(mac, 0x03e2);
- BWN_WRITE_2(mac, 0x03e2, BWN_READ_2(mac, 0x03e2) | 0x8000);
- for (i = 0; i < SAVE_RF_MAX; ++i)
- save_rf[i] = BWN_RF_READ(mac, save_rf_regs[i]);
- for (i = 0; i < SAVE_PHY_COMM_MAX; ++i)
- save_phy_comm[i] = BWN_PHY_READ(mac, save_phy_comm_regs[i]);
-
- phy0 = BWN_READ_2(mac, BWN_PHY0);
- chan_ex = BWN_READ_2(mac, BWN_CHANNEL_EXT);
- if (phy->rev >= 3) {
- for (i = 0; i < SAVE_PHY3_MAX; ++i)
- save_phy3[i] = BWN_PHY_READ(mac, save_phy3_regs[i]);
- BWN_PHY_WRITE(mac, 0x002e, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_G_LOCTL, 0);
- switch (phy->rev) {
- case 4:
- case 6:
- case 7:
- BWN_PHY_SET(mac, 0x0478, 0x0100);
- BWN_PHY_SET(mac, 0x0801, 0x0040);
- break;
- case 3:
- case 5:
- BWN_PHY_MASK(mac, 0x0801, 0xffbf);
- break;
- }
- BWN_PHY_SET(mac, 0x0060, 0x0040);
- BWN_PHY_SET(mac, 0x0014, 0x0200);
- }
- /*
- * Calculate nrssi0
- */
- BWN_RF_SET(mac, 0x007a, 0x0070);
- bwn_set_all_gains(mac, 0, 8, 0);
- BWN_RF_MASK(mac, 0x007a, 0x00f7);
- if (phy->rev >= 2) {
- BWN_PHY_SETMASK(mac, 0x0811, 0xffcf, 0x0030);
- BWN_PHY_SETMASK(mac, 0x0812, 0xffcf, 0x0010);
- }
- BWN_RF_SET(mac, 0x007a, 0x0080);
- DELAY(20);
-
- nrssi0 = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
- if (nrssi0 >= 0x0020)
- nrssi0 -= 0x0040;
-
- /*
- * Calculate nrssi1
- */
- BWN_RF_MASK(mac, 0x007a, 0x007f);
- if (phy->rev >= 2)
- BWN_PHY_SETMASK(mac, 0x0003, 0xff9f, 0x0040);
-
- BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
- BWN_READ_2(mac, BWN_CHANNEL_EXT) | 0x2000);
- BWN_RF_SET(mac, 0x007a, 0x000f);
- BWN_PHY_WRITE(mac, 0x0015, 0xf330);
- if (phy->rev >= 2) {
- BWN_PHY_SETMASK(mac, 0x0812, 0xffcf, 0x0020);
- BWN_PHY_SETMASK(mac, 0x0811, 0xffcf, 0x0020);
- }
-
- bwn_set_all_gains(mac, 3, 0, 1);
- if (phy->rf_rev == 8) {
- BWN_RF_WRITE(mac, 0x0043, 0x001f);
- } else {
- tmp = BWN_RF_READ(mac, 0x0052) & 0xff0f;
- BWN_RF_WRITE(mac, 0x0052, tmp | 0x0060);
- tmp = BWN_RF_READ(mac, 0x0043) & 0xfff0;
- BWN_RF_WRITE(mac, 0x0043, tmp | 0x0009);
- }
- BWN_PHY_WRITE(mac, 0x005a, 0x0480);
- BWN_PHY_WRITE(mac, 0x0059, 0x0810);
- BWN_PHY_WRITE(mac, 0x0058, 0x000d);
- DELAY(20);
- nrssi1 = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
-
- /*
- * Install calculated narrow RSSI values
- */
- if (nrssi1 >= 0x0020)
- nrssi1 -= 0x0040;
- if (nrssi0 == nrssi1)
- pg->pg_nrssi_slope = 0x00010000;
- else
- pg->pg_nrssi_slope = 0x00400000 / (nrssi0 - nrssi1);
- if (nrssi0 >= -4) {
- pg->pg_nrssi[0] = nrssi1;
- pg->pg_nrssi[1] = nrssi0;
- }
-
- /*
- * Restore saved RF/PHY registers
- */
- if (phy->rev >= 3) {
- for (phy3_idx = 0; phy3_idx < 4; ++phy3_idx) {
- BWN_PHY_WRITE(mac, save_phy3_regs[phy3_idx],
- save_phy3[phy3_idx]);
- }
- }
- if (phy->rev >= 2) {
- BWN_PHY_MASK(mac, 0x0812, 0xffcf);
- BWN_PHY_MASK(mac, 0x0811, 0xffcf);
- }
-
- for (i = 0; i < SAVE_RF_MAX; ++i)
- BWN_RF_WRITE(mac, save_rf_regs[i], save_rf[i]);
-
- BWN_WRITE_2(mac, 0x03e2, ant_div);
- BWN_WRITE_2(mac, 0x03e6, phy0);
- BWN_WRITE_2(mac, BWN_CHANNEL_EXT, chan_ex);
-
- for (i = 0; i < SAVE_PHY_COMM_MAX; ++i)
- BWN_PHY_WRITE(mac, save_phy_comm_regs[i], save_phy_comm[i]);
-
- bwn_spu_workaround(mac, phy->chan);
- BWN_PHY_SET(mac, 0x0802, (0x0001 | 0x0002));
- bwn_set_original_gains(mac);
- BWN_PHY_SET(mac, BWN_PHY_G_CRS, 0x8000);
- if (phy->rev >= 3) {
- for (; phy3_idx < SAVE_PHY3_MAX; ++phy3_idx) {
- BWN_PHY_WRITE(mac, save_phy3_regs[phy3_idx],
- save_phy3[phy3_idx]);
- }
- }
-
- delta = 0x1f - pg->pg_nrssi[0];
- for (i = 0; i < 64; i++) {
- tmp32 = (((i - delta) * pg->pg_nrssi_slope) / 0x10000) + 0x3a;
- tmp32 = MIN(MAX(tmp32, 0), 0x3f);
- pg->pg_nrssi_lt[i] = tmp32;
- }
-
- bwn_nrssi_threshold(mac);
-#undef SAVE_RF_MAX
-#undef SAVE_PHY_COMM_MAX
-#undef SAVE_PHY3_MAX
-}
-
-static void
-bwn_nrssi_offset(struct bwn_mac *mac)
-{
-#define SAVE_RF_MAX 2
-#define SAVE_PHY_COMM_MAX 10
-#define SAVE_PHY6_MAX 8
- static const uint16_t save_rf_regs[SAVE_RF_MAX] =
- { 0x7a, 0x43 };
- static const uint16_t save_phy_comm_regs[SAVE_PHY_COMM_MAX] = {
- 0x0001, 0x0811, 0x0812, 0x0814,
- 0x0815, 0x005a, 0x0059, 0x0058,
- 0x000a, 0x0003
- };
- static const uint16_t save_phy6_regs[SAVE_PHY6_MAX] = {
- 0x002e, 0x002f, 0x080f, 0x0810,
- 0x0801, 0x0060, 0x0014, 0x0478
- };
- struct bwn_phy *phy = &mac->mac_phy;
- int i, phy6_idx = 0;
- uint16_t save_rf[SAVE_RF_MAX];
- uint16_t save_phy_comm[SAVE_PHY_COMM_MAX];
- uint16_t save_phy6[SAVE_PHY6_MAX];
- int16_t nrssi;
- uint16_t saved = 0xffff;
-
- for (i = 0; i < SAVE_PHY_COMM_MAX; ++i)
- save_phy_comm[i] = BWN_PHY_READ(mac, save_phy_comm_regs[i]);
- for (i = 0; i < SAVE_RF_MAX; ++i)
- save_rf[i] = BWN_RF_READ(mac, save_rf_regs[i]);
-
- BWN_PHY_MASK(mac, 0x0429, 0x7fff);
- BWN_PHY_SETMASK(mac, 0x0001, 0x3fff, 0x4000);
- BWN_PHY_SET(mac, 0x0811, 0x000c);
- BWN_PHY_SETMASK(mac, 0x0812, 0xfff3, 0x0004);
- BWN_PHY_MASK(mac, 0x0802, ~(0x1 | 0x2));
- if (phy->rev >= 6) {
- for (i = 0; i < SAVE_PHY6_MAX; ++i)
- save_phy6[i] = BWN_PHY_READ(mac, save_phy6_regs[i]);
-
- BWN_PHY_WRITE(mac, 0x002e, 0);
- BWN_PHY_WRITE(mac, 0x002f, 0);
- BWN_PHY_WRITE(mac, 0x080f, 0);
- BWN_PHY_WRITE(mac, 0x0810, 0);
- BWN_PHY_SET(mac, 0x0478, 0x0100);
- BWN_PHY_SET(mac, 0x0801, 0x0040);
- BWN_PHY_SET(mac, 0x0060, 0x0040);
- BWN_PHY_SET(mac, 0x0014, 0x0200);
- }
- BWN_RF_SET(mac, 0x007a, 0x0070);
- BWN_RF_SET(mac, 0x007a, 0x0080);
- DELAY(30);
-
- nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
- if (nrssi >= 0x20)
- nrssi -= 0x40;
- if (nrssi == 31) {
- for (i = 7; i >= 4; i--) {
- BWN_RF_WRITE(mac, 0x007b, i);
- DELAY(20);
- nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) &
- 0x003f);
- if (nrssi >= 0x20)
- nrssi -= 0x40;
- if (nrssi < 31 && saved == 0xffff)
- saved = i;
- }
- if (saved == 0xffff)
- saved = 4;
- } else {
- BWN_RF_MASK(mac, 0x007a, 0x007f);
- if (phy->rev != 1) {
- BWN_PHY_SET(mac, 0x0814, 0x0001);
- BWN_PHY_MASK(mac, 0x0815, 0xfffe);
- }
- BWN_PHY_SET(mac, 0x0811, 0x000c);
- BWN_PHY_SET(mac, 0x0812, 0x000c);
- BWN_PHY_SET(mac, 0x0811, 0x0030);
- BWN_PHY_SET(mac, 0x0812, 0x0030);
- BWN_PHY_WRITE(mac, 0x005a, 0x0480);
- BWN_PHY_WRITE(mac, 0x0059, 0x0810);
- BWN_PHY_WRITE(mac, 0x0058, 0x000d);
- if (phy->rev == 0)
- BWN_PHY_WRITE(mac, 0x0003, 0x0122);
- else
- BWN_PHY_SET(mac, 0x000a, 0x2000);
- if (phy->rev != 1) {
- BWN_PHY_SET(mac, 0x0814, 0x0004);
- BWN_PHY_MASK(mac, 0x0815, 0xfffb);
- }
- BWN_PHY_SETMASK(mac, 0x0003, 0xff9f, 0x0040);
- BWN_RF_SET(mac, 0x007a, 0x000f);
- bwn_set_all_gains(mac, 3, 0, 1);
- BWN_RF_SETMASK(mac, 0x0043, 0x00f0, 0x000f);
- DELAY(30);
- nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
- if (nrssi >= 0x20)
- nrssi -= 0x40;
- if (nrssi == -32) {
- for (i = 0; i < 4; i++) {
- BWN_RF_WRITE(mac, 0x007b, i);
- DELAY(20);
- nrssi = (int16_t)((BWN_PHY_READ(mac,
- 0x047f) >> 8) & 0x003f);
- if (nrssi >= 0x20)
- nrssi -= 0x40;
- if (nrssi > -31 && saved == 0xffff)
- saved = i;
- }
- if (saved == 0xffff)
- saved = 3;
- } else
- saved = 0;
- }
- BWN_RF_WRITE(mac, 0x007b, saved);
-
- /*
- * Restore saved RF/PHY registers
- */
- if (phy->rev >= 6) {
- for (phy6_idx = 0; phy6_idx < 4; ++phy6_idx) {
- BWN_PHY_WRITE(mac, save_phy6_regs[phy6_idx],
- save_phy6[phy6_idx]);
- }
- }
- if (phy->rev != 1) {
- for (i = 3; i < 5; i++)
- BWN_PHY_WRITE(mac, save_phy_comm_regs[i],
- save_phy_comm[i]);
- }
- for (i = 5; i < SAVE_PHY_COMM_MAX; i++)
- BWN_PHY_WRITE(mac, save_phy_comm_regs[i], save_phy_comm[i]);
-
- for (i = SAVE_RF_MAX - 1; i >= 0; --i)
- BWN_RF_WRITE(mac, save_rf_regs[i], save_rf[i]);
-
- BWN_PHY_WRITE(mac, 0x0802, BWN_PHY_READ(mac, 0x0802) | 0x1 | 0x2);
- BWN_PHY_SET(mac, 0x0429, 0x8000);
- bwn_set_original_gains(mac);
- if (phy->rev >= 6) {
- for (; phy6_idx < SAVE_PHY6_MAX; ++phy6_idx) {
- BWN_PHY_WRITE(mac, save_phy6_regs[phy6_idx],
- save_phy6[phy6_idx]);
- }
- }
-
- BWN_PHY_WRITE(mac, save_phy_comm_regs[0], save_phy_comm[0]);
- BWN_PHY_WRITE(mac, save_phy_comm_regs[2], save_phy_comm[2]);
- BWN_PHY_WRITE(mac, save_phy_comm_regs[1], save_phy_comm[1]);
-}
-
-static void
-bwn_set_all_gains(struct bwn_mac *mac, int16_t first, int16_t second,
- int16_t third)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- uint16_t i;
- uint16_t start = 0x08, end = 0x18;
- uint16_t tmp;
- uint16_t table;
-
- if (phy->rev <= 1) {
- start = 0x10;
- end = 0x20;
- }
-
- table = BWN_OFDMTAB_GAINX;
- if (phy->rev <= 1)
- table = BWN_OFDMTAB_GAINX_R1;
- for (i = 0; i < 4; i++)
- bwn_ofdmtab_write_2(mac, table, i, first);
-
- for (i = start; i < end; i++)
- bwn_ofdmtab_write_2(mac, table, i, second);
-
- if (third != -1) {
- tmp = ((uint16_t) third << 14) | ((uint16_t) third << 6);
- BWN_PHY_SETMASK(mac, 0x04a0, 0xbfbf, tmp);
- BWN_PHY_SETMASK(mac, 0x04a1, 0xbfbf, tmp);
- BWN_PHY_SETMASK(mac, 0x04a2, 0xbfbf, tmp);
- }
- bwn_dummy_transmission(mac, 0, 1);
-}
-
-static void
-bwn_set_original_gains(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- uint16_t i, tmp;
- uint16_t table;
- uint16_t start = 0x0008, end = 0x0018;
-
- if (phy->rev <= 1) {
- start = 0x0010;
- end = 0x0020;
- }
-
- table = BWN_OFDMTAB_GAINX;
- if (phy->rev <= 1)
- table = BWN_OFDMTAB_GAINX_R1;
- for (i = 0; i < 4; i++) {
- tmp = (i & 0xfffc);
- tmp |= (i & 0x0001) << 1;
- tmp |= (i & 0x0002) >> 1;
-
- bwn_ofdmtab_write_2(mac, table, i, tmp);
- }
-
- for (i = start; i < end; i++)
- bwn_ofdmtab_write_2(mac, table, i, i - start);
-
- BWN_PHY_SETMASK(mac, 0x04a0, 0xbfbf, 0x4040);
- BWN_PHY_SETMASK(mac, 0x04a1, 0xbfbf, 0x4040);
- BWN_PHY_SETMASK(mac, 0x04a2, 0xbfbf, 0x4000);
- bwn_dummy_transmission(mac, 0, 1);
-}
-
-static void
-bwn_phy_hwpctl_init(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_rfatt old_rfatt, rfatt;
- struct bwn_bbatt old_bbatt, bbatt;
- struct bwn_softc *sc = mac->mac_sc;
- uint8_t old_txctl = 0;
-
- KASSERT(phy->type == BWN_PHYTYPE_G,
- ("%s:%d: fail", __func__, __LINE__));
-
- if ((siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM) &&
- (siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BU4306))
- return;
-
- BWN_PHY_WRITE(mac, 0x0028, 0x8018);
-
- BWN_WRITE_2(mac, BWN_PHY0, BWN_READ_2(mac, BWN_PHY0) & 0xffdf);
-
- if (!phy->gmode)
- return;
- bwn_hwpctl_early_init(mac);
- if (pg->pg_curtssi == 0) {
- if (phy->rf_ver == 0x2050 && phy->analog == 0) {
- BWN_RF_SETMASK(mac, 0x0076, 0x00f7, 0x0084);
- } else {
- memcpy(&old_rfatt, &pg->pg_rfatt, sizeof(old_rfatt));
- memcpy(&old_bbatt, &pg->pg_bbatt, sizeof(old_bbatt));
- old_txctl = pg->pg_txctl;
-
- bbatt.att = 11;
- if (phy->rf_rev == 8) {
- rfatt.att = 15;
- rfatt.padmix = 1;
- } else {
- rfatt.att = 9;
- rfatt.padmix = 0;
- }
- bwn_phy_g_set_txpwr_sub(mac, &bbatt, &rfatt, 0);
- }
- bwn_dummy_transmission(mac, 0, 1);
- pg->pg_curtssi = BWN_PHY_READ(mac, BWN_PHY_TSSI);
- if (phy->rf_ver == 0x2050 && phy->analog == 0)
- BWN_RF_MASK(mac, 0x0076, 0xff7b);
- else
- bwn_phy_g_set_txpwr_sub(mac, &old_bbatt,
- &old_rfatt, old_txctl);
- }
- bwn_hwpctl_init_gphy(mac);
-
- /* clear TSSI */
- bwn_shm_write_2(mac, BWN_SHARED, 0x0058, 0x7f7f);
- bwn_shm_write_2(mac, BWN_SHARED, 0x005a, 0x7f7f);
- bwn_shm_write_2(mac, BWN_SHARED, 0x0070, 0x7f7f);
- bwn_shm_write_2(mac, BWN_SHARED, 0x0072, 0x7f7f);
-}
-
-static void
-bwn_hwpctl_early_init(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
-
- if (!bwn_has_hwpctl(mac)) {
- BWN_PHY_WRITE(mac, 0x047a, 0xc111);
- return;
- }
-
- BWN_PHY_MASK(mac, 0x0036, 0xfeff);
- BWN_PHY_WRITE(mac, 0x002f, 0x0202);
- BWN_PHY_SET(mac, 0x047c, 0x0002);
- BWN_PHY_SET(mac, 0x047a, 0xf000);
- if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) {
- BWN_PHY_SETMASK(mac, 0x047a, 0xff0f, 0x0010);
- BWN_PHY_SET(mac, 0x005d, 0x8000);
- BWN_PHY_SETMASK(mac, 0x004e, 0xffc0, 0x0010);
- BWN_PHY_WRITE(mac, 0x002e, 0xc07f);
- BWN_PHY_SET(mac, 0x0036, 0x0400);
- } else {
- BWN_PHY_SET(mac, 0x0036, 0x0200);
- BWN_PHY_SET(mac, 0x0036, 0x0400);
- BWN_PHY_MASK(mac, 0x005d, 0x7fff);
- BWN_PHY_MASK(mac, 0x004f, 0xfffe);
- BWN_PHY_SETMASK(mac, 0x004e, 0xffc0, 0x0010);
- BWN_PHY_WRITE(mac, 0x002e, 0xc07f);
- BWN_PHY_SETMASK(mac, 0x047a, 0xff0f, 0x0010);
- }
-}
-
-static void
-bwn_hwpctl_init_gphy(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- int i;
- uint16_t nr_written = 0, tmp, value;
- uint8_t rf, bb;
-
- if (!bwn_has_hwpctl(mac)) {
- bwn_hf_write(mac, bwn_hf_read(mac) & ~BWN_HF_HW_POWERCTL);
- return;
- }
-
- BWN_PHY_SETMASK(mac, 0x0036, 0xffc0,
- (pg->pg_idletssi - pg->pg_curtssi));
- BWN_PHY_SETMASK(mac, 0x0478, 0xff00,
- (pg->pg_idletssi - pg->pg_curtssi));
-
- for (i = 0; i < 32; i++)
- bwn_ofdmtab_write_2(mac, 0x3c20, i, pg->pg_tssi2dbm[i]);
- for (i = 32; i < 64; i++)
- bwn_ofdmtab_write_2(mac, 0x3c00, i - 32, pg->pg_tssi2dbm[i]);
- for (i = 0; i < 64; i += 2) {
- value = (uint16_t) pg->pg_tssi2dbm[i];
- value |= ((uint16_t) pg->pg_tssi2dbm[i + 1]) << 8;
- BWN_PHY_WRITE(mac, 0x380 + (i / 2), value);
- }
-
- for (rf = 0; rf < lo->rfatt.len; rf++) {
- for (bb = 0; bb < lo->bbatt.len; bb++) {
- if (nr_written >= 0x40)
- return;
- tmp = lo->bbatt.array[bb].att;
- tmp <<= 8;
- if (phy->rf_rev == 8)
- tmp |= 0x50;
- else
- tmp |= 0x40;
- tmp |= lo->rfatt.array[rf].att;
- BWN_PHY_WRITE(mac, 0x3c0 + nr_written, tmp);
- nr_written++;
- }
- }
-
- BWN_PHY_MASK(mac, 0x0060, 0xffbf);
- BWN_PHY_WRITE(mac, 0x0014, 0x0000);
-
- KASSERT(phy->rev >= 6, ("%s:%d: fail", __func__, __LINE__));
- BWN_PHY_SET(mac, 0x0478, 0x0800);
- BWN_PHY_MASK(mac, 0x0478, 0xfeff);
- BWN_PHY_MASK(mac, 0x0801, 0xffbf);
-
- bwn_phy_g_dc_lookup_init(mac, 1);
- bwn_hf_write(mac, bwn_hf_read(mac) | BWN_HF_HW_POWERCTL);
-}
-
-static void
-bwn_phy_g_switch_chan(struct bwn_mac *mac, int channel, uint8_t spu)
-{
- struct bwn_softc *sc = mac->mac_sc;
-
- if (spu != 0)
- bwn_spu_workaround(mac, channel);
-
- BWN_WRITE_2(mac, BWN_CHANNEL, bwn_phy_g_chan2freq(channel));
-
- if (channel == 14) {
- if (siba_sprom_get_ccode(sc->sc_dev) == SIBA_CCODE_JAPAN)
- bwn_hf_write(mac,
- bwn_hf_read(mac) & ~BWN_HF_JAPAN_CHAN14_OFF);
- else
- bwn_hf_write(mac,
- bwn_hf_read(mac) | BWN_HF_JAPAN_CHAN14_OFF);
- BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
- BWN_READ_2(mac, BWN_CHANNEL_EXT) | (1 << 11));
- return;
- }
-
- BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
- BWN_READ_2(mac, BWN_CHANNEL_EXT) & 0xf7bf);
-}
-
-static uint16_t
-bwn_phy_g_chan2freq(uint8_t channel)
-{
- static const uint8_t bwn_phy_g_rf_channels[] = BWN_PHY_G_RF_CHANNELS;
-
- KASSERT(channel >= 1 && channel <= 14,
- ("%s:%d: fail", __func__, __LINE__));
-
- return (bwn_phy_g_rf_channels[channel - 1]);
-}
-
-static void
-bwn_phy_g_set_txpwr_sub(struct bwn_mac *mac, const struct bwn_bbatt *bbatt,
- const struct bwn_rfatt *rfatt, uint8_t txctl)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
- uint16_t bb, rf;
- uint16_t tx_bias, tx_magn;
-
- bb = bbatt->att;
- rf = rfatt->att;
- tx_bias = lo->tx_bias;
- tx_magn = lo->tx_magn;
- if (tx_bias == 0xff)
- tx_bias = 0;
-
- pg->pg_txctl = txctl;
- memmove(&pg->pg_rfatt, rfatt, sizeof(*rfatt));
- pg->pg_rfatt.padmix = (txctl & BWN_TXCTL_TXMIX) ? 1 : 0;
- memmove(&pg->pg_bbatt, bbatt, sizeof(*bbatt));
- bwn_phy_g_set_bbatt(mac, bb);
- bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_RADIO_ATT, rf);
- if (phy->rf_ver == 0x2050 && phy->rf_rev == 8)
- BWN_RF_WRITE(mac, 0x43, (rf & 0x000f) | (txctl & 0x0070));
- else {
- BWN_RF_SETMASK(mac, 0x43, 0xfff0, (rf & 0x000f));
- BWN_RF_SETMASK(mac, 0x52, ~0x0070, (txctl & 0x0070));
- }
- if (BWN_HAS_TXMAG(phy))
- BWN_RF_WRITE(mac, 0x52, tx_magn | tx_bias);
- else
- BWN_RF_SETMASK(mac, 0x52, 0xfff0, (tx_bias & 0x000f));
- bwn_lo_g_adjust(mac);
-}
-
-static void
-bwn_phy_g_set_bbatt(struct bwn_mac *mac,
- uint16_t bbatt)
-{
- struct bwn_phy *phy = &mac->mac_phy;
-
- if (phy->analog == 0) {
- BWN_WRITE_2(mac, BWN_PHY0,
- (BWN_READ_2(mac, BWN_PHY0) & 0xfff0) | bbatt);
- return;
- }
- if (phy->analog > 1) {
- BWN_PHY_SETMASK(mac, BWN_PHY_DACCTL, 0xffc3, bbatt << 2);
- return;
- }
- BWN_PHY_SETMASK(mac, BWN_PHY_DACCTL, 0xff87, bbatt << 3);
-}
-
-static uint16_t
-bwn_rf_2050_rfoverval(struct bwn_mac *mac, uint16_t reg, uint32_t lpd)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_g *pg = &phy->phy_g;
- struct bwn_softc *sc = mac->mac_sc;
- int max_lb_gain;
- uint16_t extlna;
- uint16_t i;
-
- if (phy->gmode == 0)
- return (0);
-
- if (BWN_HAS_LOOPBACK(phy)) {
- max_lb_gain = pg->pg_max_lb_gain;
- max_lb_gain += (phy->rf_rev == 8) ? 0x3e : 0x26;
- if (max_lb_gain >= 0x46) {
- extlna = 0x3000;
- max_lb_gain -= 0x46;
- } else if (max_lb_gain >= 0x3a) {
- extlna = 0x1000;
- max_lb_gain -= 0x3a;
- } else if (max_lb_gain >= 0x2e) {
- extlna = 0x2000;
- max_lb_gain -= 0x2e;
- } else {
- extlna = 0;
- max_lb_gain -= 0x10;
- }
-
- for (i = 0; i < 16; i++) {
- max_lb_gain -= (i * 6);
- if (max_lb_gain < 6)
- break;
- }
-
- if ((phy->rev < 7) ||
- !(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA)) {
- if (reg == BWN_PHY_RFOVER) {
- return (0x1b3);
- } else if (reg == BWN_PHY_RFOVERVAL) {
- extlna |= (i << 8);
- switch (lpd) {
- case BWN_LPD(0, 1, 1):
- return (0x0f92);
- case BWN_LPD(0, 0, 1):
- case BWN_LPD(1, 0, 1):
- return (0x0092 | extlna);
- case BWN_LPD(1, 0, 0):
- return (0x0093 | extlna);
- }
- KASSERT(0 == 1,
- ("%s:%d: fail", __func__, __LINE__));
- }
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- } else {
- if (reg == BWN_PHY_RFOVER)
- return (0x9b3);
- if (reg == BWN_PHY_RFOVERVAL) {
- if (extlna)
- extlna |= 0x8000;
- extlna |= (i << 8);
- switch (lpd) {
- case BWN_LPD(0, 1, 1):
- return (0x8f92);
- case BWN_LPD(0, 0, 1):
- return (0x8092 | extlna);
- case BWN_LPD(1, 0, 1):
- return (0x2092 | extlna);
- case BWN_LPD(1, 0, 0):
- return (0x2093 | extlna);
- }
- KASSERT(0 == 1,
- ("%s:%d: fail", __func__, __LINE__));
- }
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
- return (0);
- }
-
- if ((phy->rev < 7) ||
- !(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA)) {
- if (reg == BWN_PHY_RFOVER) {
- return (0x1b3);
- } else if (reg == BWN_PHY_RFOVERVAL) {
- switch (lpd) {
- case BWN_LPD(0, 1, 1):
- return (0x0fb2);
- case BWN_LPD(0, 0, 1):
- return (0x00b2);
- case BWN_LPD(1, 0, 1):
- return (0x30b2);
- case BWN_LPD(1, 0, 0):
- return (0x30b3);
- }
- KASSERT(0 == 1,
- ("%s:%d: fail", __func__, __LINE__));
- }
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- } else {
- if (reg == BWN_PHY_RFOVER) {
- return (0x9b3);
- } else if (reg == BWN_PHY_RFOVERVAL) {
- switch (lpd) {
- case BWN_LPD(0, 1, 1):
- return (0x8fb2);
- case BWN_LPD(0, 0, 1):
- return (0x80b2);
- case BWN_LPD(1, 0, 1):
- return (0x20b2);
- case BWN_LPD(1, 0, 0):
- return (0x20b3);
- }
- KASSERT(0 == 1,
- ("%s:%d: fail", __func__, __LINE__));
- }
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
- return (0);
-}
-
-static void
-bwn_spu_workaround(struct bwn_mac *mac, uint8_t channel)
-{
-
- if (mac->mac_phy.rf_ver != 0x2050 || mac->mac_phy.rf_rev >= 6)
- return;
- BWN_WRITE_2(mac, BWN_CHANNEL, (channel <= 10) ?
- bwn_phy_g_chan2freq(channel + 4) : bwn_phy_g_chan2freq(1));
- DELAY(1000);
- BWN_WRITE_2(mac, BWN_CHANNEL, bwn_phy_g_chan2freq(channel));
-}
-
static int
bwn_fw_gets(struct bwn_mac *mac, enum bwn_fwtype type)
{
@@ -7834,7 +4096,7 @@ fail:
#undef GET_NEXTIV32
}
-static int
+int
bwn_switch_channel(struct bwn_mac *mac, int chan)
{
struct bwn_phy *phy = &(mac->mac_phy);
@@ -9878,130 +6140,6 @@ bwn_dma_getslot(struct bwn_dma_ring *dr)
return (slot);
}
-static int
-bwn_phy_shm_tssi_read(struct bwn_mac *mac, uint16_t shm_offset)
-{
- const uint8_t ofdm = (shm_offset != BWN_SHARED_TSSI_CCK);
- unsigned int a, b, c, d;
- unsigned int avg;
- uint32_t tmp;
-
- tmp = bwn_shm_read_4(mac, BWN_SHARED, shm_offset);
- a = tmp & 0xff;
- b = (tmp >> 8) & 0xff;
- c = (tmp >> 16) & 0xff;
- d = (tmp >> 24) & 0xff;
- if (a == 0 || a == BWN_TSSI_MAX || b == 0 || b == BWN_TSSI_MAX ||
- c == 0 || c == BWN_TSSI_MAX || d == 0 || d == BWN_TSSI_MAX)
- return (ENOENT);
- bwn_shm_write_4(mac, BWN_SHARED, shm_offset,
- BWN_TSSI_MAX | (BWN_TSSI_MAX << 8) |
- (BWN_TSSI_MAX << 16) | (BWN_TSSI_MAX << 24));
-
- if (ofdm) {
- a = (a + 32) & 0x3f;
- b = (b + 32) & 0x3f;
- c = (c + 32) & 0x3f;
- d = (d + 32) & 0x3f;
- }
-
- avg = (a + b + c + d + 2) / 4;
- if (ofdm) {
- if (bwn_shm_read_2(mac, BWN_SHARED, BWN_SHARED_HFLO)
- & BWN_HF_4DB_CCK_POWERBOOST)
- avg = (avg >= 13) ? (avg - 13) : 0;
- }
- return (avg);
-}
-
-static void
-bwn_phy_g_setatt(struct bwn_mac *mac, int *bbattp, int *rfattp)
-{
- struct bwn_txpwr_loctl *lo = &mac->mac_phy.phy_g.pg_loctl;
- int rfatt = *rfattp;
- int bbatt = *bbattp;
-
- while (1) {
- if (rfatt > lo->rfatt.max && bbatt > lo->bbatt.max - 4)
- break;
- if (rfatt < lo->rfatt.min && bbatt < lo->bbatt.min + 4)
- break;
- if (bbatt > lo->bbatt.max && rfatt > lo->rfatt.max - 1)
- break;
- if (bbatt < lo->bbatt.min && rfatt < lo->rfatt.min + 1)
- break;
- if (bbatt > lo->bbatt.max) {
- bbatt -= 4;
- rfatt += 1;
- continue;
- }
- if (bbatt < lo->bbatt.min) {
- bbatt += 4;
- rfatt -= 1;
- continue;
- }
- if (rfatt > lo->rfatt.max) {
- rfatt -= 1;
- bbatt += 4;
- continue;
- }
- if (rfatt < lo->rfatt.min) {
- rfatt += 1;
- bbatt -= 4;
- continue;
- }
- break;
- }
-
- *rfattp = MIN(MAX(rfatt, lo->rfatt.min), lo->rfatt.max);
- *bbattp = MIN(MAX(bbatt, lo->bbatt.min), lo->bbatt.max);
-}
-
-static void
-bwn_phy_lock(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
-
- KASSERT(siba_get_revid(sc->sc_dev) >= 3,
- ("%s: unsupported rev %d", __func__, siba_get_revid(sc->sc_dev)));
-
- if (ic->ic_opmode != IEEE80211_M_HOSTAP)
- bwn_psctl(mac, BWN_PS_AWAKE);
-}
-
-static void
-bwn_phy_unlock(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
-
- KASSERT(siba_get_revid(sc->sc_dev) >= 3,
- ("%s: unsupported rev %d", __func__, siba_get_revid(sc->sc_dev)));
-
- if (ic->ic_opmode != IEEE80211_M_HOSTAP)
- bwn_psctl(mac, 0);
-}
-
-static void
-bwn_rf_lock(struct bwn_mac *mac)
-{
-
- BWN_WRITE_4(mac, BWN_MACCTL,
- BWN_READ_4(mac, BWN_MACCTL) | BWN_MACCTL_RADIO_LOCK);
- BWN_READ_4(mac, BWN_MACCTL);
- DELAY(10);
-}
-
-static void
-bwn_rf_unlock(struct bwn_mac *mac)
-{
-
- BWN_READ_2(mac, BWN_PHYVER);
- BWN_WRITE_4(mac, BWN_MACCTL,
- BWN_READ_4(mac, BWN_MACCTL) & ~BWN_MACCTL_RADIO_LOCK);
-}
-
static struct bwn_pio_txqueue *
bwn_pio_parse_cookie(struct bwn_mac *mac, uint16_t cookie,
struct bwn_pio_txpkt **pack)
@@ -10699,3343 +6837,6 @@ bwn_rfswitch(void *arg)
}
static void
-bwn_phy_lp_init_pre(struct bwn_mac *mac)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_lp *plp = &phy->phy_lp;
-
- plp->plp_antenna = BWN_ANT_DEFAULT;
-}
-
-static int
-bwn_phy_lp_init(struct bwn_mac *mac)
-{
- static const struct bwn_stxtable tables[] = {
- { 2, 6, 0x3d, 3, 0x01 }, { 1, 12, 0x4c, 1, 0x01 },
- { 1, 8, 0x50, 0, 0x7f }, { 0, 8, 0x44, 0, 0xff },
- { 1, 0, 0x4a, 0, 0xff }, { 0, 4, 0x4d, 0, 0xff },
- { 1, 4, 0x4e, 0, 0xff }, { 0, 12, 0x4f, 0, 0x0f },
- { 1, 0, 0x4f, 4, 0x0f }, { 3, 0, 0x49, 0, 0x0f },
- { 4, 3, 0x46, 4, 0x07 }, { 3, 15, 0x46, 0, 0x01 },
- { 4, 0, 0x46, 1, 0x07 }, { 3, 8, 0x48, 4, 0x07 },
- { 3, 11, 0x48, 0, 0x0f }, { 3, 4, 0x49, 4, 0x0f },
- { 2, 15, 0x45, 0, 0x01 }, { 5, 13, 0x52, 4, 0x07 },
- { 6, 0, 0x52, 7, 0x01 }, { 5, 3, 0x41, 5, 0x07 },
- { 5, 6, 0x41, 0, 0x0f }, { 5, 10, 0x42, 5, 0x07 },
- { 4, 15, 0x42, 0, 0x01 }, { 5, 0, 0x42, 1, 0x07 },
- { 4, 11, 0x43, 4, 0x0f }, { 4, 7, 0x43, 0, 0x0f },
- { 4, 6, 0x45, 1, 0x01 }, { 2, 7, 0x40, 4, 0x0f },
- { 2, 11, 0x40, 0, 0x0f }
- };
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- const struct bwn_stxtable *st;
- struct ieee80211com *ic = &sc->sc_ic;
- int i, error;
- uint16_t tmp;
-
- bwn_phy_lp_readsprom(mac); /* XXX bad place */
- bwn_phy_lp_bbinit(mac);
-
- /* initialize RF */
- BWN_PHY_SET(mac, BWN_PHY_4WIRECTL, 0x2);
- DELAY(1);
- BWN_PHY_MASK(mac, BWN_PHY_4WIRECTL, 0xfffd);
- DELAY(1);
-
- if (mac->mac_phy.rf_ver == 0x2062)
- bwn_phy_lp_b2062_init(mac);
- else {
- bwn_phy_lp_b2063_init(mac);
-
- /* synchronize stx table. */
- for (i = 0; i < N(tables); i++) {
- st = &tables[i];
- tmp = BWN_RF_READ(mac, st->st_rfaddr);
- tmp >>= st->st_rfshift;
- tmp <<= st->st_physhift;
- BWN_PHY_SETMASK(mac,
- BWN_PHY_OFDM(0xf2 + st->st_phyoffset),
- ~(st->st_mask << st->st_physhift), tmp);
- }
-
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xf0), 0x5f80);
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xf1), 0);
- }
-
- /* calibrate RC */
- if (mac->mac_phy.rev >= 2)
- bwn_phy_lp_rxcal_r2(mac);
- else if (!plp->plp_rccap) {
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- bwn_phy_lp_rccal_r12(mac);
- } else
- bwn_phy_lp_set_rccap(mac);
-
- error = bwn_phy_lp_switch_channel(mac, 7);
- if (error)
- device_printf(sc->sc_dev,
- "failed to change channel 7 (%d)\n", error);
- bwn_phy_lp_txpctl_init(mac);
- bwn_phy_lp_calib(mac);
- return (0);
-}
-
-static uint16_t
-bwn_phy_lp_read(struct bwn_mac *mac, uint16_t reg)
-{
-
- BWN_WRITE_2(mac, BWN_PHYCTL, reg);
- return (BWN_READ_2(mac, BWN_PHYDATA));
-}
-
-static void
-bwn_phy_lp_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
-{
-
- BWN_WRITE_2(mac, BWN_PHYCTL, reg);
- BWN_WRITE_2(mac, BWN_PHYDATA, value);
-}
-
-static void
-bwn_phy_lp_maskset(struct bwn_mac *mac, uint16_t reg, uint16_t mask,
- uint16_t set)
-{
-
- BWN_WRITE_2(mac, BWN_PHYCTL, reg);
- BWN_WRITE_2(mac, BWN_PHYDATA,
- (BWN_READ_2(mac, BWN_PHYDATA) & mask) | set);
-}
-
-static uint16_t
-bwn_phy_lp_rf_read(struct bwn_mac *mac, uint16_t reg)
-{
-
- KASSERT(reg != 1, ("unaccessible register %d", reg));
- if (mac->mac_phy.rev < 2 && reg != 0x4001)
- reg |= 0x100;
- if (mac->mac_phy.rev >= 2)
- reg |= 0x200;
- BWN_WRITE_2(mac, BWN_RFCTL, reg);
- return BWN_READ_2(mac, BWN_RFDATALO);
-}
-
-static void
-bwn_phy_lp_rf_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
-{
-
- KASSERT(reg != 1, ("unaccessible register %d", reg));
- BWN_WRITE_2(mac, BWN_RFCTL, reg);
- BWN_WRITE_2(mac, BWN_RFDATALO, value);
-}
-
-static void
-bwn_phy_lp_rf_onoff(struct bwn_mac *mac, int on)
-{
-
- if (on) {
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xe0ff);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2,
- (mac->mac_phy.rev >= 2) ? 0xf7f7 : 0xffe7);
- return;
- }
-
- if (mac->mac_phy.rev >= 2) {
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x83ff);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x1f00);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS, 0x80ff);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xdfff);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x0808);
- return;
- }
-
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xe0ff);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x1f00);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfcff);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x0018);
-}
-
-static int
-bwn_phy_lp_switch_channel(struct bwn_mac *mac, uint32_t chan)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_lp *plp = &phy->phy_lp;
- int error;
-
- if (phy->rf_ver == 0x2063) {
- error = bwn_phy_lp_b2063_switch_channel(mac, chan);
- if (error)
- return (error);
- } else {
- error = bwn_phy_lp_b2062_switch_channel(mac, chan);
- if (error)
- return (error);
- bwn_phy_lp_set_anafilter(mac, chan);
- bwn_phy_lp_set_gaintbl(mac, ieee80211_ieee2mhz(chan, 0));
- }
-
- plp->plp_chan = chan;
- BWN_WRITE_2(mac, BWN_CHANNEL, chan);
- return (0);
-}
-
-static uint32_t
-bwn_phy_lp_get_default_chan(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
-
- return (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan) ? 1 : 36);
-}
-
-static void
-bwn_phy_lp_set_antenna(struct bwn_mac *mac, int antenna)
-{
- struct bwn_phy *phy = &mac->mac_phy;
- struct bwn_phy_lp *plp = &phy->phy_lp;
-
- if (phy->rev >= 2 || antenna > BWN_ANTAUTO1)
- return;
-
- bwn_hf_write(mac, bwn_hf_read(mac) & ~BWN_HF_UCODE_ANTDIV_HELPER);
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xfffd, antenna & 0x2);
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xfffe, antenna & 0x1);
- bwn_hf_write(mac, bwn_hf_read(mac) | BWN_HF_UCODE_ANTDIV_HELPER);
- plp->plp_antenna = antenna;
-}
-
-static void
-bwn_phy_lp_task_60s(struct bwn_mac *mac)
-{
-
- bwn_phy_lp_calib(mac);
-}
-
-static void
-bwn_phy_lp_readsprom(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
-
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- plp->plp_txisoband_m = siba_sprom_get_tri2g(sc->sc_dev);
- plp->plp_bxarch = siba_sprom_get_bxa2g(sc->sc_dev);
- plp->plp_rxpwroffset = siba_sprom_get_rxpo2g(sc->sc_dev);
- plp->plp_rssivf = siba_sprom_get_rssismf2g(sc->sc_dev);
- plp->plp_rssivc = siba_sprom_get_rssismc2g(sc->sc_dev);
- plp->plp_rssigs = siba_sprom_get_rssisav2g(sc->sc_dev);
- return;
- }
-
- plp->plp_txisoband_l = siba_sprom_get_tri5gl(sc->sc_dev);
- plp->plp_txisoband_m = siba_sprom_get_tri5g(sc->sc_dev);
- plp->plp_txisoband_h = siba_sprom_get_tri5gh(sc->sc_dev);
- plp->plp_bxarch = siba_sprom_get_bxa5g(sc->sc_dev);
- plp->plp_rxpwroffset = siba_sprom_get_rxpo5g(sc->sc_dev);
- plp->plp_rssivf = siba_sprom_get_rssismf5g(sc->sc_dev);
- plp->plp_rssivc = siba_sprom_get_rssismc5g(sc->sc_dev);
- plp->plp_rssigs = siba_sprom_get_rssisav5g(sc->sc_dev);
-}
-
-static void
-bwn_phy_lp_bbinit(struct bwn_mac *mac)
-{
-
- bwn_phy_lp_tblinit(mac);
- if (mac->mac_phy.rev >= 2)
- bwn_phy_lp_bbinit_r2(mac);
- else
- bwn_phy_lp_bbinit_r01(mac);
-}
-
-static void
-bwn_phy_lp_txpctl_init(struct bwn_mac *mac)
-{
- struct bwn_txgain gain_2ghz = { 4, 12, 12, 0 };
- struct bwn_txgain gain_5ghz = { 7, 15, 14, 0 };
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
-
- bwn_phy_lp_set_txgain(mac,
- IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan) ? &gain_2ghz : &gain_5ghz);
- bwn_phy_lp_set_bbmult(mac, 150);
-}
-
-static void
-bwn_phy_lp_calib(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- const struct bwn_rxcompco *rc = NULL;
- struct bwn_txgain ogain;
- int i, omode, oafeovr, orf, obbmult;
- uint8_t mode, fc = 0;
-
- if (plp->plp_chanfullcal != plp->plp_chan) {
- plp->plp_chanfullcal = plp->plp_chan;
- fc = 1;
- }
-
- bwn_mac_suspend(mac);
-
- /* BlueTooth Coexistance Override */
- BWN_WRITE_2(mac, BWN_BTCOEX_CTL, 0x3);
- BWN_WRITE_2(mac, BWN_BTCOEX_TXCTL, 0xff);
-
- if (mac->mac_phy.rev >= 2)
- bwn_phy_lp_digflt_save(mac);
- bwn_phy_lp_get_txpctlmode(mac);
- mode = plp->plp_txpctlmode;
- bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
- if (mac->mac_phy.rev == 0 && mode != BWN_PHYLP_TXPCTL_OFF)
- bwn_phy_lp_bugfix(mac);
- if (mac->mac_phy.rev >= 2 && fc == 1) {
- bwn_phy_lp_get_txpctlmode(mac);
- omode = plp->plp_txpctlmode;
- oafeovr = BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVR) & 0x40;
- if (oafeovr)
- ogain = bwn_phy_lp_get_txgain(mac);
- orf = BWN_PHY_READ(mac, BWN_PHY_RF_PWR_OVERRIDE) & 0xff;
- obbmult = bwn_phy_lp_get_bbmult(mac);
- bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
- if (oafeovr)
- bwn_phy_lp_set_txgain(mac, &ogain);
- bwn_phy_lp_set_bbmult(mac, obbmult);
- bwn_phy_lp_set_txpctlmode(mac, omode);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_PWR_OVERRIDE, 0xff00, orf);
- }
- bwn_phy_lp_set_txpctlmode(mac, mode);
- if (mac->mac_phy.rev >= 2)
- bwn_phy_lp_digflt_restore(mac);
-
- /* do RX IQ Calculation; assumes that noise is true. */
- if (siba_get_chipid(sc->sc_dev) == 0x5354) {
- for (i = 0; i < N(bwn_rxcompco_5354); i++) {
- if (bwn_rxcompco_5354[i].rc_chan == plp->plp_chan)
- rc = &bwn_rxcompco_5354[i];
- }
- } else if (mac->mac_phy.rev >= 2)
- rc = &bwn_rxcompco_r2;
- else {
- for (i = 0; i < N(bwn_rxcompco_r12); i++) {
- if (bwn_rxcompco_r12[i].rc_chan == plp->plp_chan)
- rc = &bwn_rxcompco_r12[i];
- }
- }
- if (rc == NULL)
- goto fail;
-
- BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0xff00, rc->rc_c1);
- BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0x00ff, rc->rc_c0 << 8);
-
- bwn_phy_lp_set_trsw_over(mac, 1 /* TX */, 0 /* RX */);
-
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x8);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfff7, 0);
- } else {
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x20);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xffdf, 0);
- }
-
- bwn_phy_lp_set_rxgain(mac, 0x2d5d);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xfffe);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVRVAL, 0xfffe);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x800);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x800);
- bwn_phy_lp_set_deaf(mac, 0);
- /* XXX no checking return value? */
- (void)bwn_phy_lp_calc_rx_iq_comp(mac, 0xfff0);
- bwn_phy_lp_clear_deaf(mac, 0);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xfffc);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xfff7);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xffdf);
-
- /* disable RX GAIN override. */
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xfffe);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xffef);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xffbf);
- if (mac->mac_phy.rev >= 2) {
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfeff);
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfbff);
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xe5), 0xfff7);
- }
- } else {
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfdff);
- }
-
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xfffe);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVRVAL, 0xf7ff);
-fail:
- bwn_mac_enable(mac);
-}
-
-static void
-bwn_phy_lp_switch_analog(struct bwn_mac *mac, int on)
-{
-
- if (on) {
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xfff8);
- return;
- }
-
- BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVRVAL, 0x0007);
- BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVR, 0x0007);
-}
-
-static int
-bwn_phy_lp_b2063_switch_channel(struct bwn_mac *mac, uint8_t chan)
-{
- static const struct bwn_b206x_chan *bc = NULL;
- struct bwn_softc *sc = mac->mac_sc;
- uint32_t count, freqref, freqvco, freqxtal, val[3], timeout, timeoutref,
- tmp[6];
- uint16_t old, scale, tmp16;
- int i, div;
-
- for (i = 0; i < N(bwn_b2063_chantable); i++) {
- if (bwn_b2063_chantable[i].bc_chan == chan) {
- bc = &bwn_b2063_chantable[i];
- break;
- }
- }
- if (bc == NULL)
- return (EINVAL);
-
- BWN_RF_WRITE(mac, BWN_B2063_LOGEN_VCOBUF1, bc->bc_data[0]);
- BWN_RF_WRITE(mac, BWN_B2063_LOGEN_MIXER2, bc->bc_data[1]);
- BWN_RF_WRITE(mac, BWN_B2063_LOGEN_BUF2, bc->bc_data[2]);
- BWN_RF_WRITE(mac, BWN_B2063_LOGEN_RCCR1, bc->bc_data[3]);
- BWN_RF_WRITE(mac, BWN_B2063_A_RX_1ST3, bc->bc_data[4]);
- BWN_RF_WRITE(mac, BWN_B2063_A_RX_2ND1, bc->bc_data[5]);
- BWN_RF_WRITE(mac, BWN_B2063_A_RX_2ND4, bc->bc_data[6]);
- BWN_RF_WRITE(mac, BWN_B2063_A_RX_2ND7, bc->bc_data[7]);
- BWN_RF_WRITE(mac, BWN_B2063_A_RX_PS6, bc->bc_data[8]);
- BWN_RF_WRITE(mac, BWN_B2063_TX_RF_CTL2, bc->bc_data[9]);
- BWN_RF_WRITE(mac, BWN_B2063_TX_RF_CTL5, bc->bc_data[10]);
- BWN_RF_WRITE(mac, BWN_B2063_PA_CTL11, bc->bc_data[11]);
-
- old = BWN_RF_READ(mac, BWN_B2063_COM15);
- BWN_RF_SET(mac, BWN_B2063_COM15, 0x1e);
-
- freqxtal = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
- freqvco = bc->bc_freq << ((bc->bc_freq > 4000) ? 1 : 2);
- freqref = freqxtal * 3;
- div = (freqxtal <= 26000000 ? 1 : 2);
- timeout = ((((8 * freqxtal) / (div * 5000000)) + 1) >> 1) - 1;
- timeoutref = ((((8 * freqxtal) / (div * (timeout + 1))) +
- 999999) / 1000000) + 1;
-
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_VCO_CALIB3, 0x2);
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_VCO_CALIB6,
- 0xfff8, timeout >> 2);
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_VCO_CALIB7,
- 0xff9f,timeout << 5);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_VCO_CALIB5, timeoutref);
-
- val[0] = bwn_phy_lp_roundup(freqxtal, 1000000, 16);
- val[1] = bwn_phy_lp_roundup(freqxtal, 1000000 * div, 16);
- val[2] = bwn_phy_lp_roundup(freqvco, 3, 16);
-
- count = (bwn_phy_lp_roundup(val[2], val[1] + 16, 16) * (timeout + 1) *
- (timeoutref + 1)) - 1;
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_VCO_CALIB7,
- 0xf0, count >> 8);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_VCO_CALIB8, count & 0xff);
-
- tmp[0] = ((val[2] * 62500) / freqref) << 4;
- tmp[1] = ((val[2] * 62500) % freqref) << 4;
- while (tmp[1] >= freqref) {
- tmp[0]++;
- tmp[1] -= freqref;
- }
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_SG1, 0xffe0, tmp[0] >> 4);
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_SG2, 0xfe0f, tmp[0] << 4);
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_SG2, 0xfff0, tmp[0] >> 16);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_SG3, (tmp[1] >> 8) & 0xff);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_SG4, tmp[1] & 0xff);
-
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF1, 0xb9);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF2, 0x88);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF3, 0x28);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF4, 0x63);
-
- tmp[2] = ((41 * (val[2] - 3000)) /1200) + 27;
- tmp[3] = bwn_phy_lp_roundup(132000 * tmp[0], 8451, 16);
-
- if (howmany(tmp[3], tmp[2]) > 60) {
- scale = 1;
- tmp[4] = ((tmp[3] + tmp[2]) / (tmp[2] << 1)) - 8;
- } else {
- scale = 0;
- tmp[4] = ((tmp[3] + (tmp[2] >> 1)) / tmp[2]) - 8;
- }
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP2, 0xffc0, tmp[4]);
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP2, 0xffbf, scale << 6);
-
- tmp[5] = bwn_phy_lp_roundup(100 * val[0], val[2], 16) * (tmp[4] * 8) *
- (scale + 1);
- if (tmp[5] > 150)
- tmp[5] = 0;
-
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP3, 0xffe0, tmp[5]);
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP3, 0xffdf, scale << 5);
-
- BWN_RF_SETMASK(mac, BWN_B2063_JTAG_XTAL_12, 0xfffb, 0x4);
- if (freqxtal > 26000000)
- BWN_RF_SET(mac, BWN_B2063_JTAG_XTAL_12, 0x2);
- else
- BWN_RF_MASK(mac, BWN_B2063_JTAG_XTAL_12, 0xfd);
-
- if (val[0] == 45)
- BWN_RF_SET(mac, BWN_B2063_JTAG_VCO1, 0x2);
- else
- BWN_RF_MASK(mac, BWN_B2063_JTAG_VCO1, 0xfd);
-
- BWN_RF_SET(mac, BWN_B2063_PLL_SP2, 0x3);
- DELAY(1);
- BWN_RF_MASK(mac, BWN_B2063_PLL_SP2, 0xfffc);
-
- /* VCO Calibration */
- BWN_RF_MASK(mac, BWN_B2063_PLL_SP1, ~0x40);
- tmp16 = BWN_RF_READ(mac, BWN_B2063_JTAG_CALNRST) & 0xf8;
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16);
- DELAY(1);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16 | 0x4);
- DELAY(1);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16 | 0x6);
- DELAY(1);
- BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16 | 0x7);
- DELAY(300);
- BWN_RF_SET(mac, BWN_B2063_PLL_SP1, 0x40);
-
- BWN_RF_WRITE(mac, BWN_B2063_COM15, old);
- return (0);
-}
-
-static int
-bwn_phy_lp_b2062_switch_channel(struct bwn_mac *mac, uint8_t chan)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- const struct bwn_b206x_chan *bc = NULL;
- uint32_t freqxtal = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
- uint32_t tmp[9];
- int i;
-
- for (i = 0; i < N(bwn_b2062_chantable); i++) {
- if (bwn_b2062_chantable[i].bc_chan == chan) {
- bc = &bwn_b2062_chantable[i];
- break;
- }
- }
-
- if (bc == NULL)
- return (EINVAL);
-
- BWN_RF_SET(mac, BWN_B2062_S_RFPLLCTL14, 0x04);
- BWN_RF_WRITE(mac, BWN_B2062_N_LGENATUNE0, bc->bc_data[0]);
- BWN_RF_WRITE(mac, BWN_B2062_N_LGENATUNE2, bc->bc_data[1]);
- BWN_RF_WRITE(mac, BWN_B2062_N_LGENATUNE3, bc->bc_data[2]);
- BWN_RF_WRITE(mac, BWN_B2062_N_TX_TUNE, bc->bc_data[3]);
- BWN_RF_WRITE(mac, BWN_B2062_S_LGENG_CTL1, bc->bc_data[4]);
- BWN_RF_WRITE(mac, BWN_B2062_N_LGENACTL5, bc->bc_data[5]);
- BWN_RF_WRITE(mac, BWN_B2062_N_LGENACTL6, bc->bc_data[6]);
- BWN_RF_WRITE(mac, BWN_B2062_N_TX_PGA, bc->bc_data[7]);
- BWN_RF_WRITE(mac, BWN_B2062_N_TX_PAD, bc->bc_data[8]);
-
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL33, 0xcc);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL34, 0x07);
- bwn_phy_lp_b2062_reset_pllbias(mac);
- tmp[0] = freqxtal / 1000;
- tmp[1] = plp->plp_div * 1000;
- tmp[2] = tmp[1] * ieee80211_ieee2mhz(chan, 0);
- if (ieee80211_ieee2mhz(chan, 0) < 4000)
- tmp[2] *= 2;
- tmp[3] = 48 * tmp[0];
- tmp[5] = tmp[2] / tmp[3];
- tmp[6] = tmp[2] % tmp[3];
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL26, tmp[5]);
- tmp[4] = tmp[6] * 0x100;
- tmp[5] = tmp[4] / tmp[3];
- tmp[6] = tmp[4] % tmp[3];
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL27, tmp[5]);
- tmp[4] = tmp[6] * 0x100;
- tmp[5] = tmp[4] / tmp[3];
- tmp[6] = tmp[4] % tmp[3];
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL28, tmp[5]);
- tmp[4] = tmp[6] * 0x100;
- tmp[5] = tmp[4] / tmp[3];
- tmp[6] = tmp[4] % tmp[3];
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL29,
- tmp[5] + ((2 * tmp[6]) / tmp[3]));
- tmp[7] = BWN_RF_READ(mac, BWN_B2062_S_RFPLLCTL19);
- tmp[8] = ((2 * tmp[2] * (tmp[7] + 1)) + (3 * tmp[0])) / (6 * tmp[0]);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL23, (tmp[8] >> 8) + 16);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL24, tmp[8] & 0xff);
-
- bwn_phy_lp_b2062_vco_calib(mac);
- if (BWN_RF_READ(mac, BWN_B2062_S_RFPLLCTL3) & 0x10) {
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL33, 0xfc);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL34, 0);
- bwn_phy_lp_b2062_reset_pllbias(mac);
- bwn_phy_lp_b2062_vco_calib(mac);
- if (BWN_RF_READ(mac, BWN_B2062_S_RFPLLCTL3) & 0x10) {
- BWN_RF_MASK(mac, BWN_B2062_S_RFPLLCTL14, ~0x04);
- return (EIO);
- }
- }
- BWN_RF_MASK(mac, BWN_B2062_S_RFPLLCTL14, ~0x04);
- return (0);
-}
-
-static void
-bwn_phy_lp_set_anafilter(struct bwn_mac *mac, uint8_t channel)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- uint16_t tmp = (channel == 14);
-
- if (mac->mac_phy.rev < 2) {
- BWN_PHY_SETMASK(mac, BWN_PHY_LP_PHY_CTL, 0xfcff, tmp << 9);
- if ((mac->mac_phy.rev == 1) && (plp->plp_rccap))
- bwn_phy_lp_set_rccap(mac);
- return;
- }
-
- BWN_RF_WRITE(mac, BWN_B2063_TX_BB_SP3, 0x3f);
-}
-
-static void
-bwn_phy_lp_set_gaintbl(struct bwn_mac *mac, uint32_t freq)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- uint16_t iso, tmp[3];
-
- KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
-
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- iso = plp->plp_txisoband_m;
- else if (freq <= 5320)
- iso = plp->plp_txisoband_l;
- else if (freq <= 5700)
- iso = plp->plp_txisoband_m;
- else
- iso = plp->plp_txisoband_h;
-
- tmp[0] = ((iso - 26) / 12) << 12;
- tmp[1] = tmp[0] + 0x1000;
- tmp[2] = tmp[0] + 0x2000;
-
- bwn_tab_write_multi(mac, BWN_TAB_2(13, 0), 3, tmp);
- bwn_tab_write_multi(mac, BWN_TAB_2(12, 0), 3, tmp);
-}
-
-static void
-bwn_phy_lp_digflt_save(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- int i;
- static const uint16_t addr[] = {
- BWN_PHY_OFDM(0xc1), BWN_PHY_OFDM(0xc2),
- BWN_PHY_OFDM(0xc3), BWN_PHY_OFDM(0xc4),
- BWN_PHY_OFDM(0xc5), BWN_PHY_OFDM(0xc6),
- BWN_PHY_OFDM(0xc7), BWN_PHY_OFDM(0xc8),
- BWN_PHY_OFDM(0xcf),
- };
- static const uint16_t val[] = {
- 0xde5e, 0xe832, 0xe331, 0x4d26,
- 0x0026, 0x1420, 0x0020, 0xfe08,
- 0x0008,
- };
-
- for (i = 0; i < N(addr); i++) {
- plp->plp_digfilt[i] = BWN_PHY_READ(mac, addr[i]);
- BWN_PHY_WRITE(mac, addr[i], val[i]);
- }
-}
-
-static void
-bwn_phy_lp_get_txpctlmode(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- uint16_t ctl;
-
- ctl = BWN_PHY_READ(mac, BWN_PHY_TX_PWR_CTL_CMD);
- switch (ctl & BWN_PHY_TX_PWR_CTL_CMD_MODE) {
- case BWN_PHY_TX_PWR_CTL_CMD_MODE_OFF:
- plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_OFF;
- break;
- case BWN_PHY_TX_PWR_CTL_CMD_MODE_SW:
- plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_ON_SW;
- break;
- case BWN_PHY_TX_PWR_CTL_CMD_MODE_HW:
- plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_ON_HW;
- break;
- default:
- plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_UNKNOWN;
- device_printf(sc->sc_dev, "unknown command mode\n");
- break;
- }
-}
-
-static void
-bwn_phy_lp_set_txpctlmode(struct bwn_mac *mac, uint8_t mode)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- uint16_t ctl;
- uint8_t old;
-
- bwn_phy_lp_get_txpctlmode(mac);
- old = plp->plp_txpctlmode;
- if (old == mode)
- return;
- plp->plp_txpctlmode = mode;
-
- if (old != BWN_PHYLP_TXPCTL_ON_HW && mode == BWN_PHYLP_TXPCTL_ON_HW) {
- BWN_PHY_SETMASK(mac, BWN_PHY_TX_PWR_CTL_CMD, 0xff80,
- plp->plp_tssiidx);
- BWN_PHY_SETMASK(mac, BWN_PHY_TX_PWR_CTL_NNUM,
- 0x8fff, ((uint16_t)plp->plp_tssinpt << 16));
-
- /* disable TX GAIN override */
- if (mac->mac_phy.rev < 2)
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfeff);
- else {
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xff7f);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xbfff);
- }
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xffbf);
-
- plp->plp_txpwridx = -1;
- }
- if (mac->mac_phy.rev >= 2) {
- if (mode == BWN_PHYLP_TXPCTL_ON_HW)
- BWN_PHY_SET(mac, BWN_PHY_OFDM(0xd0), 0x2);
- else
- BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xd0), 0xfffd);
- }
-
- /* writes TX Power Control mode */
- switch (plp->plp_txpctlmode) {
- case BWN_PHYLP_TXPCTL_OFF:
- ctl = BWN_PHY_TX_PWR_CTL_CMD_MODE_OFF;
- break;
- case BWN_PHYLP_TXPCTL_ON_HW:
- ctl = BWN_PHY_TX_PWR_CTL_CMD_MODE_HW;
- break;
- case BWN_PHYLP_TXPCTL_ON_SW:
- ctl = BWN_PHY_TX_PWR_CTL_CMD_MODE_SW;
- break;
- default:
- ctl = 0;
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
- BWN_PHY_SETMASK(mac, BWN_PHY_TX_PWR_CTL_CMD,
- (uint16_t)~BWN_PHY_TX_PWR_CTL_CMD_MODE, ctl);
-}
-
-static void
-bwn_phy_lp_bugfix(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- const unsigned int size = 256;
- struct bwn_txgain tg;
- uint32_t rxcomp, txgain, coeff, rfpwr, *tabs;
- uint16_t tssinpt, tssiidx, value[2];
- uint8_t mode;
- int8_t txpwridx;
-
- tabs = (uint32_t *)malloc(sizeof(uint32_t) * size, M_DEVBUF,
- M_NOWAIT | M_ZERO);
- if (tabs == NULL) {
- device_printf(sc->sc_dev, "failed to allocate buffer.\n");
- return;
- }
-
- bwn_phy_lp_get_txpctlmode(mac);
- mode = plp->plp_txpctlmode;
- txpwridx = plp->plp_txpwridx;
- tssinpt = plp->plp_tssinpt;
- tssiidx = plp->plp_tssiidx;
-
- bwn_tab_read_multi(mac,
- (mac->mac_phy.rev < 2) ? BWN_TAB_4(10, 0x140) :
- BWN_TAB_4(7, 0x140), size, tabs);
-
- bwn_phy_lp_tblinit(mac);
- bwn_phy_lp_bbinit(mac);
- bwn_phy_lp_txpctl_init(mac);
- bwn_phy_lp_rf_onoff(mac, 1);
- bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
-
- bwn_tab_write_multi(mac,
- (mac->mac_phy.rev < 2) ? BWN_TAB_4(10, 0x140) :
- BWN_TAB_4(7, 0x140), size, tabs);
-
- BWN_WRITE_2(mac, BWN_CHANNEL, plp->plp_chan);
- plp->plp_tssinpt = tssinpt;
- plp->plp_tssiidx = tssiidx;
- bwn_phy_lp_set_anafilter(mac, plp->plp_chan);
- if (txpwridx != -1) {
- /* set TX power by index */
- plp->plp_txpwridx = txpwridx;
- bwn_phy_lp_get_txpctlmode(mac);
- if (plp->plp_txpctlmode != BWN_PHYLP_TXPCTL_OFF)
- bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_ON_SW);
- if (mac->mac_phy.rev >= 2) {
- rxcomp = bwn_tab_read(mac,
- BWN_TAB_4(7, txpwridx + 320));
- txgain = bwn_tab_read(mac,
- BWN_TAB_4(7, txpwridx + 192));
- tg.tg_pad = (txgain >> 16) & 0xff;
- tg.tg_gm = txgain & 0xff;
- tg.tg_pga = (txgain >> 8) & 0xff;
- tg.tg_dac = (rxcomp >> 28) & 0xff;
- bwn_phy_lp_set_txgain(mac, &tg);
- } else {
- rxcomp = bwn_tab_read(mac,
- BWN_TAB_4(10, txpwridx + 320));
- txgain = bwn_tab_read(mac,
- BWN_TAB_4(10, txpwridx + 192));
- BWN_PHY_SETMASK(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL,
- 0xf800, (txgain >> 4) & 0x7fff);
- bwn_phy_lp_set_txgain_dac(mac, txgain & 0x7);
- bwn_phy_lp_set_txgain_pa(mac, (txgain >> 24) & 0x7f);
- }
- bwn_phy_lp_set_bbmult(mac, (rxcomp >> 20) & 0xff);
-
- /* set TX IQCC */
- value[0] = (rxcomp >> 10) & 0x3ff;
- value[1] = rxcomp & 0x3ff;
- bwn_tab_write_multi(mac, BWN_TAB_2(0, 80), 2, value);
-
- coeff = bwn_tab_read(mac,
- (mac->mac_phy.rev >= 2) ? BWN_TAB_4(7, txpwridx + 448) :
- BWN_TAB_4(10, txpwridx + 448));
- bwn_tab_write(mac, BWN_TAB_2(0, 85), coeff & 0xffff);
- if (mac->mac_phy.rev >= 2) {
- rfpwr = bwn_tab_read(mac,
- BWN_TAB_4(7, txpwridx + 576));
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_PWR_OVERRIDE, 0xff00,
- rfpwr & 0xffff);
- }
- bwn_phy_lp_set_txgain_override(mac);
- }
- if (plp->plp_rccap)
- bwn_phy_lp_set_rccap(mac);
- bwn_phy_lp_set_antenna(mac, plp->plp_antenna);
- bwn_phy_lp_set_txpctlmode(mac, mode);
- free(tabs, M_DEVBUF);
-}
-
-static void
-bwn_phy_lp_digflt_restore(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- int i;
- static const uint16_t addr[] = {
- BWN_PHY_OFDM(0xc1), BWN_PHY_OFDM(0xc2),
- BWN_PHY_OFDM(0xc3), BWN_PHY_OFDM(0xc4),
- BWN_PHY_OFDM(0xc5), BWN_PHY_OFDM(0xc6),
- BWN_PHY_OFDM(0xc7), BWN_PHY_OFDM(0xc8),
- BWN_PHY_OFDM(0xcf),
- };
-
- for (i = 0; i < N(addr); i++)
- BWN_PHY_WRITE(mac, addr[i], plp->plp_digfilt[i]);
-}
-
-static void
-bwn_phy_lp_tblinit(struct bwn_mac *mac)
-{
- uint32_t freq = ieee80211_ieee2mhz(bwn_phy_lp_get_default_chan(mac), 0);
-
- if (mac->mac_phy.rev < 2) {
- bwn_phy_lp_tblinit_r01(mac);
- bwn_phy_lp_tblinit_txgain(mac);
- bwn_phy_lp_set_gaintbl(mac, freq);
- return;
- }
-
- bwn_phy_lp_tblinit_r2(mac);
- bwn_phy_lp_tblinit_txgain(mac);
-}
-
-struct bwn_wpair {
- uint16_t reg;
- uint16_t value;
-};
-
-struct bwn_smpair {
- uint16_t offset;
- uint16_t mask;
- uint16_t set;
-};
-
-static void
-bwn_phy_lp_bbinit_r2(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- static const struct bwn_wpair v1[] = {
- { BWN_PHY_AFE_DAC_CTL, 0x50 },
- { BWN_PHY_AFE_CTL, 0x8800 },
- { BWN_PHY_AFE_CTL_OVR, 0 },
- { BWN_PHY_AFE_CTL_OVRVAL, 0 },
- { BWN_PHY_RF_OVERRIDE_0, 0 },
- { BWN_PHY_RF_OVERRIDE_2, 0 },
- { BWN_PHY_OFDM(0xf9), 0 },
- { BWN_PHY_TR_LOOKUP_1, 0 }
- };
- static const struct bwn_smpair v2[] = {
- { BWN_PHY_OFDMSYNCTHRESH0, 0xff00, 0xb4 },
- { BWN_PHY_DCOFFSETTRANSIENT, 0xf8ff, 0x200 },
- { BWN_PHY_DCOFFSETTRANSIENT, 0xff00, 0x7f },
- { BWN_PHY_GAINDIRECTMISMATCH, 0xff0f, 0x40 },
- { BWN_PHY_PREAMBLECONFIRMTO, 0xff00, 0x2 }
- };
- static const struct bwn_smpair v3[] = {
- { BWN_PHY_OFDM(0xfe), 0xffe0, 0x1f },
- { BWN_PHY_OFDM(0xff), 0xffe0, 0xc },
- { BWN_PHY_OFDM(0x100), 0xff00, 0x19 },
- { BWN_PHY_OFDM(0xff), 0x03ff, 0x3c00 },
- { BWN_PHY_OFDM(0xfe), 0xfc1f, 0x3e0 },
- { BWN_PHY_OFDM(0xff), 0xffe0, 0xc },
- { BWN_PHY_OFDM(0x100), 0x00ff, 0x1900 },
- { BWN_PHY_CLIPCTRTHRESH, 0x83ff, 0x5800 },
- { BWN_PHY_CLIPCTRTHRESH, 0xffe0, 0x12 },
- { BWN_PHY_GAINMISMATCH, 0x0fff, 0x9000 },
-
- };
- int i;
-
- for (i = 0; i < N(v1); i++)
- BWN_PHY_WRITE(mac, v1[i].reg, v1[i].value);
- BWN_PHY_SET(mac, BWN_PHY_ADC_COMPENSATION_CTL, 0x10);
- for (i = 0; i < N(v2); i++)
- BWN_PHY_SETMASK(mac, v2[i].offset, v2[i].mask, v2[i].set);
-
- BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, ~0x4000);
- BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, ~0x2000);
- BWN_PHY_SET(mac, BWN_PHY_OFDM(0x10a), 0x1);
- if (siba_get_pci_revid(sc->sc_dev) >= 0x18) {
- bwn_tab_write(mac, BWN_TAB_4(17, 65), 0xec);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x10a), 0xff01, 0x14);
- } else {
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x10a), 0xff01, 0x10);
- }
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xdf), 0xff00, 0xf4);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xdf), 0x00ff, 0xf100);
- BWN_PHY_WRITE(mac, BWN_PHY_CLIPTHRESH, 0x48);
- BWN_PHY_SETMASK(mac, BWN_PHY_HIGAINDB, 0xff00, 0x46);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xe4), 0xff00, 0x10);
- BWN_PHY_SETMASK(mac, BWN_PHY_PWR_THRESH1, 0xfff0, 0x9);
- BWN_PHY_MASK(mac, BWN_PHY_GAINDIRECTMISMATCH, ~0xf);
- BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0x00ff, 0x5500);
- BWN_PHY_SETMASK(mac, BWN_PHY_CLIPCTRTHRESH, 0xfc1f, 0xa0);
- BWN_PHY_SETMASK(mac, BWN_PHY_GAINDIRECTMISMATCH, 0xe0ff, 0x300);
- BWN_PHY_SETMASK(mac, BWN_PHY_HIGAINDB, 0x00ff, 0x2a00);
- if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
- (siba_get_chiprev(sc->sc_dev) == 0)) {
- BWN_PHY_SETMASK(mac, BWN_PHY_LOWGAINDB, 0x00ff, 0x2100);
- BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0xff00, 0xa);
- } else {
- BWN_PHY_SETMASK(mac, BWN_PHY_LOWGAINDB, 0x00ff, 0x1e00);
- BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0xff00, 0xd);
- }
- for (i = 0; i < N(v3); i++)
- BWN_PHY_SETMASK(mac, v3[i].offset, v3[i].mask, v3[i].set);
- if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
- (siba_get_chiprev(sc->sc_dev) == 0)) {
- bwn_tab_write(mac, BWN_TAB_2(0x08, 0x14), 0);
- bwn_tab_write(mac, BWN_TAB_2(0x08, 0x12), 0x40);
- }
-
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x40);
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xf0ff, 0xb00);
- BWN_PHY_SETMASK(mac, BWN_PHY_SYNCPEAKCNT, 0xfff8, 0x6);
- BWN_PHY_SETMASK(mac, BWN_PHY_MINPWR_LEVEL, 0x00ff, 0x9d00);
- BWN_PHY_SETMASK(mac, BWN_PHY_MINPWR_LEVEL, 0xff00, 0xa1);
- BWN_PHY_MASK(mac, BWN_PHY_IDLEAFTERPKTRXTO, 0x00ff);
- } else
- BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, ~0x40);
-
- BWN_PHY_SETMASK(mac, BWN_PHY_CRS_ED_THRESH, 0xff00, 0xb3);
- BWN_PHY_SETMASK(mac, BWN_PHY_CRS_ED_THRESH, 0x00ff, 0xad00);
- BWN_PHY_SETMASK(mac, BWN_PHY_INPUT_PWRDB, 0xff00, plp->plp_rxpwroffset);
- BWN_PHY_SET(mac, BWN_PHY_RESET_CTL, 0x44);
- BWN_PHY_WRITE(mac, BWN_PHY_RESET_CTL, 0x80);
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_RSSI_CTL_0, 0xa954);
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_RSSI_CTL_1,
- 0x2000 | ((uint16_t)plp->plp_rssigs << 10) |
- ((uint16_t)plp->plp_rssivc << 4) | plp->plp_rssivf);
-
- if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
- (siba_get_chiprev(sc->sc_dev) == 0)) {
- BWN_PHY_SET(mac, BWN_PHY_AFE_ADC_CTL_0, 0x1c);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_CTL, 0x00ff, 0x8800);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_ADC_CTL_1, 0xfc3c, 0x0400);
- }
-
- bwn_phy_lp_digflt_save(mac);
-}
-
-static void
-bwn_phy_lp_bbinit_r01(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- static const struct bwn_smpair v1[] = {
- { BWN_PHY_CLIPCTRTHRESH, 0xffe0, 0x0005 },
- { BWN_PHY_CLIPCTRTHRESH, 0xfc1f, 0x0180 },
- { BWN_PHY_CLIPCTRTHRESH, 0x83ff, 0x3c00 },
- { BWN_PHY_GAINDIRECTMISMATCH, 0xfff0, 0x0005 },
- { BWN_PHY_GAIN_MISMATCH_LIMIT, 0xffc0, 0x001a },
- { BWN_PHY_CRS_ED_THRESH, 0xff00, 0x00b3 },
- { BWN_PHY_CRS_ED_THRESH, 0x00ff, 0xad00 }
- };
- static const struct bwn_smpair v2[] = {
- { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_1, 0x3f00, 0x0900 },
- { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0b00 },
- { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0400 },
- { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0b00 },
- { BWN_PHY_TR_LOOKUP_5, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_5, 0xc0ff, 0x0900 },
- { BWN_PHY_TR_LOOKUP_6, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_6, 0xc0ff, 0x0b00 },
- { BWN_PHY_TR_LOOKUP_7, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_7, 0xc0ff, 0x0900 },
- { BWN_PHY_TR_LOOKUP_8, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_8, 0xc0ff, 0x0b00 }
- };
- static const struct bwn_smpair v3[] = {
- { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x0001 },
- { BWN_PHY_TR_LOOKUP_1, 0xc0ff, 0x0400 },
- { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x0001 },
- { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0500 },
- { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x0002 },
- { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0800 },
- { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x0002 },
- { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0a00 }
- };
- static const struct bwn_smpair v4[] = {
- { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x0004 },
- { BWN_PHY_TR_LOOKUP_1, 0xc0ff, 0x0800 },
- { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x0004 },
- { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0c00 },
- { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x0002 },
- { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0100 },
- { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x0002 },
- { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0300 }
- };
- static const struct bwn_smpair v5[] = {
- { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_1, 0xc0ff, 0x0900 },
- { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x000a },
- { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0b00 },
- { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x0006 },
- { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0500 },
- { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x0006 },
- { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0700 }
- };
- int i;
- uint16_t tmp, tmp2;
-
- BWN_PHY_MASK(mac, BWN_PHY_AFE_DAC_CTL, 0xf7ff);
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL_OVR, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_0, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2, 0);
- BWN_PHY_SET(mac, BWN_PHY_AFE_DAC_CTL, 0x0004);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDMSYNCTHRESH0, 0xff00, 0x0078);
- BWN_PHY_SETMASK(mac, BWN_PHY_CLIPCTRTHRESH, 0x83ff, 0x5800);
- BWN_PHY_WRITE(mac, BWN_PHY_ADC_COMPENSATION_CTL, 0x0016);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_ADC_CTL_0, 0xfff8, 0x0004);
- BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0x00ff, 0x5400);
- BWN_PHY_SETMASK(mac, BWN_PHY_HIGAINDB, 0x00ff, 0x2400);
- BWN_PHY_SETMASK(mac, BWN_PHY_LOWGAINDB, 0x00ff, 0x2100);
- BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0xff00, 0x0006);
- BWN_PHY_MASK(mac, BWN_PHY_RX_RADIO_CTL, 0xfffe);
- for (i = 0; i < N(v1); i++)
- BWN_PHY_SETMASK(mac, v1[i].offset, v1[i].mask, v1[i].set);
- BWN_PHY_SETMASK(mac, BWN_PHY_INPUT_PWRDB,
- 0xff00, plp->plp_rxpwroffset);
- if ((siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM) &&
- ((IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) ||
- (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_LDO_PAREF))) {
- siba_cc_pmu_set_ldovolt(sc->sc_dev, SIBA_LDO_PAREF, 0x28);
- siba_cc_pmu_set_ldoparef(sc->sc_dev, 1);
- if (mac->mac_phy.rev == 0)
- BWN_PHY_SETMASK(mac, BWN_PHY_LP_RF_SIGNAL_LUT,
- 0xffcf, 0x0010);
- bwn_tab_write(mac, BWN_TAB_2(11, 7), 60);
- } else {
- siba_cc_pmu_set_ldoparef(sc->sc_dev, 0);
- BWN_PHY_SETMASK(mac, BWN_PHY_LP_RF_SIGNAL_LUT, 0xffcf, 0x0020);
- bwn_tab_write(mac, BWN_TAB_2(11, 7), 100);
- }
- tmp = plp->plp_rssivf | plp->plp_rssivc << 4 | 0xa000;
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_RSSI_CTL_0, tmp);
- if (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_RSSIINV)
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_RSSI_CTL_1, 0xf000, 0x0aaa);
- else
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_RSSI_CTL_1, 0xf000, 0x02aa);
- bwn_tab_write(mac, BWN_TAB_2(11, 1), 24);
- BWN_PHY_SETMASK(mac, BWN_PHY_RX_RADIO_CTL,
- 0xfff9, (plp->plp_bxarch << 1));
- if (mac->mac_phy.rev == 1 &&
- (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_FEM_BT)) {
- for (i = 0; i < N(v2); i++)
- BWN_PHY_SETMASK(mac, v2[i].offset, v2[i].mask,
- v2[i].set);
- } else if (IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ||
- (siba_get_pci_subdevice(sc->sc_dev) == 0x048a) ||
- ((mac->mac_phy.rev == 0) &&
- (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM))) {
- for (i = 0; i < N(v3); i++)
- BWN_PHY_SETMASK(mac, v3[i].offset, v3[i].mask,
- v3[i].set);
- } else if (mac->mac_phy.rev == 1 ||
- (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM)) {
- for (i = 0; i < N(v4); i++)
- BWN_PHY_SETMASK(mac, v4[i].offset, v4[i].mask,
- v4[i].set);
- } else {
- for (i = 0; i < N(v5); i++)
- BWN_PHY_SETMASK(mac, v5[i].offset, v5[i].mask,
- v5[i].set);
- }
- if (mac->mac_phy.rev == 1 &&
- (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_LDO_PAREF)) {
- BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_5, BWN_PHY_TR_LOOKUP_1);
- BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_6, BWN_PHY_TR_LOOKUP_2);
- BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_7, BWN_PHY_TR_LOOKUP_3);
- BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_8, BWN_PHY_TR_LOOKUP_4);
- }
- if ((siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_FEM_BT) &&
- (siba_get_chipid(sc->sc_dev) == 0x5354) &&
- (siba_get_chippkg(sc->sc_dev) == SIBA_CHIPPACK_BCM4712S)) {
- BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x0006);
- BWN_PHY_WRITE(mac, BWN_PHY_GPIO_SELECT, 0x0005);
- BWN_PHY_WRITE(mac, BWN_PHY_GPIO_OUTEN, 0xffff);
- bwn_hf_write(mac, bwn_hf_read(mac) | BWN_HF_PR45960W);
- }
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- BWN_PHY_SET(mac, BWN_PHY_LP_PHY_CTL, 0x8000);
- BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x0040);
- BWN_PHY_SETMASK(mac, BWN_PHY_MINPWR_LEVEL, 0x00ff, 0xa400);
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xf0ff, 0x0b00);
- BWN_PHY_SETMASK(mac, BWN_PHY_SYNCPEAKCNT, 0xfff8, 0x0007);
- BWN_PHY_SETMASK(mac, BWN_PHY_DSSS_CONFIRM_CNT, 0xfff8, 0x0003);
- BWN_PHY_SETMASK(mac, BWN_PHY_DSSS_CONFIRM_CNT, 0xffc7, 0x0020);
- BWN_PHY_MASK(mac, BWN_PHY_IDLEAFTERPKTRXTO, 0x00ff);
- } else {
- BWN_PHY_MASK(mac, BWN_PHY_LP_PHY_CTL, 0x7fff);
- BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, 0xffbf);
- }
- if (mac->mac_phy.rev == 1) {
- tmp = BWN_PHY_READ(mac, BWN_PHY_CLIPCTRTHRESH);
- tmp2 = (tmp & 0x03e0) >> 5;
- tmp2 |= tmp2 << 5;
- BWN_PHY_WRITE(mac, BWN_PHY_4C3, tmp2);
- tmp = BWN_PHY_READ(mac, BWN_PHY_GAINDIRECTMISMATCH);
- tmp2 = (tmp & 0x1f00) >> 8;
- tmp2 |= tmp2 << 5;
- BWN_PHY_WRITE(mac, BWN_PHY_4C4, tmp2);
- tmp = BWN_PHY_READ(mac, BWN_PHY_VERYLOWGAINDB);
- tmp2 = tmp & 0x00ff;
- tmp2 |= tmp << 8;
- BWN_PHY_WRITE(mac, BWN_PHY_4C5, tmp2);
- }
-}
-
-struct bwn_b2062_freq {
- uint16_t freq;
- uint8_t value[6];
-};
-
-static void
-bwn_phy_lp_b2062_init(struct bwn_mac *mac)
-{
-#define CALC_CTL7(freq, div) \
- (((800000000 * (div) + (freq)) / (2 * (freq)) - 8) & 0xff)
-#define CALC_CTL18(freq, div) \
- ((((100 * (freq) + 16000000 * (div)) / (32000000 * (div))) - 1) & 0xff)
-#define CALC_CTL19(freq, div) \
- ((((2 * (freq) + 1000000 * (div)) / (2000000 * (div))) - 1) & 0xff)
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- static const struct bwn_b2062_freq freqdata_tab[] = {
- { 12000, { 6, 6, 6, 6, 10, 6 } },
- { 13000, { 4, 4, 4, 4, 11, 7 } },
- { 14400, { 3, 3, 3, 3, 12, 7 } },
- { 16200, { 3, 3, 3, 3, 13, 8 } },
- { 18000, { 2, 2, 2, 2, 14, 8 } },
- { 19200, { 1, 1, 1, 1, 14, 9 } }
- };
- static const struct bwn_wpair v1[] = {
- { BWN_B2062_N_TXCTL3, 0 },
- { BWN_B2062_N_TXCTL4, 0 },
- { BWN_B2062_N_TXCTL5, 0 },
- { BWN_B2062_N_TXCTL6, 0 },
- { BWN_B2062_N_PDNCTL0, 0x40 },
- { BWN_B2062_N_PDNCTL0, 0 },
- { BWN_B2062_N_CALIB_TS, 0x10 },
- { BWN_B2062_N_CALIB_TS, 0 }
- };
- const struct bwn_b2062_freq *f = NULL;
- uint32_t xtalfreq, ref;
- unsigned int i;
-
- bwn_phy_lp_b2062_tblinit(mac);
-
- for (i = 0; i < N(v1); i++)
- BWN_RF_WRITE(mac, v1[i].reg, v1[i].value);
- if (mac->mac_phy.rev > 0)
- BWN_RF_WRITE(mac, BWN_B2062_S_BG_CTL1,
- (BWN_RF_READ(mac, BWN_B2062_N_COM2) >> 1) | 0x80);
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- BWN_RF_SET(mac, BWN_B2062_N_TSSI_CTL0, 0x1);
- else
- BWN_RF_MASK(mac, BWN_B2062_N_TSSI_CTL0, ~0x1);
-
- KASSERT(siba_get_cc_caps(sc->sc_dev) & SIBA_CC_CAPS_PMU,
- ("%s:%d: fail", __func__, __LINE__));
- xtalfreq = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
- KASSERT(xtalfreq != 0, ("%s:%d: fail", __func__, __LINE__));
-
- if (xtalfreq <= 30000000) {
- plp->plp_div = 1;
- BWN_RF_MASK(mac, BWN_B2062_S_RFPLLCTL1, 0xfffb);
- } else {
- plp->plp_div = 2;
- BWN_RF_SET(mac, BWN_B2062_S_RFPLLCTL1, 0x4);
- }
-
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL7,
- CALC_CTL7(xtalfreq, plp->plp_div));
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL18,
- CALC_CTL18(xtalfreq, plp->plp_div));
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL19,
- CALC_CTL19(xtalfreq, plp->plp_div));
-
- ref = (1000 * plp->plp_div + 2 * xtalfreq) / (2000 * plp->plp_div);
- ref &= 0xffff;
- for (i = 0; i < N(freqdata_tab); i++) {
- if (ref < freqdata_tab[i].freq) {
- f = &freqdata_tab[i];
- break;
- }
- }
- if (f == NULL)
- f = &freqdata_tab[N(freqdata_tab) - 1];
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL8,
- ((uint16_t)(f->value[1]) << 4) | f->value[0]);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL9,
- ((uint16_t)(f->value[3]) << 4) | f->value[2]);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL10, f->value[4]);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL11, f->value[5]);
-#undef CALC_CTL7
-#undef CALC_CTL18
-#undef CALC_CTL19
-}
-
-static void
-bwn_phy_lp_b2063_init(struct bwn_mac *mac)
-{
-
- bwn_phy_lp_b2063_tblinit(mac);
- BWN_RF_WRITE(mac, BWN_B2063_LOGEN_SP5, 0);
- BWN_RF_SET(mac, BWN_B2063_COM8, 0x38);
- BWN_RF_WRITE(mac, BWN_B2063_REG_SP1, 0x56);
- BWN_RF_MASK(mac, BWN_B2063_RX_BB_CTL2, ~0x2);
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP7, 0);
- BWN_RF_WRITE(mac, BWN_B2063_TX_RF_SP6, 0x20);
- BWN_RF_WRITE(mac, BWN_B2063_TX_RF_SP9, 0x40);
- if (mac->mac_phy.rev == 2) {
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP3, 0xa0);
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP4, 0xa0);
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP2, 0x18);
- } else {
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP3, 0x20);
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP2, 0x20);
- }
-}
-
-static void
-bwn_phy_lp_rxcal_r2(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- static const struct bwn_wpair v1[] = {
- { BWN_B2063_RX_BB_SP8, 0x0 },
- { BWN_B2063_RC_CALIB_CTL1, 0x7e },
- { BWN_B2063_RC_CALIB_CTL1, 0x7c },
- { BWN_B2063_RC_CALIB_CTL2, 0x15 },
- { BWN_B2063_RC_CALIB_CTL3, 0x70 },
- { BWN_B2063_RC_CALIB_CTL4, 0x52 },
- { BWN_B2063_RC_CALIB_CTL5, 0x1 },
- { BWN_B2063_RC_CALIB_CTL1, 0x7d }
- };
- static const struct bwn_wpair v2[] = {
- { BWN_B2063_TX_BB_SP3, 0x0 },
- { BWN_B2063_RC_CALIB_CTL1, 0x7e },
- { BWN_B2063_RC_CALIB_CTL1, 0x7c },
- { BWN_B2063_RC_CALIB_CTL2, 0x55 },
- { BWN_B2063_RC_CALIB_CTL3, 0x76 }
- };
- uint32_t freqxtal = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
- int i;
- uint8_t tmp;
-
- tmp = BWN_RF_READ(mac, BWN_B2063_RX_BB_SP8) & 0xff;
-
- for (i = 0; i < 2; i++)
- BWN_RF_WRITE(mac, v1[i].reg, v1[i].value);
- BWN_RF_MASK(mac, BWN_B2063_PLL_SP1, 0xf7);
- for (i = 2; i < N(v1); i++)
- BWN_RF_WRITE(mac, v1[i].reg, v1[i].value);
- for (i = 0; i < 10000; i++) {
- if (BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2)
- break;
- DELAY(1000);
- }
-
- if (!(BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2))
- BWN_RF_WRITE(mac, BWN_B2063_RX_BB_SP8, tmp);
-
- tmp = BWN_RF_READ(mac, BWN_B2063_TX_BB_SP3) & 0xff;
-
- for (i = 0; i < N(v2); i++)
- BWN_RF_WRITE(mac, v2[i].reg, v2[i].value);
- if (freqxtal == 24000000) {
- BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL4, 0xfc);
- BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL5, 0x0);
- } else {
- BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL4, 0x13);
- BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL5, 0x1);
- }
- BWN_RF_WRITE(mac, BWN_B2063_PA_SP7, 0x7d);
- for (i = 0; i < 10000; i++) {
- if (BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2)
- break;
- DELAY(1000);
- }
- if (!(BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2))
- BWN_RF_WRITE(mac, BWN_B2063_TX_BB_SP3, tmp);
- BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL1, 0x7e);
-}
-
-static void
-bwn_phy_lp_rccal_r12(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct bwn_phy_lp_iq_est ie;
- struct bwn_txgain tx_gains;
- static const uint32_t pwrtbl[21] = {
- 0x10000, 0x10557, 0x10e2d, 0x113e0, 0x10f22, 0x0ff64,
- 0x0eda2, 0x0e5d4, 0x0efd1, 0x0fbe8, 0x0b7b8, 0x04b35,
- 0x01a5e, 0x00a0b, 0x00444, 0x001fd, 0x000ff, 0x00088,
- 0x0004c, 0x0002c, 0x0001a,
- };
- uint32_t npwr, ipwr, sqpwr, tmp;
- int loopback, i, j, sum, error;
- uint16_t save[7];
- uint8_t txo, bbmult, txpctlmode;
-
- error = bwn_phy_lp_switch_channel(mac, 7);
- if (error)
- device_printf(sc->sc_dev,
- "failed to change channel to 7 (%d)\n", error);
- txo = (BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVR) & 0x40) ? 1 : 0;
- bbmult = bwn_phy_lp_get_bbmult(mac);
- if (txo)
- tx_gains = bwn_phy_lp_get_txgain(mac);
-
- save[0] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_0);
- save[1] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_VAL_0);
- save[2] = BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVR);
- save[3] = BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVRVAL);
- save[4] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_2);
- save[5] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_2_VAL);
- save[6] = BWN_PHY_READ(mac, BWN_PHY_LP_PHY_CTL);
-
- bwn_phy_lp_get_txpctlmode(mac);
- txpctlmode = plp->plp_txpctlmode;
- bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
-
- /* disable CRS */
- bwn_phy_lp_set_deaf(mac, 1);
- bwn_phy_lp_set_trsw_over(mac, 0, 1);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffb);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x4);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfff7);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x8);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x10);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x10);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xffdf);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x20);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xffbf);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x40);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0x7);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0x38);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xff3f);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0x100);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfdff);
- BWN_PHY_WRITE(mac, BWN_PHY_PS_CTL_OVERRIDE_VAL0, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_PS_CTL_OVERRIDE_VAL1, 1);
- BWN_PHY_WRITE(mac, BWN_PHY_PS_CTL_OVERRIDE_VAL2, 0x20);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfbff);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xf7ff);
- BWN_PHY_WRITE(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL, 0);
- BWN_PHY_WRITE(mac, BWN_PHY_RX_GAIN_CTL_OVERRIDE_VAL, 0x45af);
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2, 0x3ff);
-
- loopback = bwn_phy_lp_loopback(mac);
- if (loopback == -1)
- goto done;
- bwn_phy_lp_set_rxgain_idx(mac, loopback);
- BWN_PHY_SETMASK(mac, BWN_PHY_LP_PHY_CTL, 0xffbf, 0x40);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfff8, 0x1);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xffc7, 0x8);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xff3f, 0xc0);
-
- tmp = 0;
- memset(&ie, 0, sizeof(ie));
- for (i = 128; i <= 159; i++) {
- BWN_RF_WRITE(mac, BWN_B2062_N_RXBB_CALIB2, i);
- sum = 0;
- for (j = 5; j <= 25; j++) {
- bwn_phy_lp_ddfs_turnon(mac, 1, 1, j, j, 0);
- if (!(bwn_phy_lp_rx_iq_est(mac, 1000, 32, &ie)))
- goto done;
- sqpwr = ie.ie_ipwr + ie.ie_qpwr;
- ipwr = ((pwrtbl[j - 5] >> 3) + 1) >> 1;
- npwr = bwn_phy_lp_roundup(sqpwr, (j == 5) ? sqpwr : 0,
- 12);
- sum += ((ipwr - npwr) * (ipwr - npwr));
- if ((i == 128) || (sum < tmp)) {
- plp->plp_rccap = i;
- tmp = sum;
- }
- }
- }
- bwn_phy_lp_ddfs_turnoff(mac);
-done:
- /* restore CRS */
- bwn_phy_lp_clear_deaf(mac, 1);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xff80);
- BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfc00);
-
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_VAL_0, save[1]);
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_0, save[0]);
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL_OVRVAL, save[3]);
- BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL_OVR, save[2]);
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2_VAL, save[5]);
- BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2, save[4]);
- BWN_PHY_WRITE(mac, BWN_PHY_LP_PHY_CTL, save[6]);
-
- bwn_phy_lp_set_bbmult(mac, bbmult);
- if (txo)
- bwn_phy_lp_set_txgain(mac, &tx_gains);
- bwn_phy_lp_set_txpctlmode(mac, txpctlmode);
- if (plp->plp_rccap)
- bwn_phy_lp_set_rccap(mac);
-}
-
-static void
-bwn_phy_lp_set_rccap(struct bwn_mac *mac)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- uint8_t rc_cap = (plp->plp_rccap & 0x1f) >> 1;
-
- if (mac->mac_phy.rev == 1)
- rc_cap = MIN(rc_cap + 5, 15);
-
- BWN_RF_WRITE(mac, BWN_B2062_N_RXBB_CALIB2,
- MAX(plp->plp_rccap - 4, 0x80));
- BWN_RF_WRITE(mac, BWN_B2062_N_TXCTL_A, rc_cap | 0x80);
- BWN_RF_WRITE(mac, BWN_B2062_S_RXG_CNT16,
- ((plp->plp_rccap & 0x1f) >> 2) | 0x80);
-}
-
-static uint32_t
-bwn_phy_lp_roundup(uint32_t value, uint32_t div, uint8_t pre)
-{
- uint32_t i, q, r;
-
- if (div == 0)
- return (0);
-
- for (i = 0, q = value / div, r = value % div; i < pre; i++) {
- q <<= 1;
- if (r << 1 >= div) {
- q++;
- r = (r << 1) - div;
- }
- }
- if (r << 1 >= div)
- q++;
- return (q);
-}
-
-static void
-bwn_phy_lp_b2062_reset_pllbias(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
-
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL2, 0xff);
- DELAY(20);
- if (siba_get_chipid(sc->sc_dev) == 0x5354) {
- BWN_RF_WRITE(mac, BWN_B2062_N_COM1, 4);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL2, 4);
- } else {
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL2, 0);
- }
- DELAY(5);
-}
-
-static void
-bwn_phy_lp_b2062_vco_calib(struct bwn_mac *mac)
-{
-
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL21, 0x42);
- BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL21, 0x62);
- DELAY(200);
-}
-
-static void
-bwn_phy_lp_b2062_tblinit(struct bwn_mac *mac)
-{
-#define FLAG_A 0x01
-#define FLAG_G 0x02
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- static const struct bwn_b206x_rfinit_entry bwn_b2062_init_tab[] = {
- { BWN_B2062_N_COM4, 0x1, 0x0, FLAG_A | FLAG_G, },
- { BWN_B2062_N_PDNCTL1, 0x0, 0xca, FLAG_G, },
- { BWN_B2062_N_PDNCTL3, 0x0, 0x0, FLAG_A | FLAG_G, },
- { BWN_B2062_N_PDNCTL4, 0x15, 0x2a, FLAG_A | FLAG_G, },
- { BWN_B2062_N_LGENC, 0xDB, 0xff, FLAG_A, },
- { BWN_B2062_N_LGENATUNE0, 0xdd, 0x0, FLAG_A | FLAG_G, },
- { BWN_B2062_N_LGENATUNE2, 0xdd, 0x0, FLAG_A | FLAG_G, },
- { BWN_B2062_N_LGENATUNE3, 0x77, 0xB5, FLAG_A | FLAG_G, },
- { BWN_B2062_N_LGENACTL3, 0x0, 0xff, FLAG_A | FLAG_G, },
- { BWN_B2062_N_LGENACTL7, 0x33, 0x33, FLAG_A | FLAG_G, },
- { BWN_B2062_N_RXA_CTL1, 0x0, 0x0, FLAG_G, },
- { BWN_B2062_N_RXBB_CTL0, 0x82, 0x80, FLAG_A | FLAG_G, },
- { BWN_B2062_N_RXBB_GAIN1, 0x4, 0x4, FLAG_A | FLAG_G, },
- { BWN_B2062_N_RXBB_GAIN2, 0x0, 0x0, FLAG_A | FLAG_G, },
- { BWN_B2062_N_TXCTL4, 0x3, 0x3, FLAG_A | FLAG_G, },
- { BWN_B2062_N_TXCTL5, 0x2, 0x2, FLAG_A | FLAG_G, },
- { BWN_B2062_N_TX_TUNE, 0x88, 0x1b, FLAG_A | FLAG_G, },
- { BWN_B2062_S_COM4, 0x1, 0x0, FLAG_A | FLAG_G, },
- { BWN_B2062_S_PDS_CTL0, 0xff, 0xff, FLAG_A | FLAG_G, },
- { BWN_B2062_S_LGENG_CTL0, 0xf8, 0xd8, FLAG_A | FLAG_G, },
- { BWN_B2062_S_LGENG_CTL1, 0x3c, 0x24, FLAG_A | FLAG_G, },
- { BWN_B2062_S_LGENG_CTL8, 0x88, 0x80, FLAG_A | FLAG_G, },
- { BWN_B2062_S_LGENG_CTL10, 0x88, 0x80, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL0, 0x98, 0x98, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL1, 0x10, 0x10, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL5, 0x43, 0x43, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL6, 0x47, 0x47, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL7, 0xc, 0xc, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL8, 0x11, 0x11, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL9, 0x11, 0x11, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL10, 0xe, 0xe, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL11, 0x8, 0x8, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL12, 0x33, 0x33, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL13, 0xa, 0xa, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL14, 0x6, 0x6, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL18, 0x3e, 0x3e, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL19, 0x13, 0x13, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL21, 0x62, 0x62, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL22, 0x7, 0x7, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL23, 0x16, 0x16, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL24, 0x5c, 0x5c, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL25, 0x95, 0x95, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL30, 0xa0, 0xa0, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL31, 0x4, 0x4, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL33, 0xcc, 0xcc, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RFPLLCTL34, 0x7, 0x7, FLAG_A | FLAG_G, },
- { BWN_B2062_S_RXG_CNT8, 0xf, 0xf, FLAG_A, },
- };
- const struct bwn_b206x_rfinit_entry *br;
- unsigned int i;
-
- for (i = 0; i < N(bwn_b2062_init_tab); i++) {
- br = &bwn_b2062_init_tab[i];
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- if (br->br_flags & FLAG_G)
- BWN_RF_WRITE(mac, br->br_offset, br->br_valueg);
- } else {
- if (br->br_flags & FLAG_A)
- BWN_RF_WRITE(mac, br->br_offset, br->br_valuea);
- }
- }
-#undef FLAG_A
-#undef FLAG_B
-}
-
-static void
-bwn_phy_lp_b2063_tblinit(struct bwn_mac *mac)
-{
-#define FLAG_A 0x01
-#define FLAG_G 0x02
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- static const struct bwn_b206x_rfinit_entry bwn_b2063_init_tab[] = {
- { BWN_B2063_COM1, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM10, 0x1, 0x0, FLAG_A, },
- { BWN_B2063_COM16, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM17, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM18, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM19, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM20, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM21, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM22, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM23, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_COM24, 0x0, 0x0, FLAG_G, },
- { BWN_B2063_LOGEN_SP1, 0xe8, 0xd4, FLAG_A | FLAG_G, },
- { BWN_B2063_LOGEN_SP2, 0xa7, 0x53, FLAG_A | FLAG_G, },
- { BWN_B2063_LOGEN_SP4, 0xf0, 0xf, FLAG_A | FLAG_G, },
- { BWN_B2063_G_RX_SP1, 0x1f, 0x5e, FLAG_G, },
- { BWN_B2063_G_RX_SP2, 0x7f, 0x7e, FLAG_G, },
- { BWN_B2063_G_RX_SP3, 0x30, 0xf0, FLAG_G, },
- { BWN_B2063_G_RX_SP7, 0x7f, 0x7f, FLAG_A | FLAG_G, },
- { BWN_B2063_G_RX_SP10, 0xc, 0xc, FLAG_A | FLAG_G, },
- { BWN_B2063_A_RX_SP1, 0x3c, 0x3f, FLAG_A, },
- { BWN_B2063_A_RX_SP2, 0xfc, 0xfe, FLAG_A, },
- { BWN_B2063_A_RX_SP7, 0x8, 0x8, FLAG_A | FLAG_G, },
- { BWN_B2063_RX_BB_SP4, 0x60, 0x60, FLAG_A | FLAG_G, },
- { BWN_B2063_RX_BB_SP8, 0x30, 0x30, FLAG_A | FLAG_G, },
- { BWN_B2063_TX_RF_SP3, 0xc, 0xb, FLAG_A | FLAG_G, },
- { BWN_B2063_TX_RF_SP4, 0x10, 0xf, FLAG_A | FLAG_G, },
- { BWN_B2063_PA_SP1, 0x3d, 0xfd, FLAG_A | FLAG_G, },
- { BWN_B2063_TX_BB_SP1, 0x2, 0x2, FLAG_A | FLAG_G, },
- { BWN_B2063_BANDGAP_CTL1, 0x56, 0x56, FLAG_A | FLAG_G, },
- { BWN_B2063_JTAG_VCO2, 0xF7, 0xF7, FLAG_A | FLAG_G, },
- { BWN_B2063_G_RX_MIX3, 0x71, 0x71, FLAG_A | FLAG_G, },
- { BWN_B2063_G_RX_MIX4, 0x71, 0x71, FLAG_A | FLAG_G, },
- { BWN_B2063_A_RX_1ST2, 0xf0, 0x30, FLAG_A, },
- { BWN_B2063_A_RX_PS6, 0x77, 0x77, FLAG_A | FLAG_G, },
- { BWN_B2063_A_RX_MIX4, 0x3, 0x3, FLAG_A | FLAG_G, },
- { BWN_B2063_A_RX_MIX5, 0xf, 0xf, FLAG_A | FLAG_G, },
- { BWN_B2063_A_RX_MIX6, 0xf, 0xf, FLAG_A | FLAG_G, },
- { BWN_B2063_RX_TIA_CTL1, 0x77, 0x77, FLAG_A | FLAG_G, },
- { BWN_B2063_RX_TIA_CTL3, 0x77, 0x77, FLAG_A | FLAG_G, },
- { BWN_B2063_RX_BB_CTL2, 0x4, 0x4, FLAG_A | FLAG_G, },
- { BWN_B2063_PA_CTL1, 0x0, 0x4, FLAG_A, },
- { BWN_B2063_VREG_CTL1, 0x3, 0x3, FLAG_A | FLAG_G, },
- };
- const struct bwn_b206x_rfinit_entry *br;
- unsigned int i;
-
- for (i = 0; i < N(bwn_b2063_init_tab); i++) {
- br = &bwn_b2063_init_tab[i];
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- if (br->br_flags & FLAG_G)
- BWN_RF_WRITE(mac, br->br_offset, br->br_valueg);
- } else {
- if (br->br_flags & FLAG_A)
- BWN_RF_WRITE(mac, br->br_offset, br->br_valuea);
- }
- }
-#undef FLAG_A
-#undef FLAG_B
-}
-
-static void
-bwn_tab_read_multi(struct bwn_mac *mac, uint32_t typenoffset,
- int count, void *_data)
-{
- unsigned int i;
- uint32_t offset, type;
- uint8_t *data = _data;
-
- type = BWN_TAB_GETTYPE(typenoffset);
- offset = BWN_TAB_GETOFFSET(typenoffset);
- KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
-
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
-
- for (i = 0; i < count; i++) {
- switch (type) {
- case BWN_TAB_8BIT:
- *data = BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO) & 0xff;
- data++;
- break;
- case BWN_TAB_16BIT:
- *((uint16_t *)data) = BWN_PHY_READ(mac,
- BWN_PHY_TABLEDATALO);
- data += 2;
- break;
- case BWN_TAB_32BIT:
- *((uint32_t *)data) = BWN_PHY_READ(mac,
- BWN_PHY_TABLEDATAHI);
- *((uint32_t *)data) <<= 16;
- *((uint32_t *)data) |= BWN_PHY_READ(mac,
- BWN_PHY_TABLEDATALO);
- data += 4;
- break;
- default:
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
- }
-}
-
-static void
-bwn_tab_write_multi(struct bwn_mac *mac, uint32_t typenoffset,
- int count, const void *_data)
-{
- uint32_t offset, type, value;
- const uint8_t *data = _data;
- unsigned int i;
-
- type = BWN_TAB_GETTYPE(typenoffset);
- offset = BWN_TAB_GETOFFSET(typenoffset);
- KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
-
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
-
- for (i = 0; i < count; i++) {
- switch (type) {
- case BWN_TAB_8BIT:
- value = *data;
- data++;
- KASSERT(!(value & ~0xff),
- ("%s:%d: fail", __func__, __LINE__));
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
- break;
- case BWN_TAB_16BIT:
- value = *((const uint16_t *)data);
- data += 2;
- KASSERT(!(value & ~0xffff),
- ("%s:%d: fail", __func__, __LINE__));
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
- break;
- case BWN_TAB_32BIT:
- value = *((const uint32_t *)data);
- data += 4;
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATAHI, value >> 16);
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
- break;
- default:
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
- }
-}
-
-static struct bwn_txgain
-bwn_phy_lp_get_txgain(struct bwn_mac *mac)
-{
- struct bwn_txgain tg;
- uint16_t tmp;
-
- tg.tg_dac = (BWN_PHY_READ(mac, BWN_PHY_AFE_DAC_CTL) & 0x380) >> 7;
- if (mac->mac_phy.rev < 2) {
- tmp = BWN_PHY_READ(mac,
- BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL) & 0x7ff;
- tg.tg_gm = tmp & 0x0007;
- tg.tg_pga = (tmp & 0x0078) >> 3;
- tg.tg_pad = (tmp & 0x780) >> 7;
- return (tg);
- }
-
- tmp = BWN_PHY_READ(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL);
- tg.tg_pad = BWN_PHY_READ(mac, BWN_PHY_OFDM(0xfb)) & 0xff;
- tg.tg_gm = tmp & 0xff;
- tg.tg_pga = (tmp >> 8) & 0xff;
- return (tg);
-}
-
-static uint8_t
-bwn_phy_lp_get_bbmult(struct bwn_mac *mac)
-{
-
- return (bwn_tab_read(mac, BWN_TAB_2(0, 87)) & 0xff00) >> 8;
-}
-
-static void
-bwn_phy_lp_set_txgain(struct bwn_mac *mac, struct bwn_txgain *tg)
-{
- uint16_t pa;
-
- if (mac->mac_phy.rev < 2) {
- BWN_PHY_SETMASK(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL, 0xf800,
- (tg->tg_pad << 7) | (tg->tg_pga << 3) | tg->tg_gm);
- bwn_phy_lp_set_txgain_dac(mac, tg->tg_dac);
- bwn_phy_lp_set_txgain_override(mac);
- return;
- }
-
- pa = bwn_phy_lp_get_pa_gain(mac);
- BWN_PHY_WRITE(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL,
- (tg->tg_pga << 8) | tg->tg_gm);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfb), 0x8000,
- tg->tg_pad | (pa << 6));
- BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xfc), (tg->tg_pga << 8) | tg->tg_gm);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfd), 0x8000,
- tg->tg_pad | (pa << 8));
- bwn_phy_lp_set_txgain_dac(mac, tg->tg_dac);
- bwn_phy_lp_set_txgain_override(mac);
-}
-
-static void
-bwn_phy_lp_set_bbmult(struct bwn_mac *mac, uint8_t bbmult)
-{
-
- bwn_tab_write(mac, BWN_TAB_2(0, 87), (uint16_t)bbmult << 8);
-}
-
-static void
-bwn_phy_lp_set_trsw_over(struct bwn_mac *mac, uint8_t tx, uint8_t rx)
-{
- uint16_t trsw = (tx << 1) | rx;
-
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffc, trsw);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x3);
-}
-
-static void
-bwn_phy_lp_set_rxgain(struct bwn_mac *mac, uint32_t gain)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- uint16_t ext_lna, high_gain, lna, low_gain, trsw, tmp;
-
- if (mac->mac_phy.rev < 2) {
- trsw = gain & 0x1;
- lna = (gain & 0xfffc) | ((gain & 0xc) >> 2);
- ext_lna = (gain & 2) >> 1;
-
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffe, trsw);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
- 0xfbff, ext_lna << 10);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
- 0xf7ff, ext_lna << 11);
- BWN_PHY_WRITE(mac, BWN_PHY_RX_GAIN_CTL_OVERRIDE_VAL, lna);
- } else {
- low_gain = gain & 0xffff;
- high_gain = (gain >> 16) & 0xf;
- ext_lna = (gain >> 21) & 0x1;
- trsw = ~(gain >> 20) & 0x1;
-
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffe, trsw);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
- 0xfdff, ext_lna << 9);
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
- 0xfbff, ext_lna << 10);
- BWN_PHY_WRITE(mac, BWN_PHY_RX_GAIN_CTL_OVERRIDE_VAL, low_gain);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xfff0, high_gain);
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- tmp = (gain >> 2) & 0x3;
- BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
- 0xe7ff, tmp<<11);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xe6), 0xffe7,
- tmp << 3);
- }
- }
-
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x1);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x10);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x40);
- if (mac->mac_phy.rev >= 2) {
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x100);
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x400);
- BWN_PHY_SET(mac, BWN_PHY_OFDM(0xe5), 0x8);
- }
- return;
- }
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x200);
-}
-
-static void
-bwn_phy_lp_set_deaf(struct bwn_mac *mac, uint8_t user)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
-
- if (user)
- plp->plp_crsusr_off = 1;
- else
- plp->plp_crssys_off = 1;
-
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xff1f, 0x80);
-}
-
-static void
-bwn_phy_lp_clear_deaf(struct bwn_mac *mac, uint8_t user)
-{
- struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
-
- if (user)
- plp->plp_crsusr_off = 0;
- else
- plp->plp_crssys_off = 0;
-
- if (plp->plp_crsusr_off || plp->plp_crssys_off)
- return;
-
- if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xff1f, 0x60);
- else
- BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xff1f, 0x20);
-}
-
-static unsigned int
-bwn_sqrt(struct bwn_mac *mac, unsigned int x)
-{
- /* Table holding (10 * sqrt(x)) for x between 1 and 256. */
- static uint8_t sqrt_table[256] = {
- 10, 14, 17, 20, 22, 24, 26, 28,
- 30, 31, 33, 34, 36, 37, 38, 40,
- 41, 42, 43, 44, 45, 46, 47, 48,
- 50, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 60, 61, 62, 63,
- 64, 64, 65, 66, 67, 67, 68, 69,
- 70, 70, 71, 72, 72, 73, 74, 74,
- 75, 76, 76, 77, 78, 78, 79, 80,
- 80, 81, 81, 82, 83, 83, 84, 84,
- 85, 86, 86, 87, 87, 88, 88, 89,
- 90, 90, 91, 91, 92, 92, 93, 93,
- 94, 94, 95, 95, 96, 96, 97, 97,
- 98, 98, 99, 100, 100, 100, 101, 101,
- 102, 102, 103, 103, 104, 104, 105, 105,
- 106, 106, 107, 107, 108, 108, 109, 109,
- 110, 110, 110, 111, 111, 112, 112, 113,
- 113, 114, 114, 114, 115, 115, 116, 116,
- 117, 117, 117, 118, 118, 119, 119, 120,
- 120, 120, 121, 121, 122, 122, 122, 123,
- 123, 124, 124, 124, 125, 125, 126, 126,
- 126, 127, 127, 128, 128, 128, 129, 129,
- 130, 130, 130, 131, 131, 131, 132, 132,
- 133, 133, 133, 134, 134, 134, 135, 135,
- 136, 136, 136, 137, 137, 137, 138, 138,
- 138, 139, 139, 140, 140, 140, 141, 141,
- 141, 142, 142, 142, 143, 143, 143, 144,
- 144, 144, 145, 145, 145, 146, 146, 146,
- 147, 147, 147, 148, 148, 148, 149, 149,
- 150, 150, 150, 150, 151, 151, 151, 152,
- 152, 152, 153, 153, 153, 154, 154, 154,
- 155, 155, 155, 156, 156, 156, 157, 157,
- 157, 158, 158, 158, 159, 159, 159, 160
- };
-
- if (x == 0)
- return (0);
- if (x >= 256) {
- unsigned int tmp;
-
- for (tmp = 0; x >= (2 * tmp) + 1; x -= (2 * tmp++) + 1)
- /* do nothing */ ;
- return (tmp);
- }
- return (sqrt_table[x - 1] / 10);
-}
-
-static int
-bwn_phy_lp_calc_rx_iq_comp(struct bwn_mac *mac, uint16_t sample)
-{
-#define CALC_COEFF(_v, _x, _y, _z) do { \
- int _t; \
- _t = _x - 20; \
- if (_t >= 0) { \
- _v = ((_y << (30 - _x)) + (_z >> (1 + _t))) / (_z >> _t); \
- } else { \
- _v = ((_y << (30 - _x)) + (_z << (-1 - _t))) / (_z << -_t); \
- } \
-} while (0)
-#define CALC_COEFF2(_v, _x, _y, _z) do { \
- int _t; \
- _t = _x - 11; \
- if (_t >= 0) \
- _v = (_y << (31 - _x)) / (_z >> _t); \
- else \
- _v = (_y << (31 - _x)) / (_z << -_t); \
-} while (0)
- struct bwn_phy_lp_iq_est ie;
- uint16_t v0, v1;
- int tmp[2], ret;
-
- v1 = BWN_PHY_READ(mac, BWN_PHY_RX_COMP_COEFF_S);
- v0 = v1 >> 8;
- v1 |= 0xff;
-
- BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0xff00, 0x00c0);
- BWN_PHY_MASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0x00ff);
-
- ret = bwn_phy_lp_rx_iq_est(mac, sample, 32, &ie);
- if (ret == 0)
- goto done;
-
- if (ie.ie_ipwr + ie.ie_qpwr < 2) {
- ret = 0;
- goto done;
- }
-
- CALC_COEFF(tmp[0], bwn_nbits(ie.ie_iqprod), ie.ie_iqprod, ie.ie_ipwr);
- CALC_COEFF2(tmp[1], bwn_nbits(ie.ie_qpwr), ie.ie_qpwr, ie.ie_ipwr);
-
- tmp[1] = -bwn_sqrt(mac, tmp[1] - (tmp[0] * tmp[0]));
- v0 = tmp[0] >> 3;
- v1 = tmp[1] >> 4;
-done:
- BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0xff00, v1);
- BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0x00ff, v0 << 8);
- return ret;
-#undef CALC_COEFF
-#undef CALC_COEFF2
-}
-
-static void
-bwn_phy_lp_tblinit_r01(struct bwn_mac *mac)
-{
- static const uint16_t noisescale[] = {
- 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4,
- 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa400, 0xa4a4, 0xa4a4,
- 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4,
- 0xa4a4, 0xa4a4, 0x00a4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x4c00, 0x2d36, 0x0000, 0x0000, 0x4c00, 0x2d36,
- };
- static const uint16_t crsgainnft[] = {
- 0x0366, 0x036a, 0x036f, 0x0364, 0x0367, 0x036d, 0x0374, 0x037f,
- 0x036f, 0x037b, 0x038a, 0x0378, 0x0367, 0x036d, 0x0375, 0x0381,
- 0x0374, 0x0381, 0x0392, 0x03a9, 0x03c4, 0x03e1, 0x0001, 0x001f,
- 0x0040, 0x005e, 0x007f, 0x009e, 0x00bd, 0x00dd, 0x00fd, 0x011d,
- 0x013d,
- };
- static const uint16_t filterctl[] = {
- 0xa0fc, 0x10fc, 0x10db, 0x20b7, 0xff93, 0x10bf, 0x109b, 0x2077,
- 0xff53, 0x0127,
- };
- static const uint32_t psctl[] = {
- 0x00010000, 0x000000a0, 0x00040000, 0x00000048, 0x08080101,
- 0x00000080, 0x08080101, 0x00000040, 0x08080101, 0x000000c0,
- 0x08a81501, 0x000000c0, 0x0fe8fd01, 0x000000c0, 0x08300105,
- 0x000000c0, 0x08080201, 0x000000c0, 0x08280205, 0x000000c0,
- 0xe80802fe, 0x000000c7, 0x28080206, 0x000000c0, 0x08080202,
- 0x000000c0, 0x0ba87602, 0x000000c0, 0x1068013d, 0x000000c0,
- 0x10280105, 0x000000c0, 0x08880102, 0x000000c0, 0x08280106,
- 0x000000c0, 0xe80801fd, 0x000000c7, 0xa8080115, 0x000000c0,
- };
- static const uint16_t ofdmcckgain_r0[] = {
- 0x0001, 0x0001, 0x0001, 0x0001, 0x1001, 0x2001, 0x3001, 0x4001,
- 0x5001, 0x6001, 0x7001, 0x7011, 0x7021, 0x2035, 0x2045, 0x2055,
- 0x2065, 0x2075, 0x006d, 0x007d, 0x014d, 0x015d, 0x115d, 0x035d,
- 0x135d, 0x055d, 0x155d, 0x0d5d, 0x1d5d, 0x2d5d, 0x555d, 0x655d,
- 0x755d,
- };
- static const uint16_t ofdmcckgain_r1[] = {
- 0x5000, 0x6000, 0x7000, 0x0001, 0x1001, 0x2001, 0x3001, 0x4001,
- 0x5001, 0x6001, 0x7001, 0x7011, 0x7021, 0x2035, 0x2045, 0x2055,
- 0x2065, 0x2075, 0x006d, 0x007d, 0x014d, 0x015d, 0x115d, 0x035d,
- 0x135d, 0x055d, 0x155d, 0x0d5d, 0x1d5d, 0x2d5d, 0x555d, 0x655d,
- 0x755d,
- };
- static const uint16_t gaindelta[] = {
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000,
- };
- static const uint32_t txpwrctl[] = {
- 0x00000050, 0x0000004f, 0x0000004e, 0x0000004d, 0x0000004c,
- 0x0000004b, 0x0000004a, 0x00000049, 0x00000048, 0x00000047,
- 0x00000046, 0x00000045, 0x00000044, 0x00000043, 0x00000042,
- 0x00000041, 0x00000040, 0x0000003f, 0x0000003e, 0x0000003d,
- 0x0000003c, 0x0000003b, 0x0000003a, 0x00000039, 0x00000038,
- 0x00000037, 0x00000036, 0x00000035, 0x00000034, 0x00000033,
- 0x00000032, 0x00000031, 0x00000030, 0x0000002f, 0x0000002e,
- 0x0000002d, 0x0000002c, 0x0000002b, 0x0000002a, 0x00000029,
- 0x00000028, 0x00000027, 0x00000026, 0x00000025, 0x00000024,
- 0x00000023, 0x00000022, 0x00000021, 0x00000020, 0x0000001f,
- 0x0000001e, 0x0000001d, 0x0000001c, 0x0000001b, 0x0000001a,
- 0x00000019, 0x00000018, 0x00000017, 0x00000016, 0x00000015,
- 0x00000014, 0x00000013, 0x00000012, 0x00000011, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x000075a0, 0x000075a0, 0x000075a1,
- 0x000075a1, 0x000075a2, 0x000075a2, 0x000075a3, 0x000075a3,
- 0x000074b0, 0x000074b0, 0x000074b1, 0x000074b1, 0x000074b2,
- 0x000074b2, 0x000074b3, 0x000074b3, 0x00006d20, 0x00006d20,
- 0x00006d21, 0x00006d21, 0x00006d22, 0x00006d22, 0x00006d23,
- 0x00006d23, 0x00004660, 0x00004660, 0x00004661, 0x00004661,
- 0x00004662, 0x00004662, 0x00004663, 0x00004663, 0x00003e60,
- 0x00003e60, 0x00003e61, 0x00003e61, 0x00003e62, 0x00003e62,
- 0x00003e63, 0x00003e63, 0x00003660, 0x00003660, 0x00003661,
- 0x00003661, 0x00003662, 0x00003662, 0x00003663, 0x00003663,
- 0x00002e60, 0x00002e60, 0x00002e61, 0x00002e61, 0x00002e62,
- 0x00002e62, 0x00002e63, 0x00002e63, 0x00002660, 0x00002660,
- 0x00002661, 0x00002661, 0x00002662, 0x00002662, 0x00002663,
- 0x00002663, 0x000025e0, 0x000025e0, 0x000025e1, 0x000025e1,
- 0x000025e2, 0x000025e2, 0x000025e3, 0x000025e3, 0x00001de0,
- 0x00001de0, 0x00001de1, 0x00001de1, 0x00001de2, 0x00001de2,
- 0x00001de3, 0x00001de3, 0x00001d60, 0x00001d60, 0x00001d61,
- 0x00001d61, 0x00001d62, 0x00001d62, 0x00001d63, 0x00001d63,
- 0x00001560, 0x00001560, 0x00001561, 0x00001561, 0x00001562,
- 0x00001562, 0x00001563, 0x00001563, 0x00000d60, 0x00000d60,
- 0x00000d61, 0x00000d61, 0x00000d62, 0x00000d62, 0x00000d63,
- 0x00000d63, 0x00000ce0, 0x00000ce0, 0x00000ce1, 0x00000ce1,
- 0x00000ce2, 0x00000ce2, 0x00000ce3, 0x00000ce3, 0x00000e10,
- 0x00000e10, 0x00000e11, 0x00000e11, 0x00000e12, 0x00000e12,
- 0x00000e13, 0x00000e13, 0x00000bf0, 0x00000bf0, 0x00000bf1,
- 0x00000bf1, 0x00000bf2, 0x00000bf2, 0x00000bf3, 0x00000bf3,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
- 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
- 0x04000000, 0x04200000, 0x04000000, 0x000000ff, 0x000002fc,
- 0x0000fa08, 0x00000305, 0x00000206, 0x00000304, 0x0000fb04,
- 0x0000fcff, 0x000005fb, 0x0000fd01, 0x00000401, 0x00000006,
- 0x0000ff03, 0x000007fc, 0x0000fc08, 0x00000203, 0x0000fffb,
- 0x00000600, 0x0000fa01, 0x0000fc03, 0x0000fe06, 0x0000fe00,
- 0x00000102, 0x000007fd, 0x000004fb, 0x000006ff, 0x000004fd,
- 0x0000fdfa, 0x000007fb, 0x0000fdfa, 0x0000fa06, 0x00000500,
- 0x0000f902, 0x000007fa, 0x0000fafa, 0x00000500, 0x000007fa,
- 0x00000700, 0x00000305, 0x000004ff, 0x00000801, 0x00000503,
- 0x000005f9, 0x00000404, 0x0000fb08, 0x000005fd, 0x00000501,
- 0x00000405, 0x0000fb03, 0x000007fc, 0x00000403, 0x00000303,
- 0x00000402, 0x0000faff, 0x0000fe05, 0x000005fd, 0x0000fe01,
- 0x000007fa, 0x00000202, 0x00000504, 0x00000102, 0x000008fe,
- 0x0000fa04, 0x0000fafc, 0x0000fe08, 0x000000f9, 0x000002fa,
- 0x000003fe, 0x00000304, 0x000004f9, 0x00000100, 0x0000fd06,
- 0x000008fc, 0x00000701, 0x00000504, 0x0000fdfe, 0x0000fdfc,
- 0x000003fe, 0x00000704, 0x000002fc, 0x000004f9, 0x0000fdfd,
- 0x0000fa07, 0x00000205, 0x000003fd, 0x000005fb, 0x000004f9,
- 0x00000804, 0x0000fc06, 0x0000fcf9, 0x00000100, 0x0000fe05,
- 0x00000408, 0x0000fb02, 0x00000304, 0x000006fe, 0x000004fa,
- 0x00000305, 0x000008fc, 0x00000102, 0x000001fd, 0x000004fc,
- 0x0000fe03, 0x00000701, 0x000001fb, 0x000001f9, 0x00000206,
- 0x000006fd, 0x00000508, 0x00000700, 0x00000304, 0x000005fe,
- 0x000005ff, 0x0000fa04, 0x00000303, 0x0000fefb, 0x000007f9,
- 0x0000fefc, 0x000004fd, 0x000005fc, 0x0000fffd, 0x0000fc08,
- 0x0000fbf9, 0x0000fd07, 0x000008fb, 0x0000fe02, 0x000006fb,
- 0x00000702,
- };
-
- KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
-
- bwn_tab_write_multi(mac, BWN_TAB_1(2, 0), N(bwn_tab_sigsq_tbl),
- bwn_tab_sigsq_tbl);
- bwn_tab_write_multi(mac, BWN_TAB_2(1, 0), N(noisescale), noisescale);
- bwn_tab_write_multi(mac, BWN_TAB_2(14, 0), N(crsgainnft), crsgainnft);
- bwn_tab_write_multi(mac, BWN_TAB_2(8, 0), N(filterctl), filterctl);
- bwn_tab_write_multi(mac, BWN_TAB_4(9, 0), N(psctl), psctl);
- bwn_tab_write_multi(mac, BWN_TAB_1(6, 0), N(bwn_tab_pllfrac_tbl),
- bwn_tab_pllfrac_tbl);
- bwn_tab_write_multi(mac, BWN_TAB_2(0, 0), N(bwn_tabl_iqlocal_tbl),
- bwn_tabl_iqlocal_tbl);
- if (mac->mac_phy.rev == 0) {
- bwn_tab_write_multi(mac, BWN_TAB_2(13, 0), N(ofdmcckgain_r0),
- ofdmcckgain_r0);
- bwn_tab_write_multi(mac, BWN_TAB_2(12, 0), N(ofdmcckgain_r0),
- ofdmcckgain_r0);
- } else {
- bwn_tab_write_multi(mac, BWN_TAB_2(13, 0), N(ofdmcckgain_r1),
- ofdmcckgain_r1);
- bwn_tab_write_multi(mac, BWN_TAB_2(12, 0), N(ofdmcckgain_r1),
- ofdmcckgain_r1);
- }
- bwn_tab_write_multi(mac, BWN_TAB_2(15, 0), N(gaindelta), gaindelta);
- bwn_tab_write_multi(mac, BWN_TAB_4(10, 0), N(txpwrctl), txpwrctl);
-}
-
-static void
-bwn_phy_lp_tblinit_r2(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- int i;
- static const uint16_t noisescale[] = {
- 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
- 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
- 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
- 0x00a4, 0x00a4, 0x0000, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
- 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
- 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
- 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4
- };
- static const uint32_t filterctl[] = {
- 0x000141fc, 0x000021fc, 0x000021b7, 0x0000416f, 0x0001ff27,
- 0x0000217f, 0x00002137, 0x000040ef, 0x0001fea7, 0x0000024f
- };
- static const uint32_t psctl[] = {
- 0x00e38e08, 0x00e08e38, 0x00000000, 0x00000000, 0x00000000,
- 0x00002080, 0x00006180, 0x00003002, 0x00000040, 0x00002042,
- 0x00180047, 0x00080043, 0x00000041, 0x000020c1, 0x00046006,
- 0x00042002, 0x00040000, 0x00002003, 0x00180006, 0x00080002
- };
- static const uint32_t gainidx[] = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x10000001, 0x00000000,
- 0x20000082, 0x00000000, 0x40000104, 0x00000000, 0x60004207,
- 0x00000001, 0x7000838a, 0x00000001, 0xd021050d, 0x00000001,
- 0xe041c683, 0x00000001, 0x50828805, 0x00000000, 0x80e34288,
- 0x00000000, 0xb144040b, 0x00000000, 0xe1a6058e, 0x00000000,
- 0x12064711, 0x00000001, 0xb0a18612, 0x00000010, 0xe1024794,
- 0x00000010, 0x11630915, 0x00000011, 0x31c3ca1b, 0x00000011,
- 0xc1848a9c, 0x00000018, 0xf1e50da0, 0x00000018, 0x22468e21,
- 0x00000019, 0x4286d023, 0x00000019, 0xa347d0a4, 0x00000019,
- 0xb36811a6, 0x00000019, 0xf3e89227, 0x00000019, 0x0408d329,
- 0x0000001a, 0x244953aa, 0x0000001a, 0x346994ab, 0x0000001a,
- 0x54aa152c, 0x0000001a, 0x64ca55ad, 0x0000001a, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x10000001, 0x00000000, 0x20000082,
- 0x00000000, 0x40000104, 0x00000000, 0x60004207, 0x00000001,
- 0x7000838a, 0x00000001, 0xd021050d, 0x00000001, 0xe041c683,
- 0x00000001, 0x50828805, 0x00000000, 0x80e34288, 0x00000000,
- 0xb144040b, 0x00000000, 0xe1a6058e, 0x00000000, 0x12064711,
- 0x00000001, 0xb0a18612, 0x00000010, 0xe1024794, 0x00000010,
- 0x11630915, 0x00000011, 0x31c3ca1b, 0x00000011, 0xc1848a9c,
- 0x00000018, 0xf1e50da0, 0x00000018, 0x22468e21, 0x00000019,
- 0x4286d023, 0x00000019, 0xa347d0a4, 0x00000019, 0xb36811a6,
- 0x00000019, 0xf3e89227, 0x00000019, 0x0408d329, 0x0000001a,
- 0x244953aa, 0x0000001a, 0x346994ab, 0x0000001a, 0x54aa152c,
- 0x0000001a, 0x64ca55ad, 0x0000001a
- };
- static const uint16_t auxgainidx[] = {
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0001, 0x0002, 0x0004, 0x0016, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002,
- 0x0004, 0x0016
- };
- static const uint16_t swctl[] = {
- 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
- 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
- 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009,
- 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
- 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
- 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
- 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009,
- 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018
- };
- static const uint8_t hf[] = {
- 0x4b, 0x36, 0x24, 0x18, 0x49, 0x34, 0x23, 0x17, 0x48,
- 0x33, 0x23, 0x17, 0x48, 0x33, 0x23, 0x17
- };
- static const uint32_t gainval[] = {
- 0x00000008, 0x0000000e, 0x00000014, 0x0000001a, 0x000000fb,
- 0x00000004, 0x00000008, 0x0000000d, 0x00000001, 0x00000004,
- 0x00000007, 0x0000000a, 0x0000000d, 0x00000010, 0x00000012,
- 0x00000015, 0x00000000, 0x00000006, 0x0000000c, 0x00000000,
- 0x00000000, 0x00000000, 0x00000012, 0x00000000, 0x00000000,
- 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x0000001e, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
- 0x00000006, 0x00000009, 0x0000000c, 0x0000000f, 0x00000012,
- 0x00000015, 0x00000018, 0x0000001b, 0x0000001e, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000009,
- 0x000000f1, 0x00000000, 0x00000000
- };
- static const uint16_t gain[] = {
- 0x0000, 0x0400, 0x0800, 0x0802, 0x0804, 0x0806, 0x0807, 0x0808,
- 0x080a, 0x080b, 0x080c, 0x080e, 0x080f, 0x0810, 0x0812, 0x0813,
- 0x0814, 0x0816, 0x0817, 0x081a, 0x081b, 0x081f, 0x0820, 0x0824,
- 0x0830, 0x0834, 0x0837, 0x083b, 0x083f, 0x0840, 0x0844, 0x0857,
- 0x085b, 0x085f, 0x08d7, 0x08db, 0x08df, 0x0957, 0x095b, 0x095f,
- 0x0b57, 0x0b5b, 0x0b5f, 0x0f5f, 0x135f, 0x175f, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
- };
- static const uint32_t papdeps[] = {
- 0x00000000, 0x00013ffc, 0x0001dff3, 0x0001bff0, 0x00023fe9,
- 0x00021fdf, 0x00028fdf, 0x00033fd2, 0x00039fcb, 0x00043fc7,
- 0x0004efc2, 0x00055fb5, 0x0005cfb0, 0x00063fa8, 0x00068fa3,
- 0x00071f98, 0x0007ef92, 0x00084f8b, 0x0008df82, 0x00097f77,
- 0x0009df69, 0x000a3f62, 0x000adf57, 0x000b6f4c, 0x000bff41,
- 0x000c9f39, 0x000cff30, 0x000dbf27, 0x000e4f1e, 0x000edf16,
- 0x000f7f13, 0x00102f11, 0x00110f10, 0x0011df11, 0x0012ef15,
- 0x00143f1c, 0x00158f27, 0x00172f35, 0x00193f47, 0x001baf5f,
- 0x001e6f7e, 0x0021cfa4, 0x0025bfd2, 0x002a2008, 0x002fb047,
- 0x00360090, 0x003d40e0, 0x0045c135, 0x004fb189, 0x005ae1d7,
- 0x0067221d, 0x0075025a, 0x007ff291, 0x007ff2bf, 0x007ff2e3,
- 0x007ff2ff, 0x007ff315, 0x007ff329, 0x007ff33f, 0x007ff356,
- 0x007ff36e, 0x007ff39c, 0x007ff441, 0x007ff506
- };
- static const uint32_t papdmult[] = {
- 0x001111e0, 0x00652051, 0x00606055, 0x005b005a, 0x00555060,
- 0x00511065, 0x004c806b, 0x0047d072, 0x00444078, 0x00400080,
- 0x003ca087, 0x0039408f, 0x0035e098, 0x0032e0a1, 0x003030aa,
- 0x002d80b4, 0x002ae0bf, 0x002880ca, 0x002640d6, 0x002410e3,
- 0x002220f0, 0x002020ff, 0x001e510e, 0x001ca11e, 0x001b012f,
- 0x00199140, 0x00182153, 0x0016c168, 0x0015817d, 0x00145193,
- 0x001321ab, 0x001211c5, 0x001111e0, 0x001021fc, 0x000f321a,
- 0x000e523a, 0x000d925c, 0x000cd27f, 0x000c12a5, 0x000b62cd,
- 0x000ac2f8, 0x000a2325, 0x00099355, 0x00091387, 0x000883bd,
- 0x000813f5, 0x0007a432, 0x00073471, 0x0006c4b5, 0x000664fc,
- 0x00061547, 0x0005b598, 0x000565ec, 0x00051646, 0x0004d6a5,
- 0x0004870a, 0x00044775, 0x000407e6, 0x0003d85e, 0x000398dd,
- 0x00036963, 0x000339f2, 0x00030a89, 0x0002db28
- };
- static const uint32_t gainidx_a0[] = {
- 0x001111e0, 0x00652051, 0x00606055, 0x005b005a, 0x00555060,
- 0x00511065, 0x004c806b, 0x0047d072, 0x00444078, 0x00400080,
- 0x003ca087, 0x0039408f, 0x0035e098, 0x0032e0a1, 0x003030aa,
- 0x002d80b4, 0x002ae0bf, 0x002880ca, 0x002640d6, 0x002410e3,
- 0x002220f0, 0x002020ff, 0x001e510e, 0x001ca11e, 0x001b012f,
- 0x00199140, 0x00182153, 0x0016c168, 0x0015817d, 0x00145193,
- 0x001321ab, 0x001211c5, 0x001111e0, 0x001021fc, 0x000f321a,
- 0x000e523a, 0x000d925c, 0x000cd27f, 0x000c12a5, 0x000b62cd,
- 0x000ac2f8, 0x000a2325, 0x00099355, 0x00091387, 0x000883bd,
- 0x000813f5, 0x0007a432, 0x00073471, 0x0006c4b5, 0x000664fc,
- 0x00061547, 0x0005b598, 0x000565ec, 0x00051646, 0x0004d6a5,
- 0x0004870a, 0x00044775, 0x000407e6, 0x0003d85e, 0x000398dd,
- 0x00036963, 0x000339f2, 0x00030a89, 0x0002db28
- };
- static const uint16_t auxgainidx_a0[] = {
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0002, 0x0014, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0002, 0x0014
- };
- static const uint32_t gainval_a0[] = {
- 0x00000008, 0x0000000e, 0x00000014, 0x0000001a, 0x000000fb,
- 0x00000004, 0x00000008, 0x0000000d, 0x00000001, 0x00000004,
- 0x00000007, 0x0000000a, 0x0000000d, 0x00000010, 0x00000012,
- 0x00000015, 0x00000000, 0x00000006, 0x0000000c, 0x00000000,
- 0x00000000, 0x00000000, 0x00000012, 0x00000000, 0x00000000,
- 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x0000001e, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
- 0x00000006, 0x00000009, 0x0000000c, 0x0000000f, 0x00000012,
- 0x00000015, 0x00000018, 0x0000001b, 0x0000001e, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f,
- 0x000000f7, 0x00000000, 0x00000000
- };
- static const uint16_t gain_a0[] = {
- 0x0000, 0x0002, 0x0004, 0x0006, 0x0007, 0x0008, 0x000a, 0x000b,
- 0x000c, 0x000e, 0x000f, 0x0010, 0x0012, 0x0013, 0x0014, 0x0016,
- 0x0017, 0x001a, 0x001b, 0x001f, 0x0020, 0x0024, 0x0030, 0x0034,
- 0x0037, 0x003b, 0x003f, 0x0040, 0x0044, 0x0057, 0x005b, 0x005f,
- 0x00d7, 0x00db, 0x00df, 0x0157, 0x015b, 0x015f, 0x0357, 0x035b,
- 0x035f, 0x075f, 0x0b5f, 0x0f5f, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
- };
-
- KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
-
- for (i = 0; i < 704; i++)
- bwn_tab_write(mac, BWN_TAB_4(7, i), 0);
-
- bwn_tab_write_multi(mac, BWN_TAB_1(2, 0), N(bwn_tab_sigsq_tbl),
- bwn_tab_sigsq_tbl);
- bwn_tab_write_multi(mac, BWN_TAB_2(1, 0), N(noisescale), noisescale);
- bwn_tab_write_multi(mac, BWN_TAB_4(11, 0), N(filterctl), filterctl);
- bwn_tab_write_multi(mac, BWN_TAB_4(12, 0), N(psctl), psctl);
- bwn_tab_write_multi(mac, BWN_TAB_4(13, 0), N(gainidx), gainidx);
- bwn_tab_write_multi(mac, BWN_TAB_2(14, 0), N(auxgainidx), auxgainidx);
- bwn_tab_write_multi(mac, BWN_TAB_2(15, 0), N(swctl), swctl);
- bwn_tab_write_multi(mac, BWN_TAB_1(16, 0), N(hf), hf);
- bwn_tab_write_multi(mac, BWN_TAB_4(17, 0), N(gainval), gainval);
- bwn_tab_write_multi(mac, BWN_TAB_2(18, 0), N(gain), gain);
- bwn_tab_write_multi(mac, BWN_TAB_1(6, 0), N(bwn_tab_pllfrac_tbl),
- bwn_tab_pllfrac_tbl);
- bwn_tab_write_multi(mac, BWN_TAB_2(0, 0), N(bwn_tabl_iqlocal_tbl),
- bwn_tabl_iqlocal_tbl);
- bwn_tab_write_multi(mac, BWN_TAB_4(9, 0), N(papdeps), papdeps);
- bwn_tab_write_multi(mac, BWN_TAB_4(10, 0), N(papdmult), papdmult);
-
- if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
- (siba_get_chiprev(sc->sc_dev) == 0)) {
- bwn_tab_write_multi(mac, BWN_TAB_4(13, 0), N(gainidx_a0),
- gainidx_a0);
- bwn_tab_write_multi(mac, BWN_TAB_2(14, 0), N(auxgainidx_a0),
- auxgainidx_a0);
- bwn_tab_write_multi(mac, BWN_TAB_4(17, 0), N(gainval_a0),
- gainval_a0);
- bwn_tab_write_multi(mac, BWN_TAB_2(18, 0), N(gain_a0), gain_a0);
- }
-}
-
-static void
-bwn_phy_lp_tblinit_txgain(struct bwn_mac *mac)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- static struct bwn_txgain_entry txgain_r2[] = {
- { 255, 255, 203, 0, 152 }, { 255, 255, 203, 0, 147 },
- { 255, 255, 203, 0, 143 }, { 255, 255, 203, 0, 139 },
- { 255, 255, 203, 0, 135 }, { 255, 255, 203, 0, 131 },
- { 255, 255, 203, 0, 128 }, { 255, 255, 203, 0, 124 },
- { 255, 255, 203, 0, 121 }, { 255, 255, 203, 0, 117 },
- { 255, 255, 203, 0, 114 }, { 255, 255, 203, 0, 111 },
- { 255, 255, 203, 0, 107 }, { 255, 255, 203, 0, 104 },
- { 255, 255, 203, 0, 101 }, { 255, 255, 203, 0, 99 },
- { 255, 255, 203, 0, 96 }, { 255, 255, 203, 0, 93 },
- { 255, 255, 203, 0, 90 }, { 255, 255, 203, 0, 88 },
- { 255, 255, 203, 0, 85 }, { 255, 255, 203, 0, 83 },
- { 255, 255, 203, 0, 81 }, { 255, 255, 203, 0, 78 },
- { 255, 255, 203, 0, 76 }, { 255, 255, 203, 0, 74 },
- { 255, 255, 203, 0, 72 }, { 255, 255, 203, 0, 70 },
- { 255, 255, 203, 0, 68 }, { 255, 255, 203, 0, 66 },
- { 255, 255, 203, 0, 64 }, { 255, 255, 197, 0, 64 },
- { 255, 255, 192, 0, 64 }, { 255, 255, 186, 0, 64 },
- { 255, 255, 181, 0, 64 }, { 255, 255, 176, 0, 64 },
- { 255, 255, 171, 0, 64 }, { 255, 255, 166, 0, 64 },
- { 255, 255, 161, 0, 64 }, { 255, 255, 157, 0, 64 },
- { 255, 255, 152, 0, 64 }, { 255, 255, 148, 0, 64 },
- { 255, 255, 144, 0, 64 }, { 255, 255, 140, 0, 64 },
- { 255, 255, 136, 0, 64 }, { 255, 255, 132, 0, 64 },
- { 255, 255, 128, 0, 64 }, { 255, 255, 124, 0, 64 },
- { 255, 255, 121, 0, 64 }, { 255, 255, 117, 0, 64 },
- { 255, 255, 114, 0, 64 }, { 255, 255, 111, 0, 64 },
- { 255, 255, 108, 0, 64 }, { 255, 255, 105, 0, 64 },
- { 255, 255, 102, 0, 64 }, { 255, 255, 99, 0, 64 },
- { 255, 255, 96, 0, 64 }, { 255, 255, 93, 0, 64 },
- { 255, 255, 91, 0, 64 }, { 255, 255, 88, 0, 64 },
- { 255, 255, 86, 0, 64 }, { 255, 255, 83, 0, 64 },
- { 255, 255, 81, 0, 64 }, { 255, 255, 79, 0, 64 },
- { 255, 255, 76, 0, 64 }, { 255, 255, 74, 0, 64 },
- { 255, 255, 72, 0, 64 }, { 255, 255, 70, 0, 64 },
- { 255, 255, 68, 0, 64 }, { 255, 255, 66, 0, 64 },
- { 255, 255, 64, 0, 64 }, { 255, 248, 64, 0, 64 },
- { 255, 248, 62, 0, 64 }, { 255, 241, 62, 0, 64 },
- { 255, 241, 60, 0, 64 }, { 255, 234, 60, 0, 64 },
- { 255, 234, 59, 0, 64 }, { 255, 227, 59, 0, 64 },
- { 255, 227, 57, 0, 64 }, { 255, 221, 57, 0, 64 },
- { 255, 221, 55, 0, 64 }, { 255, 215, 55, 0, 64 },
- { 255, 215, 54, 0, 64 }, { 255, 208, 54, 0, 64 },
- { 255, 208, 52, 0, 64 }, { 255, 203, 52, 0, 64 },
- { 255, 203, 51, 0, 64 }, { 255, 197, 51, 0, 64 },
- { 255, 197, 49, 0, 64 }, { 255, 191, 49, 0, 64 },
- { 255, 191, 48, 0, 64 }, { 255, 186, 48, 0, 64 },
- { 255, 186, 47, 0, 64 }, { 255, 181, 47, 0, 64 },
- { 255, 181, 45, 0, 64 }, { 255, 175, 45, 0, 64 },
- { 255, 175, 44, 0, 64 }, { 255, 170, 44, 0, 64 },
- { 255, 170, 43, 0, 64 }, { 255, 166, 43, 0, 64 },
- { 255, 166, 42, 0, 64 }, { 255, 161, 42, 0, 64 },
- { 255, 161, 40, 0, 64 }, { 255, 156, 40, 0, 64 },
- { 255, 156, 39, 0, 64 }, { 255, 152, 39, 0, 64 },
- { 255, 152, 38, 0, 64 }, { 255, 148, 38, 0, 64 },
- { 255, 148, 37, 0, 64 }, { 255, 143, 37, 0, 64 },
- { 255, 143, 36, 0, 64 }, { 255, 139, 36, 0, 64 },
- { 255, 139, 35, 0, 64 }, { 255, 135, 35, 0, 64 },
- { 255, 135, 34, 0, 64 }, { 255, 132, 34, 0, 64 },
- { 255, 132, 33, 0, 64 }, { 255, 128, 33, 0, 64 },
- { 255, 128, 32, 0, 64 }, { 255, 124, 32, 0, 64 },
- { 255, 124, 31, 0, 64 }, { 255, 121, 31, 0, 64 },
- { 255, 121, 30, 0, 64 }, { 255, 117, 30, 0, 64 },
- { 255, 117, 29, 0, 64 }, { 255, 114, 29, 0, 64 },
- { 255, 114, 29, 0, 64 }, { 255, 111, 29, 0, 64 },
- };
- static struct bwn_txgain_entry txgain_2ghz_r2[] = {
- { 7, 99, 255, 0, 64 }, { 7, 96, 255, 0, 64 },
- { 7, 93, 255, 0, 64 }, { 7, 90, 255, 0, 64 },
- { 7, 88, 255, 0, 64 }, { 7, 85, 255, 0, 64 },
- { 7, 83, 255, 0, 64 }, { 7, 81, 255, 0, 64 },
- { 7, 78, 255, 0, 64 }, { 7, 76, 255, 0, 64 },
- { 7, 74, 255, 0, 64 }, { 7, 72, 255, 0, 64 },
- { 7, 70, 255, 0, 64 }, { 7, 68, 255, 0, 64 },
- { 7, 66, 255, 0, 64 }, { 7, 64, 255, 0, 64 },
- { 7, 64, 255, 0, 64 }, { 7, 62, 255, 0, 64 },
- { 7, 62, 248, 0, 64 }, { 7, 60, 248, 0, 64 },
- { 7, 60, 241, 0, 64 }, { 7, 59, 241, 0, 64 },
- { 7, 59, 234, 0, 64 }, { 7, 57, 234, 0, 64 },
- { 7, 57, 227, 0, 64 }, { 7, 55, 227, 0, 64 },
- { 7, 55, 221, 0, 64 }, { 7, 54, 221, 0, 64 },
- { 7, 54, 215, 0, 64 }, { 7, 52, 215, 0, 64 },
- { 7, 52, 208, 0, 64 }, { 7, 51, 208, 0, 64 },
- { 7, 51, 203, 0, 64 }, { 7, 49, 203, 0, 64 },
- { 7, 49, 197, 0, 64 }, { 7, 48, 197, 0, 64 },
- { 7, 48, 191, 0, 64 }, { 7, 47, 191, 0, 64 },
- { 7, 47, 186, 0, 64 }, { 7, 45, 186, 0, 64 },
- { 7, 45, 181, 0, 64 }, { 7, 44, 181, 0, 64 },
- { 7, 44, 175, 0, 64 }, { 7, 43, 175, 0, 64 },
- { 7, 43, 170, 0, 64 }, { 7, 42, 170, 0, 64 },
- { 7, 42, 166, 0, 64 }, { 7, 40, 166, 0, 64 },
- { 7, 40, 161, 0, 64 }, { 7, 39, 161, 0, 64 },
- { 7, 39, 156, 0, 64 }, { 7, 38, 156, 0, 64 },
- { 7, 38, 152, 0, 64 }, { 7, 37, 152, 0, 64 },
- { 7, 37, 148, 0, 64 }, { 7, 36, 148, 0, 64 },
- { 7, 36, 143, 0, 64 }, { 7, 35, 143, 0, 64 },
- { 7, 35, 139, 0, 64 }, { 7, 34, 139, 0, 64 },
- { 7, 34, 135, 0, 64 }, { 7, 33, 135, 0, 64 },
- { 7, 33, 132, 0, 64 }, { 7, 32, 132, 0, 64 },
- { 7, 32, 128, 0, 64 }, { 7, 31, 128, 0, 64 },
- { 7, 31, 124, 0, 64 }, { 7, 30, 124, 0, 64 },
- { 7, 30, 121, 0, 64 }, { 7, 29, 121, 0, 64 },
- { 7, 29, 117, 0, 64 }, { 7, 29, 117, 0, 64 },
- { 7, 29, 114, 0, 64 }, { 7, 28, 114, 0, 64 },
- { 7, 28, 111, 0, 64 }, { 7, 27, 111, 0, 64 },
- { 7, 27, 108, 0, 64 }, { 7, 26, 108, 0, 64 },
- { 7, 26, 104, 0, 64 }, { 7, 25, 104, 0, 64 },
- { 7, 25, 102, 0, 64 }, { 7, 25, 102, 0, 64 },
- { 7, 25, 99, 0, 64 }, { 7, 24, 99, 0, 64 },
- { 7, 24, 96, 0, 64 }, { 7, 23, 96, 0, 64 },
- { 7, 23, 93, 0, 64 }, { 7, 23, 93, 0, 64 },
- { 7, 23, 90, 0, 64 }, { 7, 22, 90, 0, 64 },
- { 7, 22, 88, 0, 64 }, { 7, 21, 88, 0, 64 },
- { 7, 21, 85, 0, 64 }, { 7, 21, 85, 0, 64 },
- { 7, 21, 83, 0, 64 }, { 7, 20, 83, 0, 64 },
- { 7, 20, 81, 0, 64 }, { 7, 20, 81, 0, 64 },
- { 7, 20, 78, 0, 64 }, { 7, 19, 78, 0, 64 },
- { 7, 19, 76, 0, 64 }, { 7, 19, 76, 0, 64 },
- { 7, 19, 74, 0, 64 }, { 7, 18, 74, 0, 64 },
- { 7, 18, 72, 0, 64 }, { 7, 18, 72, 0, 64 },
- { 7, 18, 70, 0, 64 }, { 7, 17, 70, 0, 64 },
- { 7, 17, 68, 0, 64 }, { 7, 17, 68, 0, 64 },
- { 7, 17, 66, 0, 64 }, { 7, 16, 66, 0, 64 },
- { 7, 16, 64, 0, 64 }, { 7, 16, 64, 0, 64 },
- { 7, 16, 62, 0, 64 }, { 7, 15, 62, 0, 64 },
- { 7, 15, 60, 0, 64 }, { 7, 15, 60, 0, 64 },
- { 7, 15, 59, 0, 64 }, { 7, 14, 59, 0, 64 },
- { 7, 14, 57, 0, 64 }, { 7, 14, 57, 0, 64 },
- { 7, 14, 55, 0, 64 }, { 7, 14, 55, 0, 64 },
- { 7, 14, 54, 0, 64 }, { 7, 13, 54, 0, 64 },
- { 7, 13, 52, 0, 64 }, { 7, 13, 52, 0, 64 },
- };
- static struct bwn_txgain_entry txgain_5ghz_r2[] = {
- { 255, 255, 255, 0, 152 }, { 255, 255, 255, 0, 147 },
- { 255, 255, 255, 0, 143 }, { 255, 255, 255, 0, 139 },
- { 255, 255, 255, 0, 135 }, { 255, 255, 255, 0, 131 },
- { 255, 255, 255, 0, 128 }, { 255, 255, 255, 0, 124 },
- { 255, 255, 255, 0, 121 }, { 255, 255, 255, 0, 117 },
- { 255, 255, 255, 0, 114 }, { 255, 255, 255, 0, 111 },
- { 255, 255, 255, 0, 107 }, { 255, 255, 255, 0, 104 },
- { 255, 255, 255, 0, 101 }, { 255, 255, 255, 0, 99 },
- { 255, 255, 255, 0, 96 }, { 255, 255, 255, 0, 93 },
- { 255, 255, 255, 0, 90 }, { 255, 255, 255, 0, 88 },
- { 255, 255, 255, 0, 85 }, { 255, 255, 255, 0, 83 },
- { 255, 255, 255, 0, 81 }, { 255, 255, 255, 0, 78 },
- { 255, 255, 255, 0, 76 }, { 255, 255, 255, 0, 74 },
- { 255, 255, 255, 0, 72 }, { 255, 255, 255, 0, 70 },
- { 255, 255, 255, 0, 68 }, { 255, 255, 255, 0, 66 },
- { 255, 255, 255, 0, 64 }, { 255, 255, 248, 0, 64 },
- { 255, 255, 241, 0, 64 }, { 255, 255, 234, 0, 64 },
- { 255, 255, 227, 0, 64 }, { 255, 255, 221, 0, 64 },
- { 255, 255, 215, 0, 64 }, { 255, 255, 208, 0, 64 },
- { 255, 255, 203, 0, 64 }, { 255, 255, 197, 0, 64 },
- { 255, 255, 191, 0, 64 }, { 255, 255, 186, 0, 64 },
- { 255, 255, 181, 0, 64 }, { 255, 255, 175, 0, 64 },
- { 255, 255, 170, 0, 64 }, { 255, 255, 166, 0, 64 },
- { 255, 255, 161, 0, 64 }, { 255, 255, 156, 0, 64 },
- { 255, 255, 152, 0, 64 }, { 255, 255, 148, 0, 64 },
- { 255, 255, 143, 0, 64 }, { 255, 255, 139, 0, 64 },
- { 255, 255, 135, 0, 64 }, { 255, 255, 132, 0, 64 },
- { 255, 255, 128, 0, 64 }, { 255, 255, 124, 0, 64 },
- { 255, 255, 121, 0, 64 }, { 255, 255, 117, 0, 64 },
- { 255, 255, 114, 0, 64 }, { 255, 255, 111, 0, 64 },
- { 255, 255, 108, 0, 64 }, { 255, 255, 104, 0, 64 },
- { 255, 255, 102, 0, 64 }, { 255, 255, 99, 0, 64 },
- { 255, 255, 96, 0, 64 }, { 255, 255, 93, 0, 64 },
- { 255, 255, 90, 0, 64 }, { 255, 255, 88, 0, 64 },
- { 255, 255, 85, 0, 64 }, { 255, 255, 83, 0, 64 },
- { 255, 255, 81, 0, 64 }, { 255, 255, 78, 0, 64 },
- { 255, 255, 76, 0, 64 }, { 255, 255, 74, 0, 64 },
- { 255, 255, 72, 0, 64 }, { 255, 255, 70, 0, 64 },
- { 255, 255, 68, 0, 64 }, { 255, 255, 66, 0, 64 },
- { 255, 255, 64, 0, 64 }, { 255, 255, 64, 0, 64 },
- { 255, 255, 62, 0, 64 }, { 255, 248, 62, 0, 64 },
- { 255, 248, 60, 0, 64 }, { 255, 241, 60, 0, 64 },
- { 255, 241, 59, 0, 64 }, { 255, 234, 59, 0, 64 },
- { 255, 234, 57, 0, 64 }, { 255, 227, 57, 0, 64 },
- { 255, 227, 55, 0, 64 }, { 255, 221, 55, 0, 64 },
- { 255, 221, 54, 0, 64 }, { 255, 215, 54, 0, 64 },
- { 255, 215, 52, 0, 64 }, { 255, 208, 52, 0, 64 },
- { 255, 208, 51, 0, 64 }, { 255, 203, 51, 0, 64 },
- { 255, 203, 49, 0, 64 }, { 255, 197, 49, 0, 64 },
- { 255, 197, 48, 0, 64 }, { 255, 191, 48, 0, 64 },
- { 255, 191, 47, 0, 64 }, { 255, 186, 47, 0, 64 },
- { 255, 186, 45, 0, 64 }, { 255, 181, 45, 0, 64 },
- { 255, 181, 44, 0, 64 }, { 255, 175, 44, 0, 64 },
- { 255, 175, 43, 0, 64 }, { 255, 170, 43, 0, 64 },
- { 255, 170, 42, 0, 64 }, { 255, 166, 42, 0, 64 },
- { 255, 166, 40, 0, 64 }, { 255, 161, 40, 0, 64 },
- { 255, 161, 39, 0, 64 }, { 255, 156, 39, 0, 64 },
- { 255, 156, 38, 0, 64 }, { 255, 152, 38, 0, 64 },
- { 255, 152, 37, 0, 64 }, { 255, 148, 37, 0, 64 },
- { 255, 148, 36, 0, 64 }, { 255, 143, 36, 0, 64 },
- { 255, 143, 35, 0, 64 }, { 255, 139, 35, 0, 64 },
- { 255, 139, 34, 0, 64 }, { 255, 135, 34, 0, 64 },
- { 255, 135, 33, 0, 64 }, { 255, 132, 33, 0, 64 },
- { 255, 132, 32, 0, 64 }, { 255, 128, 32, 0, 64 }
- };
- static struct bwn_txgain_entry txgain_r0[] = {
- { 7, 15, 14, 0, 152 }, { 7, 15, 14, 0, 147 },
- { 7, 15, 14, 0, 143 }, { 7, 15, 14, 0, 139 },
- { 7, 15, 14, 0, 135 }, { 7, 15, 14, 0, 131 },
- { 7, 15, 14, 0, 128 }, { 7, 15, 14, 0, 124 },
- { 7, 15, 14, 0, 121 }, { 7, 15, 14, 0, 117 },
- { 7, 15, 14, 0, 114 }, { 7, 15, 14, 0, 111 },
- { 7, 15, 14, 0, 107 }, { 7, 15, 14, 0, 104 },
- { 7, 15, 14, 0, 101 }, { 7, 15, 14, 0, 99 },
- { 7, 15, 14, 0, 96 }, { 7, 15, 14, 0, 93 },
- { 7, 15, 14, 0, 90 }, { 7, 15, 14, 0, 88 },
- { 7, 15, 14, 0, 85 }, { 7, 15, 14, 0, 83 },
- { 7, 15, 14, 0, 81 }, { 7, 15, 14, 0, 78 },
- { 7, 15, 14, 0, 76 }, { 7, 15, 14, 0, 74 },
- { 7, 15, 14, 0, 72 }, { 7, 15, 14, 0, 70 },
- { 7, 15, 14, 0, 68 }, { 7, 15, 14, 0, 66 },
- { 7, 15, 14, 0, 64 }, { 7, 15, 14, 0, 62 },
- { 7, 15, 14, 0, 60 }, { 7, 15, 14, 0, 59 },
- { 7, 15, 14, 0, 57 }, { 7, 15, 13, 0, 72 },
- { 7, 15, 13, 0, 70 }, { 7, 15, 13, 0, 68 },
- { 7, 15, 13, 0, 66 }, { 7, 15, 13, 0, 64 },
- { 7, 15, 13, 0, 62 }, { 7, 15, 13, 0, 60 },
- { 7, 15, 13, 0, 59 }, { 7, 15, 13, 0, 57 },
- { 7, 15, 12, 0, 71 }, { 7, 15, 12, 0, 69 },
- { 7, 15, 12, 0, 67 }, { 7, 15, 12, 0, 65 },
- { 7, 15, 12, 0, 63 }, { 7, 15, 12, 0, 62 },
- { 7, 15, 12, 0, 60 }, { 7, 15, 12, 0, 58 },
- { 7, 15, 12, 0, 57 }, { 7, 15, 11, 0, 70 },
- { 7, 15, 11, 0, 68 }, { 7, 15, 11, 0, 66 },
- { 7, 15, 11, 0, 65 }, { 7, 15, 11, 0, 63 },
- { 7, 15, 11, 0, 61 }, { 7, 15, 11, 0, 59 },
- { 7, 15, 11, 0, 58 }, { 7, 15, 10, 0, 71 },
- { 7, 15, 10, 0, 69 }, { 7, 15, 10, 0, 67 },
- { 7, 15, 10, 0, 65 }, { 7, 15, 10, 0, 63 },
- { 7, 15, 10, 0, 61 }, { 7, 15, 10, 0, 60 },
- { 7, 15, 10, 0, 58 }, { 7, 15, 10, 0, 56 },
- { 7, 15, 9, 0, 70 }, { 7, 15, 9, 0, 68 },
- { 7, 15, 9, 0, 66 }, { 7, 15, 9, 0, 64 },
- { 7, 15, 9, 0, 62 }, { 7, 15, 9, 0, 60 },
- { 7, 15, 9, 0, 59 }, { 7, 14, 9, 0, 72 },
- { 7, 14, 9, 0, 70 }, { 7, 14, 9, 0, 68 },
- { 7, 14, 9, 0, 66 }, { 7, 14, 9, 0, 64 },
- { 7, 14, 9, 0, 62 }, { 7, 14, 9, 0, 60 },
- { 7, 14, 9, 0, 59 }, { 7, 13, 9, 0, 72 },
- { 7, 13, 9, 0, 70 }, { 7, 13, 9, 0, 68 },
- { 7, 13, 9, 0, 66 }, { 7, 13, 9, 0, 64 },
- { 7, 13, 9, 0, 63 }, { 7, 13, 9, 0, 61 },
- { 7, 13, 9, 0, 59 }, { 7, 13, 9, 0, 57 },
- { 7, 13, 8, 0, 72 }, { 7, 13, 8, 0, 70 },
- { 7, 13, 8, 0, 68 }, { 7, 13, 8, 0, 66 },
- { 7, 13, 8, 0, 64 }, { 7, 13, 8, 0, 62 },
- { 7, 13, 8, 0, 60 }, { 7, 13, 8, 0, 59 },
- { 7, 12, 8, 0, 72 }, { 7, 12, 8, 0, 70 },
- { 7, 12, 8, 0, 68 }, { 7, 12, 8, 0, 66 },
- { 7, 12, 8, 0, 64 }, { 7, 12, 8, 0, 62 },
- { 7, 12, 8, 0, 61 }, { 7, 12, 8, 0, 59 },
- { 7, 12, 7, 0, 73 }, { 7, 12, 7, 0, 71 },
- { 7, 12, 7, 0, 69 }, { 7, 12, 7, 0, 67 },
- { 7, 12, 7, 0, 65 }, { 7, 12, 7, 0, 63 },
- { 7, 12, 7, 0, 61 }, { 7, 12, 7, 0, 59 },
- { 7, 11, 7, 0, 72 }, { 7, 11, 7, 0, 70 },
- { 7, 11, 7, 0, 68 }, { 7, 11, 7, 0, 66 },
- { 7, 11, 7, 0, 65 }, { 7, 11, 7, 0, 63 },
- { 7, 11, 7, 0, 61 }, { 7, 11, 7, 0, 59 },
- { 7, 11, 6, 0, 73 }, { 7, 11, 6, 0, 71 }
- };
- static struct bwn_txgain_entry txgain_2ghz_r0[] = {
- { 4, 15, 9, 0, 64 }, { 4, 15, 9, 0, 62 },
- { 4, 15, 9, 0, 60 }, { 4, 15, 9, 0, 59 },
- { 4, 14, 9, 0, 72 }, { 4, 14, 9, 0, 70 },
- { 4, 14, 9, 0, 68 }, { 4, 14, 9, 0, 66 },
- { 4, 14, 9, 0, 64 }, { 4, 14, 9, 0, 62 },
- { 4, 14, 9, 0, 60 }, { 4, 14, 9, 0, 59 },
- { 4, 13, 9, 0, 72 }, { 4, 13, 9, 0, 70 },
- { 4, 13, 9, 0, 68 }, { 4, 13, 9, 0, 66 },
- { 4, 13, 9, 0, 64 }, { 4, 13, 9, 0, 63 },
- { 4, 13, 9, 0, 61 }, { 4, 13, 9, 0, 59 },
- { 4, 13, 9, 0, 57 }, { 4, 13, 8, 0, 72 },
- { 4, 13, 8, 0, 70 }, { 4, 13, 8, 0, 68 },
- { 4, 13, 8, 0, 66 }, { 4, 13, 8, 0, 64 },
- { 4, 13, 8, 0, 62 }, { 4, 13, 8, 0, 60 },
- { 4, 13, 8, 0, 59 }, { 4, 12, 8, 0, 72 },
- { 4, 12, 8, 0, 70 }, { 4, 12, 8, 0, 68 },
- { 4, 12, 8, 0, 66 }, { 4, 12, 8, 0, 64 },
- { 4, 12, 8, 0, 62 }, { 4, 12, 8, 0, 61 },
- { 4, 12, 8, 0, 59 }, { 4, 12, 7, 0, 73 },
- { 4, 12, 7, 0, 71 }, { 4, 12, 7, 0, 69 },
- { 4, 12, 7, 0, 67 }, { 4, 12, 7, 0, 65 },
- { 4, 12, 7, 0, 63 }, { 4, 12, 7, 0, 61 },
- { 4, 12, 7, 0, 59 }, { 4, 11, 7, 0, 72 },
- { 4, 11, 7, 0, 70 }, { 4, 11, 7, 0, 68 },
- { 4, 11, 7, 0, 66 }, { 4, 11, 7, 0, 65 },
- { 4, 11, 7, 0, 63 }, { 4, 11, 7, 0, 61 },
- { 4, 11, 7, 0, 59 }, { 4, 11, 6, 0, 73 },
- { 4, 11, 6, 0, 71 }, { 4, 11, 6, 0, 69 },
- { 4, 11, 6, 0, 67 }, { 4, 11, 6, 0, 65 },
- { 4, 11, 6, 0, 63 }, { 4, 11, 6, 0, 61 },
- { 4, 11, 6, 0, 60 }, { 4, 10, 6, 0, 72 },
- { 4, 10, 6, 0, 70 }, { 4, 10, 6, 0, 68 },
- { 4, 10, 6, 0, 66 }, { 4, 10, 6, 0, 64 },
- { 4, 10, 6, 0, 62 }, { 4, 10, 6, 0, 60 },
- { 4, 10, 6, 0, 59 }, { 4, 10, 5, 0, 72 },
- { 4, 10, 5, 0, 70 }, { 4, 10, 5, 0, 68 },
- { 4, 10, 5, 0, 66 }, { 4, 10, 5, 0, 64 },
- { 4, 10, 5, 0, 62 }, { 4, 10, 5, 0, 60 },
- { 4, 10, 5, 0, 59 }, { 4, 9, 5, 0, 70 },
- { 4, 9, 5, 0, 68 }, { 4, 9, 5, 0, 66 },
- { 4, 9, 5, 0, 64 }, { 4, 9, 5, 0, 63 },
- { 4, 9, 5, 0, 61 }, { 4, 9, 5, 0, 59 },
- { 4, 9, 4, 0, 71 }, { 4, 9, 4, 0, 69 },
- { 4, 9, 4, 0, 67 }, { 4, 9, 4, 0, 65 },
- { 4, 9, 4, 0, 63 }, { 4, 9, 4, 0, 62 },
- { 4, 9, 4, 0, 60 }, { 4, 9, 4, 0, 58 },
- { 4, 8, 4, 0, 70 }, { 4, 8, 4, 0, 68 },
- { 4, 8, 4, 0, 66 }, { 4, 8, 4, 0, 65 },
- { 4, 8, 4, 0, 63 }, { 4, 8, 4, 0, 61 },
- { 4, 8, 4, 0, 59 }, { 4, 7, 4, 0, 68 },
- { 4, 7, 4, 0, 66 }, { 4, 7, 4, 0, 64 },
- { 4, 7, 4, 0, 62 }, { 4, 7, 4, 0, 61 },
- { 4, 7, 4, 0, 59 }, { 4, 7, 3, 0, 67 },
- { 4, 7, 3, 0, 65 }, { 4, 7, 3, 0, 63 },
- { 4, 7, 3, 0, 62 }, { 4, 7, 3, 0, 60 },
- { 4, 6, 3, 0, 65 }, { 4, 6, 3, 0, 63 },
- { 4, 6, 3, 0, 61 }, { 4, 6, 3, 0, 60 },
- { 4, 6, 3, 0, 58 }, { 4, 5, 3, 0, 68 },
- { 4, 5, 3, 0, 66 }, { 4, 5, 3, 0, 64 },
- { 4, 5, 3, 0, 62 }, { 4, 5, 3, 0, 60 },
- { 4, 5, 3, 0, 59 }, { 4, 5, 3, 0, 57 },
- { 4, 4, 2, 0, 83 }, { 4, 4, 2, 0, 81 },
- { 4, 4, 2, 0, 78 }, { 4, 4, 2, 0, 76 },
- { 4, 4, 2, 0, 74 }, { 4, 4, 2, 0, 72 }
- };
- static struct bwn_txgain_entry txgain_5ghz_r0[] = {
- { 7, 15, 15, 0, 99 }, { 7, 15, 15, 0, 96 },
- { 7, 15, 15, 0, 93 }, { 7, 15, 15, 0, 90 },
- { 7, 15, 15, 0, 88 }, { 7, 15, 15, 0, 85 },
- { 7, 15, 15, 0, 83 }, { 7, 15, 15, 0, 81 },
- { 7, 15, 15, 0, 78 }, { 7, 15, 15, 0, 76 },
- { 7, 15, 15, 0, 74 }, { 7, 15, 15, 0, 72 },
- { 7, 15, 15, 0, 70 }, { 7, 15, 15, 0, 68 },
- { 7, 15, 15, 0, 66 }, { 7, 15, 15, 0, 64 },
- { 7, 15, 15, 0, 62 }, { 7, 15, 15, 0, 60 },
- { 7, 15, 15, 0, 59 }, { 7, 15, 15, 0, 57 },
- { 7, 15, 15, 0, 55 }, { 7, 15, 14, 0, 72 },
- { 7, 15, 14, 0, 70 }, { 7, 15, 14, 0, 68 },
- { 7, 15, 14, 0, 66 }, { 7, 15, 14, 0, 64 },
- { 7, 15, 14, 0, 62 }, { 7, 15, 14, 0, 60 },
- { 7, 15, 14, 0, 58 }, { 7, 15, 14, 0, 56 },
- { 7, 15, 14, 0, 55 }, { 7, 15, 13, 0, 71 },
- { 7, 15, 13, 0, 69 }, { 7, 15, 13, 0, 67 },
- { 7, 15, 13, 0, 65 }, { 7, 15, 13, 0, 63 },
- { 7, 15, 13, 0, 62 }, { 7, 15, 13, 0, 60 },
- { 7, 15, 13, 0, 58 }, { 7, 15, 13, 0, 56 },
- { 7, 15, 12, 0, 72 }, { 7, 15, 12, 0, 70 },
- { 7, 15, 12, 0, 68 }, { 7, 15, 12, 0, 66 },
- { 7, 15, 12, 0, 64 }, { 7, 15, 12, 0, 62 },
- { 7, 15, 12, 0, 60 }, { 7, 15, 12, 0, 59 },
- { 7, 15, 12, 0, 57 }, { 7, 15, 11, 0, 73 },
- { 7, 15, 11, 0, 71 }, { 7, 15, 11, 0, 69 },
- { 7, 15, 11, 0, 67 }, { 7, 15, 11, 0, 65 },
- { 7, 15, 11, 0, 63 }, { 7, 15, 11, 0, 61 },
- { 7, 15, 11, 0, 60 }, { 7, 15, 11, 0, 58 },
- { 7, 15, 10, 0, 71 }, { 7, 15, 10, 0, 69 },
- { 7, 15, 10, 0, 67 }, { 7, 15, 10, 0, 65 },
- { 7, 15, 10, 0, 63 }, { 7, 15, 10, 0, 61 },
- { 7, 15, 10, 0, 60 }, { 7, 15, 10, 0, 58 },
- { 7, 15, 9, 0, 70 }, { 7, 15, 9, 0, 68 },
- { 7, 15, 9, 0, 66 }, { 7, 15, 9, 0, 64 },
- { 7, 15, 9, 0, 62 }, { 7, 15, 9, 0, 61 },
- { 7, 15, 9, 0, 59 }, { 7, 15, 9, 0, 57 },
- { 7, 15, 9, 0, 56 }, { 7, 14, 9, 0, 68 },
- { 7, 14, 9, 0, 66 }, { 7, 14, 9, 0, 65 },
- { 7, 14, 9, 0, 63 }, { 7, 14, 9, 0, 61 },
- { 7, 14, 9, 0, 59 }, { 7, 14, 9, 0, 58 },
- { 7, 13, 9, 0, 70 }, { 7, 13, 9, 0, 68 },
- { 7, 13, 9, 0, 66 }, { 7, 13, 9, 0, 64 },
- { 7, 13, 9, 0, 63 }, { 7, 13, 9, 0, 61 },
- { 7, 13, 9, 0, 59 }, { 7, 13, 9, 0, 57 },
- { 7, 13, 8, 0, 70 }, { 7, 13, 8, 0, 68 },
- { 7, 13, 8, 0, 66 }, { 7, 13, 8, 0, 64 },
- { 7, 13, 8, 0, 62 }, { 7, 13, 8, 0, 60 },
- { 7, 13, 8, 0, 59 }, { 7, 13, 8, 0, 57 },
- { 7, 12, 8, 0, 70 }, { 7, 12, 8, 0, 68 },
- { 7, 12, 8, 0, 66 }, { 7, 12, 8, 0, 64 },
- { 7, 12, 8, 0, 62 }, { 7, 12, 8, 0, 61 },
- { 7, 12, 8, 0, 59 }, { 7, 12, 8, 0, 57 },
- { 7, 12, 7, 0, 70 }, { 7, 12, 7, 0, 68 },
- { 7, 12, 7, 0, 66 }, { 7, 12, 7, 0, 64 },
- { 7, 12, 7, 0, 62 }, { 7, 12, 7, 0, 61 },
- { 7, 12, 7, 0, 59 }, { 7, 12, 7, 0, 57 },
- { 7, 11, 7, 0, 70 }, { 7, 11, 7, 0, 68 },
- { 7, 11, 7, 0, 66 }, { 7, 11, 7, 0, 64 },
- { 7, 11, 7, 0, 62 }, { 7, 11, 7, 0, 61 },
- { 7, 11, 7, 0, 59 }, { 7, 11, 7, 0, 57 },
- { 7, 11, 6, 0, 69 }, { 7, 11, 6, 0, 67 },
- { 7, 11, 6, 0, 65 }, { 7, 11, 6, 0, 63 },
- { 7, 11, 6, 0, 62 }, { 7, 11, 6, 0, 60 }
- };
- static struct bwn_txgain_entry txgain_r1[] = {
- { 7, 15, 14, 0, 152 }, { 7, 15, 14, 0, 147 },
- { 7, 15, 14, 0, 143 }, { 7, 15, 14, 0, 139 },
- { 7, 15, 14, 0, 135 }, { 7, 15, 14, 0, 131 },
- { 7, 15, 14, 0, 128 }, { 7, 15, 14, 0, 124 },
- { 7, 15, 14, 0, 121 }, { 7, 15, 14, 0, 117 },
- { 7, 15, 14, 0, 114 }, { 7, 15, 14, 0, 111 },
- { 7, 15, 14, 0, 107 }, { 7, 15, 14, 0, 104 },
- { 7, 15, 14, 0, 101 }, { 7, 15, 14, 0, 99 },
- { 7, 15, 14, 0, 96 }, { 7, 15, 14, 0, 93 },
- { 7, 15, 14, 0, 90 }, { 7, 15, 14, 0, 88 },
- { 7, 15, 14, 0, 85 }, { 7, 15, 14, 0, 83 },
- { 7, 15, 14, 0, 81 }, { 7, 15, 14, 0, 78 },
- { 7, 15, 14, 0, 76 }, { 7, 15, 14, 0, 74 },
- { 7, 15, 14, 0, 72 }, { 7, 15, 14, 0, 70 },
- { 7, 15, 14, 0, 68 }, { 7, 15, 14, 0, 66 },
- { 7, 15, 14, 0, 64 }, { 7, 15, 14, 0, 62 },
- { 7, 15, 14, 0, 60 }, { 7, 15, 14, 0, 59 },
- { 7, 15, 14, 0, 57 }, { 7, 15, 13, 0, 72 },
- { 7, 15, 13, 0, 70 }, { 7, 15, 14, 0, 68 },
- { 7, 15, 14, 0, 66 }, { 7, 15, 14, 0, 64 },
- { 7, 15, 14, 0, 62 }, { 7, 15, 14, 0, 60 },
- { 7, 15, 14, 0, 59 }, { 7, 15, 14, 0, 57 },
- { 7, 15, 13, 0, 72 }, { 7, 15, 13, 0, 70 },
- { 7, 15, 13, 0, 68 }, { 7, 15, 13, 0, 66 },
- { 7, 15, 13, 0, 64 }, { 7, 15, 13, 0, 62 },
- { 7, 15, 13, 0, 60 }, { 7, 15, 13, 0, 59 },
- { 7, 15, 13, 0, 57 }, { 7, 15, 12, 0, 71 },
- { 7, 15, 12, 0, 69 }, { 7, 15, 12, 0, 67 },
- { 7, 15, 12, 0, 65 }, { 7, 15, 12, 0, 63 },
- { 7, 15, 12, 0, 62 }, { 7, 15, 12, 0, 60 },
- { 7, 15, 12, 0, 58 }, { 7, 15, 12, 0, 57 },
- { 7, 15, 11, 0, 70 }, { 7, 15, 11, 0, 68 },
- { 7, 15, 11, 0, 66 }, { 7, 15, 11, 0, 65 },
- { 7, 15, 11, 0, 63 }, { 7, 15, 11, 0, 61 },
- { 7, 15, 11, 0, 59 }, { 7, 15, 11, 0, 58 },
- { 7, 15, 10, 0, 71 }, { 7, 15, 10, 0, 69 },
- { 7, 15, 10, 0, 67 }, { 7, 15, 10, 0, 65 },
- { 7, 15, 10, 0, 63 }, { 7, 15, 10, 0, 61 },
- { 7, 15, 10, 0, 60 }, { 7, 15, 10, 0, 58 },
- { 7, 15, 10, 0, 56 }, { 7, 15, 9, 0, 70 },
- { 7, 15, 9, 0, 68 }, { 7, 15, 9, 0, 66 },
- { 7, 15, 9, 0, 64 }, { 7, 15, 9, 0, 62 },
- { 7, 15, 9, 0, 60 }, { 7, 15, 9, 0, 59 },
- { 7, 14, 9, 0, 72 }, { 7, 14, 9, 0, 70 },
- { 7, 14, 9, 0, 68 }, { 7, 14, 9, 0, 66 },
- { 7, 14, 9, 0, 64 }, { 7, 14, 9, 0, 62 },
- { 7, 14, 9, 0, 60 }, { 7, 14, 9, 0, 59 },
- { 7, 13, 9, 0, 72 }, { 7, 13, 9, 0, 70 },
- { 7, 13, 9, 0, 68 }, { 7, 13, 9, 0, 66 },
- { 7, 13, 9, 0, 64 }, { 7, 13, 9, 0, 63 },
- { 7, 13, 9, 0, 61 }, { 7, 13, 9, 0, 59 },
- { 7, 13, 9, 0, 57 }, { 7, 13, 8, 0, 72 },
- { 7, 13, 8, 0, 70 }, { 7, 13, 8, 0, 68 },
- { 7, 13, 8, 0, 66 }, { 7, 13, 8, 0, 64 },
- { 7, 13, 8, 0, 62 }, { 7, 13, 8, 0, 60 },
- { 7, 13, 8, 0, 59 }, { 7, 12, 8, 0, 72 },
- { 7, 12, 8, 0, 70 }, { 7, 12, 8, 0, 68 },
- { 7, 12, 8, 0, 66 }, { 7, 12, 8, 0, 64 },
- { 7, 12, 8, 0, 62 }, { 7, 12, 8, 0, 61 },
- { 7, 12, 8, 0, 59 }, { 7, 12, 7, 0, 73 },
- { 7, 12, 7, 0, 71 }, { 7, 12, 7, 0, 69 },
- { 7, 12, 7, 0, 67 }, { 7, 12, 7, 0, 65 },
- { 7, 12, 7, 0, 63 }, { 7, 12, 7, 0, 61 },
- { 7, 12, 7, 0, 59 }, { 7, 11, 7, 0, 72 },
- { 7, 11, 7, 0, 70 }, { 7, 11, 7, 0, 68 },
- { 7, 11, 7, 0, 66 }, { 7, 11, 7, 0, 65 },
- { 7, 11, 7, 0, 63 }, { 7, 11, 7, 0, 61 },
- { 7, 11, 7, 0, 59 }, { 7, 11, 6, 0, 73 },
- { 7, 11, 6, 0, 71 }
- };
- static struct bwn_txgain_entry txgain_2ghz_r1[] = {
- { 4, 15, 15, 0, 90 }, { 4, 15, 15, 0, 88 },
- { 4, 15, 15, 0, 85 }, { 4, 15, 15, 0, 83 },
- { 4, 15, 15, 0, 81 }, { 4, 15, 15, 0, 78 },
- { 4, 15, 15, 0, 76 }, { 4, 15, 15, 0, 74 },
- { 4, 15, 15, 0, 72 }, { 4, 15, 15, 0, 70 },
- { 4, 15, 15, 0, 68 }, { 4, 15, 15, 0, 66 },
- { 4, 15, 15, 0, 64 }, { 4, 15, 15, 0, 62 },
- { 4, 15, 15, 0, 60 }, { 4, 15, 15, 0, 59 },
- { 4, 15, 14, 0, 72 }, { 4, 15, 14, 0, 70 },
- { 4, 15, 14, 0, 68 }, { 4, 15, 14, 0, 66 },
- { 4, 15, 14, 0, 64 }, { 4, 15, 14, 0, 62 },
- { 4, 15, 14, 0, 60 }, { 4, 15, 14, 0, 59 },
- { 4, 15, 13, 0, 72 }, { 4, 15, 13, 0, 70 },
- { 4, 15, 13, 0, 68 }, { 4, 15, 13, 0, 66 },
- { 4, 15, 13, 0, 64 }, { 4, 15, 13, 0, 62 },
- { 4, 15, 13, 0, 60 }, { 4, 15, 13, 0, 59 },
- { 4, 15, 12, 0, 72 }, { 4, 15, 12, 0, 70 },
- { 4, 15, 12, 0, 68 }, { 4, 15, 12, 0, 66 },
- { 4, 15, 12, 0, 64 }, { 4, 15, 12, 0, 62 },
- { 4, 15, 12, 0, 60 }, { 4, 15, 12, 0, 59 },
- { 4, 15, 11, 0, 72 }, { 4, 15, 11, 0, 70 },
- { 4, 15, 11, 0, 68 }, { 4, 15, 11, 0, 66 },
- { 4, 15, 11, 0, 64 }, { 4, 15, 11, 0, 62 },
- { 4, 15, 11, 0, 60 }, { 4, 15, 11, 0, 59 },
- { 4, 15, 10, 0, 72 }, { 4, 15, 10, 0, 70 },
- { 4, 15, 10, 0, 68 }, { 4, 15, 10, 0, 66 },
- { 4, 15, 10, 0, 64 }, { 4, 15, 10, 0, 62 },
- { 4, 15, 10, 0, 60 }, { 4, 15, 10, 0, 59 },
- { 4, 15, 9, 0, 72 }, { 4, 15, 9, 0, 70 },
- { 4, 15, 9, 0, 68 }, { 4, 15, 9, 0, 66 },
- { 4, 15, 9, 0, 64 }, { 4, 15, 9, 0, 62 },
- { 4, 15, 9, 0, 60 }, { 4, 15, 9, 0, 59 },
- { 4, 14, 9, 0, 72 }, { 4, 14, 9, 0, 70 },
- { 4, 14, 9, 0, 68 }, { 4, 14, 9, 0, 66 },
- { 4, 14, 9, 0, 64 }, { 4, 14, 9, 0, 62 },
- { 4, 14, 9, 0, 60 }, { 4, 14, 9, 0, 59 },
- { 4, 13, 9, 0, 72 }, { 4, 13, 9, 0, 70 },
- { 4, 13, 9, 0, 68 }, { 4, 13, 9, 0, 66 },
- { 4, 13, 9, 0, 64 }, { 4, 13, 9, 0, 63 },
- { 4, 13, 9, 0, 61 }, { 4, 13, 9, 0, 59 },
- { 4, 13, 9, 0, 57 }, { 4, 13, 8, 0, 72 },
- { 4, 13, 8, 0, 70 }, { 4, 13, 8, 0, 68 },
- { 4, 13, 8, 0, 66 }, { 4, 13, 8, 0, 64 },
- { 4, 13, 8, 0, 62 }, { 4, 13, 8, 0, 60 },
- { 4, 13, 8, 0, 59 }, { 4, 12, 8, 0, 72 },
- { 4, 12, 8, 0, 70 }, { 4, 12, 8, 0, 68 },
- { 4, 12, 8, 0, 66 }, { 4, 12, 8, 0, 64 },
- { 4, 12, 8, 0, 62 }, { 4, 12, 8, 0, 61 },
- { 4, 12, 8, 0, 59 }, { 4, 12, 7, 0, 73 },
- { 4, 12, 7, 0, 71 }, { 4, 12, 7, 0, 69 },
- { 4, 12, 7, 0, 67 }, { 4, 12, 7, 0, 65 },
- { 4, 12, 7, 0, 63 }, { 4, 12, 7, 0, 61 },
- { 4, 12, 7, 0, 59 }, { 4, 11, 7, 0, 72 },
- { 4, 11, 7, 0, 70 }, { 4, 11, 7, 0, 68 },
- { 4, 11, 7, 0, 66 }, { 4, 11, 7, 0, 65 },
- { 4, 11, 7, 0, 63 }, { 4, 11, 7, 0, 61 },
- { 4, 11, 7, 0, 59 }, { 4, 11, 6, 0, 73 },
- { 4, 11, 6, 0, 71 }, { 4, 11, 6, 0, 69 },
- { 4, 11, 6, 0, 67 }, { 4, 11, 6, 0, 65 },
- { 4, 11, 6, 0, 63 }, { 4, 11, 6, 0, 61 },
- { 4, 11, 6, 0, 60 }, { 4, 10, 6, 0, 72 },
- { 4, 10, 6, 0, 70 }, { 4, 10, 6, 0, 68 },
- { 4, 10, 6, 0, 66 }, { 4, 10, 6, 0, 64 },
- { 4, 10, 6, 0, 62 }, { 4, 10, 6, 0, 60 }
- };
- static struct bwn_txgain_entry txgain_5ghz_r1[] = {
- { 7, 15, 15, 0, 99 }, { 7, 15, 15, 0, 96 },
- { 7, 15, 15, 0, 93 }, { 7, 15, 15, 0, 90 },
- { 7, 15, 15, 0, 88 }, { 7, 15, 15, 0, 85 },
- { 7, 15, 15, 0, 83 }, { 7, 15, 15, 0, 81 },
- { 7, 15, 15, 0, 78 }, { 7, 15, 15, 0, 76 },
- { 7, 15, 15, 0, 74 }, { 7, 15, 15, 0, 72 },
- { 7, 15, 15, 0, 70 }, { 7, 15, 15, 0, 68 },
- { 7, 15, 15, 0, 66 }, { 7, 15, 15, 0, 64 },
- { 7, 15, 15, 0, 62 }, { 7, 15, 15, 0, 60 },
- { 7, 15, 15, 0, 59 }, { 7, 15, 15, 0, 57 },
- { 7, 15, 15, 0, 55 }, { 7, 15, 14, 0, 72 },
- { 7, 15, 14, 0, 70 }, { 7, 15, 14, 0, 68 },
- { 7, 15, 14, 0, 66 }, { 7, 15, 14, 0, 64 },
- { 7, 15, 14, 0, 62 }, { 7, 15, 14, 0, 60 },
- { 7, 15, 14, 0, 58 }, { 7, 15, 14, 0, 56 },
- { 7, 15, 14, 0, 55 }, { 7, 15, 13, 0, 71 },
- { 7, 15, 13, 0, 69 }, { 7, 15, 13, 0, 67 },
- { 7, 15, 13, 0, 65 }, { 7, 15, 13, 0, 63 },
- { 7, 15, 13, 0, 62 }, { 7, 15, 13, 0, 60 },
- { 7, 15, 13, 0, 58 }, { 7, 15, 13, 0, 56 },
- { 7, 15, 12, 0, 72 }, { 7, 15, 12, 0, 70 },
- { 7, 15, 12, 0, 68 }, { 7, 15, 12, 0, 66 },
- { 7, 15, 12, 0, 64 }, { 7, 15, 12, 0, 62 },
- { 7, 15, 12, 0, 60 }, { 7, 15, 12, 0, 59 },
- { 7, 15, 12, 0, 57 }, { 7, 15, 11, 0, 73 },
- { 7, 15, 11, 0, 71 }, { 7, 15, 11, 0, 69 },
- { 7, 15, 11, 0, 67 }, { 7, 15, 11, 0, 65 },
- { 7, 15, 11, 0, 63 }, { 7, 15, 11, 0, 61 },
- { 7, 15, 11, 0, 60 }, { 7, 15, 11, 0, 58 },
- { 7, 15, 10, 0, 71 }, { 7, 15, 10, 0, 69 },
- { 7, 15, 10, 0, 67 }, { 7, 15, 10, 0, 65 },
- { 7, 15, 10, 0, 63 }, { 7, 15, 10, 0, 61 },
- { 7, 15, 10, 0, 60 }, { 7, 15, 10, 0, 58 },
- { 7, 15, 9, 0, 70 }, { 7, 15, 9, 0, 68 },
- { 7, 15, 9, 0, 66 }, { 7, 15, 9, 0, 64 },
- { 7, 15, 9, 0, 62 }, { 7, 15, 9, 0, 61 },
- { 7, 15, 9, 0, 59 }, { 7, 15, 9, 0, 57 },
- { 7, 15, 9, 0, 56 }, { 7, 14, 9, 0, 68 },
- { 7, 14, 9, 0, 66 }, { 7, 14, 9, 0, 65 },
- { 7, 14, 9, 0, 63 }, { 7, 14, 9, 0, 61 },
- { 7, 14, 9, 0, 59 }, { 7, 14, 9, 0, 58 },
- { 7, 13, 9, 0, 70 }, { 7, 13, 9, 0, 68 },
- { 7, 13, 9, 0, 66 }, { 7, 13, 9, 0, 64 },
- { 7, 13, 9, 0, 63 }, { 7, 13, 9, 0, 61 },
- { 7, 13, 9, 0, 59 }, { 7, 13, 9, 0, 57 },
- { 7, 13, 8, 0, 70 }, { 7, 13, 8, 0, 68 },
- { 7, 13, 8, 0, 66 }, { 7, 13, 8, 0, 64 },
- { 7, 13, 8, 0, 62 }, { 7, 13, 8, 0, 60 },
- { 7, 13, 8, 0, 59 }, { 7, 13, 8, 0, 57 },
- { 7, 12, 8, 0, 70 }, { 7, 12, 8, 0, 68 },
- { 7, 12, 8, 0, 66 }, { 7, 12, 8, 0, 64 },
- { 7, 12, 8, 0, 62 }, { 7, 12, 8, 0, 61 },
- { 7, 12, 8, 0, 59 }, { 7, 12, 8, 0, 57 },
- { 7, 12, 7, 0, 70 }, { 7, 12, 7, 0, 68 },
- { 7, 12, 7, 0, 66 }, { 7, 12, 7, 0, 64 },
- { 7, 12, 7, 0, 62 }, { 7, 12, 7, 0, 61 },
- { 7, 12, 7, 0, 59 }, { 7, 12, 7, 0, 57 },
- { 7, 11, 7, 0, 70 }, { 7, 11, 7, 0, 68 },
- { 7, 11, 7, 0, 66 }, { 7, 11, 7, 0, 64 },
- { 7, 11, 7, 0, 62 }, { 7, 11, 7, 0, 61 },
- { 7, 11, 7, 0, 59 }, { 7, 11, 7, 0, 57 },
- { 7, 11, 6, 0, 69 }, { 7, 11, 6, 0, 67 },
- { 7, 11, 6, 0, 65 }, { 7, 11, 6, 0, 63 },
- { 7, 11, 6, 0, 62 }, { 7, 11, 6, 0, 60 }
- };
-
- if (mac->mac_phy.rev != 0 && mac->mac_phy.rev != 1) {
- if (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_NOPA)
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_r2);
- else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
- txgain_2ghz_r2);
- else
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
- txgain_5ghz_r2);
- return;
- }
-
- if (mac->mac_phy.rev == 0) {
- if ((siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_NOPA) ||
- (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_HGPA))
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_r0);
- else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
- txgain_2ghz_r0);
- else
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
- txgain_5ghz_r0);
- return;
- }
-
- if ((siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_NOPA) ||
- (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_HGPA))
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_r1);
- else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_2ghz_r1);
- else
- bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_5ghz_r1);
-}
-
-static void
-bwn_tab_write(struct bwn_mac *mac, uint32_t typeoffset, uint32_t value)
-{
- uint32_t offset, type;
-
- type = BWN_TAB_GETTYPE(typeoffset);
- offset = BWN_TAB_GETOFFSET(typeoffset);
- KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
-
- switch (type) {
- case BWN_TAB_8BIT:
- KASSERT(!(value & ~0xff), ("%s:%d: fail", __func__, __LINE__));
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
- break;
- case BWN_TAB_16BIT:
- KASSERT(!(value & ~0xffff),
- ("%s:%d: fail", __func__, __LINE__));
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
- break;
- case BWN_TAB_32BIT:
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATAHI, value >> 16);
- BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
- break;
- default:
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- }
-}
-
-static int
-bwn_phy_lp_loopback(struct bwn_mac *mac)
-{
- struct bwn_phy_lp_iq_est ie;
- int i, index = -1;
- uint32_t tmp;
-
- memset(&ie, 0, sizeof(ie));
-
- bwn_phy_lp_set_trsw_over(mac, 1, 1);
- BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVR, 1);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVRVAL, 0xfffe);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x800);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x800);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x8);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x8);
- BWN_RF_WRITE(mac, BWN_B2062_N_TXCTL_A, 0x80);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x80);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x80);
- for (i = 0; i < 32; i++) {
- bwn_phy_lp_set_rxgain_idx(mac, i);
- bwn_phy_lp_ddfs_turnon(mac, 1, 1, 5, 5, 0);
- if (!(bwn_phy_lp_rx_iq_est(mac, 1000, 32, &ie)))
- continue;
- tmp = (ie.ie_ipwr + ie.ie_qpwr) / 1000;
- if ((tmp > 4000) && (tmp < 10000)) {
- index = i;
- break;
- }
- }
- bwn_phy_lp_ddfs_turnoff(mac);
- return (index);
-}
-
-static void
-bwn_phy_lp_set_rxgain_idx(struct bwn_mac *mac, uint16_t idx)
-{
-
- bwn_phy_lp_set_rxgain(mac, bwn_tab_read(mac, BWN_TAB_2(12, idx)));
-}
-
-static void
-bwn_phy_lp_ddfs_turnon(struct bwn_mac *mac, int i_on, int q_on,
- int incr1, int incr2, int scale_idx)
-{
-
- bwn_phy_lp_ddfs_turnoff(mac);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS_POINTER_INIT, 0xff80);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS_POINTER_INIT, 0x80ff);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS_INCR_INIT, 0xff80, incr1);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS_INCR_INIT, 0x80ff, incr2 << 8);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xfff7, i_on << 3);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xffef, q_on << 4);
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xff9f, scale_idx << 5);
- BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS, 0xfffb);
- BWN_PHY_SET(mac, BWN_PHY_AFE_DDFS, 0x2);
- BWN_PHY_SET(mac, BWN_PHY_LP_PHY_CTL, 0x20);
-}
-
-static uint8_t
-bwn_phy_lp_rx_iq_est(struct bwn_mac *mac, uint16_t sample, uint8_t time,
- struct bwn_phy_lp_iq_est *ie)
-{
- int i;
-
- BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, 0xfff7);
- BWN_PHY_WRITE(mac, BWN_PHY_IQ_NUM_SMPLS_ADDR, sample);
- BWN_PHY_SETMASK(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR, 0xff00, time);
- BWN_PHY_MASK(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR, 0xfeff);
- BWN_PHY_SET(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR, 0x200);
-
- for (i = 0; i < 500; i++) {
- if (!(BWN_PHY_READ(mac,
- BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR) & 0x200))
- break;
- DELAY(1000);
- }
- if ((BWN_PHY_READ(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR) & 0x200)) {
- BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x8);
- return 0;
- }
-
- ie->ie_iqprod = BWN_PHY_READ(mac, BWN_PHY_IQ_ACC_HI_ADDR);
- ie->ie_iqprod <<= 16;
- ie->ie_iqprod |= BWN_PHY_READ(mac, BWN_PHY_IQ_ACC_LO_ADDR);
- ie->ie_ipwr = BWN_PHY_READ(mac, BWN_PHY_IQ_I_PWR_ACC_HI_ADDR);
- ie->ie_ipwr <<= 16;
- ie->ie_ipwr |= BWN_PHY_READ(mac, BWN_PHY_IQ_I_PWR_ACC_LO_ADDR);
- ie->ie_qpwr = BWN_PHY_READ(mac, BWN_PHY_IQ_Q_PWR_ACC_HI_ADDR);
- ie->ie_qpwr <<= 16;
- ie->ie_qpwr |= BWN_PHY_READ(mac, BWN_PHY_IQ_Q_PWR_ACC_LO_ADDR);
-
- BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x8);
- return 1;
-}
-
-static uint32_t
-bwn_tab_read(struct bwn_mac *mac, uint32_t typeoffset)
-{
- uint32_t offset, type, value;
-
- type = BWN_TAB_GETTYPE(typeoffset);
- offset = BWN_TAB_GETOFFSET(typeoffset);
- KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
-
- switch (type) {
- case BWN_TAB_8BIT:
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
- value = BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO) & 0xff;
- break;
- case BWN_TAB_16BIT:
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
- value = BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO);
- break;
- case BWN_TAB_32BIT:
- BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
- value = BWN_PHY_READ(mac, BWN_PHY_TABLEDATAHI);
- value <<= 16;
- value |= BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO);
- break;
- default:
- KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
- value = 0;
- }
-
- return (value);
-}
-
-static void
-bwn_phy_lp_ddfs_turnoff(struct bwn_mac *mac)
-{
-
- BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS, 0xfffd);
- BWN_PHY_MASK(mac, BWN_PHY_LP_PHY_CTL, 0xffdf);
-}
-
-static void
-bwn_phy_lp_set_txgain_dac(struct bwn_mac *mac, uint16_t dac)
-{
- uint16_t ctl;
-
- ctl = BWN_PHY_READ(mac, BWN_PHY_AFE_DAC_CTL) & 0xc7f;
- ctl |= dac << 7;
- BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DAC_CTL, 0xf000, ctl);
-}
-
-static void
-bwn_phy_lp_set_txgain_pa(struct bwn_mac *mac, uint16_t gain)
-{
-
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfb), 0xe03f, gain << 6);
- BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfd), 0x80ff, gain << 8);
-}
-
-static void
-bwn_phy_lp_set_txgain_override(struct bwn_mac *mac)
-{
-
- if (mac->mac_phy.rev < 2)
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x100);
- else {
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x80);
- BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x4000);
- }
- BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVR, 0x40);
-}
-
-static uint16_t
-bwn_phy_lp_get_pa_gain(struct bwn_mac *mac)
-{
-
- return BWN_PHY_READ(mac, BWN_PHY_OFDM(0xfb)) & 0x7f;
-}
-
-static uint8_t
-bwn_nbits(int32_t val)
-{
- uint32_t tmp;
- uint8_t nbits = 0;
-
- for (tmp = abs(val); tmp != 0; tmp >>= 1)
- nbits++;
- return (nbits);
-}
-
-static void
-bwn_phy_lp_gaintbl_write_multi(struct bwn_mac *mac, int offset, int count,
- struct bwn_txgain_entry *table)
-{
- int i;
-
- for (i = offset; i < count; i++)
- bwn_phy_lp_gaintbl_write(mac, i, table[i]);
-}
-
-static void
-bwn_phy_lp_gaintbl_write(struct bwn_mac *mac, int offset,
- struct bwn_txgain_entry data)
-{
-
- if (mac->mac_phy.rev >= 2)
- bwn_phy_lp_gaintbl_write_r2(mac, offset, data);
- else
- bwn_phy_lp_gaintbl_write_r01(mac, offset, data);
-}
-
-static void
-bwn_phy_lp_gaintbl_write_r2(struct bwn_mac *mac, int offset,
- struct bwn_txgain_entry te)
-{
- struct bwn_softc *sc = mac->mac_sc;
- struct ieee80211com *ic = &sc->sc_ic;
- uint32_t tmp;
-
- KASSERT(mac->mac_phy.rev >= 2, ("%s:%d: fail", __func__, __LINE__));
-
- tmp = (te.te_pad << 16) | (te.te_pga << 8) | te.te_gm;
- if (mac->mac_phy.rev >= 3) {
- tmp |= ((IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) ?
- (0x10 << 24) : (0x70 << 24));
- } else {
- tmp |= ((IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) ?
- (0x14 << 24) : (0x7f << 24));
- }
- bwn_tab_write(mac, BWN_TAB_4(7, 0xc0 + offset), tmp);
- bwn_tab_write(mac, BWN_TAB_4(7, 0x140 + offset),
- te.te_bbmult << 20 | te.te_dac << 28);
-}
-
-static void
-bwn_phy_lp_gaintbl_write_r01(struct bwn_mac *mac, int offset,
- struct bwn_txgain_entry te)
-{
-
- KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
-
- bwn_tab_write(mac, BWN_TAB_4(10, 0xc0 + offset),
- (te.te_pad << 11) | (te.te_pga << 7) | (te.te_gm << 4) |
- te.te_dac);
- bwn_tab_write(mac, BWN_TAB_4(10, 0x140 + offset), te.te_bbmult << 20);
-}
-
-static void
bwn_sysctl_node(struct bwn_softc *sc)
{
device_t dev = sc->sc_dev;
diff --git a/sys/dev/bwn/if_bwn_debug.h b/sys/dev/bwn/if_bwn_debug.h
new file mode 100644
index 0000000..c38b08f
--- /dev/null
+++ b/sys/dev/bwn/if_bwn_debug.h
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __IF_BWN_DEBUG_H__
+#define __IF_BWN_DEBUG_H__
+
+enum {
+ BWN_DEBUG_XMIT = 0x00000001, /* basic xmit operation */
+ BWN_DEBUG_RECV = 0x00000002, /* basic recv operation */
+ BWN_DEBUG_STATE = 0x00000004, /* 802.11 state transitions */
+ BWN_DEBUG_TXPOW = 0x00000008, /* tx power processing */
+ BWN_DEBUG_RESET = 0x00000010, /* reset processing */
+ BWN_DEBUG_OPS = 0x00000020, /* bwn_ops processing */
+ BWN_DEBUG_BEACON = 0x00000040, /* beacon handling */
+ BWN_DEBUG_WATCHDOG = 0x00000080, /* watchdog timeout */
+ BWN_DEBUG_INTR = 0x00000100, /* ISR */
+ BWN_DEBUG_CALIBRATE = 0x00000200, /* periodic calibration */
+ BWN_DEBUG_NODE = 0x00000400, /* node management */
+ BWN_DEBUG_LED = 0x00000800, /* led management */
+ BWN_DEBUG_CMD = 0x00001000, /* cmd submission */
+ BWN_DEBUG_LO = 0x00002000, /* LO */
+ BWN_DEBUG_FW = 0x00004000, /* firmware */
+ BWN_DEBUG_WME = 0x00008000, /* WME */
+ BWN_DEBUG_RF = 0x00010000, /* RF */
+ BWN_DEBUG_FATAL = 0x80000000, /* fatal errors */
+ BWN_DEBUG_ANY = 0xffffffff
+};
+
+#ifdef BWN_DEBUG
+#define DPRINTF(sc, m, fmt, ...) do { \
+ if (sc->sc_debug & (m)) \
+ printf(fmt, __VA_ARGS__); \
+} while (0)
+#else /* BWN_DEBUG */
+#define DPRINTF(sc, m, fmt, ...) do { (void) sc; } while (0)
+#endif /* BWN_DEBUG */
+
+#endif /* __IF_BWN_DEBUG_H__ */
diff --git a/sys/dev/bwn/if_bwn_misc.h b/sys/dev/bwn/if_bwn_misc.h
new file mode 100644
index 0000000..3ef8ea7
--- /dev/null
+++ b/sys/dev/bwn/if_bwn_misc.h
@@ -0,0 +1,65 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ *
+ * $FreeBSD$
+ */
+#ifndef __IF_BWN_MISC_H__
+#define __IF_BWN_MISC_H__
+
+/*
+ * These are the functions used by the PHY code.
+ *
+ * They currently live in the driver itself; at least until they
+ * are broken out into smaller pieces.
+ */
+
+struct bwn_mac;
+
+extern uint64_t bwn_hf_read(struct bwn_mac *);
+extern void bwn_hf_write(struct bwn_mac *, uint64_t);
+
+extern void bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon);
+
+extern void bwn_ram_write(struct bwn_mac *, uint16_t, uint32_t);
+
+extern void bwn_mac_suspend(struct bwn_mac *);
+extern void bwn_mac_enable(struct bwn_mac *);
+
+extern int bwn_switch_channel(struct bwn_mac *, int);
+
+extern uint16_t bwn_shm_read_2(struct bwn_mac *, uint16_t, uint16_t);
+extern void bwn_shm_write_2(struct bwn_mac *, uint16_t, uint16_t,
+ uint16_t);
+extern uint32_t bwn_shm_read_4(struct bwn_mac *, uint16_t, uint16_t);
+extern void bwn_shm_write_4(struct bwn_mac *, uint16_t, uint16_t,
+ uint32_t);
+
+extern void bwn_reset_core(struct bwn_mac *, uint32_t);
+extern void bwn_psctl(struct bwn_mac *, uint32_t);
+
+#endif
diff --git a/sys/dev/bwn/if_bwn_phy_g.c b/sys/dev/bwn/if_bwn_phy_g.c
new file mode 100644
index 0000000..8b96cd5
--- /dev/null
+++ b/sys/dev/bwn/if_bwn_phy_g.c
@@ -0,0 +1,3600 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * The Broadcom Wireless LAN controller driver.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <sys/firmware.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_arp.h>
+#include <net/if_dl.h>
+#include <net/if_llc.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/siba/siba_ids.h>
+#include <dev/siba/sibareg.h>
+#include <dev/siba/sibavar.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211_regdomain.h>
+#include <net80211/ieee80211_phy.h>
+#include <net80211/ieee80211_ratectl.h>
+
+#include <dev/bwn/if_bwnreg.h>
+#include <dev/bwn/if_bwnvar.h>
+
+#include <dev/bwn/if_bwn_debug.h>
+#include <dev/bwn/if_bwn_misc.h>
+#include <dev/bwn/if_bwn_phy_g.h>
+
+static void bwn_phy_g_init_sub(struct bwn_mac *);
+static uint8_t bwn_has_hwpctl(struct bwn_mac *);
+static void bwn_phy_init_b5(struct bwn_mac *);
+static void bwn_phy_init_b6(struct bwn_mac *);
+static void bwn_phy_init_a(struct bwn_mac *);
+static void bwn_loopback_calcgain(struct bwn_mac *);
+static uint16_t bwn_rf_init_bcm2050(struct bwn_mac *);
+static void bwn_lo_g_init(struct bwn_mac *);
+static void bwn_lo_g_adjust(struct bwn_mac *);
+static void bwn_lo_get_powervector(struct bwn_mac *);
+static struct bwn_lo_calib *bwn_lo_calibset(struct bwn_mac *,
+ const struct bwn_bbatt *, const struct bwn_rfatt *);
+static void bwn_lo_write(struct bwn_mac *, struct bwn_loctl *);
+static void bwn_phy_hwpctl_init(struct bwn_mac *);
+static void bwn_phy_g_switch_chan(struct bwn_mac *, int, uint8_t);
+static void bwn_phy_g_set_txpwr_sub(struct bwn_mac *,
+ const struct bwn_bbatt *, const struct bwn_rfatt *,
+ uint8_t);
+static void bwn_phy_g_set_bbatt(struct bwn_mac *, uint16_t);
+static uint16_t bwn_rf_2050_rfoverval(struct bwn_mac *, uint16_t, uint32_t);
+static void bwn_spu_workaround(struct bwn_mac *, uint8_t);
+static void bwn_wa_init(struct bwn_mac *);
+static void bwn_ofdmtab_write_2(struct bwn_mac *, uint16_t, uint16_t,
+ uint16_t);
+static void bwn_ofdmtab_write_4(struct bwn_mac *, uint16_t, uint16_t,
+ uint32_t);
+static void bwn_gtab_write(struct bwn_mac *, uint16_t, uint16_t,
+ uint16_t);
+static int16_t bwn_nrssi_read(struct bwn_mac *, uint16_t);
+static void bwn_nrssi_offset(struct bwn_mac *);
+static void bwn_nrssi_threshold(struct bwn_mac *);
+static void bwn_nrssi_slope_11g(struct bwn_mac *);
+static void bwn_set_all_gains(struct bwn_mac *, int16_t, int16_t,
+ int16_t);
+static void bwn_set_original_gains(struct bwn_mac *);
+static void bwn_hwpctl_early_init(struct bwn_mac *);
+static void bwn_hwpctl_init_gphy(struct bwn_mac *);
+static uint16_t bwn_phy_g_chan2freq(uint8_t);
+static void bwn_phy_g_dc_lookup_init(struct bwn_mac *, uint8_t);
+
+/* Stuff we need */
+
+static uint16_t bwn_phy_g_txctl(struct bwn_mac *mac);
+static int bwn_phy_shm_tssi_read(struct bwn_mac *mac, uint16_t shm_offset);
+static void bwn_phy_g_setatt(struct bwn_mac *mac, int *bbattp, int *rfattp);
+static void bwn_phy_lock(struct bwn_mac *mac);
+static void bwn_phy_unlock(struct bwn_mac *mac);
+static void bwn_rf_lock(struct bwn_mac *mac);
+static void bwn_rf_unlock(struct bwn_mac *mac);
+
+static const uint16_t bwn_tab_noise_g1[] = BWN_TAB_NOISE_G1;
+static const uint16_t bwn_tab_noise_g2[] = BWN_TAB_NOISE_G2;
+static const uint16_t bwn_tab_noisescale_g1[] = BWN_TAB_NOISESCALE_G1;
+static const uint16_t bwn_tab_noisescale_g2[] = BWN_TAB_NOISESCALE_G2;
+static const uint16_t bwn_tab_noisescale_g3[] = BWN_TAB_NOISESCALE_G3;
+const uint8_t bwn_bitrev_table[256] = BWN_BITREV_TABLE;
+
+static uint8_t
+bwn_has_hwpctl(struct bwn_mac *mac)
+{
+
+ if (mac->mac_phy.hwpctl == 0 || mac->mac_phy.use_hwpctl == NULL)
+ return (0);
+ return (mac->mac_phy.use_hwpctl(mac));
+}
+
+int
+bwn_phy_g_attach(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ unsigned int i;
+ int16_t pab0, pab1, pab2;
+ static int8_t bwn_phy_g_tssi2dbm_table[] = BWN_PHY_G_TSSI2DBM_TABLE;
+ int8_t bg;
+
+ bg = (int8_t)siba_sprom_get_tssi_bg(sc->sc_dev);
+ pab0 = (int16_t)siba_sprom_get_pa0b0(sc->sc_dev);
+ pab1 = (int16_t)siba_sprom_get_pa0b1(sc->sc_dev);
+ pab2 = (int16_t)siba_sprom_get_pa0b2(sc->sc_dev);
+
+ if ((siba_get_chipid(sc->sc_dev) == 0x4301) && (phy->rf_ver != 0x2050))
+ device_printf(sc->sc_dev, "not supported anymore\n");
+
+ pg->pg_flags = 0;
+ if (pab0 == 0 || pab1 == 0 || pab2 == 0 || pab0 == -1 || pab1 == -1 ||
+ pab2 == -1) {
+ pg->pg_idletssi = 52;
+ pg->pg_tssi2dbm = bwn_phy_g_tssi2dbm_table;
+ return (0);
+ }
+
+ pg->pg_idletssi = (bg == 0 || bg == -1) ? 62 : bg;
+ pg->pg_tssi2dbm = (uint8_t *)malloc(64, M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (pg->pg_tssi2dbm == NULL) {
+ device_printf(sc->sc_dev, "failed to allocate buffer\n");
+ return (ENOMEM);
+ }
+ for (i = 0; i < 64; i++) {
+ int32_t m1, m2, f, q, delta;
+ int8_t j = 0;
+
+ m1 = BWN_TSSI2DBM(16 * pab0 + i * pab1, 32);
+ m2 = MAX(BWN_TSSI2DBM(32768 + i * pab2, 256), 1);
+ f = 256;
+
+ do {
+ if (j > 15) {
+ device_printf(sc->sc_dev,
+ "failed to generate tssi2dBm\n");
+ free(pg->pg_tssi2dbm, M_DEVBUF);
+ return (ENOMEM);
+ }
+ q = BWN_TSSI2DBM(f * 4096 - BWN_TSSI2DBM(m2 * f, 16) *
+ f, 2048);
+ delta = abs(q - f);
+ f = q;
+ j++;
+ } while (delta >= 2);
+
+ pg->pg_tssi2dbm[i] = MIN(MAX(BWN_TSSI2DBM(m1 * f, 8192), -127),
+ 128);
+ }
+
+ pg->pg_flags |= BWN_PHY_G_FLAG_TSSITABLE_ALLOC;
+ return (0);
+}
+
+void
+bwn_phy_g_detach(struct bwn_mac *mac)
+{
+ struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
+
+ if (pg->pg_flags & BWN_PHY_G_FLAG_TSSITABLE_ALLOC) {
+ free(pg->pg_tssi2dbm, M_DEVBUF);
+ pg->pg_tssi2dbm = NULL;
+ }
+ pg->pg_flags = 0;
+}
+
+void
+bwn_phy_g_init_pre(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ void *tssi2dbm;
+ int idletssi;
+ unsigned int i;
+
+ tssi2dbm = pg->pg_tssi2dbm;
+ idletssi = pg->pg_idletssi;
+
+ memset(pg, 0, sizeof(*pg));
+
+ pg->pg_tssi2dbm = tssi2dbm;
+ pg->pg_idletssi = idletssi;
+
+ memset(pg->pg_minlowsig, 0xff, sizeof(pg->pg_minlowsig));
+
+ for (i = 0; i < N(pg->pg_nrssi); i++)
+ pg->pg_nrssi[i] = -1000;
+ for (i = 0; i < N(pg->pg_nrssi_lt); i++)
+ pg->pg_nrssi_lt[i] = i;
+ pg->pg_lofcal = 0xffff;
+ pg->pg_initval = 0xffff;
+ pg->pg_immode = BWN_IMMODE_NONE;
+ pg->pg_ofdmtab_dir = BWN_OFDMTAB_DIR_UNKNOWN;
+ pg->pg_avgtssi = 0xff;
+
+ pg->pg_loctl.tx_bias = 0xff;
+ TAILQ_INIT(&pg->pg_loctl.calib_list);
+}
+
+int
+bwn_phy_g_prepare_hw(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ static const struct bwn_rfatt rfatt0[] = {
+ { 3, 0 }, { 1, 0 }, { 5, 0 }, { 7, 0 }, { 9, 0 }, { 2, 0 },
+ { 0, 0 }, { 4, 0 }, { 6, 0 }, { 8, 0 }, { 1, 1 }, { 2, 1 },
+ { 3, 1 }, { 4, 1 }
+ };
+ static const struct bwn_rfatt rfatt1[] = {
+ { 2, 1 }, { 4, 1 }, { 6, 1 }, { 8, 1 }, { 10, 1 }, { 12, 1 },
+ { 14, 1 }
+ };
+ static const struct bwn_rfatt rfatt2[] = {
+ { 0, 1 }, { 2, 1 }, { 4, 1 }, { 6, 1 }, { 8, 1 }, { 9, 1 },
+ { 9, 1 }
+ };
+ static const struct bwn_bbatt bbatt_0[] = {
+ { 0 }, { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 }
+ };
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
+
+ if (phy->rf_ver == 0x2050 && phy->rf_rev < 6)
+ pg->pg_bbatt.att = 0;
+ else
+ pg->pg_bbatt.att = 2;
+
+ /* prepare Radio Attenuation */
+ pg->pg_rfatt.padmix = 0;
+
+ if (siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM &&
+ siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BCM4309G) {
+ if (siba_get_pci_revid(sc->sc_dev) < 0x43) {
+ pg->pg_rfatt.att = 2;
+ goto done;
+ } else if (siba_get_pci_revid(sc->sc_dev) < 0x51) {
+ pg->pg_rfatt.att = 3;
+ goto done;
+ }
+ }
+
+ if (phy->type == BWN_PHYTYPE_A) {
+ pg->pg_rfatt.att = 0x60;
+ goto done;
+ }
+
+ switch (phy->rf_ver) {
+ case 0x2050:
+ switch (phy->rf_rev) {
+ case 0:
+ pg->pg_rfatt.att = 5;
+ goto done;
+ case 1:
+ if (phy->type == BWN_PHYTYPE_G) {
+ if (siba_get_pci_subvendor(sc->sc_dev) ==
+ SIBA_BOARDVENDOR_BCM &&
+ siba_get_pci_subdevice(sc->sc_dev) ==
+ SIBA_BOARD_BCM4309G &&
+ siba_get_pci_revid(sc->sc_dev) >= 30)
+ pg->pg_rfatt.att = 3;
+ else if (siba_get_pci_subvendor(sc->sc_dev) ==
+ SIBA_BOARDVENDOR_BCM &&
+ siba_get_pci_subdevice(sc->sc_dev) ==
+ SIBA_BOARD_BU4306)
+ pg->pg_rfatt.att = 3;
+ else
+ pg->pg_rfatt.att = 1;
+ } else {
+ if (siba_get_pci_subvendor(sc->sc_dev) ==
+ SIBA_BOARDVENDOR_BCM &&
+ siba_get_pci_subdevice(sc->sc_dev) ==
+ SIBA_BOARD_BCM4309G &&
+ siba_get_pci_revid(sc->sc_dev) >= 30)
+ pg->pg_rfatt.att = 7;
+ else
+ pg->pg_rfatt.att = 6;
+ }
+ goto done;
+ case 2:
+ if (phy->type == BWN_PHYTYPE_G) {
+ if (siba_get_pci_subvendor(sc->sc_dev) ==
+ SIBA_BOARDVENDOR_BCM &&
+ siba_get_pci_subdevice(sc->sc_dev) ==
+ SIBA_BOARD_BCM4309G &&
+ siba_get_pci_revid(sc->sc_dev) >= 30)
+ pg->pg_rfatt.att = 3;
+ else if (siba_get_pci_subvendor(sc->sc_dev) ==
+ SIBA_BOARDVENDOR_BCM &&
+ siba_get_pci_subdevice(sc->sc_dev) ==
+ SIBA_BOARD_BU4306)
+ pg->pg_rfatt.att = 5;
+ else if (siba_get_chipid(sc->sc_dev) == 0x4320)
+ pg->pg_rfatt.att = 4;
+ else
+ pg->pg_rfatt.att = 3;
+ } else
+ pg->pg_rfatt.att = 6;
+ goto done;
+ case 3:
+ pg->pg_rfatt.att = 5;
+ goto done;
+ case 4:
+ case 5:
+ pg->pg_rfatt.att = 1;
+ goto done;
+ case 6:
+ case 7:
+ pg->pg_rfatt.att = 5;
+ goto done;
+ case 8:
+ pg->pg_rfatt.att = 0xa;
+ pg->pg_rfatt.padmix = 1;
+ goto done;
+ case 9:
+ default:
+ pg->pg_rfatt.att = 5;
+ goto done;
+ }
+ break;
+ case 0x2053:
+ switch (phy->rf_rev) {
+ case 1:
+ pg->pg_rfatt.att = 6;
+ goto done;
+ }
+ break;
+ }
+ pg->pg_rfatt.att = 5;
+done:
+ pg->pg_txctl = (bwn_phy_g_txctl(mac) << 4);
+
+ if (!bwn_has_hwpctl(mac)) {
+ lo->rfatt.array = rfatt0;
+ lo->rfatt.len = N(rfatt0);
+ lo->rfatt.min = 0;
+ lo->rfatt.max = 9;
+ goto genbbatt;
+ }
+ if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) {
+ lo->rfatt.array = rfatt1;
+ lo->rfatt.len = N(rfatt1);
+ lo->rfatt.min = 0;
+ lo->rfatt.max = 14;
+ goto genbbatt;
+ }
+ lo->rfatt.array = rfatt2;
+ lo->rfatt.len = N(rfatt2);
+ lo->rfatt.min = 0;
+ lo->rfatt.max = 9;
+genbbatt:
+ lo->bbatt.array = bbatt_0;
+ lo->bbatt.len = N(bbatt_0);
+ lo->bbatt.min = 0;
+ lo->bbatt.max = 8;
+
+ BWN_READ_4(mac, BWN_MACCTL);
+ if (phy->rev == 1) {
+ phy->gmode = 0;
+ bwn_reset_core(mac, 0);
+ bwn_phy_g_init_sub(mac);
+ phy->gmode = 1;
+ bwn_reset_core(mac, BWN_TGSLOW_SUPPORT_G);
+ }
+ return (0);
+}
+
+static uint16_t
+bwn_phy_g_txctl(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+
+ if (phy->rf_ver != 0x2050)
+ return (0);
+ if (phy->rf_rev == 1)
+ return (BWN_TXCTL_PA2DB | BWN_TXCTL_TXMIX);
+ if (phy->rf_rev < 6)
+ return (BWN_TXCTL_PA2DB);
+ if (phy->rf_rev == 8)
+ return (BWN_TXCTL_TXMIX);
+ return (0);
+}
+
+int
+bwn_phy_g_init(struct bwn_mac *mac)
+{
+
+ bwn_phy_g_init_sub(mac);
+ return (0);
+}
+
+void
+bwn_phy_g_exit(struct bwn_mac *mac)
+{
+ struct bwn_txpwr_loctl *lo = &mac->mac_phy.phy_g.pg_loctl;
+ struct bwn_lo_calib *cal, *tmp;
+
+ if (lo == NULL)
+ return;
+ TAILQ_FOREACH_SAFE(cal, &lo->calib_list, list, tmp) {
+ TAILQ_REMOVE(&lo->calib_list, cal, list);
+ free(cal, M_DEVBUF);
+ }
+}
+
+uint16_t
+bwn_phy_g_read(struct bwn_mac *mac, uint16_t reg)
+{
+
+ BWN_WRITE_2(mac, BWN_PHYCTL, reg);
+ return (BWN_READ_2(mac, BWN_PHYDATA));
+}
+
+void
+bwn_phy_g_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
+{
+
+ BWN_WRITE_2(mac, BWN_PHYCTL, reg);
+ BWN_WRITE_2(mac, BWN_PHYDATA, value);
+}
+
+uint16_t
+bwn_phy_g_rf_read(struct bwn_mac *mac, uint16_t reg)
+{
+
+ KASSERT(reg != 1, ("%s:%d: fail", __func__, __LINE__));
+ BWN_WRITE_2(mac, BWN_RFCTL, reg | 0x80);
+ return (BWN_READ_2(mac, BWN_RFDATALO));
+}
+
+void
+bwn_phy_g_rf_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
+{
+
+ KASSERT(reg != 1, ("%s:%d: fail", __func__, __LINE__));
+ BWN_WRITE_2(mac, BWN_RFCTL, reg);
+ BWN_WRITE_2(mac, BWN_RFDATALO, value);
+}
+
+int
+bwn_phy_g_hwpctl(struct bwn_mac *mac)
+{
+
+ return (mac->mac_phy.rev >= 6);
+}
+
+void
+bwn_phy_g_rf_onoff(struct bwn_mac *mac, int on)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ unsigned int channel;
+ uint16_t rfover, rfoverval;
+
+ if (on) {
+ if (phy->rf_on)
+ return;
+
+ BWN_PHY_WRITE(mac, 0x15, 0x8000);
+ BWN_PHY_WRITE(mac, 0x15, 0xcc00);
+ BWN_PHY_WRITE(mac, 0x15, (phy->gmode ? 0xc0 : 0x0));
+ if (pg->pg_flags & BWN_PHY_G_FLAG_RADIOCTX_VALID) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER,
+ pg->pg_radioctx_over);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ pg->pg_radioctx_overval);
+ pg->pg_flags &= ~BWN_PHY_G_FLAG_RADIOCTX_VALID;
+ }
+ channel = phy->chan;
+ bwn_phy_g_switch_chan(mac, 6, 1);
+ bwn_phy_g_switch_chan(mac, channel, 0);
+ return;
+ }
+
+ rfover = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
+ rfoverval = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
+ pg->pg_radioctx_over = rfover;
+ pg->pg_radioctx_overval = rfoverval;
+ pg->pg_flags |= BWN_PHY_G_FLAG_RADIOCTX_VALID;
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, rfover | 0x008c);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfoverval & 0xff73);
+}
+
+int
+bwn_phy_g_switch_channel(struct bwn_mac *mac, uint32_t newchan)
+{
+
+ if ((newchan < 1) || (newchan > 14))
+ return (EINVAL);
+ bwn_phy_g_switch_chan(mac, newchan, 0);
+
+ return (0);
+}
+
+uint32_t
+bwn_phy_g_get_default_chan(struct bwn_mac *mac)
+{
+
+ return (1);
+}
+
+void
+bwn_phy_g_set_antenna(struct bwn_mac *mac, int antenna)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ uint64_t hf;
+ int autodiv = 0;
+ uint16_t tmp;
+
+ if (antenna == BWN_ANTAUTO0 || antenna == BWN_ANTAUTO1)
+ autodiv = 1;
+
+ hf = bwn_hf_read(mac) & ~BWN_HF_UCODE_ANTDIV_HELPER;
+ bwn_hf_write(mac, hf);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_BBANDCFG,
+ (BWN_PHY_READ(mac, BWN_PHY_BBANDCFG) & ~BWN_PHY_BBANDCFG_RXANT) |
+ ((autodiv ? BWN_ANTAUTO1 : antenna)
+ << BWN_PHY_BBANDCFG_RXANT_SHIFT));
+
+ if (autodiv) {
+ tmp = BWN_PHY_READ(mac, BWN_PHY_ANTDWELL);
+ if (antenna == BWN_ANTAUTO1)
+ tmp &= ~BWN_PHY_ANTDWELL_AUTODIV1;
+ else
+ tmp |= BWN_PHY_ANTDWELL_AUTODIV1;
+ BWN_PHY_WRITE(mac, BWN_PHY_ANTDWELL, tmp);
+ }
+ tmp = BWN_PHY_READ(mac, BWN_PHY_ANTWRSETT);
+ if (autodiv)
+ tmp |= BWN_PHY_ANTWRSETT_ARXDIV;
+ else
+ tmp &= ~BWN_PHY_ANTWRSETT_ARXDIV;
+ BWN_PHY_WRITE(mac, BWN_PHY_ANTWRSETT, tmp);
+ if (phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM61,
+ BWN_PHY_READ(mac, BWN_PHY_OFDM61) | BWN_PHY_OFDM61_10);
+ BWN_PHY_WRITE(mac, BWN_PHY_DIVSRCHGAINBACK,
+ (BWN_PHY_READ(mac, BWN_PHY_DIVSRCHGAINBACK) & 0xff00) |
+ 0x15);
+ if (phy->rev == 2)
+ BWN_PHY_WRITE(mac, BWN_PHY_ADIVRELATED, 8);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_ADIVRELATED,
+ (BWN_PHY_READ(mac, BWN_PHY_ADIVRELATED) & 0xff00) |
+ 8);
+ }
+ if (phy->rev >= 6)
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM9B, 0xdc);
+
+ hf |= BWN_HF_UCODE_ANTDIV_HELPER;
+ bwn_hf_write(mac, hf);
+}
+
+int
+bwn_phy_g_im(struct bwn_mac *mac, int mode)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s: fail", __func__));
+ KASSERT(mode == BWN_IMMODE_NONE, ("%s: fail", __func__));
+
+ if (phy->rev == 0 || !phy->gmode)
+ return (ENODEV);
+
+ pg->pg_aci_wlan_automatic = 0;
+ return (0);
+}
+
+int
+bwn_phy_g_recalc_txpwr(struct bwn_mac *mac, int ignore_tssi)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ unsigned int tssi;
+ int cck, ofdm;
+ int power;
+ int rfatt, bbatt;
+ unsigned int max;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s: fail", __func__));
+
+ cck = bwn_phy_shm_tssi_read(mac, BWN_SHARED_TSSI_CCK);
+ ofdm = bwn_phy_shm_tssi_read(mac, BWN_SHARED_TSSI_OFDM_G);
+ if (cck < 0 && ofdm < 0) {
+ if (ignore_tssi == 0)
+ return (BWN_TXPWR_RES_DONE);
+ cck = 0;
+ ofdm = 0;
+ }
+ tssi = (cck < 0) ? ofdm : ((ofdm < 0) ? cck : (cck + ofdm) / 2);
+ if (pg->pg_avgtssi != 0xff)
+ tssi = (tssi + pg->pg_avgtssi) / 2;
+ pg->pg_avgtssi = tssi;
+ KASSERT(tssi < BWN_TSSI_MAX, ("%s:%d: fail", __func__, __LINE__));
+
+ max = siba_sprom_get_maxpwr_bg(sc->sc_dev);
+ if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL)
+ max -= 3;
+ if (max >= 120) {
+ device_printf(sc->sc_dev, "invalid max TX-power value\n");
+ max = 80;
+ siba_sprom_set_maxpwr_bg(sc->sc_dev, max);
+ }
+
+ power = MIN(MAX((phy->txpower < 0) ? 0 : (phy->txpower << 2), 0), max) -
+ (pg->pg_tssi2dbm[MIN(MAX(pg->pg_idletssi - pg->pg_curtssi +
+ tssi, 0x00), 0x3f)]);
+ if (power == 0)
+ return (BWN_TXPWR_RES_DONE);
+
+ rfatt = -((power + 7) / 8);
+ bbatt = (-(power / 2)) - (4 * rfatt);
+ if ((rfatt == 0) && (bbatt == 0))
+ return (BWN_TXPWR_RES_DONE);
+ pg->pg_bbatt_delta = bbatt;
+ pg->pg_rfatt_delta = rfatt;
+ return (BWN_TXPWR_RES_NEED_ADJUST);
+}
+
+void
+bwn_phy_g_set_txpwr(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ int rfatt, bbatt;
+ uint8_t txctl;
+
+ bwn_mac_suspend(mac);
+
+ BWN_ASSERT_LOCKED(sc);
+
+ bbatt = pg->pg_bbatt.att;
+ bbatt += pg->pg_bbatt_delta;
+ rfatt = pg->pg_rfatt.att;
+ rfatt += pg->pg_rfatt_delta;
+
+ bwn_phy_g_setatt(mac, &bbatt, &rfatt);
+ txctl = pg->pg_txctl;
+ if ((phy->rf_ver == 0x2050) && (phy->rf_rev == 2)) {
+ if (rfatt <= 1) {
+ if (txctl == 0) {
+ txctl = BWN_TXCTL_PA2DB | BWN_TXCTL_TXMIX;
+ rfatt += 2;
+ bbatt += 2;
+ } else if (siba_sprom_get_bf_lo(sc->sc_dev) &
+ BWN_BFL_PACTRL) {
+ bbatt += 4 * (rfatt - 2);
+ rfatt = 2;
+ }
+ } else if (rfatt > 4 && txctl) {
+ txctl = 0;
+ if (bbatt < 3) {
+ rfatt -= 3;
+ bbatt += 2;
+ } else {
+ rfatt -= 2;
+ bbatt -= 2;
+ }
+ }
+ }
+ pg->pg_txctl = txctl;
+ bwn_phy_g_setatt(mac, &bbatt, &rfatt);
+ pg->pg_rfatt.att = rfatt;
+ pg->pg_bbatt.att = bbatt;
+
+ DPRINTF(sc, BWN_DEBUG_TXPOW, "%s: adjust TX power\n", __func__);
+
+ bwn_phy_lock(mac);
+ bwn_rf_lock(mac);
+ bwn_phy_g_set_txpwr_sub(mac, &pg->pg_bbatt, &pg->pg_rfatt,
+ pg->pg_txctl);
+ bwn_rf_unlock(mac);
+ bwn_phy_unlock(mac);
+
+ bwn_mac_enable(mac);
+}
+
+void
+bwn_phy_g_task_15s(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ unsigned long expire, now;
+ struct bwn_lo_calib *cal, *tmp;
+ uint8_t expired = 0;
+
+ bwn_mac_suspend(mac);
+
+ if (lo == NULL)
+ goto fail;
+
+ BWN_GETTIME(now);
+ if (bwn_has_hwpctl(mac)) {
+ expire = now - BWN_LO_PWRVEC_EXPIRE;
+ if (ieee80211_time_before(lo->pwr_vec_read_time, expire)) {
+ bwn_lo_get_powervector(mac);
+ bwn_phy_g_dc_lookup_init(mac, 0);
+ }
+ goto fail;
+ }
+
+ expire = now - BWN_LO_CALIB_EXPIRE;
+ TAILQ_FOREACH_SAFE(cal, &lo->calib_list, list, tmp) {
+ if (!ieee80211_time_before(cal->calib_time, expire))
+ continue;
+ if (BWN_BBATTCMP(&cal->bbatt, &pg->pg_bbatt) &&
+ BWN_RFATTCMP(&cal->rfatt, &pg->pg_rfatt)) {
+ KASSERT(!expired, ("%s:%d: fail", __func__, __LINE__));
+ expired = 1;
+ }
+
+ DPRINTF(sc, BWN_DEBUG_LO, "expired BB %u RF %u %u I %d Q %d\n",
+ cal->bbatt.att, cal->rfatt.att, cal->rfatt.padmix,
+ cal->ctl.i, cal->ctl.q);
+
+ TAILQ_REMOVE(&lo->calib_list, cal, list);
+ free(cal, M_DEVBUF);
+ }
+ if (expired || TAILQ_EMPTY(&lo->calib_list)) {
+ cal = bwn_lo_calibset(mac, &pg->pg_bbatt,
+ &pg->pg_rfatt);
+ if (cal == NULL) {
+ device_printf(sc->sc_dev,
+ "failed to recalibrate LO\n");
+ goto fail;
+ }
+ TAILQ_INSERT_TAIL(&lo->calib_list, cal, list);
+ bwn_lo_write(mac, &cal->ctl);
+ }
+
+fail:
+ bwn_mac_enable(mac);
+}
+
+void
+bwn_phy_g_task_60s(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint8_t old = phy->chan;
+
+ if (!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI))
+ return;
+
+ bwn_mac_suspend(mac);
+ bwn_nrssi_slope_11g(mac);
+ if ((phy->rf_ver == 0x2050) && (phy->rf_rev == 8)) {
+ bwn_switch_channel(mac, (old >= 8) ? 1 : 13);
+ bwn_switch_channel(mac, old);
+ }
+ bwn_mac_enable(mac);
+}
+
+void
+bwn_phy_switch_analog(struct bwn_mac *mac, int on)
+{
+
+ BWN_WRITE_2(mac, BWN_PHY0, on ? 0 : 0xf4);
+}
+
+static void
+bwn_phy_g_init_sub(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint16_t i, tmp;
+
+ if (phy->rev == 1)
+ bwn_phy_init_b5(mac);
+ else
+ bwn_phy_init_b6(mac);
+
+ if (phy->rev >= 2 || phy->gmode)
+ bwn_phy_init_a(mac);
+
+ if (phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL, 0);
+ }
+ if (phy->rev == 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xc0);
+ }
+ if (phy->rev > 5) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x400);
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xc0);
+ }
+ if (phy->gmode || phy->rev >= 2) {
+ tmp = BWN_PHY_READ(mac, BWN_PHY_VERSION_OFDM);
+ tmp &= BWN_PHYVER_VERSION;
+ if (tmp == 3 || tmp == 5) {
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc2), 0x1816);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc3), 0x8006);
+ }
+ if (tmp == 5) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xcc), 0x00ff,
+ 0x1f00);
+ }
+ }
+ if ((phy->rev <= 2 && phy->gmode) || phy->rev >= 2)
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x7e), 0x78);
+ if (phy->rf_rev == 8) {
+ BWN_PHY_SET(mac, BWN_PHY_EXTG(0x01), 0x80);
+ BWN_PHY_SET(mac, BWN_PHY_OFDM(0x3e), 0x4);
+ }
+ if (BWN_HAS_LOOPBACK(phy))
+ bwn_loopback_calcgain(mac);
+
+ if (phy->rf_rev != 8) {
+ if (pg->pg_initval == 0xffff)
+ pg->pg_initval = bwn_rf_init_bcm2050(mac);
+ else
+ BWN_RF_WRITE(mac, 0x0078, pg->pg_initval);
+ }
+ bwn_lo_g_init(mac);
+ if (BWN_HAS_TXMAG(phy)) {
+ BWN_RF_WRITE(mac, 0x52,
+ (BWN_RF_READ(mac, 0x52) & 0xff00)
+ | pg->pg_loctl.tx_bias |
+ pg->pg_loctl.tx_magn);
+ } else {
+ BWN_RF_SETMASK(mac, 0x52, 0xfff0, pg->pg_loctl.tx_bias);
+ }
+ if (phy->rev >= 6) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x36), 0x0fff,
+ (pg->pg_loctl.tx_bias << 12));
+ }
+ if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL)
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8075);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x807f);
+ if (phy->rev < 2)
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x101);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x202);
+ if (phy->gmode || phy->rev >= 2) {
+ bwn_lo_g_adjust(mac);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078);
+ }
+
+ if (!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI)) {
+ for (i = 0; i < 64; i++) {
+ BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_CTRL, i);
+ BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_DATA,
+ (uint16_t)MIN(MAX(bwn_nrssi_read(mac, i) - 0xffff,
+ -32), 31));
+ }
+ bwn_nrssi_threshold(mac);
+ } else if (phy->gmode || phy->rev >= 2) {
+ if (pg->pg_nrssi[0] == -1000) {
+ KASSERT(pg->pg_nrssi[1] == -1000,
+ ("%s:%d: fail", __func__, __LINE__));
+ bwn_nrssi_slope_11g(mac);
+ } else
+ bwn_nrssi_threshold(mac);
+ }
+ if (phy->rf_rev == 8)
+ BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x05), 0x3230);
+ bwn_phy_hwpctl_init(mac);
+ if ((siba_get_chipid(sc->sc_dev) == 0x4306
+ && siba_get_chippkg(sc->sc_dev) == 2) || 0) {
+ BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0xbfff);
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xc3), 0x7fff);
+ }
+}
+
+static void
+bwn_phy_init_b5(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint16_t offset, value;
+ uint8_t old_channel;
+
+ if (phy->analog == 1)
+ BWN_RF_SET(mac, 0x007a, 0x0050);
+ if ((siba_get_pci_subvendor(sc->sc_dev) != SIBA_BOARDVENDOR_BCM) &&
+ (siba_get_pci_subdevice(sc->sc_dev) != SIBA_BOARD_BU4306)) {
+ value = 0x2120;
+ for (offset = 0x00a8; offset < 0x00c7; offset++) {
+ BWN_PHY_WRITE(mac, offset, value);
+ value += 0x202;
+ }
+ }
+ BWN_PHY_SETMASK(mac, 0x0035, 0xf0ff, 0x0700);
+ if (phy->rf_ver == 0x2050)
+ BWN_PHY_WRITE(mac, 0x0038, 0x0667);
+
+ if (phy->gmode || phy->rev >= 2) {
+ if (phy->rf_ver == 0x2050) {
+ BWN_RF_SET(mac, 0x007a, 0x0020);
+ BWN_RF_SET(mac, 0x0051, 0x0004);
+ }
+ BWN_WRITE_2(mac, BWN_PHY_RADIO, 0x0000);
+
+ BWN_PHY_SET(mac, 0x0802, 0x0100);
+ BWN_PHY_SET(mac, 0x042b, 0x2000);
+
+ BWN_PHY_WRITE(mac, 0x001c, 0x186a);
+
+ BWN_PHY_SETMASK(mac, 0x0013, 0x00ff, 0x1900);
+ BWN_PHY_SETMASK(mac, 0x0035, 0xffc0, 0x0064);
+ BWN_PHY_SETMASK(mac, 0x005d, 0xff80, 0x000a);
+ }
+
+ if (mac->mac_flags & BWN_MAC_FLAG_BADFRAME_PREEMP)
+ BWN_PHY_SET(mac, BWN_PHY_RADIO_BITFIELD, (1 << 11));
+
+ if (phy->analog == 1) {
+ BWN_PHY_WRITE(mac, 0x0026, 0xce00);
+ BWN_PHY_WRITE(mac, 0x0021, 0x3763);
+ BWN_PHY_WRITE(mac, 0x0022, 0x1bc3);
+ BWN_PHY_WRITE(mac, 0x0023, 0x06f9);
+ BWN_PHY_WRITE(mac, 0x0024, 0x037e);
+ } else
+ BWN_PHY_WRITE(mac, 0x0026, 0xcc00);
+ BWN_PHY_WRITE(mac, 0x0030, 0x00c6);
+ BWN_WRITE_2(mac, 0x03ec, 0x3f22);
+
+ if (phy->analog == 1)
+ BWN_PHY_WRITE(mac, 0x0020, 0x3e1c);
+ else
+ BWN_PHY_WRITE(mac, 0x0020, 0x301c);
+
+ if (phy->analog == 0)
+ BWN_WRITE_2(mac, 0x03e4, 0x3000);
+
+ old_channel = phy->chan;
+ bwn_phy_g_switch_chan(mac, 7, 0);
+
+ if (phy->rf_ver != 0x2050) {
+ BWN_RF_WRITE(mac, 0x0075, 0x0080);
+ BWN_RF_WRITE(mac, 0x0079, 0x0081);
+ }
+
+ BWN_RF_WRITE(mac, 0x0050, 0x0020);
+ BWN_RF_WRITE(mac, 0x0050, 0x0023);
+
+ if (phy->rf_ver == 0x2050) {
+ BWN_RF_WRITE(mac, 0x0050, 0x0020);
+ BWN_RF_WRITE(mac, 0x005a, 0x0070);
+ }
+
+ BWN_RF_WRITE(mac, 0x005b, 0x007b);
+ BWN_RF_WRITE(mac, 0x005c, 0x00b0);
+ BWN_RF_SET(mac, 0x007a, 0x0007);
+
+ bwn_phy_g_switch_chan(mac, old_channel, 0);
+ BWN_PHY_WRITE(mac, 0x0014, 0x0080);
+ BWN_PHY_WRITE(mac, 0x0032, 0x00ca);
+ BWN_PHY_WRITE(mac, 0x002a, 0x88a3);
+
+ bwn_phy_g_set_txpwr_sub(mac, &pg->pg_bbatt, &pg->pg_rfatt,
+ pg->pg_txctl);
+
+ if (phy->rf_ver == 0x2050)
+ BWN_RF_WRITE(mac, 0x005d, 0x000d);
+
+ BWN_WRITE_2(mac, 0x03e4, (BWN_READ_2(mac, 0x03e4) & 0xffc0) | 0x0004);
+}
+
+static void
+bwn_loopback_calcgain(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint16_t backup_phy[16] = { 0 };
+ uint16_t backup_radio[3];
+ uint16_t backup_bband;
+ uint16_t i, j, loop_i_max;
+ uint16_t trsw_rx;
+ uint16_t loop1_outer_done, loop1_inner_done;
+
+ backup_phy[0] = BWN_PHY_READ(mac, BWN_PHY_CRS0);
+ backup_phy[1] = BWN_PHY_READ(mac, BWN_PHY_CCKBBANDCFG);
+ backup_phy[2] = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
+ backup_phy[3] = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
+ if (phy->rev != 1) {
+ backup_phy[4] = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVER);
+ backup_phy[5] = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVERVAL);
+ }
+ backup_phy[6] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x5a));
+ backup_phy[7] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x59));
+ backup_phy[8] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x58));
+ backup_phy[9] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x0a));
+ backup_phy[10] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x03));
+ backup_phy[11] = BWN_PHY_READ(mac, BWN_PHY_LO_MASK);
+ backup_phy[12] = BWN_PHY_READ(mac, BWN_PHY_LO_CTL);
+ backup_phy[13] = BWN_PHY_READ(mac, BWN_PHY_CCK(0x2b));
+ backup_phy[14] = BWN_PHY_READ(mac, BWN_PHY_PGACTL);
+ backup_phy[15] = BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
+ backup_bband = pg->pg_bbatt.att;
+ backup_radio[0] = BWN_RF_READ(mac, 0x52);
+ backup_radio[1] = BWN_RF_READ(mac, 0x43);
+ backup_radio[2] = BWN_RF_READ(mac, 0x7a);
+
+ BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x3fff);
+ BWN_PHY_SET(mac, BWN_PHY_CCKBBANDCFG, 0x8000);
+ BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0002);
+ BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xfffd);
+ BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0001);
+ BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xfffe);
+ if (phy->rev != 1) {
+ BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0001);
+ BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffe);
+ BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0002);
+ BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffd);
+ }
+ BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x000c);
+ BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x000c);
+ BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0030);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xffcf, 0x10);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0780);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d);
+
+ BWN_PHY_SET(mac, BWN_PHY_CCK(0x0a), 0x2000);
+ if (phy->rev != 1) {
+ BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0004);
+ BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffb);
+ }
+ BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x03), 0xff9f, 0x40);
+
+ if (phy->rf_rev == 8)
+ BWN_RF_WRITE(mac, 0x43, 0x000f);
+ else {
+ BWN_RF_WRITE(mac, 0x52, 0);
+ BWN_RF_SETMASK(mac, 0x43, 0xfff0, 0x9);
+ }
+ bwn_phy_g_set_bbatt(mac, 11);
+
+ if (phy->rev >= 3)
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc020);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8020);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, 0);
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x2b), 0xffc0, 0x01);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x2b), 0xc0ff, 0x800);
+
+ BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0100);
+ BWN_PHY_MASK(mac, BWN_PHY_RFOVERVAL, 0xcfff);
+
+ if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) {
+ if (phy->rev >= 7) {
+ BWN_PHY_SET(mac, BWN_PHY_RFOVER, 0x0800);
+ BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x8000);
+ }
+ }
+ BWN_RF_MASK(mac, 0x7a, 0x00f7);
+
+ j = 0;
+ loop_i_max = (phy->rf_rev == 8) ? 15 : 9;
+ for (i = 0; i < loop_i_max; i++) {
+ for (j = 0; j < 16; j++) {
+ BWN_RF_WRITE(mac, 0x43, i);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xf0ff,
+ (j << 8));
+ BWN_PHY_SETMASK(mac, BWN_PHY_PGACTL, 0x0fff, 0xa000);
+ BWN_PHY_SET(mac, BWN_PHY_PGACTL, 0xf000);
+ DELAY(20);
+ if (BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE) >= 0xdfc)
+ goto done0;
+ }
+ }
+done0:
+ loop1_outer_done = i;
+ loop1_inner_done = j;
+ if (j >= 8) {
+ BWN_PHY_SET(mac, BWN_PHY_RFOVERVAL, 0x30);
+ trsw_rx = 0x1b;
+ for (j = j - 8; j < 16; j++) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_RFOVERVAL, 0xf0ff, j << 8);
+ BWN_PHY_SETMASK(mac, BWN_PHY_PGACTL, 0x0fff, 0xa000);
+ BWN_PHY_SET(mac, BWN_PHY_PGACTL, 0xf000);
+ DELAY(20);
+ trsw_rx -= 3;
+ if (BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE) >= 0xdfc)
+ goto done1;
+ }
+ } else
+ trsw_rx = 0x18;
+done1:
+
+ if (phy->rev != 1) {
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, backup_phy[4]);
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL, backup_phy[5]);
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), backup_phy[6]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), backup_phy[7]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), backup_phy[8]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x0a), backup_phy[9]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x03), backup_phy[10]);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, backup_phy[11]);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, backup_phy[12]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), backup_phy[13]);
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, backup_phy[14]);
+
+ bwn_phy_g_set_bbatt(mac, backup_bband);
+
+ BWN_RF_WRITE(mac, 0x52, backup_radio[0]);
+ BWN_RF_WRITE(mac, 0x43, backup_radio[1]);
+ BWN_RF_WRITE(mac, 0x7a, backup_radio[2]);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, backup_phy[2] | 0x0003);
+ DELAY(10);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, backup_phy[2]);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, backup_phy[3]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRS0, backup_phy[0]);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCKBBANDCFG, backup_phy[1]);
+
+ pg->pg_max_lb_gain =
+ ((loop1_inner_done * 6) - (loop1_outer_done * 4)) - 11;
+ pg->pg_trsw_rx_gain = trsw_rx * 2;
+}
+
+static uint16_t
+bwn_rf_init_bcm2050(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ uint32_t tmp1 = 0, tmp2 = 0;
+ uint16_t rcc, i, j, pgactl, cck0, cck1, cck2, cck3, rfover, rfoverval,
+ analogover, analogoverval, crs0, classctl, lomask, loctl, syncctl,
+ radio0, radio1, radio2, reg0, reg1, reg2, radio78, reg, index;
+ static const uint8_t rcc_table[] = {
+ 0x02, 0x03, 0x01, 0x0f,
+ 0x06, 0x07, 0x05, 0x0f,
+ 0x0a, 0x0b, 0x09, 0x0f,
+ 0x0e, 0x0f, 0x0d, 0x0f,
+ };
+
+ loctl = lomask = reg0 = classctl = crs0 = analogoverval = analogover =
+ rfoverval = rfover = cck3 = 0;
+ radio0 = BWN_RF_READ(mac, 0x43);
+ radio1 = BWN_RF_READ(mac, 0x51);
+ radio2 = BWN_RF_READ(mac, 0x52);
+ pgactl = BWN_PHY_READ(mac, BWN_PHY_PGACTL);
+ cck0 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x5a));
+ cck1 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x59));
+ cck2 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x58));
+
+ if (phy->type == BWN_PHYTYPE_B) {
+ cck3 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x30));
+ reg0 = BWN_READ_2(mac, 0x3ec);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), 0xff);
+ BWN_WRITE_2(mac, 0x3ec, 0x3f3f);
+ } else if (phy->gmode || phy->rev >= 2) {
+ rfover = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
+ rfoverval = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
+ analogover = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVER);
+ analogoverval = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVERVAL);
+ crs0 = BWN_PHY_READ(mac, BWN_PHY_CRS0);
+ classctl = BWN_PHY_READ(mac, BWN_PHY_CLASSCTL);
+
+ BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0003);
+ BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffc);
+ BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x7fff);
+ BWN_PHY_MASK(mac, BWN_PHY_CLASSCTL, 0xfffc);
+ if (BWN_HAS_LOOPBACK(phy)) {
+ lomask = BWN_PHY_READ(mac, BWN_PHY_LO_MASK);
+ loctl = BWN_PHY_READ(mac, BWN_PHY_LO_CTL);
+ if (phy->rev >= 3)
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc020);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8020);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, 0);
+ }
+
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVERVAL,
+ BWN_LPD(0, 1, 1)));
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER,
+ bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVER, 0));
+ }
+ BWN_WRITE_2(mac, 0x3e2, BWN_READ_2(mac, 0x3e2) | 0x8000);
+
+ syncctl = BWN_PHY_READ(mac, BWN_PHY_SYNCCTL);
+ BWN_PHY_MASK(mac, BWN_PHY_SYNCCTL, 0xff7f);
+ reg1 = BWN_READ_2(mac, 0x3e6);
+ reg2 = BWN_READ_2(mac, 0x3f4);
+
+ if (phy->analog == 0)
+ BWN_WRITE_2(mac, 0x03e6, 0x0122);
+ else {
+ if (phy->analog >= 2)
+ BWN_PHY_SETMASK(mac, BWN_PHY_CCK(0x03), 0xffbf, 0x40);
+ BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
+ (BWN_READ_2(mac, BWN_CHANNEL_EXT) | 0x2000));
+ }
+
+ reg = BWN_RF_READ(mac, 0x60);
+ index = (reg & 0x001e) >> 1;
+ rcc = (((rcc_table[index] << 1) | (reg & 0x0001)) | 0x0020);
+
+ if (phy->type == BWN_PHYTYPE_B)
+ BWN_RF_WRITE(mac, 0x78, 0x26);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVERVAL,
+ BWN_LPD(0, 1, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xbfaf);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x1403);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac, BWN_PHY_RFOVERVAL,
+ BWN_LPD(0, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xbfa0);
+ BWN_RF_SET(mac, 0x51, 0x0004);
+ if (phy->rf_rev == 8)
+ BWN_RF_WRITE(mac, 0x43, 0x1f);
+ else {
+ BWN_RF_WRITE(mac, 0x52, 0);
+ BWN_RF_SETMASK(mac, 0x43, 0xfff0, 0x0009);
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
+
+ for (i = 0; i < 16; i++) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0480);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
+ DELAY(10);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xefb0);
+ DELAY(10);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 0)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xfff0);
+ DELAY(20);
+ tmp1 += BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
+ }
+ DELAY(10);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
+ tmp1++;
+ tmp1 >>= 9;
+
+ for (i = 0; i < 16; i++) {
+ radio78 = (BWN_BITREV4(i) << 1) | 0x0020;
+ BWN_RF_WRITE(mac, 0x78, radio78);
+ DELAY(10);
+ for (j = 0; j < 16; j++) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), 0x0d80);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), 0xc810);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0x000d);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
+ DELAY(10);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xefb0);
+ DELAY(10);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 0)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xfff0);
+ DELAY(10);
+ tmp2 += BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), 0);
+ if (phy->gmode || phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL,
+ bwn_rf_2050_rfoverval(mac,
+ BWN_PHY_RFOVERVAL, BWN_LPD(1, 0, 1)));
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xafb0);
+ }
+ tmp2++;
+ tmp2 >>= 8;
+ if (tmp1 < tmp2)
+ break;
+ }
+
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pgactl);
+ BWN_RF_WRITE(mac, 0x51, radio1);
+ BWN_RF_WRITE(mac, 0x52, radio2);
+ BWN_RF_WRITE(mac, 0x43, radio0);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x5a), cck0);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x59), cck1);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x58), cck2);
+ BWN_WRITE_2(mac, 0x3e6, reg1);
+ if (phy->analog != 0)
+ BWN_WRITE_2(mac, 0x3f4, reg2);
+ BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, syncctl);
+ bwn_spu_workaround(mac, phy->chan);
+ if (phy->type == BWN_PHYTYPE_B) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), cck3);
+ BWN_WRITE_2(mac, 0x3ec, reg0);
+ } else if (phy->gmode) {
+ BWN_WRITE_2(mac, BWN_PHY_RADIO,
+ BWN_READ_2(mac, BWN_PHY_RADIO)
+ & 0x7fff);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, rfover);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfoverval);
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, analogover);
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL,
+ analogoverval);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRS0, crs0);
+ BWN_PHY_WRITE(mac, BWN_PHY_CLASSCTL, classctl);
+ if (BWN_HAS_LOOPBACK(phy)) {
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, lomask);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, loctl);
+ }
+ }
+
+ return ((i > 15) ? radio78 : rcc);
+}
+
+static void
+bwn_phy_init_b6(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint16_t offset, val;
+ uint8_t old_channel;
+
+ KASSERT(!(phy->rf_rev == 6 || phy->rf_rev == 7),
+ ("%s:%d: fail", __func__, __LINE__));
+
+ BWN_PHY_WRITE(mac, 0x003e, 0x817a);
+ BWN_RF_WRITE(mac, 0x007a, BWN_RF_READ(mac, 0x007a) | 0x0058);
+ if (phy->rf_rev == 4 || phy->rf_rev == 5) {
+ BWN_RF_WRITE(mac, 0x51, 0x37);
+ BWN_RF_WRITE(mac, 0x52, 0x70);
+ BWN_RF_WRITE(mac, 0x53, 0xb3);
+ BWN_RF_WRITE(mac, 0x54, 0x9b);
+ BWN_RF_WRITE(mac, 0x5a, 0x88);
+ BWN_RF_WRITE(mac, 0x5b, 0x88);
+ BWN_RF_WRITE(mac, 0x5d, 0x88);
+ BWN_RF_WRITE(mac, 0x5e, 0x88);
+ BWN_RF_WRITE(mac, 0x7d, 0x88);
+ bwn_hf_write(mac,
+ bwn_hf_read(mac) | BWN_HF_TSSI_RESET_PSM_WORKAROUN);
+ }
+ if (phy->rf_rev == 8) {
+ BWN_RF_WRITE(mac, 0x51, 0);
+ BWN_RF_WRITE(mac, 0x52, 0x40);
+ BWN_RF_WRITE(mac, 0x53, 0xb7);
+ BWN_RF_WRITE(mac, 0x54, 0x98);
+ BWN_RF_WRITE(mac, 0x5a, 0x88);
+ BWN_RF_WRITE(mac, 0x5b, 0x6b);
+ BWN_RF_WRITE(mac, 0x5c, 0x0f);
+ if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_ALTIQ) {
+ BWN_RF_WRITE(mac, 0x5d, 0xfa);
+ BWN_RF_WRITE(mac, 0x5e, 0xd8);
+ } else {
+ BWN_RF_WRITE(mac, 0x5d, 0xf5);
+ BWN_RF_WRITE(mac, 0x5e, 0xb8);
+ }
+ BWN_RF_WRITE(mac, 0x0073, 0x0003);
+ BWN_RF_WRITE(mac, 0x007d, 0x00a8);
+ BWN_RF_WRITE(mac, 0x007c, 0x0001);
+ BWN_RF_WRITE(mac, 0x007e, 0x0008);
+ }
+ for (val = 0x1e1f, offset = 0x0088; offset < 0x0098; offset++) {
+ BWN_PHY_WRITE(mac, offset, val);
+ val -= 0x0202;
+ }
+ for (val = 0x3e3f, offset = 0x0098; offset < 0x00a8; offset++) {
+ BWN_PHY_WRITE(mac, offset, val);
+ val -= 0x0202;
+ }
+ for (val = 0x2120, offset = 0x00a8; offset < 0x00c8; offset++) {
+ BWN_PHY_WRITE(mac, offset, (val & 0x3f3f));
+ val += 0x0202;
+ }
+ if (phy->type == BWN_PHYTYPE_G) {
+ BWN_RF_SET(mac, 0x007a, 0x0020);
+ BWN_RF_SET(mac, 0x0051, 0x0004);
+ BWN_PHY_SET(mac, 0x0802, 0x0100);
+ BWN_PHY_SET(mac, 0x042b, 0x2000);
+ BWN_PHY_WRITE(mac, 0x5b, 0);
+ BWN_PHY_WRITE(mac, 0x5c, 0);
+ }
+
+ old_channel = phy->chan;
+ bwn_phy_g_switch_chan(mac, (old_channel >= 8) ? 1 : 13, 0);
+
+ BWN_RF_WRITE(mac, 0x0050, 0x0020);
+ BWN_RF_WRITE(mac, 0x0050, 0x0023);
+ DELAY(40);
+ if (phy->rf_rev < 6 || phy->rf_rev == 8) {
+ BWN_RF_WRITE(mac, 0x7c, BWN_RF_READ(mac, 0x7c) | 0x0002);
+ BWN_RF_WRITE(mac, 0x50, 0x20);
+ }
+ if (phy->rf_rev <= 2) {
+ BWN_RF_WRITE(mac, 0x7c, 0x20);
+ BWN_RF_WRITE(mac, 0x5a, 0x70);
+ BWN_RF_WRITE(mac, 0x5b, 0x7b);
+ BWN_RF_WRITE(mac, 0x5c, 0xb0);
+ }
+ BWN_RF_SETMASK(mac, 0x007a, 0x00f8, 0x0007);
+
+ bwn_phy_g_switch_chan(mac, old_channel, 0);
+
+ BWN_PHY_WRITE(mac, 0x0014, 0x0200);
+ if (phy->rf_rev >= 6)
+ BWN_PHY_WRITE(mac, 0x2a, 0x88c2);
+ else
+ BWN_PHY_WRITE(mac, 0x2a, 0x8ac0);
+ BWN_PHY_WRITE(mac, 0x0038, 0x0668);
+ bwn_phy_g_set_txpwr_sub(mac, &pg->pg_bbatt, &pg->pg_rfatt,
+ pg->pg_txctl);
+ if (phy->rf_rev <= 5)
+ BWN_PHY_SETMASK(mac, 0x5d, 0xff80, 0x0003);
+ if (phy->rf_rev <= 2)
+ BWN_RF_WRITE(mac, 0x005d, 0x000d);
+
+ if (phy->analog == 4) {
+ BWN_WRITE_2(mac, 0x3e4, 9);
+ BWN_PHY_MASK(mac, 0x61, 0x0fff);
+ } else
+ BWN_PHY_SETMASK(mac, 0x0002, 0xffc0, 0x0004);
+ if (phy->type == BWN_PHYTYPE_B)
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ else if (phy->type == BWN_PHYTYPE_G)
+ BWN_WRITE_2(mac, 0x03e6, 0x0);
+}
+
+static void
+bwn_phy_init_a(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_softc *sc = mac->mac_sc;
+
+ KASSERT(phy->type == BWN_PHYTYPE_A || phy->type == BWN_PHYTYPE_G,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ if (phy->rev >= 6) {
+ if (phy->type == BWN_PHYTYPE_A)
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x1b), ~0x1000);
+ if (BWN_PHY_READ(mac, BWN_PHY_ENCORE) & BWN_PHY_ENCORE_EN)
+ BWN_PHY_SET(mac, BWN_PHY_ENCORE, 0x0010);
+ else
+ BWN_PHY_MASK(mac, BWN_PHY_ENCORE, ~0x1010);
+ }
+
+ bwn_wa_init(mac);
+
+ if (phy->type == BWN_PHYTYPE_G &&
+ (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_PACTRL))
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x6e), 0xe000, 0x3cf);
+}
+
+static void
+bwn_wa_write_noisescale(struct bwn_mac *mac, const uint16_t *nst)
+{
+ int i;
+
+ for (i = 0; i < BWN_TAB_NOISESCALE_SIZE; i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_NOISESCALE, i, nst[i]);
+}
+
+static void
+bwn_wa_agc(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+
+ if (phy->rev == 1) {
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 0, 254);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 1, 13);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 2, 19);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1_R1, 3, 25);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 0, 0x2710);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 1, 0x9b83);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 2, 0x9b83);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, 3, 0x0f8d);
+ BWN_PHY_WRITE(mac, BWN_PHY_LMS, 4);
+ } else {
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 0, 254);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 1, 13);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 2, 19);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC1, 3, 25);
+ }
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_CCKSHIFTBITS_WA, (uint16_t)~0xff00,
+ 0x5700);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1a), ~0x007f, 0x000f);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1a), ~0x3f80, 0x2b80);
+ BWN_PHY_SETMASK(mac, BWN_PHY_ANTWRSETT, 0xf0ff, 0x0300);
+ BWN_RF_SET(mac, 0x7a, 0x0008);
+ BWN_PHY_SETMASK(mac, BWN_PHY_N1P1GAIN, ~0x000f, 0x0008);
+ BWN_PHY_SETMASK(mac, BWN_PHY_P1P2GAIN, ~0x0f00, 0x0600);
+ BWN_PHY_SETMASK(mac, BWN_PHY_N1N2GAIN, ~0x0f00, 0x0700);
+ BWN_PHY_SETMASK(mac, BWN_PHY_N1P1GAIN, ~0x0f00, 0x0100);
+ if (phy->rev == 1)
+ BWN_PHY_SETMASK(mac, BWN_PHY_N1N2GAIN, ~0x000f, 0x0007);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x88), ~0x00ff, 0x001c);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x88), ~0x3f00, 0x0200);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x96), ~0x00ff, 0x001c);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x89), ~0x00ff, 0x0020);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x89), ~0x3f00, 0x0200);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x82), ~0x00ff, 0x002e);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x96), (uint16_t)~0xff00, 0x1a00);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x81), ~0x00ff, 0x0028);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x81), (uint16_t)~0xff00, 0x2c00);
+ if (phy->rev == 1) {
+ BWN_PHY_WRITE(mac, BWN_PHY_PEAK_COUNT, 0x092b);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x1b), ~0x001e, 0x0002);
+ } else {
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x1b), ~0x001e);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x1f), 0x287a);
+ BWN_PHY_SETMASK(mac, BWN_PHY_LPFGAINCTL, ~0x000f, 0x0004);
+ if (phy->rev >= 6) {
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x22), 0x287a);
+ BWN_PHY_SETMASK(mac, BWN_PHY_LPFGAINCTL,
+ (uint16_t)~0xf000, 0x3000);
+ }
+ }
+ BWN_PHY_SETMASK(mac, BWN_PHY_DIVSRCHIDX, 0x8080, 0x7874);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8e), 0x1c00);
+ if (phy->rev == 1) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_DIVP1P2GAIN, ~0x0f00, 0x0600);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8b), 0x005e);
+ BWN_PHY_SETMASK(mac, BWN_PHY_ANTWRSETT, ~0x00ff, 0x001e);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x8d), 0x0002);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 0, 0);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 1, 7);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 2, 16);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3_R1, 3, 28);
+ } else {
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 0, 0);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 1, 7);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 2, 16);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC3, 3, 28);
+ }
+ if (phy->rev >= 6) {
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x26), ~0x0003);
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0x26), ~0x1000);
+ }
+ BWN_PHY_READ(mac, BWN_PHY_VERSION_OFDM);
+}
+
+static void
+bwn_wa_grev1(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ int i;
+ static const uint16_t bwn_tab_finefreqg[] = BWN_TAB_FINEFREQ_G;
+ static const uint32_t bwn_tab_retard[] = BWN_TAB_RETARD;
+ static const uint32_t bwn_tab_rotor[] = BWN_TAB_ROTOR;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
+
+ /* init CRSTHRES and ANTDWELL */
+ if (phy->rev == 1) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1_R1, 0x4f19);
+ } else if (phy->rev == 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x1861);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0271);
+ BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
+ } else {
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x0098);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0070);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc9), 0x0080);
+ BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
+ }
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRS0, ~0x03c0, 0xd000);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0x2c), 0x005a);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCKSHIFTBITS, 0x0026);
+
+ /* XXX support PHY-A??? */
+ for (i = 0; i < N(bwn_tab_finefreqg); i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DACRFPABB, i,
+ bwn_tab_finefreqg[i]);
+
+ /* XXX support PHY-A??? */
+ if (phy->rev == 1)
+ for (i = 0; i < N(bwn_tab_noise_g1); i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
+ bwn_tab_noise_g1[i]);
+ else
+ for (i = 0; i < N(bwn_tab_noise_g2); i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
+ bwn_tab_noise_g2[i]);
+
+
+ for (i = 0; i < N(bwn_tab_rotor); i++)
+ bwn_ofdmtab_write_4(mac, BWN_OFDMTAB_ROTOR, i,
+ bwn_tab_rotor[i]);
+
+ /* XXX support PHY-A??? */
+ if (phy->rev >= 6) {
+ if (BWN_PHY_READ(mac, BWN_PHY_ENCORE) &
+ BWN_PHY_ENCORE_EN)
+ bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g3);
+ else
+ bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g2);
+ } else
+ bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g1);
+
+ for (i = 0; i < N(bwn_tab_retard); i++)
+ bwn_ofdmtab_write_4(mac, BWN_OFDMTAB_ADVRETARD, i,
+ bwn_tab_retard[i]);
+
+ if (phy->rev == 1) {
+ for (i = 0; i < 16; i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI_R1,
+ i, 0x0020);
+ } else {
+ for (i = 0; i < 32; i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI, i, 0x0820);
+ }
+
+ bwn_wa_agc(mac);
+}
+
+static void
+bwn_wa_grev26789(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ int i;
+ static const uint16_t bwn_tab_sigmasqr2[] = BWN_TAB_SIGMASQR2;
+ uint16_t ofdmrev;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
+
+ bwn_gtab_write(mac, BWN_GTAB_ORIGTR, 0, 0xc480);
+
+ /* init CRSTHRES and ANTDWELL */
+ if (phy->rev == 1)
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1_R1, 0x4f19);
+ else if (phy->rev == 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x1861);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0271);
+ BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
+ } else {
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES1, 0x0098);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRSTHRES2, 0x0070);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xc9), 0x0080);
+ BWN_PHY_SET(mac, BWN_PHY_ANTDWELL, 0x0800);
+ }
+
+ for (i = 0; i < 64; i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_RSSI, i, i);
+
+ /* XXX support PHY-A??? */
+ if (phy->rev == 1)
+ for (i = 0; i < N(bwn_tab_noise_g1); i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
+ bwn_tab_noise_g1[i]);
+ else
+ for (i = 0; i < N(bwn_tab_noise_g2); i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_AGC2, i,
+ bwn_tab_noise_g2[i]);
+
+ /* XXX support PHY-A??? */
+ if (phy->rev >= 6) {
+ if (BWN_PHY_READ(mac, BWN_PHY_ENCORE) &
+ BWN_PHY_ENCORE_EN)
+ bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g3);
+ else
+ bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g2);
+ } else
+ bwn_wa_write_noisescale(mac, bwn_tab_noisescale_g1);
+
+ for (i = 0; i < N(bwn_tab_sigmasqr2); i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_MINSIGSQ, i,
+ bwn_tab_sigmasqr2[i]);
+
+ if (phy->rev == 1) {
+ for (i = 0; i < 16; i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI_R1, i,
+ 0x0020);
+ } else {
+ for (i = 0; i < 32; i++)
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_WRSSI, i, 0x0820);
+ }
+
+ bwn_wa_agc(mac);
+
+ ofdmrev = BWN_PHY_READ(mac, BWN_PHY_VERSION_OFDM) & BWN_PHYVER_VERSION;
+ if (ofdmrev > 2) {
+ if (phy->type == BWN_PHYTYPE_A)
+ BWN_PHY_WRITE(mac, BWN_PHY_PWRDOWN, 0x1808);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_PWRDOWN, 0x1000);
+ } else {
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 3, 0x1044);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 4, 0x7201);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_DAC, 6, 0x0040);
+ }
+
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_0F, 2, 15);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_0F, 3, 20);
+}
+
+static void
+bwn_wa_init(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_softc *sc = mac->mac_sc;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s fail", __func__));
+
+ switch (phy->rev) {
+ case 1:
+ bwn_wa_grev1(mac);
+ break;
+ case 2:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ bwn_wa_grev26789(mac);
+ break;
+ default:
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+
+ if (siba_get_pci_subvendor(sc->sc_dev) != SIBA_BOARDVENDOR_BCM ||
+ siba_get_pci_subdevice(sc->sc_dev) != SIBA_BOARD_BU4306 ||
+ siba_get_pci_revid(sc->sc_dev) != 0x17) {
+ if (phy->rev < 2) {
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX_R1, 1,
+ 0x0002);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX_R1, 2,
+ 0x0001);
+ } else {
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 1, 0x0002);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX, 2, 0x0001);
+ if ((siba_sprom_get_bf_lo(sc->sc_dev) &
+ BWN_BFL_EXTLNA) &&
+ (phy->rev >= 7)) {
+ BWN_PHY_MASK(mac, BWN_PHY_EXTG(0x11), 0xf7ff);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
+ 0x0020, 0x0001);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
+ 0x0021, 0x0001);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
+ 0x0022, 0x0001);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
+ 0x0023, 0x0000);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
+ 0x0000, 0x0000);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_GAINX,
+ 0x0003, 0x0002);
+ }
+ }
+ }
+ if (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM) {
+ BWN_PHY_WRITE(mac, BWN_PHY_GTABCTL, 0x3120);
+ BWN_PHY_WRITE(mac, BWN_PHY_GTABDATA, 0xc480);
+ }
+
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_11, 0, 0);
+ bwn_ofdmtab_write_2(mac, BWN_OFDMTAB_UNKNOWN_11, 1, 0);
+}
+
+static void
+bwn_ofdmtab_write_2(struct bwn_mac *mac, uint16_t table, uint16_t offset,
+ uint16_t value)
+{
+ struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
+ uint16_t addr;
+
+ addr = table + offset;
+ if ((pg->pg_ofdmtab_dir != BWN_OFDMTAB_DIR_WRITE) ||
+ (addr - 1 != pg->pg_ofdmtab_addr)) {
+ BWN_PHY_WRITE(mac, BWN_PHY_OTABLECTL, addr);
+ pg->pg_ofdmtab_dir = BWN_OFDMTAB_DIR_WRITE;
+ }
+ pg->pg_ofdmtab_addr = addr;
+ BWN_PHY_WRITE(mac, BWN_PHY_OTABLEI, value);
+}
+
+static void
+bwn_ofdmtab_write_4(struct bwn_mac *mac, uint16_t table, uint16_t offset,
+ uint32_t value)
+{
+ struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
+ uint16_t addr;
+
+ addr = table + offset;
+ if ((pg->pg_ofdmtab_dir != BWN_OFDMTAB_DIR_WRITE) ||
+ (addr - 1 != pg->pg_ofdmtab_addr)) {
+ BWN_PHY_WRITE(mac, BWN_PHY_OTABLECTL, addr);
+ pg->pg_ofdmtab_dir = BWN_OFDMTAB_DIR_WRITE;
+ }
+ pg->pg_ofdmtab_addr = addr;
+
+ BWN_PHY_WRITE(mac, BWN_PHY_OTABLEI, value);
+ BWN_PHY_WRITE(mac, BWN_PHY_OTABLEQ, (value >> 16));
+}
+
+static void
+bwn_gtab_write(struct bwn_mac *mac, uint16_t table, uint16_t offset,
+ uint16_t value)
+{
+
+ BWN_PHY_WRITE(mac, BWN_PHY_GTABCTL, table + offset);
+ BWN_PHY_WRITE(mac, BWN_PHY_GTABDATA, value);
+}
+
+static void
+bwn_lo_write(struct bwn_mac *mac, struct bwn_loctl *ctl)
+{
+ uint16_t value;
+
+ KASSERT(mac->mac_phy.type == BWN_PHYTYPE_G,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ value = (uint8_t) (ctl->q);
+ value |= ((uint8_t) (ctl->i)) << 8;
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_CTL, value);
+}
+
+static uint16_t
+bwn_lo_calcfeed(struct bwn_mac *mac,
+ uint16_t lna, uint16_t pga, uint16_t trsw_rx)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint16_t rfover;
+ uint16_t feedthrough;
+
+ if (phy->gmode) {
+ lna <<= BWN_PHY_RFOVERVAL_LNA_SHIFT;
+ pga <<= BWN_PHY_RFOVERVAL_PGA_SHIFT;
+
+ KASSERT((lna & ~BWN_PHY_RFOVERVAL_LNA) == 0,
+ ("%s:%d: fail", __func__, __LINE__));
+ KASSERT((pga & ~BWN_PHY_RFOVERVAL_PGA) == 0,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ trsw_rx &= (BWN_PHY_RFOVERVAL_TRSWRX | BWN_PHY_RFOVERVAL_BW);
+
+ rfover = BWN_PHY_RFOVERVAL_UNK | pga | lna | trsw_rx;
+ if ((siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) &&
+ phy->rev > 6)
+ rfover |= BWN_PHY_RFOVERVAL_EXTLNA;
+
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xe300);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfover);
+ DELAY(10);
+ rfover |= BWN_PHY_RFOVERVAL_BW_LBW;
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfover);
+ DELAY(10);
+ rfover |= BWN_PHY_RFOVERVAL_BW_LPF;
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, rfover);
+ DELAY(10);
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xf300);
+ } else {
+ pga |= BWN_PHY_PGACTL_UNKNOWN;
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pga);
+ DELAY(10);
+ pga |= BWN_PHY_PGACTL_LOWBANDW;
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pga);
+ DELAY(10);
+ pga |= BWN_PHY_PGACTL_LPF;
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, pga);
+ }
+ DELAY(21);
+ feedthrough = BWN_PHY_READ(mac, BWN_PHY_LO_LEAKAGE);
+
+ return (feedthrough);
+}
+
+static uint16_t
+bwn_lo_txctl_regtable(struct bwn_mac *mac,
+ uint16_t *value, uint16_t *pad_mix_gain)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ uint16_t reg, v, padmix;
+
+ if (phy->type == BWN_PHYTYPE_B) {
+ v = 0x30;
+ if (phy->rf_rev <= 5) {
+ reg = 0x43;
+ padmix = 0;
+ } else {
+ reg = 0x52;
+ padmix = 5;
+ }
+ } else {
+ if (phy->rev >= 2 && phy->rf_rev == 8) {
+ reg = 0x43;
+ v = 0x10;
+ padmix = 2;
+ } else {
+ reg = 0x52;
+ v = 0x30;
+ padmix = 5;
+ }
+ }
+ if (value)
+ *value = v;
+ if (pad_mix_gain)
+ *pad_mix_gain = padmix;
+
+ return (reg);
+}
+
+static void
+bwn_lo_measure_txctl_values(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ uint16_t reg, mask;
+ uint16_t trsw_rx, pga;
+ uint16_t rf_pctl_reg;
+
+ static const uint8_t tx_bias_values[] = {
+ 0x09, 0x08, 0x0a, 0x01, 0x00,
+ 0x02, 0x05, 0x04, 0x06,
+ };
+ static const uint8_t tx_magn_values[] = {
+ 0x70, 0x40,
+ };
+
+ if (!BWN_HAS_LOOPBACK(phy)) {
+ rf_pctl_reg = 6;
+ trsw_rx = 2;
+ pga = 0;
+ } else {
+ int lb_gain;
+
+ trsw_rx = 0;
+ lb_gain = pg->pg_max_lb_gain / 2;
+ if (lb_gain > 10) {
+ rf_pctl_reg = 0;
+ pga = abs(10 - lb_gain) / 6;
+ pga = MIN(MAX(pga, 0), 15);
+ } else {
+ int cmp_val;
+ int tmp;
+
+ pga = 0;
+ cmp_val = 0x24;
+ if ((phy->rev >= 2) &&
+ (phy->rf_ver == 0x2050) && (phy->rf_rev == 8))
+ cmp_val = 0x3c;
+ tmp = lb_gain;
+ if ((10 - lb_gain) < cmp_val)
+ tmp = (10 - lb_gain);
+ if (tmp < 0)
+ tmp += 6;
+ else
+ tmp += 3;
+ cmp_val /= 4;
+ tmp /= 4;
+ if (tmp >= cmp_val)
+ rf_pctl_reg = cmp_val;
+ else
+ rf_pctl_reg = tmp;
+ }
+ }
+ BWN_RF_SETMASK(mac, 0x43, 0xfff0, rf_pctl_reg);
+ bwn_phy_g_set_bbatt(mac, 2);
+
+ reg = bwn_lo_txctl_regtable(mac, &mask, NULL);
+ mask = ~mask;
+ BWN_RF_MASK(mac, reg, mask);
+
+ if (BWN_HAS_TXMAG(phy)) {
+ int i, j;
+ int feedthrough;
+ int min_feedth = 0xffff;
+ uint8_t tx_magn, tx_bias;
+
+ for (i = 0; i < N(tx_magn_values); i++) {
+ tx_magn = tx_magn_values[i];
+ BWN_RF_SETMASK(mac, 0x52, 0xff0f, tx_magn);
+ for (j = 0; j < N(tx_bias_values); j++) {
+ tx_bias = tx_bias_values[j];
+ BWN_RF_SETMASK(mac, 0x52, 0xfff0, tx_bias);
+ feedthrough = bwn_lo_calcfeed(mac, 0, pga,
+ trsw_rx);
+ if (feedthrough < min_feedth) {
+ lo->tx_bias = tx_bias;
+ lo->tx_magn = tx_magn;
+ min_feedth = feedthrough;
+ }
+ if (lo->tx_bias == 0)
+ break;
+ }
+ BWN_RF_WRITE(mac, 0x52,
+ (BWN_RF_READ(mac, 0x52)
+ & 0xff00) | lo->tx_bias | lo->
+ tx_magn);
+ }
+ } else {
+ lo->tx_magn = 0;
+ lo->tx_bias = 0;
+ BWN_RF_MASK(mac, 0x52, 0xfff0);
+ }
+
+ BWN_GETTIME(lo->txctl_measured_time);
+}
+
+static void
+bwn_lo_get_powervector(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ int i;
+ uint64_t tmp;
+ uint64_t power_vector = 0;
+
+ for (i = 0; i < 8; i += 2) {
+ tmp = bwn_shm_read_2(mac, BWN_SHARED, 0x310 + i);
+ power_vector |= (tmp << (i * 8));
+ bwn_shm_write_2(mac, BWN_SHARED, 0x310 + i, 0);
+ }
+ if (power_vector)
+ lo->power_vector = power_vector;
+
+ BWN_GETTIME(lo->pwr_vec_read_time);
+}
+
+static void
+bwn_lo_measure_gain_values(struct bwn_mac *mac, int16_t max_rx_gain,
+ int use_trsw_rx)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ uint16_t tmp;
+
+ if (max_rx_gain < 0)
+ max_rx_gain = 0;
+
+ if (BWN_HAS_LOOPBACK(phy)) {
+ int trsw_rx = 0;
+ int trsw_rx_gain;
+
+ if (use_trsw_rx) {
+ trsw_rx_gain = pg->pg_trsw_rx_gain / 2;
+ if (max_rx_gain >= trsw_rx_gain) {
+ trsw_rx_gain = max_rx_gain - trsw_rx_gain;
+ trsw_rx = 0x20;
+ }
+ } else
+ trsw_rx_gain = max_rx_gain;
+ if (trsw_rx_gain < 9) {
+ pg->pg_lna_lod_gain = 0;
+ } else {
+ pg->pg_lna_lod_gain = 1;
+ trsw_rx_gain -= 8;
+ }
+ trsw_rx_gain = MIN(MAX(trsw_rx_gain, 0), 0x2d);
+ pg->pg_pga_gain = trsw_rx_gain / 3;
+ if (pg->pg_pga_gain >= 5) {
+ pg->pg_pga_gain -= 5;
+ pg->pg_lna_gain = 2;
+ } else
+ pg->pg_lna_gain = 0;
+ } else {
+ pg->pg_lna_gain = 0;
+ pg->pg_trsw_rx_gain = 0x20;
+ if (max_rx_gain >= 0x14) {
+ pg->pg_lna_lod_gain = 1;
+ pg->pg_pga_gain = 2;
+ } else if (max_rx_gain >= 0x12) {
+ pg->pg_lna_lod_gain = 1;
+ pg->pg_pga_gain = 1;
+ } else if (max_rx_gain >= 0xf) {
+ pg->pg_lna_lod_gain = 1;
+ pg->pg_pga_gain = 0;
+ } else {
+ pg->pg_lna_lod_gain = 0;
+ pg->pg_pga_gain = 0;
+ }
+ }
+
+ tmp = BWN_RF_READ(mac, 0x7a);
+ if (pg->pg_lna_lod_gain == 0)
+ tmp &= ~0x0008;
+ else
+ tmp |= 0x0008;
+ BWN_RF_WRITE(mac, 0x7a, tmp);
+}
+
+static void
+bwn_lo_save(struct bwn_mac *mac, struct bwn_lo_g_value *sav)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ struct timespec ts;
+ uint16_t tmp;
+
+ if (bwn_has_hwpctl(mac)) {
+ sav->phy_lomask = BWN_PHY_READ(mac, BWN_PHY_LO_MASK);
+ sav->phy_extg = BWN_PHY_READ(mac, BWN_PHY_EXTG(0x01));
+ sav->phy_dacctl_hwpctl = BWN_PHY_READ(mac, BWN_PHY_DACCTL);
+ sav->phy_cck4 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x14));
+ sav->phy_hpwr_tssictl = BWN_PHY_READ(mac, BWN_PHY_HPWR_TSSICTL);
+
+ BWN_PHY_SET(mac, BWN_PHY_HPWR_TSSICTL, 0x100);
+ BWN_PHY_SET(mac, BWN_PHY_EXTG(0x01), 0x40);
+ BWN_PHY_SET(mac, BWN_PHY_DACCTL, 0x40);
+ BWN_PHY_SET(mac, BWN_PHY_CCK(0x14), 0x200);
+ }
+ if (phy->type == BWN_PHYTYPE_B &&
+ phy->rf_ver == 0x2050 && phy->rf_rev < 6) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x16), 0x410);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x17), 0x820);
+ }
+ if (phy->rev >= 2) {
+ sav->phy_analogover = BWN_PHY_READ(mac, BWN_PHY_ANALOGOVER);
+ sav->phy_analogoverval =
+ BWN_PHY_READ(mac, BWN_PHY_ANALOGOVERVAL);
+ sav->phy_rfover = BWN_PHY_READ(mac, BWN_PHY_RFOVER);
+ sav->phy_rfoverval = BWN_PHY_READ(mac, BWN_PHY_RFOVERVAL);
+ sav->phy_classctl = BWN_PHY_READ(mac, BWN_PHY_CLASSCTL);
+ sav->phy_cck3 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x3e));
+ sav->phy_crs0 = BWN_PHY_READ(mac, BWN_PHY_CRS0);
+
+ BWN_PHY_MASK(mac, BWN_PHY_CLASSCTL, 0xfffc);
+ BWN_PHY_MASK(mac, BWN_PHY_CRS0, 0x7fff);
+ BWN_PHY_SET(mac, BWN_PHY_ANALOGOVER, 0x0003);
+ BWN_PHY_MASK(mac, BWN_PHY_ANALOGOVERVAL, 0xfffc);
+ if (phy->type == BWN_PHYTYPE_G) {
+ if ((phy->rev >= 7) &&
+ (siba_sprom_get_bf_lo(sc->sc_dev) &
+ BWN_BFL_EXTLNA)) {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x933);
+ } else {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0x133);
+ }
+ } else {
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, 0);
+ }
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x3e), 0);
+ }
+ sav->reg0 = BWN_READ_2(mac, 0x3f4);
+ sav->reg1 = BWN_READ_2(mac, 0x3e2);
+ sav->rf0 = BWN_RF_READ(mac, 0x43);
+ sav->rf1 = BWN_RF_READ(mac, 0x7a);
+ sav->phy_pgactl = BWN_PHY_READ(mac, BWN_PHY_PGACTL);
+ sav->phy_cck2 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x2a));
+ sav->phy_syncctl = BWN_PHY_READ(mac, BWN_PHY_SYNCCTL);
+ sav->phy_dacctl = BWN_PHY_READ(mac, BWN_PHY_DACCTL);
+
+ if (!BWN_HAS_TXMAG(phy)) {
+ sav->rf2 = BWN_RF_READ(mac, 0x52);
+ sav->rf2 &= 0x00f0;
+ }
+ if (phy->type == BWN_PHYTYPE_B) {
+ sav->phy_cck0 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x30));
+ sav->phy_cck1 = BWN_PHY_READ(mac, BWN_PHY_CCK(0x06));
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), 0x00ff);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x06), 0x3f3f);
+ } else {
+ BWN_WRITE_2(mac, 0x3e2, BWN_READ_2(mac, 0x3e2)
+ | 0x8000);
+ }
+ BWN_WRITE_2(mac, 0x3f4, BWN_READ_2(mac, 0x3f4)
+ & 0xf000);
+
+ tmp =
+ (phy->type == BWN_PHYTYPE_G) ? BWN_PHY_LO_MASK : BWN_PHY_CCK(0x2e);
+ BWN_PHY_WRITE(mac, tmp, 0x007f);
+
+ tmp = sav->phy_syncctl;
+ BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, tmp & 0xff7f);
+ tmp = sav->rf1;
+ BWN_RF_WRITE(mac, 0x007a, tmp & 0xfff0);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2a), 0x8a3);
+ if (phy->type == BWN_PHYTYPE_G ||
+ (phy->type == BWN_PHYTYPE_B &&
+ phy->rf_ver == 0x2050 && phy->rf_rev >= 6)) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x1003);
+ } else
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2b), 0x0802);
+ if (phy->rev >= 2)
+ bwn_dummy_transmission(mac, 0, 1);
+ bwn_phy_g_switch_chan(mac, 6, 0);
+ BWN_RF_READ(mac, 0x51);
+ if (phy->type == BWN_PHYTYPE_G)
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0);
+
+ nanouptime(&ts);
+ if (ieee80211_time_before(lo->txctl_measured_time,
+ (ts.tv_nsec / 1000000 + ts.tv_sec * 1000) - BWN_LO_TXCTL_EXPIRE))
+ bwn_lo_measure_txctl_values(mac);
+
+ if (phy->type == BWN_PHYTYPE_G && phy->rev >= 3)
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0xc078);
+ else {
+ if (phy->type == BWN_PHYTYPE_B)
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8078);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, 0x8078);
+ }
+}
+
+static void
+bwn_lo_restore(struct bwn_mac *mac, struct bwn_lo_g_value *sav)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ uint16_t tmp;
+
+ if (phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, 0xe300);
+ tmp = (pg->pg_pga_gain << 8);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa0);
+ DELAY(5);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa2);
+ DELAY(2);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, tmp | 0xa3);
+ } else {
+ tmp = (pg->pg_pga_gain | 0xefa0);
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, tmp);
+ }
+ if (phy->type == BWN_PHYTYPE_G) {
+ if (phy->rev >= 3)
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0xc078);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2e), 0x8078);
+ if (phy->rev >= 2)
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x0202);
+ else
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2f), 0x0101);
+ }
+ BWN_WRITE_2(mac, 0x3f4, sav->reg0);
+ BWN_PHY_WRITE(mac, BWN_PHY_PGACTL, sav->phy_pgactl);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x2a), sav->phy_cck2);
+ BWN_PHY_WRITE(mac, BWN_PHY_SYNCCTL, sav->phy_syncctl);
+ BWN_PHY_WRITE(mac, BWN_PHY_DACCTL, sav->phy_dacctl);
+ BWN_RF_WRITE(mac, 0x43, sav->rf0);
+ BWN_RF_WRITE(mac, 0x7a, sav->rf1);
+ if (!BWN_HAS_TXMAG(phy)) {
+ tmp = sav->rf2;
+ BWN_RF_SETMASK(mac, 0x52, 0xff0f, tmp);
+ }
+ BWN_WRITE_2(mac, 0x3e2, sav->reg1);
+ if (phy->type == BWN_PHYTYPE_B &&
+ phy->rf_ver == 0x2050 && phy->rf_rev <= 5) {
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x30), sav->phy_cck0);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x06), sav->phy_cck1);
+ }
+ if (phy->rev >= 2) {
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVER, sav->phy_analogover);
+ BWN_PHY_WRITE(mac, BWN_PHY_ANALOGOVERVAL,
+ sav->phy_analogoverval);
+ BWN_PHY_WRITE(mac, BWN_PHY_CLASSCTL, sav->phy_classctl);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVER, sav->phy_rfover);
+ BWN_PHY_WRITE(mac, BWN_PHY_RFOVERVAL, sav->phy_rfoverval);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x3e), sav->phy_cck3);
+ BWN_PHY_WRITE(mac, BWN_PHY_CRS0, sav->phy_crs0);
+ }
+ if (bwn_has_hwpctl(mac)) {
+ tmp = (sav->phy_lomask & 0xbfff);
+ BWN_PHY_WRITE(mac, BWN_PHY_LO_MASK, tmp);
+ BWN_PHY_WRITE(mac, BWN_PHY_EXTG(0x01), sav->phy_extg);
+ BWN_PHY_WRITE(mac, BWN_PHY_DACCTL, sav->phy_dacctl_hwpctl);
+ BWN_PHY_WRITE(mac, BWN_PHY_CCK(0x14), sav->phy_cck4);
+ BWN_PHY_WRITE(mac, BWN_PHY_HPWR_TSSICTL, sav->phy_hpwr_tssictl);
+ }
+ bwn_phy_g_switch_chan(mac, sav->old_channel, 1);
+}
+
+static int
+bwn_lo_probe_loctl(struct bwn_mac *mac,
+ struct bwn_loctl *probe, struct bwn_lo_g_sm *d)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_loctl orig, test;
+ struct bwn_loctl prev = { -100, -100 };
+ static const struct bwn_loctl modifiers[] = {
+ { 1, 1,}, { 1, 0,}, { 1, -1,}, { 0, -1,},
+ { -1, -1,}, { -1, 0,}, { -1, 1,}, { 0, 1,}
+ };
+ int begin, end, lower = 0, i;
+ uint16_t feedth;
+
+ if (d->curstate == 0) {
+ begin = 1;
+ end = 8;
+ } else if (d->curstate % 2 == 0) {
+ begin = d->curstate - 1;
+ end = d->curstate + 1;
+ } else {
+ begin = d->curstate - 2;
+ end = d->curstate + 2;
+ }
+ if (begin < 1)
+ begin += 8;
+ if (end > 8)
+ end -= 8;
+
+ memcpy(&orig, probe, sizeof(struct bwn_loctl));
+ i = begin;
+ d->curstate = i;
+ while (1) {
+ KASSERT(i >= 1 && i <= 8, ("%s:%d: fail", __func__, __LINE__));
+ memcpy(&test, &orig, sizeof(struct bwn_loctl));
+ test.i += modifiers[i - 1].i * d->multipler;
+ test.q += modifiers[i - 1].q * d->multipler;
+ if ((test.i != prev.i || test.q != prev.q) &&
+ (abs(test.i) <= 16 && abs(test.q) <= 16)) {
+ bwn_lo_write(mac, &test);
+ feedth = bwn_lo_calcfeed(mac, pg->pg_lna_gain,
+ pg->pg_pga_gain, pg->pg_trsw_rx_gain);
+ if (feedth < d->feedth) {
+ memcpy(probe, &test,
+ sizeof(struct bwn_loctl));
+ lower = 1;
+ d->feedth = feedth;
+ if (d->nmeasure < 2 && !BWN_HAS_LOOPBACK(phy))
+ break;
+ }
+ }
+ memcpy(&prev, &test, sizeof(prev));
+ if (i == end)
+ break;
+ if (i == 8)
+ i = 1;
+ else
+ i++;
+ d->curstate = i;
+ }
+
+ return (lower);
+}
+
+static void
+bwn_lo_probe_sm(struct bwn_mac *mac, struct bwn_loctl *loctl, int *rxgain)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_lo_g_sm d;
+ struct bwn_loctl probe;
+ int lower, repeat, cnt = 0;
+ uint16_t feedth;
+
+ d.nmeasure = 0;
+ d.multipler = 1;
+ if (BWN_HAS_LOOPBACK(phy))
+ d.multipler = 3;
+
+ memcpy(&d.loctl, loctl, sizeof(struct bwn_loctl));
+ repeat = (BWN_HAS_LOOPBACK(phy)) ? 4 : 1;
+
+ do {
+ bwn_lo_write(mac, &d.loctl);
+ feedth = bwn_lo_calcfeed(mac, pg->pg_lna_gain,
+ pg->pg_pga_gain, pg->pg_trsw_rx_gain);
+ if (feedth < 0x258) {
+ if (feedth >= 0x12c)
+ *rxgain += 6;
+ else
+ *rxgain += 3;
+ feedth = bwn_lo_calcfeed(mac, pg->pg_lna_gain,
+ pg->pg_pga_gain, pg->pg_trsw_rx_gain);
+ }
+ d.feedth = feedth;
+ d.curstate = 0;
+ do {
+ KASSERT(d.curstate >= 0 && d.curstate <= 8,
+ ("%s:%d: fail", __func__, __LINE__));
+ memcpy(&probe, &d.loctl,
+ sizeof(struct bwn_loctl));
+ lower = bwn_lo_probe_loctl(mac, &probe, &d);
+ if (!lower)
+ break;
+ if ((probe.i == d.loctl.i) && (probe.q == d.loctl.q))
+ break;
+ memcpy(&d.loctl, &probe, sizeof(struct bwn_loctl));
+ d.nmeasure++;
+ } while (d.nmeasure < 24);
+ memcpy(loctl, &d.loctl, sizeof(struct bwn_loctl));
+
+ if (BWN_HAS_LOOPBACK(phy)) {
+ if (d.feedth > 0x1194)
+ *rxgain -= 6;
+ else if (d.feedth < 0x5dc)
+ *rxgain += 3;
+ if (cnt == 0) {
+ if (d.feedth <= 0x5dc) {
+ d.multipler = 1;
+ cnt++;
+ } else
+ d.multipler = 2;
+ } else if (cnt == 2)
+ d.multipler = 1;
+ }
+ bwn_lo_measure_gain_values(mac, *rxgain, BWN_HAS_LOOPBACK(phy));
+ } while (++cnt < repeat);
+}
+
+static struct bwn_lo_calib *
+bwn_lo_calibset(struct bwn_mac *mac,
+ const struct bwn_bbatt *bbatt, const struct bwn_rfatt *rfatt)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_loctl loctl = { 0, 0 };
+ struct bwn_lo_calib *cal;
+ struct bwn_lo_g_value sval = { 0 };
+ int rxgain;
+ uint16_t pad, reg, value;
+
+ sval.old_channel = phy->chan;
+ bwn_mac_suspend(mac);
+ bwn_lo_save(mac, &sval);
+
+ reg = bwn_lo_txctl_regtable(mac, &value, &pad);
+ BWN_RF_SETMASK(mac, 0x43, 0xfff0, rfatt->att);
+ BWN_RF_SETMASK(mac, reg, ~value, (rfatt->padmix ? value :0));
+
+ rxgain = (rfatt->att * 2) + (bbatt->att / 2);
+ if (rfatt->padmix)
+ rxgain -= pad;
+ if (BWN_HAS_LOOPBACK(phy))
+ rxgain += pg->pg_max_lb_gain;
+ bwn_lo_measure_gain_values(mac, rxgain, BWN_HAS_LOOPBACK(phy));
+ bwn_phy_g_set_bbatt(mac, bbatt->att);
+ bwn_lo_probe_sm(mac, &loctl, &rxgain);
+
+ bwn_lo_restore(mac, &sval);
+ bwn_mac_enable(mac);
+
+ cal = malloc(sizeof(*cal), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (!cal) {
+ device_printf(mac->mac_sc->sc_dev, "out of memory\n");
+ return (NULL);
+ }
+ memcpy(&cal->bbatt, bbatt, sizeof(*bbatt));
+ memcpy(&cal->rfatt, rfatt, sizeof(*rfatt));
+ memcpy(&cal->ctl, &loctl, sizeof(loctl));
+
+ BWN_GETTIME(cal->calib_time);
+
+ return (cal);
+}
+
+static struct bwn_lo_calib *
+bwn_lo_get_calib(struct bwn_mac *mac, const struct bwn_bbatt *bbatt,
+ const struct bwn_rfatt *rfatt)
+{
+ struct bwn_txpwr_loctl *lo = &mac->mac_phy.phy_g.pg_loctl;
+ struct bwn_lo_calib *c;
+
+ TAILQ_FOREACH(c, &lo->calib_list, list) {
+ if (!BWN_BBATTCMP(&c->bbatt, bbatt))
+ continue;
+ if (!BWN_RFATTCMP(&c->rfatt, rfatt))
+ continue;
+ return (c);
+ }
+
+ c = bwn_lo_calibset(mac, bbatt, rfatt);
+ if (!c)
+ return (NULL);
+ TAILQ_INSERT_TAIL(&lo->calib_list, c, list);
+
+ return (c);
+}
+
+static void
+bwn_phy_g_dc_lookup_init(struct bwn_mac *mac, uint8_t update)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ const struct bwn_rfatt *rfatt;
+ const struct bwn_bbatt *bbatt;
+ uint64_t pvector;
+ int i;
+ int rf_offset, bb_offset;
+ uint8_t changed = 0;
+
+ KASSERT(BWN_DC_LT_SIZE == 32, ("%s:%d: fail", __func__, __LINE__));
+ KASSERT(lo->rfatt.len * lo->bbatt.len <= 64,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ pvector = lo->power_vector;
+ if (!update && !pvector)
+ return;
+
+ bwn_mac_suspend(mac);
+
+ for (i = 0; i < BWN_DC_LT_SIZE * 2; i++) {
+ struct bwn_lo_calib *cal;
+ int idx;
+ uint16_t val;
+
+ if (!update && !(pvector & (((uint64_t)1ULL) << i)))
+ continue;
+ bb_offset = i / lo->rfatt.len;
+ rf_offset = i % lo->rfatt.len;
+ bbatt = &(lo->bbatt.array[bb_offset]);
+ rfatt = &(lo->rfatt.array[rf_offset]);
+
+ cal = bwn_lo_calibset(mac, bbatt, rfatt);
+ if (!cal) {
+ device_printf(sc->sc_dev, "LO: Could not "
+ "calibrate DC table entry\n");
+ continue;
+ }
+ val = (uint8_t)(cal->ctl.q);
+ val |= ((uint8_t)(cal->ctl.i)) << 4;
+ free(cal, M_DEVBUF);
+
+ idx = i / 2;
+ if (i % 2)
+ lo->dc_lt[idx] = (lo->dc_lt[idx] & 0x00ff)
+ | ((val & 0x00ff) << 8);
+ else
+ lo->dc_lt[idx] = (lo->dc_lt[idx] & 0xff00)
+ | (val & 0x00ff);
+ changed = 1;
+ }
+ if (changed) {
+ for (i = 0; i < BWN_DC_LT_SIZE; i++)
+ BWN_PHY_WRITE(mac, 0x3a0 + i, lo->dc_lt[i]);
+ }
+ bwn_mac_enable(mac);
+}
+
+static void
+bwn_lo_fixup_rfatt(struct bwn_rfatt *rf)
+{
+
+ if (!rf->padmix)
+ return;
+ if ((rf->att != 1) && (rf->att != 2) && (rf->att != 3))
+ rf->att = 4;
+}
+
+static void
+bwn_lo_g_adjust(struct bwn_mac *mac)
+{
+ struct bwn_phy_g *pg = &mac->mac_phy.phy_g;
+ struct bwn_lo_calib *cal;
+ struct bwn_rfatt rf;
+
+ memcpy(&rf, &pg->pg_rfatt, sizeof(rf));
+ bwn_lo_fixup_rfatt(&rf);
+
+ cal = bwn_lo_get_calib(mac, &pg->pg_bbatt, &rf);
+ if (!cal)
+ return;
+ bwn_lo_write(mac, &cal->ctl);
+}
+
+static void
+bwn_lo_g_init(struct bwn_mac *mac)
+{
+
+ if (!bwn_has_hwpctl(mac))
+ return;
+
+ bwn_lo_get_powervector(mac);
+ bwn_phy_g_dc_lookup_init(mac, 1);
+}
+
+static int16_t
+bwn_nrssi_read(struct bwn_mac *mac, uint16_t offset)
+{
+
+ BWN_PHY_WRITE(mac, BWN_PHY_NRSSI_CTRL, offset);
+ return ((int16_t)BWN_PHY_READ(mac, BWN_PHY_NRSSI_DATA));
+}
+
+static void
+bwn_nrssi_threshold(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ int32_t a, b;
+ int16_t tmp16;
+ uint16_t tmpu16;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G, ("%s: fail", __func__));
+
+ if (phy->gmode && (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_RSSI)) {
+ if (!pg->pg_aci_wlan_automatic && pg->pg_aci_enable) {
+ a = 0x13;
+ b = 0x12;
+ } else {
+ a = 0xe;
+ b = 0x11;
+ }
+
+ a = a * (pg->pg_nrssi[1] - pg->pg_nrssi[0]);
+ a += (pg->pg_nrssi[0] << 6);
+ a += (a < 32) ? 31 : 32;
+ a = a >> 6;
+ a = MIN(MAX(a, -31), 31);
+
+ b = b * (pg->pg_nrssi[1] - pg->pg_nrssi[0]);
+ b += (pg->pg_nrssi[0] << 6);
+ if (b < 32)
+ b += 31;
+ else
+ b += 32;
+ b = b >> 6;
+ b = MIN(MAX(b, -31), 31);
+
+ tmpu16 = BWN_PHY_READ(mac, 0x048a) & 0xf000;
+ tmpu16 |= ((uint32_t)b & 0x0000003f);
+ tmpu16 |= (((uint32_t)a & 0x0000003f) << 6);
+ BWN_PHY_WRITE(mac, 0x048a, tmpu16);
+ return;
+ }
+
+ tmp16 = bwn_nrssi_read(mac, 0x20);
+ if (tmp16 >= 0x20)
+ tmp16 -= 0x40;
+ BWN_PHY_SETMASK(mac, 0x048a, 0xf000, (tmp16 < 3) ? 0x09eb : 0x0aed);
+}
+
+static void
+bwn_nrssi_slope_11g(struct bwn_mac *mac)
+{
+#define SAVE_RF_MAX 3
+#define SAVE_PHY_COMM_MAX 4
+#define SAVE_PHY3_MAX 8
+ static const uint16_t save_rf_regs[SAVE_RF_MAX] =
+ { 0x7a, 0x52, 0x43 };
+ static const uint16_t save_phy_comm_regs[SAVE_PHY_COMM_MAX] =
+ { 0x15, 0x5a, 0x59, 0x58 };
+ static const uint16_t save_phy3_regs[SAVE_PHY3_MAX] = {
+ 0x002e, 0x002f, 0x080f, BWN_PHY_G_LOCTL,
+ 0x0801, 0x0060, 0x0014, 0x0478
+ };
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ int32_t i, tmp32, phy3_idx = 0;
+ uint16_t delta, tmp;
+ uint16_t save_rf[SAVE_RF_MAX];
+ uint16_t save_phy_comm[SAVE_PHY_COMM_MAX];
+ uint16_t save_phy3[SAVE_PHY3_MAX];
+ uint16_t ant_div, phy0, chan_ex;
+ int16_t nrssi0, nrssi1;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ if (phy->rf_rev >= 9)
+ return;
+ if (phy->rf_rev == 8)
+ bwn_nrssi_offset(mac);
+
+ BWN_PHY_MASK(mac, BWN_PHY_G_CRS, 0x7fff);
+ BWN_PHY_MASK(mac, 0x0802, 0xfffc);
+
+ /*
+ * Save RF/PHY registers for later restoration
+ */
+ ant_div = BWN_READ_2(mac, 0x03e2);
+ BWN_WRITE_2(mac, 0x03e2, BWN_READ_2(mac, 0x03e2) | 0x8000);
+ for (i = 0; i < SAVE_RF_MAX; ++i)
+ save_rf[i] = BWN_RF_READ(mac, save_rf_regs[i]);
+ for (i = 0; i < SAVE_PHY_COMM_MAX; ++i)
+ save_phy_comm[i] = BWN_PHY_READ(mac, save_phy_comm_regs[i]);
+
+ phy0 = BWN_READ_2(mac, BWN_PHY0);
+ chan_ex = BWN_READ_2(mac, BWN_CHANNEL_EXT);
+ if (phy->rev >= 3) {
+ for (i = 0; i < SAVE_PHY3_MAX; ++i)
+ save_phy3[i] = BWN_PHY_READ(mac, save_phy3_regs[i]);
+ BWN_PHY_WRITE(mac, 0x002e, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_G_LOCTL, 0);
+ switch (phy->rev) {
+ case 4:
+ case 6:
+ case 7:
+ BWN_PHY_SET(mac, 0x0478, 0x0100);
+ BWN_PHY_SET(mac, 0x0801, 0x0040);
+ break;
+ case 3:
+ case 5:
+ BWN_PHY_MASK(mac, 0x0801, 0xffbf);
+ break;
+ }
+ BWN_PHY_SET(mac, 0x0060, 0x0040);
+ BWN_PHY_SET(mac, 0x0014, 0x0200);
+ }
+ /*
+ * Calculate nrssi0
+ */
+ BWN_RF_SET(mac, 0x007a, 0x0070);
+ bwn_set_all_gains(mac, 0, 8, 0);
+ BWN_RF_MASK(mac, 0x007a, 0x00f7);
+ if (phy->rev >= 2) {
+ BWN_PHY_SETMASK(mac, 0x0811, 0xffcf, 0x0030);
+ BWN_PHY_SETMASK(mac, 0x0812, 0xffcf, 0x0010);
+ }
+ BWN_RF_SET(mac, 0x007a, 0x0080);
+ DELAY(20);
+
+ nrssi0 = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
+ if (nrssi0 >= 0x0020)
+ nrssi0 -= 0x0040;
+
+ /*
+ * Calculate nrssi1
+ */
+ BWN_RF_MASK(mac, 0x007a, 0x007f);
+ if (phy->rev >= 2)
+ BWN_PHY_SETMASK(mac, 0x0003, 0xff9f, 0x0040);
+
+ BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
+ BWN_READ_2(mac, BWN_CHANNEL_EXT) | 0x2000);
+ BWN_RF_SET(mac, 0x007a, 0x000f);
+ BWN_PHY_WRITE(mac, 0x0015, 0xf330);
+ if (phy->rev >= 2) {
+ BWN_PHY_SETMASK(mac, 0x0812, 0xffcf, 0x0020);
+ BWN_PHY_SETMASK(mac, 0x0811, 0xffcf, 0x0020);
+ }
+
+ bwn_set_all_gains(mac, 3, 0, 1);
+ if (phy->rf_rev == 8) {
+ BWN_RF_WRITE(mac, 0x0043, 0x001f);
+ } else {
+ tmp = BWN_RF_READ(mac, 0x0052) & 0xff0f;
+ BWN_RF_WRITE(mac, 0x0052, tmp | 0x0060);
+ tmp = BWN_RF_READ(mac, 0x0043) & 0xfff0;
+ BWN_RF_WRITE(mac, 0x0043, tmp | 0x0009);
+ }
+ BWN_PHY_WRITE(mac, 0x005a, 0x0480);
+ BWN_PHY_WRITE(mac, 0x0059, 0x0810);
+ BWN_PHY_WRITE(mac, 0x0058, 0x000d);
+ DELAY(20);
+ nrssi1 = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
+
+ /*
+ * Install calculated narrow RSSI values
+ */
+ if (nrssi1 >= 0x0020)
+ nrssi1 -= 0x0040;
+ if (nrssi0 == nrssi1)
+ pg->pg_nrssi_slope = 0x00010000;
+ else
+ pg->pg_nrssi_slope = 0x00400000 / (nrssi0 - nrssi1);
+ if (nrssi0 >= -4) {
+ pg->pg_nrssi[0] = nrssi1;
+ pg->pg_nrssi[1] = nrssi0;
+ }
+
+ /*
+ * Restore saved RF/PHY registers
+ */
+ if (phy->rev >= 3) {
+ for (phy3_idx = 0; phy3_idx < 4; ++phy3_idx) {
+ BWN_PHY_WRITE(mac, save_phy3_regs[phy3_idx],
+ save_phy3[phy3_idx]);
+ }
+ }
+ if (phy->rev >= 2) {
+ BWN_PHY_MASK(mac, 0x0812, 0xffcf);
+ BWN_PHY_MASK(mac, 0x0811, 0xffcf);
+ }
+
+ for (i = 0; i < SAVE_RF_MAX; ++i)
+ BWN_RF_WRITE(mac, save_rf_regs[i], save_rf[i]);
+
+ BWN_WRITE_2(mac, 0x03e2, ant_div);
+ BWN_WRITE_2(mac, 0x03e6, phy0);
+ BWN_WRITE_2(mac, BWN_CHANNEL_EXT, chan_ex);
+
+ for (i = 0; i < SAVE_PHY_COMM_MAX; ++i)
+ BWN_PHY_WRITE(mac, save_phy_comm_regs[i], save_phy_comm[i]);
+
+ bwn_spu_workaround(mac, phy->chan);
+ BWN_PHY_SET(mac, 0x0802, (0x0001 | 0x0002));
+ bwn_set_original_gains(mac);
+ BWN_PHY_SET(mac, BWN_PHY_G_CRS, 0x8000);
+ if (phy->rev >= 3) {
+ for (; phy3_idx < SAVE_PHY3_MAX; ++phy3_idx) {
+ BWN_PHY_WRITE(mac, save_phy3_regs[phy3_idx],
+ save_phy3[phy3_idx]);
+ }
+ }
+
+ delta = 0x1f - pg->pg_nrssi[0];
+ for (i = 0; i < 64; i++) {
+ tmp32 = (((i - delta) * pg->pg_nrssi_slope) / 0x10000) + 0x3a;
+ tmp32 = MIN(MAX(tmp32, 0), 0x3f);
+ pg->pg_nrssi_lt[i] = tmp32;
+ }
+
+ bwn_nrssi_threshold(mac);
+#undef SAVE_RF_MAX
+#undef SAVE_PHY_COMM_MAX
+#undef SAVE_PHY3_MAX
+}
+
+static void
+bwn_nrssi_offset(struct bwn_mac *mac)
+{
+#define SAVE_RF_MAX 2
+#define SAVE_PHY_COMM_MAX 10
+#define SAVE_PHY6_MAX 8
+ static const uint16_t save_rf_regs[SAVE_RF_MAX] =
+ { 0x7a, 0x43 };
+ static const uint16_t save_phy_comm_regs[SAVE_PHY_COMM_MAX] = {
+ 0x0001, 0x0811, 0x0812, 0x0814,
+ 0x0815, 0x005a, 0x0059, 0x0058,
+ 0x000a, 0x0003
+ };
+ static const uint16_t save_phy6_regs[SAVE_PHY6_MAX] = {
+ 0x002e, 0x002f, 0x080f, 0x0810,
+ 0x0801, 0x0060, 0x0014, 0x0478
+ };
+ struct bwn_phy *phy = &mac->mac_phy;
+ int i, phy6_idx = 0;
+ uint16_t save_rf[SAVE_RF_MAX];
+ uint16_t save_phy_comm[SAVE_PHY_COMM_MAX];
+ uint16_t save_phy6[SAVE_PHY6_MAX];
+ int16_t nrssi;
+ uint16_t saved = 0xffff;
+
+ for (i = 0; i < SAVE_PHY_COMM_MAX; ++i)
+ save_phy_comm[i] = BWN_PHY_READ(mac, save_phy_comm_regs[i]);
+ for (i = 0; i < SAVE_RF_MAX; ++i)
+ save_rf[i] = BWN_RF_READ(mac, save_rf_regs[i]);
+
+ BWN_PHY_MASK(mac, 0x0429, 0x7fff);
+ BWN_PHY_SETMASK(mac, 0x0001, 0x3fff, 0x4000);
+ BWN_PHY_SET(mac, 0x0811, 0x000c);
+ BWN_PHY_SETMASK(mac, 0x0812, 0xfff3, 0x0004);
+ BWN_PHY_MASK(mac, 0x0802, ~(0x1 | 0x2));
+ if (phy->rev >= 6) {
+ for (i = 0; i < SAVE_PHY6_MAX; ++i)
+ save_phy6[i] = BWN_PHY_READ(mac, save_phy6_regs[i]);
+
+ BWN_PHY_WRITE(mac, 0x002e, 0);
+ BWN_PHY_WRITE(mac, 0x002f, 0);
+ BWN_PHY_WRITE(mac, 0x080f, 0);
+ BWN_PHY_WRITE(mac, 0x0810, 0);
+ BWN_PHY_SET(mac, 0x0478, 0x0100);
+ BWN_PHY_SET(mac, 0x0801, 0x0040);
+ BWN_PHY_SET(mac, 0x0060, 0x0040);
+ BWN_PHY_SET(mac, 0x0014, 0x0200);
+ }
+ BWN_RF_SET(mac, 0x007a, 0x0070);
+ BWN_RF_SET(mac, 0x007a, 0x0080);
+ DELAY(30);
+
+ nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
+ if (nrssi >= 0x20)
+ nrssi -= 0x40;
+ if (nrssi == 31) {
+ for (i = 7; i >= 4; i--) {
+ BWN_RF_WRITE(mac, 0x007b, i);
+ DELAY(20);
+ nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) &
+ 0x003f);
+ if (nrssi >= 0x20)
+ nrssi -= 0x40;
+ if (nrssi < 31 && saved == 0xffff)
+ saved = i;
+ }
+ if (saved == 0xffff)
+ saved = 4;
+ } else {
+ BWN_RF_MASK(mac, 0x007a, 0x007f);
+ if (phy->rev != 1) {
+ BWN_PHY_SET(mac, 0x0814, 0x0001);
+ BWN_PHY_MASK(mac, 0x0815, 0xfffe);
+ }
+ BWN_PHY_SET(mac, 0x0811, 0x000c);
+ BWN_PHY_SET(mac, 0x0812, 0x000c);
+ BWN_PHY_SET(mac, 0x0811, 0x0030);
+ BWN_PHY_SET(mac, 0x0812, 0x0030);
+ BWN_PHY_WRITE(mac, 0x005a, 0x0480);
+ BWN_PHY_WRITE(mac, 0x0059, 0x0810);
+ BWN_PHY_WRITE(mac, 0x0058, 0x000d);
+ if (phy->rev == 0)
+ BWN_PHY_WRITE(mac, 0x0003, 0x0122);
+ else
+ BWN_PHY_SET(mac, 0x000a, 0x2000);
+ if (phy->rev != 1) {
+ BWN_PHY_SET(mac, 0x0814, 0x0004);
+ BWN_PHY_MASK(mac, 0x0815, 0xfffb);
+ }
+ BWN_PHY_SETMASK(mac, 0x0003, 0xff9f, 0x0040);
+ BWN_RF_SET(mac, 0x007a, 0x000f);
+ bwn_set_all_gains(mac, 3, 0, 1);
+ BWN_RF_SETMASK(mac, 0x0043, 0x00f0, 0x000f);
+ DELAY(30);
+ nrssi = (int16_t) ((BWN_PHY_READ(mac, 0x047f) >> 8) & 0x003f);
+ if (nrssi >= 0x20)
+ nrssi -= 0x40;
+ if (nrssi == -32) {
+ for (i = 0; i < 4; i++) {
+ BWN_RF_WRITE(mac, 0x007b, i);
+ DELAY(20);
+ nrssi = (int16_t)((BWN_PHY_READ(mac,
+ 0x047f) >> 8) & 0x003f);
+ if (nrssi >= 0x20)
+ nrssi -= 0x40;
+ if (nrssi > -31 && saved == 0xffff)
+ saved = i;
+ }
+ if (saved == 0xffff)
+ saved = 3;
+ } else
+ saved = 0;
+ }
+ BWN_RF_WRITE(mac, 0x007b, saved);
+
+ /*
+ * Restore saved RF/PHY registers
+ */
+ if (phy->rev >= 6) {
+ for (phy6_idx = 0; phy6_idx < 4; ++phy6_idx) {
+ BWN_PHY_WRITE(mac, save_phy6_regs[phy6_idx],
+ save_phy6[phy6_idx]);
+ }
+ }
+ if (phy->rev != 1) {
+ for (i = 3; i < 5; i++)
+ BWN_PHY_WRITE(mac, save_phy_comm_regs[i],
+ save_phy_comm[i]);
+ }
+ for (i = 5; i < SAVE_PHY_COMM_MAX; i++)
+ BWN_PHY_WRITE(mac, save_phy_comm_regs[i], save_phy_comm[i]);
+
+ for (i = SAVE_RF_MAX - 1; i >= 0; --i)
+ BWN_RF_WRITE(mac, save_rf_regs[i], save_rf[i]);
+
+ BWN_PHY_WRITE(mac, 0x0802, BWN_PHY_READ(mac, 0x0802) | 0x1 | 0x2);
+ BWN_PHY_SET(mac, 0x0429, 0x8000);
+ bwn_set_original_gains(mac);
+ if (phy->rev >= 6) {
+ for (; phy6_idx < SAVE_PHY6_MAX; ++phy6_idx) {
+ BWN_PHY_WRITE(mac, save_phy6_regs[phy6_idx],
+ save_phy6[phy6_idx]);
+ }
+ }
+
+ BWN_PHY_WRITE(mac, save_phy_comm_regs[0], save_phy_comm[0]);
+ BWN_PHY_WRITE(mac, save_phy_comm_regs[2], save_phy_comm[2]);
+ BWN_PHY_WRITE(mac, save_phy_comm_regs[1], save_phy_comm[1]);
+}
+
+static void
+bwn_set_all_gains(struct bwn_mac *mac, int16_t first, int16_t second,
+ int16_t third)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ uint16_t i;
+ uint16_t start = 0x08, end = 0x18;
+ uint16_t tmp;
+ uint16_t table;
+
+ if (phy->rev <= 1) {
+ start = 0x10;
+ end = 0x20;
+ }
+
+ table = BWN_OFDMTAB_GAINX;
+ if (phy->rev <= 1)
+ table = BWN_OFDMTAB_GAINX_R1;
+ for (i = 0; i < 4; i++)
+ bwn_ofdmtab_write_2(mac, table, i, first);
+
+ for (i = start; i < end; i++)
+ bwn_ofdmtab_write_2(mac, table, i, second);
+
+ if (third != -1) {
+ tmp = ((uint16_t) third << 14) | ((uint16_t) third << 6);
+ BWN_PHY_SETMASK(mac, 0x04a0, 0xbfbf, tmp);
+ BWN_PHY_SETMASK(mac, 0x04a1, 0xbfbf, tmp);
+ BWN_PHY_SETMASK(mac, 0x04a2, 0xbfbf, tmp);
+ }
+ bwn_dummy_transmission(mac, 0, 1);
+}
+
+static void
+bwn_set_original_gains(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ uint16_t i, tmp;
+ uint16_t table;
+ uint16_t start = 0x0008, end = 0x0018;
+
+ if (phy->rev <= 1) {
+ start = 0x0010;
+ end = 0x0020;
+ }
+
+ table = BWN_OFDMTAB_GAINX;
+ if (phy->rev <= 1)
+ table = BWN_OFDMTAB_GAINX_R1;
+ for (i = 0; i < 4; i++) {
+ tmp = (i & 0xfffc);
+ tmp |= (i & 0x0001) << 1;
+ tmp |= (i & 0x0002) >> 1;
+
+ bwn_ofdmtab_write_2(mac, table, i, tmp);
+ }
+
+ for (i = start; i < end; i++)
+ bwn_ofdmtab_write_2(mac, table, i, i - start);
+
+ BWN_PHY_SETMASK(mac, 0x04a0, 0xbfbf, 0x4040);
+ BWN_PHY_SETMASK(mac, 0x04a1, 0xbfbf, 0x4040);
+ BWN_PHY_SETMASK(mac, 0x04a2, 0xbfbf, 0x4000);
+ bwn_dummy_transmission(mac, 0, 1);
+}
+
+static void
+bwn_phy_hwpctl_init(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_rfatt old_rfatt, rfatt;
+ struct bwn_bbatt old_bbatt, bbatt;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint8_t old_txctl = 0;
+
+ KASSERT(phy->type == BWN_PHYTYPE_G,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ if ((siba_get_pci_subvendor(sc->sc_dev) == SIBA_BOARDVENDOR_BCM) &&
+ (siba_get_pci_subdevice(sc->sc_dev) == SIBA_BOARD_BU4306))
+ return;
+
+ BWN_PHY_WRITE(mac, 0x0028, 0x8018);
+
+ BWN_WRITE_2(mac, BWN_PHY0, BWN_READ_2(mac, BWN_PHY0) & 0xffdf);
+
+ if (!phy->gmode)
+ return;
+ bwn_hwpctl_early_init(mac);
+ if (pg->pg_curtssi == 0) {
+ if (phy->rf_ver == 0x2050 && phy->analog == 0) {
+ BWN_RF_SETMASK(mac, 0x0076, 0x00f7, 0x0084);
+ } else {
+ memcpy(&old_rfatt, &pg->pg_rfatt, sizeof(old_rfatt));
+ memcpy(&old_bbatt, &pg->pg_bbatt, sizeof(old_bbatt));
+ old_txctl = pg->pg_txctl;
+
+ bbatt.att = 11;
+ if (phy->rf_rev == 8) {
+ rfatt.att = 15;
+ rfatt.padmix = 1;
+ } else {
+ rfatt.att = 9;
+ rfatt.padmix = 0;
+ }
+ bwn_phy_g_set_txpwr_sub(mac, &bbatt, &rfatt, 0);
+ }
+ bwn_dummy_transmission(mac, 0, 1);
+ pg->pg_curtssi = BWN_PHY_READ(mac, BWN_PHY_TSSI);
+ if (phy->rf_ver == 0x2050 && phy->analog == 0)
+ BWN_RF_MASK(mac, 0x0076, 0xff7b);
+ else
+ bwn_phy_g_set_txpwr_sub(mac, &old_bbatt,
+ &old_rfatt, old_txctl);
+ }
+ bwn_hwpctl_init_gphy(mac);
+
+ /* clear TSSI */
+ bwn_shm_write_2(mac, BWN_SHARED, 0x0058, 0x7f7f);
+ bwn_shm_write_2(mac, BWN_SHARED, 0x005a, 0x7f7f);
+ bwn_shm_write_2(mac, BWN_SHARED, 0x0070, 0x7f7f);
+ bwn_shm_write_2(mac, BWN_SHARED, 0x0072, 0x7f7f);
+}
+
+static void
+bwn_hwpctl_early_init(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+
+ if (!bwn_has_hwpctl(mac)) {
+ BWN_PHY_WRITE(mac, 0x047a, 0xc111);
+ return;
+ }
+
+ BWN_PHY_MASK(mac, 0x0036, 0xfeff);
+ BWN_PHY_WRITE(mac, 0x002f, 0x0202);
+ BWN_PHY_SET(mac, 0x047c, 0x0002);
+ BWN_PHY_SET(mac, 0x047a, 0xf000);
+ if (phy->rf_ver == 0x2050 && phy->rf_rev == 8) {
+ BWN_PHY_SETMASK(mac, 0x047a, 0xff0f, 0x0010);
+ BWN_PHY_SET(mac, 0x005d, 0x8000);
+ BWN_PHY_SETMASK(mac, 0x004e, 0xffc0, 0x0010);
+ BWN_PHY_WRITE(mac, 0x002e, 0xc07f);
+ BWN_PHY_SET(mac, 0x0036, 0x0400);
+ } else {
+ BWN_PHY_SET(mac, 0x0036, 0x0200);
+ BWN_PHY_SET(mac, 0x0036, 0x0400);
+ BWN_PHY_MASK(mac, 0x005d, 0x7fff);
+ BWN_PHY_MASK(mac, 0x004f, 0xfffe);
+ BWN_PHY_SETMASK(mac, 0x004e, 0xffc0, 0x0010);
+ BWN_PHY_WRITE(mac, 0x002e, 0xc07f);
+ BWN_PHY_SETMASK(mac, 0x047a, 0xff0f, 0x0010);
+ }
+}
+
+static void
+bwn_hwpctl_init_gphy(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ int i;
+ uint16_t nr_written = 0, tmp, value;
+ uint8_t rf, bb;
+
+ if (!bwn_has_hwpctl(mac)) {
+ bwn_hf_write(mac, bwn_hf_read(mac) & ~BWN_HF_HW_POWERCTL);
+ return;
+ }
+
+ BWN_PHY_SETMASK(mac, 0x0036, 0xffc0,
+ (pg->pg_idletssi - pg->pg_curtssi));
+ BWN_PHY_SETMASK(mac, 0x0478, 0xff00,
+ (pg->pg_idletssi - pg->pg_curtssi));
+
+ for (i = 0; i < 32; i++)
+ bwn_ofdmtab_write_2(mac, 0x3c20, i, pg->pg_tssi2dbm[i]);
+ for (i = 32; i < 64; i++)
+ bwn_ofdmtab_write_2(mac, 0x3c00, i - 32, pg->pg_tssi2dbm[i]);
+ for (i = 0; i < 64; i += 2) {
+ value = (uint16_t) pg->pg_tssi2dbm[i];
+ value |= ((uint16_t) pg->pg_tssi2dbm[i + 1]) << 8;
+ BWN_PHY_WRITE(mac, 0x380 + (i / 2), value);
+ }
+
+ for (rf = 0; rf < lo->rfatt.len; rf++) {
+ for (bb = 0; bb < lo->bbatt.len; bb++) {
+ if (nr_written >= 0x40)
+ return;
+ tmp = lo->bbatt.array[bb].att;
+ tmp <<= 8;
+ if (phy->rf_rev == 8)
+ tmp |= 0x50;
+ else
+ tmp |= 0x40;
+ tmp |= lo->rfatt.array[rf].att;
+ BWN_PHY_WRITE(mac, 0x3c0 + nr_written, tmp);
+ nr_written++;
+ }
+ }
+
+ BWN_PHY_MASK(mac, 0x0060, 0xffbf);
+ BWN_PHY_WRITE(mac, 0x0014, 0x0000);
+
+ KASSERT(phy->rev >= 6, ("%s:%d: fail", __func__, __LINE__));
+ BWN_PHY_SET(mac, 0x0478, 0x0800);
+ BWN_PHY_MASK(mac, 0x0478, 0xfeff);
+ BWN_PHY_MASK(mac, 0x0801, 0xffbf);
+
+ bwn_phy_g_dc_lookup_init(mac, 1);
+ bwn_hf_write(mac, bwn_hf_read(mac) | BWN_HF_HW_POWERCTL);
+}
+
+static void
+bwn_phy_g_switch_chan(struct bwn_mac *mac, int channel, uint8_t spu)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+
+ if (spu != 0)
+ bwn_spu_workaround(mac, channel);
+
+ BWN_WRITE_2(mac, BWN_CHANNEL, bwn_phy_g_chan2freq(channel));
+
+ if (channel == 14) {
+ if (siba_sprom_get_ccode(sc->sc_dev) == SIBA_CCODE_JAPAN)
+ bwn_hf_write(mac,
+ bwn_hf_read(mac) & ~BWN_HF_JAPAN_CHAN14_OFF);
+ else
+ bwn_hf_write(mac,
+ bwn_hf_read(mac) | BWN_HF_JAPAN_CHAN14_OFF);
+ BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
+ BWN_READ_2(mac, BWN_CHANNEL_EXT) | (1 << 11));
+ return;
+ }
+
+ BWN_WRITE_2(mac, BWN_CHANNEL_EXT,
+ BWN_READ_2(mac, BWN_CHANNEL_EXT) & 0xf7bf);
+}
+
+static uint16_t
+bwn_phy_g_chan2freq(uint8_t channel)
+{
+ static const uint8_t bwn_phy_g_rf_channels[] = BWN_PHY_G_RF_CHANNELS;
+
+ KASSERT(channel >= 1 && channel <= 14,
+ ("%s:%d: fail", __func__, __LINE__));
+
+ return (bwn_phy_g_rf_channels[channel - 1]);
+}
+
+static void
+bwn_phy_g_set_txpwr_sub(struct bwn_mac *mac, const struct bwn_bbatt *bbatt,
+ const struct bwn_rfatt *rfatt, uint8_t txctl)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_txpwr_loctl *lo = &pg->pg_loctl;
+ uint16_t bb, rf;
+ uint16_t tx_bias, tx_magn;
+
+ bb = bbatt->att;
+ rf = rfatt->att;
+ tx_bias = lo->tx_bias;
+ tx_magn = lo->tx_magn;
+ if (tx_bias == 0xff)
+ tx_bias = 0;
+
+ pg->pg_txctl = txctl;
+ memmove(&pg->pg_rfatt, rfatt, sizeof(*rfatt));
+ pg->pg_rfatt.padmix = (txctl & BWN_TXCTL_TXMIX) ? 1 : 0;
+ memmove(&pg->pg_bbatt, bbatt, sizeof(*bbatt));
+ bwn_phy_g_set_bbatt(mac, bb);
+ bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_RADIO_ATT, rf);
+ if (phy->rf_ver == 0x2050 && phy->rf_rev == 8)
+ BWN_RF_WRITE(mac, 0x43, (rf & 0x000f) | (txctl & 0x0070));
+ else {
+ BWN_RF_SETMASK(mac, 0x43, 0xfff0, (rf & 0x000f));
+ BWN_RF_SETMASK(mac, 0x52, ~0x0070, (txctl & 0x0070));
+ }
+ if (BWN_HAS_TXMAG(phy))
+ BWN_RF_WRITE(mac, 0x52, tx_magn | tx_bias);
+ else
+ BWN_RF_SETMASK(mac, 0x52, 0xfff0, (tx_bias & 0x000f));
+ bwn_lo_g_adjust(mac);
+}
+
+static void
+bwn_phy_g_set_bbatt(struct bwn_mac *mac,
+ uint16_t bbatt)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+
+ if (phy->analog == 0) {
+ BWN_WRITE_2(mac, BWN_PHY0,
+ (BWN_READ_2(mac, BWN_PHY0) & 0xfff0) | bbatt);
+ return;
+ }
+ if (phy->analog > 1) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_DACCTL, 0xffc3, bbatt << 2);
+ return;
+ }
+ BWN_PHY_SETMASK(mac, BWN_PHY_DACCTL, 0xff87, bbatt << 3);
+}
+
+static uint16_t
+bwn_rf_2050_rfoverval(struct bwn_mac *mac, uint16_t reg, uint32_t lpd)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_g *pg = &phy->phy_g;
+ struct bwn_softc *sc = mac->mac_sc;
+ int max_lb_gain;
+ uint16_t extlna;
+ uint16_t i;
+
+ if (phy->gmode == 0)
+ return (0);
+
+ if (BWN_HAS_LOOPBACK(phy)) {
+ max_lb_gain = pg->pg_max_lb_gain;
+ max_lb_gain += (phy->rf_rev == 8) ? 0x3e : 0x26;
+ if (max_lb_gain >= 0x46) {
+ extlna = 0x3000;
+ max_lb_gain -= 0x46;
+ } else if (max_lb_gain >= 0x3a) {
+ extlna = 0x1000;
+ max_lb_gain -= 0x3a;
+ } else if (max_lb_gain >= 0x2e) {
+ extlna = 0x2000;
+ max_lb_gain -= 0x2e;
+ } else {
+ extlna = 0;
+ max_lb_gain -= 0x10;
+ }
+
+ for (i = 0; i < 16; i++) {
+ max_lb_gain -= (i * 6);
+ if (max_lb_gain < 6)
+ break;
+ }
+
+ if ((phy->rev < 7) ||
+ !(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA)) {
+ if (reg == BWN_PHY_RFOVER) {
+ return (0x1b3);
+ } else if (reg == BWN_PHY_RFOVERVAL) {
+ extlna |= (i << 8);
+ switch (lpd) {
+ case BWN_LPD(0, 1, 1):
+ return (0x0f92);
+ case BWN_LPD(0, 0, 1):
+ case BWN_LPD(1, 0, 1):
+ return (0x0092 | extlna);
+ case BWN_LPD(1, 0, 0):
+ return (0x0093 | extlna);
+ }
+ KASSERT(0 == 1,
+ ("%s:%d: fail", __func__, __LINE__));
+ }
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ } else {
+ if (reg == BWN_PHY_RFOVER)
+ return (0x9b3);
+ if (reg == BWN_PHY_RFOVERVAL) {
+ if (extlna)
+ extlna |= 0x8000;
+ extlna |= (i << 8);
+ switch (lpd) {
+ case BWN_LPD(0, 1, 1):
+ return (0x8f92);
+ case BWN_LPD(0, 0, 1):
+ return (0x8092 | extlna);
+ case BWN_LPD(1, 0, 1):
+ return (0x2092 | extlna);
+ case BWN_LPD(1, 0, 0):
+ return (0x2093 | extlna);
+ }
+ KASSERT(0 == 1,
+ ("%s:%d: fail", __func__, __LINE__));
+ }
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+ return (0);
+ }
+
+ if ((phy->rev < 7) ||
+ !(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA)) {
+ if (reg == BWN_PHY_RFOVER) {
+ return (0x1b3);
+ } else if (reg == BWN_PHY_RFOVERVAL) {
+ switch (lpd) {
+ case BWN_LPD(0, 1, 1):
+ return (0x0fb2);
+ case BWN_LPD(0, 0, 1):
+ return (0x00b2);
+ case BWN_LPD(1, 0, 1):
+ return (0x30b2);
+ case BWN_LPD(1, 0, 0):
+ return (0x30b3);
+ }
+ KASSERT(0 == 1,
+ ("%s:%d: fail", __func__, __LINE__));
+ }
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ } else {
+ if (reg == BWN_PHY_RFOVER) {
+ return (0x9b3);
+ } else if (reg == BWN_PHY_RFOVERVAL) {
+ switch (lpd) {
+ case BWN_LPD(0, 1, 1):
+ return (0x8fb2);
+ case BWN_LPD(0, 0, 1):
+ return (0x80b2);
+ case BWN_LPD(1, 0, 1):
+ return (0x20b2);
+ case BWN_LPD(1, 0, 0):
+ return (0x20b3);
+ }
+ KASSERT(0 == 1,
+ ("%s:%d: fail", __func__, __LINE__));
+ }
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+ return (0);
+}
+
+static void
+bwn_spu_workaround(struct bwn_mac *mac, uint8_t channel)
+{
+
+ if (mac->mac_phy.rf_ver != 0x2050 || mac->mac_phy.rf_rev >= 6)
+ return;
+ BWN_WRITE_2(mac, BWN_CHANNEL, (channel <= 10) ?
+ bwn_phy_g_chan2freq(channel + 4) : bwn_phy_g_chan2freq(1));
+ DELAY(1000);
+ BWN_WRITE_2(mac, BWN_CHANNEL, bwn_phy_g_chan2freq(channel));
+}
+
+static int
+bwn_phy_shm_tssi_read(struct bwn_mac *mac, uint16_t shm_offset)
+{
+ const uint8_t ofdm = (shm_offset != BWN_SHARED_TSSI_CCK);
+ unsigned int a, b, c, d;
+ unsigned int avg;
+ uint32_t tmp;
+
+ tmp = bwn_shm_read_4(mac, BWN_SHARED, shm_offset);
+ a = tmp & 0xff;
+ b = (tmp >> 8) & 0xff;
+ c = (tmp >> 16) & 0xff;
+ d = (tmp >> 24) & 0xff;
+ if (a == 0 || a == BWN_TSSI_MAX || b == 0 || b == BWN_TSSI_MAX ||
+ c == 0 || c == BWN_TSSI_MAX || d == 0 || d == BWN_TSSI_MAX)
+ return (ENOENT);
+ bwn_shm_write_4(mac, BWN_SHARED, shm_offset,
+ BWN_TSSI_MAX | (BWN_TSSI_MAX << 8) |
+ (BWN_TSSI_MAX << 16) | (BWN_TSSI_MAX << 24));
+
+ if (ofdm) {
+ a = (a + 32) & 0x3f;
+ b = (b + 32) & 0x3f;
+ c = (c + 32) & 0x3f;
+ d = (d + 32) & 0x3f;
+ }
+
+ avg = (a + b + c + d + 2) / 4;
+ if (ofdm) {
+ if (bwn_shm_read_2(mac, BWN_SHARED, BWN_SHARED_HFLO)
+ & BWN_HF_4DB_CCK_POWERBOOST)
+ avg = (avg >= 13) ? (avg - 13) : 0;
+ }
+ return (avg);
+}
+
+static void
+bwn_phy_g_setatt(struct bwn_mac *mac, int *bbattp, int *rfattp)
+{
+ struct bwn_txpwr_loctl *lo = &mac->mac_phy.phy_g.pg_loctl;
+ int rfatt = *rfattp;
+ int bbatt = *bbattp;
+
+ while (1) {
+ if (rfatt > lo->rfatt.max && bbatt > lo->bbatt.max - 4)
+ break;
+ if (rfatt < lo->rfatt.min && bbatt < lo->bbatt.min + 4)
+ break;
+ if (bbatt > lo->bbatt.max && rfatt > lo->rfatt.max - 1)
+ break;
+ if (bbatt < lo->bbatt.min && rfatt < lo->rfatt.min + 1)
+ break;
+ if (bbatt > lo->bbatt.max) {
+ bbatt -= 4;
+ rfatt += 1;
+ continue;
+ }
+ if (bbatt < lo->bbatt.min) {
+ bbatt += 4;
+ rfatt -= 1;
+ continue;
+ }
+ if (rfatt > lo->rfatt.max) {
+ rfatt -= 1;
+ bbatt += 4;
+ continue;
+ }
+ if (rfatt < lo->rfatt.min) {
+ rfatt += 1;
+ bbatt -= 4;
+ continue;
+ }
+ break;
+ }
+
+ *rfattp = MIN(MAX(rfatt, lo->rfatt.min), lo->rfatt.max);
+ *bbattp = MIN(MAX(bbatt, lo->bbatt.min), lo->bbatt.max);
+}
+
+static void
+bwn_phy_lock(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ KASSERT(siba_get_revid(sc->sc_dev) >= 3,
+ ("%s: unsupported rev %d", __func__, siba_get_revid(sc->sc_dev)));
+
+ if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+ bwn_psctl(mac, BWN_PS_AWAKE);
+}
+
+static void
+bwn_phy_unlock(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ KASSERT(siba_get_revid(sc->sc_dev) >= 3,
+ ("%s: unsupported rev %d", __func__, siba_get_revid(sc->sc_dev)));
+
+ if (ic->ic_opmode != IEEE80211_M_HOSTAP)
+ bwn_psctl(mac, 0);
+}
+
+static void
+bwn_rf_lock(struct bwn_mac *mac)
+{
+
+ BWN_WRITE_4(mac, BWN_MACCTL,
+ BWN_READ_4(mac, BWN_MACCTL) | BWN_MACCTL_RADIO_LOCK);
+ BWN_READ_4(mac, BWN_MACCTL);
+ DELAY(10);
+}
+
+static void
+bwn_rf_unlock(struct bwn_mac *mac)
+{
+
+ BWN_READ_2(mac, BWN_PHYVER);
+ BWN_WRITE_4(mac, BWN_MACCTL,
+ BWN_READ_4(mac, BWN_MACCTL) & ~BWN_MACCTL_RADIO_LOCK);
+}
diff --git a/sys/dev/bwn/if_bwn_phy_g.h b/sys/dev/bwn/if_bwn_phy_g.h
new file mode 100644
index 0000000..2de14e8
--- /dev/null
+++ b/sys/dev/bwn/if_bwn_phy_g.h
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __IF_BWN_PHY_G_H__
+#define __IF_BWN_PHY_G_H__
+
+extern int bwn_phy_g_attach(struct bwn_mac *mac);
+extern void bwn_phy_g_detach(struct bwn_mac *mac);
+extern int bwn_phy_g_prepare_hw(struct bwn_mac *mac);
+extern void bwn_phy_g_init_pre(struct bwn_mac *mac);
+extern int bwn_phy_g_init(struct bwn_mac *mac);
+extern void bwn_phy_g_exit(struct bwn_mac *mac);
+extern uint16_t bwn_phy_g_read(struct bwn_mac *mac, uint16_t reg);
+extern void bwn_phy_g_write(struct bwn_mac *mac, uint16_t reg, uint16_t value);
+extern uint16_t bwn_phy_g_rf_read(struct bwn_mac *mac, uint16_t reg);
+extern void bwn_phy_g_rf_write(struct bwn_mac *mac, uint16_t reg, uint16_t value);
+extern int bwn_phy_g_hwpctl(struct bwn_mac *mac);
+extern void bwn_phy_g_rf_onoff(struct bwn_mac *mac, int on);
+extern void bwn_phy_switch_analog(struct bwn_mac *mac, int on);
+extern int bwn_phy_g_switch_channel(struct bwn_mac *mac, uint32_t newchan);
+extern uint32_t bwn_phy_g_get_default_chan(struct bwn_mac *mac);
+extern void bwn_phy_g_set_antenna(struct bwn_mac *mac, int antenna);
+extern int bwn_phy_g_im(struct bwn_mac *mac, int mode);
+extern int bwn_phy_g_recalc_txpwr(struct bwn_mac *mac, int ignore_tssi);
+extern void bwn_phy_g_set_txpwr(struct bwn_mac *mac);
+extern void bwn_phy_g_task_15s(struct bwn_mac *mac);
+extern void bwn_phy_g_task_60s(struct bwn_mac *mac);
+
+#endif /* __IF_BWN_PHY_G_H__ */
diff --git a/sys/dev/bwn/if_bwn_phy_lp.c b/sys/dev/bwn/if_bwn_phy_lp.c
new file mode 100644
index 0000000..d53a2dd
--- /dev/null
+++ b/sys/dev/bwn/if_bwn_phy_lp.c
@@ -0,0 +1,3707 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * The Broadcom Wireless LAN controller driver.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/module.h>
+#include <sys/endian.h>
+#include <sys/errno.h>
+#include <sys/firmware.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_arp.h>
+#include <net/if_dl.h>
+#include <net/if_llc.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/siba/siba_ids.h>
+#include <dev/siba/sibareg.h>
+#include <dev/siba/sibavar.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_radiotap.h>
+#include <net80211/ieee80211_regdomain.h>
+#include <net80211/ieee80211_phy.h>
+#include <net80211/ieee80211_ratectl.h>
+
+#include <dev/bwn/if_bwnreg.h>
+#include <dev/bwn/if_bwnvar.h>
+
+#include <dev/bwn/if_bwn_debug.h>
+#include <dev/bwn/if_bwn_misc.h>
+#include <dev/bwn/if_bwn_phy_lp.h>
+
+static void bwn_phy_lp_readsprom(struct bwn_mac *);
+static void bwn_phy_lp_bbinit(struct bwn_mac *);
+static void bwn_phy_lp_txpctl_init(struct bwn_mac *);
+static void bwn_phy_lp_calib(struct bwn_mac *);
+static int bwn_phy_lp_b2062_switch_channel(struct bwn_mac *, uint8_t);
+static int bwn_phy_lp_b2063_switch_channel(struct bwn_mac *, uint8_t);
+static void bwn_phy_lp_set_anafilter(struct bwn_mac *, uint8_t);
+static void bwn_phy_lp_set_gaintbl(struct bwn_mac *, uint32_t);
+static void bwn_phy_lp_digflt_save(struct bwn_mac *);
+static void bwn_phy_lp_get_txpctlmode(struct bwn_mac *);
+static void bwn_phy_lp_set_txpctlmode(struct bwn_mac *, uint8_t);
+static void bwn_phy_lp_bugfix(struct bwn_mac *);
+static void bwn_phy_lp_digflt_restore(struct bwn_mac *);
+static void bwn_phy_lp_tblinit(struct bwn_mac *);
+static void bwn_phy_lp_bbinit_r2(struct bwn_mac *);
+static void bwn_phy_lp_bbinit_r01(struct bwn_mac *);
+static void bwn_phy_lp_b2062_init(struct bwn_mac *);
+static void bwn_phy_lp_b2063_init(struct bwn_mac *);
+static void bwn_phy_lp_rxcal_r2(struct bwn_mac *);
+static void bwn_phy_lp_rccal_r12(struct bwn_mac *);
+static void bwn_phy_lp_set_rccap(struct bwn_mac *);
+static uint32_t bwn_phy_lp_roundup(uint32_t, uint32_t, uint8_t);
+static void bwn_phy_lp_b2062_reset_pllbias(struct bwn_mac *);
+static void bwn_phy_lp_b2062_vco_calib(struct bwn_mac *);
+static void bwn_tab_write_multi(struct bwn_mac *, uint32_t, int,
+ const void *);
+static void bwn_tab_read_multi(struct bwn_mac *, uint32_t, int, void *);
+static struct bwn_txgain
+ bwn_phy_lp_get_txgain(struct bwn_mac *);
+static uint8_t bwn_phy_lp_get_bbmult(struct bwn_mac *);
+static void bwn_phy_lp_set_txgain(struct bwn_mac *, struct bwn_txgain *);
+static void bwn_phy_lp_set_bbmult(struct bwn_mac *, uint8_t);
+static void bwn_phy_lp_set_trsw_over(struct bwn_mac *, uint8_t, uint8_t);
+static void bwn_phy_lp_set_rxgain(struct bwn_mac *, uint32_t);
+static void bwn_phy_lp_set_deaf(struct bwn_mac *, uint8_t);
+static int bwn_phy_lp_calc_rx_iq_comp(struct bwn_mac *, uint16_t);
+static void bwn_phy_lp_clear_deaf(struct bwn_mac *, uint8_t);
+static void bwn_phy_lp_tblinit_r01(struct bwn_mac *);
+static void bwn_phy_lp_tblinit_r2(struct bwn_mac *);
+static void bwn_phy_lp_tblinit_txgain(struct bwn_mac *);
+static void bwn_tab_write(struct bwn_mac *, uint32_t, uint32_t);
+static void bwn_phy_lp_b2062_tblinit(struct bwn_mac *);
+static void bwn_phy_lp_b2063_tblinit(struct bwn_mac *);
+static int bwn_phy_lp_loopback(struct bwn_mac *);
+static void bwn_phy_lp_set_rxgain_idx(struct bwn_mac *, uint16_t);
+static void bwn_phy_lp_ddfs_turnon(struct bwn_mac *, int, int, int, int,
+ int);
+static uint8_t bwn_phy_lp_rx_iq_est(struct bwn_mac *, uint16_t, uint8_t,
+ struct bwn_phy_lp_iq_est *);
+static void bwn_phy_lp_ddfs_turnoff(struct bwn_mac *);
+static uint32_t bwn_tab_read(struct bwn_mac *, uint32_t);
+static void bwn_phy_lp_set_txgain_dac(struct bwn_mac *, uint16_t);
+static void bwn_phy_lp_set_txgain_pa(struct bwn_mac *, uint16_t);
+static void bwn_phy_lp_set_txgain_override(struct bwn_mac *);
+static uint16_t bwn_phy_lp_get_pa_gain(struct bwn_mac *);
+static uint8_t bwn_nbits(int32_t);
+static void bwn_phy_lp_gaintbl_write_multi(struct bwn_mac *, int, int,
+ struct bwn_txgain_entry *);
+static void bwn_phy_lp_gaintbl_write(struct bwn_mac *, int,
+ struct bwn_txgain_entry);
+static void bwn_phy_lp_gaintbl_write_r2(struct bwn_mac *, int,
+ struct bwn_txgain_entry);
+static void bwn_phy_lp_gaintbl_write_r01(struct bwn_mac *, int,
+ struct bwn_txgain_entry);
+
+static const uint8_t bwn_b2063_chantable_data[33][12] = {
+ { 0x6f, 0x3c, 0x3c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+ { 0x6f, 0x2c, 0x2c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+ { 0x6f, 0x1c, 0x1c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+ { 0x6e, 0x1c, 0x1c, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+ { 0x6e, 0xc, 0xc, 0x4, 0x5, 0x5, 0x5, 0x5, 0x77, 0x80, 0x80, 0x70 },
+ { 0x6a, 0xc, 0xc, 0, 0x2, 0x5, 0xd, 0xd, 0x77, 0x80, 0x20, 0 },
+ { 0x6a, 0xc, 0xc, 0, 0x1, 0x5, 0xd, 0xc, 0x77, 0x80, 0x20, 0 },
+ { 0x6a, 0xc, 0xc, 0, 0x1, 0x4, 0xc, 0xc, 0x77, 0x80, 0x20, 0 },
+ { 0x69, 0xc, 0xc, 0, 0x1, 0x4, 0xc, 0xc, 0x77, 0x70, 0x20, 0 },
+ { 0x69, 0xc, 0xc, 0, 0x1, 0x4, 0xb, 0xc, 0x77, 0x70, 0x20, 0 },
+ { 0x69, 0xc, 0xc, 0, 0, 0x4, 0xb, 0xb, 0x77, 0x60, 0x20, 0 },
+ { 0x69, 0xc, 0xc, 0, 0, 0x3, 0xa, 0xb, 0x77, 0x60, 0x20, 0 },
+ { 0x69, 0xc, 0xc, 0, 0, 0x3, 0xa, 0xa, 0x77, 0x60, 0x20, 0 },
+ { 0x68, 0xc, 0xc, 0, 0, 0x2, 0x9, 0x9, 0x77, 0x60, 0x20, 0 },
+ { 0x68, 0xc, 0xc, 0, 0, 0x1, 0x8, 0x8, 0x77, 0x50, 0x10, 0 },
+ { 0x67, 0xc, 0xc, 0, 0, 0, 0x8, 0x8, 0x77, 0x50, 0x10, 0 },
+ { 0x64, 0xc, 0xc, 0, 0, 0, 0x2, 0x1, 0x77, 0x20, 0, 0 },
+ { 0x64, 0xc, 0xc, 0, 0, 0, 0x1, 0x1, 0x77, 0x20, 0, 0 },
+ { 0x63, 0xc, 0xc, 0, 0, 0, 0x1, 0, 0x77, 0x10, 0, 0 },
+ { 0x63, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0x10, 0, 0 },
+ { 0x62, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0x10, 0, 0 },
+ { 0x62, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
+ { 0x61, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
+ { 0x60, 0xc, 0xc, 0, 0, 0, 0, 0, 0x77, 0, 0, 0 },
+ { 0x6e, 0xc, 0xc, 0, 0x9, 0xe, 0xf, 0xf, 0x77, 0xc0, 0x50, 0 },
+ { 0x6e, 0xc, 0xc, 0, 0x9, 0xd, 0xf, 0xf, 0x77, 0xb0, 0x50, 0 },
+ { 0x6e, 0xc, 0xc, 0, 0x8, 0xc, 0xf, 0xf, 0x77, 0xb0, 0x50, 0 },
+ { 0x6d, 0xc, 0xc, 0, 0x8, 0xc, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
+ { 0x6d, 0xc, 0xc, 0, 0x8, 0xb, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
+ { 0x6d, 0xc, 0xc, 0, 0x8, 0xa, 0xf, 0xf, 0x77, 0xa0, 0x40, 0 },
+ { 0x6c, 0xc, 0xc, 0, 0x7, 0x9, 0xf, 0xf, 0x77, 0x90, 0x40, 0 },
+ { 0x6c, 0xc, 0xc, 0, 0x6, 0x8, 0xf, 0xf, 0x77, 0x90, 0x40, 0 },
+ { 0x6c, 0xc, 0xc, 0, 0x5, 0x8, 0xf, 0xf, 0x77, 0x90, 0x40, 0 }
+};
+
+static const struct bwn_b206x_chan bwn_b2063_chantable[] = {
+ { 1, 2412, bwn_b2063_chantable_data[0] },
+ { 2, 2417, bwn_b2063_chantable_data[0] },
+ { 3, 2422, bwn_b2063_chantable_data[0] },
+ { 4, 2427, bwn_b2063_chantable_data[1] },
+ { 5, 2432, bwn_b2063_chantable_data[1] },
+ { 6, 2437, bwn_b2063_chantable_data[1] },
+ { 7, 2442, bwn_b2063_chantable_data[1] },
+ { 8, 2447, bwn_b2063_chantable_data[1] },
+ { 9, 2452, bwn_b2063_chantable_data[2] },
+ { 10, 2457, bwn_b2063_chantable_data[2] },
+ { 11, 2462, bwn_b2063_chantable_data[3] },
+ { 12, 2467, bwn_b2063_chantable_data[3] },
+ { 13, 2472, bwn_b2063_chantable_data[3] },
+ { 14, 2484, bwn_b2063_chantable_data[4] },
+ { 34, 5170, bwn_b2063_chantable_data[5] },
+ { 36, 5180, bwn_b2063_chantable_data[6] },
+ { 38, 5190, bwn_b2063_chantable_data[7] },
+ { 40, 5200, bwn_b2063_chantable_data[8] },
+ { 42, 5210, bwn_b2063_chantable_data[9] },
+ { 44, 5220, bwn_b2063_chantable_data[10] },
+ { 46, 5230, bwn_b2063_chantable_data[11] },
+ { 48, 5240, bwn_b2063_chantable_data[12] },
+ { 52, 5260, bwn_b2063_chantable_data[13] },
+ { 56, 5280, bwn_b2063_chantable_data[14] },
+ { 60, 5300, bwn_b2063_chantable_data[14] },
+ { 64, 5320, bwn_b2063_chantable_data[15] },
+ { 100, 5500, bwn_b2063_chantable_data[16] },
+ { 104, 5520, bwn_b2063_chantable_data[17] },
+ { 108, 5540, bwn_b2063_chantable_data[18] },
+ { 112, 5560, bwn_b2063_chantable_data[19] },
+ { 116, 5580, bwn_b2063_chantable_data[20] },
+ { 120, 5600, bwn_b2063_chantable_data[21] },
+ { 124, 5620, bwn_b2063_chantable_data[21] },
+ { 128, 5640, bwn_b2063_chantable_data[22] },
+ { 132, 5660, bwn_b2063_chantable_data[22] },
+ { 136, 5680, bwn_b2063_chantable_data[22] },
+ { 140, 5700, bwn_b2063_chantable_data[23] },
+ { 149, 5745, bwn_b2063_chantable_data[23] },
+ { 153, 5765, bwn_b2063_chantable_data[23] },
+ { 157, 5785, bwn_b2063_chantable_data[23] },
+ { 161, 5805, bwn_b2063_chantable_data[23] },
+ { 165, 5825, bwn_b2063_chantable_data[23] },
+ { 184, 4920, bwn_b2063_chantable_data[24] },
+ { 188, 4940, bwn_b2063_chantable_data[25] },
+ { 192, 4960, bwn_b2063_chantable_data[26] },
+ { 196, 4980, bwn_b2063_chantable_data[27] },
+ { 200, 5000, bwn_b2063_chantable_data[28] },
+ { 204, 5020, bwn_b2063_chantable_data[29] },
+ { 208, 5040, bwn_b2063_chantable_data[30] },
+ { 212, 5060, bwn_b2063_chantable_data[31] },
+ { 216, 5080, bwn_b2063_chantable_data[32] }
+};
+
+static const uint8_t bwn_b2062_chantable_data[22][12] = {
+ { 0xff, 0xff, 0xb5, 0x1b, 0x24, 0x32, 0x32, 0x88, 0x88, 0, 0, 0 },
+ { 0, 0x22, 0x20, 0x84, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0x11, 0x10, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0x11, 0x20, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0x11, 0x10, 0x84, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0x11, 0, 0x83, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0x63, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0x62, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0x30, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0x20, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0x10, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0, 0, 0, 0x3c, 0x77, 0x37, 0xff, 0x88, 0, 0, 0 },
+ { 0x55, 0x77, 0x90, 0xf7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x44, 0x77, 0x80, 0xe7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x44, 0x66, 0x80, 0xe7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x33, 0x66, 0x70, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x22, 0x55, 0x60, 0xd7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x22, 0x55, 0x60, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x22, 0x44, 0x50, 0xc7, 0x3c, 0x77, 0x35, 0xff, 0xff, 0, 0, 0 },
+ { 0x11, 0x44, 0x50, 0xa5, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 },
+ { 0, 0x44, 0x40, 0xb6, 0x3c, 0x77, 0x35, 0xff, 0x88, 0, 0, 0 }
+};
+
+static const struct bwn_b206x_chan bwn_b2062_chantable[] = {
+ { 1, 2412, bwn_b2062_chantable_data[0] },
+ { 2, 2417, bwn_b2062_chantable_data[0] },
+ { 3, 2422, bwn_b2062_chantable_data[0] },
+ { 4, 2427, bwn_b2062_chantable_data[0] },
+ { 5, 2432, bwn_b2062_chantable_data[0] },
+ { 6, 2437, bwn_b2062_chantable_data[0] },
+ { 7, 2442, bwn_b2062_chantable_data[0] },
+ { 8, 2447, bwn_b2062_chantable_data[0] },
+ { 9, 2452, bwn_b2062_chantable_data[0] },
+ { 10, 2457, bwn_b2062_chantable_data[0] },
+ { 11, 2462, bwn_b2062_chantable_data[0] },
+ { 12, 2467, bwn_b2062_chantable_data[0] },
+ { 13, 2472, bwn_b2062_chantable_data[0] },
+ { 14, 2484, bwn_b2062_chantable_data[0] },
+ { 34, 5170, bwn_b2062_chantable_data[1] },
+ { 38, 5190, bwn_b2062_chantable_data[2] },
+ { 42, 5210, bwn_b2062_chantable_data[2] },
+ { 46, 5230, bwn_b2062_chantable_data[3] },
+ { 36, 5180, bwn_b2062_chantable_data[4] },
+ { 40, 5200, bwn_b2062_chantable_data[5] },
+ { 44, 5220, bwn_b2062_chantable_data[6] },
+ { 48, 5240, bwn_b2062_chantable_data[3] },
+ { 52, 5260, bwn_b2062_chantable_data[3] },
+ { 56, 5280, bwn_b2062_chantable_data[3] },
+ { 60, 5300, bwn_b2062_chantable_data[7] },
+ { 64, 5320, bwn_b2062_chantable_data[8] },
+ { 100, 5500, bwn_b2062_chantable_data[9] },
+ { 104, 5520, bwn_b2062_chantable_data[10] },
+ { 108, 5540, bwn_b2062_chantable_data[10] },
+ { 112, 5560, bwn_b2062_chantable_data[10] },
+ { 116, 5580, bwn_b2062_chantable_data[11] },
+ { 120, 5600, bwn_b2062_chantable_data[12] },
+ { 124, 5620, bwn_b2062_chantable_data[12] },
+ { 128, 5640, bwn_b2062_chantable_data[12] },
+ { 132, 5660, bwn_b2062_chantable_data[12] },
+ { 136, 5680, bwn_b2062_chantable_data[12] },
+ { 140, 5700, bwn_b2062_chantable_data[12] },
+ { 149, 5745, bwn_b2062_chantable_data[12] },
+ { 153, 5765, bwn_b2062_chantable_data[12] },
+ { 157, 5785, bwn_b2062_chantable_data[12] },
+ { 161, 5805, bwn_b2062_chantable_data[12] },
+ { 165, 5825, bwn_b2062_chantable_data[12] },
+ { 184, 4920, bwn_b2062_chantable_data[13] },
+ { 188, 4940, bwn_b2062_chantable_data[14] },
+ { 192, 4960, bwn_b2062_chantable_data[15] },
+ { 196, 4980, bwn_b2062_chantable_data[16] },
+ { 200, 5000, bwn_b2062_chantable_data[17] },
+ { 204, 5020, bwn_b2062_chantable_data[18] },
+ { 208, 5040, bwn_b2062_chantable_data[19] },
+ { 212, 5060, bwn_b2062_chantable_data[20] },
+ { 216, 5080, bwn_b2062_chantable_data[21] }
+};
+
+/* for LP PHY */
+static const struct bwn_rxcompco bwn_rxcompco_5354[] = {
+ { 1, -66, 15 }, { 2, -66, 15 }, { 3, -66, 15 }, { 4, -66, 15 },
+ { 5, -66, 15 }, { 6, -66, 15 }, { 7, -66, 14 }, { 8, -66, 14 },
+ { 9, -66, 14 }, { 10, -66, 14 }, { 11, -66, 14 }, { 12, -66, 13 },
+ { 13, -66, 13 }, { 14, -66, 13 },
+};
+
+/* for LP PHY */
+static const struct bwn_rxcompco bwn_rxcompco_r12[] = {
+ { 1, -64, 13 }, { 2, -64, 13 }, { 3, -64, 13 }, { 4, -64, 13 },
+ { 5, -64, 12 }, { 6, -64, 12 }, { 7, -64, 12 }, { 8, -64, 12 },
+ { 9, -64, 12 }, { 10, -64, 11 }, { 11, -64, 11 }, { 12, -64, 11 },
+ { 13, -64, 11 }, { 14, -64, 10 }, { 34, -62, 24 }, { 38, -62, 24 },
+ { 42, -62, 24 }, { 46, -62, 23 }, { 36, -62, 24 }, { 40, -62, 24 },
+ { 44, -62, 23 }, { 48, -62, 23 }, { 52, -62, 23 }, { 56, -62, 22 },
+ { 60, -62, 22 }, { 64, -62, 22 }, { 100, -62, 16 }, { 104, -62, 16 },
+ { 108, -62, 15 }, { 112, -62, 14 }, { 116, -62, 14 }, { 120, -62, 13 },
+ { 124, -62, 12 }, { 128, -62, 12 }, { 132, -62, 12 }, { 136, -62, 11 },
+ { 140, -62, 10 }, { 149, -61, 9 }, { 153, -61, 9 }, { 157, -61, 9 },
+ { 161, -61, 8 }, { 165, -61, 8 }, { 184, -62, 25 }, { 188, -62, 25 },
+ { 192, -62, 25 }, { 196, -62, 25 }, { 200, -62, 25 }, { 204, -62, 25 },
+ { 208, -62, 25 }, { 212, -62, 25 }, { 216, -62, 26 },
+};
+
+static const struct bwn_rxcompco bwn_rxcompco_r2 = { 0, -64, 0 };
+
+static const uint8_t bwn_tab_sigsq_tbl[] = {
+ 0xde, 0xdc, 0xda, 0xd8, 0xd6, 0xd4, 0xd2, 0xcf, 0xcd,
+ 0xca, 0xc7, 0xc4, 0xc1, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0x00,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe,
+ 0xbe, 0xbe, 0xbe, 0xbe, 0xc1, 0xc4, 0xc7, 0xca, 0xcd,
+ 0xcf, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
+};
+
+static const uint8_t bwn_tab_pllfrac_tbl[] = {
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+};
+
+static const uint16_t bwn_tabl_iqlocal_tbl[] = {
+ 0x0200, 0x0300, 0x0400, 0x0600, 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002,
+ 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0300, 0x0400, 0x0600,
+ 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006,
+ 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+};
+
+void
+bwn_phy_lp_init_pre(struct bwn_mac *mac)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_lp *plp = &phy->phy_lp;
+
+ plp->plp_antenna = BWN_ANT_DEFAULT;
+}
+
+int
+bwn_phy_lp_init(struct bwn_mac *mac)
+{
+ static const struct bwn_stxtable tables[] = {
+ { 2, 6, 0x3d, 3, 0x01 }, { 1, 12, 0x4c, 1, 0x01 },
+ { 1, 8, 0x50, 0, 0x7f }, { 0, 8, 0x44, 0, 0xff },
+ { 1, 0, 0x4a, 0, 0xff }, { 0, 4, 0x4d, 0, 0xff },
+ { 1, 4, 0x4e, 0, 0xff }, { 0, 12, 0x4f, 0, 0x0f },
+ { 1, 0, 0x4f, 4, 0x0f }, { 3, 0, 0x49, 0, 0x0f },
+ { 4, 3, 0x46, 4, 0x07 }, { 3, 15, 0x46, 0, 0x01 },
+ { 4, 0, 0x46, 1, 0x07 }, { 3, 8, 0x48, 4, 0x07 },
+ { 3, 11, 0x48, 0, 0x0f }, { 3, 4, 0x49, 4, 0x0f },
+ { 2, 15, 0x45, 0, 0x01 }, { 5, 13, 0x52, 4, 0x07 },
+ { 6, 0, 0x52, 7, 0x01 }, { 5, 3, 0x41, 5, 0x07 },
+ { 5, 6, 0x41, 0, 0x0f }, { 5, 10, 0x42, 5, 0x07 },
+ { 4, 15, 0x42, 0, 0x01 }, { 5, 0, 0x42, 1, 0x07 },
+ { 4, 11, 0x43, 4, 0x0f }, { 4, 7, 0x43, 0, 0x0f },
+ { 4, 6, 0x45, 1, 0x01 }, { 2, 7, 0x40, 4, 0x0f },
+ { 2, 11, 0x40, 0, 0x0f }
+ };
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ const struct bwn_stxtable *st;
+ struct ieee80211com *ic = &sc->sc_ic;
+ int i, error;
+ uint16_t tmp;
+
+ bwn_phy_lp_readsprom(mac); /* XXX bad place */
+ bwn_phy_lp_bbinit(mac);
+
+ /* initialize RF */
+ BWN_PHY_SET(mac, BWN_PHY_4WIRECTL, 0x2);
+ DELAY(1);
+ BWN_PHY_MASK(mac, BWN_PHY_4WIRECTL, 0xfffd);
+ DELAY(1);
+
+ if (mac->mac_phy.rf_ver == 0x2062)
+ bwn_phy_lp_b2062_init(mac);
+ else {
+ bwn_phy_lp_b2063_init(mac);
+
+ /* synchronize stx table. */
+ for (i = 0; i < N(tables); i++) {
+ st = &tables[i];
+ tmp = BWN_RF_READ(mac, st->st_rfaddr);
+ tmp >>= st->st_rfshift;
+ tmp <<= st->st_physhift;
+ BWN_PHY_SETMASK(mac,
+ BWN_PHY_OFDM(0xf2 + st->st_phyoffset),
+ ~(st->st_mask << st->st_physhift), tmp);
+ }
+
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xf0), 0x5f80);
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xf1), 0);
+ }
+
+ /* calibrate RC */
+ if (mac->mac_phy.rev >= 2)
+ bwn_phy_lp_rxcal_r2(mac);
+ else if (!plp->plp_rccap) {
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ bwn_phy_lp_rccal_r12(mac);
+ } else
+ bwn_phy_lp_set_rccap(mac);
+
+ error = bwn_phy_lp_switch_channel(mac, 7);
+ if (error)
+ device_printf(sc->sc_dev,
+ "failed to change channel 7 (%d)\n", error);
+ bwn_phy_lp_txpctl_init(mac);
+ bwn_phy_lp_calib(mac);
+ return (0);
+}
+
+uint16_t
+bwn_phy_lp_read(struct bwn_mac *mac, uint16_t reg)
+{
+
+ BWN_WRITE_2(mac, BWN_PHYCTL, reg);
+ return (BWN_READ_2(mac, BWN_PHYDATA));
+}
+
+void
+bwn_phy_lp_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
+{
+
+ BWN_WRITE_2(mac, BWN_PHYCTL, reg);
+ BWN_WRITE_2(mac, BWN_PHYDATA, value);
+}
+
+void
+bwn_phy_lp_maskset(struct bwn_mac *mac, uint16_t reg, uint16_t mask,
+ uint16_t set)
+{
+
+ BWN_WRITE_2(mac, BWN_PHYCTL, reg);
+ BWN_WRITE_2(mac, BWN_PHYDATA,
+ (BWN_READ_2(mac, BWN_PHYDATA) & mask) | set);
+}
+
+uint16_t
+bwn_phy_lp_rf_read(struct bwn_mac *mac, uint16_t reg)
+{
+
+ KASSERT(reg != 1, ("unaccessible register %d", reg));
+ if (mac->mac_phy.rev < 2 && reg != 0x4001)
+ reg |= 0x100;
+ if (mac->mac_phy.rev >= 2)
+ reg |= 0x200;
+ BWN_WRITE_2(mac, BWN_RFCTL, reg);
+ return BWN_READ_2(mac, BWN_RFDATALO);
+}
+
+void
+bwn_phy_lp_rf_write(struct bwn_mac *mac, uint16_t reg, uint16_t value)
+{
+
+ KASSERT(reg != 1, ("unaccessible register %d", reg));
+ BWN_WRITE_2(mac, BWN_RFCTL, reg);
+ BWN_WRITE_2(mac, BWN_RFDATALO, value);
+}
+
+void
+bwn_phy_lp_rf_onoff(struct bwn_mac *mac, int on)
+{
+
+ if (on) {
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xe0ff);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2,
+ (mac->mac_phy.rev >= 2) ? 0xf7f7 : 0xffe7);
+ return;
+ }
+
+ if (mac->mac_phy.rev >= 2) {
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x83ff);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x1f00);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS, 0x80ff);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xdfff);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x0808);
+ return;
+ }
+
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xe0ff);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x1f00);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfcff);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x0018);
+}
+
+int
+bwn_phy_lp_switch_channel(struct bwn_mac *mac, uint32_t chan)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_lp *plp = &phy->phy_lp;
+ int error;
+
+ if (phy->rf_ver == 0x2063) {
+ error = bwn_phy_lp_b2063_switch_channel(mac, chan);
+ if (error)
+ return (error);
+ } else {
+ error = bwn_phy_lp_b2062_switch_channel(mac, chan);
+ if (error)
+ return (error);
+ bwn_phy_lp_set_anafilter(mac, chan);
+ bwn_phy_lp_set_gaintbl(mac, ieee80211_ieee2mhz(chan, 0));
+ }
+
+ plp->plp_chan = chan;
+ BWN_WRITE_2(mac, BWN_CHANNEL, chan);
+ return (0);
+}
+
+uint32_t
+bwn_phy_lp_get_default_chan(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ return (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan) ? 1 : 36);
+}
+
+void
+bwn_phy_lp_set_antenna(struct bwn_mac *mac, int antenna)
+{
+ struct bwn_phy *phy = &mac->mac_phy;
+ struct bwn_phy_lp *plp = &phy->phy_lp;
+
+ if (phy->rev >= 2 || antenna > BWN_ANTAUTO1)
+ return;
+
+ bwn_hf_write(mac, bwn_hf_read(mac) & ~BWN_HF_UCODE_ANTDIV_HELPER);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xfffd, antenna & 0x2);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xfffe, antenna & 0x1);
+ bwn_hf_write(mac, bwn_hf_read(mac) | BWN_HF_UCODE_ANTDIV_HELPER);
+ plp->plp_antenna = antenna;
+}
+
+void
+bwn_phy_lp_task_60s(struct bwn_mac *mac)
+{
+
+ bwn_phy_lp_calib(mac);
+}
+
+static void
+bwn_phy_lp_readsprom(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ plp->plp_txisoband_m = siba_sprom_get_tri2g(sc->sc_dev);
+ plp->plp_bxarch = siba_sprom_get_bxa2g(sc->sc_dev);
+ plp->plp_rxpwroffset = siba_sprom_get_rxpo2g(sc->sc_dev);
+ plp->plp_rssivf = siba_sprom_get_rssismf2g(sc->sc_dev);
+ plp->plp_rssivc = siba_sprom_get_rssismc2g(sc->sc_dev);
+ plp->plp_rssigs = siba_sprom_get_rssisav2g(sc->sc_dev);
+ return;
+ }
+
+ plp->plp_txisoband_l = siba_sprom_get_tri5gl(sc->sc_dev);
+ plp->plp_txisoband_m = siba_sprom_get_tri5g(sc->sc_dev);
+ plp->plp_txisoband_h = siba_sprom_get_tri5gh(sc->sc_dev);
+ plp->plp_bxarch = siba_sprom_get_bxa5g(sc->sc_dev);
+ plp->plp_rxpwroffset = siba_sprom_get_rxpo5g(sc->sc_dev);
+ plp->plp_rssivf = siba_sprom_get_rssismf5g(sc->sc_dev);
+ plp->plp_rssivc = siba_sprom_get_rssismc5g(sc->sc_dev);
+ plp->plp_rssigs = siba_sprom_get_rssisav5g(sc->sc_dev);
+}
+
+static void
+bwn_phy_lp_bbinit(struct bwn_mac *mac)
+{
+
+ bwn_phy_lp_tblinit(mac);
+ if (mac->mac_phy.rev >= 2)
+ bwn_phy_lp_bbinit_r2(mac);
+ else
+ bwn_phy_lp_bbinit_r01(mac);
+}
+
+static void
+bwn_phy_lp_txpctl_init(struct bwn_mac *mac)
+{
+ struct bwn_txgain gain_2ghz = { 4, 12, 12, 0 };
+ struct bwn_txgain gain_5ghz = { 7, 15, 14, 0 };
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ bwn_phy_lp_set_txgain(mac,
+ IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan) ? &gain_2ghz : &gain_5ghz);
+ bwn_phy_lp_set_bbmult(mac, 150);
+}
+
+static void
+bwn_phy_lp_calib(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ const struct bwn_rxcompco *rc = NULL;
+ struct bwn_txgain ogain;
+ int i, omode, oafeovr, orf, obbmult;
+ uint8_t mode, fc = 0;
+
+ if (plp->plp_chanfullcal != plp->plp_chan) {
+ plp->plp_chanfullcal = plp->plp_chan;
+ fc = 1;
+ }
+
+ bwn_mac_suspend(mac);
+
+ /* BlueTooth Coexistance Override */
+ BWN_WRITE_2(mac, BWN_BTCOEX_CTL, 0x3);
+ BWN_WRITE_2(mac, BWN_BTCOEX_TXCTL, 0xff);
+
+ if (mac->mac_phy.rev >= 2)
+ bwn_phy_lp_digflt_save(mac);
+ bwn_phy_lp_get_txpctlmode(mac);
+ mode = plp->plp_txpctlmode;
+ bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
+ if (mac->mac_phy.rev == 0 && mode != BWN_PHYLP_TXPCTL_OFF)
+ bwn_phy_lp_bugfix(mac);
+ if (mac->mac_phy.rev >= 2 && fc == 1) {
+ bwn_phy_lp_get_txpctlmode(mac);
+ omode = plp->plp_txpctlmode;
+ oafeovr = BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVR) & 0x40;
+ if (oafeovr)
+ ogain = bwn_phy_lp_get_txgain(mac);
+ orf = BWN_PHY_READ(mac, BWN_PHY_RF_PWR_OVERRIDE) & 0xff;
+ obbmult = bwn_phy_lp_get_bbmult(mac);
+ bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
+ if (oafeovr)
+ bwn_phy_lp_set_txgain(mac, &ogain);
+ bwn_phy_lp_set_bbmult(mac, obbmult);
+ bwn_phy_lp_set_txpctlmode(mac, omode);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_PWR_OVERRIDE, 0xff00, orf);
+ }
+ bwn_phy_lp_set_txpctlmode(mac, mode);
+ if (mac->mac_phy.rev >= 2)
+ bwn_phy_lp_digflt_restore(mac);
+
+ /* do RX IQ Calculation; assumes that noise is true. */
+ if (siba_get_chipid(sc->sc_dev) == 0x5354) {
+ for (i = 0; i < N(bwn_rxcompco_5354); i++) {
+ if (bwn_rxcompco_5354[i].rc_chan == plp->plp_chan)
+ rc = &bwn_rxcompco_5354[i];
+ }
+ } else if (mac->mac_phy.rev >= 2)
+ rc = &bwn_rxcompco_r2;
+ else {
+ for (i = 0; i < N(bwn_rxcompco_r12); i++) {
+ if (bwn_rxcompco_r12[i].rc_chan == plp->plp_chan)
+ rc = &bwn_rxcompco_r12[i];
+ }
+ }
+ if (rc == NULL)
+ goto fail;
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0xff00, rc->rc_c1);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0x00ff, rc->rc_c0 << 8);
+
+ bwn_phy_lp_set_trsw_over(mac, 1 /* TX */, 0 /* RX */);
+
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x8);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfff7, 0);
+ } else {
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x20);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xffdf, 0);
+ }
+
+ bwn_phy_lp_set_rxgain(mac, 0x2d5d);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xfffe);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVRVAL, 0xfffe);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x800);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x800);
+ bwn_phy_lp_set_deaf(mac, 0);
+ /* XXX no checking return value? */
+ (void)bwn_phy_lp_calc_rx_iq_comp(mac, 0xfff0);
+ bwn_phy_lp_clear_deaf(mac, 0);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xfffc);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xfff7);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xffdf);
+
+ /* disable RX GAIN override. */
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xfffe);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xffef);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xffbf);
+ if (mac->mac_phy.rev >= 2) {
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfeff);
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfbff);
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xe5), 0xfff7);
+ }
+ } else {
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfdff);
+ }
+
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xfffe);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVRVAL, 0xf7ff);
+fail:
+ bwn_mac_enable(mac);
+}
+
+void
+bwn_phy_lp_switch_analog(struct bwn_mac *mac, int on)
+{
+
+ if (on) {
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xfff8);
+ return;
+ }
+
+ BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVRVAL, 0x0007);
+ BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVR, 0x0007);
+}
+
+static int
+bwn_phy_lp_b2063_switch_channel(struct bwn_mac *mac, uint8_t chan)
+{
+ static const struct bwn_b206x_chan *bc = NULL;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint32_t count, freqref, freqvco, freqxtal, val[3], timeout, timeoutref,
+ tmp[6];
+ uint16_t old, scale, tmp16;
+ int i, div;
+
+ for (i = 0; i < N(bwn_b2063_chantable); i++) {
+ if (bwn_b2063_chantable[i].bc_chan == chan) {
+ bc = &bwn_b2063_chantable[i];
+ break;
+ }
+ }
+ if (bc == NULL)
+ return (EINVAL);
+
+ BWN_RF_WRITE(mac, BWN_B2063_LOGEN_VCOBUF1, bc->bc_data[0]);
+ BWN_RF_WRITE(mac, BWN_B2063_LOGEN_MIXER2, bc->bc_data[1]);
+ BWN_RF_WRITE(mac, BWN_B2063_LOGEN_BUF2, bc->bc_data[2]);
+ BWN_RF_WRITE(mac, BWN_B2063_LOGEN_RCCR1, bc->bc_data[3]);
+ BWN_RF_WRITE(mac, BWN_B2063_A_RX_1ST3, bc->bc_data[4]);
+ BWN_RF_WRITE(mac, BWN_B2063_A_RX_2ND1, bc->bc_data[5]);
+ BWN_RF_WRITE(mac, BWN_B2063_A_RX_2ND4, bc->bc_data[6]);
+ BWN_RF_WRITE(mac, BWN_B2063_A_RX_2ND7, bc->bc_data[7]);
+ BWN_RF_WRITE(mac, BWN_B2063_A_RX_PS6, bc->bc_data[8]);
+ BWN_RF_WRITE(mac, BWN_B2063_TX_RF_CTL2, bc->bc_data[9]);
+ BWN_RF_WRITE(mac, BWN_B2063_TX_RF_CTL5, bc->bc_data[10]);
+ BWN_RF_WRITE(mac, BWN_B2063_PA_CTL11, bc->bc_data[11]);
+
+ old = BWN_RF_READ(mac, BWN_B2063_COM15);
+ BWN_RF_SET(mac, BWN_B2063_COM15, 0x1e);
+
+ freqxtal = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
+ freqvco = bc->bc_freq << ((bc->bc_freq > 4000) ? 1 : 2);
+ freqref = freqxtal * 3;
+ div = (freqxtal <= 26000000 ? 1 : 2);
+ timeout = ((((8 * freqxtal) / (div * 5000000)) + 1) >> 1) - 1;
+ timeoutref = ((((8 * freqxtal) / (div * (timeout + 1))) +
+ 999999) / 1000000) + 1;
+
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_VCO_CALIB3, 0x2);
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_VCO_CALIB6,
+ 0xfff8, timeout >> 2);
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_VCO_CALIB7,
+ 0xff9f,timeout << 5);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_VCO_CALIB5, timeoutref);
+
+ val[0] = bwn_phy_lp_roundup(freqxtal, 1000000, 16);
+ val[1] = bwn_phy_lp_roundup(freqxtal, 1000000 * div, 16);
+ val[2] = bwn_phy_lp_roundup(freqvco, 3, 16);
+
+ count = (bwn_phy_lp_roundup(val[2], val[1] + 16, 16) * (timeout + 1) *
+ (timeoutref + 1)) - 1;
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_VCO_CALIB7,
+ 0xf0, count >> 8);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_VCO_CALIB8, count & 0xff);
+
+ tmp[0] = ((val[2] * 62500) / freqref) << 4;
+ tmp[1] = ((val[2] * 62500) % freqref) << 4;
+ while (tmp[1] >= freqref) {
+ tmp[0]++;
+ tmp[1] -= freqref;
+ }
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_SG1, 0xffe0, tmp[0] >> 4);
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_SG2, 0xfe0f, tmp[0] << 4);
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_SG2, 0xfff0, tmp[0] >> 16);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_SG3, (tmp[1] >> 8) & 0xff);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_SG4, tmp[1] & 0xff);
+
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF1, 0xb9);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF2, 0x88);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF3, 0x28);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_LF4, 0x63);
+
+ tmp[2] = ((41 * (val[2] - 3000)) /1200) + 27;
+ tmp[3] = bwn_phy_lp_roundup(132000 * tmp[0], 8451, 16);
+
+ if (howmany(tmp[3], tmp[2]) > 60) {
+ scale = 1;
+ tmp[4] = ((tmp[3] + tmp[2]) / (tmp[2] << 1)) - 8;
+ } else {
+ scale = 0;
+ tmp[4] = ((tmp[3] + (tmp[2] >> 1)) / tmp[2]) - 8;
+ }
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP2, 0xffc0, tmp[4]);
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP2, 0xffbf, scale << 6);
+
+ tmp[5] = bwn_phy_lp_roundup(100 * val[0], val[2], 16) * (tmp[4] * 8) *
+ (scale + 1);
+ if (tmp[5] > 150)
+ tmp[5] = 0;
+
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP3, 0xffe0, tmp[5]);
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_CP3, 0xffdf, scale << 5);
+
+ BWN_RF_SETMASK(mac, BWN_B2063_JTAG_XTAL_12, 0xfffb, 0x4);
+ if (freqxtal > 26000000)
+ BWN_RF_SET(mac, BWN_B2063_JTAG_XTAL_12, 0x2);
+ else
+ BWN_RF_MASK(mac, BWN_B2063_JTAG_XTAL_12, 0xfd);
+
+ if (val[0] == 45)
+ BWN_RF_SET(mac, BWN_B2063_JTAG_VCO1, 0x2);
+ else
+ BWN_RF_MASK(mac, BWN_B2063_JTAG_VCO1, 0xfd);
+
+ BWN_RF_SET(mac, BWN_B2063_PLL_SP2, 0x3);
+ DELAY(1);
+ BWN_RF_MASK(mac, BWN_B2063_PLL_SP2, 0xfffc);
+
+ /* VCO Calibration */
+ BWN_RF_MASK(mac, BWN_B2063_PLL_SP1, ~0x40);
+ tmp16 = BWN_RF_READ(mac, BWN_B2063_JTAG_CALNRST) & 0xf8;
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16);
+ DELAY(1);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16 | 0x4);
+ DELAY(1);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16 | 0x6);
+ DELAY(1);
+ BWN_RF_WRITE(mac, BWN_B2063_JTAG_CALNRST, tmp16 | 0x7);
+ DELAY(300);
+ BWN_RF_SET(mac, BWN_B2063_PLL_SP1, 0x40);
+
+ BWN_RF_WRITE(mac, BWN_B2063_COM15, old);
+ return (0);
+}
+
+static int
+bwn_phy_lp_b2062_switch_channel(struct bwn_mac *mac, uint8_t chan)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ const struct bwn_b206x_chan *bc = NULL;
+ uint32_t freqxtal = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
+ uint32_t tmp[9];
+ int i;
+
+ for (i = 0; i < N(bwn_b2062_chantable); i++) {
+ if (bwn_b2062_chantable[i].bc_chan == chan) {
+ bc = &bwn_b2062_chantable[i];
+ break;
+ }
+ }
+
+ if (bc == NULL)
+ return (EINVAL);
+
+ BWN_RF_SET(mac, BWN_B2062_S_RFPLLCTL14, 0x04);
+ BWN_RF_WRITE(mac, BWN_B2062_N_LGENATUNE0, bc->bc_data[0]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_LGENATUNE2, bc->bc_data[1]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_LGENATUNE3, bc->bc_data[2]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_TX_TUNE, bc->bc_data[3]);
+ BWN_RF_WRITE(mac, BWN_B2062_S_LGENG_CTL1, bc->bc_data[4]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_LGENACTL5, bc->bc_data[5]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_LGENACTL6, bc->bc_data[6]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_TX_PGA, bc->bc_data[7]);
+ BWN_RF_WRITE(mac, BWN_B2062_N_TX_PAD, bc->bc_data[8]);
+
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL33, 0xcc);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL34, 0x07);
+ bwn_phy_lp_b2062_reset_pllbias(mac);
+ tmp[0] = freqxtal / 1000;
+ tmp[1] = plp->plp_div * 1000;
+ tmp[2] = tmp[1] * ieee80211_ieee2mhz(chan, 0);
+ if (ieee80211_ieee2mhz(chan, 0) < 4000)
+ tmp[2] *= 2;
+ tmp[3] = 48 * tmp[0];
+ tmp[5] = tmp[2] / tmp[3];
+ tmp[6] = tmp[2] % tmp[3];
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL26, tmp[5]);
+ tmp[4] = tmp[6] * 0x100;
+ tmp[5] = tmp[4] / tmp[3];
+ tmp[6] = tmp[4] % tmp[3];
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL27, tmp[5]);
+ tmp[4] = tmp[6] * 0x100;
+ tmp[5] = tmp[4] / tmp[3];
+ tmp[6] = tmp[4] % tmp[3];
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL28, tmp[5]);
+ tmp[4] = tmp[6] * 0x100;
+ tmp[5] = tmp[4] / tmp[3];
+ tmp[6] = tmp[4] % tmp[3];
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL29,
+ tmp[5] + ((2 * tmp[6]) / tmp[3]));
+ tmp[7] = BWN_RF_READ(mac, BWN_B2062_S_RFPLLCTL19);
+ tmp[8] = ((2 * tmp[2] * (tmp[7] + 1)) + (3 * tmp[0])) / (6 * tmp[0]);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL23, (tmp[8] >> 8) + 16);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL24, tmp[8] & 0xff);
+
+ bwn_phy_lp_b2062_vco_calib(mac);
+ if (BWN_RF_READ(mac, BWN_B2062_S_RFPLLCTL3) & 0x10) {
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL33, 0xfc);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL34, 0);
+ bwn_phy_lp_b2062_reset_pllbias(mac);
+ bwn_phy_lp_b2062_vco_calib(mac);
+ if (BWN_RF_READ(mac, BWN_B2062_S_RFPLLCTL3) & 0x10) {
+ BWN_RF_MASK(mac, BWN_B2062_S_RFPLLCTL14, ~0x04);
+ return (EIO);
+ }
+ }
+ BWN_RF_MASK(mac, BWN_B2062_S_RFPLLCTL14, ~0x04);
+ return (0);
+}
+
+static void
+bwn_phy_lp_set_anafilter(struct bwn_mac *mac, uint8_t channel)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ uint16_t tmp = (channel == 14);
+
+ if (mac->mac_phy.rev < 2) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_LP_PHY_CTL, 0xfcff, tmp << 9);
+ if ((mac->mac_phy.rev == 1) && (plp->plp_rccap))
+ bwn_phy_lp_set_rccap(mac);
+ return;
+ }
+
+ BWN_RF_WRITE(mac, BWN_B2063_TX_BB_SP3, 0x3f);
+}
+
+static void
+bwn_phy_lp_set_gaintbl(struct bwn_mac *mac, uint32_t freq)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ uint16_t iso, tmp[3];
+
+ KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
+
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ iso = plp->plp_txisoband_m;
+ else if (freq <= 5320)
+ iso = plp->plp_txisoband_l;
+ else if (freq <= 5700)
+ iso = plp->plp_txisoband_m;
+ else
+ iso = plp->plp_txisoband_h;
+
+ tmp[0] = ((iso - 26) / 12) << 12;
+ tmp[1] = tmp[0] + 0x1000;
+ tmp[2] = tmp[0] + 0x2000;
+
+ bwn_tab_write_multi(mac, BWN_TAB_2(13, 0), 3, tmp);
+ bwn_tab_write_multi(mac, BWN_TAB_2(12, 0), 3, tmp);
+}
+
+static void
+bwn_phy_lp_digflt_save(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ int i;
+ static const uint16_t addr[] = {
+ BWN_PHY_OFDM(0xc1), BWN_PHY_OFDM(0xc2),
+ BWN_PHY_OFDM(0xc3), BWN_PHY_OFDM(0xc4),
+ BWN_PHY_OFDM(0xc5), BWN_PHY_OFDM(0xc6),
+ BWN_PHY_OFDM(0xc7), BWN_PHY_OFDM(0xc8),
+ BWN_PHY_OFDM(0xcf),
+ };
+ static const uint16_t val[] = {
+ 0xde5e, 0xe832, 0xe331, 0x4d26,
+ 0x0026, 0x1420, 0x0020, 0xfe08,
+ 0x0008,
+ };
+
+ for (i = 0; i < N(addr); i++) {
+ plp->plp_digfilt[i] = BWN_PHY_READ(mac, addr[i]);
+ BWN_PHY_WRITE(mac, addr[i], val[i]);
+ }
+}
+
+static void
+bwn_phy_lp_get_txpctlmode(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ uint16_t ctl;
+
+ ctl = BWN_PHY_READ(mac, BWN_PHY_TX_PWR_CTL_CMD);
+ switch (ctl & BWN_PHY_TX_PWR_CTL_CMD_MODE) {
+ case BWN_PHY_TX_PWR_CTL_CMD_MODE_OFF:
+ plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_OFF;
+ break;
+ case BWN_PHY_TX_PWR_CTL_CMD_MODE_SW:
+ plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_ON_SW;
+ break;
+ case BWN_PHY_TX_PWR_CTL_CMD_MODE_HW:
+ plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_ON_HW;
+ break;
+ default:
+ plp->plp_txpctlmode = BWN_PHYLP_TXPCTL_UNKNOWN;
+ device_printf(sc->sc_dev, "unknown command mode\n");
+ break;
+ }
+}
+
+static void
+bwn_phy_lp_set_txpctlmode(struct bwn_mac *mac, uint8_t mode)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ uint16_t ctl;
+ uint8_t old;
+
+ bwn_phy_lp_get_txpctlmode(mac);
+ old = plp->plp_txpctlmode;
+ if (old == mode)
+ return;
+ plp->plp_txpctlmode = mode;
+
+ if (old != BWN_PHYLP_TXPCTL_ON_HW && mode == BWN_PHYLP_TXPCTL_ON_HW) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_TX_PWR_CTL_CMD, 0xff80,
+ plp->plp_tssiidx);
+ BWN_PHY_SETMASK(mac, BWN_PHY_TX_PWR_CTL_NNUM,
+ 0x8fff, ((uint16_t)plp->plp_tssinpt << 16));
+
+ /* disable TX GAIN override */
+ if (mac->mac_phy.rev < 2)
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfeff);
+ else {
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xff7f);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xbfff);
+ }
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVR, 0xffbf);
+
+ plp->plp_txpwridx = -1;
+ }
+ if (mac->mac_phy.rev >= 2) {
+ if (mode == BWN_PHYLP_TXPCTL_ON_HW)
+ BWN_PHY_SET(mac, BWN_PHY_OFDM(0xd0), 0x2);
+ else
+ BWN_PHY_MASK(mac, BWN_PHY_OFDM(0xd0), 0xfffd);
+ }
+
+ /* writes TX Power Control mode */
+ switch (plp->plp_txpctlmode) {
+ case BWN_PHYLP_TXPCTL_OFF:
+ ctl = BWN_PHY_TX_PWR_CTL_CMD_MODE_OFF;
+ break;
+ case BWN_PHYLP_TXPCTL_ON_HW:
+ ctl = BWN_PHY_TX_PWR_CTL_CMD_MODE_HW;
+ break;
+ case BWN_PHYLP_TXPCTL_ON_SW:
+ ctl = BWN_PHY_TX_PWR_CTL_CMD_MODE_SW;
+ break;
+ default:
+ ctl = 0;
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+ BWN_PHY_SETMASK(mac, BWN_PHY_TX_PWR_CTL_CMD,
+ (uint16_t)~BWN_PHY_TX_PWR_CTL_CMD_MODE, ctl);
+}
+
+static void
+bwn_phy_lp_bugfix(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ const unsigned int size = 256;
+ struct bwn_txgain tg;
+ uint32_t rxcomp, txgain, coeff, rfpwr, *tabs;
+ uint16_t tssinpt, tssiidx, value[2];
+ uint8_t mode;
+ int8_t txpwridx;
+
+ tabs = (uint32_t *)malloc(sizeof(uint32_t) * size, M_DEVBUF,
+ M_NOWAIT | M_ZERO);
+ if (tabs == NULL) {
+ device_printf(sc->sc_dev, "failed to allocate buffer.\n");
+ return;
+ }
+
+ bwn_phy_lp_get_txpctlmode(mac);
+ mode = plp->plp_txpctlmode;
+ txpwridx = plp->plp_txpwridx;
+ tssinpt = plp->plp_tssinpt;
+ tssiidx = plp->plp_tssiidx;
+
+ bwn_tab_read_multi(mac,
+ (mac->mac_phy.rev < 2) ? BWN_TAB_4(10, 0x140) :
+ BWN_TAB_4(7, 0x140), size, tabs);
+
+ bwn_phy_lp_tblinit(mac);
+ bwn_phy_lp_bbinit(mac);
+ bwn_phy_lp_txpctl_init(mac);
+ bwn_phy_lp_rf_onoff(mac, 1);
+ bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
+
+ bwn_tab_write_multi(mac,
+ (mac->mac_phy.rev < 2) ? BWN_TAB_4(10, 0x140) :
+ BWN_TAB_4(7, 0x140), size, tabs);
+
+ BWN_WRITE_2(mac, BWN_CHANNEL, plp->plp_chan);
+ plp->plp_tssinpt = tssinpt;
+ plp->plp_tssiidx = tssiidx;
+ bwn_phy_lp_set_anafilter(mac, plp->plp_chan);
+ if (txpwridx != -1) {
+ /* set TX power by index */
+ plp->plp_txpwridx = txpwridx;
+ bwn_phy_lp_get_txpctlmode(mac);
+ if (plp->plp_txpctlmode != BWN_PHYLP_TXPCTL_OFF)
+ bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_ON_SW);
+ if (mac->mac_phy.rev >= 2) {
+ rxcomp = bwn_tab_read(mac,
+ BWN_TAB_4(7, txpwridx + 320));
+ txgain = bwn_tab_read(mac,
+ BWN_TAB_4(7, txpwridx + 192));
+ tg.tg_pad = (txgain >> 16) & 0xff;
+ tg.tg_gm = txgain & 0xff;
+ tg.tg_pga = (txgain >> 8) & 0xff;
+ tg.tg_dac = (rxcomp >> 28) & 0xff;
+ bwn_phy_lp_set_txgain(mac, &tg);
+ } else {
+ rxcomp = bwn_tab_read(mac,
+ BWN_TAB_4(10, txpwridx + 320));
+ txgain = bwn_tab_read(mac,
+ BWN_TAB_4(10, txpwridx + 192));
+ BWN_PHY_SETMASK(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL,
+ 0xf800, (txgain >> 4) & 0x7fff);
+ bwn_phy_lp_set_txgain_dac(mac, txgain & 0x7);
+ bwn_phy_lp_set_txgain_pa(mac, (txgain >> 24) & 0x7f);
+ }
+ bwn_phy_lp_set_bbmult(mac, (rxcomp >> 20) & 0xff);
+
+ /* set TX IQCC */
+ value[0] = (rxcomp >> 10) & 0x3ff;
+ value[1] = rxcomp & 0x3ff;
+ bwn_tab_write_multi(mac, BWN_TAB_2(0, 80), 2, value);
+
+ coeff = bwn_tab_read(mac,
+ (mac->mac_phy.rev >= 2) ? BWN_TAB_4(7, txpwridx + 448) :
+ BWN_TAB_4(10, txpwridx + 448));
+ bwn_tab_write(mac, BWN_TAB_2(0, 85), coeff & 0xffff);
+ if (mac->mac_phy.rev >= 2) {
+ rfpwr = bwn_tab_read(mac,
+ BWN_TAB_4(7, txpwridx + 576));
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_PWR_OVERRIDE, 0xff00,
+ rfpwr & 0xffff);
+ }
+ bwn_phy_lp_set_txgain_override(mac);
+ }
+ if (plp->plp_rccap)
+ bwn_phy_lp_set_rccap(mac);
+ bwn_phy_lp_set_antenna(mac, plp->plp_antenna);
+ bwn_phy_lp_set_txpctlmode(mac, mode);
+ free(tabs, M_DEVBUF);
+}
+
+static void
+bwn_phy_lp_digflt_restore(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ int i;
+ static const uint16_t addr[] = {
+ BWN_PHY_OFDM(0xc1), BWN_PHY_OFDM(0xc2),
+ BWN_PHY_OFDM(0xc3), BWN_PHY_OFDM(0xc4),
+ BWN_PHY_OFDM(0xc5), BWN_PHY_OFDM(0xc6),
+ BWN_PHY_OFDM(0xc7), BWN_PHY_OFDM(0xc8),
+ BWN_PHY_OFDM(0xcf),
+ };
+
+ for (i = 0; i < N(addr); i++)
+ BWN_PHY_WRITE(mac, addr[i], plp->plp_digfilt[i]);
+}
+
+static void
+bwn_phy_lp_tblinit(struct bwn_mac *mac)
+{
+ uint32_t freq = ieee80211_ieee2mhz(bwn_phy_lp_get_default_chan(mac), 0);
+
+ if (mac->mac_phy.rev < 2) {
+ bwn_phy_lp_tblinit_r01(mac);
+ bwn_phy_lp_tblinit_txgain(mac);
+ bwn_phy_lp_set_gaintbl(mac, freq);
+ return;
+ }
+
+ bwn_phy_lp_tblinit_r2(mac);
+ bwn_phy_lp_tblinit_txgain(mac);
+}
+
+struct bwn_wpair {
+ uint16_t reg;
+ uint16_t value;
+};
+
+struct bwn_smpair {
+ uint16_t offset;
+ uint16_t mask;
+ uint16_t set;
+};
+
+static void
+bwn_phy_lp_bbinit_r2(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ static const struct bwn_wpair v1[] = {
+ { BWN_PHY_AFE_DAC_CTL, 0x50 },
+ { BWN_PHY_AFE_CTL, 0x8800 },
+ { BWN_PHY_AFE_CTL_OVR, 0 },
+ { BWN_PHY_AFE_CTL_OVRVAL, 0 },
+ { BWN_PHY_RF_OVERRIDE_0, 0 },
+ { BWN_PHY_RF_OVERRIDE_2, 0 },
+ { BWN_PHY_OFDM(0xf9), 0 },
+ { BWN_PHY_TR_LOOKUP_1, 0 }
+ };
+ static const struct bwn_smpair v2[] = {
+ { BWN_PHY_OFDMSYNCTHRESH0, 0xff00, 0xb4 },
+ { BWN_PHY_DCOFFSETTRANSIENT, 0xf8ff, 0x200 },
+ { BWN_PHY_DCOFFSETTRANSIENT, 0xff00, 0x7f },
+ { BWN_PHY_GAINDIRECTMISMATCH, 0xff0f, 0x40 },
+ { BWN_PHY_PREAMBLECONFIRMTO, 0xff00, 0x2 }
+ };
+ static const struct bwn_smpair v3[] = {
+ { BWN_PHY_OFDM(0xfe), 0xffe0, 0x1f },
+ { BWN_PHY_OFDM(0xff), 0xffe0, 0xc },
+ { BWN_PHY_OFDM(0x100), 0xff00, 0x19 },
+ { BWN_PHY_OFDM(0xff), 0x03ff, 0x3c00 },
+ { BWN_PHY_OFDM(0xfe), 0xfc1f, 0x3e0 },
+ { BWN_PHY_OFDM(0xff), 0xffe0, 0xc },
+ { BWN_PHY_OFDM(0x100), 0x00ff, 0x1900 },
+ { BWN_PHY_CLIPCTRTHRESH, 0x83ff, 0x5800 },
+ { BWN_PHY_CLIPCTRTHRESH, 0xffe0, 0x12 },
+ { BWN_PHY_GAINMISMATCH, 0x0fff, 0x9000 },
+
+ };
+ int i;
+
+ for (i = 0; i < N(v1); i++)
+ BWN_PHY_WRITE(mac, v1[i].reg, v1[i].value);
+ BWN_PHY_SET(mac, BWN_PHY_ADC_COMPENSATION_CTL, 0x10);
+ for (i = 0; i < N(v2); i++)
+ BWN_PHY_SETMASK(mac, v2[i].offset, v2[i].mask, v2[i].set);
+
+ BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, ~0x4000);
+ BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, ~0x2000);
+ BWN_PHY_SET(mac, BWN_PHY_OFDM(0x10a), 0x1);
+ if (siba_get_pci_revid(sc->sc_dev) >= 0x18) {
+ bwn_tab_write(mac, BWN_TAB_4(17, 65), 0xec);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x10a), 0xff01, 0x14);
+ } else {
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0x10a), 0xff01, 0x10);
+ }
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xdf), 0xff00, 0xf4);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xdf), 0x00ff, 0xf100);
+ BWN_PHY_WRITE(mac, BWN_PHY_CLIPTHRESH, 0x48);
+ BWN_PHY_SETMASK(mac, BWN_PHY_HIGAINDB, 0xff00, 0x46);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xe4), 0xff00, 0x10);
+ BWN_PHY_SETMASK(mac, BWN_PHY_PWR_THRESH1, 0xfff0, 0x9);
+ BWN_PHY_MASK(mac, BWN_PHY_GAINDIRECTMISMATCH, ~0xf);
+ BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0x00ff, 0x5500);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CLIPCTRTHRESH, 0xfc1f, 0xa0);
+ BWN_PHY_SETMASK(mac, BWN_PHY_GAINDIRECTMISMATCH, 0xe0ff, 0x300);
+ BWN_PHY_SETMASK(mac, BWN_PHY_HIGAINDB, 0x00ff, 0x2a00);
+ if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
+ (siba_get_chiprev(sc->sc_dev) == 0)) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_LOWGAINDB, 0x00ff, 0x2100);
+ BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0xff00, 0xa);
+ } else {
+ BWN_PHY_SETMASK(mac, BWN_PHY_LOWGAINDB, 0x00ff, 0x1e00);
+ BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0xff00, 0xd);
+ }
+ for (i = 0; i < N(v3); i++)
+ BWN_PHY_SETMASK(mac, v3[i].offset, v3[i].mask, v3[i].set);
+ if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
+ (siba_get_chiprev(sc->sc_dev) == 0)) {
+ bwn_tab_write(mac, BWN_TAB_2(0x08, 0x14), 0);
+ bwn_tab_write(mac, BWN_TAB_2(0x08, 0x12), 0x40);
+ }
+
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x40);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xf0ff, 0xb00);
+ BWN_PHY_SETMASK(mac, BWN_PHY_SYNCPEAKCNT, 0xfff8, 0x6);
+ BWN_PHY_SETMASK(mac, BWN_PHY_MINPWR_LEVEL, 0x00ff, 0x9d00);
+ BWN_PHY_SETMASK(mac, BWN_PHY_MINPWR_LEVEL, 0xff00, 0xa1);
+ BWN_PHY_MASK(mac, BWN_PHY_IDLEAFTERPKTRXTO, 0x00ff);
+ } else
+ BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, ~0x40);
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRS_ED_THRESH, 0xff00, 0xb3);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRS_ED_THRESH, 0x00ff, 0xad00);
+ BWN_PHY_SETMASK(mac, BWN_PHY_INPUT_PWRDB, 0xff00, plp->plp_rxpwroffset);
+ BWN_PHY_SET(mac, BWN_PHY_RESET_CTL, 0x44);
+ BWN_PHY_WRITE(mac, BWN_PHY_RESET_CTL, 0x80);
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_RSSI_CTL_0, 0xa954);
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_RSSI_CTL_1,
+ 0x2000 | ((uint16_t)plp->plp_rssigs << 10) |
+ ((uint16_t)plp->plp_rssivc << 4) | plp->plp_rssivf);
+
+ if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
+ (siba_get_chiprev(sc->sc_dev) == 0)) {
+ BWN_PHY_SET(mac, BWN_PHY_AFE_ADC_CTL_0, 0x1c);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_CTL, 0x00ff, 0x8800);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_ADC_CTL_1, 0xfc3c, 0x0400);
+ }
+
+ bwn_phy_lp_digflt_save(mac);
+}
+
+static void
+bwn_phy_lp_bbinit_r01(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ static const struct bwn_smpair v1[] = {
+ { BWN_PHY_CLIPCTRTHRESH, 0xffe0, 0x0005 },
+ { BWN_PHY_CLIPCTRTHRESH, 0xfc1f, 0x0180 },
+ { BWN_PHY_CLIPCTRTHRESH, 0x83ff, 0x3c00 },
+ { BWN_PHY_GAINDIRECTMISMATCH, 0xfff0, 0x0005 },
+ { BWN_PHY_GAIN_MISMATCH_LIMIT, 0xffc0, 0x001a },
+ { BWN_PHY_CRS_ED_THRESH, 0xff00, 0x00b3 },
+ { BWN_PHY_CRS_ED_THRESH, 0x00ff, 0xad00 }
+ };
+ static const struct bwn_smpair v2[] = {
+ { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_1, 0x3f00, 0x0900 },
+ { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0b00 },
+ { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0400 },
+ { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0b00 },
+ { BWN_PHY_TR_LOOKUP_5, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_5, 0xc0ff, 0x0900 },
+ { BWN_PHY_TR_LOOKUP_6, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_6, 0xc0ff, 0x0b00 },
+ { BWN_PHY_TR_LOOKUP_7, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_7, 0xc0ff, 0x0900 },
+ { BWN_PHY_TR_LOOKUP_8, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_8, 0xc0ff, 0x0b00 }
+ };
+ static const struct bwn_smpair v3[] = {
+ { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x0001 },
+ { BWN_PHY_TR_LOOKUP_1, 0xc0ff, 0x0400 },
+ { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x0001 },
+ { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0500 },
+ { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x0002 },
+ { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0800 },
+ { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x0002 },
+ { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0a00 }
+ };
+ static const struct bwn_smpair v4[] = {
+ { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x0004 },
+ { BWN_PHY_TR_LOOKUP_1, 0xc0ff, 0x0800 },
+ { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x0004 },
+ { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0c00 },
+ { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x0002 },
+ { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0100 },
+ { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x0002 },
+ { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0300 }
+ };
+ static const struct bwn_smpair v5[] = {
+ { BWN_PHY_TR_LOOKUP_1, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_1, 0xc0ff, 0x0900 },
+ { BWN_PHY_TR_LOOKUP_2, 0xffc0, 0x000a },
+ { BWN_PHY_TR_LOOKUP_2, 0xc0ff, 0x0b00 },
+ { BWN_PHY_TR_LOOKUP_3, 0xffc0, 0x0006 },
+ { BWN_PHY_TR_LOOKUP_3, 0xc0ff, 0x0500 },
+ { BWN_PHY_TR_LOOKUP_4, 0xffc0, 0x0006 },
+ { BWN_PHY_TR_LOOKUP_4, 0xc0ff, 0x0700 }
+ };
+ int i;
+ uint16_t tmp, tmp2;
+
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_DAC_CTL, 0xf7ff);
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL_OVR, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_0, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2, 0);
+ BWN_PHY_SET(mac, BWN_PHY_AFE_DAC_CTL, 0x0004);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDMSYNCTHRESH0, 0xff00, 0x0078);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CLIPCTRTHRESH, 0x83ff, 0x5800);
+ BWN_PHY_WRITE(mac, BWN_PHY_ADC_COMPENSATION_CTL, 0x0016);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_ADC_CTL_0, 0xfff8, 0x0004);
+ BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0x00ff, 0x5400);
+ BWN_PHY_SETMASK(mac, BWN_PHY_HIGAINDB, 0x00ff, 0x2400);
+ BWN_PHY_SETMASK(mac, BWN_PHY_LOWGAINDB, 0x00ff, 0x2100);
+ BWN_PHY_SETMASK(mac, BWN_PHY_VERYLOWGAINDB, 0xff00, 0x0006);
+ BWN_PHY_MASK(mac, BWN_PHY_RX_RADIO_CTL, 0xfffe);
+ for (i = 0; i < N(v1); i++)
+ BWN_PHY_SETMASK(mac, v1[i].offset, v1[i].mask, v1[i].set);
+ BWN_PHY_SETMASK(mac, BWN_PHY_INPUT_PWRDB,
+ 0xff00, plp->plp_rxpwroffset);
+ if ((siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM) &&
+ ((IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) ||
+ (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_LDO_PAREF))) {
+ siba_cc_pmu_set_ldovolt(sc->sc_dev, SIBA_LDO_PAREF, 0x28);
+ siba_cc_pmu_set_ldoparef(sc->sc_dev, 1);
+ if (mac->mac_phy.rev == 0)
+ BWN_PHY_SETMASK(mac, BWN_PHY_LP_RF_SIGNAL_LUT,
+ 0xffcf, 0x0010);
+ bwn_tab_write(mac, BWN_TAB_2(11, 7), 60);
+ } else {
+ siba_cc_pmu_set_ldoparef(sc->sc_dev, 0);
+ BWN_PHY_SETMASK(mac, BWN_PHY_LP_RF_SIGNAL_LUT, 0xffcf, 0x0020);
+ bwn_tab_write(mac, BWN_TAB_2(11, 7), 100);
+ }
+ tmp = plp->plp_rssivf | plp->plp_rssivc << 4 | 0xa000;
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_RSSI_CTL_0, tmp);
+ if (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_RSSIINV)
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_RSSI_CTL_1, 0xf000, 0x0aaa);
+ else
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_RSSI_CTL_1, 0xf000, 0x02aa);
+ bwn_tab_write(mac, BWN_TAB_2(11, 1), 24);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RX_RADIO_CTL,
+ 0xfff9, (plp->plp_bxarch << 1));
+ if (mac->mac_phy.rev == 1 &&
+ (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_FEM_BT)) {
+ for (i = 0; i < N(v2); i++)
+ BWN_PHY_SETMASK(mac, v2[i].offset, v2[i].mask,
+ v2[i].set);
+ } else if (IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan) ||
+ (siba_get_pci_subdevice(sc->sc_dev) == 0x048a) ||
+ ((mac->mac_phy.rev == 0) &&
+ (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM))) {
+ for (i = 0; i < N(v3); i++)
+ BWN_PHY_SETMASK(mac, v3[i].offset, v3[i].mask,
+ v3[i].set);
+ } else if (mac->mac_phy.rev == 1 ||
+ (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_FEM)) {
+ for (i = 0; i < N(v4); i++)
+ BWN_PHY_SETMASK(mac, v4[i].offset, v4[i].mask,
+ v4[i].set);
+ } else {
+ for (i = 0; i < N(v5); i++)
+ BWN_PHY_SETMASK(mac, v5[i].offset, v5[i].mask,
+ v5[i].set);
+ }
+ if (mac->mac_phy.rev == 1 &&
+ (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_LDO_PAREF)) {
+ BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_5, BWN_PHY_TR_LOOKUP_1);
+ BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_6, BWN_PHY_TR_LOOKUP_2);
+ BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_7, BWN_PHY_TR_LOOKUP_3);
+ BWN_PHY_COPY(mac, BWN_PHY_TR_LOOKUP_8, BWN_PHY_TR_LOOKUP_4);
+ }
+ if ((siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_FEM_BT) &&
+ (siba_get_chipid(sc->sc_dev) == 0x5354) &&
+ (siba_get_chippkg(sc->sc_dev) == SIBA_CHIPPACK_BCM4712S)) {
+ BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x0006);
+ BWN_PHY_WRITE(mac, BWN_PHY_GPIO_SELECT, 0x0005);
+ BWN_PHY_WRITE(mac, BWN_PHY_GPIO_OUTEN, 0xffff);
+ bwn_hf_write(mac, bwn_hf_read(mac) | BWN_HF_PR45960W);
+ }
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ BWN_PHY_SET(mac, BWN_PHY_LP_PHY_CTL, 0x8000);
+ BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x0040);
+ BWN_PHY_SETMASK(mac, BWN_PHY_MINPWR_LEVEL, 0x00ff, 0xa400);
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xf0ff, 0x0b00);
+ BWN_PHY_SETMASK(mac, BWN_PHY_SYNCPEAKCNT, 0xfff8, 0x0007);
+ BWN_PHY_SETMASK(mac, BWN_PHY_DSSS_CONFIRM_CNT, 0xfff8, 0x0003);
+ BWN_PHY_SETMASK(mac, BWN_PHY_DSSS_CONFIRM_CNT, 0xffc7, 0x0020);
+ BWN_PHY_MASK(mac, BWN_PHY_IDLEAFTERPKTRXTO, 0x00ff);
+ } else {
+ BWN_PHY_MASK(mac, BWN_PHY_LP_PHY_CTL, 0x7fff);
+ BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, 0xffbf);
+ }
+ if (mac->mac_phy.rev == 1) {
+ tmp = BWN_PHY_READ(mac, BWN_PHY_CLIPCTRTHRESH);
+ tmp2 = (tmp & 0x03e0) >> 5;
+ tmp2 |= tmp2 << 5;
+ BWN_PHY_WRITE(mac, BWN_PHY_4C3, tmp2);
+ tmp = BWN_PHY_READ(mac, BWN_PHY_GAINDIRECTMISMATCH);
+ tmp2 = (tmp & 0x1f00) >> 8;
+ tmp2 |= tmp2 << 5;
+ BWN_PHY_WRITE(mac, BWN_PHY_4C4, tmp2);
+ tmp = BWN_PHY_READ(mac, BWN_PHY_VERYLOWGAINDB);
+ tmp2 = tmp & 0x00ff;
+ tmp2 |= tmp << 8;
+ BWN_PHY_WRITE(mac, BWN_PHY_4C5, tmp2);
+ }
+}
+
+struct bwn_b2062_freq {
+ uint16_t freq;
+ uint8_t value[6];
+};
+
+static void
+bwn_phy_lp_b2062_init(struct bwn_mac *mac)
+{
+#define CALC_CTL7(freq, div) \
+ (((800000000 * (div) + (freq)) / (2 * (freq)) - 8) & 0xff)
+#define CALC_CTL18(freq, div) \
+ ((((100 * (freq) + 16000000 * (div)) / (32000000 * (div))) - 1) & 0xff)
+#define CALC_CTL19(freq, div) \
+ ((((2 * (freq) + 1000000 * (div)) / (2000000 * (div))) - 1) & 0xff)
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ static const struct bwn_b2062_freq freqdata_tab[] = {
+ { 12000, { 6, 6, 6, 6, 10, 6 } },
+ { 13000, { 4, 4, 4, 4, 11, 7 } },
+ { 14400, { 3, 3, 3, 3, 12, 7 } },
+ { 16200, { 3, 3, 3, 3, 13, 8 } },
+ { 18000, { 2, 2, 2, 2, 14, 8 } },
+ { 19200, { 1, 1, 1, 1, 14, 9 } }
+ };
+ static const struct bwn_wpair v1[] = {
+ { BWN_B2062_N_TXCTL3, 0 },
+ { BWN_B2062_N_TXCTL4, 0 },
+ { BWN_B2062_N_TXCTL5, 0 },
+ { BWN_B2062_N_TXCTL6, 0 },
+ { BWN_B2062_N_PDNCTL0, 0x40 },
+ { BWN_B2062_N_PDNCTL0, 0 },
+ { BWN_B2062_N_CALIB_TS, 0x10 },
+ { BWN_B2062_N_CALIB_TS, 0 }
+ };
+ const struct bwn_b2062_freq *f = NULL;
+ uint32_t xtalfreq, ref;
+ unsigned int i;
+
+ bwn_phy_lp_b2062_tblinit(mac);
+
+ for (i = 0; i < N(v1); i++)
+ BWN_RF_WRITE(mac, v1[i].reg, v1[i].value);
+ if (mac->mac_phy.rev > 0)
+ BWN_RF_WRITE(mac, BWN_B2062_S_BG_CTL1,
+ (BWN_RF_READ(mac, BWN_B2062_N_COM2) >> 1) | 0x80);
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ BWN_RF_SET(mac, BWN_B2062_N_TSSI_CTL0, 0x1);
+ else
+ BWN_RF_MASK(mac, BWN_B2062_N_TSSI_CTL0, ~0x1);
+
+ KASSERT(siba_get_cc_caps(sc->sc_dev) & SIBA_CC_CAPS_PMU,
+ ("%s:%d: fail", __func__, __LINE__));
+ xtalfreq = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
+ KASSERT(xtalfreq != 0, ("%s:%d: fail", __func__, __LINE__));
+
+ if (xtalfreq <= 30000000) {
+ plp->plp_div = 1;
+ BWN_RF_MASK(mac, BWN_B2062_S_RFPLLCTL1, 0xfffb);
+ } else {
+ plp->plp_div = 2;
+ BWN_RF_SET(mac, BWN_B2062_S_RFPLLCTL1, 0x4);
+ }
+
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL7,
+ CALC_CTL7(xtalfreq, plp->plp_div));
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL18,
+ CALC_CTL18(xtalfreq, plp->plp_div));
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL19,
+ CALC_CTL19(xtalfreq, plp->plp_div));
+
+ ref = (1000 * plp->plp_div + 2 * xtalfreq) / (2000 * plp->plp_div);
+ ref &= 0xffff;
+ for (i = 0; i < N(freqdata_tab); i++) {
+ if (ref < freqdata_tab[i].freq) {
+ f = &freqdata_tab[i];
+ break;
+ }
+ }
+ if (f == NULL)
+ f = &freqdata_tab[N(freqdata_tab) - 1];
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL8,
+ ((uint16_t)(f->value[1]) << 4) | f->value[0]);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL9,
+ ((uint16_t)(f->value[3]) << 4) | f->value[2]);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL10, f->value[4]);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL11, f->value[5]);
+#undef CALC_CTL7
+#undef CALC_CTL18
+#undef CALC_CTL19
+}
+
+static void
+bwn_phy_lp_b2063_init(struct bwn_mac *mac)
+{
+
+ bwn_phy_lp_b2063_tblinit(mac);
+ BWN_RF_WRITE(mac, BWN_B2063_LOGEN_SP5, 0);
+ BWN_RF_SET(mac, BWN_B2063_COM8, 0x38);
+ BWN_RF_WRITE(mac, BWN_B2063_REG_SP1, 0x56);
+ BWN_RF_MASK(mac, BWN_B2063_RX_BB_CTL2, ~0x2);
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP7, 0);
+ BWN_RF_WRITE(mac, BWN_B2063_TX_RF_SP6, 0x20);
+ BWN_RF_WRITE(mac, BWN_B2063_TX_RF_SP9, 0x40);
+ if (mac->mac_phy.rev == 2) {
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP3, 0xa0);
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP4, 0xa0);
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP2, 0x18);
+ } else {
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP3, 0x20);
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP2, 0x20);
+ }
+}
+
+static void
+bwn_phy_lp_rxcal_r2(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ static const struct bwn_wpair v1[] = {
+ { BWN_B2063_RX_BB_SP8, 0x0 },
+ { BWN_B2063_RC_CALIB_CTL1, 0x7e },
+ { BWN_B2063_RC_CALIB_CTL1, 0x7c },
+ { BWN_B2063_RC_CALIB_CTL2, 0x15 },
+ { BWN_B2063_RC_CALIB_CTL3, 0x70 },
+ { BWN_B2063_RC_CALIB_CTL4, 0x52 },
+ { BWN_B2063_RC_CALIB_CTL5, 0x1 },
+ { BWN_B2063_RC_CALIB_CTL1, 0x7d }
+ };
+ static const struct bwn_wpair v2[] = {
+ { BWN_B2063_TX_BB_SP3, 0x0 },
+ { BWN_B2063_RC_CALIB_CTL1, 0x7e },
+ { BWN_B2063_RC_CALIB_CTL1, 0x7c },
+ { BWN_B2063_RC_CALIB_CTL2, 0x55 },
+ { BWN_B2063_RC_CALIB_CTL3, 0x76 }
+ };
+ uint32_t freqxtal = siba_get_cc_pmufreq(sc->sc_dev) * 1000;
+ int i;
+ uint8_t tmp;
+
+ tmp = BWN_RF_READ(mac, BWN_B2063_RX_BB_SP8) & 0xff;
+
+ for (i = 0; i < 2; i++)
+ BWN_RF_WRITE(mac, v1[i].reg, v1[i].value);
+ BWN_RF_MASK(mac, BWN_B2063_PLL_SP1, 0xf7);
+ for (i = 2; i < N(v1); i++)
+ BWN_RF_WRITE(mac, v1[i].reg, v1[i].value);
+ for (i = 0; i < 10000; i++) {
+ if (BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2)
+ break;
+ DELAY(1000);
+ }
+
+ if (!(BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2))
+ BWN_RF_WRITE(mac, BWN_B2063_RX_BB_SP8, tmp);
+
+ tmp = BWN_RF_READ(mac, BWN_B2063_TX_BB_SP3) & 0xff;
+
+ for (i = 0; i < N(v2); i++)
+ BWN_RF_WRITE(mac, v2[i].reg, v2[i].value);
+ if (freqxtal == 24000000) {
+ BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL4, 0xfc);
+ BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL5, 0x0);
+ } else {
+ BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL4, 0x13);
+ BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL5, 0x1);
+ }
+ BWN_RF_WRITE(mac, BWN_B2063_PA_SP7, 0x7d);
+ for (i = 0; i < 10000; i++) {
+ if (BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2)
+ break;
+ DELAY(1000);
+ }
+ if (!(BWN_RF_READ(mac, BWN_B2063_RC_CALIB_CTL6) & 0x2))
+ BWN_RF_WRITE(mac, BWN_B2063_TX_BB_SP3, tmp);
+ BWN_RF_WRITE(mac, BWN_B2063_RC_CALIB_CTL1, 0x7e);
+}
+
+static void
+bwn_phy_lp_rccal_r12(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct bwn_phy_lp_iq_est ie;
+ struct bwn_txgain tx_gains;
+ static const uint32_t pwrtbl[21] = {
+ 0x10000, 0x10557, 0x10e2d, 0x113e0, 0x10f22, 0x0ff64,
+ 0x0eda2, 0x0e5d4, 0x0efd1, 0x0fbe8, 0x0b7b8, 0x04b35,
+ 0x01a5e, 0x00a0b, 0x00444, 0x001fd, 0x000ff, 0x00088,
+ 0x0004c, 0x0002c, 0x0001a,
+ };
+ uint32_t npwr, ipwr, sqpwr, tmp;
+ int loopback, i, j, sum, error;
+ uint16_t save[7];
+ uint8_t txo, bbmult, txpctlmode;
+
+ error = bwn_phy_lp_switch_channel(mac, 7);
+ if (error)
+ device_printf(sc->sc_dev,
+ "failed to change channel to 7 (%d)\n", error);
+ txo = (BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVR) & 0x40) ? 1 : 0;
+ bbmult = bwn_phy_lp_get_bbmult(mac);
+ if (txo)
+ tx_gains = bwn_phy_lp_get_txgain(mac);
+
+ save[0] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_0);
+ save[1] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_VAL_0);
+ save[2] = BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVR);
+ save[3] = BWN_PHY_READ(mac, BWN_PHY_AFE_CTL_OVRVAL);
+ save[4] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_2);
+ save[5] = BWN_PHY_READ(mac, BWN_PHY_RF_OVERRIDE_2_VAL);
+ save[6] = BWN_PHY_READ(mac, BWN_PHY_LP_PHY_CTL);
+
+ bwn_phy_lp_get_txpctlmode(mac);
+ txpctlmode = plp->plp_txpctlmode;
+ bwn_phy_lp_set_txpctlmode(mac, BWN_PHYLP_TXPCTL_OFF);
+
+ /* disable CRS */
+ bwn_phy_lp_set_deaf(mac, 1);
+ bwn_phy_lp_set_trsw_over(mac, 0, 1);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffb);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x4);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfff7);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x8);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x10);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x10);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xffdf);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x20);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xffbf);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x40);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0x7);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0x38);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xff3f);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0x100);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfdff);
+ BWN_PHY_WRITE(mac, BWN_PHY_PS_CTL_OVERRIDE_VAL0, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_PS_CTL_OVERRIDE_VAL1, 1);
+ BWN_PHY_WRITE(mac, BWN_PHY_PS_CTL_OVERRIDE_VAL2, 0x20);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfbff);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xf7ff);
+ BWN_PHY_WRITE(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL, 0);
+ BWN_PHY_WRITE(mac, BWN_PHY_RX_GAIN_CTL_OVERRIDE_VAL, 0x45af);
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2, 0x3ff);
+
+ loopback = bwn_phy_lp_loopback(mac);
+ if (loopback == -1)
+ goto done;
+ bwn_phy_lp_set_rxgain_idx(mac, loopback);
+ BWN_PHY_SETMASK(mac, BWN_PHY_LP_PHY_CTL, 0xffbf, 0x40);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xfff8, 0x1);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xffc7, 0x8);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL, 0xff3f, 0xc0);
+
+ tmp = 0;
+ memset(&ie, 0, sizeof(ie));
+ for (i = 128; i <= 159; i++) {
+ BWN_RF_WRITE(mac, BWN_B2062_N_RXBB_CALIB2, i);
+ sum = 0;
+ for (j = 5; j <= 25; j++) {
+ bwn_phy_lp_ddfs_turnon(mac, 1, 1, j, j, 0);
+ if (!(bwn_phy_lp_rx_iq_est(mac, 1000, 32, &ie)))
+ goto done;
+ sqpwr = ie.ie_ipwr + ie.ie_qpwr;
+ ipwr = ((pwrtbl[j - 5] >> 3) + 1) >> 1;
+ npwr = bwn_phy_lp_roundup(sqpwr, (j == 5) ? sqpwr : 0,
+ 12);
+ sum += ((ipwr - npwr) * (ipwr - npwr));
+ if ((i == 128) || (sum < tmp)) {
+ plp->plp_rccap = i;
+ tmp = sum;
+ }
+ }
+ }
+ bwn_phy_lp_ddfs_turnoff(mac);
+done:
+ /* restore CRS */
+ bwn_phy_lp_clear_deaf(mac, 1);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_0, 0xff80);
+ BWN_PHY_MASK(mac, BWN_PHY_RF_OVERRIDE_2, 0xfc00);
+
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_VAL_0, save[1]);
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_0, save[0]);
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL_OVRVAL, save[3]);
+ BWN_PHY_WRITE(mac, BWN_PHY_AFE_CTL_OVR, save[2]);
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2_VAL, save[5]);
+ BWN_PHY_WRITE(mac, BWN_PHY_RF_OVERRIDE_2, save[4]);
+ BWN_PHY_WRITE(mac, BWN_PHY_LP_PHY_CTL, save[6]);
+
+ bwn_phy_lp_set_bbmult(mac, bbmult);
+ if (txo)
+ bwn_phy_lp_set_txgain(mac, &tx_gains);
+ bwn_phy_lp_set_txpctlmode(mac, txpctlmode);
+ if (plp->plp_rccap)
+ bwn_phy_lp_set_rccap(mac);
+}
+
+static void
+bwn_phy_lp_set_rccap(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ uint8_t rc_cap = (plp->plp_rccap & 0x1f) >> 1;
+
+ if (mac->mac_phy.rev == 1)
+ rc_cap = MIN(rc_cap + 5, 15);
+
+ BWN_RF_WRITE(mac, BWN_B2062_N_RXBB_CALIB2,
+ MAX(plp->plp_rccap - 4, 0x80));
+ BWN_RF_WRITE(mac, BWN_B2062_N_TXCTL_A, rc_cap | 0x80);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RXG_CNT16,
+ ((plp->plp_rccap & 0x1f) >> 2) | 0x80);
+}
+
+static uint32_t
+bwn_phy_lp_roundup(uint32_t value, uint32_t div, uint8_t pre)
+{
+ uint32_t i, q, r;
+
+ if (div == 0)
+ return (0);
+
+ for (i = 0, q = value / div, r = value % div; i < pre; i++) {
+ q <<= 1;
+ if (r << 1 >= div) {
+ q++;
+ r = (r << 1) - div;
+ }
+ }
+ if (r << 1 >= div)
+ q++;
+ return (q);
+}
+
+static void
+bwn_phy_lp_b2062_reset_pllbias(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL2, 0xff);
+ DELAY(20);
+ if (siba_get_chipid(sc->sc_dev) == 0x5354) {
+ BWN_RF_WRITE(mac, BWN_B2062_N_COM1, 4);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL2, 4);
+ } else {
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL2, 0);
+ }
+ DELAY(5);
+}
+
+static void
+bwn_phy_lp_b2062_vco_calib(struct bwn_mac *mac)
+{
+
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL21, 0x42);
+ BWN_RF_WRITE(mac, BWN_B2062_S_RFPLLCTL21, 0x62);
+ DELAY(200);
+}
+
+static void
+bwn_phy_lp_b2062_tblinit(struct bwn_mac *mac)
+{
+#define FLAG_A 0x01
+#define FLAG_G 0x02
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ static const struct bwn_b206x_rfinit_entry bwn_b2062_init_tab[] = {
+ { BWN_B2062_N_COM4, 0x1, 0x0, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_PDNCTL1, 0x0, 0xca, FLAG_G, },
+ { BWN_B2062_N_PDNCTL3, 0x0, 0x0, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_PDNCTL4, 0x15, 0x2a, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_LGENC, 0xDB, 0xff, FLAG_A, },
+ { BWN_B2062_N_LGENATUNE0, 0xdd, 0x0, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_LGENATUNE2, 0xdd, 0x0, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_LGENATUNE3, 0x77, 0xB5, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_LGENACTL3, 0x0, 0xff, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_LGENACTL7, 0x33, 0x33, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_RXA_CTL1, 0x0, 0x0, FLAG_G, },
+ { BWN_B2062_N_RXBB_CTL0, 0x82, 0x80, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_RXBB_GAIN1, 0x4, 0x4, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_RXBB_GAIN2, 0x0, 0x0, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_TXCTL4, 0x3, 0x3, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_TXCTL5, 0x2, 0x2, FLAG_A | FLAG_G, },
+ { BWN_B2062_N_TX_TUNE, 0x88, 0x1b, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_COM4, 0x1, 0x0, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_PDS_CTL0, 0xff, 0xff, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_LGENG_CTL0, 0xf8, 0xd8, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_LGENG_CTL1, 0x3c, 0x24, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_LGENG_CTL8, 0x88, 0x80, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_LGENG_CTL10, 0x88, 0x80, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL0, 0x98, 0x98, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL1, 0x10, 0x10, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL5, 0x43, 0x43, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL6, 0x47, 0x47, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL7, 0xc, 0xc, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL8, 0x11, 0x11, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL9, 0x11, 0x11, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL10, 0xe, 0xe, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL11, 0x8, 0x8, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL12, 0x33, 0x33, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL13, 0xa, 0xa, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL14, 0x6, 0x6, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL18, 0x3e, 0x3e, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL19, 0x13, 0x13, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL21, 0x62, 0x62, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL22, 0x7, 0x7, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL23, 0x16, 0x16, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL24, 0x5c, 0x5c, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL25, 0x95, 0x95, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL30, 0xa0, 0xa0, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL31, 0x4, 0x4, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL33, 0xcc, 0xcc, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RFPLLCTL34, 0x7, 0x7, FLAG_A | FLAG_G, },
+ { BWN_B2062_S_RXG_CNT8, 0xf, 0xf, FLAG_A, },
+ };
+ const struct bwn_b206x_rfinit_entry *br;
+ unsigned int i;
+
+ for (i = 0; i < N(bwn_b2062_init_tab); i++) {
+ br = &bwn_b2062_init_tab[i];
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ if (br->br_flags & FLAG_G)
+ BWN_RF_WRITE(mac, br->br_offset, br->br_valueg);
+ } else {
+ if (br->br_flags & FLAG_A)
+ BWN_RF_WRITE(mac, br->br_offset, br->br_valuea);
+ }
+ }
+#undef FLAG_A
+#undef FLAG_B
+}
+
+static void
+bwn_phy_lp_b2063_tblinit(struct bwn_mac *mac)
+{
+#define FLAG_A 0x01
+#define FLAG_G 0x02
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ static const struct bwn_b206x_rfinit_entry bwn_b2063_init_tab[] = {
+ { BWN_B2063_COM1, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM10, 0x1, 0x0, FLAG_A, },
+ { BWN_B2063_COM16, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM17, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM18, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM19, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM20, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM21, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM22, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM23, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_COM24, 0x0, 0x0, FLAG_G, },
+ { BWN_B2063_LOGEN_SP1, 0xe8, 0xd4, FLAG_A | FLAG_G, },
+ { BWN_B2063_LOGEN_SP2, 0xa7, 0x53, FLAG_A | FLAG_G, },
+ { BWN_B2063_LOGEN_SP4, 0xf0, 0xf, FLAG_A | FLAG_G, },
+ { BWN_B2063_G_RX_SP1, 0x1f, 0x5e, FLAG_G, },
+ { BWN_B2063_G_RX_SP2, 0x7f, 0x7e, FLAG_G, },
+ { BWN_B2063_G_RX_SP3, 0x30, 0xf0, FLAG_G, },
+ { BWN_B2063_G_RX_SP7, 0x7f, 0x7f, FLAG_A | FLAG_G, },
+ { BWN_B2063_G_RX_SP10, 0xc, 0xc, FLAG_A | FLAG_G, },
+ { BWN_B2063_A_RX_SP1, 0x3c, 0x3f, FLAG_A, },
+ { BWN_B2063_A_RX_SP2, 0xfc, 0xfe, FLAG_A, },
+ { BWN_B2063_A_RX_SP7, 0x8, 0x8, FLAG_A | FLAG_G, },
+ { BWN_B2063_RX_BB_SP4, 0x60, 0x60, FLAG_A | FLAG_G, },
+ { BWN_B2063_RX_BB_SP8, 0x30, 0x30, FLAG_A | FLAG_G, },
+ { BWN_B2063_TX_RF_SP3, 0xc, 0xb, FLAG_A | FLAG_G, },
+ { BWN_B2063_TX_RF_SP4, 0x10, 0xf, FLAG_A | FLAG_G, },
+ { BWN_B2063_PA_SP1, 0x3d, 0xfd, FLAG_A | FLAG_G, },
+ { BWN_B2063_TX_BB_SP1, 0x2, 0x2, FLAG_A | FLAG_G, },
+ { BWN_B2063_BANDGAP_CTL1, 0x56, 0x56, FLAG_A | FLAG_G, },
+ { BWN_B2063_JTAG_VCO2, 0xF7, 0xF7, FLAG_A | FLAG_G, },
+ { BWN_B2063_G_RX_MIX3, 0x71, 0x71, FLAG_A | FLAG_G, },
+ { BWN_B2063_G_RX_MIX4, 0x71, 0x71, FLAG_A | FLAG_G, },
+ { BWN_B2063_A_RX_1ST2, 0xf0, 0x30, FLAG_A, },
+ { BWN_B2063_A_RX_PS6, 0x77, 0x77, FLAG_A | FLAG_G, },
+ { BWN_B2063_A_RX_MIX4, 0x3, 0x3, FLAG_A | FLAG_G, },
+ { BWN_B2063_A_RX_MIX5, 0xf, 0xf, FLAG_A | FLAG_G, },
+ { BWN_B2063_A_RX_MIX6, 0xf, 0xf, FLAG_A | FLAG_G, },
+ { BWN_B2063_RX_TIA_CTL1, 0x77, 0x77, FLAG_A | FLAG_G, },
+ { BWN_B2063_RX_TIA_CTL3, 0x77, 0x77, FLAG_A | FLAG_G, },
+ { BWN_B2063_RX_BB_CTL2, 0x4, 0x4, FLAG_A | FLAG_G, },
+ { BWN_B2063_PA_CTL1, 0x0, 0x4, FLAG_A, },
+ { BWN_B2063_VREG_CTL1, 0x3, 0x3, FLAG_A | FLAG_G, },
+ };
+ const struct bwn_b206x_rfinit_entry *br;
+ unsigned int i;
+
+ for (i = 0; i < N(bwn_b2063_init_tab); i++) {
+ br = &bwn_b2063_init_tab[i];
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ if (br->br_flags & FLAG_G)
+ BWN_RF_WRITE(mac, br->br_offset, br->br_valueg);
+ } else {
+ if (br->br_flags & FLAG_A)
+ BWN_RF_WRITE(mac, br->br_offset, br->br_valuea);
+ }
+ }
+#undef FLAG_A
+#undef FLAG_B
+}
+
+static void
+bwn_tab_read_multi(struct bwn_mac *mac, uint32_t typenoffset,
+ int count, void *_data)
+{
+ unsigned int i;
+ uint32_t offset, type;
+ uint8_t *data = _data;
+
+ type = BWN_TAB_GETTYPE(typenoffset);
+ offset = BWN_TAB_GETOFFSET(typenoffset);
+ KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
+
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+
+ for (i = 0; i < count; i++) {
+ switch (type) {
+ case BWN_TAB_8BIT:
+ *data = BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO) & 0xff;
+ data++;
+ break;
+ case BWN_TAB_16BIT:
+ *((uint16_t *)data) = BWN_PHY_READ(mac,
+ BWN_PHY_TABLEDATALO);
+ data += 2;
+ break;
+ case BWN_TAB_32BIT:
+ *((uint32_t *)data) = BWN_PHY_READ(mac,
+ BWN_PHY_TABLEDATAHI);
+ *((uint32_t *)data) <<= 16;
+ *((uint32_t *)data) |= BWN_PHY_READ(mac,
+ BWN_PHY_TABLEDATALO);
+ data += 4;
+ break;
+ default:
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+ }
+}
+
+static void
+bwn_tab_write_multi(struct bwn_mac *mac, uint32_t typenoffset,
+ int count, const void *_data)
+{
+ uint32_t offset, type, value;
+ const uint8_t *data = _data;
+ unsigned int i;
+
+ type = BWN_TAB_GETTYPE(typenoffset);
+ offset = BWN_TAB_GETOFFSET(typenoffset);
+ KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
+
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+
+ for (i = 0; i < count; i++) {
+ switch (type) {
+ case BWN_TAB_8BIT:
+ value = *data;
+ data++;
+ KASSERT(!(value & ~0xff),
+ ("%s:%d: fail", __func__, __LINE__));
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
+ break;
+ case BWN_TAB_16BIT:
+ value = *((const uint16_t *)data);
+ data += 2;
+ KASSERT(!(value & ~0xffff),
+ ("%s:%d: fail", __func__, __LINE__));
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
+ break;
+ case BWN_TAB_32BIT:
+ value = *((const uint32_t *)data);
+ data += 4;
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATAHI, value >> 16);
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
+ break;
+ default:
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+ }
+}
+
+static struct bwn_txgain
+bwn_phy_lp_get_txgain(struct bwn_mac *mac)
+{
+ struct bwn_txgain tg;
+ uint16_t tmp;
+
+ tg.tg_dac = (BWN_PHY_READ(mac, BWN_PHY_AFE_DAC_CTL) & 0x380) >> 7;
+ if (mac->mac_phy.rev < 2) {
+ tmp = BWN_PHY_READ(mac,
+ BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL) & 0x7ff;
+ tg.tg_gm = tmp & 0x0007;
+ tg.tg_pga = (tmp & 0x0078) >> 3;
+ tg.tg_pad = (tmp & 0x780) >> 7;
+ return (tg);
+ }
+
+ tmp = BWN_PHY_READ(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL);
+ tg.tg_pad = BWN_PHY_READ(mac, BWN_PHY_OFDM(0xfb)) & 0xff;
+ tg.tg_gm = tmp & 0xff;
+ tg.tg_pga = (tmp >> 8) & 0xff;
+ return (tg);
+}
+
+static uint8_t
+bwn_phy_lp_get_bbmult(struct bwn_mac *mac)
+{
+
+ return (bwn_tab_read(mac, BWN_TAB_2(0, 87)) & 0xff00) >> 8;
+}
+
+static void
+bwn_phy_lp_set_txgain(struct bwn_mac *mac, struct bwn_txgain *tg)
+{
+ uint16_t pa;
+
+ if (mac->mac_phy.rev < 2) {
+ BWN_PHY_SETMASK(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL, 0xf800,
+ (tg->tg_pad << 7) | (tg->tg_pga << 3) | tg->tg_gm);
+ bwn_phy_lp_set_txgain_dac(mac, tg->tg_dac);
+ bwn_phy_lp_set_txgain_override(mac);
+ return;
+ }
+
+ pa = bwn_phy_lp_get_pa_gain(mac);
+ BWN_PHY_WRITE(mac, BWN_PHY_TX_GAIN_CTL_OVERRIDE_VAL,
+ (tg->tg_pga << 8) | tg->tg_gm);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfb), 0x8000,
+ tg->tg_pad | (pa << 6));
+ BWN_PHY_WRITE(mac, BWN_PHY_OFDM(0xfc), (tg->tg_pga << 8) | tg->tg_gm);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfd), 0x8000,
+ tg->tg_pad | (pa << 8));
+ bwn_phy_lp_set_txgain_dac(mac, tg->tg_dac);
+ bwn_phy_lp_set_txgain_override(mac);
+}
+
+static void
+bwn_phy_lp_set_bbmult(struct bwn_mac *mac, uint8_t bbmult)
+{
+
+ bwn_tab_write(mac, BWN_TAB_2(0, 87), (uint16_t)bbmult << 8);
+}
+
+static void
+bwn_phy_lp_set_trsw_over(struct bwn_mac *mac, uint8_t tx, uint8_t rx)
+{
+ uint16_t trsw = (tx << 1) | rx;
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffc, trsw);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x3);
+}
+
+static void
+bwn_phy_lp_set_rxgain(struct bwn_mac *mac, uint32_t gain)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ uint16_t ext_lna, high_gain, lna, low_gain, trsw, tmp;
+
+ if (mac->mac_phy.rev < 2) {
+ trsw = gain & 0x1;
+ lna = (gain & 0xfffc) | ((gain & 0xc) >> 2);
+ ext_lna = (gain & 2) >> 1;
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffe, trsw);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
+ 0xfbff, ext_lna << 10);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
+ 0xf7ff, ext_lna << 11);
+ BWN_PHY_WRITE(mac, BWN_PHY_RX_GAIN_CTL_OVERRIDE_VAL, lna);
+ } else {
+ low_gain = gain & 0xffff;
+ high_gain = (gain >> 16) & 0xf;
+ ext_lna = (gain >> 21) & 0x1;
+ trsw = ~(gain >> 20) & 0x1;
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0xfffe, trsw);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
+ 0xfdff, ext_lna << 9);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
+ 0xfbff, ext_lna << 10);
+ BWN_PHY_WRITE(mac, BWN_PHY_RX_GAIN_CTL_OVERRIDE_VAL, low_gain);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xfff0, high_gain);
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ tmp = (gain >> 2) & 0x3;
+ BWN_PHY_SETMASK(mac, BWN_PHY_RF_OVERRIDE_2_VAL,
+ 0xe7ff, tmp<<11);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xe6), 0xffe7,
+ tmp << 3);
+ }
+ }
+
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x1);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x10);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x40);
+ if (mac->mac_phy.rev >= 2) {
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x100);
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) {
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x400);
+ BWN_PHY_SET(mac, BWN_PHY_OFDM(0xe5), 0x8);
+ }
+ return;
+ }
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x200);
+}
+
+static void
+bwn_phy_lp_set_deaf(struct bwn_mac *mac, uint8_t user)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+
+ if (user)
+ plp->plp_crsusr_off = 1;
+ else
+ plp->plp_crssys_off = 1;
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xff1f, 0x80);
+}
+
+static void
+bwn_phy_lp_clear_deaf(struct bwn_mac *mac, uint8_t user)
+{
+ struct bwn_phy_lp *plp = &mac->mac_phy.phy_lp;
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+
+ if (user)
+ plp->plp_crsusr_off = 0;
+ else
+ plp->plp_crssys_off = 0;
+
+ if (plp->plp_crsusr_off || plp->plp_crssys_off)
+ return;
+
+ if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xff1f, 0x60);
+ else
+ BWN_PHY_SETMASK(mac, BWN_PHY_CRSGAIN_CTL, 0xff1f, 0x20);
+}
+
+static unsigned int
+bwn_sqrt(struct bwn_mac *mac, unsigned int x)
+{
+ /* Table holding (10 * sqrt(x)) for x between 1 and 256. */
+ static uint8_t sqrt_table[256] = {
+ 10, 14, 17, 20, 22, 24, 26, 28,
+ 30, 31, 33, 34, 36, 37, 38, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48,
+ 50, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 60, 61, 62, 63,
+ 64, 64, 65, 66, 67, 67, 68, 69,
+ 70, 70, 71, 72, 72, 73, 74, 74,
+ 75, 76, 76, 77, 78, 78, 79, 80,
+ 80, 81, 81, 82, 83, 83, 84, 84,
+ 85, 86, 86, 87, 87, 88, 88, 89,
+ 90, 90, 91, 91, 92, 92, 93, 93,
+ 94, 94, 95, 95, 96, 96, 97, 97,
+ 98, 98, 99, 100, 100, 100, 101, 101,
+ 102, 102, 103, 103, 104, 104, 105, 105,
+ 106, 106, 107, 107, 108, 108, 109, 109,
+ 110, 110, 110, 111, 111, 112, 112, 113,
+ 113, 114, 114, 114, 115, 115, 116, 116,
+ 117, 117, 117, 118, 118, 119, 119, 120,
+ 120, 120, 121, 121, 122, 122, 122, 123,
+ 123, 124, 124, 124, 125, 125, 126, 126,
+ 126, 127, 127, 128, 128, 128, 129, 129,
+ 130, 130, 130, 131, 131, 131, 132, 132,
+ 133, 133, 133, 134, 134, 134, 135, 135,
+ 136, 136, 136, 137, 137, 137, 138, 138,
+ 138, 139, 139, 140, 140, 140, 141, 141,
+ 141, 142, 142, 142, 143, 143, 143, 144,
+ 144, 144, 145, 145, 145, 146, 146, 146,
+ 147, 147, 147, 148, 148, 148, 149, 149,
+ 150, 150, 150, 150, 151, 151, 151, 152,
+ 152, 152, 153, 153, 153, 154, 154, 154,
+ 155, 155, 155, 156, 156, 156, 157, 157,
+ 157, 158, 158, 158, 159, 159, 159, 160
+ };
+
+ if (x == 0)
+ return (0);
+ if (x >= 256) {
+ unsigned int tmp;
+
+ for (tmp = 0; x >= (2 * tmp) + 1; x -= (2 * tmp++) + 1)
+ /* do nothing */ ;
+ return (tmp);
+ }
+ return (sqrt_table[x - 1] / 10);
+}
+
+static int
+bwn_phy_lp_calc_rx_iq_comp(struct bwn_mac *mac, uint16_t sample)
+{
+#define CALC_COEFF(_v, _x, _y, _z) do { \
+ int _t; \
+ _t = _x - 20; \
+ if (_t >= 0) { \
+ _v = ((_y << (30 - _x)) + (_z >> (1 + _t))) / (_z >> _t); \
+ } else { \
+ _v = ((_y << (30 - _x)) + (_z << (-1 - _t))) / (_z << -_t); \
+ } \
+} while (0)
+#define CALC_COEFF2(_v, _x, _y, _z) do { \
+ int _t; \
+ _t = _x - 11; \
+ if (_t >= 0) \
+ _v = (_y << (31 - _x)) / (_z >> _t); \
+ else \
+ _v = (_y << (31 - _x)) / (_z << -_t); \
+} while (0)
+ struct bwn_phy_lp_iq_est ie;
+ uint16_t v0, v1;
+ int tmp[2], ret;
+
+ v1 = BWN_PHY_READ(mac, BWN_PHY_RX_COMP_COEFF_S);
+ v0 = v1 >> 8;
+ v1 |= 0xff;
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0xff00, 0x00c0);
+ BWN_PHY_MASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0x00ff);
+
+ ret = bwn_phy_lp_rx_iq_est(mac, sample, 32, &ie);
+ if (ret == 0)
+ goto done;
+
+ if (ie.ie_ipwr + ie.ie_qpwr < 2) {
+ ret = 0;
+ goto done;
+ }
+
+ CALC_COEFF(tmp[0], bwn_nbits(ie.ie_iqprod), ie.ie_iqprod, ie.ie_ipwr);
+ CALC_COEFF2(tmp[1], bwn_nbits(ie.ie_qpwr), ie.ie_qpwr, ie.ie_ipwr);
+
+ tmp[1] = -bwn_sqrt(mac, tmp[1] - (tmp[0] * tmp[0]));
+ v0 = tmp[0] >> 3;
+ v1 = tmp[1] >> 4;
+done:
+ BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0xff00, v1);
+ BWN_PHY_SETMASK(mac, BWN_PHY_RX_COMP_COEFF_S, 0x00ff, v0 << 8);
+ return ret;
+#undef CALC_COEFF
+#undef CALC_COEFF2
+}
+
+static void
+bwn_phy_lp_tblinit_r01(struct bwn_mac *mac)
+{
+ static const uint16_t noisescale[] = {
+ 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4,
+ 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa400, 0xa4a4, 0xa4a4,
+ 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4,
+ 0xa4a4, 0xa4a4, 0x00a4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x4c00, 0x2d36, 0x0000, 0x0000, 0x4c00, 0x2d36,
+ };
+ static const uint16_t crsgainnft[] = {
+ 0x0366, 0x036a, 0x036f, 0x0364, 0x0367, 0x036d, 0x0374, 0x037f,
+ 0x036f, 0x037b, 0x038a, 0x0378, 0x0367, 0x036d, 0x0375, 0x0381,
+ 0x0374, 0x0381, 0x0392, 0x03a9, 0x03c4, 0x03e1, 0x0001, 0x001f,
+ 0x0040, 0x005e, 0x007f, 0x009e, 0x00bd, 0x00dd, 0x00fd, 0x011d,
+ 0x013d,
+ };
+ static const uint16_t filterctl[] = {
+ 0xa0fc, 0x10fc, 0x10db, 0x20b7, 0xff93, 0x10bf, 0x109b, 0x2077,
+ 0xff53, 0x0127,
+ };
+ static const uint32_t psctl[] = {
+ 0x00010000, 0x000000a0, 0x00040000, 0x00000048, 0x08080101,
+ 0x00000080, 0x08080101, 0x00000040, 0x08080101, 0x000000c0,
+ 0x08a81501, 0x000000c0, 0x0fe8fd01, 0x000000c0, 0x08300105,
+ 0x000000c0, 0x08080201, 0x000000c0, 0x08280205, 0x000000c0,
+ 0xe80802fe, 0x000000c7, 0x28080206, 0x000000c0, 0x08080202,
+ 0x000000c0, 0x0ba87602, 0x000000c0, 0x1068013d, 0x000000c0,
+ 0x10280105, 0x000000c0, 0x08880102, 0x000000c0, 0x08280106,
+ 0x000000c0, 0xe80801fd, 0x000000c7, 0xa8080115, 0x000000c0,
+ };
+ static const uint16_t ofdmcckgain_r0[] = {
+ 0x0001, 0x0001, 0x0001, 0x0001, 0x1001, 0x2001, 0x3001, 0x4001,
+ 0x5001, 0x6001, 0x7001, 0x7011, 0x7021, 0x2035, 0x2045, 0x2055,
+ 0x2065, 0x2075, 0x006d, 0x007d, 0x014d, 0x015d, 0x115d, 0x035d,
+ 0x135d, 0x055d, 0x155d, 0x0d5d, 0x1d5d, 0x2d5d, 0x555d, 0x655d,
+ 0x755d,
+ };
+ static const uint16_t ofdmcckgain_r1[] = {
+ 0x5000, 0x6000, 0x7000, 0x0001, 0x1001, 0x2001, 0x3001, 0x4001,
+ 0x5001, 0x6001, 0x7001, 0x7011, 0x7021, 0x2035, 0x2045, 0x2055,
+ 0x2065, 0x2075, 0x006d, 0x007d, 0x014d, 0x015d, 0x115d, 0x035d,
+ 0x135d, 0x055d, 0x155d, 0x0d5d, 0x1d5d, 0x2d5d, 0x555d, 0x655d,
+ 0x755d,
+ };
+ static const uint16_t gaindelta[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000,
+ };
+ static const uint32_t txpwrctl[] = {
+ 0x00000050, 0x0000004f, 0x0000004e, 0x0000004d, 0x0000004c,
+ 0x0000004b, 0x0000004a, 0x00000049, 0x00000048, 0x00000047,
+ 0x00000046, 0x00000045, 0x00000044, 0x00000043, 0x00000042,
+ 0x00000041, 0x00000040, 0x0000003f, 0x0000003e, 0x0000003d,
+ 0x0000003c, 0x0000003b, 0x0000003a, 0x00000039, 0x00000038,
+ 0x00000037, 0x00000036, 0x00000035, 0x00000034, 0x00000033,
+ 0x00000032, 0x00000031, 0x00000030, 0x0000002f, 0x0000002e,
+ 0x0000002d, 0x0000002c, 0x0000002b, 0x0000002a, 0x00000029,
+ 0x00000028, 0x00000027, 0x00000026, 0x00000025, 0x00000024,
+ 0x00000023, 0x00000022, 0x00000021, 0x00000020, 0x0000001f,
+ 0x0000001e, 0x0000001d, 0x0000001c, 0x0000001b, 0x0000001a,
+ 0x00000019, 0x00000018, 0x00000017, 0x00000016, 0x00000015,
+ 0x00000014, 0x00000013, 0x00000012, 0x00000011, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x000075a0, 0x000075a0, 0x000075a1,
+ 0x000075a1, 0x000075a2, 0x000075a2, 0x000075a3, 0x000075a3,
+ 0x000074b0, 0x000074b0, 0x000074b1, 0x000074b1, 0x000074b2,
+ 0x000074b2, 0x000074b3, 0x000074b3, 0x00006d20, 0x00006d20,
+ 0x00006d21, 0x00006d21, 0x00006d22, 0x00006d22, 0x00006d23,
+ 0x00006d23, 0x00004660, 0x00004660, 0x00004661, 0x00004661,
+ 0x00004662, 0x00004662, 0x00004663, 0x00004663, 0x00003e60,
+ 0x00003e60, 0x00003e61, 0x00003e61, 0x00003e62, 0x00003e62,
+ 0x00003e63, 0x00003e63, 0x00003660, 0x00003660, 0x00003661,
+ 0x00003661, 0x00003662, 0x00003662, 0x00003663, 0x00003663,
+ 0x00002e60, 0x00002e60, 0x00002e61, 0x00002e61, 0x00002e62,
+ 0x00002e62, 0x00002e63, 0x00002e63, 0x00002660, 0x00002660,
+ 0x00002661, 0x00002661, 0x00002662, 0x00002662, 0x00002663,
+ 0x00002663, 0x000025e0, 0x000025e0, 0x000025e1, 0x000025e1,
+ 0x000025e2, 0x000025e2, 0x000025e3, 0x000025e3, 0x00001de0,
+ 0x00001de0, 0x00001de1, 0x00001de1, 0x00001de2, 0x00001de2,
+ 0x00001de3, 0x00001de3, 0x00001d60, 0x00001d60, 0x00001d61,
+ 0x00001d61, 0x00001d62, 0x00001d62, 0x00001d63, 0x00001d63,
+ 0x00001560, 0x00001560, 0x00001561, 0x00001561, 0x00001562,
+ 0x00001562, 0x00001563, 0x00001563, 0x00000d60, 0x00000d60,
+ 0x00000d61, 0x00000d61, 0x00000d62, 0x00000d62, 0x00000d63,
+ 0x00000d63, 0x00000ce0, 0x00000ce0, 0x00000ce1, 0x00000ce1,
+ 0x00000ce2, 0x00000ce2, 0x00000ce3, 0x00000ce3, 0x00000e10,
+ 0x00000e10, 0x00000e11, 0x00000e11, 0x00000e12, 0x00000e12,
+ 0x00000e13, 0x00000e13, 0x00000bf0, 0x00000bf0, 0x00000bf1,
+ 0x00000bf1, 0x00000bf2, 0x00000bf2, 0x00000bf3, 0x00000bf3,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000,
+ 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000,
+ 0x04000000, 0x04200000, 0x04000000, 0x000000ff, 0x000002fc,
+ 0x0000fa08, 0x00000305, 0x00000206, 0x00000304, 0x0000fb04,
+ 0x0000fcff, 0x000005fb, 0x0000fd01, 0x00000401, 0x00000006,
+ 0x0000ff03, 0x000007fc, 0x0000fc08, 0x00000203, 0x0000fffb,
+ 0x00000600, 0x0000fa01, 0x0000fc03, 0x0000fe06, 0x0000fe00,
+ 0x00000102, 0x000007fd, 0x000004fb, 0x000006ff, 0x000004fd,
+ 0x0000fdfa, 0x000007fb, 0x0000fdfa, 0x0000fa06, 0x00000500,
+ 0x0000f902, 0x000007fa, 0x0000fafa, 0x00000500, 0x000007fa,
+ 0x00000700, 0x00000305, 0x000004ff, 0x00000801, 0x00000503,
+ 0x000005f9, 0x00000404, 0x0000fb08, 0x000005fd, 0x00000501,
+ 0x00000405, 0x0000fb03, 0x000007fc, 0x00000403, 0x00000303,
+ 0x00000402, 0x0000faff, 0x0000fe05, 0x000005fd, 0x0000fe01,
+ 0x000007fa, 0x00000202, 0x00000504, 0x00000102, 0x000008fe,
+ 0x0000fa04, 0x0000fafc, 0x0000fe08, 0x000000f9, 0x000002fa,
+ 0x000003fe, 0x00000304, 0x000004f9, 0x00000100, 0x0000fd06,
+ 0x000008fc, 0x00000701, 0x00000504, 0x0000fdfe, 0x0000fdfc,
+ 0x000003fe, 0x00000704, 0x000002fc, 0x000004f9, 0x0000fdfd,
+ 0x0000fa07, 0x00000205, 0x000003fd, 0x000005fb, 0x000004f9,
+ 0x00000804, 0x0000fc06, 0x0000fcf9, 0x00000100, 0x0000fe05,
+ 0x00000408, 0x0000fb02, 0x00000304, 0x000006fe, 0x000004fa,
+ 0x00000305, 0x000008fc, 0x00000102, 0x000001fd, 0x000004fc,
+ 0x0000fe03, 0x00000701, 0x000001fb, 0x000001f9, 0x00000206,
+ 0x000006fd, 0x00000508, 0x00000700, 0x00000304, 0x000005fe,
+ 0x000005ff, 0x0000fa04, 0x00000303, 0x0000fefb, 0x000007f9,
+ 0x0000fefc, 0x000004fd, 0x000005fc, 0x0000fffd, 0x0000fc08,
+ 0x0000fbf9, 0x0000fd07, 0x000008fb, 0x0000fe02, 0x000006fb,
+ 0x00000702,
+ };
+
+ KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
+
+ bwn_tab_write_multi(mac, BWN_TAB_1(2, 0), N(bwn_tab_sigsq_tbl),
+ bwn_tab_sigsq_tbl);
+ bwn_tab_write_multi(mac, BWN_TAB_2(1, 0), N(noisescale), noisescale);
+ bwn_tab_write_multi(mac, BWN_TAB_2(14, 0), N(crsgainnft), crsgainnft);
+ bwn_tab_write_multi(mac, BWN_TAB_2(8, 0), N(filterctl), filterctl);
+ bwn_tab_write_multi(mac, BWN_TAB_4(9, 0), N(psctl), psctl);
+ bwn_tab_write_multi(mac, BWN_TAB_1(6, 0), N(bwn_tab_pllfrac_tbl),
+ bwn_tab_pllfrac_tbl);
+ bwn_tab_write_multi(mac, BWN_TAB_2(0, 0), N(bwn_tabl_iqlocal_tbl),
+ bwn_tabl_iqlocal_tbl);
+ if (mac->mac_phy.rev == 0) {
+ bwn_tab_write_multi(mac, BWN_TAB_2(13, 0), N(ofdmcckgain_r0),
+ ofdmcckgain_r0);
+ bwn_tab_write_multi(mac, BWN_TAB_2(12, 0), N(ofdmcckgain_r0),
+ ofdmcckgain_r0);
+ } else {
+ bwn_tab_write_multi(mac, BWN_TAB_2(13, 0), N(ofdmcckgain_r1),
+ ofdmcckgain_r1);
+ bwn_tab_write_multi(mac, BWN_TAB_2(12, 0), N(ofdmcckgain_r1),
+ ofdmcckgain_r1);
+ }
+ bwn_tab_write_multi(mac, BWN_TAB_2(15, 0), N(gaindelta), gaindelta);
+ bwn_tab_write_multi(mac, BWN_TAB_4(10, 0), N(txpwrctl), txpwrctl);
+}
+
+static void
+bwn_phy_lp_tblinit_r2(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ int i;
+ static const uint16_t noisescale[] = {
+ 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
+ 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
+ 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
+ 0x00a4, 0x00a4, 0x0000, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
+ 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
+ 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4,
+ 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4
+ };
+ static const uint32_t filterctl[] = {
+ 0x000141fc, 0x000021fc, 0x000021b7, 0x0000416f, 0x0001ff27,
+ 0x0000217f, 0x00002137, 0x000040ef, 0x0001fea7, 0x0000024f
+ };
+ static const uint32_t psctl[] = {
+ 0x00e38e08, 0x00e08e38, 0x00000000, 0x00000000, 0x00000000,
+ 0x00002080, 0x00006180, 0x00003002, 0x00000040, 0x00002042,
+ 0x00180047, 0x00080043, 0x00000041, 0x000020c1, 0x00046006,
+ 0x00042002, 0x00040000, 0x00002003, 0x00180006, 0x00080002
+ };
+ static const uint32_t gainidx[] = {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x10000001, 0x00000000,
+ 0x20000082, 0x00000000, 0x40000104, 0x00000000, 0x60004207,
+ 0x00000001, 0x7000838a, 0x00000001, 0xd021050d, 0x00000001,
+ 0xe041c683, 0x00000001, 0x50828805, 0x00000000, 0x80e34288,
+ 0x00000000, 0xb144040b, 0x00000000, 0xe1a6058e, 0x00000000,
+ 0x12064711, 0x00000001, 0xb0a18612, 0x00000010, 0xe1024794,
+ 0x00000010, 0x11630915, 0x00000011, 0x31c3ca1b, 0x00000011,
+ 0xc1848a9c, 0x00000018, 0xf1e50da0, 0x00000018, 0x22468e21,
+ 0x00000019, 0x4286d023, 0x00000019, 0xa347d0a4, 0x00000019,
+ 0xb36811a6, 0x00000019, 0xf3e89227, 0x00000019, 0x0408d329,
+ 0x0000001a, 0x244953aa, 0x0000001a, 0x346994ab, 0x0000001a,
+ 0x54aa152c, 0x0000001a, 0x64ca55ad, 0x0000001a, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x10000001, 0x00000000, 0x20000082,
+ 0x00000000, 0x40000104, 0x00000000, 0x60004207, 0x00000001,
+ 0x7000838a, 0x00000001, 0xd021050d, 0x00000001, 0xe041c683,
+ 0x00000001, 0x50828805, 0x00000000, 0x80e34288, 0x00000000,
+ 0xb144040b, 0x00000000, 0xe1a6058e, 0x00000000, 0x12064711,
+ 0x00000001, 0xb0a18612, 0x00000010, 0xe1024794, 0x00000010,
+ 0x11630915, 0x00000011, 0x31c3ca1b, 0x00000011, 0xc1848a9c,
+ 0x00000018, 0xf1e50da0, 0x00000018, 0x22468e21, 0x00000019,
+ 0x4286d023, 0x00000019, 0xa347d0a4, 0x00000019, 0xb36811a6,
+ 0x00000019, 0xf3e89227, 0x00000019, 0x0408d329, 0x0000001a,
+ 0x244953aa, 0x0000001a, 0x346994ab, 0x0000001a, 0x54aa152c,
+ 0x0000001a, 0x64ca55ad, 0x0000001a
+ };
+ static const uint16_t auxgainidx[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0001, 0x0002, 0x0004, 0x0016, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002,
+ 0x0004, 0x0016
+ };
+ static const uint16_t swctl[] = {
+ 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
+ 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
+ 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009,
+ 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
+ 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
+ 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028,
+ 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009,
+ 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018
+ };
+ static const uint8_t hf[] = {
+ 0x4b, 0x36, 0x24, 0x18, 0x49, 0x34, 0x23, 0x17, 0x48,
+ 0x33, 0x23, 0x17, 0x48, 0x33, 0x23, 0x17
+ };
+ static const uint32_t gainval[] = {
+ 0x00000008, 0x0000000e, 0x00000014, 0x0000001a, 0x000000fb,
+ 0x00000004, 0x00000008, 0x0000000d, 0x00000001, 0x00000004,
+ 0x00000007, 0x0000000a, 0x0000000d, 0x00000010, 0x00000012,
+ 0x00000015, 0x00000000, 0x00000006, 0x0000000c, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000012, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x0000001e, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000006, 0x00000009, 0x0000000c, 0x0000000f, 0x00000012,
+ 0x00000015, 0x00000018, 0x0000001b, 0x0000001e, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000009,
+ 0x000000f1, 0x00000000, 0x00000000
+ };
+ static const uint16_t gain[] = {
+ 0x0000, 0x0400, 0x0800, 0x0802, 0x0804, 0x0806, 0x0807, 0x0808,
+ 0x080a, 0x080b, 0x080c, 0x080e, 0x080f, 0x0810, 0x0812, 0x0813,
+ 0x0814, 0x0816, 0x0817, 0x081a, 0x081b, 0x081f, 0x0820, 0x0824,
+ 0x0830, 0x0834, 0x0837, 0x083b, 0x083f, 0x0840, 0x0844, 0x0857,
+ 0x085b, 0x085f, 0x08d7, 0x08db, 0x08df, 0x0957, 0x095b, 0x095f,
+ 0x0b57, 0x0b5b, 0x0b5f, 0x0f5f, 0x135f, 0x175f, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+ };
+ static const uint32_t papdeps[] = {
+ 0x00000000, 0x00013ffc, 0x0001dff3, 0x0001bff0, 0x00023fe9,
+ 0x00021fdf, 0x00028fdf, 0x00033fd2, 0x00039fcb, 0x00043fc7,
+ 0x0004efc2, 0x00055fb5, 0x0005cfb0, 0x00063fa8, 0x00068fa3,
+ 0x00071f98, 0x0007ef92, 0x00084f8b, 0x0008df82, 0x00097f77,
+ 0x0009df69, 0x000a3f62, 0x000adf57, 0x000b6f4c, 0x000bff41,
+ 0x000c9f39, 0x000cff30, 0x000dbf27, 0x000e4f1e, 0x000edf16,
+ 0x000f7f13, 0x00102f11, 0x00110f10, 0x0011df11, 0x0012ef15,
+ 0x00143f1c, 0x00158f27, 0x00172f35, 0x00193f47, 0x001baf5f,
+ 0x001e6f7e, 0x0021cfa4, 0x0025bfd2, 0x002a2008, 0x002fb047,
+ 0x00360090, 0x003d40e0, 0x0045c135, 0x004fb189, 0x005ae1d7,
+ 0x0067221d, 0x0075025a, 0x007ff291, 0x007ff2bf, 0x007ff2e3,
+ 0x007ff2ff, 0x007ff315, 0x007ff329, 0x007ff33f, 0x007ff356,
+ 0x007ff36e, 0x007ff39c, 0x007ff441, 0x007ff506
+ };
+ static const uint32_t papdmult[] = {
+ 0x001111e0, 0x00652051, 0x00606055, 0x005b005a, 0x00555060,
+ 0x00511065, 0x004c806b, 0x0047d072, 0x00444078, 0x00400080,
+ 0x003ca087, 0x0039408f, 0x0035e098, 0x0032e0a1, 0x003030aa,
+ 0x002d80b4, 0x002ae0bf, 0x002880ca, 0x002640d6, 0x002410e3,
+ 0x002220f0, 0x002020ff, 0x001e510e, 0x001ca11e, 0x001b012f,
+ 0x00199140, 0x00182153, 0x0016c168, 0x0015817d, 0x00145193,
+ 0x001321ab, 0x001211c5, 0x001111e0, 0x001021fc, 0x000f321a,
+ 0x000e523a, 0x000d925c, 0x000cd27f, 0x000c12a5, 0x000b62cd,
+ 0x000ac2f8, 0x000a2325, 0x00099355, 0x00091387, 0x000883bd,
+ 0x000813f5, 0x0007a432, 0x00073471, 0x0006c4b5, 0x000664fc,
+ 0x00061547, 0x0005b598, 0x000565ec, 0x00051646, 0x0004d6a5,
+ 0x0004870a, 0x00044775, 0x000407e6, 0x0003d85e, 0x000398dd,
+ 0x00036963, 0x000339f2, 0x00030a89, 0x0002db28
+ };
+ static const uint32_t gainidx_a0[] = {
+ 0x001111e0, 0x00652051, 0x00606055, 0x005b005a, 0x00555060,
+ 0x00511065, 0x004c806b, 0x0047d072, 0x00444078, 0x00400080,
+ 0x003ca087, 0x0039408f, 0x0035e098, 0x0032e0a1, 0x003030aa,
+ 0x002d80b4, 0x002ae0bf, 0x002880ca, 0x002640d6, 0x002410e3,
+ 0x002220f0, 0x002020ff, 0x001e510e, 0x001ca11e, 0x001b012f,
+ 0x00199140, 0x00182153, 0x0016c168, 0x0015817d, 0x00145193,
+ 0x001321ab, 0x001211c5, 0x001111e0, 0x001021fc, 0x000f321a,
+ 0x000e523a, 0x000d925c, 0x000cd27f, 0x000c12a5, 0x000b62cd,
+ 0x000ac2f8, 0x000a2325, 0x00099355, 0x00091387, 0x000883bd,
+ 0x000813f5, 0x0007a432, 0x00073471, 0x0006c4b5, 0x000664fc,
+ 0x00061547, 0x0005b598, 0x000565ec, 0x00051646, 0x0004d6a5,
+ 0x0004870a, 0x00044775, 0x000407e6, 0x0003d85e, 0x000398dd,
+ 0x00036963, 0x000339f2, 0x00030a89, 0x0002db28
+ };
+ static const uint16_t auxgainidx_a0[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0002, 0x0014, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0002, 0x0014
+ };
+ static const uint32_t gainval_a0[] = {
+ 0x00000008, 0x0000000e, 0x00000014, 0x0000001a, 0x000000fb,
+ 0x00000004, 0x00000008, 0x0000000d, 0x00000001, 0x00000004,
+ 0x00000007, 0x0000000a, 0x0000000d, 0x00000010, 0x00000012,
+ 0x00000015, 0x00000000, 0x00000006, 0x0000000c, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000012, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x0000001e, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
+ 0x00000006, 0x00000009, 0x0000000c, 0x0000000f, 0x00000012,
+ 0x00000015, 0x00000018, 0x0000001b, 0x0000001e, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f,
+ 0x000000f7, 0x00000000, 0x00000000
+ };
+ static const uint16_t gain_a0[] = {
+ 0x0000, 0x0002, 0x0004, 0x0006, 0x0007, 0x0008, 0x000a, 0x000b,
+ 0x000c, 0x000e, 0x000f, 0x0010, 0x0012, 0x0013, 0x0014, 0x0016,
+ 0x0017, 0x001a, 0x001b, 0x001f, 0x0020, 0x0024, 0x0030, 0x0034,
+ 0x0037, 0x003b, 0x003f, 0x0040, 0x0044, 0x0057, 0x005b, 0x005f,
+ 0x00d7, 0x00db, 0x00df, 0x0157, 0x015b, 0x015f, 0x0357, 0x035b,
+ 0x035f, 0x075f, 0x0b5f, 0x0f5f, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+ };
+
+ KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
+
+ for (i = 0; i < 704; i++)
+ bwn_tab_write(mac, BWN_TAB_4(7, i), 0);
+
+ bwn_tab_write_multi(mac, BWN_TAB_1(2, 0), N(bwn_tab_sigsq_tbl),
+ bwn_tab_sigsq_tbl);
+ bwn_tab_write_multi(mac, BWN_TAB_2(1, 0), N(noisescale), noisescale);
+ bwn_tab_write_multi(mac, BWN_TAB_4(11, 0), N(filterctl), filterctl);
+ bwn_tab_write_multi(mac, BWN_TAB_4(12, 0), N(psctl), psctl);
+ bwn_tab_write_multi(mac, BWN_TAB_4(13, 0), N(gainidx), gainidx);
+ bwn_tab_write_multi(mac, BWN_TAB_2(14, 0), N(auxgainidx), auxgainidx);
+ bwn_tab_write_multi(mac, BWN_TAB_2(15, 0), N(swctl), swctl);
+ bwn_tab_write_multi(mac, BWN_TAB_1(16, 0), N(hf), hf);
+ bwn_tab_write_multi(mac, BWN_TAB_4(17, 0), N(gainval), gainval);
+ bwn_tab_write_multi(mac, BWN_TAB_2(18, 0), N(gain), gain);
+ bwn_tab_write_multi(mac, BWN_TAB_1(6, 0), N(bwn_tab_pllfrac_tbl),
+ bwn_tab_pllfrac_tbl);
+ bwn_tab_write_multi(mac, BWN_TAB_2(0, 0), N(bwn_tabl_iqlocal_tbl),
+ bwn_tabl_iqlocal_tbl);
+ bwn_tab_write_multi(mac, BWN_TAB_4(9, 0), N(papdeps), papdeps);
+ bwn_tab_write_multi(mac, BWN_TAB_4(10, 0), N(papdmult), papdmult);
+
+ if ((siba_get_chipid(sc->sc_dev) == 0x4325) &&
+ (siba_get_chiprev(sc->sc_dev) == 0)) {
+ bwn_tab_write_multi(mac, BWN_TAB_4(13, 0), N(gainidx_a0),
+ gainidx_a0);
+ bwn_tab_write_multi(mac, BWN_TAB_2(14, 0), N(auxgainidx_a0),
+ auxgainidx_a0);
+ bwn_tab_write_multi(mac, BWN_TAB_4(17, 0), N(gainval_a0),
+ gainval_a0);
+ bwn_tab_write_multi(mac, BWN_TAB_2(18, 0), N(gain_a0), gain_a0);
+ }
+}
+
+static void
+bwn_phy_lp_tblinit_txgain(struct bwn_mac *mac)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ static struct bwn_txgain_entry txgain_r2[] = {
+ { 255, 255, 203, 0, 152 }, { 255, 255, 203, 0, 147 },
+ { 255, 255, 203, 0, 143 }, { 255, 255, 203, 0, 139 },
+ { 255, 255, 203, 0, 135 }, { 255, 255, 203, 0, 131 },
+ { 255, 255, 203, 0, 128 }, { 255, 255, 203, 0, 124 },
+ { 255, 255, 203, 0, 121 }, { 255, 255, 203, 0, 117 },
+ { 255, 255, 203, 0, 114 }, { 255, 255, 203, 0, 111 },
+ { 255, 255, 203, 0, 107 }, { 255, 255, 203, 0, 104 },
+ { 255, 255, 203, 0, 101 }, { 255, 255, 203, 0, 99 },
+ { 255, 255, 203, 0, 96 }, { 255, 255, 203, 0, 93 },
+ { 255, 255, 203, 0, 90 }, { 255, 255, 203, 0, 88 },
+ { 255, 255, 203, 0, 85 }, { 255, 255, 203, 0, 83 },
+ { 255, 255, 203, 0, 81 }, { 255, 255, 203, 0, 78 },
+ { 255, 255, 203, 0, 76 }, { 255, 255, 203, 0, 74 },
+ { 255, 255, 203, 0, 72 }, { 255, 255, 203, 0, 70 },
+ { 255, 255, 203, 0, 68 }, { 255, 255, 203, 0, 66 },
+ { 255, 255, 203, 0, 64 }, { 255, 255, 197, 0, 64 },
+ { 255, 255, 192, 0, 64 }, { 255, 255, 186, 0, 64 },
+ { 255, 255, 181, 0, 64 }, { 255, 255, 176, 0, 64 },
+ { 255, 255, 171, 0, 64 }, { 255, 255, 166, 0, 64 },
+ { 255, 255, 161, 0, 64 }, { 255, 255, 157, 0, 64 },
+ { 255, 255, 152, 0, 64 }, { 255, 255, 148, 0, 64 },
+ { 255, 255, 144, 0, 64 }, { 255, 255, 140, 0, 64 },
+ { 255, 255, 136, 0, 64 }, { 255, 255, 132, 0, 64 },
+ { 255, 255, 128, 0, 64 }, { 255, 255, 124, 0, 64 },
+ { 255, 255, 121, 0, 64 }, { 255, 255, 117, 0, 64 },
+ { 255, 255, 114, 0, 64 }, { 255, 255, 111, 0, 64 },
+ { 255, 255, 108, 0, 64 }, { 255, 255, 105, 0, 64 },
+ { 255, 255, 102, 0, 64 }, { 255, 255, 99, 0, 64 },
+ { 255, 255, 96, 0, 64 }, { 255, 255, 93, 0, 64 },
+ { 255, 255, 91, 0, 64 }, { 255, 255, 88, 0, 64 },
+ { 255, 255, 86, 0, 64 }, { 255, 255, 83, 0, 64 },
+ { 255, 255, 81, 0, 64 }, { 255, 255, 79, 0, 64 },
+ { 255, 255, 76, 0, 64 }, { 255, 255, 74, 0, 64 },
+ { 255, 255, 72, 0, 64 }, { 255, 255, 70, 0, 64 },
+ { 255, 255, 68, 0, 64 }, { 255, 255, 66, 0, 64 },
+ { 255, 255, 64, 0, 64 }, { 255, 248, 64, 0, 64 },
+ { 255, 248, 62, 0, 64 }, { 255, 241, 62, 0, 64 },
+ { 255, 241, 60, 0, 64 }, { 255, 234, 60, 0, 64 },
+ { 255, 234, 59, 0, 64 }, { 255, 227, 59, 0, 64 },
+ { 255, 227, 57, 0, 64 }, { 255, 221, 57, 0, 64 },
+ { 255, 221, 55, 0, 64 }, { 255, 215, 55, 0, 64 },
+ { 255, 215, 54, 0, 64 }, { 255, 208, 54, 0, 64 },
+ { 255, 208, 52, 0, 64 }, { 255, 203, 52, 0, 64 },
+ { 255, 203, 51, 0, 64 }, { 255, 197, 51, 0, 64 },
+ { 255, 197, 49, 0, 64 }, { 255, 191, 49, 0, 64 },
+ { 255, 191, 48, 0, 64 }, { 255, 186, 48, 0, 64 },
+ { 255, 186, 47, 0, 64 }, { 255, 181, 47, 0, 64 },
+ { 255, 181, 45, 0, 64 }, { 255, 175, 45, 0, 64 },
+ { 255, 175, 44, 0, 64 }, { 255, 170, 44, 0, 64 },
+ { 255, 170, 43, 0, 64 }, { 255, 166, 43, 0, 64 },
+ { 255, 166, 42, 0, 64 }, { 255, 161, 42, 0, 64 },
+ { 255, 161, 40, 0, 64 }, { 255, 156, 40, 0, 64 },
+ { 255, 156, 39, 0, 64 }, { 255, 152, 39, 0, 64 },
+ { 255, 152, 38, 0, 64 }, { 255, 148, 38, 0, 64 },
+ { 255, 148, 37, 0, 64 }, { 255, 143, 37, 0, 64 },
+ { 255, 143, 36, 0, 64 }, { 255, 139, 36, 0, 64 },
+ { 255, 139, 35, 0, 64 }, { 255, 135, 35, 0, 64 },
+ { 255, 135, 34, 0, 64 }, { 255, 132, 34, 0, 64 },
+ { 255, 132, 33, 0, 64 }, { 255, 128, 33, 0, 64 },
+ { 255, 128, 32, 0, 64 }, { 255, 124, 32, 0, 64 },
+ { 255, 124, 31, 0, 64 }, { 255, 121, 31, 0, 64 },
+ { 255, 121, 30, 0, 64 }, { 255, 117, 30, 0, 64 },
+ { 255, 117, 29, 0, 64 }, { 255, 114, 29, 0, 64 },
+ { 255, 114, 29, 0, 64 }, { 255, 111, 29, 0, 64 },
+ };
+ static struct bwn_txgain_entry txgain_2ghz_r2[] = {
+ { 7, 99, 255, 0, 64 }, { 7, 96, 255, 0, 64 },
+ { 7, 93, 255, 0, 64 }, { 7, 90, 255, 0, 64 },
+ { 7, 88, 255, 0, 64 }, { 7, 85, 255, 0, 64 },
+ { 7, 83, 255, 0, 64 }, { 7, 81, 255, 0, 64 },
+ { 7, 78, 255, 0, 64 }, { 7, 76, 255, 0, 64 },
+ { 7, 74, 255, 0, 64 }, { 7, 72, 255, 0, 64 },
+ { 7, 70, 255, 0, 64 }, { 7, 68, 255, 0, 64 },
+ { 7, 66, 255, 0, 64 }, { 7, 64, 255, 0, 64 },
+ { 7, 64, 255, 0, 64 }, { 7, 62, 255, 0, 64 },
+ { 7, 62, 248, 0, 64 }, { 7, 60, 248, 0, 64 },
+ { 7, 60, 241, 0, 64 }, { 7, 59, 241, 0, 64 },
+ { 7, 59, 234, 0, 64 }, { 7, 57, 234, 0, 64 },
+ { 7, 57, 227, 0, 64 }, { 7, 55, 227, 0, 64 },
+ { 7, 55, 221, 0, 64 }, { 7, 54, 221, 0, 64 },
+ { 7, 54, 215, 0, 64 }, { 7, 52, 215, 0, 64 },
+ { 7, 52, 208, 0, 64 }, { 7, 51, 208, 0, 64 },
+ { 7, 51, 203, 0, 64 }, { 7, 49, 203, 0, 64 },
+ { 7, 49, 197, 0, 64 }, { 7, 48, 197, 0, 64 },
+ { 7, 48, 191, 0, 64 }, { 7, 47, 191, 0, 64 },
+ { 7, 47, 186, 0, 64 }, { 7, 45, 186, 0, 64 },
+ { 7, 45, 181, 0, 64 }, { 7, 44, 181, 0, 64 },
+ { 7, 44, 175, 0, 64 }, { 7, 43, 175, 0, 64 },
+ { 7, 43, 170, 0, 64 }, { 7, 42, 170, 0, 64 },
+ { 7, 42, 166, 0, 64 }, { 7, 40, 166, 0, 64 },
+ { 7, 40, 161, 0, 64 }, { 7, 39, 161, 0, 64 },
+ { 7, 39, 156, 0, 64 }, { 7, 38, 156, 0, 64 },
+ { 7, 38, 152, 0, 64 }, { 7, 37, 152, 0, 64 },
+ { 7, 37, 148, 0, 64 }, { 7, 36, 148, 0, 64 },
+ { 7, 36, 143, 0, 64 }, { 7, 35, 143, 0, 64 },
+ { 7, 35, 139, 0, 64 }, { 7, 34, 139, 0, 64 },
+ { 7, 34, 135, 0, 64 }, { 7, 33, 135, 0, 64 },
+ { 7, 33, 132, 0, 64 }, { 7, 32, 132, 0, 64 },
+ { 7, 32, 128, 0, 64 }, { 7, 31, 128, 0, 64 },
+ { 7, 31, 124, 0, 64 }, { 7, 30, 124, 0, 64 },
+ { 7, 30, 121, 0, 64 }, { 7, 29, 121, 0, 64 },
+ { 7, 29, 117, 0, 64 }, { 7, 29, 117, 0, 64 },
+ { 7, 29, 114, 0, 64 }, { 7, 28, 114, 0, 64 },
+ { 7, 28, 111, 0, 64 }, { 7, 27, 111, 0, 64 },
+ { 7, 27, 108, 0, 64 }, { 7, 26, 108, 0, 64 },
+ { 7, 26, 104, 0, 64 }, { 7, 25, 104, 0, 64 },
+ { 7, 25, 102, 0, 64 }, { 7, 25, 102, 0, 64 },
+ { 7, 25, 99, 0, 64 }, { 7, 24, 99, 0, 64 },
+ { 7, 24, 96, 0, 64 }, { 7, 23, 96, 0, 64 },
+ { 7, 23, 93, 0, 64 }, { 7, 23, 93, 0, 64 },
+ { 7, 23, 90, 0, 64 }, { 7, 22, 90, 0, 64 },
+ { 7, 22, 88, 0, 64 }, { 7, 21, 88, 0, 64 },
+ { 7, 21, 85, 0, 64 }, { 7, 21, 85, 0, 64 },
+ { 7, 21, 83, 0, 64 }, { 7, 20, 83, 0, 64 },
+ { 7, 20, 81, 0, 64 }, { 7, 20, 81, 0, 64 },
+ { 7, 20, 78, 0, 64 }, { 7, 19, 78, 0, 64 },
+ { 7, 19, 76, 0, 64 }, { 7, 19, 76, 0, 64 },
+ { 7, 19, 74, 0, 64 }, { 7, 18, 74, 0, 64 },
+ { 7, 18, 72, 0, 64 }, { 7, 18, 72, 0, 64 },
+ { 7, 18, 70, 0, 64 }, { 7, 17, 70, 0, 64 },
+ { 7, 17, 68, 0, 64 }, { 7, 17, 68, 0, 64 },
+ { 7, 17, 66, 0, 64 }, { 7, 16, 66, 0, 64 },
+ { 7, 16, 64, 0, 64 }, { 7, 16, 64, 0, 64 },
+ { 7, 16, 62, 0, 64 }, { 7, 15, 62, 0, 64 },
+ { 7, 15, 60, 0, 64 }, { 7, 15, 60, 0, 64 },
+ { 7, 15, 59, 0, 64 }, { 7, 14, 59, 0, 64 },
+ { 7, 14, 57, 0, 64 }, { 7, 14, 57, 0, 64 },
+ { 7, 14, 55, 0, 64 }, { 7, 14, 55, 0, 64 },
+ { 7, 14, 54, 0, 64 }, { 7, 13, 54, 0, 64 },
+ { 7, 13, 52, 0, 64 }, { 7, 13, 52, 0, 64 },
+ };
+ static struct bwn_txgain_entry txgain_5ghz_r2[] = {
+ { 255, 255, 255, 0, 152 }, { 255, 255, 255, 0, 147 },
+ { 255, 255, 255, 0, 143 }, { 255, 255, 255, 0, 139 },
+ { 255, 255, 255, 0, 135 }, { 255, 255, 255, 0, 131 },
+ { 255, 255, 255, 0, 128 }, { 255, 255, 255, 0, 124 },
+ { 255, 255, 255, 0, 121 }, { 255, 255, 255, 0, 117 },
+ { 255, 255, 255, 0, 114 }, { 255, 255, 255, 0, 111 },
+ { 255, 255, 255, 0, 107 }, { 255, 255, 255, 0, 104 },
+ { 255, 255, 255, 0, 101 }, { 255, 255, 255, 0, 99 },
+ { 255, 255, 255, 0, 96 }, { 255, 255, 255, 0, 93 },
+ { 255, 255, 255, 0, 90 }, { 255, 255, 255, 0, 88 },
+ { 255, 255, 255, 0, 85 }, { 255, 255, 255, 0, 83 },
+ { 255, 255, 255, 0, 81 }, { 255, 255, 255, 0, 78 },
+ { 255, 255, 255, 0, 76 }, { 255, 255, 255, 0, 74 },
+ { 255, 255, 255, 0, 72 }, { 255, 255, 255, 0, 70 },
+ { 255, 255, 255, 0, 68 }, { 255, 255, 255, 0, 66 },
+ { 255, 255, 255, 0, 64 }, { 255, 255, 248, 0, 64 },
+ { 255, 255, 241, 0, 64 }, { 255, 255, 234, 0, 64 },
+ { 255, 255, 227, 0, 64 }, { 255, 255, 221, 0, 64 },
+ { 255, 255, 215, 0, 64 }, { 255, 255, 208, 0, 64 },
+ { 255, 255, 203, 0, 64 }, { 255, 255, 197, 0, 64 },
+ { 255, 255, 191, 0, 64 }, { 255, 255, 186, 0, 64 },
+ { 255, 255, 181, 0, 64 }, { 255, 255, 175, 0, 64 },
+ { 255, 255, 170, 0, 64 }, { 255, 255, 166, 0, 64 },
+ { 255, 255, 161, 0, 64 }, { 255, 255, 156, 0, 64 },
+ { 255, 255, 152, 0, 64 }, { 255, 255, 148, 0, 64 },
+ { 255, 255, 143, 0, 64 }, { 255, 255, 139, 0, 64 },
+ { 255, 255, 135, 0, 64 }, { 255, 255, 132, 0, 64 },
+ { 255, 255, 128, 0, 64 }, { 255, 255, 124, 0, 64 },
+ { 255, 255, 121, 0, 64 }, { 255, 255, 117, 0, 64 },
+ { 255, 255, 114, 0, 64 }, { 255, 255, 111, 0, 64 },
+ { 255, 255, 108, 0, 64 }, { 255, 255, 104, 0, 64 },
+ { 255, 255, 102, 0, 64 }, { 255, 255, 99, 0, 64 },
+ { 255, 255, 96, 0, 64 }, { 255, 255, 93, 0, 64 },
+ { 255, 255, 90, 0, 64 }, { 255, 255, 88, 0, 64 },
+ { 255, 255, 85, 0, 64 }, { 255, 255, 83, 0, 64 },
+ { 255, 255, 81, 0, 64 }, { 255, 255, 78, 0, 64 },
+ { 255, 255, 76, 0, 64 }, { 255, 255, 74, 0, 64 },
+ { 255, 255, 72, 0, 64 }, { 255, 255, 70, 0, 64 },
+ { 255, 255, 68, 0, 64 }, { 255, 255, 66, 0, 64 },
+ { 255, 255, 64, 0, 64 }, { 255, 255, 64, 0, 64 },
+ { 255, 255, 62, 0, 64 }, { 255, 248, 62, 0, 64 },
+ { 255, 248, 60, 0, 64 }, { 255, 241, 60, 0, 64 },
+ { 255, 241, 59, 0, 64 }, { 255, 234, 59, 0, 64 },
+ { 255, 234, 57, 0, 64 }, { 255, 227, 57, 0, 64 },
+ { 255, 227, 55, 0, 64 }, { 255, 221, 55, 0, 64 },
+ { 255, 221, 54, 0, 64 }, { 255, 215, 54, 0, 64 },
+ { 255, 215, 52, 0, 64 }, { 255, 208, 52, 0, 64 },
+ { 255, 208, 51, 0, 64 }, { 255, 203, 51, 0, 64 },
+ { 255, 203, 49, 0, 64 }, { 255, 197, 49, 0, 64 },
+ { 255, 197, 48, 0, 64 }, { 255, 191, 48, 0, 64 },
+ { 255, 191, 47, 0, 64 }, { 255, 186, 47, 0, 64 },
+ { 255, 186, 45, 0, 64 }, { 255, 181, 45, 0, 64 },
+ { 255, 181, 44, 0, 64 }, { 255, 175, 44, 0, 64 },
+ { 255, 175, 43, 0, 64 }, { 255, 170, 43, 0, 64 },
+ { 255, 170, 42, 0, 64 }, { 255, 166, 42, 0, 64 },
+ { 255, 166, 40, 0, 64 }, { 255, 161, 40, 0, 64 },
+ { 255, 161, 39, 0, 64 }, { 255, 156, 39, 0, 64 },
+ { 255, 156, 38, 0, 64 }, { 255, 152, 38, 0, 64 },
+ { 255, 152, 37, 0, 64 }, { 255, 148, 37, 0, 64 },
+ { 255, 148, 36, 0, 64 }, { 255, 143, 36, 0, 64 },
+ { 255, 143, 35, 0, 64 }, { 255, 139, 35, 0, 64 },
+ { 255, 139, 34, 0, 64 }, { 255, 135, 34, 0, 64 },
+ { 255, 135, 33, 0, 64 }, { 255, 132, 33, 0, 64 },
+ { 255, 132, 32, 0, 64 }, { 255, 128, 32, 0, 64 }
+ };
+ static struct bwn_txgain_entry txgain_r0[] = {
+ { 7, 15, 14, 0, 152 }, { 7, 15, 14, 0, 147 },
+ { 7, 15, 14, 0, 143 }, { 7, 15, 14, 0, 139 },
+ { 7, 15, 14, 0, 135 }, { 7, 15, 14, 0, 131 },
+ { 7, 15, 14, 0, 128 }, { 7, 15, 14, 0, 124 },
+ { 7, 15, 14, 0, 121 }, { 7, 15, 14, 0, 117 },
+ { 7, 15, 14, 0, 114 }, { 7, 15, 14, 0, 111 },
+ { 7, 15, 14, 0, 107 }, { 7, 15, 14, 0, 104 },
+ { 7, 15, 14, 0, 101 }, { 7, 15, 14, 0, 99 },
+ { 7, 15, 14, 0, 96 }, { 7, 15, 14, 0, 93 },
+ { 7, 15, 14, 0, 90 }, { 7, 15, 14, 0, 88 },
+ { 7, 15, 14, 0, 85 }, { 7, 15, 14, 0, 83 },
+ { 7, 15, 14, 0, 81 }, { 7, 15, 14, 0, 78 },
+ { 7, 15, 14, 0, 76 }, { 7, 15, 14, 0, 74 },
+ { 7, 15, 14, 0, 72 }, { 7, 15, 14, 0, 70 },
+ { 7, 15, 14, 0, 68 }, { 7, 15, 14, 0, 66 },
+ { 7, 15, 14, 0, 64 }, { 7, 15, 14, 0, 62 },
+ { 7, 15, 14, 0, 60 }, { 7, 15, 14, 0, 59 },
+ { 7, 15, 14, 0, 57 }, { 7, 15, 13, 0, 72 },
+ { 7, 15, 13, 0, 70 }, { 7, 15, 13, 0, 68 },
+ { 7, 15, 13, 0, 66 }, { 7, 15, 13, 0, 64 },
+ { 7, 15, 13, 0, 62 }, { 7, 15, 13, 0, 60 },
+ { 7, 15, 13, 0, 59 }, { 7, 15, 13, 0, 57 },
+ { 7, 15, 12, 0, 71 }, { 7, 15, 12, 0, 69 },
+ { 7, 15, 12, 0, 67 }, { 7, 15, 12, 0, 65 },
+ { 7, 15, 12, 0, 63 }, { 7, 15, 12, 0, 62 },
+ { 7, 15, 12, 0, 60 }, { 7, 15, 12, 0, 58 },
+ { 7, 15, 12, 0, 57 }, { 7, 15, 11, 0, 70 },
+ { 7, 15, 11, 0, 68 }, { 7, 15, 11, 0, 66 },
+ { 7, 15, 11, 0, 65 }, { 7, 15, 11, 0, 63 },
+ { 7, 15, 11, 0, 61 }, { 7, 15, 11, 0, 59 },
+ { 7, 15, 11, 0, 58 }, { 7, 15, 10, 0, 71 },
+ { 7, 15, 10, 0, 69 }, { 7, 15, 10, 0, 67 },
+ { 7, 15, 10, 0, 65 }, { 7, 15, 10, 0, 63 },
+ { 7, 15, 10, 0, 61 }, { 7, 15, 10, 0, 60 },
+ { 7, 15, 10, 0, 58 }, { 7, 15, 10, 0, 56 },
+ { 7, 15, 9, 0, 70 }, { 7, 15, 9, 0, 68 },
+ { 7, 15, 9, 0, 66 }, { 7, 15, 9, 0, 64 },
+ { 7, 15, 9, 0, 62 }, { 7, 15, 9, 0, 60 },
+ { 7, 15, 9, 0, 59 }, { 7, 14, 9, 0, 72 },
+ { 7, 14, 9, 0, 70 }, { 7, 14, 9, 0, 68 },
+ { 7, 14, 9, 0, 66 }, { 7, 14, 9, 0, 64 },
+ { 7, 14, 9, 0, 62 }, { 7, 14, 9, 0, 60 },
+ { 7, 14, 9, 0, 59 }, { 7, 13, 9, 0, 72 },
+ { 7, 13, 9, 0, 70 }, { 7, 13, 9, 0, 68 },
+ { 7, 13, 9, 0, 66 }, { 7, 13, 9, 0, 64 },
+ { 7, 13, 9, 0, 63 }, { 7, 13, 9, 0, 61 },
+ { 7, 13, 9, 0, 59 }, { 7, 13, 9, 0, 57 },
+ { 7, 13, 8, 0, 72 }, { 7, 13, 8, 0, 70 },
+ { 7, 13, 8, 0, 68 }, { 7, 13, 8, 0, 66 },
+ { 7, 13, 8, 0, 64 }, { 7, 13, 8, 0, 62 },
+ { 7, 13, 8, 0, 60 }, { 7, 13, 8, 0, 59 },
+ { 7, 12, 8, 0, 72 }, { 7, 12, 8, 0, 70 },
+ { 7, 12, 8, 0, 68 }, { 7, 12, 8, 0, 66 },
+ { 7, 12, 8, 0, 64 }, { 7, 12, 8, 0, 62 },
+ { 7, 12, 8, 0, 61 }, { 7, 12, 8, 0, 59 },
+ { 7, 12, 7, 0, 73 }, { 7, 12, 7, 0, 71 },
+ { 7, 12, 7, 0, 69 }, { 7, 12, 7, 0, 67 },
+ { 7, 12, 7, 0, 65 }, { 7, 12, 7, 0, 63 },
+ { 7, 12, 7, 0, 61 }, { 7, 12, 7, 0, 59 },
+ { 7, 11, 7, 0, 72 }, { 7, 11, 7, 0, 70 },
+ { 7, 11, 7, 0, 68 }, { 7, 11, 7, 0, 66 },
+ { 7, 11, 7, 0, 65 }, { 7, 11, 7, 0, 63 },
+ { 7, 11, 7, 0, 61 }, { 7, 11, 7, 0, 59 },
+ { 7, 11, 6, 0, 73 }, { 7, 11, 6, 0, 71 }
+ };
+ static struct bwn_txgain_entry txgain_2ghz_r0[] = {
+ { 4, 15, 9, 0, 64 }, { 4, 15, 9, 0, 62 },
+ { 4, 15, 9, 0, 60 }, { 4, 15, 9, 0, 59 },
+ { 4, 14, 9, 0, 72 }, { 4, 14, 9, 0, 70 },
+ { 4, 14, 9, 0, 68 }, { 4, 14, 9, 0, 66 },
+ { 4, 14, 9, 0, 64 }, { 4, 14, 9, 0, 62 },
+ { 4, 14, 9, 0, 60 }, { 4, 14, 9, 0, 59 },
+ { 4, 13, 9, 0, 72 }, { 4, 13, 9, 0, 70 },
+ { 4, 13, 9, 0, 68 }, { 4, 13, 9, 0, 66 },
+ { 4, 13, 9, 0, 64 }, { 4, 13, 9, 0, 63 },
+ { 4, 13, 9, 0, 61 }, { 4, 13, 9, 0, 59 },
+ { 4, 13, 9, 0, 57 }, { 4, 13, 8, 0, 72 },
+ { 4, 13, 8, 0, 70 }, { 4, 13, 8, 0, 68 },
+ { 4, 13, 8, 0, 66 }, { 4, 13, 8, 0, 64 },
+ { 4, 13, 8, 0, 62 }, { 4, 13, 8, 0, 60 },
+ { 4, 13, 8, 0, 59 }, { 4, 12, 8, 0, 72 },
+ { 4, 12, 8, 0, 70 }, { 4, 12, 8, 0, 68 },
+ { 4, 12, 8, 0, 66 }, { 4, 12, 8, 0, 64 },
+ { 4, 12, 8, 0, 62 }, { 4, 12, 8, 0, 61 },
+ { 4, 12, 8, 0, 59 }, { 4, 12, 7, 0, 73 },
+ { 4, 12, 7, 0, 71 }, { 4, 12, 7, 0, 69 },
+ { 4, 12, 7, 0, 67 }, { 4, 12, 7, 0, 65 },
+ { 4, 12, 7, 0, 63 }, { 4, 12, 7, 0, 61 },
+ { 4, 12, 7, 0, 59 }, { 4, 11, 7, 0, 72 },
+ { 4, 11, 7, 0, 70 }, { 4, 11, 7, 0, 68 },
+ { 4, 11, 7, 0, 66 }, { 4, 11, 7, 0, 65 },
+ { 4, 11, 7, 0, 63 }, { 4, 11, 7, 0, 61 },
+ { 4, 11, 7, 0, 59 }, { 4, 11, 6, 0, 73 },
+ { 4, 11, 6, 0, 71 }, { 4, 11, 6, 0, 69 },
+ { 4, 11, 6, 0, 67 }, { 4, 11, 6, 0, 65 },
+ { 4, 11, 6, 0, 63 }, { 4, 11, 6, 0, 61 },
+ { 4, 11, 6, 0, 60 }, { 4, 10, 6, 0, 72 },
+ { 4, 10, 6, 0, 70 }, { 4, 10, 6, 0, 68 },
+ { 4, 10, 6, 0, 66 }, { 4, 10, 6, 0, 64 },
+ { 4, 10, 6, 0, 62 }, { 4, 10, 6, 0, 60 },
+ { 4, 10, 6, 0, 59 }, { 4, 10, 5, 0, 72 },
+ { 4, 10, 5, 0, 70 }, { 4, 10, 5, 0, 68 },
+ { 4, 10, 5, 0, 66 }, { 4, 10, 5, 0, 64 },
+ { 4, 10, 5, 0, 62 }, { 4, 10, 5, 0, 60 },
+ { 4, 10, 5, 0, 59 }, { 4, 9, 5, 0, 70 },
+ { 4, 9, 5, 0, 68 }, { 4, 9, 5, 0, 66 },
+ { 4, 9, 5, 0, 64 }, { 4, 9, 5, 0, 63 },
+ { 4, 9, 5, 0, 61 }, { 4, 9, 5, 0, 59 },
+ { 4, 9, 4, 0, 71 }, { 4, 9, 4, 0, 69 },
+ { 4, 9, 4, 0, 67 }, { 4, 9, 4, 0, 65 },
+ { 4, 9, 4, 0, 63 }, { 4, 9, 4, 0, 62 },
+ { 4, 9, 4, 0, 60 }, { 4, 9, 4, 0, 58 },
+ { 4, 8, 4, 0, 70 }, { 4, 8, 4, 0, 68 },
+ { 4, 8, 4, 0, 66 }, { 4, 8, 4, 0, 65 },
+ { 4, 8, 4, 0, 63 }, { 4, 8, 4, 0, 61 },
+ { 4, 8, 4, 0, 59 }, { 4, 7, 4, 0, 68 },
+ { 4, 7, 4, 0, 66 }, { 4, 7, 4, 0, 64 },
+ { 4, 7, 4, 0, 62 }, { 4, 7, 4, 0, 61 },
+ { 4, 7, 4, 0, 59 }, { 4, 7, 3, 0, 67 },
+ { 4, 7, 3, 0, 65 }, { 4, 7, 3, 0, 63 },
+ { 4, 7, 3, 0, 62 }, { 4, 7, 3, 0, 60 },
+ { 4, 6, 3, 0, 65 }, { 4, 6, 3, 0, 63 },
+ { 4, 6, 3, 0, 61 }, { 4, 6, 3, 0, 60 },
+ { 4, 6, 3, 0, 58 }, { 4, 5, 3, 0, 68 },
+ { 4, 5, 3, 0, 66 }, { 4, 5, 3, 0, 64 },
+ { 4, 5, 3, 0, 62 }, { 4, 5, 3, 0, 60 },
+ { 4, 5, 3, 0, 59 }, { 4, 5, 3, 0, 57 },
+ { 4, 4, 2, 0, 83 }, { 4, 4, 2, 0, 81 },
+ { 4, 4, 2, 0, 78 }, { 4, 4, 2, 0, 76 },
+ { 4, 4, 2, 0, 74 }, { 4, 4, 2, 0, 72 }
+ };
+ static struct bwn_txgain_entry txgain_5ghz_r0[] = {
+ { 7, 15, 15, 0, 99 }, { 7, 15, 15, 0, 96 },
+ { 7, 15, 15, 0, 93 }, { 7, 15, 15, 0, 90 },
+ { 7, 15, 15, 0, 88 }, { 7, 15, 15, 0, 85 },
+ { 7, 15, 15, 0, 83 }, { 7, 15, 15, 0, 81 },
+ { 7, 15, 15, 0, 78 }, { 7, 15, 15, 0, 76 },
+ { 7, 15, 15, 0, 74 }, { 7, 15, 15, 0, 72 },
+ { 7, 15, 15, 0, 70 }, { 7, 15, 15, 0, 68 },
+ { 7, 15, 15, 0, 66 }, { 7, 15, 15, 0, 64 },
+ { 7, 15, 15, 0, 62 }, { 7, 15, 15, 0, 60 },
+ { 7, 15, 15, 0, 59 }, { 7, 15, 15, 0, 57 },
+ { 7, 15, 15, 0, 55 }, { 7, 15, 14, 0, 72 },
+ { 7, 15, 14, 0, 70 }, { 7, 15, 14, 0, 68 },
+ { 7, 15, 14, 0, 66 }, { 7, 15, 14, 0, 64 },
+ { 7, 15, 14, 0, 62 }, { 7, 15, 14, 0, 60 },
+ { 7, 15, 14, 0, 58 }, { 7, 15, 14, 0, 56 },
+ { 7, 15, 14, 0, 55 }, { 7, 15, 13, 0, 71 },
+ { 7, 15, 13, 0, 69 }, { 7, 15, 13, 0, 67 },
+ { 7, 15, 13, 0, 65 }, { 7, 15, 13, 0, 63 },
+ { 7, 15, 13, 0, 62 }, { 7, 15, 13, 0, 60 },
+ { 7, 15, 13, 0, 58 }, { 7, 15, 13, 0, 56 },
+ { 7, 15, 12, 0, 72 }, { 7, 15, 12, 0, 70 },
+ { 7, 15, 12, 0, 68 }, { 7, 15, 12, 0, 66 },
+ { 7, 15, 12, 0, 64 }, { 7, 15, 12, 0, 62 },
+ { 7, 15, 12, 0, 60 }, { 7, 15, 12, 0, 59 },
+ { 7, 15, 12, 0, 57 }, { 7, 15, 11, 0, 73 },
+ { 7, 15, 11, 0, 71 }, { 7, 15, 11, 0, 69 },
+ { 7, 15, 11, 0, 67 }, { 7, 15, 11, 0, 65 },
+ { 7, 15, 11, 0, 63 }, { 7, 15, 11, 0, 61 },
+ { 7, 15, 11, 0, 60 }, { 7, 15, 11, 0, 58 },
+ { 7, 15, 10, 0, 71 }, { 7, 15, 10, 0, 69 },
+ { 7, 15, 10, 0, 67 }, { 7, 15, 10, 0, 65 },
+ { 7, 15, 10, 0, 63 }, { 7, 15, 10, 0, 61 },
+ { 7, 15, 10, 0, 60 }, { 7, 15, 10, 0, 58 },
+ { 7, 15, 9, 0, 70 }, { 7, 15, 9, 0, 68 },
+ { 7, 15, 9, 0, 66 }, { 7, 15, 9, 0, 64 },
+ { 7, 15, 9, 0, 62 }, { 7, 15, 9, 0, 61 },
+ { 7, 15, 9, 0, 59 }, { 7, 15, 9, 0, 57 },
+ { 7, 15, 9, 0, 56 }, { 7, 14, 9, 0, 68 },
+ { 7, 14, 9, 0, 66 }, { 7, 14, 9, 0, 65 },
+ { 7, 14, 9, 0, 63 }, { 7, 14, 9, 0, 61 },
+ { 7, 14, 9, 0, 59 }, { 7, 14, 9, 0, 58 },
+ { 7, 13, 9, 0, 70 }, { 7, 13, 9, 0, 68 },
+ { 7, 13, 9, 0, 66 }, { 7, 13, 9, 0, 64 },
+ { 7, 13, 9, 0, 63 }, { 7, 13, 9, 0, 61 },
+ { 7, 13, 9, 0, 59 }, { 7, 13, 9, 0, 57 },
+ { 7, 13, 8, 0, 70 }, { 7, 13, 8, 0, 68 },
+ { 7, 13, 8, 0, 66 }, { 7, 13, 8, 0, 64 },
+ { 7, 13, 8, 0, 62 }, { 7, 13, 8, 0, 60 },
+ { 7, 13, 8, 0, 59 }, { 7, 13, 8, 0, 57 },
+ { 7, 12, 8, 0, 70 }, { 7, 12, 8, 0, 68 },
+ { 7, 12, 8, 0, 66 }, { 7, 12, 8, 0, 64 },
+ { 7, 12, 8, 0, 62 }, { 7, 12, 8, 0, 61 },
+ { 7, 12, 8, 0, 59 }, { 7, 12, 8, 0, 57 },
+ { 7, 12, 7, 0, 70 }, { 7, 12, 7, 0, 68 },
+ { 7, 12, 7, 0, 66 }, { 7, 12, 7, 0, 64 },
+ { 7, 12, 7, 0, 62 }, { 7, 12, 7, 0, 61 },
+ { 7, 12, 7, 0, 59 }, { 7, 12, 7, 0, 57 },
+ { 7, 11, 7, 0, 70 }, { 7, 11, 7, 0, 68 },
+ { 7, 11, 7, 0, 66 }, { 7, 11, 7, 0, 64 },
+ { 7, 11, 7, 0, 62 }, { 7, 11, 7, 0, 61 },
+ { 7, 11, 7, 0, 59 }, { 7, 11, 7, 0, 57 },
+ { 7, 11, 6, 0, 69 }, { 7, 11, 6, 0, 67 },
+ { 7, 11, 6, 0, 65 }, { 7, 11, 6, 0, 63 },
+ { 7, 11, 6, 0, 62 }, { 7, 11, 6, 0, 60 }
+ };
+ static struct bwn_txgain_entry txgain_r1[] = {
+ { 7, 15, 14, 0, 152 }, { 7, 15, 14, 0, 147 },
+ { 7, 15, 14, 0, 143 }, { 7, 15, 14, 0, 139 },
+ { 7, 15, 14, 0, 135 }, { 7, 15, 14, 0, 131 },
+ { 7, 15, 14, 0, 128 }, { 7, 15, 14, 0, 124 },
+ { 7, 15, 14, 0, 121 }, { 7, 15, 14, 0, 117 },
+ { 7, 15, 14, 0, 114 }, { 7, 15, 14, 0, 111 },
+ { 7, 15, 14, 0, 107 }, { 7, 15, 14, 0, 104 },
+ { 7, 15, 14, 0, 101 }, { 7, 15, 14, 0, 99 },
+ { 7, 15, 14, 0, 96 }, { 7, 15, 14, 0, 93 },
+ { 7, 15, 14, 0, 90 }, { 7, 15, 14, 0, 88 },
+ { 7, 15, 14, 0, 85 }, { 7, 15, 14, 0, 83 },
+ { 7, 15, 14, 0, 81 }, { 7, 15, 14, 0, 78 },
+ { 7, 15, 14, 0, 76 }, { 7, 15, 14, 0, 74 },
+ { 7, 15, 14, 0, 72 }, { 7, 15, 14, 0, 70 },
+ { 7, 15, 14, 0, 68 }, { 7, 15, 14, 0, 66 },
+ { 7, 15, 14, 0, 64 }, { 7, 15, 14, 0, 62 },
+ { 7, 15, 14, 0, 60 }, { 7, 15, 14, 0, 59 },
+ { 7, 15, 14, 0, 57 }, { 7, 15, 13, 0, 72 },
+ { 7, 15, 13, 0, 70 }, { 7, 15, 14, 0, 68 },
+ { 7, 15, 14, 0, 66 }, { 7, 15, 14, 0, 64 },
+ { 7, 15, 14, 0, 62 }, { 7, 15, 14, 0, 60 },
+ { 7, 15, 14, 0, 59 }, { 7, 15, 14, 0, 57 },
+ { 7, 15, 13, 0, 72 }, { 7, 15, 13, 0, 70 },
+ { 7, 15, 13, 0, 68 }, { 7, 15, 13, 0, 66 },
+ { 7, 15, 13, 0, 64 }, { 7, 15, 13, 0, 62 },
+ { 7, 15, 13, 0, 60 }, { 7, 15, 13, 0, 59 },
+ { 7, 15, 13, 0, 57 }, { 7, 15, 12, 0, 71 },
+ { 7, 15, 12, 0, 69 }, { 7, 15, 12, 0, 67 },
+ { 7, 15, 12, 0, 65 }, { 7, 15, 12, 0, 63 },
+ { 7, 15, 12, 0, 62 }, { 7, 15, 12, 0, 60 },
+ { 7, 15, 12, 0, 58 }, { 7, 15, 12, 0, 57 },
+ { 7, 15, 11, 0, 70 }, { 7, 15, 11, 0, 68 },
+ { 7, 15, 11, 0, 66 }, { 7, 15, 11, 0, 65 },
+ { 7, 15, 11, 0, 63 }, { 7, 15, 11, 0, 61 },
+ { 7, 15, 11, 0, 59 }, { 7, 15, 11, 0, 58 },
+ { 7, 15, 10, 0, 71 }, { 7, 15, 10, 0, 69 },
+ { 7, 15, 10, 0, 67 }, { 7, 15, 10, 0, 65 },
+ { 7, 15, 10, 0, 63 }, { 7, 15, 10, 0, 61 },
+ { 7, 15, 10, 0, 60 }, { 7, 15, 10, 0, 58 },
+ { 7, 15, 10, 0, 56 }, { 7, 15, 9, 0, 70 },
+ { 7, 15, 9, 0, 68 }, { 7, 15, 9, 0, 66 },
+ { 7, 15, 9, 0, 64 }, { 7, 15, 9, 0, 62 },
+ { 7, 15, 9, 0, 60 }, { 7, 15, 9, 0, 59 },
+ { 7, 14, 9, 0, 72 }, { 7, 14, 9, 0, 70 },
+ { 7, 14, 9, 0, 68 }, { 7, 14, 9, 0, 66 },
+ { 7, 14, 9, 0, 64 }, { 7, 14, 9, 0, 62 },
+ { 7, 14, 9, 0, 60 }, { 7, 14, 9, 0, 59 },
+ { 7, 13, 9, 0, 72 }, { 7, 13, 9, 0, 70 },
+ { 7, 13, 9, 0, 68 }, { 7, 13, 9, 0, 66 },
+ { 7, 13, 9, 0, 64 }, { 7, 13, 9, 0, 63 },
+ { 7, 13, 9, 0, 61 }, { 7, 13, 9, 0, 59 },
+ { 7, 13, 9, 0, 57 }, { 7, 13, 8, 0, 72 },
+ { 7, 13, 8, 0, 70 }, { 7, 13, 8, 0, 68 },
+ { 7, 13, 8, 0, 66 }, { 7, 13, 8, 0, 64 },
+ { 7, 13, 8, 0, 62 }, { 7, 13, 8, 0, 60 },
+ { 7, 13, 8, 0, 59 }, { 7, 12, 8, 0, 72 },
+ { 7, 12, 8, 0, 70 }, { 7, 12, 8, 0, 68 },
+ { 7, 12, 8, 0, 66 }, { 7, 12, 8, 0, 64 },
+ { 7, 12, 8, 0, 62 }, { 7, 12, 8, 0, 61 },
+ { 7, 12, 8, 0, 59 }, { 7, 12, 7, 0, 73 },
+ { 7, 12, 7, 0, 71 }, { 7, 12, 7, 0, 69 },
+ { 7, 12, 7, 0, 67 }, { 7, 12, 7, 0, 65 },
+ { 7, 12, 7, 0, 63 }, { 7, 12, 7, 0, 61 },
+ { 7, 12, 7, 0, 59 }, { 7, 11, 7, 0, 72 },
+ { 7, 11, 7, 0, 70 }, { 7, 11, 7, 0, 68 },
+ { 7, 11, 7, 0, 66 }, { 7, 11, 7, 0, 65 },
+ { 7, 11, 7, 0, 63 }, { 7, 11, 7, 0, 61 },
+ { 7, 11, 7, 0, 59 }, { 7, 11, 6, 0, 73 },
+ { 7, 11, 6, 0, 71 }
+ };
+ static struct bwn_txgain_entry txgain_2ghz_r1[] = {
+ { 4, 15, 15, 0, 90 }, { 4, 15, 15, 0, 88 },
+ { 4, 15, 15, 0, 85 }, { 4, 15, 15, 0, 83 },
+ { 4, 15, 15, 0, 81 }, { 4, 15, 15, 0, 78 },
+ { 4, 15, 15, 0, 76 }, { 4, 15, 15, 0, 74 },
+ { 4, 15, 15, 0, 72 }, { 4, 15, 15, 0, 70 },
+ { 4, 15, 15, 0, 68 }, { 4, 15, 15, 0, 66 },
+ { 4, 15, 15, 0, 64 }, { 4, 15, 15, 0, 62 },
+ { 4, 15, 15, 0, 60 }, { 4, 15, 15, 0, 59 },
+ { 4, 15, 14, 0, 72 }, { 4, 15, 14, 0, 70 },
+ { 4, 15, 14, 0, 68 }, { 4, 15, 14, 0, 66 },
+ { 4, 15, 14, 0, 64 }, { 4, 15, 14, 0, 62 },
+ { 4, 15, 14, 0, 60 }, { 4, 15, 14, 0, 59 },
+ { 4, 15, 13, 0, 72 }, { 4, 15, 13, 0, 70 },
+ { 4, 15, 13, 0, 68 }, { 4, 15, 13, 0, 66 },
+ { 4, 15, 13, 0, 64 }, { 4, 15, 13, 0, 62 },
+ { 4, 15, 13, 0, 60 }, { 4, 15, 13, 0, 59 },
+ { 4, 15, 12, 0, 72 }, { 4, 15, 12, 0, 70 },
+ { 4, 15, 12, 0, 68 }, { 4, 15, 12, 0, 66 },
+ { 4, 15, 12, 0, 64 }, { 4, 15, 12, 0, 62 },
+ { 4, 15, 12, 0, 60 }, { 4, 15, 12, 0, 59 },
+ { 4, 15, 11, 0, 72 }, { 4, 15, 11, 0, 70 },
+ { 4, 15, 11, 0, 68 }, { 4, 15, 11, 0, 66 },
+ { 4, 15, 11, 0, 64 }, { 4, 15, 11, 0, 62 },
+ { 4, 15, 11, 0, 60 }, { 4, 15, 11, 0, 59 },
+ { 4, 15, 10, 0, 72 }, { 4, 15, 10, 0, 70 },
+ { 4, 15, 10, 0, 68 }, { 4, 15, 10, 0, 66 },
+ { 4, 15, 10, 0, 64 }, { 4, 15, 10, 0, 62 },
+ { 4, 15, 10, 0, 60 }, { 4, 15, 10, 0, 59 },
+ { 4, 15, 9, 0, 72 }, { 4, 15, 9, 0, 70 },
+ { 4, 15, 9, 0, 68 }, { 4, 15, 9, 0, 66 },
+ { 4, 15, 9, 0, 64 }, { 4, 15, 9, 0, 62 },
+ { 4, 15, 9, 0, 60 }, { 4, 15, 9, 0, 59 },
+ { 4, 14, 9, 0, 72 }, { 4, 14, 9, 0, 70 },
+ { 4, 14, 9, 0, 68 }, { 4, 14, 9, 0, 66 },
+ { 4, 14, 9, 0, 64 }, { 4, 14, 9, 0, 62 },
+ { 4, 14, 9, 0, 60 }, { 4, 14, 9, 0, 59 },
+ { 4, 13, 9, 0, 72 }, { 4, 13, 9, 0, 70 },
+ { 4, 13, 9, 0, 68 }, { 4, 13, 9, 0, 66 },
+ { 4, 13, 9, 0, 64 }, { 4, 13, 9, 0, 63 },
+ { 4, 13, 9, 0, 61 }, { 4, 13, 9, 0, 59 },
+ { 4, 13, 9, 0, 57 }, { 4, 13, 8, 0, 72 },
+ { 4, 13, 8, 0, 70 }, { 4, 13, 8, 0, 68 },
+ { 4, 13, 8, 0, 66 }, { 4, 13, 8, 0, 64 },
+ { 4, 13, 8, 0, 62 }, { 4, 13, 8, 0, 60 },
+ { 4, 13, 8, 0, 59 }, { 4, 12, 8, 0, 72 },
+ { 4, 12, 8, 0, 70 }, { 4, 12, 8, 0, 68 },
+ { 4, 12, 8, 0, 66 }, { 4, 12, 8, 0, 64 },
+ { 4, 12, 8, 0, 62 }, { 4, 12, 8, 0, 61 },
+ { 4, 12, 8, 0, 59 }, { 4, 12, 7, 0, 73 },
+ { 4, 12, 7, 0, 71 }, { 4, 12, 7, 0, 69 },
+ { 4, 12, 7, 0, 67 }, { 4, 12, 7, 0, 65 },
+ { 4, 12, 7, 0, 63 }, { 4, 12, 7, 0, 61 },
+ { 4, 12, 7, 0, 59 }, { 4, 11, 7, 0, 72 },
+ { 4, 11, 7, 0, 70 }, { 4, 11, 7, 0, 68 },
+ { 4, 11, 7, 0, 66 }, { 4, 11, 7, 0, 65 },
+ { 4, 11, 7, 0, 63 }, { 4, 11, 7, 0, 61 },
+ { 4, 11, 7, 0, 59 }, { 4, 11, 6, 0, 73 },
+ { 4, 11, 6, 0, 71 }, { 4, 11, 6, 0, 69 },
+ { 4, 11, 6, 0, 67 }, { 4, 11, 6, 0, 65 },
+ { 4, 11, 6, 0, 63 }, { 4, 11, 6, 0, 61 },
+ { 4, 11, 6, 0, 60 }, { 4, 10, 6, 0, 72 },
+ { 4, 10, 6, 0, 70 }, { 4, 10, 6, 0, 68 },
+ { 4, 10, 6, 0, 66 }, { 4, 10, 6, 0, 64 },
+ { 4, 10, 6, 0, 62 }, { 4, 10, 6, 0, 60 }
+ };
+ static struct bwn_txgain_entry txgain_5ghz_r1[] = {
+ { 7, 15, 15, 0, 99 }, { 7, 15, 15, 0, 96 },
+ { 7, 15, 15, 0, 93 }, { 7, 15, 15, 0, 90 },
+ { 7, 15, 15, 0, 88 }, { 7, 15, 15, 0, 85 },
+ { 7, 15, 15, 0, 83 }, { 7, 15, 15, 0, 81 },
+ { 7, 15, 15, 0, 78 }, { 7, 15, 15, 0, 76 },
+ { 7, 15, 15, 0, 74 }, { 7, 15, 15, 0, 72 },
+ { 7, 15, 15, 0, 70 }, { 7, 15, 15, 0, 68 },
+ { 7, 15, 15, 0, 66 }, { 7, 15, 15, 0, 64 },
+ { 7, 15, 15, 0, 62 }, { 7, 15, 15, 0, 60 },
+ { 7, 15, 15, 0, 59 }, { 7, 15, 15, 0, 57 },
+ { 7, 15, 15, 0, 55 }, { 7, 15, 14, 0, 72 },
+ { 7, 15, 14, 0, 70 }, { 7, 15, 14, 0, 68 },
+ { 7, 15, 14, 0, 66 }, { 7, 15, 14, 0, 64 },
+ { 7, 15, 14, 0, 62 }, { 7, 15, 14, 0, 60 },
+ { 7, 15, 14, 0, 58 }, { 7, 15, 14, 0, 56 },
+ { 7, 15, 14, 0, 55 }, { 7, 15, 13, 0, 71 },
+ { 7, 15, 13, 0, 69 }, { 7, 15, 13, 0, 67 },
+ { 7, 15, 13, 0, 65 }, { 7, 15, 13, 0, 63 },
+ { 7, 15, 13, 0, 62 }, { 7, 15, 13, 0, 60 },
+ { 7, 15, 13, 0, 58 }, { 7, 15, 13, 0, 56 },
+ { 7, 15, 12, 0, 72 }, { 7, 15, 12, 0, 70 },
+ { 7, 15, 12, 0, 68 }, { 7, 15, 12, 0, 66 },
+ { 7, 15, 12, 0, 64 }, { 7, 15, 12, 0, 62 },
+ { 7, 15, 12, 0, 60 }, { 7, 15, 12, 0, 59 },
+ { 7, 15, 12, 0, 57 }, { 7, 15, 11, 0, 73 },
+ { 7, 15, 11, 0, 71 }, { 7, 15, 11, 0, 69 },
+ { 7, 15, 11, 0, 67 }, { 7, 15, 11, 0, 65 },
+ { 7, 15, 11, 0, 63 }, { 7, 15, 11, 0, 61 },
+ { 7, 15, 11, 0, 60 }, { 7, 15, 11, 0, 58 },
+ { 7, 15, 10, 0, 71 }, { 7, 15, 10, 0, 69 },
+ { 7, 15, 10, 0, 67 }, { 7, 15, 10, 0, 65 },
+ { 7, 15, 10, 0, 63 }, { 7, 15, 10, 0, 61 },
+ { 7, 15, 10, 0, 60 }, { 7, 15, 10, 0, 58 },
+ { 7, 15, 9, 0, 70 }, { 7, 15, 9, 0, 68 },
+ { 7, 15, 9, 0, 66 }, { 7, 15, 9, 0, 64 },
+ { 7, 15, 9, 0, 62 }, { 7, 15, 9, 0, 61 },
+ { 7, 15, 9, 0, 59 }, { 7, 15, 9, 0, 57 },
+ { 7, 15, 9, 0, 56 }, { 7, 14, 9, 0, 68 },
+ { 7, 14, 9, 0, 66 }, { 7, 14, 9, 0, 65 },
+ { 7, 14, 9, 0, 63 }, { 7, 14, 9, 0, 61 },
+ { 7, 14, 9, 0, 59 }, { 7, 14, 9, 0, 58 },
+ { 7, 13, 9, 0, 70 }, { 7, 13, 9, 0, 68 },
+ { 7, 13, 9, 0, 66 }, { 7, 13, 9, 0, 64 },
+ { 7, 13, 9, 0, 63 }, { 7, 13, 9, 0, 61 },
+ { 7, 13, 9, 0, 59 }, { 7, 13, 9, 0, 57 },
+ { 7, 13, 8, 0, 70 }, { 7, 13, 8, 0, 68 },
+ { 7, 13, 8, 0, 66 }, { 7, 13, 8, 0, 64 },
+ { 7, 13, 8, 0, 62 }, { 7, 13, 8, 0, 60 },
+ { 7, 13, 8, 0, 59 }, { 7, 13, 8, 0, 57 },
+ { 7, 12, 8, 0, 70 }, { 7, 12, 8, 0, 68 },
+ { 7, 12, 8, 0, 66 }, { 7, 12, 8, 0, 64 },
+ { 7, 12, 8, 0, 62 }, { 7, 12, 8, 0, 61 },
+ { 7, 12, 8, 0, 59 }, { 7, 12, 8, 0, 57 },
+ { 7, 12, 7, 0, 70 }, { 7, 12, 7, 0, 68 },
+ { 7, 12, 7, 0, 66 }, { 7, 12, 7, 0, 64 },
+ { 7, 12, 7, 0, 62 }, { 7, 12, 7, 0, 61 },
+ { 7, 12, 7, 0, 59 }, { 7, 12, 7, 0, 57 },
+ { 7, 11, 7, 0, 70 }, { 7, 11, 7, 0, 68 },
+ { 7, 11, 7, 0, 66 }, { 7, 11, 7, 0, 64 },
+ { 7, 11, 7, 0, 62 }, { 7, 11, 7, 0, 61 },
+ { 7, 11, 7, 0, 59 }, { 7, 11, 7, 0, 57 },
+ { 7, 11, 6, 0, 69 }, { 7, 11, 6, 0, 67 },
+ { 7, 11, 6, 0, 65 }, { 7, 11, 6, 0, 63 },
+ { 7, 11, 6, 0, 62 }, { 7, 11, 6, 0, 60 }
+ };
+
+ if (mac->mac_phy.rev != 0 && mac->mac_phy.rev != 1) {
+ if (siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_NOPA)
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_r2);
+ else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
+ txgain_2ghz_r2);
+ else
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
+ txgain_5ghz_r2);
+ return;
+ }
+
+ if (mac->mac_phy.rev == 0) {
+ if ((siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_NOPA) ||
+ (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_HGPA))
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_r0);
+ else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
+ txgain_2ghz_r0);
+ else
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128,
+ txgain_5ghz_r0);
+ return;
+ }
+
+ if ((siba_sprom_get_bf_hi(sc->sc_dev) & BWN_BFH_NOPA) ||
+ (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_HGPA))
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_r1);
+ else if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_2ghz_r1);
+ else
+ bwn_phy_lp_gaintbl_write_multi(mac, 0, 128, txgain_5ghz_r1);
+}
+
+static void
+bwn_tab_write(struct bwn_mac *mac, uint32_t typeoffset, uint32_t value)
+{
+ uint32_t offset, type;
+
+ type = BWN_TAB_GETTYPE(typeoffset);
+ offset = BWN_TAB_GETOFFSET(typeoffset);
+ KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
+
+ switch (type) {
+ case BWN_TAB_8BIT:
+ KASSERT(!(value & ~0xff), ("%s:%d: fail", __func__, __LINE__));
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
+ break;
+ case BWN_TAB_16BIT:
+ KASSERT(!(value & ~0xffff),
+ ("%s:%d: fail", __func__, __LINE__));
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
+ break;
+ case BWN_TAB_32BIT:
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATAHI, value >> 16);
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLEDATALO, value);
+ break;
+ default:
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ }
+}
+
+static int
+bwn_phy_lp_loopback(struct bwn_mac *mac)
+{
+ struct bwn_phy_lp_iq_est ie;
+ int i, index = -1;
+ uint32_t tmp;
+
+ memset(&ie, 0, sizeof(ie));
+
+ bwn_phy_lp_set_trsw_over(mac, 1, 1);
+ BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVR, 1);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_CTL_OVRVAL, 0xfffe);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x800);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x800);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x8);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x8);
+ BWN_RF_WRITE(mac, BWN_B2062_N_TXCTL_A, 0x80);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_0, 0x80);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_VAL_0, 0x80);
+ for (i = 0; i < 32; i++) {
+ bwn_phy_lp_set_rxgain_idx(mac, i);
+ bwn_phy_lp_ddfs_turnon(mac, 1, 1, 5, 5, 0);
+ if (!(bwn_phy_lp_rx_iq_est(mac, 1000, 32, &ie)))
+ continue;
+ tmp = (ie.ie_ipwr + ie.ie_qpwr) / 1000;
+ if ((tmp > 4000) && (tmp < 10000)) {
+ index = i;
+ break;
+ }
+ }
+ bwn_phy_lp_ddfs_turnoff(mac);
+ return (index);
+}
+
+static void
+bwn_phy_lp_set_rxgain_idx(struct bwn_mac *mac, uint16_t idx)
+{
+
+ bwn_phy_lp_set_rxgain(mac, bwn_tab_read(mac, BWN_TAB_2(12, idx)));
+}
+
+static void
+bwn_phy_lp_ddfs_turnon(struct bwn_mac *mac, int i_on, int q_on,
+ int incr1, int incr2, int scale_idx)
+{
+
+ bwn_phy_lp_ddfs_turnoff(mac);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS_POINTER_INIT, 0xff80);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS_POINTER_INIT, 0x80ff);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS_INCR_INIT, 0xff80, incr1);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS_INCR_INIT, 0x80ff, incr2 << 8);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xfff7, i_on << 3);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xffef, q_on << 4);
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DDFS, 0xff9f, scale_idx << 5);
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS, 0xfffb);
+ BWN_PHY_SET(mac, BWN_PHY_AFE_DDFS, 0x2);
+ BWN_PHY_SET(mac, BWN_PHY_LP_PHY_CTL, 0x20);
+}
+
+static uint8_t
+bwn_phy_lp_rx_iq_est(struct bwn_mac *mac, uint16_t sample, uint8_t time,
+ struct bwn_phy_lp_iq_est *ie)
+{
+ int i;
+
+ BWN_PHY_MASK(mac, BWN_PHY_CRSGAIN_CTL, 0xfff7);
+ BWN_PHY_WRITE(mac, BWN_PHY_IQ_NUM_SMPLS_ADDR, sample);
+ BWN_PHY_SETMASK(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR, 0xff00, time);
+ BWN_PHY_MASK(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR, 0xfeff);
+ BWN_PHY_SET(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR, 0x200);
+
+ for (i = 0; i < 500; i++) {
+ if (!(BWN_PHY_READ(mac,
+ BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR) & 0x200))
+ break;
+ DELAY(1000);
+ }
+ if ((BWN_PHY_READ(mac, BWN_PHY_IQ_ENABLE_WAIT_TIME_ADDR) & 0x200)) {
+ BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x8);
+ return 0;
+ }
+
+ ie->ie_iqprod = BWN_PHY_READ(mac, BWN_PHY_IQ_ACC_HI_ADDR);
+ ie->ie_iqprod <<= 16;
+ ie->ie_iqprod |= BWN_PHY_READ(mac, BWN_PHY_IQ_ACC_LO_ADDR);
+ ie->ie_ipwr = BWN_PHY_READ(mac, BWN_PHY_IQ_I_PWR_ACC_HI_ADDR);
+ ie->ie_ipwr <<= 16;
+ ie->ie_ipwr |= BWN_PHY_READ(mac, BWN_PHY_IQ_I_PWR_ACC_LO_ADDR);
+ ie->ie_qpwr = BWN_PHY_READ(mac, BWN_PHY_IQ_Q_PWR_ACC_HI_ADDR);
+ ie->ie_qpwr <<= 16;
+ ie->ie_qpwr |= BWN_PHY_READ(mac, BWN_PHY_IQ_Q_PWR_ACC_LO_ADDR);
+
+ BWN_PHY_SET(mac, BWN_PHY_CRSGAIN_CTL, 0x8);
+ return 1;
+}
+
+static uint32_t
+bwn_tab_read(struct bwn_mac *mac, uint32_t typeoffset)
+{
+ uint32_t offset, type, value;
+
+ type = BWN_TAB_GETTYPE(typeoffset);
+ offset = BWN_TAB_GETOFFSET(typeoffset);
+ KASSERT(offset <= 0xffff, ("%s:%d: fail", __func__, __LINE__));
+
+ switch (type) {
+ case BWN_TAB_8BIT:
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+ value = BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO) & 0xff;
+ break;
+ case BWN_TAB_16BIT:
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+ value = BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO);
+ break;
+ case BWN_TAB_32BIT:
+ BWN_PHY_WRITE(mac, BWN_PHY_TABLE_ADDR, offset);
+ value = BWN_PHY_READ(mac, BWN_PHY_TABLEDATAHI);
+ value <<= 16;
+ value |= BWN_PHY_READ(mac, BWN_PHY_TABLEDATALO);
+ break;
+ default:
+ KASSERT(0 == 1, ("%s:%d: fail", __func__, __LINE__));
+ value = 0;
+ }
+
+ return (value);
+}
+
+static void
+bwn_phy_lp_ddfs_turnoff(struct bwn_mac *mac)
+{
+
+ BWN_PHY_MASK(mac, BWN_PHY_AFE_DDFS, 0xfffd);
+ BWN_PHY_MASK(mac, BWN_PHY_LP_PHY_CTL, 0xffdf);
+}
+
+static void
+bwn_phy_lp_set_txgain_dac(struct bwn_mac *mac, uint16_t dac)
+{
+ uint16_t ctl;
+
+ ctl = BWN_PHY_READ(mac, BWN_PHY_AFE_DAC_CTL) & 0xc7f;
+ ctl |= dac << 7;
+ BWN_PHY_SETMASK(mac, BWN_PHY_AFE_DAC_CTL, 0xf000, ctl);
+}
+
+static void
+bwn_phy_lp_set_txgain_pa(struct bwn_mac *mac, uint16_t gain)
+{
+
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfb), 0xe03f, gain << 6);
+ BWN_PHY_SETMASK(mac, BWN_PHY_OFDM(0xfd), 0x80ff, gain << 8);
+}
+
+static void
+bwn_phy_lp_set_txgain_override(struct bwn_mac *mac)
+{
+
+ if (mac->mac_phy.rev < 2)
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x100);
+ else {
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x80);
+ BWN_PHY_SET(mac, BWN_PHY_RF_OVERRIDE_2, 0x4000);
+ }
+ BWN_PHY_SET(mac, BWN_PHY_AFE_CTL_OVR, 0x40);
+}
+
+static uint16_t
+bwn_phy_lp_get_pa_gain(struct bwn_mac *mac)
+{
+
+ return BWN_PHY_READ(mac, BWN_PHY_OFDM(0xfb)) & 0x7f;
+}
+
+static uint8_t
+bwn_nbits(int32_t val)
+{
+ uint32_t tmp;
+ uint8_t nbits = 0;
+
+ for (tmp = abs(val); tmp != 0; tmp >>= 1)
+ nbits++;
+ return (nbits);
+}
+
+static void
+bwn_phy_lp_gaintbl_write_multi(struct bwn_mac *mac, int offset, int count,
+ struct bwn_txgain_entry *table)
+{
+ int i;
+
+ for (i = offset; i < count; i++)
+ bwn_phy_lp_gaintbl_write(mac, i, table[i]);
+}
+
+static void
+bwn_phy_lp_gaintbl_write(struct bwn_mac *mac, int offset,
+ struct bwn_txgain_entry data)
+{
+
+ if (mac->mac_phy.rev >= 2)
+ bwn_phy_lp_gaintbl_write_r2(mac, offset, data);
+ else
+ bwn_phy_lp_gaintbl_write_r01(mac, offset, data);
+}
+
+static void
+bwn_phy_lp_gaintbl_write_r2(struct bwn_mac *mac, int offset,
+ struct bwn_txgain_entry te)
+{
+ struct bwn_softc *sc = mac->mac_sc;
+ struct ieee80211com *ic = &sc->sc_ic;
+ uint32_t tmp;
+
+ KASSERT(mac->mac_phy.rev >= 2, ("%s:%d: fail", __func__, __LINE__));
+
+ tmp = (te.te_pad << 16) | (te.te_pga << 8) | te.te_gm;
+ if (mac->mac_phy.rev >= 3) {
+ tmp |= ((IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) ?
+ (0x10 << 24) : (0x70 << 24));
+ } else {
+ tmp |= ((IEEE80211_IS_CHAN_5GHZ(ic->ic_curchan)) ?
+ (0x14 << 24) : (0x7f << 24));
+ }
+ bwn_tab_write(mac, BWN_TAB_4(7, 0xc0 + offset), tmp);
+ bwn_tab_write(mac, BWN_TAB_4(7, 0x140 + offset),
+ te.te_bbmult << 20 | te.te_dac << 28);
+}
+
+static void
+bwn_phy_lp_gaintbl_write_r01(struct bwn_mac *mac, int offset,
+ struct bwn_txgain_entry te)
+{
+
+ KASSERT(mac->mac_phy.rev < 2, ("%s:%d: fail", __func__, __LINE__));
+
+ bwn_tab_write(mac, BWN_TAB_4(10, 0xc0 + offset),
+ (te.te_pad << 11) | (te.te_pga << 7) | (te.te_gm << 4) |
+ te.te_dac);
+ bwn_tab_write(mac, BWN_TAB_4(10, 0x140 + offset), te.te_bbmult << 20);
+}
diff --git a/sys/dev/bwn/if_bwn_phy_lp.h b/sys/dev/bwn/if_bwn_phy_lp.h
new file mode 100644
index 0000000..bb1c4dc
--- /dev/null
+++ b/sys/dev/bwn/if_bwn_phy_lp.h
@@ -0,0 +1,50 @@
+/*-
+ * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
+ * 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,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * 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 NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __IF_BWN_PHY_LP_H__
+#define __IF_BWN_PHY_LP_H__
+
+extern void bwn_phy_lp_init_pre(struct bwn_mac *);
+extern int bwn_phy_lp_init(struct bwn_mac *);
+extern uint16_t bwn_phy_lp_read(struct bwn_mac *, uint16_t);
+extern void bwn_phy_lp_write(struct bwn_mac *, uint16_t, uint16_t);
+extern void bwn_phy_lp_maskset(struct bwn_mac *, uint16_t, uint16_t,
+ uint16_t);
+extern uint16_t bwn_phy_lp_rf_read(struct bwn_mac *, uint16_t);
+extern void bwn_phy_lp_rf_write(struct bwn_mac *, uint16_t, uint16_t);
+extern void bwn_phy_lp_rf_onoff(struct bwn_mac *, int);
+extern int bwn_phy_lp_switch_channel(struct bwn_mac *, uint32_t);
+extern void bwn_phy_lp_switch_analog(struct bwn_mac *, int);
+extern uint32_t bwn_phy_lp_get_default_chan(struct bwn_mac *);
+extern void bwn_phy_lp_set_antenna(struct bwn_mac *, int);
+extern void bwn_phy_lp_task_60s(struct bwn_mac *);
+
+#endif /* __IF_BWN_PHY_LP_H__ */
diff --git a/sys/dev/bwn/if_bwnreg.h b/sys/dev/bwn/if_bwnreg.h
index 71f56f4..f4c1ba0 100644
--- a/sys/dev/bwn/if_bwnreg.h
+++ b/sys/dev/bwn/if_bwnreg.h
@@ -67,6 +67,12 @@
#define BWN_PHYTYPE_G 0x02
#define BWN_PHYTYPE_N 0x04
#define BWN_PHYTYPE_LP 0x05
+#define BWN_PHYTYPE_SSLPN 0x06
+#define BWN_PHYTYPE_HT 0x07
+#define BWN_PHYTYPE_LCN 0x08
+#define BWN_PHYTYPE_LCNXN 0x09
+#define BWN_PHYTYPE_LCN40 0x0a
+#define BWN_PHYTYPE_AC 0x0b
#define BWN_DMA0_REASON 0x20
#define BWN_DMA0_INTR_MASK 0x24
diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index 170d157..3b5ab17 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -2221,7 +2221,7 @@ storm_memset_eq_prod(struct bxe_softc *sc,
/*
* Post a slowpath command.
*
- * A slowpath command is used to propogate a configuration change through
+ * A slowpath command is used to propagate a configuration change through
* the controller in a controlled manner, allowing each STORM processor and
* other H/W blocks to phase in the change. The commands sent on the
* slowpath are referred to as ramrods. Depending on the ramrod used the
@@ -4248,7 +4248,7 @@ bxe_nic_unload(struct bxe_softc *sc,
/*
* Nothing to do during unload if previous bxe_nic_load()
- * did not completed succesfully - all resourses are released.
+ * did not completed successfully - all resourses are released.
*/
if ((sc->state == BXE_STATE_CLOSED) ||
(sc->state == BXE_STATE_ERROR)) {
@@ -4762,7 +4762,7 @@ bxe_dump_mbuf(struct bxe_softc *sc,
* Checks to ensure the 13 bd sliding window is >= MSS for TSO.
* Check that (13 total bds - 3 bds) = 10 bd window >= MSS.
* The window: 3 bds are = 1 for headers BD + 2 for parse BD and last BD
- * The headers comes in a seperate bd in FreeBSD so 13-3=10.
+ * The headers comes in a separate bd in FreeBSD so 13-3=10.
* Returns: 0 if OK to send, 1 if packet needs further defragmentation
*/
static int
@@ -7990,7 +7990,7 @@ bxe_attn_int_deasserted2(struct bxe_softc *sc,
mask1 = REG_RD(sc, PXP2_REG_PXP2_INT_MASK_1);
val0 = REG_RD(sc, PXP2_REG_PXP2_INT_STS_0);
/*
- * If the olny PXP2_EOP_ERROR_BIT is set in
+ * If the only PXP2_EOP_ERROR_BIT is set in
* STS0 and STS1 - clear it
*
* probably we lose additional attentions between
@@ -10627,7 +10627,7 @@ bxe_set_234_gates(struct bxe_softc *sc,
(!close) ? (val | HC_CONFIG_0_REG_BLOCK_DISABLE_0) :
(val & ~(uint32_t)HC_CONFIG_0_REG_BLOCK_DISABLE_0));
} else {
- /* Prevent incomming interrupts in IGU */
+ /* Prevent incoming interrupts in IGU */
val = REG_RD(sc, IGU_REG_BLOCK_CONFIGURATION);
REG_WR(sc, IGU_REG_BLOCK_CONFIGURATION,
diff --git a/sys/dev/bxe/bxe_elink.c b/sys/dev/bxe/bxe_elink.c
index 0ce0433..ab5bac4 100644
--- a/sys/dev/bxe/bxe_elink.c
+++ b/sys/dev/bxe/bxe_elink.c
@@ -1294,7 +1294,7 @@ static void elink_ets_e3b0_set_credit_upper_bound_nig(
* Will return the NIG ETS registers to init values.Except
* credit_upper_bound.
* That isn't used in this configuration (No WFQ is enabled) and will be
-* configured acording to spec
+* configured according to spec.
*.
******************************************************************************/
static void elink_ets_e3b0_nig_disabled(const struct elink_params *params,
@@ -1411,7 +1411,7 @@ static void elink_ets_e3b0_set_credit_upper_bound_pbf(
* Will return the PBF ETS registers to init values.Except
* credit_upper_bound.
* That isn't used in this configuration (No WFQ is enabled) and will be
-* configured acording to spec
+* configured according to spec.
*.
******************************************************************************/
static void elink_ets_e3b0_pbf_disabled(const struct elink_params *params)
@@ -1469,7 +1469,7 @@ static void elink_ets_e3b0_pbf_disabled(const struct elink_params *params)
}
/******************************************************************************
* Description:
-* E3B0 disable will return basicly the values to init values.
+* E3B0 disable will return basically the values to init values.
*.
******************************************************************************/
static elink_status_t elink_ets_e3b0_disabled(const struct elink_params *params,
@@ -1492,7 +1492,7 @@ static elink_status_t elink_ets_e3b0_disabled(const struct elink_params *params,
/******************************************************************************
* Description:
-* Disable will return basicly the values to init values.
+* Disable will return basically the values to init values.
*
******************************************************************************/
elink_status_t elink_ets_disabled(struct elink_params *params,
@@ -3762,7 +3762,7 @@ static elink_status_t elink_eee_initial_config(struct elink_params *params,
{
vars->eee_status |= ((uint32_t) mode) << SHMEM_EEE_SUPPORTED_SHIFT;
- /* Propogate params' bits --> vars (for migration exposure) */
+ /* Propagate params' bits --> vars (for migration exposure) */
if (params->eee_mode & ELINK_EEE_MODE_ENABLE_LPI)
vars->eee_status |= SHMEM_EEE_LPI_REQUESTED_BIT;
else
@@ -14632,7 +14632,7 @@ static void elink_check_over_curr(struct elink_params *params,
vars->phy_flags &= ~PHY_OVER_CURRENT_FLAG;
}
-/* Returns 0 if no change occured since last check; 1 otherwise. */
+/* Returns 0 if no change occurred since last check; 1 otherwise. */
static uint8_t elink_analyze_link_error(struct elink_params *params,
struct elink_vars *vars, uint32_t status,
uint32_t phy_flag, uint32_t link_flag, uint8_t notify)
diff --git a/sys/dev/bxe/bxe_stats.c b/sys/dev/bxe/bxe_stats.c
index 03e643c..2310e8f 100644
--- a/sys/dev/bxe/bxe_stats.c
+++ b/sys/dev/bxe/bxe_stats.c
@@ -1670,7 +1670,7 @@ bxe_stats_init(struct bxe_softc *sc)
bxe_port_stats_base_init(sc);
}
- /* mark the end of statistics initializiation */
+ /* mark the end of statistics initialization */
sc->stats_init = FALSE;
}
diff --git a/sys/dev/bxe/bxe_stats.h b/sys/dev/bxe/bxe_stats.h
index 75f0248..a0f5792 100644
--- a/sys/dev/bxe/bxe_stats.h
+++ b/sys/dev/bxe/bxe_stats.h
@@ -264,7 +264,7 @@ struct bxe_eth_stats {
uint32_t mbuf_alloc_sge;
uint32_t mbuf_alloc_tpa;
- /* num. of times tx queue full occured */
+ /* num. of times tx queue full occurred */
uint32_t tx_queue_full_return;
};
@@ -370,7 +370,7 @@ struct bxe_eth_q_stats {
uint32_t mbuf_alloc_sge;
uint32_t mbuf_alloc_tpa;
- /* num. of times tx queue full occured */
+ /* num. of times tx queue full occurred */
uint32_t tx_queue_full_return;
};
diff --git a/sys/dev/bxe/ecore_hsi.h b/sys/dev/bxe/ecore_hsi.h
index 9ed0264..d1924a7 100644
--- a/sys/dev/bxe/ecore_hsi.h
+++ b/sys/dev/bxe/ecore_hsi.h
@@ -8188,7 +8188,7 @@ union fcoe_kcqe_params
struct fcoe_kcqe
{
uint32_t fcoe_conn_id /* Drivers connection ID (only 16 bits are used) */;
- uint32_t completion_status /* 0=command completed succesfuly, 1=command failed */;
+ uint32_t completion_status /* 0=command completed successfully, 1=command failed */;
uint32_t fcoe_conn_context_id /* Context ID of the FCoE connection */;
union fcoe_kcqe_params params /* command-specific parameters */;
uint16_t qe_self_seq /* Self identifying sequence number */;
@@ -9464,7 +9464,7 @@ union iscsi_kcqe_params
struct iscsi_kcqe
{
uint32_t iscsi_conn_id /* Drivers connection ID (only 16 bits are used) */;
- uint32_t completion_status /* 0=command completed succesfuly, 1=command failed */;
+ uint32_t completion_status /* 0=command completed successfully, 1=command failed */;
uint32_t iscsi_conn_context_id /* Context ID of the iSCSI connection */;
union iscsi_kcqe_params params /* command-specific parameters */;
#if defined(__BIG_ENDIAN)
@@ -10241,7 +10241,7 @@ struct tstorm_tcp_st_context_section
uint16_t mid_mac_address /* TX source MAC MID-16 */;
uint16_t msb_mac_address /* TX source MAC MSB-16 */;
#endif
- uint32_t rightmost_received_seq /* The maximum sequence ever recieved - used for The New Patent */;
+ uint32_t rightmost_received_seq /* The maximum sequence ever received - used for The New Patent */;
};
/*
@@ -11694,7 +11694,7 @@ struct flow_control_configuration
struct function_start_data
{
uint8_t function_mode /* the function mode */;
- uint8_t allow_npar_tx_switching /* If set, inter-pf tx switching is allowed in Switch Independant function mode. (E2/E3 Only) */;
+ uint8_t allow_npar_tx_switching /* If set, inter-pf tx switching is allowed in Switch Independent function mode. (E2/E3 Only) */;
uint16_t sd_vlan_tag /* value of Vlan in case of switch depended multi-function mode */;
uint16_t vif_id /* value of VIF id in case of NIV multi-function mode */;
uint8_t path_id;
@@ -11712,7 +11712,7 @@ struct function_start_data
uint8_t sd_accept_mf_clss_fail /* If set, accept packets that fail Multi-Function Switch-Dependent classification. Only one VNIC on the port can have this set to 1 */;
uint8_t sd_accept_mf_clss_fail_match_ethtype /* If set, accepted packets must match the ethertype of sd_clss_fail_ethtype */;
uint16_t sd_accept_mf_clss_fail_ethtype /* Ethertype to match in the case of sd_accept_mf_clss_fail_match_ethtype */;
- uint16_t sd_vlan_eth_type /* Value of ether-type to use in the case of switch dependant multi-function mode. Setting this to 0 uses the default value of 0x8100 */;
+ uint16_t sd_vlan_eth_type /* Value of ether-type to use in the case of switch dependent multi-function mode. Setting this to 0 uses the default value of 0x8100 */;
uint8_t sd_vlan_force_pri_flg /* If set, the SD Vlan Priority is forced to the value of the sd_vlan_pri_force_val field regardless of the DCB or inband VLAN priority. */;
uint8_t sd_vlan_force_pri_val /* value to force SD Vlan Priority if sd_vlan_pri_force_flg is set */;
uint8_t c2s_pri_tt_valid /* When set, c2s_pri_trans_table is valid */;
@@ -11754,7 +11754,7 @@ struct function_update_data
uint8_t sd_vlan_eth_type_change_flg /* If set, the SD VLAN Ethertype is changed according to the field sd_vlan_eth_type */;
uint8_t reserved1;
uint16_t sd_vlan_tag /* New value of Outer Vlan in case of switch depended multi-function mode */;
- uint16_t sd_vlan_eth_type /* New value of ether-type in the case of switch dependant multi-function mode. Setting this to 0 restores the default value of 0x8100 */;
+ uint16_t sd_vlan_eth_type /* New value of ether-type in the case of switch dependent multi-function mode. Setting this to 0 restores the default value of 0x8100 */;
uint16_t reserved0;
uint32_t reserved2;
};
@@ -12564,7 +12564,7 @@ struct ustorm_toe_prefetched_bd
uint32_t __addr_hi /* receive payload base address - Single continuous buffer (page) pointer */;
#if defined(__BIG_ENDIAN)
uint16_t flags;
- #define __USTORM_TOE_PREFETCHED_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the begining of an application buffer */
+ #define __USTORM_TOE_PREFETCHED_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the beginning of an application buffer */
#define __USTORM_TOE_PREFETCHED_BD_START_SHIFT 0
#define __USTORM_TOE_PREFETCHED_BD_END (0x1<<1) /* BitField flagsbd command flags this bd is the end of an application buffer */
#define __USTORM_TOE_PREFETCHED_BD_END_SHIFT 1
@@ -12578,7 +12578,7 @@ struct ustorm_toe_prefetched_bd
#elif defined(__LITTLE_ENDIAN)
uint16_t __buf_un_used /* Number of bytes left for placement in the pre fetched application/grq bd 0 size for buffer is not valid */;
uint16_t flags;
- #define __USTORM_TOE_PREFETCHED_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the begining of an application buffer */
+ #define __USTORM_TOE_PREFETCHED_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the beginning of an application buffer */
#define __USTORM_TOE_PREFETCHED_BD_START_SHIFT 0
#define __USTORM_TOE_PREFETCHED_BD_END (0x1<<1) /* BitField flagsbd command flags this bd is the end of an application buffer */
#define __USTORM_TOE_PREFETCHED_BD_END_SHIFT 1
@@ -12609,9 +12609,9 @@ struct ustorm_toe_st_context
#define USTORM_TOE_ST_CONTEXT_RESERVED0 (0x1F<<3) /* BitField flags2various state flags */
#define USTORM_TOE_ST_CONTEXT_RESERVED0_SHIFT 3
uint8_t __indirection_shift /* Offset in bits of the cupid of this connection on the 64Bits fetched from internal memoy */;
- uint16_t indirection_ram_offset /* address offset in internal memory from the begining of the table consisting the cpu id of this connection (Only 12 bits are used) */;
+ uint16_t indirection_ram_offset /* address offset in internal memory from the beginning of the table consisting the cpu id of this connection (Only 12 bits are used) */;
#elif defined(__LITTLE_ENDIAN)
- uint16_t indirection_ram_offset /* address offset in internal memory from the begining of the table consisting the cpu id of this connection (Only 12 bits are used) */;
+ uint16_t indirection_ram_offset /* address offset in internal memory from the beginning of the table consisting the cpu id of this connection (Only 12 bits are used) */;
uint8_t __indirection_shift /* Offset in bits of the cupid of this connection on the 64Bits fetched from internal memoy */;
uint8_t flags2;
#define USTORM_TOE_ST_CONTEXT_IGNORE_GRQ_PUSH (0x1<<0) /* BitField flags2various state flags we will ignore grq push unless it is ping pong test */
@@ -12637,8 +12637,8 @@ struct ustorm_toe_st_context
uint32_t initial_rcv_wnd /* the maximal advertized window */;
uint32_t __bytes_cons /* the last rq_available_bytes producer that was read from host - used to know how many bytes were added */;
uint32_t __prev_consumed_grq_bytes /* the last rq_available_bytes producer that was read from host - used to know how many bytes were added */;
- uint32_t prev_rcv_win_right_edge /* siquence of the last bytes that can be recieved - used to know how many bytes were added */;
- uint32_t rcv_nxt /* Receive sequence: next expected - of the right most recieved packet */;
+ uint32_t prev_rcv_win_right_edge /* siquence of the last bytes that can be received - used to know how many bytes were added */;
+ uint32_t rcv_nxt /* Receive sequence: next expected - of the right most received packet */;
struct ustorm_toe_prefetched_isle_bd __isle_bd /* prefetched bd for the isle */;
struct ustorm_toe_ring_params pen_ring_params /* peninsula ring params */;
struct ustorm_toe_prefetched_bd __pen_bd_0 /* peninsula prefetched bd for the peninsula */;
@@ -12839,7 +12839,7 @@ struct toe_rx_bd
uint32_t addr_hi /* receive payload base address - Single continuous buffer (page) pointer */;
#if defined(__BIG_ENDIAN)
uint16_t flags;
- #define TOE_RX_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the begining of an application buffer */
+ #define TOE_RX_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the beginning of an application buffer */
#define TOE_RX_BD_START_SHIFT 0
#define TOE_RX_BD_END (0x1<<1) /* BitField flagsbd command flags this bd is the end of an application buffer */
#define TOE_RX_BD_END_SHIFT 1
@@ -12853,7 +12853,7 @@ struct toe_rx_bd
#elif defined(__LITTLE_ENDIAN)
uint16_t size /* Size of the buffer pointed by the BD */;
uint16_t flags;
- #define TOE_RX_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the begining of an application buffer */
+ #define TOE_RX_BD_START (0x1<<0) /* BitField flagsbd command flags this bd is the beginning of an application buffer */
#define TOE_RX_BD_START_SHIFT 0
#define TOE_RX_BD_END (0x1<<1) /* BitField flagsbd command flags this bd is the end of an application buffer */
#define TOE_RX_BD_END_SHIFT 1
@@ -12935,7 +12935,7 @@ struct toe_rx_cqe
*/
struct toe_rx_db_data
{
- uint32_t rcv_win_right_edge /* siquence of the last bytes that can be recieved */;
+ uint32_t rcv_win_right_edge /* siquence of the last bytes that can be received */;
uint32_t bytes_prod /* cyclic counter of posted bytes */;
#if defined(__BIG_ENDIAN)
uint8_t reserved1 /* reserved */;
diff --git a/sys/dev/bxe/ecore_init.h b/sys/dev/bxe/ecore_init.h
index 8ce06ab..05c5bf7 100644
--- a/sys/dev/bxe/ecore_init.h
+++ b/sys/dev/bxe/ecore_init.h
@@ -321,7 +321,7 @@ static inline void ecore_dcb_config_qm(struct bxe_softc *sc, enum cos_mode mode,
/*
- * congestion managment port init api description
+ * congestion management port init api description
* the api works as follows:
* the driver should pass the cmng_init_input struct, the port_init function
* will prepare the required internal ram structure which will be passed back
diff --git a/sys/dev/bxe/ecore_sp.h b/sys/dev/bxe/ecore_sp.h
index 15403d7..10d6c08 100644
--- a/sys/dev/bxe/ecore_sp.h
+++ b/sys/dev/bxe/ecore_sp.h
@@ -1949,7 +1949,7 @@ void ecore_init_mcast_obj(struct bxe_softc *sc,
* the current command will be enqueued to the tail of the
* pending commands list.
*
- * Return: 0 is operation was successfull and there are no pending completions,
+ * Return: 0 is operation was successful and there are no pending completions,
* negative if there were errors, positive if there are pending
* completions.
*/
diff --git a/sys/dev/cardbus/cardbus_cis.c b/sys/dev/cardbus/cardbus_cis.c
index 00c34a6..55c4d35 100644
--- a/sys/dev/cardbus/cardbus_cis.c
+++ b/sys/dev/cardbus/cardbus_cis.c
@@ -406,7 +406,7 @@ cardbus_read_tuple_conf(device_t cbdev, device_t child, uint32_t start,
}
/*
- * Read the CIS data out of memroy. We indirect through the bus space
+ * Read the CIS data out of memory. We indirect through the bus space
* routines to ensure proper byte ordering conversions when necessary.
*/
static int
diff --git a/sys/dev/ce/ceddk.c b/sys/dev/ce/ceddk.c
index bc98012..3707d47 100644
--- a/sys/dev/ce/ceddk.c
+++ b/sys/dev/ce/ceddk.c
@@ -623,7 +623,7 @@ void ce_stop_chan (ce_chan_t *c)
/* XXXRIK: This function should be for comleteness, but for now I
* don't use it. So I just start to write and didn't finished it yet.
- * It and it is VERY BUGGY!!! Do not use it. If you realy
+ * It and it is VERY BUGGY!!! Do not use it. If you really
* need it ask me to fix it or rewrite it by your self.
* Note: most buggy part of it in ce_on_config_stop!
*/
diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c
index 85b9fce..69779d6 100644
--- a/sys/dev/ce/if_ce.c
+++ b/sys/dev/ce/if_ce.c
@@ -2448,7 +2448,7 @@ static int ng_ce_rmnode (node_p node)
NG_NODE_UNREF (node);
}
#if __FreeBSD_version >= 502120
- NG_NODE_REVIVE(node); /* Persistant node */
+ NG_NODE_REVIVE(node); /* Persistent node */
#else
node->nd_flags &= ~NG_INVALID;
#endif
diff --git a/sys/dev/cesa/cesa.c b/sys/dev/cesa/cesa.c
index 8a2b19d..4d71ae0 100644
--- a/sys/dev/cesa/cesa.c
+++ b/sys/dev/cesa/cesa.c
@@ -284,7 +284,7 @@ cesa_free_request(struct cesa_softc *sc, struct cesa_request *cr)
STAILQ_CONCAT(&sc->sc_free_sdesc, &cr->cr_sdesc);
CESA_UNLOCK(sc, sdesc);
- /* Unload DMA memory asociated with request */
+ /* Unload DMA memory associated with request */
if (cr->cr_dmap_loaded) {
bus_dmamap_unload(sc->sc_data_dtag, cr->cr_dmap);
cr->cr_dmap_loaded = 0;
@@ -705,7 +705,7 @@ cesa_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
/*
* Fill in current packet with data. Break if there is
* no more data in current DMA segment or an error
- * occured.
+ * occurred.
*/
size = cesa_fill_packet(sc, &cp, &seg);
if (size <= 0) {
@@ -1260,7 +1260,7 @@ cesa_detach(device_t dev)
/* Relase I/O and IRQ resources */
bus_release_resources(dev, cesa_res_spec, sc->sc_res);
- /* Destory mutexes */
+ /* Destroy mutexes */
mtx_destroy(&sc->sc_sessions_lock);
mtx_destroy(&sc->sc_requests_lock);
mtx_destroy(&sc->sc_sdesc_lock);
diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index 6c2a843..f4eeabf 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -464,7 +464,7 @@ ciss_attach(device_t dev)
ciss_initq_notify(sc);
/*
- * Initalize device sysctls.
+ * Initialize device sysctls.
*/
ciss_init_sysctl(sc);
@@ -619,7 +619,7 @@ ciss_init_pci(struct ciss_softc *sc)
/*
* XXX Big hammer, masks/unmasks all possible interrupts. This should
* work on all hardware variants. Need to add code to handle the
- * "controller crashed" interupt bit that this unmasks.
+ * "controller crashed" interrupt bit that this unmasks.
*/
sqmask = ~0;
}
@@ -4487,7 +4487,7 @@ ciss_name_ldrive_org(int org)
case CISS_LDRIVE_RAIDADG:
return("RAID ADG");
}
- return("unkown");
+ return("unknown");
}
/************************************************************************
diff --git a/sys/dev/ciss/cissvar.h b/sys/dev/ciss/cissvar.h
index 6bc9cf4..20693af 100644
--- a/sys/dev/ciss/cissvar.h
+++ b/sys/dev/ciss/cissvar.h
@@ -58,7 +58,7 @@ typedef STAILQ_HEAD(, ciss_request) cr_qhead_t;
/*
* Interrupt reduction can be controlled by tuning the interrupt
- * coalesce delay and count paramters. The delay (in microseconds)
+ * coalesce delay and count parameters. The delay (in microseconds)
* defers delivery of interrupts to increase the chance of there being
* more than one completed command ready when the interrupt is
* delivered. The count expedites the delivery of the interrupt when
diff --git a/sys/dev/cmx/cmx.c b/sys/dev/cmx/cmx.c
index 69cf892..a7cd8ab 100644
--- a/sys/dev/cmx/cmx.c
+++ b/sys/dev/cmx/cmx.c
@@ -235,7 +235,7 @@ cmx_release_resources(device_t dev)
}
/*
- * Bus independant device attachment routine. Creates the
+ * Bus independent device attachment routine. Creates the
* character device node.
*/
int
@@ -258,7 +258,7 @@ cmx_attach(device_t dev)
}
/*
- * Bus independant device detachment routine. Makes sure all
+ * Bus independent device detachment routine. Makes sure all
* allocated resources are freed, callouts disabled and waiting
* processes unblocked.
*/
diff --git a/sys/dev/cmx/cmx_pccard.c b/sys/dev/cmx/cmx_pccard.c
index ebb57cc..89411e5 100644
--- a/sys/dev/cmx/cmx_pccard.c
+++ b/sys/dev/cmx/cmx_pccard.c
@@ -72,7 +72,7 @@ cmx_pccard_probe(device_t dev)
}
/*
- * Attach to the pccard, and call bus independant attach and
+ * Attach to the pccard, and call bus independent attach and
* resource allocation routines.
*/
static int
diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c
index f1a120f..426a5ee 100644
--- a/sys/dev/cp/if_cp.c
+++ b/sys/dev/cp/if_cp.c
@@ -2171,7 +2171,7 @@ static int ng_cp_rmnode (node_p node)
NG_NODE_SET_PRIVATE (node, NULL);
NG_NODE_UNREF (node);
}
- NG_NODE_REVIVE(node); /* Persistant node */
+ NG_NODE_REVIVE(node); /* Persistent node */
#endif
return 0;
}
diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c
index af8a93e..3c52d89 100644
--- a/sys/dev/cs/if_cs.c
+++ b/sys/dev/cs/if_cs.c
@@ -180,7 +180,7 @@ wait_eeprom_ready(struct cs_softc *sc)
*
* Before we issue the command, we should be !busy, so that will
* be fast. The datasheet suggests that clock out from the part
- * per word will be on the order of 25us, which is consistant with
+ * per word will be on the order of 25us, which is consistent with
* the 1MHz serial clock and 16bits... We should never hit 100,
* let alone 15,000 here. The original code did an unconditional
* 30ms DELAY here. Bad Kharma. cs_readreg takes ~2us.
diff --git a/sys/dev/cx/csigma.c b/sys/dev/cx/csigma.c
index 7be2239..b0e56e1 100644
--- a/sys/dev/cx/csigma.c
+++ b/sys/dev/cx/csigma.c
@@ -100,7 +100,7 @@ static int cx_reset (port_t port)
cx_cmd (port, CCR_RSTALL);
- /* Firmware revision code should clear imediately. */
+ /* Firmware revision code should clear immediately. */
/* Wait up to 10 msec for revision code to appear again. */
for (count=0; count<20000; ++count)
if (inb(GFRCR(port)) != 0)
diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c
index d513161..654e913 100644
--- a/sys/dev/cx/if_cx.c
+++ b/sys/dev/cx/if_cx.c
@@ -2453,7 +2453,7 @@ static int ng_cx_rmnode (node_p node)
NG_NODE_SET_PRIVATE (node, NULL);
NG_NODE_UNREF (node);
}
- NG_NODE_REVIVE(node); /* Persistant node */
+ NG_NODE_REVIVE(node); /* Persistent node */
#endif
return 0;
}
diff --git a/sys/dev/cxgb/common/cxgb_t3_hw.c b/sys/dev/cxgb/common/cxgb_t3_hw.c
index 942571a..33e308e 100644
--- a/sys/dev/cxgb/common/cxgb_t3_hw.c
+++ b/sys/dev/cxgb/common/cxgb_t3_hw.c
@@ -651,7 +651,7 @@ struct t3_vpd {
*
* Read a 32-bit word from a location in VPD EEPROM using the card's PCI
* VPD ROM capability. A zero is written to the flag bit when the
- * addres is written to the control register. The hardware device will
+ * address is written to the control register. The hardware device will
* set the flag to 1 when 4 bytes have been read into the data register.
*/
int t3_seeprom_read(adapter_t *adapter, u32 addr, u32 *data)
@@ -1031,7 +1031,7 @@ static int flash_wait_op(adapter_t *adapter, int attempts, int delay)
* Read the specified number of 32-bit words from the serial flash.
* If @byte_oriented is set the read data is stored as a byte array
* (i.e., big-endian), otherwise as 32-bit words in the platform's
- * natural endianess.
+ * natural endianness.
*/
int t3_read_flash(adapter_t *adapter, unsigned int addr, unsigned int nwords,
u32 *data, int byte_oriented)
@@ -1068,7 +1068,7 @@ int t3_read_flash(adapter_t *adapter, unsigned int addr, unsigned int nwords,
* Writes up to a page of data (256 bytes) to the serial flash starting
* at the given address.
* If @byte_oriented is set the write data is stored as a 32-bit
- * big-endian array, otherwise in the processor's native endianess.
+ * big-endian array, otherwise in the processor's native endianness.
*
*/
static int t3_write_flash(adapter_t *adapter, unsigned int addr,
@@ -1738,7 +1738,7 @@ struct intr_info {
*
* A table driven interrupt handler that applies a set of masks to an
* interrupt status word and performs the corresponding actions if the
- * interrupts described by the mask have occured. The actions include
+ * interrupts described by the mask have occurred. The actions include
* optionally printing a warning or alert message, and optionally
* incrementing a stat counter. The table is terminated by an entry
* specifying mask 0. Returns the number of fatal interrupt conditions.
@@ -3338,7 +3338,7 @@ static void __devinit init_mtus(unsigned short mtus[])
{
/*
* See draft-mathis-plpmtud-00.txt for the values. The min is 88 so
- * it can accomodate max size TCP/IP headers when SACK and timestamps
+ * it can accommodate max size TCP/IP headers when SACK and timestamps
* are enabled and still have at least 8 bytes of payload.
*/
mtus[0] = 88;
diff --git a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c
index 2427263..4267e25 100644
--- a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c
+++ b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_hal.c
@@ -633,7 +633,7 @@ cxio_hal_ctrl_qp_write_mem(struct cxio_rdev *rdev_p, u32 addr,
{
u32 i, nr_wqe, copy_len;
u8 *copy_data;
- u8 wr_len, utx_len; /* lenght in 8 byte flit */
+ u8 wr_len, utx_len; /* length in 8 byte flit */
enum t3_wr_flags flag;
__be64 *wqe;
u64 utx_cmd;
diff --git a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h
index 8718aa0..57690a2 100644
--- a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h
+++ b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_wr.h
@@ -633,7 +633,7 @@ struct t3_swrq {
* A T3 WQ implements both the SQ and RQ.
*/
struct t3_wq {
- union t3_wr *queue; /* DMA accessable memory */
+ union t3_wr *queue; /* DMA accessible memory */
bus_addr_t dma_addr; /* DMA address for HW */
u32 error; /* 1 once we go to ERROR */
u32 qpid;
diff --git a/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c b/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
index 6343d4d..804c9e1 100644
--- a/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
+++ b/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
@@ -861,7 +861,7 @@ calc_opt0l(struct socket *so, int rcv_bufsize)
KASSERT(rcv_bufsize <= M_RCV_BUFSIZ,
("%s: rcv_bufsize (%d) is too high", __func__, rcv_bufsize));
- if (so != NULL) /* optional because noone cares about IP TOS */
+ if (so != NULL) /* optional because no one cares about IP TOS */
opt0l |= V_TOS(INP_TOS(sotoinpcb(so)));
return (htobe32(opt0l));
diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h
index 2193142..5800faa 100644
--- a/sys/dev/cxgbe/adapter.h
+++ b/sys/dev/cxgbe/adapter.h
@@ -621,7 +621,7 @@ struct sge_wrq {
/*
* Scratch space for work requests that wrap around after reaching the
- * status page, and some infomation about the last WR that used it.
+ * status page, and some information about the last WR that used it.
*/
uint16_t ss_pidx;
uint16_t ss_len;
diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c
index 03312b1..7ecdb81 100644
--- a/sys/dev/cxgbe/common/t4_hw.c
+++ b/sys/dev/cxgbe/common/t4_hw.c
@@ -2706,7 +2706,7 @@ int t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data)
}
/*
- * Grab the returned data, swizzle it into our endianess and
+ * Grab the returned data, swizzle it into our endianness and
* return success.
*/
t4_os_pci_read_cfg4(adapter, base + PCI_VPD_DATA, data);
@@ -7739,7 +7739,7 @@ static void read_filter_mode_and_ingress_config(struct adapter *adap)
/*
* If TP_INGRESS_CONFIG.VNID == 0, then TP_VLAN_PRI_MAP.VNIC_ID
- * represents the presense of an Outer VLAN instead of a VNIC ID.
+ * represents the presence of an Outer VLAN instead of a VNIC ID.
*/
if ((tpp->ingress_config & F_VNIC) == 0)
tpp->vnic_shift = -1;
@@ -9121,7 +9121,7 @@ int t4_config_watchdog(struct adapter *adapter, unsigned int mbox,
/*
* The watchdog command expects a timeout in units of 10ms so we need
* to convert it here (via rounding) and force a minimum of one 10ms
- * "tick" if the timeout is non-zero but the convertion results in 0
+ * "tick" if the timeout is non-zero but the conversion results in 0
* ticks.
*/
ticks = (timeout + 5)/10;
diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c
index 66ceb89..775e3a2 100644
--- a/sys/dev/cxgbe/cxgbei/cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/cxgbei.c
@@ -214,7 +214,7 @@ t4_ddp_set_map(struct cxgbei_data *ci, void *iccp,
/*
* on T4, if we use a mix of IMMD and DSGL with ULP_MEM_WRITE,
- * the order would not be garanteed, so we will stick with IMMD
+ * the order would not be guaranteed, so we will stick with IMMD
*/
gl->tid = toep->tid;
gl->port_id = toep->vi->pi->port_id;
diff --git a/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt b/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt
index cc8ad8b..43dc76e 100644
--- a/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt
+++ b/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt
@@ -17,7 +17,7 @@
# finite. This requires balancing the configuration/operation needs of
# device drivers across OSes and a large number of customer application.
#
-# Some of the more important resources to allocate and their constaints are:
+# Some of the more important resources to allocate and their constraints are:
# 1. Virtual Interfaces: 128.
# 2. Ingress Queues with Free Lists: 1024. PCI-E SR-IOV Virtual Functions
# must use a power of 2 Ingress Queues.
@@ -275,7 +275,7 @@
# to directly select the type of Physical Function to which they wish to be
# attached.
#
-# Note that the actual values used for the PCI-E Intelectual Property will be
+# Note that the actual values used for the PCI-E Intellectual Property will be
# 1 less than those below since that's the way it "counts" things. For
# readability, we use the number we actually mean ...
#
diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h
index f4d7825..ccb3612 100644
--- a/sys/dev/cxgbe/firmware/t4fw_interface.h
+++ b/sys/dev/cxgbe/firmware/t4fw_interface.h
@@ -35,7 +35,7 @@
********************************/
enum fw_retval {
- FW_SUCCESS = 0, /* completed sucessfully */
+ FW_SUCCESS = 0, /* completed successfully */
FW_EPERM = 1, /* operation not permitted */
FW_ENOENT = 2, /* no such file or directory */
FW_EIO = 5, /* input/output error; hw bad */
@@ -8635,7 +8635,7 @@ enum pcie_fw_eval {
**********************************************/
/*
- * this register is available as 32-bit of persistent storage (accross
+ * this register is available as 32-bit of persistent storage (across
* PL_RST based chip-reset) for boot drivers (i.e. firmware and driver
* will not write it)
*/
diff --git a/sys/dev/cxgbe/firmware/t5fw_cfg_fpga.txt b/sys/dev/cxgbe/firmware/t5fw_cfg_fpga.txt
index e1c8b00..4c74fa1 100644
--- a/sys/dev/cxgbe/firmware/t5fw_cfg_fpga.txt
+++ b/sys/dev/cxgbe/firmware/t5fw_cfg_fpga.txt
@@ -17,7 +17,7 @@
# finite. This requires balancing the configuration/operation needs of
# device drivers across OSes and a large number of customer application.
#
-# Some of the more important resources to allocate and their constaints are:
+# Some of the more important resources to allocate and their constraints are:
# 1. Virtual Interfaces: 128.
# 2. Ingress Queues with Free Lists: 1024. PCI-E SR-IOV Virtual Functions
# must use a power of 2 Ingress Queues.
@@ -292,7 +292,7 @@
# to directly select the type of Physical Function to which they wish to be
# attached.
#
-# Note that the actual values used for the PCI-E Intelectual Property will be
+# Note that the actual values used for the PCI-E Intellectual Property will be
# 1 less than those below since that's the way it "counts" things. For
# readability, we use the number we actually mean ...
#
diff --git a/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt b/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt
index 6fcc934..d6caf2c 100644
--- a/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt
+++ b/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt
@@ -18,7 +18,7 @@
# are finite. This requires balancing the configuration/operation needs of
# device drivers across OSes and a large number of customer application.
#
-# Some of the more important resources to allocate and their constaints are:
+# Some of the more important resources to allocate and their constraints are:
# 1. Virtual Interfaces: 256.
# 2. Ingress Queues with Free Lists: 1024.
# 3. Egress Queues: 128K.
@@ -309,7 +309,7 @@
# to directly select the type of Physical Function to which they wish to be
# attached.
#
-# Note that the actual values used for the PCI-E Intelectual Property will be
+# Note that the actual values used for the PCI-E Intellectual Property will be
# 1 less than those below since that's the way it "counts" things. For
# readability, we use the number we actually mean ...
#
diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h
index 992b4cd..d1363c4 100644
--- a/sys/dev/cxgbe/offload.h
+++ b/sys/dev/cxgbe/offload.h
@@ -87,7 +87,7 @@ struct tid_info {
u_int nstids;
u_int stid_base;
u_int stids_in_use;
- u_int nstids_free_head; /* # of available stids at the begining */
+ u_int nstids_free_head; /* # of available stids at the beginning */
struct stid_head stids;
struct mtx atid_lock __aligned(CACHE_LINE_SIZE);
diff --git a/sys/dev/cxgbe/t4_ioctl.h b/sys/dev/cxgbe/t4_ioctl.h
index 473cf89..fdc5e98 100644
--- a/sys/dev/cxgbe/t4_ioctl.h
+++ b/sys/dev/cxgbe/t4_ioctl.h
@@ -156,7 +156,7 @@ struct t4_filter_tuple {
uint16_t dport; /* destination port */
/*
- * A combination of these (upto 36 bits) is available. TP_VLAN_PRI_MAP
+ * A combination of these (up to 36 bits) is available. TP_VLAN_PRI_MAP
* is used to select the global mode and all filters are limited to the
* set of fields allowed by the global mode.
*/
diff --git a/sys/dev/cxgbe/t4_l2t.c b/sys/dev/cxgbe/t4_l2t.c
index cca1bf3..cab5cc2 100644
--- a/sys/dev/cxgbe/t4_l2t.c
+++ b/sys/dev/cxgbe/t4_l2t.c
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
* can change state or increment its ref count during allocation as both of
* these perform lookups.
*
- * Note: We do not take refereces to ifnets in this module because both
+ * Note: We do not take references to ifnets in this module because both
* the TOE and the sockets already hold references to the interfaces and the
* lifetime of an L2T entry is fully contained in the lifetime of the TOE.
*/
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index e3b64b0..1e86aa9 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -4146,7 +4146,7 @@ vi_full_init(struct vi_info *vi)
if (extra) {
if_printf(ifp,
- "global RSS config (0x%x) cannot be accomodated.\n",
+ "global RSS config (0x%x) cannot be accommodated.\n",
hashconfig);
}
if (extra & RSS_HASHTYPE_RSS_IPV4)
@@ -5207,7 +5207,7 @@ cxgbe_sysctls(struct port_info *pi)
SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, #name, CTLFLAG_RD, \
&pi->stats.name, desc)
- /* We get these from port_stats and they may be stale by upto 1s */
+ /* We get these from port_stats and they may be stale by up to 1s */
SYSCTL_ADD_T4_PORTSTAT(rx_ovflow0,
"# drops due to buffer-group 0 overflows");
SYSCTL_ADD_T4_PORTSTAT(rx_ovflow1,
diff --git a/sys/dev/cxgbe/t4_mp_ring.c b/sys/dev/cxgbe/t4_mp_ring.c
index 045a24b..32ee41f 100644
--- a/sys/dev/cxgbe/t4_mp_ring.c
+++ b/sys/dev/cxgbe/t4_mp_ring.c
@@ -282,7 +282,7 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n, int budget)
/*
* Wait for other producers who got in ahead of us to enqueue their
* items, one producer at a time. It is our turn when the ring's
- * pidx_tail reaches the begining of our reservation (pidx_start).
+ * pidx_tail reaches the beginning of our reservation (pidx_start).
*/
while (ns.pidx_tail != pidx_start) {
cpu_spinwait();
diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c
index 6f6df10..ba968d6 100644
--- a/sys/dev/cxgbe/t4_netmap.c
+++ b/sys/dev/cxgbe/t4_netmap.c
@@ -1119,7 +1119,7 @@ ncxgbe_attach(device_t dev)
* freelist, and not the number of entries in the iq. (These two are
* not exactly the same due to the space taken up by the status page).
*/
- na.num_rx_desc = (vi->qsize_rxq / 8) * 8;
+ na.num_rx_desc = rounddown(vi->qsize_rxq, 8);
na.nm_txsync = cxgbe_netmap_txsync;
na.nm_rxsync = cxgbe_netmap_rxsync;
na.nm_register = cxgbe_netmap_reg;
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index fd4f291..ad1da55 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -3547,7 +3547,7 @@ ring_fl_db(struct adapter *sc, struct sge_fl *fl)
}
/*
- * Fills up the freelist by allocating upto 'n' buffers. Buffers that are
+ * Fills up the freelist by allocating up to 'n' buffers. Buffers that are
* recycled do not count towards this allocation budget.
*
* Returns non-zero to indicate that this freelist should be added to the list
@@ -3569,7 +3569,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n)
FL_LOCK_ASSERT_OWNED(fl);
/*
- * We always stop at the begining of the hardware descriptor that's just
+ * We always stop at the beginning of the hardware descriptor that's just
* before the one with the hw cidx. This is to avoid hw pidx = hw cidx,
* which would mean an empty freelist to the chip.
*/
diff --git a/sys/dev/de/dc21040reg.h b/sys/dev/de/dc21040reg.h
index c0ff191..d94eca6 100644
--- a/sys/dev/de/dc21040reg.h
+++ b/sys/dev/de/dc21040reg.h
@@ -175,7 +175,7 @@ typedef struct {
#define TULIP_CMD_SCRAMBLER 0x01000000L /* (RW) Scrambler Mode (21140) */
#define TULIP_CMD_PCSFUNCTION 0x00800000L /* (RW) PCS Function (21140) */
#define TULIP_CMD_TXTHRSHLDCTL 0x00400000L /* (RW) Transmit Threshold Mode (21140) */
-#define TULIP_CMD_STOREFWD 0x00200000L /* (RW) Store and Foward (21140) */
+#define TULIP_CMD_STOREFWD 0x00200000L /* (RW) Store and Forward (21140) */
#define TULIP_CMD_NOHEARTBEAT 0x00080000L /* (RW) No Heartbeat (21140) */
#define TULIP_CMD_PORTSELECT 0x00040000L /* (RW) Post Select (100Mb) (21140) */
#define TULIP_CMD_ENHCAPTEFFCT 0x00040000L /* (RW) Enhanced Capture Effecty (21041) */
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c
index 0e6b27c..a6253f5 100644
--- a/sys/dev/de/if_de.c
+++ b/sys/dev/de/if_de.c
@@ -419,7 +419,7 @@ tulip_linkup(tulip_softc_t * const sc, tulip_media_t media)
* We could set probe_timeout to 0 but setting to 3000 puts this
* in one central place and the only matters is tulip_link is
* followed by a tulip_timeout. Therefore setting it should not
- * result in aberrant behavour.
+ * result in aberrant behaviour.
*/
sc->tulip_probe_timeout = 3000;
sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
diff --git a/sys/dev/de/if_devar.h b/sys/dev/de/if_devar.h
index 8776be0..e3e364d 100644
--- a/sys/dev/de/if_devar.h
+++ b/sys/dev/de/if_devar.h
@@ -842,7 +842,7 @@ static const struct {
/*
* This driver supports a maximum of 32 tulip boards.
- * This should be enough for the forseeable future.
+ * This should be enough for the foreseeable future.
*/
#define TULIP_MAX_DEVICES 32
diff --git a/sys/dev/dpt/dpt.h b/sys/dev/dpt/dpt.h
index a715e588..6c0e341 100644
--- a/sys/dev/dpt/dpt.h
+++ b/sys/dev/dpt/dpt.h
@@ -1083,7 +1083,7 @@ typedef struct dpt_softc {
/*
* Every object on a unit can have a receiver, if it treats
- * us as a target. We do that so that separate and independant
+ * us as a target. We do that so that separate and independent
* clients can consume received buffers.
*/
@@ -1245,7 +1245,7 @@ dpt_softc_t *dpt_minor2softc(int minor_no);
#endif /* _KERNEL */
/*
- * This function substracts one timval structure from another,
+ * This function subtracts one timval structure from another,
* Returning the result in usec.
* It assumes that less than 4 billion usecs passed form start to end.
* If times are sensless, ~0 is returned.
diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c
index e6bbf1f..26c0f2a0 100644
--- a/sys/dev/dpt/dpt_scsi.c
+++ b/sys/dev/dpt/dpt_scsi.c
@@ -31,7 +31,7 @@
__FBSDID("$FreeBSD$");
/*
- * dpt_scsi.c: SCSI dependant code for the DPT driver
+ * dpt_scsi.c: SCSI dependent code for the DPT driver
*
* credits: Assisted by Mike Neuffer in the early low level DPT code
* Thanx to Mark Salyzyn of DPT for his assistance.
@@ -95,7 +95,7 @@ devclass_t dpt_devclass;
/*
* These will have to be setup by parameters passed at boot/load time. For
- * perfromance reasons, we make them constants for the time being.
+ * performance reasons, we make them constants for the time being.
*/
#define dpt_min_segs DPT_MAX_SEGS
#define dpt_max_segs DPT_MAX_SEGS
@@ -598,7 +598,7 @@ dpt_detect_cache(dpt_softc_t *dpt, dpt_ccb_t *dccb, u_int32_t dccb_busaddr,
mtx_assert(&dpt->lock, MA_OWNED);
/*
- * Default setting, for best perfromance..
+ * Default setting, for best performance..
* This is what virtually all cards default to..
*/
dpt->cache_type = DPT_CACHE_WRITEBACK;
@@ -1878,7 +1878,7 @@ dpt_reset_hba(dpt_softc_t *dpt)
ccb->cp_msg[0] = HA_IDENTIFY_MSG | HA_DISCO_RECO;
ccb->cp_scsi_cmd = 0; /* Should be ignored */
- /* Lock up the submitted queue. We are very persistant here */
+ /* Lock up the submitted queue. We are very persistent here */
while (dpt->queue_status & DPT_SUBMITTED_QUEUE_ACTIVE) {
DELAY(100);
}
diff --git a/sys/dev/drm/drm.h b/sys/dev/drm/drm.h
index e579a16..a261204 100644
--- a/sys/dev/drm/drm.h
+++ b/sys/dev/drm/drm.h
@@ -812,7 +812,7 @@ struct drm_fence_arg {
*/
#define DRM_BO_HINT_WAIT_LAZY 0x00000008
/*
- * The client has compute relocations refering to this buffer using the
+ * The client has compute relocations referring to this buffer using the
* offset in the presumed_offset field. If that offset ends up matching
* where this buffer lands, the kernel is free to skip executing those
* relocations
diff --git a/sys/dev/drm/drm_bufs.c b/sys/dev/drm/drm_bufs.c
index b685a59..1ee0ffa 100644
--- a/sys/dev/drm/drm_bufs.c
+++ b/sys/dev/drm/drm_bufs.c
@@ -668,7 +668,7 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
dma->buflist[i + dma->buf_count] = &entry->buflist[i];
}
- /* No allocations failed, so now we can replace the orginal pagelist
+ /* No allocations failed, so now we can replace the original pagelist
* with the new one.
*/
free(dma->pagelist, DRM_MEM_PAGES);
diff --git a/sys/dev/drm/drm_vm.c b/sys/dev/drm/drm_vm.c
index 7986856..4810343 100644
--- a/sys/dev/drm/drm_vm.c
+++ b/sys/dev/drm/drm_vm.c
@@ -43,7 +43,7 @@ int drm_mmap(struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr,
/* d_mmap gets called twice, we can only reference file_priv during
* the first call. We need to assume that if error is EBADF the
- * call was succesful and the client is authenticated.
+ * call was successful and the client is authenticated.
*/
error = devfs_get_cdevpriv((void **)&file_priv);
if (error == ENOENT) {
diff --git a/sys/dev/drm/i915_drv.h b/sys/dev/drm/i915_drv.h
index 3896732..07af147 100644
--- a/sys/dev/drm/i915_drv.h
+++ b/sys/dev/drm/i915_drv.h
@@ -307,7 +307,7 @@ typedef struct drm_i915_private {
* Flag if the hardware appears to be wedged.
*
* This is set when attempts to idle the device timeout.
- * It prevents command submission from occuring and makes
+ * It prevents command submission from occurring and makes
* every pending request fail
*/
int wedged;
diff --git a/sys/dev/drm/mach64_state.c b/sys/dev/drm/mach64_state.c
index 16848c2..a72244f 100644
--- a/sys/dev/drm/mach64_state.c
+++ b/sys/dev/drm/mach64_state.c
@@ -709,10 +709,10 @@ static int mach64_dma_dispatch_blit(struct drm_device * dev,
* XXX: This is overkill. The most efficient solution would be having
* two sets of buffers (one set private for vertex data, the other set
* client-writable for blits). However that would bring more complexity
- * and would break backward compatability. The solution currently
+ * and would break backward compatibility. The solution currently
* implemented is keeping all buffers private, allowing to secure the
* driver, without increasing complexity at the expense of some speed
- * transfering data.
+ * transferring data.
*/
verify_ret = copy_from_user_blit(GETBUFPTR(copy_buf), blit->buf, used);
diff --git a/sys/dev/drm/mga_dma.c b/sys/dev/drm/mga_dma.c
index 71775b6..b3a7a98 100644
--- a/sys/dev/drm/mga_dma.c
+++ b/sys/dev/drm/mga_dma.c
@@ -433,7 +433,7 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags)
* Bootstrap the driver for AGP DMA.
*
* \todo
- * Investigate whether there is any benifit to storing the WARP microcode in
+ * Investigate whether there is any benefit to storing the WARP microcode in
* AGP memory. If not, the microcode may as well always be put in PCI
* memory.
*
diff --git a/sys/dev/drm/mga_drm.h b/sys/dev/drm/mga_drm.h
index 16e8990..2754c93 100644
--- a/sys/dev/drm/mga_drm.h
+++ b/sys/dev/drm/mga_drm.h
@@ -108,7 +108,7 @@ __FBSDID("$FreeBSD$");
*/
#define MGA_NR_SAREA_CLIPRECTS 8
-/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
+/* 2 heaps (1 for card, 1 for agp), each divided into up to 128
* regions, subject to a minimum region size of (1<<16) == 64k.
*
* Clients may subdivide regions internally, but when sharing between
diff --git a/sys/dev/drm/radeon_cp.c b/sys/dev/drm/radeon_cp.c
index 5d2f4c7..be83936 100644
--- a/sys/dev/drm/radeon_cp.c
+++ b/sys/dev/drm/radeon_cp.c
@@ -231,7 +231,7 @@ void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base)
u32 agp_base_lo = agp_base & 0xffffffff;
u32 r6xx_agp_base = (agp_base >> 22) & 0x3ffff;
- /* R6xx/R7xx must be aligned to a 4MB boundry */
+ /* R6xx/R7xx must be aligned to a 4MB boundary */
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770)
RADEON_WRITE(R700_MC_VM_AGP_BASE, r6xx_agp_base);
else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
diff --git a/sys/dev/drm/radeon_drm.h b/sys/dev/drm/radeon_drm.h
index 11f2fcb..2287ef5 100644
--- a/sys/dev/drm/radeon_drm.h
+++ b/sys/dev/drm/radeon_drm.h
@@ -618,7 +618,7 @@ typedef struct drm_radeon_vertex2 {
} drm_radeon_vertex2_t;
/* v1.3 - obsoletes drm_radeon_vertex2
- * - allows arbitarily large cliprect list
+ * - allows arbitrarily large cliprect list
* - allows updating of tcl packet, vector and scalar state
* - allows memory-efficient description of state updates
* - allows state to be emitted without a primitive
diff --git a/sys/dev/drm/radeon_drv.h b/sys/dev/drm/radeon_drv.h
index e830a83..b4785e0 100644
--- a/sys/dev/drm/radeon_drv.h
+++ b/sys/dev/drm/radeon_drv.h
@@ -365,7 +365,7 @@ typedef struct drm_radeon_private {
u32 scratch_ages[5];
- /* starting from here on, data is preserved accross an open */
+ /* starting from here on, data is preserved across an open */
uint32_t flags; /* see radeon_chip_flags */
unsigned long fb_aper_offset;
diff --git a/sys/dev/drm/radeon_state.c b/sys/dev/drm/radeon_state.c
index b334a88..718c7e1 100644
--- a/sys/dev/drm/radeon_state.c
+++ b/sys/dev/drm/radeon_state.c
@@ -950,7 +950,7 @@ static void radeon_cp_dispatch_clear(struct drm_device * dev,
}
/* hyper z clear */
- /* no docs available, based on reverse engeneering by Stephane Marchesin */
+ /* no docs available, based on reverse engineering by Stephane Marchesin */
if ((flags & (RADEON_DEPTH | RADEON_STENCIL))
&& (flags & RADEON_CLEAR_FASTZ)) {
@@ -1064,7 +1064,7 @@ static void radeon_cp_dispatch_clear(struct drm_device * dev,
/* judging by the first tile offset needed, could possibly
directly address/clear 4x4 tiles instead of 8x2 * 4x4
macro tiles, though would still need clear mask for
- right/bottom if truely 4x4 granularity is desired ? */
+ right/bottom if truly 4x4 granularity is desired ? */
OUT_RING(tileoffset * 16);
/* the number of tiles to clear */
OUT_RING(nrtilesx + 1);
diff --git a/sys/dev/drm/savage_bci.c b/sys/dev/drm/savage_bci.c
index 0f8d66e..173993e 100644
--- a/sys/dev/drm/savage_bci.c
+++ b/sys/dev/drm/savage_bci.c
@@ -555,7 +555,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)
}
/*
- * Initalize mappings. On Savage4 and SavageIX the alignment
+ * Initialize mappings. On Savage4 and SavageIX the alignment
* and size of the aperture is not suitable for automatic MTRR setup
* in drm_addmap. Therefore we add them manually before the maps are
* initialized, and tear them down on last close.
diff --git a/sys/dev/drm/savage_drm.h b/sys/dev/drm/savage_drm.h
index c54d2d4..3655b5e 100644
--- a/sys/dev/drm/savage_drm.h
+++ b/sys/dev/drm/savage_drm.h
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
#ifndef __SAVAGE_SAREA_DEFINES__
#define __SAVAGE_SAREA_DEFINES__
-/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
+/* 2 heaps (1 for card, 1 for agp), each divided into up to 128
* regions, subject to a minimum region size of (1<<16) == 64k.
*
* Clients may subdivide regions internally, but when sharing between
diff --git a/sys/dev/drm2/drm_vm.c b/sys/dev/drm2/drm_vm.c
index 3fa2aba..b7979d9 100644
--- a/sys/dev/drm2/drm_vm.c
+++ b/sys/dev/drm2/drm_vm.c
@@ -57,7 +57,7 @@ drm_mmap(struct cdev *kdev, vm_ooffset_t offset, vm_paddr_t *paddr,
/* d_mmap gets called twice, we can only reference file_priv during
* the first call. We need to assume that if error is EBADF the
- * call was succesful and the client is authenticated.
+ * call was successful and the client is authenticated.
*/
error = devfs_get_cdevpriv((void **)&file_priv);
if (error == ENOENT) {
diff --git a/sys/dev/drm2/i915/i915_drm.h b/sys/dev/drm2/i915/i915_drm.h
index c6f0be3..c9ccb35 100644
--- a/sys/dev/drm2/i915/i915_drm.h
+++ b/sys/dev/drm2/i915/i915_drm.h
@@ -735,7 +735,7 @@ struct drm_i915_gem_caching {
__u32 handle;
/**
- * Cacheing level to apply or return value
+ * Caching level to apply or return value
*
* bits0-15 are for generic caching control (i.e. the above defined
* values). bits16-31 are reserved for platform-specific variations
diff --git a/sys/dev/drm2/i915/i915_drv.h b/sys/dev/drm2/i915/i915_drv.h
index 2dff53c..3325aa1 100644
--- a/sys/dev/drm2/i915/i915_drv.h
+++ b/sys/dev/drm2/i915/i915_drv.h
@@ -1129,7 +1129,7 @@ struct drm_i915_gem_request {
/** GEM sequence number associated with this request. */
uint32_t seqno;
- /** Postion in the ringbuffer of the end of the request */
+ /** Position in the ringbuffer of the end of the request */
u32 tail;
/** Time at which this request was emitted, in jiffies. */
diff --git a/sys/dev/drm2/i915/i915_gem.c b/sys/dev/drm2/i915/i915_gem.c
index 41ce74c..2e75623 100644
--- a/sys/dev/drm2/i915/i915_gem.c
+++ b/sys/dev/drm2/i915/i915_gem.c
@@ -1600,7 +1600,7 @@ have_page:
}
DRM_UNLOCK(dev);
if (*mres != NULL) {
- KASSERT(*mres != page, ("loosing %p %p", *mres, page));
+ KASSERT(*mres != page, ("losing %p %p", *mres, page));
vm_page_lock(*mres);
vm_page_free(*mres);
vm_page_unlock(*mres);
@@ -3149,7 +3149,7 @@ static bool i915_gem_valid_gtt_space(struct drm_device *dev,
/* On non-LLC machines we have to be careful when putting differing
* types of snoopable memory together to avoid the prefetcher
- * crossing memory domains and dieing.
+ * crossing memory domains and dying.
*/
if (HAS_LLC(dev))
return true;
diff --git a/sys/dev/drm2/i915/i915_gem_gtt.c b/sys/dev/drm2/i915/i915_gem_gtt.c
index f0e7f7a..5cd50ad 100644
--- a/sys/dev/drm2/i915/i915_gem_gtt.c
+++ b/sys/dev/drm2/i915/i915_gem_gtt.c
@@ -550,7 +550,7 @@ void i915_gem_init_global_gtt(struct drm_device *dev,
{
drm_i915_private_t *dev_priv = dev->dev_private;
- /* Substract the guard page ... */
+ /* Subtract the guard page ... */
drm_mm_init(&dev_priv->mm.gtt_space, start, end - start - PAGE_SIZE);
if (!HAS_LLC(dev))
dev_priv->mm.gtt_space.color_adjust = i915_gtt_color_adjust;
diff --git a/sys/dev/drm2/i915/intel_display.c b/sys/dev/drm2/i915/intel_display.c
index 363cbf2..0a03f22 100644
--- a/sys/dev/drm2/i915/intel_display.c
+++ b/sys/dev/drm2/i915/intel_display.c
@@ -3403,7 +3403,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
* There seems to be a race in PCH platform hw (at least on some
* outputs) where an enabled pipe still completes any pageflip right
* away (as if the pipe is off) instead of waiting for vblank. As soon
- * as the first vblank happend, everything works as expected. Hence just
+ * as the first vblank happened, everything works as expected. Hence just
* wait for one vblank before returning to avoid strange things
* happening.
*/
@@ -3480,7 +3480,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
* There seems to be a race in PCH platform hw (at least on some
* outputs) where an enabled pipe still completes any pageflip right
* away (as if the pipe is off) instead of waiting for vblank. As soon
- * as the first vblank happend, everything works as expected. Hence just
+ * as the first vblank happened, everything works as expected. Hence just
* wait for one vblank before returning to avoid strange things
* happening.
*/
diff --git a/sys/dev/drm2/i915/intel_dp.c b/sys/dev/drm2/i915/intel_dp.c
index 8bff4610..67dd543 100644
--- a/sys/dev/drm2/i915/intel_dp.c
+++ b/sys/dev/drm2/i915/intel_dp.c
@@ -1959,7 +1959,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
}
if (channel_eq)
- DRM_DEBUG_KMS("Channel EQ done. DP Training successfull\n");
+ DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n");
intel_dp_set_link_train(intel_dp, DP, DP_TRAINING_PATTERN_DISABLE);
}
diff --git a/sys/dev/drm2/radeon/atombios.h b/sys/dev/drm2/radeon/atombios.h
index 8ef8196..16119f4 100644
--- a/sys/dev/drm2/radeon/atombios.h
+++ b/sys/dev/drm2/radeon/atombios.h
@@ -1797,7 +1797,7 @@ typedef struct _GET_ENGINE_CLOCK_PARAMETERS
// Following Structures and constant may be obsolete
/****************************************************************************/
//Maxium 8 bytes,the data read in will be placed in the parameter space.
-//Read operaion successeful when the paramter space is non-zero, otherwise read operation failed
+//Read operaion successeful when the parameter space is non-zero, otherwise read operation failed
typedef struct _READ_EDID_FROM_HW_I2C_DATA_PARAMETERS
{
USHORT usPrescale; //Ratio between Engine clock and I2C clock
@@ -4725,14 +4725,14 @@ ucUMAChannelNumber: System memory channel numbers.
ulCSR_M3_ARB_CNTL_DEFAULT[10]: Arrays with values for CSR M3 arbiter for default
ulCSR_M3_ARB_CNTL_UVD[10]: Arrays with values for CSR M3 arbiter for UVD playback.
ulCSR_M3_ARB_CNTL_FS3D[10]: Arrays with values for CSR M3 arbiter for Full Screen 3D applications.
-sAvail_SCLK[5]: Arrays to provide availabe list of SLCK and corresponding voltage, order from low to high
+sAvail_SCLK[5]: Arrays to provide available list of SLCK and corresponding voltage, order from low to high
ulGMCRestoreResetTime: GMC power restore and GMC reset time to calculate data reconnection latency. Unit in ns.
ulMinimumNClk: Minimum NCLK speed among all NB-Pstates to calcualte data reconnection latency. Unit in 10kHz.
ulIdleNClk: NCLK speed while memory runs in self-refresh state. Unit in 10kHz.
ulDDR_DLL_PowerUpTime: DDR PHY DLL power up time. Unit in ns.
ulDDR_PLL_PowerUpTime: DDR PHY PLL power up time. Unit in ns.
-usPCIEClkSSPercentage: PCIE Clock Spred Spectrum Percentage in unit 0.01%; 100 mean 1%.
-usPCIEClkSSType: PCIE Clock Spred Spectrum Type. 0 for Down spread(default); 1 for Center spread.
+usPCIEClkSSPercentage: PCIE Clock Spread Spectrum Percentage in unit 0.01%; 100 mean 1%.
+usPCIEClkSSType: PCIE Clock Spread Spectrum Type. 0 for Down spread(default); 1 for Center spread.
usLvdsSSPercentage: LVDS panel ( not include eDP ) Spread Spectrum Percentage in unit of 0.01%, =0, use VBIOS default setting.
usLvdsSSpreadRateIn10Hz: LVDS panel ( not include eDP ) Spread Spectrum frequency in unit of 10Hz, =0, use VBIOS default setting.
usHDMISSPercentage: HDMI Spread Spectrum Percentage in unit 0.01%; 100 mean 1%, =0, use VBIOS default setting.
@@ -4926,7 +4926,7 @@ ucUMAChannelNumber: System memory channel numbers.
ulCSR_M3_ARB_CNTL_DEFAULT[10]: Arrays with values for CSR M3 arbiter for default
ulCSR_M3_ARB_CNTL_UVD[10]: Arrays with values for CSR M3 arbiter for UVD playback.
ulCSR_M3_ARB_CNTL_FS3D[10]: Arrays with values for CSR M3 arbiter for Full Screen 3D applications.
-sAvail_SCLK[5]: Arrays to provide availabe list of SLCK and corresponding voltage, order from low to high
+sAvail_SCLK[5]: Arrays to provide available list of SLCK and corresponding voltage, order from low to high
ulGMCRestoreResetTime: GMC power restore and GMC reset time to calculate data reconnection latency. Unit in ns.
ulMinimumNClk: Minimum NCLK speed among all NB-Pstates to calcualte data reconnection latency. Unit in 10kHz.
ulIdleNClk: NCLK speed while memory runs in self-refresh state. Unit in 10kHz.
@@ -7600,7 +7600,7 @@ typedef struct _ATOM_PPLIB_SUMO_CLOCK_INFO{
UCHAR ucEngineClockHigh; //clockfrequency >> 16.
UCHAR vddcIndex; //2-bit vddc index;
USHORT tdpLimit;
- //please initalize to 0
+ //please initialize to 0
USHORT rsv1;
//please initialize to 0s
ULONG rsv2[2];
@@ -7979,8 +7979,8 @@ typedef struct {
typedef struct {
AMD_ACPI_DESCRIPTION_HEADER SHeader;
UCHAR TableUUID[16]; //0x24
- ULONG VBIOSImageOffset; //0x34. Offset to the first GOP_VBIOS_CONTENT block from the beginning of the stucture.
- ULONG Lib1ImageOffset; //0x38. Offset to the first GOP_LIB1_CONTENT block from the beginning of the stucture.
+ ULONG VBIOSImageOffset; //0x34. Offset to the first GOP_VBIOS_CONTENT block from the beginning of the structure.
+ ULONG Lib1ImageOffset; //0x38. Offset to the first GOP_LIB1_CONTENT block from the beginning of the structure.
ULONG Reserved[4]; //0x3C
}UEFI_ACPI_VFCT;
diff --git a/sys/dev/drm2/radeon/evergreen.c b/sys/dev/drm2/radeon/evergreen.c
index 4643d62..67e943f 100644
--- a/sys/dev/drm2/radeon/evergreen.c
+++ b/sys/dev/drm2/radeon/evergreen.c
@@ -105,7 +105,7 @@ void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev)
v = (ctl & PCIEM_CTL_MAX_READ_REQUEST) >> 12;
/* if bios or OS sets MAX_READ_REQUEST_SIZE to an invalid value, fix it
- * to avoid hangs or perfomance issues
+ * to avoid hangs or performance issues
*/
if ((v == 0) || (v == 6) || (v == 7)) {
ctl &= ~PCIEM_CTL_MAX_READ_REQUEST;
diff --git a/sys/dev/drm2/radeon/radeon_device.c b/sys/dev/drm2/radeon/radeon_device.c
index 73b2f4c..76b4cd7 100644
--- a/sys/dev/drm2/radeon/radeon_device.c
+++ b/sys/dev/drm2/radeon/radeon_device.c
@@ -541,7 +541,7 @@ bool radeon_boot_test_post_card(struct radeon_device *rdev)
* Allocate the dummy page used by the driver (all asics).
* This dummy page is used by the driver as a filler for gart entries
* when pages are taken out of the GART
- * Returns 0 on sucess, -ENOMEM on failure.
+ * Returns 0 on success, -ENOMEM on failure.
*/
int radeon_dummy_page_init(struct radeon_device *rdev)
{
@@ -724,7 +724,7 @@ static uint32_t cail_ioreg_read(struct card_info *info, uint32_t reg)
*
* Initializes the driver info and register access callbacks for the
* ATOM interpreter (r4xx+).
- * Returns 0 on sucess, -ENOMEM on failure.
+ * Returns 0 on success, -ENOMEM on failure.
* Called at driver startup.
*/
int radeon_atombios_init(struct radeon_device *rdev)
@@ -793,7 +793,7 @@ void radeon_atombios_fini(struct radeon_device *rdev)
* @rdev: radeon_device pointer
*
* Initializes the driver info for combios (r1xx-r3xx).
- * Returns 0 on sucess.
+ * Returns 0 on success.
* Called at driver startup.
*/
int radeon_combios_init(struct radeon_device *rdev)
diff --git a/sys/dev/drm2/radeon/radeon_fb.c b/sys/dev/drm2/radeon/radeon_fb.c
index 6ed52d9..1ad00a0 100644
--- a/sys/dev/drm2/radeon/radeon_fb.c
+++ b/sys/dev/drm2/radeon/radeon_fb.c
@@ -228,7 +228,7 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
if (ret) {
- DRM_ERROR("failed to initalise framebuffer %d\n", ret);
+ DRM_ERROR("failed to initialise framebuffer %d\n", ret);
goto out_unref;
}
diff --git a/sys/dev/drm2/radeon/radeon_fence.c b/sys/dev/drm2/radeon/radeon_fence.c
index 21c3541..6b1763b 100644
--- a/sys/dev/drm2/radeon/radeon_fence.c
+++ b/sys/dev/drm2/radeon/radeon_fence.c
@@ -613,7 +613,7 @@ int radeon_fence_wait_any(struct radeon_device *rdev,
}
if (fences[i]->seq == RADEON_FENCE_SIGNALED_SEQ) {
- /* something was allready signaled */
+ /* something was already signaled */
return 0;
}
@@ -644,7 +644,7 @@ int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)
seq = atomic64_read(&rdev->fence_drv[ring].last_seq) + 1ULL;
if (seq >= rdev->fence_drv[ring].sync_seq[ring]) {
/* nothing to wait for, last_seq is
- already the last emited fence */
+ already the last emitted fence */
return -ENOENT;
}
return radeon_fence_wait_seq(rdev, seq, ring, false, false);
diff --git a/sys/dev/drm2/radeon/radeon_gart.c b/sys/dev/drm2/radeon/radeon_gart.c
index 3dae6ae..cf5609a 100644
--- a/sys/dev/drm2/radeon/radeon_gart.c
+++ b/sys/dev/drm2/radeon/radeon_gart.c
@@ -698,7 +698,7 @@ struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev,
if (vm->fence && vm->fence == rdev->vm_manager.active[vm->id])
return NULL;
- /* we definately need to flush */
+ /* we definitely need to flush */
radeon_fence_unref(&vm->last_flush);
/* skip over VMID 0, since it is the system VM */
diff --git a/sys/dev/drm2/radeon/radeon_gem.c b/sys/dev/drm2/radeon/radeon_gem.c
index 2a55101..a96ab47 100644
--- a/sys/dev/drm2/radeon/radeon_gem.c
+++ b/sys/dev/drm2/radeon/radeon_gem.c
@@ -462,7 +462,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
/* !! DONT REMOVE !!
* We don't support vm_id yet, to be sure we don't have have broken
* userspace, reject anyone trying to use non 0 value thus moving
- * forward we can use those fields without breaking existant userspace
+ * forward we can use those fields without breaking existent userspace
*/
if (args->vm_id) {
args->operation = RADEON_VA_RESULT_ERROR;
diff --git a/sys/dev/drm2/radeon/radeon_kms.c b/sys/dev/drm2/radeon/radeon_kms.c
index 29e19df..b86e545 100644
--- a/sys/dev/drm2/radeon/radeon_kms.c
+++ b/sys/dev/drm2/radeon/radeon_kms.c
@@ -611,7 +611,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
*
* Gets the timestamp on the requested crtc based on the
* scanout position. (all asics).
- * Returns postive status flags on success, negative error on failure.
+ * Returns positive status flags on success, negative error on failure.
*/
int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,
int *max_error,
diff --git a/sys/dev/drm2/radeon/radeon_legacy_crtc.c b/sys/dev/drm2/radeon/radeon_legacy_crtc.c
index 282f200..9d6bb57 100644
--- a/sys/dev/drm2/radeon/radeon_legacy_crtc.c
+++ b/sys/dev/drm2/radeon/radeon_legacy_crtc.c
@@ -76,7 +76,7 @@ static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc,
if ((rdev->family == CHIP_RS100) ||
(rdev->family == CHIP_RS200)) {
/* This is to workaround the asic bug for RMX, some versions
- of BIOS dosen't have this register initialized correctly. */
+ of BIOS doesn't have this register initialized correctly. */
crtc_more_cntl |= RADEON_CRTC_H_CUTOFF_ACTIVE_EN;
}
diff --git a/sys/dev/drm2/ttm/ttm_bo_vm.c b/sys/dev/drm2/ttm/ttm_bo_vm.c
index 96ebeca..438077b 100644
--- a/sys/dev/drm2/ttm/ttm_bo_vm.c
+++ b/sys/dev/drm2/ttm/ttm_bo_vm.c
@@ -260,7 +260,7 @@ reserve:
m->valid = VM_PAGE_BITS_ALL;
vm_page_xbusy(m);
if (*mres != NULL) {
- KASSERT(*mres != m, ("loosing %p %p", *mres, m));
+ KASSERT(*mres != m, ("losing %p %p", *mres, m));
vm_page_lock(*mres);
vm_page_free(*mres);
vm_page_unlock(*mres);
@@ -296,7 +296,7 @@ ttm_bo_vm_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot,
* acquired either in ttm_bo_mmap() or ttm_bo_vm_open(). It's
* then released in ttm_bo_vm_close().
*
- * Here, this function is called during mmap() intialization.
+ * Here, this function is called during mmap() initialization.
* Thus, the reference acquired in ttm_bo_mmap_single() is
* sufficient.
*/
diff --git a/sys/dev/drm2/ttm/ttm_page_alloc_dma.c b/sys/dev/drm2/ttm/ttm_page_alloc_dma.c
index a5c6fed..21dc287 100644
--- a/sys/dev/drm2/ttm/ttm_page_alloc_dma.c
+++ b/sys/dev/drm2/ttm/ttm_page_alloc_dma.c
@@ -82,7 +82,7 @@ enum pool_type {
* - dma32 (up to 2^32 - so up 4GB):
* - write combined, uncached, cached.
* for each 'struct device'. The 'cached' is for pages that are actively used.
- * The other ones can be shrunk by the shrinker API if neccessary.
+ * The other ones can be shrunk by the shrinker API if necessary.
* @pools: The 'struct device->dma_pools' link.
* @type: Type of the pool
* @lock: Protects the inuse_list and free_list from concurrnet access. Must be
@@ -801,7 +801,7 @@ static int ttm_dma_page_pool_fill_locked(struct dma_pool *pool,
spin_unlock_irqrestore(&pool->lock, *irq_flags);
- /* Returns how many more are neccessary to fulfill the
+ /* Returns how many more are necessary to fulfill the
* request. */
r = ttm_dma_pool_alloc_new_pages(pool, &d_pages, count);
diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h
index 3dd6a8d..d9198bd 100644
--- a/sys/dev/dwc/if_dwcvar.h
+++ b/sys/dev/dwc/if_dwcvar.h
@@ -90,7 +90,7 @@ struct dwc_softc {
struct dwc_hwdesc *txdesc_ring;
bus_addr_t txdesc_ring_paddr;
bus_dma_tag_t txbuf_tag;
- struct dwc_bufmap txbuf_map[RX_DESC_COUNT];
+ struct dwc_bufmap txbuf_map[TX_DESC_COUNT];
uint32_t tx_idx_head;
uint32_t tx_idx_tail;
int txcount;
diff --git a/sys/dev/ed/if_edreg.h b/sys/dev/ed/if_edreg.h
index ed2dbbe..84064bd 100644
--- a/sys/dev/ed/if_edreg.h
+++ b/sys/dev/ed/if_edreg.h
@@ -793,7 +793,7 @@ struct ed_ring {
#define ED_3COM_PSPR 1
/*
- * Drq Timer Register. Determines number of bytes to be transfered during
+ * Drq Timer Register. Determines number of bytes to be transferred during
* a DMA burst.
*/
#define ED_3COM_DQTR 2
diff --git a/sys/dev/esp/esp_pci.c b/sys/dev/esp/esp_pci.c
index cd88f6b..bd85d8e 100644
--- a/sys/dev/esp/esp_pci.c
+++ b/sys/dev/esp/esp_pci.c
@@ -292,7 +292,7 @@ esp_pci_attach(device_t dev)
}
error = bus_dmamap_create(esc->sc_xferdmat, 0, &esc->sc_xferdmam);
if (error != 0) {
- device_printf(dev, "cannnot create transfer DMA map\n");
+ device_printf(dev, "cannot create transfer DMA map\n");
goto fail_xferdmat;
}
diff --git a/sys/dev/esp/ncr53c9xvar.h b/sys/dev/esp/ncr53c9xvar.h
index 97b7241..c5c8343 100644
--- a/sys/dev/esp/ncr53c9xvar.h
+++ b/sys/dev/esp/ncr53c9xvar.h
@@ -102,7 +102,7 @@
/*
* ECB. Holds additional information for each SCSI command Comments: We
* need a separate scsi command block because we may need to overwrite it
- * with a request sense command. Basicly, we refrain from fiddling with
+ * with a request sense command. Basically, we refrain from fiddling with
* the ccb union (except do the expected updating of return values).
* We'll generally update: ccb->ccb_h.status and ccb->csio.{resid,
* scsi_status,sense_data}.
diff --git a/sys/dev/et/if_et.c b/sys/dev/et/if_et.c
index 97fbdcf..67cddc9 100644
--- a/sys/dev/et/if_et.c
+++ b/sys/dev/et/if_et.c
@@ -1395,7 +1395,7 @@ et_start_locked(struct ifnet *ifp)
* Driver does not request TX completion interrupt for every
* queued frames to prevent generating excessive interrupts.
* This means driver may wait for TX completion interrupt even
- * though some frames were sucessfully transmitted. Reclaiming
+ * though some frames were successfully transmitted. Reclaiming
* transmitted frames will ensure driver see all available
* descriptors.
*/
diff --git a/sys/dev/et/if_etreg.h b/sys/dev/et/if_etreg.h
index a314921..52fa930 100644
--- a/sys/dev/et/if_etreg.h
+++ b/sys/dev/et/if_etreg.h
@@ -73,7 +73,7 @@
#define ET_PCIV_ACK_LATENCY_256 416
#define ET_PCIR_REPLAY_TIMER 0xC2
-#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */
+#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX inferred from default */
#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ)
#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ)
diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c
index ca4ec3f..ae552b8 100644
--- a/sys/dev/etherswitch/e6000sw/e6000sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6000sw.c
@@ -805,7 +805,7 @@ e6000sw_setup(device_t dev, e6000sw_softc_t *sc)
e6000sw_writereg(sc, REG_GLOBAL2, MGMT_EN_2x, MGMT_EN_ALL);
e6000sw_writereg(sc, REG_GLOBAL2, MGMT_EN_0x, MGMT_EN_ALL);
- /* Disable Remote Managment */
+ /* Disable Remote Management */
e6000sw_writereg(sc, REG_GLOBAL, SWITCH_GLOBAL_CONTROL2, 0);
/* Disable loopback filter and flow control messages */
diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c
index 83f43fd..a530a443 100644
--- a/sys/dev/fatm/if_fatm.c
+++ b/sys/dev/fatm/if_fatm.c
@@ -1664,7 +1664,7 @@ fatm_intr(void *p)
* is stopped the stopping function will broadcast the cv. All threads will
* find that the interface has been stopped and return.
*
- * Aquiring of the buffer is done by the fatm_getstat() function. The freeing
+ * Acquiring of the buffer is done by the fatm_getstat() function. The freeing
* must be done by the caller when he has finished using the buffer.
*/
static void
@@ -2105,7 +2105,7 @@ fatm_start(struct ifnet *ifp)
}
/*
- * VCC managment
+ * VCC management
*
* This may seem complicated. The reason for this is, that we need an
* asynchronuous open/close for the NATM VCCs because our ioctl handler
@@ -2116,7 +2116,7 @@ fatm_start(struct ifnet *ifp)
/*
* Command the card to open/close a VC.
- * Return the queue entry for waiting if we are succesful.
+ * Return the queue entry for waiting if we are successful.
*/
static struct cmdqueue *
fatm_start_vcc(struct fatm_softc *sc, u_int vpi, u_int vci, uint32_t cmd,
@@ -2849,7 +2849,7 @@ fatm_attach(device_t dev)
sc->memt = rman_get_bustag(sc->memres);
/*
- * Convert endianess of slave access
+ * Convert endianness of slave access
*/
cfg = pci_read_config(dev, FATM_PCIR_MCTL, 1);
cfg |= FATM_PCIM_SWAB;
diff --git a/sys/dev/fatm/if_fatmreg.h b/sys/dev/fatm/if_fatmreg.h
index d488dbf..d6eb007 100644
--- a/sys/dev/fatm/if_fatmreg.h
+++ b/sys/dev/fatm/if_fatmreg.h
@@ -63,7 +63,7 @@ enum {
* status word to PENDING. The card sets it to COMPLETE upon completion of
* the transmit/receive or command. An unused queue entry contains FREE.
* The ERROR can be ored into the COMPLETE. Note, that there are circumstances
- * when ERROR is set without COMPLETE beeing set (when you try to activate
+ * when ERROR is set without COMPLETE being set (when you try to activate
* a bad VCI like, for example, VCI 0).
*/
enum {
diff --git a/sys/dev/fatm/if_fatmvar.h b/sys/dev/fatm/if_fatmvar.h
index bcd8759..ba064fe 100644
--- a/sys/dev/fatm/if_fatmvar.h
+++ b/sys/dev/fatm/if_fatmvar.h
@@ -118,7 +118,7 @@ typedef void (*completion_cb)(struct fatm_softc *, struct cmdqueue *);
struct cmdqueue { /* command queue element */
struct fqelem q;
completion_cb cb; /* call on command completion */
- int error; /* set if error occured */
+ int error; /* set if error occurred */
};
/*
diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c
index aa2d300..183abdc 100644
--- a/sys/dev/fb/fb.c
+++ b/sys/dev/fb/fb.c
@@ -86,7 +86,7 @@ vid_realloc_array(void)
return ENOMEM;
s = spltty();
- newsize = ((adapters + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA;
+ newsize = rounddown(adapters + ARRAY_DELTA, ARRAY_DELTA);
new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO);
new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF,
M_WAITOK | M_ZERO);
diff --git a/sys/dev/fb/machfb.c b/sys/dev/fb/machfb.c
index 03e209d..4282483 100644
--- a/sys/dev/fb/machfb.c
+++ b/sys/dev/fb/machfb.c
@@ -1278,7 +1278,7 @@ machfb_pci_attach(device_t dev)
* Test whether the aperture is byte swapped or not, set
* va_window and va_window_size as appropriate. Note that
* the aperture could be mapped either big or little endian
- * independently of the endianess of the host so this has
+ * independently of the endianness of the host so this has
* to be a runtime test.
*/
p32 = (uint32_t *)adp->va_buffer;
diff --git a/sys/dev/fb/splash.c b/sys/dev/fb/splash.c
index ac005887..4a7226f 100644
--- a/sys/dev/fb/splash.c
+++ b/sys/dev/fb/splash.c
@@ -115,7 +115,7 @@ splash_register(splash_decoder_t *decoder)
if (splash_adp != NULL) {
/*
- * If the video card has aleady been initialized, test
+ * If the video card has already been initialized, test
* this decoder immediately.
*/
error = splash_test(decoder);
diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c
index cdd836c..4ab83c3 100644
--- a/sys/dev/fb/vesa.c
+++ b/sys/dev/fb/vesa.c
@@ -1581,7 +1581,7 @@ vesa_set_origin(video_adapter_t *adp, off_t offset)
regs.R_DX = offset / adp->va_window_gran;
x86bios_intr(&regs, 0x10);
- adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran;
+ adp->va_window_orig = rounddown(offset, adp->va_window_gran);
return (0); /* XXX */
}
diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c
index d0239b3..39078c6 100644
--- a/sys/dev/fb/vga.c
+++ b/sys/dev/fb/vga.c
@@ -948,7 +948,7 @@ probe_adapters(void)
/*
* Locate display adapters.
- * The AT architecture supports upto two adapters. `syscons' allows
+ * The AT architecture supports up to two adapters. `syscons' allows
* the following combinations of adapters:
* 1) MDA + CGA
* 2) MDA + EGA/VGA color
@@ -1134,7 +1134,7 @@ probe_adapters(void)
case COMP_DIFFERENT:
default:
/*
- * Don't use the paramter table in BIOS. It doesn't
+ * Don't use the parameter table in BIOS. It doesn't
* look familiar to us. Video mode switching is allowed
* only if the new mode is the same as or based on
* the initial mode.
@@ -1252,7 +1252,7 @@ set_line_length(video_adapter_t *adp, int pixel)
break;
case V_INFO_MM_PACKED:
count = (pixel + 7)/8;
- bpl = ((pixel + 7)/8)*8;
+ bpl = rounddown(pixel + 7, 8);
break;
case V_INFO_MM_TEXT:
count = (pixel + 7)/8; /* columns */
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index e6c2bf4..699ccbb 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -2202,7 +2202,7 @@ fd_probe(device_t dev)
/* anything responding? */
if (fdc_sense_int(fdc, &st0, NULL) == 0 &&
(st0 & NE7_ST0_EC) == 0)
- break; /* already probed succesfully */
+ break; /* already probed successfully */
}
}
}
diff --git a/sys/dev/fdt/fdt_static_dtb.S b/sys/dev/fdt/fdt_static_dtb.S
index 96a564a..ae1fc03 100644
--- a/sys/dev/fdt/fdt_static_dtb.S
+++ b/sys/dev/fdt/fdt_static_dtb.S
@@ -38,7 +38,7 @@
/*
* The device tree blob must be aligned at 8-bytes boundary. Use
* gas-specific 'balign' extension to ensure the same alignment behaviour on
- * all archs (the .align directive meaning can vary accross gas arch
+ * all archs (the .align directive meaning can vary across gas arch
* variations).
*/
.balign 8
diff --git a/sys/dev/fe/if_fe_isa.c b/sys/dev/fe/if_fe_isa.c
index 8dc7cba..092f30e 100644
--- a/sys/dev/fe/if_fe_isa.c
+++ b/sys/dev/fe/if_fe_isa.c
@@ -364,7 +364,7 @@ fe_probe_fmv(device_t dev)
* u_short const * func (struct fe_softc * sc, u_char const * eeprom);
*
* where eeprom is a pointer to an array of 32 byte data read from the
- * config EEPROM on the board. It retuns an IRQ mapping table for the
+ * config EEPROM on the board. It returns an IRQ mapping table for the
* board, when the corresponding implementation is detected. It
* returns a NULL otherwise.
*
diff --git a/sys/dev/fe/mb86960.h b/sys/dev/fe/mb86960.h
index 1272dde..0482783 100644
--- a/sys/dev/fe/mb86960.h
+++ b/sys/dev/fe/mb86960.h
@@ -44,7 +44,7 @@
* documents..
*/
-/* Data Link Control Registrs, on invaliant port addresses. */
+/* Data Link Control Registers, on invaliant port addresses. */
#define FE_DLCR0 0
#define FE_DLCR1 1
#define FE_DLCR2 2
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c
index 7234188..f691c9d 100644
--- a/sys/dev/firewire/firewire.c
+++ b/sys/dev/firewire/firewire.c
@@ -1584,7 +1584,7 @@ fw_explore_node(struct fw_device *dfwdev)
* speed map value.
* 1394a-2000 compliant devices only use
* the Bus Info Block link spd value, so
- * ignore the speed map alltogether. SWB
+ * ignore the speed map altogether. SWB
*/
if (binfo->link_spd == FWSPD_S100 /* 0 */) {
device_printf(fc->bdev, "%s: "
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c
index e09ce2c..fbaa9bb 100644
--- a/sys/dev/firewire/fwdev.c
+++ b/sys/dev/firewire/fwdev.c
@@ -80,7 +80,6 @@ struct cdevsw firewire_cdevsw = {
.d_mmap = fw_mmap,
.d_strategy = fw_strategy,
.d_name = "fw",
- .d_flags = D_MEM
};
struct fw_drv1 {
@@ -350,7 +349,7 @@ readloop:
}
}
if (ir->stproc == NULL) {
- /* no data avaliable */
+ /* no data available */
if (slept == 0) {
slept = 1;
ir->flag |= FWXFERQ_WAKEUP;
diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c
index 70134af..ac7fa52 100644
--- a/sys/dev/firewire/fwohci.c
+++ b/sys/dev/firewire/fwohci.c
@@ -511,7 +511,7 @@ fwohci_reset(struct fwohci_softc *sc, device_t dev)
OWRITE(sc, OHCI_ITCTLCLR(i), OHCI_CNTL_DMA_RUN);
}
- /* FLUSH FIFO and reset Transmitter/Reciever */
+ /* FLUSH FIFO and reset Transmitter/Receiver */
OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_RESET);
if (firewire_debug)
device_printf(dev, "resetting OHCI...");
@@ -692,7 +692,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev)
sc->fc.config_rom[0] |= fw_crc16(&sc->fc.config_rom[1], 5*4);
#endif
-/* SID recieve buffer must align 2^11 */
+/* SID receive buffer must align 2^11 */
#define OHCI_SIDSIZE (1 << 11)
sc->sid_buf = fwdma_malloc(&sc->fc, OHCI_SIDSIZE, OHCI_SIDSIZE,
&sc->sid_dma, BUS_DMA_WAITOK | BUS_DMA_COHERENT);
@@ -929,7 +929,7 @@ txloop:
OHCI_OUTPUT_MORE | OHCI_KEY_ST2 | hdr_len);
FWOHCI_DMA_WRITE(db->db.desc.addr, 0);
FWOHCI_DMA_WRITE(db->db.desc.res, 0);
-/* Specify bound timer of asy. responce */
+/* Specify bound timer of asy. response */
if (&sc->atrs == dbch) {
FWOHCI_DMA_WRITE(db->db.desc.res,
(OREAD(sc, OHCI_CYCLETIMER) >> 12) + (1 << 13));
@@ -1748,7 +1748,7 @@ fwohci_stop(struct fwohci_softc *sc, device_t dev)
| OHCI_INT_DMA_ARRQ | OHCI_INT_DMA_ARRS
| OHCI_INT_PHY_BUS_R);
-/* FLUSH FIFO and reset Transmitter/Reciever */
+/* FLUSH FIFO and reset Transmitter/Receiver */
OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_RESET);
#endif
@@ -2208,7 +2208,7 @@ fwohci_rbuf_update(struct fwohci_softc *sc, int dmach)
ir->bnpacket, BUS_DMASYNC_POSTREAD);
} else {
/* XXX */
- printf("fwohci_rbuf_update: this shouldn't happend\n");
+ printf("fwohci_rbuf_update: this shouldn't happened\n");
}
STAILQ_REMOVE_HEAD(&ir->stdma, link);
diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c
index 0617a9c..0a958b2 100644
--- a/sys/dev/firewire/if_fwip.c
+++ b/sys/dev/firewire/if_fwip.c
@@ -739,7 +739,7 @@ fwip_stream_input(struct fw_xferq *xferq)
/*
* We must have a GASP header - leave the
* encapsulation sanity checks to the generic
- * code. Remeber that we also have the firewire async
+ * code. Remember that we also have the firewire async
* stream header even though that isn't accounted for
* in mode.stream.len.
*/
diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c
index bd7e924..27e9843 100644
--- a/sys/dev/firewire/sbp_targ.c
+++ b/sys/dev/firewire/sbp_targ.c
@@ -1031,7 +1031,7 @@ sbp_targ_pt_done(struct fw_xfer *xfer)
}
orbi->refcount++;
/*
- * Set endianess here so we don't have
+ * Set endianness here so we don't have
* to deal with is later
*/
for (i = 0, pt = orbi->page_table; i < orbi->orb4.data_size; i++, pt++) {
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index dc91817..543eba9 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -1263,7 +1263,7 @@ fxp_eeprom_putword(struct fxp_softc *sc, int offset, uint16_t data)
*
* 559's can have either 64-word or 256-word EEPROMs, the 558
* datasheet only talks about 64-word EEPROMs, and the 557 datasheet
- * talks about the existance of 16 to 256 word EEPROMs.
+ * talks about the existence of 16 to 256 word EEPROMs.
*
* The only known sizes are 64 and 256, where the 256 version is used
* by CardBus cards to store CIS information.
@@ -2090,7 +2090,7 @@ fxp_update_stats(struct fxp_softc *sc)
le32toh(sp->rx_rnr_errors) +
le32toh(sp->rx_overrun_errors));
/*
- * If any transmit underruns occured, bump up the transmit
+ * If any transmit underruns occurred, bump up the transmit
* threshold by another 512 bytes (64 * 8).
*/
if (sp->tx_underruns) {
@@ -2141,7 +2141,7 @@ fxp_tick(void *xsc)
* then assume the receiver has locked up and attempt to clear
* the condition by reprogramming the multicast filter. This is
* a work-around for a bug in the 82557 where the receiver locks
- * up if it gets certain types of garbage in the syncronization
+ * up if it gets certain types of garbage in the synchronization
* bits prior to the packet header. This bug is supposed to only
* occur in 10Mbps mode, but has been seen to occur in 100Mbps
* mode as well (perhaps due to a 10/100 speed transition).
diff --git a/sys/dev/fxp/rcvbundl.h b/sys/dev/fxp/rcvbundl.h
index 2510f42..dac793d 100644
--- a/sys/dev/fxp/rcvbundl.h
+++ b/sys/dev/fxp/rcvbundl.h
@@ -62,7 +62,7 @@ rcvbundl.h file given above).
* driver can change algorithm.
*
* CPUSAVER_DWORD - This is the location of the instruction that loads
-* the dead-man timer with its inital value. By writing a 16-bit
+* the dead-man timer with its initial value. By writing a 16-bit
* value to the low word of this instruction, the driver can change
* the timer value. The current default is either x600 or x800;
* experiments show that the value probably should stay within the
diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c
index c34ee0e..e87b79f 100644
--- a/sys/dev/hatm/if_hatm.c
+++ b/sys/dev/hatm/if_hatm.c
@@ -557,7 +557,7 @@ hatm_init_bus_width(struct hatm_softc *sc)
}
/*
- * 4.6 Set Host Endianess
+ * 4.6 Set Host Endianness
*/
static void
hatm_init_endianess(struct hatm_softc *sc)
diff --git a/sys/dev/hatm/if_hatm_rx.c b/sys/dev/hatm/if_hatm_rx.c
index af0b925..c12ec6e 100644
--- a/sys/dev/hatm/if_hatm_rx.c
+++ b/sys/dev/hatm/if_hatm_rx.c
@@ -178,7 +178,7 @@ hatm_rx(struct hatm_softc *sc, u_int cid, u_int flags, struct mbuf *m0,
if (vcc->param.aal == ATMIO_AAL_5) {
/*
* Need to remove padding and the trailer. The trailer
- * may be split accross buffers according to 2.10.1.2
+ * may be split across buffers according to 2.10.1.2
* Assume that mbufs sizes are even (buffer sizes and cell
* payload sizes are) and that there are no empty mbufs.
*/
diff --git a/sys/dev/hatm/if_hatm_tx.c b/sys/dev/hatm/if_hatm_tx.c
index d0a28ba..8d64908 100644
--- a/sys/dev/hatm/if_hatm_tx.c
+++ b/sys/dev/hatm/if_hatm_tx.c
@@ -123,7 +123,7 @@ hatm_alloc_tpd(struct hatm_softc *sc, u_int flags)
return (NULL);
}
- /* make it beeing used */
+ /* make it being used */
t = SLIST_FIRST(&sc->tpd_free);
KASSERT(t != NULL, ("tpd botch"));
SLIST_REMOVE_HEAD(&sc->tpd_free, link);
diff --git a/sys/dev/hifn/hifn7751var.h b/sys/dev/hifn/hifn7751var.h
index fcae4af..c5e8a8b 100644
--- a/sys/dev/hifn/hifn7751var.h
+++ b/sys/dev/hifn/hifn7751var.h
@@ -128,7 +128,7 @@ struct hifn_session {
struct hifn_softc {
device_t sc_dev; /* device backpointer */
struct mtx sc_mtx; /* per-instance lock */
- bus_dma_tag_t sc_dmat; /* parent DMA tag decriptor */
+ bus_dma_tag_t sc_dmat; /* parent DMA tag descriptor */
struct resource *sc_bar0res;
bus_space_handle_t sc_sh0; /* bar0 bus space handle */
bus_space_tag_t sc_st0; /* bar0 bus space tag */
diff --git a/sys/dev/hptiop/hptiop.c b/sys/dev/hptiop/hptiop.c
index 204e13d..b9c7211 100644
--- a/sys/dev/hptiop/hptiop.c
+++ b/sys/dev/hptiop/hptiop.c
@@ -2408,7 +2408,7 @@ static void hptiop_post_req_itl(struct hpt_iop_hba *hba,
iop_req32 = BUS_SPACE_RD4_ITL(inbound_queue);
if (iop_req32 == IOPMU_QUEUE_EMPTY) {
- device_printf(hba->pcidev, "invaild req offset\n");
+ device_printf(hba->pcidev, "invalid req offset\n");
ccb->ccb_h.status = CAM_BUSY;
bus_dmamap_unload(hba->io_dmat, srb->dma_map);
hptiop_free_srb(hba, srb);
diff --git a/sys/dev/hptmv/array.h b/sys/dev/hptmv/array.h
index 7b50774..2caf413 100644
--- a/sys/dev/hptmv/array.h
+++ b/sys/dev/hptmv/array.h
@@ -99,7 +99,7 @@ typedef struct _RaidArray
} RaidArray;
/***************************************************************************
- * Array Descripton on disk
+ * Array Description on disk
***************************************************************************/
#pragma pack(1)
typedef struct _ArrayDescript
diff --git a/sys/dev/hptmv/command.h b/sys/dev/hptmv/command.h
index 3b6a53b..de51356 100644
--- a/sys/dev/hptmv/command.h
+++ b/sys/dev/hptmv/command.h
@@ -128,7 +128,7 @@ typedef struct _Command
/* called when this command is finished */
void (* HPTLIBAPI pfnCompletion)(_VBUS_ARG PCommand pCmd);
- /* pointer to origional command */
+ /* pointer to original command */
void *pOrgCommand;
diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c
index 9a1b91b..a3ef364 100644
--- a/sys/dev/hptmv/entry.c
+++ b/sys/dev/hptmv/entry.c
@@ -164,7 +164,7 @@ char DRIVER_VERSION[] = "v1.16";
*
* Description: free allocated queues for the given channel
*
- * Parameters: pMvSataAdapter - pointer to the RR18xx controler this
+ * Parameters: pMvSataAdapter - pointer to the RR18xx controller this
* channel connected to.
* channelNum - channel number.
*
@@ -309,7 +309,7 @@ hptmv_init_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
*
* Description: this functions parses the identify command results, checks
* that the connected deives can be accesed by RR18xx EDMA,
- * and updates the channel stucture accordingly.
+ * and updates the channel structure accordingly.
*
* Parameters: pMvSataChannel, pointer to the channel data structure.
*
diff --git a/sys/dev/hptmv/hptintf.h b/sys/dev/hptmv/hptintf.h
index 09d638f..191795c 100644
--- a/sys/dev/hptmv/hptintf.h
+++ b/sys/dev/hptmv/hptintf.h
@@ -101,7 +101,7 @@ typedef DWORD DEVICEID;
#define MAX_ARRAY_MEMBERS_V1 8
#define MAX_ARRAY_MEMBERS_V2 16
-/* keep definition for source code compatiblity */
+/* keep definition for source code compatibility */
#define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1
/*
diff --git a/sys/dev/hptmv/mvOs.h b/sys/dev/hptmv/mvOs.h
index a1ababc..3110973 100644
--- a/sys/dev/hptmv/mvOs.h
+++ b/sys/dev/hptmv/mvOs.h
@@ -72,7 +72,7 @@ typedef enum mvBoolean{MV_FALSE, MV_TRUE} MV_BOOLEAN;
#define NULL 0
#endif
-/* System dependant typedefs */
+/* System dependent typedefs */
typedef void MV_VOID;
typedef unsigned int MV_U32;
typedef unsigned short MV_U16;
diff --git a/sys/dev/hptnr/hptintf.h b/sys/dev/hptnr/hptintf.h
index fa3b36e..aefb49c 100644
--- a/sys/dev/hptnr/hptintf.h
+++ b/sys/dev/hptnr/hptintf.h
@@ -128,7 +128,7 @@ typedef HPT_U32 DEVICEID;
#define MAX_ARRAY_MEMBERS_V3 64
#endif
-/* keep definition for source code compatiblity */
+/* keep definition for source code compatibility */
#define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1
/*
@@ -153,8 +153,8 @@ typedef HPT_U32 DEVICEID;
#define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */
#define ARRAY_FLAG_VERIFYING 0x00000100 /* is being verified */
#define ARRAY_FLAG_INITIALIZING 0x00000200 /* is being initialized */
-#define ARRAY_FLAG_TRANSFORMING 0x00000400 /* tranform in progress */
-#define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need tranform */
+#define ARRAY_FLAG_TRANSFORMING 0x00000400 /* transform in progress */
+#define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need transform */
#define ARRAY_FLAG_NEEDINITIALIZING 0x00001000 /* the array's initialization hasn't finished*/
#define ARRAY_FLAG_BROKEN_REDUNDANT 0x00002000 /* broken but redundant (raid6) */
#define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */
@@ -2014,7 +2014,7 @@ DEVICEID hpt_create_transform_v2(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V3 destI
#endif
/* hpt_step_transform
- * move a block in a tranform progress.
+ * move a block in a transform progress.
* This function is called by mid-layer, not GUI (which uses set_array_state instead).
* Version compatibility: v2.0.0.0 or later
* Parameters:
diff --git a/sys/dev/hptrr/hptintf.h b/sys/dev/hptrr/hptintf.h
index eb210fc..b7f22ab 100644
--- a/sys/dev/hptrr/hptintf.h
+++ b/sys/dev/hptrr/hptintf.h
@@ -128,7 +128,7 @@ typedef HPT_U32 DEVICEID;
#define MAX_ARRAY_MEMBERS_V3 64
#endif
-/* keep definition for source code compatiblity */
+/* keep definition for source code compatibility */
#define MAX_ARRAY_MEMBERS MAX_ARRAY_MEMBERS_V1
/*
@@ -153,8 +153,8 @@ typedef HPT_U32 DEVICEID;
#define ARRAY_FLAG_NEED_AUTOREBUILD 0x00000080 /* auto-rebuild should start */
#define ARRAY_FLAG_VERIFYING 0x00000100 /* is being verified */
#define ARRAY_FLAG_INITIALIZING 0x00000200 /* is being initialized */
-#define ARRAY_FLAG_TRANSFORMING 0x00000400 /* tranform in progress */
-#define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need tranform */
+#define ARRAY_FLAG_TRANSFORMING 0x00000400 /* transform in progress */
+#define ARRAY_FLAG_NEEDTRANSFORM 0x00000800 /* array need transform */
#define ARRAY_FLAG_NEEDINITIALIZING 0x00001000 /* the array's initialization hasn't finished*/
#define ARRAY_FLAG_BROKEN_REDUNDANT 0x00002000 /* broken but redundant (raid6) */
#define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */
@@ -1735,7 +1735,7 @@ DEVICEID hpt_create_transform_v2(DEVICEID idArray, PCREATE_ARRAY_PARAMS_V3 destI
#endif
/* hpt_step_transform
- * move a block in a tranform progress.
+ * move a block in a transform progress.
* This function is called by mid-layer, not GUI (which uses set_array_state instead).
* Version compatibility: v2.0.0.0 or later
* Parameters:
diff --git a/sys/dev/hwpmc/hwpmc_core.h b/sys/dev/hwpmc/hwpmc_core.h
index 7196d9d..6183e26 100644
--- a/sys/dev/hwpmc/hwpmc_core.h
+++ b/sys/dev/hwpmc/hwpmc_core.h
@@ -141,7 +141,7 @@ struct pmc_md_iap_op_pmcallocate {
#define IA_GLOBAL_CTRL 0x38F
/*
- * IA_GLOBAL_CTRL is layed out in the following way.
+ * IA_GLOBAL_CTRL is laid out in the following way.
*
* Bit Position Use
* 63-35 Reserved (do not touch)
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index 4a5586c..c0caab6 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -1123,7 +1123,7 @@ pmc_detach_one_process(struct proc *p, struct pmc *pm, int flags)
pmclog_process_pmcdetach(pm, p->p_pid);
/*
- * If there are no PMCs targetting this process, we remove its
+ * If there are no PMCs targeting this process, we remove its
* descriptor from the target hash table and unset the P_HWPMC
* flag in the struct proc.
*/
@@ -1232,7 +1232,7 @@ pmc_process_csw_in(struct thread *td)
p->p_pid, p->p_comm, pp);
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
- ("[pmc,%d] wierd CPU id %d", __LINE__, cpu));
+ ("[pmc,%d] weird CPU id %d", __LINE__, cpu));
pc = pmc_pcpu[cpu];
@@ -1377,7 +1377,7 @@ pmc_process_csw_out(struct thread *td)
p->p_pid, p->p_comm, pp);
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
- ("[pmc,%d wierd CPU id %d", __LINE__, cpu));
+ ("[pmc,%d weird CPU id %d", __LINE__, cpu));
pc = pmc_pcpu[cpu];
@@ -1907,7 +1907,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
/*
* Log the exec event to all monitoring owners. Skip
- * owners who have already recieved the event because
+ * owners who have already received the event because
* they had system sampling PMCs active.
*/
for (ri = 0; ri < md->pmd_npmc; ri++)
@@ -1933,7 +1933,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg)
/*
* If the newly exec()'ed process has a different credential
* than before, allow it to be the target of a PMC only if
- * the PMC's owner has sufficient priviledge.
+ * the PMC's owner has sufficient privilege.
*/
for (ri = 0; ri < md->pmd_npmc; ri++)
@@ -4441,7 +4441,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
* process, we would have context switched IN at some prior
* point. However, with PREEMPTION, kernel mode context
* switches may happen any time, so we want to disable a
- * context switch OUT till we get any PMCs targetting this
+ * context switch OUT till we get any PMCs targeting this
* process off the hardware.
*
* We also need to atomically remove this process'
@@ -4544,7 +4544,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
/*
* Unlink this process from the PMCs that are
- * targetting it. This will send a signal to
+ * targeting it. This will send a signal to
* all PMC owner's whose PMCs are orphaned.
*
* Log PMC value at exit time if requested.
diff --git a/sys/dev/hwpmc/pmc_events.h b/sys/dev/hwpmc/pmc_events.h
index 864ec95..7c0ac2f 100644
--- a/sys/dev/hwpmc/pmc_events.h
+++ b/sys/dev/hwpmc/pmc_events.h
@@ -4552,7 +4552,7 @@ __PMC_EV_ALIAS("SQ_MISC.SPLIT_LOCK", IAP_EVENT_F4H_10H)
#define PMC_EV_TSC_LAST PMC_EV_TSC_TSC
/*
- * Software events are dynamicaly defined.
+ * Software events are dynamically defined.
*/
#define PMC_EV_DYN_COUNT 0x1000
diff --git a/sys/dev/hyperv/include/hyperv.h b/sys/dev/hyperv/include/hyperv.h
index aeec8ec..d5166f6 100644
--- a/sys/dev/hyperv/include/hyperv.h
+++ b/sys/dev/hyperv/include/hyperv.h
@@ -783,7 +783,7 @@ typedef struct hv_vmbus_channel {
/*
* From Win8, this field specifies the target virtual process
- * on which to deliver the interupt from the host to guest.
+ * on which to deliver the interrupt from the host to guest.
* Before Win8, all channel interrupts would only be
* delivered on cpu 0. Setting this value to 0 would preserve
* the earlier behavior.
diff --git a/sys/dev/hyperv/utilities/hv_kvp.c b/sys/dev/hyperv/utilities/hv_kvp.c
index d4520d6..c39083a 100644
--- a/sys/dev/hyperv/utilities/hv_kvp.c
+++ b/sys/dev/hyperv/utilities/hv_kvp.c
@@ -118,7 +118,7 @@ typedef struct hv_kvp_sc {
struct hv_util_sc util_sc;
/* Unless specified the pending mutex should be
- * used to alter the values of the following paramters:
+ * used to alter the values of the following parameters:
* 1. req_in_progress
* 2. req_timed_out
*/
@@ -778,7 +778,7 @@ hv_kvp_dev_daemon_read(struct cdev *dev, struct uio *uio, int ioflag __unused)
/*
* hv_kvp_daemon write invokes this function
- * acts as a recieve from daemon
+ * acts as a receive from daemon
*/
static int
hv_kvp_dev_daemon_write(struct cdev *dev, struct uio *uio, int ioflag __unused)
diff --git a/sys/dev/ic/cd180.h b/sys/dev/ic/cd180.h
index ae46a48..941f8ca 100644
--- a/sys/dev/ic/cd180.h
+++ b/sys/dev/ic/cd180.h
@@ -82,7 +82,7 @@
/* Channel Address Register */
#define CAR_CHAN 0x07 /* Channel Number Mask */
-#define CAR_A7 0x08 /* Addres bit 7 (unused) */
+#define CAR_A7 0x08 /* Address bit 7 (unused) */
/* Receive Character Status Register */
#define RCSR_OE 0x01 /* Overrun Error */
diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c
index 23bdb7d..ff27da2 100644
--- a/sys/dev/ichiic/ig4_iic.c
+++ b/sys/dev/ichiic/ig4_iic.c
@@ -659,7 +659,7 @@ ig4iic_smb_callback(device_t dev, int index, void *data)
/*
* Quick command. i.e. START + cmd + R/W + STOP and no data. It is
* unclear to me how I could implement this with the intel i2c controller
- * because the controler sends STARTs and STOPs automatically with data.
+ * because the controller sends STARTs and STOPs automatically with data.
*/
int
ig4iic_smb_quick(device_t dev, u_char slave, int how)
diff --git a/sys/dev/ichiic/ig4_reg.h b/sys/dev/ichiic/ig4_reg.h
index c87d1d1..33976c0 100644
--- a/sys/dev/ichiic/ig4_reg.h
+++ b/sys/dev/ichiic/ig4_reg.h
@@ -185,7 +185,7 @@
* RESTART - RW This bit controls whether a forced RESTART is
* issued before the byte is sent or received.
*
- * 0 If not set a RESTART is only issued if the tranfer
+ * 0 If not set a RESTART is only issued if the transfer
* direction is changing from the previous command.
*
* 1 A RESTART is issued before the byte is sent or
@@ -271,7 +271,7 @@
* cleared by HW when the buffer level goes above
* the threshold.
*
- * TX_OVER Indicates that the processer attempted to write
+ * TX_OVER Indicates that the processor attempted to write
* to the TX FIFO while the TX FIFO was full. Cleared
* by reading CLR_TX_OVER.
*
diff --git a/sys/dev/ida/idareg.h b/sys/dev/ida/idareg.h
index a25a768..7fb48d4 100644
--- a/sys/dev/ida/idareg.h
+++ b/sys/dev/ida/idareg.h
@@ -295,7 +295,7 @@ struct ida_phys_drv_info {
u_int8_t scsi_lun;
u_int8_t ympd_flags; /* yet more physical drive flags */
#define YMPDF_DRIVE_WCE_SET 0x40 /* WCE currently set */
-#define YMPDF_DRIVE_WCE_CHNG 0x80 /* WCE changable */
+#define YMPDF_DRIVE_WCE_CHNG 0x80 /* WCE changeable */
u_int8_t reserved;
u_int32_t spi_speed_rules;
u_int8_t phys_con[2]; /* Physical Connector */
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index 5084202..2237259 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -725,7 +725,7 @@ ndis_80211attach(struct ndis_softc *sc)
struct ndis_80211_nettype_list *ntl;
uint32_t arg;
int mode, i, r, len, nonettypes = 1;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)] = { 0 };
+ uint8_t bands[IEEE80211_MODE_BYTES] = { 0 };
callout_init(&sc->ndis_scan_callout, 1);
@@ -1374,7 +1374,7 @@ ndis_rxeof_xfr_done(adapter, packet, status, len)
* out-of-band portion of the ndis_packet has special meaning. In the
* most common case, the underlying NDIS driver will set this field
* to NDIS_STATUS_SUCCESS, which indicates that it's ok for us to
- * take posession of it. We then change the status field to
+ * take possession of it. We then change the status field to
* NDIS_STATUS_PENDING to tell the driver that we now own the packet,
* and that we will return it at some point in the future via the
* return packet handler.
diff --git a/sys/dev/iicbus/ds133x.c b/sys/dev/iicbus/ds133x.c
index 20f1d40..1f703dc 100644
--- a/sys/dev/iicbus/ds133x.c
+++ b/sys/dev/iicbus/ds133x.c
@@ -150,7 +150,7 @@ ds133x_detect(device_t dev, int *sc_type)
/*
* Now Check for DS1337. Bit 5 in control register of this chip will be
- * allways read as 0. In DS1339 changing of this bit is safe until
+ * always read as 0. In DS1339 changing of this bit is safe until
* chip is powered up.
*/
diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c
index 7a4e2b1..0df2f4a 100644
--- a/sys/dev/iicbus/if_ic.c
+++ b/sys/dev/iicbus/if_ic.c
@@ -289,7 +289,7 @@ icintr(device_t dev, int event, char *ptr)
case INTR_STOP:
- /* if any error occured during transfert,
+ /* if any error occurred during transfert,
* drop the packet */
sc->ic_flags &= ~IC_IFBUF_BUSY;
if ((sc->ic_flags & (IC_BUFFERS_BUSY | IC_BUFFER_WAITER)) ==
diff --git a/sys/dev/iicbus/iiconf.h b/sys/dev/iicbus/iiconf.h
index 12ac0d7..03b9583 100644
--- a/sys/dev/iicbus/iiconf.h
+++ b/sys/dev/iicbus/iiconf.h
@@ -82,7 +82,7 @@
/*
* adapter layer errors
*/
-#define IIC_NOERR 0x0 /* no error occured */
+#define IIC_NOERR 0x0 /* no error occurred */
#define IIC_EBUSERR 0x1 /* bus error (hardware not in expected state) */
#define IIC_ENOACK 0x2 /* ack not received until timeout */
#define IIC_ETIMEOUT 0x3 /* timeout */
diff --git a/sys/dev/iicbus/twsi/twsi.c b/sys/dev/iicbus/twsi/twsi.c
index 1b27956..dee0b7a 100644
--- a/sys/dev/iicbus/twsi/twsi.c
+++ b/sys/dev/iicbus/twsi/twsi.c
@@ -141,7 +141,7 @@ twsi_clear_iflg(struct twsi_softc *sc)
/*
* timeout given in us
* returns
- * 0 on sucessfull mask change
+ * 0 on successful mask change
* non-zero on timeout
*/
static int
diff --git a/sys/dev/iir/iir.c b/sys/dev/iir/iir.c
index e74698e..52dc123 100644
--- a/sys/dev/iir/iir.c
+++ b/sys/dev/iir/iir.c
@@ -30,7 +30,7 @@
*/
/*
- * iir.c: SCSI dependant code for the Intel Integrated RAID Controller driver
+ * iir.c: SCSI dependent code for the Intel Integrated RAID Controller driver
*
* Written by: Achim Leubner <achim_leubner@adaptec.com>
* Fixes/Additions: Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com>
diff --git a/sys/dev/intpm/intpm.c b/sys/dev/intpm/intpm.c
index 60ad17f..911332c 100644
--- a/sys/dev/intpm/intpm.c
+++ b/sys/dev/intpm/intpm.c
@@ -496,7 +496,7 @@ intsmb_stop(struct intsmb_softc *sc)
/* Timeout Procedure. */
sc->isbusy = 0;
- /* Re-enable supressed interrupt from slave part. */
+ /* Re-enable suppressed interrupt from slave part. */
bus_write_1(sc->io_res, PIIX4_SMBSLVCNT, PIIX4_SMBSLVCNT_ALTEN);
if (error == EWOULDBLOCK)
return (SMB_ETIMEOUT);
diff --git a/sys/dev/ips/ips.c b/sys/dev/ips/ips.c
index 7ef3ba7..2bda55d 100644
--- a/sys/dev/ips/ips.c
+++ b/sys/dev/ips/ips.c
@@ -107,7 +107,7 @@ static void ips_cmd_dmaload(void *cmdptr, bus_dma_segment_t *segments,int segnum
}
-/* is locking needed? what locking guarentees are there on removal? */
+/* is locking needed? what locking guarantees are there on removal? */
static int ips_cmdqueue_free(ips_softc_t *sc)
{
int i, error = -1;
diff --git a/sys/dev/isci/isci_controller.c b/sys/dev/isci/isci_controller.c
index d3ec045..02bf2d0 100644
--- a/sys/dev/isci/isci_controller.c
+++ b/sys/dev/isci/isci_controller.c
@@ -470,7 +470,7 @@ int isci_controller_allocate_memory(struct ISCI_CONTROLLER *controller)
/* Create DMA tag for our I/O requests. Then we can create DMA maps based off
* of this tag and store them in each of our ISCI_IO_REQUEST objects. This
- * will enable better performance than creating the DMA maps everytime we get
+ * will enable better performance than creating the DMA maps every time we get
* an I/O.
*/
status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, 0x0,
diff --git a/sys/dev/isci/isci_io_request.c b/sys/dev/isci/isci_io_request.c
index f86c126..468d124 100644
--- a/sys/dev/isci/isci_io_request.c
+++ b/sys/dev/isci/isci_io_request.c
@@ -309,7 +309,7 @@ isci_io_request_complete(SCI_CONTROLLER_HANDLE_T scif_controller,
* handle.
* @param[in] io_request This parameter is the io request object handle
* for which the physical address is being requested.
- * @param[in] virtual_address This paramter is the virtual address which
+ * @param[in] virtual_address This parameter is the virtual address which
* is to be returned as a physical address.
* @param[out] physical_address The physical address for the supplied virtual
* address.
@@ -540,14 +540,14 @@ scif_cb_io_request_get_virtual_address_from_sgl(void * scif_user_io_request,
/**
* @brief This callback method asks the user to provide the number of
- * bytes to be transfered as part of this request.
+ * bytes to be transferred as part of this request.
*
* @param[in] scif_user_io_request This parameter points to the user's
* IO request object. It is a cookie that allows the user to
* provide the necessary information for this callback.
*
* @return This method returns the number of payload data bytes to be
- * transfered for this IO request.
+ * transferred for this IO request.
*/
uint32_t
scif_cb_io_request_get_transfer_length(void * scif_user_io_request)
diff --git a/sys/dev/isci/isci_timer.c b/sys/dev/isci/isci_timer.c
index 1f22e94..9059c5b 100644
--- a/sys/dev/isci/isci_timer.c
+++ b/sys/dev/isci/isci_timer.c
@@ -144,7 +144,7 @@ scif_cb_timer_create(SCI_CONTROLLER_HANDLE_T scif_controller,
}
/**
- * @brief This callback method asks the user to destory the supplied timer.
+ * @brief This callback method asks the user to destroy the supplied timer.
*
* @param[in] controller This parameter specifies the controller with
* which this timer is to associated.
diff --git a/sys/dev/isci/scil/intel_sas.h b/sys/dev/isci/scil/intel_sas.h
index 18fa8d3..e2bd8ee 100644
--- a/sys/dev/isci/scil/intel_sas.h
+++ b/sys/dev/isci/scil/intel_sas.h
@@ -465,7 +465,7 @@ typedef struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
/**
* @struct SMP_REQUEST_PHY_CONTROL
- * @brief This structure defines the contents of an SMP Phy Controler
+ * @brief This structure defines the contents of an SMP Phy Controller
* request.
* @note For specific information on each of these
* individual fields please reference the SAS specification.
diff --git a/sys/dev/isci/scil/sati_callbacks.h b/sys/dev/isci/scil/sati_callbacks.h
index e6cd57f..2364e42 100644
--- a/sys/dev/isci/scil/sati_callbacks.h
+++ b/sys/dev/isci/scil/sati_callbacks.h
@@ -173,7 +173,7 @@ U8 sati_cb_get_task_function(
* response IU buffer.
*
* @param[in] scsi_io This parameter specifies the user's SCSI IO request
- * for which to retreive the location of the response buffer to
+ * for which to retrieve the location of the response buffer to
* be written.
*
* @return This method returns the address of the response data buffer.
@@ -189,7 +189,7 @@ void * sati_cb_get_response_iu_address(
* buffer.
*
* @param[in] scsi_io This parameter specifies the user's SCSI IO request
- * for which to retreive the location of the sense buffer to
+ * for which to retrieve the location of the sense buffer to
* be written.
*
* @return This method returns the address of the sense data buffer.
@@ -203,7 +203,7 @@ U8* sati_cb_get_sense_data_address(
* buffer.
*
* @param[in] scsi_io This parameter specifies the user's SCSI IO request
- * for which to retreive the location of the sense buffer to
+ * for which to retrieve the location of the sense buffer to
* be written.
*
* @return This method returns the length of the sense data buffer.
@@ -246,7 +246,7 @@ U8 * sati_cb_get_h2d_register_fis_address(
/**
* @brief This method retrieves the ATA task file (register FIS) relating to
- * the device to host reponse values.
+ * the device to host response values.
*
* @param[in] ata_io This parameter specifies the user's ATA IO request
* from which to retrieve the d2h register FIS address.
@@ -374,7 +374,7 @@ BOOL sati_cb_do_translate_response(
* associated device is contained in a SAS Domain.
*
* @param[in] scsi_io This parameter specifies the user's SCSI IO request
- * for which to retreive the SAS address of the device.
+ * for which to retrieve the SAS address of the device.
* @param[out] sas_address This parameter specifies the SAS address memory
* to be contain the retrieved value.
*
diff --git a/sys/dev/isci/scil/sati_design.h b/sys/dev/isci/scil/sati_design.h
index f4f2248..372dce0 100644
--- a/sys/dev/isci/scil/sati_design.h
+++ b/sys/dev/isci/scil/sati_design.h
@@ -151,7 +151,7 @@ be followed for command translations.
@image html Sequence_Diagram__General_Cmd_Translation_Sequence__General_Cmd_Translation_Sequence.jpg "General Command Translation Sequence"
This sequence diagram simply depicts the high-level translation sequence to
-be followed for reponse translations.
+be followed for response translations.
@image html Sequence_Diagram__General_Rsp_Translation_Sequence__General_Rsp_Translation_Sequence.jpg "General Response Translation Sequence"
diff --git a/sys/dev/isci/scil/sati_device.h b/sys/dev/isci/scil/sati_device.h
index 980ca44..d955f83 100644
--- a/sys/dev/isci/scil/sati_device.h
+++ b/sys/dev/isci/scil/sati_device.h
@@ -151,7 +151,7 @@ typedef struct SATI_DEVICE
U8 unit_attention_ascq;
/**
- * This field indicates the ATA standby timer value set throught the
+ * This field indicates the ATA standby timer value set through the
* ATA IDLE and ATA Standby commands
*/
U8 ata_standby_timer;
diff --git a/sys/dev/isci/scil/sati_log_sense.c b/sys/dev/isci/scil/sati_log_sense.c
index 44bc4e9..04c4894 100644
--- a/sys/dev/isci/scil/sati_log_sense.c
+++ b/sys/dev/isci/scil/sati_log_sense.c
@@ -394,7 +394,7 @@ void sati_self_test_log_header_construct(
/**
* @brief This method will construct the SCSI self test log page from
- * the Extended SMART self-test log response recieved from the
+ * the Extended SMART self-test log response received from the
* ATA device. The response is from a ATA_Read_Log_EXT command
* issued by SATI.
*
@@ -427,7 +427,7 @@ void sati_extended_self_test_log_page_construct(
/**
* @brief This method will construct the SCSI self test log page from
-* the SMART self-test log response recieved from the ATA device.
+* the SMART self-test log response received from the ATA device.
* The response is from a ATA_SMART_Read_Log command issued by SATI.
*
* @return n/a
@@ -513,7 +513,7 @@ void sati_self_test_log_page_construct(
/**
* @brief This method will construct the SCSI information exception log page from
-* the ATA SMART response recieved from the ATA device. The response is
+* the ATA SMART response received from the ATA device. The response is
* from a ATA SMART return status command issued by SATI.
*
* @return n/a
diff --git a/sys/dev/isci/scil/sati_move.c b/sys/dev/isci/scil/sati_move.c
index 630a9f8..9b1e8dc 100644
--- a/sys/dev/isci/scil/sati_move.c
+++ b/sys/dev/isci/scil/sati_move.c
@@ -147,7 +147,7 @@ void sati_move_small_udma_translate_command(
* please reference sati_translate_command()
*
* @param[in] sector_count This parameter specifies the number of sectors
- * to be transfered.
+ * to be transferred.
* @param[in] write_opcode This parameter specifies the value to be written
* to the ATA command register for a write (data out) operation.
* @param[in] read_opcode This parameter specifies the value to be written
@@ -220,7 +220,7 @@ void sati_move_ncq_translate_8_bit_sector_count(
* @note This method should only be called for CDB sizes of 10-bytes or larger.
*
* @param[in] sector_count This parameter specifies the number of sectors
- * to be transfered.
+ * to be transferred.
* @param[in] is_fpdma_command This parameter indicates if the supplied
* ata_io is a first party DMA request (NCQ).
*
@@ -491,7 +491,7 @@ SATI_STATUS sati_move_small_translate_command(
* please reference sati_translate_command().
*
* @param[in] sector_count This parameter specifies the number of sectors
- * to be transfered.
+ * to be transferred.
* @param[in] device_head This parameter specifies the contents to be
* written to the device head register.
*
diff --git a/sys/dev/isci/scil/sati_translator_sequence.h b/sys/dev/isci/scil/sati_translator_sequence.h
index 4bd63a7..dba5326 100644
--- a/sys/dev/isci/scil/sati_translator_sequence.h
+++ b/sys/dev/isci/scil/sati_translator_sequence.h
@@ -57,7 +57,7 @@
/**
* @file
* @brief This file contains all of the defintions for the SATI translator
- * sequence. A translator sequence is simply a defintion for the
+ * sequence. A translator sequence is simply a definition for the
* various sequences of commands that occur in this translator.
*/
@@ -310,7 +310,7 @@ typedef struct SATI_TRANSLATOR_SEQUENCE
/**
* This field specifies the amount of data that will actually be
- * transfered across the wire for this ATA request.
+ * transferred across the wire for this ATA request.
*/
U32 ata_transfer_length;
diff --git a/sys/dev/isci/scil/sati_util.c b/sys/dev/isci/scil/sati_util.c
index 18c10c8..90b9bfa 100644
--- a/sys/dev/isci/scil/sati_util.c
+++ b/sys/dev/isci/scil/sati_util.c
@@ -1790,7 +1790,7 @@ void sati_ata_smart_read_log_construct(
/**
* @brief This method will construct a Write Uncorrectable ATA command that
- * will write one sector with a psuedo or flagged error. The type of
+ * will write one sector with a pseudo or flagged error. The type of
* error is specified by the feature value.
*
* @return N/A
diff --git a/sys/dev/isci/scil/sci_base_phy.h b/sys/dev/isci/scil/sci_base_phy.h
index 141b47a..914a110 100644
--- a/sys/dev/isci/scil/sci_base_phy.h
+++ b/sys/dev/isci/scil/sci_base_phy.h
@@ -93,7 +93,7 @@ typedef enum _SCI_BASE_PHY_STATES
SCI_BASE_PHY_STATE_STOPPED,
/**
- * This state indicates that the phy is in the process of becomming
+ * This state indicates that the phy is in the process of becoming
* ready. In this state no new IO operations are permitted on this phy.
* This state is entered from the STOPPED state.
* This state is entered from the READY state.
diff --git a/sys/dev/isci/scil/sci_fast_list.h b/sys/dev/isci/scil/sci_fast_list.h
index a7f166d..0325fad 100644
--- a/sys/dev/isci/scil/sci_fast_list.h
+++ b/sys/dev/isci/scil/sci_fast_list.h
@@ -67,7 +67,7 @@
* queue. Pointers in this implementation never == NULL.
*
* Definitions:
- * - anchor : This is ths list container and has a
+ * - anchor : This is the list container and has a
* pointer to both the head and tail of the
* list elements
* - element: This is the list element not the actual
diff --git a/sys/dev/isci/scil/sci_simple_list.h b/sys/dev/isci/scil/sci_simple_list.h
index 98d29e1..9c0848a 100644
--- a/sys/dev/isci/scil/sci_simple_list.h
+++ b/sys/dev/isci/scil/sci_simple_list.h
@@ -305,7 +305,7 @@ static void sci_simple_list_insert_list_at_head(
}
// Wipe the source list to make sure the list elements can not be accessed
- // from two seperate lists at the same time.
+ // from two separate lists at the same time.
sci_simple_list_init(source_anchor);
}
}
@@ -342,7 +342,7 @@ static void sci_simple_list_insert_list_at_tail(
}
// Wipe the source list to make sure the list elements can not be accessed
- // from two seperate lists at the same time.
+ // from two separate lists at the same time.
sci_simple_list_init(source_anchor);
}
}
diff --git a/sys/dev/isci/scil/scic_config_parameters.h b/sys/dev/isci/scil/scic_config_parameters.h
index 1c6c86c..969cd30 100644
--- a/sys/dev/isci/scil/scic_config_parameters.h
+++ b/sys/dev/isci/scil/scic_config_parameters.h
@@ -323,7 +323,7 @@ SCI_STATUS scic_oem_parameters_set(
);
/**
- * @brief This method allows the user to retreive the OEM
+ * @brief This method allows the user to retrieve the OEM
* parameters utilized by the controller.
*
* @param[in] controller This parameter specifies the controller on which
diff --git a/sys/dev/isci/scil/scic_controller.h b/sys/dev/isci/scil/scic_controller.h
index 75804c7..31c94af 100644
--- a/sys/dev/isci/scil/scic_controller.h
+++ b/sys/dev/isci/scil/scic_controller.h
@@ -133,7 +133,7 @@ typedef BOOL (*SCIC_CONTROLLER_INTERRUPT_HANDLER)(
* called some time after the interrupt handler.
*
* @note Most, if not all, of the user callback APIs are invoked from within
- * this API. As a result, the user should be cognizent of the operating
+ * this API. As a result, the user should be cognizant of the operating
* level at which they invoke this API.
*
*/
diff --git a/sys/dev/isci/scil/scic_phy.h b/sys/dev/isci/scil/scic_phy.h
index 754cf5d..75b11d4 100644
--- a/sys/dev/isci/scil/scic_phy.h
+++ b/sys/dev/isci/scil/scic_phy.h
@@ -308,7 +308,7 @@ SCI_STATUS scic_sas_phy_get_properties(
/**
* @brief This method will enable the user to retrieve information
- * specific to a SATA phy, such as: the recieved signature
+ * specific to a SATA phy, such as: the received signature
* FIS, if a port selector is present, etc.
*
* @param[in] phy this parameter specifies the phy for which to
diff --git a/sys/dev/isci/scil/scic_sds_controller.c b/sys/dev/isci/scil/scic_sds_controller.c
index 413ef5b..767f89c 100644
--- a/sys/dev/isci/scil/scic_sds_controller.c
+++ b/sys/dev/isci/scil/scic_sds_controller.c
@@ -1077,7 +1077,7 @@ void scic_sds_controller_afe_initialization(
scu_afe_register_write(this_controller, afe_bias_control, 0x00005F00);
else if (this_controller->pci_revision == SCIC_SDS_PCI_REVISION_C1)
scu_afe_register_write(this_controller, afe_bias_control, 0x00005500);
- // For C0 the AFE BIAS Controll is unchanged
+ // For C0 the AFE BIAS Control is unchanged
scic_cb_stall_execution(AFE_REGISTER_WRITE_DELAY);
@@ -2429,7 +2429,7 @@ void scic_sds_controller_process_completions(
SCIC_LOG_TRACE((
sci_base_object_get_logger(this_controller),
SCIC_LOG_OBJECT_COMPLETION_QUEUE,
- "completion queue begining get : 0x%08x\n",
+ "completion queue beginning get : 0x%08x\n",
this_controller->completion_queue_get
));
@@ -2544,7 +2544,7 @@ void scic_sds_controller_transitioned_process_completions(
SCIC_LOG_TRACE((
sci_base_object_get_logger(this_controller),
SCIC_LOG_OBJECT_COMPLETION_QUEUE,
- "completion queue begining get : 0x%08x\n",
+ "completion queue beginning get : 0x%08x\n",
this_controller->completion_queue_get
));
diff --git a/sys/dev/isci/scil/scic_sds_controller.h b/sys/dev/isci/scil/scic_sds_controller.h
index 9829a7b..fe3468f 100644
--- a/sys/dev/isci/scil/scic_sds_controller.h
+++ b/sys/dev/isci/scil/scic_sds_controller.h
@@ -247,7 +247,7 @@ typedef struct SCIC_SDS_CONTROLLER
SCI_POOL_CREATE(tci_pool, U16, SCI_MAX_IO_REQUESTS);
/**
- * This filed is the SCIC_POWER_CONTROL data used to controll when direct
+ * This filed is the SCIC_POWER_CONTROL data used to control when direct
* attached devices can consume power.
*/
SCIC_POWER_CONTROL_T power_control;
@@ -371,7 +371,7 @@ typedef struct SCIC_SDS_CONTROLLER
U32 next_phy_to_start;
/**
- * This field controlls the invalid link up notifications to the SCI_USER. If
+ * This field controls the invalid link up notifications to the SCI_USER. If
* an invalid_link_up notification is reported a bit for the PHY index is set
* so further notifications are not made. Once the PHY object reports link up
* and is made part of a port then this bit for the PHY index is cleared.
diff --git a/sys/dev/isci/scil/scic_sds_phy.c b/sys/dev/isci/scil/scic_sds_phy.c
index a893e29..a7755c3 100644
--- a/sys/dev/isci/scil/scic_sds_phy.c
+++ b/sys/dev/isci/scil/scic_sds_phy.c
@@ -749,7 +749,7 @@ SCI_STATUS scic_sds_phy_initialize(
this_phy, link_layer_registers
));
- // Perfrom the initialization of the TL hardware
+ // Perform the initialization of the TL hardware
scic_sds_phy_transport_layer_initialization(this_phy, transport_layer_registers);
// Perofrm the initialization of the PE hardware
@@ -1029,7 +1029,7 @@ SCI_STATUS scic_sds_phy_reset(
}
/**
- * @brief This method will process the event code recieved.
+ * @brief This method will process the event code received.
*
* @param[in] this_phy
* @param[in] event_code
@@ -1052,7 +1052,7 @@ SCI_STATUS scic_sds_phy_event_handler(
}
/**
- * @brief This method will process the frame index recieved.
+ * @brief This method will process the frame index received.
*
* @param[in] this_phy
* @param[in] frame_index
@@ -1754,7 +1754,7 @@ SCI_STATUS scic_sds_phy_default_frame_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY,
- "SCIC Phy 0x%08x recieved unexpected frame data %d while in state %d\n",
+ "SCIC Phy 0x%08x received unexpected frame data %d while in state %d\n",
this_phy, frame_index,
sci_base_state_machine_get_state(&this_phy->parent.state_machine)
));
@@ -1866,7 +1866,7 @@ SCI_STATUS scic_sds_phy_stopped_state_start_handler(
* This method takes the SCIC_SDS_PHY from a stopped state and destroys it.
* - This function takes no action.
*
- * @todo Shouldnt this function transition the SCI_BASE_PHY::state_machine to
+ * @todo Shouldn't this function transition the SCI_BASE_PHY::state_machine to
* the SCI_BASE_PHY_STATE_FINAL?
*
* @param[in] phy This is the SCI_BASE_PHY object which is cast into a
@@ -1964,7 +1964,7 @@ SCI_STATUS scic_sds_phy_ready_state_reset_handler(
* - decoded event is a link failure
* - transition the SCIC_SDS_PHY back to the SCI_BASE_PHY_STATE_STARTING
* state.
- * - any other event recived will report a warning message
+ * - any other event received will report a warning message
*
* @param[in] phy This is the SCIC_SDS_PHY object which has received the
* event.
@@ -2020,7 +2020,7 @@ SCI_STATUS scic_sds_phy_ready_state_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "SCIC PHY 0x%x ready state machine recieved unexpected event_code %x\n",
+ "SCIC PHY 0x%x ready state machine received unexpected event_code %x\n",
this_phy, event_code
));
result = SCI_FAILURE_INVALID_STATE;
@@ -2066,7 +2066,7 @@ SCI_STATUS scic_sds_phy_resetting_state_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "SCIC PHY 0x%x resetting state machine recieved unexpected event_code %x\n",
+ "SCIC PHY 0x%x resetting state machine received unexpected event_code %x\n",
this_phy, event_code
));
@@ -2691,7 +2691,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_ossp_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -2772,7 +2772,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -2834,7 +2834,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_iaf_uf_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -2879,7 +2879,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sas_power_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -2935,7 +2935,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sata_power_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -3003,7 +3003,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sata_phy_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -3090,7 +3090,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sata_speed_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -3147,7 +3147,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sig_fis_event_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
- "PHY starting substate machine recieved unexpected event_code %x\n",
+ "PHY starting substate machine received unexpected event_code %x\n",
event_code
));
@@ -3246,7 +3246,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_iaf_uf_frame_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_UNSOLICITED_FRAMES,
- "PHY starting substate machine recieved unexpected frame id %x\n",
+ "PHY starting substate machine received unexpected frame id %x\n",
frame_index
));
}
@@ -3332,7 +3332,7 @@ SCI_STATUS scic_sds_phy_starting_substate_await_sig_fis_frame_handler(
SCIC_LOG_WARNING((
sci_base_object_get_logger(this_phy),
SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_UNSOLICITED_FRAMES,
- "PHY starting substate machine recieved unexpected frame id %x\n",
+ "PHY starting substate machine received unexpected frame id %x\n",
frame_index
));
}
diff --git a/sys/dev/isci/scil/scic_sds_phy_registers.h b/sys/dev/isci/scil/scic_sds_phy_registers.h
index 14a6be5..24ed608 100644
--- a/sys/dev/isci/scil/scic_sds_phy_registers.h
+++ b/sys/dev/isci/scil/scic_sds_phy_registers.h
@@ -241,7 +241,7 @@ extern "C" {
#define SCU_SAS_PHYCAP_WRITE(phy, value) \
scu_link_layer_register_write(phy, phy_capabilities, value)
-/// This macro reads the Recieved PHY Capacity register
+/// This macro reads the Received PHY Capacity register
#define SCU_SAS_RECPHYCAP_READ(phy) \
scu_link_layer_register_read(phy, receive_phycap)
diff --git a/sys/dev/isci/scil/scic_sds_port.c b/sys/dev/isci/scil/scic_sds_port.c
index 59940f0..42993a3 100644
--- a/sys/dev/isci/scil/scic_sds_port.c
+++ b/sys/dev/isci/scil/scic_sds_port.c
@@ -584,7 +584,7 @@ void scic_sds_port_get_attached_protocols(
}
/**
- * @brief This method returns the amount of memory requred for a port
+ * @brief This method returns the amount of memory required for a port
* object.
*
* @return U32
@@ -3013,7 +3013,7 @@ SCI_STATUS scic_sds_port_ready_waiting_substate_start_io_handler(
//****************************************************************************
/**
- * This method will casue the port to reset.
+ * This method will cause the port to reset.
*
* @param[in] port This is the SCI_BASE_PORT object which is cast into a
* SCIC_SDS_PORT object.
diff --git a/sys/dev/isci/scil/scic_sds_port.h b/sys/dev/isci/scil/scic_sds_port.h
index b07997b..321f667 100644
--- a/sys/dev/isci/scil/scic_sds_port.h
+++ b/sys/dev/isci/scil/scic_sds_port.h
@@ -214,7 +214,7 @@ typedef struct SCIC_SDS_PORT
SCU_PORT_PE_CONFIGURATION_REGISTER_T *port_pe_configuration_register;
/**
- * This field is the VIIT register space for ths port object.
+ * This field is the VIIT register space for this port object.
*/
SCU_VIIT_ENTRY_T *viit_registers;
diff --git a/sys/dev/isci/scil/scic_sds_port_configuration_agent.c b/sys/dev/isci/scil/scic_sds_port_configuration_agent.c
index a6f66a3..95e442f 100644
--- a/sys/dev/isci/scil/scic_sds_port_configuration_agent.c
+++ b/sys/dev/isci/scil/scic_sds_port_configuration_agent.c
@@ -772,7 +772,7 @@ void scic_sds_apc_agent_configure_ports(
// Check to see if the start timer operations should instead map to an
// add phy operation. This is caused because we have been waiting to
- // add a phy to a port but could not becuase the automatic port
+ // add a phy to a port but could not because the automatic port
// configuration engine had a choice of possible ports for the phy.
// Since we have gone through a timeout we are going to restrict the
// choice to the smallest possible port.
@@ -849,7 +849,7 @@ void scic_sds_apc_agent_link_up(
//the phy is already the part of the port
//if the PORT'S state is resetting then the link up is from port hard reset
- //in this case, we need to tell the port that link up is recieved
+ //in this case, we need to tell the port that link up is received
if ( SCI_BASE_PORT_STATE_RESETTING
== port->parent.state_machine.current_state_id
)
diff --git a/sys/dev/isci/scil/scic_sds_remote_device.c b/sys/dev/isci/scil/scic_sds_remote_device.c
index e683630..efc2f18 100644
--- a/sys/dev/isci/scil/scic_sds_remote_device.c
+++ b/sys/dev/isci/scil/scic_sds_remote_device.c
@@ -2375,7 +2375,7 @@ SCIC_SDS_REMOTE_DEVICE_STATE_HANDLER_T
/**
* This is the enter method for the SCI_BASE_REMOTE_DEVICE_STATE_INITIAL it
- * immediatly transitions the remote device object to the stopped state.
+ * immediately transitions the remote device object to the stopped state.
*
* @param[in] object This is the SCI_BASE_OBJECT that is cast into a
* SCIC_SDS_REMOTE_DEVICE.
diff --git a/sys/dev/isci/scil/scic_sds_remote_node_context.c b/sys/dev/isci/scil/scic_sds_remote_node_context.c
index c2ec1c2..473b476 100644
--- a/sys/dev/isci/scil/scic_sds_remote_node_context.c
+++ b/sys/dev/isci/scil/scic_sds_remote_node_context.c
@@ -302,7 +302,7 @@ void scic_sds_remote_node_context_setup_to_resume(
/**
* This method will setup the remote node context object so it will
-* transistion to its final state.
+* transition to its final state.
*
* @param[in] this_rnc
* @param[in] the_callback
diff --git a/sys/dev/isci/scil/scic_sds_remote_node_table.c b/sys/dev/isci/scil/scic_sds_remote_node_table.c
index d159f27..2c287bd 100644
--- a/sys/dev/isci/scil/scic_sds_remote_node_table.c
+++ b/sys/dev/isci/scil/scic_sds_remote_node_table.c
@@ -138,7 +138,7 @@ void scic_sds_remote_node_table_clear_group_index(
}
/**
- * This method will set the group index bit entry in the specified gropu index
+ * This method will set the group index bit entry in the specified group index
* table.
*
* @param[in out] remote_node_table This the remote node table in which to set
diff --git a/sys/dev/isci/scil/scic_sds_request.c b/sys/dev/isci/scil/scic_sds_request.c
index f126e58..3e85785 100644
--- a/sys/dev/isci/scil/scic_sds_request.c
+++ b/sys/dev/isci/scil/scic_sds_request.c
@@ -94,7 +94,7 @@ __FBSDID("$FreeBSD$");
/**
* @struct SCI_SINGLE_LEVEL_LUN
*
-* @brief this struct decribes the single level LUN structure
+* @brief this struct describes the single level LUN structure
* as per the SAM 4.
*/
typedef struct SCI_SINGLE_LEVEL_LUN
@@ -842,7 +842,7 @@ void scic_sds_ssp_task_request_assign_buffers(
* -# task_type == SCU_TASK_TYPE_IOREAD. This simply indicates
* that a normal request type (i.e. non-raw frame) is being
* utilized to perform task management.
- * -# control_frame == 1. This ensures that the proper endianess
+ * -# control_frame == 1. This ensures that the proper endianness
* is set so that the bytes are transmitted in the right order
* for a task frame.
*
@@ -2116,7 +2116,7 @@ SCI_STATUS scic_sds_request_started_state_abort_handler(
* @param[in] this_request This parameter specifies the request for which
* a completion occurred.
* @param[in] completion_code This parameter specifies the completion code
- * recieved from the SCU.
+ * received from the SCU.
*
* @return none
*/
@@ -2706,7 +2706,7 @@ void scic_sds_request_constructed_state_enter(
* SCSI Task request we must enter the started substate machine.
*
* @param[in] object This parameter specifies the base object for which the
- * state transition is occuring. This is cast into a
+ * state transition is occurring. This is cast into a
* SCIC_SDS_IO_REQUEST object.
*
* @return none
@@ -2736,7 +2736,7 @@ void scic_sds_request_started_state_enter(
* to stop the started substate machine.
*
* @param[in] object This parameter specifies the base object for which the
- * state transition is occuring. This object is cast into a
+ * state transition is occurring. This object is cast into a
* SCIC_SDS_IO_REQUEST object.
*
* @return none
@@ -2760,7 +2760,7 @@ void scic_sds_request_started_state_exit(
* completion callback function.
*
* @param[in] object This parameter specifies the base object for which the
- * state transition is occuring. This object is cast into a
+ * state transition is occurring. This object is cast into a
* SCIC_SDS_IO_REQUEST object.
*
* @return none
@@ -2804,7 +2804,7 @@ void scic_sds_request_completed_state_enter(
* SCI_BASE_REQUEST_STATE_ABORTING state.
*
* @param[in] object This parameter specifies the base object for which the
- * state transition is occuring. This object is cast into a
+ * state transition is occurring. This object is cast into a
* SCIC_SDS_IO_REQUEST object.
*
* @return none
@@ -2832,7 +2832,7 @@ void scic_sds_request_aborting_state_enter(
* state handlers in place.
*
* @param[in] object This parameter specifies the base object for which the
- * state transition is occuring. This is cast into a
+ * state transition is occurring. This is cast into a
* SCIC_SDS_IO_REQUEST object.
*
* @return none
diff --git a/sys/dev/isci/scil/scic_sds_smp_request.c b/sys/dev/isci/scil/scic_sds_smp_request.c
index d6990e5..ea92782 100644
--- a/sys/dev/isci/scil/scic_sds_smp_request.c
+++ b/sys/dev/isci/scil/scic_sds_smp_request.c
@@ -352,7 +352,7 @@ SCI_STATUS scic_io_request_construct_smp_pass_through(
* -# task_type == SCU_TASK_TYPE_SMP. This simply indicates
* that a normal request type (i.e. non-raw frame) is being
* utilized to perform task management.
- * -# control_frame == 1. This ensures that the proper endianess
+ * -# control_frame == 1. This ensures that the proper endianness
* is set so that the bytes are transmitted in the right order
* for a smp request frame.
*
@@ -811,7 +811,7 @@ scic_sds_smp_request_started_substate_handler_table
* sub-state.
*
* @param[in] object This parameter specifies the request object for which
- * the sub-state change is occuring.
+ * the sub-state change is occurring.
*
* @return none.
*/
@@ -836,7 +836,7 @@ void scic_sds_smp_request_started_await_response_substate_enter(
* this sub-state.
*
* @param[in] object This parameter specifies the request object for which
- * the sub-state change is occuring.
+ * the sub-state change is occurring.
*
* @return none.
*/
diff --git a/sys/dev/isci/scil/scic_sds_ssp_request.c b/sys/dev/isci/scil/scic_sds_ssp_request.c
index 086f479..c7a67ac 100644
--- a/sys/dev/isci/scil/scic_sds_ssp_request.c
+++ b/sys/dev/isci/scil/scic_sds_ssp_request.c
@@ -279,7 +279,7 @@ scic_sds_ssp_task_request_started_substate_handler_table
* for this sub-state.
*
* @param[in] object This parameter specifies the request object for which
- * the sub-state change is occuring.
+ * the sub-state change is occurring.
*
* @return none.
*/
@@ -304,7 +304,7 @@ void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_enter(
* sub-state.
*
* @param[in] object This parameter specifies the request object for which
- * the sub-state change is occuring.
+ * the sub-state change is occurring.
*
* @return none.
*/
diff --git a/sys/dev/isci/scil/scic_sds_stp_packet_request.c b/sys/dev/isci/scil/scic_sds_stp_packet_request.c
index b29a4e8..42a7497 100644
--- a/sys/dev/isci/scil/scic_sds_stp_packet_request.c
+++ b/sys/dev/isci/scil/scic_sds_stp_packet_request.c
@@ -124,7 +124,7 @@ SCI_STATUS scic_sds_stp_packet_request_construct(
* -# task_type == SCU_TASK_TYPE_PACKET_DMA. This simply indicates
* that a normal request type (i.e. non-raw frame) is being
* utilized to perform task management.
- * -# control_frame == 1. This ensures that the proper endianess
+ * -# control_frame == 1. This ensures that the proper endianness
* is set so that the bytes are transmitted in the right order
* for a smp request frame.
*
@@ -454,7 +454,7 @@ SCI_STATUS scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_handle
* @brief This method processes the completions transport layer (TL) status
* to determine if the PACKET command data FIS was sent successfully.
* If successfully, then the state for the packet request
- * transits to COMPLETE state. If not successfuly, the request transits
+ * transits to COMPLETE state. If not successfully, the request transits
* to COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE.
*
* @param[in] this_request This parameter specifies the request for which
diff --git a/sys/dev/isci/scil/scic_sds_stp_remote_device.c b/sys/dev/isci/scil/scic_sds_stp_remote_device.c
index 49511c9..8eb511f 100644
--- a/sys/dev/isci/scil/scic_sds_stp_remote_device.c
+++ b/sys/dev/isci/scil/scic_sds_stp_remote_device.c
@@ -424,7 +424,7 @@ SCI_STATUS scic_sds_stp_remote_device_ready_ncq_substate_event_handler(
this_device, event_code, sci_base_state_machine_get_state(&this_device->ready_substate_machine)
));
- // Since we didnt expect to get here start the device again.
+ // Since we didn't expect to get here start the device again.
status = scic_sds_remote_device_resume(this_device);
break;
diff --git a/sys/dev/isci/scil/scic_sds_stp_request.c b/sys/dev/isci/scil/scic_sds_stp_request.c
index f3fe28d..5a2612c 100644
--- a/sys/dev/isci/scil/scic_sds_stp_request.c
+++ b/sys/dev/isci/scil/scic_sds_stp_request.c
@@ -337,7 +337,7 @@ void scu_sata_reqeust_construct_task_context(
// Copy the physical address for the command buffer to the SCU Task Context
// We must offset the command buffer by 4 bytes because the first 4 bytes are
- // transfered in the body of the TC
+ // transferred in the body of the TC
scic_cb_io_request_get_physical_address(
scic_sds_request_get_controller(this_request),
this_request,
@@ -398,7 +398,7 @@ void scic_sds_stp_optimized_request_construct(
// Build the STP task context structure
scu_sata_reqeust_construct_task_context(this_request, task_context);
- // Copy over the number of bytes to be transfered
+ // Copy over the number of bytes to be transferred
task_context->transfer_length_bytes = transfer_length;
if ( data_direction == SCI_IO_REQUEST_DATA_OUT )
@@ -1267,7 +1267,7 @@ SCI_STATUS scic_sds_stp_request_pio_data_in_copy_data(
}
else
{
- // We are transfering the whole frame so copy
+ // We are transferring the whole frame so copy
status = scic_sds_stp_request_pio_data_in_copy_data_buffer(
this_request, data_buffer, SCU_MAX_FRAME_BUFFER_SIZE);
@@ -1667,7 +1667,7 @@ SCI_STATUS scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_c
}
else if (this_scic_sds_stp_request->type.pio.pio_transfer_bytes == 0)
{
- //this will happen if the all data is written at the first time after the pio setup fis is recieved
+ //this will happen if the all data is written at the first time after the pio setup fis is received
all_frames_transferred = TRUE;
}
diff --git a/sys/dev/isci/scil/scic_sds_stp_request.h b/sys/dev/isci/scil/scic_sds_stp_request.h
index 20b53ab..5d57acf 100644
--- a/sys/dev/isci/scil/scic_sds_stp_request.h
+++ b/sys/dev/isci/scil/scic_sds_stp_request.h
@@ -83,7 +83,7 @@ typedef struct SCIC_SDS_STP_REQUEST
struct
{
/**
- * Total transfer for the entire PIO request recorded at request constuction
+ * Total transfer for the entire PIO request recorded at request construction
* time.
*
* @todo Should we just decrement this value for each byte of data transitted
diff --git a/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c b/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c
index 2c79b77..f3fd91a 100644
--- a/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c
+++ b/sys/dev/isci/scil/scic_sds_unsolicited_frame_control.c
@@ -279,7 +279,7 @@ SCI_STATUS scic_sds_unsolicited_frame_control_get_header(
{
if (frame_index < uf_control->address_table.count)
{
- // Skip the first word in the frame since this is a controll word used
+ // Skip the first word in the frame since this is a control word used
// by the hardware.
*frame_header = &uf_control->buffers.array[frame_index].header->data;
diff --git a/sys/dev/isci/scil/scic_task_request.h b/sys/dev/isci/scil/scic_task_request.h
index 41f57fc..0b93972 100644
--- a/sys/dev/isci/scil/scic_task_request.h
+++ b/sys/dev/isci/scil/scic_task_request.h
@@ -73,7 +73,7 @@ extern "C" {
/**
* @brief This method simply returns the size required to build an SCI
- * based task managment request object.
+ * based task management request object.
*
* @return Return the size of the SCIC task request object.
*/
diff --git a/sys/dev/isci/scil/scic_user_callback.h b/sys/dev/isci/scil/scic_user_callback.h
index c8f2bdc..3f75c78 100644
--- a/sys/dev/isci/scil/scic_user_callback.h
+++ b/sys/dev/isci/scil/scic_user_callback.h
@@ -96,7 +96,7 @@ void * scic_cb_timer_create(
);
/**
- * @brief This callback method asks the user to destory the supplied timer.
+ * @brief This callback method asks the user to destroy the supplied timer.
*
* @param[in] controller This parameter specifies the controller with
* which this timer is to associated.
@@ -277,7 +277,7 @@ void scic_cb_task_request_complete(
* handle.
* @param[in] io_request This parameter is the io request object handle
* for which the physical address is being requested.
- * @param[in] virtual_address This paramter is the virtual address which
+ * @param[in] virtual_address This parameter is the virtual address which
* is to be returned as a physical address.
* @param[out] physical_address The physical address for the supplied virtual
* address.
@@ -294,14 +294,14 @@ void scic_cb_io_request_get_physical_address(
/**
* @brief This callback method asks the user to provide the number of
- * bytes to be transfered as part of this request.
+ * bytes to be transferred as part of this request.
*
* @param[in] scic_user_io_request This parameter points to the user's
* IO request object. It is a cookie that allows the user to
* provide the necessary information for this callback.
*
* @return This method returns the number of payload data bytes to be
- * transfered for this IO request.
+ * transferred for this IO request.
*/
U32 scic_cb_io_request_get_transfer_length(
void * scic_user_io_request
@@ -1117,7 +1117,7 @@ void scic_cb_controller_error(
* the CDB address.
* @param[in] scic_user_io_request
*
- * @return The cdb adress.
+ * @return The cdb address.
*/
void * scic_cb_stp_packet_io_request_get_cdb_address(
void * scic_user_io_request
diff --git a/sys/dev/isci/scil/scif_config_parameters.h b/sys/dev/isci/scil/scif_config_parameters.h
index 71965fd..d5d15bf 100644
--- a/sys/dev/isci/scil/scif_config_parameters.h
+++ b/sys/dev/isci/scil/scif_config_parameters.h
@@ -116,7 +116,7 @@ typedef struct SCIF_SAS_USER_PARAMETERS
/**
* This field indicates the os/user recommends ignoring fua in translation
- * for perfromance reasons.
+ * for performance reasons.
*/
BOOL ignore_fua;
diff --git a/sys/dev/isci/scil/scif_domain.h b/sys/dev/isci/scil/scif_domain.h
index ee639c8..73ca775 100644
--- a/sys/dev/isci/scil/scif_domain.h
+++ b/sys/dev/isci/scil/scif_domain.h
@@ -87,7 +87,7 @@ SCI_PORT_HANDLE_T scif_domain_get_scic_port_handle(
);
/**
- * @brief This method will find and retreive the device associated with the
+ * @brief This method will find and retrieve the device associated with the
* supplied SAS address if such a device exists.
*
* @param[in] domain This parameter specifies the framework domain object
diff --git a/sys/dev/isci/scil/scif_io_request.h b/sys/dev/isci/scil/scif_io_request.h
index 41647d1..69d86ee 100644
--- a/sys/dev/isci/scil/scif_io_request.h
+++ b/sys/dev/isci/scil/scif_io_request.h
@@ -81,13 +81,13 @@ U32 scif_io_request_get_object_size(
);
/**
-* @brief This method simply the number of data bytes transfered for a
+* @brief This method simply the number of data bytes transferred for a
* STP or SSP io request.
*
* @param[in] scif_io_request This parameter specifies the framework IO
* handle to retrieve the number of data bytes transferred.
*
-* @return Return the number of data bytes transfered by the io request
+* @return Return the number of data bytes transferred by the io request
*/
U32 scif_io_request_get_number_of_bytes_transferred(
void * scif_io_request
diff --git a/sys/dev/isci/scil/scif_sas_design.h b/sys/dev/isci/scil/scif_sas_design.h
index 4bc2825..e847b28 100644
--- a/sys/dev/isci/scil/scif_sas_design.h
+++ b/sys/dev/isci/scil/scif_sas_design.h
@@ -331,7 +331,7 @@ Please refer to these files directly for further design information:
The SCIF SAS SMP REMOTE DEVICE object represents the expander device and fulfills
its SMP discover activities. The discover procedure includes a initial discover
-phase and a follwoing SATA spinup_hold release phase, if there are expander attached
+phase and a following SATA spinup_hold release phase, if there are expander attached
SATA device is discovered and in spinup_hold conditon. The SCIF SAS SMP REMOTE DEVICE
object also fulfills expander attached device Target Reset (Phy Control) activity.
diff --git a/sys/dev/isci/scil/scif_sas_domain.c b/sys/dev/isci/scil/scif_sas_domain.c
index 8261e55..c5a54fa 100644
--- a/sys/dev/isci/scil/scif_sas_domain.c
+++ b/sys/dev/isci/scil/scif_sas_domain.c
@@ -642,7 +642,7 @@ void scif_sas_domain_terminate_requests(
while (element != NULL)
{
request = (SCIF_SAS_REQUEST_T*) sci_fast_list_get_object(element);
- // The current element may be deleted from the list becasue of
+ // The current element may be deleted from the list because of
// IO completion so advance to the next element early
element = sci_fast_list_get_next(element);
@@ -1280,7 +1280,7 @@ U8 scif_sas_domain_get_smp_request_count(
while (element != NULL)
{
request = (SCIF_SAS_REQUEST_T*) sci_fast_list_get_object(element);
- // The current element may be deleted from the list becasue of
+ // The current element may be deleted from the list because of
// IO completion so advance to the next element early
element = sci_fast_list_get_next(element);
@@ -1427,7 +1427,7 @@ SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_next_ea_target_reset(
fw_domain
));
- //search throught domain's device list to find the first sata device on spinup_hold
+ //search through domain's device list to find the first sata device on spinup_hold
current_element = sci_abstract_list_get_front(&fw_domain->remote_device_list);
while (current_element != NULL )
{
diff --git a/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c b/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c
index f13166e..9f6bb4a 100644
--- a/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c
+++ b/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c
@@ -245,7 +245,7 @@ void scif_sas_remote_device_ready_ncq_error_substate_enter(
pending_request =
(SCIF_SAS_REQUEST_T*) sci_fast_list_get_object(pending_request_element);
- // The current element may be deleted from the list becasue of
+ // The current element may be deleted from the list because of
// IO completion so advance to the next element early
pending_request_element = sci_fast_list_get_next(pending_request_element);
diff --git a/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c b/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c
index 2a3b9bd..dc6aa4e 100644
--- a/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c
+++ b/sys/dev/isci/scil/scif_sas_remote_device_state_handlers.c
@@ -668,7 +668,7 @@ SCI_STATUS scif_sas_remote_device_default_complete_task_handler(
* such a notification isn't supported.
*
* @param[in] remote_device This parameter specifies the remote device object
- * for which the completion notification has occured.
+ * for which the completion notification has occurred.
* @param[in] completion_status This parameter specifies the status
* of the completion operation.
*
@@ -694,7 +694,7 @@ void scif_sas_remote_device_default_start_complete_handler(
* such a notification isn't supported.
*
* @param[in] remote_device This parameter specifies the remote device object
- * for which the completion notification has occured.
+ * for which the completion notification has occurred.
* @param[in] completion_status This parameter specifies the status
* of the completion operation.
*
@@ -720,7 +720,7 @@ void scif_sas_remote_device_default_stop_complete_handler(
* notification isn't supported.
*
* @param[in] remote_device This parameter specifies the remote device object
- * for which the notification has occured.
+ * for which the notification has occurred.
*
* @return none.
*/
@@ -743,7 +743,7 @@ void scif_sas_remote_device_default_ready_handler(
* notification isn't supported.
*
* @param[in] remote_device This parameter specifies the remote device object
- * for which the notification has occured.
+ * for which the notification has occurred.
*
* @return none.
*/
diff --git a/sys/dev/isci/scil/scif_sas_stp_remote_device.c b/sys/dev/isci/scil/scif_sas_stp_remote_device.c
index 22e5c3c..2ead304 100644
--- a/sys/dev/isci/scil/scif_sas_stp_remote_device.c
+++ b/sys/dev/isci/scil/scif_sas_stp_remote_device.c
@@ -197,7 +197,7 @@ scif_sas_stp_remote_device_get_request_by_ncq_tag(
pending_request =
(SCIF_SAS_REQUEST_T*) sci_fast_list_get_object(pending_request_element);
- // The current element may be deleted from the list becasue of
+ // The current element may be deleted from the list because of
// IO completion so advance to the next element early
pending_request_element = sci_fast_list_get_next(pending_request_element);
diff --git a/sys/dev/isci/scil/scif_sas_stp_task_request.c b/sys/dev/isci/scil/scif_sas_stp_task_request.c
index 0a9f953..e7680d6 100644
--- a/sys/dev/isci/scil/scif_sas_stp_task_request.c
+++ b/sys/dev/isci/scil/scif_sas_stp_task_request.c
@@ -227,7 +227,7 @@ void scif_sas_stp_task_request_abort_task_set_failure_handler(
pending_request =
(SCIF_SAS_REQUEST_T*) sci_fast_list_get_object(pending_request_element);
- // The current element may be deleted from the list becasue of
+ // The current element may be deleted from the list because of
// IO completion so advance to the next element early
pending_request_element = sci_fast_list_get_next(pending_request_element);
diff --git a/sys/dev/isci/scil/scif_user_callback.h b/sys/dev/isci/scil/scif_user_callback.h
index 5478495..70ef235a 100644
--- a/sys/dev/isci/scil/scif_user_callback.h
+++ b/sys/dev/isci/scil/scif_user_callback.h
@@ -100,7 +100,7 @@ void * scif_cb_timer_create(
);
/**
- * @brief This callback method asks the user to destory the supplied timer.
+ * @brief This callback method asks the user to destroy the supplied timer.
*
* @param[in] controller This parameter specifies the controller with
* which this timer is to associated.
@@ -371,14 +371,14 @@ void scif_cb_task_request_complete(
/**
* @brief This callback method asks the user to provide the number of
- * bytes to be transfered as part of this request.
+ * bytes to be transferred as part of this request.
*
* @param[in] scif_user_io_request This parameter points to the user's
* IO request object. It is a cookie that allows the user to
* provide the necessary information for this callback.
*
* @return This method returns the number of payload data bytes to be
- * transfered for this IO request.
+ * transferred for this IO request.
*/
U32 scif_cb_io_request_get_transfer_length(
void * scif_user_io_request
diff --git a/sys/dev/isci/scil/scu_registers.h b/sys/dev/isci/scil/scu_registers.h
index 8157c1a..a72c629 100644
--- a/sys/dev/isci/scil/scu_registers.h
+++ b/sys/dev/isci/scil/scu_registers.h
@@ -913,13 +913,13 @@ typedef char LEX_REGISTERS_T;
// To calculate the offset for other functions use
// BAR0 + FN# * SystemPageSize * 2
//
-// The TCA is only accessable from FN#0 (Physical Function) and each
+// The TCA is only accessible from FN#0 (Physical Function) and each
// is programmed by (BAR0 + SCU_SMU_TCA_OFFSET + (FN# * 0x04)) or
// TCA0 for FN#0 is at BAR0 + 0x0400
// TCA1 for FN#1 is at BAR0 + 0x0404
// etc.
// ----------------------------------------------------------------------------
-// Accessable to all FN#s
+// Accessible to all FN#s
#define SCU_SMU_PCP_OFFSET 0x0000
#define SCU_SMU_AMR_OFFSET 0x0004
#define SCU_SMU_ISR_OFFSET 0x0010
@@ -933,7 +933,7 @@ typedef char LEX_REGISTERS_T;
#define SCU_SMU_CQPR_OFFSET 0x0040
#define SCU_SMU_CQGR_OFFSET 0x0044
#define SCU_SMU_CQC_OFFSET 0x0048
-// Accessable to FN#0 only
+// Accessible to FN#0 only
#define SCU_SMU_RNCLBAR_OFFSET 0x0080
#define SCU_SMU_RNCUBAR_OFFSET 0x0084
#define SCU_SMU_DCC_OFFSET 0x0090
@@ -942,9 +942,9 @@ typedef char LEX_REGISTERS_T;
#define SCU_SMU_SCUSRCR_OFFSET 0x009C
#define SCU_SMU_SMAW_OFFSET 0x00A0
#define SCU_SMU_SMDW_OFFSET 0x00A4
-// Accessable to FN#0 only
+// Accessible to FN#0 only
#define SCU_SMU_TCA_OFFSET 0x0400
-// Accessable to all FN#s
+// Accessible to all FN#s
#define SCU_SMU_MT_MLAR0_OFFSET 0x2000
#define SCU_SMU_MT_MUAR0_OFFSET 0x2004
#define SCU_SMU_MT_MDR0_OFFSET 0x2008
@@ -999,7 +999,7 @@ typedef struct SMU_REGISTERS
U32 reserved_5x[4];
U32 reserved_6x[4];
U32 reserved_7x[4];
-// Accessable to FN#0 only
+// Accessible to FN#0 only
// 0x0080 RNCLBAR
U32 remote_node_context_lower;
// 0x0084 RNCUBAR
@@ -1031,7 +1031,7 @@ typedef struct SMU_REGISTERS
U32 reserved_1xx[64];
U32 reserved_2xx[64];
U32 reserved_3xx[64];
-// Accessable to FN#0 only
+// Accessible to FN#0 only
// 0x0400 TCA
U32 task_context_assignment[256];
// MSI-X registers not included
diff --git a/sys/dev/isci/scil/scu_task_context.h b/sys/dev/isci/scil/scu_task_context.h
index f73ce64..39a6396 100644
--- a/sys/dev/isci/scil/scu_task_context.h
+++ b/sys/dev/isci/scil/scu_task_context.h
@@ -172,7 +172,7 @@ typedef enum
#define SCU_TASK_REGULAR 0
#define SCU_TASK_ABORTED 1
-//direction bit defintion
+//direction bit definition
/**
* @name SATA_DIRECTION
*/
@@ -483,7 +483,7 @@ typedef struct SCU_SGL_ELEMENT
* @brief This structure is the SCU hardware definition of a pair of SGL
* elements.
*
- * The SCU hardware always works on SGL pairs. They are refered to in the DS
+ * The SCU hardware always works on SGL pairs. They are referred to in the DS
* specification as SGL A and SGL B. Each SGL pair is followed by the address
* of the next pair.
*/
@@ -706,7 +706,7 @@ typedef struct SCU_TASK_CONTEXT
U32 strict_ordering : 1;
/**
- * This field indicates the type of endianess to be utilized for the
+ * This field indicates the type of endianness to be utilized for the
* frame. command, task, and response frames utilized control_frame
* set to 1.
*/
@@ -793,7 +793,7 @@ typedef struct SCU_TASK_CONTEXT
// OFFSET 0x14
/**
- * This filed is set to the number of bytes to be transfered in the request.
+ * This filed is set to the number of bytes to be transferred in the request.
*/
U32 transfer_length_bytes : 24; // In terms of bytes
@@ -804,7 +804,7 @@ typedef struct SCU_TASK_CONTEXT
// OFFSET 0x18-0x2C
/**
- * This union provides for the protocol specif part of the SCU Task Context.
+ * This union provides for the protocol specific part of the SCU Task Context.
*/
union PROTOCOL_CONTEXT type;
diff --git a/sys/dev/iscsi_initiator/isc_cam.c b/sys/dev/iscsi_initiator/isc_cam.c
index e53a0fb..02ed91a 100644
--- a/sys/dev/iscsi_initiator/isc_cam.c
+++ b/sys/dev/iscsi_initiator/isc_cam.c
@@ -227,7 +227,7 @@ ic_action(struct cam_sim *sim, union ccb *ccb)
if(ccg->block_size == 0 ||
(ccg->volume_size < ccg->block_size)) {
// print error message ...
- /* XXX: what error is appropiate? */
+ /* XXX: what error is appropriate? */
break;
}
else {
diff --git a/sys/dev/iscsi_initiator/isc_soc.c b/sys/dev/iscsi_initiator/isc_soc.c
index adb9914..2282677 100644
--- a/sys/dev/iscsi_initiator/isc_soc.c
+++ b/sys/dev/iscsi_initiator/isc_soc.c
@@ -222,7 +222,7 @@ isc_sendPDU(isc_session_t *sp, pduq_t *pq)
if(pq->pdu.ds_addr && pp->ds_len) {
iv->iov_base = pp->ds_addr;
iv->iov_len = pp->ds_len;
- while(iv->iov_len & 03) // the specs say it must be int alligned
+ while(iv->iov_len & 03) // the specs say it must be int aligned
iv->iov_len++;
uio->uio_resid += iv->iov_len ;
iv++;
diff --git a/sys/dev/iscsi_initiator/iscsi.c b/sys/dev/iscsi_initiator/iscsi.c
index 99f727e..e607f18 100644
--- a/sys/dev/iscsi_initiator/iscsi.c
+++ b/sys/dev/iscsi_initiator/iscsi.c
@@ -150,7 +150,7 @@ iscsi_close(struct cdev *dev, int flag, int otyp, struct thread *td)
sdebug(3, "sp->flags=%x", sp->flags );
/*
| if still in full phase, this probably means
- | that something went realy bad.
+ | that something went really bad.
| it could be a result from 'shutdown', in which case
| we will ignore it (so buffers can be flushed).
| the problem is that there is no way of differentiating
diff --git a/sys/dev/isp/DriverManual.txt b/sys/dev/isp/DriverManual.txt
index 3d2f0fc..ded4f3a 100644
--- a/sys/dev/isp/DriverManual.txt
+++ b/sys/dev/isp/DriverManual.txt
@@ -69,7 +69,7 @@ are planned.
3. Driver Design Goals
The driver has not started out as one normally would do such an effort.
-Normally you design via top-down methodologies and set an intial goal
+Normally you design via top-down methodologies and set an initial goal
and meet it. This driver has had a design goal that changes from almost
the very first. This has been an extremely peculiar, if not risque,
experience. As a consequence, this section of this document contains
@@ -127,7 +127,7 @@ means that at the same host visible address if you write a mailbox
register, that is a write to an (incoming, to the HBA) mailbox register,
while a read to the same address reads another (outgoing, to the HBA)
mailbox register with completely different data. Each HBA also then has
-core and auxillary logic which either is used to interface to a SCSI bus
+core and auxiliary logic which either is used to interface to a SCSI bus
(or to external bus drivers that connect to a SCSI bus), or to connect
to a Fibre Channel bus.
@@ -310,7 +310,7 @@ queues (as well as a Fibre Channel scratch area if this is a Fibre
Channel HBA). The reason this is considered 'bus dependent' is that
only the bus dependent module may have the information that says how
one could perform I/O mapping and dependent (e.g., on a Solaris system)
-on the Request and Reponse queues. Another callback can enable the *use*
+on the Request and Response queues. Another callback can enable the *use*
of interrupts should this platform be able to finish configuration in
interrupt driven mode.
@@ -325,7 +325,7 @@ here in clarifying some of this.
5.4 Initiator Mode Command Code Flow
-A succesful execution of isp_init will lead to the driver 'registering'
+A successful execution of isp_init will lead to the driver 'registering'
itself with this platform's SCSI subsystem. One assumed action for this
is the registry of a function that the SCSI subsystem for this platform
will call when it has a SCSI command to run.
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index ceb54ed..ff1d29f 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -5871,7 +5871,7 @@ isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
}
#endif
/*
- * We've had problems with data corruption occuring on
+ * We've had problems with data corruption occurring on
* commands that complete (with no apparent error) after
* we receive a LIP. This has been observed mostly on
* Local Loop topologies. To be safe, let's just mark
@@ -6455,7 +6455,7 @@ isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp)
* isn't an error, per se.
*
* Unfortunately, some QLogic f/w writers have, in
- * some cases, ommitted to *set* status to QFULL.
+ * some cases, omitted to *set* status to QFULL.
*/
#if 0
if (*XS_STSP(xs) != SCSI_GOOD && XS_NOERR(xs)) {
diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h
index a97a04f..fe06a98 100644
--- a/sys/dev/isp/ispvar.h
+++ b/sys/dev/isp/ispvar.h
@@ -356,9 +356,9 @@ typedef struct {
* index to put it into the Database, but that's just an optimization. We mark
* the entry VALID and make sure that the target index is updated and correct.
*
- * When we get done searching the local loop, we then search similarily for
+ * When we get done searching the local loop, we then search similarly for
* a list of devices we've gotten from the fabric name controller (if we're
- * on a fabric). VALID marking is also done similarily.
+ * on a fabric). VALID marking is also done similarly.
*
* When all of this is done, we can march through the database and clean up
* any entry that is still PROBATIONAL (these represent devices which have
@@ -1040,7 +1040,7 @@ void isp_prt_endcmd(ispsoftc_t *, XS_T *);
* XS_STSP(xs) gets a pointer to the SCSI status byte ""
* XS_SNSP(xs) gets a pointer to the associate sense data
* XS_TOT_SNSLEN(xs) gets the total length of sense data storage
- * XS_CUR_SNSLEN(xs) gets the currently used lenght of sense data storage
+ * XS_CUR_SNSLEN(xs) gets the currently used length of sense data storage
* XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key
* XS_SNSASC(xs) dereferences XS_SNSP to get the current stored Additional Sense Code
* XS_SNSASCQ(xs) dereferences XS_SNSP to get the current stored Additional Sense Code Qualifier
diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c
index 55004f6..88dfc48 100644
--- a/sys/dev/iwi/if_iwi.c
+++ b/sys/dev/iwi/if_iwi.c
@@ -271,7 +271,7 @@ iwi_attach(device_t dev)
struct iwi_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint16_t val;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int i, error;
sc->sc_dev = dev;
diff --git a/sys/dev/iwi/if_iwireg.h b/sys/dev/iwi/if_iwireg.h
index bc05ad2..0e837ff 100644
--- a/sys/dev/iwi/if_iwireg.h
+++ b/sys/dev/iwi/if_iwireg.h
@@ -481,7 +481,7 @@ struct iwi_scan {
#define IWI_SCAN_TYPES 5
/* scan result codes */
-#define IWI_SCAN_COMPLETED 1 /* scan compeleted sucessfully */
+#define IWI_SCAN_COMPLETED 1 /* scan compeleted successfully */
#define IWI_SCAN_ABORTED 2 /* scan was aborted by the driver */
/* structure for command IWI_CMD_SCAN_EXT */
diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c
index 202dd98..220d5a0 100644
--- a/sys/dev/iwm/if_iwm.c
+++ b/sys/dev/iwm/if_iwm.c
@@ -166,12 +166,15 @@ const uint8_t iwm_nvm_channels[] = {
/* 2.4 GHz */
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
/* 5 GHz */
- 36, 40, 44 , 48, 52, 56, 60, 64,
+ 36, 40, 44, 48, 52, 56, 60, 64,
100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144,
149, 153, 157, 161, 165
};
#define IWM_NUM_2GHZ_CHANNELS 14
+_Static_assert(nitems(iwm_nvm_channels) <= IWM_NUM_CHANNELS,
+ "IWM_NUM_CHANNELS is too small");
+
/*
* XXX For now, there's simply a fixed set of rate table entries
* that are populated.
@@ -241,8 +244,12 @@ static int iwm_nvm_read_chunk(struct iwm_softc *, uint16_t, uint16_t,
uint16_t, uint8_t *, uint16_t *);
static int iwm_nvm_read_section(struct iwm_softc *, uint16_t, uint8_t *,
uint16_t *);
-static void iwm_init_channel_map(struct iwm_softc *,
- const uint16_t * const);
+static uint32_t iwm_eeprom_channel_flags(uint16_t);
+static void iwm_add_channel_band(struct iwm_softc *,
+ struct ieee80211_channel[], int, int *, int, int,
+ const uint8_t[]);
+static void iwm_init_channel_map(struct ieee80211com *, int, int *,
+ struct ieee80211_channel[]);
static int iwm_parse_nvm_data(struct iwm_softc *, const uint16_t *,
const uint16_t *, const uint16_t *, uint8_t,
uint8_t);
@@ -1634,6 +1641,7 @@ enum nvm_sku_bits {
* @IWM_NVM_CHANNEL_IBSS: usable as an IBSS channel
* @IWM_NVM_CHANNEL_ACTIVE: active scanning allowed
* @IWM_NVM_CHANNEL_RADAR: radar detection required
+ * XXX cannot find this (DFS) flag in iwl-nvm-parse.c
* @IWM_NVM_CHANNEL_DFS: dynamic freq selection candidate
* @IWM_NVM_CHANNEL_WIDE: 20 MHz channel okay (?)
* @IWM_NVM_CHANNEL_40MHZ: 40 MHz channel okay (?)
@@ -1653,97 +1661,90 @@ enum iwm_nvm_channel_flags {
};
/*
- * Add a channel to the net80211 channel list.
- *
- * ieee is the ieee channel number
- * ch_idx is channel index.
- * mode is the channel mode - CHAN_A, CHAN_B, CHAN_G.
- * ch_flags is the iwm channel flags.
- *
- * Return 0 on OK, < 0 on error.
+ * Translate EEPROM flags to net80211.
*/
-static int
-iwm_init_net80211_channel(struct iwm_softc *sc, int ieee, int ch_idx,
- int mode, uint16_t ch_flags)
+static uint32_t
+iwm_eeprom_channel_flags(uint16_t ch_flags)
{
- /* XXX for now, no overflow checking! */
- struct ieee80211com *ic = &sc->sc_ic;
- int is_5ghz, flags;
- struct ieee80211_channel *channel;
-
- channel = &ic->ic_channels[ic->ic_nchans++];
- channel->ic_ieee = ieee;
+ uint32_t nflags;
- is_5ghz = ch_idx >= IWM_NUM_2GHZ_CHANNELS;
- if (!is_5ghz) {
- flags = IEEE80211_CHAN_2GHZ;
- channel->ic_flags = mode;
- } else {
- flags = IEEE80211_CHAN_5GHZ;
- channel->ic_flags = mode;
+ nflags = 0;
+ if ((ch_flags & IWM_NVM_CHANNEL_ACTIVE) == 0)
+ nflags |= IEEE80211_CHAN_PASSIVE;
+ if ((ch_flags & IWM_NVM_CHANNEL_IBSS) == 0)
+ nflags |= IEEE80211_CHAN_NOADHOC;
+ if (ch_flags & IWM_NVM_CHANNEL_RADAR) {
+ nflags |= IEEE80211_CHAN_DFS;
+ /* Just in case. */
+ nflags |= IEEE80211_CHAN_NOADHOC;
}
- channel->ic_freq = ieee80211_ieee2mhz(ieee, flags);
- if (!(ch_flags & IWM_NVM_CHANNEL_ACTIVE))
- channel->ic_flags |= IEEE80211_CHAN_PASSIVE;
- return (0);
+ return (nflags);
}
static void
-iwm_init_channel_map(struct iwm_softc *sc, const uint16_t * const nvm_ch_flags)
+iwm_add_channel_band(struct iwm_softc *sc, struct ieee80211_channel chans[],
+ int maxchans, int *nchans, int ch_idx, int ch_num, const uint8_t bands[])
{
- struct ieee80211com *ic = &sc->sc_ic;
- struct iwm_nvm_data *data = &sc->sc_nvm;
- int ch_idx;
+ const uint16_t * const nvm_ch_flags = sc->sc_nvm.nvm_ch_flags;
+ uint32_t nflags;
uint16_t ch_flags;
- int hw_value;
+ uint8_t ieee;
+ int error;
- for (ch_idx = 0; ch_idx < nitems(iwm_nvm_channels); ch_idx++) {
+ for (; ch_idx < ch_num; ch_idx++) {
ch_flags = le16_to_cpup(nvm_ch_flags + ch_idx);
-
- if (ch_idx >= IWM_NUM_2GHZ_CHANNELS &&
- !data->sku_cap_band_52GHz_enable)
- ch_flags &= ~IWM_NVM_CHANNEL_VALID;
+ ieee = iwm_nvm_channels[ch_idx];
if (!(ch_flags & IWM_NVM_CHANNEL_VALID)) {
IWM_DPRINTF(sc, IWM_DEBUG_EEPROM,
"Ch. %d Flags %x [%sGHz] - No traffic\n",
- iwm_nvm_channels[ch_idx],
- ch_flags,
+ ieee, ch_flags,
(ch_idx >= IWM_NUM_2GHZ_CHANNELS) ?
"5.2" : "2.4");
continue;
}
- hw_value = iwm_nvm_channels[ch_idx];
-
- /* 5GHz? */
- if (ch_idx >= IWM_NUM_2GHZ_CHANNELS) {
- (void) iwm_init_net80211_channel(sc, hw_value,
- ch_idx,
- IEEE80211_CHAN_A,
- ch_flags);
- } else {
- (void) iwm_init_net80211_channel(sc, hw_value,
- ch_idx,
- IEEE80211_CHAN_B,
- ch_flags);
- /* If it's not channel 13, also add 11g */
- if (hw_value != 13)
- (void) iwm_init_net80211_channel(sc, hw_value,
- ch_idx,
- IEEE80211_CHAN_G,
- ch_flags);
- }
+ nflags = iwm_eeprom_channel_flags(ch_flags);
+ error = ieee80211_add_channel(chans, maxchans, nchans,
+ ieee, 0, 0, nflags, bands);
+ if (error != 0)
+ break;
IWM_DPRINTF(sc, IWM_DEBUG_EEPROM,
"Ch. %d Flags %x [%sGHz] - Added\n",
- iwm_nvm_channels[ch_idx],
- ch_flags,
+ ieee, ch_flags,
(ch_idx >= IWM_NUM_2GHZ_CHANNELS) ?
"5.2" : "2.4");
}
- ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans);
+}
+
+static void
+iwm_init_channel_map(struct ieee80211com *ic, int maxchans, int *nchans,
+ struct ieee80211_channel chans[])
+{
+ struct iwm_softc *sc = ic->ic_softc;
+ struct iwm_nvm_data *data = &sc->sc_nvm;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+
+ memset(bands, 0, sizeof(bands));
+ /* 1-13: 11b/g channels. */
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ iwm_add_channel_band(sc, chans, maxchans, nchans, 0,
+ IWM_NUM_2GHZ_CHANNELS - 1, bands);
+
+ /* 14: 11b channel only. */
+ clrbit(bands, IEEE80211_MODE_11G);
+ iwm_add_channel_band(sc, chans, maxchans, nchans,
+ IWM_NUM_2GHZ_CHANNELS - 1, IWM_NUM_2GHZ_CHANNELS, bands);
+
+ if (data->sku_cap_band_52GHz_enable) {
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11A);
+ iwm_add_channel_band(sc, chans, maxchans, nchans,
+ IWM_NUM_2GHZ_CHANNELS, nitems(iwm_nvm_channels), bands);
+ }
}
static int
@@ -1792,7 +1793,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
data->hw_addr[4] = hw_addr[5];
data->hw_addr[5] = hw_addr[4];
- iwm_init_channel_map(sc, &nvm_sw[IWM_NVM_CHANNELS]);
+ memcpy(data->nvm_ch_flags, &nvm_sw[IWM_NVM_CHANNELS],
+ sizeof(data->nvm_ch_flags));
data->calib_version = 255; /* TODO:
this value will prevent some checks from
failing, we need to check if this
@@ -2572,9 +2574,7 @@ iwm_tx_rateidx_lookup(struct iwm_softc *sc, struct iwm_node *in,
}
/*
- * Fill in various bit for management frames, and leave them
- * unfilled for data frames (firmware takes care of that).
- * Return the selected TX rate.
+ * Fill in the rate related information for a transmit command.
*/
static const struct iwm_rate *
iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in,
@@ -2606,28 +2606,28 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in,
IWM_DPRINTF(sc, IWM_DEBUG_XMIT | IWM_DEBUG_TXRATE,
"%s: start with i=%d, txrate %d\n",
__func__, i, iwm_rates[ridx].rate);
- /* XXX no rate_n_flags? */
- return &iwm_rates[ridx];
- }
-
- /*
- * For non-data, use the lowest supported rate for the given
- * operational mode.
- *
- * Note: there may not be any rate control information available.
- * This driver currently assumes if we're transmitting data
- * frames, use the rate control table. Grr.
- *
- * XXX TODO: use the configured rate for the traffic type!
- */
- if (ic->ic_curmode == IEEE80211_MODE_11A) {
+ } else {
/*
- * XXX this assumes the mode is either 11a or not 11a;
- * definitely won't work for 11n.
+ * For non-data, use the lowest supported rate for the given
+ * operational mode.
+ *
+ * Note: there may not be any rate control information available.
+ * This driver currently assumes if we're transmitting data
+ * frames, use the rate control table. Grr.
+ *
+ * XXX TODO: use the configured rate for the traffic type!
+ * XXX TODO: this should be per-vap, not curmode; as we later
+ * on we'll want to handle off-channel stuff (eg TDLS).
*/
- ridx = IWM_RIDX_OFDM;
- } else {
- ridx = IWM_RIDX_CCK;
+ if (ic->ic_curmode == IEEE80211_MODE_11A) {
+ /*
+ * XXX this assumes the mode is either 11a or not 11a;
+ * definitely won't work for 11n.
+ */
+ ridx = IWM_RIDX_OFDM;
+ } else {
+ ridx = IWM_RIDX_CCK;
+ }
}
rinfo = &iwm_rates[ridx];
@@ -2642,7 +2642,6 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in,
rate_flags = 1 << IWM_RATE_MCS_ANT_POS;
if (IWM_RIDX_IS_CCK(ridx))
rate_flags |= IWM_RATE_MCS_CCK_MSK;
- /* XXX hard-coded tx rate */
tx->rate_n_flags = htole32(rate_flags | rinfo->plcp);
return rinfo;
@@ -4363,8 +4362,9 @@ iwm_intr(void *arg)
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+#ifdef IWM_DEBUG
iwm_nic_error(sc);
-
+#endif
/* Dump driver status (TX and RX rings) while we're here. */
device_printf(sc->sc_dev, "driver status:\n");
for (i = 0; i < IWM_MVM_MAX_QUEUES; i++) {
@@ -4780,6 +4780,9 @@ iwm_preinit(void *arg)
sizeof(ic->ic_sup_rates[IEEE80211_MODE_11A]));
IWM_UNLOCK(sc);
+ iwm_init_channel_map(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
+ ic->ic_channels);
+
/*
* At this point we've committed - if we fail to do setup,
* we now also have to tear down the net80211 state.
@@ -4792,6 +4795,7 @@ iwm_preinit(void *arg)
ic->ic_scan_start = iwm_scan_start;
ic->ic_scan_end = iwm_scan_end;
ic->ic_update_mcast = iwm_update_mcast;
+ ic->ic_getradiocaps = iwm_init_channel_map;
ic->ic_set_channel = iwm_set_channel;
ic->ic_scan_curchan = iwm_scan_curchan;
ic->ic_scan_mindwell = iwm_scan_mindwell;
diff --git a/sys/dev/iwm/if_iwmreg.h b/sys/dev/iwm/if_iwmreg.h
index dc32b98..1fc438b 100644
--- a/sys/dev/iwm/if_iwmreg.h
+++ b/sys/dev/iwm/if_iwmreg.h
@@ -1869,7 +1869,7 @@ enum {
* struct iwm_error_resp - FW error indication
* ( IWM_REPLY_ERROR = 0x2 )
* @error_type: one of IWM_FW_ERR_*
- * @cmd_id: the command ID for which the error occured
+ * @cmd_id: the command ID for which the error occurred
* @bad_cmd_seq_num: sequence number of the erroneous command
* @error_service: which service created the error, applicable only if
* error_type = 2, otherwise 0
@@ -2855,7 +2855,7 @@ enum iwm_sf_scenario {
/**
* Smart Fifo configuration command.
* @state: smart fifo state, types listed in iwm_sf_sate.
- * @watermark: Minimum allowed availabe free space in RXF for transient state.
+ * @watermark: Minimum allowed available free space in RXF for transient state.
* @long_delay_timeouts: aging and idle timer values for each scenario
* in long delay state.
* @full_on_timeouts: timer values for each scenario in full on state.
@@ -3411,12 +3411,12 @@ struct iwm_uapsd_misbehaving_ap_notif {
* calculated for this and the last passed beacon is greater than this
* threshold. Zero value means that the temperature change is ignored for
* beacon filtering; beacons will not be forced to be sent to driver
- * regardless of whether its temerature has been changed.
+ * regardless of whether its temperature has been changed.
* @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
* calculated for this and the last passed beacon is greater than this
* threshold. Zero value means that the temperature change is ignored for
* beacon filtering; beacons will not be forced to be sent to driver
- * regardless of whether its temerature has been changed.
+ * regardless of whether its temperature has been changed.
* @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
* @bf_filter_escape_timer: Send beacons to to driver if no beacons were passed
* for a specific period of time. Units: Beacons.
@@ -4439,7 +4439,7 @@ enum iwm_scan_type {
* @rxchain_sel_flags: RXON_RX_CHAIN_*
* @max_out_time: in usecs, max out of serving channel time
* @suspend_time: how long to pause scan when returning to service channel:
- * bits 0-19: beacon interal in usecs (suspend before executing)
+ * bits 0-19: beacon interval in usecs (suspend before executing)
* bits 20-23: reserved
* bits 24-31: number of beacons (suspend between channels)
* @rxon_flags: RXON_FLG_*
diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h
index 58c1920..849ded7 100644
--- a/sys/dev/iwm/if_iwmvar.h
+++ b/sys/dev/iwm/if_iwmvar.h
@@ -196,6 +196,9 @@ struct iwm_nvm_data {
uint8_t radio_cfg_dash;
uint8_t radio_cfg_pnum;
uint8_t valid_tx_ant, valid_rx_ant;
+#define IWM_NUM_CHANNELS 39
+
+ uint16_t nvm_ch_flags[IWM_NUM_CHANNELS];
uint16_t nvm_version;
uint8_t max_tx_pwr_half_dbm;
@@ -455,7 +458,7 @@ struct iwm_softc {
/*
* So why do we need a separate stopped flag and a generation?
- * the former protects the device from issueing commands when it's
+ * the former protects the device from issuing commands when it's
* stopped (duh). The latter protects against race from a very
* fast stop/unstop cycle where threads waiting for responses do
* not have a chance to run in between. Notably: we want to stop
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index bffa8de..6a740d3 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -2381,12 +2381,24 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n, int maxchans, int *nchans,
{
struct iwn_eeprom_chan *channels = sc->eeprom_channels[n];
const struct iwn_chan_band *band = &iwn_bands[n];
- struct ieee80211_channel *c;
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t chan;
- int i, nflags;
+ int i, error, nflags;
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
+ memset(bands, 0, sizeof(bands));
+ if (n == 0) {
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ if (sc->sc_flags & IWN_FLAG_HAS_11N)
+ setbit(bands, IEEE80211_MODE_11NG);
+ } else {
+ setbit(bands, IEEE80211_MODE_11A);
+ if (sc->sc_flags & IWN_FLAG_HAS_11N)
+ setbit(bands, IEEE80211_MODE_11NA);
+ }
+
for (i = 0; i < band->nchan; i++) {
if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID)) {
DPRINTF(sc, IWN_DEBUG_RESET,
@@ -2396,49 +2408,20 @@ iwn_read_eeprom_band(struct iwn_softc *sc, int n, int maxchans, int *nchans,
continue;
}
- if (*nchans >= maxchans)
- break;
-
chan = band->chan[i];
nflags = iwn_eeprom_channel_flags(&channels[i]);
-
- c = &chans[(*nchans)++];
- c->ic_ieee = chan;
- c->ic_maxregpower = channels[i].maxpwr;
- c->ic_maxpower = 2*c->ic_maxregpower;
-
- if (n == 0) { /* 2GHz band */
- c->ic_freq = ieee80211_ieee2mhz(chan, IEEE80211_CHAN_G);
- /* G =>'s B is supported */
- c->ic_flags = IEEE80211_CHAN_B | nflags;
-
- if (*nchans >= maxchans)
- break;
-
- c = &chans[(*nchans)++];
- c[0] = c[-1];
- c->ic_flags = IEEE80211_CHAN_G | nflags;
- } else { /* 5GHz band */
- c->ic_freq = ieee80211_ieee2mhz(chan, IEEE80211_CHAN_A);
- c->ic_flags = IEEE80211_CHAN_A | nflags;
- }
+ error = ieee80211_add_channel(chans, maxchans, nchans,
+ chan, 0, channels[i].maxpwr, nflags, bands);
+ if (error != 0)
+ break;
/* Save maximum allowed TX power for this channel. */
+ /* XXX wrong */
sc->maxpwr[chan] = channels[i].maxpwr;
DPRINTF(sc, IWN_DEBUG_RESET,
"add chan %d flags 0x%x maxpwr %d\n", chan,
channels[i].flags, channels[i].maxpwr);
-
- if (sc->sc_flags & IWN_FLAG_HAS_11N) {
- if (*nchans >= maxchans)
- break;
-
- /* add HT20, HT40 added separately */
- c = &chans[(*nchans)++];
- c[0] = c[-1];
- c->ic_flags |= IEEE80211_CHAN_HT20;
- }
}
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
@@ -2449,12 +2432,10 @@ static void
iwn_read_eeprom_ht40(struct iwn_softc *sc, int n, int maxchans, int *nchans,
struct ieee80211_channel chans[])
{
- struct ieee80211com *ic = &sc->sc_ic;
struct iwn_eeprom_chan *channels = sc->eeprom_channels[n];
const struct iwn_chan_band *band = &iwn_bands[n];
- struct ieee80211_channel *c, *cent, *extc;
uint8_t chan;
- int i, nflags;
+ int i, error, nflags;
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s start\n", __func__);
@@ -2472,46 +2453,33 @@ iwn_read_eeprom_ht40(struct iwn_softc *sc, int n, int maxchans, int *nchans,
continue;
}
- if (*nchans + 1 >= maxchans)
- break;
-
chan = band->chan[i];
nflags = iwn_eeprom_channel_flags(&channels[i]);
-
- /*
- * Each entry defines an HT40 channel pair; find the
- * center channel, then the extension channel above.
- */
- cent = ieee80211_find_channel_byieee(ic, chan,
- (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A));
- if (cent == NULL) { /* XXX shouldn't happen */
+ nflags |= (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A);
+ error = ieee80211_add_channel_ht40(chans, maxchans, nchans,
+ chan, channels[i].maxpwr, nflags);
+ switch (error) {
+ case EINVAL:
device_printf(sc->sc_dev,
"%s: no entry for channel %d\n", __func__, chan);
continue;
- }
- extc = ieee80211_find_channel(ic, cent->ic_freq+20,
- (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A));
- if (extc == NULL) {
+ case ENOENT:
DPRINTF(sc, IWN_DEBUG_RESET,
"%s: skip chan %d, extension channel not found\n",
__func__, chan);
continue;
+ case ENOBUFS:
+ device_printf(sc->sc_dev,
+ "%s: channel table is full!\n", __func__);
+ break;
+ case 0:
+ DPRINTF(sc, IWN_DEBUG_RESET,
+ "add ht40 chan %d flags 0x%x maxpwr %d\n",
+ chan, channels[i].flags, channels[i].maxpwr);
+ /* FALLTHROUGH */
+ default:
+ break;
}
-
- DPRINTF(sc, IWN_DEBUG_RESET,
- "add ht40 chan %d flags 0x%x maxpwr %d\n",
- chan, channels[i].flags, channels[i].maxpwr);
-
- c = &chans[(*nchans)++];
- c[0] = cent[0];
- c->ic_extieee = extc->ic_ieee;
- c->ic_flags &= ~IEEE80211_CHAN_HT;
- c->ic_flags |= IEEE80211_CHAN_HT40U | nflags;
- c = &chans[(*nchans)++];
- c[0] = extc[0];
- c->ic_extieee = cent->ic_ieee;
- c->ic_flags &= ~IEEE80211_CHAN_HT;
- c->ic_flags |= IEEE80211_CHAN_HT40D | nflags;
}
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s end\n", __func__);
@@ -2884,7 +2852,8 @@ iwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
sc->calib.state = IWN_CALIB_STATE_INIT;
/* Wait until we hear a beacon before we transmit */
- sc->sc_beacon_wait = 1;
+ if (IEEE80211_IS_CHAN_PASSIVE(ic->ic_curchan))
+ sc->sc_beacon_wait = 1;
if ((error = iwn_auth(sc, vap)) != 0) {
device_printf(sc->sc_dev,
@@ -2902,7 +2871,8 @@ iwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
}
/* Wait until we hear a beacon before we transmit */
- sc->sc_beacon_wait = 1;
+ if (IEEE80211_IS_CHAN_PASSIVE(ic->ic_curchan))
+ sc->sc_beacon_wait = 1;
/*
* !RUN -> RUN requires setting the association id
@@ -5281,7 +5251,7 @@ iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni)
* will not be using MIMO.
*
* Since we're filling linkq from 0..15 and we're filling
- * from the higest MCS rates to the lowest rates, if we
+ * from the highest MCS rates to the lowest rates, if we
* _are_ doing a dual-stream rate, set mimo to idx+1 (ie,
* the next entry.) That way if the next entry is a non-MIMO
* entry, we're already pointing at it.
@@ -6335,7 +6305,7 @@ iwn_set_pslevel(struct iwn_softc *sc, int dtim, int level, int async)
if (max == (uint32_t)-1)
max = dtim * (skip_dtim + 1);
else if (max > dtim)
- max = (max / dtim) * dtim;
+ max = rounddown(max, dtim);
} else
max = dtim;
for (i = 0; i < 5; i++)
diff --git a/sys/dev/ixgb/ixgb_ee.c b/sys/dev/ixgb/ixgb_ee.c
index 4ce650e..3dcd630 100644
--- a/sys/dev/ixgb/ixgb_ee.c
+++ b/sys/dev/ixgb/ixgb_ee.c
@@ -375,7 +375,7 @@ ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
*
* hw - Struct containing variables accessed by shared code
* reg - offset within the EEPROM to be written to
- * data - 16 bit word to be writen to the EEPROM
+ * data - 16 bit word to be written to the EEPROM
*
* If ixgb_update_eeprom_checksum is not called after this function, the
* EEPROM will most likely contain an invalid checksum.
diff --git a/sys/dev/ixgb/ixgb_hw.c b/sys/dev/ixgb/ixgb_hw.c
index 23b0b28..2985994 100644
--- a/sys/dev/ixgb/ixgb_hw.c
+++ b/sys/dev/ixgb/ixgb_hw.c
@@ -939,7 +939,7 @@ ixgb_check_for_link(struct ixgb_hw *hw)
}
/******************************************************************************
- * Check for a bad link condition that may have occured.
+ * Check for a bad link condition that may have occurred.
* The indication is that the RFC / LFC registers may be incrementing
* continually. A full adapter reset is required to recover.
*
diff --git a/sys/dev/jme/if_jmereg.h b/sys/dev/jme/if_jmereg.h
index f7dfb12..d778b7f 100644
--- a/sys/dev/jme/if_jmereg.h
+++ b/sys/dev/jme/if_jmereg.h
@@ -925,7 +925,7 @@
#define TIMER3_TIMEOUT_COUNT_SHIFT 8
#define TIMER3_TIMEOUT_VALUE_SHIFT 1
-/* Aggresive power mode control. */
+/* Aggressive power mode control. */
#define JME_APMC 0x087C
#define APMC_PCIE_SDOWN_STAT 0x80000000
#define APMC_PCIE_SDOWN_ENB 0x40000000
diff --git a/sys/dev/jme/if_jmevar.h b/sys/dev/jme/if_jmevar.h
index 1a1e81c..cffab5a 100644
--- a/sys/dev/jme/if_jmevar.h
+++ b/sys/dev/jme/if_jmevar.h
@@ -35,7 +35,7 @@
#include <sys/taskqueue.h>
/*
- * JMC250 supports upto 1024 descriptors and the number of
+ * JMC250 supports up to 1024 descriptors and the number of
* descriptors should be multiple of 16.
*/
#define JME_TX_RING_CNT 384
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index 45f483a..389ef75 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -96,7 +96,7 @@ kbd_realloc_array(void)
int s;
s = spltty();
- newsize = ((keyboards + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA;
+ newsize = rounddown(keyboards + ARRAY_DELTA, ARRAY_DELTA);
new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO);
if (new_kbd == NULL) {
splx(s);
@@ -283,7 +283,7 @@ kbd_unregister(keyboard_t *kbd)
return (0);
}
-/* find a funciton table by the driver name */
+/* find a function table by the driver name */
keyboard_switch_t
*kbd_get_switch(char *driver)
{
diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c
index 9aef131..721aee8 100644
--- a/sys/dev/lge/if_lge.c
+++ b/sys/dev/lge/if_lge.c
@@ -1074,7 +1074,7 @@ lge_intr(arg)
ifp = sc->lge_ifp;
LGE_LOCK(sc);
- /* Supress unwanted interrupts */
+ /* Suppress unwanted interrupts */
if (!(ifp->if_flags & IFF_UP)) {
lge_stop(sc);
LGE_UNLOCK(sc);
diff --git a/sys/dev/lmc/if_lmc.c b/sys/dev/lmc/if_lmc.c
index fe22edf..cf030c7 100644
--- a/sys/dev/lmc/if_lmc.c
+++ b/sys/dev/lmc/if_lmc.c
@@ -1268,7 +1268,7 @@ t3_send_dbl_feac(softc_t *sc, int feac1, int feac2)
/* Flush received FEACS; don't respond to our own loop cmd! */
while (read_framer(sc, T3CSR_FEAC_STK) & FEAC_STK_VALID) DELAY(1); /* XXX HANG */
/* Restore previous state of the FEAC transmitter. */
- /* If it was sending a continous FEAC, it will resume. */
+ /* If it was sending a continuous FEAC, it will resume. */
write_framer(sc, T3CSR_TX_FEAC, tx_feac);
}
diff --git a/sys/dev/lmc/if_lmc.h b/sys/dev/lmc/if_lmc.h
index 8291dcd..0121375 100644
--- a/sys/dev/lmc/if_lmc.h
+++ b/sys/dev/lmc/if_lmc.h
@@ -236,14 +236,14 @@
/* T3 GPIO bits */
#define GPIO_T3_DAC 0x04 /* DAC chip select */
-#define GPIO_T3_INTEN 0x08 /* Framer Interupt enable */
+#define GPIO_T3_INTEN 0x08 /* Framer Interrupt enable */
/* SSI GPIO bits */
#define GPIO_SSI_SYNTH 0x04 /* Synth osc chip select */
#define GPIO_SSI_DCE 0x08 /* provide clock on TXCLOCK output */
/* T1E1 GPIO bits */
-#define GPIO_T1_INTEN 0x08 /* Framer Interupt enable */
+#define GPIO_T1_INTEN 0x08 /* Framer Interrupt enable */
/* MII register 16 bits common to all cards */
/* NB: LEDs for HSSI & SSI are in DIFFERENT bits than for T1E1 & T3; oops */
diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c
index b7e1a7f..e1959e2 100644
--- a/sys/dev/malo/if_malo.c
+++ b/sys/dev/malo/if_malo.c
@@ -174,7 +174,7 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
struct ieee80211com *ic = &sc->malo_ic;
struct malo_hal *mh;
int error;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
MALO_LOCK_INIT(sc);
callout_init_mtx(&sc->malo_watchdog_timer, &sc->malo_mtx, 0);
diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c
index 05751ba..021a424 100644
--- a/sys/dev/mfi/mfi.c
+++ b/sys/dev/mfi/mfi.c
@@ -539,7 +539,7 @@ mfi_attach(struct mfi_softc *sc)
/*
Allocate DMA memory mapping for MPI2 IOC Init descriptor,
- we are taking it diffrent from what we have allocated for Request
+ we are taking it different from what we have allocated for Request
and reply descriptors to avoid confusion later
*/
tb_mem_size = sizeof(struct MPI2_IOC_INIT_REQUEST);
@@ -2351,7 +2351,7 @@ mfi_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
/*
* We need to check if we have the lock as this is async
* callback so even though our caller mfi_mapcmd asserts
- * it has the lock, there is no garantee that hasn't been
+ * it has the lock, there is no guarantee that hasn't been
* dropped if bus_dmamap_load returned prior to our
* completion.
*/
diff --git a/sys/dev/mfi/mfi_tbolt.c b/sys/dev/mfi/mfi_tbolt.c
index 984c355..3f83eb9 100644
--- a/sys/dev/mfi/mfi_tbolt.c
+++ b/sys/dev/mfi/mfi_tbolt.c
@@ -1148,7 +1148,7 @@ mfi_tbolt_send_frame(struct mfi_softc *sc, struct mfi_command *cm)
* This is a polled command, so busy-wait for it to complete.
*
* The value of hdr->cmd_status is updated directly by the hardware
- * so there is no garantee that mfi_tbolt_complete_cmd is called
+ * so there is no guarantee that mfi_tbolt_complete_cmd is called
* prior to this value changing.
*/
while (hdr->cmd_status == MFI_STAT_INVALID_STATUS) {
@@ -1351,7 +1351,7 @@ mfi_process_fw_state_chg_isr(void *arg)
* interrupt thread.
*
* The driver could get the RAID state via the MFI_DCMD_LD_MAP_GET_INFO
- * That requires a bunch of structure and it is simplier to just do
+ * That requires a bunch of structure and it is simpler to just do
* the MFI_DCMD_LD_GET_LIST versus walking the RAID map.
*/
diff --git a/sys/dev/mge/if_mgevar.h b/sys/dev/mge/if_mgevar.h
index 31b9ac3..e161055 100644
--- a/sys/dev/mge/if_mgevar.h
+++ b/sys/dev/mge/if_mgevar.h
@@ -370,7 +370,7 @@ struct mge_softc {
/* RX error codes */
#define MGE_RX_ERROR_CE (0 << 1) /* CRC error */
#define MGE_RX_ERROR_OR (1 << 1) /* Overrun error */
-#define MGE_RX_ERROR_MF (2 << 1) /* Max frame lenght error */
+#define MGE_RX_ERROR_MF (2 << 1) /* Max frame length error */
#define MGE_RX_ERROR_RE (3 << 1) /* Resource error */
#endif /* __IF_MGE_H__ */
diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c
index 3b86665..2464dd5 100644
--- a/sys/dev/mlx/mlx_disk.c
+++ b/sys/dev/mlx/mlx_disk.c
@@ -170,7 +170,7 @@ mlxd_strategy(struct bio *bp)
bad:
/*
- * Correctly set the bio to indicate a failed tranfer.
+ * Correctly set the bio to indicate a failed transfer.
*/
bp->bio_resid = bp->bio_bcount;
biodone(bp);
diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h
index 83793d5..8136e57 100644
--- a/sys/dev/mlx5/driver.h
+++ b/sys/dev/mlx5/driver.h
@@ -542,6 +542,7 @@ struct mlx5_core_dev {
atomic_t num_qps;
u32 issi;
struct mlx5_special_contexts special_contexts;
+ unsigned int module_status[MLX5_MAX_PORTS];
};
enum {
@@ -835,6 +836,7 @@ int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu);
int mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu);
int mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu);
+unsigned int mlx5_query_module_status(struct mlx5_core_dev *dev, int module_num);
int mlx5_query_module_num(struct mlx5_core_dev *dev, int *module_num);
int mlx5_query_eeprom(struct mlx5_core_dev *dev, int i2c_addr, int page_num,
int device_addr, int size, int module_num, u32 *data,
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c
index dd407e8..8321342 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c
@@ -579,6 +579,13 @@ static const char *mlx5_port_module_event_error_type_to_string(u8 error_type)
}
}
+unsigned int mlx5_query_module_status(struct mlx5_core_dev *dev, int module_num)
+{
+ if (module_num < 0 || module_num >= MLX5_MAX_PORTS)
+ return 0; /* undefined */
+ return dev->module_status[module_num];
+}
+
static void mlx5_port_module_event(struct mlx5_core_dev *dev,
struct mlx5_eqe *eqe)
{
@@ -612,5 +619,8 @@ static void mlx5_port_module_event(struct mlx5_core_dev *dev,
default:
device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, unknown status", module_num);
}
+ /* store module status */
+ if (module_num < MLX5_MAX_PORTS)
+ dev->module_status[module_num] = module_status;
}
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 3676910..a76d32e 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -2559,9 +2559,15 @@ out:
if (error) {
if_printf(ifp, "Query module num failed, eeprom "
"reading is not supported\n");
+ error = EINVAL;
+ goto err_i2c;
+ }
+ /* Check if module is present before doing an access */
+ if (mlx5_query_module_status(priv->mdev, module_num) !=
+ MLX5_MODULE_STATUS_PLUGGED) {
+ error = EINVAL;
goto err_i2c;
}
-
/*
* Currently 0XA0 and 0xA2 are the only addresses permitted.
* The internal conversion is as follows:
@@ -2583,6 +2589,7 @@ out:
if (error) {
if_printf(ifp, "Query eeprom failed, eeprom "
"reading is not supported\n");
+ error = EINVAL;
goto err_i2c;
}
@@ -2596,6 +2603,7 @@ out:
if (error) {
if_printf(ifp, "Query eeprom failed, eeprom "
"reading is not supported\n");
+ error = EINVAL;
goto err_i2c;
}
diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c
index 7c4ed41..cbae482 100644
--- a/sys/dev/mly/mly.c
+++ b/sys/dev/mly/mly.c
@@ -1931,7 +1931,7 @@ mly_unmap_command(struct mly_command *mc)
* the kernel environment variable "hw.mly.register_physical_channels" is set.
*
* When we refer to a "bus", we are referring to the bus number registered with
- * the SIM, wheras a "channel" is a channel number given to the adapter. In order
+ * the SIM, whereas a "channel" is a channel number given to the adapter. In order
* to keep things simple, we map these 1:1, so "bus" and "channel" may be used
* interchangeably.
*/
diff --git a/sys/dev/mly/mlyreg.h b/sys/dev/mly/mlyreg.h
index a4106a5..9e5715b 100644
--- a/sys/dev/mly/mlyreg.h
+++ b/sys/dev/mly/mlyreg.h
@@ -138,7 +138,7 @@ struct mly_sg_entry {
*/
struct mly_lun_map {
u_int8_t res1:4;
- u_int8_t host_port_mapped:1; /* this system drive visibile to host on this controller/port combination */
+ u_int8_t host_port_mapped:1; /* this system drive visible to host on this controller/port combination */
u_int8_t tid_valid:1; /* target ID valid */
u_int8_t hid_valid:1; /* host ID valid */
u_int8_t lun_valid:1; /* LUN valid */
@@ -1208,7 +1208,7 @@ union mly_command_packet {
* PG6: 5.4.4 Doorbell 1
*
* Note that the documentation claims that these bits are set when the
- * status queue(s) are empty, wheras the Linux driver and experience
+ * status queue(s) are empty, whereas the Linux driver and experience
* suggest they are set when there is status available.
*/
#define MLY_HM_STSREADY (1<<0)
diff --git a/sys/dev/mmc/mmcreg.h b/sys/dev/mmc/mmcreg.h
index b169d26..f25c0f63 100644
--- a/sys/dev/mmc/mmcreg.h
+++ b/sys/dev/mmc/mmcreg.h
@@ -441,7 +441,7 @@ struct mmc_sd_status
* Older versions of the MMC standard had a variable sector size. However,
* I've been able to find no old MMC or SD cards that have a non 512
* byte sector size anywhere, so we assume that such cards are very rare
- * and only note their existance in passing here...
+ * and only note their existence in passing here...
*/
#define MMC_SECTOR_SIZE 512
diff --git a/sys/dev/mn/if_mn.c b/sys/dev/mn/if_mn.c
index 0356f53..a4ec603 100644
--- a/sys/dev/mn/if_mn.c
+++ b/sys/dev/mn/if_mn.c
@@ -1186,7 +1186,7 @@ mn_rx_intr(struct mn_softc *sc, u_int32_t vector)
/*
- * Interupt handler
+ * Interrupt handler
*/
static void
diff --git a/sys/dev/mpr/mpi/mpi2_history.txt b/sys/dev/mpr/mpi/mpi2_history.txt
index 9fca796..e843237 100644
--- a/sys/dev/mpr/mpi/mpi2_history.txt
+++ b/sys/dev/mpr/mpi/mpi2_history.txt
@@ -305,7 +305,7 @@ mpi2_init.h
* 05-21-08 02.00.05 Fixed typo in name of Mpi2SepRequest_t.
* 10-02-08 02.00.06 Removed Untagged and No Disconnect values from SCSI IO
* Control field Task Attribute flags.
- * Moved LUN field defines to mpi2.h becasue they are
+ * Moved LUN field defines to mpi2.h because they are
* common to many structures.
* 05-06-09 02.00.07 Changed task management type of Query Unit Attention to
* Query Asynchronous Event.
diff --git a/sys/dev/mpr/mpi/mpi2_init.h b/sys/dev/mpr/mpi/mpi2_init.h
index 5f475c0..5b73643 100644
--- a/sys/dev/mpr/mpi/mpi2_init.h
+++ b/sys/dev/mpr/mpi/mpi2_init.h
@@ -61,7 +61,7 @@
* 05-21-08 02.00.05 Fixed typo in name of Mpi2SepRequest_t.
* 10-02-08 02.00.06 Removed Untagged and No Disconnect values from SCSI IO
* Control field Task Attribute flags.
- * Moved LUN field defines to mpi2.h becasue they are
+ * Moved LUN field defines to mpi2.h because they are
* common to many structures.
* 05-06-09 02.00.07 Changed task management type of Query Unit Attention to
* Query Asynchronous Event.
diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c
index 6fe08b0..5580157 100644
--- a/sys/dev/mpr/mpr.c
+++ b/sys/dev/mpr/mpr.c
@@ -2671,7 +2671,7 @@ mpr_request_polled(struct mpr_softc *sc, struct mpr_command *cm)
/*
* The MPT driver had a verbose interface for config pages. In this driver,
- * reduce it to much simplier terms, similar to the Linux driver.
+ * reduce it to much simpler terms, similar to the Linux driver.
*/
int
mpr_read_config_page(struct mpr_softc *sc, struct mpr_config_params *params)
diff --git a/sys/dev/mpr/mpr_mapping.h b/sys/dev/mpr/mpr_mapping.h
index c00a3b7..fafaf9b 100644
--- a/sys/dev/mpr/mpr_mapping.h
+++ b/sys/dev/mpr/mpr_mapping.h
@@ -33,7 +33,7 @@
#define _MPR_MAPPING_H
/**
- * struct _map_phy_change - PHY entries recieved in Topology change list
+ * struct _map_phy_change - PHY entries received in Topology change list
* @physical_id: SAS address of the device attached with the associate PHY
* @device_info: bitfield provides detailed info about the device
* @dev_handle: device handle for the device pointed by this entry
diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c
index b2ffe96..f162d1f 100644
--- a/sys/dev/mpr/mpr_sas_lsi.c
+++ b/sys/dev/mpr/mpr_sas_lsi.c
@@ -717,7 +717,7 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 linkrate){
parent_devinfo = le32toh(parent_config_page.DeviceInfo);
}
}
- /* TODO Check proper endianess */
+ /* TODO Check proper endianness */
sas_address = config_page.SASAddress.High;
sas_address = (sas_address << 32) | config_page.SASAddress.Low;
mpr_dprint(sc, MPR_INFO, "SAS Address from SAS device page0 = %jx\n",
diff --git a/sys/dev/mps/mpi/mpi2_history.txt b/sys/dev/mps/mpi/mpi2_history.txt
index d0c2c1d..45af490 100644
--- a/sys/dev/mps/mpi/mpi2_history.txt
+++ b/sys/dev/mps/mpi/mpi2_history.txt
@@ -247,7 +247,7 @@ mpi2_init.h
* 05-21-08 02.00.05 Fixed typo in name of Mpi2SepRequest_t.
* 10-02-08 02.00.06 Removed Untagged and No Disconnect values from SCSI IO
* Control field Task Attribute flags.
- * Moved LUN field defines to mpi2.h becasue they are
+ * Moved LUN field defines to mpi2.h because they are
* common to many structures.
* 05-06-09 02.00.07 Changed task management type of Query Unit Attention to
* Query Asynchronous Event.
diff --git a/sys/dev/mps/mpi/mpi2_init.h b/sys/dev/mps/mpi/mpi2_init.h
index 189e457..a75873c 100644
--- a/sys/dev/mps/mpi/mpi2_init.h
+++ b/sys/dev/mps/mpi/mpi2_init.h
@@ -53,7 +53,7 @@
* 05-21-08 02.00.05 Fixed typo in name of Mpi2SepRequest_t.
* 10-02-08 02.00.06 Removed Untagged and No Disconnect values from SCSI IO
* Control field Task Attribute flags.
- * Moved LUN field defines to mpi2.h becasue they are
+ * Moved LUN field defines to mpi2.h because they are
* common to many structures.
* 05-06-09 02.00.07 Changed task management type of Query Unit Attention to
* Query Asynchronous Event.
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index ce24eed..b564b33 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -782,7 +782,7 @@ mps_wait_db_ack(struct mps_softc *sc, int timeout, int sleep_flag)
int_status = mps_regread(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET);
if (!(int_status & MPI2_HIS_SYS2IOC_DB_STATUS)) {
mps_dprint(sc, MPS_INIT,
- "%s: successfull count(%d), timeout(%d)\n",
+ "%s: successful count(%d), timeout(%d)\n",
__func__, count, timeout);
return 0;
} else if (int_status & MPI2_HIS_IOC2SYS_DB_STATUS) {
@@ -1907,7 +1907,7 @@ mps_intr_locked(void *data)
sc->reply_frames, sc->fqdepth,
sc->facts->ReplyFrameSize * 4);
printf("%s: baddr %#x,\n", __func__, baddr);
- /* LSI-TODO. See Linux Code. Need Gracefull exit*/
+ /* LSI-TODO. See Linux Code. Need Graceful exit*/
panic("Reply address out of range");
}
if (le16toh(desc->AddressReply.SMID) == 0) {
@@ -2192,7 +2192,7 @@ mps_add_chain(struct mps_command *cm)
* sgc->Flags = ( MPI2_SGE_FLAGS_CHAIN_ELEMENT | MPI2_SGE_FLAGS_64_BIT_ADDRESSING |
* MPI2_SGE_FLAGS_SYSTEM_ADDRESS) << MPI2_SGE_FLAGS_SHIFT
* This is fine.. because we are not using simple element. In case of
- * MPI2_SGE_CHAIN32, we have seperate Length and Flags feild.
+ * MPI2_SGE_CHAIN32, we have separate Length and Flags feild.
*/
sgc->Flags = MPI2_SGE_FLAGS_CHAIN_ELEMENT;
sgc->Address = htole32(chain->chain_busaddr);
@@ -2558,7 +2558,7 @@ mps_wait_command(struct mps_softc *sc, struct mps_command *cm, int timeout,
/*
* The MPT driver had a verbose interface for config pages. In this driver,
- * reduce it to much simplier terms, similar to the Linux driver.
+ * reduce it to much simpler terms, similar to the Linux driver.
*/
int
mps_read_config_page(struct mps_softc *sc, struct mps_config_params *params)
diff --git a/sys/dev/mps/mps_config.c b/sys/dev/mps/mps_config.c
index 9ecfbb3..c21506d 100644
--- a/sys/dev/mps/mps_config.c
+++ b/sys/dev/mps/mps_config.c
@@ -366,7 +366,7 @@ mps_base_static_config_pages(struct mps_softc *sc)
/**
* mps_wd_config_pages - get info required to support WarpDrive. This needs to
- * be called after discovery is complete to guarentee that IR info is there.
+ * be called after discovery is complete to guarantee that IR info is there.
* @sc: per adapter object
*
* Return nothing.
diff --git a/sys/dev/mps/mps_mapping.h b/sys/dev/mps/mps_mapping.h
index c370d50..9803b80 100644
--- a/sys/dev/mps/mps_mapping.h
+++ b/sys/dev/mps/mps_mapping.h
@@ -33,7 +33,7 @@
#define _MPS_MAPPING_H
/**
- * struct _map_phy_change - PHY entries recieved in Topology change list
+ * struct _map_phy_change - PHY entries received in Topology change list
* @physical_id: SAS address of the device attached with the associate PHY
* @device_info: bitfield provides detailed info about the device
* @dev_handle: device handle for the device pointed by this entry
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 8cba1d7..a4dd3e1 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -2502,7 +2502,7 @@ mpssas_direct_drive_io(struct mpssas_softc *sassc, struct mps_command *cm,
* Check if the I/O crosses a stripe boundary. If not,
* translate the virtual LBA to a physical LBA and set
* the DevHandle for the PhysDisk to be used. If it
- * does cross a boundry, do normal I/O. To get the
+ * does cross a boundary, do normal I/O. To get the
* right DevHandle to use, get the map number for the
* column, then use that map number to look up the
* DevHandle of the PhysDisk.
@@ -2588,7 +2588,7 @@ mpssas_direct_drive_io(struct mpssas_softc *sassc, struct mps_command *cm,
* If not, translate the virtual LBA to a
* physical LBA and set the DevHandle for the
* PhysDisk to be used. If it does cross a
- * boundry, do normal I/O. To get the right
+ * boundary, do normal I/O. To get the right
* DevHandle to use, get the map number for the
* column, then use that map number to look up
* the DevHandle of the PhysDisk.
@@ -2666,7 +2666,7 @@ mpssas_direct_drive_io(struct mpssas_softc *sassc, struct mps_command *cm,
* If not, translate the virtual LBA to a
* physical LBA and set the DevHandle for the
* PhysDisk to be used. If it does cross a
- * boundry, do normal I/O. To get the right
+ * boundary, do normal I/O. To get the right
* DevHandle to use, get the map number for the
* column, then use that map number to look up
* the DevHandle of the PhysDisk.
diff --git a/sys/dev/mps/mps_sas_lsi.c b/sys/dev/mps/mps_sas_lsi.c
index 268383a..e9fa06b 100644
--- a/sys/dev/mps/mps_sas_lsi.c
+++ b/sys/dev/mps/mps_sas_lsi.c
@@ -647,7 +647,7 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8 linkrate){
parent_devinfo = le32toh(parent_config_page.DeviceInfo);
}
}
- /* TODO Check proper endianess */
+ /* TODO Check proper endianness */
sas_address = config_page.SASAddress.High;
sas_address = (sas_address << 32) | config_page.SASAddress.Low;
diff --git a/sys/dev/mpt/mpilib/mpi_cnfg.h b/sys/dev/mpt/mpilib/mpi_cnfg.h
index e763c58..cb70d88 100644
--- a/sys/dev/mpt/mpilib/mpi_cnfg.h
+++ b/sys/dev/mpt/mpilib/mpi_cnfg.h
@@ -339,7 +339,7 @@
* define.
* Added BIOS Page 4 structure.
* Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
- * Physcial Disk Page 1.
+ * Physical Disk Page 1.
* 01-15-07 01.05.17 Added additional bit defines for ExtFlags field of
* Manufacturing Page 4.
* Added Solid State Drives Supported bit to IOC Page 6
diff --git a/sys/dev/mpt/mpilib/mpi_log_fc.h b/sys/dev/mpt/mpilib/mpi_log_fc.h
index 4f8d6f6..0383f66 100644
--- a/sys/dev/mpt/mpilib/mpi_log_fc.h
+++ b/sys/dev/mpt/mpilib/mpi_log_fc.h
@@ -66,8 +66,8 @@ typedef enum _MpiIocLogInfoFc
{
MPI_IOCLOGINFO_FC_INIT_BASE = 0x20000000,
MPI_IOCLOGINFO_FC_INIT_ERROR_OUT_OF_ORDER_FRAME = 0x20000001, /* received an out of order frame - unsupported */
- MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_START_OF_FRAME = 0x20000002, /* Bad Rx Frame, bad start of frame primative */
- MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_END_OF_FRAME = 0x20000003, /* Bad Rx Frame, bad end of frame primative */
+ MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_START_OF_FRAME = 0x20000002, /* Bad Rx Frame, bad start of frame primitive */
+ MPI_IOCLOGINFO_FC_INIT_ERROR_BAD_END_OF_FRAME = 0x20000003, /* Bad Rx Frame, bad end of frame primitive */
MPI_IOCLOGINFO_FC_INIT_ERROR_OVER_RUN = 0x20000004, /* Bad Rx Frame, overrun */
MPI_IOCLOGINFO_FC_INIT_ERROR_RX_OTHER = 0x20000005, /* Other errors caught by IOC which require retries */
MPI_IOCLOGINFO_FC_INIT_ERROR_SUBPROC_DEAD = 0x20000006, /* Main processor could not initialize sub-processor */
diff --git a/sys/dev/mpt/mpilib/mpi_log_sas.h b/sys/dev/mpt/mpilib/mpi_log_sas.h
index 3afd0bb..caebcb1 100644
--- a/sys/dev/mpt/mpilib/mpi_log_sas.h
+++ b/sys/dev/mpt/mpilib/mpi_log_sas.h
@@ -86,9 +86,9 @@
#define IOP_LOGINFO_CODE_FWUPLOAD_NO_FLASH_AVAILABLE (0x0003E000) /* Tried to upload from flash, but there is none */
#define IOP_LOGINFO_CODE_FWUPLOAD_UNKNOWN_IMAGE_TYPE (0x0003E001) /* ImageType field contents were invalid */
#define IOP_LOGINFO_CODE_FWUPLOAD_WRONG_IMAGE_SIZE (0x0003E002) /* ImageSize field in TCSGE was bad/offset in MfgPg 4 was wrong */
-#define IOP_LOGINFO_CODE_FWUPLOAD_ENTIRE_FLASH_UPLOAD_FAILED (0x0003E003) /* Error occured while attempting to upload the entire flash */
-#define IOP_LOGINFO_CODE_FWUPLOAD_REGION_UPLOAD_FAILED (0x0003E004) /* Error occured while attempting to upload single flash region */
-#define IOP_LOGINFO_CODE_FWUPLOAD_DMA_FAILURE (0x0003E005) /* Problem occured while DMAing FW to host memory */
+#define IOP_LOGINFO_CODE_FWUPLOAD_ENTIRE_FLASH_UPLOAD_FAILED (0x0003E003) /* Error occurred while attempting to upload the entire flash */
+#define IOP_LOGINFO_CODE_FWUPLOAD_REGION_UPLOAD_FAILED (0x0003E004) /* Error occurred while attempting to upload single flash region */
+#define IOP_LOGINFO_CODE_FWUPLOAD_DMA_FAILURE (0x0003E005) /* Problem occurred while DMAing FW to host memory */
#define IOP_LOGINFO_CODE_DIAG_MSG_ERROR (0x00040000) /* Error handling diag msg - or'd with diag status */
@@ -215,8 +215,8 @@
#define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD (0x00005000)
#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE (0x00200000) /* Can't get SMP Frame */
-#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occured on SMP Read */
-#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_WRITE_ERROR (0x00200020) /* Error occured on SMP Write */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR (0x00200010) /* Error occurred on SMP Read */
+#define PL_LOGINFO_CODE_ENCL_MGMT_SMP_WRITE_ERROR (0x00200020) /* Error occurred on SMP Write */
#define PL_LOGINFO_CODE_ENCL_MGMT_NOT_SUPPORTED_ON_ENCL (0x00200040) /* Encl Mgmt services not available for this WWID */
#define PL_LOGINFO_CODE_ENCL_MGMT_ADDR_MODE_NOT_SUPPORTED (0x00200050) /* Address Mode not suppored */
#define PL_LOGINFO_CODE_ENCL_MGMT_BAD_SLOT_NUM (0x00200060) /* Invalid Slot Number in SEP Msg */
@@ -235,8 +235,8 @@
#define PL_LOGINFO_DA_SEP_RECEIVED_NACK_FROM_SLAVE (0x00200103) /* SEP NACK'd, it is busy */
#define PL_LOGINFO_DA_SEP_DID_NOT_RECEIVE_ACK (0x00200104) /* SEP didn't rcv. ACK (Last Rcvd Bit = 1) */
#define PL_LOGINFO_DA_SEP_BAD_STATUS_HDR_CHKSUM (0x00200105) /* SEP stopped or sent bad chksum in Hdr */
-#define PL_LOGINFO_DA_SEP_STOP_ON_DATA (0x00200106) /* SEP stopped while transfering data */
-#define PL_LOGINFO_DA_SEP_STOP_ON_SENSE_DATA (0x00200107) /* SEP stopped while transfering sense data */
+#define PL_LOGINFO_DA_SEP_STOP_ON_DATA (0x00200106) /* SEP stopped while transferring data */
+#define PL_LOGINFO_DA_SEP_STOP_ON_SENSE_DATA (0x00200107) /* SEP stopped while transferring sense data */
#define PL_LOGINFO_DA_SEP_UNSUPPORTED_SCSI_STATUS_1 (0x00200108) /* SEP returned unknown scsi status */
#define PL_LOGINFO_DA_SEP_UNSUPPORTED_SCSI_STATUS_2 (0x00200109) /* SEP returned unknown scsi status */
#define PL_LOGINFO_DA_SEP_CHKSUM_ERROR_AFTER_STOP (0x0020010A) /* SEP returned bad chksum after STOP */
diff --git a/sys/dev/mpt/mpt.c b/sys/dev/mpt/mpt.c
index 9317965..a3fa58e 100644
--- a/sys/dev/mpt/mpt.c
+++ b/sys/dev/mpt/mpt.c
@@ -964,7 +964,7 @@ mpt_wait_state(struct mpt_softc *mpt, enum DB_STATE_BITS state)
}
-/************************* Intialization/Configuration ************************/
+/************************* Initialization/Configuration ************************/
static int mpt_download_fw(struct mpt_softc *mpt);
/* Issue the reset COMMAND to the IOC */
diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h
index 57dbe7b..b611d06 100644
--- a/sys/dev/mpt/mpt.h
+++ b/sys/dev/mpt/mpt.h
@@ -237,7 +237,7 @@ struct mpt_map_info {
void mpt_map_rquest(void *, bus_dma_segment_t *, int, int);
-/********************************** Endianess *********************************/
+/********************************* Endianness *********************************/
#define MPT_2_HOST64(ptr, tag) ptr->tag = le64toh(ptr->tag)
#define MPT_2_HOST32(ptr, tag) ptr->tag = le32toh(ptr->tag)
#define MPT_2_HOST16(ptr, tag) ptr->tag = le16toh(ptr->tag)
@@ -663,8 +663,8 @@ struct mpt_softc {
bus_addr_t reply_phys; /* BusAddr of reply memory */
bus_dma_tag_t buffer_dmat; /* DMA tag for buffers */
- bus_dma_tag_t request_dmat; /* DMA tag for request memroy */
- bus_dmamap_t request_dmap; /* DMA map for request memroy */
+ bus_dma_tag_t request_dmat; /* DMA tag for request memory */
+ bus_dmamap_t request_dmap; /* DMA map for request memory */
uint8_t *request; /* KVA of Request memory */
bus_addr_t request_phys; /* BusAddr of request memory */
diff --git a/sys/dev/mrsas/mrsas.c b/sys/dev/mrsas/mrsas.c
index 7d5f7fb..23682a9 100644
--- a/sys/dev/mrsas/mrsas.c
+++ b/sys/dev/mrsas/mrsas.c
@@ -1069,7 +1069,7 @@ mrsas_free_mem(struct mrsas_softc *sc)
}
/*
- * Free version buffer memroy
+ * Free version buffer memory
*/
if (sc->verbuf_phys_addr)
bus_dmamap_unload(sc->verbuf_tag, sc->verbuf_dmamap);
@@ -2687,7 +2687,7 @@ mrsas_reset_reply_desc(struct mrsas_softc *sc)
* command Controller is in working state, so skip OCR. Otherwise, do
* OCR/kill Adapter based on flag disableOnlineCtrlReset. 4. Start of the
* OCR, return all SCSI command back to CAM layer which has ccb_ptr. 5. Post
- * OCR, Re-fire Managment command and move Controller to Operation state.
+ * OCR, Re-fire Management command and move Controller to Operation state.
*/
int
mrsas_reset_ctrl(struct mrsas_softc *sc)
diff --git a/sys/dev/mrsas/mrsas_cam.c b/sys/dev/mrsas/mrsas_cam.c
index 08f9002..d6d4ad5 100644
--- a/sys/dev/mrsas/mrsas_cam.c
+++ b/sys/dev/mrsas/mrsas_cam.c
@@ -362,7 +362,7 @@ mrsas_action(struct cam_sim *sim, union ccb *ccb)
*
* This function will execute after timeout value provided by ccb header from
* CAM layer, if timer expires. Driver will run timer for all DCDM and LDIO
- * comming from CAM layer. This function is callback function for IO timeout
+ * coming from CAM layer. This function is callback function for IO timeout
* and it runs in no-sleep context. Set do_timedout_reset in Adapter context
* so that it will execute OCR/Kill adpter from ocr_thread context.
*/
diff --git a/sys/dev/msk/if_msk.c b/sys/dev/msk/if_msk.c
index ffbe36e..458d7fd 100644
--- a/sys/dev/msk/if_msk.c
+++ b/sys/dev/msk/if_msk.c
@@ -3493,7 +3493,7 @@ msk_intr_hwerr(struct msk_softc *sc)
CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
if ((status & Y2_IS_PCI_NEXP) != 0) {
/*
- * PCI Express Error occured which is not described in PEX
+ * PCI Express Error occurred which is not described in PEX
* spec.
* This error is also mapped either to Master Abort(
* Y2_IS_MST_ERR) or Target Abort (Y2_IS_IRQ_STAT) bit and
diff --git a/sys/dev/msk/if_mskreg.h b/sys/dev/msk/if_mskreg.h
index da69f2e..8f2ea63 100644
--- a/sys/dev/msk/if_mskreg.h
+++ b/sys/dev/msk/if_mskreg.h
@@ -1309,7 +1309,7 @@
#define PHY_ST_EXT_ST (1<<8) /* Bit 8: Extended Status Present */
#define PHY_ST_PRE_SUP (1<<6) /* Bit 6: Preamble Suppression */
#define PHY_ST_AN_OVER (1<<5) /* Bit 5: Auto-Negotiation Over */
-#define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remote Fault Condition Occured */
+#define PHY_ST_REM_FLT (1<<4) /* Bit 4: Remote Fault Condition Occurred */
#define PHY_ST_AN_CAP (1<<3) /* Bit 3: Auto-Negotiation Capability */
#define PHY_ST_LSYNC (1<<2) /* Bit 2: Link Synchronized */
#define PHY_ST_JAB_DET (1<<1) /* Bit 1: Jabber Detected */
@@ -1813,8 +1813,8 @@
#define GM_GPSR_LINK_UP BIT_12 /* Link Up Status */
#define GM_GPSR_PAUSE BIT_11 /* Pause State */
#define GM_GPSR_TX_ACTIVE BIT_10 /* Tx in Progress */
-#define GM_GPSR_EXC_COL BIT_9 /* Excessive Collisions Occured */
-#define GM_GPSR_LAT_COL BIT_8 /* Late Collisions Occured */
+#define GM_GPSR_EXC_COL BIT_9 /* Excessive Collisions Occurred */
+#define GM_GPSR_LAT_COL BIT_8 /* Late Collisions Occurred */
#define GM_GPSR_PHY_ST_CH BIT_5 /* PHY Status Change */
#define GM_GPSR_GIG_SPEED BIT_4 /* Gigabit Speed (1 = 1000 Mbps) */
#define GM_GPSR_PART_MODE BIT_3 /* Partition mode */
diff --git a/sys/dev/mvs/mvs.c b/sys/dev/mvs/mvs.c
index 699c22f..b3ff4d1 100644
--- a/sys/dev/mvs/mvs.c
+++ b/sys/dev/mvs/mvs.c
@@ -475,7 +475,7 @@ mvs_setup_edma_queues(device_t dev)
ATA_OUTL(ch->r_mem, EDMA_REQQOP, work & 0xffffffff);
bus_dmamap_sync(ch->dma.workrq_tag, ch->dma.workrq_map,
BUS_DMASYNC_PREWRITE);
- /* Reponses queue. */
+ /* Responses queue. */
memset(ch->dma.workrp, 0xff, MVS_WORKRP_SIZE);
work = ch->dma.workrp_bus;
ATA_OUTL(ch->r_mem, EDMA_RESQBAH, work >> 32);
@@ -1042,7 +1042,7 @@ mvs_crbq_intr(device_t dev)
slot = le16toh(crpb->id) & MVS_CRPB_TAG_MASK;
flags = le16toh(crpb->rspflg);
/*
- * Handle only successfull completions here.
+ * Handle only successful completions here.
* Errors will be handled by main intr handler.
*/
#if defined(__i386__) || defined(__amd64__)
diff --git a/sys/dev/mvs/mvs.h b/sys/dev/mvs/mvs.h
index 163af50..51f1d51 100644
--- a/sys/dev/mvs/mvs.h
+++ b/sys/dev/mvs/mvs.h
@@ -566,7 +566,7 @@ struct mvs_channel {
int numtslotspd[16];/* Number of NCQ slots per dev */
int numhslots; /* Number of held slots */
int recoverycmd; /* Our READ LOG active */
- int fatalerr; /* Fatal error happend */
+ int fatalerr; /* Fatal error happened */
int lastslot; /* Last used slot */
int taggedtarget; /* Last tagged target */
int resetting; /* Hard-reset in progress. */
diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c
index 161af74..100d7b5 100644
--- a/sys/dev/mwl/if_mwl.c
+++ b/sys/dev/mwl/if_mwl.c
@@ -4665,7 +4665,7 @@ mwl_txq_dump(&sc->sc_txq[0]);/*XXX*/
* Diagnostic interface to the HAL. This is used by various
* tools to do things like retrieve register contents for
* debugging. The mechanism is intentionally opaque so that
- * it can change frequently w/o concern for compatiblity.
+ * it can change frequently w/o concern for compatibility.
*/
static int
mwl_ioctl_diag(struct mwl_softc *sc, struct mwl_diag *md)
diff --git a/sys/dev/mwl/if_mwlvar.h b/sys/dev/mwl/if_mwlvar.h
index 4a4b338..e5feda9 100644
--- a/sys/dev/mwl/if_mwlvar.h
+++ b/sys/dev/mwl/if_mwlvar.h
@@ -37,6 +37,7 @@
#define _DEV_MWL_MVVAR_H
#include <sys/endian.h>
+#include <sys/bus.h>
#include <net80211/ieee80211_radiotap.h>
#include <dev/mwl/mwlhal.h>
#include <dev/mwl/mwlreg.h>
@@ -64,7 +65,7 @@
#define MWL_TXDESC 1 /* max tx descriptors/segments */
#endif
#ifndef MWL_AGGR_SIZE
-#define MWL_AGGR_SIZE 3839 /* max tx agregation size */
+#define MWL_AGGR_SIZE 3839 /* max tx aggregation size */
#endif
#define MWL_AGEINTERVAL 1 /* poke f/w every sec to age q's */
#define MWL_MAXSTAID 64 /* max of 64 stations */
diff --git a/sys/dev/mwl/mwlhal.h b/sys/dev/mwl/mwlhal.h
index 25b8b07..087effa 100644
--- a/sys/dev/mwl/mwlhal.h
+++ b/sys/dev/mwl/mwlhal.h
@@ -71,15 +71,13 @@ enum {
MWL_WME_AC_VO = 3, /* voice access category */
};
-struct device;
-
struct mwl_hal {
bus_space_handle_t mh_ioh; /* BAR 1 copied from softc */
bus_space_tag_t mh_iot;
uint32_t mh_imask; /* interrupt mask */
/* remainder is opaque to driver */
};
-struct mwl_hal *mwl_hal_attach(struct device *dev, uint16_t devid,
+struct mwl_hal *mwl_hal_attach(device_t dev, uint16_t devid,
bus_space_handle_t ioh, bus_space_tag_t iot, bus_dma_tag_t tag);
void mwl_hal_detach(struct mwl_hal *);
diff --git a/sys/dev/nand/nfc_fsl.c b/sys/dev/nand/nfc_fsl.c
index 414c009..8c3ca06 100644
--- a/sys/dev/nand/nfc_fsl.c
+++ b/sys/dev/nand/nfc_fsl.c
@@ -515,7 +515,7 @@ fsl_nfc_start_command(device_t dev)
if (fcm->status)
sc->fcm.reg_mdr = LBC_READ(MDR);
- /* Even if timeout occured, we should perform steps below */
+ /* Even if timeout occurred, we should perform steps below */
LBC_WRITE(LTESR, ltesr_v);
LBC_WRITE(LTEATR, 0);
diff --git a/sys/dev/ncr/ncr.c b/sys/dev/ncr/ncr.c
index 8f02ef0..6f52f0f 100644
--- a/sys/dev/ncr/ncr.c
+++ b/sys/dev/ncr/ncr.c
@@ -737,7 +737,7 @@ struct head {
**
** The last four bytes are used inside the script by "COPY" commands.
** Because source and destination must have the same alignment
-** in a longword, the fields HAVE to be at the choosen offsets.
+** in a longword, the fields HAVE to be at the chosen offsets.
** xerr_st (4) 0 (0x34) scratcha
** sync_st (5) 1 (0x05) sxfer
** wide_st (7) 3 (0x03) scntl3
@@ -1698,7 +1698,7 @@ static struct script script0 = {
}/*-------------------------< NO_DATA >--------------------*/,{
/*
- ** The target wants to tranfer too much data
+ ** The target wants to transfer too much data
** or in the wrong direction.
** Remember that in extended error.
*/
@@ -3642,7 +3642,7 @@ ncr_attach (device_t dev)
(np->rv_ctest5 & DFS) ? "large" : "normal");
/*
- ** Print some complementary information that can be helpfull.
+ ** Print some complementary information that can be helpful.
*/
if (bootverbose)
device_printf(dev, "%s, %s IRQ driver%s\n",
@@ -5622,7 +5622,7 @@ static void ncr_int_ma (ncb_p np, u_char dstat)
/*
- ** The data in the dma fifo has not been transfered to
+ ** The data in the dma fifo has not been transferred to
** the target -> add the amount to the rest
** and clear the data.
** Check the sstat2 register in case of wide transfer.
@@ -5921,7 +5921,7 @@ static void ncr_int_sir (ncb_p np)
** Was Sie schon immer ueber transfermode negotiation wissen wollten ...
**
** We try to negotiate sync and wide transfer only after
-** a successfull inquire command. We look at byte 7 of the
+** a successful inquire command. We look at byte 7 of the
** inquire data to determine the capabilities if the target.
**
** When we try to negotiate, we append the negotiation message
@@ -5929,7 +5929,7 @@ static void ncr_int_sir (ncb_p np)
** The host status field is set to HS_NEGOTIATE to mark this
** situation.
**
-** If the target doesn't answer this message immidiately
+** If the target doesn't answer this message immediately
** (as required by the standard), the SIR_NEGO_FAIL interrupt
** will be raised eventually.
** The handler removes the HS_NEGOTIATE status, and sets the
@@ -6356,7 +6356,7 @@ out:
/*==========================================================
**
**
-** Aquire a control block
+** Acquire a control block
**
**
**==========================================================
diff --git a/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c b/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c
index 2f864ab..565a5f6 100644
--- a/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c
+++ b/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c
@@ -355,7 +355,7 @@ nf10bmac_rx_locked(struct nf10bmac_softc *sc)
/*
* General problem here in case we need to sync ourselves to the
* beginning of a packet. Length will only be set for the first
- * read, and together with strb we can detect the begining (or
+ * read, and together with strb we can detect the beginning (or
* skip to tlast).
*/
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index f1b8610..ee38452 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -186,7 +186,7 @@ ports attached to the switch)
* This is a persistent or ephemeral VALE port. Ephemeral ports
* are created on the fly if they don't already exist, and are
* always attached to a bridge.
- * Persistent VALE ports must must be created seperately, and i
+ * Persistent VALE ports must must be created separately, and i
* then attached like normal NICs. The NIOCREGIF we are examining
* will find them only if they had previosly been created and
* attached (see VALE_CTL below).
@@ -1378,7 +1378,7 @@ netmap_get_na(struct nmreq *nmr, struct netmap_adapter **na, int create)
NMG_LOCK_ASSERT();
- /* we cascade through all possibile types of netmap adapter.
+ /* we cascade through all possible types of netmap adapter.
* All netmap_get_*_na() functions return an error and an na,
* with the following combinations:
*
@@ -1912,7 +1912,7 @@ netmap_rel_exclusive(struct netmap_priv_d *priv)
*
* * netmap_pipe_reg (pipes)
* inform the other pipe end that it is no
- * longer responsibile for the lifetime of this
+ * longer responsible for the lifetime of this
* pipe end
*
* * netmap_monitor_reg (monitors)
diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c
index 9129960..85a6a9f 100644
--- a/sys/dev/netmap/netmap_generic.c
+++ b/sys/dev/netmap/netmap_generic.c
@@ -332,7 +332,7 @@ generic_netmap_register(struct netmap_adapter *na, int enable)
} else if (na->tx_rings[0].tx_pool) {
/* Disable netmap mode. We enter here only if the previous
- generic_netmap_register(na, 1) was successfull.
+ generic_netmap_register(na, 1) was successful.
If it was not, na->tx_rings[0].tx_pool was set to NULL by the
error handling code below. */
rtnl_lock();
diff --git a/sys/dev/netmap/netmap_offloadings.c b/sys/dev/netmap/netmap_offloadings.c
index 4055c42..dadc1dc 100644
--- a/sys/dev/netmap/netmap_offloadings.c
+++ b/sys/dev/netmap/netmap_offloadings.c
@@ -171,7 +171,7 @@ void bdg_mismatch_datapath(struct netmap_vp_adapter *na,
* - 12: the first 10 bytes correspond to the struct
* virtio_net_hdr, and the last 2 bytes store the
* "mergeable buffers" info, which is an optional
- * hint that can be zeroed for compability
+ * hint that can be zeroed for compatibility
*
* The destination header is therefore built according to the
* following table:
diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c
index 2d92bc3..2bd49e1 100644
--- a/sys/dev/nge/if_nge.c
+++ b/sys/dev/nge/if_nge.c
@@ -2109,7 +2109,7 @@ nge_init_locked(struct nge_softc *sc)
CSR_WRITE_4(sc, NGE_PRIOQCTL, 0);
/*
- * Set pause frames paramters.
+ * Set pause frames parameters.
* Rx stat FIFO hi-threshold : 2 or more packets
* Rx stat FIFO lo-threshold : less than 2 packets
* Rx data FIFO hi-threshold : 2K or more bytes
diff --git a/sys/dev/nsp/nsp.c b/sys/dev/nsp/nsp.c
index 5cda44e..c86bcdb 100644
--- a/sys/dev/nsp/nsp.c
+++ b/sys/dev/nsp/nsp.c
@@ -1069,7 +1069,7 @@ WriteLoop:
* (not scsi bus!), we should check
* the scsi device sends us request
* signals, which means the scsi device
- * is ready to recieve data without
+ * is ready to receive data without
* heavy delays.
*/
if ((slp->sl_scp.scp_datalen % suspendio) == 0)
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw.c b/sys/dev/ntb/ntb_hw/ntb_hw.c
index cb8f27c..c1949f7 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
* allows you to connect two systems using a PCI-e link.
*
* This module contains the hardware abstraction layer for the NTB. It allows
- * you to send and recieve interrupts, map the memory windows and send and
+ * you to send and receive interrupts, map the memory windows and send and
* receive messages in the scratch-pad registers.
*
* NOTE: Much of the code in this module is shared with Linux. Any patches may
@@ -3192,7 +3192,7 @@ ntb_peer_db_set(struct ntb_softc *ntb, uint64_t bit)
* ring to its memory window write.
*
* Note that writing the peer doorbell via a memory window will *not* generate
- * an interrupt on the remote host; that must be done seperately.
+ * an interrupt on the remote host; that must be done separately.
*/
bus_addr_t
ntb_get_peer_db_addr(struct ntb_softc *ntb, vm_size_t *sz_out)
diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c
index 517ff2a..7b069a6 100644
--- a/sys/dev/otus/if_otus.c
+++ b/sys/dev/otus/if_otus.c
@@ -132,6 +132,8 @@ static device_detach_t otus_detach;
static int otus_attachhook(struct otus_softc *);
void otus_get_chanlist(struct otus_softc *);
+static void otus_getradiocaps(struct ieee80211com *, int, int *,
+ struct ieee80211_channel[]);
int otus_load_firmware(struct otus_softc *, const char *,
uint32_t);
int otus_open_pipes(struct otus_softc *);
@@ -179,6 +181,8 @@ int otus_set_multi(struct otus_softc *);
static int otus_updateedca(struct ieee80211com *);
static void otus_updateedca_locked(struct otus_softc *);
static void otus_updateslot(struct otus_softc *);
+static void otus_set_operating_mode(struct otus_softc *sc);
+static void otus_set_rx_filter(struct otus_softc *sc);
int otus_init_mac(struct otus_softc *);
uint32_t otus_phy_get_def(struct otus_softc *, uint32_t);
int otus_set_board_values(struct otus_softc *,
@@ -624,7 +628,6 @@ otus_attachhook(struct otus_softc *sc)
struct ieee80211com *ic = &sc->sc_ic;
usb_device_request_t req;
uint32_t in, out;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int error;
/* Not locked */
@@ -742,20 +745,8 @@ otus_attachhook(struct otus_softc *sc)
/* Build the list of supported channels. */
otus_get_chanlist(sc);
#else
- /* Set supported .11b and .11g rates. */
- memset(bands, 0, sizeof(bands));
- if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) {
- setbit(bands, IEEE80211_MODE_11B);
- setbit(bands, IEEE80211_MODE_11G);
- }
- if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) {
- setbit(bands, IEEE80211_MODE_11A);
- }
-#if 0
- if (sc->sc_ht)
- setbit(bands, IEEE80211_MODE_11NG);
-#endif
- ieee80211_init_channels(ic, NULL, bands);
+ otus_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
+ ic->ic_channels);
#endif
ieee80211_ifattach(ic);
@@ -763,6 +754,7 @@ otus_attachhook(struct otus_softc *sc)
ic->ic_scan_start = otus_scan_start;
ic->ic_scan_end = otus_scan_end;
ic->ic_set_channel = otus_set_channel;
+ ic->ic_getradiocaps = otus_getradiocaps;
ic->ic_vap_create = otus_vap_create;
ic->ic_vap_delete = otus_vap_delete;
ic->ic_update_mcast = otus_update_mcast;
@@ -820,6 +812,32 @@ otus_get_chanlist(struct otus_softc *sc)
}
}
+static void
+otus_getradiocaps(struct ieee80211com *ic,
+ int maxchans, int *nchans, struct ieee80211_channel chans[])
+{
+ struct otus_softc *sc = ic->ic_softc;
+ uint8_t bands[IEEE80211_MODE_BYTES];
+
+ /* Set supported .11b and .11g rates. */
+ memset(bands, 0, sizeof(bands));
+ if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) {
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+#if 0
+ if (sc->sc_ht)
+ setbit(bands, IEEE80211_MODE_11NG);
+#endif
+ ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
+ ar_chans, 14, bands, 0);
+ }
+ if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) {
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
+ &ar_chans[14], nitems(ar_chans) - 14, bands, 0);
+ }
+}
+
int
otus_load_firmware(struct otus_softc *sc, const char *name, uint32_t addr)
{
@@ -948,7 +966,7 @@ otus_alloc_cmd_list(struct otus_softc *sc, struct otus_tx_cmd cmd[],
for (i = 0; i < ndata; i++) {
struct otus_tx_cmd *dp = &cmd[i];
- dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
+ dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT | M_ZERO);
dp->odata = NULL;
if (dp->buf == NULL) {
device_printf(sc->sc_dev,
@@ -1012,7 +1030,7 @@ otus_alloc_list(struct otus_softc *sc, struct otus_data data[],
struct otus_data *dp = &data[i];
dp->sc = sc;
dp->m = NULL;
- dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
+ dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT | M_ZERO);
if (dp->buf == NULL) {
device_printf(sc->sc_dev,
"could not allocate buffer\n");
@@ -1126,6 +1144,7 @@ _otus_getbuf(struct otus_softc *sc)
STAILQ_REMOVE_HEAD(&sc->sc_tx_inactive, next);
else
bf = NULL;
+ /* XXX bzero? */
return (bf);
}
@@ -1208,7 +1227,6 @@ otus_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
struct otus_vap *uvp = OTUS_VAP(vap);
struct ieee80211com *ic = vap->iv_ic;
struct otus_softc *sc = ic->ic_softc;
- struct ieee80211_node *ni;
enum ieee80211_state ostate;
ostate = vap->iv_state;
@@ -1223,18 +1241,20 @@ otus_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
/* XXX TODO: more fleshing out! */
switch (nstate) {
+ case IEEE80211_S_INIT:
+ otus_set_operating_mode(sc);
+ otus_set_rx_filter(sc);
+ break;
case IEEE80211_S_RUN:
- ni = ieee80211_ref_node(vap->iv_bss);
-
if (ic->ic_opmode == IEEE80211_M_STA) {
otus_updateslot(sc);
- otus_set_bssid(sc, ni->ni_bssid);
+ otus_set_operating_mode(sc);
+ otus_set_rx_filter(sc);
/* Start calibration timer. */
taskqueue_enqueue_timeout(taskqueue_thread,
&sc->calib_to, hz);
}
- ieee80211_free_node(ni);
break;
default:
break;
@@ -2339,6 +2359,7 @@ otus_set_multi(struct otus_softc *sc)
otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_L, lo);
otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_H, hi);
r = otus_write_barrier(sc);
+ /* XXX operating mode? filter? */
OTUS_UNLOCK(sc);
return (r);
}
@@ -2437,7 +2458,6 @@ otus_init_mac(struct otus_softc *sc)
otus_write(sc, AR_MAC_REG_ACK_EXTENSION, 0x40);
otus_write(sc, AR_MAC_REG_RETRY_MAX, 0);
- otus_write(sc, AR_MAC_REG_SNIFFER, 0x2000000);
otus_write(sc, AR_MAC_REG_RX_THRESHOLD, 0xc1f80);
otus_write(sc, AR_MAC_REG_RX_PE_DELAY, 0x70);
otus_write(sc, AR_MAC_REG_EIFS_AND_SIFS, 0xa144000);
@@ -2449,13 +2469,14 @@ otus_init_mac(struct otus_softc *sc)
otus_write(sc, AR_MAC_REG_BCN_HT1, 0x8000170);
otus_write(sc, AR_MAC_REG_BACKOFF_PROTECT, 0x105);
otus_write(sc, AR_MAC_REG_AMPDU_FACTOR, 0x10000a);
- /* Filter any control frames, BAR is bit 24. */
-// otus_write(sc, AR_MAC_REG_FRAMETYPE_FILTER, 0x0500ffff);
-// otus_write(sc, AR_MAC_REG_RX_CONTROL, 0x1);
+
+ otus_set_rx_filter(sc);
+
otus_write(sc, AR_MAC_REG_BASIC_RATE, 0x150f);
otus_write(sc, AR_MAC_REG_MANDATORY_RATE, 0x150f);
otus_write(sc, AR_MAC_REG_RTS_CTS_RATE, 0x10b01bb);
otus_write(sc, AR_MAC_REG_ACK_TPC, 0x4003c1e);
+
/* Enable LED0 and LED1. */
otus_write(sc, AR_GPIO_REG_PORT_TYPE, 0x3);
otus_write(sc, AR_GPIO_REG_PORT_DATA, 0x3);
@@ -3051,55 +3072,88 @@ otus_led_newstate_type3(struct otus_softc *sc)
#endif
}
+static uint8_t zero_macaddr[IEEE80211_ADDR_LEN] = { 0,0,0,0,0,0 };
+
/*
- * TODO:
- *
- * + If in monitor mode, set BSSID to all zeros, else the node BSSID.
- * + Handle STA + monitor (eg tcpdump/promisc/radiotap) as well as
- * pure monitor mode.
+ * Set up operating mode, MAC/BSS address and RX filter.
*/
-static int
+static void
otus_set_operating_mode(struct otus_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
- uint32_t rx_ctrl;
- uint32_t frm_filt;
- uint32_t cam_mode;
- uint32_t rx_sniffer;
+ struct ieee80211vap *vap;
+ uint32_t cam_mode = AR_MAC_CAM_DEFAULTS;
+ uint32_t rx_ctrl = AR_MAC_RX_CTRL_DEAGG | AR_MAC_RX_CTRL_SHORT_FILTER;
+ uint32_t sniffer = AR_MAC_SNIFFER_DEFAULTS;
+ uint32_t enc_mode = 0x78; /* XXX */
+ const uint8_t *macaddr;
+ uint8_t bssid[IEEE80211_ADDR_LEN];
+ struct ieee80211_node *ni;
OTUS_LOCK_ASSERT(sc);
- /* XXX TODO: too many magic constants */
- rx_ctrl = 0x1;
- /* Filter any control frames, BAR is bit 24. */
- frm_filt = 0x0500ffff;
- cam_mode = 0x0f000002; /* XXX STA */
- rx_sniffer = 0x20000000;
+ /*
+ * If we're in sniffer mode or we don't have a MAC
+ * address assigned, ensure it gets reset to all-zero.
+ */
+ IEEE80211_ADDR_COPY(bssid, zero_macaddr);
+ vap = TAILQ_FIRST(&ic->ic_vaps);
+ macaddr = ic->ic_macaddr;
switch (ic->ic_opmode) {
case IEEE80211_M_STA:
- cam_mode = 0x0f000002; /* XXX STA */
- rx_ctrl = 0x1;
- frm_filt = 0x0500ffff;
- rx_sniffer = 0x20000000;
+ if (vap) {
+ ni = ieee80211_ref_node(vap->iv_bss);
+ IEEE80211_ADDR_COPY(bssid, ni->ni_bssid);
+ ieee80211_free_node(ni);
+ }
+ cam_mode |= AR_MAC_CAM_STA;
+ rx_ctrl |= AR_MAC_RX_CTRL_PASS_TO_HOST;
break;
case IEEE80211_M_MONITOR:
- cam_mode = 0x0f000002; /* XXX STA */
- rx_ctrl = 0x1;
- frm_filt = 0xffffffff;
- rx_sniffer = 0x20000001;
- break;
+ /*
+ * Note: monitor mode ends up causing the MAC to
+ * generate ACK frames for everything it sees.
+ * So don't do that; instead just put it in STA mode
+ * and disable RX filters.
+ */
default:
+ cam_mode |= AR_MAC_CAM_STA;
+ rx_ctrl |= AR_MAC_RX_CTRL_PASS_TO_HOST;
break;
}
- otus_write(sc, AR_MAC_REG_SNIFFER, rx_sniffer);
+ /*
+ * TODO: if/when we do hardware encryption, ensure it's
+ * disabled if the NIC is in monitor mode.
+ */
+ otus_write(sc, AR_MAC_REG_SNIFFER, sniffer);
otus_write(sc, AR_MAC_REG_CAM_MODE, cam_mode);
- otus_write(sc, AR_MAC_REG_FRAMETYPE_FILTER, frm_filt);
- otus_write(sc, AR_MAC_REG_RX_CONTROL, cam_mode);
+ otus_write(sc, AR_MAC_REG_ENCRYPTION, enc_mode);
+ otus_write(sc, AR_MAC_REG_RX_CONTROL, rx_ctrl);
+ otus_set_macaddr(sc, macaddr);
+ otus_set_bssid(sc, bssid);
+ /* XXX barrier? */
+}
- (void) otus_write_barrier(sc);
- return (0);
+static void
+otus_set_rx_filter(struct otus_softc *sc)
+{
+// struct ieee80211com *ic = &sc->sc_ic;
+
+ OTUS_LOCK_ASSERT(sc);
+
+#if 0
+ if (ic->ic_allmulti > 0 || ic->ic_promisc > 0 ||
+ ic->ic_opmode == IEEE80211_M_MONITOR) {
+ otus_write(sc, AR_MAC_REG_FRAMETYPE_FILTER, 0xff00ffff);
+ } else {
+#endif
+ /* Filter any control frames, BAR is bit 24. */
+ otus_write(sc, AR_MAC_REG_FRAMETYPE_FILTER, 0x0500ffff);
+#if 0
+ }
+#endif
}
int
@@ -3123,7 +3177,8 @@ otus_init(struct otus_softc *sc)
return error;
}
- (void) otus_set_macaddr(sc, ic->ic_macaddr);
+ otus_set_operating_mode(sc);
+ otus_set_rx_filter(sc);
(void) otus_set_operating_mode(sc);
sc->bb_reset = 1; /* Force cold reset. */
diff --git a/sys/dev/otus/if_otusreg.h b/sys/dev/otus/if_otusreg.h
index 541d767..f7b1eda 100644
--- a/sys/dev/otus/if_otusreg.h
+++ b/sys/dev/otus/if_otusreg.h
@@ -348,8 +348,8 @@ struct ar_evt_tx_comp {
/* List of supported channels. */
static const uint8_t ar_chans[] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124,
- 128, 132, 136, 140, 149, 153, 157, 161, 165, 34, 38, 42, 46
+ 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, 100, 104, 108,
+ 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
};
/*
diff --git a/sys/dev/patm/if_patmvar.h b/sys/dev/patm/if_patmvar.h
index e934784..c87787a 100644
--- a/sys/dev/patm/if_patmvar.h
+++ b/sys/dev/patm/if_patmvar.h
@@ -256,7 +256,7 @@ struct patm_softc {
struct callout tst_callout;
u_int tst_free; /* free slots */
u_int tst_reserve; /* non-CBR reserve */
- u_int bwrem; /* remaining bandwith */
+ u_int bwrem; /* remaining bandwidth */
/* sysctl support */
struct sysctl_ctx_list sysctl_ctx;
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index c3a30fa..f120219 100644
--- a/sys/dev/pccbb/pccbb.c
+++ b/sys/dev/pccbb/pccbb.c
@@ -722,7 +722,7 @@ cbb_o2micro_power_hack(struct cbb_softc *sc)
/*
* Restore the damage that cbb_o2micro_power_hack does to EXCA_INTR so
- * we don't have an interrupt storm on power on. This has the efect of
+ * we don't have an interrupt storm on power on. This has the effect of
* disabling card status change interrupts for the duration of poweron.
*/
static void
diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c
index 4ec8d9b..3ccec52 100644
--- a/sys/dev/pccbb/pccbb_pci.c
+++ b/sys/dev/pccbb/pccbb_pci.c
@@ -340,7 +340,7 @@ cbb_pci_attach(device_t brdev)
SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "memory",
CTLFLAG_RD, &sc->subbus, 0, "Memory window open");
SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "premem",
- CTLFLAG_RD, &sc->subbus, 0, "Prefetch memroy window open");
+ CTLFLAG_RD, &sc->subbus, 0, "Prefetch memory window open");
SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "io1",
CTLFLAG_RD, &sc->subbus, 0, "io range 1 open");
SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "io2",
@@ -448,7 +448,7 @@ cbb_chipinit(struct cbb_softc *sc)
if (pci_read_config(sc->dev, PCIR_LATTIMER, 1) < 0x20)
pci_write_config(sc->dev, PCIR_LATTIMER, 0x20, 1);
- /* Enable DMA, memory access for this card and I/O acces for children */
+ /* Enable DMA, memory access for this card and I/O access for children */
pci_enable_busmaster(sc->dev);
pci_enable_io(sc->dev, SYS_RES_IOPORT);
pci_enable_io(sc->dev, SYS_RES_MEMORY);
diff --git a/sys/dev/pcf/pcf_isa.c b/sys/dev/pcf/pcf_isa.c
index 70c3efe..ca63583 100644
--- a/sys/dev/pcf/pcf_isa.c
+++ b/sys/dev/pcf/pcf_isa.c
@@ -112,7 +112,7 @@ pcf_isa_probe(device_t dev)
if ((error = resource_int_value(PCF_NAME, 0, "port", &port) != 0))
return (error);
- /* Probe is only successfull for the specified base io */
+ /* Probe is only successful for the specified base io */
if (port != (u_int)start)
return (ENXIO);
diff --git a/sys/dev/pci/hostb_pci.c b/sys/dev/pci/hostb_pci.c
index 84878ca..79664c6 100644
--- a/sys/dev/pci/hostb_pci.c
+++ b/sys/dev/pci/hostb_pci.c
@@ -51,7 +51,7 @@ pci_hostb_probe(device_t dev)
switch (id) {
- /* VIA VT82C596 Power Managment Function */
+ /* VIA VT82C596 Power Management Function */
case 0x30501106:
return (ENXIO);
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index fd23f3b..630aaa9 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -333,7 +333,7 @@ SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RWTUN,
&pci_do_power_nodriver, 0,
"Place a function into D3 state when no driver attaches to it. 0 means\n\
disable. 1 means conservatively place devices into D3 state. 2 means\n\
-agressively place devices into D3 state. 3 means put absolutely everything\n\
+aggressively place devices into D3 state. 3 means put absolutely everything\n\
in D3 state.");
int pci_do_power_resume = 1;
@@ -1855,7 +1855,7 @@ pci_remap_msix_method(device_t dev, device_t child, int count,
for (i = 0; i < count; i++) {
if (vectors[i] == 0)
continue;
- irq = msix->msix_vectors[vectors[i]].mv_irq;
+ irq = msix->msix_vectors[vectors[i] - 1].mv_irq;
resource_list_add(&dinfo->resources, SYS_RES_IRQ, i + 1, irq,
irq, 1);
}
@@ -1869,7 +1869,7 @@ pci_remap_msix_method(device_t dev, device_t child, int count,
printf("---");
else
printf("%d",
- msix->msix_vectors[vectors[i]].mv_irq);
+ msix->msix_vectors[vectors[i] - 1].mv_irq);
}
printf("\n");
}
@@ -4128,7 +4128,7 @@ pci_attach(device_t dev)
return (error);
/*
- * Since there can be multiple independantly numbered PCI
+ * Since there can be multiple independently numbered PCI
* busses on systems with multiple PCI domains, we can't use
* the unit number to decide which bus we are probing. We ask
* the parent pcib what our domain and bus numbers are.
@@ -5774,7 +5774,7 @@ pci_cfg_save(device_t dev, struct pci_devinfo *dinfo, int setstate)
if (cls == PCIC_STORAGE)
return;
/*FALLTHROUGH*/
- case 2: /* Agressive about what to power down */
+ case 2: /* Aggressive about what to power down */
if (cls == PCIC_DISPLAY || cls == PCIC_MEMORY ||
cls == PCIC_BASEPERIPH)
return;
diff --git a/sys/dev/pdq/pdq.c b/sys/dev/pdq/pdq.c
index 4fb98db..00add2c 100644
--- a/sys/dev/pdq/pdq.c
+++ b/sys/dev/pdq/pdq.c
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
static const char * const pdq_halt_codes[] = {
"Selftest Timeout", "Host Bus Parity Error", "Host Directed Fault",
"Software Fault", "Hardware Fault", "PC Trace Path Test",
- "DMA Error", "Image CRC Error", "Adapter Processer Error"
+ "DMA Error", "Image CRC Error", "Adapter Processor Error"
};
static const char * const pdq_adapter_states[] = {
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index 3a28efd2..ce08ccc 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -113,7 +113,7 @@ struct lpt_data {
prime once */
u_char sc_control;
char sc_flags;
-#define LP_POS_INIT 0x04 /* if we are a postive init signal */
+#define LP_POS_INIT 0x04 /* if we are a positive init signal */
#define LP_POS_ACK 0x08 /* if we are a positive going ack */
#define LP_NO_PRIME 0x10 /* don't prime the printer at all */
#define LP_PRIMEOPEN 0x20 /* prime on every open */
diff --git a/sys/dev/ppbus/ppb_1284.c b/sys/dev/ppbus/ppb_1284.c
index e909e8e..31f38ce 100644
--- a/sys/dev/ppbus/ppb_1284.c
+++ b/sys/dev/ppbus/ppb_1284.c
@@ -103,14 +103,14 @@ ppb_1284_get_state(device_t bus)
/*
* ppb_1284_set_state()
*
- * Change IEEE1284 state if no error occured
+ * Change IEEE1284 state if no error occurred
*/
int
ppb_1284_set_state(device_t bus, int state)
{
struct ppb_data *ppb = DEVTOSOFTC(bus);
- /* call ppb_1284_reset_error() if you absolutly want to change
+ /* call ppb_1284_reset_error() if you absolutely want to change
* the state from PPB_ERROR to another */
mtx_assert(ppb->ppc_lock, MA_OWNED);
if ((ppb->state != PPB_ERROR) &&
@@ -191,7 +191,7 @@ ppb_request_mode(int mode, int options)
/*
* ppb_peripheral_negociate()
*
- * Negociate the peripheral side
+ * Negotiate the peripheral side
*/
int
ppb_peripheral_negociate(device_t bus, int mode, int options)
@@ -249,7 +249,7 @@ ppb_peripheral_negociate(device_t bus, int mode, int options)
#ifdef DEBUG_1284
printf("A");
#endif
- /* negociation succeeds */
+ /* negotiation succeeds */
}
} else {
/* Event 5 - mode not supported */
@@ -648,11 +648,11 @@ ppb_1284_read(device_t bus, int mode, char *buffer,
/*
* ppb_1284_negociate()
*
- * IEEE1284 negociation phase
+ * IEEE1284 negotiation phase
*
* Normal nibble mode or request device id mode (see ppb_1284.h)
*
- * After negociation, nFAULT is low if data is available
+ * After negotiation, nFAULT is low if data is available
*/
int
ppb_1284_negociate(device_t bus, int mode, int options)
@@ -677,7 +677,7 @@ ppb_1284_negociate(device_t bus, int mode, int options)
/* ensure the host is in compatible mode */
ppb_set_mode(bus, PPB_COMPATIBLE);
- /* reset error to catch the actual negociation error */
+ /* reset error to catch the actual negotiation error */
ppb_1284_reset_error(bus, PPB_FORWARD_IDLE);
/* calculate ext. value */
@@ -687,7 +687,7 @@ ppb_1284_negociate(device_t bus, int mode, int options)
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
DELAY(1);
- /* enter negociation phase */
+ /* enter negotiation phase */
ppb_1284_set_state(bus, PPB_NEGOCIATION);
/* Event 0 - put the exten. value on the data lines */
@@ -769,7 +769,7 @@ ppb_1284_negociate(device_t bus, int mode, int options)
ppb_1284_set_state(bus, PPB_REVERSE_IDLE);
break;
case PPB_ECP:
- /* negociation ok, now setup the communication */
+ /* negotiation ok, now setup the communication */
ppb_1284_set_state(bus, PPB_SETUP);
ppb_wctr(bus, (nINIT | AUTOFEED) & ~(SELECTIN | STROBE));
@@ -825,7 +825,7 @@ ppb_1284_terminate(device_t bus)
#endif
/* do not reset error here to keep the error that
- * may occured before the ppb_1284_terminate() call */
+ * may occurred before the ppb_1284_terminate() call */
ppb_1284_set_state(bus, PPB_TERMINATION);
#ifdef PERIPH_1284
diff --git a/sys/dev/ppbus/vpo.c b/sys/dev/ppbus/vpo.c
index f508275..d9e7cb8 100644
--- a/sys/dev/ppbus/vpo.c
+++ b/sys/dev/ppbus/vpo.c
@@ -221,7 +221,7 @@ vpo_intr(struct vpo_data *vpo, struct ccb_scsiio *csio)
return;
}
- /* if a timeout occured, no sense */
+ /* if a timeout occurred, no sense */
if (vpo->vpo_error) {
if (vpo->vpo_error != VP0_ESELECT_TIMEOUT)
device_printf(vpo->vpo_dev, "VP0 error/timeout (%d)\n",
diff --git a/sys/dev/ppbus/vpoio.c b/sys/dev/ppbus/vpoio.c
index 62af869..a989e8d1 100644
--- a/sys/dev/ppbus/vpoio.c
+++ b/sys/dev/ppbus/vpoio.c
@@ -382,7 +382,7 @@ vpoio_detect(struct vpoio_data *vpo)
/* The interface must be at least PS/2 or NIBBLE capable.
* There is no way to know if the ZIP will work with
* PS/2 mode since PS/2 and SPP both use the same connect
- * sequence. One must supress PS/2 with boot flags if
+ * sequence. One must suppress PS/2 with boot flags if
* PS/2 mode fails (see ppc(4)).
*/
if (ppb_set_mode(ppbus, PPB_PS2) != -1) {
diff --git a/sys/dev/qlxgb/qla_def.h b/sys/dev/qlxgb/qla_def.h
index 534f002..77b678c 100644
--- a/sys/dev/qlxgb/qla_def.h
+++ b/sys/dev/qlxgb/qla_def.h
@@ -105,7 +105,7 @@ typedef struct qla_ivec qla_ivec_t;
#define QLA_WATCHDOG_CALLOUT_TICKS 1
/*
- * Adapter structure contains the hardware independant information of the
+ * Adapter structure contains the hardware independent information of the
* pci function.
*/
struct qla_host {
diff --git a/sys/dev/qlxgb/qla_hw.c b/sys/dev/qlxgb/qla_hw.c
index d71bb29..cebe05a 100644
--- a/sys/dev/qlxgb/qla_hw.c
+++ b/sys/dev/qlxgb/qla_hw.c
@@ -28,7 +28,7 @@
/*
* File: qla_hw.c
* Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
- * Content: Contains Hardware dependant functions
+ * Content: Contains Hardware dependent functions
*/
#include <sys/cdefs.h>
@@ -319,7 +319,7 @@ qla_init_cntxt_regions(qla_host_t *ha)
/*
* Initialize the Transmit Context Request so that we don't need to
- * do it everytime we need to create a context
+ * do it every time we need to create a context
*/
tx_cntxt_req = hw->tx_cntxt_req;
@@ -636,7 +636,7 @@ qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint16_t cntxt_id,
/*
* Name: qla_set_mac_rcv_mode
- * Function: Enable/Disable AllMulticast and Promiscous Modes.
+ * Function: Enable/Disable AllMulticast and Promiscuous Modes.
*/
static int
qla_set_mac_rcv_mode(qla_host_t *ha, uint16_t cntxt_id, uint32_t mode)
diff --git a/sys/dev/qlxgb/qla_isr.c b/sys/dev/qlxgb/qla_isr.c
index 983fc12..d9670fb 100644
--- a/sys/dev/qlxgb/qla_isr.c
+++ b/sys/dev/qlxgb/qla_isr.c
@@ -138,7 +138,7 @@ qla_rx_intr(qla_host_t *ha, uint64_t data, uint32_t sds_idx,
}
if (lro->lro_cnt && (tcp_lro_rx(lro, mp, 0) == 0)) {
- /* LRO packet has been successfuly queued */
+ /* LRO packet has been successfully queued */
} else {
(*ifp->if_input)(ifp, mp);
}
diff --git a/sys/dev/qlxgbe/ql_def.h b/sys/dev/qlxgbe/ql_def.h
index b227f67..968cc5b 100644
--- a/sys/dev/qlxgbe/ql_def.h
+++ b/sys/dev/qlxgbe/ql_def.h
@@ -113,7 +113,7 @@ typedef struct _qla_tx_ring {
} qla_tx_ring_t;
/*
- * Adapter structure contains the hardware independant information of the
+ * Adapter structure contains the hardware independent information of the
* pci function.
*/
struct qla_host {
diff --git a/sys/dev/qlxgbe/ql_hw.c b/sys/dev/qlxgbe/ql_hw.c
index bbe774b..996c4bb 100644
--- a/sys/dev/qlxgbe/ql_hw.c
+++ b/sys/dev/qlxgbe/ql_hw.c
@@ -28,7 +28,7 @@
/*
* File: ql_hw.c
* Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
- * Content: Contains Hardware dependant functions
+ * Content: Contains Hardware dependent functions
*/
#include <sys/cdefs.h>
@@ -1102,7 +1102,7 @@ qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr, uint32_t add_mac)
/*
* Name: qla_set_mac_rcv_mode
- * Function: Enable/Disable AllMulticast and Promiscous Modes.
+ * Function: Enable/Disable AllMulticast and Promiscuous Modes.
*/
static int
qla_set_mac_rcv_mode(qla_host_t *ha, uint32_t mode)
diff --git a/sys/dev/qlxge/qls_def.h b/sys/dev/qlxge/qls_def.h
index b486beb..815946f 100644
--- a/sys/dev/qlxge/qls_def.h
+++ b/sys/dev/qlxge/qls_def.h
@@ -237,7 +237,7 @@ typedef struct _qla_mcast {
#define QLA_PAGE_SIZE 4096
/*
- * Adapter structure contains the hardware independant information of the
+ * Adapter structure contains the hardware independent information of the
* pci function.
*/
struct qla_host {
diff --git a/sys/dev/qlxge/qls_hw.c b/sys/dev/qlxge/qls_hw.c
index 181a7b0..b77d20e 100644
--- a/sys/dev/qlxge/qls_hw.c
+++ b/sys/dev/qlxge/qls_hw.c
@@ -28,7 +28,7 @@
/*
* File: qls_hw.c
* Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
- * Content: Contains Hardware dependant functions
+ * Content: Contains Hardware dependent functions
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -353,7 +353,7 @@ qls_config_mcast_mac_addr_exit:
/*
* Name: qls_set_mac_rcv_mode
- * Function: Enable/Disable AllMulticast and Promiscous Modes.
+ * Function: Enable/Disable AllMulticast and Promiscuous Modes.
*/
static int
qls_wait_for_route_idx_ready(qla_host_t *ha, uint32_t op)
diff --git a/sys/dev/qlxge/qls_isr.c b/sys/dev/qlxge/qls_isr.c
index 4cca895..1eb833e 100644
--- a/sys/dev/qlxge/qls_isr.c
+++ b/sys/dev/qlxge/qls_isr.c
@@ -204,7 +204,7 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e)
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
if (lro->lro_cnt && (tcp_lro_rx(lro, mp, 0) == 0)) {
- /* LRO packet has been successfuly queued */
+ /* LRO packet has been successfully queued */
} else {
(*ifp->if_input)(ifp, mp);
}
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
index 5ac753c..9e441e0 100644
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -199,7 +199,7 @@ rt2560_attach(device_t dev, int id)
{
struct rt2560_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int error;
sc->sc_dev = dev;
@@ -780,7 +780,7 @@ rt2560_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
return error;
}
- /* turn assocation led on */
+ /* turn association led on */
rt2560_update_led(sc, 1, 0);
if (vap->iv_opmode != IEEE80211_M_MONITOR)
@@ -1096,7 +1096,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc)
int hw, error;
int8_t rssi, nf;
- /* retrieve last decriptor index processed by cipher engine */
+ /* retrieve last descriptor index processed by cipher engine */
hw = RAL_READ(sc, RT2560_SECCSR0) - sc->rxq.physaddr;
hw /= RT2560_RX_DESC_SIZE;
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index 2e9ceec..9bf3cee 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -199,7 +199,7 @@ rt2661_attach(device_t dev, int id)
struct rt2661_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t val;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int error, ac, ntries;
sc->sc_id = id;
diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c
index c50c14d..bcd276e 100644
--- a/sys/dev/ral/rt2860.c
+++ b/sys/dev/ral/rt2860.c
@@ -232,7 +232,7 @@ rt2860_attach(device_t dev, int id)
struct rt2860_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t tmp;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int error, ntries, qid;
sc->sc_dev = dev;
diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c
index f3c74ce..3ae0fe0 100644
--- a/sys/dev/random/fortuna.c
+++ b/sys/dev/random/fortuna.c
@@ -250,7 +250,7 @@ random_fortuna_process_event(struct harvest_event *event)
/*-
* FS&K - Reseed()
* This introduces new key material into the output generator.
- * Additionaly it increments the output generator's counter
+ * Additionally it increments the output generator's counter
* variable C. When C > 0, the output generator is seeded and
* will deliver output.
* The entropy_data buffer passed is a very specific size; the
diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c
index 49cc8d0..40fc6cd 100644
--- a/sys/dev/random/yarrow.c
+++ b/sys/dev/random/yarrow.c
@@ -96,7 +96,7 @@ static struct yarrow_state {
u_int ys_slowoverthresh; /* slow pool overthreshhold reseed count */
struct ys_pool {
u_int ysp_source_bits[ENTROPYSOURCE]; /* estimated bits of entropy per source */
- u_int ysp_thresh; /* pool reseed threshhold */
+ u_int ysp_thresh; /* pool reseed threshold */
struct randomdev_hash ysp_hash; /* accumulated entropy */
} ys_pool[RANDOM_YARROW_NPOOLS];/* pool[0] is fast, pool[1] is slow */
bool ys_seeded;
@@ -240,8 +240,8 @@ random_yarrow_process_event(struct harvest_event *event)
}
}
/*
- * If enough slow sources are over threshhold, then slow reseed
- * else if any fast source over threshhold, then fast reseed.
+ * If enough slow sources are over threshold, then slow reseed
+ * else if any fast source over threshold, then fast reseed.
*/
if (overthreshhold[RANDOM_YARROW_SLOW] >= yarrow_state.ys_slowoverthresh)
random_yarrow_reseed_internal(RANDOM_YARROW_SLOW);
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index d600626..24b851a 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -1123,7 +1123,7 @@ rc_test(struct rc_softc *sc)
chipid = RC_FAKEID;
- /* First, reset board to inital state */
+ /* First, reset board to initial state */
rc_hwreset(sc, chipid);
divs = RC_BRD(19200);
diff --git a/sys/dev/rl/if_rlreg.h b/sys/dev/rl/if_rlreg.h
index 5a5c5f5..2cef251 100644
--- a/sys/dev/rl/if_rlreg.h
+++ b/sys/dev/rl/if_rlreg.h
@@ -681,7 +681,7 @@ struct rl_desc {
#define RL_TDESC_STAT_LINKFAIL 0x00200000 /* link faulure */
#define RL_TDESC_STAT_OWINCOL 0x00400000 /* out-of-window collision */
#define RL_TDESC_STAT_TXERRSUM 0x00800000 /* transmit error summary */
-#define RL_TDESC_STAT_UNDERRUN 0x02000000 /* TX underrun occured */
+#define RL_TDESC_STAT_UNDERRUN 0x02000000 /* TX underrun occurred */
#define RL_TDESC_STAT_OWN 0x80000000
/*
diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c
index 0f7422f..f24fa1d 100644
--- a/sys/dev/rtwn/if_rtwn.c
+++ b/sys/dev/rtwn/if_rtwn.c
@@ -251,7 +251,7 @@ rtwn_attach(device_t dev)
struct rtwn_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t lcsr;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int i, count, error, rid;
sc->sc_dev = dev;
diff --git a/sys/dev/sbni/if_sbni.c b/sys/dev/sbni/if_sbni.c
index 6281e7d..50a3bcd 100644
--- a/sys/dev/sbni/if_sbni.c
+++ b/sys/dev/sbni/if_sbni.c
@@ -607,7 +607,7 @@ upload_data(struct sbni_softc *sc, u_int framelen, u_int frameno,
/*
* if CRC is right but framelen incorrect then transmitter
- * error was occured... drop entire packet
+ * error was occurred... drop entire packet
*/
} else if ((frame_ok = skip_tail(sc, framelen, crc)) != 0) {
sc->wait_frameno = 0;
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index bd685f1..2d0df0f 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -720,7 +720,7 @@ sf_probe(device_t dev)
}
if (vid == AD_VENDORID && did == AD_DEVICEID_STARFIRE) {
- /* unkown subdevice */
+ /* unknown subdevice */
device_set_desc(dev, sf_devs[0].sf_name);
return (BUS_PROBE_DEFAULT);
}
@@ -1515,7 +1515,7 @@ sf_fixup_rx(struct mbuf *m)
* it is marred by one truly stupid design flaw, which is that receive
* buffer addresses must be aligned on a longword boundary. This forces
* the packet payload to be unaligned, which is suboptimal on the x86 and
- * completely unuseable on the Alpha. Our only recourse is to copy received
+ * completely unusable on the Alpha. Our only recourse is to copy received
* packets into properly aligned buffers before handing them off.
*/
static int
diff --git a/sys/dev/sfxge/common/efx_bootcfg.c b/sys/dev/sfxge/common/efx_bootcfg.c
index 16ee337..a9717bb 100644
--- a/sys/dev/sfxge/common/efx_bootcfg.c
+++ b/sys/dev/sfxge/common/efx_bootcfg.c
@@ -73,7 +73,7 @@ efx_bootcfg_verify(
size_t used = 0;
efx_rc_t rc;
- /* Start parsing tags immediatly after the checksum */
+ /* Start parsing tags immediately after the checksum */
for (offset = 1; offset < size; ) {
uint8_t tag;
uint8_t length;
diff --git a/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c
index dd28ece..149cd23 100644
--- a/sys/dev/sfxge/common/efx_nic.c
+++ b/sys/dev/sfxge/common/efx_nic.c
@@ -390,7 +390,7 @@ efx_nic_create(
case EFX_FAMILY_MEDFORD:
enp->en_enop = (efx_nic_ops_t *)&__efx_nic_medford_ops;
/*
- * FW_ASSISTED_TSO ommitted as Medford only supports firmware
+ * FW_ASSISTED_TSO omitted as Medford only supports firmware
* assisted TSO version 2, not the v1 scheme used on Huntington.
*/
enp->en_features =
diff --git a/sys/dev/sfxge/common/efx_regs_mcdi.h b/sys/dev/sfxge/common/efx_regs_mcdi.h
index a1d76ab..bc1451d 100644
--- a/sys/dev/sfxge/common/efx_regs_mcdi.h
+++ b/sys/dev/sfxge/common/efx_regs_mcdi.h
@@ -754,7 +754,7 @@
#define FCDI_EVENT_PORT_CONFIG_DATA_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
+ * to the MC. Note that this structure | is overlaid over a normal FCDI event
* such that bits 32-63 containing | event code, level, source etc remain the
* same. In this case the data | field of the header is defined to be the
* number of timestamps
@@ -11469,7 +11469,7 @@
#define MC_CMD_DUMP_BUFTBL_ENTRIES_OUT_LENMIN 12
#define MC_CMD_DUMP_BUFTBL_ENTRIES_OUT_LENMAX 252
#define MC_CMD_DUMP_BUFTBL_ENTRIES_OUT_LEN(num) (0+12*(num))
-/* Raw buffer table entries, layed out as BUFTBL_ENTRY. */
+/* Raw buffer table entries, laid out as BUFTBL_ENTRY. */
#define MC_CMD_DUMP_BUFTBL_ENTRIES_OUT_ENTRY_OFST 0
#define MC_CMD_DUMP_BUFTBL_ENTRIES_OUT_ENTRY_LEN 12
#define MC_CMD_DUMP_BUFTBL_ENTRIES_OUT_ENTRY_MINNUM 1
@@ -13322,7 +13322,7 @@
#define MC_CMD_PRIVILEGE_MASK_IN_GRP_ALL_MULTICAST 0x200 /* enum */
#define MC_CMD_PRIVILEGE_MASK_IN_GRP_PROMISCUOUS 0x400 /* enum */
/* enum: Allows to set the TX packets' source MAC address to any arbitrary MAC
- * adress.
+ * address.
*/
#define MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX 0x800
/* enum: Privilege that allows a Function to change the MAC address configured
diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c
index dd471f4..8abe73d 100644
--- a/sys/dev/sfxge/common/hunt_nvram.c
+++ b/sys/dev/sfxge/common/hunt_nvram.c
@@ -1113,7 +1113,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);
diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c
index 9708e0c..b031120 100644
--- a/sys/dev/sfxge/common/siena_nvram.c
+++ b/sys/dev/sfxge/common/siena_nvram.c
@@ -342,7 +342,7 @@ siena_nvram_get_dynamic_cfg(
!= SIENA_MC_DYNAMIC_CONFIG_MAGIC)
goto invalid1;
- /* All future versions of the structure must be backwards compatable */
+ /* All future versions of the structure must be backwards compatible */
EFX_STATIC_ASSERT(SIENA_MC_DYNAMIC_CONFIG_VERSION == 0);
hdr_length = EFX_WORD_FIELD(dcfg->length, EFX_WORD_0);
diff --git a/sys/dev/sfxge/common/siena_vpd.c b/sys/dev/sfxge/common/siena_vpd.c
index 7a7ce67..4bee1e9 100644
--- a/sys/dev/sfxge/common/siena_vpd.c
+++ b/sys/dev/sfxge/common/siena_vpd.c
@@ -80,7 +80,7 @@ siena_vpd_get_static(
goto fail4;
}
- /* All future versions of the structure must be backwards compatable */
+ /* All future versions of the structure must be backwards compatible */
EFX_STATIC_ASSERT(SIENA_MC_STATIC_CONFIG_VERSION == 0);
hdr_length = EFX_WORD_FIELD(scfg->length, EFX_WORD_0);
diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c
index 876bd1f..4424c9b 100644
--- a/sys/dev/sfxge/sfxge_rx.c
+++ b/sys/dev/sfxge/sfxge_rx.c
@@ -829,7 +829,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop)
if (rx_desc->flags & (EFX_ADDR_MISMATCH | EFX_DISCARD))
goto discard;
- /* Read the length from the psuedo header if required */
+ /* Read the length from the pseudo header if required */
if (rx_desc->flags & EFX_PKT_PREFIX_LEN) {
uint16_t tmp_size;
int rc;
diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c
index 6e93b12..69ea549 100644
--- a/sys/dev/sfxge/sfxge_tx.c
+++ b/sys/dev/sfxge/sfxge_tx.c
@@ -207,7 +207,7 @@ sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq)
static unsigned int
sfxge_is_mbuf_non_tcp(struct mbuf *mbuf)
{
- /* Absense of TCP checksum flags does not mean that it is non-TCP
+ /* Absence of TCP checksum flags does not mean that it is non-TCP
* but it should be true if user wants to achieve high throughput.
*/
return (!(mbuf->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)));
diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c
index 163dd31..5c2ccbb 100644
--- a/sys/dev/si/si.c
+++ b/sys/dev/si/si.c
@@ -541,7 +541,7 @@ try_next:
pp = sc->sc_ports;
nmodule = 0;
modp = (struct si_module *)(maddr + 0x80);
- uart_type = 1000; /* arbitary, > uchar_max */
+ uart_type = 1000; /* arbitrary, > uchar_max */
for (;;) {
switch (modp->sm_type) {
case TA4:
diff --git a/sys/dev/si/si.h b/sys/dev/si/si.h
index 64891ec..0a45a3c 100644
--- a/sys/dev/si/si.h
+++ b/sys/dev/si/si.h
@@ -76,7 +76,7 @@ struct si_module {
};
/*
- * The 'next' pointer & with 0x7fff + SI base addres give
+ * The 'next' pointer & with 0x7fff + SI base address give
* the address of the next module block if fitted. (else 0)
* Note that next points to the TX buffer so 0x60 must be
* subtracted to find the true base.
diff --git a/sys/dev/siis/siis.c b/sys/dev/siis/siis.c
index 0841471..989a780 100644
--- a/sys/dev/siis/siis.c
+++ b/sys/dev/siis/siis.c
@@ -856,7 +856,7 @@ siis_ch_intr(void *data)
/* Read command statuses. */
sstatus = ATA_INL(ch->r_mem, SIIS_P_SS);
ok = ch->rslots & ~sstatus;
- /* Complete all successfull commands. */
+ /* Complete all successful commands. */
for (i = 0; i < SIIS_MAX_SLOTS; i++) {
if ((ok >> i) & 1)
siis_end_transaction(&ch->slot[i], SIIS_ERR_NONE);
diff --git a/sys/dev/siis/siis.h b/sys/dev/siis/siis.h
index 6d8a063..d0e0d88 100644
--- a/sys/dev/siis/siis.h
+++ b/sys/dev/siis/siis.h
@@ -389,7 +389,7 @@ struct siis_channel {
int numtslots[SIIS_MAX_SLOTS]; /* Number of tagged slots */
int numhslots; /* Number of held slots */
int recoverycmd; /* Our READ LOG active */
- int fatalerr; /* Fatal error happend */
+ int fatalerr; /* Fatal error happened */
int recovery; /* Some slots are in error */
union ccb *frozen; /* Frozen command */
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 60ba8b8..166e6bf 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -2323,7 +2323,7 @@ siocntxwait(iobase)
/*
* Read the serial port specified and try to figure out what speed
* it's currently running at. We're assuming the serial port has
- * been initialized and is basicly idle. This routine is only intended
+ * been initialized and is basically idle. This routine is only intended
* to be run at system startup.
*
* If the value read from the serial port doesn't make sense, return 0.
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c
index bdf4365..b0a46c9 100644
--- a/sys/dev/sk/if_sk.c
+++ b/sys/dev/sk/if_sk.c
@@ -3275,7 +3275,7 @@ sk_init_xmac(sc_if)
* that jumbo frames larger than 8192 bytes will be
* truncated. Disabling all bad frame filtering causes
* the RX FIFO to operate in streaming mode, in which
- * case the XMAC will start transfering frames out of the
+ * case the XMAC will start transferring frames out of the
* RX FIFO as soon as the FIFO threshold is reached.
*/
if (ifp->if_mtu > SK_MAX_FRAMELEN) {
diff --git a/sys/dev/sk/yukonreg.h b/sys/dev/sk/yukonreg.h
index efe71a0..33ca8b2 100644
--- a/sys/dev/sk/yukonreg.h
+++ b/sys/dev/sk/yukonreg.h
@@ -165,7 +165,7 @@
/* SMI Data Register (SMIDR) */
#define YUKON_SMIDR 0x0084
-/* PHY Addres Register (PAR) */
+/* PHY Address Register (PAR) */
#define YUKON_PAR 0x0088
#define YU_PAR_MIB_CLR 0x0020 /* MIB Counters Clear Mode */
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c
index 77ec927..7ac2a13 100644
--- a/sys/dev/sn/if_sn.c
+++ b/sys/dev/sn/if_sn.c
@@ -283,7 +283,7 @@ sninit_locked(void *xsc)
CSR_WRITE_2(sc, TXMIT_CONTROL_REG_W, 0x0000);
/*
- * Set the control register to automatically release succesfully
+ * Set the control register to automatically release successfully
* transmitted packets (making the best use out of our limited
* memory) and to enable the EPH interrupt on certain TX errors.
*/
diff --git a/sys/dev/sn/if_snreg.h b/sys/dev/sn/if_snreg.h
index 8b1b701..9fab405 100644
--- a/sys/dev/sn/if_snreg.h
+++ b/sys/dev/sn/if_snreg.h
@@ -115,7 +115,7 @@
* the Ethernet Protocol Handler jumbled together. In auto-release
* mode this information is simply discarded after each TX. This info
* is copied to the status word of in-memory packets after transmit
- * where relevent statuses can be checked.
+ * where relevant statuses can be checked.
*/
#define EPH_STATUS_REG_W 0x02
@@ -145,7 +145,7 @@
#define RCR_RX_ABORT 0x0001 /* Received huge packet */
#define RCR_PROMISC 0x0002 /* enable promiscuous mode */
#define RCR_ALMUL 0x0004 /* receive all multicast packets */
-#define RCR_ENABLE 0x0100 /* IFF this is set, we can recieve packets */
+#define RCR_ENABLE 0x0100 /* IFF this is set, we can receive packets */
#define RCR_STRIP_CRC 0x0200 /* strips CRC */
#define RCR_GAIN_BITS 0x0c00 /* PLL Gain control (for testing) */
#define RCR_FILT_CAR 0x4000 /* Enable 12 bit carrier filter */
diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c
index a496b67..acda11c 100644
--- a/sys/dev/snc/dp83932.c
+++ b/sys/dev/snc/dp83932.c
@@ -405,7 +405,7 @@ sncinit_locked(struct snc_softc *sc)
/* already running */
return;
- NIC_PUT(sc, SNCR_CR, CR_RST); /* DCR only accessable in reset mode! */
+ NIC_PUT(sc, SNCR_CR, CR_RST); /* DCR only accessible in reset mode! */
/* config it */
NIC_PUT(sc, SNCR_DCR, (sc->sncr_dcr |
@@ -1001,7 +1001,7 @@ sonicrxint(struct snc_softc *sc)
*
* If this was the last packet in the RRA, give the RRA to
* the chip again.
- * If sonic read didnt copy it out then we would have to
+ * If sonic read didn't copy it out then we would have to
* wait !!
* (dont bother add it back in again straight away)
*
diff --git a/sys/dev/snc/dp83932var.h b/sys/dev/snc/dp83932var.h
index 2ed9b9d..6ee5108 100644
--- a/sys/dev/snc/dp83932var.h
+++ b/sys/dev/snc/dp83932var.h
@@ -211,7 +211,7 @@ typedef struct snc_softc {
/*
* Accessing SONIC data structures and registers as 32 bit values
- * makes code endianess independent. The SONIC is however always in
+ * makes code endianness independent. The SONIC is however always in
* bigendian mode so it is necessary to ensure that data structures shared
* between the CPU and the SONIC are always in bigendian order.
*/
diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c
index 53c66bb..5981e31 100644
--- a/sys/dev/sym/sym_hipd.c
+++ b/sys/dev/sym/sym_hipd.c
@@ -4001,7 +4001,7 @@ static void sym_recover_scsi_int (hcb_p np, u_char hsts)
/*
* If we haven't been interrupted inside the SCRIPTS
- * critical pathes, we can safely restart the SCRIPTS
+ * critical paths, we can safely restart the SCRIPTS
* and trust the DSA value if it matches a CCB.
*/
if ((!(dsp > SCRIPTA_BA (np, getjob_begin) &&
@@ -5185,7 +5185,7 @@ static void sym_sir_task_recovery(hcb_p np, int num)
/*
* Otherwise, check for the LUN and TASK(s)
- * concerned by the cancelation.
+ * concerned by the cancellation.
* If it is not ABORT_TAG then it is CLEAR_QUEUE
* or an ABORT message :-)
*/
@@ -6134,7 +6134,7 @@ static void sym_int_sir (hcb_p np)
}
goto out;
/*
- * The device wants us to tranfer more data than
+ * The device wants us to transfer more data than
* expected or in the wrong direction.
* The number of extra bytes is in scratcha.
* It is a data overrun condition.
diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c
index 5895066..db26787 100644
--- a/sys/dev/syscons/scmouse.c
+++ b/sys/dev/syscons/scmouse.c
@@ -495,7 +495,7 @@ mouse_cut_start(scr_stat *scp)
i = skip_spc_left(scp, scp->mouse_pos) + 1;
s = spltty();
scp->mouse_cut_start =
- (scp->mouse_pos / scp->xsize) * scp->xsize + i;
+ rounddown(scp->mouse_pos, scp->xsize) + i;
scp->mouse_cut_end =
(scp->mouse_pos / scp->xsize + 1) * scp->xsize - 1;
splx(s);
@@ -540,7 +540,7 @@ mouse_cut_word(scr_stat *scp)
* unless user specified SC_CUT_SEPCHARS in his kernel config file.
*/
if (scp->status & MOUSE_VISIBLE) {
- sol = (scp->mouse_pos / scp->xsize) * scp->xsize;
+ sol = rounddown(scp->mouse_pos, scp->xsize);
eol = sol + scp->xsize;
c = sc_vtb_getc(&scp->vtb, scp->mouse_pos);
if (IS_SEP_CHAR(c)) {
@@ -589,7 +589,7 @@ mouse_cut_line(scr_stat *scp)
int from;
if (scp->status & MOUSE_VISIBLE) {
- from = (scp->mouse_pos / scp->xsize) * scp->xsize;
+ from = rounddown(scp->mouse_pos, scp->xsize);
mouse_do_cut(scp, from, from + scp->xsize - 1);
len = strlen(cut_buffer);
if (cut_buffer[len - 1] == '\r')
diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c
index fc7f02f..2d26517 100644
--- a/sys/dev/syscons/scvgarndr.c
+++ b/sys/dev/syscons/scvgarndr.c
@@ -1035,7 +1035,7 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y)
line_width = scp->sc->adp->va_line_width;
xoff = (x - scp->xoff*8)%8;
- yoff = y - (y/line_width)*line_width;
+ yoff = y - rounddown(y, line_width);
ymax = imin(y + 16, scp->ypixel);
outw(GDCIDX, 0x0805); /* read mode 1, write mode 0 */
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index f109b24..063083e 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -3541,7 +3541,7 @@ next_code:
if (cold) {
/*
* While devices are being probed, the screen saver need
- * to be invoked explictly. XXX
+ * to be invoked explicitly. XXX
*/
if (sc->flags & SC_SCRN_BLANKED) {
scsplash_stick(FALSE);
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 538d65d..d3f15fe 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -2513,7 +2513,7 @@ ti_attach(device_t dev)
/*
* Copper cards allow manual 10/100 mode selection,
* but not manual 1000baseTX mode selection. Why?
- * Becuase currently there's no way to specify the
+ * Because currently there's no way to specify the
* master/slave setting through the firmware interface,
* so Alteon decided to just bag it and handle it
* via autonegotiation.
@@ -2747,7 +2747,7 @@ ti_discard_jumbo(struct ti_softc *sc, int i)
* Note: we have to be able to handle three possibilities here:
* 1) the frame is from the mini receive ring (can only happen)
* on Tigon 2 boards)
- * 2) the frame is from the jumbo recieve ring
+ * 2) the frame is from the jumbo receive ring
* 3) the frame is from the standard receive ring
*/
@@ -2987,7 +2987,7 @@ ti_intr(void *xsc)
return;
}
- /* Ack interrupt and stop others from occuring. */
+ /* Ack interrupt and stop others from occurring. */
CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1);
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
@@ -3379,7 +3379,7 @@ ti_ifmedia_upd_locked(struct ti_softc *sc)
/*
* Transmit flow control can also cause problems on the
- * Tigon 2, apparantly with both the copper and fiber
+ * Tigon 2, apparently with both the copper and fiber
* boards. The symptom is that the interface will just
* hang. This was reproduced with Alteon 180 switches.
*/
diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h
index 63b93f4..d55e150 100644
--- a/sys/dev/ti/if_tireg.h
+++ b/sys/dev/ti/if_tireg.h
@@ -140,7 +140,7 @@
#define TI_FIRMWARE_FIX 0xb
/*
- * Miscelaneous Local Control register.
+ * Miscellaneous Local Control register.
*/
#define TI_MLC_EE_WRITE_ENB 0x00000010
#define TI_MLC_SRAM_BANK_SIZE 0x00000300 /* Tigon 2 only */
@@ -337,7 +337,7 @@
*/
#define TI_OPMODE_BYTESWAP_BD 0x00000002
#define TI_OPMODE_WORDSWAP_BD 0x00000004
-#define TI_OPMODE_WARN_ENB 0x00000008 /* not yet implimented */
+#define TI_OPMODE_WARN_ENB 0x00000008 /* not yet implemented */
#define TI_OPMODE_BYTESWAP_DATA 0x00000010
#define TI_OPMODE_1_DMA_ACTIVE 0x00000040
#define TI_OPMODE_SBUS 0x00000100
@@ -347,7 +347,7 @@
#define TI_OPMODE_NO_EVENT_INTRS 0x00001000
#define TI_OPMODE_NO_TX_INTRS 0x00002000
#define TI_OPMODE_NO_RX_INTRS 0x00004000
-#define TI_OPMODE_FATAL_ENB 0x40000000 /* not yet implimented */
+#define TI_OPMODE_FATAL_ENB 0x40000000 /* not yet implemented */
#define TI_OPMODE_JUMBO_HDRSPLIT 0x00008000
/*
diff --git a/sys/dev/tl/if_tl.c b/sys/dev/tl/if_tl.c
index 455dd38..b80e81f 100644
--- a/sys/dev/tl/if_tl.c
+++ b/sys/dev/tl/if_tl.c
@@ -116,7 +116,7 @@ __FBSDID("$FreeBSD$");
* To transmit frames, the driver again sets up lists and fragment
* descriptors, only this time the buffers contain frame data that
* is to be DMA'ed into the chip instead of out of it. Once the chip
- * has transfered the data into its on-board SRAM, it will trigger a
+ * has transferred the data into its on-board SRAM, it will trigger a
* TX 'end of frame' interrupt. It will also generate an 'end of channel'
* interrupt when it reaches the end of the list.
*/
diff --git a/sys/dev/tpm/tpm.c b/sys/dev/tpm/tpm.c
index a90f8ba..3ac52d6 100644
--- a/sys/dev/tpm/tpm.c
+++ b/sys/dev/tpm/tpm.c
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
#define IRQUNK -1
#endif
-#define TPM_ACCESS 0x0000 /* acess register */
+#define TPM_ACCESS 0x0000 /* access register */
#define TPM_ACCESS_ESTABLISHMENT 0x01 /* establishment */
#define TPM_ACCESS_REQUEST_USE 0x02 /* request using locality */
#define TPM_ACCESS_REQUEST_PENDING 0x04 /* pending request */
@@ -820,7 +820,7 @@ tpm_waitfor(struct tpm_softc *sc, u_int8_t b0, int tmo, void *c)
b = b0;
/*
- * Wait for data ready. This interrupt only occures
+ * Wait for data ready. This interrupt only occurs
* when both TPM_STS_VALID and TPM_STS_DATA_AVAIL are asserted.
* Thus we don't have to bother with TPM_STS_VALID
* separately and can just return.
diff --git a/sys/dev/tpm/tpm_acpi.c b/sys/dev/tpm/tpm_acpi.c
index 5d83477..b16dd23 100644
--- a/sys/dev/tpm/tpm_acpi.c
+++ b/sys/dev/tpm/tpm_acpi.c
@@ -62,7 +62,7 @@ tpm_acpi_probe(device_t dev)
static device_method_t tpm_acpi_methods[] = {
#if 0
- /*In some case, TPM existance is found only in TPCA header*/
+ /*In some case, TPM existence is found only in TPCA header*/
DEVMETHOD(device_identify, tpm_acpi_identify),
#endif
diff --git a/sys/dev/trm/trm.c b/sys/dev/trm/trm.c
index f86523e..e5f02dd 100644
--- a/sys/dev/trm/trm.c
+++ b/sys/dev/trm/trm.c
@@ -1121,7 +1121,7 @@ trm_reset(PACB pACB)
pACB->pActiveDCB = NULL;
pACB->ACBFlag = 0;/* RESET_DETECT, RESET_DONE ,RESET_DEV */
trm_DoWaitingSRB(pACB);
- /* Tell the XPT layer that a bus reset occured */
+ /* Tell the XPT layer that a bus reset occurred */
if (pACB->ppath != NULL)
xpt_async(AC_BUS_RESET, pACB->ppath, NULL);
splx(intflag);
@@ -1890,7 +1890,7 @@ trm_MsgInPhase0(PACB pACB, PSRB pSRB, u_int16_t *pscsi_status)
}
} else {
/*
- * Parsing incomming extented messages
+ * Parsing incoming extented messages
*/
*pSRB->pMsgPtr = message_in_code;
pSRB->MsgCnt++;
diff --git a/sys/dev/trm/trm.h b/sys/dev/trm/trm.h
index 97b318a..f72335a 100644
--- a/sys/dev/trm/trm.h
+++ b/sys/dev/trm/trm.h
@@ -926,7 +926,7 @@ typedef struct NVRAM_TARGET_STRUCT
#define NTC_DO_SEND_START 0x08 /* Send start command SPINUP*/
#define NTC_DO_DISCONNECT 0x04 /* Enable SCSI disconnect */
#define NTC_DO_SYNC_NEGO 0x02 /* Sync negotiation */
-#define NTC_DO_PARITY_CHK 0x01 /* (it sould define at NAC )
+#define NTC_DO_PARITY_CHK 0x01 /* (it should define at NAC )
Parity check enable */
/*
diff --git a/sys/dev/tsec/if_tsec.h b/sys/dev/tsec/if_tsec.h
index 7c6bc30..af703f2 100644
--- a/sys/dev/tsec/if_tsec.h
+++ b/sys/dev/tsec/if_tsec.h
@@ -60,12 +60,12 @@ struct tsec_softc {
bus_dma_tag_t tsec_tx_dtag; /* TX descriptors tag */
bus_dmamap_t tsec_tx_dmap; /* TX descriptors map */
struct tsec_desc *tsec_tx_vaddr;/* vadress of TX descriptors */
- uint32_t tsec_tx_raddr; /* real adress of TX descriptors */
+ uint32_t tsec_tx_raddr; /* real address of TX descriptors */
bus_dma_tag_t tsec_rx_dtag; /* RX descriptors tag */
bus_dmamap_t tsec_rx_dmap; /* RX descriptors map */
struct tsec_desc *tsec_rx_vaddr; /* vadress of RX descriptors */
- uint32_t tsec_rx_raddr; /* real adress of RX descriptors */
+ uint32_t tsec_rx_raddr; /* real address of RX descriptors */
bus_dma_tag_t tsec_tx_mtag; /* TX mbufs tag */
bus_dma_tag_t tsec_rx_mtag; /* TX mbufs tag */
@@ -73,7 +73,7 @@ struct tsec_softc {
struct rx_data_type {
bus_dmamap_t map; /* mbuf map */
struct mbuf *mbuf;
- uint32_t paddr; /* DMA addres of buffer */
+ uint32_t paddr; /* DMA address of buffer */
} rx_data[TSEC_RX_NUM_DESC];
uint32_t tx_cur_desc_cnt;
diff --git a/sys/dev/twe/twe.c b/sys/dev/twe/twe.c
index 51c760c..cdb2180 100644
--- a/sys/dev/twe/twe.c
+++ b/sys/dev/twe/twe.c
@@ -531,7 +531,7 @@ twe_ioctl(struct twe_softc *sc, u_long ioctlcmd, void *addr)
case TWEIO_COMMAND:
/*
* if there's a data buffer, allocate and copy it in.
- * Must be in multipled of 512 bytes.
+ * Must be in multiplied of 512 bytes.
*/
tr_length = roundup2(tu->tu_size, 512);
if (tr_length > 0) {
diff --git a/sys/dev/twe/twevar.h b/sys/dev/twe/twevar.h
index 38e1c81..616f12b 100644
--- a/sys/dev/twe/twevar.h
+++ b/sys/dev/twe/twevar.h
@@ -143,7 +143,7 @@ struct twe_softc
};
/*
- * Interface betwen driver core and platform-dependant code.
+ * Interface between driver core and platform-dependant code.
*/
extern int twe_setup(struct twe_softc *sc); /* do early driver/controller setup */
extern void twe_init(struct twe_softc *sc); /* init controller */
diff --git a/sys/dev/tws/tws_cam.c b/sys/dev/tws/tws_cam.c
index 0002715..9866a29 100644
--- a/sys/dev/tws/tws_cam.c
+++ b/sys/dev/tws/tws_cam.c
@@ -1099,7 +1099,7 @@ tws_intr_attn_aen(struct tws_softc *sc)
{
u_int32_t db=0;
- /* maskoff db intrs untill all the aens are fetched */
+ /* maskoff db intrs until all the aens are fetched */
/* tws_disable_db_intr(sc); */
tws_fetch_aen((void *)sc);
tws_write_reg(sc, TWS_I2O0_HOBDBC, TWS_BIT18, 4);
diff --git a/sys/dev/tws/tws_hdm.c b/sys/dev/tws/tws_hdm.c
index 2e568c8..83d5a50 100644
--- a/sys/dev/tws/tws_hdm.c
+++ b/sys/dev/tws/tws_hdm.c
@@ -312,7 +312,7 @@ tws_submit_command(struct tws_softc *sc, struct tws_request *req)
TWS_TRACE_DEBUG(sc, "inbound fifo empty", mfa, 0);
/*
- * Generaly we should not get here.
+ * Generally we should not get here.
* If the fifo was empty we can't do any thing much
* retry later
*/
@@ -428,7 +428,7 @@ tws_turn_on_interrupts(struct tws_softc *sc)
{
TWS_TRACE_DEBUG(sc, "entry", 0, 0);
- /* turn on responce and db interrupt only */
+ /* turn on response and db interrupt only */
tws_write_reg(sc, TWS_I2O0_HIMASK, TWS_BIT0, 4);
}
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c
index 42b327f..72a4c08 100644
--- a/sys/dev/tx/if_tx.c
+++ b/sys/dev/tx/if_tx.c
@@ -796,7 +796,7 @@ epic_rx_done(epic_softc_t *sc)
(*ifp->if_input)(ifp, m);
EPIC_LOCK(sc);
- /* Successfuly received frame */
+ /* Successfully received frame */
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
}
bus_dmamap_sync(sc->rtag, sc->rmap,
@@ -897,7 +897,7 @@ epic_intr(void *arg)
INTSTAT_APE|INTSTAT_DPE|INTSTAT_TXU|INTSTAT_RXE)) {
if (status & (INTSTAT_FATAL|INTSTAT_PMA|INTSTAT_PTA|
INTSTAT_APE|INTSTAT_DPE)) {
- device_printf(sc->dev, "PCI fatal errors occured: %s%s%s%s\n",
+ device_printf(sc->dev, "PCI fatal errors occurred: %s%s%s%s\n",
(status & INTSTAT_PMA) ? "PMA " : "",
(status & INTSTAT_PTA) ? "PTA " : "",
(status & INTSTAT_APE) ? "APE " : "",
diff --git a/sys/dev/tx/if_txreg.h b/sys/dev/tx/if_txreg.h
index 63891cd..059c2c0 100644
--- a/sys/dev/tx/if_txreg.h
+++ b/sys/dev/tx/if_txreg.h
@@ -90,7 +90,7 @@
#define INTSTAT_CNT 0x00000200
#define INTSTAT_PREI 0x00000400
#define INTSTAT_RCT 0x00000800
-#define INTSTAT_FATAL 0x00001000 /* One of DPE,APE,PMA,PTA happend */
+#define INTSTAT_FATAL 0x00001000 /* One of DPE,APE,PMA,PTA happened */
#define INTSTAT_UNUSED1 0x00002000
#define INTSTAT_UNUSED2 0x00004000
#define INTSTAT_GP2 0x00008000 /* PHY Event */
diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c
index 5308a2e..faea2cf 100644
--- a/sys/dev/uart/uart_bus_fdt.c
+++ b/sys/dev/uart/uart_bus_fdt.c
@@ -68,7 +68,7 @@ int
uart_fdt_get_clock(phandle_t node, pcell_t *cell)
{
- /* clock-frequency is a FreeBSD-only extention. */
+ /* clock-frequency is a FreeBSD-only extension. */
if ((OF_getencprop(node, "clock-frequency", cell,
sizeof(*cell))) <= 0) {
/* Try to retrieve parent 'bus-frequency' */
diff --git a/sys/dev/uart/uart_dev_lpc.c b/sys/dev/uart/uart_dev_lpc.c
index f8d77d4..306c9f1 100644
--- a/sys/dev/uart/uart_dev_lpc.c
+++ b/sys/dev/uart/uart_dev_lpc.c
@@ -803,7 +803,7 @@ done:
#if 0
/*
* XXX there are some issues related to hardware flow control and
- * it's likely that uart(4) is the cause. This basicly needs more
+ * it's likely that uart(4) is the cause. This basically needs more
* investigation, but we avoid using for hardware flow control
* until then.
*/
@@ -911,7 +911,7 @@ lpc_ns8250_bus_grab(struct uart_softc *sc)
/*
* turn off all interrupts to enter polling mode. Leave the
* saved mask alone. We'll restore whatever it was in ungrab.
- * All pending interupt signals are reset when IER is set to 0.
+ * All pending interrupt signals are reset when IER is set to 0.
*/
uart_lock(sc->sc_hwmtx);
uart_setreg(bas, REG_IER, 0);
diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c
index a36afef..2498fa3 100644
--- a/sys/dev/uart/uart_dev_ns8250.c
+++ b/sys/dev/uart/uart_dev_ns8250.c
@@ -565,7 +565,7 @@ ns8250_bus_getsig(struct uart_softc *sc)
* when capturing PPS pulses which are too narrow for software detection
* to see the edges. Hardware delta for RI doesn't work like the
* others, so always use software for it. Other threads may be changing
- * other (non-MSR) bits in sc_hwsig, so loop until it can succesfully
+ * other (non-MSR) bits in sc_hwsig, so loop until it can successfully
* update without other changes happening. Note that the SIGCHGxx()
* macros carefully preserve the delta bits when we have to loop several
* times and a signal transitions between iterations.
@@ -882,7 +882,7 @@ ns8250_bus_probe(struct uart_softc *sc)
#if 0
/*
* XXX there are some issues related to hardware flow control and
- * it's likely that uart(4) is the cause. This basicly needs more
+ * it's likely that uart(4) is the cause. This basically needs more
* investigation, but we avoid using for hardware flow control
* until then.
*/
@@ -996,7 +996,7 @@ ns8250_bus_grab(struct uart_softc *sc)
/*
* turn off all interrupts to enter polling mode. Leave the
* saved mask alone. We'll restore whatever it was in ungrab.
- * All pending interupt signals are reset when IER is set to 0.
+ * All pending interrupt signals are reset when IER is set to 0.
*/
uart_lock(sc->sc_hwmtx);
ier = uart_getreg(bas, REG_IER);
diff --git a/sys/dev/urtwn/if_urtwn.c b/sys/dev/urtwn/if_urtwn.c
index d79ea2b..dce9d19 100644
--- a/sys/dev/urtwn/if_urtwn.c
+++ b/sys/dev/urtwn/if_urtwn.c
@@ -490,7 +490,7 @@ urtwn_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct urtwn_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
int error;
device_set_usb_desc(self);
diff --git a/sys/dev/usb/controller/at91dci.c b/sys/dev/usb/controller/at91dci.c
index 69ecffb..169595c 100644
--- a/sys/dev/usb/controller/at91dci.c
+++ b/sys/dev/usb/controller/at91dci.c
@@ -1330,7 +1330,7 @@ at91dci_clear_stall_sub(struct at91dci_softc *sc, uint8_t ep_no,
/*
* NOTE: One would assume that a FIFO reset would release the
- * FIFO banks aswell, but it doesn't! We have to do this
+ * FIFO banks as well, but it doesn't! We have to do this
* manually!
*/
diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c
index 16c4c3a..1dcfa02 100644
--- a/sys/dev/usb/controller/dwc_otg.c
+++ b/sys/dev/usb/controller/dwc_otg.c
@@ -3332,7 +3332,7 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer)
* type in general, as a means to workaround
* that. This trick should work for both FULL and LOW
* speed USB traffic going through a TT. For non-TT
- * traffic it works aswell. The reason for using
+ * traffic it works as well. The reason for using
* CONTROL type instead of BULK is that some TTs might
* reject LOW speed BULK traffic.
*/
diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c
index 7f9547c..e7c85a1 100644
--- a/sys/dev/usb/controller/ehci.c
+++ b/sys/dev/usb/controller/ehci.c
@@ -2995,7 +2995,7 @@ struct usb_device_descriptor ehci_devd =
UDPROTO_HSHUBSTT, /* protocol */
64, /* max packet */
{0}, {0}, {0x00, 0x01}, /* device id */
- 1, 2, 0, /* string indicies */
+ 1, 2, 0, /* string indexes */
1 /* # of configurations */
};
diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c
index 93785c0..a33ce04 100644
--- a/sys/dev/usb/controller/ohci.c
+++ b/sys/dev/usb/controller/ohci.c
@@ -2043,7 +2043,7 @@ struct usb_device_descriptor ohci_devd =
UDPROTO_FSHUB, /* protocol */
64, /* max packet */
{0}, {0}, {0x00, 0x01}, /* device id */
- 1, 2, 0, /* string indicies */
+ 1, 2, 0, /* string indexes */
1 /* # of configurations */
};
diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c
index 5204d63..013a5f3 100644
--- a/sys/dev/usb/controller/uhci.c
+++ b/sys/dev/usb/controller/uhci.c
@@ -2321,7 +2321,7 @@ struct usb_device_descriptor uhci_devd =
UDPROTO_FSHUB, /* protocol */
64, /* max packet */
{0}, {0}, {0x00, 0x01}, /* device id */
- 1, 2, 0, /* string indicies */
+ 1, 2, 0, /* string indexes */
1 /* # of configurations */
};
diff --git a/sys/dev/usb/controller/xhcireg.h b/sys/dev/usb/controller/xhcireg.h
index a0b7397..d1f0197 100644
--- a/sys/dev/usb/controller/xhcireg.h
+++ b/sys/dev/usb/controller/xhcireg.h
@@ -45,16 +45,16 @@
#define XHCI_HCIVERSION 0x02 /* RO Interface version number */
#define XHCI_HCIVERSION_0_9 0x0090 /* xHCI version 0.9 */
#define XHCI_HCIVERSION_1_0 0x0100 /* xHCI version 1.0 */
-#define XHCI_HCSPARAMS1 0x04 /* RO structual parameters 1 */
+#define XHCI_HCSPARAMS1 0x04 /* RO structural parameters 1 */
#define XHCI_HCS1_DEVSLOT_MAX(x)((x) & 0xFF)
#define XHCI_HCS1_IRQ_MAX(x) (((x) >> 8) & 0x3FF)
#define XHCI_HCS1_N_PORTS(x) (((x) >> 24) & 0xFF)
-#define XHCI_HCSPARAMS2 0x08 /* RO structual parameters 2 */
+#define XHCI_HCSPARAMS2 0x08 /* RO structural parameters 2 */
#define XHCI_HCS2_IST(x) ((x) & 0xF)
#define XHCI_HCS2_ERST_MAX(x) (((x) >> 4) & 0xF)
#define XHCI_HCS2_SPR(x) (((x) >> 24) & 0x1)
#define XHCI_HCS2_SPB_MAX(x) (((x) >> 27) & 0x7F)
-#define XHCI_HCSPARAMS3 0x0C /* RO structual parameters 3 */
+#define XHCI_HCSPARAMS3 0x0C /* RO structural parameters 3 */
#define XHCI_HCS3_U1_DEL(x) ((x) & 0xFF)
#define XHCI_HCS3_U2_DEL(x) (((x) >> 16) & 0xFFFF)
#define XHCI_HCSPARAMS0 0x10 /* RO capability parameters */
diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c
index 43784bf..4c85e6e 100644
--- a/sys/dev/usb/input/ums.c
+++ b/sys/dev/usb/input/ums.c
@@ -572,7 +572,7 @@ ums_attach(device_t dev)
* The Microsoft Wireless Notebook Optical Mouse seems to be in worse
* shape than the Wireless Intellimouse 2.0, as its X, Y, wheel, and
* all of its other button positions are all off. It also reports that
- * it has two addional buttons and a tilt wheel.
+ * it has two additional buttons and a tilt wheel.
*/
if (usb_test_quirk(uaa, UQ_MS_BAD_CLASS)) {
diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c
index 86c9352..694e0d9 100644
--- a/sys/dev/usb/input/wsp.c
+++ b/sys/dev/usb/input/wsp.c
@@ -1040,7 +1040,7 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error)
if (sc->o_ntouch != ntouch)
dx = dy = 0;
- /* Ignore unexpeted movment when typing */
+ /* Ignore unexpeted movement when typing */
if (ntouch == 1 && sc->index[0]->tool_major > 1200)
dx = dy = 0;
diff --git a/sys/dev/usb/misc/udbp.c b/sys/dev/usb/misc/udbp.c
index 85924b3..3c07931 100644
--- a/sys/dev/usb/misc/udbp.c
+++ b/sys/dev/usb/misc/udbp.c
@@ -744,7 +744,7 @@ ng_udbp_rcvdata(hook_p hook, item_p item)
/*
* Do local shutdown processing..
- * We are a persistant device, we refuse to go away, and
+ * We are a persistent device, we refuse to go away, and
* only remove our links and reset ourself.
*/
static int
diff --git a/sys/dev/usb/net/if_cue.c b/sys/dev/usb/net/if_cue.c
index 39860fe..1190f98 100644
--- a/sys/dev/usb/net/if_cue.c
+++ b/sys/dev/usb/net/if_cue.c
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
* RX filter uses a 512-bit multicast hash table, single perfect entry
* for the station address, and promiscuous mode. Unlike the ADMtek
* and KLSI chips, the CATC ASIC supports read and write combining
- * mode where multiple packets can be transfered using a single bulk
+ * mode where multiple packets can be transferred using a single bulk
* transaction, which helps performance a great deal.
*/
diff --git a/sys/dev/usb/net/if_mos.c b/sys/dev/usb/net/if_mos.c
index 3a65ec6..e6aaac9 100644
--- a/sys/dev/usb/net/if_mos.c
+++ b/sys/dev/usb/net/if_mos.c
@@ -418,7 +418,7 @@ mos_write_mcast(struct mos_softc *sc, u_char *hashtbl)
}
static int
-mos_miibus_readreg(struct device *dev, int phy, int reg)
+mos_miibus_readreg(device_t dev, int phy, int reg)
{
struct mos_softc *sc = device_get_softc(dev);
uWord val;
diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c
index 541d62d..9b86e88 100644
--- a/sys/dev/usb/net/if_rue.c
+++ b/sys/dev/usb/net/if_rue.c
@@ -693,7 +693,7 @@ rue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
usbd_copy_out(pc, actlen - 4, &status, sizeof(status));
actlen -= 4;
- /* check recieve packet was valid or not */
+ /* check receive packet was valid or not */
status = le16toh(status);
if ((status & RUE_RXSTAT_VALID) == 0) {
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
diff --git a/sys/dev/usb/net/if_urndis.c b/sys/dev/usb/net/if_urndis.c
index de7fd1e..da3decc 100644
--- a/sys/dev/usb/net/if_urndis.c
+++ b/sys/dev/usb/net/if_urndis.c
@@ -709,7 +709,7 @@ urndis_ctrl_halt(struct urndis_softc *sc)
}
/*
- * NB: Querying a device has the requirment of using an input buffer the size
+ * NB: Querying a device has the requirement of using an input buffer the size
* of the expected reply or larger, except for variably sized replies.
*/
static uint32_t
diff --git a/sys/dev/usb/serial/ulpt.c b/sys/dev/usb/serial/ulpt.c
index 52dd494..529f835 100644
--- a/sys/dev/usb/serial/ulpt.c
+++ b/sys/dev/usb/serial/ulpt.c
@@ -419,7 +419,7 @@ ulpt_open(struct usb_fifo *fifo, int fflags)
if (sc->sc_fflags == 0) {
- /* reset USB paralell port */
+ /* reset USB parallel port */
ulpt_reset(sc);
}
diff --git a/sys/dev/usb/serial/umcs.h b/sys/dev/usb/serial/umcs.h
index 81dc70b..8ba57c1 100644
--- a/sys/dev/usb/serial/umcs.h
+++ b/sys/dev/usb/serial/umcs.h
@@ -107,28 +107,28 @@
* 4, R/W */
#define MCS7840_DEV_REG_BI_FIFO_STAT1 0x32 /* Bulk-In FIFO Stat for Port
* 1, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BO_FIFO_STAT1 0x33 /* Bulk-out FIFO Stat for Port
* 1, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BI_FIFO_STAT2 0x34 /* Bulk-In FIFO Stat for Port
* 2, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BO_FIFO_STAT2 0x35 /* Bulk-out FIFO Stat for Port
* 2, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BI_FIFO_STAT3 0x36 /* Bulk-In FIFO Stat for Port
* 3, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BO_FIFO_STAT3 0x37 /* Bulk-out FIFO Stat for Port
* 3, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BI_FIFO_STAT4 0x38 /* Bulk-In FIFO Stat for Port
* 4, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_BO_FIFO_STAT4 0x39 /* Bulk-out FIFO Stat for Port
* 4, contains number of
- * availiable bytes, R/Only */
+ * available bytes, R/Only */
#define MCS7840_DEV_REG_ZERO_PERIOD1 0x3a /* Period between zero out
* frames for Port 1, R/W */
#define MCS7840_DEV_REG_ZERO_PERIOD2 0x3b /* Period between zero out
@@ -139,28 +139,28 @@
* frames for Port 1, R/W */
#define MCS7840_DEV_REG_ZERO_ENABLE 0x3e /* Enable/disable of zero out
* frames, R/W */
-#define MCS7840_DEV_REG_THR_VAL_LOW1 0x3f /* Low 8 bits of threshhold
+#define MCS7840_DEV_REG_THR_VAL_LOW1 0x3f /* Low 8 bits of threshold
* value for Bulk-Out for Port
* 1, R/W */
-#define MCS7840_DEV_REG_THR_VAL_HIGH1 0x40 /* High 1 bit of threshhold
+#define MCS7840_DEV_REG_THR_VAL_HIGH1 0x40 /* High 1 bit of threshold
* value for Bulk-Out and
* enable flag for Port 1, R/W */
-#define MCS7840_DEV_REG_THR_VAL_LOW2 0x41 /* Low 8 bits of threshhold
+#define MCS7840_DEV_REG_THR_VAL_LOW2 0x41 /* Low 8 bits of threshold
* value for Bulk-Out for Port
* 2, R/W */
-#define MCS7840_DEV_REG_THR_VAL_HIGH2 0x42 /* High 1 bit of threshhold
+#define MCS7840_DEV_REG_THR_VAL_HIGH2 0x42 /* High 1 bit of threshold
* value for Bulk-Out and
* enable flag for Port 2, R/W */
-#define MCS7840_DEV_REG_THR_VAL_LOW3 0x43 /* Low 8 bits of threshhold
+#define MCS7840_DEV_REG_THR_VAL_LOW3 0x43 /* Low 8 bits of threshold
* value for Bulk-Out for Port
* 3, R/W */
-#define MCS7840_DEV_REG_THR_VAL_HIGH3 0x44 /* High 1 bit of threshhold
+#define MCS7840_DEV_REG_THR_VAL_HIGH3 0x44 /* High 1 bit of threshold
* value for Bulk-Out and
* enable flag for Port 3, R/W */
-#define MCS7840_DEV_REG_THR_VAL_LOW4 0x45 /* Low 8 bits of threshhold
+#define MCS7840_DEV_REG_THR_VAL_LOW4 0x45 /* Low 8 bits of threshold
* value for Bulk-Out for Port
* 4, R/W */
-#define MCS7840_DEV_REG_THR_VAL_HIGH4 0x46 /* High 1 bit of threshhold
+#define MCS7840_DEV_REG_THR_VAL_HIGH4 0x46 /* High 1 bit of threshold
* value for Bulk-Out and
* enable flag for Port 4, R/W */
diff --git a/sys/dev/usb/serial/uvisor.c b/sys/dev/usb/serial/uvisor.c
index bd6bc6b..4d72e38 100644
--- a/sys/dev/usb/serial/uvisor.c
+++ b/sys/dev/usb/serial/uvisor.c
@@ -100,7 +100,7 @@ SYSCTL_INT(_hw_usb_uvisor, OID_AUTO, debug, CTLFLAG_RWTUN,
/* From the Linux driver */
/*
* UVISOR_REQUEST_BYTES_AVAILABLE asks the visor for the number of bytes that
- * are available to be transfered to the host for the specified endpoint.
+ * are available to be transferred to the host for the specified endpoint.
* Currently this is not used, and always returns 0x0001
*/
#define UVISOR_REQUEST_BYTES_AVAILABLE 0x01
diff --git a/sys/dev/usb/storage/rio500_usb.h b/sys/dev/usb/storage/rio500_usb.h
index 5b53e2c..4f9a520 100644
--- a/sys/dev/usb/storage/rio500_usb.h
+++ b/sys/dev/usb/storage/rio500_usb.h
@@ -5,7 +5,7 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted under any licence of your choise which
- meets the open source licence definiton
+ meets the open source licence definition
http://www.opensource.org/opd.html such as the GNU licence or the
BSD licence.
diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c
index 80b6da3..acec1c9 100644
--- a/sys/dev/usb/storage/umass.c
+++ b/sys/dev/usb/storage/umass.c
@@ -2721,7 +2721,7 @@ umass_rbc_transform(struct umass_softc *sc, uint8_t *cmd_ptr, uint8_t cmd_len)
cmd_len = 12;
}
sc->sc_transfer.cmd_len = cmd_len;
- return (1); /* sucess */
+ return (1); /* success */
/* All other commands are not legal in RBC */
default:
diff --git a/sys/dev/usb/template/usb_template.c b/sys/dev/usb/template/usb_template.c
index 140c0b9..9adb30a 100644
--- a/sys/dev/usb/template/usb_template.c
+++ b/sys/dev/usb/template/usb_template.c
@@ -522,8 +522,8 @@ usb_make_device_desc(struct usb_temp_setup *temp,
* usb_hw_ep_match
*
* Return values:
- * 0: The endpoint profile does not match the criterias
- * Else: The endpoint profile matches the criterias
+ * 0: The endpoint profile does not match the criteria
+ * Else: The endpoint profile matches the criteria
*------------------------------------------------------------------------*/
static uint8_t
usb_hw_ep_match(const struct usb_hw_ep_profile *pf,
diff --git a/sys/dev/usb/usb_cdc.h b/sys/dev/usb/usb_cdc.h
index b8f59fa..86f3517 100644
--- a/sys/dev/usb/usb_cdc.h
+++ b/sys/dev/usb/usb_cdc.h
@@ -161,7 +161,7 @@ struct usb_cdc_notification {
#define UCDC_NOTIFICATION_LENGTH 8
/*
- * Bits set in the SERIAL STATE notifcation (first byte of data)
+ * Bits set in the SERIAL STATE notification (first byte of data)
*/
#define UCDC_N_SERIAL_OVERRUN 0x40
diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c
index c48bfc9..54e7f1b 100644
--- a/sys/dev/usb/usb_dev.c
+++ b/sys/dev/usb/usb_dev.c
@@ -179,7 +179,7 @@ usb_loc_fill(struct usb_fs_privdata* pd, struct usb_cdev_privdata *cpd)
*
* This function is used to atomically refer an USB device by its
* device location. If this function returns success the USB device
- * will not dissappear until the USB device is unreferenced.
+ * will not disappear until the USB device is unreferenced.
*
* Return values:
* 0: Success, refcount incremented on the given USB device.
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index 2976fec..df9fea6 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -190,7 +190,7 @@ usbd_get_ep_by_addr(struct usb_device *udev, uint8_t ea_val)
ea_val &= EA_MASK;
/*
- * Iterate accross all the USB endpoints searching for a match
+ * Iterate across all the USB endpoints searching for a match
* based on the endpoint address:
*/
for (; ep != ep_end; ep++) {
@@ -300,7 +300,7 @@ usbd_get_endpoint(struct usb_device *udev, uint8_t iface_index,
}
/*
- * Iterate accross all the USB endpoints searching for a match
+ * Iterate across all the USB endpoints searching for a match
* based on the endpoint address. Note that we are searching
* the endpoints from the beginning of the "udev->endpoints" array.
*/
diff --git a/sys/dev/usb/usb_handle_request.c b/sys/dev/usb/usb_handle_request.c
index 7f3cdc6..fcbdf95 100644
--- a/sys/dev/usb/usb_handle_request.c
+++ b/sys/dev/usb/usb_handle_request.c
@@ -313,7 +313,7 @@ tr_repeat:
case UR_SET_INTERFACE:
/*
* We assume that the endpoints are the same
- * accross the alternate settings.
+ * across the alternate settings.
*
* Reset the endpoints, because re-attaching
* only a part of the device is not possible.
diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c
index dc0ce99..fe85f0c 100644
--- a/sys/dev/usb/usb_hid.c
+++ b/sys/dev/usb/usb_hid.c
@@ -576,7 +576,7 @@ hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, uint8_t *id)
for (d = hid_start_parse(buf, len, 1 << k); hid_get_item(d, &h);) {
if (h.kind == k) {
- /* check for ID-byte presense */
+ /* check for ID-byte presence */
if ((h.report_ID != 0) && !any_id) {
if (id != NULL)
*id = h.report_ID;
diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c
index 280e97a..90a85fc 100644
--- a/sys/dev/usb/usb_hub.c
+++ b/sys/dev/usb/usb_hub.c
@@ -1766,7 +1766,7 @@ done:
* The USB Transaction Translator:
* ===============================
*
- * When doing LOW- and FULL-speed USB transfers accross a HIGH-speed
+ * When doing LOW- and FULL-speed USB transfers across a HIGH-speed
* USB HUB, bandwidth must be allocated for ISOCHRONOUS and INTERRUPT
* USB transfers. To utilize bandwidth dynamically the "scatter and
* gather" principle must be applied. This means that bandwidth must
@@ -1838,7 +1838,7 @@ usb_intr_find_best_slot(usb_size_t *ptr, uint8_t start,
/*------------------------------------------------------------------------*
* usb_hs_bandwidth_adjust
*
- * This function will update the bandwith usage for the microframe
+ * This function will update the bandwidth usage for the microframe
* having index "slot" by "len" bytes. "len" can be negative. If the
* "slot" argument is greater or equal to "USB_HS_MICRO_FRAMES_MAX"
* the "slot" argument will be replaced by the slot having least used
@@ -2310,7 +2310,7 @@ usb_needs_explore_all(void)
return;
}
/*
- * Explore all USB busses in parallell.
+ * Explore all USB busses in parallel.
*/
max = devclass_get_maxunit(dc);
while (max >= 0) {
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c
index e3f388d8..3c920f9 100644
--- a/sys/dev/usb/usb_transfer.c
+++ b/sys/dev/usb/usb_transfer.c
@@ -615,7 +615,7 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm)
/*
* NOTE: we do not allow "max_packet_size" or "max_frame_size"
* to be equal to zero when setting up USB transfers, hence
- * this leads to alot of extra code in the USB kernel.
+ * this leads to a lot of extra code in the USB kernel.
*/
if ((xfer->max_frame_size == 0) ||
@@ -2448,7 +2448,7 @@ done:
*
* This function is called when the DMA delay has been exectuded, and
* will make sure that the callback is called to complete the USB
- * transfer. This code path is ususally only used when there is an USB
+ * transfer. This code path is usually only used when there is an USB
* error like USB_ERR_CANCELLED.
*------------------------------------------------------------------------*/
void
diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs
index 223a2e3..e9dda0b 100644
--- a/sys/dev/usb/usbdevs
+++ b/sys/dev/usb/usbdevs
@@ -134,7 +134,7 @@ vendor MEGATRENDS 0x046b American Megatrends
vendor LOGITECH 0x046d Logitech
vendor BTC 0x046e Behavior Tech. Computer
vendor PHILIPS 0x0471 Philips
-vendor SUN2 0x0472 Sun Microsystems (offical)
+vendor SUN2 0x0472 Sun Microsystems (official)
vendor SANYO 0x0474 Sanyo Electric
vendor SEAGATE 0x0477 Seagate
vendor CONNECTIX 0x0478 Connectix
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h
index ab7cc1a..202ad89 100644
--- a/sys/dev/usb/usbdi.h
+++ b/sys/dev/usb/usbdi.h
@@ -241,7 +241,7 @@ struct usb_config {
/*
* Use these macro when defining USB device ID arrays if you want to
* have your driver module automatically loaded in host, device or
- * both modes respectivly:
+ * both modes respectively:
*/
#if USB_HAVE_ID_SECTION
#define STRUCT_USB_HOST_ID \
diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c
index 6ee1c24..08740b3 100644
--- a/sys/dev/usb/wlan/if_rsu.c
+++ b/sys/dev/usb/wlan/if_rsu.c
@@ -404,7 +404,7 @@ rsu_attach(device_t self)
struct rsu_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
int error;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index;
struct usb_interface *iface;
const char *rft;
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
index 323de8d..86bb97c 100644
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -269,6 +269,8 @@ static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *,
static void rum_scan_start(struct ieee80211com *);
static void rum_scan_end(struct ieee80211com *);
static void rum_set_channel(struct ieee80211com *);
+static void rum_getradiocaps(struct ieee80211com *, int, int *,
+ struct ieee80211_channel[]);
static int rum_get_rssi(struct rum_softc *, uint8_t);
static void rum_ratectl_start(struct rum_softc *,
struct ieee80211_node *);
@@ -336,6 +338,14 @@ static const struct {
{ 107, 0x04 }
};
+static const uint8_t rum_chan_2ghz[] =
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
+
+static const uint8_t rum_chan_5ghz[] =
+ { 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
+ 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
+ 149, 153, 157, 161, 165 };
+
static const struct rfprog {
uint8_t chan;
uint32_t r1, r2, r3, r4;
@@ -477,7 +487,6 @@ rum_attach(device_t self)
struct rum_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t tmp;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
uint8_t iface_index;
int error, ntries;
@@ -548,12 +557,8 @@ rum_attach(device_t self)
IEEE80211_CRYPTO_TKIPMIC |
IEEE80211_CRYPTO_TKIP;
- memset(bands, 0, sizeof(bands));
- setbit(bands, IEEE80211_MODE_11B);
- setbit(bands, IEEE80211_MODE_11G);
- if (sc->rf_rev == RT2573_RF_5225 || sc->rf_rev == RT2573_RF_5226)
- setbit(bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, bands);
+ rum_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
+ ic->ic_channels);
ieee80211_ifattach(ic);
ic->ic_update_promisc = rum_update_promisc;
@@ -561,6 +566,7 @@ rum_attach(device_t self)
ic->ic_scan_start = rum_scan_start;
ic->ic_scan_end = rum_scan_end;
ic->ic_set_channel = rum_set_channel;
+ ic->ic_getradiocaps = rum_getradiocaps;
ic->ic_transmit = rum_transmit;
ic->ic_parent = rum_parent;
ic->ic_vap_create = rum_vap_create;
@@ -3165,6 +3171,26 @@ rum_set_channel(struct ieee80211com *ic)
RUM_UNLOCK(sc);
}
+static void
+rum_getradiocaps(struct ieee80211com *ic,
+ int maxchans, int *nchans, struct ieee80211_channel chans[])
+{
+ struct rum_softc *sc = ic->ic_softc;
+ uint8_t bands[IEEE80211_MODE_BYTES];
+
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
+ rum_chan_2ghz, nitems(rum_chan_2ghz), bands, 0);
+
+ if (sc->rf_rev == RT2573_RF_5225 || sc->rf_rev == RT2573_RF_5226) {
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
+ rum_chan_5ghz, nitems(rum_chan_5ghz), bands, 0);
+ }
+}
+
static int
rum_get_rssi(struct rum_softc *sc, uint8_t raw)
{
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
index fe115ed..1a96776 100644
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -704,7 +704,7 @@ run_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t ver;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index;
int ntries, error;
@@ -1030,7 +1030,7 @@ run_vap_delete(struct ieee80211vap *vap)
* There are numbers of functions need to be called in context thread.
* Rather than creating taskqueue event for each of those functions,
* here is all-for-one taskqueue callback function. This function
- * gurantees deferred functions are executed in the same order they
+ * guarantees deferred functions are executed in the same order they
* were enqueued.
* '& RUN_CMDQ_MASQ' is to loop cmdq[].
*/
@@ -3372,7 +3372,7 @@ run_tx(struct run_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
/*
* Unlike PCI based devices, we don't get any interrupt from
* USB devices, so we simulate FIFO-is-full interrupt here.
- * Ralink recomends to drain FIFO stats every 100 ms, but 16 slots
+ * Ralink recommends to drain FIFO stats every 100 ms, but 16 slots
* quickly get fulled. To prevent overflow, increment a counter on
* every FIFO stat request, so we know how many slots are left.
* We do this only in HOSTAP or multiple vap mode since FIFO stats
@@ -4884,7 +4884,7 @@ run_update_beacon_cb(void *arg)
/*
* No need to call ieee80211_beacon_update(), run_update_beacon()
- * is taking care of apropriate calls.
+ * is taking care of appropriate calls.
*/
if (rvp->beacon_mbuf == NULL) {
rvp->beacon_mbuf = ieee80211_beacon_alloc(ni);
diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c
index 404fdd8..470be6f 100644
--- a/sys/dev/usb/wlan/if_uath.c
+++ b/sys/dev/usb/wlan/if_uath.c
@@ -328,7 +328,7 @@ uath_attach(device_t dev)
struct uath_softc *sc = device_get_softc(dev);
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index = UATH_IFACE_INDEX; /* XXX */
usb_error_t error;
diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c
index 7f1e8ad..11eec38 100644
--- a/sys/dev/usb/wlan/if_upgt.c
+++ b/sys/dev/usb/wlan/if_upgt.c
@@ -243,7 +243,7 @@ upgt_attach(device_t dev)
struct upgt_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
struct usb_attach_arg *uaa = device_get_ivars(dev);
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index = UPGT_IFACE_INDEX;
int error;
diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c
index 259c158..f27ccd1 100644
--- a/sys/dev/usb/wlan/if_ural.c
+++ b/sys/dev/usb/wlan/if_ural.c
@@ -424,7 +424,7 @@ ural_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct ural_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index;
int error;
diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c
index 0f7b4d9..8895705 100644
--- a/sys/dev/usb/wlan/if_urtw.c
+++ b/sys/dev/usb/wlan/if_urtw.c
@@ -785,7 +785,7 @@ urtw_attach(device_t dev)
struct urtw_softc *sc = device_get_softc(dev);
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index = URTW_IFACE_INDEX; /* XXX */
uint16_t n_setup;
uint32_t data;
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
index 161d26b..af2e6fc 100644
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -334,7 +334,7 @@ zyd_attach(device_t dev)
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct zyd_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t iface_index;
int error;
diff --git a/sys/dev/virtio/console/virtio_console.c b/sys/dev/virtio/console/virtio_console.c
index 902c85f..0a2fa0a 100644
--- a/sys/dev/virtio/console/virtio_console.c
+++ b/sys/dev/virtio/console/virtio_console.c
@@ -1177,7 +1177,7 @@ vtcon_port_enable_intr(struct vtcon_port *port)
{
/*
- * NOTE: The out virtqueue is always polled, so its interupt
+ * NOTE: The out virtqueue is always polled, so its interrupt
* kept disabled.
*/
virtqueue_enable_intr(port->vtcport_invq);
diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c
index e81dcba..9788b7e 100644
--- a/sys/dev/vt/hw/vga/vt_vga.c
+++ b/sys/dev/vt/hw/vga/vt_vga.c
@@ -912,7 +912,7 @@ vga_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
uint8_t pattern_2colors;
/* Align coordinates with the 8-pxels grid. */
- x1 = x / VT_VGA_PIXELS_BLOCK * VT_VGA_PIXELS_BLOCK;
+ x1 = rounddown(x, VT_VGA_PIXELS_BLOCK);
y1 = y;
x2 = roundup(x + width, VT_VGA_PIXELS_BLOCK);
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 2884c57..a90ab9f 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -640,9 +640,9 @@ vt_compute_drawable_area(struct vt_window *vw)
if (vt_draw_logo_cpus)
vw->vw_draw_area.tr_begin.tp_row += vt_logo_sprite_height;
vw->vw_draw_area.tr_end.tp_col = vw->vw_draw_area.tr_begin.tp_col +
- vd->vd_width / vf->vf_width * vf->vf_width;
+ rounddown(vd->vd_width, vf->vf_width);
vw->vw_draw_area.tr_end.tp_row = vw->vw_draw_area.tr_begin.tp_row +
- height / vf->vf_height * vf->vf_height;
+ rounddown(height, vf->vf_height);
}
static void
diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c
index 47a6cd9..08d84a6 100644
--- a/sys/dev/vx/if_vx.c
+++ b/sys/dev/vx/if_vx.c
@@ -251,7 +251,7 @@ vx_init_locked(struct vx_softc *sc)
S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
/*
- * Attempt to get rid of any stray interrupts that occured during
+ * Attempt to get rid of any stray interrupts that occurred during
* configuration. On the i386 this isn't possible because one may
* already be queued. However, a single stray interrupt is
* unimportant.
@@ -752,7 +752,7 @@ again:
eh = mtod(m, struct ether_header *);
/*
- * XXX: Some cards seem to be in promiscous mode all the time.
+ * XXX: Some cards seem to be in promiscuous mode all the time.
* we need to make sure we only get our own stuff always.
* bleah!
*/
diff --git a/sys/dev/vx/if_vx_eisa.c b/sys/dev/vx/if_vx_eisa.c
index b05c8e1..2556580 100644
--- a/sys/dev/vx/if_vx_eisa.c
+++ b/sys/dev/vx/if_vx_eisa.c
@@ -149,7 +149,7 @@ vx_eisa_attach(device_t dev)
}
sc->vx_irq = irq;
- /* Now the registers are availible through the lower ioport */
+ /* Now the registers are available through the lower ioport */
if (vx_attach(dev) == 0)
goto bad;
diff --git a/sys/dev/vxge/include/vxge-queue.h b/sys/dev/vxge/include/vxge-queue.h
index 2ff5e22..4745403 100644
--- a/sys/dev/vxge/include/vxge-queue.h
+++ b/sys/dev/vxge/include/vxge-queue.h
@@ -103,7 +103,7 @@ typedef void (*vxge_queued_f) (void *data, u32 event_type);
* produce/consume operations.
* @tail_ptr: Points to the tail of the queue. It gets changed during queue
* produce/consume operations.
- * @lock: Lock for queue operations(syncronization purpose).
+ * @lock: Lock for queue operations(synchronization purpose).
* @pages_initial:Number of pages to be initially allocated at the time
* of queue creation.
* @pages_max: Max number of pages that can be allocated in the queue.
@@ -235,7 +235,7 @@ vxge_queue_produce(vxge_queue_h queueh,
* Returns: VXGE_QUEUE_OK - success.
* VXGE_QUEUE_IS_EMPTY - Queue is empty.
* VXGE_QUEUE_NOT_ENOUGH_SPACE - Requested item size(@data_max_size)
- * is too small to accomodate an item from the queue.
+ * is too small to accommodate an item from the queue.
*
* See also: vxge_queue_item_t {}, vxge_queue_produce().
*/
@@ -261,7 +261,7 @@ vxge_queue_produce_context(vxge_queue_h queueh,
* Returns: VXGE_QUEUE_OK - success.
* VXGE_QUEUE_IS_EMPTY - Queue is empty.
* VXGE_QUEUE_NOT_ENOUGH_SPACE - Requested item size(@data_max_size)
- * is too small to accomodate an item from the queue.
+ * is too small to accommodate an item from the queue.
*
* See also: vxge_queue_item_t {}, vxge_queue_produce().
*/
@@ -285,7 +285,7 @@ vxge_queue_flush(vxge_queue_h queueh);
* @queueh: Queue handle.
*
* This function is called in the case of no slot avaialble in the queue
- * to accomodate the newly received event.
+ * to accommodate the newly received event.
* Note that queue cannot grow beyond the max size specified for the
* queue.
*
diff --git a/sys/dev/vxge/include/vxgehal-ll.h b/sys/dev/vxge/include/vxgehal-ll.h
index 5c65cc1..7e03448 100644
--- a/sys/dev/vxge/include/vxgehal-ll.h
+++ b/sys/dev/vxge/include/vxgehal-ll.h
@@ -2451,7 +2451,7 @@ void vxge_hal_fifo_txdl_cksum_set_bits(
/*
* vxge_hal_fifo_txdl_interrupt_type_set - Set the interrupt type for the txdl
* @txdlh: Descriptor handle.
- * @interrupt_type: utiliz based interupt or List interrupt
+ * @interrupt_type: utiliz based interrupt or List interrupt
*
* vxge_hal_fifo_txdl_interrupt_type_set is used to set the interrupt type for
* each xmit txdl dynamically
@@ -2639,7 +2639,7 @@ vxge_hal_fifo_txdl_buffer_append(
* @txdlh: Descriptor handle.
* @frag_idx: Index of the data buffer in the Txdl list.
*
- * This API in conjuction with vxge_hal_fifo_txdl_buffer_append() prepares
+ * This API in conjunction with vxge_hal_fifo_txdl_buffer_append() prepares
* a descriptor that consists of a single physically contiguous buffer
* which inturn contains the contents of one or more virtually contiguous
* buffers received from the upper layer.
@@ -3950,7 +3950,7 @@ void
* @read_length: Size of the valid data in the buffer.
*
* Read HAL trace buffer contents starting from the offset
- * upto the size of the buffer or till EOF is reached.
+ * up to the size of the buffer or till EOF is reached.
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_EOF_TRACE_BUF - No more data in the trace buffer.
@@ -5109,7 +5109,7 @@ vxge_hal_vpath_rts_rth_get(
*
* @vpath_handle: Virtual Path ahandle.
* @KeySize: Number of 64-bit words
- * @Key: upto 40-byte array of 64-bit values
+ * @Key: up to 40-byte array of 64-bit values
* This function configures the 40-byte secret which is used for hash
* calculation.
*
@@ -5633,7 +5633,7 @@ vxge_hal_vpath_rpa_set(
* vxge_hal_vpath_poll_rx - Poll Rx od Virtual Path for completed
* descriptors and process the same.
* @vpath_handle: Virtual Path ahandle.
- * @got_rx: Buffer to return the flag set if receive interrupt is occured
+ * @got_rx: Buffer to return the flag set if receive interrupt is occurred
*
* The function polls the Rx for the completed descriptors and calls
* the upper-layer driver (ULD) via supplied completion callback.
@@ -5653,7 +5653,7 @@ vxge_hal_vpath_poll_rx(
* vxge_hal_vpath_poll_tx - Poll Tx for completed descriptors and process
* the same.
* @vpath_handle: Virtual Path ahandle.
- * @got_tx: Buffer to return the flag set if transmit interrupt is occured
+ * @got_tx: Buffer to return the flag set if transmit interrupt is occurred
*
* The function polls the Tx for the completed descriptors and calls
* the upper-layer driver (ULD) via supplied completion callback.
diff --git a/sys/dev/vxge/include/vxgehal-mgmt.h b/sys/dev/vxge/include/vxgehal-mgmt.h
index 682e81e..effc9ab 100644
--- a/sys/dev/vxge/include/vxgehal-mgmt.h
+++ b/sys/dev/vxge/include/vxgehal-mgmt.h
@@ -87,7 +87,7 @@ typedef struct vxge_hal_mgmt_about_info_t {
*
* Returns: VXGE_HAL_OK - success;
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
* VXGE_HAL_FAIL - Failed to retrieve the information.
*
@@ -111,7 +111,7 @@ vxge_hal_mgmt_about(vxge_hal_device_h devh,
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
*
*/
@@ -122,7 +122,7 @@ vxge_hal_mgmt_pci_config(vxge_hal_device_h devh, u8 *buffer, u32 *size);
* struct vxge_hal_mgmt_pm_cap_t - Power Management Capabilities
* @pm_cap_ver: Version
* @pm_cap_pme_clock: PME clock required
- * @pm_cap_aux_power: Auxilliary power support
+ * @pm_cap_aux_power: Auxiliary power support
* @pm_cap_dsi: Device specific initialization
* @pm_cap_aux_current: auxiliary current requirements
* @pm_cap_cap_d0: D1 power state support
@@ -412,7 +412,7 @@ vxge_hal_mgmt_pci_err_capabilities_get(vxge_hal_device_h devh,
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_DRIVER_NOT_INITIALIZED - HAL is not initialized.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version is not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version is not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
*
* See also: vxge_hal_driver_config_t {}, vxge_hal_mgmt_device_config().
@@ -430,7 +430,7 @@ vxge_hal_mgmt_driver_config(vxge_hal_driver_config_t *drv_config, u32 *size);
* @read_length: Size of the valid data in the buffer.
*
* Read HAL trace buffer contents starting from the offset
- * upto the size of the buffer or till EOF is reached.
+ * up to the size of the buffer or till EOF is reached.
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_EOF_TRACE_BUF - No more data in the trace buffer.
@@ -457,7 +457,7 @@ vxge_hal_mgmt_trace_read(char *buffer,
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
*
* See also: vxge_hal_device_config_t {}, vxge_hal_mgmt_driver_config().
diff --git a/sys/dev/vxge/include/vxgehal-mgmtaux.h b/sys/dev/vxge/include/vxgehal-mgmtaux.h
index 6eba36a..8ded696 100644
--- a/sys/dev/vxge/include/vxgehal-mgmtaux.h
+++ b/sys/dev/vxge/include/vxgehal-mgmtaux.h
@@ -47,7 +47,7 @@ __EXTERN_BEGIN_DECLS
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_FAIL - Failed to retrieve the information.
*
* See also: vxge_hal_mgmt_about(), vxge_hal_aux_device_dump().
@@ -64,7 +64,7 @@ vxge_hal_status_e vxge_hal_aux_about_read(vxge_hal_device_h devh, int bufsize,
* Read driver configuration,
*
* Returns: VXGE_HAL_OK - success.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
*
* See also: vxge_hal_aux_device_config_read().
*/
@@ -84,7 +84,7 @@ vxge_hal_aux_driver_config_read(int bufsize, char *retbuf, int *retsize);
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
*
* See also: vxge_hal_mgmt_pci_config(), vxge_hal_aux_device_dump().
*/
@@ -105,7 +105,7 @@ vxge_hal_aux_pci_config_read(vxge_hal_device_h devh,
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
*
* See also: vxge_hal_aux_driver_config_read().
*/
diff --git a/sys/dev/vxge/include/vxgehal-stats.h b/sys/dev/vxge/include/vxgehal-stats.h
index 3697471..9dae119 100644
--- a/sys/dev/vxge/include/vxgehal-stats.h
+++ b/sys/dev/vxge/include/vxgehal-stats.h
@@ -925,7 +925,7 @@ typedef struct vxge_hal_xmac_aggr_stats_t {
* @rx_red_discard: Count of received frames that are discarded because of RED
* (Random Early Discard).
* @rx_xgmii_ctrl_err_cnt: Maintains a count of unexpected or misplaced control
- * characters occuring between times of normal data transmission
+ * characters occurring between times of normal data transmission
* (i.e. not included in RX_XGMII_DATA_ERR_CNT). This counter is
* incremented when either -
* 1) The Reconciliation Sublayer (RS) is expecting one control
diff --git a/sys/dev/vxge/vxgehal/vxge-queue.c b/sys/dev/vxge/vxgehal/vxge-queue.c
index 5cf433e..c2a2b5a 100644
--- a/sys/dev/vxge/vxgehal/vxge-queue.c
+++ b/sys/dev/vxge/vxgehal/vxge-queue.c
@@ -392,7 +392,7 @@ vxge_queue_destroy(vxge_queue_h queueh)
* @queueh: Queue handle.
*
* This function is called in the case of no slot avaialble in the queue
- * to accomodate the newly received event.
+ * to accommodate the newly received event.
* Note that queue cannot grow beyond the max size specified for the
* queue.
*
@@ -488,7 +488,7 @@ vxge_io_queue_grow(vxge_queue_h queueh)
* Returns: VXGE_QUEUE_OK - success.
* VXGE_QUEUE_IS_EMPTY - Queue is empty.
* VXGE_QUEUE_NOT_ENOUGH_SPACE - Requested item size(@data_max_size)
- * is too small to accomodate an item from the queue.
+ * is too small to accommodate an item from the queue.
*
* See also: vxge_queue_item_t {}, vxge_queue_produce().
*/
diff --git a/sys/dev/vxge/vxgehal/vxgehal-device.c b/sys/dev/vxge/vxgehal/vxgehal-device.c
index 2e77f1e..faa5f79 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-device.c
+++ b/sys/dev/vxge/vxgehal/vxgehal-device.c
@@ -3395,7 +3395,7 @@ vxge_hal_device_trace_dump(vxge_hal_device_h devh)
* @read_length: Size of the valid data in the buffer.
*
* Read HAL trace buffer contents starting from the offset
- * upto the size of the buffer or till EOF is reached.
+ * up to the size of the buffer or till EOF is reached.
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_EOF_TRACE_BUF - No more data in the trace buffer.
diff --git a/sys/dev/vxge/vxgehal/vxgehal-fifo.c b/sys/dev/vxge/vxgehal/vxgehal-fifo.c
index 771f880..30dfa3d 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-fifo.c
+++ b/sys/dev/vxge/vxgehal/vxgehal-fifo.c
@@ -384,7 +384,7 @@ __hal_fifo_create(
* demand with the size which will fit into one memory block.
* One memory block may contain more than one TxDL. In simple case
* memory block size can be equal to CPU page size. On more
- * sophisticated OS's memory block can be contigious across
+ * sophisticated OS's memory block can be contiguous across
* several pages.
*
* During "reserve" operations more memory can be allocated on demand
@@ -1191,7 +1191,7 @@ vxge_hal_fifo_txdl_buffer_append(
* @txdlh: Descriptor handle.
* @frag_idx: Index of the data buffer in the Txdl list.
*
- * This API in conjuction with vxge_hal_fifo_txdl_buffer_append() prepares
+ * This API in conjunction with vxge_hal_fifo_txdl_buffer_append() prepares
* a descriptor that consists of a single physically contiguous buffer
* which inturn contains the contents of one or more virtually contiguous
* buffers received from the upper layer.
diff --git a/sys/dev/vxge/vxgehal/vxgehal-mgmt.c b/sys/dev/vxge/vxgehal/vxgehal-mgmt.c
index 3e1a25afb..c58ddb2 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-mgmt.c
+++ b/sys/dev/vxge/vxgehal/vxgehal-mgmt.c
@@ -45,7 +45,7 @@
*
* Returns: VXGE_HAL_OK - success;
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
* VXGE_HAL_FAIL - Failed to retrieve the information.
*
@@ -136,7 +136,7 @@ vxge_hal_mgmt_about(vxge_hal_device_h devh,
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
*
*/
@@ -916,7 +916,7 @@ vxge_hal_mgmt_pci_err_capabilities_get(vxge_hal_device_h devh,
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_DRIVER_NOT_INITIALIZED - HAL is not initialized.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version is not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version is not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
*
* See also: vxge_hal_driver_config_t {}, vxge_hal_mgmt_device_config().
@@ -974,7 +974,7 @@ vxge_hal_mgmt_driver_config(vxge_hal_driver_config_t *drv_config, u32 *size)
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_ERR_OUT_OF_SPACE - If the buffer is not sufficient
*
* See also: vxge_hal_device_config_t {}, vxge_hal_mgmt_driver_config().
diff --git a/sys/dev/vxge/vxgehal/vxgehal-mgmtaux.c b/sys/dev/vxge/vxgehal/vxgehal-mgmtaux.c
index e294e7e..995cbc7 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-mgmtaux.c
+++ b/sys/dev/vxge/vxgehal/vxgehal-mgmtaux.c
@@ -82,7 +82,7 @@
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
* VXGE_HAL_FAIL - Failed to retrieve the information.
*
* See also: vxge_hal_mgmt_about(), vxge_hal_aux_device_dump().
@@ -132,7 +132,7 @@ vxge_hal_aux_about_read(vxge_hal_device_h devh, int bufsize,
* Read driver configuration,
*
* Returns: VXGE_HAL_OK - success.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
*
* See also: vxge_hal_aux_device_config_read().
*/
@@ -169,7 +169,7 @@ vxge_hal_aux_driver_config_read(int bufsize, char *retbuf, int *retsize)
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
*
* See also: vxge_hal_mgmt_pci_config(), vxge_hal_aux_device_dump().
*/
@@ -463,7 +463,7 @@ vxge_hal_aux_pci_config_read(
*
* Returns: VXGE_HAL_OK - success.
* VXGE_HAL_ERR_INVALID_DEVICE - Device is not valid.
- * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not maching.
+ * VXGE_HAL_ERR_VERSION_CONFLICT - Version it not matching.
*
* See also: vxge_hal_aux_driver_config_read().
*/
diff --git a/sys/dev/vxge/vxgehal/vxgehal-regs.h b/sys/dev/vxge/vxgehal/vxgehal-regs.h
index 52cef74..a18e97b 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-regs.h
+++ b/sys/dev/vxge/vxgehal/vxgehal-regs.h
@@ -200,7 +200,7 @@ typedef struct vxge_hal_pm_capability_le_t {
u16 capabilities_reg;
#define VXGE_HAL_PCI_PM_CAP_VER_MASK 0x0007 /* Version */
#define VXGE_HAL_PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
-#define VXGE_HAL_PCI_PM_CAP_AUX_POWER 0x0010 /* Auxilliary power support */
+#define VXGE_HAL_PCI_PM_CAP_AUX_POWER 0x0010 /* Auxiliary power support */
#define VXGE_HAL_PCI_PM_CAP_DSI 0x0020 /* Device specific init */
#define VXGE_HAL_PCI_PM_AUX_CURRENT 0x01C0 /* Auxiliary current reqs */
#define VXGE_HAL_PCI_PM_CAP_D1 0x0200 /* D1 power state support */
@@ -228,7 +228,7 @@ typedef struct vxge_hal_pm_capability_t {
u16 capabilities_reg;
#define VXGE_HAL_PCI_PM_CAP_VER_MASK 0x0007 /* Version */
#define VXGE_HAL_PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
-#define VXGE_HAL_PCI_PM_CAP_AUX_POWER 0x0010 /* Auxilliary power support */
+#define VXGE_HAL_PCI_PM_CAP_AUX_POWER 0x0010 /* Auxiliary power support */
#define VXGE_HAL_PCI_PM_CAP_DSI 0x0020 /* Dev specific init */
#define VXGE_HAL_PCI_PM_AUX_CURRENT 0x01C0 /* Auxiliary current reqs */
#define VXGE_HAL_PCI_PM_CAP_D1 0x0200 /* D1 power state support */
@@ -257,7 +257,7 @@ typedef struct vxge_hal_pm_capability_t {
u16 capabilities_reg;
#define VXGE_HAL_PCI_PM_CAP_VER_MASK 0x0007 /* Version */
#define VXGE_HAL_PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
-#define VXGE_HAL_PCI_PM_CAP_AUX_POWER 0x0010 /* Auxilliary power support */
+#define VXGE_HAL_PCI_PM_CAP_AUX_POWER 0x0010 /* Auxiliary power support */
#define VXGE_HAL_PCI_PM_CAP_DSI 0x0020 /* Dev specific init */
#define VXGE_HAL_PCI_PM_AUX_CURRENT 0x01C0 /* Auxiliary curr reqs */
#define VXGE_HAL_PCI_PM_CAP_D1 0x0200 /* D1 power state support */
diff --git a/sys/dev/vxge/vxgehal/vxgehal-virtualpath.c b/sys/dev/vxge/vxgehal/vxgehal-virtualpath.c
index ac51b97..c4067e9 100644
--- a/sys/dev/vxge/vxgehal/vxgehal-virtualpath.c
+++ b/sys/dev/vxge/vxgehal/vxgehal-virtualpath.c
@@ -2899,7 +2899,7 @@ vxge_hal_vpath_rts_rth_get(vxge_hal_vpath_h vpath_handle,
*
* @vpath_handle: Virtual Path ahandle.
* @KeySize: Number of 64-bit words
- * @Key: upto 40-byte array of 64-bit values
+ * @Key: up to 40-byte array of 64-bit values
* This function configures the 40-byte secret which is used for hash
* calculation.
*
@@ -7532,7 +7532,7 @@ vxge_hal_vpath_msix_unmask_all(vxge_hal_vpath_h vpath_handle)
* vxge_hal_vpath_poll_rx - Poll Rx Virtual Path for completed
* descriptors and process the same.
* @vpath_handle: Virtual Path ahandle.
- * @got_rx: Buffer to return the flag set if receive interrupt is occured
+ * @got_rx: Buffer to return the flag set if receive interrupt is occurred
*
* The function polls the Rx for the completed descriptors and calls
* the upper-layer driver (ULD) via supplied completion callback.
@@ -7597,7 +7597,7 @@ vxge_hal_vpath_poll_rx(vxge_hal_vpath_h vpath_handle, u32 *got_rx)
* vxge_hal_vpath_poll_tx - Poll Tx for completed descriptors and process
* the same.
* @vpath_handle: Virtual Path ahandle.
- * @got_tx: Buffer to return the flag set if transmit interrupt is occured
+ * @got_tx: Buffer to return the flag set if transmit interrupt is occurred
*
* The function polls the Tx for the completed descriptors and calls
* the upper-layer driver (ULD) via supplied completion callback.
diff --git a/sys/dev/wbwd/wbwd.c b/sys/dev/wbwd/wbwd.c
index 7ed2d48..47d7bbd 100644
--- a/sys/dev/wbwd/wbwd.c
+++ b/sys/dev/wbwd/wbwd.c
@@ -754,7 +754,7 @@ wb_attach(device_t dev)
sc = device_get_softc(dev);
KASSERT(sc->ext_cfg_enter_f != NULL && sc->ext_cfg_exit_f != NULL,
- ("%s: successfull probe result but not setup correctly", __func__));
+ ("%s: successful probe result but not setup correctly", __func__));
/* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */
write_reg(sc, WB_LDN_REG, WB_LDN_REG_LDN8);
diff --git a/sys/dev/wi/if_wavelan_ieee.h b/sys/dev/wi/if_wavelan_ieee.h
index 0061e63..c2a8e1b 100644
--- a/sys/dev/wi/if_wavelan_ieee.h
+++ b/sys/dev/wi/if_wavelan_ieee.h
@@ -431,7 +431,7 @@ struct wi_apinfo {
*/
/*
- * standard hermes recieve frame used by wavelan/prism2 cards
+ * standard hermes receive frame used by wavelan/prism2 cards
*/
struct wi_rx_frame {
/*
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 632bd76..19876e1 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -46,7 +46,7 @@
* without an NDA (if at all). What they do release is an API library
* called the HCF (Hardware Control Functions) which is supposed to
* do the device-specific operations of a device driver for you. The
- * publically available version of the HCF library (the 'HCF Light') is
+ * publicly available version of the HCF library (the 'HCF Light') is
* a) extremely gross, b) lacks certain features, particularly support
* for 802.11 frames, and c) is contaminated by the GNU Public License.
*
diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h
index d99e597..d5e12ca 100644
--- a/sys/dev/wi/if_wireg.h
+++ b/sys/dev/wi/if_wireg.h
@@ -157,7 +157,7 @@
* - Lucent has created a library called HCF (Hardware Control Functions)
* though which it wants developers to interact with the card. The HCF
* is needlessly complex, ill conceived and badly documented. Actually,
- * the comments in the HCP code itself aren't bad, but the publically
+ * the comments in the HCP code itself aren't bad, but the publicly
* available manual that comes with it is awful, probably due largely to
* the fact that it has been emasculated in order to hide information
* that Lucent wants to keep proprietary. The purpose of the HCF seems
@@ -295,7 +295,7 @@
#define WI_EV_CMD 0x0010 /* command completed */
#define WI_EV_ALLOC 0x0008 /* async alloc/reclaim completed */
#define WI_EV_TX_EXC 0x0004 /* async xmit completed with failure */
-#define WI_EV_TX 0x0002 /* async xmit completed succesfully */
+#define WI_EV_TX 0x0002 /* async xmit completed successfully */
#define WI_EV_RX 0x0001 /* async rx completed */
/* Host software registers */
diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c
index 6414d33..08d0fc8 100644
--- a/sys/dev/wl/if_wl.c
+++ b/sys/dev/wl/if_wl.c
@@ -1252,7 +1252,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
mode |= MOD_PROM;
}
/*
- * force a complete reset if the recieve multicast/
+ * force a complete reset if the receive multicast/
* promiscuous mode changes so that these take
* effect immediately.
*
@@ -1479,11 +1479,11 @@ wlwatchdog(void *vsc)
*
* This function is the interrupt handler for the WaveLAN
* board. This routine will be called whenever either a packet
- * is received, or a packet has successfully been transfered and
+ * is received, or a packet has successfully been transferred and
* the unit is ready to transmit another packet.
*
* input : board number that interrupted
- * output : either a packet is received, or a packet is transfered
+ * output : either a packet is received, or a packet is transferred
*
*/
static void
@@ -1500,7 +1500,7 @@ wlintr(void *arg)
#endif
if ((int_type = WL_READ_2(sc, HASR)) & HASR_MMC_INTR) {
- /* handle interrupt from the modem management controler */
+ /* handle interrupt from the modem management controller */
/* This will clear the interrupt condition */
(void) wlmmcread(sc, MMC_DCE_STATUS); /* ignored for now */
}
diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c
index e435096..acaa821 100644
--- a/sys/dev/wpi/if_wpi.c
+++ b/sys/dev/wpi/if_wpi.c
@@ -1412,9 +1412,18 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n, int maxchans,
{
struct wpi_eeprom_chan *channels = sc->eeprom_channels[n];
const struct wpi_chan_band *band = &wpi_bands[n];
- struct ieee80211_channel *c;
uint32_t nflags;
+ uint8_t bands[IEEE80211_MODE_BYTES];
uint8_t chan, i;
+ int error;
+
+ memset(bands, 0, sizeof(bands));
+
+ if (n == 0) {
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ } else
+ setbit(bands, IEEE80211_MODE_11A);
for (i = 0; i < band->nchan; i++) {
if (!(channels[i].flags & WPI_EEPROM_CHAN_VALID)) {
@@ -1424,45 +1433,19 @@ wpi_read_eeprom_band(struct wpi_softc *sc, uint8_t n, int maxchans,
continue;
}
- if (*nchans >= maxchans)
- break;
-
chan = band->chan[i];
nflags = wpi_eeprom_channel_flags(&channels[i]);
-
- c = &chans[(*nchans)++];
- c->ic_ieee = chan;
- c->ic_maxregpower = channels[i].maxpwr;
- c->ic_maxpower = 2*c->ic_maxregpower;
-
- if (n == 0) { /* 2GHz band */
- c->ic_freq = ieee80211_ieee2mhz(chan,
- IEEE80211_CHAN_G);
-
- /* G =>'s B is supported */
- c->ic_flags = IEEE80211_CHAN_B | nflags;
-
- if (*nchans >= maxchans)
- break;
-
- c = &chans[(*nchans)++];
- c[0] = c[-1];
- c->ic_flags = IEEE80211_CHAN_G | nflags;
- } else { /* 5GHz band */
- c->ic_freq = ieee80211_ieee2mhz(chan,
- IEEE80211_CHAN_A);
-
- c->ic_flags = IEEE80211_CHAN_A | nflags;
- }
+ error = ieee80211_add_channel(chans, maxchans, nchans,
+ chan, 0, channels[i].maxpwr, nflags, bands);
+ if (error != 0)
+ break;
/* Save maximum allowed TX power for this channel. */
sc->maxpwr[chan] = channels[i].maxpwr;
DPRINTF(sc, WPI_DEBUG_EEPROM,
- "adding chan %d (%dMHz) flags=0x%x maxpwr=%d passive=%d,"
- " offset %d\n", chan, c->ic_freq,
- channels[i].flags, sc->maxpwr[chan],
- IEEE80211_IS_CHAN_PASSIVE(c), *nchans);
+ "adding chan %d flags=0x%x maxpwr=%d, offset %d\n",
+ chan, channels[i].flags, sc->maxpwr[chan], *nchans);
}
}
@@ -2074,7 +2057,6 @@ wpi_tx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc)
struct mbuf *m;
struct ieee80211_node *ni;
struct ieee80211vap *vap;
- struct ieee80211com *ic;
uint32_t status = le32toh(stat->status);
int ackfailcnt = stat->ackfailcnt / WPI_NTRIES_DEFAULT;
@@ -2094,7 +2076,6 @@ wpi_tx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc)
m = data->m, data->m = NULL;
ni = data->ni, data->ni = NULL;
vap = ni->ni_vap;
- ic = vap->iv_ic;
/*
* Update rate control statistics for the node.
@@ -3833,7 +3814,7 @@ wpi_set_pslevel(struct wpi_softc *sc, uint8_t dtim, int level, int async)
if (max == (uint32_t)-1)
max = dtim * (skip_dtim + 1);
else if (max > dtim)
- max = (max / dtim) * dtim;
+ max = rounddown(max, dtim);
} else
max = dtim;
diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c
index 2c58ad9..9646129 100644
--- a/sys/dev/wtap/if_wtap.c
+++ b/sys/dev/wtap/if_wtap.c
@@ -131,7 +131,7 @@ wtap_node_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
switch(cmd) {
default:
- DWTAP_PRINTF("Unkown WTAP IOCTL\n");
+ DWTAP_PRINTF("Unknown WTAP IOCTL\n");
error = EINVAL;
}
return error;
diff --git a/sys/dev/wtap/if_wtap_module.c b/sys/dev/wtap/if_wtap_module.c
index 764f8a6..c03293e 100644
--- a/sys/dev/wtap/if_wtap_module.c
+++ b/sys/dev/wtap/if_wtap_module.c
@@ -88,7 +88,7 @@
MALLOC_DEFINE(M_WTAP, "wtap", "wtap wireless simulator");
MALLOC_DEFINE(M_WTAP_PACKET, "wtap packet", "wtap wireless simulator packet");
MALLOC_DEFINE(M_WTAP_RXBUF, "wtap rxbuf",
- "wtap wireless simulator recieve buffer");
+ "wtap wireless simulator receive buffer");
MALLOC_DEFINE(M_WTAP_PLUGIN, "wtap plugin", "wtap wireless simulator plugin");
static struct wtap_hal *hal;
@@ -122,7 +122,7 @@ wtap_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
error = EINVAL;
break;
default:
- DWTAP_PRINTF("Unkown WTAP IOCTL\n");
+ DWTAP_PRINTF("Unknown WTAP IOCTL\n");
error = EINVAL;
}
diff --git a/sys/dev/wtap/plugins/visibility.c b/sys/dev/wtap/plugins/visibility.c
index 620dfd6..82ce5e8 100644
--- a/sys/dev/wtap/plugins/visibility.c
+++ b/sys/dev/wtap/plugins/visibility.c
@@ -230,7 +230,7 @@ vis_ioctl(struct cdev *sdev, u_long cmd, caddr_t data,
#endif
break;
default:
- DWTAP_PRINTF("Unkown WTAP IOCTL\n");
+ DWTAP_PRINTF("Unknown WTAP IOCTL\n");
error = EINVAL;
}
diff --git a/sys/dev/xe/if_xereg.h b/sys/dev/xe/if_xereg.h
index f3ab4b5..b81ae6b 100644
--- a/sys/dev/xe/if_xereg.h
+++ b/sys/dev/xe/if_xereg.h
@@ -633,7 +633,7 @@
#define PHY_BMSR 0x01 /* Basic Mode Status Register */
#define PHY_ID1 0x02 /* PHY ID 1 */
#define PHY_ID2 0x03 /* PHY ID 2 */
-#define PHY_ANAR 0x04 /* Auto-Negotiation Advertisment Register */
+#define PHY_ANAR 0x04 /* Auto-Negotiation Advertisement Register */
#define PHY_LPAR 0x05 /* Auto-Negotiation Link Partner Ability Register */
#define PHY_ANER 0x06 /* Auto-Negotiation Expansion Register */
diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c
index e54e39c..aefa5cd 100644
--- a/sys/dev/xen/balloon/balloon.c
+++ b/sys/dev/xen/balloon/balloon.c
@@ -353,7 +353,7 @@ xenballoon_identify(driver_t *driver __unused, device_t parent)
}
/**
- * \brief Probe for the existance of the Xen Balloon device
+ * \brief Probe for the existence of the Xen Balloon device
*
* \param dev NewBus device_t for this Xen control instance.
*
diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c
index a97314b..97068a1 100644
--- a/sys/dev/xen/blkback/blkback.c
+++ b/sys/dev/xen/blkback/blkback.c
@@ -619,7 +619,7 @@ struct xbb_softc {
* There are situations where the back and front ends can
* have a different, native abi (e.g. intel x86_64 and
* 32bit x86 domains on the same machine). The back-end
- * always accomodates the front-end's native abi. That
+ * always accommodates the front-end's native abi. That
* value is pulled from the XenStore and recorded here.
*/
int abi;
@@ -788,13 +788,13 @@ struct xbb_softc {
/** Number of requests we completed with an error status*/
uint64_t reqs_completed_with_error;
- /** How many forced dispatches (i.e. without coalescing) have happend */
+ /** How many forced dispatches (i.e. without coalescing) have happened */
uint64_t forced_dispatch;
- /** How many normal dispatches have happend */
+ /** How many normal dispatches have happened */
uint64_t normal_dispatch;
- /** How many total dispatches have happend */
+ /** How many total dispatches have happened */
uint64_t total_dispatch;
/** How many times we have run out of KVA */
@@ -1957,7 +1957,7 @@ xbb_run_queue(void *context, int pending)
* we've already consumed all necessary data out
* of the version of the request in the ring buffer
* (for native mode). We must update the consumer
- * index before issueing back-end I/O so there is
+ * index before issuing back-end I/O so there is
* no possibility that it will complete and a
* response be generated before we make room in
* the queue for that response.
@@ -3062,7 +3062,7 @@ xbb_collect_frontend_info(struct xbb_softc *xbb)
* and the new value is outside of its allowed range.
*
* \note xs_gather() returns on the first encountered error, so
- * we must use independant calls in order to guarantee
+ * we must use independent calls in order to guarantee
* we don't miss information in a sparsly populated front-end
* tree.
*
@@ -3739,7 +3739,7 @@ xbb_attach(device_t dev)
*
* \note A block back device may be detached at any time in its life-cycle,
* including part way through the attach process. For this reason,
- * initialization order and the intialization state checks in this
+ * initialization order and the initialization state checks in this
* routine must be carefully coupled so that attach time failures
* are gracefully handled.
*/
diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c
index ef36b94..4de5884 100644
--- a/sys/dev/xen/blkfront/blkfront.c
+++ b/sys/dev/xen/blkfront/blkfront.c
@@ -571,7 +571,7 @@ xbd_quiesce(struct xbd_softc *sc)
while (xbd_queue_length(sc, XBD_Q_BUSY) != 0) {
RING_FINAL_CHECK_FOR_RESPONSES(&sc->xbd_ring, mtd);
if (mtd) {
- /* Recieved request completions, update queue. */
+ /* Received request completions, update queue. */
xbd_int(sc);
}
if (xbd_queue_length(sc, XBD_Q_BUSY) != 0) {
@@ -1118,7 +1118,7 @@ xbd_initialize(struct xbd_softc *sc)
* Protocol negotiation.
*
* \note xs_gather() returns on the first encountered error, so
- * we must use independant calls in order to guarantee
+ * we must use independent calls in order to guarantee
* we don't miss information in a sparsly populated back-end
* tree.
*
diff --git a/sys/dev/xen/blkfront/block.h b/sys/dev/xen/blkfront/block.h
index ddb4088..b481396 100644
--- a/sys/dev/xen/blkfront/block.h
+++ b/sys/dev/xen/blkfront/block.h
@@ -160,7 +160,7 @@ typedef enum {
XBDF_CM_SHORTAGE = 1 << 4, /* Free cm resource shortage active. */
XBDF_GNT_SHORTAGE = 1 << 5, /* Grant ref resource shortage active */
XBDF_WAIT_IDLE = 1 << 6, /*
- * No new work until oustanding work
+ * No new work until outstanding work
* completes.
*/
XBDF_DISCARD = 1 << 7, /* backend supports discard */
diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c
index c7bd8c2..8cf5969 100644
--- a/sys/dev/xen/control/control.c
+++ b/sys/dev/xen/control/control.c
@@ -122,6 +122,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/eventhandler.h>
+#include <sys/timetc.h>
#include <geom/geom.h>
@@ -197,6 +198,8 @@ xctrl_suspend()
#endif
int suspend_cancelled;
+ EVENTHANDLER_INVOKE(power_suspend_early);
+ stop_all_proc();
EVENTHANDLER_INVOKE(power_suspend);
if (smp_started) {
@@ -222,7 +225,6 @@ xctrl_suspend()
printf("%s: device_suspend failed\n", __func__);
return;
}
- mtx_unlock(&Giant);
#ifdef SMP
CPU_ZERO(&cpu_suspend_map); /* silence gcc */
@@ -273,16 +275,24 @@ xctrl_suspend()
* FreeBSD really needs to add DEVICE_SUSPEND_CANCEL or
* similar.
*/
- mtx_lock(&Giant);
DEVICE_RESUME(root_bus);
mtx_unlock(&Giant);
+ /*
+ * Warm up timecounter again and reset system clock.
+ */
+ timecounter->tc_get_timecount(timecounter);
+ timecounter->tc_get_timecount(timecounter);
+ inittodr(time_second);
+
if (smp_started) {
thread_lock(curthread);
sched_unbind(curthread);
thread_unlock(curthread);
}
+ resume_all_proc();
+
EVENTHANDLER_INVOKE(power_resume);
if (bootverbose)
@@ -358,7 +368,7 @@ xctrl_identify(driver_t *driver __unused, device_t parent)
}
/**
- * \brief Probe for the existance of the Xen Control device
+ * \brief Probe for the existence of the Xen Control device
*
* \param dev NewBus device_t for this Xen control instance.
*
diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c
index 4b4fdb9..aa5ce6e 100644
--- a/sys/dev/xen/netback/netback.c
+++ b/sys/dev/xen/netback/netback.c
@@ -416,7 +416,7 @@ struct xnb_softc {
* There are situations where the back and front ends can
* have a different, native abi (e.g. intel x86_64 and
* 32bit x86 domains on the same machine). The back-end
- * always accomodates the front-end's native abi. That
+ * always accommodates the front-end's native abi. That
* value is pulled from the XenStore and recorded here.
*/
int abi;
@@ -1327,7 +1327,7 @@ xnb_attach(device_t dev)
*
* \note A net back device may be detached at any time in its life-cycle,
* including part way through the attach process. For this reason,
- * initialization order and the intialization state checks in this
+ * initialization order and the initialization state checks in this
* routine must be carefully coupled so that attach time failures
* are gracefully handled.
*/
diff --git a/sys/dev/xen/netback/netback_unit_tests.c b/sys/dev/xen/netback/netback_unit_tests.c
index 390f9f7..db94217 100644
--- a/sys/dev/xen/netback/netback_unit_tests.c
+++ b/sys/dev/xen/netback/netback_unit_tests.c
@@ -98,7 +98,7 @@ struct test_fixture {
/** Will be run if setup succeeds */
testcase_t *test;
- /** Cleans up test data whether or not the setup suceeded*/
+ /** Cleans up test data whether or not the setup succeeded */
teardown_t *teardown;
};
diff --git a/sys/dev/xen/timer/timer.c b/sys/dev/xen/timer/timer.c
index 53aff0a..083898c 100644
--- a/sys/dev/xen/timer/timer.c
+++ b/sys/dev/xen/timer/timer.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <xen/hypervisor.h>
#include <xen/interface/io/xenbus.h>
#include <xen/interface/vcpu.h>
+#include <xen/error.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
@@ -63,6 +64,8 @@ __FBSDID("$FreeBSD$");
#include <dev/xen/timer/timer.h>
+#include <isa/rtc.h>
+
#include "clock_if.h"
static devclass_t xentimer_devclass;
@@ -74,9 +77,7 @@ static devclass_t xentimer_devclass;
/* Xen timers may fire up to 100us off */
#define XENTIMER_MIN_PERIOD_IN_NSEC 100*NSEC_IN_USEC
-#define XENCLOCK_RESOLUTION 10000000
-
-#define ETIME 62 /* Xen "bad time" error */
+#define XENCLOCK_RESOLUTION 1000001 /* ATRTC resolution + 1 */
#define XENTIMER_QUALITY 950
@@ -213,11 +214,32 @@ xen_fetch_uptime(struct timespec *ts)
static int
xentimer_settime(device_t dev __unused, struct timespec *ts)
{
+ struct xen_platform_op settime;
+ int ret;
+
/*
* Don't return EINVAL here; just silently fail if the domain isn't
* privileged enough to set the TOD.
*/
- return (0);
+ if (!xen_initial_domain())
+ return (0);
+
+ /* Set the native RTC. */
+ atrtc_set(ts);
+
+ settime.cmd = XENPF_settime64;
+ settime.u.settime64.mbz = 0;
+ settime.u.settime64.secs = ts->tv_sec;
+ settime.u.settime64.nsecs = ts->tv_nsec;
+ settime.u.settime64.system_time =
+ xen_fetch_vcpu_time(DPCPU_GET(vcpu_info));
+
+ ret = HYPERVISOR_platform_op(&settime);
+ ret = ret != 0 ? xen_translate_error(ret) : 0;
+ if (ret != 0 && bootverbose)
+ device_printf(dev, "failed to set Xen PV clock: %d\n", ret);
+
+ return (ret);
}
/**
@@ -267,7 +289,8 @@ xentimer_vcpu_start_timer(int vcpu, uint64_t next_time)
struct vcpu_set_singleshot_timer single;
single.timeout_abs_ns = next_time;
- single.flags = VCPU_SSHOTTMR_future;
+ /* Get an event anyway, even if the timeout is already expired */
+ single.flags = 0;
return (HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, vcpu, &single));
}
@@ -294,7 +317,7 @@ static int
xentimer_et_start(struct eventtimer *et,
sbintime_t first, sbintime_t period)
{
- int error = 0, i = 0;
+ int error;
struct xentimer_softc *sc = et->et_priv;
int cpu = PCPU_GET(vcpu_id);
struct xentimer_pcpu_data *pcpu = DPCPU_PTR(xentimer_pcpu);
@@ -311,21 +334,8 @@ xentimer_et_start(struct eventtimer *et,
first_in_ns = (((first >> 32) * NSEC_IN_SEC) +
(((uint64_t)NSEC_IN_SEC * (uint32_t)first) >> 32));
- /*
- * Retry any timer scheduling failures, where the hypervisor
- * returns -ETIME. Sometimes even a 100us timer period isn't large
- * enough, but larger period instances are relatively uncommon.
- *
- * XXX Remove the panics once et_start() and its consumers are
- * equipped to deal with start failures.
- */
- do {
- if (++i == 60)
- panic("can't schedule timer");
- next_time = xen_fetch_vcpu_time(vcpu) + first_in_ns;
- error = xentimer_vcpu_start_timer(cpu, next_time);
- } while (error == -ETIME);
-
+ next_time = xen_fetch_vcpu_time(vcpu) + first_in_ns;
+ error = xentimer_vcpu_start_timer(cpu, next_time);
if (error)
panic("%s: Error %d setting singleshot timer to %"PRIu64"\n",
device_get_nameunit(sc->dev), error, next_time);
@@ -462,9 +472,6 @@ xentimer_resume(device_t dev)
/* Reset the last uptime value */
pvclock_resume();
- /* Reset the RTC clock */
- inittodr(time_second);
-
/* Kick the timers on all CPUs */
smp_rendezvous(NULL, xentimer_percpu_resume, NULL, dev);
diff --git a/sys/dev/xen/xenstore/xenstore.c b/sys/dev/xen/xenstore/xenstore.c
index f3df97d..4f89b74 100644
--- a/sys/dev/xen/xenstore/xenstore.c
+++ b/sys/dev/xen/xenstore/xenstore.c
@@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$");
*
* The XenStore is ASCII string based, and has a structure and semantics
* similar to a filesystem. There are files and directories, the directories
- * able to contain files or other directories. The depth of the hierachy
+ * able to contain files or other directories. The depth of the hierarchy
* is only limited by the XenStore's maximum path length.
*
* The communication channel between the XenStore service and other
@@ -1110,7 +1110,7 @@ xs_identify(driver_t *driver, device_t parent)
}
/**
- * Probe for the existance of the XenStore.
+ * Probe for the existence of the XenStore.
*
* \param dev
*/
diff --git a/sys/dev/xen/xenstore/xenstore_dev.c b/sys/dev/xen/xenstore/xenstore_dev.c
index 80396fd..ce62140 100644
--- a/sys/dev/xen/xenstore/xenstore_dev.c
+++ b/sys/dev/xen/xenstore/xenstore_dev.c
@@ -241,7 +241,7 @@ xs_dev_identify(driver_t *driver __unused, device_t parent)
}
/**
- * \brief Probe for the existance of the Xenstore device
+ * \brief Probe for the existence of the Xenstore device
*
* \param dev NewBus device_t for this instance.
*
diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c
index 9568967..e82fe1c 100644
--- a/sys/dev/xl/if_xl.c
+++ b/sys/dev/xl/if_xl.c
@@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$");
* Columbia University, New York City
*/
/*
- * The 3c90x series chips use a bus-master DMA interface for transfering
+ * The 3c90x series chips use a bus-master DMA interface for transferring
* packets to and from the controller chip. Some of the "vortex" cards
* (3c59x) also supported a bus master mode, however for those chips
* you could only DMA packets to/from a contiguous memory buffer. For
diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c
index 36768fb..891cc19 100644
--- a/sys/fs/ext2fs/ext2_inode.c
+++ b/sys/fs/ext2fs/ext2_inode.c
@@ -183,7 +183,7 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
}
/*
* Shorten the size of the file. If the file is not being
- * truncated to a block boundry, the contents of the
+ * truncated to a block boundary, the contents of the
* partial block following the end of the file must be
* zero'ed in case it ever become accessible again because
* of subsequent file growth.
diff --git a/sys/fs/fdescfs/fdesc.h b/sys/fs/fdescfs/fdesc.h
index 477193a..41d34ed 100644
--- a/sys/fs/fdescfs/fdesc.h
+++ b/sys/fs/fdescfs/fdesc.h
@@ -13,7 +13,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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c
index f379c5a..d41a21a 100644
--- a/sys/fs/fdescfs/fdesc_vfsops.c
+++ b/sys/fs/fdescfs/fdesc_vfsops.c
@@ -13,7 +13,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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -119,9 +119,7 @@ fdesc_mount(struct mount *mp)
}
static int
-fdesc_unmount(mp, mntflags)
- struct mount *mp;
- int mntflags;
+fdesc_unmount(struct mount *mp, int mntflags)
{
struct fdescmount *fmp;
caddr_t data;
@@ -162,10 +160,7 @@ fdesc_unmount(mp, mntflags)
}
static int
-fdesc_root(mp, flags, vpp)
- struct mount *mp;
- int flags;
- struct vnode **vpp;
+fdesc_root(struct mount *mp, int flags, struct vnode **vpp)
{
struct vnode *vp;
@@ -179,9 +174,7 @@ fdesc_root(mp, flags, vpp)
}
static int
-fdesc_statfs(mp, sbp)
- struct mount *mp;
- struct statfs *sbp;
+fdesc_statfs(struct mount *mp, struct statfs *sbp)
{
struct thread *td;
struct filedesc *fdp;
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index 1b0e569..4f6e1b9 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -13,7 +13,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.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -92,8 +92,7 @@ static void fdesc_remove_entry(struct fdescnode *);
* Initialise cache headers
*/
int
-fdesc_init(vfsp)
- struct vfsconf *vfsp;
+fdesc_init(struct vfsconf *vfsp)
{
mtx_init(&fdesc_hashmtx, "fdescfs_hash", NULL, MTX_DEF);
@@ -105,8 +104,7 @@ fdesc_init(vfsp)
* Uninit ready for unload.
*/
int
-fdesc_uninit(vfsp)
- struct vfsconf *vfsp;
+fdesc_uninit(struct vfsconf *vfsp)
{
hashdestroy(fdhashtbl, M_CACHE, fdhash);
@@ -146,12 +144,8 @@ fdesc_remove_entry(struct fdescnode *fd)
}
int
-fdesc_allocvp(ftype, fd_fd, ix, mp, vpp)
- fdntype ftype;
- unsigned fd_fd;
- int ix;
- struct mount *mp;
- struct vnode **vpp;
+fdesc_allocvp(fdntype ftype, unsigned fd_fd, int ix, struct mount *mp,
+ struct vnode **vpp)
{
struct fdescmount *fmp;
struct fdhashhead *fc;
@@ -274,12 +268,7 @@ fdesc_get_ino_alloc(struct mount *mp, void *arg, int lkflags,
* ndp is the name to locate in that directory...
*/
static int
-fdesc_lookup(ap)
- struct vop_lookup_args /* {
- struct vnode * a_dvp;
- struct vnode ** a_vpp;
- struct componentname * a_cnp;
- } */ *ap;
+fdesc_lookup(struct vop_lookup_args *ap)
{
struct vnode **vpp = ap->a_vpp;
struct vnode *dvp = ap->a_dvp;
@@ -381,13 +370,7 @@ bad:
}
static int
-fdesc_open(ap)
- struct vop_open_args /* {
- struct vnode *a_vp;
- int a_mode;
- struct ucred *a_cred;
- struct thread *a_td;
- } */ *ap;
+fdesc_open(struct vop_open_args *ap)
{
struct vnode *vp = ap->a_vp;
@@ -407,12 +390,7 @@ fdesc_open(ap)
}
static int
-fdesc_getattr(ap)
- struct vop_getattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- } */ *ap;
+fdesc_getattr(struct vop_getattr_args *ap)
{
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
@@ -456,12 +434,7 @@ fdesc_getattr(ap)
}
static int
-fdesc_setattr(ap)
- struct vop_setattr_args /* {
- struct vnode *a_vp;
- struct vattr *a_vap;
- struct ucred *a_cred;
- } */ *ap;
+fdesc_setattr(struct vop_setattr_args *ap)
{
struct vattr *vap = ap->a_vap;
struct vnode *vp;
@@ -513,15 +486,7 @@ fdesc_setattr(ap)
#define UIO_MX 16
static int
-fdesc_readdir(ap)
- struct vop_readdir_args /* {
- struct vnode *a_vp;
- struct uio *a_uio;
- struct ucred *a_cred;
- int *a_eofflag;
- u_long *a_cookies;
- int a_ncookies;
- } */ *ap;
+fdesc_readdir(struct vop_readdir_args *ap)
{
struct uio *uio = ap->a_uio;
struct filedesc *fdp;
@@ -588,10 +553,7 @@ done:
}
static int
-fdesc_reclaim(ap)
- struct vop_reclaim_args /* {
- struct vnode *a_vp;
- } */ *ap;
+fdesc_reclaim(struct vop_reclaim_args *ap)
{
struct vnode *vp;
struct fdescnode *fd;
diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c
index 89b57bb..5ffeb88 100644
--- a/sys/fs/fuse/fuse_io.c
+++ b/sys/fs/fuse/fuse_io.c
@@ -209,7 +209,7 @@ fuse_read_biobackend(struct vnode *vp, struct uio *uio,
* buffer based on an EOF condition we need to hold
* nfs_rslock() through obtaining the buffer to prevent
* a potential writer-appender from messing with n_size.
- * Otherwise we may accidently truncate the buffer and
+ * Otherwise we may accidentally truncate the buffer and
* lose dirty data.
*
* Note that bcount is *not* DEV_BSIZE aligned.
@@ -546,7 +546,7 @@ again:
(on > bp->b_dirtyend || (on + n) < bp->b_dirtyoff)) {
/*
* Yes, we mean it. Write out everything to "storage"
- * immediatly, without hesitation. (Apart from other
+ * immediately, without hesitation. (Apart from other
* reasons: the only way to know if a write is valid
* if its actually written out.)
*/
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c
index 74dbcb2..b919b5f 100644
--- a/sys/fs/fuse/fuse_vnops.c
+++ b/sys/fs/fuse/fuse_vnops.c
@@ -1027,7 +1027,7 @@ out:
* soon as we get those attrs... There is
* one bit of info though not given us by
* the daemon: whether his response is
- * authorative or not... His response should
+ * authoritative or not... His response should
* be ignored if something is mounted over
* the dir in question. But that can be
* known only by having the vnode...
@@ -1774,7 +1774,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
/*
* We use only the kva address for the buffer, but this is extremely
- * convienient and fast.
+ * convenient and fast.
*/
bp = getpbuf(&fuse_pbuf_freecnt);
@@ -1835,7 +1835,7 @@ fuse_vnop_getpages(struct vop_getpages_args *ap)
("fuse_getpages: page %p is dirty", m));
} else {
/*
- * Read operation was short. If no error occured
+ * Read operation was short. If no error occurred
* we may have hit a zero-fill section. We simply
* leave valid set to 0.
*/
@@ -1908,7 +1908,7 @@ fuse_vnop_putpages(struct vop_putpages_args *ap)
}
/*
* We use only the kva address for the buffer, but this is extremely
- * convienient and fast.
+ * convenient and fast.
*/
bp = getpbuf(&fuse_pbuf_freecnt);
diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c
index 396df9e..574417b 100644
--- a/sys/fs/msdosfs/msdosfs_conv.c
+++ b/sys/fs/msdosfs/msdosfs_conv.c
@@ -759,7 +759,7 @@ winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp)
}
/*
- * Determine the number of bytes neccessary for Win95 names
+ * Determine the number of bytes necessary for Win95 names
*/
size_t
winLenFixup(const u_char *un, size_t unlen)
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c
index 5df053c..cdfc9b0 100644
--- a/sys/fs/msdosfs/msdosfs_fat.c
+++ b/sys/fs/msdosfs/msdosfs_fat.c
@@ -175,7 +175,7 @@ pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int *sp)
/*
* Rummage around in the fat cache, maybe we can avoid tromping
- * thru every fat entry for the file. And, keep track of how far
+ * through every fat entry for the file. And, keep track of how far
* off the cache was from where we wanted to be.
*/
i = 0;
diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c
index f7955f2..f9c1170 100644
--- a/sys/fs/msdosfs/msdosfs_lookup.c
+++ b/sys/fs/msdosfs/msdosfs_lookup.c
@@ -924,7 +924,7 @@ readde(struct denode *dep, struct buf **bpp, struct direntry **epp)
/*
* Remove a directory entry. At this point the file represented by the
- * directory entry to be removed is still full length until noone has it
+ * directory entry to be removed is still full length until no one has it
* open. When the file no longer being used msdosfs_inactive() is called
* and will truncate the file to 0 length. When the vnode containing the
* denode is needed for some other purpose by VFS it will call
@@ -975,7 +975,7 @@ removede(struct denode *pdep, struct denode *dep)
offset += sizeof(struct direntry);
while (1) {
/*
- * We are a bit agressive here in that we delete any Win95
+ * We are a bit aggressive here in that we delete any Win95
* entries preceding this entry, not just the ones we "own".
* Since these presumably aren't valid anyway,
* there should be no harm.
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 74a7e32..04be967 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -116,7 +116,7 @@ static vop_vptofh_t msdosfs_vptofh;
* that when a directory is actually read/written (via read, write, or
* readdir, or seek) we must use the vnode for the filesystem instead of
* the vnode for the directory as would happen in ufs. This is to insure we
- * retreive the correct block from the buffer cache since the hash value is
+ * retrieve the correct block from the buffer cache since the hash value is
* based upon the vnode address and the desired block number.
*/
diff --git a/sys/fs/nandfs/nandfs_fs.h b/sys/fs/nandfs/nandfs_fs.h
index b72be40..a0d060d 100644
--- a/sys/fs/nandfs/nandfs_fs.h
+++ b/sys/fs/nandfs/nandfs_fs.h
@@ -343,7 +343,7 @@ struct nandfs_segment_summary {
/*
* Structure of DAT/inode file.
*
- * A DAT file is devided into groups. The maximum number of groups is the
+ * A DAT file is divided into groups. The maximum number of groups is the
* number of block group descriptors that fit into one block; this descriptor
* only gives the number of free entries in the associated group.
*
diff --git a/sys/fs/nandfs/nandfs_subr.h b/sys/fs/nandfs/nandfs_subr.h
index 0bcda18..c3fb8f1 100644
--- a/sys/fs/nandfs/nandfs_subr.h
+++ b/sys/fs/nandfs/nandfs_subr.h
@@ -114,7 +114,7 @@ int nandfs_free_entry(struct nandfs_mdt *, struct nandfs_alloc_request *);
int nandfs_get_entry_block(struct nandfs_mdt *, struct nandfs_node *,
struct nandfs_alloc_request *, uint32_t *, int);
-/* inode managment */
+/* Inode management. */
int nandfs_node_create(struct nandfsmount *, struct nandfs_node **, uint16_t);
int nandfs_node_destroy(struct nandfs_node *);
int nandfs_node_update(struct nandfs_node *);
diff --git a/sys/fs/nandfs/nandfs_sufile.c b/sys/fs/nandfs/nandfs_sufile.c
index d4f4326..b1af84e 100644
--- a/sys/fs/nandfs/nandfs_sufile.c
+++ b/sys/fs/nandfs/nandfs_sufile.c
@@ -137,7 +137,7 @@ nandfs_alloc_segment(struct nandfs_device *fsdev, uint64_t *seg)
rest = (fsdev->nd_blocksize - offset) / seg_size;
/* Go through all su usage in block */
while (rest) {
- /* When last check start from beggining */
+ /* When last check start from beginning */
if (i == nsegments)
break;
diff --git a/sys/fs/nandfs/nandfs_vfsops.c b/sys/fs/nandfs/nandfs_vfsops.c
index 7132635..97d2273 100644
--- a/sys/fs/nandfs/nandfs_vfsops.c
+++ b/sys/fs/nandfs/nandfs_vfsops.c
@@ -331,8 +331,8 @@ nandfs_write_superblock_at(struct nandfs_device *fsdev,
super->s_last_pseg, super->s_last_cno, super->s_last_seq,
super->s_wtime, index));
- read_block = btodb(offset + ((index / sb_per_sector) * sb_per_sector)
- * sizeof(struct nandfs_super_block));
+ read_block = btodb(offset + rounddown(index, sb_per_sector) *
+ sizeof(struct nandfs_super_block));
DPRINTF(SYNC, ("%s: read_block %#x\n", __func__, read_block));
diff --git a/sys/fs/nandfs/nandfs_vnops.c b/sys/fs/nandfs/nandfs_vnops.c
index 40dd855..e94c6ff 100644
--- a/sys/fs/nandfs/nandfs_vnops.c
+++ b/sys/fs/nandfs/nandfs_vnops.c
@@ -1251,12 +1251,12 @@ nandfs_readdir(struct vop_readdir_args *ap)
diroffset += ndirent->rec_len;
blkoff += ndirent->rec_len;
- /* Remember the last entry we transfered */
+ /* Remember the last entry we transferred */
transoffset = diroffset;
}
brelse(bp);
- /* Pass on last transfered offset */
+ /* Pass on last transferred offset */
uio->uio_offset = transoffset;
}
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index a62a222..a22073f 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -155,7 +155,7 @@ newnfs_realign(struct mbuf **pm, int how)
* we cannot afford to overwrite them.
*
* We would prefer to avoid this situation entirely. The situation does
- * not occur with NFS/UDP and is supposed to only occassionally occur
+ * not occur with NFS/UDP and is supposed to only occasionally occur
* with TCP. Use vfs.nfs.realign_count and realign_test to check this.
*
*/
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index 04bb27c..921df2d 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -968,7 +968,7 @@ struct nfsreq {
/*
* Name used by getnewvnode() to describe filesystem, "nfs".
- * For perfomance reasons it is useful to have the same string
+ * For performance reasons it is useful to have the same string
* used in both places that call getnewvnode().
*/
extern const char nfs_vnode_tag[];
diff --git a/sys/fs/nfs/nfsrvstate.h b/sys/fs/nfs/nfsrvstate.h
index 42254ab..ef8f249 100644
--- a/sys/fs/nfs/nfsrvstate.h
+++ b/sys/fs/nfs/nfsrvstate.h
@@ -76,7 +76,7 @@ struct nfssessionhash {
* Client server structure for V4. It is doubly linked into two lists.
* The first is a hash table based on the clientid and the second is a
* list of all clients maintained in LRU order.
- * The actual size malloc'd is large enough to accomodate the id string.
+ * The actual size malloc'd is large enough to accommodate the id string.
*/
struct nfsclient {
LIST_ENTRY(nfsclient) lc_hash; /* Clientid hash list */
diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c
index 567e326..387584c 100644
--- a/sys/fs/nfsclient/nfs_clbio.c
+++ b/sys/fs/nfsclient/nfs_clbio.c
@@ -140,7 +140,7 @@ ncl_getpages(struct vop_getpages_args *ap)
/*
* We use only the kva address for the buffer, but this is extremely
- * convienient and fast.
+ * convenient and fast.
*/
bp = getpbuf(&ncl_pbuf_freecnt);
@@ -201,7 +201,7 @@ ncl_getpages(struct vop_getpages_args *ap)
} else {
/*
* Read operation was short. If no error
- * occured we may have hit a zero-fill
+ * occurred we may have hit a zero-fill
* section. We leave valid set to 0, and page
* is freed by vm_page_readahead_finish() if
* its index is not equal to requested, or
@@ -286,7 +286,7 @@ ncl_putpages(struct vop_putpages_args *ap)
/*
* We use only the kva address for the buffer, but this is extremely
- * convienient and fast.
+ * convenient and fast.
*/
bp = getpbuf(&ncl_pbuf_freecnt);
@@ -1188,7 +1188,7 @@ again:
/*
* Get the partial update on the progress made from
- * uiomove, if an error occured.
+ * uiomove, if an error occurred.
*/
if (error != 0)
n = local_resid - uio->uio_resid;
@@ -1480,7 +1480,7 @@ again:
}
/*
* We might have lost our iod while sleeping,
- * so check and loop if nescessary.
+ * so check and loop if necessary.
*/
goto again;
}
diff --git a/sys/fs/nfsclient/nfs_clkdtrace.c b/sys/fs/nfsclient/nfs_clkdtrace.c
index 5e6e58c..540daae 100644
--- a/sys/fs/nfsclient/nfs_clkdtrace.c
+++ b/sys/fs/nfsclient/nfs_clkdtrace.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
/*
* dtnfscl is a DTrace provider that tracks the intent to perform RPCs
- * in the NFS client, as well as acess to and maintenance of the access and
+ * in the NFS client, as well as access to and maintenance of the access and
* attribute caches. This is not quite the same as RPCs, because NFS may
* issue multiple RPC transactions in the event that authentication fails,
* there's a jukebox error, or none at all if the access or attribute cache
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 6e6ece3..dfd073b 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -1701,7 +1701,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iomode,
commit = fxdr_unsigned(int, *tl++);
/*
- * Return the lowest committment level
+ * Return the lowest commitment level
* obtained by any of the RPCs.
*/
if (committed == NFSWRITE_FILESYNC)
@@ -2676,7 +2676,7 @@ nfsrpc_rmdir(vnode_t dvp, char *name, int namelen, struct ucred *cred,
* 2 - pass the opaque directory offset cookies up into userland
* and let the libc functions deal with them, via the system call
* 3 - return them to userland in the "struct dirent", so future versions
- * of libc can use them and do whatever is necessary to amke things work
+ * of libc can use them and do whatever is necessary to make things work
* above these rpc calls, in the meantime
* For now, I do #3 by "hiding" the directory offset cookies after the
* d_name field in struct dirent. This is space inside d_reclen that
@@ -2927,7 +2927,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
if (!more_dirs)
tryformoredirs = 0;
- /* loop thru the dir entries, doctoring them to 4bsd form */
+ /* loop through the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
if (nd->nd_flag & ND_NFSV4) {
NFSM_DISSECT(tl, u_int32_t *, 3*NFSX_UNSIGNED);
@@ -3342,7 +3342,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
if (!more_dirs)
tryformoredirs = 0;
- /* loop thru the dir entries, doctoring them to 4bsd form */
+ /* loop through the dir entries, doctoring them to 4bsd form */
while (more_dirs && bigenough) {
NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
if (nd->nd_flag & ND_NFSV4) {
@@ -5782,7 +5782,7 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
commit = fxdr_unsigned(int, *tl++);
/*
- * Return the lowest committment level
+ * Return the lowest commitment level
* obtained by any of the RPCs.
*/
if (committed == NFSWRITE_FILESYNC)
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index a49e93f..20adaf1 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -716,7 +716,7 @@ nfscl_openrelease(struct nfsclopen *op, int error, int candelete)
/*
* Called to get a clientid structure. It will optionally lock the
* client data structures to do the SetClientId/SetClientId_confirm,
- * but will release that lock and return the clientid with a refernce
+ * but will release that lock and return the clientid with a reference
* count on it.
* If the "cred" argument is NULL, a new clientid should not be created.
* If the "p" argument is NULL, a SetClientID/SetClientIDConfirm cannot
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index 14a4d18..9446577 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -1066,7 +1066,7 @@ nfs_mount(struct mount *mp)
/*
* If a change from TCP->UDP is done and there are thread(s)
- * that have I/O RPC(s) in progress with a tranfer size
+ * that have I/O RPC(s) in progress with a transfer size
* greater than NFS_MAXDGRAMDATA, those thread(s) will be
* hung, retrying the RPC(s) forever. Usually these threads
* will be seen doing an uninterruptible sleep on wait channel
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 4487b2a..530802d 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -2414,7 +2414,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
/*
* Fudge together a funny name.
- * Changing the format of the funny name to accomodate more
+ * Changing the format of the funny name to accommodate more
* sillynames per directory.
* The name is now changed to .nfs.<ticks>.<pid>.4, where ticks is
* CPU ticks since boot.
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index a1e1204..2f67829 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1305,7 +1305,7 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred,
daddr_t lblkno;
/*
- * Align to iosize boundry, super-align to page boundry.
+ * Align to iosize boundary, super-align to page boundary.
*/
if (off & iomask) {
cnt += off & iomask;
@@ -2800,7 +2800,7 @@ nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype,
/*
* Personally, I've never seen any point in requiring a
* reserved port#, since only in the rare case where the
- * clients are all boxes with secure system priviledges,
+ * clients are all boxes with secure system privileges,
* does it provide any enhanced security, but... some people
* believe it to be useful and keep putting this code back in.
* (There is also some "security checker" out there that
@@ -3066,7 +3066,7 @@ out:
}
/*
- * Nfs server psuedo system call for the nfsd's
+ * Nfs server pseudo system call for the nfsd's
*/
/*
* MPSAFE
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index c0a5a6e..b096501 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -1635,7 +1635,7 @@ tryagain:
if (new_stp->ls_flags & NFSLCK_TEST) {
/*
* RFC 3530 does not list LockT as an op that renews a
- * lease, but the concensus seems to be that it is ok
+ * lease, but the consensus seems to be that it is ok
* for a server to do so.
*/
error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
@@ -1742,7 +1742,7 @@ tryagain:
* If the seqid part of the stateid isn't the same, return
* NFSERR_OLDSTATEID for cases other than I/O Ops.
* For I/O Ops, only return NFSERR_OLDSTATEID if
- * nfsrv_returnoldstateid is set. (The concensus on the email
+ * nfsrv_returnoldstateid is set. (The consensus on the email
* list was that most clients would prefer to not receive
* NFSERR_OLDSTATEID for I/O Ops, but the RFC suggests that that
* is what will happen, so I use the nfsrv_returnoldstateid to
@@ -1971,7 +1971,7 @@ tryagain:
* - there is a conflict if a different client has any delegation
* - there is a conflict if the same client has a read delegation
* (I don't understand why this isn't allowed, but that seems to be
- * the current concensus?)
+ * the current consensus?)
*/
tstp = LIST_FIRST(&lfp->lf_deleg);
while (tstp != LIST_END(&lfp->lf_deleg)) {
@@ -2438,7 +2438,7 @@ tryagain:
* For Open with other Write Access or any Deny except None
* - there is a conflict if a different client has any delegation
* - there is a conflict if the same client has a read delegation
- * (The current concensus is that this last case should be
+ * (The current consensus is that this last case should be
* considered a conflict since the client with a read delegation
* could have done an Open with ReadAccess and WriteDeny
* locally and then not have checked for the WriteDeny.)
@@ -2731,7 +2731,7 @@ tryagain:
* For Open with other Write Access or any Deny except None
* - there is a conflict if a different client has any delegation
* - there is a conflict if the same client has a read delegation
- * (The current concensus is that this last case should be
+ * (The current consensus is that this last case should be
* considered a conflict since the client with a read delegation
* could have done an Open with ReadAccess and WriteDeny
* locally and then not have checked for the WriteDeny.)
@@ -4396,7 +4396,7 @@ tryagain:
* nfsrvboottime does not, somehow, get set to a previous one.
* (This is important so that Stale ClientIDs and StateIDs can
* be recognized.)
- * The number of previous nfsvrboottime values preceeds the list.
+ * The number of previous nfsvrboottime values precedes the list.
* - followed by some number of appended records with:
* - client id string
* - flag that indicates it is a record revoking state via lease
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index ec7d046..d3a7906 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -117,7 +117,7 @@
* are created as a result of vnode operations on
* this or other null vnode stacks.
*
- * New vnode stacks come into existance as a result of
+ * New vnode stacks come into existence as a result of
* an operation which returns a vnode.
* The bypass routine stacks a null-node above the new
* vnode before returning it to the caller.
diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c
index f549160..498d063 100644
--- a/sys/fs/smbfs/smbfs_io.c
+++ b/sys/fs/smbfs/smbfs_io.c
@@ -520,7 +520,7 @@ smbfs_getpages(ap)
("smbfs_getpages: page %p is dirty", m));
} else {
/*
- * Read operation was short. If no error occured
+ * Read operation was short. If no error occurred
* we may have hit a zero-fill section. We simply
* leave valid set to 0.
*/
diff --git a/sys/fs/smbfs/smbfs_subr.h b/sys/fs/smbfs/smbfs_subr.h
index 4ee143c..10bf7bf 100644
--- a/sys/fs/smbfs/smbfs_subr.h
+++ b/sys/fs/smbfs/smbfs_subr.h
@@ -107,7 +107,7 @@ struct smbfs_fctx {
struct smb_t2rq * uf_t2;
} f_urq;
int f_left; /* entries left */
- int f_ecnt; /* entries left in the current reponse */
+ int f_ecnt; /* entries left in the current response */
int f_eofs; /* entry offset in the parameter block */
u_char f_skey[SMB_SKEYLEN]; /* server side search context */
u_char f_fname[8 + 1 + 3 + 1]; /* common case for 8.3 filenames */
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index bf42ffe..c302771 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -840,7 +840,7 @@ tmpfs_rename(struct vop_rename_args *v)
/* If re-naming a directory to another preexisting directory
* ensure that the target directory is empty so that its
* removal causes no side effects.
- * Kern_rename gurantees the destination to be a directory
+ * Kern_rename guarantees the destination to be a directory
* if the source is one. */
if (tvp != NULL) {
MPASS(tnode != NULL);
diff --git a/sys/fs/udf/osta.h b/sys/fs/udf/osta.h
index 8fe4342..7a889c2 100644
--- a/sys/fs/udf/osta.h
+++ b/sys/fs/udf/osta.h
@@ -28,7 +28,7 @@
#endif
/***********************************************************************
- * The following two typedef's are to remove compiler dependancies.
+ * The following two typedef's are to remove compiler dependencies.
* byte needs to be unsigned 8-bit, and unicode_t needs to be
* unsigned 16-bit.
*/
diff --git a/sys/geom/bde/g_bde_lock.c b/sys/geom/bde/g_bde_lock.c
index 462b92b..05b68ed 100644
--- a/sys/geom/bde/g_bde_lock.c
+++ b/sys/geom/bde/g_bde_lock.c
@@ -289,7 +289,7 @@ g_bde_decode_lock(struct g_bde_softc *sc, struct g_bde_key *gl, u_char *ptr)
* Security objectives: Encode/Decode the metadata encrypted by key-material.
*
* A simple AES/128/CBC will do. We take care to always store the metadata
- * in the same endianess to make it MI.
+ * in the same endianness to make it MI.
*
* In the typical case the metadata is stored in encrypted format in sector
* zero on the media, but at the users discretion or if the piece of the
diff --git a/sys/geom/geom_bsd_enc.c b/sys/geom/geom_bsd_enc.c
index 79b2bbc..413cfbb 100644
--- a/sys/geom/geom_bsd_enc.c
+++ b/sys/geom/geom_bsd_enc.c
@@ -35,7 +35,7 @@
/*
* Functions to encode and decode struct disklabel and struct partition into
- * a bytestream of little endianess and correct packing.
+ * a bytestream of little endianness and correct packing.
*
* NB! This file must be usable both in kernel and userland.
*/
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index b2ccaba..e92aabb 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -271,7 +271,7 @@ ccdinit(struct gctl_req *req, struct ccd_s *cs)
/*
* If uniform interleave is desired set all sizes to that of
- * the smallest component. This will guarentee that a single
+ * the smallest component. This will guarantee that a single
* interleave table is generated.
*
* Lost space must be taken into account when calculating the
@@ -291,7 +291,7 @@ ccdinit(struct gctl_req *req, struct ccd_s *cs)
* Check to see if an even number of components
* have been specified. The interleave must also
* be non-zero in order for us to be able to
- * guarentee the topology.
+ * guarantee the topology.
*/
if (cs->sc_ndisks % 2) {
gctl_error(req,
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 3e3ae8f..5ba9191 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -630,8 +630,8 @@ g_dev_strategy(struct bio *bp)
for (;;) {
/*
- * XXX: This is not an ideal solution, but I belive it to
- * XXX: deadlock safe, all things considered.
+ * XXX: This is not an ideal solution, but I believe it to
+ * XXX: deadlock safely, all things considered.
*/
bp2 = g_clone_bio(bp);
if (bp2 != NULL)
@@ -686,7 +686,7 @@ g_dev_callback(void *arg)
* - Clear any dump settings.
* - Request asynchronous device destruction to prevent any more requests
* from coming in. The provider is already marked with an error, so
- * anything which comes in in the interrim will be returned immediately.
+ * anything which comes in the interim will be returned immediately.
*/
static void
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index b2d8e8c..1580030 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -107,7 +107,7 @@ g_disk_access(struct g_provider *pp, int r, int w, int e)
if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) {
/*
* Allow decreasing access count even if disk is not
- * avaliable anymore.
+ * available anymore.
*/
if (r <= 0 && w <= 0 && e <= 0)
return (0);
diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c
index e6021d3..dbced0f 100644
--- a/sys/geom/geom_kern.c
+++ b/sys/geom/geom_kern.c
@@ -76,7 +76,7 @@ int g_notaste;
* part of I/O prioritization by deciding which bios/bioqs to service
* in what order.
*
- * We have only one thread in each direction, it is belived that until
+ * We have only one thread in each direction, it is believed that until
* a very non-trivial workload in the UP/DOWN path this will be enough,
* but more than one can actually be run without problems.
*
diff --git a/sys/geom/geom_mbr_enc.c b/sys/geom/geom_mbr_enc.c
index e3e3977..a9c268c 100644
--- a/sys/geom/geom_mbr_enc.c
+++ b/sys/geom/geom_mbr_enc.c
@@ -25,7 +25,7 @@
*/
/* Functions to encode or decode struct dos_partition into a bytestream
- * of correct endianess and packing. These functions do no validation
+ * of correct endianness and packing. These functions do no validation
* or sanity checking, they only pack/unpack the fields correctly.
*
* NB! This file must be usable both in kernel and userland.
diff --git a/sys/geom/geom_sunlabel_enc.c b/sys/geom/geom_sunlabel_enc.c
index 7463e01..3ae7599 100644
--- a/sys/geom/geom_sunlabel_enc.c
+++ b/sys/geom/geom_sunlabel_enc.c
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/* Functions to encode or decode struct sun_disklabel into a bytestream
- * of correct endianess and packing.
+ * of correct endianness and packing.
*
* NB! This file must be usable both in kernel and userland.
*/
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c
index f0b07b2..871bd8e4 100644
--- a/sys/geom/journal/g_journal.c
+++ b/sys/geom/journal/g_journal.c
@@ -520,7 +520,7 @@ g_journal_write_header(struct g_journal_softc *sc)
/*
* Every journal record has a header and data following it.
* Functions below are used to decode the header before storing it to
- * little endian and to encode it after reading to system endianess.
+ * little endian and to encode it after reading to system endianness.
*/
static void
g_journal_record_header_encode(struct g_journal_record_header *hdr,
@@ -581,7 +581,7 @@ g_journal_record_header_decode(const u_char *data,
/*
* Function reads metadata from a provider (via the given consumer), decodes
- * it to system endianess and verifies its correctness.
+ * it to system endianness and verifies its correctness.
*/
static int
g_journal_metadata_read(struct g_consumer *cp, struct g_journal_metadata *md)
@@ -1846,7 +1846,7 @@ g_journal_sync(struct g_journal_softc *sc)
for (;;) {
/*
* If the biggest record won't fit, look for a record header or
- * journal header from the begining.
+ * journal header from the beginning.
*/
GJ_VALIDATE_OFFSET(offset, sc);
error = g_journal_sync_read(cp, bp, offset, buf);
diff --git a/sys/geom/journal/g_journal.h b/sys/geom/journal/g_journal.h
index 82aae0d..392dc77 100644
--- a/sys/geom/journal/g_journal.h
+++ b/sys/geom/journal/g_journal.h
@@ -224,7 +224,7 @@ struct g_journal_entry {
#define GJ_VALIDATE_OFFSET(offset, sc) do { \
if ((offset) + GJ_RECORD_MAX_SIZE(sc) >= (sc)->sc_jend) { \
(offset) = (sc)->sc_jstart; \
- GJ_DEBUG(2, "Starting from the begining (%s).", \
+ GJ_DEBUG(2, "Starting from the beginning (%s).", \
(sc)->sc_name); \
} \
} while (0)
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 5ef4d5c..91f1367 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -1048,7 +1048,7 @@ g_mirror_kernel_dump(struct bio *bp)
/*
* We configure dumping to the first component, because this component
* will be used for reading with 'prefer' balance algorithm.
- * If the component with the higest priority is currently disconnected
+ * If the component with the highest priority is currently disconnected
* we will not be able to read the dump after the reboot if it will be
* connected and synchronized later. Can we do something better?
*/
@@ -1277,7 +1277,7 @@ g_mirror_sync_release(struct g_mirror_softc *sc)
* Handle synchronization requests.
* Every synchronization request is two-steps process: first, READ request is
* send to active provider and then WRITE request (with read data) to the provider
- * beeing synchronized. When WRITE is finished, new synchronization request is
+ * being synchronized. When WRITE is finished, new synchronization request is
* send.
*/
static void
diff --git a/sys/geom/part/g_part_bsd64.c b/sys/geom/part/g_part_bsd64.c
index 1d2277c..8b2777d 100644
--- a/sys/geom/part/g_part_bsd64.c
+++ b/sys/geom/part/g_part_bsd64.c
@@ -58,7 +58,7 @@ FEATURE(geom_part_bsd64, "GEOM partitioning class for 64-bit BSD disklabels");
struct disklabel64 {
char d_reserved0[512]; /* reserved or unused */
u_int32_t d_magic; /* the magic number */
- u_int32_t d_crc; /* crc32() d_magic thru last part */
+ u_int32_t d_crc; /* crc32() d_magic through last part */
u_int32_t d_align; /* partition alignment requirement */
u_int32_t d_npartitions; /* number of partitions */
struct uuid d_stor_uuid; /* unique uuid for label */
diff --git a/sys/geom/part/g_part_if.m b/sys/geom/part/g_part_if.m
index 31c1d65..5ce99ea 100644
--- a/sys/geom/part/g_part_if.m
+++ b/sys/geom/part/g_part_if.m
@@ -201,7 +201,7 @@ METHOD int setunset {
};
# type() - return a string representation of the partition type.
-# Preferrably, the alias names.
+# Preferably, the alias names.
METHOD const char * type {
struct g_part_table *table;
struct g_part_entry *entry;
diff --git a/sys/geom/part/g_part_ldm.c b/sys/geom/part/g_part_ldm.c
index 33555ce..47adf69 100644
--- a/sys/geom/part/g_part_ldm.c
+++ b/sys/geom/part/g_part_ldm.c
@@ -1220,7 +1220,7 @@ ldm_gpt_probe(struct g_part_table *basetable, struct g_consumer *cp)
int error;
/*
- * XXX: We use some knowlege about GEOM_PART_GPT internal
+ * XXX: We use some knowledge about GEOM_PART_GPT internal
* structures, but it is easier than parse GPT by himself.
*/
g_topology_lock();
diff --git a/sys/geom/raid/g_raid_ctl.c b/sys/geom/raid/g_raid_ctl.c
index dc1536a..3ec4042 100644
--- a/sys/geom/raid/g_raid_ctl.c
+++ b/sys/geom/raid/g_raid_ctl.c
@@ -117,7 +117,7 @@ g_raid_ctl_label(struct gctl_req *req, struct g_class *mp)
}
format = gctl_get_asciiparam(req, "arg0");
if (format == NULL) {
- gctl_error(req, "No format recieved.");
+ gctl_error(req, "No format received.");
return;
}
crstatus = g_raid_create_node_format(format, req, &geom);
@@ -164,7 +164,7 @@ g_raid_ctl_stop(struct gctl_req *req, struct g_class *mp)
}
nodename = gctl_get_asciiparam(req, "arg0");
if (nodename == NULL) {
- gctl_error(req, "No array name recieved.");
+ gctl_error(req, "No array name received.");
return;
}
sc = g_raid_find_node(mp, nodename);
@@ -204,7 +204,7 @@ g_raid_ctl_other(struct gctl_req *req, struct g_class *mp)
}
nodename = gctl_get_asciiparam(req, "arg0");
if (nodename == NULL) {
- gctl_error(req, "No array name recieved.");
+ gctl_error(req, "No array name received.");
return;
}
sc = g_raid_find_node(mp, nodename);
diff --git a/sys/geom/raid/md_ddf.c b/sys/geom/raid/md_ddf.c
index 686bd4d..a663af2 100644
--- a/sys/geom/raid/md_ddf.c
+++ b/sys/geom/raid/md_ddf.c
@@ -257,7 +257,7 @@ g_raid_md_ddf_print(struct ddf_meta *meta)
printf("BBM Log %u:%u\n", GET32(meta, hdr->bbmlog_section), GET32(meta, hdr->bbmlog_length));
printf("Diagnostic Space %u:%u\n", GET32(meta, hdr->Diagnostic_Space), GET32(meta, hdr->Diagnostic_Space_Length));
printf("Vendor_Specific_Logs %u:%u\n", GET32(meta, hdr->Vendor_Specific_Logs), GET32(meta, hdr->Vendor_Specific_Logs_Length));
- printf("**** Controler Data ****\n");
+ printf("**** Controller Data ****\n");
printf("Controller_GUID ");
print_guid(meta->cdr->Controller_GUID);
printf("\n");
diff --git a/sys/geom/raid/tr_raid1.c b/sys/geom/raid/tr_raid1.c
index 17c7a25..3bdeb58 100644
--- a/sys/geom/raid/tr_raid1.c
+++ b/sys/geom/raid/tr_raid1.c
@@ -840,8 +840,8 @@ rebuild_round_done:
* disk, remapping the bad sector. Do we need to do that by
* queueing a request to the main worker thread? It doesn't
* affect the return code of this current read, and can be
- * done at our liesure. However, to make the code simpler, it
- * is done syncrhonously.
+ * done at our leisure. However, to make the code simpler, it
+ * is done synchronously.
*/
G_RAID_LOGREQ(3, bp, "Recovered data from other drive");
cbp = g_clone_bio(pbp);
@@ -858,7 +858,7 @@ rebuild_round_done:
if (pbp->bio_pflags & G_RAID_BIO_FLAG_LOCKED) {
/*
* We're done with a recovery, mark the range as unlocked.
- * For any write errors, we agressively fail the disk since
+ * For any write errors, we aggressively fail the disk since
* there was both a READ and a WRITE error at this location.
* Both types of errors generally indicates the drive is on
* the verge of total failure anyway. Better to stop trusting
diff --git a/sys/geom/raid/tr_raid1e.c b/sys/geom/raid/tr_raid1e.c
index b357742..d945ea2 100644
--- a/sys/geom/raid/tr_raid1e.c
+++ b/sys/geom/raid/tr_raid1e.c
@@ -1096,7 +1096,7 @@ rebuild_round_done:
if ((mask & (1U << 31)) != 0) {
/*
* We're done with a recovery, mark the range as unlocked.
- * For any write errors, we agressively fail the disk since
+ * For any write errors, we aggressively fail the disk since
* there was both a READ and a WRITE error at this location.
* Both types of errors generally indicates the drive is on
* the verge of total failure anyway. Better to stop trusting
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index 617f72e..a2ffe53 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -1587,7 +1587,7 @@ g_raid3_sync_release(struct g_raid3_softc *sc)
* Handle synchronization requests.
* Every synchronization request is two-steps process: first, READ request is
* send to active provider and then WRITE request (with read data) to the provider
- * beeing synchronized. When WRITE is finished, new synchronization request is
+ * being synchronized. When WRITE is finished, new synchronization request is
* send.
*/
static void
diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c
index 877eed4..a7a9c4e 100644
--- a/sys/geom/vinum/geom_vinum_drive.c
+++ b/sys/geom/vinum/geom_vinum_drive.c
@@ -76,7 +76,7 @@ gv_legacy_header_type(uint8_t *hdr, int bigendian)
uint32_t *i32;
int arch_32, arch_64, i;
- /* Set arch according to endianess. */
+ /* Set arch according to endianness. */
if (bigendian) {
arch_32 = GV_LEGACY_POWERPC;
arch_64 = GV_LEGACY_SPARC64;
diff --git a/sys/geom/vinum/geom_vinum_subr.c b/sys/geom/vinum/geom_vinum_subr.c
index ea7c7e7..a2642c2 100644
--- a/sys/geom/vinum/geom_vinum_subr.c
+++ b/sys/geom/vinum/geom_vinum_subr.c
@@ -72,7 +72,7 @@ gv_parse_config(struct gv_softc *sc, char *buf, struct gv_drive *d)
bptr = aptr;
cptr = aptr;
- /* Seperate input lines. */
+ /* Separate input lines. */
while (*bptr != '\n')
bptr++;
*bptr = '\0';
diff --git a/sys/geom/virstor/g_virstor.c b/sys/geom/virstor/g_virstor.c
index 7393c10..72d042d 100644
--- a/sys/geom/virstor/g_virstor.c
+++ b/sys/geom/virstor/g_virstor.c
@@ -1257,7 +1257,7 @@ virstor_check_and_run(struct g_virstor_softc *sc)
bs = MIN(MAXPHYS, sc->map_size - count);
if (bs % sc->sectorsize != 0) {
/* Check for alignment errors */
- bs = (bs / sc->sectorsize) * sc->sectorsize;
+ bs = rounddown(bs, sc->sectorsize);
if (bs == 0)
break;
LOG_MSG(LVL_ERROR, "Trouble: map is not sector-aligned "
@@ -1723,13 +1723,12 @@ g_virstor_start(struct bio *b)
* sc_offset will end up pointing to the drive
* sector. */
s_offset = chunk_index * sizeof *me;
- s_offset = (s_offset / sc->sectorsize) *
- sc->sectorsize;
+ s_offset = rounddown(s_offset, sc->sectorsize);
/* data_me points to map entry sector
- * in memory (analoguos to offset) */
- data_me = &sc->map[(chunk_index /
- sc->me_per_sector) * sc->me_per_sector];
+ * in memory (analogous to offset) */
+ data_me = &sc->map[rounddown(chunk_index,
+ sc->me_per_sector)];
/* Commit sector with map entry to storage */
cb->bio_to = sc->components[0].gcons->provider;
diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c
index a7710bb..ef1ba42 100644
--- a/sys/i386/bios/smapi.c
+++ b/sys/i386/bios/smapi.c
@@ -80,7 +80,7 @@ static struct cdevsw smapi_cdevsw = {
.d_version = D_VERSION,
.d_ioctl = smapi_ioctl,
.d_name = "smapi",
- .d_flags = D_MEM | D_NEEDGIANT,
+ .d_flags = D_NEEDGIANT,
};
static void smapi_identify(driver_t *, device_t);
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 5d8eaa3..52bd6bf 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -373,11 +373,6 @@ options EISA_SLOTS=12
device mca
#
-# PCI bus & PCI options:
-#
-device pci
-
-#
# AGP GART support
device agp
diff --git a/sys/i386/include/xen/hypercall.h b/sys/i386/include/xen/hypercall.h
index 7e18f9e..72a17fa 100644
--- a/sys/i386/include/xen/hypercall.h
+++ b/sys/i386/include/xen/hypercall.h
@@ -209,7 +209,7 @@ HYPERVISOR_set_timer_op(
unsigned long timeout_lo = (unsigned long)timeout;
return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
}
-#if 0
+
static inline int
HYPERVISOR_platform_op(
struct xen_platform_op *platform_op)
@@ -217,7 +217,7 @@ HYPERVISOR_platform_op(
platform_op->interface_version = XENPF_INTERFACE_VERSION;
return _hypercall1(int, platform_op, platform_op);
}
-#endif
+
static inline int
HYPERVISOR_set_debugreg(
int reg, unsigned long value)
diff --git a/sys/isa/rtc.h b/sys/isa/rtc.h
index 8d86981..5c5a341 100644
--- a/sys/isa/rtc.h
+++ b/sys/isa/rtc.h
@@ -117,6 +117,7 @@ extern int atrtcclock_disable;
int rtcin(int reg);
void atrtc_restore(void);
void writertc(int reg, u_char val);
+void atrtc_set(struct timespec *ts);
#endif
#endif /* _I386_ISA_RTC_H_ */
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index c359b41..56673a4 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -121,7 +121,7 @@ METHOD void probe_nomatch {
* @param _child the child device whose instance variable is
* being read
* @param _index the instance variable to read
- * @param _result a loction to recieve the instance variable
+ * @param _result a location to receive the instance variable
* value
*
* @retval 0 success
@@ -389,7 +389,7 @@ METHOD int release_resource {
* triggers
* @param _arg a value to use as the single argument in calls
* to @p _intr
- * @param _cookiep a pointer to a location to recieve a cookie
+ * @param _cookiep a pointer to a location to receive a cookie
* value that may be used to remove the interrupt
* handler
*/
@@ -460,9 +460,9 @@ METHOD int set_resource {
* @param _child the device which owns the resource
* @param _type the type of resource
* @param _rid the resource identifier
- * @param _start the address of a location to recieve the start
+ * @param _start the address of a location to receive the start
* index of the resource range
- * @param _count the address of a location to recieve the size
+ * @param _count the address of a location to receive the size
* of the resource range
*/
METHOD int get_resource {
diff --git a/sys/kern/imgact_binmisc.c b/sys/kern/imgact_binmisc.c
index 39ca156..39af520 100644
--- a/sys/kern/imgact_binmisc.c
+++ b/sys/kern/imgact_binmisc.c
@@ -700,7 +700,7 @@ imgact_binmisc_exec(struct image_params *imgp)
break;
case ' ':
- /* Replace space with NUL to seperate arguments. */
+ /* Replace space with NUL to separate arguments. */
*d++ = '\0';
break;
diff --git a/sys/kern/inflate.c b/sys/kern/inflate.c
index 383ebc4..8fde5cb 100644
--- a/sys/kern/inflate.c
+++ b/sys/kern/inflate.c
@@ -206,7 +206,7 @@ extern void kzipfree (void*);
end-of-block. Note however that the static length tree defines
288 codes just to fill out the Huffman codes. Codes 286 and 287
cannot be used though, since there is no length base or extra bits
- defined for them. Similarily, there are up to 30 distance codes.
+ defined for them. Similarly, there are up to 30 distance codes.
However, static trees define 32 codes (all 5 bits) to fill out the
Huffman codes, but the last two had better not show up in the data.
7. Unzip can check dynamic Huffman blocks for complete code sets.
@@ -335,7 +335,7 @@ static const ush mask[] = {
where NEEDBITS makes sure that b has at least j bits in it, and
DUMPBITS removes the bits from b. The macros use the variable k
for the number of bits in b. Normally, b and k are register
- variables for speed, and are initialized at the begining of a
+ variables for speed, and are initialized at the beginning of a
routine that uses these macros from a global bit buffer and count.
In order to not ask for more bits than there are in the compressed
diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
index 6f891e0..d4b477f 100644
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -156,7 +156,7 @@ _cv_wait(struct cv *cvp, struct lock_object *lock)
/*
* Wait on a condition variable. This function differs from cv_wait by
- * not aquiring the mutex after condition variable was signaled.
+ * not acquiring the mutex after condition variable was signaled.
*/
void
_cv_wait_unlock(struct cv *cvp, struct lock_object *lock)
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index b37adcc..bd8a934 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1530,7 +1530,7 @@ fdgrowtable_exp(struct filedesc *fdp, int nfd)
}
/*
- * Grow the file table to accomodate (at least) nfd descriptors.
+ * Grow the file table to accommodate (at least) nfd descriptors.
*/
static void
fdgrowtable(struct filedesc *fdp, int nfd)
@@ -1544,7 +1544,7 @@ fdgrowtable(struct filedesc *fdp, int nfd)
/*
* If lastfile is -1 this struct filedesc was just allocated and we are
- * growing it to accomodate for the one we are going to copy from. There
+ * growing it to accommodate for the one we are going to copy from. There
* is no need to have a lock on this one as it's not visible to anyone.
*/
if (fdp->fd_lastfile != -1)
@@ -1709,7 +1709,7 @@ fdallocn(struct thread *td, int minfd, int *fds, int n)
}
/*
- * Create a new open file structure and allocate a file decriptor for the
+ * Create a new open file structure and allocate a file descriptor for the
* process that refers to it. We add one reference to the file for the
* descriptor table and one reference for resultfp. This is to prevent us
* being preempted and the entry in the descriptor table closed after we
@@ -2535,7 +2535,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
*
* File's rights will be checked against the capability rights mask.
*
- * If an error occured the non-zero error is returned and *fpp is set to
+ * If an error occurred the non-zero error is returned and *fpp is set to
* NULL. Otherwise *fpp is held and set and zero is returned. Caller is
* responsible for fdrop().
*/
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 7c88fe0..fd25b94 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -413,7 +413,7 @@ do_execve(td, args, mac_p)
/*
* Translate the file name. namei() returns a vnode pointer
- * in ni_vp amoung other things.
+ * in ni_vp among other things.
*
* XXXAUDIT: It would be desirable to also audit the name of the
* interpreter if this is an interpreted binary.
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 94e139e..fbc96a4 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -918,7 +918,7 @@ fork1(struct thread *td, struct fork_req *fr)
/*
* The swap reservation failed. The accounting
* from the entries of the copied vm2 will be
- * substracted in vmspace_free(), so force the
+ * subtracted in vmspace_free(), so force the
* reservation there.
*/
swap_reserve_force(mem_charged);
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 56944ac..a361fda 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -4039,7 +4039,7 @@ prison_priv_check(struct ucred *cred, int priv)
return (0);
/*
- * Allow jailed root to set certian IPv4/6 (option) headers.
+ * Allow jailed root to set certain IPv4/6 (option) headers.
*/
case PRIV_NETINET_SETHDROPTS:
return (0);
@@ -4280,7 +4280,7 @@ SYSCTL_UINT(_security_jail, OID_AUTO, jail_max_af_ips, CTLFLAG_RW,
#endif
/*
- * Default parameters for jail(2) compatability. For historical reasons,
+ * Default parameters for jail(2) compatibility. For historical reasons,
* the sysctl names have varying similarity to the parameter names. Prisons
* just see their own parameters, and can't change them.
*/
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index c2c7583..16c39f0 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -949,7 +949,7 @@ linker_debug_search_symbol_name(caddr_t value, char *buf, u_int buflen,
*
* Note that we do not obey list locking protocols here. We really don't need
* DDB to hang because somebody's got the lock held. We'll take the chance
- * that the files list is inconsistant instead.
+ * that the files list is inconsistent instead.
*/
#ifdef DDB
int
@@ -2037,7 +2037,7 @@ linker_load_dependencies(linker_file_t lf)
int ver, error = 0, count;
/*
- * All files are dependant on /kernel.
+ * All files are dependent on /kernel.
*/
sx_assert(&kld_sx, SA_XLOCKED);
if (linker_kernel_file) {
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index aa67180..34d7b34 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -281,7 +281,7 @@ wakeupshlk(struct lock *lk, const char *file, int line)
* exclusive waiters bit anyway.
* Please note that lk_exslpfail count may be lying about
* the real number of waiters with the LK_SLEEPFAIL flag on
- * because they may be used in conjuction with interruptible
+ * because they may be used in conjunction with interruptible
* sleeps so lk_exslpfail might be considered an 'upper limit'
* bound, including the edge cases.
*/
@@ -1058,7 +1058,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
* Please note that lk_exslpfail count may be lying
* about the real number of waiters with the
* LK_SLEEPFAIL flag on because they may be used in
- * conjuction with interruptible sleeps so
+ * conjunction with interruptible sleeps so
* lk_exslpfail might be considered an 'upper limit'
* bound, including the edge cases.
*/
@@ -1171,7 +1171,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
* Please note that lk_exslpfail count may be
* lying about the real number of waiters with
* the LK_SLEEPFAIL flag on because they may
- * be used in conjuction with interruptible
+ * be used in conjunction with interruptible
* sleeps so lk_exslpfail might be considered
* an 'upper limit' bound, including the edge
* cases.
diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c
index 91eae09..a0a3789 100644
--- a/sys/kern/kern_lockf.c
+++ b/sys/kern/kern_lockf.c
@@ -362,7 +362,7 @@ lf_free_lock(struct lockf_entry *lock)
struct lock_owner *lo = lock->lf_owner;
if (lo) {
KASSERT(LIST_EMPTY(&lock->lf_outedges),
- ("freeing lock with dependancies"));
+ ("freeing lock with dependencies"));
KASSERT(LIST_EMPTY(&lock->lf_inedges),
("freeing lock with dependants"));
sx_xlock(&lf_lock_owners_lock);
@@ -827,7 +827,7 @@ lf_purgelocks(struct vnode *vp, struct lockf **statep)
/*
* We can just free all the active locks since they
- * will have no dependancies (we removed them all
+ * will have no dependencies (we removed them all
* above). We don't need to bother locking since we
* are the last thread using this state structure.
*/
@@ -1112,7 +1112,7 @@ lf_insert_lock(struct lockf *state, struct lockf_entry *lock)
/*
* Wake up a sleeping lock and remove it from the pending list now
- * that all its dependancies have been resolved. The caller should
+ * that all its dependencies have been resolved. The caller should
* arrange for the lock to be added to the active list, adjusting any
* existing locks for the same owner as needed.
*/
@@ -1137,9 +1137,9 @@ lf_wakeup_lock(struct lockf *state, struct lockf_entry *wakelock)
}
/*
- * Re-check all dependant locks and remove edges to locks that we no
+ * Re-check all dependent locks and remove edges to locks that we no
* longer block. If 'all' is non-zero, the lock has been removed and
- * we must remove all the dependancies, otherwise it has simply been
+ * we must remove all the dependencies, otherwise it has simply been
* reduced but remains active. Any pending locks which have been been
* unblocked are added to 'granted'
*/
@@ -1165,7 +1165,7 @@ lf_update_dependancies(struct lockf *state, struct lockf_entry *lock, int all,
}
/*
- * Set the start of an existing active lock, updating dependancies and
+ * Set the start of an existing active lock, updating dependencies and
* adding any newly woken locks to 'granted'.
*/
static void
@@ -1181,7 +1181,7 @@ lf_set_start(struct lockf *state, struct lockf_entry *lock, off_t new_start,
}
/*
- * Set the end of an existing active lock, updating dependancies and
+ * Set the end of an existing active lock, updating dependencies and
* adding any newly woken locks to 'granted'.
*/
static void
@@ -1204,7 +1204,7 @@ lf_set_end(struct lockf *state, struct lockf_entry *lock, off_t new_end,
* pending locks as a result of downgrading/unlocking. We simply
* activate the newly granted locks by looping.
*
- * Since the new lock already has its dependancies set up, we always
+ * Since the new lock already has its dependencies set up, we always
* add it to the list (unless its an unlock request). This may
* fragment the lock list in some pathological cases but its probably
* not a real problem.
@@ -1332,7 +1332,7 @@ lf_cancel_lock(struct lockf *state, struct lockf_entry *lock)
* may allow some other pending lock to become
* active. Consider this case:
*
- * Owner Action Result Dependancies
+ * Owner Action Result Dependencies
*
* A: lock [0..0] succeeds
* B: lock [2..2] succeeds
@@ -1840,7 +1840,7 @@ lf_split(struct lockf *state, struct lockf_entry *lock1,
/*
* This cannot cause a deadlock since any edges we would add
* to splitlock already exist in lock1. We must be sure to add
- * necessary dependancies to splitlock before we reduce lock1
+ * necessary dependencies to splitlock before we reduce lock1
* otherwise we may accidentally grant a pending lock that
* was blocked by the tail end of lock1.
*/
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index 5e634d7..273196b 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$");
*
* Whenever an object is allocated from the underlying global
* memory pool it gets pre-initialized with the _zinit_ functions.
- * When the Keg's are overfull objects get decomissioned with
+ * When the Keg's are overfull objects get decommissioned with
* _zfini_ functions and free'd back to the global memory pool.
*
*/
diff --git a/sys/kern/kern_mtxpool.c b/sys/kern/kern_mtxpool.c
index 0c6f95b..90bf8e7 100644
--- a/sys/kern/kern_mtxpool.c
+++ b/sys/kern/kern_mtxpool.c
@@ -39,7 +39,7 @@
*
* Disadvantages:
* - should generally only be used as leaf mutexes.
- * - pool/pool dependancy ordering cannot be depended on.
+ * - pool/pool dependency ordering cannot be depended on.
* - possible L1 cache mastersip contention between cpus.
*/
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 6594e51..3daaf00 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -164,7 +164,7 @@ sys_getpgrp(struct thread *td, struct getpgrp_args *uap)
return (0);
}
-/* Get an arbitary pid's process group id */
+/* Get an arbitrary pid's process group id */
#ifndef _SYS_SYSPROTO_H_
struct getpgid_args {
pid_t pid;
@@ -195,7 +195,7 @@ sys_getpgid(struct thread *td, struct getpgid_args *uap)
}
/*
- * Get an arbitary pid's session id.
+ * Get an arbitrary pid's session id.
*/
#ifndef _SYS_SYSPROTO_H_
struct getsid_args {
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
index a405122..e4a6b97 100644
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -444,7 +444,7 @@ rctl_pcpu_available(const struct proc *p) {
/*
* Return slightly less than actual value of the available
- * %cpu resource. This makes %cpu throttling more agressive
+ * %cpu resource. This makes %cpu throttling more aggressive
* and lets us act sooner than the limits are already exceeded.
*/
if (limit != 0) {
diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c
index b6df53e..b74253f 100644
--- a/sys/kern/kern_rmlock.c
+++ b/sys/kern/kern_rmlock.c
@@ -375,7 +375,7 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock)
}
/*
- * We allow readers to aquire a lock even if a writer is blocked if
+ * We allow readers to acquire a lock even if a writer is blocked if
* the lock is recursive and the reader already holds the lock.
*/
if ((rm->lock_object.lo_flags & LO_RECURSABLE) != 0) {
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index aae705e..37dfff1 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -359,7 +359,7 @@ sysctl_register_oid(struct sysctl_oid *oidp)
*
* NOTE: DO NOT change the starting value here, change it in
* <sys/sysctl.h>, and make sure it is at least 256 to
- * accomodate e.g. net.inet.raw as a static sysctl node.
+ * accommodate e.g. net.inet.raw as a static sysctl node.
*/
if (oid_number < 0) {
static int newoid;
@@ -494,7 +494,7 @@ sysctl_ctx_free(struct sysctl_ctx_list *clist)
}
/*
* Restore deregistered entries, either from the end,
- * or from the place where error occured.
+ * or from the place where error occurred.
* e contains the entry that was not unregistered
*/
if (error)
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 070a93a..0f015b3 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1898,7 +1898,7 @@ inittimecounter(void *dummy)
* Set the initial timeout to
* max(1, <approx. number of hardclock ticks in a millisecond>).
* People should probably not use the sysctl to set the timeout
- * to smaller than its inital value, since that value is the
+ * to smaller than its initial value, since that value is the
* smallest reasonable one. If they want better timestamps they
* should use the non-"get"* functions.
*/
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index c5ac4c1..50e6db9 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -1446,7 +1446,7 @@ _callout_init_lock(struct callout *c, struct lock_object *lock, int flags)
* which set the timer can do the maintanence the timer was for as close
* as possible to the originally intended time. Testing this code for a
* week showed that resuming from a suspend resulted in 22 to 25 timers
- * firing, which seemed independant on whether the suspend was 2 hours or
+ * firing, which seemed independent on whether the suspend was 2 hours or
* 2 days. Your milage may vary. - Ken Key <key@cs.utk.edu>
*/
void
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index 544bd253..08ae922 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -1128,7 +1128,7 @@ relocate_file(elf_file_t ef)
}
/*
- * Only clean SHN_FBSD_CACHED for successfull return. If we
+ * Only clean SHN_FBSD_CACHED for successful return. If we
* modified symbol table for the object but found an
* unresolved symbol, there is no reason to roll back.
*/
diff --git a/sys/kern/linker_if.m b/sys/kern/linker_if.m
index 3df592c..a583a03 100644
--- a/sys/kern/linker_if.m
+++ b/sys/kern/linker_if.m
@@ -89,7 +89,7 @@ METHOD int lookup_set {
};
#
-# Unload a file, releasing dependancies and freeing storage.
+# Unload a file, releasing dependencies and freeing storage.
#
METHOD void unload {
linker_file_t file;
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 6d54e23..25afe98 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -1395,7 +1395,7 @@ sched_add(struct thread *td, int flags)
* or kicking off another CPU as it won't help and may hinder.
* In the YIEDLING case, we are about to run whoever is being
* put in the queue anyhow, and in the OURSELF case, we are
- * puting ourself on the run queue which also only happens
+ * putting ourself on the run queue which also only happens
* when we are about to yield.
*/
if ((flags & SRQ_YIELDING) == 0) {
diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c
index 5c45b81..fb3526b 100644
--- a/sys/kern/subr_blist.c
+++ b/sys/kern/subr_blist.c
@@ -57,8 +57,8 @@
* The non-blocking features of the blist code are used in the swap code
* (vm/swap_pager.c).
*
- * LAYOUT: The radix tree is layed out recursively using a
- * linear array. Each meta node is immediately followed (layed out
+ * LAYOUT: The radix tree is laid out recursively using a
+ * linear array. Each meta node is immediately followed (laid out
* sequentially in memory) by BLIST_META_RADIX lower level nodes. This
* is a recursive structure but one that can be easily scanned through
* a very simple 'skip' calculation. In order to support large radixes,
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 6ee7e18..1202903 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -4699,7 +4699,7 @@ root_setup_intr(device_t dev, device_t child, struct resource *irq, int flags,
}
/*
- * If we get here, assume that the device is permanant and really is
+ * If we get here, assume that the device is permanent and really is
* present in the system. Removable bus drivers are expected to intercept
* this call long before it gets here. We return -1 so that drivers that
* really care can check vs -1 or some ERRNO returned higher in the food
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index b026f8c..c291342 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -389,7 +389,7 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS)
* XXX devstat_generation should really be "volatile" but that
* XXX freaks out the sysctl macro below. The places where we
* XXX change it and inspect it are bracketed in the mutex which
- * XXX guarantees us proper write barriers. I don't belive the
+ * XXX guarantees us proper write barriers. I don't believe the
* XXX compiler is allowed to optimize mygen away across calls
* XXX to other functions, so the following is belived to be safe.
*/
diff --git a/sys/kern/subr_hash.c b/sys/kern/subr_hash.c
index 915f3f7..4d9249f 100644
--- a/sys/kern/subr_hash.c
+++ b/sys/kern/subr_hash.c
@@ -104,16 +104,21 @@ static const int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531,
#define NPRIMES nitems(primes)
/*
- * General routine to allocate a prime number sized hash table.
+ * General routine to allocate a prime number sized hash table with control of
+ * memory flags.
*/
void *
-phashinit(int elements, struct malloc_type *type, u_long *nentries)
+phashinit_flags(int elements, struct malloc_type *type, u_long *nentries, int flags)
{
long hashsize;
LIST_HEAD(generic, generic) *hashtbl;
- int i;
+ int i, m_flags;
KASSERT(elements > 0, ("%s: bad elements", __func__));
+ /* Exactly one of HASH_WAITOK and HASH_NOWAIT must be set. */
+ KASSERT((flags & HASH_WAITOK) ^ (flags & HASH_NOWAIT),
+ ("Bad flags (0x%x) passed to phashinit_flags", flags));
+
for (i = 1, hashsize = primes[1]; hashsize <= elements;) {
i++;
if (i == NPRIMES)
@@ -121,9 +126,25 @@ phashinit(int elements, struct malloc_type *type, u_long *nentries)
hashsize = primes[i];
}
hashsize = primes[i - 1];
- hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK);
+
+ m_flags = (flags & HASH_NOWAIT) ? M_NOWAIT : M_WAITOK;
+ hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, m_flags);
+ if (hashtbl == NULL)
+ return (NULL);
+
for (i = 0; i < hashsize; i++)
LIST_INIT(&hashtbl[i]);
*nentries = hashsize;
return (hashtbl);
}
+
+/*
+ * Allocate and initialize a prime number sized hash table with default flag:
+ * may sleep.
+ */
+void *
+phashinit(int elements, struct malloc_type *type, u_long *nentries)
+{
+
+ return (phashinit_flags(elements, type, nentries, HASH_WAITOK));
+}
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
index ca53d2d..c5febf5 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -705,7 +705,7 @@ intr_isrc_assign_cpu(void *arg, int cpu)
* In NOCPU case, it's up to PIC to either leave ISRC on same CPU or
* re-balance it to another CPU or enable it on more CPUs. However,
* PIC is expected to change isrc_cpu appropriately to keep us well
- * informed if the call is successfull.
+ * informed if the call is successful.
*/
if (irq_assign_cpu) {
error = PIC_BIND_INTR(isrc->isrc_dev, isrc);
@@ -1032,7 +1032,7 @@ intr_setup_irq(device_t dev, struct resource *res, driver_filter_t filt,
#ifdef INTR_SOLO
/*
- * Standard handling is done thru MI interrupt framework. However,
+ * Standard handling is done through MI interrupt framework. However,
* some interrupts could request solely own special handling. This
* non standard handling can be used for interrupt controllers without
* handler (filter only), so in case that interrupt controllers are
diff --git a/sys/kern/subr_mbpool.c b/sys/kern/subr_mbpool.c
index 0b44dcc..de79ad4 100644
--- a/sys/kern/subr_mbpool.c
+++ b/sys/kern/subr_mbpool.c
@@ -288,7 +288,7 @@ mbp_ext_free(struct mbuf *m, void *buf, void *arg)
}
/*
- * Free all buffers that are marked as beeing on the card
+ * Free all buffers that are marked as being on the card
*/
void
mbp_card_free(struct mbpool *p)
diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c
index 233a78a..21220ca 100644
--- a/sys/kern/subr_mchain.c
+++ b/sys/kern/subr_mchain.c
@@ -102,7 +102,7 @@ mb_fixhdr(struct mbchain *mbp)
/*
* Check if object of size 'size' fit to the current position and
* allocate new mbuf if not. Advance pointers and increase length of mbuf(s).
- * Return pointer to the object placeholder or NULL if any error occured.
+ * Return pointer to the object placeholder or NULL if any error occurred.
* Note: size should be <= MLEN
*/
caddr_t
diff --git a/sys/kern/subr_msgbuf.c b/sys/kern/subr_msgbuf.c
index fa23c91..f275aef 100644
--- a/sys/kern/subr_msgbuf.c
+++ b/sys/kern/subr_msgbuf.c
@@ -50,7 +50,7 @@ static u_int msgbuf_cksum(struct msgbuf *mbp);
/*
* Timestamps in msgbuf are useful when trying to diagnose when core dumps
- * or other actions occured.
+ * or other actions occurred.
*/
static int msgbuf_show_timestamp = 0;
SYSCTL_INT(_kern, OID_AUTO, msgbuf_show_timestamp, CTLFLAG_RWTUN,
diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c
index 3d87ff9..56b17f5 100644
--- a/sys/kern/subr_prof.c
+++ b/sys/kern/subr_prof.c
@@ -269,7 +269,7 @@ kmstartup(dummy)
* without much risk of reducing the profiling times below what they
* would be when profiling is not configured. Abbreviate:
* ab = minimum time between MC1 and MC3
- * a = minumum time between MC1 and MC2
+ * a = minimum time between MC1 and MC2
* b = minimum time between MC2 and MC3
* cd = minimum time between ME1 and ME3
* c = minimum time between ME1 and ME2
diff --git a/sys/kern/subr_scanf.c b/sys/kern/subr_scanf.c
index 824e392..806ca4f 100644
--- a/sys/kern/subr_scanf.c
+++ b/sys/kern/subr_scanf.c
@@ -603,7 +603,7 @@ doswitch:
* z', but treats `a-a' as `the letter a, the
* character -, and the letter a'.
*
- * For compatibility, the `-' is not considerd
+ * For compatibility, the `-' is not considered
* to define a range if the character following
* it is either a close bracket (required by ANSI)
* or is not numerically greater than the character
diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c
index a2ce7fb..b2297f3 100644
--- a/sys/kern/subr_uio.c
+++ b/sys/kern/subr_uio.c
@@ -466,7 +466,7 @@ copyout_map(struct thread *td, vm_offset_t *addr, size_t sz)
*addr = round_page((vm_offset_t)vms->vm_daddr +
lim_max(td, RLIMIT_DATA));
- /* round size up to page boundry */
+ /* round size up to page boundary */
size = (vm_size_t)round_page(sz);
error = vm_mmap(&vms->vm_map, addr, size, VM_PROT_READ | VM_PROT_WRITE,
diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c
index 3bf7aaf..8283550 100644
--- a/sys/kern/subr_unit.c
+++ b/sys/kern/subr_unit.c
@@ -68,11 +68,11 @@
*/
#include <sys/types.h>
-#include <sys/bitstring.h>
#include <sys/_unrhdr.h>
#ifdef _KERNEL
+#include <sys/bitstring.h>
#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
@@ -98,6 +98,11 @@ MTX_SYSINIT(unit, &unitmtx, "unit# allocation", MTX_DEF);
#else /* ...USERLAND */
+#include <bitstring.h>
+#include <err.h>
+#include <errno.h>
+#include <getopt.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -880,9 +885,13 @@ free_unr(struct unrhdr *uh, u_int item)
#ifndef _KERNEL /* USERLAND test driver */
/*
- * Simple stochastic test driver for the above functions
+ * Simple stochastic test driver for the above functions. The code resides
+ * here so that it can access static functions and structures.
*/
+static bool verbose;
+#define VPRINTF(...) {if (verbose) printf(__VA_ARGS__);}
+
static void
print_unr(struct unrhdr *uh, struct unr *up)
{
@@ -933,7 +942,7 @@ test_alloc_unr(struct unrhdr *uh, u_int i, char a[])
int j;
if (a[i]) {
- printf("F %u\n", i);
+ VPRINTF("F %u\n", i);
free_unr(uh, i);
a[i] = 0;
} else {
@@ -941,7 +950,7 @@ test_alloc_unr(struct unrhdr *uh, u_int i, char a[])
j = alloc_unr(uh);
if (j != -1) {
a[j] = 1;
- printf("A %d\n", j);
+ VPRINTF("A %d\n", j);
}
no_alloc = 0;
}
@@ -954,40 +963,73 @@ test_alloc_unr_specific(struct unrhdr *uh, u_int i, char a[])
j = alloc_unr_specific(uh, i);
if (j == -1) {
- printf("F %u\n", i);
+ VPRINTF("F %u\n", i);
a[i] = 0;
free_unr(uh, i);
} else {
a[i] = 1;
- printf("A %d\n", j);
+ VPRINTF("A %d\n", j);
}
}
-/* Number of unrs to test */
-#define NN 10000
+static void
+usage(char** argv)
+{
+ printf("%s [-h] [-r REPETITIONS] [-v]\n", argv[0]);
+}
int
-main(int argc __unused, const char **argv __unused)
+main(int argc, char **argv)
{
struct unrhdr *uh;
+ char *a;
+ long count = 10000; /* Number of unrs to test */
+ long reps = 1;
+ int ch;
u_int i, x, m, j;
- char a[NN];
+
+ verbose = false;
+
+ while ((ch = getopt(argc, argv, "hr:v")) != -1) {
+ switch (ch) {
+ case 'r':
+ errno = 0;
+ reps = strtol(optarg, NULL, 0);
+ if (errno == ERANGE || errno == EINVAL) {
+ usage(argv);
+ exit(2);
+ }
+
+ break;
+ case 'v':
+ verbose = true;
+ break;
+ case 'h':
+ default:
+ usage(argv);
+ exit(2);
+ }
+
+
+ }
setbuf(stdout, NULL);
- uh = new_unrhdr(0, NN - 1, NULL);
+ uh = new_unrhdr(0, count - 1, NULL);
print_unrhdr(uh);
- memset(a, 0, sizeof a);
+ a = calloc(count, sizeof(char));
+ if (a == NULL)
+ err(1, "calloc failed");
srandomdev();
- fprintf(stderr, "sizeof(struct unr) %zu\n", sizeof(struct unr));
- fprintf(stderr, "sizeof(struct unrb) %zu\n", sizeof(struct unrb));
- fprintf(stderr, "sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr));
- fprintf(stderr, "NBITS %d\n", NBITS);
+ printf("sizeof(struct unr) %zu\n", sizeof(struct unr));
+ printf("sizeof(struct unrb) %zu\n", sizeof(struct unrb));
+ printf("sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr));
+ printf("NBITS %d\n", NBITS);
x = 1;
- for (m = 0; m < NN * 100; m++) {
+ for (m = 0; m < count * reps; m++) {
j = random();
- i = (j >> 1) % NN;
+ i = (j >> 1) % count;
#if 0
if (a[i] && (j & 1))
continue;
@@ -997,19 +1039,22 @@ main(int argc __unused, const char **argv __unused)
else
test_alloc_unr_specific(uh, i, a);
- if (1) /* XXX: change this for detailed debug printout */
+ if (verbose)
print_unrhdr(uh);
check_unrhdr(uh, __LINE__);
}
- for (i = 0; i < NN; i++) {
+ for (i = 0; i < count; i++) {
if (a[i]) {
- printf("C %u\n", i);
+ if (verbose) {
+ printf("C %u\n", i);
+ print_unrhdr(uh);
+ }
free_unr(uh, i);
- print_unrhdr(uh);
}
}
print_unrhdr(uh);
delete_unrhdr(uh);
+ free(a);
return (0);
}
#endif
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 03e5a50..a678635 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -2971,7 +2971,7 @@ witness_lock_order_add(struct witness *parent, struct witness *child)
return (1);
}
-/* Call this whenver the structure of the witness graph changes. */
+/* Call this whenever the structure of the witness graph changes. */
static void
witness_increment_graph_generation(void)
{
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index ffdb003..e6416b9 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -512,7 +512,7 @@ soaio_kproc_create(void *context, int pending)
mtx_unlock(&soaio_jobs_lock);
}
-static void
+void
soaio_enqueue(struct task *task)
{
@@ -734,8 +734,13 @@ soo_aio_queue(struct file *fp, struct kaiocb *job)
{
struct socket *so;
struct sockbuf *sb;
+ int error;
so = fp->f_data;
+ error = (*so->so_proto->pr_usrreqs->pru_aio_queue)(so, job);
+ if (error == 0)
+ return (0);
+
switch (job->uaiocb.aio_lio_opcode) {
case LIO_READ:
sb = &so->so_rcv;
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index 865ee10..a3bd548 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -1143,7 +1143,7 @@ sys_semop(struct thread *td, struct semop_args *uap)
if ((error = sem_prison_cansee(rpr, semakptr)) != 0)
goto done2;
/*
- * Initial pass thru sops to see what permissions are needed.
+ * Initial pass through sops to see what permissions are needed.
* Also perform any checks that don't need repeating on each
* attempt to satisfy the request vector.
*/
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index f10b9ea..b37d5a5 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -388,7 +388,7 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig)
PROC_LOCK(p);
/*
* The process should only sleep, when:
- * - This terminal is the controling terminal
+ * - This terminal is the controlling terminal
* - Its process group is not the foreground process
* group
* - The parent process isn't waiting for the child to
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c
index fcc9c47..a4c3dbb 100644
--- a/sys/kern/tty_pts.c
+++ b/sys/kern/tty_pts.c
@@ -124,7 +124,7 @@ ptsdev_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
/*
* Implement packet mode. When packet mode is turned on,
* the first byte contains a bitmask of events that
- * occured (start, stop, flush, window size, etc).
+ * occurred (start, stop, flush, window size, etc).
*/
if (psc->pts_flags & PTS_PKT && psc->pts_pkt) {
pkt = psc->pts_pkt;
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index 6dc24f9..211cfa1 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -135,6 +135,7 @@ protosw_init(struct protosw *pr)
#define DEFAULT(foo, bar) if ((foo) == NULL) (foo) = (bar)
DEFAULT(pu->pru_accept, pru_accept_notsupp);
+ DEFAULT(pu->pru_aio_queue, pru_aio_queue_notsupp);
DEFAULT(pu->pru_bind, pru_bind_notsupp);
DEFAULT(pu->pru_bindat, pru_bindat_notsupp);
DEFAULT(pu->pru_connect, pru_connect_notsupp);
diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c
index af240a1..a90074e 100644
--- a/sys/kern/uipc_mbuf2.c
+++ b/sys/kern/uipc_mbuf2.c
@@ -143,7 +143,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp)
* Ideally, the requirement should only be (iii).
*
* If we're writable, we're sure we're writable, because the ref. count
- * cannot increase from 1, as that would require posession of mbuf
+ * cannot increase from 1, as that would require possession of mbuf
* n by someone else (which is impossible). However, if we're _not_
* writable, we may eventually become writable )if the ref. count drops
* to 1), but we'll fail to notice it unless we re-evaluate
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index d873217..70cc8fd 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -194,7 +194,7 @@ VNET_DEFINE(struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST + 1]);
/*
* Limit on the number of connections in the listen queue waiting
* for accept(2).
- * NB: The orginal sysctl somaxconn is still available but hidden
+ * NB: The original sysctl somaxconn is still available but hidden
* to prevent confusion about the actual purpose of this number.
*/
static u_int somaxconn = SOMAXCONN;
@@ -1164,7 +1164,7 @@ sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio,
}
/*
* XXX all the SBS_CANTSENDMORE checks previously done could be out
- * of date. We could have recieved a reset packet in an interrupt or
+ * of date. We could have received a reset packet in an interrupt or
* maybe we slept while doing page faults in uiomove() etc. We could
* probably recheck again inside the locking protection here, but
* there are probably other places that this also happens. We must
@@ -1347,7 +1347,7 @@ restart:
}
/*
* XXX all the SBS_CANTSENDMORE checks previously
- * done could be out of date. We could have recieved
+ * done could be out of date. We could have received
* a reset packet in an interrupt or maybe we slept
* while doing page faults in uiomove() etc. We
* could probably recheck again inside the locking
@@ -3103,6 +3103,13 @@ pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
}
int
+pru_aio_queue_notsupp(struct socket *so, struct kaiocb *job)
+{
+
+ return EOPNOTSUPP;
+}
+
+int
pru_attach_notsupp(struct socket *so, int proto, struct thread *td)
{
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 640f649..9ce8451 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -224,7 +224,7 @@ SYSCTL_INT(_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW, &getnewbufcalls, 0,
"Number of calls to getnewbuf");
static int getnewbufrestarts;
SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, &getnewbufrestarts, 0,
- "Number of times getnewbuf has had to restart a buffer aquisition");
+ "Number of times getnewbuf has had to restart a buffer acquisition");
static int mappingrestarts;
SYSCTL_INT(_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RW, &mappingrestarts, 0,
"Number of times getblk has had to restart a buffer mapping for "
@@ -975,7 +975,7 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
else
bio_transient_maxcnt = biotmap_sz / MAXPHYS;
/*
- * Artifically limit to 1024 simultaneous in-flight I/Os
+ * Artificially limit to 1024 simultaneous in-flight I/Os
* using the transient mapping.
*/
if (bio_transient_maxcnt > 1024)
@@ -1084,7 +1084,7 @@ bufinit(void)
maxbufmallocspace = hibufspace / 20;
/*
- * Reduce the chance of a deadlock occuring by limiting the number
+ * Reduce the chance of a deadlock occurring by limiting the number
* of delayed-write dirty buffers we allow to stack up.
*/
hidirtybuffers = nbuf / 4 + 20;
@@ -1162,8 +1162,7 @@ vfs_buf_check_unmapped(struct buf *bp)
static int
isbufbusy(struct buf *bp)
{
- if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 &&
- BUF_ISLOCKED(bp)) ||
+ if (((bp->b_flags & B_INVAL) == 0 && BUF_ISLOCKED(bp)) ||
((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI))
return (1);
return (0);
@@ -3471,7 +3470,7 @@ has_addr:
* to clear B_INVAL. If the caller does this without issuing an I/O,
* the caller should set B_CACHE ( as an optimization ), else the caller
* should issue the I/O and biodone() will set B_CACHE if the I/O was
- * a write attempt or if it was a successfull read. If the caller
+ * a write attempt or if it was a successful read. If the caller
* intends to issue a READ, the caller must clear B_INVAL and BIO_ERROR
* prior to issuing the READ. biodone() will *not* clear B_INVAL.
*/
@@ -3583,7 +3582,7 @@ loop:
bp_unmapped_get_kva(bp, blkno, size, flags);
/*
- * If the size is inconsistant in the VMIO case, we can resize
+ * If the size is inconsistent in the VMIO case, we can resize
* the buffer. This might lead to B_CACHE getting set or
* cleared. If the size has not changed, B_CACHE remains
* unchanged from its previous state.
@@ -3845,7 +3844,7 @@ vfs_nonvmio_extend(struct buf *bp, int newbsize)
* resize a buffer up or down.
*
* Note that this code is tricky, and has many complications to resolve
- * deadlock or inconsistant data situations. Tread lightly!!!
+ * deadlock or inconsistent data situations. Tread lightly!!!
* There are B_CACHE and B_DELWRI interactions that must be dealt with by
* the caller. Calling this code willy nilly can result in the loss of data.
*
@@ -4005,11 +4004,11 @@ bufwait(struct buf *bp)
* assuming B_INVAL is clear.
*
* For the VMIO case, we set B_CACHE if the op was a read and no
- * read error occured, or if the op was a write. B_CACHE is never
+ * read error occurred, or if the op was a write. B_CACHE is never
* set if the buffer is invalid or otherwise uncacheable.
*
* biodone does not mess with B_INVAL, allowing the I/O routine or the
- * initiator to leave B_INVAL set to brelse the buffer out of existance
+ * initiator to leave B_INVAL set to brelse the buffer out of existence
* in the biodone routine.
*/
void
@@ -4054,7 +4053,7 @@ bufdone_finish(struct buf *bp)
if (bp->b_flags & B_VMIO) {
/*
* Set B_CACHE if the op was a normal read and no error
- * occured. B_CACHE is set for writes in the b*write()
+ * occurred. B_CACHE is set for writes in the b*write()
* routines.
*/
if (bp->b_iocmd == BIO_READ &&
@@ -4082,7 +4081,7 @@ bufdone_finish(struct buf *bp)
/*
* This routine is called in lieu of iodone in the case of
* incomplete I/O. This keeps the busy status for pages
- * consistant.
+ * consistent.
*/
void
vfs_unbusy_pages(struct buf *bp)
@@ -4161,7 +4160,7 @@ vfs_page_set_validclean(struct buf *bp, vm_ooffset_t off, vm_page_t m)
/*
* Start and end offsets in buffer. eoff - soff may not cross a
- * page boundry or cross the end of the buffer. The end of the
+ * page boundary or cross the end of the buffer. The end of the
* buffer, in this case, is our file EOF, not the allocation size
* of the buffer.
*/
@@ -4218,10 +4217,10 @@ vfs_drain_busy_pages(struct buf *bp)
* progress, and treat the pages associated with the buffer
* almost as being exclusive busy. Also the object paging_in_progress
* flag is handled to make sure that the object doesn't become
- * inconsistant.
+ * inconsistent.
*
* Since I/O has not been initiated yet, certain buffer flags
- * such as BIO_ERROR or B_INVAL may be in an inconsistant state
+ * such as BIO_ERROR or B_INVAL may be in an inconsistent state
* and should be ignored.
*/
void
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index bfed116..ac46856 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -150,7 +150,7 @@ struct namecache_ts {
*/
/*
- * Structures associated with name cacheing.
+ * Structures associated with name caching.
*/
#define NCHHASH(hash) \
(&nchashtbl[(hash) & nchash])
@@ -485,7 +485,7 @@ cache_zap(struct namecache *ncp)
* cnp pointing to the name of the entry being sought. If the lookup
* succeeds, the vnode is returned in *vpp, and a status of -1 is
* returned. If the lookup determines that the name does not exist
- * (negative cacheing), a status of ENOENT is returned. If the lookup
+ * (negative caching), a status of ENOENT is returned. If the lookup
* fails, a status of zero is returned. If the directory vnode is
* recycled out from under us due to a forced unmount, a status of
* ENOENT is returned.
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index ea902d7..f6be7a7 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -563,7 +563,7 @@ cluster_callback(bp)
int error = 0;
/*
- * Must propogate errors to all the components.
+ * Must propagate errors to all the components.
*/
if (bp->b_ioflags & BIO_ERROR)
error = bp->b_error;
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index a1116e0..f33dc8b 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1154,7 +1154,7 @@ NDFREE(struct nameidata *ndp, const u_int flags)
* Determine if there is a suitable alternate filename under the specified
* prefix for the specified path. If the create flag is set, then the
* alternate prefix will be used so long as the parent directory exists.
- * This is used by the various compatiblity ABIs so that Linux binaries prefer
+ * This is used by the various compatibility ABIs so that Linux binaries prefer
* files under /compat/linux for example. The chosen path (whether under
* the prefix or under /) is returned in a kernel malloc'd buffer pointed
* to by pathbuf. The caller is responsible for free'ing the buffer from
diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index a33e376..c78d25d 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$");
*
* If the environment variable vfs.root.mountfrom is a space separated list,
* each list element is tried in turn and the root filesystem will be mounted
- * from the first one that suceeds.
+ * from the first one that succeeds.
*
* The environment variable vfs.root.mountfrom.options is a comma delimited
* set of string mount options. These mount options must be parseable
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 36b9c2a..795eac5 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -534,7 +534,7 @@ vfs_busy(struct mount *mp, int flags)
MNT_ILOCK(mp);
MNT_REF(mp);
/*
- * If mount point is currenly being unmounted, sleep until the
+ * If mount point is currently being unmounted, sleep until the
* mount point fate is decided. If thread doing the unmounting fails,
* it will clear MNTK_UNMOUNT flag before waking us up, indicating
* that this mount point has survived the unmount attempt and vfs_busy
@@ -830,7 +830,7 @@ vattr_null(struct vattr *vap)
* the buffer cache may have references on the vnode, a directory
* vnode may still have references due to the namei cache representing
* underlying files, or the vnode may be in active use. It is not
- * desireable to reuse such vnodes. These conditions may cause the
+ * desirable to reuse such vnodes. These conditions may cause the
* number of vnodes to reach some minimum value regardless of what
* you set kern.maxvnodes to. Do not set kern.maxvnodes too low.
*/
@@ -3945,7 +3945,7 @@ destroy_vpollinfo(struct vpollinfo *vi)
}
/*
- * Initalize per-vnode helper structure to hold poll-related state.
+ * Initialize per-vnode helper structure to hold poll-related state.
*/
void
v_addpollinfo(struct vnode *vp)
@@ -4356,7 +4356,7 @@ extattr_check_cred(struct vnode *vp, int attrnamespace, struct ucred *cred,
#ifdef DEBUG_VFS_LOCKS
/*
- * This only exists to supress warnings from unlocked specfs accesses. It is
+ * This only exists to suppress warnings from unlocked specfs accesses. It is
* no longer ok to have an unlocked VFS.
*/
#define IGNORE_LOCK(vp) (panicstr != NULL || (vp) == NULL || \
@@ -4650,10 +4650,27 @@ void
vop_rename_post(void *ap, int rc)
{
struct vop_rename_args *a = ap;
+ long hint;
if (!rc) {
- VFS_KNOTE_UNLOCKED(a->a_fdvp, NOTE_WRITE);
- VFS_KNOTE_UNLOCKED(a->a_tdvp, NOTE_WRITE);
+ hint = NOTE_WRITE;
+ if (a->a_fdvp == a->a_tdvp) {
+ if (a->a_tvp != NULL && a->a_tvp->v_type == VDIR)
+ hint |= NOTE_LINK;
+ VFS_KNOTE_UNLOCKED(a->a_fdvp, hint);
+ VFS_KNOTE_UNLOCKED(a->a_tdvp, hint);
+ } else {
+ hint |= NOTE_EXTEND;
+ if (a->a_fvp->v_type == VDIR)
+ hint |= NOTE_LINK;
+ VFS_KNOTE_UNLOCKED(a->a_fdvp, hint);
+
+ if (a->a_fvp->v_type == VDIR && a->a_tvp != NULL &&
+ a->a_tvp->v_type == VDIR)
+ hint &= ~NOTE_LINK;
+ VFS_KNOTE_UNLOCKED(a->a_tdvp, hint);
+ }
+
VFS_KNOTE_UNLOCKED(a->a_fvp, NOTE_RENAME);
if (a->a_tvp)
VFS_KNOTE_UNLOCKED(a->a_tvp, NOTE_DELETE);
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index a0f624e..0a3a88a 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1537,7 +1537,7 @@ _vn_lock(struct vnode *vp, int flags, char *file, int line)
error = VOP_LOCK1(vp, flags, file, line);
flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */
KASSERT((flags & LK_RETRY) == 0 || error == 0,
- ("LK_RETRY set with incompatible flags (0x%x) or an error occured (%d)",
+ ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)",
flags, error));
/*
* Callers specify LK_RETRY if they wish to get dead vnodes.
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index 5586a14..1b07a36 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -35,7 +35,7 @@
# is a specification of the locking protocol used by each vop call.
# The first column is the name of the variable, the remaining three
# columns are in, out and error respectively. The "in" column defines
-# the lock state on input, the "out" column defines the state on succesful
+# the lock state on input, the "out" column defines the state on successful
# return, and the "error" column defines the locking state on error exit.
#
# The locking value can take the following values:
diff --git a/sys/libkern/crc32.c b/sys/libkern/crc32.c
index c0b464c..65331ce 100644
--- a/sys/libkern/crc32.c
+++ b/sys/libkern/crc32.c
@@ -684,7 +684,7 @@ crc32c_sb8_64_bit(uint32_t crc,
uint32_t running_length;
uint32_t end_bytes;
- running_length = ((length - init_bytes) / 8) * 8;
+ running_length = rounddown(length - init_bytes, 8);
end_bytes = length - init_bytes - running_length;
for (li = 0; li < init_bytes; li++)
diff --git a/sys/mips/atheros/ar934x_chip.c b/sys/mips/atheros/ar934x_chip.c
index b5b804f..f59d4aa 100644
--- a/sys/mips/atheros/ar934x_chip.c
+++ b/sys/mips/atheros/ar934x_chip.c
@@ -437,7 +437,7 @@ ar934x_chip_gpio_output_configure(int gpio, uint8_t func)
if (gpio > AR934X_GPIO_COUNT)
return;
- reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
+ reg = AR934X_GPIO_REG_OUT_FUNC0 + rounddown(gpio, 4);
s = 8 * (gpio % 4);
/* read-modify-write */
diff --git a/sys/mips/atheros/qca953x_chip.c b/sys/mips/atheros/qca953x_chip.c
index a262a9f..88127b4 100644
--- a/sys/mips/atheros/qca953x_chip.c
+++ b/sys/mips/atheros/qca953x_chip.c
@@ -360,7 +360,7 @@ qca953x_chip_gpio_output_configure(int gpio, uint8_t func)
if (gpio > QCA953X_GPIO_COUNT)
return;
- reg = QCA953X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
+ reg = QCA953X_GPIO_REG_OUT_FUNC0 + rounddown(gpio, 4);
s = 8 * (gpio % 4);
/* read-modify-write */
diff --git a/sys/mips/atheros/qca955x_chip.c b/sys/mips/atheros/qca955x_chip.c
index b4d54fa..d963cc6 100644
--- a/sys/mips/atheros/qca955x_chip.c
+++ b/sys/mips/atheros/qca955x_chip.c
@@ -369,7 +369,7 @@ qca955x_chip_gpio_output_configure(int gpio, uint8_t func)
if (gpio > QCA955X_GPIO_COUNT)
return;
- reg = QCA955X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
+ reg = QCA955X_GPIO_REG_OUT_FUNC0 + rounddown(gpio, 4);
s = 8 * (gpio % 4);
/* read-modify-write */
diff --git a/sys/mips/include/param.h b/sys/mips/include/param.h
index 90f3e6f..7c5e667 100644
--- a/sys/mips/include/param.h
+++ b/sys/mips/include/param.h
@@ -146,12 +146,14 @@
#define SEGSHIFT (PAGE_SHIFT + NPTEPGSHIFT + NPDEPGSHIFT)
#define NBSEG (1ul << SEGSHIFT)
#define PDRSHIFT (PAGE_SHIFT + NPTEPGSHIFT)
+#define PDRSIZE (1ul << PDRSHIFT)
#define PDRMASK ((1 << PDRSHIFT) - 1)
#else
#define NPDEPGSHIFT 10 /* LOG2(NPTEPG) */
#define SEGSHIFT (PAGE_SHIFT + NPTEPGSHIFT)
#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
#define PDRSHIFT SEGSHIFT /* alias for SEG in 32 bit */
+#define PDRSIZE (1ul << PDRSHIFT)
#define PDRMASK ((1 << PDRSHIFT) - 1)
#endif
#define NBPDR (1 << PDRSHIFT) /* bytes/pagedir */
diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c
index 0827ad1..7081b74 100644
--- a/sys/mips/mips/pmap.c
+++ b/sys/mips/mips/pmap.c
@@ -3299,18 +3299,18 @@ pmap_align_superpage(vm_object_t object, vm_ooffset_t offset,
{
vm_offset_t superpage_offset;
- if (size < NBSEG)
+ if (size < PDRSIZE)
return;
if (object != NULL && (object->flags & OBJ_COLORED) != 0)
offset += ptoa(object->pg_color);
- superpage_offset = offset & SEGMASK;
- if (size - ((NBSEG - superpage_offset) & SEGMASK) < NBSEG ||
- (*addr & SEGMASK) == superpage_offset)
+ superpage_offset = offset & PDRMASK;
+ if (size - ((PDRSIZE - superpage_offset) & PDRMASK) < PDRSIZE ||
+ (*addr & PDRMASK) == superpage_offset)
return;
- if ((*addr & SEGMASK) < superpage_offset)
- *addr = (*addr & ~SEGMASK) + superpage_offset;
+ if ((*addr & PDRMASK) < superpage_offset)
+ *addr = (*addr & ~PDRMASK) + superpage_offset;
else
- *addr = ((*addr + SEGMASK) & ~SEGMASK) + superpage_offset;
+ *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset;
}
#ifdef DDB
diff --git a/sys/modules/bhnd/Makefile b/sys/modules/bhnd/Makefile
index c2456a0..862b56d 100644
--- a/sys/modules/bhnd/Makefile
+++ b/sys/modules/bhnd/Makefile
@@ -4,7 +4,7 @@
KMOD= bhnd
SRCS= bhnd.c bhnd_subr.c \
- bhnd_bus_if.c bhnd_bus_if.h
+ bhnd_bus_if.c bhnd_bus_if.h bhnd_nvram_if.h
SRCS+= device_if.h bus_if.h
diff --git a/sys/modules/bhnd/bcma_bhndb/Makefile b/sys/modules/bhnd/bcma_bhndb/Makefile
index 5896703..372a7ed 100644
--- a/sys/modules/bhnd/bcma_bhndb/Makefile
+++ b/sys/modules/bhnd/bcma_bhndb/Makefile
@@ -5,7 +5,7 @@
KMOD= bcma_bhndb
SRCS= bcma_bhndb.c
-SRCS+= bhnd_bus_if.h bhndb_if.h
+SRCS+= bhnd_bus_if.h bhndb_bus_if.h bhndb_if.h
SRCS+= device_if.h bus_if.h
.include <bsd.kmod.mk>
diff --git a/sys/modules/bhnd/bhndb/Makefile b/sys/modules/bhnd/bhndb/Makefile
index a414937..06822de 100644
--- a/sys/modules/bhnd/bhndb/Makefile
+++ b/sys/modules/bhnd/bhndb/Makefile
@@ -5,7 +5,8 @@
KMOD= bhndb
SRCS= bhndb.c bhndb_subr.c bhndb_hwdata.c \
bhndb_bus_if.c bhndb_bus_if.h \
- bhndb_if.c bhndb_if.h
+ bhndb_if.c bhndb_if.h \
+ bhnd_bus_if.h
SRCS+= device_if.h bus_if.h
diff --git a/sys/modules/bhnd/nvram/Makefile b/sys/modules/bhnd/nvram/Makefile
index f85502c..6c6d203 100644
--- a/sys/modules/bhnd/nvram/Makefile
+++ b/sys/modules/bhnd/nvram/Makefile
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/../../../dev/bhnd/nvram
KMOD= bhnd_nvram
-SRCS= bhnd_nvram_if.c bhnd_nvram_if.h
+SRCS= bhnd_nvram_if.c bhnd_nvram_if.h bhnd_bus_if.h
SRCS+= device_if.h bus_if.h
diff --git a/sys/modules/bhnd/siba_bhndb/Makefile b/sys/modules/bhnd/siba_bhndb/Makefile
index 2dbef19..ba46a7f 100644
--- a/sys/modules/bhnd/siba_bhndb/Makefile
+++ b/sys/modules/bhnd/siba_bhndb/Makefile
@@ -5,7 +5,7 @@
KMOD= siba_bhndb
SRCS= siba_bhndb.c
-SRCS+= bhnd_bus_if.h bhndb_if.h
+SRCS+= bhnd_bus_if.h bhndb_bus_if.h bhndb_if.h
SRCS+= device_if.h bus_if.h
.include <bsd.kmod.mk>
diff --git a/sys/modules/bwn/Makefile b/sys/modules/bwn/Makefile
index e04ab0b..36ca965 100644
--- a/sys/modules/bwn/Makefile
+++ b/sys/modules/bwn/Makefile
@@ -4,9 +4,12 @@
KMOD= if_bwn
SRCS= if_bwn.c if_bwnreg.h if_bwnvar.h
+SRCS+= if_bwn_phy_g.c if_bwn_phy_lp.c
SRCS+= device_if.h bus_if.h pci_if.h
.include <bsd.kmod.mk>
# XXX Work around clang warning, until maintainer approves fix.
CWARNFLAGS.if_bwn.c= ${NO_WSOMETIMES_UNINITIALIZED}
+CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED}
+CWARNFLAGS.if_bwn_phy_lp.c= ${NO_WSOMETIMES_UNINITIALIZED}
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 59c76eb..a5631fc 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -930,7 +930,7 @@ vxlan_socket_init(struct vxlan_socket *vso, struct ifnet *ifp)
}
error = udp_set_kernel_tunneling(vso->vxlso_sock,
- vxlan_rcv_udp_packet, vso);
+ vxlan_rcv_udp_packet, NULL, vso);
if (error) {
if_printf(ifp, "cannot set tunneling function: %d\n", error);
return (error);
diff --git a/sys/net80211/_ieee80211.h b/sys/net80211/_ieee80211.h
index 4ff395d..aceaba5 100644
--- a/sys/net80211/_ieee80211.h
+++ b/sys/net80211/_ieee80211.h
@@ -70,6 +70,7 @@ enum ieee80211_phymode {
IEEE80211_MODE_QUARTER = 11, /* OFDM, 1/4x clock */
};
#define IEEE80211_MODE_MAX (IEEE80211_MODE_QUARTER+1)
+#define IEEE80211_MODE_BYTES howmany(IEEE80211_MODE_MAX, NBBY)
/*
* Operating mode. Devices do not necessarily support
@@ -146,7 +147,7 @@ struct ieee80211_channel {
};
#define IEEE80211_CHAN_MAX 256
-#define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */
+#define IEEE80211_CHAN_BYTES howmany(IEEE80211_CHAN_MAX, NBBY)
#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */
#define IEEE80211_CHAN_ANYC \
((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index bb4b141..86f4d81 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -970,6 +970,261 @@ ieee80211_ieee2mhz(u_int chan, u_int flags)
}
}
+static __inline void
+set_extchan(struct ieee80211_channel *c)
+{
+
+ /*
+ * IEEE Std 802.11-2012, page 1738, subclause 20.3.15.4:
+ * "the secondary channel number shall be 'N + [1,-1] * 4'
+ */
+ if (c->ic_flags & IEEE80211_CHAN_HT40U)
+ c->ic_extieee = c->ic_ieee + 4;
+ else if (c->ic_flags & IEEE80211_CHAN_HT40D)
+ c->ic_extieee = c->ic_ieee - 4;
+ else
+ c->ic_extieee = 0;
+}
+
+static int
+addchan(struct ieee80211_channel chans[], int maxchans, int *nchans,
+ uint8_t ieee, uint16_t freq, int8_t maxregpower, uint32_t flags)
+{
+ struct ieee80211_channel *c;
+
+ if (*nchans >= maxchans)
+ return (ENOBUFS);
+
+ c = &chans[(*nchans)++];
+ c->ic_ieee = ieee;
+ c->ic_freq = freq != 0 ? freq : ieee80211_ieee2mhz(ieee, flags);
+ c->ic_maxregpower = maxregpower;
+ c->ic_maxpower = 2 * maxregpower;
+ c->ic_flags = flags;
+ set_extchan(c);
+
+ return (0);
+}
+
+static int
+copychan_prev(struct ieee80211_channel chans[], int maxchans, int *nchans,
+ uint32_t flags)
+{
+ struct ieee80211_channel *c;
+
+ KASSERT(*nchans > 0, ("channel list is empty\n"));
+
+ if (*nchans >= maxchans)
+ return (ENOBUFS);
+
+ c = &chans[(*nchans)++];
+ c[0] = c[-1];
+ c->ic_flags = flags;
+ set_extchan(c);
+
+ return (0);
+}
+
+static void
+getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40)
+{
+ int nmodes;
+
+ nmodes = 0;
+ if (isset(bands, IEEE80211_MODE_11B))
+ flags[nmodes++] = IEEE80211_CHAN_B;
+ if (isset(bands, IEEE80211_MODE_11G))
+ flags[nmodes++] = IEEE80211_CHAN_G;
+ if (isset(bands, IEEE80211_MODE_11NG))
+ flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT20;
+ if (ht40) {
+ flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U;
+ flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D;
+ }
+ flags[nmodes] = 0;
+}
+
+static void
+getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40)
+{
+ int nmodes;
+
+ nmodes = 0;
+ if (isset(bands, IEEE80211_MODE_11A))
+ flags[nmodes++] = IEEE80211_CHAN_A;
+ if (isset(bands, IEEE80211_MODE_11NA))
+ flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20;
+ if (ht40) {
+ flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U;
+ flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D;
+ }
+ flags[nmodes] = 0;
+}
+
+static void
+getflags(const uint8_t bands[], uint32_t flags[], int ht40)
+{
+
+ flags[0] = 0;
+ if (isset(bands, IEEE80211_MODE_11A) ||
+ isset(bands, IEEE80211_MODE_11NA)) {
+ if (isset(bands, IEEE80211_MODE_11B) ||
+ isset(bands, IEEE80211_MODE_11G) ||
+ isset(bands, IEEE80211_MODE_11NG))
+ return;
+
+ getflags_5ghz(bands, flags, ht40);
+ } else
+ getflags_2ghz(bands, flags, ht40);
+}
+
+/*
+ * Add one 20 MHz channel into specified channel list.
+ */
+int
+ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans,
+ int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower,
+ uint32_t chan_flags, const uint8_t bands[])
+{
+ uint32_t flags[IEEE80211_MODE_MAX];
+ int i, error;
+
+ getflags(bands, flags, 0);
+ KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
+
+ error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower,
+ flags[0] | chan_flags);
+ for (i = 1; flags[i] != 0 && error == 0; i++) {
+ error = copychan_prev(chans, maxchans, nchans,
+ flags[i] | chan_flags);
+ }
+
+ return (error);
+}
+
+static struct ieee80211_channel *
+findchannel(struct ieee80211_channel chans[], int nchans, uint16_t freq,
+ uint32_t flags)
+{
+ struct ieee80211_channel *c;
+ int i;
+
+ flags &= IEEE80211_CHAN_ALLTURBO;
+ /* brute force search */
+ for (i = 0; i < nchans; i++) {
+ c = &chans[i];
+ if (c->ic_freq == freq &&
+ (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
+ return c;
+ }
+ return NULL;
+}
+
+/*
+ * Add 40 MHz channel pair into specified channel list.
+ */
+int
+ieee80211_add_channel_ht40(struct ieee80211_channel chans[], int maxchans,
+ int *nchans, uint8_t ieee, int8_t maxregpower, uint32_t flags)
+{
+ struct ieee80211_channel *cent, *extc;
+ uint16_t freq;
+ int error;
+
+ freq = ieee80211_ieee2mhz(ieee, flags);
+
+ /*
+ * Each entry defines an HT40 channel pair; find the
+ * center channel, then the extension channel above.
+ */
+ flags |= IEEE80211_CHAN_HT20;
+ cent = findchannel(chans, *nchans, freq, flags);
+ if (cent == NULL)
+ return (EINVAL);
+
+ extc = findchannel(chans, *nchans, freq + 20, flags);
+ if (extc == NULL)
+ return (ENOENT);
+
+ flags &= ~IEEE80211_CHAN_HT;
+ error = addchan(chans, maxchans, nchans, cent->ic_ieee, cent->ic_freq,
+ maxregpower, flags | IEEE80211_CHAN_HT40U);
+ if (error != 0)
+ return (error);
+
+ error = addchan(chans, maxchans, nchans, extc->ic_ieee, extc->ic_freq,
+ maxregpower, flags | IEEE80211_CHAN_HT40D);
+
+ return (error);
+}
+
+/*
+ * Adds channels into specified channel list (ieee[] array must be sorted).
+ * Channels are already sorted.
+ */
+static int
+add_chanlist(struct ieee80211_channel chans[], int maxchans, int *nchans,
+ const uint8_t ieee[], int nieee, uint32_t flags[])
+{
+ uint16_t freq;
+ int i, j, error;
+
+ for (i = 0; i < nieee; i++) {
+ freq = ieee80211_ieee2mhz(ieee[i], flags[0]);
+ for (j = 0; flags[j] != 0; j++) {
+ if (flags[j] & IEEE80211_CHAN_HT40D)
+ if (i == 0 || ieee[i] < ieee[0] + 4 ||
+ freq - 20 !=
+ ieee80211_ieee2mhz(ieee[i] - 4, flags[j]))
+ continue;
+ if (flags[j] & IEEE80211_CHAN_HT40U)
+ if (i == nieee - 1 ||
+ ieee[i] + 4 > ieee[nieee - 1] ||
+ freq + 20 !=
+ ieee80211_ieee2mhz(ieee[i] + 4, flags[j]))
+ continue;
+
+ if (j == 0) {
+ error = addchan(chans, maxchans, nchans,
+ ieee[i], freq, 0, flags[j]);
+ } else {
+ error = copychan_prev(chans, maxchans, nchans,
+ flags[j]);
+ }
+ if (error != 0)
+ return (error);
+ }
+ }
+
+ return (error);
+}
+
+int
+ieee80211_add_channel_list_2ghz(struct ieee80211_channel chans[], int maxchans,
+ int *nchans, const uint8_t ieee[], int nieee, const uint8_t bands[],
+ int ht40)
+{
+ uint32_t flags[IEEE80211_MODE_MAX];
+
+ getflags_2ghz(bands, flags, ht40);
+ KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
+
+ return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
+}
+
+int
+ieee80211_add_channel_list_5ghz(struct ieee80211_channel chans[], int maxchans,
+ int *nchans, const uint8_t ieee[], int nieee, const uint8_t bands[],
+ int ht40)
+{
+ uint32_t flags[IEEE80211_MODE_MAX];
+
+ getflags_5ghz(bands, flags, ht40);
+ KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__));
+
+ return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags));
+}
+
/*
* Locate a channel given a frequency+flags. We cache
* the previous lookup to optimize switching between two
@@ -979,7 +1234,6 @@ struct ieee80211_channel *
ieee80211_find_channel(struct ieee80211com *ic, int freq, int flags)
{
struct ieee80211_channel *c;
- int i;
flags &= IEEE80211_CHAN_ALLTURBO;
c = ic->ic_prevchan;
@@ -987,13 +1241,7 @@ ieee80211_find_channel(struct ieee80211com *ic, int freq, int flags)
(c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
return c;
/* brute force search */
- for (i = 0; i < ic->ic_nchans; i++) {
- c = &ic->ic_channels[i];
- if (c->ic_freq == freq &&
- (c->ic_flags & IEEE80211_CHAN_ALLTURBO) == flags)
- return c;
- }
- return NULL;
+ return (findchannel(ic->ic_channels, ic->ic_nchans, freq, flags));
}
/*
diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c
index d3b1937..deb329f 100644
--- a/sys/net80211/ieee80211_adhoc.c
+++ b/sys/net80211/ieee80211_adhoc.c
@@ -854,7 +854,8 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
case IEEE80211_FC0_SUBTYPE_ACTION:
case IEEE80211_FC0_SUBTYPE_ACTION_NOACK:
- if (ni == vap->iv_bss) {
+ if ((ni == vap->iv_bss) &&
+ !IEEE80211_ADDR_EQ(wh->i_addr2, ni->ni_macaddr)) {
IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
wh, NULL, "%s", "unknown node");
vap->iv_stats.is_rx_mgtdiscard++;
diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h
index d27b2ca..26fba76 100644
--- a/sys/net80211/ieee80211_freebsd.h
+++ b/sys/net80211/ieee80211_freebsd.h
@@ -28,7 +28,7 @@
#define _NET80211_IEEE80211_FREEBSD_H_
#ifdef _KERNEL
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/systm.h>
#include <sys/counter.h>
#include <sys/lock.h>
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index c3b02e8..823906b 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -3382,8 +3382,18 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
IEEE80211_UNLOCK(ic);
/* Wait for parent ioctl handler if it was queued */
- if (wait)
+ if (wait) {
ieee80211_waitfor_parent(ic);
+
+ /*
+ * Check if the MAC address was changed
+ * via SIOCSIFLLADDR ioctl.
+ */
+ if ((ifp->if_flags & IFF_UP) == 0 &&
+ !IEEE80211_ADDR_EQ(vap->iv_myaddr, IF_LLADDR(ifp)))
+ IEEE80211_ADDR_COPY(vap->iv_myaddr,
+ IF_LLADDR(ifp));
+ }
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c
index efbe1a8..4db08fd 100644
--- a/sys/net80211/ieee80211_regdomain.c
+++ b/sys/net80211/ieee80211_regdomain.c
@@ -98,22 +98,14 @@ ieee80211_regdomain_vdetach(struct ieee80211vap *vap)
{
}
-static void
-addchan(struct ieee80211com *ic, int ieee, int flags)
-{
- struct ieee80211_channel *c;
-
- c = &ic->ic_channels[ic->ic_nchans++];
- c->ic_freq = ieee80211_ieee2mhz(ieee, flags);
- c->ic_ieee = ieee;
- c->ic_flags = flags;
- if (flags & IEEE80211_CHAN_HT40U)
- c->ic_extieee = ieee + 4;
- else if (flags & IEEE80211_CHAN_HT40D)
- c->ic_extieee = ieee - 4;
- else
- c->ic_extieee = 0;
-}
+static const uint8_t def_chan_2ghz[] =
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
+static const uint8_t def_chan_5ghz_band1[] =
+ { 36, 40, 44, 48, 52, 56, 60, 64 };
+static const uint8_t def_chan_5ghz_band2[] =
+ { 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 };
+static const uint8_t def_chan_5ghz_band3[] =
+ { 149, 153, 157, 161 };
/*
* Setup the channel list for the specified regulatory domain,
@@ -125,82 +117,34 @@ int
ieee80211_init_channels(struct ieee80211com *ic,
const struct ieee80211_regdomain *rd, const uint8_t bands[])
{
- int i;
+ struct ieee80211_channel *chans = ic->ic_channels;
+ int *nchans = &ic->ic_nchans;
+ int ht40;
/* XXX just do something for now */
- ic->ic_nchans = 0;
+ ht40 = !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40);
+ *nchans = 0;
if (isset(bands, IEEE80211_MODE_11B) ||
isset(bands, IEEE80211_MODE_11G) ||
isset(bands, IEEE80211_MODE_11NG)) {
- int maxchan = 11;
- if (rd != NULL && rd->ecm)
- maxchan = 14;
- for (i = 1; i <= maxchan; i++) {
- if (isset(bands, IEEE80211_MODE_11B))
- addchan(ic, i, IEEE80211_CHAN_B);
- if (isset(bands, IEEE80211_MODE_11G))
- addchan(ic, i, IEEE80211_CHAN_G);
- if (isset(bands, IEEE80211_MODE_11NG)) {
- addchan(ic, i,
- IEEE80211_CHAN_G | IEEE80211_CHAN_HT20);
- }
- if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0)
- continue;
- if (i <= 7) {
- addchan(ic, i,
- IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U);
- addchan(ic, i + 4,
- IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D);
- }
- }
+ int nchan = nitems(def_chan_2ghz);
+ if (!(rd != NULL && rd->ecm))
+ nchan -= 3;
+
+ ieee80211_add_channel_list_2ghz(chans, IEEE80211_CHAN_MAX,
+ nchans, def_chan_2ghz, nchan, bands, ht40);
}
if (isset(bands, IEEE80211_MODE_11A) ||
isset(bands, IEEE80211_MODE_11NA)) {
- for (i = 36; i <= 64; i += 4) {
- addchan(ic, i, IEEE80211_CHAN_A);
- if (isset(bands, IEEE80211_MODE_11NA)) {
- addchan(ic, i,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT20);
- }
- if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0)
- continue;
- if ((i % 8) == 4) {
- addchan(ic, i,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U);
- addchan(ic, i + 4,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D);
- }
- }
- for (i = 100; i <= 140; i += 4) {
- addchan(ic, i, IEEE80211_CHAN_A);
- if (isset(bands, IEEE80211_MODE_11NA)) {
- addchan(ic, i,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT20);
- }
- if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0)
- continue;
- if ((i % 8) == 4 && i != 140) {
- addchan(ic, i,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U);
- addchan(ic, i + 4,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D);
- }
- }
- for (i = 149; i <= 161; i += 4) {
- addchan(ic, i, IEEE80211_CHAN_A);
- if (isset(bands, IEEE80211_MODE_11NA)) {
- addchan(ic, i,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT20);
- }
- if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) == 0)
- continue;
- if ((i % 8) == 5) {
- addchan(ic, i,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U);
- addchan(ic, i + 4,
- IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D);
- }
- }
+ ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
+ nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
+ bands, ht40);
+ ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
+ nchans, def_chan_5ghz_band2, nitems(def_chan_5ghz_band2),
+ bands, ht40);
+ ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
+ nchans, def_chan_5ghz_band3, nitems(def_chan_5ghz_band3),
+ bands, ht40);
}
if (rd != NULL)
ic->ic_regdomain = *rd;
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index fbaa782..8c0f6fb 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -723,6 +723,14 @@ int ieee80211_mhz2ieee(u_int, u_int);
int ieee80211_chan2ieee(struct ieee80211com *,
const struct ieee80211_channel *);
u_int ieee80211_ieee2mhz(u_int, u_int);
+int ieee80211_add_channel(struct ieee80211_channel[], int, int *,
+ uint8_t, uint16_t, int8_t, uint32_t, const uint8_t[]);
+int ieee80211_add_channel_ht40(struct ieee80211_channel[], int, int *,
+ uint8_t, int8_t, uint32_t);
+int ieee80211_add_channel_list_2ghz(struct ieee80211_channel[], int, int *,
+ const uint8_t[], int, const uint8_t[], int);
+int ieee80211_add_channel_list_5ghz(struct ieee80211_channel[], int, int *,
+ const uint8_t[], int, const uint8_t[], int);
struct ieee80211_channel *ieee80211_find_channel(struct ieee80211com *,
int freq, int flags);
struct ieee80211_channel *ieee80211_find_channel_byieee(struct ieee80211com *,
diff --git a/sys/netgraph/atm/ng_atm.c b/sys/netgraph/atm/ng_atm.c
index c0a7032..e06cb1d 100644
--- a/sys/netgraph/atm/ng_atm.c
+++ b/sys/netgraph/atm/ng_atm.c
@@ -1343,7 +1343,7 @@ ng_atm_shutdown(node_p node)
}
#else
/*
- * We are persistant - reinitialize
+ * We are persistent - reinitialize.
*/
NG_NODE_REVIVE(node);
#endif
diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
index 4121ebc..400616a 100644
--- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
+++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
@@ -58,7 +58,7 @@
* 2) Netgraph context. This is where all the Netgraph related stuff happens.
* Since we mark node as WRITER, the Netgraph node will be "locked" (from
* Netgraph point of view). Any variable that is only modified from the
- * Netgraph context does not require any additonal locking. It is generally
+ * Netgraph context does not require any additional locking. It is generally
* *NOT* allowed to grab *ANY* additional locks. Whatever you do, *DO NOT*
* grab any lock in the Netgraph context that could cause de-scheduling of
* the Netgraph thread for significant amount of time. In fact, the only
@@ -1463,7 +1463,7 @@ ng_ubt_shutdown(node_p node)
if (node->nd_flags & NGF_REALLY_DIE) {
/*
* We came here because the USB device is being
- * detached, so stop being persistant.
+ * detached, so stop being persistent.
*/
NG_NODE_SET_PRIVATE(node, NULL);
NG_NODE_UNREF(node);
diff --git a/sys/netgraph/bluetooth/hci/ng_hci_cmds.c b/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
index 0edb44c..4208a2c 100644
--- a/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
+++ b/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
@@ -369,7 +369,7 @@ complete_command(ng_hci_unit_p unit, int opcode, struct mbuf **cp)
* and return command parameters. ng_hci_command_untimeout will
* drop NG_HCI_UNIT_COMMAND_PENDING flag.
* Note: if ng_hci_command_untimeout() fails (returns non-zero)
- * then timeout aready happened and timeout message went info node
+ * then timeout already happened and timeout message went info node
* queue. In this case we ignore command completion and pretend
* there is a timeout.
*/
diff --git a/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h b/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
index fdc1d00..c42cf4f 100644
--- a/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
+++ b/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
@@ -69,7 +69,7 @@
#define RFCOMM_MODEM_FC 0x02 /* Flow Control asserted */
#define RFCOMM_MODEM_RTC 0x04 /* Ready To Communicate */
#define RFCOMM_MODEM_RTR 0x08 /* Ready To Receive */
-#define RFCOMM_MODEM_IC 0x40 /* Incomming Call */
+#define RFCOMM_MODEM_IC 0x40 /* Incoming Call */
#define RFCOMM_MODEM_DV 0x80 /* Data Valid */
/* RPN parameters - baud rate */
@@ -270,7 +270,7 @@ struct ng_btsocket_rfcomm_pcb {
u_int16_t flags; /* DLC flags */
#define NG_BTSOCKET_RFCOMM_DLC_TIMO (1 << 0) /* timeout pending */
#define NG_BTSOCKET_RFCOMM_DLC_CFC (1 << 1) /* credit flow ctrl */
-#define NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT (1 << 2) /* timeout happend */
+#define NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT (1 << 2) /* timeout happened */
#define NG_BTSOCKET_RFCOMM_DLC_DETACHED (1 << 3) /* DLC detached */
#define NG_BTSOCKET_RFCOMM_DLC_SENDING (1 << 4) /* send pending */
diff --git a/sys/netgraph/bluetooth/include/ng_hci.h b/sys/netgraph/bluetooth/include/ng_hci.h
index 40d6a79..7fe1dc7 100644
--- a/sys/netgraph/bluetooth/include/ng_hci.h
+++ b/sys/netgraph/bluetooth/include/ng_hci.h
@@ -1560,7 +1560,7 @@ typedef struct {
u_int16_t min_ce_length;
u_int16_t max_ce_length;
}__attribute__((packed)) ng_hci_le_create_connection_cp;
-/* no return paramters*/
+/* No return parameters. */
#define NG_HCI_OCF_LE_CREATE_CONNECTION_CANCEL 0x000e
/*No command parameter*/
typedef ng_hci_status_rp ng_hci_le_create_connection_cancel_rp;
@@ -1572,7 +1572,7 @@ typedef struct {
} __attribute__ ((packed)) ng_hci_le_read_white_list_size_rp;
#define NG_HCI_OCF_LE_CLEAR_WHITE_LIST 0x0010
-/*No command paramters*/
+/* No command parameters. */
typedef ng_hci_status_rp ng_hci_le_clear_white_list_rp;
#define NG_HCI_OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011
typedef struct {
@@ -1689,7 +1689,7 @@ typedef struct{
typedef ng_hci_status_rp ng_hci_le_transmitter_test_rp;
#define NG_HCI_OCF_LE_TEST_END 0x001f
-/*No command paramter*/
+/* No command parameter. */
typedef struct {
u_int8_t status;
u_int16_t number_of_packets;
diff --git a/sys/netgraph/bluetooth/include/ng_l2cap.h b/sys/netgraph/bluetooth/include/ng_l2cap.h
index 8a72e3d..ffe6a95 100644
--- a/sys/netgraph/bluetooth/include/ng_l2cap.h
+++ b/sys/netgraph/bluetooth/include/ng_l2cap.h
@@ -385,7 +385,7 @@ typedef struct {
bdaddr_t bdaddr; /* remote unit address */
u_int16_t lcid; /* local channel ID */
u_int16_t psm; /* Procotol/Service Multiplexor */
- u_int8_t ident; /* indentifier */
+ u_int8_t ident; /* identifier */
u_int8_t linktype; /* link type*/
} ng_l2cap_l2ca_con_ind_ip;
/* No output parameters */
@@ -688,7 +688,7 @@ typedef struct {
u_int16_t scid; /* source (local) channel ID */
u_int16_t dcid; /* destination (remote) channel ID */
- u_int16_t imtu; /* incomming MTU */
+ u_int16_t imtu; /* incoming MTU */
u_int16_t omtu; /* outgoing MTU */
u_int16_t psm; /* PSM */
diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c
index 167fcb6..c13a2af 100644
--- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c
+++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c
@@ -332,7 +332,7 @@ ng_l2cap_con_fail(ng_l2cap_con_p con, u_int16_t result)
/*
* Process L2CAP command timeout. In general - notify upper layer and destroy
- * channel. Do not pay much attension to return code, just do our best.
+ * channel. Do not pay much attention to return code, just do our best.
*/
void
diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c
index 7429f78..11ef311 100644
--- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c
+++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c
@@ -358,7 +358,7 @@ ng_l2cap_process_lesignal_cmd(ng_l2cap_con_p con)
/*Update Paramater Request*/
static int ng_l2cap_process_cmd_urq(ng_l2cap_con_p con, uint8_t ident)
{
- /*We do not implement paramter negotiasion for now*/
+ /* We do not implement parameter negotiation for now. */
send_l2cap_param_urs(con, ident, NG_L2CAP_UPDATE_PARAM_ACCEPT);
NG_FREE_M(con->rx_pkt);
return 0;
@@ -1068,7 +1068,7 @@ ng_l2cap_process_discon_rsp(ng_l2cap_con_p con, u_int8_t ident)
}
/*
- * Looks like we have successfuly disconnected channel, so notify
+ * Looks like we have successfully disconnected channel, so notify
* upper layer. If command timeout already happened then ignore
* response.
*/
diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c
index 889f6ab..f80a7b0 100644
--- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c
+++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c
@@ -325,7 +325,7 @@ ng_l2cap_con_by_handle(ng_l2cap_p l2cap, u_int16_t con_handle)
} /* ng_l2cap_con_by_handle */
/*
- * Allocate new L2CAP channel descriptor on "con" conection with "psm".
+ * Allocate new L2CAP channel descriptor on "con" connection with "psm".
* Will link the channel to the l2cap node
*/
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
index 57628b0..7653263 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
@@ -2076,7 +2076,7 @@ ng_btsocket_l2cap_attach(struct socket *so, int proto, struct thread *td)
* This is totally FUBAR. We could get here in two cases:
*
* 1) When user calls socket()
- * 2) When we need to accept new incomming connection and call
+ * 2) When we need to accept new incoming connection and call
* sonewconn()
*
* In the first case we must acquire ng_btsocket_l2cap_sockets_mtx.
@@ -2610,7 +2610,7 @@ ng_btsocket_l2cap_send(struct socket *so, int flags, struct mbuf *m,
goto drop;
}
- /* Check packet size agains outgoing (peer's incoming) MTU) */
+ /* Check packet size against outgoing (peer's incoming) MTU) */
if (m->m_pkthdr.len > pcb->omtu) {
NG_BTSOCKET_L2CAP_ERR(
"%s: Packet too big, len=%d, omtu=%d\n", __func__, m->m_pkthdr.len, pcb->omtu);
@@ -2690,7 +2690,7 @@ ng_btsocket_l2cap_send2(ng_btsocket_l2cap_pcb_p pcb)
hdr->token, pcb->state);
/*
- * If we got here than we have successfuly creates new L2CAP
+ * If we got here than we have successfully creates new L2CAP
* data packet and now we can send it to the L2CAP layer
*/
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
index 68c5975..704088a 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -1475,7 +1475,7 @@ ng_btsocket_rfcomm_session_accept(ng_btsocket_rfcomm_session_p s0)
s->state = NG_BTSOCKET_RFCOMM_SESSION_CONNECTED;
/*
- * Adjust MTU on incomming connection. Reserve 5 bytes:
+ * Adjust MTU on incoming connection. Reserve 5 bytes:
* RFCOMM frame header, one extra byte for length and
* one extra byte for credits.
*/
@@ -2881,7 +2881,7 @@ ng_btsocket_rfcomm_receive_pn(ng_btsocket_rfcomm_session_p s, struct mbuf *m0)
mtx_unlock(&pcb->pcb_mtx);
} else if (RFCOMM_CR(hdr->type)) {
- /* PN request to non-existing dlci - incomming connection */
+ /* PN request to non-existing dlci - incoming connection */
pcb = ng_btsocket_rfcomm_connect_ind(s,
RFCOMM_SRVCHANNEL(pn->dlci));
if (pcb != NULL) {
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
index 9ff0ceb..1398599 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
@@ -1261,10 +1261,10 @@ ng_btsocket_sco_attach(struct socket *so, int proto, struct thread *td)
* This is totally FUBAR. We could get here in two cases:
*
* 1) When user calls socket()
- * 2) When we need to accept new incomming connection and call
+ * 2) When we need to accept new incoming connection and call
* sonewconn()
*
- * In the first case we must aquire ng_btsocket_sco_sockets_mtx.
+ * In the first case we must acquire ng_btsocket_sco_sockets_mtx.
* In the second case we hold ng_btsocket_sco_sockets_mtx already.
* So we now need to distinguish between these cases. From reading
* /sys/kern/uipc_socket2.c we can find out that sonewconn() calls
diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c
index a142903..9ada133 100644
--- a/sys/netgraph/netflow/ng_netflow.c
+++ b/sys/netgraph/netflow/ng_netflow.c
@@ -826,7 +826,7 @@ ng_netflow_rcvdata (hook_p hook, item_p item)
goto bypass;
/*
- * Loop thru IPv6 extended headers to get upper
+ * Loop through IPv6 extended headers to get upper
* layer header / frag.
*/
for (;;) {
diff --git a/sys/netgraph/netflow/ng_netflow.h b/sys/netgraph/netflow/ng_netflow.h
index d7f06af..24dde4a 100644
--- a/sys/netgraph/netflow/ng_netflow.h
+++ b/sys/netgraph/netflow/ng_netflow.h
@@ -166,7 +166,7 @@ struct ng_netflow_setmtu {
uint16_t mtu; /* MTU for packet */
};
-/* This structure is used in NGM_NETFLOW_SHOW request/responce */
+/* This structure is used in NGM_NETFLOW_SHOW request/response */
struct ngnf_show_header {
u_char version; /* IPv4 or IPv6 */
uint32_t hash_id; /* current hash index */
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h
index 9fc8986..c7b0e67 100644
--- a/sys/netgraph/netgraph.h
+++ b/sys/netgraph/netgraph.h
@@ -109,7 +109,7 @@ typedef int ng_rcvitem (node_p node, hook_p hook, item_p item);
*/
struct ng_hook {
char hk_name[NG_HOOKSIZ]; /* what this node knows this link as */
- void *hk_private; /* node dependant ID for this hook */
+ void *hk_private; /* node dependent ID for this hook */
int hk_flags; /* info about this hook/link */
int hk_type; /* tbd: hook data link type */
struct ng_hook *hk_peer; /* the other end of this link */
@@ -362,7 +362,7 @@ struct ng_node {
struct ng_type *nd_type; /* the installed 'type' */
int nd_flags; /* see below for bit definitions */
int nd_numhooks; /* number of hooks */
- void *nd_private; /* node type dependant node ID */
+ void *nd_private; /* node type dependent node ID */
ng_ID_t nd_ID; /* Unique per node */
LIST_HEAD(hooks, ng_hook) nd_hooks; /* linked list of node hooks */
LIST_ENTRY(ng_node) nd_nodes; /* name hash collision list */
@@ -1066,7 +1066,7 @@ struct ng_cmdlist {
* Note the input queueing system is to allow modules
* to 'release the stack' or to pass data across spl layers.
* The data will be redelivered as soon as the NETISR code runs
- * which may be almost immediatly. A node may also do it's own queueing
+ * which may be almost immediately. A node may also do it's own queueing
* for other reasons (e.g. device output queuing).
*/
struct ng_type {
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index b920885..78c0c1b 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -772,7 +772,7 @@ ng_rmnode(node_p node, hook_p dummy1, void *dummy2, int dummy3)
/*
* Well, blow me down if the node code hasn't declared
* that it doesn't want to die.
- * Presumably it is a persistant node.
+ * Presumably it is a persistent node.
* If we REALLY want it to go away,
* e.g. hardware going away,
* Our caller should set NGF_REALLY_DIE in nd_flags.
@@ -2959,7 +2959,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook)
* Sometimes a generic message may be statically allocated
* to avoid problems with allocating when in tight memory situations.
* Don't free it if it is so.
- * I break them appart here, because erros may cause a free if the item
+ * I break them apart here, because erros may cause a free if the item
* in which case we'd be doing it twice.
* they are kept together above, to simplify freeing.
*/
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index a902f00..a1e3f26 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -327,7 +327,7 @@ ng_bridge_constructor(node_p node)
/*
* This node has all kinds of stuff that could be screwed by SMP.
* Until it gets it's own internal protection, we go through in
- * single file. This could hurt a machine bridging beteen two
+ * single file. This could hurt a machine bridging between two
* GB ethernets so it should be fixed.
* When it's fixed the process SHOULD NOT SLEEP, spinlocks please!
* (and atomic ops )
diff --git a/sys/netgraph/ng_car.c b/sys/netgraph/ng_car.c
index 84e8808..cdbaf5a 100644
--- a/sys/netgraph/ng_car.c
+++ b/sys/netgraph/ng_car.c
@@ -28,7 +28,7 @@
*/
/*
- * ng_car - An implementation of commited access rate for netgraph
+ * ng_car - An implementation of committed access rate for netgraph
*
* TODO:
* - Sanitize input config values (impose some limits)
@@ -49,14 +49,14 @@
#include <netgraph/ng_car.h>
#define NG_CAR_QUEUE_SIZE 100 /* Maximum queue size for SHAPE mode */
-#define NG_CAR_QUEUE_MIN_TH 8 /* Minimum RED threshhold for SHAPE mode */
+#define NG_CAR_QUEUE_MIN_TH 8 /* Minimum RED threshold for SHAPE mode */
/* Hook private info */
struct hookinfo {
hook_p hook; /* this (source) hook */
hook_p dest; /* destination hook */
- int64_t tc; /* commited token bucket counter */
+ int64_t tc; /* committed token bucket counter */
int64_t te; /* exceeded/peak token bucket counter */
struct bintime lastRefill; /* last token refill time */
@@ -296,7 +296,7 @@ ng_car_rcvdata(hook_p hook, item_p item )
len = m->m_pkthdr.len;
}
- /* Check commited token bucket. */
+ /* Check committed token bucket. */
if (hinfo->tc - len >= 0) {
/* This packet is green. */
++hinfo->stats.green_pkts;
@@ -307,7 +307,7 @@ ng_car_rcvdata(hook_p hook, item_p item )
/* Refill only if not green without it. */
ng_car_refillhook(hinfo);
- /* Check commited token bucket again after refill. */
+ /* Check committed token bucket again after refill. */
if (hinfo->tc - len >= 0) {
/* This packet is green */
++hinfo->stats.green_pkts;
@@ -339,7 +339,7 @@ ng_car_rcvdata(hook_p hook, item_p item )
hinfo->tc -= len;
NG_CAR_PERFORM_MATCH_ACTION(hinfo->conf.yellow_action);
} else {
- /* This packet is probaly red. */
+ /* This packet is probably red. */
++hinfo->stats.red_pkts;
hinfo->te = 0;
NG_CAR_PERFORM_MATCH_ACTION(hinfo->conf.red_action);
@@ -608,7 +608,7 @@ ng_car_refillhook(struct hookinfo *h)
if (h->conf.mode == NG_CAR_SINGLE_RATE) {
int64_t delta;
- /* Refill commited token bucket. */
+ /* Refill committed token bucket. */
h->tc += (h->conf.cir * deltat_us) >> 23;
delta = h->tc - h->conf.cbs;
if (delta > 0) {
@@ -621,7 +621,7 @@ ng_car_refillhook(struct hookinfo *h)
}
} else if (h->conf.mode == NG_CAR_DOUBLE_RATE) {
- /* Refill commited token bucket. */
+ /* Refill committed token bucket. */
h->tc += (h->conf.cir * deltat_us) >> 23;
if (h->tc > ((int64_t)h->conf.cbs))
h->tc = h->conf.cbs;
@@ -632,7 +632,7 @@ ng_car_refillhook(struct hookinfo *h)
h->te = h->conf.ebs;
} else { /* RED or SHAPE mode. */
- /* Refill commited token bucket. */
+ /* Refill committed token bucket. */
h->tc += (h->conf.cir * deltat_us) >> 23;
if (h->tc > ((int64_t)h->conf.cbs))
h->tc = h->conf.cbs;
diff --git a/sys/netgraph/ng_car.h b/sys/netgraph/ng_car.h
index b4ebb7d..3fda675 100644
--- a/sys/netgraph/ng_car.h
+++ b/sys/netgraph/ng_car.h
@@ -69,9 +69,9 @@ struct ng_car_bulkstats {
/* Per hook configuration */
struct ng_car_hookconf {
- u_int64_t cbs; /* Commited burst size (bytes) */
+ u_int64_t cbs; /* Committed burst size (bytes) */
u_int64_t ebs; /* Exceeded/Peak burst size (bytes) */
- u_int64_t cir; /* Commited information rate (bits/s) */
+ u_int64_t cir; /* Committed information rate (bits/s) */
u_int64_t pir; /* Peak information rate (bits/s) */
u_int8_t green_action; /* Action for green packets */
u_int8_t yellow_action; /* Action for yellow packets */
diff --git a/sys/netgraph/ng_etf.c b/sys/netgraph/ng_etf.c
index 2167b5d..66eab27 100644
--- a/sys/netgraph/ng_etf.c
+++ b/sys/netgraph/ng_etf.c
@@ -228,7 +228,7 @@ ng_etf_newhook(node_p node, hook_p hook, const char *name)
/*
* Get a netgraph control message.
- * We actually recieve a queue item that has a pointer to the message.
+ * We actually receive a queue item that has a pointer to the message.
* If we free the item, the message will be freed too, unless we remove
* it from the item using NGI_GET_MSG();
* The return address is also stored in the item, as an ng_ID_t,
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 430b859..42c4f0e 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -754,7 +754,7 @@ ng_ether_shutdown(node_p node)
if (node->nd_flags & NGF_REALLY_DIE) {
/*
* WE came here because the ethernet card is being unloaded,
- * so stop being persistant.
+ * so stop being persistent.
* Actually undo all the things we did on creation.
* Assume the ifp has already been freed.
*/
diff --git a/sys/netgraph/ng_frame_relay.c b/sys/netgraph/ng_frame_relay.c
index a4a84fe..b931e89 100644
--- a/sys/netgraph/ng_frame_relay.c
+++ b/sys/netgraph/ng_frame_relay.c
@@ -364,7 +364,7 @@ ngfrm_rcvdata(hook_p hook, item_p item)
data = mtod(m, char *);
/*
- * Shift the lowest bits into the address field untill we are done.
+ * Shift the lowest bits into the address field until we are done.
* First byte is MSBits of addr so work backwards.
*/
switch (alen) {
diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c
index 580b8b1..199546c 100644
--- a/sys/netgraph/ng_gif.c
+++ b/sys/netgraph/ng_gif.c
@@ -491,7 +491,7 @@ ng_gif_shutdown(node_p node)
if (node->nd_flags & NGF_REALLY_DIE) {
/*
* WE came here because the gif interface is being destroyed,
- * so stop being persistant.
+ * so stop being persistent.
* Actually undo all the things we did on creation.
* Assume the ifp has already been freed.
*/
diff --git a/sys/netgraph/ng_gif_demux.c b/sys/netgraph/ng_gif_demux.c
index 0a0644e..67de5a1 100644
--- a/sys/netgraph/ng_gif_demux.c
+++ b/sys/netgraph/ng_gif_demux.c
@@ -70,7 +70,7 @@
*
* Packets received on the "gif" hook have their type header removed
* and are passed to the appropriate hook protocol hook. Packets
- * recieved on a protocol hook have a type header added back and are
+ * received on a protocol hook have a type header added back and are
* passed out the gif hook. The currently supported protocol hooks are:
*/
diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c
index 0797842..af37f4d 100644
--- a/sys/netgraph/ng_ksocket.c
+++ b/sys/netgraph/ng_ksocket.c
@@ -632,7 +632,7 @@ ng_ksocket_connect(hook_p hook)
* first created and now (on another processesor) will
* be earlier on the queue than the request to finalise the hook.
* By the time the hook is finalised,
- * The queued upcalls will have happenned and the code
+ * The queued upcalls will have happened and the code
* will have discarded them because of a lack of a hook.
* (socket not open).
*
@@ -642,9 +642,9 @@ ng_ksocket_connect(hook_p hook)
* Since we are a netgraph operation
* We know that we hold a lock on this node. This forces the
* request we make below to be queued rather than implemented
- * immediatly which will cause the upcall function to be called a bit
+ * immediately which will cause the upcall function to be called a bit
* later.
- * However, as we will run any waiting queued operations immediatly
+ * However, as we will run any waiting queued operations immediately
* after doing this one, if we have not finalised the other end
* of the hook, those queued operations will fail.
*/
diff --git a/sys/netgraph/ng_l2tp.h b/sys/netgraph/ng_l2tp.h
index 106162b..45b66b0 100644
--- a/sys/netgraph/ng_l2tp.h
+++ b/sys/netgraph/ng_l2tp.h
@@ -54,7 +54,7 @@
#define NG_L2TP_HOOK_SESSION_P "session_" /* session data hook (prefix) */
#define NG_L2TP_HOOK_SESSION_F "session_%04x" /* session data hook (format) */
-/* Set intial sequence numbers to not yet enabled node. */
+/* Set initial sequence numbers to not yet enabled node. */
struct ng_l2tp_seq_config {
u_int16_t ns; /* sequence number to send next */
u_int16_t nr; /* sequence number to be recved next */
diff --git a/sys/netgraph/ng_lmi.c b/sys/netgraph/ng_lmi.c
index 6d3fb20..a51c024 100644
--- a/sys/netgraph/ng_lmi.c
+++ b/sys/netgraph/ng_lmi.c
@@ -429,7 +429,7 @@ ngauto_state_machine(sc_p sc)
break;
}
- /* send an inquirey encoded appropriatly */
+ /* send an inquirey encoded appropriately */
nglmi_inquire(sc, 0);
sc->poll_count--;
}
@@ -585,7 +585,7 @@ nglmi_rcvdata(hook_p hook, item_p item)
/* Now check if there is a 'locking shift'. This is only seen in
* Annex D frames. don't bother checking, we already did that. Don't
- * increment immediatly as it might not be there. */
+ * increment immediately as it might not be there. */
if (ANNEXD(sc))
STEPBY(1);
diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c
index ad1d3d8..5015751 100644
--- a/sys/netgraph/ng_one2many.c
+++ b/sys/netgraph/ng_one2many.c
@@ -44,7 +44,7 @@
* ng_one2many(4) netgraph node type
*
* Packets received on the "one" hook are sent out each of the
- * "many" hooks accoring to an algorithm. Packets received on any
+ * "many" hooks according to an algorithm. Packets received on any
* "many" hook are always delivered to the "one" hook.
*/
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c
index e1a8a2a..3e27237 100644
--- a/sys/netgraph/ng_ppp.c
+++ b/sys/netgraph/ng_ppp.c
@@ -152,7 +152,7 @@ static MALLOC_DEFINE(M_NETGRAPH_PPP, "netgraph_ppp", "netgraph ppp node");
((s) | ~MP_LONG_SEQ_MASK) \
: ((s) & MP_LONG_SEQ_MASK))
-/* Comparision of MP sequence numbers. Note: all sequence numbers
+/* Comparison of MP sequence numbers. Note: all sequence numbers
except priv->xseq are stored with the sign bit extended. */
#define MP_SHORT_SEQ_DIFF(x,y) MP_SHORT_EXTEND((x) - (y))
#define MP_LONG_SEQ_DIFF(x,y) MP_LONG_EXTEND((x) - (y))
@@ -211,7 +211,7 @@ struct ng_ppp_private {
struct ng_ppp_link links[NG_PPP_MAX_LINKS];/* per-link info */
int32_t xseq; /* next out MP seq # */
int32_t mseq; /* min links[i].seq */
- uint16_t activeLinks[NG_PPP_MAX_LINKS]; /* indicies */
+ uint16_t activeLinks[NG_PPP_MAX_LINKS]; /* indices */
uint16_t numActiveLinks; /* how many links up */
uint16_t lastLink; /* for round robin */
uint8_t vjCompHooked; /* VJ comp hooked up? */
@@ -254,7 +254,7 @@ static ng_rcvdata_t ng_ppp_rcvdata_decompress;
static ng_rcvdata_t ng_ppp_rcvdata_encrypt;
static ng_rcvdata_t ng_ppp_rcvdata_decrypt;
-/* We use integer indicies to refer to the non-link hooks. */
+/* We use integer indices to refer to the non-link hooks. */
static const struct {
char *const name;
ng_rcvdata_t *fn;
@@ -1511,7 +1511,7 @@ done:
* discarded, their missing fragments are declared lost and MSEQ
* is increased.
*
- * o If we recieve a fragment with seq# < MSEQ, we throw it away
+ * o If we receive a fragment with seq# < MSEQ, we throw it away
* because we've already delcared it lost.
*
* This assumes linkNum != NG_PPP_BUNDLE_LINKNUM.
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 382410c..9a23b1b 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -788,7 +788,7 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook)
}
/*
- * PPPOE_SERVICE advertisments are set up
+ * PPPOE_SERVICE advertisements are set up
* on sessions that are in PRIMED state.
*/
if (msg->header.cmd == NGM_PPPOE_SERVICE)
@@ -1729,7 +1729,7 @@ ng_pppoe_rcvdata_debug(hook_p hook, item_p item)
/*
* Do local shutdown processing..
- * If we are a persistant device, we might refuse to go away, and
+ * If we are a persistent device, we might refuse to go away, and
* we'd only remove our links and reset ourself.
*/
static int
diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c
index 6dc5b2d..0941d8e 100644
--- a/sys/netgraph/ng_pptpgre.c
+++ b/sys/netgraph/ng_pptpgre.c
@@ -124,7 +124,7 @@ typedef u_int64_t pptptime_t;
#define PPTP_MIN_TIMEOUT (PPTP_TIME_SCALE / 83) /* 12 milliseconds */
#define PPTP_MAX_TIMEOUT (3 * PPTP_TIME_SCALE) /* 3 seconds */
-/* When we recieve a packet, we wait to see if there's an outgoing packet
+/* When we receive a packet, we wait to see if there's an outgoing packet
we can piggy-back the ACK off of. These parameters determine the mimimum
and maxmimum length of time we're willing to wait in order to do that.
These have no effect unless "enableDelayedAck" is turned on. */
diff --git a/sys/netgraph/ng_sample.c b/sys/netgraph/ng_sample.c
index f0e4d50..8fa6622 100644
--- a/sys/netgraph/ng_sample.c
+++ b/sys/netgraph/ng_sample.c
@@ -241,7 +241,7 @@ ng_xxx_newhook(node_p node, hook_p hook, const char *name)
/*
* Get a netgraph control message.
- * We actually recieve a queue item that has a pointer to the message.
+ * We actually receive a queue item that has a pointer to the message.
* If we free the item, the message will be freed too, unless we remove
* it from the item using NGI_GET_MSG();
* The return address is also stored in the item, as an ng_ID_t,
@@ -404,8 +404,8 @@ devintr()
/*
* Do local shutdown processing..
* All our links and the name have already been removed.
- * If we are a persistant device, we might refuse to go away.
- * In the case of a persistant node we signal the framework that we
+ * If we are a persistent device, we might refuse to go away.
+ * In the case of a persistent node we signal the framework that we
* are still in business by clearing the NGF_INVALID bit. However
* If we find the NGF_REALLY_DIE bit set, this means that
* we REALLY need to die (e.g. hardware removed).
@@ -426,7 +426,7 @@ ng_xxx_shutdown(node_p node)
if (node->nd_flags & NGF_REALLY_DIE) {
/*
* WE came here because the widget card is being unloaded,
- * so stop being persistant.
+ * so stop being persistent.
* Actually undo all the things we did on creation.
*/
NG_NODE_SET_PRIVATE(node, NULL);
diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c
index 8332d20..ea341b6 100644
--- a/sys/netgraph/ng_source.c
+++ b/sys/netgraph/ng_source.c
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
/*
* This node is used for high speed packet geneneration. It queues
- * all data recieved on its 'input' hook and when told to start via
+ * all data received on its 'input' hook and when told to start via
* a control message it sends the packets out its 'output' hook. In
* this way this node can be preloaded with a packet stream which it
* can then send continuously as fast as possible.
diff --git a/sys/netgraph/ng_split.h b/sys/netgraph/ng_split.h
index c8b672c..d3082ae 100644
--- a/sys/netgraph/ng_split.h
+++ b/sys/netgraph/ng_split.h
@@ -40,6 +40,6 @@
/* My hook names */
#define NG_SPLIT_HOOK_MIXED "mixed" /* Mixed stream (in/out) */
#define NG_SPLIT_HOOK_OUT "out" /* Output to outhook (sending out) */
-#define NG_SPLIT_HOOK_IN "in" /* Input from inhook (recieving) */
+#define NG_SPLIT_HOOK_IN "in" /* Input from inhook (receiving) */
#endif /* _NETGRAPH_NG_SPLIT_H_ */
diff --git a/sys/netgraph/ng_tee.c b/sys/netgraph/ng_tee.c
index c6a517e..b5ea0ea 100644
--- a/sys/netgraph/ng_tee.c
+++ b/sys/netgraph/ng_tee.c
@@ -168,7 +168,7 @@ ng_tee_newhook(node_p node, hook_p hook, const char *name)
sc_p privdata = NG_NODE_PRIVATE(node);
hi_p hinfo;
- /* Precalculate internal pathes. */
+ /* Precalculate internal paths. */
if (strcmp(name, NG_TEE_HOOK_RIGHT) == 0) {
hinfo = &privdata->right;
if (privdata->left.dest)
@@ -371,7 +371,7 @@ ng_tee_disconnect(hook_p hook)
KASSERT(hinfo != NULL, ("%s: null info", __func__));
hinfo->hook = NULL;
- /* Recalculate internal pathes. */
+ /* Recalculate internal paths. */
if (sc->left.dest == hinfo) {
sc->left.dest = sc->left.dup;
sc->left.dup = NULL;
diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c
index 5e794a8..ec0792e 100644
--- a/sys/netgraph/ng_tty.c
+++ b/sys/netgraph/ng_tty.c
@@ -190,7 +190,7 @@ ngt_newhook(node_p node, hook_p hook, const char *name)
/*
* Set the hook into queueing mode (for outgoing packets),
- * so that we wont deliver mbuf thru the whole graph holding
+ * so that we wont deliver mbuf through the whole graph holding
* tty locks.
*/
static int
diff --git a/sys/netgraph/ng_vjc.c b/sys/netgraph/ng_vjc.c
index e689a10..1d8d3a9 100644
--- a/sys/netgraph/ng_vjc.c
+++ b/sys/netgraph/ng_vjc.c
@@ -348,7 +348,7 @@ ng_vjc_rcvmsg(node_p node, item_p item, hook_p lasthook)
sl = (struct slcompress *)resp->data;
*sl = *sl0;
- /* Replace pointers with integer indicies */
+ /* Replace pointers with integer indices */
if (sl->last_cs != NULL) {
index = sl0->last_cs - sl0->tstate;
bzero(&sl->last_cs, sizeof(sl->last_cs));
diff --git a/sys/netgraph/ng_vlan.c b/sys/netgraph/ng_vlan.c
index 1c10a0e..e2f8cb8 100644
--- a/sys/netgraph/ng_vlan.c
+++ b/sys/netgraph/ng_vlan.c
@@ -387,7 +387,7 @@ ng_vlan_rcvmsg(node_p node, item_p item, hook_p lasthook)
vlan_count ++;
}
- /* Allocate memory for responce. */
+ /* Allocate memory for response. */
NG_MKRESPONSE(resp, msg, sizeof(*t) +
vlan_count * sizeof(*t->filter), M_NOWAIT);
if (resp == NULL) {
@@ -395,7 +395,7 @@ ng_vlan_rcvmsg(node_p node, item_p item, hook_p lasthook)
break;
}
- /* Pack data to responce. */
+ /* Pack data to response. */
t = (struct ng_vlan_table *)resp->data;
t->n = 0;
vf = &t->filter[0];
@@ -565,7 +565,7 @@ ng_vlan_rcvdata(hook_p hook, item_p item)
if (priv->vlan_hook[vid] != NULL) {
/*
- * VLAN filter: allways remove vlan tags and
+ * VLAN filter: always remove vlan tags and
* decapsulate packet.
*/
dst_hook = priv->vlan_hook[vid];
diff --git a/sys/netinet/ip_icmp.h b/sys/netinet/ip_icmp.h
index a046432..64db006 100644
--- a/sys/netinet/ip_icmp.h
+++ b/sys/netinet/ip_icmp.h
@@ -140,9 +140,10 @@ struct icmp {
/*
* ICMP_ADVLENPREF is the preferred number of bytes which should be contiguous.
* SCTP needs additional 12 bytes to be able to access the initiate tag
- * in packets containing an INIT chunk.
+ * in packets containing an INIT chunk. For also supporting SCTP/UDP,
+ * additional 8 bytes are needed.
*/
-#define ICMP_ADVLENPREF(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8 + 12)
+#define ICMP_ADVLENPREF(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8 + 8 + 12)
/*
* Definition of type and code field values.
diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c
index 58bc8ae..680c4ad 100644
--- a/sys/netinet/sctp_asconf.c
+++ b/sys/netinet/sctp_asconf.c
@@ -244,7 +244,8 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struct sctp_asconf_paramhdr *ap
m_reply = sctp_asconf_error_response(aph->correlation_id,
SCTP_CAUSE_INVALID_PARAM, (uint8_t *) aph,
aparam_length);
- } else if (sctp_add_remote_addr(stcb, sa, &net, SCTP_DONOT_SETSCOPE,
+ } else if (sctp_add_remote_addr(stcb, sa, &net, stcb->asoc.port,
+ SCTP_DONOT_SETSCOPE,
SCTP_ADDR_DYNAMIC_ADDED) != 0) {
SCTPDBG(SCTP_DEBUG_ASCONF1,
"process_asconf_add_ip: error adding address\n");
diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c
index af76c54..deb73e7 100644
--- a/sys/netinet/sctp_bsd_addr.c
+++ b/sys/netinet/sctp_bsd_addr.c
@@ -298,7 +298,7 @@ sctp_addr_change(struct ifaddr *ifa, int cmd)
}
/*
* BSD only has one VRF, if this changes we will need to hook in the
- * right things here to get the id to pass to the address managment
+ * right things here to get the id to pass to the address management
* routine.
*/
if (SCTP_BASE_VAR(first_time) == 0) {
diff --git a/sys/netinet/sctp_cc_functions.c b/sys/netinet/sctp_cc_functions.c
index 0ad3e33..d550060 100644
--- a/sys/netinet/sctp_cc_functions.c
+++ b/sys/netinet/sctp_cc_functions.c
@@ -242,7 +242,7 @@ sctp_cwnd_update_after_fr(struct sctp_tcb *stcb,
}
/* Defines for instantaneous bw decisions */
-#define SCTP_INST_LOOSING 1 /* Loosing to other flows */
+#define SCTP_INST_LOOSING 1 /* Losing to other flows */
#define SCTP_INST_NEUTRAL 2 /* Neutral, no indication */
#define SCTP_INST_GAINING 3 /* Gaining, step down possible */
@@ -563,7 +563,7 @@ cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint6
return (0);
}
-/* RTCC Algoritm to limit growth of cwnd, return
+/* RTCC Algorithm to limit growth of cwnd, return
* true if you want to NOT allow cwnd growth
*/
static int
@@ -1110,7 +1110,7 @@ sctp_cwnd_update_after_ecn_echo_common(struct sctp_tcb *stcb, struct sctp_nets *
} else {
/*
* Further tuning down required over the drastic
- * orginal cut
+ * original cut
*/
net->ssthresh -= (net->mtu * num_pkt_lost);
net->cwnd -= (net->mtu * num_pkt_lost);
@@ -1290,7 +1290,7 @@ sctp_cwnd_update_after_sack(struct sctp_tcb *stcb,
struct sctp_association *asoc,
int accum_moved, int reneged_all, int will_exit)
{
- /* Passing a zero argument in last disables the rtcc algoritm */
+ /* Passing a zero argument in last disables the rtcc algorithm */
sctp_cwnd_update_after_sack_common(stcb, asoc, accum_moved, reneged_all, will_exit, 0);
}
@@ -1298,13 +1298,13 @@ static void
sctp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net,
int in_window, int num_pkt_lost)
{
- /* Passing a zero argument in last disables the rtcc algoritm */
+ /* Passing a zero argument in last disables the rtcc algorithm */
sctp_cwnd_update_after_ecn_echo_common(stcb, net, in_window, num_pkt_lost, 0);
}
/* Here starts the RTCCVAR type CC invented by RRS which
* is a slight mod to RFC2581. We reuse a common routine or
- * two since these algoritms are so close and need to
+ * two since these algorithms are so close and need to
* remain the same.
*/
static void
@@ -1510,7 +1510,7 @@ sctp_cwnd_update_rtcc_after_sack(struct sctp_tcb *stcb,
struct sctp_association *asoc,
int accum_moved, int reneged_all, int will_exit)
{
- /* Passing a one argument at the last enables the rtcc algoritm */
+ /* Passing a one argument at the last enables the rtcc algorithm */
sctp_cwnd_update_after_sack_common(stcb, asoc, accum_moved, reneged_all, will_exit, 1);
}
diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h
index 6c1a014..a58c206 100644
--- a/sys/netinet/sctp_constants.h
+++ b/sys/netinet/sctp_constants.h
@@ -275,7 +275,7 @@ __FBSDID("$FreeBSD$");
#define SCTP_DEFAULT_MULTIPLE_ASCONFS 0
/*
- * Theshold for rwnd updates, we have to read (sb_hiwat >>
+ * Threshold for rwnd updates, we have to read (sb_hiwat >>
* SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a
* window update sack. When we look, we compare the last rwnd we sent vs the
* current rwnd. It too must be greater than this value. Using 3 divdes the
@@ -513,7 +513,7 @@ __FBSDID("$FreeBSD$");
/* Maximum the mapping array will grow to (TSN mapping array) */
#define SCTP_MAPPING_ARRAY 512
-/* size of the inital malloc on the mapping array */
+/* size of the initial malloc on the mapping array */
#define SCTP_INITIAL_MAPPING_ARRAY 16
/* how much we grow the mapping array each call */
#define SCTP_MAPPING_ARRAY_INCR 32
@@ -638,7 +638,7 @@ __FBSDID("$FreeBSD$");
#define SCTP_DEF_PMTU_RAISE_SEC 600 /* 10 min between raise attempts */
-/* How many streams I request initally by default */
+/* How many streams I request initially by default */
#define SCTP_OSTREAM_INITIAL 10
#define SCTP_ISTREAM_INITIAL 2048
@@ -921,7 +921,7 @@ __FBSDID("$FreeBSD$");
* element. Each entry will take 2 4 byte ints (and of course the overhead
* of the next pointer as well). Using 15 as an example will yield * ((8 *
* 15) + 8) or 128 bytes of overhead for each timewait block that gets
- * initialized. Increasing it to 31 would yeild 256 bytes per block.
+ * initialized. Increasing it to 31 would yield 256 bytes per block.
*/
#define SCTP_NUMBER_IN_VTAG_BLOCK 15
/*
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
index a643358..cd6c5f9 100644
--- a/sys/netinet/sctp_indata.c
+++ b/sys/netinet/sctp_indata.c
@@ -481,7 +481,7 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb,
* FIX-ME maybe? What happens when the ssn wraps? If we are getting
* all the data in one stream this could happen quite rapidly. One
* could use the TSN to keep track of things, but this scheme breaks
- * down in the other type of stream useage that could occur. Send a
+ * down in the other type of stream usage that could occur. Send a
* single msg to stream 0, send 4Billion messages to stream 1, now
* send a message to stream 0. You have a situation where the TSN
* has wrapped but not in the stream. Is this worth worrying about
@@ -1343,7 +1343,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
* For IDATA we always check since we know
* that the first fragment is 0. For old
* DATA we have to receive the first before
- * we knwo the first FSN (which is the TSN).
+ * we know the first FSN (which is the TSN).
*/
if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) {
/*
@@ -1372,7 +1372,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
* For IDATA we always check since we know
* that the first fragment is 0. For old
* DATA we have to receive the first before
- * we knwo the first FSN (which is the TSN).
+ * we know the first FSN (which is the TSN).
*/
if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) {
@@ -2227,7 +2227,7 @@ sctp_slide_mapping_arrays(struct sctp_tcb *stcb)
* 1) Did we move the cum-ack point?
*
* When you first glance at this you might think that all entries that
- * make up the postion of the cum-ack would be in the nr-mapping
+ * make up the position of the cum-ack would be in the nr-mapping
* array only.. i.e. things up to the cum-ack are always
* deliverable. Thats true with one exception, when its a fragmented
* message we may not deliver the data until some threshold (or all
@@ -2534,7 +2534,7 @@ sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length,
/* copy the length and free up the old */
SCTP_BUF_LEN(m) = SCTP_BUF_LEN((*mm));
sctp_m_freem(*mm);
- /* sucess, back copy */
+ /* success, back copy */
*mm = m;
} else {
/* We are in trouble in the mbuf world .. yikes */
@@ -4694,7 +4694,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
}
if (TAILQ_EMPTY(&asoc->sent_queue) && (asoc->total_flight > 0)) {
#ifdef INVARIANTS
- panic("Warning flight size is postive and should be 0");
+ panic("Warning flight size is positive and should be 0");
#else
SCTP_PRINTF("Warning flight size incorrect should be 0 is %d\n",
asoc->total_flight);
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index a63d6b4..1fff331 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -465,7 +465,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
/* load all addresses */
if ((retval = sctp_load_addresses_from_init(stcb, m,
(offset + sizeof(struct sctp_init_chunk)), initack_limit,
- src, dst, NULL))) {
+ src, dst, NULL, stcb->asoc.port))) {
op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code),
"Problem with address parameters");
SCTPDBG(SCTP_DEBUG_INPUT1,
@@ -616,7 +616,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp,
if (f_net != r_net) {
/*
* first one on the list is NOT the primary
- * sctp_cmpaddr() is much more efficent if
+ * sctp_cmpaddr() is much more efficient if
* the primary is the first on the list,
* make it so.
*/
@@ -1082,7 +1082,7 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp SCTP_UNUSED,
/*
* Skip past the param header and then we will find the chunk that caused the
- * problem. There are two possiblities ASCONF or FWD-TSN other than that and
+ * problem. There are two possibilities ASCONF or FWD-TSN other than that and
* our peer must be broken.
*/
static void
@@ -1256,7 +1256,7 @@ sctp_handle_error(struct sctp_chunkhdr *ch,
* (or IPv4 for that matter) it does not matter. If
* they don't support that type of address, they can
* NOT possibly get that packet type... i.e. with no
- * IPv6 you can't recieve a IPv6 packet. so we can
+ * IPv6 you can't receive a IPv6 packet. so we can
* safely ignore this one. If we ever added support
* for HOSTNAME Addresses, then we would need to do
* something here.
@@ -1672,7 +1672,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
*/
if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk),
- initack_offset, src, dst, init_src)) {
+ initack_offset, src, dst, init_src, stcb->asoc.port)) {
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 4;
return (NULL);
@@ -1799,7 +1799,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
}
if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk),
- initack_offset, src, dst, init_src)) {
+ initack_offset, src, dst, init_src, stcb->asoc.port)) {
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 10;
return (NULL);
@@ -2011,7 +2011,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk),
- initack_offset, src, dst, init_src)) {
+ initack_offset, src, dst, init_src, stcb->asoc.port)) {
if (how_indx < sizeof(asoc->cookie_how))
asoc->cookie_how[how_indx] = 14;
@@ -2123,6 +2123,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
stcb = sctp_aloc_assoc(inp, init_src, &error,
ntohl(initack_cp->init.initiate_tag), vrf_id,
ntohs(initack_cp->init.num_outbound_streams),
+ port,
(struct thread *)NULL
);
if (stcb == NULL) {
@@ -2212,7 +2213,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
/* load all addresses */
if (sctp_load_addresses_from_init(stcb, m,
init_offset + sizeof(struct sctp_init_chunk), initack_offset,
- src, dst, init_src)) {
+ src, dst, init_src, port)) {
atomic_add_int(&stcb->asoc.refcnt, 1);
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
SCTP_TCB_UNLOCK(stcb);
@@ -2371,12 +2372,6 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
(*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
&cookie->time_entered, sctp_align_unsafe_makecopy,
SCTP_RTT_FROM_NON_DATA);
-#if defined(INET) || defined(INET6)
- if (((*netp)->port == 0) && (port != 0)) {
- sctp_pathmtu_adjustment(stcb, (uint16_t) ((*netp)->mtu - sizeof(struct udphdr)));
- }
- (*netp)->port = port;
-#endif
}
/* respond with a COOKIE-ACK */
sctp_send_cookie_ack(stcb);
@@ -2718,7 +2713,8 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
*/
if (netl == NULL) {
/* TSNH! Huh, why do I need to add this address here? */
- if (sctp_add_remote_addr(*stcb, to, NULL, SCTP_DONOT_SETSCOPE, SCTP_IN_COOKIE_PROC)) {
+ if (sctp_add_remote_addr(*stcb, to, NULL, port,
+ SCTP_DONOT_SETSCOPE, SCTP_IN_COOKIE_PROC)) {
return (NULL);
}
netl = sctp_findnet(*stcb, to);
@@ -4474,7 +4470,7 @@ sctp_handle_packet_dropped(struct sctp_pktdrop_chunk *cp,
(stcb->asoc.sat_t3_loss_recovery == 0) &&
(stcb->asoc.sat_network)) {
/*
- * This is debateable but for sat networks it makes sense
+ * This is debatable but for sat networks it makes sense
* Note if a T3 timer has went off, we will prohibit any
* changes to cwnd until we exit the t3 loss recovery.
*/
diff --git a/sys/netinet/sctp_lock_bsd.h b/sys/netinet/sctp_lock_bsd.h
index 35cdf5f..96e3521 100644
--- a/sys/netinet/sctp_lock_bsd.h
+++ b/sys/netinet/sctp_lock_bsd.h
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
* Most other locks (INP and INFO) attempt to localize the locking i.e. we try
* to contain the lock and unlock within the function that needs to lock it.
* This sometimes mean we do extra locks and unlocks and lose a bit of
- * efficency, but if the performance statements about non-recursive locks are
+ * efficiency, but if the performance statements about non-recursive locks are
* true this should not be a problem. One issue that arises with this only
* lock when needed is that if an implicit association setup is done we have
* a problem. If at the time I lookup an association I have NULL in the tcb
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index d91fb82..85ec065 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -3071,7 +3071,7 @@ bound_all_plan_b:
ifn, num_preferred);
if (num_preferred == 0) {
/* None on this interface. */
- SCTPDBG(SCTP_DEBUG_OUTPUT2, "No prefered -- skipping to next\n");
+ SCTPDBG(SCTP_DEBUG_OUTPUT2, "No preferred -- skipping to next\n");
continue;
}
SCTPDBG(SCTP_DEBUG_OUTPUT2,
@@ -3156,7 +3156,7 @@ again_with_private_addresses_allowed:
* It is restricted for some reason..
* probably not yet added.
*/
- SCTPDBG(SCTP_DEBUG_OUTPUT2, "Its resticted\n");
+ SCTPDBG(SCTP_DEBUG_OUTPUT2, "Its restricted\n");
sifa = NULL;
continue;
}
@@ -3677,7 +3677,7 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er
*error = EINVAL;
return (1);
}
- if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin, NULL,
+ if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin, NULL, stcb->asoc.port,
SCTP_DONOT_SETSCOPE, SCTP_ADDR_IS_CONFIRMED)) {
*error = ENOBUFS;
return (1);
@@ -3709,14 +3709,14 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er
*error = EINVAL;
return (1);
}
- if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin, NULL,
+ if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin, NULL, stcb->asoc.port,
SCTP_DONOT_SETSCOPE, SCTP_ADDR_IS_CONFIRMED)) {
*error = ENOBUFS;
return (1);
}
} else
#endif
- if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin6, NULL,
+ if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin6, NULL, stcb->asoc.port,
SCTP_DONOT_SETSCOPE, SCTP_ADDR_IS_CONFIRMED)) {
*error = ENOBUFS;
return (1);
@@ -5390,7 +5390,7 @@ sctp_are_there_new_addresses(struct sctp_association *asoc,
}
}
if (fnd == 0) {
- /* New address added! no need to look futher. */
+ /* New address added! no need to look further. */
return (1);
}
}
@@ -5631,7 +5631,7 @@ do_a_abort:
stc.peerport = sh->src_port;
/*
- * If we wanted to honor cookie life extentions, we would add to
+ * If we wanted to honor cookie life extensions, we would add to
* stc.cookie_life. For now we should NOT honor any extension
*/
stc.site_scope = stc.local_scope = stc.loopback_scope = 0;
@@ -6206,7 +6206,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb,
return;
}
} /* if chunk was present */
- } /* if of sufficent priority */
+ } /* if of sufficient priority */
} /* if chunk has enabled */
} /* tailqforeach */
@@ -6564,7 +6564,7 @@ error_out:
}
}
/*
- * save off the end and update the end-chain postion
+ * save off the end and update the end-chain position
*/
m = appendchain;
while (m) {
@@ -6576,7 +6576,7 @@ error_out:
}
return (outchain);
} else {
- /* save off the end and update the end-chain postion */
+ /* save off the end and update the end-chain position */
m = appendchain;
while (m) {
if (SCTP_BUF_NEXT(m) == NULL) {
@@ -6810,7 +6810,7 @@ sctp_sendall_completes(void *ptr, uint32_t val SCTP_UNUSED)
/*
* Do a notify here? Kacheong suggests that the notify be done at
* the send time.. so you would push up a notification if any send
- * failed. Don't know if this is feasable since the only failures we
+ * failed. Don't know if this is feasible since the only failures we
* have is "memory" related and if you cannot get an mbuf to send
* the data you surely can't get an mbuf to send up to notify the
* user you can't send the data :->
@@ -7468,7 +7468,7 @@ dont_do_it:
chk->copy_by_ref = 0;
}
/*
- * get last_mbuf and counts of mb useage This is ugly but hopefully
+ * get last_mbuf and counts of mb usage This is ugly but hopefully
* its only one mbuf.
*/
if (chk->last_mbuf == NULL) {
@@ -9537,7 +9537,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
cnt_thru = 0;
/* do we have control chunks to retransmit? */
if (m != NULL) {
- /* Start a timer no matter if we suceed or fail */
+ /* Start a timer no matter if we succeed or fail */
if (chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) {
sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, inp, stcb, chk->whoTo);
} else if (chk->rec.chunk_id.id == SCTP_ASCONF)
@@ -9802,7 +9802,7 @@ one_chunk_around:
/* Is there something to send for this destination? */
if (m) {
/*
- * No matter if we fail/or suceed we should start a
+ * No matter if we fail/or succeed we should start a
* timer. A failure is like a lost IP packet :-)
*/
if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) {
@@ -12765,8 +12765,8 @@ sctp_lower_sosend(struct socket *so,
#endif
stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
inp->sctp_ep.pre_open_stream_count,
- p
- );
+ inp->sctp_ep.port,
+ p);
if (stcb == NULL) {
/* Error is setup for us in the call */
goto out_unlocked;
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 2013fbc..704e5d9 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -330,7 +330,7 @@ sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr,
goto out;
}
if (sctp_ifap->ifn_p == NULL) {
- SCTPDBG(SCTP_DEBUG_PCB4, "IFA has no IFN - can't mark unuseable\n");
+ SCTPDBG(SCTP_DEBUG_PCB4, "IFA has no IFN - can't mark unusable\n");
goto out;
}
if (if_name) {
@@ -374,7 +374,7 @@ sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr,
goto out;
}
if (sctp_ifap->ifn_p == NULL) {
- SCTPDBG(SCTP_DEBUG_PCB4, "IFA has no IFN - can't mark unuseable\n");
+ SCTPDBG(SCTP_DEBUG_PCB4, "IFA has no IFN - can't mark unusable\n");
goto out;
}
if (if_name) {
@@ -3766,7 +3766,7 @@ sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id)
*/
int
sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
- struct sctp_nets **netp, int set_scope, int from)
+ struct sctp_nets **netp, uint16_t port, int set_scope, int from)
{
/*
* The following is redundant to the same lines in the
@@ -3944,7 +3944,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
stcb->asoc.numnets++;
net->ref_count = 1;
net->cwr_window_tsn = net->last_cwr_tsn = stcb->asoc.sending_seq - 1;
- net->port = stcb->asoc.port;
+ net->port = port;
net->dscp = stcb->asoc.default_dscp;
#ifdef INET6
net->flowlabel = stcb->asoc.default_flowlabel;
@@ -4045,7 +4045,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr,
stcb->asoc.smallest_mtu = net->mtu;
}
if (stcb->asoc.smallest_mtu > net->mtu) {
- stcb->asoc.smallest_mtu = net->mtu;
+ sctp_pathmtu_adjustment(stcb, net->mtu);
}
#ifdef INET6
if (newaddr->sa_family == AF_INET6) {
@@ -4191,7 +4191,7 @@ try_again:
struct sctp_tcb *
sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
int *error, uint32_t override_tag, uint32_t vrf_id,
- uint16_t o_streams,
+ uint16_t o_streams, uint16_t port,
struct thread *p
)
{
@@ -4384,7 +4384,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr,
LIST_INSERT_HEAD(head, stcb, sctp_asocs);
SCTP_INP_INFO_WUNLOCK();
- if ((err = sctp_add_remote_addr(stcb, firstaddr, NULL, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) {
+ if ((err = sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) {
/* failure.. memory error? */
if (asoc->strmout) {
SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
@@ -5772,7 +5772,7 @@ sctp_pcb_init()
{
/*
* SCTP initialization for the PCB structures should be called by
- * the sctp_init() funciton.
+ * the sctp_init() function.
*/
int i;
struct timeval tv;
@@ -6068,7 +6068,7 @@ int
sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
int offset, int limit,
struct sockaddr *src, struct sockaddr *dst,
- struct sockaddr *altsa)
+ struct sockaddr *altsa, uint16_t port)
{
/*
* grub through the INIT pulling addresses and loading them to the
@@ -6159,7 +6159,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
#ifdef INET
case AF_INET:
if (stcb->asoc.scope.ipv4_addr_legal) {
- if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_2)) {
+ if (sctp_add_remote_addr(stcb, sa, NULL, port, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_2)) {
return (-1);
}
}
@@ -6168,7 +6168,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
#ifdef INET6
case AF_INET6:
if (stcb->asoc.scope.ipv6_addr_legal) {
- if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_3)) {
+ if (sctp_add_remote_addr(stcb, sa, NULL, port, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_3)) {
return (-2);
}
}
@@ -6253,7 +6253,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
/* the assoc was freed? */
return (-7);
}
- if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_4)) {
+ if (sctp_add_remote_addr(stcb, sa, NULL, port, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_4)) {
return (-8);
}
} else if (stcb_tmp == stcb) {
@@ -6348,7 +6348,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m,
* we must add the address, no scope
* set
*/
- if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_5)) {
+ if (sctp_add_remote_addr(stcb, sa, NULL, port, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_5)) {
return (-17);
}
} else if (stcb_tmp == stcb) {
diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h
index a5810a7..9820409 100644
--- a/sys/netinet/sctp_pcb.h
+++ b/sys/netinet/sctp_pcb.h
@@ -107,7 +107,7 @@ struct sctp_ifa {
* that we MUST lock appropriate locks. This
* is for V6. */
union sctp_sockstore address;
- uint32_t refcount; /* number of folks refering to this */
+ uint32_t refcount; /* number of folks referring to this */
uint32_t flags;
uint32_t localifa_flags;
uint32_t vrf_id; /* vrf_id of this addr (for deleting) */
@@ -360,7 +360,7 @@ struct sctp_pcbtsn_rlog {
struct sctp_inpcb {
/*-
* put an inpcb in front of it all, kind of a waste but we need to
- * for compatability with all the other stuff.
+ * for compatibility with all the other stuff.
*/
union {
struct inpcb inp;
@@ -585,7 +585,7 @@ void sctp_inpcb_free(struct sctp_inpcb *, int, int);
struct sctp_tcb *
sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,
- int *, uint32_t, uint32_t, uint16_t, struct thread *);
+ int *, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *);
int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);
@@ -601,7 +601,7 @@ void sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t);
void sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *);
-int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets **, int, int);
+int sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets **, uint16_t, int, int);
void sctp_remove_net(struct sctp_tcb *, struct sctp_nets *);
@@ -616,7 +616,7 @@ void sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);
int
sctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int,
- struct sockaddr *, struct sockaddr *, struct sockaddr *);
+ struct sockaddr *, struct sockaddr *, struct sockaddr *, uint16_t);
int
sctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *,
diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h
index 87aa05b..39fc949 100644
--- a/sys/netinet/sctp_structs.h
+++ b/sys/netinet/sctp_structs.h
@@ -971,7 +971,7 @@ struct sctp_association {
uint32_t sat_t3_recovery_tsn;
uint32_t tsn_last_delivered;
/*
- * For the pd-api we should re-write this a bit more efficent. We
+ * For the pd-api we should re-write this a bit more efficient. We
* could have multiple sctp_queued_to_read's that we are building at
* once. Now we only do this when we get ready to deliver to the
* socket buffer. Note that we depend on the fact that the struct is
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index 9fa37e7..2d29fcb 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -1076,7 +1076,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp,
return (1);
}
/*
- * cleared theshold management now lets backoff the address & select
+ * cleared threshold management now lets backoff the address & select
* an alternate
*/
stcb->asoc.dropped_special_cnt = 0;
@@ -1122,7 +1122,7 @@ sctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
return (1);
}
/*
- * cleared theshold management now lets backoff the address & select
+ * cleared threshold management now lets backoff the address & select
* an alternate
*/
sctp_backoff_on_timeout(stcb, strrst->whoTo, 1, 0, 0);
@@ -1282,7 +1282,7 @@ sctp_shutdown_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
{
struct sctp_nets *alt;
- /* first threshold managment */
+ /* first threshold management */
if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
/* Assoc is over */
return (1);
@@ -1305,7 +1305,7 @@ sctp_shutdownack_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
{
struct sctp_nets *alt;
- /* first threshold managment */
+ /* first threshold management */
if (sctp_threshold_management(inp, stcb, net, stcb->asoc.max_send_times)) {
/* Assoc is over */
return (1);
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 85efd8e..49d3e42 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -1474,6 +1474,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
/* We are GOOD to go */
stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id,
inp->sctp_ep.pre_open_stream_count,
+ inp->sctp_ep.port,
(struct thread *)p
);
if (stcb == NULL) {
@@ -6999,7 +7000,9 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
}
vrf_id = inp->def_vrf_id;
/* We are GOOD to go */
- stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, p);
+ stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
+ inp->sctp_ep.pre_open_stream_count,
+ inp->sctp_ep.port, p);
if (stcb == NULL) {
/* Gak! no memory */
goto out_now;
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 77c62a1..b7b2c27 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -52,6 +52,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <sys/proc.h>
+#ifdef INET6
+#include <netinet/icmp6.h>
+#endif
#ifndef KTR_SCTP
@@ -1613,7 +1616,7 @@ sctp_timeout_handler(void *t)
return;
}
}
- /* record in stopped what t-o occured */
+ /* record in stopped what t-o occurred */
tmr->stopped_from = type;
/* mark as being serviced now */
@@ -6274,7 +6277,9 @@ sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr,
*error = EINVAL;
goto out_now;
}
- if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_ADDR_IS_CONFIRMED)) {
+ if (sctp_add_remote_addr(stcb, sa, NULL, stcb->asoc.port,
+ SCTP_DONOT_SETSCOPE,
+ SCTP_ADDR_IS_CONFIRMED)) {
/* assoc gone no un-lock */
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOBUFS);
(void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
@@ -6297,7 +6302,9 @@ sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr,
*error = EINVAL;
goto out_now;
}
- if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_ADDR_IS_CONFIRMED)) {
+ if (sctp_add_remote_addr(stcb, sa, NULL, stcb->asoc.port,
+ SCTP_DONOT_SETSCOPE,
+ SCTP_ADDR_IS_CONFIRMED)) {
/* assoc gone no un-lock */
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOBUFS);
(void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
@@ -6880,6 +6887,261 @@ out:
m_freem(m);
}
+#ifdef INET
+static void
+sctp_recv_icmp_tunneled_packet(int cmd, struct sockaddr *sa, void *vip, void *ctx SCTP_UNUSED)
+{
+ struct ip *outer_ip, *inner_ip;
+ struct sctphdr *sh;
+ struct icmp *icmp;
+ struct udphdr *udp;
+ struct sctp_inpcb *inp;
+ struct sctp_tcb *stcb;
+ struct sctp_nets *net;
+ struct sctp_init_chunk *ch;
+ struct sockaddr_in src, dst;
+ uint8_t type, code;
+
+ inner_ip = (struct ip *)vip;
+ icmp = (struct icmp *)((caddr_t)inner_ip -
+ (sizeof(struct icmp) - sizeof(struct ip)));
+ outer_ip = (struct ip *)((caddr_t)icmp - sizeof(struct ip));
+ if (ntohs(outer_ip->ip_len) <
+ sizeof(struct ip) + 8 + (inner_ip->ip_hl << 2) + sizeof(struct udphdr) + 8) {
+ return;
+ }
+ udp = (struct udphdr *)((caddr_t)inner_ip + (inner_ip->ip_hl << 2));
+ sh = (struct sctphdr *)(udp + 1);
+ memset(&src, 0, sizeof(struct sockaddr_in));
+ src.sin_family = AF_INET;
+ src.sin_len = sizeof(struct sockaddr_in);
+ src.sin_port = sh->src_port;
+ src.sin_addr = inner_ip->ip_src;
+ memset(&dst, 0, sizeof(struct sockaddr_in));
+ dst.sin_family = AF_INET;
+ dst.sin_len = sizeof(struct sockaddr_in);
+ dst.sin_port = sh->dest_port;
+ dst.sin_addr = inner_ip->ip_dst;
+ /*
+ * 'dst' holds the dest of the packet that failed to be sent. 'src'
+ * holds our local endpoint address. Thus we reverse the dst and the
+ * src in the lookup.
+ */
+ inp = NULL;
+ net = NULL;
+ stcb = sctp_findassociation_addr_sa((struct sockaddr *)&dst,
+ (struct sockaddr *)&src,
+ &inp, &net, 1,
+ SCTP_DEFAULT_VRFID);
+ if ((stcb != NULL) &&
+ (net != NULL) &&
+ (inp != NULL) &&
+ (inp->sctp_socket != NULL)) {
+ /* Check the UDP port numbers */
+ if ((udp->uh_dport != net->port) ||
+ (udp->uh_sport != htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)))) {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ /* Check the verification tag */
+ if (ntohl(sh->v_tag) != 0) {
+ /*
+ * This must be the verification tag used for
+ * sending out packets. We don't consider packets
+ * reflecting the verification tag.
+ */
+ if (ntohl(sh->v_tag) != stcb->asoc.peer_vtag) {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ } else {
+ if (ntohs(outer_ip->ip_len) >=
+ sizeof(struct ip) +
+ 8 + (inner_ip->ip_hl << 2) + 8 + 20) {
+ /*
+ * In this case we can check if we got an
+ * INIT chunk and if the initiate tag
+ * matches.
+ */
+ ch = (struct sctp_init_chunk *)(sh + 1);
+ if ((ch->ch.chunk_type != SCTP_INITIATION) ||
+ (ntohl(ch->init.initiate_tag) != stcb->asoc.my_vtag)) {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ } else {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ }
+ type = icmp->icmp_type;
+ code = icmp->icmp_code;
+ if ((type == ICMP_UNREACH) &&
+ (code == ICMP_UNREACH_PORT)) {
+ code = ICMP_UNREACH_PROTOCOL;
+ }
+ sctp_notify(inp, stcb, net, type, code,
+ ntohs(inner_ip->ip_len),
+ ntohs(icmp->icmp_nextmtu));
+ } else {
+ if ((stcb == NULL) && (inp != NULL)) {
+ /* reduce ref-count */
+ SCTP_INP_WLOCK(inp);
+ SCTP_INP_DECR_REF(inp);
+ SCTP_INP_WUNLOCK(inp);
+ }
+ if (stcb) {
+ SCTP_TCB_UNLOCK(stcb);
+ }
+ }
+ return;
+}
+
+#endif
+
+#ifdef INET6
+static void
+sctp_recv_icmp6_tunneled_packet(int cmd, struct sockaddr *sa, void *d, void *ctx SCTP_UNUSED)
+{
+ struct ip6ctlparam *ip6cp;
+ struct sctp_inpcb *inp;
+ struct sctp_tcb *stcb;
+ struct sctp_nets *net;
+ struct sctphdr sh;
+ struct udphdr udp;
+ struct sockaddr_in6 src, dst;
+ uint8_t type, code;
+
+ ip6cp = (struct ip6ctlparam *)d;
+ /*
+ * XXX: We assume that when IPV6 is non NULL, M and OFF are valid.
+ */
+ if (ip6cp->ip6c_m == NULL) {
+ return;
+ }
+ /*
+ * Check if we can safely examine the ports and the verification tag
+ * of the SCTP common header.
+ */
+ if (ip6cp->ip6c_m->m_pkthdr.len <
+ ip6cp->ip6c_off + sizeof(struct udphdr) + offsetof(struct sctphdr, checksum)) {
+ return;
+ }
+ /* Copy out the UDP header. */
+ memset(&udp, 0, sizeof(struct udphdr));
+ m_copydata(ip6cp->ip6c_m,
+ ip6cp->ip6c_off,
+ sizeof(struct udphdr),
+ (caddr_t)&udp);
+ /* Copy out the port numbers and the verification tag. */
+ memset(&sh, 0, sizeof(struct sctphdr));
+ m_copydata(ip6cp->ip6c_m,
+ ip6cp->ip6c_off + sizeof(struct udphdr),
+ sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t),
+ (caddr_t)&sh);
+ memset(&src, 0, sizeof(struct sockaddr_in6));
+ src.sin6_family = AF_INET6;
+ src.sin6_len = sizeof(struct sockaddr_in6);
+ src.sin6_port = sh.src_port;
+ src.sin6_addr = ip6cp->ip6c_ip6->ip6_src;
+ if (in6_setscope(&src.sin6_addr, ip6cp->ip6c_m->m_pkthdr.rcvif, NULL) != 0) {
+ return;
+ }
+ memset(&dst, 0, sizeof(struct sockaddr_in6));
+ dst.sin6_family = AF_INET6;
+ dst.sin6_len = sizeof(struct sockaddr_in6);
+ dst.sin6_port = sh.dest_port;
+ dst.sin6_addr = ip6cp->ip6c_ip6->ip6_dst;
+ if (in6_setscope(&dst.sin6_addr, ip6cp->ip6c_m->m_pkthdr.rcvif, NULL) != 0) {
+ return;
+ }
+ inp = NULL;
+ net = NULL;
+ stcb = sctp_findassociation_addr_sa((struct sockaddr *)&dst,
+ (struct sockaddr *)&src,
+ &inp, &net, 1, SCTP_DEFAULT_VRFID);
+ if ((stcb != NULL) &&
+ (net != NULL) &&
+ (inp != NULL) &&
+ (inp->sctp_socket != NULL)) {
+ /* Check the UDP port numbers */
+ if ((udp.uh_dport != net->port) ||
+ (udp.uh_sport != htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)))) {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ /* Check the verification tag */
+ if (ntohl(sh.v_tag) != 0) {
+ /*
+ * This must be the verification tag used for
+ * sending out packets. We don't consider packets
+ * reflecting the verification tag.
+ */
+ if (ntohl(sh.v_tag) != stcb->asoc.peer_vtag) {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ } else {
+ if (ip6cp->ip6c_m->m_pkthdr.len >=
+ ip6cp->ip6c_off + sizeof(struct udphdr) +
+ sizeof(struct sctphdr) +
+ sizeof(struct sctp_chunkhdr) +
+ offsetof(struct sctp_init, a_rwnd)) {
+ /*
+ * In this case we can check if we got an
+ * INIT chunk and if the initiate tag
+ * matches.
+ */
+ uint32_t initiate_tag;
+ uint8_t chunk_type;
+
+ m_copydata(ip6cp->ip6c_m,
+ ip6cp->ip6c_off +
+ sizeof(struct udphdr) +
+ sizeof(struct sctphdr),
+ sizeof(uint8_t),
+ (caddr_t)&chunk_type);
+ m_copydata(ip6cp->ip6c_m,
+ ip6cp->ip6c_off +
+ sizeof(struct udphdr) +
+ sizeof(struct sctphdr) +
+ sizeof(struct sctp_chunkhdr),
+ sizeof(uint32_t),
+ (caddr_t)&initiate_tag);
+ if ((chunk_type != SCTP_INITIATION) ||
+ (ntohl(initiate_tag) != stcb->asoc.my_vtag)) {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ } else {
+ SCTP_TCB_UNLOCK(stcb);
+ return;
+ }
+ }
+ type = ip6cp->ip6c_icmp6->icmp6_type;
+ code = ip6cp->ip6c_icmp6->icmp6_code;
+ if ((type == ICMP6_DST_UNREACH) &&
+ (code == ICMP6_DST_UNREACH_NOPORT)) {
+ type = ICMP6_PARAM_PROB;
+ code = ICMP6_PARAMPROB_NEXTHEADER;
+ }
+ sctp6_notify(inp, stcb, net, type, code,
+ (uint16_t) ntohl(ip6cp->ip6c_icmp6->icmp6_mtu));
+ } else {
+ if ((stcb == NULL) && (inp != NULL)) {
+ /* reduce inp's ref-count */
+ SCTP_INP_WLOCK(inp);
+ SCTP_INP_DECR_REF(inp);
+ SCTP_INP_WUNLOCK(inp);
+ }
+ if (stcb) {
+ SCTP_TCB_UNLOCK(stcb);
+ }
+ }
+}
+
+#endif
+
void
sctp_over_udp_stop(void)
{
@@ -6945,7 +7207,9 @@ sctp_over_udp_start(void)
}
/* Call the special UDP hook. */
if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp4_tun_socket),
- sctp_recv_udp_tunneled_packet, NULL))) {
+ sctp_recv_udp_tunneled_packet,
+ sctp_recv_icmp_tunneled_packet,
+ NULL))) {
sctp_over_udp_stop();
return (ret);
}
@@ -6969,7 +7233,9 @@ sctp_over_udp_start(void)
}
/* Call the special UDP hook. */
if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp6_tun_socket),
- sctp_recv_udp_tunneled_packet, NULL))) {
+ sctp_recv_udp_tunneled_packet,
+ sctp_recv_icmp6_tunneled_packet,
+ NULL))) {
sctp_over_udp_stop();
return (ret);
}
diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 0ade1d7..96da954 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -69,6 +69,20 @@ static MALLOC_DEFINE(M_LRO, "LRO", "LRO control structures");
static void tcp_lro_rx_done(struct lro_ctrl *lc);
+static __inline void
+tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_entry *le)
+{
+
+ LIST_INSERT_HEAD(&lc->lro_active, le, next);
+}
+
+static __inline void
+tcp_lro_active_remove(struct lro_entry *le)
+{
+
+ LIST_REMOVE(le, next);
+}
+
int
tcp_lro_init(struct lro_ctrl *lc)
{
@@ -129,7 +143,7 @@ tcp_lro_free(struct lro_ctrl *lc)
/* free active mbufs, if any */
while ((le = LIST_FIRST(&lc->lro_active)) != NULL) {
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
m_freem(le->m_head);
}
@@ -234,7 +248,7 @@ tcp_lro_rx_done(struct lro_ctrl *lc)
struct lro_entry *le;
while ((le = LIST_FIRST(&lc->lro_active)) != NULL) {
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
}
}
@@ -252,7 +266,7 @@ tcp_lro_flush_inactive(struct lro_ctrl *lc, const struct timeval *timeout)
timevalsub(&tv, timeout);
LIST_FOREACH_SAFE(le, &lc->lro_active, next, le_tmp) {
if (timevalcmp(&tv, &le->mtime, >=)) {
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
}
}
@@ -620,7 +634,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
/* Flush now if appending will result in overflow. */
if (le->p_len > (lc->lro_length_lim - tcp_data_len)) {
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
break;
}
@@ -629,7 +643,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
if (__predict_false(seq != le->next_seq ||
(tcp_data_len == 0 && le->ack_seq == th->th_ack))) {
/* Out of order packet or duplicate ACK. */
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
return (TCP_LRO_CANNOT);
}
@@ -662,7 +676,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
* be further delayed.
*/
if (le->append_cnt >= lc->lro_ackcnt_lim) {
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
}
return (0);
@@ -686,7 +700,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
* overflow, pro-actively flush now.
*/
if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) {
- LIST_REMOVE(le, next);
+ tcp_lro_active_remove(le);
tcp_lro_flush(lc, le);
} else
getmicrotime(&le->mtime);
@@ -701,7 +715,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
/* Start a new segment chain. */
le = LIST_FIRST(&lc->lro_free);
LIST_REMOVE(le, next);
- LIST_INSERT_HEAD(&lc->lro_active, le, next);
+ tcp_lro_active_insert(lc, le);
getmicrotime(&le->mtime);
/* Start filling in details. */
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 8c8b5d7..2c568da 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -127,7 +127,8 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies_only, CTLFLAG_VNET | CTLFLAG_RW,
static void syncache_drop(struct syncache *, struct syncache_head *);
static void syncache_free(struct syncache *);
static void syncache_insert(struct syncache *, struct syncache_head *);
-static int syncache_respond(struct syncache *, struct syncache_head *, int);
+static int syncache_respond(struct syncache *, struct syncache_head *, int,
+ const struct mbuf *);
static struct socket *syncache_socket(struct syncache *, struct socket *,
struct mbuf *m);
static void syncache_timeout(struct syncache *sc, struct syncache_head *sch,
@@ -457,7 +458,7 @@ syncache_timer(void *xsch)
free(s, M_TCPLOG);
}
- syncache_respond(sc, sch, 1);
+ syncache_respond(sc, sch, 1, NULL);
TCPSTAT_INC(tcps_sc_retransmitted);
syncache_timeout(sc, sch, 0);
}
@@ -1307,7 +1308,7 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
s, __func__);
free(s, M_TCPLOG);
}
- if (syncache_respond(sc, sch, 1) == 0) {
+ if (syncache_respond(sc, sch, 1, m) == 0) {
sc->sc_rxmits = 0;
syncache_timeout(sc, sch, 1);
TCPSTAT_INC(tcps_sndacks);
@@ -1474,7 +1475,7 @@ skip_alloc:
/*
* Do a standard 3-way handshake.
*/
- if (syncache_respond(sc, sch, 0) == 0) {
+ if (syncache_respond(sc, sch, 0, m) == 0) {
if (V_tcp_syncookies && V_tcp_syncookiesonly && sc != &scs)
syncache_free(sc);
else if (sc != &scs)
@@ -1505,7 +1506,8 @@ tfo_done:
}
static int
-syncache_respond(struct syncache *sc, struct syncache_head *sch, int locked)
+syncache_respond(struct syncache *sc, struct syncache_head *sch, int locked,
+ const struct mbuf *m0)
{
struct ip *ip = NULL;
struct mbuf *m;
@@ -1686,6 +1688,10 @@ syncache_respond(struct syncache *sc, struct syncache_head *sch, int locked)
M_SETFIB(m, sc->sc_inc.inc_fibnum);
m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
+ if (m0 != NULL && M_HASHTYPE_GET(m0) != M_HASHTYPE_NONE) {
+ m->m_pkthdr.flowid = m0->m_pkthdr.flowid;
+ M_HASHTYPE_SET(m, M_HASHTYPE_GET(m0));
+ }
#ifdef INET6
if (sc->sc_inc.inc_flags & INC_ISIPV6) {
m->m_pkthdr.csum_flags = CSUM_TCP_IPV6;
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index fdc2e76..503f059 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -792,6 +792,21 @@ udp_common_ctlinput(int cmd, struct sockaddr *sa, void *vip,
udp_notify(inp, inetctlerrmap[cmd]);
}
INP_RUNLOCK(inp);
+ } else {
+ inp = in_pcblookup(pcbinfo, faddr, uh->uh_dport,
+ ip->ip_src, uh->uh_sport,
+ INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL);
+ if (inp != NULL) {
+ struct udpcb *up;
+
+ up = intoudpcb(inp);
+ if (up->u_icmp_func != NULL) {
+ INP_RUNLOCK(inp);
+ (*up->u_icmp_func)(cmd, sa, vip, up->u_tun_ctx);
+ } else {
+ INP_RUNLOCK(inp);
+ }
+ }
}
} else
in_pcbnotifyall(pcbinfo, faddr, inetctlerrmap[cmd],
@@ -1748,7 +1763,7 @@ udp_attach(struct socket *so, int proto, struct thread *td)
#endif /* INET */
int
-udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, void *ctx)
+udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, udp_tun_icmp_t i, void *ctx)
{
struct inpcb *inp;
struct udpcb *up;
@@ -1759,11 +1774,13 @@ udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, void *ctx)
KASSERT(inp != NULL, ("udp_set_kernel_tunneling: inp == NULL"));
INP_WLOCK(inp);
up = intoudpcb(inp);
- if (up->u_tun_func != NULL) {
+ if ((up->u_tun_func != NULL) ||
+ (up->u_icmp_func != NULL)) {
INP_WUNLOCK(inp);
return (EBUSY);
}
up->u_tun_func = f;
+ up->u_icmp_func = i;
up->u_tun_ctx = ctx;
INP_WUNLOCK(inp);
return (0);
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index 40d35ef..6d19dee 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -55,14 +55,16 @@ struct udpiphdr {
struct inpcb;
struct mbuf;
-typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *,
+typedef void(*udp_tun_func_t)(struct mbuf *, int, struct inpcb *,
const struct sockaddr *, void *);
-
+typedef void(*udp_tun_icmp_t)(int, struct sockaddr *, void *, void *);
+
/*
* UDP control block; one per udp.
*/
struct udpcb {
udp_tun_func_t u_tun_func; /* UDP kernel tunneling callback. */
+ udp_tun_icmp_t u_icmp_func; /* UDP kernel tunneling icmp callback */
u_int u_flags; /* Generic UDP flags. */
uint16_t u_rxcslen; /* Coverage for incoming datagrams. */
uint16_t u_txcslen; /* Coverage for outgoing datagrams. */
@@ -179,7 +181,7 @@ struct inpcb *udp_notify(struct inpcb *inp, int errno);
int udp_shutdown(struct socket *so);
int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f,
- void *ctx);
+ udp_tun_icmp_t i, void *ctx);
#endif /* _KERNEL */
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index 3439f7e..647107d 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -919,7 +919,9 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p)
return (EALREADY);
}
/* We are GOOD to go */
- stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, p);
+ stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
+ inp->sctp_ep.pre_open_stream_count,
+ inp->sctp_ep.port, p);
SCTP_ASOC_CREATE_UNLOCK(inp);
if (stcb == NULL) {
/* Gak! no memory */
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 03479fd..347eb56 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -553,6 +553,29 @@ udp6_common_ctlinput(int cmd, struct sockaddr *sa, void *d,
bzero(&uh, sizeof(uh));
m_copydata(m, off, sizeof(*uhp), (caddr_t)&uh);
+ if (!PRC_IS_REDIRECT(cmd)) {
+ /* Check to see if its tunneled */
+ struct inpcb *inp;
+ inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_dst,
+ uh.uh_dport, &ip6->ip6_src, uh.uh_sport,
+ INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB,
+ m->m_pkthdr.rcvif, m);
+ if (inp != NULL) {
+ struct udpcb *up;
+
+ up = intoudpcb(inp);
+ if (up->u_icmp_func) {
+ /* Yes it is. */
+ INP_RUNLOCK(inp);
+ (*up->u_icmp_func)(cmd, (struct sockaddr *)ip6cp->ip6c_src,
+ d, up->u_tun_ctx);
+ return;
+ } else {
+ /* Can't find it. */
+ INP_RUNLOCK(inp);
+ }
+ }
+ }
(void)in6_pcbnotify(pcbinfo, sa, uh.uh_dport,
(struct sockaddr *)ip6cp->ip6c_src, uh.uh_sport, cmd,
cmdarg, notify);
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index 2d37c108..7ec8332 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -217,7 +217,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func,
from = NULL;
/*
- * Create socket and set its recieve timeout.
+ * Create socket and set its receive timeout.
*/
if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td)))
return error;
diff --git a/sys/nfs/nfs_nfssvc.c b/sys/nfs/nfs_nfssvc.c
index c0d78e0..82d3cce 100644
--- a/sys/nfs/nfs_nfssvc.c
+++ b/sys/nfs/nfs_nfssvc.c
@@ -70,7 +70,7 @@ int (*nfsd_call_nfscl)(struct thread *, struct nfssvc_args *) = NULL;
int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *) = NULL;
/*
- * Nfs server psuedo system call for the nfsd's
+ * Nfs server pseudo system call for the nfsd's
*/
int
sys_nfssvc(struct thread *td, struct nfssvc_args *uap)
diff --git a/sys/pc98/conf/NOTES b/sys/pc98/conf/NOTES
index 1dfc260..2abcb07 100644
--- a/sys/pc98/conf/NOTES
+++ b/sys/pc98/conf/NOTES
@@ -282,11 +282,6 @@ options EPSON_BOUNCEDMA
options EPSON_MEMWIN
#
-# PCI bus & PCI options:
-#
-device pci
-
-#
# AGP GART support
device agp
diff --git a/sys/powerpc/conf/NOTES b/sys/powerpc/conf/NOTES
index 75e774f..fbceea7 100644
--- a/sys/powerpc/conf/NOTES
+++ b/sys/powerpc/conf/NOTES
@@ -52,7 +52,6 @@ options SC_OFWFB # OFW frame buffer
device cpufreq
# Standard busses
-device pci
device agp
device bm # Apple BMAC (Big Mac Ethernet)
@@ -96,9 +95,6 @@ nodevice warp_saver
nodevice daemon_saver
nodevice star_saver
nodevice snake_saver
-# isa
-nodevice pcii
-nodevice tnt4882
# sound
nodevice snd_cmi
# wants gdb_cur
diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c
index 1acc180..c78899d 100644
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -162,7 +162,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
code = siginfo32.si_code;
sfp = (caddr_t)&sf32;
sfpsize = sizeof(sf32);
- rndfsize = ((sizeof(sf32) + 15) / 16) * 16;
+ rndfsize = roundup(sizeof(sf32), 16);
/*
* Save user context
@@ -189,9 +189,9 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
* 64-bit PPC defines a 288 byte scratch region
* below the stack.
*/
- rndfsize = 288 + ((sizeof(sf) + 47) / 48) * 48;
+ rndfsize = 288 + roundup(sizeof(sf), 48);
#else
- rndfsize = ((sizeof(sf) + 15) / 16) * 16;
+ rndfsize = roundup(sizeof(sf), 16);
#endif
/*
diff --git a/sys/rpc/clnt_dg.c b/sys/rpc/clnt_dg.c
index 36e63c6..d9d5e41 100644
--- a/sys/rpc/clnt_dg.c
+++ b/sys/rpc/clnt_dg.c
@@ -219,8 +219,8 @@ clnt_dg_create(
/*
* Should be multiple of 4 for XDR.
*/
- sendsz = ((sendsz + 3) / 4) * 4;
- recvsz = ((recvsz + 3) / 4) * 4;
+ sendsz = rounddown(sendsz + 3, 4);
+ recvsz = rounddown(recvsz + 3, 4);
cu = mem_alloc(sizeof (*cu));
cu->cu_threads = 0;
cu->cu_closing = FALSE;
diff --git a/sys/sparc64/conf/NOTES b/sys/sparc64/conf/NOTES
index 0b15f38..49557ed 100644
--- a/sys/sparc64/conf/NOTES
+++ b/sys/sparc64/conf/NOTES
@@ -20,7 +20,6 @@ cpu SUN4U
device ebus
device isa
-device pci
device sbus
device central
device fhc
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index 4255afd..77343e7 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -200,7 +200,7 @@ struct buf {
#define B_CACHE 0x00000020 /* Bread found us in the cache. */
#define B_VALIDSUSPWRT 0x00000040 /* Valid write during suspension. */
#define B_DELWRI 0x00000080 /* Delay I/O until buffer reused. */
-#define B_PERSISTENT 0x00000100 /* Perm. ref'ed while EXT2FS mounted. */
+#define B_00000100 0x00000100 /* Available flag. */
#define B_DONE 0x00000200 /* I/O completed. */
#define B_EINTR 0x00000400 /* I/O was interrupted */
#define B_NOREUSE 0x00000800 /* Contents not reused once released. */
@@ -213,7 +213,7 @@ struct buf {
#define B_00040000 0x00040000 /* Available flag. */
#define B_00080000 0x00080000 /* Available flag. */
#define B_00100000 0x00100000 /* Available flag. */
-#define B_DIRTY 0x00200000 /* Needs writing later (in EXT2FS). */
+#define B_00200000 0x00200000 /* Available flag. */
#define B_RELBUF 0x00400000 /* Release VMIO buffer. */
#define B_FS_FLAG1 0x00800000 /* Available flag for FS use. */
#define B_NOCOPY 0x01000000 /* Don't copy-on-write this buf. */
@@ -226,9 +226,9 @@ struct buf {
#define B_REMFREE 0x80000000 /* Delayed bremfree */
#define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \
- "\33paging\32infreecnt\31nocopy\30b23\27relbuf\26dirty\25b20" \
+ "\33paging\32infreecnt\31nocopy\30b23\27relbuf\26b21\25b20" \
"\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \
- "\15b12\14noreuse\13eintr\12done\11persist\10delwri" \
+ "\15b12\14noreuse\13eintr\12done\11b8\10delwri" \
"\7validsuspwrt\6cache\5deferred\4direct\3async\2needcommit\1age"
/*
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index b7d9756..2bfc14f 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -138,7 +138,7 @@ typedef int dumper_t(
#define D_TAPE 0x0001
#define D_DISK 0x0002
#define D_TTY 0x0004
-#define D_MEM 0x0008
+#define D_MEM 0x0008 /* /dev/(k)mem */
#ifdef _KERNEL
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index 55db0e3..2a44d80 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -34,6 +34,7 @@
#define _SYS_PROTOSW_H_
/* Forward declare these structures referenced from prototypes below. */
+struct kaiocb;
struct mbuf;
struct thread;
struct sockaddr;
@@ -228,12 +229,14 @@ struct pr_usrreqs {
struct thread *td);
int (*pru_connectat)(int fd, struct socket *so,
struct sockaddr *nam, struct thread *td);
+ int (*pru_aio_queue)(struct socket *so, struct kaiocb *job);
};
/*
* All nonvoid pru_*() functions below return EOPNOTSUPP.
*/
int pru_accept_notsupp(struct socket *so, struct sockaddr **nam);
+int pru_aio_queue_notsupp(struct socket *so, struct kaiocb *job);
int pru_attach_notsupp(struct socket *so, int proto, struct thread *td);
int pru_bind_notsupp(struct socket *so, struct sockaddr *nam,
struct thread *td);
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 176f16c..c675cfb 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -341,6 +341,7 @@ int getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp, u_int *fflagp);
void soabort(struct socket *so);
int soaccept(struct socket *so, struct sockaddr **nam);
+void soaio_enqueue(struct task *task);
void soaio_rcv(void *context, int pending);
void soaio_snd(void *context, int pending);
int socheckuid(struct socket *so, uid_t uid);
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 34ad5ba..1f05f69 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -189,6 +189,8 @@ void *hashinit_flags(int count, struct malloc_type *type,
#define HASH_WAITOK 0x00000002
void *phashinit(int count, struct malloc_type *type, u_long *nentries);
+void *phashinit_flags(int count, struct malloc_type *type, u_long *nentries,
+ int flags);
void g_waitidle(void);
void panic(const char *, ...) __dead2 __printflike(1, 2);
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index feaa14f..797a42b 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1231,7 +1231,7 @@ ffs_dirpref(pip)
* backwards or even to alternate looking forward and backward,
* this approach fails badly when the filesystem is nearly full.
* Specifically, we first search all the areas that have no space
- * and finally try the one preceeding that. We repeat this on
+ * and finally try the one preceding that. We repeat this on
* every request and in the case of the final block end up
* searching the entire filesystem. By jumping to the front
* of the filesystem, our future forward searches always look
@@ -1351,7 +1351,7 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
/*
* If we are at the beginning of a file, or we have already allocated
* the maximum number of blocks per cylinder group, or we do not
- * have a block allocated immediately preceeding us, then we need
+ * have a block allocated immediately preceding us, then we need
* to decide where to start allocating new blocks.
*/
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
@@ -1456,7 +1456,7 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
/*
* If we are at the beginning of a file, or we have already allocated
* the maximum number of blocks per cylinder group, or we do not
- * have a block allocated immediately preceeding us, then we need
+ * have a block allocated immediately preceding us, then we need
* to decide where to start allocating new blocks.
*/
if (indx % fs->fs_maxbpg == 0 || bap[indx - 1] == 0) {
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index cc6ad8a..64e9f15 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -13187,7 +13187,7 @@ softdep_request_cleanup(fs, vp, cred, resource)
*
* Additionally, if we are unpriviledged and allocating space,
* we need to ensure that we clean up enough blocks to get the
- * needed number of blocks over the threshhold of the minimum
+ * needed number of blocks over the threshold of the minimum
* number of blocks required to be kept free by the filesystem
* (fs_minfree).
*/
@@ -13888,7 +13888,7 @@ getdirtybuf(bp, lock, waitfor)
error = BUF_LOCK(bp,
LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK, lock);
/*
- * Even if we sucessfully acquire bp here, we have dropped
+ * Even if we successfully acquire bp here, we have dropped
* lock, which may violates our guarantee.
*/
if (error == 0)
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index b89dc33..c76683e 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -814,7 +814,7 @@ ffs_mountfs(devvp, mp, td)
goto out;
}
fs->fs_fmod = 0;
- fs->fs_flags &= ~FS_INDEXDIRS; /* no support for directory indicies */
+ fs->fs_flags &= ~FS_INDEXDIRS; /* no support for directory indices */
fs->fs_flags &= ~FS_UNCLEAN;
if (fs->fs_clean == 0) {
fs->fs_flags |= FS_UNCLEAN;
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h
index 835a8f9..620fee9 100644
--- a/sys/ufs/ffs/fs.h
+++ b/sys/ufs/ffs/fs.h
@@ -401,8 +401,8 @@ CTASSERT(sizeof(struct fs) == 1376);
* flag to enforce that inconsistent filesystems be mounted read-only.
* The FS_INDEXDIRS flag when set indicates that the kernel maintains
* on-disk auxiliary indexes (such as B-trees) for speeding directory
- * accesses. Kernels that do not support auxiliary indicies clear the
- * flag to indicate that the indicies need to be rebuilt (by fsck) before
+ * accesses. Kernels that do not support auxiliary indices clear the
+ * flag to indicate that the indices need to be rebuilt (by fsck) before
* they can be used.
*
* FS_ACLS indicates that POSIX.1e ACLs are administratively enabled
diff --git a/sys/ufs/ufs/dirhash.h b/sys/ufs/ufs/dirhash.h
index 4a53249..cd709c0 100644
--- a/sys/ufs/ufs/dirhash.h
+++ b/sys/ufs/ufs/dirhash.h
@@ -60,7 +60,7 @@
* together on a TAILQ list, and hashes with higher scores filter
* towards the tail (most recently used) end of the list.
*
- * New hash entries are given an inital score of DH_SCOREINIT and are
+ * New hash entries are given an initial score of DH_SCOREINIT and are
* placed at the most-recently-used end of the list. This helps a lot
* in the worst-case case scenario where every directory access is
* to a directory that is not hashed (i.e. the working set of hash
diff --git a/sys/ufs/ufs/ufs_acl.c b/sys/ufs/ufs/ufs_acl.c
index 47f0434..836b2c0 100644
--- a/sys/ufs/ufs/ufs_acl.c
+++ b/sys/ufs/ufs/ufs_acl.c
@@ -220,7 +220,7 @@ ufs_getacl_nfs4(struct vop_getacl_args *ap)
/*
* Read POSIX.1e ACL from an EA. Return error if its not found
- * or if any other error has occured.
+ * or if any other error has occurred.
*/
static int
ufs_get_oldacl(acl_type_t type, struct oldacl *old, struct vnode *vp,
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index a4f0d6e..2080fdf 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -299,7 +299,7 @@ old_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, int prot,
struct cdevsw *csw;
struct file *fpop;
struct thread *td;
- vm_memattr_t memattr;
+ vm_memattr_t memattr, memattr1;
int ref, ret;
memattr = object->memattr;
@@ -327,10 +327,18 @@ old_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, int prot,
/* If "paddr" is a real page, perform a sanity check on "memattr". */
if ((m_paddr = vm_phys_paddr_to_vm_page(paddr)) != NULL &&
- pmap_page_get_memattr(m_paddr) != memattr) {
- memattr = pmap_page_get_memattr(m_paddr);
- printf(
- "WARNING: A device driver has set \"memattr\" inconsistently.\n");
+ (memattr1 = pmap_page_get_memattr(m_paddr)) != memattr) {
+ /*
+ * For the /dev/mem d_mmap routine to return the
+ * correct memattr, pmap_page_get_memattr() needs to
+ * be called, which we do there.
+ */
+ if ((csw->d_flags & D_MEM) == 0) {
+ printf("WARNING: Device driver %s has set "
+ "\"memattr\" inconsistently (drv %u pmap %u).\n",
+ csw->d_name, memattr, memattr1);
+ }
+ memattr = memattr1;
}
if (((*mres)->flags & PG_FICTITIOUS) != 0) {
/*
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index f243eca..ae8adae 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -965,7 +965,7 @@ swap_pager_copy(vm_object_t srcobject, vm_object_t dstobject,
/*
* Free left over swap blocks in source.
*
- * We have to revert the type to OBJT_DEFAULT so we do not accidently
+ * We have to revert the type to OBJT_DEFAULT so we do not accidentally
* double-remove the object from the swap queues.
*/
if (destroysource) {
@@ -2623,7 +2623,7 @@ swapongeom_ev(void *arg, int flags)
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
g_attach(cp, pp);
/*
- * XXX: Everytime you think you can improve the margin for
+ * XXX: Every time you think you can improve the margin for
* footshooting, somebody depends on the ability to do so:
* savecore(8) wants to write to our swapdev so we cannot
* set an exclusive count :-(
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
index 262f8b0..bcc895e 100644
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -31,7 +31,7 @@
*
* This allocator is intended to replace the multitude of similar object caches
* in the standard FreeBSD kernel. The intent is to be flexible as well as
- * effecient. A primary design goal is to return unused memory to the rest of
+ * efficient. A primary design goal is to return unused memory to the rest of
* the system. This will make the system as a whole more flexible due to the
* ability to move memory to subsystems which most need it instead of leaving
* pools of reserved memory unused.
@@ -531,7 +531,7 @@ zone_timeout(uma_zone_t zone)
* hash A new hash structure with the old hash size in uh_hashsize
*
* Returns:
- * 1 on sucess and 0 on failure.
+ * 1 on success and 0 on failure.
*/
static int
hash_alloc(struct uma_hash *hash)
@@ -2257,7 +2257,7 @@ zalloc_start:
/*
* Now lets just fill a bucket and put it on the free list. If that
- * works we'll restart the allocation from the begining and it
+ * works we'll restart the allocation from the beginning and it
* will use the just filled bucket.
*/
bucket = zone_alloc_bucket(zone, udata, flags);
diff --git a/sys/vm/uma_int.h b/sys/vm/uma_int.h
index c4235ce..461558b 100644
--- a/sys/vm/uma_int.h
+++ b/sys/vm/uma_int.h
@@ -415,7 +415,7 @@ vsetslab(vm_offset_t va, uma_slab_t slab)
/*
* The following two functions may be defined by architecture specific code
- * if they can provide more effecient allocation functions. This is useful
+ * if they can provide more efficient allocation functions. This is useful
* for using direct mapped addresses.
*/
void *uma_small_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag,
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index e1538db..118348d 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -149,7 +149,7 @@ kernacc(addr, len, rw)
* the associated vm_map_entry range. It does not determine whether the
* contents of the memory is actually readable or writable. vmapbuf(),
* vm_fault_quick(), or copyin()/copout()/su*()/fu*() functions should be
- * used in conjuction with this call.
+ * used in conjunction with this call.
*/
int
useracc(addr, len, rw)
@@ -665,7 +665,7 @@ vm_forkproc(td, p2, td2, vm2, flags)
}
/*
- * Called after process has been wait(2)'ed apon and is being reaped.
+ * Called after process has been wait(2)'ed upon and is being reaped.
* The idea is to reclaim resources that we could not reclaim while
* the process was still executing.
*/
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index a536ebb..18404f8 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -3519,7 +3519,7 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize,
return (KERN_NO_SPACE);
/*
- * If we can't accomodate max_ssize in the current mapping, no go.
+ * If we can't accommodate max_ssize in the current mapping, no go.
* However, we need to be aware that subsequent user mappings might
* map into the space we have reserved for stack, and currently this
* space is not protected.
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 1b1d532..4a0479b 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2111,7 +2111,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset_t prev_offset,
/*
* If prev_object was charged, then this mapping,
- * althought not charged now, may become writable
+ * although not charged now, may become writable
* later. Non-NULL cred in the object would prevent
* swap reservation during enabling of the write
* access, so reserve swap now. Failed reservation
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 0d2b92e..2f3b17f 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1283,7 +1283,7 @@ vm_page_next(vm_page_t m)
{
vm_page_t next;
- VM_OBJECT_ASSERT_WLOCKED(m->object);
+ VM_OBJECT_ASSERT_LOCKED(m->object);
if ((next = TAILQ_NEXT(m, listq)) != NULL &&
next->pindex != m->pindex + 1)
next = NULL;
@@ -1301,7 +1301,7 @@ vm_page_prev(vm_page_t m)
{
vm_page_t prev;
- VM_OBJECT_ASSERT_WLOCKED(m->object);
+ VM_OBJECT_ASSERT_LOCKED(m->object);
if ((prev = TAILQ_PREV(m, pglist, listq)) != NULL &&
prev->pindex != m->pindex - 1)
prev = NULL;
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 972603a..4eb0050 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -141,7 +141,7 @@ struct vm_page {
vm_object_t object; /* which object am I in (O,P) */
vm_pindex_t pindex; /* offset into object (O,P) */
vm_paddr_t phys_addr; /* physical address of page */
- struct md_page md; /* machine dependant stuff */
+ struct md_page md; /* machine dependent stuff */
u_int wire_count; /* wired down maps refs (P) */
volatile u_int busy_lock; /* busy owners lock */
uint16_t hold_count; /* page hold count (P) */
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index e981e8b..ffdcb61 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -447,7 +447,7 @@ more:
++pageout_count;
++ib;
/*
- * alignment boundry, stop here and switch directions. Do
+ * alignment boundary, stop here and switch directions. Do
* not clear ib.
*/
if ((pindex - (ib - 1)) % vm_pageout_page_count == 0)
@@ -477,7 +477,7 @@ more:
/*
* If we exhausted our forward scan, continue with the reverse scan
- * when possible, even past a page boundry. This catches boundry
+ * when possible, even past a page boundary. This catches boundary
* conditions.
*/
if (ib && pageout_count < vm_pageout_page_count)
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index 66dd29d..f39afc2 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -819,7 +819,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count,
/*
* A sparse file can be encountered only for a single page request,
- * which may not be preceeded by call to vm_pager_haspage().
+ * which may not be preceded by call to vm_pager_haspage().
*/
if (bp->b_blkno == -1) {
KASSERT(count == 1,
@@ -1139,7 +1139,7 @@ vnode_pager_putpages(vm_object_t object, vm_page_t *m, int count,
* own vnodes if they fail to implement VOP_PUTPAGES.
*
* This is typically called indirectly via the pageout daemon and
- * clustering has already typically occured, so in general we ask the
+ * clustering has already typically occurred, so in general we ask the
* underlying filesystem to write the data out asynchronously rather
* then delayed.
*/
@@ -1182,7 +1182,7 @@ vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *ma, int bytecount,
/*
* If the page-aligned write is larger then the actual file we
- * have to invalidate pages occuring beyond the file EOF. However,
+ * have to invalidate pages occurring beyond the file EOF. However,
* there is an edge case where a file may not be page-aligned where
* the last page is partially invalid. In this case the filesystem
* may not properly clear the dirty bits for the entire page (which
diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c
index c1e796f..27fa127 100644
--- a/sys/x86/isa/atrtc.c
+++ b/sys/x86/isa/atrtc.c
@@ -151,6 +151,33 @@ atrtc_restore(void)
rtcin(RTC_INTR);
}
+void
+atrtc_set(struct timespec *ts)
+{
+ struct clocktime ct;
+
+ clock_ts_to_ct(ts, &ct);
+
+ /* Disable RTC updates and interrupts. */
+ writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
+
+ writertc(RTC_SEC, bin2bcd(ct.sec)); /* Write back Seconds */
+ writertc(RTC_MIN, bin2bcd(ct.min)); /* Write back Minutes */
+ writertc(RTC_HRS, bin2bcd(ct.hour)); /* Write back Hours */
+
+ writertc(RTC_WDAY, ct.dow + 1); /* Write back Weekday */
+ writertc(RTC_DAY, bin2bcd(ct.day)); /* Write back Day */
+ writertc(RTC_MONTH, bin2bcd(ct.mon)); /* Write back Month */
+ writertc(RTC_YEAR, bin2bcd(ct.year % 100)); /* Write back Year */
+#ifdef USE_RTC_CENTURY
+ writertc(RTC_CENTURY, bin2bcd(ct.year / 100)); /* ... and Century */
+#endif
+
+ /* Re-enable RTC updates and interrupts. */
+ writertc(RTC_STATUSB, rtc_statusb);
+ rtcin(RTC_INTR);
+}
+
/**********************************************************************
* RTC driver for subr_rtc
*/
@@ -297,28 +324,8 @@ atrtc_resume(device_t dev)
static int
atrtc_settime(device_t dev __unused, struct timespec *ts)
{
- struct clocktime ct;
-
- clock_ts_to_ct(ts, &ct);
-
- /* Disable RTC updates and interrupts. */
- writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
-
- writertc(RTC_SEC, bin2bcd(ct.sec)); /* Write back Seconds */
- writertc(RTC_MIN, bin2bcd(ct.min)); /* Write back Minutes */
- writertc(RTC_HRS, bin2bcd(ct.hour)); /* Write back Hours */
- writertc(RTC_WDAY, ct.dow + 1); /* Write back Weekday */
- writertc(RTC_DAY, bin2bcd(ct.day)); /* Write back Day */
- writertc(RTC_MONTH, bin2bcd(ct.mon)); /* Write back Month */
- writertc(RTC_YEAR, bin2bcd(ct.year % 100)); /* Write back Year */
-#ifdef USE_RTC_CENTURY
- writertc(RTC_CENTURY, bin2bcd(ct.year / 100)); /* ... and Century */
-#endif
-
- /* Reenable RTC updates and interrupts. */
- writertc(RTC_STATUSB, rtc_statusb);
- rtcin(RTC_INTR);
+ atrtc_set(ts);
return (0);
}
diff --git a/tests/Makefile b/tests/Makefile
index ba743ee..92e462f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/tests/etc/Makefile b/tests/etc/Makefile
index 7e73a48..6e02e32 100644
--- a/tests/etc/Makefile
+++ b/tests/etc/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/tests/sys/kern/Makefile b/tests/sys/kern/Makefile
index f38cc58..4a24a40 100644
--- a/tests/sys/kern/Makefile
+++ b/tests/sys/kern/Makefile
@@ -4,12 +4,14 @@ PACKAGE= tests
FILESGROUPS= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel
+.PATH: ${SRCTOP}/sys/kern
TESTSDIR= ${TESTSBASE}/sys/kern
ATF_TESTS_C+= kern_copyin
ATF_TESTS_C+= kern_descrip_test
ATF_TESTS_C+= ptrace_test
+PLAIN_TESTS_C+= subr_unit_test
ATF_TESTS_C+= unix_seqpacket_test
ATF_TESTS_C+= unix_passfd_test
TEST_METADATA.unix_seqpacket_test+= timeout="15"
@@ -23,6 +25,14 @@ NETBSD_ATF_TESTS_C+= mqueue_test
CFLAGS.mqueue_test+= -I${SRCTOP}/tests
LIBADD.mqueue_test+= rt
+# subr_unit.c contains functions whose prototypes lie in headers that cannot be
+# included in userland. But as far as subr_unit_test goes, they're effectively
+# static. So it's ok to disable -Wmissing-prototypes for this program.
+CFLAGS.subr_unit.c+= -Wno-missing-prototypes
+# XXX: -Wno-sign-compare will be eliminated as part of D6004
+CFLAGS.subr_unit.c+= -Wno-sign-compare
+SRCS.subr_unit_test+= subr_unit.c
+
WARNS?= 5
TESTS_SUBDIRS+= acct
diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot
index b75809b..4eeb550 100644
--- a/tools/build/mk/Makefile.boot
+++ b/tools/build/mk/Makefile.boot
@@ -5,5 +5,5 @@ DPADD+= ${WORLDTMP}/legacy/usr/lib/libegacy.a
LDADD+= -legacy
LDFLAGS+= -L${WORLDTMP}/legacy/usr/lib
-# we do not want to capture dependencies refering to the above
+# we do not want to capture dependencies referring to the above
UPDATE_DEPENDFILE= no
diff --git a/tools/regression/sockets/so_setfib/so_setfib.c b/tools/regression/sockets/so_setfib/so_setfib.c
index c56cf5b..ab1255b 100644
--- a/tools/regression/sockets/so_setfib/so_setfib.c
+++ b/tools/regression/sockets/so_setfib/so_setfib.c
@@ -175,7 +175,7 @@ main(int argc __unused, char *argv[] __unused)
return (0);
}
- /* Initalize randomness. */
+ /* Initialize randomness. */
srandomdev();
/* Get number of FIBs supported by kernel. */
diff --git a/tools/tools/fixwhite/fixwhite.1 b/tools/tools/fixwhite/fixwhite.1
index 3ad088d..016e24b 100644
--- a/tools/tools/fixwhite/fixwhite.1
+++ b/tools/tools/fixwhite/fixwhite.1
@@ -43,6 +43,6 @@ trailing whitespace characters from ever line of text.
Multiple successive empty lines are merged together.
If the whitespace at the beginning of a sentence is exactly a multiple
of eight spaces, the whitespace is replaced by tabs.
-Also, spaces preceeding tabs will be merged into the tab character.
+Also, spaces preceding tabs will be merged into the tab character.
.Sh AUTHORS
.An Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/tools/tools/fixwhite/fixwhite.c b/tools/tools/fixwhite/fixwhite.c
index 903a5a3..2b17630 100644
--- a/tools/tools/fixwhite/fixwhite.c
+++ b/tools/tools/fixwhite/fixwhite.c
@@ -95,7 +95,7 @@ savewhite(char c, bool leading)
savebyte(' ');
break;
case '\t':
- /* Convert preceeding spaces to tabs. */
+ /* Convert preceding spaces to tabs. */
ncolumn = (column / 8 + 1) * 8;
while (peekbyte(1, ' ')) {
queuelen--;
diff --git a/tools/tools/ipw/ipwstats.c b/tools/tools/ipw/ipwstats.c
index 3146d12..fe8c5a8 100644
--- a/tools/tools/ipw/ipwstats.c
+++ b/tools/tools/ipw/ipwstats.c
@@ -89,7 +89,7 @@ static const struct statistic tbl[] = {
{ 27, "Number of reassociation requests transmitted", INT },
{ 28, "Number of reassociation responses transmitted", INT },
{ 29, "Number of probe requests transmitted", INT },
- { 30, "Number of probe reponses transmitted", INT },
+ { 30, "Number of probe responses transmitted", INT },
{ 31, "Number of beacons transmitted", INT },
{ 32, "Number of ATIM frames transmitted", INT },
{ 33, "Number of disassociation requests transmitted", INT },
@@ -137,7 +137,7 @@ static const struct statistic tbl[] = {
{ 89, "Number of reassociation requests received", INT },
{ 90, "Number of reassociation responses received", INT },
{ 91, "Number of probe requests received", INT },
- { 92, "Number of probe reponses received", INT },
+ { 92, "Number of probe responses received", INT },
{ 93, "Number of beacons received", INT },
{ 94, "Number of ATIM frames received", INT },
{ 95, "Number of disassociation requests received", INT },
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 19cf887..a69ad8b 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -97,7 +97,7 @@ NANO_CUSTOMIZE=""
# Late customize commands.
NANO_LATE_CUSTOMIZE=""
-# Newfs paramters to use
+# Newfs parameters to use
NANO_NEWFS="-b 4096 -f 512 -i 8192 -U"
# The drive name of the media at runtime
@@ -348,7 +348,7 @@ build_kernel ( ) (
# Note: We intentionally build all modules, not only the ones in
# NANO_MODULES so the built world can be reused by multiple images.
- # Although MODULES_OVERRIDE can be defined in the kenrel config
+ # Although MODULES_OVERRIDE can be defined in the kernel config
# file to override this behavior. Just set NANO_MODULES=default.
set -o xtrace
cd "${NANO_SRC}"
diff --git a/tools/tools/nanobsd/dhcpd/common b/tools/tools/nanobsd/dhcpd/common
index 2658a84..c8c7598 100644
--- a/tools/tools/nanobsd/dhcpd/common
+++ b/tools/tools/nanobsd/dhcpd/common
@@ -229,7 +229,7 @@ add_port () {
local port_path=$1
local port=`echo $1 | sed -e 's/\//_/'`
shift
- # Check if package allready exist
+ # Check if package already exist
# Need to:
# 1. check ARCH of this package!
# 2. Add a trap
diff --git a/tools/tools/nanobsd/embedded/README b/tools/tools/nanobsd/embedded/README
index ebaba4c..78f6c31 100644
--- a/tools/tools/nanobsd/embedded/README
+++ b/tools/tools/nanobsd/embedded/README
@@ -35,13 +35,13 @@ qemu-sparc64.cfg Create a bootable sparc64 image for qemu
rpi.cfg Create a bootable image for Raspberry Pi B
rpi2.cfg Create a bootable image for Raspberry Pi2
sam9260ek.cfg Create a bootable image for an Atmel SAM9260-EK
- evaluation board (still needs a kenrel loaded
+ evaluation board (still needs a kernel loaded
into dataflash or NAND, so experimental).
sam9g20ek.cfg Create a bootable image for an Atmel SAM9G20-EK
- evaluation board (still needs a kenrel loaded
+ evaluation board (still needs a kernel loaded
into dataflash or NAND, so experimental). Also
works on many after-market boards that are somewhat
- compatible with the refernce board.
+ compatible with the references board.
QEMU command lines for serial console access
diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common
index 8bbb089..4050ae5 100644
--- a/tools/tools/nanobsd/embedded/common
+++ b/tools/tools/nanobsd/embedded/common
@@ -38,7 +38,7 @@
# Missing in base:
# o mkimg setting active partition
# o mkimg starting at arbitrary offset (needed for A10, et al)
-# o mtools still needed becuase we have no makefs -t msdos
+# o mtools still needed because we have no makefs -t msdos
# o nanobsd doesn't record changes to WORLDTEMP in customization
# scripts yet, so we have kludge to pick up all files
# o easy way for pkg to grab files from other repos and put that
diff --git a/tools/tools/netmap/pkt-gen.8 b/tools/tools/netmap/pkt-gen.8
new file mode 100644
index 0000000..3e61439
--- /dev/null
+++ b/tools/tools/netmap/pkt-gen.8
@@ -0,0 +1,179 @@
+.\" Copyright (c) 2016, George V. Neville-Neil
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 1, 2016
+.Dt PKT-GEN 8
+.Os
+.Sh NAME
+.Nm pkt-gen
+.Nd Packet generator for use with
+.Xr netmap 4
+.Sh SYNOPSIS
+.Bl -item -compact
+.It
+.Nm
+.Op Fl i Ar interface
+.Op Fl f Ar function
+.Op Fl n Ar count
+.Op Fl t Ar pkts_to_send
+.Op Fl r Ar pkts_to_receive
+.Op Fl l Ar pkt_size
+.Op Fl d Ar dst_ip[:port[-dst_ip:port]]
+.Op Fl s Ar src_ip[:port[-src_ip:port]]
+.Op Fl D Ar dst-mac
+.Op Fl S Ar src-mac
+.Op Fl a Ar cpu_id
+.Op Fl b Ar burst size
+.Op Fl c Ar cores
+.Op Fl p Ar threads
+.Op Fl T Ar report_ms
+.Op Fl P
+.Op Fl w Ar wait_for_link_time
+.Op Fl R Ar rate
+.Op Fl X
+.Op Fl H Ar len
+.Op Fl P Ar xfile
+.Op Fl z
+.Op Fl Z
+.Sh DESCRIPTION
+.Nm
+generates and receives raw network packets using
+.Xr netmap 4 .
+The arguments are as follows:
+.Pp
+.Bl -tag -width Ds
+.It Fl i Ar interface
+Network interface name.
+.It Fl f Ar function tx rx ping pong
+Set the function to transmit, receive of ping/pong.
+.It Fl n count
+Number of iterations (can be 0).
+.It Fl t pkts_to_send
+Number of packets to send. Also forces transmit mode.
+.It Fl r Ar pkts_to_receive
+Number of packets to receive. Also forces rx mode.
+.It Fl l Ar pkt_size
+Packet size in bytes excluding CRC.
+.It Fl d Ar dst_ip[:port[-dst_ip:port]]
+Destination IPv4 address and port, single or range.
+.It Fl s Ar src_ip[:port[-src_ip:port]]
+Source IPv4 address and port, single or range.
+.It Fl D Ar dst-mac
+Destination MAC address in colon notation.
+.It Fl S Ar src-mac
+Source MAC address in colon notation.
+.It Fl a Ar cpu_id
+Tie
+.Nm
+to a particular CPU core using
+.Xr setaffinity 2.
+.It Fl b Ar burst size
+Set the size of a burst of packets.
+.It Fl c Ar cores
+Number of cores to use.
+.It Fl p Ar threads
+Number of threads to use.
+.It Fl T Ar report_ms
+Number of milliseconds between reports.
+.It Fl P
+Use libpcap instead of netmap for reading or writing.
+.It Fl w Ar wait_for_link_time
+Number of seconds to wait to make sure that the network link is up. A
+network device driver may take some time to create a new
+transmit/receive ring pair when
+.Xr netmap 4
+requests one.
+.It Fl R Ar rate
+Packet transmission rate. Not setting the packet transmission rate tells
+.Nm
+to transmit packets as quickly as possible. On servers from 2010 on-wards
+.Xr netmap 4
+is able to completely use all of the bandwidth of a 10 or 40Gbps link,
+so this option should be used unless your intention is to saturate the link.
+.It Fl X
+Dump payload transmitted or received.
+.It Fl H Ar len
+Add empty virtio-net-header with size 'len'. This option is only use
+with Virtual Machine technologies that use virtio as a network interface.
+.It Fl P Ar file
+Load the packet from a pcap file rather than constructing it inside of
+.Nm
+.It Fl z
+Use random IPv4 src address/port
+.It Fl Z
+Use random IPv4 dst address/port
+.El
+.Pp
+.Nm
+is a raw packet generator that can utilize either
+.Xr netmap 4
+or
+.Xr bpf 4
+but which is most often uses with
+.Xr netmap 4 .
+The
+.Ar interface name
+used depends upon how the underlying Ethernet driver exposes its
+transmit and receive rings to
+.Xr netmap 4 .
+Most modern network interfaces that support 10Gbps and higher speeds
+have several transmit and receive rings that are used by the operating
+system to balance traffic across the interface.
+.Nm
+can peel off one or more of the transmit or receive rings for its own
+use without interfering with packets that might otherwise be destined
+for the host. For example on a system with a Chelsio Network
+Interface Card (NIC) the interface specification of
+.Ar -i netmap:ncxl0
+gives
+.Nm
+access to a pair of transmit and receive rings that are separate from
+the more commonly known cxl0 interface, which is used by the operating
+system's TCP/IP stack.
+.Sh EXAMPLES
+Capture and count all packets arriving on the operating system's cxl0
+interface. Using this will block packets from reaching the operating
+system's network stack.
+.Dl
+.Pp
+.Nm
+-i cxl0 -f rx
+.Pp
+Send a stream of fake DNS packets between two hosts with a packet
+length of 128 bytes. You must set the destination MAC address for
+packets to be received by the target host.
+.Pp
+.Dl
+.Nm
+-i netmap:ncxl0 -f tx -s 172.16.0.1:53 -d 172.16.1.3:53 -D 00:07:43:29:2a:e0
+.Sh FILES
+.Xr netmap 4
+.Sh SEE ALSO
+.Xr netmap 4
+.Sh AUTHORS
+This manual page was written by
+.An George V. Neville-Neil Aq gnn@FreeBSD.org .
diff --git a/tools/tools/shlib-compat/shlib-compat.py b/tools/tools/shlib-compat/shlib-compat.py
index 2d970b5..5df5524 100755
--- a/tools/tools/shlib-compat/shlib-compat.py
+++ b/tools/tools/shlib-compat/shlib-compat.py
@@ -936,7 +936,7 @@ class DwarfdumpParser(Parser):
tag.tag in DwarfdumpParser.external_tags)):
if offset in self.offsetmap:
raise ValueError("Dwarf dump parse error: " +
- "symbol is aleady defined at offset 0x%x" % offset)
+ "symbol is already defined at offset 0x%x" % offset)
self.offsetmap[offset] = tag
if len(self.stack) > 0:
prev = self.stack.pop()
diff --git a/tools/tools/wtap/vis_map/vis_map.c b/tools/tools/wtap/vis_map/vis_map.c
index 4a0109e..afba7d1 100644
--- a/tools/tools/wtap/vis_map/vis_map.c
+++ b/tools/tools/wtap/vis_map/vis_map.c
@@ -110,7 +110,7 @@ main(int argc, const char* argv[])
link_op(&l);
break;
default:
- printf("wtap ioctl: unkown command '%c'\n", *argv[1]);
+ printf("wtap ioctl: unknown command '%c'\n", *argv[1]);
exit(1);
}
exit(0);
diff --git a/tools/tools/wtap/wtap/wtap.c b/tools/tools/wtap/wtap/wtap.c
index 9e8ce5d..0bc9233 100644
--- a/tools/tools/wtap/wtap/wtap.c
+++ b/tools/tools/wtap/wtap/wtap.c
@@ -75,7 +75,7 @@ int main( int argc, const char* argv[])
delete(id);
break;
default:
- printf("wtap ioctl: unkown command '%c'\n", *argv[1]);
+ printf("wtap ioctl: unknown command '%c'\n", *argv[1]);
return -1;
}
return 0;
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 28cfa35..3918f0f 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -134,6 +134,7 @@ SUBDIR= alias \
rusers \
rwall \
script \
+ sdiff \
sed \
send-pr \
seq \
diff --git a/usr.bin/iscsictl/iscsictl.c b/usr.bin/iscsictl/iscsictl.c
index 12ede3c..8bd303d 100644
--- a/usr.bin/iscsictl/iscsictl.c
+++ b/usr.bin/iscsictl/iscsictl.c
@@ -771,7 +771,7 @@ main(int argc, char **argv)
xo_errx(1, "at most one of -A, -M, -R, or -L may be specified");
/*
- * Note that we ignore unneccessary/inapplicable "-c" flag; so that
+ * Note that we ignore unnecessary/inapplicable "-c" flag; so that
* people can do something like "alias ISCSICTL="iscsictl -c path"
* in shell scripts.
*/
diff --git a/usr.bin/localedef/charmap.c b/usr.bin/localedef/charmap.c
index 18db802..52839a9 100644
--- a/usr.bin/localedef/charmap.c
+++ b/usr.bin/localedef/charmap.c
@@ -324,7 +324,7 @@ add_charmap_char(const char *name, int val)
/*
* POSIX insists that certain entries be present, even when not in the
- * orginal charmap file.
+ * original charmap file.
*/
void
add_charmap_posix(void)
diff --git a/usr.bin/localedef/collate.c b/usr.bin/localedef/collate.c
index 32c583c..0eb6ea1 100644
--- a/usr.bin/localedef/collate.c
+++ b/usr.bin/localedef/collate.c
@@ -1120,7 +1120,7 @@ dump_collate(void)
collate_chain_t *chain;
/*
- * We have to run throught a preliminary pass to identify all the
+ * We have to run through a preliminary pass to identify all the
* weights that we use for each sorting level.
*/
for (i = 0; i < NUM_WT; i++) {
diff --git a/usr.bin/localedef/scanner.c b/usr.bin/localedef/scanner.c
index 0b57e5b..fa62089 100644
--- a/usr.bin/localedef/scanner.c
+++ b/usr.bin/localedef/scanner.c
@@ -181,7 +181,7 @@ static struct token {
/*
* These are keywords used in the charmap file. Note that
- * Solaris orginally used angle brackets to wrap some of them,
+ * Solaris originally used angle brackets to wrap some of them,
* but we removed that to simplify our parser. The first of these
* items are "global items."
*/
diff --git a/usr.bin/localedef/time.c b/usr.bin/localedef/time.c
index 6daf7ac..e40001d 100644
--- a/usr.bin/localedef/time.c
+++ b/usr.bin/localedef/time.c
@@ -262,7 +262,7 @@ dump_time(void)
* NOTE: If date_fmt is not specified, then we'll default to
* using the %c for date. This is reasonable for most
* locales, although for reasons that I don't understand
- * Solaris historically has had a seperate format for date.
+ * Solaris historically has had a separate format for date.
*/
if ((putl_category(tm.X_fmt, f) == EOF) ||
(putl_category(tm.x_fmt, f) == EOF) ||
diff --git a/usr.bin/localedef/wide.c b/usr.bin/localedef/wide.c
index 7102eb5..9d898fd 100644
--- a/usr.bin/localedef/wide.c
+++ b/usr.bin/localedef/wide.c
@@ -92,7 +92,7 @@ static struct {
{ "EUC-CN", "EUC-CN", 16, towide_euccn, tomb_mbs },
{ "eucCN", "EUC-CN", 16, towide_euccn, tomb_mbs },
/*
- * Becuase the 3-byte form of EUC-JP use the same leading byte,
+ * Because the 3-byte form of EUC-JP use the same leading byte,
* only 17 bits required to provide unique priorities. (The low
* bit of that first byte is set.) By setting this value low,
* we can get by with only 3 bytes in the strxfrm expansion.
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c
index d50138a..f3d72b6 100644
--- a/usr.bin/m4/eval.c
+++ b/usr.bin/m4/eval.c
@@ -895,7 +895,7 @@ dosub(const char *argv[], int argc)
* function of ICON language. Within mapvec, we replace every character
* of "from" with the corresponding character in "to".
* If "to" is shorter than "from", than the corresponding entries are null,
- * which means that those characters dissapear altogether.
+ * which means that those characters disappear altogether.
*/
static void
map(char *dest, const char *src, const char *from, const char *to)
diff --git a/usr.bin/newgrp/newgrp.c b/usr.bin/newgrp/newgrp.c
index 9b3972e..8fc90f3 100644
--- a/usr.bin/newgrp/newgrp.c
+++ b/usr.bin/newgrp/newgrp.c
@@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <grp.h>
-#include <libgen.h>
#include <limits.h>
#include <login_cap.h>
#include <paths.h>
@@ -290,7 +289,7 @@ loginshell(void)
if (ticket != NULL)
setenv("KRBTKFILE", ticket, 1);
- if (asprintf(args, "-%s", basename(shell)) < 0)
+ if (asprintf(args, "-%s", shell) < 0)
err(1, "asprintf");
args[1] = NULL;
@@ -306,6 +305,6 @@ doshell(void)
shell = pwd->pw_shell;
if (*shell == '\0')
shell = _PATH_BSHELL;
- execl(shell, basename(shell), (char *)NULL);
+ execl(shell, shell, (char *)NULL);
err(1, "%s", shell);
}
diff --git a/usr.bin/sdiff/Makefile b/usr.bin/sdiff/Makefile
new file mode 100644
index 0000000..bc7d1dc
--- /dev/null
+++ b/usr.bin/sdiff/Makefile
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+PROG= sdiff
+SRCS= common.c edit.c sdiff.c
+WARNS= 3
+
+LIBADD= util
+MAN1= sdiff.1
+
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
+.include <bsd.progs.mk>
diff --git a/usr.bin/sdiff/common.c b/usr.bin/sdiff/common.c
new file mode 100644
index 0000000..686965c
--- /dev/null
+++ b/usr.bin/sdiff/common.c
@@ -0,0 +1,24 @@
+/* $OpenBSD: common.c,v 1.4 2006/05/25 03:20:32 ray Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "common.h"
+
+void
+cleanup(const char *filename)
+{
+
+ if (unlink(filename))
+ err(2, "could not delete: %s", filename);
+ exit(2);
+}
diff --git a/usr.bin/sdiff/common.h b/usr.bin/sdiff/common.h
new file mode 100644
index 0000000..127c1f4
--- /dev/null
+++ b/usr.bin/sdiff/common.h
@@ -0,0 +1,9 @@
+/* $OpenBSD: common.h,v 1.2 2006/05/25 03:20:32 ray Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+void cleanup(const char *) __dead2;
diff --git a/usr.bin/sdiff/edit.c b/usr.bin/sdiff/edit.c
new file mode 100644
index 0000000..4d7fb5b
--- /dev/null
+++ b/usr.bin/sdiff/edit.c
@@ -0,0 +1,209 @@
+/* $OpenBSD: edit.c,v 1.19 2009/06/07 13:29:50 ray Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <paths.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "common.h"
+#include "extern.h"
+
+int editit(const char *);
+
+/*
+ * Execute an editor on the specified pathname, which is interpreted
+ * from the shell. This means flags may be included.
+ *
+ * Returns -1 on error, or the exit value on success.
+ */
+int
+editit(const char *pathname)
+{
+ char *argp[] = {"sh", "-c", NULL, NULL}, *ed, *p;
+ sig_t sighup, sigint, sigquit, sigchld;
+ pid_t pid;
+ int saved_errno, st, ret = -1;
+
+ ed = getenv("VISUAL");
+ if (ed == NULL || ed[0] == '\0')
+ ed = getenv("EDITOR");
+ if (ed == NULL || ed[0] == '\0')
+ ed = _PATH_VI;
+ if (asprintf(&p, "%s %s", ed, pathname) == -1)
+ return (-1);
+ argp[2] = p;
+
+ sighup = signal(SIGHUP, SIG_IGN);
+ sigint = signal(SIGINT, SIG_IGN);
+ sigquit = signal(SIGQUIT, SIG_IGN);
+ sigchld = signal(SIGCHLD, SIG_DFL);
+ if ((pid = fork()) == -1)
+ goto fail;
+ if (pid == 0) {
+ execv(_PATH_BSHELL, argp);
+ _exit(127);
+ }
+ while (waitpid(pid, &st, 0) == -1)
+ if (errno != EINTR)
+ goto fail;
+ if (!WIFEXITED(st))
+ errno = EINTR;
+ else
+ ret = WEXITSTATUS(st);
+
+ fail:
+ saved_errno = errno;
+ (void)signal(SIGHUP, sighup);
+ (void)signal(SIGINT, sigint);
+ (void)signal(SIGQUIT, sigquit);
+ (void)signal(SIGCHLD, sigchld);
+ free(p);
+ errno = saved_errno;
+ return (ret);
+}
+
+/*
+ * Parse edit command. Returns 0 on success, -1 on error.
+ */
+int
+eparse(const char *cmd, const char *left, const char *right)
+{
+ FILE *file;
+ size_t nread;
+ int fd;
+ char *filename;
+ char buf[BUFSIZ], *text;
+
+ /* Skip whitespace. */
+ while (isspace(*cmd))
+ ++cmd;
+
+ text = NULL;
+ switch (*cmd) {
+ case '\0':
+ /* Edit empty file. */
+ break;
+
+ case 'b':
+ /* Both strings. */
+ if (left == NULL)
+ goto RIGHT;
+ if (right == NULL)
+ goto LEFT;
+
+ /* Neither column is blank, so print both. */
+ if (asprintf(&text, "%s\n%s\n", left, right) == -1)
+ err(2, "could not allocate memory");
+ break;
+
+ case 'l':
+LEFT:
+ /* Skip if there is no left column. */
+ if (left == NULL)
+ break;
+
+ if (asprintf(&text, "%s\n", left) == -1)
+ err(2, "could not allocate memory");
+
+ break;
+
+ case 'r':
+RIGHT:
+ /* Skip if there is no right column. */
+ if (right == NULL)
+ break;
+
+ if (asprintf(&text, "%s\n", right) == -1)
+ err(2, "could not allocate memory");
+
+ break;
+
+ default:
+ return (-1);
+ }
+
+ /* Create temp file. */
+ if (asprintf(&filename, "%s/sdiff.XXXXXXXXXX", tmpdir) == -1)
+ err(2, "asprintf");
+ if ((fd = mkstemp(filename)) == -1)
+ err(2, "mkstemp");
+ if (text != NULL) {
+ size_t len;
+ ssize_t nwritten;
+
+ len = strlen(text);
+ if ((nwritten = write(fd, text, len)) == -1 ||
+ (size_t)nwritten != len) {
+ warn("error writing to temp file");
+ cleanup(filename);
+ }
+ }
+ close(fd);
+
+ /* text is no longer used. */
+ free(text);
+
+ /* Edit temp file. */
+ if (editit(filename) == -1) {
+ warn("error editing %s", filename);
+ cleanup(filename);
+ }
+
+ /* Open temporary file. */
+ if (!(file = fopen(filename, "r"))) {
+ warn("could not open edited file: %s", filename);
+ cleanup(filename);
+ }
+
+ /* Copy temporary file contents to output file. */
+ for (nread = sizeof(buf); nread == sizeof(buf);) {
+ size_t nwritten;
+
+ nread = fread(buf, sizeof(*buf), sizeof(buf), file);
+ /* Test for error or end of file. */
+ if (nread != sizeof(buf) &&
+ (ferror(file) || !feof(file))) {
+ warnx("error reading edited file: %s", filename);
+ cleanup(filename);
+ }
+
+ /*
+ * If we have nothing to read, break out of loop
+ * instead of writing nothing.
+ */
+ if (!nread)
+ break;
+
+ /* Write data we just read. */
+ nwritten = fwrite(buf, sizeof(*buf), nread, outfp);
+ if (nwritten != nread) {
+ warnx("error writing to output file");
+ cleanup(filename);
+ }
+ }
+
+ /* We've reached the end of the temporary file, so remove it. */
+ if (unlink(filename))
+ warn("could not delete: %s", filename);
+ fclose(file);
+
+ free(filename);
+
+ return (0);
+}
diff --git a/usr.bin/sdiff/extern.h b/usr.bin/sdiff/extern.h
new file mode 100644
index 0000000..2f24091
--- /dev/null
+++ b/usr.bin/sdiff/extern.h
@@ -0,0 +1,12 @@
+/* $OpenBSD: extern.h,v 1.5 2009/06/07 13:29:50 ray Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+extern FILE *outfp; /* file to save changes to */
+extern const char *tmpdir;
+
+int eparse(const char *, const char *, const char *);
diff --git a/usr.bin/sdiff/sdiff.1 b/usr.bin/sdiff/sdiff.1
new file mode 100644
index 0000000..16e340a
--- /dev/null
+++ b/usr.bin/sdiff/sdiff.1
@@ -0,0 +1,174 @@
+.\" $FreeBSD$
+.\" $OpenBSD: sdiff.1,v 1.15 2007/06/29 14:48:07 jmc Exp $
+.\"
+.\" Written by Raymond Lai <ray@cyth.net>.
+.\" Public domain.
+.\"
+.Dd $Mdocdate: July 5 2012 $
+.Dt SDIFF 1
+.Os
+.Sh NAME
+.Nm sdiff
+.Nd side-by-side diff
+.Sh SYNOPSIS
+.Nm
+.Op Fl abdilstW
+.Op Fl I Ar regexp
+.Op Fl o Ar outfile
+.Op Fl w Ar width
+.Ar file1
+.Ar file2
+.Sh DESCRIPTION
+.Nm
+displays two files side by side,
+with any differences between the two highlighted as follows:
+new lines are marked with
+.Sq \*(Gt ;
+deleted lines are marked with
+.Sq \*(Lt ;
+and changed lines are marked with
+.Sq \*(Ba .
+.Pp
+.Nm
+can also be used to interactively merge two files,
+prompting at each set of differences.
+See the
+.Fl o
+option for an explanation.
+.Pp
+The options are:
+.Bl -tag -width Ds
+.It Fl l -left-column
+Only print the left column for identical lines.
+.It Fl o -output Ar outfile
+Interactively merge
+.Ar file1
+and
+.Ar file2
+into
+.Ar outfile .
+In this mode, the user is prompted for each set of differences.
+See
+.Ev EDITOR
+and
+.Ev VISUAL ,
+below,
+for details of which editor, if any, is invoked.
+.Pp
+The commands are as follows:
+.Bl -tag -width Ds
+.It Cm l | 1
+Choose left set of diffs.
+.It Cm r | 2
+Choose right set of diffs.
+.It Cm s
+Silent mode \(en identical lines are not printed.
+.It Cm v
+Verbose mode \(en identical lines are printed.
+.It Cm e
+Start editing an empty file, which will be merged into
+.Ar outfile
+upon exiting the editor.
+.It Cm e Cm l
+Start editing file with left set of diffs.
+.It Cm e Cm r
+Start editing file with right set of diffs.
+.It Cm e Cm b
+Start editing file with both sets of diffs.
+.It Cm q
+Quit
+.Nm .
+.El
+.It Fl s -suppress-common-lines
+Skip identical lines.
+.It Fl w -width Ar width
+Print a maximum of
+.Ar width
+characters on each line.
+The default is 130 characters.
+.El
+.Pp
+Options passed to
+.Xr diff 1
+are:
+.Bl -tag -width Ds
+.It Fl a -text
+Treat
+.Ar file1
+and
+.Ar file2
+as text files.
+.It Fl b -ignore-space-change
+Ignore trailing blank spaces.
+.It Fl d -minimal
+Minimize diff size.
+.It Fl I -ignore-matching-lines Ar regexp
+Ignore line changes matching
+.Ar regexp .
+All lines in the change must match
+.Ar regexp
+for the change to be ignored.
+.It Fl i -ignore-case
+Do a case-insensitive comparison.
+.It Fl t -expand-tabs
+Expand tabs to spaces.
+.It Fl W -ignore-all-space
+Ignore all spaces.
+.It Fl B -ignore-blank-lines
+Ignore blank lines.
+.It Fl E -ignore-tab-expansion
+Treat tabs and eight spaces as the same.
+.It Fl t -ignore-tabs
+Ignore tabs.
+.It Fl H -speed-large-files
+Assume scattered small changes in a large file.
+.It Fl -ignore-file-name-case
+Ignore the case of file names.
+.It Fl -no-ignore-file-name-case
+Do not ignore file name case.
+.It Fl -strip-trailing-cr
+Skip identical lines.
+.It Fl -tabsize Ar NUM
+Change the size of tabs (default is 8.)
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width Ds
+.It Ev EDITOR , VISUAL
+Specifies an editor to use with the
+.Fl o
+option.
+If both
+.Ev EDITOR
+and
+.Ev VISUAL
+are set,
+.Ev VISUAL
+takes precedence.
+If neither
+.Ev EDITOR
+nor
+.Ev VISUAL
+are set,
+the default is
+.Xr vi 1 .
+.It Ev TMPDIR
+Specifies a directory for temporary files to be created.
+The default is
+.Pa /tmp .
+.El
+.Sh SEE ALSO
+.Xr cmp 1 ,
+.Xr diff 1 ,
+.Xr diff3 1 ,
+.Xr vi 1 ,
+.Xr re_format 7
+.Sh AUTHORS
+.Nm
+was written from scratch for the public domain by
+.An Ray Lai Aq ray@cyth.net .
+.Sh CAVEATS
+.Pp
+Tabs are treated as anywhere from one to eight characters wide,
+depending on the current column.
+Terminals that treat tabs as eight characters wide will look best.
+
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c
new file mode 100644
index 0000000..d1d763e
--- /dev/null
+++ b/usr.bin/sdiff/sdiff.c
@@ -0,0 +1,1185 @@
+/* $OpenBSD: sdiff.c,v 1.36 2015/12/29 19:04:46 gsoares Exp $ */
+
+/*
+ * Written by Raymond Lai <ray@cyth.net>.
+ * Public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <limits.h>
+#include <paths.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <libutil.h>
+
+#include "common.h"
+#include "extern.h"
+
+#define DIFF_PATH "/usr/bin/diff"
+
+#define WIDTH 126
+/*
+ * Each column must be at least one character wide, plus three
+ * characters between the columns (space, [<|>], space).
+ */
+#define WIDTH_MIN 5
+
+/* 3 kilobytes of chars */
+#define MAX_CHECK 768
+
+/* A single diff line. */
+struct diffline {
+ STAILQ_ENTRY(diffline) diffentries;
+ char *left;
+ char div;
+ char *right;
+};
+
+static void astrcat(char **, const char *);
+static void enqueue(char *, char, char *);
+static char *mktmpcpy(const char *);
+static int istextfile(FILE *);
+static void binexec(char *, char *, char *) __dead2;
+static void freediff(struct diffline *);
+static void int_usage(void);
+static int parsecmd(FILE *, FILE *, FILE *);
+static void printa(FILE *, size_t);
+static void printc(FILE *, size_t, FILE *, size_t);
+static void printcol(const char *, size_t *, const size_t);
+static void printd(FILE *, size_t);
+static void println(const char *, const char, const char *);
+static void processq(void);
+static void prompt(const char *, const char *);
+static void usage(void) __dead2;
+static char *xfgets(FILE *);
+
+static STAILQ_HEAD(, diffline) diffhead = STAILQ_HEAD_INITIALIZER(diffhead);
+static size_t line_width; /* width of a line (two columns and divider) */
+static size_t width; /* width of each column */
+static size_t file1ln, file2ln; /* line number of file1 and file2 */
+static int Iflag = 0; /* ignore sets matching regexp */
+static int lflag; /* print only left column for identical lines */
+static int sflag; /* skip identical lines */
+FILE *outfp; /* file to save changes to */
+const char *tmpdir; /* TMPDIR or /tmp */
+
+enum {
+ HELP_OPT = CHAR_MAX + 1,
+ NORMAL_OPT,
+ FCASE_SENSITIVE_OPT,
+ FCASE_IGNORE_OPT,
+ FROMFILE_OPT,
+ TOFILE_OPT,
+ UNIDIR_OPT,
+ STRIPCR_OPT,
+ HORIZ_OPT,
+ LEFTC_OPT,
+ SUPCL_OPT,
+ LF_OPT,
+ /* the following groupings must be in sequence */
+ OLDGF_OPT,
+ NEWGF_OPT,
+ UNCGF_OPT,
+ CHGF_OPT,
+ OLDLF_OPT,
+ NEWLF_OPT,
+ UNCLF_OPT,
+ /* end order-sensitive enums */
+ TSIZE_OPT,
+ HLINES_OPT,
+ LFILES_OPT,
+ DIFFPROG_OPT,
+ PIPE_FD,
+ /* pid from the diff parent (if applicable) */
+ DIFF_PID,
+
+ NOOP_OPT,
+};
+
+static struct option longopts[] = {
+ /* options only processed in sdiff */
+ { "left-column", no_argument, NULL, LEFTC_OPT },
+ { "suppress-common-lines", no_argument, NULL, 's' },
+ { "width", required_argument, NULL, 'w' },
+
+ { "output", required_argument, NULL, 'o' },
+ { "diff-program", required_argument, NULL, DIFFPROG_OPT },
+
+ { "pipe-fd", required_argument, NULL, PIPE_FD },
+ { "diff-pid", required_argument, NULL, DIFF_PID },
+ /* Options processed by diff. */
+ { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT },
+ { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT },
+ { "strip-trailing-cr", no_argument, NULL, STRIPCR_OPT },
+ { "tabsize", required_argument, NULL, TSIZE_OPT },
+ { "help", no_argument, NULL, HELP_OPT },
+ { "text", no_argument, NULL, 'a' },
+ { "ignore-blank-lines", no_argument, NULL, 'B' },
+ { "ignore-space-change", no_argument, NULL, 'b' },
+ { "minimal", no_argument, NULL, 'd' },
+ { "ignore-tab-expansion", no_argument, NULL, 'E' },
+ { "ignore-matching-lines", required_argument, NULL, 'I' },
+ { "ignore-case", no_argument, NULL, 'i' },
+ { "expand-tabs", no_argument, NULL, 't' },
+ { "speed-large-files", no_argument, NULL, 'H' },
+ { "ignore-all-space", no_argument, NULL, 'W' },
+
+ { NULL, 0, NULL, '\0'}
+};
+
+static const char *help_msg[] = {
+ "\nusage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n",
+ "\t-l, --left-column, Only print the left column for identical lines.",
+ "\t-o OUTFILE, --output=OUTFILE, nteractively merge file1 and file2 into outfile.",
+ "\t-s, --suppress-common-lines, Skip identical lines.",
+ "\t-w WIDTH, --width=WIDTH, Print a maximum of WIDTH characters on each line.",
+ "\tOptions passed to diff(1) are:",
+ "\t\t-a, --text, Treat file1 and file2 as text files.",
+ "\t\t-b, --ignore-trailing-cr, Ignore trailing blank spaces.",
+ "\t\t-d, --minimal, Minimize diff size.",
+ "\t\t-I RE, --ignore-matching-lines=RE, Ignore changes whose line matches RE.",
+ "\t\t-i, --ignore-case, Do a case-insensitive comparison.",
+ "\t\t-t, --expand-tabs Expand tabs to spaces.",
+ "\t\t-W, --ignore-all-spaces, Ignore all spaces.",
+ "\t\t--speed-large-files, Assume large file with scattered changes.",
+ "\t\t--strip-trailing-cr, Strip trailing carriage return.",
+ "\t\t--ignore-file-name-case, Ignore case of file names.",
+ "\t\t--no-ignore-file-name-case, Do not ignore file name case",
+ "\t\t--tabsize NUM, Change size of tabs (default 8.)",
+
+ NULL,
+};
+
+/*
+ * Create temporary file if source_file is not a regular file.
+ * Returns temporary file name if one was malloced, NULL if unnecessary.
+ */
+static char *
+mktmpcpy(const char *source_file)
+{
+ struct stat sb;
+ ssize_t rcount;
+ int ifd, ofd;
+ u_char buf[BUFSIZ];
+ char *target_file;
+
+ /* Open input and output. */
+ ifd = open(source_file, O_RDONLY, 0);
+ /* File was opened successfully. */
+ if (ifd != -1) {
+ if (fstat(ifd, &sb) == -1)
+ err(2, "error getting file status from %s", source_file);
+
+ /* Regular file. */
+ if (S_ISREG(sb.st_mode)) {
+ close(ifd);
+ return (NULL);
+ }
+ } else {
+ /* If ``-'' does not exist the user meant stdin. */
+ if (errno == ENOENT && strcmp(source_file, "-") == 0)
+ ifd = STDIN_FILENO;
+ else
+ err(2, "error opening %s", source_file);
+ }
+
+ /* Not a regular file, so copy input into temporary file. */
+ if (asprintf(&target_file, "%s/sdiff.XXXXXXXXXX", tmpdir) == -1)
+ err(2, "asprintf");
+ if ((ofd = mkstemp(target_file)) == -1) {
+ warn("error opening %s", target_file);
+ goto FAIL;
+ }
+ while ((rcount = read(ifd, buf, sizeof(buf))) != -1 &&
+ rcount != 0) {
+ ssize_t wcount;
+
+ wcount = write(ofd, buf, (size_t)rcount);
+ if (-1 == wcount || rcount != wcount) {
+ warn("error writing to %s", target_file);
+ goto FAIL;
+ }
+ }
+ if (rcount == -1) {
+ warn("error reading from %s", source_file);
+ goto FAIL;
+ }
+
+ close(ifd);
+ close(ofd);
+
+ return (target_file);
+
+FAIL:
+ unlink(target_file);
+ exit(2);
+}
+
+int
+main(int argc, char **argv)
+{
+ FILE *diffpipe=NULL, *file1, *file2;
+ size_t diffargc = 0, wflag = WIDTH;
+ int ch, fd[2] = {-1}, status;
+ pid_t pid=0; pid_t ppid =-1;
+ const char *outfile = NULL;
+ struct option *popt;
+ char **diffargv, *diffprog = DIFF_PATH, *filename1, *filename2,
+ *tmp1, *tmp2, *s1, *s2;
+ int i;
+
+ /*
+ * Process diff flags.
+ */
+ /*
+ * Allocate memory for diff arguments and NULL.
+ * Each flag has at most one argument, so doubling argc gives an
+ * upper limit of how many diff args can be passed. argv[0],
+ * file1, and file2 won't have arguments so doubling them will
+ * waste some memory; however we need an extra space for the
+ * NULL at the end, so it sort of works out.
+ */
+ if (!(diffargv = calloc(argc, sizeof(char **) * 2)))
+ err(2, "main");
+
+ /* Add first argument, the program name. */
+ diffargv[diffargc++] = diffprog;
+
+ /* create a dynamic string for merging single-switch options */
+ if ( asprintf(&diffargv[diffargc++], "-") < 0 )
+ err(2, "main");
+
+ while ((ch = getopt_long(argc, argv, "aBbdEHI:ilo:stWw:",
+ longopts, NULL)) != -1) {
+ const char *errstr;
+
+ switch (ch) {
+ /* only compatible --long-name-form with diff */
+ case FCASE_IGNORE_OPT:
+ case FCASE_SENSITIVE_OPT:
+ case STRIPCR_OPT:
+ case TSIZE_OPT:
+ case 'S':
+ break;
+ /* combine no-arg single switches */
+ case 'a':
+ case 'B':
+ case 'b':
+ case 'd':
+ case 'E':
+ case 'i':
+ case 't':
+ case 'H':
+ case 'W':
+ for(popt = longopts; ch != popt->val && popt->name != NULL; popt++);
+ diffargv[1] = realloc(diffargv[1], sizeof(char) * strlen(diffargv[1]) + 2);
+ /*
+ * In diff, the 'W' option is 'w' and the 'w' is 'W'.
+ */
+ if (ch == 'W')
+ sprintf(diffargv[1], "%sw", diffargv[1]);
+ else
+ sprintf(diffargv[1], "%s%c", diffargv[1], ch);
+ break;
+ case DIFFPROG_OPT:
+ diffargv[0] = diffprog = optarg;
+ break;
+ case 'I':
+ Iflag = 1;
+ diffargv[diffargc++] = "-I";
+ diffargv[diffargc++] = optarg;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'o':
+ outfile = optarg;
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 'w':
+ wflag = strtonum(optarg, WIDTH_MIN,
+ INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "width is %s: %s", errstr, optarg);
+ break;
+ case DIFF_PID:
+ ppid = strtonum(optarg, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "diff pid value is %s: %s", errstr, optarg);
+ break;
+ case HELP_OPT:
+ for (i = 0; help_msg[i] != NULL; i++)
+ printf("%s\n", help_msg[i]);
+ exit(0);
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ /* no single switches were used */
+ if (strcmp(diffargv[1], "-") == 0 ) {
+ for ( i = 1; i < argc-1; i++) {
+ diffargv[i] = diffargv[i+1];
+ }
+ diffargv[diffargc-1] = NULL;
+ diffargc--;
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ if (outfile && (outfp = fopen(outfile, "w")) == NULL)
+ err(2, "could not open: %s", optarg);
+
+ if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
+ tmpdir = _PATH_TMP;
+
+ filename1 = argv[0];
+ filename2 = argv[1];
+
+ /*
+ * Create temporary files for diff and sdiff to share if file1
+ * or file2 are not regular files. This allows sdiff and diff
+ * to read the same inputs if one or both inputs are stdin.
+ *
+ * If any temporary files were created, their names would be
+ * saved in tmp1 or tmp2. tmp1 should never equal tmp2.
+ */
+ tmp1 = tmp2 = NULL;
+ /* file1 and file2 are the same, so copy to same temp file. */
+ if (strcmp(filename1, filename2) == 0) {
+ if ((tmp1 = mktmpcpy(filename1)))
+ filename1 = filename2 = tmp1;
+ /* Copy file1 and file2 into separate temp files. */
+ } else {
+ if ((tmp1 = mktmpcpy(filename1)))
+ filename1 = tmp1;
+ if ((tmp2 = mktmpcpy(filename2)))
+ filename2 = tmp2;
+ }
+
+ diffargv[diffargc++] = filename1;
+ diffargv[diffargc++] = filename2;
+ /* Add NULL to end of array to indicate end of array. */
+ diffargv[diffargc++] = NULL;
+
+ /* Subtract column divider and divide by two. */
+ width = (wflag - 3) / 2;
+ /* Make sure line_width can fit in size_t. */
+ if (width > (SIZE_MAX - 3) / 2)
+ errx(2, "width is too large: %zu", width);
+ line_width = width * 2 + 3;
+
+ if (ppid == -1 ) {
+ if (pipe(fd))
+ err(2, "pipe");
+
+ switch (pid = fork()) {
+ case 0:
+ /* child */
+ /* We don't read from the pipe. */
+ close(fd[0]);
+ if (dup2(fd[1], STDOUT_FILENO) == -1)
+ err(2, "child could not duplicate descriptor");
+ /* Free unused descriptor. */
+ close(fd[1]);
+ execvp(diffprog, diffargv);
+ err(2, "could not execute diff: %s", diffprog);
+ break;
+ case -1:
+ err(2, "could not fork");
+ break;
+ }
+
+ /* parent */
+ /* We don't write to the pipe. */
+ close(fd[1]);
+
+ /* Open pipe to diff command. */
+ if ((diffpipe = fdopen(fd[0], "r")) == NULL)
+ err(2, "could not open diff pipe");
+ }
+ if ((file1 = fopen(filename1, "r")) == NULL)
+ err(2, "could not open %s", filename1);
+ if ((file2 = fopen(filename2, "r")) == NULL)
+ err(2, "could not open %s", filename2);
+ if (!istextfile(file1) || !istextfile(file2)) {
+ /* Close open files and pipe, delete temps */
+ fclose(file1);
+ fclose(file2);
+ fclose(diffpipe);
+ if (tmp1)
+ if (unlink(tmp1))
+ warn("Error deleting %s.", tmp1);
+ if (tmp2)
+ if (unlink(tmp2))
+ warn("Error deleting %s.", tmp2);
+ free(tmp1);
+ free(tmp2);
+ binexec(diffprog, filename1, filename2);
+ }
+ /* Line numbers start at one. */
+ file1ln = file2ln = 1;
+
+ /* Read and parse diff output. */
+ while (parsecmd(diffpipe, file1, file2) != EOF)
+ ;
+ fclose(diffpipe);
+
+ /* Wait for diff to exit. */
+ if (waitpid(pid, &status, 0) == -1 || !WIFEXITED(status) ||
+ WEXITSTATUS(status) >= 2)
+ err(2, "diff exited abnormally.");
+
+ /* Delete and free unneeded temporary files. */
+ if (tmp1)
+ if (unlink(tmp1))
+ warn("Error deleting %s.", tmp1);
+ if (tmp2)
+ if (unlink(tmp2))
+ warn("Error deleting %s.", tmp2);
+ free(tmp1);
+ free(tmp2);
+ filename1 = filename2 = tmp1 = tmp2 = NULL;
+
+ /* No more diffs, so print common lines. */
+ if (lflag)
+ while ((s1 = xfgets(file1)))
+ enqueue(s1, ' ', NULL);
+ else
+ for (;;) {
+ s1 = xfgets(file1);
+ s2 = xfgets(file2);
+ if (s1 || s2)
+ enqueue(s1, ' ', s2);
+ else
+ break;
+ }
+ fclose(file1);
+ fclose(file2);
+ /* Process unmodified lines. */
+ processq();
+
+ /* Return diff exit status. */
+ return (WEXITSTATUS(status));
+}
+
+/*
+ * When sdiff/zsdiff detects a binary file as input, executes them with
+ * diff/zdiff to maintain the same behavior as GNU sdiff with binary input.
+ */
+static void
+binexec(char *diffprog, char *f1, char *f2)
+{
+
+ char *args[] = {diffprog, f1, f2, (char *) 0};
+ execv(diffprog, args);
+
+ /* If execv() fails, sdiff's execution will continue below. */
+ errx(1, "Could not execute diff process.\n");
+}
+
+/*
+ * Checks whether a file appears to be a text file.
+ */
+static int
+istextfile(FILE *f)
+{
+ int ch, i;
+
+ if (f == NULL)
+ return (1);
+ rewind(f);
+ for (i = 0; i <= MAX_CHECK; i++) {
+ ch = fgetc(f);
+ if (ch == '\0') {
+ rewind(f);
+ return (0);
+ }
+ if (ch == EOF)
+ break;
+ }
+ rewind(f);
+ return (1);
+}
+
+/*
+ * Prints an individual column (left or right), taking into account
+ * that tabs are variable-width. Takes a string, the current column
+ * the cursor is on the screen, and the maximum value of the column.
+ * The column value is updated as we go along.
+ */
+static void
+printcol(const char *s, size_t *col, const size_t col_max)
+{
+
+ for (; *s && *col < col_max; ++s) {
+ size_t new_col;
+
+ switch (*s) {
+ case '\t':
+ /*
+ * If rounding to next multiple of eight causes
+ * an integer overflow, just return.
+ */
+ if (*col > SIZE_MAX - 8)
+ return;
+
+ /* Round to next multiple of eight. */
+ new_col = (*col / 8 + 1) * 8;
+
+ /*
+ * If printing the tab goes past the column
+ * width, don't print it and just quit.
+ */
+ if (new_col > col_max)
+ return;
+ *col = new_col;
+ break;
+ default:
+ ++(*col);
+ }
+ putchar(*s);
+ }
+}
+
+/*
+ * Prompts user to either choose between two strings or edit one, both,
+ * or neither.
+ */
+static void
+prompt(const char *s1, const char *s2)
+{
+ char *cmd;
+
+ /* Print command prompt. */
+ putchar('%');
+
+ /* Get user input. */
+ for (; (cmd = xfgets(stdin)); free(cmd)) {
+ const char *p;
+
+ /* Skip leading whitespace. */
+ for (p = cmd; isspace(*p); ++p)
+ ;
+ switch (*p) {
+ case 'e':
+ /* Skip `e'. */
+ ++p;
+ if (eparse(p, s1, s2) == -1)
+ goto USAGE;
+ break;
+ case 'l':
+ case '1':
+ /* Choose left column as-is. */
+ if (s1 != NULL)
+ fprintf(outfp, "%s\n", s1);
+ /* End of command parsing. */
+ break;
+ case 'q':
+ goto QUIT;
+ case 'r':
+ case '2':
+ /* Choose right column as-is. */
+ if (s2 != NULL)
+ fprintf(outfp, "%s\n", s2);
+ /* End of command parsing. */
+ break;
+ case 's':
+ sflag = 1;
+ goto PROMPT;
+ case 'v':
+ sflag = 0;
+ /* FALLTHROUGH */
+ default:
+ /* Interactive usage help. */
+USAGE:
+ int_usage();
+PROMPT:
+ putchar('%');
+
+ /* Prompt user again. */
+ continue;
+ }
+ free(cmd);
+ return;
+ }
+
+ /*
+ * If there was no error, we received an EOF from stdin, so we
+ * should quit.
+ */
+QUIT:
+ fclose(outfp);
+ exit(0);
+}
+
+/*
+ * Takes two strings, separated by a column divider. NULL strings are
+ * treated as empty columns. If the divider is the ` ' character, the
+ * second column is not printed (-l flag). In this case, the second
+ * string must be NULL. When the second column is NULL, the divider
+ * does not print the trailing space following the divider character.
+ *
+ * Takes into account that tabs can take multiple columns.
+ */
+static void
+println(const char *s1, const char div, const char *s2)
+{
+ size_t col;
+
+ /* Print first column. Skips if s1 == NULL. */
+ col = 0;
+ if (s1) {
+ /* Skip angle bracket and space. */
+ printcol(s1, &col, width);
+
+ }
+
+ /* Otherwise, we pad this column up to width. */
+ for (; col < width; ++col)
+ putchar(' ');
+
+ /* Only print left column. */
+ if (div == ' ' && !s2) {
+ printf(" (\n");
+ return;
+ }
+
+ /*
+ * Print column divider. If there is no second column, we don't
+ * need to add the space for padding.
+ */
+ if (!s2) {
+ printf(" %c\n", div);
+ return;
+ }
+ printf(" %c ", div);
+ col += 3;
+
+ /* Skip angle bracket and space. */
+ printcol(s2, &col, line_width);
+
+ putchar('\n');
+}
+
+/*
+ * Reads a line from file and returns as a string. If EOF is reached,
+ * NULL is returned. The returned string must be freed afterwards.
+ */
+static char *
+xfgets(FILE *file)
+{
+ const char delim[3] = {'\0', '\0', '\0'};
+ char *s;
+
+ /* XXX - Is this necessary? */
+ clearerr(file);
+
+ if (!(s = fparseln(file, NULL, NULL, delim, 0)) &&
+ ferror(file))
+ err(2, "error reading file");
+
+ if (!s) {
+ return (NULL);
+ }
+
+ return (s);
+}
+
+/*
+ * Parse ed commands from diffpipe and print lines from file1 (lines
+ * to change or delete) or file2 (lines to add or change).
+ * Returns EOF or 0.
+ */
+static int
+parsecmd(FILE *diffpipe, FILE *file1, FILE *file2)
+{
+ size_t file1start, file1end, file2start, file2end, n;
+ /* ed command line and pointer to characters in line */
+ char *line, *p, *q;
+ const char *errstr;
+ char c, cmd;
+
+ /* Read ed command. */
+ if (!(line = xfgets(diffpipe)))
+ return (EOF);
+
+ p = line;
+ /* Go to character after line number. */
+ while (isdigit(*p))
+ ++p;
+ c = *p;
+ *p++ = 0;
+ file1start = strtonum(line, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file1 start is %s: %s", errstr, line);
+
+ /* A range is specified for file1. */
+ if (c == ',') {
+ q = p;
+ /* Go to character after file2end. */
+ while (isdigit(*p))
+ ++p;
+ c = *p;
+ *p++ = 0;
+ file1end = strtonum(q, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file1 end is %s: %s", errstr, line);
+ if (file1start > file1end)
+ errx(2, "invalid line range in file1: %s", line);
+ } else
+ file1end = file1start;
+
+ cmd = c;
+ /* Check that cmd is valid. */
+ if (!(cmd == 'a' || cmd == 'c' || cmd == 'd'))
+ errx(2, "ed command not recognized: %c: %s", cmd, line);
+
+ q = p;
+ /* Go to character after line number. */
+ while (isdigit(*p))
+ ++p;
+ c = *p;
+ *p++ = 0;
+ file2start = strtonum(q, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file2 start is %s: %s", errstr, line);
+
+ /*
+ * There should either be a comma signifying a second line
+ * number or the line should just end here.
+ */
+ if (c != ',' && c != '\0')
+ errx(2, "invalid line range in file2: %c: %s", c, line);
+
+ if (c == ',') {
+
+ file2end = strtonum(p, 0, INT_MAX, &errstr);
+ if (errstr)
+ errx(2, "file2 end is %s: %s", errstr, line);
+ if (file2start >= file2end)
+ errx(2, "invalid line range in file2: %s", line);
+ } else
+ file2end = file2start;
+
+ /* Appends happen _after_ stated line. */
+ if (cmd == 'a') {
+ if (file1start != file1end)
+ errx(2, "append cannot have a file1 range: %s",
+ line);
+ if (file1start == SIZE_MAX)
+ errx(2, "file1 line range too high: %s", line);
+ file1start = ++file1end;
+ }
+ /*
+ * I'm not sure what the deal is with the line numbers for
+ * deletes, though.
+ */
+ else if (cmd == 'd') {
+ if (file2start != file2end)
+ errx(2, "delete cannot have a file2 range: %s",
+ line);
+ if (file2start == SIZE_MAX)
+ errx(2, "file2 line range too high: %s", line);
+ file2start = ++file2end;
+ }
+
+ /*
+ * Continue reading file1 and file2 until we reach line numbers
+ * specified by diff. Should only happen with -I flag.
+ */
+ for (; file1ln < file1start && file2ln < file2start;
+ ++file1ln, ++file2ln) {
+ char *s1, *s2;
+
+ if (!(s1 = xfgets(file1)))
+ errx(2, "file1 shorter than expected");
+ if (!(s2 = xfgets(file2)))
+ errx(2, "file2 shorter than expected");
+
+ /* If the -l flag was specified, print only left column. */
+ if (lflag) {
+ free(s2);
+ /*
+ * XXX - If -l and -I are both specified, all
+ * unchanged or ignored lines are shown with a
+ * `(' divider. This matches GNU sdiff, but I
+ * believe it is a bug. Just check out:
+ * gsdiff -l -I '^$' samefile samefile.
+ */
+ if (Iflag)
+ enqueue(s1, '(', NULL);
+ else
+ enqueue(s1, ' ', NULL);
+ } else
+ enqueue(s1, ' ', s2);
+ }
+ /* Ignore deleted lines. */
+ for (; file1ln < file1start; ++file1ln) {
+ char *s;
+
+ if (!(s = xfgets(file1)))
+ errx(2, "file1 shorter than expected");
+
+ enqueue(s, '(', NULL);
+ }
+ /* Ignore added lines. */
+ for (; file2ln < file2start; ++file2ln) {
+ char *s;
+
+ if (!(s = xfgets(file2)))
+ errx(2, "file2 shorter than expected");
+
+ /* If -l flag was given, don't print right column. */
+ if (lflag)
+ free(s);
+ else
+ enqueue(NULL, ')', s);
+ }
+
+ /* Process unmodified or skipped lines. */
+ processq();
+
+ switch (cmd) {
+ case 'a':
+ printa(file2, file2end);
+ n = file2end - file2start + 1;
+ break;
+ case 'c':
+ printc(file1, file1end, file2, file2end);
+ n = file1end - file1start + 1 + 1 + file2end - file2start + 1;
+ break;
+ case 'd':
+ printd(file1, file1end);
+ n = file1end - file1start + 1;
+ break;
+ default:
+ errx(2, "invalid diff command: %c: %s", cmd, line);
+ }
+ free(line);
+
+ /* Skip to next ed line. */
+ while (n--) {
+ if (!(line = xfgets(diffpipe)))
+ errx(2, "diff ended early");
+ free(line);
+ }
+
+ return (0);
+}
+
+/*
+ * Queues up a diff line.
+ */
+static void
+enqueue(char *left, char div, char *right)
+{
+ struct diffline *diffp;
+
+ if (!(diffp = malloc(sizeof(struct diffline))))
+ err(2, "enqueue");
+ diffp->left = left;
+ diffp->div = div;
+ diffp->right = right;
+ STAILQ_INSERT_TAIL(&diffhead, diffp, diffentries);
+}
+
+/*
+ * Free a diffline structure and its elements.
+ */
+static void
+freediff(struct diffline *diffp)
+{
+
+ free(diffp->left);
+ free(diffp->right);
+ free(diffp);
+}
+
+/*
+ * Append second string into first. Repeated appends to the same string
+ * are cached, making this an O(n) function, where n = strlen(append).
+ */
+static void
+astrcat(char **s, const char *append)
+{
+ /* Length of string in previous run. */
+ static size_t offset = 0;
+ size_t newsiz;
+ /*
+ * String from previous run. Compared to *s to see if we are
+ * dealing with the same string. If so, we can use offset.
+ */
+ static const char *oldstr = NULL;
+ char *newstr;
+
+ /*
+ * First string is NULL, so just copy append.
+ */
+ if (!*s) {
+ if (!(*s = strdup(append)))
+ err(2, "astrcat");
+
+ /* Keep track of string. */
+ offset = strlen(*s);
+ oldstr = *s;
+
+ return;
+ }
+
+ /*
+ * *s is a string so concatenate.
+ */
+
+ /* Did we process the same string in the last run? */
+ /*
+ * If this is a different string from the one we just processed
+ * cache new string.
+ */
+ if (oldstr != *s) {
+ offset = strlen(*s);
+ oldstr = *s;
+ }
+
+ /* Size = strlen(*s) + \n + strlen(append) + '\0'. */
+ newsiz = offset + 1 + strlen(append) + 1;
+
+ /* Resize *s to fit new string. */
+ newstr = realloc(*s, newsiz);
+ if (newstr == NULL)
+ err(2, "astrcat");
+ *s = newstr;
+
+ /* *s + offset should be end of string. */
+ /* Concatenate. */
+ strlcpy(*s + offset, "\n", newsiz - offset);
+ strlcat(*s + offset, append, newsiz - offset);
+
+ /* New string length should be exactly newsiz - 1 characters. */
+ /* Store generated string's values. */
+ offset = newsiz - 1;
+ oldstr = *s;
+}
+
+/*
+ * Process diff set queue, printing, prompting, and saving each diff
+ * line stored in queue.
+ */
+static void
+processq(void)
+{
+ struct diffline *diffp;
+ char divc, *left, *right;
+
+ /* Don't process empty queue. */
+ if (STAILQ_EMPTY(&diffhead))
+ return;
+
+ /* Remember the divider. */
+ divc = STAILQ_FIRST(&diffhead)->div;
+
+ left = NULL;
+ right = NULL;
+ /*
+ * Go through set of diffs, concatenating each line in left or
+ * right column into two long strings, `left' and `right'.
+ */
+ STAILQ_FOREACH(diffp, &diffhead, diffentries) {
+ /*
+ * Print changed lines if -s was given,
+ * print all lines if -s was not given.
+ */
+ if (!sflag || diffp->div == '|' || diffp->div == '<' ||
+ diffp->div == '>')
+ println(diffp->left, diffp->div, diffp->right);
+
+ /* Append new lines to diff set. */
+ if (diffp->left)
+ astrcat(&left, diffp->left);
+ if (diffp->right)
+ astrcat(&right, diffp->right);
+ }
+
+ /* Empty queue and free each diff line and its elements. */
+ while (!STAILQ_EMPTY(&diffhead)) {
+ diffp = STAILQ_FIRST(&diffhead);
+ STAILQ_REMOVE_HEAD(&diffhead, diffentries);
+ freediff(diffp);
+ }
+
+ /* Write to outfp, prompting user if lines are different. */
+ if (outfp)
+ switch (divc) {
+ case ' ': case '(': case ')':
+ fprintf(outfp, "%s\n", left);
+ break;
+ case '|': case '<': case '>':
+ prompt(left, right);
+ break;
+ default:
+ errx(2, "invalid divider: %c", divc);
+ }
+
+ /* Free left and right. */
+ free(left);
+ free(right);
+}
+
+/*
+ * Print lines following an (a)ppend command.
+ */
+static void
+printa(FILE *file, size_t line2)
+{
+ char *line;
+
+ for (; file2ln <= line2; ++file2ln) {
+ if (!(line = xfgets(file)))
+ errx(2, "append ended early");
+ enqueue(NULL, '>', line);
+ }
+ processq();
+}
+
+/*
+ * Print lines following a (c)hange command, from file1ln to file1end
+ * and from file2ln to file2end.
+ */
+static void
+printc(FILE *file1, size_t file1end, FILE *file2, size_t file2end)
+{
+ struct fileline {
+ STAILQ_ENTRY(fileline) fileentries;
+ char *line;
+ };
+ STAILQ_HEAD(, fileline) delqhead = STAILQ_HEAD_INITIALIZER(delqhead);
+
+ /* Read lines to be deleted. */
+ for (; file1ln <= file1end; ++file1ln) {
+ struct fileline *linep;
+ char *line1;
+
+ /* Read lines from both. */
+ if (!(line1 = xfgets(file1)))
+ errx(2, "error reading file1 in delete in change");
+
+ /* Add to delete queue. */
+ if (!(linep = malloc(sizeof(struct fileline))))
+ err(2, "printc");
+ linep->line = line1;
+ STAILQ_INSERT_TAIL(&delqhead, linep, fileentries);
+ }
+
+ /* Process changed lines.. */
+ for (; !STAILQ_EMPTY(&delqhead) && file2ln <= file2end;
+ ++file2ln) {
+ struct fileline *del;
+ char *add;
+
+ /* Get add line. */
+ if (!(add = xfgets(file2)))
+ errx(2, "error reading add in change");
+
+ del = STAILQ_FIRST(&delqhead);
+ enqueue(del->line, '|', add);
+ STAILQ_REMOVE_HEAD(&delqhead, fileentries);
+ /*
+ * Free fileline structure but not its elements since
+ * they are queued up.
+ */
+ free(del);
+ }
+ processq();
+
+ /* Process remaining lines to add. */
+ for (; file2ln <= file2end; ++file2ln) {
+ char *add;
+
+ /* Get add line. */
+ if (!(add = xfgets(file2)))
+ errx(2, "error reading add in change");
+
+ enqueue(NULL, '>', add);
+ }
+ processq();
+
+ /* Process remaining lines to delete. */
+ while (!STAILQ_EMPTY(&delqhead)) {
+ struct fileline *filep;
+
+ filep = STAILQ_FIRST(&delqhead);
+ enqueue(filep->line, '<', NULL);
+ STAILQ_REMOVE_HEAD(&delqhead, fileentries);
+ free(filep);
+ }
+ processq();
+}
+
+/*
+ * Print deleted lines from file, from file1ln to file1end.
+ */
+static void
+printd(FILE *file1, size_t file1end)
+{
+ char *line1;
+
+ /* Print out lines file1ln to line2. */
+ for (; file1ln <= file1end; ++file1ln) {
+ if (!(line1 = xfgets(file1)))
+ errx(2, "file1 ended early in delete");
+ enqueue(line1, '<', NULL);
+ }
+ processq();
+}
+
+/*
+ * Interactive mode usage.
+ */
+static void
+int_usage(void)
+{
+
+ puts("e:\tedit blank diff\n"
+ "eb:\tedit both diffs concatenated\n"
+ "el:\tedit left diff\n"
+ "er:\tedit right diff\n"
+ "l | 1:\tchoose left diff\n"
+ "r | 2:\tchoose right diff\n"
+ "s:\tsilent mode--don't print identical lines\n"
+ "v:\tverbose mode--print identical lines\n"
+ "q:\tquit");
+}
+
+static void
+usage(void)
+{
+
+ fprintf(stderr,
+ "usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1"
+ " file2\n");
+ exit(2);
+}
diff --git a/usr.bin/sdiff/tests/Makefile b/usr.bin/sdiff/tests/Makefile
new file mode 100644
index 0000000..2c0b916
--- /dev/null
+++ b/usr.bin/sdiff/tests/Makefile
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+PACKAGE= tests
+FILEGROUPS= TESTS
+TESTPACKAGE= ${PACKAGE}
+TESTDIR= ${TESTSBASE}/usr.bin/sdiff
+
+ATF_TESTS_SH= sdiff
+
+FILESDIR= ${TESTDIR}
+FILES= d_dot.in \
+ d_flags_l.out \
+ d_flags_s.out \
+ d_flags_w.out \
+ d_iflags_a1.out \
+ d_iflags_a2.out \
+ d_iflags_b1.out \
+ d_iflags_b2.out \
+ d_iflags_c1.out \
+ d_iflags_c2.out \
+ d_iflags_d1.out \
+ d_iflags_d2.out \
+ d_input1 \
+ d_input2 \
+ d_oneline.in \
+ d_oneline_a.out \
+ d_oneline_b.out \
+ d_same.out \
+ d_short.out \
+ d_tabends.in \
+ d_tabends_a.out \
+ d_tabends_b.out \
+ d_tabends_c.out \
+ d_tabs.out \
+ d_tabs1.in \
+ d_tabs2.in
+
+.include <bsd.test.mk>
diff --git a/usr.bin/sdiff/tests/d_dot.in b/usr.bin/sdiff/tests/d_dot.in
new file mode 100644
index 0000000..9c558e3
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_dot.in
@@ -0,0 +1 @@
+.
diff --git a/usr.bin/sdiff/tests/d_flags_l.out b/usr.bin/sdiff/tests/d_flags_l.out
new file mode 100644
index 0000000..ac8d2ad
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_flags_l.out
@@ -0,0 +1,102 @@
+Policy: /usr/bin/lynx, Emulation: native (
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit (
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit (
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit (
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit (
+ > native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit (
+ native-fsread: filename eq "/usr/bin" then permit (
+ native-fsread: filename eq "/usr/games" then permit (
+ native-fsread: filename eq "/usr/include" then permit (
+ native-fsread: filename eq "/usr/lib" then permit (
+ native-fsread: filename match "/usr/lib/libc.so.*" then p <
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t <
+ native-fsread: filename match "/usr/lib/libncurses.so.*" <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then <
+ native-fsread: filename eq "/usr/libdata" then permit (
+ native-fsread: filename eq "/usr/libexec" then permit (
+ native-fsread: filename eq "/usr/lkm" then permit (
+ native-fsread: filename eq "/usr/local" then permit (
+ native-fsread: filename eq "/usr/mdec" then permit (
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then | native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" (
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit (
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit (
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_flags_s.out b/usr.bin/sdiff/tests/d_flags_s.out
new file mode 100644
index 0000000..8af11f3
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_flags_s.out
@@ -0,0 +1,79 @@
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ > native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p <
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t <
+ native-fsread: filename match "/usr/lib/libncurses.so.*" <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then <
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then | native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename match "/<non-existent filename>:
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_flags_w.out b/usr.bin/sdiff/tests/d_flags_w.out
new file mode 100644
index 0000000..19ea79b
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_flags_w.out
@@ -0,0 +1,102 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit native-__sysctl: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ > native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit native-fsread: filename match "/tmp/lynx-*/." then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p <
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t <
+ native-fsread: filename match "/usr/lib/libncurses.so.*" <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then <
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then | native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit native-poll: permit
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_a1.out b/usr.bin/sdiff/tests/d_iflags_a1.out
new file mode 100644
index 0000000..2a0f532
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_a1.out
@@ -0,0 +1,100 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit native-__sysctl: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit native-fswrite: filename match "/tmp/lynx-*" then permit
+ ) native-fsread: filename match "/tmp/lynx-*/." then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/usr/obj" then permit native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ native-fsread: filename eq "/usr/obj/bin" then permit native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit native-poll: permit
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_a2.out b/usr.bin/sdiff/tests/d_iflags_a2.out
new file mode 100644
index 0000000..4e0d349
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_a2.out
@@ -0,0 +1,96 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-__sysctl: permit native-__sysctl: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-close: permit native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/home" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/obj" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename match "/<non-existent filename>: native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ ) native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ ) native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-gettimeofday: permit native-gettimeofday: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ native-recvfrom: permit native-recvfrom: permit
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_iflags_b1.out b/usr.bin/sdiff/tests/d_iflags_b1.out
new file mode 100644
index 0000000..3e548b6
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_b1.out
@@ -0,0 +1,69 @@
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_b2.out b/usr.bin/sdiff/tests/d_iflags_b2.out
new file mode 100644
index 0000000..4504c36
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_b2.out
@@ -0,0 +1,65 @@
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_iflags_c1.out b/usr.bin/sdiff/tests/d_iflags_c1.out
new file mode 100644
index 0000000..e9ac88e
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_c1.out
@@ -0,0 +1,99 @@
+Policy: /usr/bin/lynx, Emulation: native (
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit (
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-close: permit (
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit (
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit (
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit (
+ native-fsread: filename eq "/usr/bin" then permit (
+ native-fsread: filename eq "/usr/games" then permit (
+ native-fsread: filename eq "/usr/include" then permit (
+ native-fsread: filename eq "/usr/lib" then permit (
+ native-fsread: filename match "/usr/lib/libc.so.*" then p (
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t (
+ native-fsread: filename match "/usr/lib/libncurses.so.*" (
+ native-fsread: filename match "/usr/lib/libssl.so.*" then (
+ native-fsread: filename eq "/usr/libdata" then permit (
+ native-fsread: filename eq "/usr/libexec" then permit (
+ native-fsread: filename eq "/usr/lkm" then permit (
+ native-fsread: filename eq "/usr/local" then permit (
+ native-fsread: filename eq "/usr/mdec" then permit (
+ native-fsread: filename eq "/usr/obj" then permit (
+ native-fsread: filename eq "/usr/obj/bin" then permit (
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" (
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/dev.db" then permit (
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit (
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_c2.out b/usr.bin/sdiff/tests/d_iflags_c2.out
new file mode 100644
index 0000000..fe7af0e
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_c2.out
@@ -0,0 +1,94 @@
+Policy: /usr/bin/lynx, Emulation: native (
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-__sysctl: permit (
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-close: permit (
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit (
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit (
+ native-fswrite: filename match "/tmp/lynx-*" then permit (
+ native-fsread: filename match "/tmp/lynx-*/." then permit (
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "/usr" then permit (
+ native-fsread: filename eq "/usr/bin" then permit (
+ native-fsread: filename eq "/usr/games" then permit (
+ native-fsread: filename eq "/usr/include" then permit (
+ native-fsread: filename eq "/usr/lib" then permit (
+ native-fsread: filename eq "/usr/libdata" then permit (
+ native-fsread: filename eq "/usr/libexec" then permit (
+ native-fsread: filename eq "/usr/lkm" then permit (
+ native-fsread: filename eq "/usr/local" then permit (
+ native-fsread: filename eq "/usr/mdec" then permit (
+ native-fsread: filename eq "/home" then permit (
+ native-fsread: filename eq "/obj" then permit (
+ native-fsread: filename eq "$HOME/.lynxrc" then permit (
+ native-fsread: filename match "/<non-existent filename>: (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca (
+ native-fsread: filename eq "$HOME/.mailcap" then permit (
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t (
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" (
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/var/run/dev.db" then permit (
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-gettimeofday: permit (
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ native-recvfrom: permit (
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK (
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_iflags_d1.out b/usr.bin/sdiff/tests/d_iflags_d1.out
new file mode 100644
index 0000000..3e548b6
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_d1.out
@@ -0,0 +1,69 @@
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ > native-fstat: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/<non-existent filename>: | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "$HOME/.lynxrc" then permit <
+ native-fsread: filename eq "$HOME/.mailcap" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "/obj" then permit <
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permit
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then permit <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_iflags_d2.out b/usr.bin/sdiff/tests/d_iflags_d2.out
new file mode 100644
index 0000000..4504c36
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_iflags_d2.out
@@ -0,0 +1,65 @@
+ native-issetugid: permit <
+ native-mprotect: permit <
+ native-mmap: permit <
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe <
+ native-fstat: permit <
+ native-fsread: filename match "/usr/lib/libssl.so.*" then | native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-read: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t | native-exit: permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" | native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p | native-fsread: filename eq "/" then permit
+ native-munmap: permit | native-fsread: filename match "/<non-existent filename>:
+ native-sigprocmask: permit | native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-getpid: permit | native-fsread: filename eq "/etc/resolv.conf" then permit
+ > native-fsread: filename eq "/etc/utmp" then permit
+ > native-fsread: filename eq "/home" then permit
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ > native-fsread: filename eq "$HOME/.lynxrc" then permit
+ > native-fsread: filename eq "$HOME/.mailcap" then permit
+ > native-fsread: filename eq "$HOME/.mime.types" then permi
+ > native-fsread: filename eq "$HOME/.terminfo" then permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ > native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "/etc/lynx.cfg" then permit <
+ native-fsread: filename eq "/" then permit <
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then <
+ native-fsread: filename eq "/usr/obj/bin" then permit <
+ native-fcntl: permit <
+ native-getdirentries: permit <
+ native-lseek: permit <
+ native-fsread: filename eq "/usr/obj" then permit <
+ native-fsread: filename eq "$HOME/.mime.types" then permi <
+ native-sigaction: permit <
+ native-ioctl: permit <
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm <
+ native-fsread: filename eq "$HOME/.terminfo" then permit <
+ native-pread: permit <
+ native-write: permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per <
+ native-fsread: filename eq "/etc/utmp" then permit | native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-poll: permit | native-fstat: permit
+ native-nanosleep: permit | native-fswrite: filename match "/tmp/lynx-*" then permit
+ > native-getdirentries: permit
+ > native-getpid: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit | native-ioctl: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK | native-issetugid: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe | native-lseek: permit
+ native-sendto: true then permit | native-mmap: permit
+ native-select: permit | native-mprotect: prot eq "PROT_READ" then permit
+ > native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ > native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ > native-munmap: permit
+ > native-nanosleep: permit
+ > native-poll: permit
+ > native-pread: permit
+ > native-read: permit
+ > native-select: permit
+ > native-sendto: true then permit
+ > native-sigaction: permit
+ > native-sigprocmask: permit
+ > native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p | native-write: permit
+ native-exit: permit <
diff --git a/usr.bin/sdiff/tests/d_input1 b/usr.bin/sdiff/tests/d_input1
new file mode 100644
index 0000000..686e8ea
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_input1
@@ -0,0 +1,72 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-__sysctl: permit
+ native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
+ native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-getdirentries: permit
+ native-getpid: permit
+ native-gettimeofday: permit
+ native-ioctl: permit
+ native-issetugid: permit
+ native-lseek: permit
+ native-mmap: permit
+ native-mprotect: prot eq "PROT_READ" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" then permit
+ native-munmap: permit
+ native-nanosleep: permit
+ native-poll: permit
+ native-pread: permit
+ native-read: permit
+ native-recvfrom: permit
+ native-select: permit
+ native-sendto: true then permit
+ native-sigaction: permit
+ native-sigprocmask: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-write: permit
diff --git a/usr.bin/sdiff/tests/d_input2 b/usr.bin/sdiff/tests/d_input2
new file mode 100644
index 0000000..70e1b57
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_input2
@@ -0,0 +1,69 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-__sysctl: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-read: permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-getpid: permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fcntl: permit
+ native-getdirentries: permit
+ native-lseek: permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-sigaction: permit
+ native-ioctl: permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-pread: permit
+ native-write: permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-poll: permit
+ native-nanosleep: permit
+ native-gettimeofday: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-sendto: true then permit
+ native-select: permit
+ native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_oneline.in b/usr.bin/sdiff/tests/d_oneline.in
new file mode 100644
index 0000000..acbe86c
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_oneline.in
@@ -0,0 +1 @@
+abcd
diff --git a/usr.bin/sdiff/tests/d_oneline_a.out b/usr.bin/sdiff/tests/d_oneline_a.out
new file mode 100644
index 0000000..18f7c6b
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_oneline_a.out
@@ -0,0 +1 @@
+ > abcd
diff --git a/usr.bin/sdiff/tests/d_oneline_b.out b/usr.bin/sdiff/tests/d_oneline_b.out
new file mode 100644
index 0000000..04cad47
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_oneline_b.out
@@ -0,0 +1 @@
+abcd <
diff --git a/usr.bin/sdiff/tests/d_same.out b/usr.bin/sdiff/tests/d_same.out
new file mode 100644
index 0000000..f929fcf
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_same.out
@@ -0,0 +1,72 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ native-__sysctl: permit native-__sysctl: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe native-connect: sockaddr eq "inet-[127.0.0.1]:53" then pe
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then p native-connect: sockaddr match "inet-\\\[*\\\]:80" then p
+ native-exit: permit native-exit: permit
+ native-fcntl: cmd eq "F_SETFD" then permit native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename eq "/" then permit native-fsread: filename eq "/" then permit
+ native-fsread: filename match "/<non-existent filename>: native-fsread: filename match "/<non-existent filename>:
+ native-fsread: filename eq "/etc/lynx.cfg" then permit native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-fsread: filename eq "/etc/utmp" then permit native-fsread: filename eq "/etc/utmp" then permit
+ native-fsread: filename eq "/home" then permit native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "$HOME" then permit native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then per native-fsread: filename eq "$HOME/.lynx-keymaps" then per
+ native-fsread: filename eq "$HOME/.lynxrc" then permit native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permi native-fsread: filename eq "$HOME/.mime.types" then permi
+ native-fsread: filename eq "$HOME/.terminfo" then permit native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then perm native-fsread: filename eq "$HOME/.terminfo.db" then perm
+ native-fsread: filename eq "/obj" then permit native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then p native-fsread: filename match "/usr/lib/libc.so.*" then p
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" t native-fsread: filename match "/usr/lib/libcrypto.so.*" t
+ native-fsread: filename match "/usr/lib/libncurses.so.*" native-fsread: filename match "/usr/lib/libncurses.so.*"
+ native-fsread: filename match "/usr/lib/libssl.so.*" then native-fsread: filename match "/usr/lib/libssl.so.*" then
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then native-fsread: filename eq "/usr/obj/bin/systrace/." then
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailca native-fsread: filename eq "/usr/obj/bin/systrace/.mailca
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t native-fsread: filename eq "/usr/obj/bin/systrace/.mime.t
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" native-fsread: filename eq "/usr/share/misc/terminfo.db"
+ native-fsread: filename eq "/var/run/dev.db" then permit native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then pe native-fsread: filename eq "/var/run/ld.so.hints" then pe
+ native-fstat: permit native-fstat: permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-getdirentries: permit native-getdirentries: permit
+ native-getpid: permit native-getpid: permit
+ native-gettimeofday: permit native-gettimeofday: permit
+ native-ioctl: permit native-ioctl: permit
+ native-issetugid: permit native-issetugid: permit
+ native-lseek: permit native-lseek: permit
+ native-mmap: permit native-mmap: permit
+ native-mprotect: prot eq "PROT_READ" then permit native-mprotect: prot eq "PROT_READ" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permi
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm native-mprotect: prot eq "PROT_READ|PROT_WRITE" then perm
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC"
+ native-munmap: permit native-munmap: permit
+ native-nanosleep: permit native-nanosleep: permit
+ native-poll: permit native-poll: permit
+ native-pread: permit native-pread: permit
+ native-read: permit native-read: permit
+ native-recvfrom: permit native-recvfrom: permit
+ native-select: permit native-select: permit
+ native-sendto: true then permit native-sendto: true then permit
+ native-sigaction: permit native-sigaction: permit
+ native-sigprocmask: permit native-sigprocmask: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK native-socket: sockdom eq "AF_INET" and socktype eq "SOCK
+ native-write: permit native-write: permit
diff --git a/usr.bin/sdiff/tests/d_short.out b/usr.bin/sdiff/tests/d_short.out
new file mode 100644
index 0000000..7a33460
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_short.out
@@ -0,0 +1,15 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-__sysctl: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-read: permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
diff --git a/usr.bin/sdiff/tests/d_tabends.in b/usr.bin/sdiff/tests/d_tabends.in
new file mode 100644
index 0000000..0547049
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends.in
@@ -0,0 +1,17 @@
+
+0
+01
+012
+0123
+01234
+012345
+0123456
+01234567
+012345670
+0123456701
+01234567012
+012345670123
+0123456701234
+01234567012345
+012345670123456
+0123456701234567
diff --git a/usr.bin/sdiff/tests/d_tabends_a.out b/usr.bin/sdiff/tests/d_tabends_a.out
new file mode 100644
index 0000000..423bd02
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends_a.out
@@ -0,0 +1,17 @@
+ <
+0 <
+01 <
+012 <
+0123 <
+01234 <
+012345 <
+0123456 <
+01234567 <
+012345670 <
+0123456701 <
+01234567012 <
+012345670123 <
+0123456701234 <
+0123456701234 <
+0123456701234 <
+0123456701234 <
diff --git a/usr.bin/sdiff/tests/d_tabends_b.out b/usr.bin/sdiff/tests/d_tabends_b.out
new file mode 100644
index 0000000..b180705
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends_b.out
@@ -0,0 +1,17 @@
+ >
+ > 0
+ > 01
+ > 012
+ > 0123
+ > 01234
+ > 012345
+ > 0123456
+ > 01234567
+ > 012345670
+ > 0123456701
+ > 01234567012
+ > 012345670123
+ > 0123456701234
+ > 0123456701234
+ > 0123456701234
+ > 0123456701234
diff --git a/usr.bin/sdiff/tests/d_tabends_c.out b/usr.bin/sdiff/tests/d_tabends_c.out
new file mode 100644
index 0000000..c301382
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabends_c.out
@@ -0,0 +1,17 @@
+ <
+0 <
+01 <
+012 <
+0123 <
+01234 <
+012345 <
+0123456 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
+01234567 <
diff --git a/usr.bin/sdiff/tests/d_tabs.out b/usr.bin/sdiff/tests/d_tabs.out
new file mode 100644
index 0000000..a67d7b1
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabs.out
@@ -0,0 +1,102 @@
+Policy: /usr/bin/lynx, Emulation: native Policy: /usr/bin/lynx, Emulation: native
+ > native-issetugid: permit
+ > native-mprotect: permit
+ > native-mmap: permit
+ native-__sysctl: permit native-__sysctl: permit
+ > native-fsread: filename eq "/var/run/ld.so.hints" the
+ > native-fstat: permit
+ native-close: permit native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" the | native-fsread: filename match "/usr/lib/libssl.so.*"
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" th | native-read: permit
+ native-exit: permit | native-fsread: filename match "/usr/lib/libcrypto.so.
+ native-fcntl: cmd eq "F_SETFD" then permit | native-fsread: filename match "/usr/lib/libncurses.so
+ native-fsread: filename eq "/" then permit | native-fsread: filename match "/usr/lib/libc.so.*" th
+ native-fsread: filename match "/<non-existent filenam | native-munmap: permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permi | native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then pe native-fsread: filename eq "/etc/malloc.conf" then pe
+ native-fsread: filename eq "/etc/resolv.conf" then pe | native-getpid: permit
+ native-fsread: filename eq "/etc/utmp" then permit <
+ native-fsread: filename eq "/home" then permit <
+ native-fsread: filename eq "$HOME" then permit <
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then <
+ native-fsread: filename eq "$HOME/.lynxrc" then permi <
+ native-fsread: filename eq "$HOME/.mailcap" then perm <
+ native-fsread: filename eq "$HOME/.mime.types" then p <
+ native-fsread: filename eq "$HOME/.terminfo" then per <
+ native-fsread: filename eq "$HOME/.terminfo.db" then <
+ native-fsread: filename eq "/obj" then permit <
+ native-fsread: filename eq "/tmp" then permit native-fsread: filename eq "/tmp" then permit
+ > native-fswrite: filename match "/tmp/lynx-*" then per
+ native-fsread: filename match "/tmp/lynx-*/." then pe native-fsread: filename match "/tmp/lynx-*/." then pe
+ > native-fsread: filename eq "$HOME" then permit
+ > native-fsread: filename eq "/etc/lynx.cfg" then permi
+ > native-fsread: filename eq "/" then permit
+ > native-fsread: filename eq "/usr/obj/bin/systrace/."
+ > native-fsread: filename eq "/usr/obj/bin" then permit
+ > native-fcntl: permit
+ > native-getdirentries: permit
+ > native-lseek: permit
+ > native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" th <
+ native-fsread: filename match "/usr/lib/libcrypto.so. <
+ native-fsread: filename match "/usr/lib/libncurses.so <
+ native-fsread: filename match "/usr/lib/libssl.so.*" <
+ native-fsread: filename eq "/usr/libdata" then permit native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit | native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit | native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." | native-fsread: filename eq "$HOME/.lynxrc" then permi
+ > native-fsread: filename match "/<non-existent filenam
+ native-fsread: filename eq "/usr/obj/bin/systrace/.ma native-fsread: filename eq "/usr/obj/bin/systrace/.ma
+ > native-fsread: filename eq "$HOME/.mailcap" then perm
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mi native-fsread: filename eq "/usr/obj/bin/systrace/.mi
+ > native-fsread: filename eq "$HOME/.mime.types" then p
+ > native-sigaction: permit
+ > native-ioctl: permit
+ > native-fsread: filename eq "$HOME/.terminfo.db" then
+ > native-fsread: filename eq "$HOME/.terminfo" then per
+ native-fsread: filename eq "/usr/share/misc/terminfo. native-fsread: filename eq "/usr/share/misc/terminfo.
+ > native-pread: permit
+ > native-write: permit
+ > native-fsread: filename eq "$HOME/.lynx-keymaps" then
+ native-fsread: filename eq "/var/run/dev.db" then per native-fsread: filename eq "/var/run/dev.db" then per
+ native-fsread: filename eq "/var/run/ld.so.hints" the | native-fsread: filename eq "/etc/utmp" then permit
+ native-fstat: permit <
+ native-fswrite: filename match "/tmp/lynx-*" then per <
+ native-getdirentries: permit <
+ native-getpid: permit <
+ native-gettimeofday: permit <
+ native-ioctl: permit <
+ native-issetugid: permit <
+ native-lseek: permit <
+ native-mmap: permit <
+ native-mprotect: prot eq "PROT_READ" then permit <
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then p <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then <
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_E <
+ native-munmap: permit <
+ native-nanosleep: permit <
+ native-poll: permit native-poll: permit
+ native-pread: permit | native-nanosleep: permit
+ native-read: permit | native-gettimeofday: permit
+ native-recvfrom: permit | native-fsread: filename eq "/etc/resolv.conf" then pe
+ native-select: permit <
+ native-sendto: true then permit <
+ native-sigaction: permit <
+ native-sigprocmask: permit <
+ native-socket: sockdom eq "AF_INET" and socktype eq " native-socket: sockdom eq "AF_INET" and socktype eq "
+ > native-connect: sockaddr eq "inet-[127.0.0.1]:53" the
+ > native-sendto: true then permit
+ > native-select: permit
+ > native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq " native-socket: sockdom eq "AF_INET" and socktype eq "
+ native-write: permit | native-connect: sockaddr match "inet-\\\[*\\\]:80" th
+ > native-exit: permit
diff --git a/usr.bin/sdiff/tests/d_tabs1.in b/usr.bin/sdiff/tests/d_tabs1.in
new file mode 100644
index 0000000..b5a1834
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabs1.in
@@ -0,0 +1,72 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-__sysctl: permit
+ native-close: permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
+ native-fcntl: cmd eq "F_SETFD" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-getdirentries: permit
+ native-getpid: permit
+ native-gettimeofday: permit
+ native-ioctl: permit
+ native-issetugid: permit
+ native-lseek: permit
+ native-mmap: permit
+ native-mprotect: prot eq "PROT_READ" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_EXEC" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE" then permit
+ native-mprotect: prot eq "PROT_READ|PROT_WRITE|PROT_EXEC" then permit
+ native-munmap: permit
+ native-nanosleep: permit
+ native-poll: permit
+ native-pread: permit
+ native-read: permit
+ native-recvfrom: permit
+ native-select: permit
+ native-sendto: true then permit
+ native-sigaction: permit
+ native-sigprocmask: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-write: permit
diff --git a/usr.bin/sdiff/tests/d_tabs2.in b/usr.bin/sdiff/tests/d_tabs2.in
new file mode 100644
index 0000000..d00f415
--- /dev/null
+++ b/usr.bin/sdiff/tests/d_tabs2.in
@@ -0,0 +1,69 @@
+Policy: /usr/bin/lynx, Emulation: native
+ native-issetugid: permit
+ native-mprotect: permit
+ native-mmap: permit
+ native-__sysctl: permit
+ native-fsread: filename eq "/var/run/ld.so.hints" then permit
+ native-fstat: permit
+ native-close: permit
+ native-fsread: filename match "/usr/lib/libssl.so.*" then permit
+ native-read: permit
+ native-fsread: filename match "/usr/lib/libcrypto.so.*" then permit
+ native-fsread: filename match "/usr/lib/libncurses.so.*" then permit
+ native-fsread: filename match "/usr/lib/libc.so.*" then permit
+ native-munmap: permit
+ native-sigprocmask: permit
+ native-fsread: filename eq "/etc/malloc.conf" then permit
+ native-getpid: permit
+ native-fsread: filename eq "/tmp" then permit
+ native-fswrite: filename match "/tmp/lynx-*" then permit
+ native-fsread: filename match "/tmp/lynx-*/." then permit
+ native-fsread: filename eq "$HOME" then permit
+ native-fsread: filename eq "/etc/lynx.cfg" then permit
+ native-fsread: filename eq "/" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/." then permit
+ native-fsread: filename eq "/usr/obj/bin" then permit
+ native-fcntl: permit
+ native-getdirentries: permit
+ native-lseek: permit
+ native-fsread: filename eq "/usr/obj" then permit
+ native-fsread: filename eq "/usr" then permit
+ native-fsread: filename eq "/usr/bin" then permit
+ native-fsread: filename eq "/usr/games" then permit
+ native-fsread: filename eq "/usr/include" then permit
+ native-fsread: filename eq "/usr/lib" then permit
+ native-fsread: filename eq "/usr/libdata" then permit
+ native-fsread: filename eq "/usr/libexec" then permit
+ native-fsread: filename eq "/usr/lkm" then permit
+ native-fsread: filename eq "/usr/local" then permit
+ native-fsread: filename eq "/usr/mdec" then permit
+ native-fsread: filename eq "/home" then permit
+ native-fsread: filename eq "/obj" then permit
+ native-fsread: filename eq "$HOME/.lynxrc" then permit
+ native-fsread: filename match "/<non-existent filename>: *" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mailcap" then permit
+ native-fsread: filename eq "$HOME/.mailcap" then permit
+ native-fsread: filename eq "/usr/obj/bin/systrace/.mime.types" then permit
+ native-fsread: filename eq "$HOME/.mime.types" then permit
+ native-sigaction: permit
+ native-ioctl: permit
+ native-fsread: filename eq "$HOME/.terminfo.db" then permit
+ native-fsread: filename eq "$HOME/.terminfo" then permit
+ native-fsread: filename eq "/usr/share/misc/terminfo.db" then permit
+ native-pread: permit
+ native-write: permit
+ native-fsread: filename eq "$HOME/.lynx-keymaps" then permit
+ native-fsread: filename eq "/var/run/dev.db" then permit
+ native-fsread: filename eq "/etc/utmp" then permit
+ native-poll: permit
+ native-nanosleep: permit
+ native-gettimeofday: permit
+ native-fsread: filename eq "/etc/resolv.conf" then permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_DGRAM" then permit
+ native-connect: sockaddr eq "inet-[127.0.0.1]:53" then permit
+ native-sendto: true then permit
+ native-select: permit
+ native-recvfrom: permit
+ native-socket: sockdom eq "AF_INET" and socktype eq "SOCK_STREAM" then permit
+ native-connect: sockaddr match "inet-\\\[*\\\]:80" then permit
+ native-exit: permit
diff --git a/usr.bin/sdiff/tests/sdiff.sh b/usr.bin/sdiff/tests/sdiff.sh
new file mode 100755
index 0000000..51aac6b
--- /dev/null
+++ b/usr.bin/sdiff/tests/sdiff.sh
@@ -0,0 +1,207 @@
+# $NetBSD: t_sdiff.sh,v 1.1 2012/03/17 16:33:15 jruoho Exp $
+# $FreeBSD$
+#
+# Copyright (c) 2008, 2009 The NetBSD Foundation, 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 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.
+#
+
+atf_test_case flags
+flags_head()
+{
+ atf_set "descr" "Checks -l, -s and -w flags"
+}
+flags_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_flags_l.out -s eq:1 \
+ sdiff -l "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input2"
+
+ atf_check -o file:$(atf_get_srcdir)/d_flags_s.out -s eq:1 \
+ sdiff -s "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input2"
+
+ atf_check -o file:$(atf_get_srcdir)/d_flags_w.out -s eq:1 \
+ sdiff -w 125 "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input2"
+}
+
+atf_test_case iflags
+iflags_head()
+{
+ atf_set "descr" "Checks flags -l, -s and -w combined with -I"
+}
+iflags_body()
+{
+ tail1="-w 125 -I .*filename.* $(atf_get_srcdir)/d_input1 $(atf_get_srcdir)/d_input2"
+ tail2="-w 125 -I .*filename.* $(atf_get_srcdir)/d_input2 $(atf_get_srcdir)/d_input1"
+
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_a1.out -s eq:1 sdiff ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_a2.out -s eq:1 sdiff ${tail2}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_b1.out -s eq:1 sdiff -s ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_b2.out -s eq:1 sdiff -s ${tail2}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_c1.out -s eq:1 sdiff -l ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_c2.out -s eq:1 sdiff -l ${tail2}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_d1.out -s eq:1 sdiff -s ${tail1}
+ atf_check -o file:$(atf_get_srcdir)/d_iflags_d2.out -s eq:1 sdiff -s ${tail2}
+}
+
+atf_test_case tabs
+tabs_head()
+{
+ atf_set "descr" "Checks comparing files containing tabs"
+}
+tabs_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_tabs.out -s eq:1 \
+ sdiff "$(atf_get_srcdir)/d_tabs1.in" "$(atf_get_srcdir)/d_tabs2.in"
+}
+
+atf_test_case tabends
+tabends_head()
+{
+ atf_set "descr" "Checks correct handling of lines ended with tabs"
+}
+tabends_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_tabends_a.out -s eq:1 \
+ sdiff -w30 "$(atf_get_srcdir)/d_tabends.in" /dev/null
+
+ atf_check -o file:$(atf_get_srcdir)/d_tabends_b.out -s eq:1 \
+ sdiff -w30 /dev/null "$(atf_get_srcdir)/d_tabends.in"
+
+ atf_check -o file:$(atf_get_srcdir)/d_tabends_c.out -s eq:1 \
+ sdiff -w19 "$(atf_get_srcdir)/d_tabends.in" /dev/null
+}
+
+atf_test_case merge
+merge_head()
+{
+ atf_set "descr" "Checks interactive merging"
+}
+merge_body()
+{
+ merge_tail="-o merge.out $(atf_get_srcdir)/d_input1 \
+$(atf_get_srcdir)/d_input2 >/dev/null ; cat merge.out"
+
+ cp $(atf_get_srcdir)/d_input* .
+
+ atf_check -o file:d_input1 -x "yes l | sdiff ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff ${merge_tail}"
+
+ atf_check -o file:d_input1 -x \
+ "yes el | EDITOR=cat VISUAL=cat sdiff ${merge_tail}"
+ atf_check -o file:d_input2 -x \
+ "yes er | EDITOR=cat VISUAL=cat sdiff ${merge_tail}"
+
+ atf_check -o file:d_input1 -x "yes l | sdiff -s ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff -s ${merge_tail}"
+ atf_check -o file:d_input1 -x "yes l | sdiff -l ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff -l ${merge_tail}"
+ atf_check -o file:d_input1 -x "yes l | sdiff -ls ${merge_tail}"
+ atf_check -o file:d_input2 -x "yes r | sdiff -ls ${merge_tail}"
+
+ atf_check -o file:d_input1 -x "{ while :; do echo s; echo l; \
+echo v; echo l; done; } | sdiff ${merge_tail}"
+
+ atf_check -o file:d_input2 -x "{ while :; do echo s; echo r; \
+echo v; echo r; done; } | sdiff ${merge_tail}"
+}
+
+atf_test_case same
+same_head()
+{
+ atf_set "descr" "Checks comparing file with itself"
+}
+same_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_same.out \
+ sdiff "$(atf_get_srcdir)/d_input1" "$(atf_get_srcdir)/d_input1"
+}
+
+atf_test_case oneline
+oneline_head()
+{
+ atf_set "descr" "Checks comparing one-line files"
+}
+oneline_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_oneline_a.out -s eq:1 \
+ sdiff /dev/null "$(atf_get_srcdir)/d_oneline.in"
+
+ atf_check -o file:$(atf_get_srcdir)/d_oneline_b.out -s eq:1 \
+ sdiff "$(atf_get_srcdir)/d_oneline.in" /dev/null
+}
+
+atf_test_case dot
+dot_head()
+{
+ atf_set "descr" "Checks comparing with file containing only one character"
+}
+dot_body()
+{
+ echo ". <" > expout
+ atf_check -o file:expout -s eq:1 sdiff "$(atf_get_srcdir)/d_dot.in" /dev/null
+
+ echo " > ." > expout
+ atf_check -o file:expout -s eq:1 sdiff /dev/null "$(atf_get_srcdir)/d_dot.in"
+}
+
+atf_test_case stdin
+stdin_head()
+{
+ atf_set "descr" "Checks reading data from stdin"
+}
+stdin_body()
+{
+ echo " > stdin" > expout
+ atf_check -o file:expout -s eq:1 -x \
+ "echo stdin | sdiff /dev/null /dev/stdin"
+
+ echo "stdin <" > expout
+ atf_check -o file:expout -s eq:1 -x \
+ "echo stdin | sdiff /dev/stdin /dev/null"
+}
+
+atf_test_case short
+short_head()
+{
+ atf_set "descr" "Checks premature stop of merging"
+}
+short_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/d_short.out -x \
+ "printf \"r\\nl\\nr\\nl\" | sdiff -o merge.out $(atf_get_srcdir)/d_input1 \
+$(atf_get_srcdir)/d_input2 >/dev/null ; cat merge.out"
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case flags
+ atf_add_test_case iflags
+ atf_add_test_case tabs
+ atf_add_test_case tabends
+ atf_add_test_case merge
+ atf_add_test_case same
+ atf_add_test_case oneline
+ atf_add_test_case dot
+ atf_add_test_case stdin
+ atf_add_test_case short
+}
diff --git a/usr.bin/svn/Makefile.inc b/usr.bin/svn/Makefile.inc
index 2621238..7404de4 100644
--- a/usr.bin/svn/Makefile.inc
+++ b/usr.bin/svn/Makefile.inc
@@ -15,7 +15,7 @@ PACKAGE= svn
SVNDIR= ${.CURDIR}/../../../contrib/subversion/subversion
APRU= ${.CURDIR}/../../../contrib/apr-util
APR= ${.CURDIR}/../../../contrib/apr
-WARNS?= 0 # defintely not warns friendly
+WARNS?= 0 # definitely not warns friendly
.if exists(${.CURDIR}/../../Makefile.inc)
.include "${.CURDIR}/../../Makefile.inc"
diff --git a/usr.bin/svn/svn_private_config.h b/usr.bin/svn/svn_private_config.h
index 03ff604..4907e98 100644
--- a/usr.bin/svn/svn_private_config.h
+++ b/usr.bin/svn/svn_private_config.h
@@ -17,7 +17,7 @@
/* #undef ENABLE_NLS */
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
-#define HAVE_BIND_TEXTDOMAIN_CODESET 1
+/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@@ -110,7 +110,7 @@
#define PACKAGE_NAME "subversion"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "subversion 1.9.2"
+#define PACKAGE_STRING "subversion 1.9.4"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "subversion"
@@ -119,7 +119,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.8.14"
+#define PACKAGE_VERSION "1.9.4"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
diff --git a/usr.bin/tests/Makefile b/usr.bin/tests/Makefile
index e8e8e80..77a87ea 100644
--- a/usr.bin/tests/Makefile
+++ b/usr.bin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
diff --git a/usr.bin/timeout/tests/timeout.sh b/usr.bin/timeout/tests/timeout.sh
index e04e6f9..6ccde32 100644
--- a/usr.bin/timeout/tests/timeout.sh
+++ b/usr.bin/timeout/tests/timeout.sh
@@ -83,7 +83,7 @@ exit_numbers_body()
-s exit:124 \
-x timeout .1 sleep 1
- # With preserv status exit shoudl be 128 + TERM aka 143
+ # With preserv status exit should be 128 + TERM aka 143
atf_check \
-o empty \
-e empty \
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c
index 804efd8..d682541 100644
--- a/usr.bin/timeout/timeout.c
+++ b/usr.bin/timeout/timeout.c
@@ -227,7 +227,7 @@ main(int argc, char **argv)
argv++;
if (!foreground) {
- /* Aquire a reaper */
+ /* Acquire a reaper */
if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
err(EX_OSERR, "Fail to acquire the reaper");
}
diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c
index 6864e7b..3d85711 100644
--- a/usr.bin/whereis/whereis.c
+++ b/usr.bin/whereis/whereis.c
@@ -505,7 +505,7 @@ main(int argc, char **argv)
(rlen = matches[1].rm_eo -
matches[1].rm_so) > 0) {
/*
- * man -w found formated
+ * man -w found formatted
* page, need to pick up
* source page name.
*/
diff --git a/usr.bin/xlint/lint2/chk.c b/usr.bin/xlint/lint2/chk.c
index 4062246..4bdd5b7 100644
--- a/usr.bin/xlint/lint2/chk.c
+++ b/usr.bin/xlint/lint2/chk.c
@@ -459,7 +459,7 @@ chkau(hte_t *hte, int n, sym_t *def, sym_t *decl, pos_t *pos1p,
promote = def != NULL && def->s_osdef;
/*
- * If we compair with a definition or declaration, we must perform
+ * If we compare with a definition or declaration, we must perform
* the same checks for qualifiers in indirected types as in
* assignments.
*/
diff --git a/usr.sbin/bluetooth/btpand/btpand.c b/usr.sbin/bluetooth/btpand/btpand.c
index 243fcf5..f4f3e69 100644
--- a/usr.sbin/bluetooth/btpand/btpand.c
+++ b/usr.sbin/bluetooth/btpand/btpand.c
@@ -66,7 +66,7 @@ static const struct {
const char * desc;
} services[] = {
{ "PANU", SDP_SERVICE_CLASS_PANU, "Personal Area Networking User" },
- { "NAP", SDP_SERVICE_CLASS_NAP, "Network Acess Point" },
+ { "NAP", SDP_SERVICE_CLASS_NAP, "Network Access Point" },
{ "GN", SDP_SERVICE_CLASS_GN, "Group Network" },
};
diff --git a/usr.sbin/bluetooth/hccontrol/node.c b/usr.sbin/bluetooth/hccontrol/node.c
index fb6fd19..f1f2694 100644
--- a/usr.sbin/bluetooth/hccontrol/node.c
+++ b/usr.sbin/bluetooth/hccontrol/node.c
@@ -592,7 +592,7 @@ struct hci_command node_commands[] = {
"Write the value of the Role Switch parameter for the HCI node. By default,\n" \
"if Role Switch is supported, local device will try to perform Role Switch\n" \
"and become Master on incoming connection. Some devices do not support Role\n" \
-"Switch and thus incomming connections from such devices will fail. Setting\n" \
+"Switch and thus incoming connections from such devices will fail. Setting\n" \
"this parameter to zero will prevent Role Switch and thus accepting device\n" \
"will remain Slave",
&hci_write_node_role_switch
diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr
index 2b911fc..49b9186 100644
--- a/usr.sbin/bsdconfig/share/common.subr
+++ b/usr.sbin/bsdconfig/share/common.subr
@@ -167,7 +167,7 @@ f_debug_init()
[ "$debugFile" ] && { [ "${debug+set}" ] || debug=1; }
#
- # Make debugging persistant if set
+ # Make debugging persistent if set
#
[ "$debug" ] && export debug
[ "$debugFile" ] && export debugFile
@@ -175,7 +175,7 @@ f_debug_init()
#
# Truncate debug file unless requested otherwise. Note that we will
# trim a leading plus (`+') from the value of debugFile to support
- # persistant meaning that f_dprintf() should print both to standard
+ # persistent meaning that f_dprintf() should print both to standard
# output and $debugFile (minus the leading plus, of course).
#
local _debug_file="${debugFile#+}"
diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr
index 1e63aec..17e7b4a 100644
--- a/usr.sbin/bsdconfig/share/dialog.subr
+++ b/usr.sbin/bsdconfig/share/dialog.subr
@@ -105,10 +105,10 @@ DIALOG_ESC=255
#
# When manually sizing Xdialog(1) widgets such as calendar and timebox, you'll
# need to know the size of the embedded GUI objects because the height passed
-# to Xdialog(1) for these widgets has to be tall enough to accomodate them.
+# to Xdialog(1) for these widgets has to be tall enough to accommodate them.
#
# These values are helpful when manually sizing with dialog(1) too, but in a
-# different way. dialog(1) does not make you accomodate the custom items in the
+# different way. dialog(1) does not make you accommodate the custom items in the
# height (but does for width) -- a height of 3 will display three lines and a
# full calendar, for example (whereas Xdialog will truncate the calendar if
# given a height of 3). For dialog(1), use these values for making sure that
@@ -703,7 +703,7 @@ f_dialog_buttonbox_size()
# Adjust height if desired
if [ "$__var_height" ]; then
- # Add height to accomodate the buttons
+ # Add height to accommodate the buttons
__height_bbox_size=$(( $__height_bbox_size + 2 ))
# Adjust for clipping with Xdialog(1) on Linux/GTK2
@@ -1382,7 +1382,7 @@ f_dialog_calendar_size()
__height=$( echo "$__prompt" | f_number_of_lines )
if [ "$USE_XDIALOG" ]; then
- # Add height to accomodate for embedded calendar widget
+ # Add height to accommodate for embedded calendar widget
__height=$(( $__height + $DIALOG_CALENDAR_HEIGHT - 1 ))
# Also, bump height if backtitle is enabled
diff --git a/usr.sbin/bsdconfig/share/geom.subr b/usr.sbin/bsdconfig/share/geom.subr
index 912a5c7..d6486c6 100644
--- a/usr.sbin/bsdconfig/share/geom.subr
+++ b/usr.sbin/bsdconfig/share/geom.subr
@@ -91,7 +91,7 @@ f_struct_define GEOM_PROVIDER_CONFIG \
# f_geom_get_all
#
# Parse sysctl(8) `kern.geom.confxml' data into a series of structs. GEOM
-# classes are at the top of the heirarchy and are stored as numbered structs
+# classes are at the top of the hierarchy and are stored as numbered structs
# from 1 to $NGEOM_CLASSES (set by this function) named `geom_class_C'. GEOM
# objects within each class are stored as numbered structs from 1 to `ngeoms'
# (a property of the GEOM class struct) named `geom_class_C_geom_N' (where C
diff --git a/usr.sbin/bsdconfig/share/media/tcpip.subr b/usr.sbin/bsdconfig/share/media/tcpip.subr
index 42c6e20..d149bc6 100644
--- a/usr.sbin/bsdconfig/share/media/tcpip.subr
+++ b/usr.sbin/bsdconfig/share/media/tcpip.subr
@@ -1129,7 +1129,7 @@ f_host_lookup()
# allows you to have a mostly non-interactive script that still
# prompts for network setup/confirmation.
#
-# After successfull execution, the following variables are set:
+# After successful execution, the following variables are set:
#
# VAR_IFCONFIG + $device (e.g., `ifconfig_em0')
# Defines the ifconfig(8) properties specific to $device.
diff --git a/usr.sbin/bsdconfig/share/packages/index.subr b/usr.sbin/bsdconfig/share/packages/index.subr
index de81656..95260da 100644
--- a/usr.sbin/bsdconfig/share/packages/index.subr
+++ b/usr.sbin/bsdconfig/share/packages/index.subr
@@ -123,7 +123,7 @@ f_index_initialize()
#
#
- # Calculate digest used to determine if the on-disk persistant cache
+ # Calculate digest used to determine if the on-disk persistent cache
# INDEX (containing this digest on the first line) is valid and can be
# used to quickly populate the environment.
#
@@ -135,7 +135,7 @@ f_index_initialize()
fi
#
- # Check to see if the persistant cache INDEX file exists
+ # Check to see if the persistent cache INDEX file exists
#
if [ -f "$PACKAGES_INDEX_CACHEFILE" ]; then
#
@@ -184,7 +184,7 @@ f_index_initialize()
) | sort )'
#
- # Attempt to create the persistant on-disk cache
+ # Attempt to create the persistent on-disk cache
#
# Create a new temporary file to write to
diff --git a/usr.sbin/bsdconfig/share/packages/packages.subr b/usr.sbin/bsdconfig/share/packages/packages.subr
index 3780185..a22edd8 100644
--- a/usr.sbin/bsdconfig/share/packages/packages.subr
+++ b/usr.sbin/bsdconfig/share/packages/packages.subr
@@ -143,7 +143,7 @@ f_package_select()
# f_package_deselect $package ...
#
-# Remove $package from teh list of tracked/selected packages. If $package is
+# Remove $package from the list of tracked/selected packages. If $package is
# not being tracked (doesn't appear in $SELECTED_PACKAGES), this function
# amounts to having no effet.
#
@@ -187,7 +187,7 @@ f_package_detect_installed()
# Also calculates the total number of installed/selected packages stored as
# $_All_ninstalled and $_All_nselected.
#
-# Calculations are peformed by checking "marks". A "mark" is stored as
+# Calculations are performed by checking "marks". A "mark" is stored as
# $_mark_$varpkg -- where $varpkg is the product of `f_str2varname $package
# varpkg'. A mark can be "X" for an installed package, `I' for a package that
# is marked for installation, "R" for a package that is marked for re-install,
diff --git a/usr.sbin/bsdconfig/startup/share/rcconf.subr b/usr.sbin/bsdconfig/startup/share/rcconf.subr
index 38b4cc8..80b6504 100644
--- a/usr.sbin/bsdconfig/startup/share/rcconf.subr
+++ b/usr.sbin/bsdconfig/startup/share/rcconf.subr
@@ -124,7 +124,7 @@ f_startup_rcconf_map()
#
#
- # Calculate digest used to determine if the on-disk global persistant
+ # Calculate digest used to determine if the on-disk global persistent
# cache file (containing this digest on the first line) is valid and
# can be used to quickly populate the cache value for immediate return.
#
@@ -132,7 +132,7 @@ f_startup_rcconf_map()
__rc_defaults_digest=$( exec 2> /dev/null; md5 < "$RC_DEFAULTS" )
#
- # Check to see if the global persistant cache file exists
+ # Check to see if the global persistent cache file exists
#
if [ -f "$STARTUP_RCCONF_MAP_CACHEFILE" ]; then
#
@@ -176,7 +176,7 @@ f_startup_rcconf_map()
#
# If we reach this point, we need to generate the data from scratch
- # (and after we do, we'll attempt to create the global persistant
+ # (and after we do, we'll attempt to create the global persistent
# cache file to speed up future executions).
#
@@ -215,7 +215,7 @@ f_startup_rcconf_map()
fi
#
- # Attempt to create the persistant global cache
+ # Attempt to create the persistent global cache
#
# Create a new temporary file to write to
diff --git a/usr.sbin/bsdconfig/startup/share/rcvar.subr b/usr.sbin/bsdconfig/startup/share/rcvar.subr
index c5a7885..c1a6ff2 100644
--- a/usr.sbin/bsdconfig/startup/share/rcvar.subr
+++ b/usr.sbin/bsdconfig/startup/share/rcvar.subr
@@ -121,7 +121,7 @@ f_startup_rcvar_map()
#
# Calculate a digest given the checksums of all dependencies (scripts
# and the defaults file). This digest will be used to determine if an
- # on-disk global persistant cache file (containg this digest on the
+ # on-disk global persistent cache file (containg this digest on the
# first line) is valid and can be used to quickly populate the cache
# value for immediate return.
#
@@ -130,7 +130,7 @@ f_startup_rcvar_map()
cksum "$RC_DEFAULTS" $__rc_script_list 2> /dev/null | md5 )
#
- # Check to see if the global persistant cache file exists
+ # Check to see if the global persistent cache file exists
#
if [ -f "$STARTUP_RCVAR_MAP_CACHEFILE" ]; then
#
@@ -174,7 +174,7 @@ f_startup_rcvar_map()
#
# If we reach this point, we need to generate the data from scratch
- # (and after we do, we'll attempt to create the global persistant
+ # (and after we do, we'll attempt to create the global persistent
# cache file to speed up future executions).
#
@@ -208,7 +208,7 @@ f_startup_rcvar_map()
fi
#
- # Attempt to create/update the persistant global cache
+ # Attempt to create/update the persistent global cache
#
# Create a new temporary file to write to
diff --git a/usr.sbin/bsdinstall/scripts/netconfig_ipv4 b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
index 88a0fa2..ffa9846 100755
--- a/usr.sbin/bsdinstall/scripts/netconfig_ipv4
+++ b/usr.sbin/bsdinstall/scripts/netconfig_ipv4
@@ -84,7 +84,7 @@ retval=$?
if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
. $BSDINSTALL_TMPETC/._rc.conf.net
- ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE`
+ ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE | sed "s|$2||"`
if [ "$defaultrouter" ]; then
route delete -inet default
route add -inet default $defaultrouter
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index b076081..dc0eedc 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -1321,7 +1321,7 @@ zfs_create_boot()
# MBR boot loader touch-up
if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
f_dprintf "$funcname: Updating MBR boot loader on disks..."
- # Stick the ZFS boot loader in the "convienient hole" after
+ # Stick the ZFS boot loader in the "convenient hole" after
# the ZFS internal metadata
for disk in $disks; do
f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
index 43dd9a4..a682c80 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c
@@ -338,8 +338,9 @@ static char *
snmp_date2asn_oid(char *str, struct asn_oid *oid)
{
char *endptr, *ptr;
- uint32_t v;
+ static const char UTC[3] = "UTC";
int32_t saved_errno;
+ uint32_t v;
if (snmp_suboid_append(oid, (asn_subid_t) SNMP_DATETIME_OCTETS) < 0)
return (NULL);
@@ -440,8 +441,8 @@ snmp_date2asn_oid(char *str, struct asn_oid *oid)
/* 'UTC' - optional */
ptr = endptr + 1;
- if (strncmp(ptr, "UTC", strlen("UTC")) == 0)
- ptr += strlen("UTC");
+ if (strncmp(ptr, UTC, sizeof(UTC)) == 0)
+ ptr += sizeof(UTC);
/* '+/-' */
if (*ptr == '-' || *ptr == '+') {
diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c
index 9284eb5..badfce1 100644
--- a/usr.sbin/camdd/camdd.c
+++ b/usr.sbin/camdd/camdd.c
@@ -446,7 +446,7 @@ static int need_status = 0;
#endif
-/* Generically usefull offsets into the peripheral private area */
+/* Generically useful offsets into the peripheral private area */
#define ppriv_ptr0 periph_priv.entries[0].ptr
#define ppriv_ptr1 periph_priv.entries[1].ptr
#define ppriv_field0 periph_priv.entries[0].field
diff --git a/usr.sbin/cron/cron/cron.c b/usr.sbin/cron/cron/cron.c
index 0cdb9e3..21243e7 100644
--- a/usr.sbin/cron/cron/cron.c
+++ b/usr.sbin/cron/cron/cron.c
@@ -228,7 +228,7 @@ cron_tick(cron_db *db, int secres)
register user *u;
register entry *e;
- /* make 0-based values out of these so we can use them as indicies
+ /* make 0-based values out of these so we can use them as indices
*/
second = (secres == 0) ? 0 : tm->tm_sec -FIRST_SECOND;
minute = tm->tm_min -FIRST_MINUTE;
@@ -289,7 +289,7 @@ cron_tick(cron_db *db, int secres)
time_t difftime = TargetTime + tm->tm_gmtoff - diff;
gmtime_r(&difftime, &otztm);
- /* make 0-based values out of these so we can use them as indicies
+ /* make 0-based values out of these so we can use them as indices
*/
otzsecond = (secres == 0) ? 0 : otztm.tm_sec -FIRST_SECOND;
otzminute = otztm.tm_min -FIRST_MINUTE;
diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c
index 57b1f77..01e62bf 100644
--- a/usr.sbin/cron/cron/popen.c
+++ b/usr.sbin/cron/cron/popen.c
@@ -47,7 +47,7 @@ static const char rcsid[] =
#define WANT_GLOBBING 0
/*
- * Special version of popen which avoids call to shell. This insures noone
+ * Special version of popen which avoids call to shell. This insures no one
* may create a pipe to a hidden program as a side effect of a list or dir
* command.
*/
diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 2e5817b..16ce287 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -2922,7 +2922,7 @@ cctl_islist_end_element(void *user_data, const char *name)
/* Nothing. */
} else {
/*
- * Unknown element; ignore it for forward compatiblity.
+ * Unknown element; ignore it for forward compatibility.
*/
}
diff --git a/usr.sbin/extattr/tests/Makefile b/usr.sbin/extattr/tests/Makefile
index 7dec010..935e6cf 100644
--- a/usr.sbin/extattr/tests/Makefile
+++ b/usr.sbin/extattr/tests/Makefile
@@ -1,5 +1,9 @@
# $FreeBSD$
+PACKAGE= tests
+FILESGROUPS= TESTS
+TESTSPACKAGE= ${PACKAGE}
+
ATF_TESTS_SH= extattr_test
.include <bsd.test.mk>
diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c
index f3e5ce9..7a00192 100644
--- a/usr.sbin/gssd/gssd.c
+++ b/usr.sbin/gssd/gssd.c
@@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$");
struct gss_resource {
LIST_ENTRY(gss_resource) gr_link;
- uint64_t gr_id; /* indentifier exported to kernel */
+ uint64_t gr_id; /* identifier exported to kernel */
void* gr_res; /* GSS-API resource pointer */
};
LIST_HEAD(gss_resource_list, gss_resource) gss_resources;
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 752a7a4..9f91385 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1934,7 +1934,7 @@ more:
if (sep->se_bi && sep->se_bi->bi_maxchild >= 0)
sep->se_maxchild = sep->se_bi->bi_maxchild;
else if (sep->se_accept)
- sep->se_maxchild = maxchild > 0 ? maxchild : 0;
+ sep->se_maxchild = MAX(maxchild, 0);
else
sep->se_maxchild = 1;
}
diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8
index 6dd8c7f..70f6d10 100644
--- a/usr.sbin/jail/jail.8
+++ b/usr.sbin/jail/jail.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 25, 2016
+.Dd April 30, 2016
.Dt JAIL 8
.Os
.Sh NAME
@@ -653,7 +653,7 @@ its keys.
If set to
.Dq disable ,
the jail cannot perform any sysvmsg-related system calls.
-.It Va sysvsem, sysvmsg
+.It Va sysvsem, sysvshm
Allow access to SYSV IPC semaphore and shared memory primitives, in the
same manner as
.Va sysvmsg.
@@ -838,13 +838,14 @@ Allow making changes to a
jail.
.It Va depend
Specify a jail (or jails) that this jail depends on.
-Any such jails must be fully created, up to the last
+When this jail is to be created, any jail(s) it depends on must already exist.
+If not, they will be created automatically, up to the completion of the last
.Va exec.poststart
command, before any action will taken to create this jail.
When jails are removed the opposite is true:
-this jail must be fully removed, up to the last
+this jail will be removed, up to the last
.Va exec.poststop
-command, before the jail(s) it depends on are stopped.
+command, before any jail(s) it depends on are stopped.
.El
.Sh EXAMPLES
Jails are typically set up using one of two philosophies: either to
diff --git a/usr.sbin/jail/jailparse.y b/usr.sbin/jail/jailparse.y
index d085eb8..515fc58 100644
--- a/usr.sbin/jail/jailparse.y
+++ b/usr.sbin/jail/jailparse.y
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
/*
* A config file is a series of jails (containing parameters) and jail-less
- * parameters which realy belong to a global pseudo-jail.
+ * parameters which really belong to a global pseudo-jail.
*/
conf :
;
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index ce0ba7c..0f960e8 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -640,7 +640,7 @@ trstat_write(struct printer *pp, tr_sendrecv sendrecv, size_t bytecnt,
* a host as it receives a datafile.
* user=<userid> - user who sent the job (if known)
* secs=<n> - seconds it took to transfer the file
- * bytes=<n> - number of bytes transfered (ie, "bytecount")
+ * bytes=<n> - number of bytes transferred (ie, "bytecount")
* bps=<n.n>e<n> - Bytes/sec (if the transfer was "big enough"
* for this to be useful)
* ! top=<str> - type of printer (if the type is defined in
diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c
index 5b5ec78..2be4c84 100644
--- a/usr.sbin/lpr/lpc/lpc.c
+++ b/usr.sbin/lpr/lpc/lpc.c
@@ -182,7 +182,7 @@ cmdscanner(void)
if ((bp = el_gets(el, &num)) == NULL || num == 0)
quit(0, NULL);
- len = (num > MAX_CMDLINE - 1) ? MAX_CMDLINE - 1 : num;
+ len = MIN(MAX_CMDLINE - 1, num);
memcpy(cmdline, bp, len);
cmdline[len] = 0;
history(hist, &he, H_ENTER, bp);
diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c
index ec8834c..c7ee4e9 100644
--- a/usr.sbin/lpr/lpd/recvjob.c
+++ b/usr.sbin/lpr/lpd/recvjob.c
@@ -140,7 +140,7 @@ recvjob(const char *printer)
/*
* Read printer jobs sent by lpd and copy them to the spooling directory.
- * Return the number of jobs successfully transfered.
+ * Return the number of jobs successfully transferred.
*/
static int
readjob(struct printer *pp)
@@ -356,7 +356,7 @@ read_number(const char *fn)
}
/*
- * Remove all the files associated with the current job being transfered.
+ * Remove all the files associated with the current job being transferred.
*/
static void
rcleanup(int signo __unused)
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c
index dfdaf57..eca58eb 100644
--- a/usr.sbin/makefs/ffs/mkfs.c
+++ b/usr.sbin/makefs/ffs/mkfs.c
@@ -610,8 +610,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
acg.cg_magic = CG_MAGIC;
acg.cg_cgx = cylno;
acg.cg_niblk = sblock.fs_ipg;
- acg.cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ?
- sblock.fs_ipg : 2 * INOPB(&sblock);
+ acg.cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock));
acg.cg_ndblk = dmax - cbase;
if (sblock.fs_contigsumsize > 0)
acg.cg_nclusterblks = acg.cg_ndblk >> sblock.fs_fragshift;
@@ -730,7 +729,7 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts)
* Write out the duplicate super block, the cylinder group map
* and two blocks worth of inodes in a single write.
*/
- start = sblock.fs_bsize > SBLOCKSIZE ? sblock.fs_bsize : SBLOCKSIZE;
+ start = MAX(sblock.fs_bsize, SBLOCKSIZE);
memcpy(&iobuf[start], &acg, sblock.fs_cgsize);
if (fsopts->needswap)
ffs_cg_swap(&acg, (struct cg*)&iobuf[start], &sblock);
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index a9464f6..e4b04b0 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -3171,7 +3171,7 @@ makemask(struct sockaddr_storage *ssp, int bitlen)
return (-1);
for (i = 0; i < len; i++) {
- bits = (bitlen > CHAR_BIT) ? CHAR_BIT : bitlen;
+ bits = MIN(CHAR_BIT, bitlen);
*p++ = (u_char)~0 << (CHAR_BIT - bits);
bitlen -= bits;
}
diff --git a/usr.sbin/nandsim/nandsim_cfgparse.c b/usr.sbin/nandsim/nandsim_cfgparse.c
index a9b5eb1..2cbb89d 100644
--- a/usr.sbin/nandsim/nandsim_cfgparse.c
+++ b/usr.sbin/nandsim/nandsim_cfgparse.c
@@ -528,7 +528,7 @@ parse_config(char *cfgfname, const char *devfname)
error("Controller#%d already created\n",
ctrls[i].num);
else if (err == EINVAL)
- error("Incorrect controler number (%d)\n",
+ error("Incorrect controller number (%d)\n",
ctrls[i].num);
else
error("Could not created controller#%d\n",
diff --git a/usr.sbin/pmcstat/pmcpl_calltree.c b/usr.sbin/pmcstat/pmcpl_calltree.c
index 3d0127d..edfe85a 100644
--- a/usr.sbin/pmcstat/pmcpl_calltree.c
+++ b/usr.sbin/pmcstat/pmcpl_calltree.c
@@ -830,7 +830,7 @@ pmcpl_ct_node_printchild(struct pmcpl_ct_node *ct, uintfptr_t paddr,
/*
* Child cost.
- * TODO: attach child cost to the real position in the funtion.
+ * TODO: attach child cost to the real position in the function.
* TODO: cfn=<fn> / call <ncall> addr(<fn>) / addr(call <fn>) <arccost>
*/
for (i=0 ; i<ct->pct_narc; i++) {
diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c
index ea9b547..26f3615 100644
--- a/usr.sbin/pmcstat/pmcstat_log.c
+++ b/usr.sbin/pmcstat/pmcstat_log.c
@@ -1372,7 +1372,7 @@ pmcstat_analyze_log(void)
assert(args.pa_flags & FLAG_DO_ANALYSIS);
if (elf_version(EV_CURRENT) == EV_NONE)
- err(EX_UNAVAILABLE, "Elf library intialization failed");
+ err(EX_UNAVAILABLE, "Elf library initialization failed");
while (pmclog_read(args.pa_logparser, &ev) == 0) {
assert(ev.pl_state == PMCLOG_OK);
diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c
index ac90da6..9e9ae79 100644
--- a/usr.sbin/quot/quot.c
+++ b/usr.sbin/quot/quot.c
@@ -142,7 +142,7 @@ get_inode(int fd, struct fs *super, ino_t ino)
if (!ipbuf
&& !(ipbuf = malloc(INOSZ(super))))
errx(1, "allocate inodes");
- last = (ino / INOCNT(super)) * INOCNT(super);
+ last = rounddown(ino, INOCNT(super));
if (lseek(fd, (off_t)ino_to_fsba(super, last) << super->fs_fshift, 0) < (off_t)0
|| read(fd, ipbuf, INOSZ(super)) != (ssize_t)INOSZ(super))
err(1, "read inodes");
@@ -414,7 +414,7 @@ dofsizes(int fd, struct fs *super, char *name)
errx(1, "allocate fsize structure");
fp->fsz_next = *fsp;
*fsp = fp;
- fp->fsz_first = (ksz / FSZCNT) * FSZCNT;
+ fp->fsz_first = rounddown(ksz, FSZCNT);
fp->fsz_last = fp->fsz_first + FSZCNT;
for (i = FSZCNT; --i >= 0;) {
fp->fsz_count[i] = 0;
diff --git a/usr.sbin/rpcbind/rpcb_svc_com.c b/usr.sbin/rpcbind/rpcb_svc_com.c
index 2ee2a4c..5c6b8dd 100644
--- a/usr.sbin/rpcbind/rpcb_svc_com.c
+++ b/usr.sbin/rpcbind/rpcb_svc_com.c
@@ -634,7 +634,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
/*
* Should be multiple of 4 for XDR.
*/
- sendsz = ((sendsz + 3) / 4) * 4;
+ sendsz = roundup(sendsz, 4);
if (sendsz > RPC_BUF_MAX) {
#ifdef notyet
buf_alloc = alloca(sendsz); /* not in IDR2? */
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index 7694811..9976c78 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -1223,7 +1223,7 @@ udiff(uint32_t u, uint32_t v)
return (u >= v ? u - v : v - u);
}
-/* return a non-zero value if the received prefix is inconsitent with ours */
+/* return a non-zero value if the received prefix is inconsistent with ours */
static int
prefix_check(struct nd_opt_prefix_info *pinfo,
struct rainfo *rai, struct sockaddr_in6 *from)
diff --git a/usr.sbin/tests/Makefile b/usr.sbin/tests/Makefile
index 609357e..06058a0 100644
--- a/usr.sbin/tests/Makefile
+++ b/usr.sbin/tests/Makefile
@@ -2,8 +2,9 @@
.include <bsd.own.mk>
+FILESGROUPS= FILES
PACKAGE= tests
-FILESGROUPS= TESTS
+FILESGROUPS+= TESTS
TESTSPACKAGE= ${PACKAGE}
TESTS+= Kyuafile
OpenPOWER on IntegriCloud