svn commit: r299091 - in user/ngie/release-pkg-fix-tests: . etc/mtree include lib/libbluetooth sbin/fsck_msdosfs sbin/hastd share/man/man3 sys/amd64/amd64 sys/arm/allwinner sys/arm/amlogic/aml8726 ...

Garrett Cooper ngie at FreeBSD.org
Wed May 4 22:57:30 UTC 2016


Author: ngie
Date: Wed May  4 22:57:28 2016
New Revision: 299091
URL: https://svnweb.freebsd.org/changeset/base/299091

Log:
  MFhead at r299090

Added:
  user/ngie/release-pkg-fix-tests/sys/arm/allwinner/if_awg.c
     - copied unchanged from r299090, head/sys/arm/allwinner/if_awg.c
  user/ngie/release-pkg-fix-tests/sys/arm/allwinner/if_awgreg.h
     - copied unchanged from r299090, head/sys/arm/allwinner/if_awgreg.h
  user/ngie/release-pkg-fix-tests/tests/sys/sys/
     - copied from r299090, head/tests/sys/sys/
Modified:
  user/ngie/release-pkg-fix-tests/Makefile.inc1
  user/ngie/release-pkg-fix-tests/etc/mtree/BSD.tests.dist
  user/ngie/release-pkg-fix-tests/include/bitstring.h
  user/ngie/release-pkg-fix-tests/lib/libbluetooth/bluetooth.h
  user/ngie/release-pkg-fix-tests/sbin/fsck_msdosfs/boot.c
  user/ngie/release-pkg-fix-tests/sbin/hastd/activemap.c
  user/ngie/release-pkg-fix-tests/share/man/man3/bitstring.3
  user/ngie/release-pkg-fix-tests/sys/amd64/amd64/pmap.c
  user/ngie/release-pkg-fix-tests/sys/arm/allwinner/files.allwinner
  user/ngie/release-pkg-fix-tests/sys/arm/amlogic/aml8726/aml8726_mmc.c
  user/ngie/release-pkg-fix-tests/sys/arm/amlogic/aml8726/aml8726_mmc.h
  user/ngie/release-pkg-fix-tests/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c
  user/ngie/release-pkg-fix-tests/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.h
  user/ngie/release-pkg-fix-tests/sys/arm/arm/cpufunc_asm_arm11.S
  user/ngie/release-pkg-fix-tests/sys/arm/arm/exception.S
  user/ngie/release-pkg-fix-tests/sys/arm/arm/generic_timer.c
  user/ngie/release-pkg-fix-tests/sys/arm/arm/gic.c
  user/ngie/release-pkg-fix-tests/sys/arm/arm/machdep.c
  user/ngie/release-pkg-fix-tests/sys/arm/arm/mpcore_timer.c
  user/ngie/release-pkg-fix-tests/sys/arm/arm/pmap-v4.c
  user/ngie/release-pkg-fix-tests/sys/arm/arm/pmap-v6.c
  user/ngie/release-pkg-fix-tests/sys/arm/arm/swtch-v4.S
  user/ngie/release-pkg-fix-tests/sys/arm/at91/at91_cfata.c
  user/ngie/release-pkg-fix-tests/sys/arm/at91/at91_machdep.c
  user/ngie/release-pkg-fix-tests/sys/arm/at91/at91_mci.c
  user/ngie/release-pkg-fix-tests/sys/arm/at91/at91_reset.S
  user/ngie/release-pkg-fix-tests/sys/arm/at91/at91reg.h
  user/ngie/release-pkg-fix-tests/sys/arm/at91/at91sam9260.c
  user/ngie/release-pkg-fix-tests/sys/arm/at91/if_ate.c
  user/ngie/release-pkg-fix-tests/sys/arm/at91/if_atereg.h
  user/ngie/release-pkg-fix-tests/sys/arm/broadcom/bcm2835/bcm2835_audio.c
  user/ngie/release-pkg-fix-tests/sys/arm/broadcom/bcm2835/bcm2835_dma.c
  user/ngie/release-pkg-fix-tests/sys/arm/cavium/cns11xx/if_ece.c
  user/ngie/release-pkg-fix-tests/sys/arm/freescale/imx/imx6_ipu.c
  user/ngie/release-pkg-fix-tests/sys/arm/freescale/imx/imx6_ssi.c
  user/ngie/release-pkg-fix-tests/sys/arm/freescale/vybrid/vf_uart.c
  user/ngie/release-pkg-fix-tests/sys/arm/mv/mpic.c
  user/ngie/release-pkg-fix-tests/sys/arm/mv/mv_common.c
  user/ngie/release-pkg-fix-tests/sys/arm/qemu/virt_machdep.c
  user/ngie/release-pkg-fix-tests/sys/arm/samsung/exynos/exynos5_usb_phy.c
  user/ngie/release-pkg-fix-tests/sys/arm/ti/omap4/omap4_prcm_clks.c
  user/ngie/release-pkg-fix-tests/sys/arm/ti/ti_i2c.c
  user/ngie/release-pkg-fix-tests/sys/arm/ti/ti_pinmux.c
  user/ngie/release-pkg-fix-tests/sys/arm/ti/ti_prcm.c
  user/ngie/release-pkg-fix-tests/sys/arm/ti/ti_scm.c
  user/ngie/release-pkg-fix-tests/sys/arm/ti/ti_sdma.c
  user/ngie/release-pkg-fix-tests/sys/arm/xilinx/zy7_slcr.c
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/i8134x/crb_machdep.c
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/i8134x/i81342reg.h
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/ixp425/avila_machdep.c
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/ixp425/cambria_gpio.c
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/ixp425/ixp425_npe.c
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/ixp425/ixp425_npereg.h
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/ixp425/ixp425_qmgr.c
  user/ngie/release-pkg-fix-tests/sys/arm/xscale/pxa/pxa_machdep.c
  user/ngie/release-pkg-fix-tests/sys/dev/iwn/if_iwn.c
  user/ngie/release-pkg-fix-tests/sys/dev/iwn/if_iwnvar.h
  user/ngie/release-pkg-fix-tests/sys/dev/pms/freebsd/driver/common/lxcommon.h
  user/ngie/release-pkg-fix-tests/sys/dev/pms/freebsd/driver/common/osenv.h
  user/ngie/release-pkg-fix-tests/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
  user/ngie/release-pkg-fix-tests/sys/dev/pms/freebsd/driver/ini/src/osapi.c
  user/ngie/release-pkg-fix-tests/sys/dev/usb/usb_device.c
  user/ngie/release-pkg-fix-tests/sys/dev/wi/if_wi.c
  user/ngie/release-pkg-fix-tests/sys/dev/xen/blkback/blkback.c
  user/ngie/release-pkg-fix-tests/sys/dev/xen/timer/timer.c
  user/ngie/release-pkg-fix-tests/sys/kern/subr_rtc.c
  user/ngie/release-pkg-fix-tests/sys/kern/subr_unit.c
  user/ngie/release-pkg-fix-tests/sys/net/flowtable.c
  user/ngie/release-pkg-fix-tests/sys/net80211/ieee80211_ht.c
  user/ngie/release-pkg-fix-tests/sys/net80211/ieee80211_var.h
  user/ngie/release-pkg-fix-tests/sys/sparc64/sbus/sbus.c
  user/ngie/release-pkg-fix-tests/sys/sparc64/sparc64/intr_machdep.c
  user/ngie/release-pkg-fix-tests/sys/sys/bitstring.h
  user/ngie/release-pkg-fix-tests/sys/sys/param.h
  user/ngie/release-pkg-fix-tests/tests/sys/Makefile
  user/ngie/release-pkg-fix-tests/tools/tools/locale/etc/charmaps.xml
  user/ngie/release-pkg-fix-tests/usr.sbin/bluetooth/hccontrol/le.c
  user/ngie/release-pkg-fix-tests/usr.sbin/extattr/Makefile
  user/ngie/release-pkg-fix-tests/usr.sbin/extattr/rmextattr.8
  user/ngie/release-pkg-fix-tests/usr.sbin/extattr/rmextattr.c
  user/ngie/release-pkg-fix-tests/usr.sbin/extattr/tests/extattr_test.sh
