Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Feb 2017 02:49:42 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r313267 - in projects/netbsd-tests-upstream-01-2017: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt cddl/contrib/opensolaris/lib/libdtrace/common sbin/ifconfig sbin/nvmecontro...
Message-ID:  <201702050249.v152ng2N018631@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Feb  5 02:49:42 2017
New Revision: 313267
URL: https://svnweb.freebsd.org/changeset/base/313267

Log:
  MFhead@r313266

Modified:
  projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
  projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
  projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
  projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
  projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
  projects/netbsd-tests-upstream-01-2017/sbin/ifconfig/ifieee80211.c
  projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/logpage.c
  projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/nvmecontrol.8
  projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/wdc.c
  projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
  projects/netbsd-tests-upstream-01-2017/sys/cddl/dev/dtrace/dtrace_ioctl.c
  projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmc.c
  projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmcreg.h
  projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci.c
  projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci.h
  projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci_fdt.c
  projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci_pci.c
  projects/netbsd-tests-upstream-01-2017/sys/kern/kern_descrip.c
  projects/netbsd-tests-upstream-01-2017/sys/kern/subr_witness.c
  projects/netbsd-tests-upstream-01-2017/sys/net/iflib.c
  projects/netbsd-tests-upstream-01-2017/sys/riscv/include/atomic.h
  projects/netbsd-tests-upstream-01-2017/sys/vm/vm_object.h
Directory Properties:
  projects/netbsd-tests-upstream-01-2017/   (props changed)
  projects/netbsd-tests-upstream-01-2017/cddl/   (props changed)
  projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/   (props changed)
  projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/   (props changed)

Modified: projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh	Sun Feb  5 02:49:42 2017	(r313267)
@@ -77,7 +77,7 @@ main(int argc, char **argv)
 }
 EOF
 
-cc -c -xO2 test.c
+cc -c -O2 test.c
 if [ $? -ne 0 ]; then
 	print -u2 "failed to compile test.c"
 	exit 1

Modified: projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.include.ksh	Sun Feb  5 02:49:42 2017	(r313267)
@@ -25,7 +25,7 @@
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 
-# Make sure <unistd.h> defines _DTRACE_VERSION
+# Make sure <sys/sdt.h> defines _DTRACE_VERSION
 
 DIR=/var/tmp/dtest.$$
 
@@ -33,7 +33,7 @@ mkdir $DIR
 cd $DIR
 
 cat > test.c <<EOF
-#include <unistd.h>
+#include <sys/sdt.h>
 
 int
 main(int argc, char **argv)
@@ -46,7 +46,7 @@ main(int argc, char **argv)
 }
 EOF
 
-cc -xarch=generic -o test test.c
+cc -o test test.c
 if [ $? -ne 0 ]; then
 	print -u2 "failed to compile test.c"
 	exit 1

Modified: projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -462,18 +462,8 @@ dof_add_probe(dt_idhash_t *dhp, dt_ident
 		dt_buf_write(dtp, &ddo->ddo_enoffs, pip->pi_enoffs,
 		    pip->pi_nenoffs * sizeof (uint32_t), sizeof (uint32_t));
 
-		/*
-		 * If pi_rname isn't set, the relocation will be against the
-		 * function name. If it is, the relocation will be against
-		 * pi_rname. This will be used if the function is scoped
-		 * locally so an alternate symbol is added for the purpose
-		 * of this relocation.
-		 */
-		if (pip->pi_rname == NULL)
-			dofr.dofr_name = dofpr.dofpr_func;
-		else
-			dofr.dofr_name = dof_add_string(ddo, pip->pi_rname);
-		dofr.dofr_type = DOF_RELO_SETX;
+		dofr.dofr_name = dof_add_string(ddo, pip->pi_rname);
+		dofr.dofr_type = DOF_RELO_DOFREL;
 		dofr.dofr_offset = dt_buf_len(&ddo->ddo_probes);
 		dofr.dofr_data = 0;
 

Modified: projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -237,7 +237,7 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_
 			rel->r_offset = s->dofs_offset +
 			    dofr[j].dofr_offset;
 			rel->r_info = ELF32_R_INFO(count + dep->de_global,
-			    R_386_32);
+			    R_386_PC32);
 #elif defined(__mips__)
 /* XXX */
 printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
@@ -253,15 +253,6 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_
 #elif defined(__riscv__)
 /* XXX */
 printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#elif defined(__sparc)
-			/*
-			 * Add 4 bytes to hit the low half of this 64-bit
-			 * big-endian address.
-			 */
-			rel->r_offset = s->dofs_offset +
-			    dofr[j].dofr_offset + 4;
-			rel->r_info = ELF32_R_INFO(count + dep->de_global,
-			    R_SPARC_32);
 #else
 #error unknown ISA
 #endif
@@ -270,7 +261,7 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_
 			sym->st_value = 0;
 			sym->st_size = 0;
 			sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_FUNC);
-			sym->st_other = 0;
+			sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN);
 			sym->st_shndx = SHN_UNDEF;
 
 			rel++;
@@ -287,11 +278,7 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_
 	sym->st_value = 0;
 	sym->st_size = dof->dofh_filesz;
 	sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT);
-#ifdef illumos
-	sym->st_other = 0;
-#else
 	sym->st_other = ELF32_ST_VISIBILITY(STV_HIDDEN);
-#endif
 	sym->st_shndx = ESHDR_DOF;
 	sym++;
 
