Mercurial > illumos > git > illumos-omnios
changeset 21514:1e16d8ca3768
Merge branch 'upstream_gate' into upstream_merge/2019061801
commit cf26d3683a
11191 zfs.1m: UNSUPP: unsupported escape sequence: \?
commit 2da8e96eb9
11192 zpool.1m: UNSUPP: unsupported escape sequence: \?
commit 1f2dca3250
11193 cmn_err.9f: UNSUPP: unsupported escape sequences
commit 0ae8c37dc7
11194 syseventadm.1m: ERROR: using macro argument outside macro
commit e6645893d6
11195 Lint old man pages for errors with mandoc
commit be0ffda965
11221 Should be able to enable findunref without lint
commit 0409f346a1
11128 SPARC build fails for sun4v picl snmp plugin
commit 32106ed6e3
11235 make -C fails under GCC7
commit 3e3ca1ce30
10362 Catch kernel module undefined symbols at build time
commit 0d2006e470
11177 usba should read the device binary object store
11178 USB topology could know about supported, minimum speeds
11179 usba parsing code should take const data pointers
11176 usba kernel module should be CERRWARN and smatch clean
commit 9f3a5a7e38
11246 krb5 makefiles should use INS or INS.file
commit 67b1ef3c62
11238 librtld_db demos should work with gcc 7
commit 8123ce6133
9996 use GCC 7 as default primary compiler
commit 37b221f0ca
11248 Panic in smb_ofile_free after 11016
commit 6bf877adf2
11225 There are no positrons
commit 077efea495
11239 usr/src/lib/nsswitch/nis/common/switch_err.c is unused
Conflicts:
usr/src/Makefile.master
usr/src/tools/scripts/nightly.sh
usr/src/uts/sun4/os/startup.c
author | Andy Fiddaman <omnios@citrus-it.co.uk> |
---|---|
date | Tue, 18 Jun 2019 07:47:10 +0000 |
parents | dd4db089303c (current diff) 1b043da7cce0 (diff) |
children | 66b837a7261d |
files | usr/src/Makefile.master usr/src/cmd/picl/plugins/sun4v/lib/snmp/debug.c usr/src/cmd/picl/plugins/sun4v/lib/snmp/debug.h usr/src/lib/nsswitch/nis/common/switch_err.c usr/src/tools/env/illumos.sh usr/src/tools/scripts/nightly.1onbld usr/src/tools/scripts/nightly.sh usr/src/uts/common/Makefile.files usr/src/uts/sun4/os/startup.c |
diffstat | 63 files changed, 1466 insertions(+), 1405 deletions(-) [+] |
line wrap: on
line diff
--- a/exception_lists/mapfilechk Mon Jun 17 17:20:41 2019 +0200 +++ b/exception_lists/mapfilechk Tue Jun 18 07:47:10 2019 +0000 @@ -33,7 +33,7 @@ # # This file provides an exception mechanism for specifying files # that match this pattern that should be skipped. -# +# syntax: glob exception_lists/mapfilechk @@ -49,3 +49,5 @@ usr/src/cmd/mklocale/* usr/src/tools/onbld/Checks/Mapfile* usr/src/tools/scripts/* +usr/src/uts/common/mapfiles/dtrace.mapfile.awk +usr/src/uts/Makefile.mapfile
--- a/usr/src/Makefile.master Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/Makefile.master Tue Jun 18 07:47:10 2019 +0000 @@ -29,7 +29,7 @@ # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com> # Copyright 2016 Toomas Soome <tsoome@me.com> # Copyright 2019 OmniOS Community Edition (OmniOSce) Association. -# Copyright (c) 2019, Joyent, Inc. +# Copyright 2019, Joyent, Inc. # #
--- a/usr/src/cmd/make/bin/main.cc Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/make/bin/main.cc Tue Jun 18 07:47:10 2019 +0000 @@ -2545,6 +2545,8 @@ fatal(gettext("failed to change to directory %s: %s"), argv[i + 1], strerror(errno)); } + MBSTOWCS(wcs_buffer, "DMAKE_CDIR"); + name = GETNAME(wcs_buffer, FIND_LENGTH); path_reset = true; rebuild_arg0 = true; (void) get_current_path();
--- a/usr/src/cmd/picl/plugins/sun4v/lib/snmp/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/picl/plugins/sun4v/lib/snmp/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -23,6 +23,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2019 Peter Tribble. +# # # cmd/picl/plugins/sun4v/lib/snmp/Makefile @@ -30,7 +32,7 @@ LIBRARY= libpiclsnmp.a VERS= .1 -OBJECTS= snmplib.o pdu.o asn1.o debug.o +OBJECTS= snmplib.o pdu.o asn1.o # include library definitions include $(SRC)/Makefile.psm @@ -53,12 +55,6 @@ CPPFLAGS += -D_REENTRANT # -# Be careful when enabling SNMP_DEBUG; the debug log can quickly grow -# very very large. Never run cycle stress test with SNMP_DEBUG enabled! -# -#CPPFLAGS += -DSNMP_DEBUG - -# # Do NOT uncomment the following two lines, unless you want to test # the behavior of the library with an SNMP agent over network. # @@ -68,11 +64,6 @@ CFLAGS += $(CCVERBOSE) -DBIG_ENDIAN LDLIBS += -lc -lnvpair -# It's OK not to build debug.c except when SNMP_DEBUG is enabled. -# Don't let lint complain about it. -# -ALWAYS_LINT_DEFS += -erroff=E_EMPTY_TRANSLATION_UNIT - .KEEP_STATE:
--- a/usr/src/cmd/picl/plugins/sun4v/lib/snmp/asn1.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/picl/plugins/sun4v/lib/snmp/asn1.c Tue Jun 18 07:47:10 2019 +0000 @@ -22,10 +22,9 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019 Peter Tribble. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * ASN.1 encoding related routines */ @@ -36,7 +35,6 @@ #include <sys/types.h> #include "asn1.h" #include "pdu.h" -#include "debug.h" /* * This routine builds a 'SEQUENCE OF' ASN.1 object in the buffer @@ -61,8 +59,6 @@ if (bufsz_p) *bufsz_p -= 4; - LOGASNSEQ(buf, 4); - return (buf + 4); } @@ -91,8 +87,6 @@ buf[0] = (uchar_t)length; (*bufsz_p)--; - LOGASNLENGTH(buf, 1); - return (buf + 1); } else if (length <= 0xFF) { @@ -102,8 +96,6 @@ buf[1] = (uchar_t)length; *bufsz_p -= 2; - LOGASNLENGTH(buf, 2); - return (buf + 2); } else { @@ -115,8 +107,6 @@ buf[2] = (uchar_t)(length & 0xff); *bufsz_p -= 3; - LOGASNLENGTH(buf, 3); - return (buf + 3); } } @@ -171,8 +161,6 @@ *bufsz_p -= valsz; - LOGASNINT(buf, p + valsz - buf); - return (p + valsz); } } @@ -192,17 +180,15 @@ if (*bufsz_p < slen) return (NULL); else { - if (str) { - (void) memcpy(p, str, slen); - } else { - (void) memset(p, 0, slen); - } + if (str) { + (void) memcpy(p, str, slen); + } else { + (void) memset(p, 0, slen); + } - *bufsz_p -= slen; + *bufsz_p -= slen; - LOGASNOCTSTR(buf, p + slen - buf); - - return (p + slen); + return (p + slen); } } @@ -318,8 +304,6 @@ *bufsz_p -= oid_asnlen; - LOGASNOID(buf, p - buf); - return (p); } /* @@ -332,8 +316,6 @@ p = asn_build_header(buf, bufsz_p, id, 0); - LOGASNNULL(buf, p - buf); - return (p); }
--- a/usr/src/cmd/picl/plugins/sun4v/lib/snmp/debug.c Mon Jun 17 17:20:41 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,616 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef SNMP_DEBUG - -/* - * Debug routines - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <thread.h> -#include <synch.h> -#include <ctype.h> -#include <sys/types.h> -#include "asn1.h" -#include "pdu.h" -#include "snmplib.h" -#include "debug.h" - -/* - * Buffer and line limits - */ -#define SNMP_DBLOCK_SZ 4096 -#define SNMP_DMAX_LINE 80 -#define SNMP_NCHARS_IN_A_ROW 16 - -/* - * Debug flags - */ -#define SNMP_DEBUG_CMD 0x01 -#define SNMP_DEBUG_VAR 0x02 -#define SNMP_DEBUG_PDU 0x04 -#define SNMP_DEBUG_ASN 0x08 -#define SNMP_DEBUG_PKT 0x10 -#define SNMP_DEBUG_IO 0x20 - -#define SNMP_DEBUG_DEFAULT 0x15 /* cmd, pdu, pkt */ -#define SNMP_DEBUG_EXTENDED 0x35 /* cmd, pdu, pkt, io */ -#define SNMP_DEBUG_ALL 0x3f - -/* - * Formatting aids - */ -#define SNMP_DCMD_INDENT 2 -#define SNMP_DVAR_INDENT 4 -#define SNMP_DPDU_INDENT 6 -#define SNMP_DASN_INDENT 8 -#define SNMP_DPKT_INDENT 10 -#define SNMP_DIO_INDENT 12 - -#define SNMP_DHDR_PREFIX (const char *)" ___ " -#define SNMP_DHDR_SUFFIX (const char *)" ___" -#define SNMP_DTEXT_PREFIX (const char *)"| " - -/* - * All debug vars are protected by a single lock - */ -static mutex_t snmp_dbuf_lock; /* debug lock */ -static uint16_t snmp_debug_flag = SNMP_DEBUG_EXTENDED; /* debug flags */ -static char *snmp_dbuf = NULL; /* the debug buffer */ -static char *snmp_dbuf_curp = NULL; /* current dbuf index */ -static char *snmp_dbuf_tail = NULL; /* current dbuf tail */ -static int snmp_dbuf_sz = 0; /* current dbuf size */ -static int snmp_dbuf_overflow = 0; /* no more memory */ -static char snmp_lbuf[SNMP_DMAX_LINE]; /* scratch space */ - -/* - * Key-to-string - */ -typedef struct { - int key; - char *str; -} snmp_key_to_str_t; - -static snmp_key_to_str_t snmp_cmds[] = { - { SNMP_MSG_GET, "SNMP_MSG_GET" }, - { SNMP_MSG_GETNEXT, "SNMP_MSG_GETNEXT" }, - { SNMP_MSG_RESPONSE, "SNMP_MSG_RESPONSE" }, - { SNMP_MSG_SET, "SNMP_MSG_SET" }, - { SNMP_MSG_TRAP, "SNMP_MSG_TRAP" }, - { SNMP_MSG_GETBULK, "SNMP_MSG_GETBULK" }, - { SNMP_MSG_INFORM, "SNMP_MSG_INFORM" }, - { SNMP_MSG_TRAP2, "SNMP_MSG_TRAP2" }, - { SNMP_MSG_REPORT, "SNMP_MSG_REPORT" } -}; - -static snmp_key_to_str_t snmp_vartypes[] = { - { ASN_BOOLEAN, "ASN_BOOLEAN" }, - { ASN_INTEGER, "ASN_INTEGER" }, - { ASN_BIT_STR, "ASN_BIT_STR" }, - { ASN_OCTET_STR, "ASN_OCTET_STR" }, - { ASN_NULL, "ASN_NULL" }, - { ASN_OBJECT_ID, "ASN_OBJECT_ID" }, - { ASN_SEQUENCE, "ASN_SEQUENCE" } -}; - -static snmp_key_to_str_t snmp_asnencodings[] = { - { SNMP_DASN_SEQUENCE, "ASN SEQUENCE" }, - { SNMP_DASN_LENGTH, "ASN LENGTH" }, - { SNMP_DASN_INT, "ASN INT" }, - { SNMP_DASN_OCTET_STR, "ASN OCTET STR" }, - { SNMP_DASN_OID, "ASN OBJECT ID" }, - { SNMP_DASN_NULL, "ASN NULL" } -}; - -static char *debug_tags[] = { - "SNMP Command Request", - "Null Var", - "Response Var", - "Request PDU", - "Response PDU", - "Request Packet", - "Response Packet", - "WRITE", - "IOCTL", - "READ", - "SENDTO", - "RECVFROM" -}; -static const int n_tags = sizeof (debug_tags) / sizeof (char *); - -/* - * Helpers - */ -static char *snmp_cmdstr_lookup(int cmd); -static char *snmp_vtypestr_lookup(int vtype); -static char *snmp_asnencoding_lookup(int asnkey); -static void snmp_get_dumpchars(uchar_t *abuf, uchar_t *p, int nchars); -static void snmp_log_append(char *bufp); -static void snmp_dbuf_realloc(void); - -void -snmp_debug_init(void) -{ - (void) mutex_init(&snmp_dbuf_lock, USYNC_THREAD, NULL); - - (void) mutex_lock(&snmp_dbuf_lock); - snmp_dbuf_realloc(); - if (snmp_dbuf == NULL) - snmp_debug_flag = 0; /* really tragic */ - (void) mutex_unlock(&snmp_dbuf_lock); -} - -void -snmp_log_cmd(uint_t tag, int cmd, int n_oids, char *oidstr, int row) -{ - char *cmdstr; - int i; - - if (oidstr == NULL) - return; - - (void) mutex_lock(&snmp_dbuf_lock); - - if ((snmp_debug_flag & SNMP_DEBUG_CMD) == 0) { - (void) mutex_unlock(&snmp_dbuf_lock); - return; - } - - snmp_log_append("\n"); - - if (tag < n_tags) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s%s%s\n", - SNMP_DCMD_INDENT, ' ', SNMP_DHDR_PREFIX, - debug_tags[tag], SNMP_DHDR_SUFFIX); - snmp_log_append(snmp_lbuf); - } - - if ((cmdstr = snmp_cmdstr_lookup(cmd)) == NULL) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sCMD=%#x\n", - SNMP_DCMD_INDENT, ' ', SNMP_DTEXT_PREFIX, cmd); - } else { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s%s\n", - SNMP_DCMD_INDENT, ' ', SNMP_DTEXT_PREFIX, cmdstr); - } - snmp_log_append(snmp_lbuf); - - for (i = 0; i < n_oids; i++) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s %s.%d\n", - SNMP_DCMD_INDENT, ' ', SNMP_DTEXT_PREFIX, - oidstr, row); - snmp_log_append(snmp_lbuf); - - oidstr += strlen(oidstr) + 1; - } - - (void) mutex_unlock(&snmp_dbuf_lock); -} - -void -snmp_log_var(uint_t tag, pdu_varlist_t *vp) -{ - char *vts; - - if (vp == NULL) - return; - - (void) mutex_lock(&snmp_dbuf_lock); - - if ((snmp_debug_flag & SNMP_DEBUG_VAR) == 0) { - (void) mutex_unlock(&snmp_dbuf_lock); - return; - } - - snmp_log_append("\n"); - - if (tag < n_tags) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s%s%s\n", - SNMP_DVAR_INDENT, ' ', SNMP_DHDR_PREFIX, - debug_tags[tag], SNMP_DHDR_SUFFIX); - snmp_log_append(snmp_lbuf); - } - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%snextvar = %#x\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vp->nextvar); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sname = %#x\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vp->name); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sname_len = %u\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vp->name_len); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sval.ptr = %#x\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vp->val.str); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sval_len = %u\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vp->val_len); - snmp_log_append(snmp_lbuf); - - if ((vts = snmp_vtypestr_lookup(vp->type)) == NULL) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%stype = %#x\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vp->type); - } else { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%stype = %s\n", - SNMP_DVAR_INDENT, ' ', SNMP_DTEXT_PREFIX, vts); - } - snmp_log_append(snmp_lbuf); - - (void) mutex_unlock(&snmp_dbuf_lock); -} - -void -snmp_log_pdu(uint_t tag, snmp_pdu_t *pdu) -{ - char *cmdstr; - - if (pdu == NULL) - return; - - (void) mutex_lock(&snmp_dbuf_lock); - - if ((snmp_debug_flag & SNMP_DEBUG_PDU) == 0) { - (void) mutex_unlock(&snmp_dbuf_lock); - return; - } - - snmp_log_append("\n"); - - if (tag < n_tags) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s%s%s\n", - SNMP_DPDU_INDENT, ' ', SNMP_DHDR_PREFIX, - debug_tags[tag], SNMP_DHDR_SUFFIX); - snmp_log_append(snmp_lbuf); - } - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sversion = %d\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->version); - snmp_log_append(snmp_lbuf); - - if (pdu->community) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%scommunity = %s\n", SNMP_DPDU_INDENT, ' ', - SNMP_DTEXT_PREFIX, pdu->community); - } else { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%scommunity = %#x\n", SNMP_DPDU_INDENT, ' ', - SNMP_DTEXT_PREFIX, pdu->community); - } - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%scommunity_len = %u\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->community_len); - snmp_log_append(snmp_lbuf); - - if ((cmdstr = snmp_cmdstr_lookup(pdu->command)) == NULL) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%scommand = %#x\n", SNMP_DPDU_INDENT, ' ', - SNMP_DTEXT_PREFIX, pdu->command); - } else { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%scommand = %s\n", SNMP_DPDU_INDENT, ' ', - SNMP_DTEXT_PREFIX, cmdstr); - } - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sreqid = %d\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->reqid); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%serrstat = %#x (non-repeaters)\n", SNMP_DPDU_INDENT, ' ', - SNMP_DTEXT_PREFIX, pdu->errstat); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%serrindex = %u (max-reps)\n", SNMP_DPDU_INDENT, ' ', - SNMP_DTEXT_PREFIX, pdu->errindex); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%svars = %#x\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->vars); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sreq_pkt = %#x\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->req_pkt); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sreq_pktsz = %u\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->req_pktsz); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sreply_pkt = %#x\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->reply_pkt); - snmp_log_append(snmp_lbuf); - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sreply_pktsz = %u\n", - SNMP_DPDU_INDENT, ' ', SNMP_DTEXT_PREFIX, pdu->reply_pktsz); - snmp_log_append(snmp_lbuf); - - snmp_log_append("\n"); - - (void) mutex_unlock(&snmp_dbuf_lock); -} - -void -snmp_log_asn(int key, uchar_t *pkt, size_t pktsz) -{ - char *p, *asnstr; - int i, len; - size_t nrows, nrem; - - if (pkt == NULL) - return; - - (void) mutex_lock(&snmp_dbuf_lock); - - if ((snmp_debug_flag & SNMP_DEBUG_ASN) == 0) { - (void) mutex_unlock(&snmp_dbuf_lock); - return; - } - - if ((asnstr = snmp_asnencoding_lookup(key)) == NULL) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%sASNKEY=%#x\n", - SNMP_DASN_INDENT, ' ', SNMP_DTEXT_PREFIX, key); - } else { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s%s\n", - SNMP_DASN_INDENT, ' ', SNMP_DTEXT_PREFIX, asnstr); - } - snmp_log_append(snmp_lbuf); - - nrows = pktsz / 16; - for (i = 0; i < nrows; i++) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s " - "%02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x\n", - SNMP_DASN_INDENT, ' ', SNMP_DTEXT_PREFIX, - pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5], - pkt[6], pkt[7], pkt[8], pkt[9], pkt[10], pkt[11], - pkt[12], pkt[13], pkt[14], pkt[15]); - - pkt += 16; - snmp_log_append(snmp_lbuf); - } - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s ", - SNMP_DASN_INDENT, ' ', SNMP_DTEXT_PREFIX); - - p = snmp_lbuf + SNMP_DASN_INDENT + strlen(SNMP_DTEXT_PREFIX) + 1; - len = SNMP_DMAX_LINE - SNMP_DASN_INDENT - strlen(SNMP_DTEXT_PREFIX) - 1; - - nrem = pktsz % 16; - for (i = 0; i < nrem; i++) { - (void) snprintf(p, len, " %02x", pkt[i]); - - p += 3; - len -= 3; - } - (void) snprintf(p, len, "\n"); - snmp_log_append(snmp_lbuf); - - (void) mutex_unlock(&snmp_dbuf_lock); -} - -void -snmp_log_pkt(uint_t tag, uchar_t *pkt, size_t pktsz) -{ - uchar_t ascii[SNMP_NCHARS_IN_A_ROW + 1]; - uchar_t *p = pkt; - char *bufp; - int nrows, nrem; - int i, len; - - if (pkt == NULL) - return; - - (void) mutex_lock(&snmp_dbuf_lock); - - if ((snmp_debug_flag & SNMP_DEBUG_PKT) == 0) { - (void) mutex_unlock(&snmp_dbuf_lock); - return; - } - - snmp_log_append("\n"); - - if (tag < n_tags) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s%s%s\n", - SNMP_DPKT_INDENT, ' ', - SNMP_DHDR_PREFIX, debug_tags[tag], SNMP_DHDR_SUFFIX); - snmp_log_append(snmp_lbuf); - } - - nrows = pktsz / SNMP_NCHARS_IN_A_ROW; - nrem = pktsz % SNMP_NCHARS_IN_A_ROW; - - for (i = 0; i < nrows; i++) { - snmp_get_dumpchars(ascii, p, SNMP_NCHARS_IN_A_ROW); - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s" - "%02x %02x %02x %02x %02x %02x %02x %02x " - "%02x %02x %02x %02x %02x %02x %02x %02x " - "%s\n", - SNMP_DPKT_INDENT, ' ', SNMP_DTEXT_PREFIX, - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], - p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], - ascii); - p += 16; - - snmp_log_append(snmp_lbuf); - } - - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, "%*c%s", - SNMP_DPKT_INDENT, ' ', SNMP_DTEXT_PREFIX); - - snmp_get_dumpchars(ascii, p, nrem); - - bufp = snmp_lbuf + SNMP_DPKT_INDENT + strlen(SNMP_DTEXT_PREFIX); - len = SNMP_DMAX_LINE - SNMP_DPKT_INDENT + strlen(SNMP_DTEXT_PREFIX); - for (i = 0; i < 16; i++) { - if (i < nrem) - (void) snprintf(bufp, len, "%02x ", p[i]); - else - (void) snprintf(bufp, len, " "); - - bufp += 3; - len -= 3; - } - (void) snprintf(bufp, len, "%s\n", ascii); - snmp_log_append(snmp_lbuf); - - (void) mutex_unlock(&snmp_dbuf_lock); -} - -void -snmp_log_io(uint_t tag, int a1, uint_t a2, uint_t a3) -{ - (void) mutex_lock(&snmp_dbuf_lock); - - if ((snmp_debug_flag & SNMP_DEBUG_IO) == 0) { - (void) mutex_unlock(&snmp_dbuf_lock); - return; - } - - snmp_log_append("\n"); - - if (tag < n_tags) { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%s%s(%d, %#x, %#x)\n", SNMP_DIO_INDENT, ' ', - SNMP_DTEXT_PREFIX, debug_tags[tag], a1, a2, a3); - } else { - (void) snprintf(snmp_lbuf, SNMP_DMAX_LINE, - "%*c%s%#x(%d, %#x, %#x)\n", SNMP_DIO_INDENT, ' ', - SNMP_DTEXT_PREFIX, tag, a1, a2, a3); - } - - snmp_log_append(snmp_lbuf); - - (void) mutex_unlock(&snmp_dbuf_lock); -} - -static char * -snmp_cmdstr_lookup(int cmd) -{ - int nelem = sizeof (snmp_cmds) / sizeof (snmp_key_to_str_t); - int i; - - for (i = 0; i < nelem; i++) { - if (snmp_cmds[i].key == cmd) - return (snmp_cmds[i].str); - } - - return (NULL); -} - -static char * -snmp_vtypestr_lookup(int vtype) -{ - int nelem = sizeof (snmp_vartypes) / sizeof (snmp_key_to_str_t); - int i; - - for (i = 0; i < nelem; i++) { - if (snmp_vartypes[i].key == vtype) - return (snmp_vartypes[i].str); - } - - return (NULL); -} - -static char * -snmp_asnencoding_lookup(int asnkey) -{ - int nelem = sizeof (snmp_asnencodings) / sizeof (snmp_key_to_str_t); - int i; - - for (i = 0; i < nelem; i++) { - if (snmp_asnencodings[i].key == asnkey) - return (snmp_asnencodings[i].str); - } - - return (NULL); -} - -static void -snmp_get_dumpchars(uchar_t *abuf, uchar_t *p, int nchars) -{ - int i; - - if (nchars > SNMP_NCHARS_IN_A_ROW) - nchars = SNMP_NCHARS_IN_A_ROW; - - abuf[nchars] = 0; - for (i = 0; i < nchars; i++) - abuf[i] = isprint(p[i]) ? p[i] : '.'; -} - -static void -snmp_log_append(char *bufp) -{ - int len; - - len = strlen(bufp); - if ((snmp_dbuf_curp + len) >= snmp_dbuf_tail) - snmp_dbuf_realloc(); - - (void) strcpy(snmp_dbuf_curp, bufp); - - snmp_dbuf_curp += len; -} - -static void -snmp_dbuf_realloc(void) -{ - char *p; - size_t offset = 0; - size_t count; - - count = snmp_dbuf_sz + SNMP_DBLOCK_SZ; - if ((p = (char *)calloc(count, 1)) == NULL) { - snmp_dbuf_overflow++; - snmp_dbuf_curp = snmp_dbuf; - return; - } - - if (snmp_dbuf) { - offset = snmp_dbuf_curp - snmp_dbuf; - (void) memcpy(p, snmp_dbuf, snmp_dbuf_sz); - free(snmp_dbuf); - } - - snmp_dbuf = p; - snmp_dbuf_sz += SNMP_DBLOCK_SZ; - - snmp_dbuf_curp = snmp_dbuf + offset; - snmp_dbuf_tail = snmp_dbuf + snmp_dbuf_sz; -} - -#endif
--- a/usr/src/cmd/picl/plugins/sun4v/lib/snmp/debug.h Mon Jun 17 17:20:41 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _DEBUG_H -#define _DEBUG_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef SNMP_DEBUG - -/* - * ASN Debugging keys - */ -#define SNMP_DASN_SEQUENCE 1 -#define SNMP_DASN_LENGTH 2 -#define SNMP_DASN_INT 3 -#define SNMP_DASN_OCTET_STR 4 -#define SNMP_DASN_OID 5 -#define SNMP_DASN_NULL 6 - -/* - * Debug tags - */ -#define TAG_CMD_REQUEST 0 -#define TAG_NULL_VAR 1 -#define TAG_RESPONSE_VAR 2 -#define TAG_REQUEST_PDU 3 -#define TAG_RESPONSE_PDU 4 -#define TAG_REQUEST_PKT 5 -#define TAG_RESPONSE_PKT 6 -#define TAG_WRITE 7 -#define TAG_IOCTL 8 -#define TAG_READ 9 -#define TAG_SENDTO 10 -#define TAG_RECVFROM 11 - -/* - * Debug macros - */ -#define LOGINIT() \ - snmp_debug_init() - -#define LOGGET(tag, prefix, row) \ - snmp_log_cmd(tag, SNMP_MSG_GET, 1, prefix, row) - -#define LOGBULK(tag, n_oids, oidstrs, row) \ - snmp_log_cmd(tag, SNMP_MSG_GETBULK, n_oids, oidstrs, row) - -#define LOGNEXT(tag, prefix, row) \ - snmp_log_cmd(tag, SNMP_MSG_GETNEXT, 1, prefix, row) - -#define LOGVAR(tag, vp) \ - snmp_log_var(tag, vp) - -#define LOGPDU(tag, pdu) \ - snmp_log_pdu(tag, pdu) - -#define LOGASNSEQ(pkt, pktsz) \ - snmp_log_asn(SNMP_DASN_SEQUENCE, pkt, pktsz) - -#define LOGASNLENGTH(pkt, pktsz) \ - snmp_log_asn(SNMP_DASN_LENGTH, pkt, pktsz) - -#define LOGASNINT(pkt, pktsz) \ - snmp_log_asn(SNMP_DASN_INT, pkt, pktsz) - -#define LOGASNOCTSTR(pkt, pktsz) \ - snmp_log_asn(SNMP_DASN_OCTET_STR, pkt, pktsz) - -#define LOGASNOID(pkt, pktsz) \ - snmp_log_asn(SNMP_DASN_OID, pkt, pktsz) - -#define LOGASNNULL(pkt, pktsz) \ - snmp_log_asn(SNMP_DASN_NULL, pkt, pktsz) - -#define LOGPKT(tag, pkt, sz) \ - snmp_log_pkt(tag, pkt, sz) - -#define LOGIO(tag, a1, a2, a3) \ - snmp_log_io(tag, (int)a1, (uint_t)a2, (uint_t)a3) - -/* - * Exported debug interfaces - */ -extern void snmp_debug_init(void); -extern void snmp_log_cmd(uint_t tag, int cmd, int n_oids, - char *oidstr, int row); -extern void snmp_log_var(uint_t tag, pdu_varlist_t *vp); -extern void snmp_log_pdu(uint_t tag, snmp_pdu_t *pdu); -extern void snmp_log_asn(int key, uchar_t *pkt, size_t pktsz); -extern void snmp_log_pkt(uint_t tag, uchar_t *pkt, size_t pktsz); -extern void snmp_log_io(uint_t tag, int a1, uint_t a2, uint_t a3); - -#else /* SNMP_DEBUG */ - -#define LOGINIT() -#define LOGGET(tag, prefix, row) -#define LOGBULK(tag, n_oids, oidstrs, row) -#define LOGNEXT(tag, prefix, row) -#define LOGVAR(tag, vp) -#define LOGPDU(tag, pdu) -#define LOGASNSEQ(pkt, pktsz) -#define LOGASNLENGTH(pkt, pktsz) -#define LOGASNINT(pkt, pktsz) -#define LOGASNOCTSTR(pkt, pktsz) -#define LOGASNOID(pkt, pktsz) -#define LOGASNNULL(pkt, pktsz) -#define LOGPKT(tag, pkt, sz) -#define LOGIO(tag, a1, a2, a3) - -#endif /* SNMP_DEBUG */ - -#ifdef __cplusplus -} -#endif - -#endif /* _DEBUG_H */
--- a/usr/src/cmd/picl/plugins/sun4v/lib/snmp/pdu.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/picl/plugins/sun4v/lib/snmp/pdu.c Tue Jun 18 07:47:10 2019 +0000 @@ -22,10 +22,9 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019 Peter Tribble. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * SNMP PDU and packet transport related routines */ @@ -36,7 +35,6 @@ #include <sys/types.h> #include "asn1.h" #include "pdu.h" -#include "debug.h" /* * Static declarations @@ -276,8 +274,6 @@ vp->type = ASN_NULL; vp->nextvar = NULL; - LOGVAR(TAG_NULL_VAR, vp); - prev = vp; p += strlen(p) + 1; } @@ -601,8 +597,6 @@ vp = newvp; if ((p = snmp_parse_variable(p, msgsz_p, vp)) == NULL) return (NULL); - - LOGVAR(TAG_RESPONSE_VAR, vp); } return (p);
--- a/usr/src/cmd/picl/plugins/sun4v/lib/snmp/snmplib.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/picl/plugins/sun4v/lib/snmp/snmplib.c Tue Jun 18 07:47:10 2019 +0000 @@ -22,6 +22,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019 Peter Tribble. */ /* @@ -47,7 +48,6 @@ #include "snmplib.h" #include "asn1.h" #include "pdu.h" -#include "debug.h" #pragma init(libpiclsnmp_init) /* need this in .init */ @@ -69,13 +69,6 @@ static mutex_t snmp_reqid_lock; static int snmp_reqid = 1; -#ifdef SNMP_DEBUG -uint_t snmp_nsends = 0; -uint_t snmp_sentbytes = 0; -uint_t snmp_nrecvs = 0; -uint_t snmp_rcvdbytes = 0; -#endif - #ifdef USE_SOCKETS #define SNMP_DEFAULT_PORT 161 #define SNMP_MAX_RECV_PKTSZ (64 * 1024) @@ -176,8 +169,6 @@ (void) mutex_init(&refreshq_lock, USYNC_THREAD, NULL); (void) mutex_init(&snmp_reqid_lock, USYNC_THREAD, NULL); - - LOGINIT(); } picl_snmphdl_t @@ -877,20 +868,14 @@ { snmp_pdu_t *pdu, *reply_pdu; - LOGGET(TAG_CMD_REQUEST, prefix, row); - if ((pdu = snmp_create_pdu(SNMP_MSG_GET, 0, prefix, 1, row)) == NULL) return (NULL); - LOGPDU(TAG_REQUEST_PDU, pdu); - if (snmp_make_packet(pdu) < 0) { snmp_free_pdu(pdu); return (NULL); } - LOGPKT(TAG_REQUEST_PKT, pdu->req_pkt, pdu->req_pktsz); - if (snmp_send_request(smd, pdu, snmp_syserr) < 0) { snmp_free_pdu(pdu); return (NULL); @@ -901,13 +886,9 @@ return (NULL); } - LOGPKT(TAG_RESPONSE_PKT, pdu->reply_pkt, pdu->reply_pktsz); - reply_pdu = snmp_parse_reply(pdu->reqid, pdu->reply_pkt, pdu->reply_pktsz); - LOGPDU(TAG_RESPONSE_PDU, reply_pdu); - snmp_free_pdu(pdu); return (reply_pdu); @@ -920,8 +901,6 @@ snmp_pdu_t *pdu, *reply_pdu; int max_reps; - LOGBULK(TAG_CMD_REQUEST, n_oids, oidstrs, row); - /* * If we're fetching volatile properties using BULKGET, don't * venture to get multiple rows (passing max_reps=0 will make @@ -933,8 +912,6 @@ if (pdu == NULL) return; - LOGPDU(TAG_REQUEST_PDU, pdu); - /* * Make an ASN.1 encoded packet from the PDU information */ @@ -943,8 +920,6 @@ return; } - LOGPKT(TAG_REQUEST_PKT, pdu->req_pkt, pdu->req_pktsz); - /* * Send the request packet to the agent */ @@ -962,8 +937,6 @@ return; } - LOGPKT(TAG_RESPONSE_PKT, pdu->reply_pkt, pdu->reply_pktsz); - /* * Parse the reply, validate the response and create a * reply-PDU out of the information. Populate the mibcache @@ -972,8 +945,6 @@ reply_pdu = snmp_parse_reply(pdu->reqid, pdu->reply_pkt, pdu->reply_pktsz); if (reply_pdu) { - LOGPDU(TAG_RESPONSE_PDU, reply_pdu); - if (reply_pdu->errstat == SNMP_ERR_NOERROR) { if (is_vol) { /* Add a job to the cache refresh work queue */ @@ -995,21 +966,15 @@ { snmp_pdu_t *pdu, *reply_pdu; - LOGNEXT(TAG_CMD_REQUEST, prefix, row); - pdu = snmp_create_pdu(SNMP_MSG_GETNEXT, 0, prefix, 1, row); if (pdu == NULL) return (NULL); - LOGPDU(TAG_REQUEST_PDU, pdu); - if (snmp_make_packet(pdu) < 0) { snmp_free_pdu(pdu); return (NULL); } - LOGPKT(TAG_REQUEST_PKT, pdu->req_pkt, pdu->req_pktsz); - if (snmp_send_request(smd, pdu, snmp_syserr) < 0) { snmp_free_pdu(pdu); return (NULL); @@ -1020,13 +985,9 @@ return (NULL); } - LOGPKT(TAG_RESPONSE_PKT, pdu->reply_pkt, pdu->reply_pktsz); - reply_pdu = snmp_parse_reply(pdu->reqid, pdu->reply_pkt, pdu->reply_pktsz); - LOGPDU(TAG_RESPONSE_PDU, reply_pdu); - snmp_free_pdu(pdu); return (reply_pdu); @@ -1049,8 +1010,6 @@ #ifdef USE_SOCKETS ret = -1; while (ret < 0) { - LOGIO(TAG_SENDTO, smd->fd, pdu->req_pkt, pdu->req_pktsz); - ret = sendto(smd->fd, pdu->req_pkt, pdu->req_pktsz, 0, (struct sockaddr *)&smd->agent_addr, sizeof (struct sockaddr)); @@ -1059,8 +1018,6 @@ } } #else - LOGIO(TAG_WRITE, smd->fd, pdu->req_pkt, pdu->req_pktsz); - if (write(smd->fd, pdu->req_pkt, pdu->req_pktsz) < 0) { if (snmp_syserr) *snmp_syserr = errno; @@ -1068,11 +1025,6 @@ } #endif -#ifdef SNMP_DEBUG - snmp_nsends++; - snmp_sentbytes += pdu->req_pktsz; -#endif - return (0); } @@ -1084,7 +1036,7 @@ uchar_t *pkt; extern int errno; #ifdef USE_SOCKETS - struct sockaddr_in from; + struct sockaddr_in from; int fromlen; ssize_t msgsz; #endif @@ -1098,8 +1050,6 @@ fromlen = sizeof (struct sockaddr_in); - LOGIO(TAG_RECVFROM, smd->fd, pkt, SNMP_MAX_RECV_PKTSZ); - msgsz = recvfrom(smd->fd, pkt, SNMP_MAX_RECV_PKTSZ, 0, (struct sockaddr *)&from, &fromlen); if (msgsz < 0 || msgsz >= SNMP_MAX_RECV_PKTSZ) { @@ -1109,8 +1059,6 @@ pktsz = (size_t)msgsz; #else - LOGIO(TAG_IOCTL, smd->fd, DSSNMP_GETINFO, &snmp_info); - /* * The ioctl will block until we have snmp data available */ @@ -1124,8 +1072,6 @@ if ((pkt = (uchar_t *)calloc(1, pktsz)) == NULL) return (-1); - LOGIO(TAG_READ, smd->fd, pkt, pktsz); - if (read(smd->fd, pkt, pktsz) < 0) { free(pkt); if (snmp_syserr) @@ -1137,11 +1083,6 @@ pdu->reply_pkt = pkt; pdu->reply_pktsz = pktsz; -#ifdef SNMP_DEBUG - snmp_nrecvs++; - snmp_rcvdbytes += pktsz; -#endif - return (0); }
--- a/usr/src/cmd/sgs/librtld_db/demo/Makefile.targ Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/sgs/librtld_db/demo/Makefile.targ Tue Jun 18 07:47:10 2019 +0000 @@ -60,7 +60,7 @@ $(LINK.c) $(LDFLAG) -o $@ ../tests/simp.c -R. ./libsub.so.1 libsub.so.1: ../tests/sub.c - $(LINK.c) $(LDFLAG) -o $@ -G -Kpic -hlibsub.so.1 ../tests/sub.c + $(LINK.c) $(LDFLAG) -o $@ -G -fpic -hlibsub.so.1 ../tests/sub.c # # RDB sample runs & tests
--- a/usr/src/cmd/sgs/librtld_db/demo/common/bpt.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/sgs/librtld_db/demo/common/bpt.c Tue Jun 18 07:47:10 2019 +0000 @@ -376,7 +376,7 @@ handle_sp_break(ph); if (ph->pp_flags & FLG_PP_LMAPS) { - if (get_linkmaps(ph) != PS_OK) + if (get_linkmaps(ph) != RET_OK) (void) fprintf(stderr, "problem loading linkmaps\n"); } @@ -499,7 +499,7 @@ perr("stn: PRCFAULT"); if ((flgs & FLG_SN_VERBOSE) && (ph->pp_flags & FLG_PP_LMAPS)) { - if (get_linkmaps(ph) != PS_OK) + if (get_linkmaps(ph) != RET_OK) (void) fprintf(stderr, "problem loading linkmaps\n"); }
--- a/usr/src/cmd/sgs/librtld_db/demo/common/main.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/sgs/librtld_db/demo/common/main.c Tue Jun 18 07:47:10 2019 +0000 @@ -169,7 +169,7 @@ */ if ((cpid = fork()) == 0) { (void) execv(argv[optind], &argv[optind]); - perr(argv[1]); + perr(argv[optind]); } if (cpid == -1) /* fork() failure */
--- a/usr/src/cmd/sgs/librtld_db/demo/common/ps.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/cmd/sgs/librtld_db/demo/common/ps.c Tue Jun 18 07:47:10 2019 +0000 @@ -330,7 +330,7 @@ if (read(lwpfd, &lwpstatus, sizeof (lwpstatus)) == -1) return (PS_ERR); - gregset = lwpstatus.pr_reg; + (void) memcpy(gregset, lwpstatus.pr_reg, sizeof (*gregset)); (void) close(lwpfd); return (PS_OK);
--- a/usr/src/lib/fm/topo/libtopo/common/topo_hc.h Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/lib/fm/topo/libtopo/common/topo_hc.h Tue Jun 18 07:47:10 2019 +0000 @@ -21,7 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019, Joyent, Inc. */ #ifndef _TOPO_HC_H @@ -206,6 +206,9 @@ #define TOPO_PGROUP_USB_PROPS_VERSION "usb-version" #define TOPO_PGROUP_USB_PROPS_SPEED "usb-speed" #define TOPO_PGROUP_USB_PROPS_PORT "usb-port" +#define TOPO_PGROUP_USB_PROPS_SUPPORTED_SPEEDS "usb-supported-speeds" +#define TOPO_PGROUP_USB_PROPS_MIN_SPEED "usb-minimum-speed" + /* * These properties will exist on nodes enumerated by the ipmi module. They
--- a/usr/src/lib/fm/topo/modules/common/usb/topo_usb.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/lib/fm/topo/modules/common/usb/topo_usb.c Tue Jun 18 07:47:10 2019 +0000 @@ -10,7 +10,7 @@ */ /* - * Copyright (c) 2018, Joyent, Inc. + * Copyright (c) 2019, Joyent, Inc. */ /* @@ -1403,6 +1403,8 @@ int ret, inst; int *vendid = NULL, *prodid = NULL, *revid = NULL, *release = NULL; char *vend = NULL, *prod = NULL, *serial = NULL, *speed = NULL; + char *min_speed = NULL, *sup_speeds = NULL; + int nsup_speeds = 0; char *driver, *devfs; char revbuf[32], relbuf[32]; tnode_t *tn = NULL; @@ -1455,6 +1457,14 @@ speed = "high-speed"; } else if (strcmp(pname, "super-speed") == 0) { speed = "super-speed"; + } else if (strcmp(pname, "usb-minimum-speed") == 0) { + if (di_prop_strings(prop, &min_speed) != 1) + min_speed = NULL; + } else if (strcmp(pname, "usb-supported-speeds") == 0) { + nsup_speeds = di_prop_strings(prop, &sup_speeds); + if (nsup_speeds <= 0) { + sup_speeds = NULL; + } } } @@ -1588,6 +1598,51 @@ goto error; } + if (min_speed != NULL && topo_prop_set_string(tn, TOPO_PGROUP_USB_PROPS, + TOPO_PGROUP_USB_PROPS_MIN_SPEED, TOPO_PROP_IMMUTABLE, min_speed, + &ret) != 0) { + topo_mod_dprintf(mod, "failed to create property %s: %s", + TOPO_PGROUP_USB_PROPS_MIN_SPEED, topo_strerror(ret)); + goto error; + } + + if (sup_speeds != NULL) { + const char **strings, *c; + int i, rval; + + if ((strings = topo_mod_zalloc(mod, sizeof (char *) * + nsup_speeds)) == NULL) { + topo_mod_dprintf(mod, "failed to allocate character " + "array for property %s", + TOPO_PGROUP_USB_PROPS_SUPPORTED_SPEEDS); + goto error; + } + + /* + * devinfo string properties are concatenated NUL-terminated + * strings. We need to translate that to a string array. + */ + for (c = sup_speeds, i = 0; i < nsup_speeds; i++) { + size_t len; + + strings[i] = c; + if (i + 1 < nsup_speeds) { + len = strlen(c); + c += len + 1; + } + } + + rval = topo_prop_set_string_array(tn, TOPO_PGROUP_USB_PROPS, + TOPO_PGROUP_USB_PROPS_SUPPORTED_SPEEDS, TOPO_PROP_IMMUTABLE, + strings, nsup_speeds, &ret); + topo_mod_free(mod, strings, sizeof (char *) * nsup_speeds); + if (rval != 0) { + topo_mod_dprintf(mod, "failed to create property %s: " + "%s", TOPO_PGROUP_USB_PROPS_SUPPORTED_SPEEDS, + topo_strerror(ret)); + } + } + /* * I/O pgroup */
--- a/usr/src/lib/libkrb5/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/lib/libkrb5/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -35,7 +35,7 @@ LOCPLUGH = $(SRC)/lib/gss_mechs/mech_krb5/include/locate_plugin.h KRB5H = $(SRC)/uts/common/gssapi/mechs/krb5/include/krb5.h -KRB5INCDIR= $(ROOT)/usr/include/kerberosv5 +KRB5INCDIR= $(ROOT)/usr/include/kerberosv5 COMERRHINST = $(KRB5INCDIR)/com_err.h LOCPLUGHINST = $(KRB5INCDIR)/locate_plugin.h @@ -60,10 +60,10 @@ install_h: $(KRB5INCDIR) $(KRB5HDRS) $(COMERRHINST): $(COMERRH) - install -s -m 644 -f $(KRB5INCDIR) $(COMERRH) + $(INS) -s -m $(FILEMODE) -f $(KRB5INCDIR) $(COMERRH) $(KRB5HINST): $(KRB5H) - install -s -m 644 -f $(KRB5INCDIR) $(KRB5H) + $(INS) -s -m $(FILEMODE) -f $(KRB5INCDIR) $(KRB5H) $(LOCPLUGHINST): $(LOCPLUGH) - install -s -m 644 -f $(KRB5INCDIR) $(LOCPLUGH) + $(INS) -s -m $(FILEMODE) -f $(KRB5INCDIR) $(LOCPLUGH) FRC:
--- a/usr/src/lib/nsswitch/nis/common/switch_err.c Mon Jun 17 17:20:41 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * switch_err.c - * - * Copyright (c) 1988-1992 Sun Microsystems Inc - * All Rights Reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <rpcsvc/ypclnt.h> -#include <nsswitch.h> - -/* - * maps errors returned by libnsl/yp routines into switch errors - */ - -int -switch_err(ypclnt_err) - int ypclnt_err; -{ - int serr; - - switch (ypclnt_err) { - case 0: - serr = __NSW_SUCCESS; - break; - case YPERR_BADARGS: - case YPERR_KEY: - case YPERR_NOMORE: - serr = __NSW_NOTFOUND; - break; - case YPERR_RPC: - case YPERR_DOMAIN: - case YPERR_MAP: - case YPERR_YPERR: - case YPERR_RESRC: - case YPERR_PMAP: - case YPERR_YPBIND: - case YPERR_YPSERV: - case YPERR_NODOM: - case YPERR_BADDB: - case YPERR_VERS: - case YPERR_ACCESS: - serr = __NSW_UNAVAIL; - break; - case YPERR_BUSY: - serr = __NSW_TRYAGAIN; /* :-) */ - } - - return (serr); -}
--- a/usr/src/man/Makefile.man Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/man/Makefile.man Tue Jun 18 07:47:10 2019 +0000 @@ -25,7 +25,7 @@ # MANSECT= MANCHECKS= $(MANFILES:%=%.check) -ROOTMANFILES= $(MANFILES:%=$(ROOTMAN)/man$(MANSECT)/%) +ROOTMANFILES= $(MANFILES:%=$(ROOTMAN)/man$(MANSECT)/%) ROOTMANLINKS= $(MANLINKS:%=$(ROOTMAN)/man$(MANSECT)/%) $(ROOTMAN)/man$(MANSECT) $(ROOTHASMAN)/man$(MANSECT): @@ -44,9 +44,12 @@ # manually when editing (git pbchk will do so for you.) # $(MANCHECKS): - @$(EGREP) -q "^.TH" $(@:%.check=%) || \ - ( $(ECHO) "checking $(@:%.check=%)"; \ - $(MANDOC) -Tlint -Wwarning $(@:%.check=%) ) + @$(ECHO) "checking $(@:%.check=%)"; \ + if $(EGREP) -q "^.TH" $(@:%.check=%); then \ + $(MANDOC) -Tlint -Werror $(@:%.check=%); \ + else; \ + $(MANDOC) -Tlint -Wwarning $(@:%.check=%); \ + fi $(MANLINKS): $(RM) $@; $(SYMLINK) $(LINKSRC) $@
--- a/usr/src/man/man1m/syseventadm.1m Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/man/man1m/syseventadm.1m Tue Jun 18 07:47:10 2019 +0000 @@ -31,7 +31,7 @@ .fi .SH DESCRIPTION -.sp + .LP The \fBsyseventadm\fR command is an administrative front-end to add, remove and list \fBsysevent\fR event handlers. You can also restart the sysevent daemon by @@ -75,7 +75,7 @@ to reread the \fBsysevent\fR registry after a change has been made by adding or removing one or more \fBsysevent\fR handler specifications. .SS "Argument Macro Substitution" -.sp + .LP The \fBsysevent\fR handling facility provides extensive macro capability for constructing the command line arguments to be executed in response to an event. @@ -178,7 +178,7 @@ Array types are expanded with each element expanded as defined for that scalar type, with a space separating each element substitution. .SH OPTIONS -.sp + .LP The \fBadd\fR, \fBlist\fR and \fBremove\fR subcommands support the following options: @@ -248,7 +248,7 @@ .RE .SH OPERANDS -.sp + .LP The \fBadd\fR, \fBlist\fR and \fBremove\fR subcommands support the following options: @@ -286,8 +286,8 @@ .sp .in +2 .nf -# syseventadm add -R \$ALTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e - /opt/MYCOenv/bin/ec_env_temp \e$class \e$subclass \e$pathname +# syseventadm add -R $ALTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e + /opt/MYCOenv/bin/ec_env_temp ${class} ${subclass} ${pathname} .fi .in -2 .sp @@ -306,8 +306,8 @@ .sp .in +2 .nf -# syseventadm remove -R \$ALTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e - /opt/MYCOenv/bin/ec_env_temp \${class} \${subclass} \${pathname} +# syseventadm remove -R $ALTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e + /opt/MYCOenv/bin/ec_env_temp ${class} ${subclass} ${pathname} .fi .in -2 .sp @@ -329,7 +329,7 @@ .nf # syseventadm list -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e vendor=MYCO class=EC_ENV subclass=ESC_ENV_TEMP \e - /opt/MYCOenv/bin/ec_env_temp \e${class} \e${subclass} \e${pathname} + /opt/MYCOenv/bin/ec_env_temp ${class} ${subclass} ${pathname} .fi .in -2 .sp @@ -396,7 +396,7 @@ .sp .SH EXIT STATUS -.sp + .LP The following exit values are returned: .sp @@ -454,12 +454,12 @@ .RE .SH SEE ALSO -.sp + .LP \fBsyseventd\fR(1M), \fBsysevent_post_event\fR(3SYSEVENT), \fBattributes\fR(5), \fBddi_log_sysevent\fR(9F) .SH NOTES -.sp + .LP To avoid upgrade problems, packages delivering a sysevent event handler should install the event handler by running \fBsyseventadm\fR from the package's
--- a/usr/src/man/man1m/zfs.1m Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/man/man1m/zfs.1m Tue Jun 18 07:47:10 2019 +0000 @@ -37,7 +37,7 @@ .Nd configures ZFS file systems .Sh SYNOPSIS .Nm -.Op Fl \? +.Op Fl \&? .Nm .Cm create .Op Fl p @@ -1861,7 +1861,7 @@ All subcommands that modify state are logged persistently to the pool in their original form. .Bl -tag -width "" -.It Nm Fl \? +.It Nm Fl \&? Displays a help message. .It Xo .Nm
--- a/usr/src/man/man1m/zpool.1m Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/man/man1m/zpool.1m Tue Jun 18 07:47:10 2019 +0000 @@ -34,7 +34,7 @@ .Nd configure ZFS storage pools .Sh SYNOPSIS .Nm -.Fl \? +.Fl \&? .Nm .Cm add .Op Fl fgLnP @@ -830,7 +830,7 @@ .Bl -tag -width Ds .It Xo .Nm -.Fl \? +.Fl \&? .Xc Displays a help message. .It Xo
--- a/usr/src/man/man9f/cmn_err.9f Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/man/man9f/cmn_err.9f Tue Jun 18 07:47:10 2019 +0000 @@ -188,11 +188,11 @@ with additional meaning of the first character affecting where the message will be written: .Bl -tag -width Ds -.It Sy \! +.It \&! The message goes only to the system log. .It Sy ^ The message goes only to the console. -.It Sy \? +.It \&? If .Fa level is also @@ -202,7 +202,7 @@ See .Xr kernel 1M . If neither condition is met, the -.Qq Sy \? +.Qq Sy \&? character has no effect and is simply ignored. .El .Pp @@ -353,7 +353,7 @@ .Sy %b conversion specification. Because of the leading -.Qq Sy \? +.Qq Sy \&? character in the format string, this message will always be logged, but it will only be displayed when the kernel is booted in verbose mode. .Bd -literal
--- a/usr/src/man/man9f/usb_parse_data.9f Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/man/man9f/usb_parse_data.9f Tue Jun 18 07:47:10 2019 +0000 @@ -3,7 +3,7 @@ .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH USB_PARSE_DATA 9F "Oct 30, 2016" +.TH USB_PARSE_DATA 9F "April 4, 2019" .SH NAME usb_parse_data \- Tokenize and align the bytes of raw variable-format data .SH SYNOPSIS @@ -13,7 +13,7 @@ -\fBsize_t\fR \fBusb_parse_data\fR(\fBchar *\fR\fIformat\fR, \fBuchar_t *\fR\fIdata\fR, +\fBsize_t\fR \fBusb_parse_data\fR(\fBchar *\fR\fIformat\fR, \fBconst uchar_t *\fR\fIdata\fR, \fBsize_t\fR \fIdatalen\fR, \fBvoid *\fR\fIstructure\fR, \fBsize_t\fR \fIstructlen\fR); .fi
--- a/usr/src/tools/env/illumos.sh Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/tools/env/illumos.sh Tue Jun 18 07:47:10 2019 +0000 @@ -23,7 +23,7 @@ # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2018 OmniOS Community Edition (OmniOSce) Association. -# Copyright (c) 2019, Joyent, Inc. +# Copyright 2019, Joyent, Inc. # # - This file is sourced by "bldenv.sh" and "nightly.sh" and should not # be executed directly. @@ -78,8 +78,11 @@ # # To disable shadow compilation, unset SHADOW_* or set them to the empty string. # -export SHADOW_CCS=gcc7,/usr/gcc/7/bin/gcc,gnu -export SHADOW_CCCS=gcc7,/usr/gcc/7/bin/g++,gnu +export GNUC_ROOT=/usr/gcc/7 +export PRIMARY_CCS=gcc7,$GNUC_ROOT/bin/gcc,gnu +export PRIMARY_CCCS=gcc7,$GNUC_ROOT/bin/g++,gnu +export SHADOW_CCS=gcc4,/opt/gcc/4.4.4/bin/gcc,gnu +export SHADOW_CCCS=gcc4,/opt/gcc/4.4.4/bin/g++,gnu # uncomment to enable smatch #export ENABLE_SMATCH=1 @@ -279,13 +282,6 @@ export SPRO_ROOT='/opt/SUNWspro' export SPRO_VROOT="$SPRO_ROOT" -# This goes along with lint - it is a series of the form "A [y|n]" which -# means "go to directory A and run 'make lint'" Then mail me (y) the -# difference in the lint output. 'y' should only be used if the area you're -# linting is actually lint clean or you'll get lots of mail. -# You shouldn't need to change this though. -#export LINTDIRS="$SRC y" - # Set this flag to 'n' to disable the use of 'checkpaths'. The default, # if the 'N' option is not specified, is to run this test. #CHECK_PATHS='y'
--- a/usr/src/tools/scripts/nightly.1onbld Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/tools/scripts/nightly.1onbld Tue Jun 18 07:47:10 2019 +0000 @@ -18,8 +18,9 @@ .\" " .\" "Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. .\" "Copyright 2012 Joshua M. Clulow <josh@sysmgr.org> +.\" "Copyright 2019 Peter Tribble. .\" " -.TH NIGHTLY 1ONBLD "Jul 2, 2017" +.TH NIGHTLY 1ONBLD "Jun 9, 2019" .SH NAME .I nightly \- build an OS-Net consolidation overnight @@ -69,9 +70,6 @@ list shared lib interface and compare with previous list .TP \(bu -perform a "make lint" of the kernel and report errors -.TP -\(bu perform a "make check" to report hdrchk/cstyle errors .TP \(bu @@ -136,8 +134,7 @@ .B \-i Do an incremental build, suppressing the "make clobber" that by default removes all existing binaries and derived files. From the -command line, -i also suppresses the lint pass and the cstyle/hdrchk -pass +command line, -i also suppresses the cstyle/hdrchk pass .TP .B \-n Suppress the bringover so that the build will start immediately with @@ -190,14 +187,11 @@ .B \-f Check for unreferenced files. Since the full workspace must be built in order to accurately identify unreferenced files, -f is ignored for -incremental (-i) builds, or builds that do not include -l, and -p. +incremental (-i) builds, or builds that do not include -p. .TP .B \-r Check the ELF runtime attributes of all dynamic objects .TP -.B \-l -Do "make lint" in $LINTDIRS (default: $SRC n) -.TP .B \-N Do not run protocmp or checkpaths (note: this option is not recommended, especially in conjunction with the \-p option) @@ -392,11 +386,6 @@ to some Devpro machine every time the tools are used. .RE .LP -.B LINTDIRS -.RS 5 -Directories to lint with the \-l option. -.RE -.LP .B BUILD_TOOLS .RS 5 BUILD_TOOLS is the root of all tools including the compilers; e.g.,
--- a/usr/src/tools/scripts/nightly.sh Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/tools/scripts/nightly.sh Tue Jun 18 07:47:10 2019 +0000 @@ -28,6 +28,7 @@ # Copyright (c) 2017 by Delphix. All rights reserved. # Copyright 2018 OmniOS Community Edition (OmniOSce) Association. # Copyright 2019 Joyent, Inc. +# Copyright 2019 Peter Trible. # # Based on the nightly script from the integration folks, # Mostly modified and owned by mike_s. @@ -37,18 +38,9 @@ # The default is the old behavior of CLONE_WS # # -i on the command line, means fast options, so when it's on the -# command line (only), lint and check builds are skipped no matter what +# command line (only), check builds are skipped no matter what # the setting of their individual flags are in NIGHTLY_OPTIONS. # -# LINTDIRS can be set in the env file, format is a list of: -# -# /dirname-to-run-lint-on flag -# -# Where flag is: y - enable lint noise diff output -# n - disable lint noise diff output -# -# For example: LINTDIRS="$SRC/uts n $SRC/stand y $SRC/psm y" -# # OPTHOME may be set in the environment to override /opt # @@ -362,114 +354,6 @@ ROOT=$ORIGROOT } -# Usage: dolint /dir y|n -# Arg. 2 is a flag to turn on/off the lint diff output -function dolint { - if [ ! -d "$1" ]; then - echo "dolint error: $1 is not a directory" - exit 1 - fi - - if [ "$2" != "y" -a "$2" != "n" ]; then - echo "dolint internal error: $2 should be 'y' or 'n'" - exit 1 - fi - - lintdir=$1 - dodiff=$2 - base=`basename $lintdir` - LINTOUT=$lintdir/lint-${MACH}.out - LINTNOISE=$lintdir/lint-noise-${MACH} - export ENVLDLIBS1=`myldlibs $ROOT` - export ENVCPPFLAGS1=`myheaders $ROOT` - - set_debug_build_flags - - # - # '$MAKE lint' in $lintdir - # - echo "\n==== Begin '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE - - # remove old lint.out - rm -f $lintdir/lint.out $lintdir/lint-noise.out - if [ -f $lintdir/lint-noise.ref ]; then - mv $lintdir/lint-noise.ref ${LINTNOISE}.ref - fi - - rm -f $LINTOUT - cd $lintdir - # - # Remove all .ln files to ensure a full reference file - # - rm -f Nothing_to_remove \ - `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \ - -prune -o -type f -name '*.ln' -print ` - - /bin/time $MAKE -ek lint 2>&1 | \ - tee -a $LINTOUT >> $LOGFILE - - echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file - - grep "$MAKE:" $LINTOUT | - egrep -v "Ignoring unknown host" | \ - tee $TMPDIR/lint_errs >> $mail_msg_file - if [[ -s $TMPDIR/lint_errs ]]; then - build_extras_ok=n - fi - - echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE - - echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \ - >>$mail_msg_file - tail -3 $LINTOUT >>$mail_msg_file - - rm -f ${LINTNOISE}.ref - if [ -f ${LINTNOISE}.out ]; then - mv ${LINTNOISE}.out ${LINTNOISE}.ref - fi - grep : $LINTOUT | \ - egrep -v '^(real|user|sys)' | - egrep -v '(library construction)' | \ - egrep -v ': global crosschecks' | \ - egrep -v 'Ignoring unknown host' | \ - egrep -v '\.c:$' | \ - sort | uniq > ${LINTNOISE}.out - if [ ! -f ${LINTNOISE}.ref ]; then - cp ${LINTNOISE}.out ${LINTNOISE}.ref - fi - - if [ "$dodiff" != "n" ]; then - echo "\n==== lint warnings $base ====\n" \ - >>$mail_msg_file - # should be none, though there are a few that were filtered out - # above. - - # We also exclude: - # /vmm/ as there are multiple lint warning present in this - # code imported from FreeBSD which are not being - # addressed in order to make future upstream merges - # easier. - # ctype.h A specific warning for the isprint() function that - # we have been so far unable to resolve. The issue is - # that this is unused in most kernel modules but used - # in prvnops (came in as part of OS-7200 would like - # thread name API). This may get resolved once this - # change is upstreamed to gate. - - egrep -i '(warning|lint):' ${LINTNOISE}.out \ - | egrep -v '/vmm/' \ - | egrep -v 'sys/ctype.h.*line 111.*E_SUPPRESSION_DIRECTIVE_UNUSED' \ - | sort | uniq | tee $TMPDIR/lint_warns >> $mail_msg_file - if [[ -s $TMPDIR/lint_warns ]]; then - build_extras_ok=n - fi - echo "\n==== lint noise differences $base ====\n" \ - >> $mail_msg_file - diff ${LINTNOISE}.ref ${LINTNOISE}.out \ - >> $mail_msg_file - fi -} - # # Build and install the onbld tools. # @@ -583,7 +467,7 @@ USAGE='Usage: nightly [-in] [+t] [-V VERS ] <env_file> Where: - -i Fast incremental options (no clobber, lint, check) + -i Fast incremental options (no clobber, check) -n Do not do a bringover +t Use the build tools in $ONBLD_TOOLS/bin -V VERS set the build version string to VERS @@ -609,7 +493,6 @@ -V VERS set the build version string to VERS -f find unreferenced files -i do an incremental build (no "make clobber") - -l do "make lint" in $LINTDIRS (default: $SRC y) -m send mail to $MAILTO at end of build -n do not do a bringover -p create packages @@ -633,7 +516,6 @@ F_FLAG=n f_FLAG=n i_FLAG=n; i_CMD_LINE_FLAG=n -l_FLAG=n M_FLAG=n m_FLAG=n N_FLAG=n @@ -817,7 +699,7 @@ # NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-} OPTIND=1 -while getopts +ABCDdFfGIilMmNnpRrtUuwW FLAG $NIGHTLY_OPTIONS +while getopts +ABCDdFfGIiMmNnpRrtUuwW FLAG $NIGHTLY_OPTIONS do case $FLAG in A ) A_FLAG=y @@ -840,8 +722,6 @@ ;; i ) i_FLAG=y ;; - l ) l_FLAG=y - ;; M ) M_FLAG=y ;; m ) m_FLAG=y @@ -1301,27 +1181,14 @@ echo "" | tee -a $mail_msg_file >> $LOGFILE fi -if [ "$D_FLAG" = "n" -a "$l_FLAG" = "y" ]; then - # - # In the past we just complained but went ahead with the lint - # pass, even though the proto area was built non-DEBUG. It's - # unlikely that non-DEBUG headers will make a difference, but - # rather than assuming it's a safe combination, force the user - # to specify a DEBUG build. - # - echo "WARNING: DEBUG build not requested; disabling lint.\n" \ - | tee -a $mail_msg_file >> $LOGFILE - l_FLAG=n -fi - if [ "$f_FLAG" = "y" ]; then if [ "$i_FLAG" = "y" ]; then echo "WARNING: the -f flag cannot be used during incremental" \ "builds; ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE f_FLAG=n fi - if [ "${l_FLAG}${p_FLAG}" != "yy" ]; then - echo "WARNING: the -f flag requires -l, and -p;" \ + if [ "${p_FLAG}" != "y" ]; then + echo "WARNING: the -f flag requires -p;" \ "ignoring -f\n" | tee -a $mail_msg_file >> $LOGFILE f_FLAG=n fi @@ -1932,7 +1799,7 @@ if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then base_ifile="$ELF_DATA_BASELINE_DIR/interface" - echo "\n==== Compare versioning and ABI information" \ + echo "\n==== Compare versioning and ABI information" \ "to baseline ====\n" | \ tee -a $LOGFILE >> $mail_msg_file echo "Baseline: $base_ifile\n" >> $LOGFILE @@ -2028,21 +1895,6 @@ fi fi -# DEBUG lint of kernel begins - -if [ "$i_CMD_LINE_FLAG" = "n" -a "$l_FLAG" = "y" ]; then - if [ "$LINTDIRS" = "" ]; then - # LINTDIRS="$SRC/uts y $SRC/stand y $SRC/psm y" - LINTDIRS="$SRC y" - fi - set $LINTDIRS - while [ $# -gt 0 ]; do - dolint $1 $2; shift; shift - done -else - echo "\n==== No '$MAKE lint' ====\n" >> $LOGFILE -fi - # "make check" begins if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/Makefile.mapfile Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,43 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +# +# This Makefile should be included in individual kernel modules to opt +# into a -z defs world. Note, this should be included after a MAPFILES +# entry is defined. See uts/common/README.mapfiles for more information. +# + +# +# Mapfile base +# +MAPBASE = $(UTSBASE)/common/mapfiles +DTRACE_MAPFILE = $(OBJS_DIR)/dtrace.mapfile + +# +# Always append -z defs to the LD FLAGS and append all mapfiles. +# +LDFLAGS += -z defs $(MAPFILES:%=-M $(MAPBASE)/%.mapfile) -M $(DTRACE_MAPFILE) + +# +# Definitions and rules to assemble the DTrace probe mapfile. There's no +# good way to automatically do this, hence we have a slightly gross +# series of automated tools. This does mean that we have a bit more work +# to do, but also means that probes can be added arbitrarily without +# having to manually edit mapfiles. +# +DTRACE_AWK_FILE = $(MAPBASE)/dtrace.mapfile.awk + +$(OBJS_DIR)/dtrace.mapfile: $(OBJECTS) $(DTRACE_AWK_FILE) + $(NM) -u $(OBJECTS) | $(AWK) -f $(DTRACE_AWK_FILE) > $@
--- a/usr/src/uts/Makefile.targ Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/Makefile.targ Tue Jun 18 07:47:10 2019 +0000 @@ -50,7 +50,7 @@ # Partially link .o files to generate the kmod. The fake dependency # on modstubs simplifies things... # -$(BINARY): $(OBJECTS) +$(BINARY): $(OBJECTS) $(DTRACE_MAPFILE) $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS) $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) $(POST_PROCESS)
--- a/usr/src/uts/common/Makefile.files Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/Makefile.files Tue Jun 18 07:47:10 2019 +0000 @@ -844,7 +844,7 @@ USBA_OBJS += hcdi.o usba.o usbai.o hubdi.o parser.o genconsole.o \ usbai_pipe_mgmt.o usbai_req.o usbai_util.o usbai_register.o \ - usba_devdb.o usba10_calls.o usba_ugen.o + usba_devdb.o usba10_calls.o usba_ugen.o usba_bos.o USBA10_OBJS += usba10.o
--- a/usr/src/uts/common/fs/smbsrv/smb_ofile.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/fs/smbsrv/smb_ofile.c Tue Jun 18 07:47:10 2019 +0000 @@ -1378,9 +1378,6 @@ ASSERT(of->f_state == SMB_OFILE_STATE_ALLOC); - /* Make sure it's not in the persistid hash. */ - ASSERT(of->f_persistid == 0); - if (tree != NULL) { if (of->f_fid != 0) smb_idpool_free(&tree->t_fid_pool, of->f_fid);
--- a/usr/src/uts/common/io/usb/usba/genconsole.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/genconsole.c Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019, Joyent, Inc. */ /* @@ -40,10 +41,8 @@ * layers to initialize any state information. */ int -usb_console_input_init(dev_info_t *dip, - usb_pipe_handle_t pipe_handle, - uchar_t **state_buf, - usb_console_info_t *console_input_info) +usb_console_input_init(dev_info_t *dip, usb_pipe_handle_t pipe_handle, + uchar_t **state_buf, usb_console_info_t *console_input_info) { int ret; usba_device_t *usba_device; @@ -168,10 +167,8 @@ /* * Call the lower layer to save state information. */ - usba_device->usb_hcdi_ops->usba_hcdi_console_input_enter( - usb_console_input); - - return (USB_SUCCESS); + return (usba_device->usb_hcdi_ops->usba_hcdi_console_input_enter( + usb_console_input)); } @@ -235,10 +232,8 @@ /* * Restore the state information. */ - usba_device->usb_hcdi_ops->usba_hcdi_console_input_exit( - usb_console_input); - - return (USB_SUCCESS); + return (usba_device->usb_hcdi_ops->usba_hcdi_console_input_exit( + usb_console_input)); } /* @@ -345,10 +340,8 @@ /* * Call the lower layer to save state information. */ - usb_device->usb_hcdi_ops->usba_hcdi_console_output_enter( - usb_console_output); - - return (USB_SUCCESS); + return (usb_device->usb_hcdi_ops->usba_hcdi_console_output_enter( + usb_console_output)); } /* @@ -358,7 +351,7 @@ */ int usb_console_write(usb_console_info_t console_output_info, - uchar_t *buf, uint_t num_characters, uint_t *num_characters_written) + uchar_t *buf, uint_t num_characters, uint_t *num_characters_written) { usba_device_t *usb_device; usb_console_info_impl_t *usb_console_output; @@ -402,8 +395,6 @@ /* * Restore the state information. */ - usb_device->usb_hcdi_ops->usba_hcdi_console_output_exit( - usb_console_output); - - return (USB_SUCCESS); + return (usb_device->usb_hcdi_ops->usba_hcdi_console_output_exit( + usb_console_output)); }
--- a/usr/src/uts/common/io/usb/usba/hubdi.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/hubdi.c Tue Jun 18 07:47:10 2019 +0000 @@ -22,7 +22,7 @@ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019, Joyent, Inc. */ /* @@ -1797,6 +1797,10 @@ retval = hubd_pwrlvl3(hubd); break; + default: + retval = USB_FAILURE; + + break; } mutex_exit(HUBD_MUTEX(hubd)); @@ -2133,11 +2137,11 @@ kmem_free(pathname, MAXPATHLEN); } - mutex_enter(HUBD_MUTEX(hubd)); - hubd_pm_idle_component(hubd, dip, 0); - mutex_exit(HUBD_MUTEX(hubd)); - - if (hubd) { + if (hubd != NULL) { + mutex_enter(HUBD_MUTEX(hubd)); + hubd_pm_idle_component(hubd, dip, 0); + mutex_exit(HUBD_MUTEX(hubd)); + rval = hubd_cleanup(dip, hubd); if (rval != USB_SUCCESS) { USB_DPRINTF_L2(DPRINT_MASK_ATTA, hubdi_log_handle, @@ -2180,7 +2184,7 @@ static int hubd_setdevaddr(hubd_t *hubd, usb_port_t port) { - int rval; + int rval = USB_FAILURE; usb_cr_t completion_reason; usb_cb_flags_t cb_flags; usb_pipe_handle_t ph; @@ -2235,8 +2239,8 @@ for (retry = 0; retry < hubd_retry_enumerate; retry++) { /* open child's default pipe with USBA_DEFAULT_ADDR */ - if (usb_pipe_open(child_dip, NULL, NULL, - USB_FLAGS_SLEEP | USBA_FLAGS_PRIVILEGED, &ph) != + if ((rval = usb_pipe_open(child_dip, NULL, NULL, + USB_FLAGS_SLEEP | USBA_FLAGS_PRIVILEGED, &ph)) != USB_SUCCESS) { USB_DPRINTF_L2(DPRINT_MASK_ATTA, hubd->h_log_handle, "hubd_setdevaddr: Unable to open default pipe"); @@ -6071,7 +6075,6 @@ return (child_dip); } - /* * hubd_create_child * - create child dip @@ -6480,6 +6483,8 @@ goto fail_cleanup; } + /* Read the BOS data */ + usba_get_binary_object_store(child_dip, child_ud); /* get the device string descriptor(s) */ usba_get_dev_string_descrs(child_dip, child_ud); @@ -9198,7 +9203,7 @@ usb_port_t port = 0; dev_info_t *hdip; usb_pipe_state_t prev_pipe_state = 0; - usba_device_t *usba_device; + usba_device_t *usba_device = NULL; hubd_reset_arg_t *arg; int i, ph_open_cnt; int rval = USB_FAILURE; @@ -9372,6 +9377,7 @@ == USB_SUCCESS) { mutex_exit(HUBD_MUTEX(hubd)); /* re-open the default pipe */ + ASSERT3P(usba_device, !=, NULL); rval = usba_persistent_pipe_open(usba_device); mutex_enter(HUBD_MUTEX(hubd)); if (rval != USB_SUCCESS) {
--- a/usr/src/uts/common/io/usb/usba/parser.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/parser.c Tue Jun 18 07:47:10 2019 +0000 @@ -23,6 +23,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2019, Joyent, Inc. */ @@ -45,16 +46,13 @@ extern usba_if_pwr_descr_t default_if_power; size_t -usb_parse_data(char *format, - uchar_t *data, - size_t datalen, - void *structure, - size_t structlen) +usb_parse_data(char *format, const uchar_t *data, size_t datalen, + void *structure, size_t structlen) { int fmt; int counter = 1; int multiplier = 0; - uchar_t *dataend = data + datalen; + const uchar_t *dataend = data + datalen; char *structstart = (char *)structure; void *structend = (void *)((intptr_t)structstart + structlen); @@ -170,11 +168,8 @@ size_t -usb_parse_CV_descr(char *format, - uchar_t *data, - size_t datalen, - void *structure, - size_t structlen) +usb_parse_CV_descr(char *format, const uchar_t *data, size_t datalen, + void *structure, size_t structlen) { return (usb_parse_data(format, data, datalen, structure, structlen)); @@ -186,16 +181,12 @@ * type descr_type, unless the end of the buffer or a descriptor * of type stop_descr_type1 or stop_descr_type2 is encountered first. */ -static uchar_t * -usb_nth_descr(uchar_t *buf, - size_t buflen, - int descr_type, - uint_t n, - int stop_descr_type1, - int stop_descr_type2) +static const uchar_t * +usb_nth_descr(const uchar_t *buf, size_t buflen, int descr_type, uint_t n, + int stop_descr_type1, int stop_descr_type2) { - uchar_t *bufstart = buf; - uchar_t *bufend = buf + buflen; + const uchar_t *bufstart = buf; + const uchar_t *bufend = buf + buflen; if (buf == NULL) { @@ -229,10 +220,8 @@ size_t -usb_parse_dev_descr(uchar_t *buf, /* from GET_DESCRIPTOR(DEVICE) */ - size_t buflen, - usb_dev_descr_t *ret_descr, - size_t ret_buf_len) +usb_parse_dev_descr(const uchar_t *buf, size_t buflen, + usb_dev_descr_t *ret_descr, size_t ret_buf_len) { if ((buf == NULL) || (ret_descr == NULL) || (buflen < 2) || (buf[1] != USB_DESCR_TYPE_DEV)) { @@ -246,10 +235,8 @@ size_t -usb_parse_cfg_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - usb_cfg_descr_t *ret_descr, - size_t ret_buf_len) +usb_parse_cfg_descr(const uchar_t *buf, size_t buflen, + usb_cfg_descr_t *ret_descr, size_t ret_buf_len) { if ((buf == NULL) || (ret_descr == NULL) || (buflen < 2) || (buf[1] != USB_DESCR_TYPE_CFG)) { @@ -263,13 +250,10 @@ size_t -usba_parse_cfg_pwr_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - usba_cfg_pwr_descr_t *ret_descr, - size_t ret_buf_len) +usba_parse_cfg_pwr_descr(const uchar_t *buf, size_t buflen, + usba_cfg_pwr_descr_t *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL)) { @@ -298,13 +282,10 @@ size_t -usb_parse_ia_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - size_t first_if, - usb_ia_descr_t *ret_descr, - size_t ret_buf_len) +usb_parse_ia_descr(const uchar_t *buf, size_t buflen, size_t first_if, + usb_ia_descr_t *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL)) { @@ -332,14 +313,10 @@ size_t -usb_parse_if_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - uint_t if_number, - uint_t alt_if_setting, - usb_if_descr_t *ret_descr, - size_t ret_buf_len) +usb_parse_if_descr(const uchar_t *buf, size_t buflen, uint_t if_number, + uint_t alt_if_setting, usb_if_descr_t *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL)) { @@ -367,14 +344,10 @@ } size_t -usba_parse_if_pwr_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - uint_t if_number, - uint_t alt_if_setting, - usba_if_pwr_descr_t *ret_descr, - size_t ret_buf_len) +usba_parse_if_pwr_descr(const uchar_t *buf, size_t buflen, uint_t if_number, + uint_t alt_if_setting, usba_if_pwr_descr_t *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL)) { @@ -422,15 +395,11 @@ * the first endpoint */ size_t -usb_parse_ep_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - uint_t if_number, - uint_t alt_if_setting, - uint_t ep_index, - usb_ep_descr_t *ret_descr, - size_t ret_buf_len) +usb_parse_ep_descr(const uchar_t *buf, size_t buflen, uint_t if_number, + uint_t alt_if_setting, uint_t ep_index, usb_ep_descr_t *ret_descr, + size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL)) { @@ -473,14 +442,12 @@ */ /*ARGSUSED*/ size_t -usba_ascii_string_descr(uchar_t *buf, /* from GET_DESCRIPTOR(STRING) */ - size_t buflen, - char *ret_descr, - size_t ret_buf_len) +usba_ascii_string_descr(const uchar_t *buf, size_t buflen, char *ret_descr, + size_t ret_buf_len) { - int i = 1; - char *retstart = ret_descr; - uchar_t *bufend = buf + buflen; + int i = 1; + char *retstart = ret_descr; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL) || (ret_buf_len == 0) || (buflen < 2) || @@ -501,15 +468,10 @@ size_t -usb_parse_CV_cfg_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - char *fmt, - uint_t descr_type, - uint_t descr_index, - void *ret_descr, - size_t ret_buf_len) +usb_parse_CV_cfg_descr(const uchar_t *buf, size_t buflen, char *fmt, + uint_t descr_type, uint_t descr_index, void *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL) || (fmt == NULL) || (buflen < 2) || ((buf = usb_nth_descr(buf, buflen, descr_type, @@ -525,17 +487,11 @@ size_t -usb_parse_CV_if_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - char *fmt, - uint_t if_number, - uint_t alt_if_setting, - uint_t descr_type, - uint_t descr_index, - void *ret_descr, - size_t ret_buf_len) +usb_parse_CV_if_descr(const uchar_t *buf, size_t buflen, char *fmt, + uint_t if_number, uint_t alt_if_setting, uint_t descr_type, + uint_t descr_index, void *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL) || (fmt == NULL)) { @@ -570,18 +526,11 @@ size_t -usb_parse_CV_ep_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ - size_t buflen, - char *fmt, - uint_t if_number, - uint_t alt_if_setting, - uint_t ep_index, - uint_t descr_type, - uint_t descr_index, - void *ret_descr, - size_t ret_buf_len) +usb_parse_CV_ep_descr(const uchar_t *buf, size_t buflen, char *fmt, + uint_t if_number, uint_t alt_if_setting, uint_t ep_index, uint_t descr_type, + uint_t descr_index, void *ret_descr, size_t ret_buf_len) { - uchar_t *bufend = buf + buflen; + const uchar_t *bufend = buf + buflen; if ((buf == NULL) || (ret_descr == NULL) || (fmt == NULL)) {
--- a/usr/src/uts/common/io/usb/usba/usba.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usba.c Tue Jun 18 07:47:10 2019 +0000 @@ -24,6 +24,7 @@ * * Copyright 2014 Garrett D'Amore <garrett@damore.org> * Copyright 2016 James S. Blachly, MD <james.blachly@gmail.com> + * Copyright 2019 Joyent, Inc. */ @@ -776,6 +777,8 @@ strlen(usba_device->usb_serialno_str) + 1); } + usba_free_binary_object_store(usba_device); + usba_unset_usb_address(usba_device); } @@ -2262,6 +2265,17 @@ } } + if (usba_device->usb_port_status == USBA_FULL_SPEED_DEV) { + /* create boolean property */ + rval = ndi_prop_create_boolean(DDI_DEV_T_NONE, child_dip, + "full-speed"); + if (rval != DDI_PROP_SUCCESS) { + USB_DPRINTF_L2(DPRINT_MASK_USBA, usba_log_handle, + "usba_ready_device_node: " + "full speed prop update failed"); + } + } + if (usba_device->usb_port_status == USBA_HIGH_SPEED_DEV) { /* create boolean property */ rval = ndi_prop_create_boolean(DDI_DEV_T_NONE, child_dip, @@ -2283,6 +2297,8 @@ } } + usba_add_binary_object_store_props(child_dip, usba_device); + USB_DPRINTF_L4(DPRINT_MASK_USBA, usba_log_handle, "%s%d at port %d: %s, dip=0x%p", ddi_node_name(ddi_get_parent(child_dip)), @@ -2906,7 +2922,6 @@ return (buffer); } - /* * USB enumeration statistic functions */
--- a/usr/src/uts/common/io/usb/usba/usba10_calls.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usba10_calls.c Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019, Joyent, Inc. */ @@ -80,7 +81,7 @@ size_t usba10_usb_parse_data( char *format, - uchar_t *data, + const uchar_t *data, size_t datalen, void *structure, size_t structlen)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/io/usb/usba/usba_bos.c Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,420 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2019 Joyent, Inc. + */ + +/* + * Routines to access, parse, and manage the USB Binary Object Store + */ + +#define USBA_FRAMEWORK +#include <sys/usb/usba/usba_impl.h> +#include <sys/strsun.h> +#include <sys/sysmacros.h> + +static size_t +usba_bos_parse_bos_descr(const uchar_t *buf, size_t buflen, + usb_bos_descr_t *bosp, size_t rlen) +{ + if (buf == NULL || bosp == NULL || buflen < USB_BOS_PACKED_SIZE || + buf[1] != USB_DESCR_TYPE_BOS) { + return (USB_PARSE_ERROR); + } + + return (usb_parse_data("ccsc", buf, buflen, bosp, rlen)); +} + +static boolean_t +usba_bos_parse_usb2ext(const uchar_t *buf, size_t buflen, usb_bos_t *bosp) +{ + size_t len; + + if (buflen != USB_BOS_USB2EXT_PACKED_SIZE) { + return (B_FALSE); + } + + len = usb_parse_data("cccl", buf, buflen, &bosp->ubos_caps.ubos_usb2, + sizeof (usb_bos_usb2ext_t)); + return (len == sizeof (usb_bos_usb2ext_t)); +} + +static boolean_t +usba_bos_parse_superspeed(const uchar_t *buf, size_t buflen, usb_bos_t *bosp) +{ + size_t len; + + if (buflen != USB_BOS_SSUSB_PACKED_SIZE) { + return (B_FALSE); + } + + len = usb_parse_data("ccccsccs", buf, buflen, + &bosp->ubos_caps.ubos_ssusb, sizeof (usb_bos_ssusb_t)); + return (len == sizeof (usb_bos_ssusb_t)); +} + +static boolean_t +usba_bos_parse_container(const uchar_t *buf, size_t buflen, usb_bos_t *bosp) +{ + size_t len; + + if (buflen != USB_BOS_CONTAINER_PACKED_SIZE) { + return (B_FALSE); + } + + len = usb_parse_data("cccc16c", buf, buflen, + &bosp->ubos_caps.ubos_container, sizeof (usb_bos_container_t)); + return (len == sizeof (usb_bos_container_t)); +} + +static boolean_t +usba_bos_parse_precision_time(const uchar_t *buf, size_t buflen, + usb_bos_t *bosp) +{ + size_t len; + + if (buflen != USB_BOS_PRECISION_TIME_PACKED_SIZE) { + return (B_FALSE); + } + + len = usb_parse_data("ccc", buf, buflen, &bosp->ubos_caps.ubos_time, + sizeof (usb_bos_precision_time_t)); + /* + * The actual size of this structure will usually be rounded up to four + * bytes by the compiler, therefore we need to compare against the + * packed size. + */ + return (len == USB_BOS_PRECISION_TIME_PACKED_SIZE); +} + +/* + * Validate that the BOS looks reasonable. This means the following: + * + * - We read the whole length of the descriptor + * - The total number of capabilities doesn't exceed the expected value + * - The length of each device capabilities fits within our expected range + * + * After we finish that up, go through and save all of the valid BOS + * descriptors, unpacking the ones that we actually understand. + */ +static boolean_t +usba_bos_save(usba_device_t *ud, const mblk_t *mp, usb_bos_descr_t *bdesc) +{ + size_t len = MBLKL(mp); + const uchar_t *buf = mp->b_rptr; + uint_t ncaps, nalloc; + usb_bos_t *bos; + + if (bdesc->bLength != USB_BOS_PACKED_SIZE || + bdesc->bNumDeviceCaps == 0 || len < USB_BOS_PACKED_SIZE || + len < bdesc->wTotalLength) { + return (B_FALSE); + } + + len = MIN(len, bdesc->wTotalLength); + buf += USB_BOS_PACKED_SIZE; + len -= USB_BOS_PACKED_SIZE; + + if (len < USB_DEV_CAP_PACKED_SIZE) { + return (B_FALSE); + } + + ncaps = 0; + while (len > 0) { + usb_dev_cap_descr_t dev; + + if (usb_parse_data("ccc", buf, len, &dev, sizeof (dev)) != + USB_DEV_CAP_PACKED_SIZE) { + return (B_FALSE); + } + + if (dev.bDescriptorType != USB_DESCR_TYPE_DEV_CAPABILITY || + dev.bLength > len) { + return (B_FALSE); + } + + ncaps++; + len -= dev.bLength; + buf += dev.bLength; + } + + if (ncaps != bdesc->bNumDeviceCaps) { + return (B_FALSE); + } + + nalloc = ncaps; + bos = kmem_zalloc(sizeof (usb_bos_t) * nalloc, KM_SLEEP); + buf = mp->b_rptr + USB_BOS_PACKED_SIZE; + len = MIN(MBLKL(mp), bdesc->wTotalLength) - USB_BOS_PACKED_SIZE; + ncaps = 0; + while (len > 0) { + usb_dev_cap_descr_t dev; + boolean_t valid; + + if (usb_parse_data("ccc", buf, len, &dev, sizeof (dev)) != + USB_DEV_CAP_PACKED_SIZE) { + goto fail; + } + + bos[ncaps].ubos_length = dev.bLength; + bos[ncaps].ubos_type = dev.bDevCapabilityType; + + valid = B_FALSE; + switch (dev.bDevCapabilityType) { + case USB_BOS_TYPE_USB2_EXT: + valid = usba_bos_parse_usb2ext(buf, dev.bLength, + &bos[ncaps]); + break; + case USB_BOS_TYPE_SUPERSPEED: + valid = usba_bos_parse_superspeed(buf, dev.bLength, + &bos[ncaps]); + break; + case USB_BOS_TYPE_CONTAINER: + valid = usba_bos_parse_container(buf, dev.bLength, + &bos[ncaps]); + break; + case USB_BOS_TYPE_PRECISION_TIME: + valid = usba_bos_parse_precision_time(buf, dev.bLength, + &bos[ncaps]); + break; + default: + /* + * Override the type to one that we know isn't used to + * indicate that the caller can't rely on the type + * that's present here. + */ + bos[ncaps].ubos_type = USB_BOS_TYPE_INVALID; + bcopy(buf, bos[ncaps].ubos_caps.ubos_raw, dev.bLength); + valid = B_TRUE; + break; + } + + if (valid) { + ncaps++; + } else { + bos[ncaps].ubos_length = 0; + bos[ncaps].ubos_type = USB_BOS_TYPE_INVALID; + bzero(bos[ncaps].ubos_caps.ubos_raw, + sizeof (bos[ncaps].ubos_caps.ubos_raw)); + } + len -= dev.bLength; + buf += dev.bLength; + } + + ud->usb_bos_nalloc = nalloc; + ud->usb_bos_nents = ncaps; + ud->usb_bos = bos; + + return (B_TRUE); + +fail: + kmem_free(bos, sizeof (usb_bos_t) * nalloc); + return (B_FALSE); +} + +/* + * Read the Binary Object Store (BOS) data from the device and attempt to parse + * it. Do not fail to attach the device if we cannot get all of the information + * at this time. While certain aspects of the BOS are required for Windows, + * which suggests that we could actually rely on it, we haven't historically. + */ +void +usba_get_binary_object_store(dev_info_t *dip, usba_device_t *ud) +{ + int rval; + mblk_t *mp = NULL; + usb_cr_t completion_reason; + usb_cb_flags_t cb_flags; + usb_pipe_handle_t ph; + size_t size; + usb_bos_descr_t bos; + + /* + * The BOS is only supported on USB 3.x devices. Therefore if the bcdUSB + * is greater than USB 2.0, we can check this. Note, USB 3.x devices + * that are linked on a USB device will report version 2.1 in the bcdUSB + * field. + */ + if (ud->usb_dev_descr->bcdUSB <= 0x200) { + return; + } + + ph = usba_get_dflt_pipe_handle(dip); + + /* + * First get just the BOS descriptor itself. + */ + rval = usb_pipe_sync_ctrl_xfer(dip, ph, + USB_DEV_REQ_DEV_TO_HOST | USB_DEV_REQ_TYPE_STANDARD, + USB_REQ_GET_DESCR, /* bRequest */ + (USB_DESCR_TYPE_BOS << 8), /* wValue */ + 0, /* wIndex */ + USB_BOS_PACKED_SIZE, /* wLength */ + &mp, USB_ATTRS_SHORT_XFER_OK, + &completion_reason, &cb_flags, 0); + + if (rval != USB_SUCCESS) { + return; + } + + size = usba_bos_parse_bos_descr(mp->b_rptr, MBLKL(mp), &bos, + sizeof (bos)); + freemsg(mp); + mp = NULL; + if (size < USB_BOS_PACKED_SIZE) { + return; + } + + /* + * Check to see if there are any capabilities and if it's worth getting + * the whole BOS. + */ + if (bos.bLength != USB_BOS_PACKED_SIZE || bos.bNumDeviceCaps == 0) { + return; + } + + rval = usb_pipe_sync_ctrl_xfer(dip, ph, + USB_DEV_REQ_DEV_TO_HOST | USB_DEV_REQ_TYPE_STANDARD, + USB_REQ_GET_DESCR, /* bRequest */ + (USB_DESCR_TYPE_BOS << 8), /* wValue */ + 0, /* wIndex */ + bos.wTotalLength, /* wLength */ + &mp, USB_ATTRS_SHORT_XFER_OK, + &completion_reason, &cb_flags, 0); + + if (rval != USB_SUCCESS) { + return; + } + + size = usba_bos_parse_bos_descr(mp->b_rptr, MBLKL(mp), &bos, + sizeof (bos)); + if (size < USB_BOS_PACKED_SIZE) { + freemsg(mp); + return; + } + + if (!usba_bos_save(ud, mp, &bos)) { + freemsg(mp); + return; + } + + ud->usb_bos_mp = mp; +} + +static void +usba_add_superspeed_props(dev_info_t *dip, usb_bos_ssusb_t *ssusb) +{ + char *supported[4]; + uint_t nsup = 0; + char *min; + + if (ssusb->wSpeedsSupported & USB_BOS_SSUSB_SPEED_LOW) { + supported[nsup++] = "low-speed"; + } + + if (ssusb->wSpeedsSupported & USB_BOS_SSUSB_SPEED_FULL) { + supported[nsup++] = "full-speed"; + } + + if (ssusb->wSpeedsSupported & USB_BOS_SSUSB_SPEED_HIGH) { + supported[nsup++] = "high-speed"; + } + + if (ssusb->wSpeedsSupported & USB_BOS_SSUSB_SPEED_SUPER) { + supported[nsup++] = "super-speed"; + } + + if (nsup != 0 && ndi_prop_update_string_array(DDI_DEV_T_NONE, dip, + "usb-supported-speeds", supported, nsup) != DDI_PROP_SUCCESS) { + USB_DPRINTF_L2(DPRINT_MASK_USBA, NULL, "failed to add " + "usb-supported-speeds property"); + } + + switch (ssusb->bFunctionalitySupport) { + case 0: + min = "low-speed"; + break; + case 1: + min = "full-speed"; + break; + case 2: + min = "high-speed"; + break; + case 3: + min = "super-speed"; + break; + default: + min = NULL; + } + + if (min != NULL && ndi_prop_update_string(DDI_DEV_T_NONE, dip, + "usb-minimum-speed", min) != DDI_PROP_SUCCESS) { + USB_DPRINTF_L2(DPRINT_MASK_USBA, NULL, "failed to add " + "usb-minimum-speed property"); + } +} + +static void +usba_add_container_props(dev_info_t *dip, usb_bos_container_t *cp) +{ + if (ndi_prop_update_byte_array(DDI_DEV_T_NONE, dip, "usb-container-id", + cp->ContainerId, sizeof (cp->ContainerId)) != DDI_PROP_SUCCESS) { + USB_DPRINTF_L2(DPRINT_MASK_USBA, NULL, "failed to add " + "usb-container-id property"); + } +} + +void +usba_add_binary_object_store_props(dev_info_t *dip, usba_device_t *ud) +{ + uint_t i; + + if (ud->usb_bos == NULL) { + return; + } + + for (i = 0; i < ud->usb_bos_nents; i++) { + usb_bos_t *bos = &ud->usb_bos[i]; + + switch (bos->ubos_type) { + case USB_BOS_TYPE_SUPERSPEED: + usba_add_superspeed_props(dip, + &bos->ubos_caps.ubos_ssusb); + break; + case USB_BOS_TYPE_CONTAINER: + usba_add_container_props(dip, + &bos->ubos_caps.ubos_container); + break; + default: + /* + * This is a capability that we're not going to add + * devinfo properties to describe. + */ + continue; + } + } +} + +void +usba_free_binary_object_store(usba_device_t *ud) +{ + if (ud->usb_bos_mp != NULL) { + freemsg(ud->usb_bos_mp); + ud->usb_bos_mp = NULL; + } + + if (ud->usb_bos != NULL) { + kmem_free(ud->usb_bos, sizeof (usb_bos_t) * ud->usb_bos_nalloc); + ud->usb_bos = NULL; + ud->usb_bos_nalloc = ud->usb_bos_nents = 0; + } +}
--- a/usr/src/uts/common/io/usb/usba/usba_devdb.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usba_devdb.c Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019, Joyent, Inc. */ @@ -140,13 +141,13 @@ token_t token; char tokval[MAXPATHLEN]; usba_configrec_t *cfgrec; - config_field_t cfgvar; + config_field_t cfgvar = USB_NONE; u_longlong_t llptr; u_longlong_t value; enum { USB_NEWVAR, USB_CONFIG_VAR, USB_VAR_EQUAL, USB_VAR_VALUE, USB_ERROR - } parse_state = USB_NEWVAR; + } parse_state = USB_NEWVAR; cfgrec = (usba_configrec_t *)kmem_zalloc( sizeof (usba_configrec_t), KM_SLEEP);
--- a/usr/src/uts/common/io/usb/usba/usba_ugen.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usba_ugen.c Tue Jun 18 07:47:10 2019 +0000 @@ -24,7 +24,7 @@ */ /* - * Copyright 2016 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -409,11 +409,9 @@ return (DDI_SUCCESS); fail: - if (ugenp) { - USB_DPRINTF_L2(UGEN_PRINT_ATTA, ugenp->ug_log_hdl, - "attach fail"); - (void) ugen_cleanup(ugenp); - } + USB_DPRINTF_L2(UGEN_PRINT_ATTA, ugenp->ug_log_hdl, + "attach fail"); + (void) ugen_cleanup(ugenp); return (DDI_FAILURE); } @@ -2545,7 +2543,7 @@ goto fail; } -done: + *wait = B_TRUE; return (USB_SUCCESS);
--- a/usr/src/uts/common/io/usb/usba/usbai.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usbai.c Tue Jun 18 07:47:10 2019 +0000 @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2019, Joyent, Inc. */ @@ -115,8 +116,8 @@ */ usb_log_handle_t usb_alloc_log_hdl(dev_info_t *dip, char *name, - uint_t *errlevel, uint_t *mask, uint_t *instance_filter, - usb_flags_t flags) + uint_t *errlevel, uint_t *mask, uint_t *instance_filter, + usb_flags_t flags) { usba_log_handle_impl_t *hdl; @@ -147,8 +148,8 @@ /*ARGSUSED*/ usb_log_handle_t usb_alloc_log_handle(dev_info_t *dip, char *name, - uint_t *errlevel, uint_t *mask, uint_t *instance_filter, - uint_t reserved, usb_flags_t flags) + uint_t *errlevel, uint_t *mask, uint_t *instance_filter, + uint_t reserved, usb_flags_t flags) { return (usb_alloc_log_hdl(dip, name, errlevel, mask, instance_filter, flags)); @@ -215,7 +216,7 @@ usb_vprintf(dev_info_t *dip, int level, char *label, char *fmt, va_list ap) { size_t len; - int instance; + int instance = 0; char driver_name[USBA_DRVNAME_LEN]; char *msg_ptr; @@ -383,7 +384,7 @@ int usba_vlog(usb_log_handle_t, uint_t, uint_t, char *, va_list) - __KVPRINTFLIKE(4); + __KVPRINTFLIKE(4); /* When usba10_calls.c goes away, this function can be made static again. */ int @@ -579,7 +580,7 @@ /* usb function to perform async pm_request_power_change */ int usb_req_raise_power(dev_info_t *dip, int comp, int level, - void (*callback)(void *, int), void *arg, usb_flags_t flags) + void (*callback)(void *, int), void *arg, usb_flags_t flags) { usba_pm_req_t *pmrq; @@ -633,7 +634,7 @@ /* usb function to perform async pm_request_power_change */ int usb_req_lower_power(dev_info_t *dip, int comp, int level, - void (*callback)(void *, int), void *arg, usb_flags_t flags) + void (*callback)(void *, int), void *arg, usb_flags_t flags) { usba_pm_req_t *pmrq; @@ -1100,7 +1101,7 @@ /*ARGSUSED*/ int usb_register_event_cbs(dev_info_t *dip, usb_event_t *usb_evdata, - usb_flags_t flags) + usb_flags_t flags) { usba_device_t *usba_device; usba_evdata_t *evdata;
--- a/usr/src/uts/common/io/usb/usba/usbai_pipe_mgmt.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usbai_pipe_mgmt.c Tue Jun 18 07:47:10 2019 +0000 @@ -23,7 +23,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> - * Copyright 2016 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ @@ -540,7 +540,7 @@ } /* fix up the MaxPacketSize if it is the default endpoint descr */ - if ((ep == &usba_default_ep_descr) && usba_device) { + if (ep == &usba_default_ep_descr) { uint16_t maxpktsize; maxpktsize = usba_device->usb_dev_descr->bMaxPacketSize0;
--- a/usr/src/uts/common/io/usb/usba/usbai_register.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usbai_register.c Tue Jun 18 07:47:10 2019 +0000 @@ -23,7 +23,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> - * Copyright (c) 2017, Joyent, Inc. + * Copyright 2019, Joyent, Inc. */ /* @@ -1313,7 +1313,7 @@ uint8_t largest_value; uint8_t curr_value; uint_t in_order = 0; - usb_alt_if_data_t *orig_addr = *array; /* Non-sparse array base ptr */ + usb_alt_if_data_t *orig_addr; /* Non-sparse array base ptr */ usb_alt_if_data_t *repl_array; /* Base ptr to sparse array */ uint_t n_repl_elements; /* Number elements in the new array */ uint_t i; @@ -1328,6 +1328,7 @@ "make_sparse: array=0x%p, n_orig_elements=%d", (void *)array, n_orig_elements); + orig_addr = *array; curr_value = orig_addr[0].altif_descr.bAlternateSetting; smallest_value = largest_value = curr_value; @@ -1635,7 +1636,7 @@ usb_cfg_descr_t *config_descr; /* and its USB descriptor. */ char *string; char *name_string = NULL; - int name_string_size; + int name_string_size = 0; if ((usb_reg == NULL) || ((log_handle == NULL) && (dip == NULL))) {
--- a/usr/src/uts/common/io/usb/usba/usbai_req.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usbai_req.c Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019 Joyent, Inc. */ @@ -113,7 +114,7 @@ mblk_t *data; usb_cr_t *cr; usb_req_attrs_t attrs; - usb_opaque_t cb, exc_cb; + usb_opaque_t cb = NULL, exc_cb = NULL; uint_t timeout = 0; uchar_t direction = ph_data->p_ep.bEndpointAddress & USB_EP_DIR_MASK; @@ -144,6 +145,8 @@ case USB_EP_ATTR_ISOCH: cr = &isoc_req->isoc_completion_reason; break; + default: + return (USB_INVALID_REQUEST); } *cr = USB_CR_UNSPECIFIED_ERR; @@ -220,6 +223,8 @@ cb = (usb_opaque_t)isoc_req->isoc_cb; exc_cb = (usb_opaque_t)isoc_req->isoc_exc_cb; break; + default: + return (USB_INVALID_REQUEST); } USB_DPRINTF_L4(DPRINT_MASK_USBAI, usbai_log_handle,
--- a/usr/src/uts/common/io/usb/usba/usbai_util.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba/usbai_util.c Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019 Joyent, Inc. */ @@ -301,7 +302,7 @@ usba_get_dflt_pipe_handle(dip), USB_DEV_REQ_DEV_TO_HOST, USB_REQ_GET_DESCR, - USB_DESCR_TYPE_STRING << 8 | index & 0xff, + (USB_DESCR_TYPE_STRING << 8) | (index & 0xff), langid, 4, &data, USB_ATTRS_SHORT_XFER_OK, @@ -345,7 +346,7 @@ usba_get_dflt_pipe_handle(dip), USB_DEV_REQ_DEV_TO_HOST, USB_REQ_GET_DESCR, - USB_DESCR_TYPE_STRING << 8 | index & 0xff, + (USB_DESCR_TYPE_STRING << 8) | (index & 0xff), langid, length, &data, USB_ATTRS_SHORT_XFER_OK, @@ -2009,7 +2010,7 @@ usb_serialization_t tokenp, uint_t how_to_wait, uint_t delta_timeout) { int rval = 1; /* Must be initialized > 0 */ - clock_t abs_timeout; + clock_t abs_timeout = 0; usba_serialization_impl_t *impl_tokenp; impl_tokenp = (usba_serialization_impl_t *)tokenp;
--- a/usr/src/uts/common/io/usb/usba10/usba10.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/io/usb/usba10/usba10.c Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019, Joyent, Inc. */ @@ -107,7 +108,7 @@ size_t usb_parse_data( char *format, - uchar_t *data, + const uchar_t *data, size_t datalen, void *structure, size_t structlen)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/mapfiles/README Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,68 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +Kernel Module Build Time Symbol Verification +-------------------------------------------- + +Historically, kernel modules have all been built as relocatable objects. +They are not dynamic objects and dependency information is always noted +in individual makefiles. Along with this, there has never been any +verification of the symbols that are being used. This means that it's +possible for a kernel module author to refer to a symbol that doesn't +exist and not find out until they try to install the module. + +To help find these problems at build time, we provide an opt-in system +for modules to use, leveraging the link-editor's '-z defs' option. This +option ensures that there are no unknown definitons at link-edit time. +To supply these definitions we supply a series of mapfiles in this +directory. + +These mapfiles are not the traditional versioning mapfiles like those in +usr/src/lib/README.mapfiles! Please review the following differences +closely: + +* These mapfiles do not declare any versions! +* These mapfiles do not use the 'SYMBOL_VERSION' directive, instead they + use the 'SYMBOL_SCOPE' directive. +* These mapfiles do not hide symbols! Library mapfiles always have + something to catch all local symbols. That should *never* be used + here. These mapfiles should not affect visibility. +* All symbols in these mapfiles should be marked 'EXTERN' to indicate + that they are not provided by the kernel module but by another. +* These mapfiles do not declare what is or isn't a public interface, + though they are often grouped around interfaces, to make it easier for + a driver author to get this right. + +Mapfiles are organized based on kernel module. For example the GLDv3 +device driver interface is provided by the 'mac' module and thus is +found in the file 'mac.mapfile'. The DDI is currently in the 'ddi' +mapfile. Functions that are found in genunix and unix that aren't in +the DDI should not be put in that mapfile. + +Note, the existing files may not be complete. These are intended to only +have the public interfaces provided by modules and thus should not +include every symbol in them. As the need arises, add new symbols or +modules as appropriate. + +To opt a module into this, first declare a series of MAPFILES that they +should check against in the module. This should be a series of one or +more files, for example: + +MAPFILES += ddi mac + +Next, you should add an include of Makefile.mapfile right before you +include Makefile.targ. You can do this with the following line: + +include $(UTSBASE)/Makefile.mapfile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/mapfiles/ddi.mapfile Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,191 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +# +# MAPFILE HEADER START +# +# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. +# Object scoping must comply with the rules detailed in +# +# usr/src/uts/common/README.mapfiles +# +# You should not be making modifications here until you've read the most current +# copy of that file. If you need help, contact a gatekeeper for guidance. +# +# MAPFILE HEADER END +# + +# +# This file contains core functions provided by the DDI and also items +# required as part of the platform's runime ABI (think compiler +# functions). +# + +$mapfile_version 2 + +SYMBOL_SCOPE { + global: + __divdi3 { FLAGS = EXTERN }; + __stack_chk_fail { FLAGS = EXTERN }; + __stack_chk_guard { FLAGS = EXTERN }; + allocb { FLAGS = EXTERN }; + assfail { FLAGS = EXTERN }; + assfail3 { FLAGS = EXTERN }; + atomic_dec_32_nv { FLAGS = EXTERN }; + bcmp { FLAGS = EXTERN }; + bcopy { FLAGS = EXTERN }; + bzero { FLAGS = EXTERN }; + cmn_err { FLAGS = EXTERN }; + cv_broadcast { FLAGS = EXTERN }; + cv_destroy { FLAGS = EXTERN }; + cv_init { FLAGS = EXTERN }; + cv_reltimedwait { FLAGS = EXTERN }; + ddi_cb_register { FLAGS = EXTERN }; + ddi_cb_unregister { FLAGS = EXTERN }; + ddi_dev_regsize { FLAGS = EXTERN }; + ddi_dma_addr_bind_handle { FLAGS = EXTERN }; + ddi_dma_alloc_handle { FLAGS = EXTERN }; + ddi_dma_free_handle { FLAGS = EXTERN }; + ddi_dma_mem_alloc { FLAGS = EXTERN }; + ddi_dma_mem_free { FLAGS = EXTERN }; + ddi_dma_nextcookie { FLAGS = EXTERN }; + ddi_dma_sync { FLAGS = EXTERN }; + ddi_dma_unbind_handle { FLAGS = EXTERN }; + ddi_fls { FLAGS = EXTERN }; + ddi_fm_acc_err_clear { FLAGS = EXTERN }; + ddi_fm_acc_err_get { FLAGS = EXTERN }; + ddi_fm_dma_err_get { FLAGS = EXTERN }; + ddi_fm_ereport_post { FLAGS = EXTERN }; + ddi_fm_fini { FLAGS = EXTERN }; + ddi_fm_handler_register { FLAGS = EXTERN }; + ddi_fm_handler_unregister { FLAGS = EXTERN }; + ddi_fm_init { FLAGS = EXTERN }; + ddi_fm_service_impact { FLAGS = EXTERN }; + ddi_get_driver_private { FLAGS = EXTERN }; + ddi_get_instance { FLAGS = EXTERN }; + ddi_get_lbolt { FLAGS = EXTERN }; + ddi_get_lbolt64 { FLAGS = EXTERN }; + ddi_get_name { FLAGS = EXTERN }; + ddi_get_parent { FLAGS = EXTERN }; + ddi_get16 { FLAGS = EXTERN }; + ddi_get32 { FLAGS = EXTERN }; + ddi_get64 { FLAGS = EXTERN }; + ddi_intr_add_handler { FLAGS = EXTERN }; + ddi_intr_alloc { FLAGS = EXTERN }; + ddi_intr_block_disable { FLAGS = EXTERN }; + ddi_intr_block_enable { FLAGS = EXTERN }; + ddi_intr_disable { FLAGS = EXTERN }; + ddi_intr_enable { FLAGS = EXTERN }; + ddi_intr_free { FLAGS = EXTERN }; + ddi_intr_get_cap { FLAGS = EXTERN }; + ddi_intr_get_navail { FLAGS = EXTERN }; + ddi_intr_get_nintrs { FLAGS = EXTERN }; + ddi_intr_get_pri { FLAGS = EXTERN }; + ddi_intr_get_supported_types { FLAGS = EXTERN }; + ddi_intr_remove_handler { FLAGS = EXTERN }; + ddi_periodic_add { FLAGS = EXTERN }; + ddi_periodic_delete { FLAGS = EXTERN }; + ddi_power { FLAGS = EXTERN }; + ddi_prop_free { FLAGS = EXTERN }; + ddi_prop_get_int { FLAGS = EXTERN }; + ddi_prop_lookup_int_array { FLAGS = EXTERN }; + ddi_prop_op { FLAGS = EXTERN }; + ddi_prop_remove_all { FLAGS = EXTERN }; + ddi_prop_update_int_array { FLAGS = EXTERN }; + ddi_prop_update_string { FLAGS = EXTERN }; + ddi_ptob { FLAGS = EXTERN }; + ddi_put16 { FLAGS = EXTERN }; + ddi_put32 { FLAGS = EXTERN }; + ddi_quiesce_not_supported { FLAGS = EXTERN }; + ddi_regs_map_free { FLAGS = EXTERN }; + ddi_regs_map_setup { FLAGS = EXTERN }; + ddi_set_driver_private { FLAGS = EXTERN }; + ddi_strtol { FLAGS = EXTERN }; + ddi_taskq_create { FLAGS = EXTERN }; + ddi_taskq_destroy { FLAGS = EXTERN }; + ddi_taskq_dispatch { FLAGS = EXTERN }; + delay { FLAGS = EXTERN }; + desballoc { FLAGS = EXTERN }; + dev_err { FLAGS = EXTERN }; + drv_usectohz { FLAGS = EXTERN }; + drv_usecwait { FLAGS = EXTERN }; + fm_ena_generate { FLAGS = EXTERN }; + freeb { FLAGS = EXTERN }; + freemsg { FLAGS = EXTERN }; + freemsgchain { FLAGS = EXTERN }; + gethrtime { FLAGS = EXTERN }; + kmem_alloc { FLAGS = EXTERN }; + kmem_free { FLAGS = EXTERN }; + kmem_zalloc { FLAGS = EXTERN }; + kstat_create { FLAGS = EXTERN }; + kstat_delete { FLAGS = EXTERN }; + kstat_install { FLAGS = EXTERN }; + kstat_named_init { FLAGS = EXTERN }; + list_create { FLAGS = EXTERN }; + list_destroy { FLAGS = EXTERN }; + list_head { FLAGS = EXTERN }; + list_insert_tail { FLAGS = EXTERN }; + list_next { FLAGS = EXTERN }; + list_remove { FLAGS = EXTERN }; + memcpy { FLAGS = EXTERN }; + memset { FLAGS = EXTERN }; + miocack { FLAGS = EXTERN }; + miocnak { FLAGS = EXTERN }; + mod_driverops { FLAGS = EXTERN }; + mod_info { FLAGS = EXTERN }; + mod_install { FLAGS = EXTERN }; + mod_remove { FLAGS = EXTERN }; + msgpullup { FLAGS = EXTERN }; + msgsize { FLAGS = EXTERN }; + mutex_destroy { FLAGS = EXTERN }; + mutex_enter { FLAGS = EXTERN }; + mutex_exit { FLAGS = EXTERN }; + mutex_init { FLAGS = EXTERN }; + mutex_owned { FLAGS = EXTERN }; + mutex_tryenter { FLAGS = EXTERN }; + nochpoll { FLAGS = EXTERN }; + nodev { FLAGS = EXTERN }; + nulldev { FLAGS = EXTERN }; + panic { FLAGS = EXTERN }; + pci_config_get16 { FLAGS = EXTERN }; + pci_config_get32 { FLAGS = EXTERN }; + pci_config_get64 { FLAGS = EXTERN }; + pci_config_get8 { FLAGS = EXTERN }; + pci_config_put16 { FLAGS = EXTERN }; + pci_config_put32 { FLAGS = EXTERN }; + pci_config_put64 { FLAGS = EXTERN }; + pci_config_put8 { FLAGS = EXTERN }; + pci_config_setup { FLAGS = EXTERN }; + pci_config_teardown { FLAGS = EXTERN }; + pci_ereport_post { FLAGS = EXTERN }; + pci_ereport_setup { FLAGS = EXTERN }; + pci_ereport_teardown { FLAGS = EXTERN }; + pci_lcap_locate { FLAGS = EXTERN }; + qreply { FLAGS = EXTERN }; + rw_destroy { FLAGS = EXTERN }; + rw_enter { FLAGS = EXTERN }; + rw_exit { FLAGS = EXTERN }; + rw_init { FLAGS = EXTERN }; + snprintf { FLAGS = EXTERN }; + sprintf { FLAGS = EXTERN }; + strcat { FLAGS = EXTERN }; + strcmp { FLAGS = EXTERN }; + strcpy { FLAGS = EXTERN }; + strlen { FLAGS = EXTERN }; + timeout { FLAGS = EXTERN }; + untimeout { FLAGS = EXTERN }; + vsnprintf { FLAGS = EXTERN }; + vsprintf { FLAGS = EXTERN }; +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/mapfiles/dtrace.mapfile.awk Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,34 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +# +# This script is designed to assemble a mapfile for DTrace probes. +# +BEGIN { + print "#" + print "# This file is autogenerated by dtrace.mapfile.awk" + print "#" + print "$mapfile_version 2" + print "SYMBOL_SCOPE {" + print " global:" +} + +/__dtrace_probe_/ { + printf "\t%s\t{ FLAGS = EXTERN };\n", $1 +} + +END { + print "};" +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/mapfiles/kernel.mapfile Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,41 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +# +# MAPFILE HEADER START +# +# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. +# Object scoping must comply with the rules detailed in +# +# usr/src/uts/common/README.mapfiles +# +# You should not be making modifications here until you've read the most current +# copy of that file. If you need help, contact a gatekeeper for guidance. +# +# MAPFILE HEADER END +# + +# +# This file contains functions provided by the kernel that various +# modules use. This is a combination of things in both unix and genunix. +# + +$mapfile_version 2 + +SYMBOL_SCOPE { + global: + bt_getlowbit { FLAGS = EXTERN }; + servicing_interrupt { FLAGS = EXTERN }; +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/mapfiles/mac.mapfile Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,57 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2017, Joyent, Inc. +# + +# +# MAPFILE HEADER START +# +# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. +# Object scoping must comply with the rules detailed in +# +# usr/src/uts/common/README.mapfiles +# +# You should not be making modifications here until you've read the most current +# copy of that file. If you need help, contact a gatekeeper for guidance. +# +# MAPFILE HEADER END +# + +$mapfile_version 2 + +SYMBOL_SCOPE { + global: + mac_alloc { FLAGS = EXTERN }; + mac_fini_ops { FLAGS = EXTERN }; + mac_free { FLAGS = EXTERN }; + mac_hcksum_get { FLAGS = EXTERN }; + mac_hcksum_set { FLAGS = EXTERN }; + mac_init_ops { FLAGS = EXTERN }; + mac_link_update { FLAGS = EXTERN }; + mac_lso_get { FLAGS = EXTERN }; + mac_maxsdu_update { FLAGS = EXTERN }; + mac_prop_info_set_default_link_flowctrl { FLAGS = EXTERN }; + mac_prop_info_set_default_str { FLAGS = EXTERN }; + mac_prop_info_set_default_uint8 { FLAGS = EXTERN }; + mac_prop_info_set_perm { FLAGS = EXTERN }; + mac_prop_info_set_range_uint32 { FLAGS = EXTERN }; + mac_ring_intr_set { FLAGS = EXTERN }; + mac_register { FLAGS = EXTERN }; + mac_rx { FLAGS = EXTERN }; + mac_rx_ring { FLAGS = EXTERN }; + mac_transceiver_info_set_present { FLAGS = EXTERN }; + mac_transceiver_info_set_usable { FLAGS = EXTERN }; + mac_tx_ring_update { FLAGS = EXTERN }; + mac_tx_update { FLAGS = EXTERN }; + mac_unregister { FLAGS = EXTERN }; +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/mapfiles/random.mapfile Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,37 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2016 Joyent, Inc. +# + +# +# MAPFILE HEADER START +# +# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. +# Object scoping must comply with the rules detailed in +# +# usr/src/uts/common/README.mapfiles +# +# You should not be making modifications here until you've read the most current +# copy of that file. If you need help, contact a gatekeeper for guidance. +# +# MAPFILE HEADER END +# + +$mapfile_version 2 + +SYMBOL_SCOPE { + global: + random_get_bytes { FLAGS = EXTERN }; + random_get_blocking_bytes { FLAGS = EXTERN }; + random_get_pseudo_bytes { FLAGS = EXTERN }; +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/uts/common/sys/usb/usba/bos.h Tue Jun 18 07:47:10 2019 +0000 @@ -0,0 +1,242 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2019 Joyent, Inc. + */ + +#ifndef _SYS_USB_BOS_H +#define _SYS_USB_BOS_H + +/* + * This header contains definitions that relate to the USB Binary Object Store. + * While this functionality was originally introduced with WUSB, it was used in + * USB 3.x as a way to provide additional device related information. This is + * currently separate from the primary usbai headers as this functionality is + * not currently used by client device drivers themselves, but only by the hub + * driver for private functionality. + * + * This data is all derived from the USB 3.1 specification, Chapter 9.6.2 Binary + * Device Object Store (BOS). + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Capability list, see USB 3.1 r1.0, Table 9-14. + */ +#define USB_BOS_TYPE_INVALID 0x00 /* Internal, synthetic value */ +#define USB_BOS_TYPE_WUSB 0x01 +#define USB_BOS_TYPE_USB2_EXT 0x02 +#define USB_BOS_TYPE_SUPERSPEED 0x03 +#define USB_BOS_TYPE_CONTAINER 0x04 +#define USB_BOS_TYPE_PLATFORM 0x05 +#define USB_BOS_TYPE_PD_CAP 0x06 +#define USB_BOS_TYPE_BATTERY_INFO 0x07 +#define USB_BOS_TYPE_PD_CONSUMER_CAP 0x08 +#define USB_BOS_TYPE_PD_PRODUCER_CAP 0x09 +#define USB_BOS_TYPE_SUPERSPEED_PLUS 0x0a +#define USB_BOS_TYPE_PRECISION_TIME 0x0b +#define USB_BOS_TYPE_WUSB_EXT 0x0c + +/* + * General Binary Object Store (BOS) descriptor. This is returned at the start + * of the BOS tree. See USB 3.1/Table 9-12. + */ +typedef struct usb_bos_descr { + uint8_t bLength; /* Descriptor size */ + uint8_t bDescriptorType; /* Set to USB_DESCR_TYPE_BOS */ + uint16_t wTotalLength; /* Total length */ + uint8_t bNumDeviceCaps; /* Number of caps that follow */ +} usb_bos_descr_t; + +/* + * This is the size of the usb_bos_descr_t in terms of packed bytes. + */ +#define USB_BOS_PACKED_SIZE 5 + +/* + * This represents a Device Capability Descriptor. bNumDeviceCaps of these + * follow the usb_bos_descr_t. This structure is the generic header of each + * device capability. Capability specific ones follow this. See USB 3.1/Table + * 9-14. + */ +typedef struct usb_dev_cap_descr { + uint8_t bLength; /* Descriptor size */ + uint8_t bDescriptorType; /* USB_TYPE_DEV_CAPABILITY */ + uint8_t bDevCapabilityType; /* USB_BOS_TYPE_* value */ +} usb_dev_cap_descr_t; + +#define USB_DEV_CAP_PACKED_SIZE 3 + +/* + * SuperSpeed devices include this descriptor to describe additional + * capabilities that they have when operating in USB 2.0 High-Speed mode. See + * USB 3.1/9.6.2.1 USB 2.0 Extension. + */ +typedef struct usb_bos_usb2ext { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint32_t bmAttributes; /* Bitfield defined below */ +} usb_bos_usb2ext_t; + +#define USB_BOS_USB2EXT_PACKED_SIZE 7 + +#define USB_BOS_USB2EXT_LPM 0x02 + +/* + * SuperSpeed devices include this descriptor to describe various hardware + * attributes related to basic USB 3.0 SuperSpeed functionality. See USB + * 3.1/9.6.2.2 SuperSpeed USB Device Capability. + */ +typedef struct usb_bos_ssusb { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint8_t bmAttributes; /* Capability bitfield */ + uint16_t wSpeedsSupported; /* speed bitmap defined below */ + uint8_t bFunctionalitySupport; /* Minimum supported speed */ + uint8_t bU1DevExitLat; /* Exit latency in us */ + uint16_t bU2DevExitLat; /* Exit latency in us */ +} usb_bos_ssusb_t; + +#define USB_BOS_SSUSB_PACKED_SIZE 10 + +#define USB_BOS_SSUB_CAP_LTM 0x02 + +#define USB_BOS_SSUSB_SPEED_LOW (1 << 0) +#define USB_BOS_SSUSB_SPEED_FULL (1 << 1) +#define USB_BOS_SSUSB_SPEED_HIGH (1 << 2) +#define USB_BOS_SSUSB_SPEED_SUPER (1 << 3) + +/* + * This structure is used to indicate a UUID for a given device that could + * register on multiple ports. For example, a hub that appears on both a USB 2.x + * and USB 3.x port like a hub. This UUID allows one to know that the device is + * the same. See USB 3.1/9.6.2.3 Container ID. + */ +typedef struct usb_bos_container { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint8_t bReserved; + uint8_t ContainerId[16]; +} usb_bos_container_t; + +#define USB_BOS_CONTAINER_PACKED_SIZE 20 + +/* + * This structure is used to indicate a platform-specific capability. For more + * information, see USB 3.1/9.6.2.4 Platform Descriptor. + */ +typedef struct usb_bos_platform { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; + uint8_t bReserved; + uint8_t PlatformCapabilityUUID[16]; + uint8_t CapabilityData[]; +} usb_bos_platform_t; + +#define USB_BOS_PLATFORM_MIN_PACKED_SIZE 20 + +/* + * This structure is used to indicate capabilities and attributes of a + * SuperSpeedPlus link. This describes the USB 3.1+ speed needs and minimum + * attributes of the device. See USB 3.1/9.6.2.5 SuperSpeedPlus USB Device + * Capability. + */ +typedef struct usb_bos_ssplus { + uint8_t bLength; + uint8_t bDescriptortype; + uint8_t bDevCapabilityType; + uint8_t bReserved; + uint32_t bmAttributes; + uint16_t wFunctionalitySupport; + uint16_t wReserved; + uint32_t bmSublinkSpeedAttr[]; +} usb_bos_ssplus_t; + +#define USB_BOS_SSPLUS_MIN_PACKED_SIZE 16 + +/* + * These macros take apart the bmAttributes fields. + */ +#define USB_BOS_SSPLUS_NSSAC(x) (((x) & 0xf) + 1) +#define USB_BOS_SSPLUS_NSSIC(x) ((((x) & 0xf0) >> 4) + 1) + +/* + * These macros take apart the wFunctionalitySupport member. + */ +#define USB_BOS_SSPLUS_MIN_SSAI(x) ((x) & 0x0f) +#define USB_BOS_SSPLUS_MIN_RX_LANE(x) (((x) >> 8) & 0xf) +#define USB_BOS_SSPLUS_MIN_TX_LANE(x) (((x) >> 12) & 0xf) + +/* + * These macros are used to take apart the bmSublinkSpeedAttr members. There is + * always at least one of them that exist in each attribute; however, there + * could be more based on the value in NSSAC. + */ +#define USB_BOS_SSPLUS_ATTR_SSID(x) ((x) & 0xf) +#define USB_BOS_SSPLUS_ATTR_LSE(x) (((x) >> 4) & 0x3) +#define USB_BOS_SSPLUS_ATTR_LSE_BITPS 0 +#define USB_BOS_SSPLUS_ATTR_LSE_KBITPS 1 +#define USB_BOS_SSPLUS_ATTR_LSE_GBITPS 2 + +/* + * These two macros take apart the sublink type. bit 6 indicates whether or not + * the links are symmetric or asymmetric. It is asymmetric if the value is set + * to one (USB_BOS_SSPLUS_ATTR_ST_ASYM), symmetric otherwise. If it is + * asymmetric, then bit 7 indicates whether or not it's a tx or rx link. + */ +#define USB_BOS_SSPLUS_ATTR_ST_ASYM (1 << 6) +#define USB_BOS_SSPLUS_ATTR_ST_TX (1 << 7) + +#define USB_BOS_SSPLUS_ATTR_LP(x) (((x) >> 14) & 0x3) +#define USB_BOS_SSPLUS_ATTR_LP_SS 0x0 +#define USB_BOS_SSPLUS_ATTR_LP_SSPLUS 0x1 + +#define USB_BOS_SSPLUS_ATTR_LSM(x) ((x) >> 16) + +typedef struct usb_bos_precision_time { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bDevCapabilityType; +} usb_bos_precision_time_t; + +#define USB_BOS_PRECISION_TIME_PACKED_SIZE 3 + +/* + * This structure serves as an internal, parsed representation of a USB bos + * descriptor. + */ +typedef struct usb_bos { + uint8_t ubos_length; + uint8_t ubos_type; + union { + usb_bos_usb2ext_t ubos_usb2; + usb_bos_ssusb_t ubos_ssusb; + usb_bos_container_t ubos_container; + usb_bos_platform_t ubos_platform; + usb_bos_ssplus_t ubos_ssplus; + usb_bos_precision_time_t ubos_time; + uint8_t ubos_raw[256]; + } ubos_caps; +} usb_bos_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_USB_BOS_H */
--- a/usr/src/uts/common/sys/usb/usba/usba10.h Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/sys/usb/usba/usba10.h Tue Jun 18 07:47:10 2019 +0000 @@ -21,6 +21,7 @@ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2019, Joyent, Inc. */ #ifndef _SYS_USB_USBA10_H @@ -139,7 +140,7 @@ size_t usba10_usb_parse_data( char *format, - uchar_t *data, + const uchar_t *data, size_t datalen, void *structure, size_t structlen);
--- a/usr/src/uts/common/sys/usb/usba/usba_impl.h Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/sys/usb/usba/usba_impl.h Tue Jun 18 07:47:10 2019 +0000 @@ -23,6 +23,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2019, Joyent, Inc. */ #ifndef _SYS_USB_USBA_USBA_IMPL_H @@ -34,6 +35,7 @@ #include <sys/usb/usba/hubdi.h> #include <sys/usb/usba/usba_private.h> #include <sys/usb/usba/usba_types.h> +#include <sys/usb/usba/bos.h> #include <sys/taskq.h> #include <sys/disp.h> @@ -301,6 +303,13 @@ void usba_get_dev_string_descrs(dev_info_t *, usba_device_t *); /* + * Retrieve the binary object store for the device. + */ +void usba_get_binary_object_store(dev_info_t *, usba_device_t *); +void usba_add_binary_object_store_props(dev_info_t *, usba_device_t *); +void usba_free_binary_object_store(usba_device_t *); + +/* * Check if we are not in interrupt context and have * USB_FLAGS_SLEEP flags set. */
--- a/usr/src/uts/common/sys/usb/usba/usba_private.h Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/sys/usb/usba/usba_private.h Tue Jun 18 07:47:10 2019 +0000 @@ -23,6 +23,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2019, Joyent, Inc. */ #ifndef _SYS_USB_USBA_USBA_PRIVATE_H @@ -88,21 +89,21 @@ * extended in a later rev of the spec. */ size_t usb_parse_dev_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(DEVICE) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(DEVICE) */ size_t buflen, usb_dev_descr_t *ret_descr, size_t ret_buf_len); size_t usb_parse_cfg_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, usb_cfg_descr_t *ret_descr, size_t ret_buf_len); size_t usb_parse_ia_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, size_t first_if, usb_ia_descr_t *ret_descr, @@ -110,7 +111,7 @@ size_t usb_parse_if_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, uint_t if_index, uint_t alt_if_setting, @@ -123,7 +124,7 @@ * the first endpoint */ size_t usb_parse_ep_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, uint_t if_index, uint_t alt_if_setting, @@ -160,7 +161,7 @@ #define USB_DESCR_TYPE_ANY -1 /* Wild card */ size_t usb_parse_CV_cfg_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, char *fmt, uint_t descr_type, @@ -170,7 +171,7 @@ size_t usb_parse_CV_if_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, char *fmt, uint_t if_index, @@ -182,7 +183,7 @@ size_t usb_parse_CV_ep_descr( - uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ + const uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */ size_t buflen, char *fmt, uint_t if_index, @@ -199,7 +200,7 @@ */ size_t usb_parse_CV_descr( char *format, - uchar_t *data, + const uchar_t *data, size_t datalen, void *structure, size_t structlen); @@ -270,8 +271,7 @@ USBA_EVENT_TAG_HOT_REMOVAL = 0, USBA_EVENT_TAG_HOT_INSERTION = 1, USBA_EVENT_TAG_PRE_SUSPEND = 2, - USBA_EVENT_TAG_POST_RESUME = 3, - USBA_EVENT_TAG_CPR = -1 + USBA_EVENT_TAG_POST_RESUME = 3 } usba_event_t; #define USBA_PRE_SUSPEND_EVENT "SUNW,USBA:USBA_PRE_SUSPEND" @@ -409,11 +409,11 @@ uint16_t TransitionTimeFromD3; /* D3 -> D0 transition time */ } usba_if_pwr_descr_t; -size_t usba_parse_cfg_pwr_descr(uchar_t *, size_t, usba_cfg_pwr_descr_t *, - size_t); +size_t usba_parse_cfg_pwr_descr(const uchar_t *, size_t, usba_cfg_pwr_descr_t *, + size_t); -size_t usba_parse_if_pwr_descr(uchar_t *, size_t buflen, uint_t, - uint_t, usba_if_pwr_descr_t *, size_t); +size_t usba_parse_if_pwr_descr(const uchar_t *, size_t buflen, uint_t, + uint_t, usba_if_pwr_descr_t *, size_t); /* * Returns (at ret_descr) a null-terminated string. Null termination is @@ -423,7 +423,7 @@ * XXX is this needed when there is usb_get_string_descriptor * If so, then more comments about how it differs? */ -size_t usba_ascii_string_descr(uchar_t *, size_t, char *, size_t); +size_t usba_ascii_string_descr(const uchar_t *, size_t, char *, size_t); /*
--- a/usr/src/uts/common/sys/usb/usba/usba_types.h Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/sys/usb/usba/usba_types.h Tue Jun 18 07:47:10 2019 +0000 @@ -22,6 +22,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2019, Joyent, Inc. */ #ifndef _SYS_USB_USBA_USBA_TYPES_H @@ -31,6 +32,7 @@ #include <sys/taskq.h> #include <sys/usb/usba/usba_private.h> #include <sys/usb/usba/usbai_private.h> +#include <sys/usb/usba/bos.h> #ifdef __cplusplus extern "C" { @@ -241,7 +243,7 @@ } usb_client_dev_data_list_t; /* - * This structure uniquely identifies a USB device + * This structure uniquely identifies a USB device * with all interfaces, or just one interface of a USB device. * usba_device is associated with a devinfo node * @@ -363,6 +365,14 @@ * Private data for HCD drivers */ void *usb_hcd_private; + + /* + * Binary Object Store data + */ + mblk_t *usb_bos_mp; + uint_t usb_bos_nalloc; + uint_t usb_bos_nents; + usb_bos_t *usb_bos; } usba_device_t; #define USBA_CLIENT_FLAG_SIZE 1
--- a/usr/src/uts/common/sys/usb/usbai.h Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/common/sys/usb/usbai.h Tue Jun 18 07:47:10 2019 +0000 @@ -23,7 +23,7 @@ * Use is subject to license terms. * * Copyright 2014 Garrett D'Amore <garrett@damore.org> - * Copyright 2016 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ #ifndef _SYS_USB_USBAI_H @@ -789,7 +789,7 @@ size_t usb_parse_data( char *format, - uchar_t *data, + const uchar_t *data, size_t datalen, void *structure, size_t structlen);
--- a/usr/src/uts/intel/e1000g/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/intel/e1000g/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -80,6 +80,7 @@ # Driver depends on MAC # LDFLAGS += -dy -N misc/mac +MAPFILES += ddi mac # # Default build targets. @@ -106,4 +107,5 @@ # # Include common targets. # +include $(UTSBASE)/Makefile.mapfile include $(UTSBASE)/intel/Makefile.targ
--- a/usr/src/uts/intel/i40e/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/intel/i40e/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -48,6 +48,8 @@ LDFLAGS += -dy -N misc/mac +MAPFILES += ddi mac random + .KEEP_STATE: def: $(DEF_DEPS) @@ -66,4 +68,5 @@ install: $(INSTALL_DEPS) +include $(UTSBASE)/Makefile.mapfile include $(UTSBASE)/intel/Makefile.targ
--- a/usr/src/uts/intel/igb/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/intel/igb/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -69,6 +69,7 @@ # Driver depends on MAC # LDFLAGS += -dy -N misc/mac +MAPFILES += ddi mac random # # Default build targets. @@ -94,4 +95,5 @@ # # Include common targets. # +include $(UTSBASE)/Makefile.mapfile include $(UTSBASE)/intel/Makefile.targ
--- a/usr/src/uts/intel/ixgbe/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/intel/ixgbe/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -75,6 +75,7 @@ # Driver depends on MAC # LDFLAGS += -dy -N misc/mac +MAPFILES += ddi mac random kernel # # Default build targets. @@ -100,4 +101,5 @@ # # Include common targets. # +include $(UTSBASE)/Makefile.mapfile include $(UTSBASE)/intel/Makefile.targ
--- a/usr/src/uts/intel/usba/Makefile Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/intel/usba/Makefile Tue Jun 18 07:47:10 2019 +0000 @@ -23,7 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019, Joyent, Inc. # # Path to the base of the uts directory tree (usually /usr/src/uts). @@ -43,16 +43,6 @@ # include $(UTSBASE)/intel/Makefile.intel -CERRWARN += -_gcc=-Wno-uninitialized -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-unused-label -CERRWARN += -_gcc=-Wno-unused-value -CERRWARN += -_gcc=-Wno-unused-variable - -# needs work -SMOFF += all_func_returns,deref_check - # # Define targets #
--- a/usr/src/uts/sun4/os/startup.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/sun4/os/startup.c Tue Jun 18 07:47:10 2019 +0000 @@ -23,6 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 by Delphix. All rights reserved. * Copyright 2018 Joyent, Inc. + * Copyright 2019 Peter Tribble. */ #include <sys/machsystm.h> @@ -276,10 +277,8 @@ /* - * Hooks for unsupported platforms and down-rev firmware + * Hook for down-rev firmware */ -int iam_positron(void); -#pragma weak iam_positron static void do_prom_version_check(void); /* @@ -613,7 +612,7 @@ void sync_handler(void) { - struct panic_trap_info ti; + struct panic_trap_info ti; int i; /* @@ -685,7 +684,7 @@ * 20 == num of %p substrings * 16 == max num of chars %p will expand to. */ - char bp[sizeof (sync_str) + 16 * 20]; + char bp[sizeof (sync_str) + 16 * 20]; /* * Initialize ptl1 stack for the 1st CPU. @@ -868,7 +867,7 @@ * * pseudo code: * if (context != 0) { - * return false + * return false * } else if (miss_va in range[kmem64_base, kmem64_end)) { * tte = tte_template + * (((miss_va & pagemask) - kmem64_base)); @@ -977,8 +976,8 @@ * We're loaded by boot with the following configuration (as * specified in the sun4u/conf/Mapfile): * - * text: 4 MB chunk aligned on a 4MB boundary - * data & bss: 4 MB chunk aligned on a 4MB boundary + * text: 4 MB chunk aligned on a 4MB boundary + * data & bss: 4 MB chunk aligned on a 4MB boundary * * These two chunks will eventually be mapped by 2 locked 4MB * ttes and will represent the nucleus of the kernel. This gives @@ -1519,22 +1518,6 @@ mod_setup(); /* - * If this is a positron, complain and halt. - */ - if (&iam_positron && iam_positron()) { - cmn_err(CE_WARN, "This hardware platform is not supported" - " by this release of Solaris.\n"); -#ifdef DEBUG - prom_enter_mon(); /* Type 'go' to resume */ - cmn_err(CE_WARN, "Booting an unsupported platform.\n"); - cmn_err(CE_WARN, "Booting with down-rev firmware.\n"); - -#else /* DEBUG */ - halt(0); -#endif /* DEBUG */ - } - - /* * If we are running firmware that isn't 64-bit ready * then complain and halt. */ @@ -2906,19 +2889,19 @@ " dup HMEBLK_ENDPA <> if ( sfmmup hmeblkp ) ( r: hblktag ) " " dup hmeblk_tag + phys-x@ r@ = if ( sfmmup hmeblkp ) " " dup hmeblk_tag + 8 + phys-x@ 2 pick = if " - " true ( sfmmup hmeblkp true ) ( r: hblktag ) " + " true ( sfmmup hmeblkp true ) ( r: hblktag ) " " else " - " hmeblk_next + phys-x@ false " + " hmeblk_next + phys-x@ false " " ( sfmmup hmeblkp false ) ( r: hblktag ) " - " then " + " then " " else " - " hmeblk_next + phys-x@ false " + " hmeblk_next + phys-x@ false " " ( sfmmup hmeblkp false ) ( r: hblktag ) " - " then " + " then " " else " - " drop 0 true " - " then " - " until r> drop " + " drop 0 true " + " then " + " until r> drop " "; " ": HME_HASH_TAG ( sfmmup rehash addr -- hblktag ) "
--- a/usr/src/uts/sun4u/os/mach_startup.c Mon Jun 17 17:20:41 2019 +0200 +++ b/usr/src/uts/sun4u/os/mach_startup.c Tue Jun 18 07:47:10 2019 +0000 @@ -20,6 +20,7 @@ */ /* * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2019 Peter Tribble. */ #include <sys/machsystm.h> @@ -495,26 +496,6 @@ } /* - * Return true if the machine we're running on is a Positron. - * (Positron is an unsupported developers platform.) - */ -int -iam_positron(void) -{ - char model[32]; - const char proto_model[] = "SUNW,501-2732"; - pnode_t root = prom_rootnode(); - - if (prom_getproplen(root, "model") != sizeof (proto_model)) - return (0); - - (void) prom_getprop(root, "model", model); - if (strcmp(model, proto_model) == 0) - return (1); - return (0); -} - -/* * Find a physically contiguous area of twice the largest ecache size * to be used while doing displacement flush of ecaches. */