Directory Properties:
  user/ngie/release-pkg-fix-tests/   (props changed)

Modified: user/ngie/release-pkg-fix-tests/Makefile.inc1
==============================================================================
--- user/ngie/release-pkg-fix-tests/Makefile.inc1	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/Makefile.inc1	Wed May  4 22:57:28 2016	(r299091)
@@ -1133,6 +1133,8 @@ buildkernel: .MAKE .PHONY
 	@echo "--------------------------------------------------------------"
 .endfor
 
+NO_INSTALLEXTRAKERNELS?=	yes
+
 #
 # installkernel, etc.
 #
@@ -1152,7 +1154,7 @@ reinstallkernel reinstallkernel.debug: _
 	    ${CROSSENV} PATH=${TMPPATH} \
 	    ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
 .endif
-.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
 .for _kernel in ${BUILDKERNELS:[2..-1]}
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Installing kernel ${_kernel}"
@@ -1183,7 +1185,7 @@ distributekernel distributekernel.debug:
 	    ${DESTDIR}/${DISTDIR}/kernel.meta
 .endif
 .endif
-.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
 .for _kernel in ${BUILDKERNELS:[2..-1]}
 .if defined(NO_ROOT)
 	@echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
@@ -1214,7 +1216,7 @@ packagekernel: .PHONY
 	    tar cvf - --include '*/*/*.debug' \
 	    @${DESTDIR}/${DISTDIR}/kernel.meta | \
 	    ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
-.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
 .for _kernel in ${BUILDKERNELS:[2..-1]}
 	cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
 	    tar cvf - --exclude '*.debug' \
@@ -1235,7 +1237,7 @@ packagekernel: .PHONY
 	cd ${DESTDIR}/${DISTDIR}/kernel; \
 	    tar cvf - --include '*/*/*.debug' $$(eval find .) | \
 	    ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
-.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
 .for _kernel in ${BUILDKERNELS:[2..-1]}
 	cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
 	    tar cvf - --exclude '*.debug' . | \
@@ -1345,7 +1347,7 @@ create-kernel-packages:	_pkgbootstrap .P
 		-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
 .endfor
 .endif
-.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
+.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
 .for _kernel in ${BUILDKERNELS:[2..-1]}
 .if exists(${KSTAGEDIR}/kernel.${_kernel}.meta)
 .for flavor in "" -debug