@@ -448,18 +435,8 @@ prepare_elf64(dtrace_hdl_t *dtp, const d
 #elif defined(__i386) || defined(__amd64)
 			rel->r_offset = s->dofs_offset +
 			    dofr[j].dofr_offset;
-#ifdef illumos
 			rel->r_info = ELF64_R_INFO(count + dep->de_global,
-			    R_AMD64_64);
-#else
-			rel->r_info = ELF64_R_INFO(count + dep->de_global,
-			    R_X86_64_RELATIVE);
-#endif
-#elif defined(__sparc)
-			rel->r_offset = s->dofs_offset +
-			    dofr[j].dofr_offset;
-			rel->r_info = ELF64_R_INFO(count + dep->de_global,
-			    R_SPARC_64);
+			    R_X86_64_PC64);
 #else
 #error unknown ISA
 #endif
@@ -468,7 +445,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const d
 			sym->st_value = 0;
 			sym->st_size = 0;
 			sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_FUNC);
-			sym->st_other = 0;
+			sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN);
 			sym->st_shndx = SHN_UNDEF;
 
 			rel++;
@@ -485,11 +462,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const d
 	sym->st_value = 0;
 	sym->st_size = dof->dofh_filesz;
 	sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_OBJECT);
-#ifdef illumos
-	sym->st_other = 0;
-#else
 	sym->st_other = ELF64_ST_VISIBILITY(STV_HIDDEN);
-#endif
 	sym->st_shndx = ESHDR_DOF;
 	sym++;
 
@@ -797,16 +770,15 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_
 }
 
 static int