Modified: user/ngie/release-pkg-fix-tests/etc/mtree/BSD.tests.dist
==============================================================================
--- user/ngie/release-pkg-fix-tests/etc/mtree/BSD.tests.dist	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/etc/mtree/BSD.tests.dist	Wed May  4 22:57:28 2016	(r299091)
@@ -460,6 +460,8 @@
         ..
         posixshm
         ..
+        sys
+        ..
         vfs
         ..
         vm

Modified: user/ngie/release-pkg-fix-tests/include/bitstring.h
==============================================================================
--- user/ngie/release-pkg-fix-tests/include/bitstring.h	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/include/bitstring.h	Wed May  4 22:57:28 2016	(r299091)
@@ -29,6 +29,8 @@
 #ifndef _BITSTRING_H_
 #define	_BITSTRING_H_
 
+#include <stdlib.h>
+#include <strings.h>
 #include <sys/bitstring.h>
 
 #endif /* _BITSTRING_H_ */

Modified: user/ngie/release-pkg-fix-tests/lib/libbluetooth/bluetooth.h
==============================================================================
--- user/ngie/release-pkg-fix-tests/lib/libbluetooth/bluetooth.h	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/lib/libbluetooth/bluetooth.h	Wed May  4 22:57:28 2016	(r299091)
@@ -35,14 +35,16 @@
 #define _BLUETOOTH_H_
 
 #include <sys/types.h>
-#include <sys/bitstring.h>
 #include <sys/endian.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <sys/un.h>
+
 #include <errno.h>
 #include <netdb.h>
+#include <bitstring.h>
+
 #include <netgraph/ng_message.h>
 #include <netgraph/bluetooth/include/ng_hci.h>
 #include <netgraph/bluetooth/include/ng_l2cap.h>

Modified: user/ngie/release-pkg-fix-tests/sbin/fsck_msdosfs/boot.c
==============================================================================
--- user/ngie/release-pkg-fix-tests/sbin/fsck_msdosfs/boot.c	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/sbin/fsck_msdosfs/boot.c	Wed May  4 22:57:28 2016	(r299091)
@@ -221,7 +221,7 @@ readboot(int dosfs, struct bootblock *bo
 		break;
 	}
 
-	if (boot->NumFatEntries < boot->NumClusters) {
+	if (boot->NumFatEntries < boot->NumClusters - CLUST_FIRST) {
 		pfatal("FAT size too small, %u entries won't fit into %u sectors\n",
 		       boot->NumClusters, boot->FATsecs);
 		return FSFATAL;

Modified: user/ngie/release-pkg-fix-tests/sbin/hastd/activemap.c
==============================================================================
--- user/ngie/release-pkg-fix-tests/sbin/hastd/activemap.c	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/sbin/hastd/activemap.c	Wed May  4 22:57:28 2016	(r299091)
@@ -162,7 +162,7 @@ activemap_init(struct activemap **ampp, 
 	amp->am_extentsize = extentsize;
 	amp->am_extentshift = bitcount32(extentsize - 1);
 	amp->am_nextents = ((mediasize - 1) / extentsize) + 1;
-	amp->am_mapsize = sizeof(bitstr_t) * bitstr_size(amp->am_nextents);
+	amp->am_mapsize = bitstr_size(amp->am_nextents);
 	amp->am_diskmapsize = roundup2(amp->am_mapsize, sectorsize);
 	amp->am_ndirty = 0;
 	amp->am_syncoff = -2;
@@ -552,7 +552,7 @@ activemap_calc_ondisk_size(uint64_t medi
 	PJDLOG_ASSERT(powerof2(sectorsize));
 
 	nextents = ((mediasize - 1) / extentsize) + 1;
-	mapsize = sizeof(bitstr_t) * bitstr_size(nextents);
+	mapsize = bitstr_size(nextents);
 	return (roundup2(mapsize, sectorsize));
 }
 

Modified: user/ngie/release-pkg-fix-tests/share/man/man3/bitstring.3
==============================================================================
--- user/ngie/release-pkg-fix-tests/share/man/man3/bitstring.3	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/share/man/man3/bitstring.3	Wed May  4 22:57:28 2016	(r299091)
@@ -27,23 +27,54 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
+.\" Copyright (c) 2014 Spectra Logic Corporation
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions, and the following disclaimer,
+.\"    without modification.
+.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer
+.\"    substantially 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 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.
+.\"
 .\"     @(#)bitstring.3	8.1 (Berkeley) 7/19/93
 .\" $FreeBSD$
 .\"
-.Dd October 17, 2015
+.Dd May 4, 2016
 .Dt BITSTRING 3
 .Os
 .Sh NAME
 .Nm bit_alloc ,
 .Nm bit_clear ,
 .Nm bit_decl ,
+.Nm bit_ffc ,
 .Nm bit_ffs ,
+.Nm bit_ffc_at ,
+.Nm bit_ffs_at ,
 .Nm bit_nclear ,
 .Nm bit_nset ,
 .Nm bit_set ,
-.Nm bitstr_size ,
-.Nm bit_test
-.Nd bit-string manipulation macros
+.Nm bit_test ,
+.Nm bitstr_size
+.Nd bit-string manipulation functions and macros
 .Sh SYNOPSIS
 .In bitstring.h
 .Ft bitstr_t *
@@ -57,6 +88,10 @@
 .Ft void
 .Fn bit_ffs "bitstr_t *name" "int nbits" "int *value"
 .Ft void
+.Fn bit_ffc_at "bitstr_t *name" "int start" "int nbits" "int *value"
+.Ft void
+.Fn bit_ffs_at "bitstr_t *name" "int start" "int nbits" "int *value"
+.Ft void
 .Fn bit_nclear "bitstr_t *name" "int start" "int stop"
 .Ft void
 .Fn bit_nset "bitstr_t *name" "int start" "int stop"
@@ -69,7 +104,7 @@
 .Sh DESCRIPTION
 These macros operate on strings of bits.
 .Pp
-The macro
+The function
 .Fn bit_alloc
 returns a pointer of type
 .Dq Fa "bitstr_t *"
@@ -78,23 +113,31 @@ to sufficient space to store
 bits, or
 .Dv NULL
 if no space is available.
+If successful, the returned bit string is initialized with all bits cleared.
 .Pp
 The macro
 .Fn bit_decl
-allocates sufficient space to store
+declares a bit string with sufficient space to store
 .Fa nbits
-bits on the stack.
+bits.
+.Fn bit_decl
+may be used to include statically sized bit strings in structure
+definitions or to create bit strings on the stack.
+Users of this macro are responsible for initialization of the bit string,
+typically via a global initialization of the containing struct or use of the
+.Fn bit_nset
+or
+.Fn bin_nclear
+functions.
 .Pp
 The macro
 .Fn bitstr_size
-returns the number of elements of type
-.Fa bitstr_t
-necessary to store
+returns the number of bytes necessary to store
 .Fa nbits
 bits.
 This is useful for copying bit strings.
 .Pp
-The macros
+The functions
 .Fn bit_clear
 and
 .Fn bit_set
@@ -107,7 +150,7 @@ The
 .Fn bit_nset
 and
 .Fn bit_nclear
-macros
+functions
 set or clear the zero-based numbered bits from
 .Fa start
 through
@@ -117,16 +160,28 @@ in the bit string
 .Pp
 The
 .Fn bit_test
-macro
+function
 evaluates to non-zero if the zero-based numbered bit
 .Fa bit
 of bit string
 .Fa name
 is set, and zero otherwise.
 .Pp
+The function
+.Fn bit_ffc
+stores in the location referenced by
+.Fa value
+the zero-based number of the first bit not set in the array of
+.Fa nbits
+bits referenced by
+.Fa name .
+If all bits are set, the location referenced by
+.Fa value
+is set to \-1.
+.Pp
 The
 .Fn bit_ffs
-macro
+function
 stores in the location referenced by
 .Fa value
 the zero-based number of the first bit set in the array of
@@ -137,19 +192,40 @@ If no bits are set, the location referen
 .Fa value
 is set to \-1.
 .Pp
-The macro
-.Fn bit_ffc
+The function
+.Fn bit_ffc_at
 stores in the location referenced by
 .Fa value
 the zero-based number of the first bit not set in the array of
 .Fa nbits
 bits referenced by
-.Fa name .
-If all bits are set, the location referenced by
+.Fa name ,
+at or after the zero-based bit index
+.Fa start .
+If all bits at or after
+.Fa start
+are set, the location referenced by
+.Fa value
+is set to \-1.
+.Pp
+The
+.Fn bit_ffs_at
+function
+stores in the location referenced by
+.Fa value
+the zero-based number of the first bit set in the array of
+.Fa nbits
+bits referenced by
+.Fa name ,
+at or after the zero-based bit index
+.Fa start .
+If no bits are set after
+.Fa start ,
+the location referenced by
 .Fa value
 is set to \-1.
 .Pp
-The arguments to these macros are evaluated only once and may safely
+The arguments in bit string macros are evaluated only once and may safely
 have side effects.
 .Sh EXAMPLES
 .Bd -literal -offset indent

Modified: user/ngie/release-pkg-fix-tests/sys/amd64/amd64/pmap.c
==============================================================================
--- user/ngie/release-pkg-fix-tests/sys/amd64/amd64/pmap.c	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/sys/amd64/amd64/pmap.c	Wed May  4 22:57:28 2016	(r299091)
@@ -4407,6 +4407,12 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t 
 		    lockp)) {
 			SLIST_INIT(&free);
 			if (pmap_unwire_ptp(pmap, va, mpde, &free)) {
+				/*
+				 * Although "va" is not mapped, paging-
+				 * structure caches could nonetheless have
+				 * entries that refer to the freed page table
+				 * pages.  Invalidate those entries.
+				 */
 				pmap_invalidate_page(pmap, va);
 				pmap_free_zero_pages(&free);
 			}
@@ -4584,6 +4590,12 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 		if (mpte != NULL) {
 			SLIST_INIT(&free);
 			if (pmap_unwire_ptp(pmap, va, mpte, &free)) {
+				/*
+				 * Although "va" is not mapped, paging-
+				 * structure caches could nonetheless have
+				 * entries that refer to the freed page table
+				 * pages.  Invalidate those entries.
+				 */
 				pmap_invalidate_page(pmap, va);
 				pmap_free_zero_pages(&free);
 			}
@@ -4967,6 +4979,14 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 					SLIST_INIT(&free);
 					if (pmap_unwire_ptp(dst_pmap, addr,
 					    dstmpte, &free)) {
+						/*
+						 * Although "addr" is not
+						 * mapped, paging-structure
+						 * caches could nonetheless
+						 * have entries that refer to
+						 * the freed page table pages.
+						 * Invalidate those entries.
+						 */
 						pmap_invalidate_page(dst_pmap,
 						    addr);
 						pmap_free_zero_pages(&free);
@@ -5219,7 +5239,7 @@ pmap_page_is_mapped(vm_page_t m)
  * Destroy all managed, non-wired mappings in the given user-space
  * pmap.  This pmap cannot be active on any processor besides the
  * caller.
- *                                                                                
+ *
  * This function cannot be applied to the kernel pmap.  Moreover, it
  * is not intended for general use.  It is only to be used during
  * process termination.  Consequently, it can be implemented in ways

Modified: user/ngie/release-pkg-fix-tests/sys/arm/allwinner/files.allwinner
==============================================================================
--- user/ngie/release-pkg-fix-tests/sys/arm/allwinner/files.allwinner	Wed May  4 22:34:11 2016	(r299090)
+++ user/ngie/release-pkg-fix-tests/sys/arm/allwinner/files.allwinner	Wed May  4 22:57:28 2016	(r299091)
@@ -18,6 +18,7 @@ arm/allwinner/a20/a20_cpu_cfg.c 	standar
 arm/allwinner/allwinner_machdep.c	standard
 arm/allwinner/aw_mp.c			optional	smp
 arm/allwinner/axp209.c			optional	axp209
+arm/allwinner/if_awg.c			optional	awg
 arm/allwinner/if_emac.c			optional	emac
 arm/allwinner/sunxi_dma_if.m		standard
 dev/iicbus/twsi/a10_twsi.c		optional	twsi

Copied: user/ngie/release-pkg-fix-tests/sys/arm/allwinner/if_awg.c (from r299090, head/sys/arm/allwinner/if_awg.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/ngie/release-pkg-fix-tests/sys/arm/allwinner/if_awg.c	Wed May  4 22:57:28 2016	(r299091, copy of r299090, head/sys/arm/allwinner/if_awg.c)
@@ -0,0 +1,1418 @@
+/*-
+ * Copyright (c) 2016 Jared McNeill <jmcneill at invisible.ca>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Allwinner Gigabit Ethernet MAC (EMAC) controller
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+#include <sys/kernel.h>
+#include <sys/endian.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/module.h>
+#include <sys/taskqueue.h>
+
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/ethernet.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+#include <net/if_var.h>
+
+#include <machine/bus.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <arm/allwinner/if_awgreg.h>
+#include <dev/mii/mii.h>
+#include <dev/mii/miivar.h>
+
+#include <dev/extres/clk/clk.h>
+#include <dev/extres/hwreset/hwreset.h>
+#include <dev/extres/regulator/regulator.h>
+
+#include "miibus_if.h"
+
+#define	RD4(sc, reg)		bus_read_4((sc)->res[0], (reg))
+#define	WR4(sc, reg, val)	bus_write_4((sc)->res[0], (reg), (val))
+
+#define	AWG_LOCK(sc)		mtx_lock(&(sc)->mtx)
+#define	AWG_UNLOCK(sc)		mtx_unlock(&(sc)->mtx);
+#define	AWG_ASSERT_LOCKED(sc)	mtx_assert(&(sc)->mtx, MA_OWNED)
+#define	AWG_ASSERT_UNLOCKED(sc)	mtx_assert(&(sc)->mtx, MA_NOTOWNED)
+
+#define	DESC_ALIGN		4
+#define	TX_DESC_COUNT		256
+#define	TX_DESC_SIZE		(sizeof(struct emac_desc) * TX_DESC_COUNT)
+#define	RX_DESC_COUNT		256
+#define	RX_DESC_SIZE		(sizeof(struct emac_desc) * RX_DESC_COUNT)
+
+#define	DESC_OFF(n)		((n) * sizeof(struct emac_desc))
+#define	TX_NEXT(n)		(((n) + 1) & (TX_DESC_COUNT - 1))
+#define	TX_SKIP(n, o)		(((n) + (o)) & (TX_DESC_COUNT - 1))
+#define	RX_NEXT(n)		(((n) + 1) & (RX_DESC_COUNT - 1))
+
+#define	TX_MAX_SEGS		10
+
+#define	SOFT_RST_RETRY		1000
+#define	MII_BUSY_RETRY		1000
+#define	MDIO_FREQ		2500000
+
+#define	BURST_LEN_DEFAULT	8
+#define	RX_TX_PRI_DEFAULT	0
+#define	PAUSE_TIME_DEFAULT	0x400
+#define	TX_INTERVAL_DEFAULT	64
+
+/* Burst length of RX and TX DMA transfers */
+static int awg_burst_len = BURST_LEN_DEFAULT;
+TUNABLE_INT("hw.awg.burst_len", &awg_burst_len);
+
+/* RX / TX DMA priority. If 1, RX DMA has priority over TX DMA. */
+static int awg_rx_tx_pri = RX_TX_PRI_DEFAULT;
+TUNABLE_INT("hw.awg.rx_tx_pri", &awg_rx_tx_pri);
+
+/* Pause time field in the transmitted control frame */
+static int awg_pause_time = PAUSE_TIME_DEFAULT;
+TUNABLE_INT("hw.awg.pause_time", &awg_pause_time);
+
+/* Request a TX interrupt every <n> descriptors */
+static int awg_tx_interval = TX_INTERVAL_DEFAULT;
+TUNABLE_INT("hw.awg.tx_interval", &awg_tx_interval);
+
+static struct ofw_compat_data compat_data[] = {
+	{ "allwinner,sun8i-a83t-emac",		1 },
+	{ NULL,					0 }
+};
+
+struct awg_bufmap {
+	bus_dmamap_t		map;
+	struct mbuf		*mbuf;
+};
+
+struct awg_txring {
+	bus_dma_tag_t		desc_tag;
+	bus_dmamap_t		desc_map;
+	struct emac_desc	*desc_ring;
+	bus_addr_t		desc_ring_paddr;
+	bus_dma_tag_t		buf_tag;
+	struct awg_bufmap	buf_map[TX_DESC_COUNT];
+	u_int			cur, next, queued;
+};
+
+struct awg_rxring {
+	bus_dma_tag_t		desc_tag;
+	bus_dmamap_t		desc_map;
+	struct emac_desc	*desc_ring;
+	bus_addr_t		desc_ring_paddr;
+	bus_dma_tag_t		buf_tag;
+	struct awg_bufmap	buf_map[RX_DESC_COUNT];
+	u_int			cur;
+};
+
+struct awg_softc {
+	struct resource		*res[2];
+	struct mtx		mtx;
+	if_t			ifp;
+	device_t		miibus;
+	struct callout		stat_ch;
+	struct task		link_task;
+	void			*ih;
+	u_int			mdc_div_ratio_m;
+	int			link;
+	int			if_flags;
+
+	struct awg_txring	tx;
+	struct awg_rxring	rx;
+};
+
+static struct resource_spec awg_spec[] = {
+	{ SYS_RES_MEMORY,	0,	RF_ACTIVE },
+	{ SYS_RES_IRQ,		0,	RF_ACTIVE },
+	{ -1, 0 }
+};
+
+static int
+awg_miibus_readreg(device_t dev, int phy, int reg)
+{
+	struct awg_softc *sc;
+	int retry, val;
+
+	sc = device_get_softc(dev);
+	val = 0;
+
+	WR4(sc, EMAC_MII_CMD,
+	    (sc->mdc_div_ratio_m << MDC_DIV_RATIO_M_SHIFT) |
+	    (phy << PHY_ADDR_SHIFT) |
+	    (reg << PHY_REG_ADDR_SHIFT) |
+	    MII_BUSY);
+	for (retry = MII_BUSY_RETRY; retry > 0; retry--) {
+		if ((RD4(sc, EMAC_MII_CMD) & MII_BUSY) == 0) {
+			val = RD4(sc, EMAC_MII_DATA);
+			break;
+		}
+		DELAY(10);
+	}
+
+	if (retry == 0)
+		device_printf(dev, "phy read timeout, phy=%d reg=%d\n",
+		    phy, reg);
+
+	return (val);
+}
+
+static int
+awg_miibus_writereg(device_t dev, int phy, int reg, int val)
+{
+	struct awg_softc *sc;
+	int retry;
+
+	sc = device_get_softc(dev);
+
+	WR4(sc, EMAC_MII_DATA, val);
+	WR4(sc, EMAC_MII_CMD,
+	    (sc->mdc_div_ratio_m << MDC_DIV_RATIO_M_SHIFT) |
+	    (phy << PHY_ADDR_SHIFT) |
+	    (reg << PHY_REG_ADDR_SHIFT) |
+	    MII_WR | MII_BUSY);
+	for (retry = MII_BUSY_RETRY; retry > 0; retry--) {
+		if ((RD4(sc, EMAC_MII_CMD) & MII_BUSY) == 0)
+			break;
+		DELAY(10);
+	}
+
+	if (retry == 0)
+		device_printf(dev, "phy write timeout, phy=%d reg=%d\n",
+		    phy, reg);
+
+	return (0);
+}
+
+static void
+awg_update_link_locked(struct awg_softc *sc)
+{
+	struct mii_data *mii;
+	uint32_t val;
+
+	AWG_ASSERT_LOCKED(sc);
+
+	if ((if_getdrvflags(sc->ifp) & IFF_DRV_RUNNING) == 0)
+		return;
+	mii = device_get_softc(sc->miibus);
+
+	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+	    (IFM_ACTIVE | IFM_AVALID)) {
+		switch (IFM_SUBTYPE(mii->mii_media_active)) {
+		case IFM_1000_T:
+		case IFM_1000_SX:
+		case IFM_100_TX:
+		case IFM_10_T:
+			sc->link = 1;
+			break;
+		default:
+			sc->link = 0;
+			break;
+		}
+	} else
+		sc->link = 0;
+
+	if (sc->link == 0)
+		return;
+
+	val = RD4(sc, EMAC_BASIC_CTL_0);
+	val &= ~(BASIC_CTL_SPEED | BASIC_CTL_DUPLEX);
+
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
+	    IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX)
+		val |= BASIC_CTL_SPEED_1000 << BASIC_CTL_SPEED_SHIFT;
+	else if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX)
+		val |= BASIC_CTL_SPEED_100 << BASIC_CTL_SPEED_SHIFT;
+	else
+		val |= BASIC_CTL_SPEED_10 << BASIC_CTL_SPEED_SHIFT;
+
+	if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
+		val |= BASIC_CTL_DUPLEX;
+
+	WR4(sc, EMAC_BASIC_CTL_0, val);
+
+	val = RD4(sc, EMAC_RX_CTL_0);
+	val &= ~RX_FLOW_CTL_EN;
+	if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0)
+		val |= RX_FLOW_CTL_EN;
+	WR4(sc, EMAC_RX_CTL_0, val);
+
+	val = RD4(sc, EMAC_TX_FLOW_CTL);
+	val &= ~(PAUSE_TIME|TX_FLOW_CTL_EN);
+	if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0)
+		val |= TX_FLOW_CTL_EN;
+	if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
+		val |= awg_pause_time << PAUSE_TIME_SHIFT;
+	WR4(sc, EMAC_TX_FLOW_CTL, val);
+}
+
+static void
+awg_link_task(void *arg, int pending)
+{
+	struct awg_softc *sc;
+
+	sc = arg;
+
+	AWG_LOCK(sc);
+	awg_update_link_locked(sc);
+	AWG_UNLOCK(sc);
+}
+
+static void
+awg_miibus_statchg(device_t dev)
+{
+	struct awg_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	taskqueue_enqueue(taskqueue_swi, &sc->link_task);
+}
+
+static void
+awg_media_status(if_t ifp, struct ifmediareq *ifmr)
+{
+	struct awg_softc *sc;
+	struct mii_data *mii;
+
+	sc = if_getsoftc(ifp);
+	mii = device_get_softc(sc->miibus);
+
+	AWG_LOCK(sc);
+	mii_pollstat(mii);
+	ifmr->ifm_active = mii->mii_media_active;
+	ifmr->ifm_status = mii->mii_media_status;
+	AWG_UNLOCK(sc);
+}
+
+static int
+awg_media_change(if_t ifp)
+{
+	struct awg_softc *sc;
+	struct mii_data *mii;
+	int error;
+
+	sc = if_getsoftc(ifp);
+	mii = device_get_softc(sc->miibus);
+
+	AWG_LOCK(sc);
+	error = mii_mediachg(mii);
+	AWG_UNLOCK(sc);
+
+	return (error);
+}
+
+static void
+awg_setup_txdesc(struct awg_softc *sc, int index, int flags, bus_addr_t paddr,
+    u_int len)
+{
+	uint32_t status, size;
+
+	if (paddr == 0 || len == 0) {
+		status = 0;
+		size = 0;
+		--sc->tx.queued;
+	} else {
+		status = TX_DESC_CTL;
+		size = flags | len;
+		if ((index & (awg_tx_interval - 1)) == 0)
+			size |= htole32(TX_INT_CTL);
+		++sc->tx.queued;
+	}
+
+	sc->tx.desc_ring[index].addr = htole32((uint32_t)paddr);
+	sc->tx.desc_ring[index].size = htole32(size);
+	sc->tx.desc_ring[index].status = htole32(status);
+}
+
+static int
+awg_setup_txbuf(struct awg_softc *sc, int index, struct mbuf **mp)
+{
+	bus_dma_segment_t segs[TX_MAX_SEGS];
+	int error, nsegs, cur, i, flags;
+	u_int csum_flags;
+	struct mbuf *m;
+
+	m = *mp;
+	error = bus_dmamap_load_mbuf_sg(sc->tx.buf_tag,
+	    sc->tx.buf_map[index].map, m, segs, &nsegs, BUS_DMA_NOWAIT);
+	if (error == EFBIG) {
+		m = m_collapse(m, M_NOWAIT, TX_MAX_SEGS);
+		if (m == NULL)
+			return (0);
+		*mp = m;
+		error = bus_dmamap_load_mbuf_sg(sc->tx.buf_tag,
+		    sc->tx.buf_map[index].map, m, segs, &nsegs, BUS_DMA_NOWAIT);
+	}
+	if (error != 0)
+		return (0);
+
+	bus_dmamap_sync(sc->tx.buf_tag, sc->tx.buf_map[index].map,
+	    BUS_DMASYNC_PREWRITE);
+
+	flags = TX_FIR_DESC;
+	if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0) {
+		if ((m->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) != 0)
+			csum_flags = TX_CHECKSUM_CTL_FULL;
+		else
+			csum_flags = TX_CHECKSUM_CTL_IP;
+		flags |= (csum_flags << TX_CHECKSUM_CTL_SHIFT);
+	}
+
+	for (cur = index, i = 0; i < nsegs; i++) {
+		sc->tx.buf_map[cur].mbuf = (i == 0 ? m : NULL);
+		if (i == nsegs - 1)
+			flags |= TX_LAST_DESC;
+		awg_setup_txdesc(sc, cur, flags, segs[i].ds_addr,
+		    segs[i].ds_len);
+		flags &= ~TX_FIR_DESC;
+		cur = TX_NEXT(cur);
+	}
+
+	return (nsegs);
+}
+
+static void
+awg_setup_rxdesc(struct awg_softc *sc, int index, bus_addr_t paddr)
+{
+	uint32_t status, size;
+
+	status = RX_DESC_CTL;
+	size = MCLBYTES - 1;
+
+	sc->rx.desc_ring[index].addr = htole32((uint32_t)paddr);
+	sc->rx.desc_ring[index].size = htole32(size);
+	sc->rx.desc_ring[index].next =
+	    htole32(sc->rx.desc_ring_paddr + DESC_OFF(RX_NEXT(index)));
+	sc->rx.desc_ring[index].status = htole32(status);
+}
+
+static int
+awg_setup_rxbuf(struct awg_softc *sc, int index, struct mbuf *m)
+{
+	bus_dma_segment_t seg;
+	int error, nsegs;
+
+	m_adj(m, ETHER_ALIGN);
+
+	error = bus_dmamap_load_mbuf_sg(sc->rx.buf_tag,
+	    sc->rx.buf_map[index].map, m, &seg, &nsegs, 0);
+	if (error != 0)
+		return (error);
+
+	bus_dmamap_sync(sc->rx.buf_tag, sc->rx.buf_map[index].map,
+	    BUS_DMASYNC_PREREAD);
+
+	sc->rx.buf_map[index].mbuf = m;
+	awg_setup_rxdesc(sc, index, seg.ds_addr);
+
+	return (0);
+}
+
+static struct mbuf *
+awg_alloc_mbufcl(struct awg_softc *sc)
+{
+	struct mbuf *m;
+
+	m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
+	if (m != NULL)
+		m->m_pkthdr.len = m->m_len = m->m_ext.ext_size;
+
+	return (m);
+}
+
+static void
+awg_start_locked(struct awg_softc *sc)
+{
+	struct mbuf *m;
+	uint32_t val;
+	if_t ifp;
+	int cnt, nsegs;
+
+	AWG_ASSERT_LOCKED(sc);
+
+	if (!sc->link)
+		return;
+
+	ifp = sc->ifp;
+
+	if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
+	    IFF_DRV_RUNNING)
+		return;
+
+	for (cnt = 0; ; cnt++) {
+		if (sc->tx.queued >= TX_DESC_COUNT - TX_MAX_SEGS) {
+			if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
+			break;
+		}
+
+		m = if_dequeue(ifp);
+		if (m == NULL)
+			break;
+
+		nsegs = awg_setup_txbuf(sc, sc->tx.cur, &m);
+		if (nsegs == 0) {
+			if_sendq_prepend(ifp, m);
+			break;
+		}
+		if_bpfmtap(ifp, m);
+		sc->tx.cur = TX_SKIP(sc->tx.cur, nsegs);
+	}
+
+	if (cnt != 0) {
+		bus_dmamap_sync(sc->tx.desc_tag, sc->tx.desc_map,
+		    BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+
+		/* Start and run TX DMA */
+		val = RD4(sc, EMAC_TX_CTL_1);
+		WR4(sc, EMAC_TX_CTL_1, val | TX_DMA_START);
+	}
+}
+
+static void
+awg_start(if_t ifp)
+{
+	struct awg_softc *sc;
+
+	sc = if_getsoftc(ifp);
+
+	AWG_LOCK(sc);
+	awg_start_locked(sc);
+	AWG_UNLOCK(sc);
+}
+
+static void
+awg_tick(void *softc)
+{
+	struct awg_softc *sc;
+	struct mii_data *mii;
+	if_t ifp;
+	int link;
+
+	sc = softc;
+	ifp = sc->ifp;
+	mii = device_get_softc(sc->miibus);
+
+	AWG_ASSERT_LOCKED(sc);
+
+	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+		return;
+
+	link = sc->link;
+	mii_tick(mii);
+	if (sc->link && !link)
+		awg_start_locked(sc);
+
+	callout_reset(&sc->stat_ch, hz, awg_tick, sc);
+}
+
+/* Bit Reversal - http://aggregate.org/MAGIC/#Bit%20Reversal */
+static uint32_t
+bitrev32(uint32_t x)
+{
+	x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
+	x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
+	x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
+	x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
+
+	return (x >> 16) | (x << 16);
+}
+
+static void
+awg_setup_rxfilter(struct awg_softc *sc)
+{
+	uint32_t val, crc, hashreg, hashbit, hash[2], machi, maclo;
+	int mc_count, mcnt, i;
+	uint8_t *eaddr, *mta;
+	if_t ifp;
+
+	AWG_ASSERT_LOCKED(sc);
+
+	ifp = sc->ifp;
+	val = 0;
+	hash[0] = hash[1] = 0;
+
+	mc_count = if_multiaddr_count(ifp, -1);
+
+	if (if_getflags(ifp) & IFF_PROMISC)
+		val |= DIS_ADDR_FILTER;
+	else if (if_getflags(ifp) & IFF_ALLMULTI) {
+		val |= RX_ALL_MULTICAST;
+		hash[0] = hash[1] = ~0;
+	} else if (mc_count > 0) {
+		val |= HASH_MULTICAST;
+
+		mta = malloc(sizeof(unsigned char) * ETHER_ADDR_LEN * mc_count,
+		    M_DEVBUF, M_NOWAIT);
+		if (mta == NULL) {
+			if_printf(ifp,
+			    "failed to allocate temporary multicast list\n");
+			return;
+		}
+
+		if_multiaddr_array(ifp, mta, &mcnt, mc_count);
+		for (i = 0; i < mcnt; i++) {
+			crc = ether_crc32_le(mta + (i * ETHER_ADDR_LEN),
+			    ETHER_ADDR_LEN) & 0x7f;
+			crc = bitrev32(~crc) >> 26;
+			hashreg = (crc >> 5);
+			hashbit = (crc & 0x1f);
+			hash[hashreg] |= (1 << hashbit);
+		}
+
+		free(mta, M_DEVBUF);
+	}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-user mailing list