-dt_symtab_lookup(Elf_Data *data_sym, int nsym, uintptr_t addr, uint_t shn,
-    GElf_Sym *sym, int uses_funcdesc, Elf *elf)
+dt_symtab_lookup(Elf_Data *data_sym, int start, int end, uintptr_t addr,
+    uint_t shn, GElf_Sym *sym, int uses_funcdesc, Elf *elf)
 {
-	int i, ret = -1;
 	Elf64_Addr symval;
 	Elf_Scn *opd_scn;
 	Elf_Data *opd_desc;
-	GElf_Sym s;
+	int i;
 
-	for (i = 0; i < nsym && gelf_getsym(data_sym, i, sym) != NULL; i++) {
+	for (i = start; i < end && gelf_getsym(data_sym, i, sym) != NULL; i++) {
 		if (GELF_ST_TYPE(sym->st_info) == STT_FUNC) {
 			symval = sym->st_value;
 			if (uses_funcdesc) {
@@ -816,20 +788,12 @@ dt_symtab_lookup(Elf_Data *data_sym, int
 				    *(uint64_t*)((char *)opd_desc->d_buf + symval);
 			}
 			if ((uses_funcdesc || shn == sym->st_shndx) &&
-			    symval <= addr &&
-			    addr < symval + sym->st_size) {
-				if (GELF_ST_BIND(sym->st_info) == STB_GLOBAL)
-					return (0);
-
-				ret = 0;
-				s = *sym;
-			}
+			    symval <= addr && addr < symval + sym->st_size)
+				return (0);
 		}
 	}
 
-	if (ret == 0)
-		*sym = s;
-	return (ret);
+	return (-1);
 }
 
 #if defined(__aarch64__)
@@ -1237,10 +1201,11 @@ process_obj(dtrace_hdl_t *dtp, const cha
 	dt_provider_t *pvp;
 	dt_probe_t *prp;
 	uint32_t off, eclass, emachine1, emachine2;
-	size_t symsize, nsym, isym, istr, len;
+	size_t symsize, osym, nsym, isym, istr, len;
 	key_t objkey;
 	dt_link_pair_t *pair, *bufs = NULL;
 	dt_strtab_t *strtab;
+	void *tmp;
 
 	if ((fd = open64(obj, O_RDWR)) == -1) {
 		return (dt_link_error(dtp, elf, fd, bufs,
@@ -1374,12 +1339,13 @@ process_obj(dtrace_hdl_t *dtp, const cha
 		 * target (text) section to replace the call instruction with
 		 * one or more nops.
 		 *
-		 * If the function containing the probe is locally scoped
-		 * (static), we create an alias used by the relocation in the
-		 * generated object. The alias, a new symbol, will be global
-		 * (so that the relocation from the generated object can be
-		 * resolved), and hidden (so that it is converted to a local
-		 * symbol at link time). Such aliases have this form:
+		 * To avoid runtime overhead, the relocations added to the
+		 * generated object should be resolved at static link time. We
+		 * therefore create aliases for the functions that contain
+		 * probes. An alias is global (so that the relocation from the
+		 * generated object can be resolved), and hidden (so that its
+		 * address is known at static link time). Such aliases have this
+		 * form:
 		 *
 		 *   $dtrace<key>.<function>
 		 *
@@ -1417,16 +1383,13 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			if (strncmp(s, dt_prefix, sizeof (dt_prefix) - 1) != 0)
 				continue;
 
-			if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
-			    shdr_rel.sh_info, &fsym,
-			    (emachine1 == EM_PPC64), elf) != 0) {
+			if (dt_symtab_lookup(data_sym, 0, isym, rela.r_offset,
+			    shdr_rel.sh_info, &fsym, (emachine1 == EM_PPC64),
+			    elf) != 0) {
 				dt_strtab_destroy(strtab);
 				goto err;
 			}
 
-			if (GELF_ST_BIND(fsym.st_info) != STB_LOCAL)
-				continue;
-
 			if (fsym.st_name > data_str->d_size) {
 				dt_strtab_destroy(strtab);
 				goto err;
@@ -1462,12 +1425,12 @@ process_obj(dtrace_hdl_t *dtp, const cha
 		}
 
 		/*
-		 * If needed, allocate the additional space for the symbol
-		 * table and string table copying the old data into the new
-		 * buffers, and marking the buffers as dirty. We inject those
-		 * newly allocated buffers into the libelf data structures, but
-		 * are still responsible for freeing them once we're done with
-		 * the elf handle.
+		 * If any probes were found, allocate the additional space for
+		 * the symbol table and string table, copying the old data into
+		 * the new buffers, and marking the buffers as dirty. We inject
+		 * those newly allocated buffers into the libelf data
+		 * structures, but are still responsible for freeing them once
+		 * we're done with the elf handle.
 		 */
 		if (nsym > 0) {
 			/*
@@ -1501,7 +1464,9 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			bufs = pair;
 
 			bcopy(data_str->d_buf, pair->dlp_str, data_str->d_size);
+			tmp = data_str->d_buf;
 			data_str->d_buf = pair->dlp_str;
+			pair->dlp_str = tmp;
 			data_str->d_size += len;
 			(void) elf_flagdata(data_str, ELF_C_SET, ELF_F_DIRTY);
 
@@ -1509,16 +1474,20 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			(void) gelf_update_shdr(scn_str, &shdr_str);
 
 			bcopy(data_sym->d_buf, pair->dlp_sym, data_sym->d_size);
+			tmp = data_sym->d_buf;
 			data_sym->d_buf = pair->dlp_sym;
+			pair->dlp_sym = tmp;
 			data_sym->d_size += nsym * symsize;
 			(void) elf_flagdata(data_sym, ELF_C_SET, ELF_F_DIRTY);
 
 			shdr_sym.sh_size += nsym * symsize;
 			(void) gelf_update_shdr(scn_sym, &shdr_sym);
 
+			osym = isym;
 			nsym += isym;
 		} else {
 			dt_strtab_destroy(strtab);
+			continue;
 		}
 
 		/*
@@ -1577,8 +1546,11 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			bcopy(s, pname, p - s);
 			pname[p - s] = '\0';
 
-			if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
-			    shdr_rel.sh_info, &fsym,
+			if (dt_symtab_lookup(data_sym, osym, isym,
+			    rela.r_offset, shdr_rel.sh_info, &fsym,
+			    (emachine1 == EM_PPC64), elf) != 0 &&
+			    dt_symtab_lookup(data_sym, 0, osym,
+			    rela.r_offset, shdr_rel.sh_info, &fsym,
 			    (emachine1 == EM_PPC64), elf) != 0)
 				goto err;
 
@@ -1588,37 +1560,30 @@ process_obj(dtrace_hdl_t *dtp, const cha
 			assert(GELF_ST_TYPE(fsym.st_info) == STT_FUNC);
 
 			/*
-			 * If a NULL relocation name is passed to
-			 * dt_probe_define(), the function name is used for the
-			 * relocation. The relocation needs to use a mangled
-			 * name if the symbol is locally scoped; the function
-			 * name may need to change if we've found the global
-			 * alias for the locally scoped symbol (we prefer
-			 * global symbols to locals in dt_symtab_lookup()).
+			 * If this is our first time encountering this symbol,
+			 * emit an alias.
 			 */
 			s = (char *)data_str->d_buf + fsym.st_name;
-			r = NULL;
 
-			if (GELF_ST_BIND(fsym.st_info) == STB_LOCAL) {
+			if (strncmp(s, dt_symprefix,
+			    sizeof (dt_symprefix) - 1) != 0) {
+				u_int bind = GELF_ST_BIND(fsym.st_info);
+
 				dsym = fsym;
 				dsym.st_name = istr;
-				dsym.st_info = GELF_ST_INFO(STB_GLOBAL,
-				    STT_FUNC);
-				dsym.st_other =
-				    ELF64_ST_VISIBILITY(STV_ELIMINATE);
+				dsym.st_info = GELF_ST_INFO(bind == STB_LOCAL ?
+				    STB_GLOBAL : bind, STT_FUNC);
+				dsym.st_other = GELF_ST_VISIBILITY(STV_HIDDEN);
 				(void) gelf_update_sym(data_sym, isym, &dsym);
-
-				r = (char *)data_str->d_buf + istr;
-				istr += 1 + sprintf(r, dt_symfmt,
-				    dt_symprefix, objkey, s);
+				r = (char *) data_str->d_buf + istr;
+				istr += 1 + sprintf(r, dt_symfmt, dt_symprefix, objkey,
+				    s);
 				isym++;
 				assert(isym <= nsym);
-
-			} else if (strncmp(s, dt_symprefix,
-			    strlen(dt_symprefix)) == 0) {
+			} else {
 				r = s;
-				if ((s = strchr(s, '.')) == NULL)
-					goto err;
+				s = strchr(s, '.');
+				assert(s != NULL);
 				s++;
 			}
 
@@ -1697,9 +1662,6 @@ process_obj(dtrace_hdl_t *dtp, const cha
 	(void) elf_end(elf);
 	(void) close(fd);
 
-#ifndef illumos
-	if (nsym > 0)
-#endif
 	while ((pair = bufs) != NULL) {
 		bufs = pair->dlp_next;
 		dt_free(dtp, pair->dlp_str);

Modified: projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -545,9 +545,7 @@ dt_probe_define(dt_provider_t *pvp, dt_p
 
 	for (pip = prp->pr_inst; pip != NULL; pip = pip->pi_next) {
 		if (strcmp(pip->pi_fname, fname) == 0 &&
-		    ((rname == NULL && pip->pi_rname == NULL) ||
-		    (rname != NULL && pip->pi_rname != NULL &&
-		    strcmp(pip->pi_rname, rname) == 0)))
+		    strcmp(pip->pi_rname, rname) == 0)
 			break;
 	}
 
@@ -565,7 +563,7 @@ dt_probe_define(dt_provider_t *pvp, dt_p
 		if ((pip->pi_fname = strdup(fname)) == NULL)
 			goto nomem;
 
-		if (rname != NULL && (pip->pi_rname = strdup(rname)) == NULL)
+		if ((pip->pi_rname = strdup(rname)) == NULL)
 			goto nomem;
 
 		pip->pi_noffs = 0;
@@ -605,7 +603,7 @@ dt_probe_define(dt_provider_t *pvp, dt_p
 	dt_dprintf("defined probe %s %s:%s %s() +0x%x (%s)\n",
 	    isenabled ? "(is-enabled)" : "",
 	    pvp->pv_desc.dtvd_name, prp->pr_ident->di_name, fname, offset,
-	    rname != NULL ? rname : fname);
+	    rname);
 
 	assert(*noffs < *maxoffs);
 	(*offs)[(*noffs)++] = offset;

Modified: projects/netbsd-tests-upstream-01-2017/sbin/ifconfig/ifieee80211.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sbin/ifconfig/ifieee80211.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sbin/ifconfig/ifieee80211.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -5594,12 +5594,12 @@ static struct cmd ieee80211_cmds[] = {
 	DEF_CMD_ARG("bgscanidle",	set80211bgscanidle),
 	DEF_CMD_ARG("bgscanintvl",	set80211bgscanintvl),
 	DEF_CMD_ARG("scanvalid",	set80211scanvalid),
-	DEF_CMD("quiet",        1,      set80211quiet),
-	DEF_CMD("-quiet",       0,      set80211quiet),
-	DEF_CMD_ARG("quiet_count",      set80211quietcount),
-	DEF_CMD_ARG("quiet_period",     set80211quietperiod),
-	DEF_CMD_ARG("quiet_dur",        set80211quietduration),
-	DEF_CMD_ARG("quiet_offset",     set80211quietoffset),
+	DEF_CMD("quiet",	1,	set80211quiet),
+	DEF_CMD("-quiet",	0,	set80211quiet),
+	DEF_CMD_ARG("quiet_count",	set80211quietcount),
+	DEF_CMD_ARG("quiet_period",	set80211quietperiod),
+	DEF_CMD_ARG("quiet_duration",	set80211quietduration),
+	DEF_CMD_ARG("quiet_offset",	set80211quietoffset),
 	DEF_CMD_ARG("roam:rssi",	set80211roamrssi),
 	DEF_CMD_ARG("roam:rate",	set80211roamrate),
 	DEF_CMD_ARG("mcastrate",	set80211mcastrate),

Modified: projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/logpage.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/logpage.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/logpage.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -74,6 +74,12 @@ kv_lookup(const struct kv_name *kv, size
 	return bad;
 }
 
+static void
+print_bin(void *data, uint32_t length)
+{
+	write(STDOUT_FILENO, data, length);
+}
+
 /*
  * 128-bit integer augments to standard values. On i386 this
  * doesn't exist, so we use 64-bit values. The 128-bit counters
@@ -846,6 +852,8 @@ static struct logpage_function {
 	 sizeof(struct nvme_firmware_page)},
 	{HGST_INFO_LOG,			"hgst",	print_hgst_info_log,
 	 DEFAULT_SIZE},
+	{HGST_INFO_LOG,			"wdc",	print_hgst_info_log,
+	 DEFAULT_SIZE},
 	{INTEL_LOG_TEMP_STATS,		"intel", print_intel_temp_stats,
 	 sizeof(struct intel_log_temp_stats)},
 	{INTEL_LOG_READ_LAT_LOG,	"intel", print_intel_read_lat_log,
@@ -870,7 +878,7 @@ logpage(int argc, char *argv[])
 {
 	int				fd, nsid;
 	int				log_page = 0, pageflag = false;
-	int				hexflag = false, ns_specified;
+	int				binflag = false, hexflag = false, ns_specified;
 	char				ch, *p;
 	char				cname[64];
 	uint32_t			size;
@@ -880,8 +888,11 @@ logpage(int argc, char *argv[])
 	struct nvme_controller_data	cdata;
 	print_fn_t			print_fn;
 
-	while ((ch = getopt(argc, argv, "p:xv:")) != -1) {
+	while ((ch = getopt(argc, argv, "bp:xv:")) != -1) {
 		switch (ch) {
+		case 'b':
+			binflag = true;
+			break;
 		case 'p':
 			/* TODO: Add human-readable ASCII page IDs */
 			log_page = strtol(optarg, &p, 0);
@@ -940,7 +951,9 @@ logpage(int argc, char *argv[])
 
 	print_fn = print_hex;
 	size = DEFAULT_SIZE;
-	if (!hexflag) {
+	if (binflag)
+		print_fn = print_bin;
+	if (!binflag && !hexflag) {
 		/*
 		 * See if there is a pretty print function for the specified log
 		 * page.  If one isn't found, we just revert to the default

Modified: projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/nvmecontrol.8
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/nvmecontrol.8	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/nvmecontrol.8	Sun Feb  5 02:49:42 2017	(r313267)
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2016
+.Dd February 4, 2017
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -62,6 +62,8 @@
 .Ic logpage
 .Aq Fl p Ar page_id
 .Op Fl x
+.Op Fl v Ar vendor-string
+.Op Fl b
 .Aq device id
 .Aq namespace id
 .Nm
@@ -74,7 +76,7 @@
 .Ic power
 .Op Fl l
 .Op Fl p power_state
-.Op fl w workload_hint
+.Op Fl w workload_hint
 .Nm
 .Ic wdc cap-diag
 .Op Fl o path_template
@@ -96,6 +98,26 @@
 .Sh DESCRIPTION
 NVM Express (NVMe) is a storage protocol standard, for SSDs and other
 high-speed storage devices over PCI Express.
+.Pp
+.Ss logpage
+The logpage command knows how to print log pages of various types.
+It also knows about vendor specific log pages from hgst/wdc and intel.
+Page 0xc1 for hgst/wdc contains the advanced smart information about
+the drive.
+Page 0xc1 is read latency stats for intel.
+Page 0xc2 is write latency stats for intel.
+Page 0xc5 is temperature stats for intel.
+Page 0xca is advanced smart information for intel.
+.Ss wdc
+The various wdc command retrieve log data from the wdc/hgst drives.
+The
+.Fl o
+flag specifies a path template to use to output the files.
+Each file takes the path template (which defaults to nothing), appends
+the drive's serial number and the type of dump it is followed
+by .bin.
+These logs must be sent to the vendor for analysis.
+This tool only provides a way to extract them.
 .Sh EXAMPLES
 .Dl nvmecontrol devlist
 .Pp
@@ -126,10 +148,21 @@ Display a human-readable summary of the 
 Log pages defined by the NVMe specification include Error Information Log (ID=1),
 SMART/Health Information Log (ID=2), and Firmware Slot Log (ID=3).
 .Pp
+.Dl nvmecontrol logpage -p 0xc1 -v wdc nvme0
+.Pp
+Display a human-readable summary of the nvme0's wdc-specific advanced
+SMART data.
+.Pp
 .Dl nvmecontrol logpage -p 1 -x nvme0
 .Pp
 Display a hexadecimal dump of the nvme0 controller's Error Information Log.
 .Pp
+.Dl nvmecontrol logpage -p 0xcb -b nvme0 > /tmp/page-cb.bin
+.Pp
+Print the contents of vendor specific page 0xcb as binary data on
+standard out.
+Redirect it to a temporary file.
+.Pp
 .Dl nvmecontrol firmware -s 2 -f /tmp/nvme_firmware nvme0
 .Pp
 Download the firmware image contained in "/tmp/nvme_firmware" to slot 2 of the

Modified: projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/wdc.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/wdc.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sbin/nvmecontrol/wdc.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -69,7 +69,7 @@ static void wdc_purge_monitor(int argc, 
 #define WDC_DRIVE_LOG_USAGE	"\tnvmecontrol wdc drive-log [-o path-template]\n"
 #define WDC_GET_CRASH_DUMP_USAGE "\tnvmecontrol wdc get-crash-dump [-o path-template]\n"
 #define WDC_PURGE_USAGE		"\tnvmecontrol wdc purge [-o path-template]\n"
-#define WDC_PURGE_MONITOR_USAGE	"\tnvmecontrol wdc purge-montor\n"
+#define WDC_PURGE_MONITOR_USAGE	"\tnvmecontrol wdc purge-monitor\n"
 
 static struct nvme_function wdc_funcs[] = {
 	{"cap-diag",		wdc_cap_diag,		WDC_CAP_DIAG_USAGE},
@@ -94,7 +94,7 @@ wdc_append_serial_name(int fd, char *buf
 	walker = sn + NVME_SERIAL_NUMBER_LENGTH - 1;
 	while (walker > sn && *walker == ' ')
 		walker--;
-	*walker = '\0';
+	*++walker = '\0';
 	snprintf(buf, len, "%s%s.bin", sn, suffix);
 }
 
@@ -127,7 +127,8 @@ wdc_do_dump(int fd, char *tmpl, const ch
 {
 	int fd2;
 	uint8_t *buf;
-	uint32_t len, resid, offset;
+	uint32_t len, offset;
+	ssize_t resid;
 
 	wdc_append_serial_name(fd, tmpl, MAXPATHLEN, suffix);
 

Modified: projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -13346,8 +13346,11 @@ dtrace_dof_property(const char *name)
 
 	data += strlen(name) + 1; /* skip past the '=' */
 	len = eol - data;
+	if (len % 2 != 0) {
+		dtrace_dof_error(NULL, "invalid DOF encoding length");
+		goto doferr;
+	}
 	bytes = len / 2;
-
 	if (bytes < sizeof(dof_hdr_t)) {
 		dtrace_dof_error(NULL, "truncated header");
 		goto doferr;
@@ -13917,12 +13920,13 @@ err:
 
 /*
  * Apply the relocations from the specified 'sec' (a DOF_SECT_URELHDR) to the
- * specified DOF.  At present, this amounts to simply adding 'ubase' to the
- * site of any user SETX relocations to account for load object base address.
- * In the future, if we need other relocations, this function can be extended.
+ * specified DOF.  SETX relocations are computed using 'ubase', the base load
+ * address of the object containing the DOF, and DOFREL relocations are relative
+ * to the relocation offset within the DOF.
  */
 static int
-dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, uint64_t ubase)
+dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, uint64_t ubase,
+    uint64_t udaddr)
 {
 	uintptr_t daddr = (uintptr_t)dof;
 	dof_relohdr_t *dofr =
@@ -13960,6 +13964,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_
 		case DOF_RELO_NONE:
 			break;
 		case DOF_RELO_SETX:
+		case DOF_RELO_DOFREL:
 			if (r->dofr_offset >= ts->dofs_size || r->dofr_offset +
 			    sizeof (uint64_t) > ts->dofs_size) {
 				dtrace_dof_error(dof, "bad relocation offset");
@@ -13971,7 +13976,11 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_
 				return (-1);
 			}
 
-			*(uint64_t *)taddr += ubase;
+			if (r->dofr_type == DOF_RELO_SETX)
+				*(uint64_t *)taddr += ubase;
+			else
+				*(uint64_t *)taddr +=
+				    udaddr + ts->dofs_offset + r->dofr_offset;
 			break;
 		default:
 			dtrace_dof_error(dof, "invalid relocation type");
@@ -13992,7 +14001,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_
  */
 static int
 dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr,
-    dtrace_enabling_t **enabp, uint64_t ubase, int noprobes)
+    dtrace_enabling_t **enabp, uint64_t ubase, uint64_t udaddr, int noprobes)
 {
 	uint64_t len = dof->dofh_loadsz, seclen;
 	uintptr_t daddr = (uintptr_t)dof;
@@ -14154,7 +14163,7 @@ dtrace_dof_slurp(dof_hdr_t *dof, dtrace_
 
 		switch (sec->dofs_type) {
 		case DOF_SECT_URELHDR:
-			if (dtrace_dof_relocate(dof, sec, ubase) != 0)
+			if (dtrace_dof_relocate(dof, sec, ubase, udaddr) != 0)
 				return (-1);
 			break;
 		}
@@ -15519,7 +15528,7 @@ dtrace_anon_property(void)
 		}
 
 		rv = dtrace_dof_slurp(dof, &state->dts_vstate, CRED(),
-		    &dtrace_anon.dta_enabling, 0, B_TRUE);
+		    &dtrace_anon.dta_enabling, 0, 0, B_TRUE);
 
 		if (rv == 0)
 			rv = dtrace_dof_options(dof, state);
@@ -16290,7 +16299,7 @@ dtrace_helper_slurp(dof_hdr_t *dof, dof_
 	vstate = &help->dthps_vstate;
 
 	if ((rv = dtrace_dof_slurp(dof, vstate, NULL, &enab, dhp->dofhp_addr,
-	    B_FALSE)) != 0) {
+	    dhp->dofhp_dof, B_FALSE)) != 0) {
 		dtrace_dof_destroy(dof);
 		return (rv);
 	}

Modified: projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h	Sun Feb  5 02:49:42 2017	(r313267)
@@ -784,6 +784,7 @@ typedef struct dof_relodesc {
 
 #define	DOF_RELO_NONE	0		/* empty relocation entry */
 #define	DOF_RELO_SETX	1		/* relocate setx value */
+#define	DOF_RELO_DOFREL	2		/* relocate DOF-relative value */
 
 typedef struct dof_optdesc {
 	uint32_t dofo_option;		/* option identifier */

Modified: projects/netbsd-tests-upstream-01-2017/sys/cddl/dev/dtrace/dtrace_ioctl.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sys/cddl/dev/dtrace/dtrace_ioctl.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sys/cddl/dev/dtrace/dtrace_ioctl.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -429,7 +429,8 @@ dtrace_ioctl(struct cdev *dev, u_long cm
 			return (EBUSY);
 		}
 
-		if (dtrace_dof_slurp(dof, vstate, td->td_ucred, &enab, 0, B_TRUE) != 0) {
+		if (dtrace_dof_slurp(dof, vstate, td->td_ucred, &enab, 0, 0,
+		    B_TRUE) != 0) {
 			mutex_exit(&dtrace_lock);
 			mutex_exit(&cpu_lock);
 			dtrace_dof_destroy(dof);

Modified: projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmc.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmc.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmc.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -111,14 +111,15 @@ struct mmc_ivars {
 	char card_sn_string[16];/* Formatted serial # for disk->d_ident */
 };
 
-#define CMD_RETRIES	3
+#define	CMD_RETRIES	3
 
 #define	CARD_ID_FREQUENCY 400000 /* Spec requires 400kHz max during ID phase. */
 
 static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver");
 
 static int mmc_debug;
-SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RWTUN, &mmc_debug, 0, "Debug level");
+SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RWTUN, &mmc_debug, 0,
+    "Debug level");
 
 /* bus entry points */
 static int mmc_acquire_bus(device_t busdev, device_t dev);
@@ -137,14 +138,14 @@ static int mmc_wait_for_request(device_t
 static int mmc_write_ivar(device_t bus, device_t child, int which,
     uintptr_t value);
 
-#define MMC_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
+#define	MMC_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 #define	MMC_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
-#define MMC_LOCK_INIT(_sc)					\
-	mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev),	\
+#define	MMC_LOCK_INIT(_sc)						\
+	mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->dev),	\
 	    "mmc", MTX_DEF)
-#define MMC_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx);
-#define MMC_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED);
-#define MMC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
+#define	MMC_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->sc_mtx);
+#define	MMC_ASSERT_LOCKED(_sc)	mtx_assert(&(_sc)->sc_mtx, MA_OWNED);
+#define	MMC_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED);
 
 static int mmc_all_send_cid(struct mmc_softc *sc, uint32_t *rawcid);
 static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr);
@@ -744,9 +745,9 @@ mmc_set_card_bus_width(struct mmc_softc 
 static int
 mmc_set_timing(struct mmc_softc *sc, int timing)
 {
+	u_char switch_res[64];
 	int err;
 	uint8_t	value;
-	u_char switch_res[64];
 
 	switch (timing) {
 	case bus_timing_normal:
@@ -1161,9 +1162,9 @@ mmc_app_send_scr(struct mmc_softc *sc, u
 static int
 mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd)
 {
-	int err;
 	struct mmc_command cmd;
 	struct mmc_data data;
+	int err;
 
 	memset(&cmd, 0, sizeof(cmd));
 	memset(&data, 0, sizeof(data));
@@ -1185,9 +1186,9 @@ mmc_send_ext_csd(struct mmc_softc *sc, u
 static int
 mmc_app_sd_status(struct mmc_softc *sc, uint16_t rca, uint32_t *rawsdstatus)
 {
-	int err, i;
 	struct mmc_command cmd;
 	struct mmc_data data;
+	int err, i;
 
 	memset(&cmd, 0, sizeof(cmd));
 	memset(&data, 0, sizeof(data));
@@ -1393,7 +1394,7 @@ mmc_discover_cards(struct mmc_softc *sc)
 			 * commands, although the state tables / diagrams in the
 			 * standard suggest they go back to the transfer state.
 			 * Other cards don't become deselected, and if we
-			 * atttempt to blindly re-select them, we get timeout
+			 * attempt to blindly re-select them, we get timeout
 			 * errors from some controllers.  So we deselect then
 			 * reselect to handle all situations.  The only thing we
 			 * use from the sd_status is the erase sector size, but
@@ -1534,7 +1535,7 @@ mmc_discover_cards(struct mmc_softc *sc)
 static void
 mmc_rescan_cards(struct mmc_softc *sc)
 {
-	struct mmc_ivars *ivar = NULL;
+	struct mmc_ivars *ivar;
 	device_t *devlist;
 	int err, i, devcount;
 
@@ -1664,14 +1665,13 @@ mmc_go_discovery(struct mmc_softc *sc)
 static int
 mmc_calculate_clock(struct mmc_softc *sc)
 {
-	int max_dtr, max_hs_dtr, max_timing;
-	int nkid, i, f_max;
 	device_t *kids;
 	struct mmc_ivars *ivar;
+	int i, f_max, max_dtr, max_hs_dtr, max_timing, nkid;
 
 	f_max = mmcbr_get_f_max(sc->dev);
 	max_dtr = max_hs_dtr = f_max;
-	if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED))
+	if (mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED)
 		max_timing = bus_timing_hs;
 	else
 		max_timing = bus_timing_normal;

Modified: projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmcreg.h
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmcreg.h	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sys/dev/mmc/mmcreg.h	Sun Feb  5 02:49:42 2017	(r313267)
@@ -100,7 +100,7 @@ struct mmc_command {
 #define	MMC_ERR_FAILED	4
 #define	MMC_ERR_INVALID	5
 #define	MMC_ERR_NO_MEMORY 6
-#define MMC_ERR_MAX	6
+#define	MMC_ERR_MAX	6
 	struct mmc_data	*data;		/* Data segment with cmd */
 	struct mmc_request *mrq;	/* backpointer to request */
 };
@@ -291,47 +291,47 @@ struct mmc_request {
 /*
  * EXT_CSD fields
  */
-#define EXT_CSD_ERASE_GRP_DEF	175	/* R/W */
-#define EXT_CSD_BUS_WIDTH	183	/* R/W */
-#define EXT_CSD_HS_TIMING	185	/* R/W */
-#define EXT_CSD_CARD_TYPE	196	/* RO */
-#define EXT_CSD_REV		192	/* RO */
-#define EXT_CSD_SEC_CNT		212	/* RO, 4 bytes */
-#define EXT_CSD_ERASE_TO_MULT	223	/* RO */
-#define EXT_CSD_ERASE_GRP_SIZE	224	/* RO */
+#define	EXT_CSD_ERASE_GRP_DEF	175	/* R/W */
+#define	EXT_CSD_BUS_WIDTH	183	/* R/W */
+#define	EXT_CSD_HS_TIMING	185	/* R/W */
+#define	EXT_CSD_CARD_TYPE	196	/* RO */
+#define	EXT_CSD_REV		192	/* RO */
+#define	EXT_CSD_SEC_CNT		212	/* RO, 4 bytes */
+#define	EXT_CSD_ERASE_TO_MULT	223	/* RO */
+#define	EXT_CSD_ERASE_GRP_SIZE	224	/* RO */
 
 /*
  * EXT_CSD field definitions
  */
-#define EXT_CSD_CMD_SET_NORMAL		1
-#define EXT_CSD_CMD_SET_SECURE		2
-#define EXT_CSD_CMD_SET_CPSECURE	4
-
-#define EXT_CSD_CARD_TYPE_26	1
-#define EXT_CSD_CARD_TYPE_52	2
-
-#define EXT_CSD_BUS_WIDTH_1	0
-#define EXT_CSD_BUS_WIDTH_4	1
-#define EXT_CSD_BUS_WIDTH_8	2
+#define	EXT_CSD_CMD_SET_NORMAL		1
+#define	EXT_CSD_CMD_SET_SECURE		2
+#define	EXT_CSD_CMD_SET_CPSECURE	4
+
+#define	EXT_CSD_CARD_TYPE_26	1
+#define	EXT_CSD_CARD_TYPE_52	2
+
+#define	EXT_CSD_BUS_WIDTH_1	0
+#define	EXT_CSD_BUS_WIDTH_4	1
+#define	EXT_CSD_BUS_WIDTH_8	2
 
-#define MMC_TYPE_26_MAX_HS	26000000
-#define MMC_TYPE_52_MAX_HS	52000000
+#define	MMC_TYPE_26_MAX_HS	26000000
+#define	MMC_TYPE_52_MAX_HS	52000000
 
 /*
  * SD bus widths
  */
-#define SD_BUS_WIDTH_1		0
-#define SD_BUS_WIDTH_4		2
+#define	SD_BUS_WIDTH_1		0
+#define	SD_BUS_WIDTH_4		2
 
 /*
  * SD Switch
  */
-#define SD_SWITCH_MODE_CHECK	0
-#define SD_SWITCH_MODE_SET	1
-#define SD_SWITCH_GROUP1	0
-#define SD_SWITCH_NORMAL_MODE	0
-#define SD_SWITCH_HS_MODE	1
-#define SD_SWITCH_NOCHANGE	0xF
+#define	SD_SWITCH_MODE_CHECK	0
+#define	SD_SWITCH_MODE_SET	1
+#define	SD_SWITCH_GROUP1	0
+#define	SD_SWITCH_NORMAL_MODE	0
+#define	SD_SWITCH_HS_MODE	1
+#define	SD_SWITCH_NOCHANGE	0xF
 
 #define	SD_CLR_CARD_DETECT	0
 #define	SD_SET_CARD_DETECT	1
@@ -419,8 +419,8 @@ struct mmc_scr
 {
 	unsigned char		sda_vsn;
 	unsigned char		bus_widths;
-#define SD_SCR_BUS_WIDTH_1	(1<<0)
-#define SD_SCR_BUS_WIDTH_4	(1<<2)
+#define	SD_SCR_BUS_WIDTH_1	(1 << 0)
+#define	SD_SCR_BUS_WIDTH_4	(1 << 2)
 };
 
 struct mmc_sd_status
@@ -443,6 +443,6 @@ struct mmc_sd_status
  * byte sector size anywhere, so we assume that such cards are very rare
  * and only note their existence in passing here...
  */
-#define MMC_SECTOR_SIZE	512
+#define	MMC_SECTOR_SIZE	512
 
 #endif /* DEV_MMCREG_H */

Modified: projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci.c
==============================================================================
--- projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci.c	Sun Feb  5 02:47:34 2017	(r313266)
+++ projects/netbsd-tests-upstream-01-2017/sys/dev/sdhci/sdhci.c	Sun Feb  5 02:49:42 2017	(r313267)
@@ -55,18 +55,19 @@ __FBSDID("$FreeBSD$");
 SYSCTL_NODE(_hw, OID_AUTO, sdhci, CTLFLAG_RD, 0, "sdhci driver");
 
 static int sdhci_debug;
-SYSCTL_INT(_hw_sdhci, OID_AUTO, debug, CTLFLAG_RWTUN, &sdhci_debug, 0, "Debug level");
+SYSCTL_INT(_hw_sdhci, OID_AUTO, debug, CTLFLAG_RWTUN, &sdhci_debug, 0,
+    "Debug level");
 
-#define RD1(slot, off)	SDHCI_READ_1((slot)->bus, (slot), (off))
-#define RD2(slot, off)	SDHCI_READ_2((slot)->bus, (slot), (off))
-#define RD4(slot, off)	SDHCI_READ_4((slot)->bus, (slot), (off))
-#define RD_MULTI_4(slot, off, ptr, count)	\
+#define	RD1(slot, off)	SDHCI_READ_1((slot)->bus, (slot), (off))
+#define	RD2(slot, off)	SDHCI_READ_2((slot)->bus, (slot), (off))
+#define	RD4(slot, off)	SDHCI_READ_4((slot)->bus, (slot), (off))
+#define	RD_MULTI_4(slot, off, ptr, count)	\
     SDHCI_READ_MULTI_4((slot)->bus, (slot), (off), (ptr), (count))
 
-#define WR1(slot, off, val)	SDHCI_WRITE_1((slot)->bus, (slot), (off), (val))
-#define WR2(slot, off, val)	SDHCI_WRITE_2((slot)->bus, (slot), (off), (val))
-#define WR4(slot, off, val)	SDHCI_WRITE_4((slot)->bus, (slot), (off), (val))
-#define WR_MULTI_4(slot, off, ptr, count)	\
+#define	WR1(slot, off, val)	SDHCI_WRITE_1((slot)->bus, (slot), (off), (val))
+#define	WR2(slot, off, val)	SDHCI_WRITE_2((slot)->bus, (slot), (off), (val))
+#define	WR4(slot, off, val)	SDHCI_WRITE_4((slot)->bus, (slot), (off), (val))
+#define	WR_MULTI_4(slot, off, ptr, count)	\
     SDHCI_WRITE_MULTI_4((slot)->bus, (slot), (off), (ptr), (count))
 
 static void sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock);
@@ -77,13 +78,13 @@ static void sdhci_card_poll(void *);
 static void sdhci_card_task(void *, int);
 
 /* helper routines */
-#define SDHCI_LOCK(_slot)		mtx_lock(&(_slot)->mtx)
+#define	SDHCI_LOCK(_slot)		mtx_lock(&(_slot)->mtx)
 #define	SDHCI_UNLOCK(_slot)		mtx_unlock(&(_slot)->mtx)
-#define SDHCI_LOCK_INIT(_slot) \
+#define	SDHCI_LOCK_INIT(_slot) \
 	mtx_init(&_slot->mtx, "SD slot mtx", "sdhci", MTX_DEF)
-#define SDHCI_LOCK_DESTROY(_slot)	mtx_destroy(&_slot->mtx);
-#define SDHCI_ASSERT_LOCKED(_slot)	mtx_assert(&_slot->mtx, MA_OWNED);
-#define SDHCI_ASSERT_UNLOCKED(_slot)	mtx_assert(&_slot->mtx, MA_NOTOWNED);
+#define	SDHCI_LOCK_DESTROY(_slot)	mtx_destroy(&_slot->mtx);
+#define	SDHCI_ASSERT_LOCKED(_slot)	mtx_assert(&_slot->mtx, MA_OWNED);
+#define	SDHCI_ASSERT_UNLOCKED(_slot)	mtx_assert(&_slot->mtx, MA_NOTOWNED);
 
 #define	SDHCI_DEFAULT_MAX_FREQ	50
 
@@ -97,20 +98,20 @@ static void sdhci_card_task(void *, int)
  * Broadcom BCM577xx Controller Constants
  */
 /* Maximum divider supported by the default clock source. */
-#define BCM577XX_DEFAULT_MAX_DIVIDER	256
+#define	BCM577XX_DEFAULT_MAX_DIVIDER	256
 /* Alternative clock's base frequency. */
-#define BCM577XX_ALT_CLOCK_BASE		63000000
-
-#define BCM577XX_HOST_CONTROL		0x198
-#define BCM577XX_CTRL_CLKSEL_MASK	0xFFFFCFFF
-#define BCM577XX_CTRL_CLKSEL_SHIFT	12
-#define BCM577XX_CTRL_CLKSEL_DEFAULT	0x0
-#define BCM577XX_CTRL_CLKSEL_64MHZ	0x3
+#define	BCM577XX_ALT_CLOCK_BASE		63000000
 
+#define	BCM577XX_HOST_CONTROL		0x198
+#define	BCM577XX_CTRL_CLKSEL_MASK	0xFFFFCFFF
+#define	BCM577XX_CTRL_CLKSEL_SHIFT	12
+#define	BCM577XX_CTRL_CLKSEL_DEFAULT	0x0
+#define	BCM577XX_CTRL_CLKSEL_64MHZ	0x3
 
 static void
 sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
 {
+
 	if (error != 0) {
 		printf("getaddr: error %d\n", error);
 		return;

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702050249.v152ng2N018631>