diff options
64 files changed, 1486 insertions, 706 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7671d67b1b12..63f2ac4b1247 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2370,7 +2370,6 @@ OLD_LIBS+=usr/lib32/private/libyaml.so.1 OLD_FILES+=usr/lib32/private/libyaml_p.a # 20140216: new clang import which bumps version from 3.3 to 3.4. OLD_FILES+=usr/bin/llvm-prof -OLD_FILES+=usr/bin/llvm-ranlib OLD_FILES+=usr/include/clang/3.3/__wmmintrin_aes.h OLD_FILES+=usr/include/clang/3.3/__wmmintrin_pclmul.h OLD_FILES+=usr/include/clang/3.3/altivec.h diff --git a/contrib/bsnmp/gensnmpdef/gensnmpdef.c b/contrib/bsnmp/gensnmpdef/gensnmpdef.c index 32c835d21a81..b0bfdafdd7be 100644 --- a/contrib/bsnmp/gensnmpdef/gensnmpdef.c +++ b/contrib/bsnmp/gensnmpdef/gensnmpdef.c @@ -126,9 +126,11 @@ open_node(const SmiNode *n, u_int level, SmiNode **last) while (level < n->oidlen - 1) { if (level >= cut) { + n1 = smiGetNodeByOID(level + 1, n->oid); + if (n1 == NULL) + continue; pindent(level); printf("(%u", n->oid[level]); - n1 = smiGetNodeByOID(level + 1, n->oid); printf(" "); print_name(n1); printf("\n"); @@ -397,12 +399,11 @@ static void save_typdef(char *name) { struct tdef *t; - t = malloc(sizeof(struct tdef)); + t = calloc(1, sizeof(struct tdef)); if (t == NULL) err(1, NULL); - memset(t, 0 , sizeof(struct tdef)); t->name = name; SLIST_INSERT_HEAD(&tdefs, t, link); } @@ -559,7 +560,11 @@ main(int argc, char *argv[]) level = 0; last = NULL; for (opt = 0; opt < argc; opt++) { + if (mods[opt] == NULL) /* smiGetModule failed above */ + continue; n = smiGetFirstNode(mods[opt], SMI_NODEKIND_ANY); + if (n == NULL) + continue; for (;;) { if (do_typedef == 0) { level = open_node(n, level, &last); diff --git a/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt b/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt index 761876a23306..29f784400253 100644 --- a/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt +++ b/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt @@ -54,6 +54,9 @@ begemotIp MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The MIB for IP stuff that is not in the official IP MIBs." + REVISION "200602130000Z" + DESCRIPTION + "Initial revision." ::= { begemot 3 } begemotIpObjects OBJECT IDENTIFIER ::= { begemotIp 1 } diff --git a/contrib/bsnmp/snmp_mibII/mibII.c b/contrib/bsnmp/snmp_mibII/mibII.c index 11218ad0ae88..e66a951c4743 100644 --- a/contrib/bsnmp/snmp_mibII/mibII.c +++ b/contrib/bsnmp/snmp_mibII/mibII.c @@ -319,7 +319,7 @@ fetch_generic_mib(struct mibif *ifp, const struct ifmibdata *old) name[5] = IFDATA_GENERAL; len = sizeof(ifp->mib); - if (sysctl(name, 6, &ifp->mib, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), &ifp->mib, &len, NULL, 0) == -1) { if (errno != ENOENT) syslog(LOG_WARNING, "sysctl(ifmib, %s) failed %m", ifp->name); @@ -480,7 +480,7 @@ mib_fetch_ifmib(struct mibif *ifp) name[3] = IFMIB_IFDATA; name[4] = ifp->sysindex; name[5] = IFDATA_LINKSPECIFIC; - if (sysctl(name, 6, NULL, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), NULL, &len, NULL, 0) == -1) { syslog(LOG_WARNING, "sysctl linkmib estimate (%s): %m", ifp->name); if (ifp->specmib != NULL) { @@ -506,7 +506,7 @@ mib_fetch_ifmib(struct mibif *ifp) ifp->specmib = newmib; ifp->specmiblen = len; } - if (sysctl(name, 6, ifp->specmib, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), ifp->specmib, &len, NULL, 0) == -1) { syslog(LOG_WARNING, "sysctl linkmib (%s): %m", ifp->name); if (ifp->specmib != NULL) { ifp->specmib = NULL; @@ -902,7 +902,7 @@ mib_refresh_iflist(void) for (idx = 1; idx <= count; idx++) { name[4] = idx; len = sizeof(mib); - if (sysctl(name, 6, &mib, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), &mib, &len, NULL, 0) == -1) { if (errno == ENOENT) continue; syslog(LOG_ERR, "ifmib(%u): %m", idx); @@ -1213,7 +1213,7 @@ mib_fetch_rtab(int af, int info, int arg, size_t *lenp) *lenp = 0; /* initial estimate */ - if (sysctl(name, 6, NULL, lenp, NULL, 0) == -1) { + if (sysctl(name, nitems(name), NULL, lenp, NULL, 0) == -1) { syslog(LOG_ERR, "sysctl estimate (%d,%d,%d,%d,%d,%d): %m", name[0], name[1], name[2], name[3], name[4], name[5]); return (NULL); @@ -1230,7 +1230,7 @@ mib_fetch_rtab(int af, int info, int arg, size_t *lenp) } buf = newbuf; - if (sysctl(name, 6, buf, lenp, NULL, 0) == 0) + if (sysctl(name, nitems(name), buf, lenp, NULL, 0) == 0) break; if (errno != ENOMEM) { diff --git a/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt b/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt index 9d99eab14c01..d7f6099438a4 100644 --- a/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt +++ b/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt @@ -54,6 +54,9 @@ begemot MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The root of the Begemot subtree of the fokus tree." + REVISION "200201300000Z" + DESCRIPTION + "Initial revision." ::= { fokus 1 } END diff --git a/contrib/bsnmp/snmpd/FOKUS-MIB.txt b/contrib/bsnmp/snmpd/FOKUS-MIB.txt index d4671e8a5496..f356d14573c1 100644 --- a/contrib/bsnmp/snmpd/FOKUS-MIB.txt +++ b/contrib/bsnmp/snmpd/FOKUS-MIB.txt @@ -52,6 +52,9 @@ fokus MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The root of the Fokus enterprises tree." + REVISION "200202050000Z" + DESCRIPTION + "Initial revision." ::= { enterprises 12325 } END diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile index 1e6f43686157..8d4fae0dffe9 100644 --- a/lib/libprocstat/Makefile +++ b/lib/libprocstat/Makefile @@ -9,11 +9,11 @@ SRCS= cd9660.c \ common_kvm.c \ core.c \ libprocstat.c \ - msdosfs.c \ + msdosfs.c \ smbfs.c \ udf.c -VERSION_DEF= ${.CURDIR}/Versions.def +VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map INCS= libprocstat.h diff --git a/lib/libprocstat/Versions.def b/lib/libprocstat/Versions.def deleted file mode 100644 index ed958db0635d..000000000000 --- a/lib/libprocstat/Versions.def +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -# This version was first added to 9.0-current. -FBSD_1.2 { -}; - -# This version was first added to 10.0-current. -FBSD_1.3 { -} FBSD_1.2; - diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 3de64aac1a1d..9dc980077ec8 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -282,7 +282,7 @@ procstat_getprocs(struct procstat *procstat, int what, int arg, name[1] = KERN_PROC; name[2] = what; name[3] = arg; - error = sysctl(name, 4, NULL, &len, NULL, 0); + error = sysctl(name, nitems(name), NULL, &len, NULL, 0); if (error < 0 && errno != EPERM) { warn("sysctl(kern.proc)"); goto fail; @@ -299,7 +299,7 @@ procstat_getprocs(struct procstat *procstat, int what, int arg, goto fail; } olen = len; - error = sysctl(name, 4, p, &len, NULL, 0); + error = sysctl(name, nitems(name), p, &len, NULL, 0); } while (error < 0 && errno == ENOMEM && olen == len); if (error < 0 && errno != EPERM) { warn("sysctl(kern.proc)"); @@ -1760,7 +1760,7 @@ getargv(struct procstat *procstat, struct kinfo_proc *kp, size_t nchr, int env) name[2] = env ? KERN_PROC_ENV : KERN_PROC_ARGS; name[3] = kp->ki_pid; len = nchr; - error = sysctl(name, 4, av->buf, &len, NULL, 0); + error = sysctl(name, nitems(name), av->buf, &len, NULL, 0); if (error != 0 && errno != ESRCH && errno != EPERM) warn("sysctl(kern.proc.%s)", env ? "env" : "args"); if (error != 0 || len == 0) @@ -1983,7 +1983,7 @@ procstat_getgroups_sysctl(pid_t pid, unsigned int *cntp) warn("malloc(%zu)", len); return (NULL); } - if (sysctl(mib, 4, groups, &len, NULL, 0) == -1) { + if (sysctl(mib, nitems(mib), groups, &len, NULL, 0) == -1) { warn("sysctl: kern.proc.groups: %d", pid); free(groups); return (NULL); @@ -2059,7 +2059,7 @@ procstat_getumask_sysctl(pid_t pid, unsigned short *maskp) mib[2] = KERN_PROC_UMASK; mib[3] = pid; len = sizeof(*maskp); - error = sysctl(mib, 4, maskp, &len, NULL, 0); + error = sysctl(mib, nitems(mib), maskp, &len, NULL, 0); if (error != 0 && errno != ESRCH && errno != EPERM) warn("sysctl: kern.proc.umask: %d", pid); return (error); @@ -2139,7 +2139,7 @@ procstat_getrlimit_sysctl(pid_t pid, int which, struct rlimit* rlimit) name[3] = pid; name[4] = which; len = sizeof(struct rlimit); - error = sysctl(name, 5, rlimit, &len, NULL, 0); + error = sysctl(name, nitems(name), rlimit, &len, NULL, 0); if (error < 0 && errno != ESRCH) { warn("sysctl: kern.proc.rlimit: %d", pid); return (-1); @@ -2201,7 +2201,7 @@ procstat_getpathname_sysctl(pid_t pid, char *pathname, size_t maxlen) name[2] = KERN_PROC_PATHNAME; name[3] = pid; len = maxlen; - error = sysctl(name, 4, pathname, &len, NULL, 0); + error = sysctl(name, nitems(name), pathname, &len, NULL, 0); if (error != 0 && errno != ESRCH) warn("sysctl: kern.proc.pathname: %d", pid); if (len == 0) @@ -2281,7 +2281,7 @@ procstat_getosrel_sysctl(pid_t pid, int *osrelp) name[2] = KERN_PROC_OSREL; name[3] = pid; len = sizeof(*osrelp); - error = sysctl(name, 4, osrelp, &len, NULL, 0); + error = sysctl(name, nitems(name), osrelp, &len, NULL, 0); if (error != 0 && errno != ESRCH) warn("sysctl: kern.proc.osrel: %d", pid); return (error); @@ -2341,7 +2341,7 @@ is_elf32_sysctl(pid_t pid) name[2] = KERN_PROC_SV_NAME; name[3] = pid; len = sizeof(sv_name); - error = sysctl(name, 4, sv_name, &len, NULL, 0); + error = sysctl(name, nitems(name), sv_name, &len, NULL, 0); if (error != 0 || len == 0) return (0); for (i = 0; i < sizeof(elf32_sv_names) / sizeof(*elf32_sv_names); i++) { @@ -2372,7 +2372,7 @@ procstat_getauxv32_sysctl(pid_t pid, unsigned int *cntp) warn("malloc(%zu)", len); goto out; } - if (sysctl(name, 4, auxv32, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), auxv32, &len, NULL, 0) == -1) { if (errno != ESRCH && errno != EPERM) warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); goto out; @@ -2421,7 +2421,7 @@ procstat_getauxv_sysctl(pid_t pid, unsigned int *cntp) warn("malloc(%zu)", len); return (NULL); } - if (sysctl(name, 4, auxv, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), auxv, &len, NULL, 0) == -1) { if (errno != ESRCH && errno != EPERM) warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); free(auxv); @@ -2482,7 +2482,7 @@ procstat_getkstack_sysctl(pid_t pid, int *cntp) name[3] = pid; len = 0; - error = sysctl(name, 4, NULL, &len, NULL, 0); + error = sysctl(name, nitems(name), NULL, &len, NULL, 0); if (error < 0 && errno != ESRCH && errno != EPERM && errno != ENOENT) { warn("sysctl: kern.proc.kstack: %d", pid); return (NULL); @@ -2499,7 +2499,7 @@ procstat_getkstack_sysctl(pid_t pid, int *cntp) warn("malloc(%zu)", len); return (NULL); } - if (sysctl(name, 4, kkstp, &len, NULL, 0) == -1) { + if (sysctl(name, nitems(name), kkstp, &len, NULL, 0) == -1) { warn("sysctl: kern.proc.pid: %d", pid); free(kkstp); return (NULL); diff --git a/lib/libutil/kinfo_getallproc.c b/lib/libutil/kinfo_getallproc.c index 0f43ce2e1ad9..8620f48545dc 100644 --- a/lib/libutil/kinfo_getallproc.c +++ b/lib/libutil/kinfo_getallproc.c @@ -31,8 +31,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/user.h> #include <sys/sysctl.h> +#include <sys/user.h> #include <stdlib.h> #include <string.h> @@ -75,14 +75,14 @@ kinfo_getallproc(int *cntp) mib[2] = KERN_PROC_PROC; len = 0; - if (sysctl(mib, 3, NULL, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) < 0) return (NULL); kipp = malloc(len); if (kipp == NULL) return (NULL); - if (sysctl(mib, 3, kipp, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), kipp, &len, NULL, 0) < 0) goto bad; if (len % sizeof(*kipp) != 0) goto bad; diff --git a/lib/libutil/kinfo_getfile.c b/lib/libutil/kinfo_getfile.c index 8a5477f40654..22baf534f504 100644 --- a/lib/libutil/kinfo_getfile.c +++ b/lib/libutil/kinfo_getfile.c @@ -2,8 +2,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/user.h> #include <sys/sysctl.h> +#include <sys/user.h> #include <stdlib.h> #include <string.h> @@ -26,14 +26,14 @@ kinfo_getfile(pid_t pid, int *cntp) mib[2] = KERN_PROC_FILEDESC; mib[3] = pid; - error = sysctl(mib, 4, NULL, &len, NULL, 0); + error = sysctl(mib, nitems(mib), NULL, &len, NULL, 0); if (error) return (NULL); len = len * 4 / 3; buf = malloc(len); if (buf == NULL) return (NULL); - error = sysctl(mib, 4, buf, &len, NULL, 0); + error = sysctl(mib, nitems(mib), buf, &len, NULL, 0); if (error) { free(buf); return (NULL); diff --git a/lib/libutil/kinfo_getproc.c b/lib/libutil/kinfo_getproc.c index 2ae6b57ee71d..496f71f55559 100644 --- a/lib/libutil/kinfo_getproc.c +++ b/lib/libutil/kinfo_getproc.c @@ -30,8 +30,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/user.h> #include <sys/sysctl.h> +#include <sys/user.h> #include <stdlib.h> #include <string.h> @@ -49,14 +49,14 @@ kinfo_getproc(pid_t pid) mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; mib[3] = pid; - if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) < 0) return (NULL); kipp = malloc(len); if (kipp == NULL) return (NULL); - if (sysctl(mib, 4, kipp, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), kipp, &len, NULL, 0) < 0) goto bad; if (len != sizeof(*kipp)) goto bad; diff --git a/lib/libutil/kinfo_getvmmap.c b/lib/libutil/kinfo_getvmmap.c index 9d9e4273a110..e01f48284c68 100644 --- a/lib/libutil/kinfo_getvmmap.c +++ b/lib/libutil/kinfo_getvmmap.c @@ -2,8 +2,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/user.h> #include <sys/sysctl.h> +#include <sys/user.h> #include <stdlib.h> #include <string.h> @@ -26,14 +26,14 @@ kinfo_getvmmap(pid_t pid, int *cntp) mib[2] = KERN_PROC_VMMAP; mib[3] = pid; - error = sysctl(mib, 4, NULL, &len, NULL, 0); + error = sysctl(mib, nitems(mib), NULL, &len, NULL, 0); if (error) return (NULL); len = len * 4 / 3; buf = malloc(len); if (buf == NULL) return (NULL); - error = sysctl(mib, 4, buf, &len, NULL, 0); + error = sysctl(mib, nitems(mib), buf, &len, NULL, 0); if (error) { free(buf); return (NULL); diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index 6254a60782d5..7ffc6dfc7053 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2016.11.21 -# Date: 2016-11-21 03:15:01 +# Version: 2017.01.08 +# Date: 2017-01-08 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -249,6 +249,7 @@ 0014 MegaRAID Tri-Mode SAS3516 1028 1fd4 PERC H745P MX 1d49 0602 ThinkSystem RAID 930-16i 4GB Flash PCIe 12Gb Adapter + 0015 MegaRAID Tri-Mode SAS3416 0016 MegaRAID Tri-Mode SAS3508 1028 1fc9 PERC H840 Adapter 1028 1fcb PERC H740P Adapter @@ -548,6 +549,7 @@ 1028 1f53 HBA330 Mini 1028 1fd2 HBA330 MX 1028 1fd3 HBA330 MMZ + 1bd4 0011 Inspur 12Gb 8i-3008 IT SAS HBA 00ab SAS3516 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00ac SAS3416 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 1d49 0201 ThinkSystem 430-16i SAS/SATA 12Gb HBA @@ -2201,6 +2203,11 @@ 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE 67c0 Ellesmere [Polaris10] + 67c4 Ellesmere [Radeon Pro WX 7100] + 67c7 Ellesmere [Radeon Pro WX 5100] + 67ca Ellesmere [Polaris10] + 67cc Ellesmere [Polaris10] + 67cf Ellesmere [Polaris10] 67df Ellesmere [Radeon RX 470/480] 1002 0b37 Radeon RX 480 1043 04a8 Radeon RX 480 @@ -2218,6 +2225,7 @@ 1787 a480 Radeon RX 480 67e0 Baffin [Polaris11] 67e1 Baffin [Polaris11] + 67e3 Baffin [Radeon Pro WX 4100] 67e8 Baffin [Polaris11] 67e9 Baffin [Polaris11] 67eb Baffin [Polaris11] @@ -2924,6 +2932,12 @@ 148c 9380 Radeon R9 380 # Make naming scheme consistent 174b e308 Radeon R9 380 Nitro 4G D5 + 6980 Polaris12 + 6981 Polaris12 + 6985 Polaris12 + 6986 Polaris12 + 6987 Polaris12 + 699f Polaris12 700f RS100 AGP Bridge 7010 RS200/RS250 AGP Bridge 7100 R520 [Radeon X1800 XT] @@ -5095,6 +5109,7 @@ 0675 1704 ISDN Adapter (PCI Bus, D, C) 0675 1707 ISDN Adapter (PCI Bus, DV, W) 10cf 105e ISDN Adapter (PCI Bus, DV, W) + 13a0 Transformer Book T101HA-GR030R # Should be 1022:9602 9602 AMD RS780/RS880 PCI to PCI bridge (int gfx) 1043 83a2 M4A785TD Motherboard @@ -10077,6 +10092,7 @@ 10c3 GT218 [GeForce 8400 GS Rev. 3] 10c5 GT218 [GeForce 405] 10d8 GT218 [NVS 300] + 10ef GP102 HDMI Audio Controller 10f0 GP104 High Definition Audio Controller 1140 GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] 1019 0799 GeForce 820M @@ -10620,7 +10636,7 @@ 13f1 GM204GL [Quadro M4000] 13f2 GM204GL [Tesla M60] 13f3 GM204GL [Tesla M6] - 13f8 GM204GLM [Quadro M5000M] + 13f8 GM204GLM [Quadro M5000M / M5000 SE] 13f9 GM204GLM [Quadro M4000M] 13fa GM204GLM [Quadro M3000M] 10de 11c9 Quadro M3000 SE @@ -10634,8 +10650,9 @@ 1431 GM206GL [Tesla M4] 15f0 GP100GL 15f1 GP100GL - 15f8 GP100GL - 15f9 GP100GL + 15f7 GP100GL [Tesla P100 PCIe 12GB] + 15f8 GP100GL [Tesla P100 PCIe 16GB] + 15f9 GP100GL [Tesla P100 SMX2 16GB] 1617 GM204M [GeForce GTX 980M] 1618 GM204M [GeForce GTX 970M] 1619 GM204M [GeForce GTX 965M] @@ -10659,10 +10676,12 @@ 1b81 GP104 [GeForce GTX 1070] 1b82 GP104 1b83 GP104 + 1b84 GP104 [GeForce GTX 1060 3GB] 1ba0 GP104M [GeForce GTX 1080] 1ba1 GP104M [GeForce GTX 1070] 1bb0 GP104GL [Quadro P5000] 1bb1 GP104GL + 1bb3 GP104GL [Tesla P4] 1bb4 GP104GL 1be0 GP104M [GeForce GTX 1080] 1be1 GP104M [GeForce GTX 1070] @@ -10678,6 +10697,9 @@ 1c80 GP107 1c81 GP107 [GeForce GTX 1050] 1c82 GP107 [GeForce GTX 1050 Ti] + 1c8c GP107M [GeForce GTX 1050 Ti] + 1c8d GP107M [GeForce GTX 1050] + 1c8e GP107M 1ca7 GP107GL 1ca8 GP107GL 1caa GP107GL @@ -12103,7 +12125,11 @@ 111f Precision Digital Images 4a47 Precision MX Video engine interface 5243 Frame capture bus interface -1120 EMC Corporation +# formerly EMC Corporation +1120 Dell EMC + 2306 Unity Fibre Channel Controller + 2501 Unity Ethernet Controller + 2505 Unity Fibre Channel Controller 1121 Zilog 1122 Multi-tech Systems, Inc. 1123 Excellent Design, Inc. @@ -15975,7 +16001,7 @@ 5081 T540-5081 Unified Wire Ethernet Controller 5082 T504-5082 Unified Wire Ethernet Controller 5083 T540-5083 Unified Wire Ethernet Controller - 5084 T580-5084 Unified Wire Ethernet Controller + 5084 T540-5084 Unified Wire Ethernet Controller 5085 T580-5085 Unified Wire Ethernet Controller 5086 T580-5086 Unified Wire Ethernet Controller 5087 T580-5087 Unified Wire Ethernet Controller @@ -15994,6 +16020,7 @@ 509a T520-509A Unified Wire Ethernet Controller 509b T540-509B Unified Wire Ethernet Controller 509c T520-509C Unified Wire Ethernet Controller + 509d T540-509D Unified Wire Ethernet Controller 5401 T520-CR Unified Wire Ethernet Controller 5402 T522-CR Unified Wire Ethernet Controller 5403 T540-CR Unified Wire Ethernet Controller @@ -16041,6 +16068,7 @@ 549a T520-509A Unified Wire Ethernet Controller 549b T540-509B Unified Wire Ethernet Controller 549c T520-509C Unified Wire Ethernet Controller + 549d T540-509D Unified Wire Ethernet Controller 5501 T520-CR Unified Wire Storage Controller 5502 T522-CR Unified Wire Storage Controller 5503 T540-CR Unified Wire Storage Controller @@ -16088,6 +16116,7 @@ 559a T520-509A Unified Wire Storage Controller 559b T540-509B Unified Wire Storage Controller 559c T520-509C Unified Wire Storage Controller + 559d T540-509D Unified Wire Storage Controller 5601 T520-CR Unified Wire Storage Controller 5602 T522-CR Unified Wire Storage Controller 5603 T540-CR Unified Wire Storage Controller @@ -16135,6 +16164,7 @@ 569a T520-509A Unified Wire Storage Controller 569b T540-509B Unified Wire Storage Controller 569c T520-509C Unified Wire Storage Controller + 569d T540-509D Unified Wire Storage Controller 5701 T520-CR Unified Wire Ethernet Controller 5702 T522-CR Unified Wire Ethernet Controller 5703 T540-CR Unified Wire Ethernet Controller @@ -16221,6 +16251,7 @@ 589a T520-509A Unified Wire Ethernet Controller [VF] 589b T540-509B Unified Wire Ethernet Controller [VF] 589c T520-509C Unified Wire Ethernet Controller [VF] + 589d T540-509D Unified Wire Ethernet Controller [VF] 6001 T6225-CR Unified Wire Ethernet Controller 6002 T6225-SO-CR Unified Wire Ethernet Controller 6003 T6425-CR Unified Wire Ethernet Controller @@ -16357,7 +16388,8 @@ 144d Samsung Electronics Co Ltd 1600 Apple PCIe SSD a800 XP941 PCIe SSD - a802 NVMe SSD Controller + a802 NVMe SSD Controller SM951/PM951 + a804 NVMe SSD Controller SM961/PM961 a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -17968,11 +18000,13 @@ 15b3 Mellanox Technologies 0191 MT25408 [ConnectX IB Flash Recovery] 01f6 MT27500 Family [ConnectX-3 Flash Recovery] + 01f8 MT27520 Family [ConnectX-3 Pro Flash Recovery] 01ff MT27600 Family [Connect-IB Flash Recovery] 0209 MT27700 Family [ConnectX-4 Flash Recovery] 020b MT27710 Family [ConnectX-4 Lx Flash Recovery] 020d MT28800 Family [ConnectX-5 Flash Recovery] 020f MT28908A0 Family [ConnectX-6 Flash Recovery] + 0211 MT416842 Family [BlueField SoC Flash Recovery] # reserved for RM#105916 024e MT53100 [Spectrum-2, Flash recovery mode] # Actual value to be used @@ -18732,6 +18766,7 @@ 7013 AP440-3: 32-Channel Isolated Digital Input Module 7014 AP445: 32-Channel Isolated Digital Output Module 7016 AP470 48-Channel TTL Level Digital Input/Output Module + 7017 AP323 16-bit, 20 or 40 Channel Analog Input Module 7018 AP408: 32-Channel Digital I/O Module 701a AP220-16 12-Bit, 16-Channel Analog Output Module 701b AP231-16 16-Bit, 16-Channel Analog Output Module @@ -18992,6 +19027,7 @@ 1160 ARC-1160 16-Port PCI-X to SATA RAID Controller 1170 ARC-1170 24-Port PCI-X to SATA RAID Controller 1201 ARC-1200 2-Port PCI-Express to SATA II RAID Controller + 1203 ARC-1203 2/4/8 Port PCIe 2.0 to SATA 6Gb RAID Controller 1210 ARC-1210 4-Port PCI-Express to SATA RAID Controller 1214 ARC-12x4 PCIe 2.0 to SAS/SATA 6Gb RAID Controller 17d3 1214 ARC-1214 4-Port PCIe 2.0 to SAS/SATA 6Gb RAID Controller @@ -19510,7 +19546,7 @@ 1924 5105 SFN4111T-R5 1924 5201 SFN4112F-R1 1924 5202 SFN4112F-R2 - 0803 SFC9020 [Solarstorm] + 0803 SFC9020 10G Ethernet Controller 1014 0478 2-port 10GbE Low-Latency (R7) 1014 0479 2-port 10GbE OpenOnload (R7) 1014 04a7 Solarflare 10Gb Low-latency Dual-port HBA (R7) @@ -19540,7 +19576,7 @@ 1924 7207 SFN5162F-R7 SFP+ Server Adapter 1924 7a06 SFN5152F-R6 SFP+ Server Adapter 1924 7a07 SFN5152F-R7 SFP+ Server Adapter - 0813 SFL9021 [Solarstorm] + 0813 SFL9021 10GBASE-T Ethernet Controller 1924 6100 SFN5121T-R0 10GBASE-T Server Adapter 1924 6102 SFN5121T-R2 10GBASE-T Server Adapter 1924 6103 SFN5121T-R3 10GBASE-T Server Adapter @@ -19549,7 +19585,7 @@ 1924 6904 SFN5111T-R4 10GBASE-T Server Adapter 1924 7104 SFN5161T-R4 10GBASE-T Server Adapter 1924 7904 SFN5151T-R4 10GBASE-T Server Adapter - 0903 SFC9120 + 0903 SFC9120 10G Ethernet Controller 1014 04cc SFN7122F-R2 2x10GbE SFP+ Flareon Ultra 1924 8002 SFN7122F-R1 SFP+ Server Adapter 1924 8003 SFN7x41Q-R1 Flareon Ultra 7000 Series 10/40G Adapter @@ -19561,11 +19597,11 @@ 1924 800d SFN7x02F-R3 Flareon 7000 Series 10G Adapter 1924 8010 SFA7942Q-R1 QSFP+ AOE Adapter 1924 8015 SFA7942Q-A5-0-R1 QSFP+ AOE Adapter - 0923 SFC9140 + 0923 SFC9140 10/40G Ethernet Controller 1924 800b SFN7x42Q-R1 Flareon Ultra 7000 Series 10/40G Adapter 1924 800e SFN7x42Q-R2 Flareon Ultra 7000 Series 10/40G Adapter 1924 800f SFN7xx4F-R1 Flareon Ultra 7000 Series 10G Adapter - 0a03 SFC9220 + 0a03 SFC9220 10/40G Ethernet Controller 1924 8011 SFN 8022-R1 Solarflare Flareon 8000 Series 10G Adapter 1924 8012 SFN8522-R1 Flareon Ultra 8000 Series 10G Adapter 1924 8013 SFN8042-R1 Solarflare Flareon 8000 Series 10/40G Adapter @@ -19574,10 +19610,11 @@ 1924 8017 SFN8522-R2 Flareon Ultra 8000 Series 10G Adapter 1924 8018 SFN8042-R2 Flareon 8000 Series 10/40G Adapter 1924 8019 SFN8542-R2 Flareon Ultra 8000 Series 10/40G Adapter - 1803 SFC9020 Virtual Function [Solarstorm] - 1813 SFL9021 Virtual Function [Solarstorm] - 1903 SFC9120 Virtual Function - 1923 SFC9140 Virtual Function + 1803 SFC9020 10G Ethernet Controller (Virtual Function) + 1813 SFL9021 10GBASE-T Ethernet Controller (Virtual Function) + 1903 SFC9120 10G Ethernet Controller (Virtual Function) + 1923 SFC9140 10/40G Ethernet Controller (Virtual Function) + 1a03 SFC9220 10/40G Ethernet Controller (Virtual Function) 6703 SFC4000 rev A iSCSI/Onload [Solarstorm] 10b8 0102 SMC10GPCIe-10BT (A2) [TigerCard] 10b8 0103 SMC10GPCIe-10BT (A3) [TigerCard] @@ -19864,6 +19901,7 @@ 5801 DDRdrive X1 5808 DDRdrive X8 dd52 DDRdrive X1-30 +19e5 Huawei Technologies Co., Ltd. 19e7 NET (Network Equipment Technologies) 1001 STIX DSP Card 1002 STIX - 1 Port T1/E1 Card @@ -20303,6 +20341,8 @@ 0303 Simulyzer-RT CompactPCI Serial PSI5-SIM-1 card 0304 Simulyzer-RT CompactPCI Serial PWR-ANA-1 card 0305 Simulyzer-RT CompactPCI Serial CAN-1 card +1cd7 Nanjing Magewell Electronics Co., Ltd. + 0010 Pro Capture Endpoint 1cdd secunet Security Networks AG 1ce4 Exablaze 0001 ExaNIC X4 @@ -20310,6 +20350,7 @@ 0003 ExaNIC X10 0004 ExaNIC X10-GM 0005 ExaNIC X40 + 0006 ExaNIC X10-HPT 1cf7 Subspace Dynamics 1d00 Pure Storage 1d1d CNEX Labs @@ -21336,6 +21377,27 @@ 0813 Moorestown SC DMA 0814 Moorestown LPE DMA 0815 Moorestown SSP0 + 0817 Medfield Serial IO I2C Controller #3 + 0818 Medfield Serial IO I2C Controller #4 + 0819 Medfield Serial IO I2C Controller #5 + 081a Medfield GPIO Controller [Core] + 081b Medfield Serial IO HSUART Controller #1 + 081c Medfield Serial IO HSUART Controller #2 + 081d Medfield Serial IO HSUART Controller #3 + 081e Medfield Serial IO HSUART DMA Controller + 081f Medfield GPIO Controller [AON] + 0820 Medfield SD Host Controller + 0821 Medfield SDIO Controller #1 + 0822 Medfield SDIO Controller #2 + 0823 Medfield eMMC Controller #0 + 0824 Medfield eMMC Controller #1 + 0827 Medfield Serial IO DMA Controller + 0828 Medfield Power Management Unit + 0829 Medfield USB Device Controller (OTG) + 082a Medfield SCU IPC + 082c Medfield Serial IO I2C Controller #0 + 082d Medfield Serial IO I2C Controller #1 + 082e Medfield Serial IO I2C Controller #2 0885 Centrino Wireless-N + WiMAX 6150 8086 1305 Centrino Wireless-N + WiMAX 6150 BGN 8086 1307 Centrino Wireless-N + WiMAX 6150 BG @@ -22445,6 +22507,18 @@ 1161 82806AA PCI64 Hub Advanced Programmable Interrupt Controller 8086 1161 82806AA PCI64 Hub APIC 1162 Xscale 80200 Big Endian Companion Chip + 1190 Merrifield SD/SDIO/eMMC Controller + 1191 Merrifield Serial IO HSUART Controller + 1192 Merrifield Serial IO HSUART DMA Controller + 1194 Merrifield Serial IO SPI Controller + 1195 Merrifield Serial IO I2C Controller + 1196 Merrifield Serial IO I2C Controller + 1199 Merrifield GPIO Controller + 119e Merrifield USB Device Controller (OTG) + 11a0 Merrifield SCU IPC + 11a1 Merrifield Power Management Unit + 11a2 Merrifield Serial IO DMA Controller + 11a5 Merrifield Serial IO PWM Controller 1200 IXP1200 Network Processor 172a 0000 AEP SSL Accelerator 1209 8255xER/82551IT Fast Ethernet Controller @@ -22917,8 +22991,8 @@ 103c 0000 HPE Ethernet 10/20Gb 2-port 660FLB Adapter 103c 22fe HPE Ethernet 10/20Gb 2-port 660FLB Adapter 1588 Ethernet Controller XL710 for 20GbE backplane - 103c 0000 HPE Ethernet 10/20Gb 2-port 660M Adapter - 103c 22ff HPE Ethernet 10/20Gb 2-port 660M Adapter + 103c 0000 Ethernet 10/20Gb 2-port 660M Adapter + 103c 22ff Ethernet 10/20Gb 2-port 660M Adapter 1589 Ethernet Controller X710/X557-AT 10GBASE-T 108e 0000 Quad Port 10GBase-T Adapter 108e 7b1c Quad Port 10GBase-T Adapter @@ -22951,12 +23025,17 @@ 15ac Ethernet Connection X552 10 GbE SFP+ 15ad Ethernet Connection X552/X557-AT 10GBASE-T 15ae Ethernet Connection X552 1000BASE-T + 15b0 Ethernet Connection X552 Backplane 15b4 X553 Virtual Function 15b5 DSL6340 USB 3.1 Controller [Alpine Ridge] 15b6 DSL6540 USB 3.1 Controller [Alpine Ridge] 15b7 Ethernet Connection (2) I219-LM 15b8 Ethernet Connection (2) I219-V 15b9 Ethernet Connection (3) I219-LM + 15bb Ethernet Connection (7) I219-LM + 15bc Ethernet Connection (7) I219-V + 15bd Ethernet Connection (6) I219-LM + 15be Ethernet Connection (6) I219-V 15bf JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] 15c0 JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] 15c5 X553 Virtual Function @@ -24258,6 +24337,9 @@ 24f4 Wireless 8260 # Snow Field Peak AC 8086 0030 Dual Band Wireless-AC 8260 + 24fd Wireless 8265 / 8275 +# Windstorm Peak + 8086 0010 Dual Band Wireless-AC 8265 2500 82820 820 (Camino) Chipset Host Bridge (MCH) 1028 0095 Precision Workstation 220 Chipset 1043 801c P3C-2000 system chipset @@ -25145,12 +25227,12 @@ 1028 01da OptiPlex 745 1462 7235 P965 Neo MS-7235 mainboard 2826 C600/X79 series chipset SATA RAID Controller - 1d49 0100 ThinkSystem RAID 331 - 1d49 0101 ThinkSystem RAID 331 - 1d49 0102 ThinkSystem RAID 331 - 1d49 0103 ThinkSystem RAID 331 - 1d49 0104 ThinkSystem RAID 331 - 1d49 0105 ThinkSystem RAID 331 + 1d49 0100 Intel RSTe SATA Software RAID + 1d49 0101 Intel RSTe SATA Software RAID + 1d49 0102 Intel RSTe SATA Software RAID + 1d49 0103 Intel RSTe SATA Software RAID + 1d49 0104 Intel RSTe SATA Software RAID + 1d49 0105 Intel RSTe SATA Software RAID 2827 C610/X99 series chipset sSATA Controller [RAID mode] 2828 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [IDE mode] 1028 01f3 Inspiron 1420 @@ -26950,41 +27032,41 @@ 530d 80310 (IOP) IO Processor 5845 QEMU NVM Express Controller 1af4 1100 QEMU Virtual Machine - 5a84 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Integrated Graphics Controller - 5a88 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Imaging Unit - 5a98 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Audio Cluster - 5a9a Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Trusted Execution Engine - 5aa2 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Integrated Sensor Hub - 5aa8 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series USB xHCI - 5aac Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #1 - 5aae Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #2 - 5ab0 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #3 - 5ab2 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #4 - 5ab4 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #5 - 5ab6 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #6 - 5ab8 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #7 - 5aba Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series I2C Controller #8 - 5abc Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series HSUART Controller #1 - 5abe Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series HSUART Controller #2 - 5ac0 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series HSUART Controller #3 - 5ac2 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI Controller #1 - 5ac4 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI Controller #2 - 5ac6 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI Controller #3 - 5ac8 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PWM Pin Controller - 5aca Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SDXC/MMC Host Controller - 5acc Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series eMMC Controller - 5ad0 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SDIO Controller - 5ad4 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SMBus Controller - 5ad6 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port B #1 - 5ad7 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port B #2 - 5ad8 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #1 - 5ad9 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #2 - 5ada Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #3 - 5adb Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series PCI Express Port A #4 - 5ae3 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SATA AHCI Controller - 5ae8 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Low Pin Count Interface - 5aee Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series HSUART Controller #4 - 5af0 Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series Host Bridge + 5a84 Celeron N3350/Pentium N4200/Atom E3900 Series Integrated Graphics Controller + 5a88 Celeron N3350/Pentium N4200/Atom E3900 Series Imaging Unit + 5a98 Celeron N3350/Pentium N4200/Atom E3900 Series Audio Cluster + 5a9a Celeron N3350/Pentium N4200/Atom E3900 Series Trusted Execution Engine + 5aa2 Celeron N3350/Pentium N4200/Atom E3900 Series Integrated Sensor Hub + 5aa8 Celeron N3350/Pentium N4200/Atom E3900 Series USB xHCI + 5aac Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #1 + 5aae Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #2 + 5ab0 Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #3 + 5ab2 Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #4 + 5ab4 Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #5 + 5ab6 Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #6 + 5ab8 Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #7 + 5aba Celeron N3350/Pentium N4200/Atom E3900 Series I2C Controller #8 + 5abc Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller #1 + 5abe Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller #2 + 5ac0 Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller #3 + 5ac2 Celeron N3350/Pentium N4200/Atom E3900 Series SPI Controller #1 + 5ac4 Celeron N3350/Pentium N4200/Atom E3900 Series SPI Controller #2 + 5ac6 Celeron N3350/Pentium N4200/Atom E3900 Series SPI Controller #3 + 5ac8 Celeron N3350/Pentium N4200/Atom E3900 Series PWM Pin Controller + 5aca Celeron N3350/Pentium N4200/Atom E3900 Series SDXC/MMC Host Controller + 5acc Celeron N3350/Pentium N4200/Atom E3900 Series eMMC Controller + 5ad0 Celeron N3350/Pentium N4200/Atom E3900 Series SDIO Controller + 5ad4 Celeron N3350/Pentium N4200/Atom E3900 Series SMBus Controller + 5ad6 Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port B #1 + 5ad7 Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port B #2 + 5ad8 Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port A #1 + 5ad9 Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port A #2 + 5ada Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port A #3 + 5adb Celeron N3350/Pentium N4200/Atom E3900 Series PCI Express Port A #4 + 5ae3 Celeron N3350/Pentium N4200/Atom E3900 Series SATA AHCI Controller + 5ae8 Celeron N3350/Pentium N4200/Atom E3900 Series Low Pin Count Interface + 5aee Celeron N3350/Pentium N4200/Atom E3900 Series HSUART Controller #4 + 5af0 Celeron N3350/Pentium N4200/Atom E3900 Series Host Bridge 65c0 5100 Chipset Memory Controller Hub 65e2 5100 Chipset PCI Express x4 Port 2 65e3 5100 Chipset PCI Express x4 Port 3 @@ -27826,6 +27908,25 @@ a243 Lewisburg LPC or eSPI Controller a252 Lewisburg SSATA Controller [AHCI mode] a256 Lewisburg SSATA Controller [RAID mode] + a282 200 Series PCH SATA controller [AHCI mode] + a294 200 Series PCH PCI Express Root Port #1 + a2a1 200 Series PCH PMC + a2a3 200 Series PCH SMBus Controller + a2a7 200 Series PCH Serial IO UART Controller #0 + a2a8 200 Series PCH Serial IO UART Controller #1 + a2a9 200 Series PCH Serial IO SPI Controller #0 + a2aa 200 Series PCH Serial IO SPI Controller #1 + a2af 200 Series PCH USB 3.0 xHCI Controller + a2b1 200 Series PCH Thermal Subsystem + a2ba 200 Series PCH CSME HECI #1 + a2bb 200 Series PCH CSME HECI #2 + a2c6 200 Series PCH LPC Controller + a2e0 200 Series PCH Serial IO I2C Controller #0 + a2e1 200 Series PCH Serial IO I2C Controller #1 + a2e2 200 Series PCH Serial IO I2C Controller #2 + a2e3 200 Series PCH Serial IO I2C Controller #3 + a2e6 200 Series PCH Serial IO UART Controller #2 + a2f0 200 Series PCH HD Audio a620 6400/6402 Advanced Memory Buffer (AMB) abc0 Omni-Path Fabric Switch Silicon 100 Series b152 21152 PCI-to-PCI Bridge @@ -28605,6 +28706,7 @@ f1d0 AJA Video cafe Kona SD cfee Xena LS/SD-22-DA/SD-DA daff KONA LHi + db09 Corvid 24 dcaf Kona HD dfee Xena HD-DA efac Xena SD-MM/SD-22-MM diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 81aad40a96f2..de2981de36a1 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -410,6 +410,63 @@ If foo has multiple source files, add the line: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The include file, <bsd.snmpmod.mk>, handles building MIB modules for bsnmpd +from one or more source files, along with their manual pages. It has a +limited number of suffixes, consistent with the current needs of the BSD +tree. + +bsd.snmpmod.mk leverages bsd.lib.mk for building MIB modules and +bsd.files.mk for installing MIB description and definition files. + +It has no additional targets. + +It sets/uses the following variables: + +BMIBS The MIB definitions to install. + +BMIBSDIR The directory where the MIB definitions are installed. + This defaults to `${SHAREDIR}/snmp/mibs`. + +DEFS The MIB description files to install. + +DEFSDIR The directory where MIB description files are installed. + This defaults to `${SHAREDIR}/snmp/defs`. + +EXTRAMIBDEFS Extra MIB description files to use as input when + generating ${MOD}_oid.h and ${MOD}_tree.[ch]. + +EXTRAMIBSYMS Extra MIB definition files used only for extracting + symbols. + + EXTRAMIBSYMS are useful when resolving inter-module + dependencies and are useful with files containing only + enum-definitions. + + See ${MOD}_oid.h for more details. + +MOD The bsnmpd module name. + +XSYM MIB names to extract symbols for. See ${MOD}_oid.h for + more details. + +It generates the following files: + +${MOD}_tree.c A source file and header which programmatically describes +${MOD}_tree.h the MIB (type, OID name, ACCESS attributes, etc). + + The files are generated via "gensnmptree -p". + + See gensnmptree(1) for more details. + +${MOD}_oid.h A header which programmatically describes the MIB root and + MIB tables. + + The files are generated via "gensnmptree -e". + + See gensnmptree(1) for more details. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + The include file <bsd.subdir.mk> contains the default targets for building subdirectories. It has the same seven targets as <bsd.prog.mk>: all, clean, cleandir, depend, install, lint, and tags. For all of the directories diff --git a/sys/arm/ti/ti_sdhci.c b/sys/arm/ti/ti_sdhci.c index ed7f1e72dacc..abc71c8d4389 100644 --- a/sys/arm/ti/ti_sdhci.c +++ b/sys/arm/ti/ti_sdhci.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include <dev/mmc/mmcbrvar.h> #include <dev/sdhci/sdhci.h> +#include <dev/sdhci/sdhci_fdt_gpio.h> #include "sdhci_if.h" #include <arm/ti/ti_cpuid.h> @@ -61,7 +62,7 @@ __FBSDID("$FreeBSD$"); struct ti_sdhci_softc { device_t dev; - device_t gpio_dev; + struct sdhci_fdt_gpio * gpio; struct resource * mem_res; struct resource * irq_res; void * intr_cookie; @@ -362,20 +363,24 @@ static int ti_sdhci_get_ro(device_t brdev, device_t reqdev) { struct ti_sdhci_softc *sc = device_get_softc(brdev); - unsigned int readonly = 0; - /* If a gpio pin is configured, read it. */ - if (sc->gpio_dev != NULL) { - GPIO_PIN_GET(sc->gpio_dev, sc->wp_gpio_pin, &readonly); - } + return (sdhci_fdt_gpio_get_readonly(sc->gpio)); +} + +static bool +ti_sdhci_get_card_present(device_t dev, struct sdhci_slot *slot) +{ + struct ti_sdhci_softc *sc = device_get_softc(dev); - return (readonly); + return (sdhci_fdt_gpio_get_present(sc->gpio)); } static int ti_sdhci_detach(device_t dev) { + /* sdhci_fdt_gpio_teardown(sc->gpio); */ + return (EBUSY); } @@ -502,25 +507,6 @@ ti_sdhci_attach(device_t dev) } /* - * See if we've got a GPIO-based write detect pin. This is not the - * standard documented property for this, we added it in freebsd. - */ - if ((OF_getencprop(node, "mmchs-wp-gpio-pin", &prop, sizeof(prop))) <= 0) - sc->wp_gpio_pin = 0xffffffff; - else - sc->wp_gpio_pin = prop; - - if (sc->wp_gpio_pin != 0xffffffff) { - sc->gpio_dev = devclass_get_device(devclass_find("gpio"), 0); - if (sc->gpio_dev == NULL) - device_printf(dev, "Error: No GPIO device, " - "Write Protect pin will not function\n"); - else - GPIO_PIN_SETFLAGS(sc->gpio_dev, sc->wp_gpio_pin, - GPIO_PIN_INPUT); - } - - /* * Set the offset from the device's memory start to the MMCHS registers. * Also for OMAP4 disable high speed mode due to erratum ID i626. */ @@ -572,6 +558,8 @@ ti_sdhci_attach(device_t dev) goto fail; } + sc->gpio = sdhci_fdt_gpio_setup(sc->dev, &sc->slot); + /* Initialise the MMCHS hardware. */ ti_sdhci_hw_init(dev); @@ -706,6 +694,7 @@ static device_method_t ti_sdhci_methods[] = { DEVMETHOD(sdhci_write_2, ti_sdhci_write_2), DEVMETHOD(sdhci_write_4, ti_sdhci_write_4), DEVMETHOD(sdhci_write_multi_4, ti_sdhci_write_multi_4), + DEVMETHOD(sdhci_get_card_present, ti_sdhci_get_card_present), DEVMETHOD_END }; diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 1164b1315765..0c31ef9e8fff 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003-2009 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2015 Alexander Motin <mav@FreeBSD.org> + * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -2567,6 +2567,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct ctl_softc *softc = dev->si_drv1; + struct ctl_port *port; struct ctl_lun *lun; int retval; @@ -2778,6 +2779,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, #endif /* CTL_IO_DELAY */ break; } +#ifdef CTL_LEGACY_STATS case CTL_GETSTATS: { struct ctl_stats *stats = (struct ctl_stats *)addr; int i; @@ -2790,26 +2792,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, stats->status = CTL_SS_OK; stats->fill_len = 0; STAILQ_FOREACH(lun, &softc->lun_list, links) { - if (stats->fill_len + sizeof(lun->stats) > + if (stats->fill_len + sizeof(lun->legacy_stats) > stats->alloc_len) { stats->status = CTL_SS_NEED_MORE_SPACE; break; } - retval = copyout(&lun->stats, &stats->lun_stats[i++], - sizeof(lun->stats)); + retval = copyout(&lun->legacy_stats, &stats->lun_stats[i++], + sizeof(lun->legacy_stats)); if (retval != 0) break; - stats->fill_len += sizeof(lun->stats); + stats->fill_len += sizeof(lun->legacy_stats); } stats->num_luns = softc->num_luns; -#ifdef CTL_TIME_IO - stats->flags = CTL_STATS_FLAG_TIME_VALID; -#else stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; #endif getnanouptime(&stats->timestamp); break; } +#endif /* CTL_LEGACY_STATS */ case CTL_ERROR_INJECT: { struct ctl_error_desc *err_desc, *new_err_desc; @@ -3397,6 +3399,72 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, ctl_isc_announce_port(port); break; } + case CTL_GET_LUN_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + if (lun->lun < stats->first_item) + continue; + if (stats->fill_len + sizeof(lun->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&lun->stats, &stats->stats[i++], + sizeof(lun->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(lun->stats); + } + stats->num_items = softc->num_luns; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } + case CTL_GET_PORT_STATS: { + struct ctl_get_io_stats *stats = (struct ctl_get_io_stats *)addr; + int i; + + /* + * XXX KDM no locking here. If the LUN list changes, + * things can blow up. + */ + i = 0; + stats->status = CTL_SS_OK; + stats->fill_len = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if (port->targ_port < stats->first_item) + continue; + if (stats->fill_len + sizeof(port->stats) > + stats->alloc_len) { + stats->status = CTL_SS_NEED_MORE_SPACE; + break; + } + retval = copyout(&port->stats, &stats->stats[i++], + sizeof(port->stats)); + if (retval != 0) + break; + stats->fill_len += sizeof(port->stats); + } + stats->num_items = softc->num_ports; + stats->flags = CTL_STATS_FLAG_NONE; +#ifdef CTL_TIME_IO + stats->flags |= CTL_STATS_FLAG_TIME_VALID; +#endif + getnanouptime(&stats->timestamp); + break; + } default: { /* XXX KDM should we fix this? */ #if 0 @@ -4391,7 +4459,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; const char *eui, *naa, *scsiname, *uuid, *vendor, *value; - int lun_number, i, lun_malloced; + int lun_number, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; if (be_lun == NULL) @@ -4585,6 +4653,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); ctl_tpc_lun_init(lun); + if (lun->flags & CTL_LUN_REMOVABLE) { + lun->prevent = malloc((CTL_MAX_INITIATORS + 31) / 32 * 4, + M_CTL, M_WAITOK); + } /* * Initialize the mode and log page index. @@ -4609,13 +4681,16 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, ctl_softc->num_luns++; /* Setup statistics gathering */ - lun->stats.device_type = be_lun->lun_type; - lun->stats.lun_number = lun_number; - lun->stats.blocksize = be_lun->blocksize; +#ifdef CTL_LEGACY_STATS + lun->legacy_stats.device_type = be_lun->lun_type; + lun->legacy_stats.lun_number = lun_number; + lun->legacy_stats.blocksize = be_lun->blocksize; if (be_lun->blocksize == 0) - lun->stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; - for (i = 0;i < CTL_MAX_PORTS;i++) - lun->stats.ports[i].targ_port = i; + lun->legacy_stats.flags = CTL_LUN_STATS_NO_BLOCKSIZE; + for (len = 0; len < CTL_MAX_PORTS; len++) + lun->legacy_stats.ports[len].targ_port = len; +#endif /* CTL_LEGACY_STATS */ + lun->stats.item = lun_number; mtx_unlock(&ctl_softc->ctl_lock); @@ -4666,6 +4741,7 @@ ctl_free_lun(struct ctl_lun *lun) for (i = 0; i < CTL_MAX_PORTS; i++) free(lun->pr_keys[i], M_CTL); free(lun->write_buffer, M_CTL); + free(lun->prevent, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); @@ -5276,7 +5352,7 @@ ctl_prevent_allow(struct ctl_scsiio *ctsio) cdb = (struct scsi_prevent *)ctsio->cdb; - if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + if ((lun->flags & CTL_LUN_REMOVABLE) == 0 || lun->prevent == NULL) { ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -6680,9 +6756,7 @@ ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio, { struct ctl_lun *lun = CTL_LUN(ctsio); struct stat_page *data; - uint64_t rn, wn, rb, wb; - struct bintime rt, wt; - int i; + struct bintime *t; data = (struct stat_page *)page_index->page_data; @@ -6690,28 +6764,21 @@ ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio, data->sap.hdr.param_control = SLP_LBIN; data->sap.hdr.param_len = sizeof(struct scsi_log_stat_and_perf) - sizeof(struct scsi_log_param_header); - rn = wn = rb = wb = 0; - bintime_clear(&rt); - bintime_clear(&wt); - for (i = 0; i < CTL_MAX_PORTS; i++) { - rn += lun->stats.ports[i].operations[CTL_STATS_READ]; - wn += lun->stats.ports[i].operations[CTL_STATS_WRITE]; - rb += lun->stats.ports[i].bytes[CTL_STATS_READ]; - wb += lun->stats.ports[i].bytes[CTL_STATS_WRITE]; - bintime_add(&rt, &lun->stats.ports[i].time[CTL_STATS_READ]); - bintime_add(&wt, &lun->stats.ports[i].time[CTL_STATS_WRITE]); - } - scsi_u64to8b(rn, data->sap.read_num); - scsi_u64to8b(wn, data->sap.write_num); - if (lun->stats.blocksize > 0) { - scsi_u64to8b(wb / lun->stats.blocksize, - data->sap.recvieved_lba); - scsi_u64to8b(rb / lun->stats.blocksize, - data->sap.transmitted_lba); - } - scsi_u64to8b((uint64_t)rt.sec * 1000 + rt.frac / (UINT64_MAX / 1000), + scsi_u64to8b(lun->stats.operations[CTL_STATS_READ], + data->sap.read_num); + scsi_u64to8b(lun->stats.operations[CTL_STATS_WRITE], + data->sap.write_num); + if (lun->be_lun->blocksize > 0) { + scsi_u64to8b(lun->stats.bytes[CTL_STATS_WRITE] / + lun->be_lun->blocksize, data->sap.recvieved_lba); + scsi_u64to8b(lun->stats.bytes[CTL_STATS_READ] / + lun->be_lun->blocksize, data->sap.transmitted_lba); + } + t = &lun->stats.time[CTL_STATS_READ]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.read_int); - scsi_u64to8b((uint64_t)wt.sec * 1000 + wt.frac / (UINT64_MAX / 1000), + t = &lun->stats.time[CTL_STATS_WRITE]; + scsi_u64to8b((uint64_t)t->sec * 1000 + t->frac / (UINT64_MAX / 1000), data->sap.write_int); scsi_u64to8b(0, data->sap.weighted_num); scsi_u64to8b(0, data->sap.weighted_int); @@ -11872,8 +11939,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, union ctl_io *io, ctl_ua_type ua_type) ctl_clear_mask(lun->have_ca, i); #endif lun->prevent_count = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) - ctl_clear_mask(lun->prevent, i); + if (lun->prevent) { + for (i = 0; i < CTL_MAX_INITIATORS; i++) + ctl_clear_mask(lun->prevent, i); + } mtx_unlock(&lun->lun_lock); return (0); @@ -12019,7 +12088,7 @@ ctl_i_t_nexus_reset(union ctl_io *io) #endif if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx)) lun->flags &= ~CTL_LUN_RESERVED; - if (ctl_is_set(lun->prevent, initidx)) { + if (lun->prevent && ctl_is_set(lun->prevent, initidx)) { ctl_clear_mask(lun->prevent, initidx); lun->prevent_count--; } @@ -13046,13 +13115,13 @@ static void ctl_process_done(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); + struct ctl_port *port = CTL_PORT(io); struct ctl_lun *lun = CTL_LUN(io); void (*fe_done)(union ctl_io *io); union ctl_ha_msg msg; - uint32_t targ_port = io->io_hdr.nexus.targ_port; CTL_DEBUG_PRINT(("ctl_process_done\n")); - fe_done = softc->ctl_ports[targ_port]->fe_done; + fe_done = port->fe_done; #ifdef CTL_TIME_IO if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { @@ -13155,11 +13224,13 @@ ctl_process_done(union ctl_io *io) */ if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS && io->io_hdr.io_type == CTL_IO_SCSI) { -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif int type; +#ifdef CTL_TIME_IO + struct bintime bt; + getbinuptime(&bt); + bintime_sub(&bt, &io->io_hdr.start_bt); +#endif if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) type = CTL_STATS_READ; @@ -13169,18 +13240,38 @@ ctl_process_done(union ctl_io *io) else type = CTL_STATS_NO_IO; - lun->stats.ports[targ_port].bytes[type] += +#ifdef CTL_LEGACY_STATS + uint32_t targ_port = port->targ_port; + lun->legacy_stats.ports[targ_port].bytes[type] += io->scsiio.kern_total_len; - lun->stats.ports[targ_port].operations[type]++; + lun->legacy_stats.ports[targ_port].operations[type] ++; + lun->legacy_stats.ports[targ_port].num_dmas[type] += + io->io_hdr.num_dmas; #ifdef CTL_TIME_IO - bintime_add(&lun->stats.ports[targ_port].dma_time[type], + bintime_add(&lun->legacy_stats.ports[targ_port].dma_time[type], &io->io_hdr.dma_bt); - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.start_bt); - bintime_add(&lun->stats.ports[targ_port].time[type], &cur_bt); + bintime_add(&lun->legacy_stats.ports[targ_port].time[type], + &bt); #endif - lun->stats.ports[targ_port].num_dmas[type] += - io->io_hdr.num_dmas; +#endif /* CTL_LEGACY_STATS */ + + lun->stats.bytes[type] += io->scsiio.kern_total_len; + lun->stats.operations[type] ++; + lun->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&lun->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&lun->stats.time[type], &bt); +#endif + + mtx_lock(&port->port_lock); + port->stats.bytes[type] += io->scsiio.kern_total_len; + port->stats.operations[type] ++; + port->stats.dmas[type] += io->io_hdr.num_dmas; +#ifdef CTL_TIME_IO + bintime_add(&port->stats.dma_time[type], &io->io_hdr.dma_bt); + bintime_add(&port->stats.time[type], &bt); +#endif + mtx_unlock(&port->port_lock); } /* diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index 4177e2d0eba0..d8ada8377738 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org> + * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,54 +40,7 @@ #ifndef _CTL_BACKEND_H_ #define _CTL_BACKEND_H_ -/* - * XXX KDM move this to another header file? - */ -#define CTL_BE_NAME_LEN 32 - -/* - * The ID_REQ flag is used to say that the caller has requested a - * particular LUN ID in the req_lun_id field. If we cannot allocate that - * LUN ID, the ctl_add_lun() call will fail. - * - * The STOPPED flag tells us that the LUN should default to the powered - * off state. It will return 0x04,0x02 until it is powered up. ("Logical - * unit not ready, initializing command required.") - * - * The NO_MEDIA flag tells us that the LUN has no media inserted. - * - * The PRIMARY flag tells us that this LUN is registered as a Primary LUN - * which is accessible via the Master shelf controller in an HA. This flag - * being set indicates a Primary LUN. This flag being reset represents a - * Secondary LUN controlled by the Secondary controller in an HA - * configuration. Flag is applicable at this time to T_DIRECT types. - * - * The SERIAL_NUM flag tells us that the serial_num field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x80. - * - * The DEVID flag tells us that the device_id field is filled in and - * valid for use in SCSI INQUIRY VPD page 0x83. - * - * The DEV_TYPE flag tells us that the device_type field is filled in. - * - * The EJECTED flag tells us that the removable LUN has tray open. - * - * The UNMAP flag tells us that this LUN supports UNMAP. - * - * The OFFLINE flag tells us that this LUN can not access backing store. - */ -typedef enum { - CTL_LUN_FLAG_ID_REQ = 0x01, - CTL_LUN_FLAG_STOPPED = 0x02, - CTL_LUN_FLAG_NO_MEDIA = 0x04, - CTL_LUN_FLAG_PRIMARY = 0x08, - CTL_LUN_FLAG_SERIAL_NUM = 0x10, - CTL_LUN_FLAG_DEVID = 0x20, - CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80, - CTL_LUN_FLAG_EJECTED = 0x100, - CTL_LUN_FLAG_READONLY = 0x200 -} ctl_backend_lun_flags; +#include <cam/ctl/ctl_ioctl.h> typedef enum { CTL_LUN_SERSEQ_OFF, diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c index 97f4e0ba44b4..03ee9da7566f 100644 --- a/sys/cam/ctl/ctl_frontend.c +++ b/sys/cam/ctl/ctl_frontend.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,13 +193,14 @@ error: mtx_unlock(&softc->ctl_lock); return (retval); } + port->targ_port = port_num; port->ctl_pool_ref = pool; - if (port->options.stqh_first == NULL) STAILQ_INIT(&port->options); + port->stats.item = port_num; + mtx_init(&port->port_lock, "CTL port", NULL, MTX_DEF); mtx_lock(&softc->ctl_lock); - port->targ_port = port_num; STAILQ_INSERT_TAIL(&port->frontend->port_list, port, fe_links); for (tport = NULL, nport = STAILQ_FIRST(&softc->port_list); nport != NULL && nport->targ_port < port_num; @@ -218,17 +220,11 @@ int ctl_port_deregister(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; - struct ctl_io_pool *pool; - int retval, i; - - retval = 0; - - pool = (struct ctl_io_pool *)port->ctl_pool_ref; + struct ctl_io_pool *pool = (struct ctl_io_pool *)port->ctl_pool_ref; + int i; - if (port->targ_port == -1) { - retval = 1; - goto bailout; - } + if (port->targ_port == -1) + return (1); mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->port_list, port, ctl_port, links); @@ -251,9 +247,9 @@ ctl_port_deregister(struct ctl_port *port) for (i = 0; i < port->max_initiators; i++) free(port->wwpn_iid[i].name, M_CTL); free(port->wwpn_iid, M_CTL); + mtx_destroy(&port->port_lock); -bailout: - return (retval); + return (0); } void diff --git a/sys/cam/ctl/ctl_frontend.h b/sys/cam/ctl/ctl_frontend.h index 3e42ac362edc..37e6824eaa8d 100644 --- a/sys/cam/ctl/ctl_frontend.h +++ b/sys/cam/ctl/ctl_frontend.h @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +40,8 @@ #ifndef _CTL_FRONTEND_H_ #define _CTL_FRONTEND_H_ +#include <cam/ctl/ctl_ioctl.h> + typedef enum { CTL_PORT_STATUS_NONE = 0x00, CTL_PORT_STATUS_ONLINE = 0x01, @@ -243,6 +246,8 @@ struct ctl_port { struct ctl_devid *port_devid; /* passed to CTL */ struct ctl_devid *target_devid; /* passed to CTL */ struct ctl_devid *init_devid; /* passed to CTL */ + struct ctl_io_stats stats; /* used by CTL */ + struct mtx port_lock; /* used by CTL */ STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ STAILQ_ENTRY(ctl_port) links; /* used by CTL */ }; diff --git a/sys/cam/ctl/ctl_ioctl.h b/sys/cam/ctl/ctl_ioctl.h index 80a9c2c1f5dd..1fe199df6f8e 100644 --- a/sys/cam/ctl/ctl_ioctl.h +++ b/sys/cam/ctl/ctl_ioctl.h @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2011 Spectra Logic Corporation + * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,6 +81,9 @@ /* Hopefully this won't conflict with new misc devices that pop up */ #define CTL_MINOR 225 +/* Legacy statistics accumulated for every port for every LU. */ +//#define CTL_LEGACY_STATS 1 + typedef enum { CTL_DELAY_TYPE_NONE, CTL_DELAY_TYPE_CONT, @@ -117,6 +121,18 @@ typedef enum { #define CTL_STATS_NUM_TYPES 3 typedef enum { + CTL_SS_OK, + CTL_SS_NEED_MORE_SPACE, + CTL_SS_ERROR +} ctl_stats_status; + +typedef enum { + CTL_STATS_FLAG_NONE = 0x00, + CTL_STATS_FLAG_TIME_VALID = 0x01 +} ctl_stats_flags; + +#ifdef CTL_LEGACY_STATS +typedef enum { CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 } ctl_lun_stats_flags; @@ -137,17 +153,6 @@ struct ctl_lun_io_stats { struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; -typedef enum { - CTL_SS_OK, - CTL_SS_NEED_MORE_SPACE, - CTL_SS_ERROR -} ctl_stats_status; - -typedef enum { - CTL_STATS_FLAG_NONE = 0x00, - CTL_STATS_FLAG_TIME_VALID = 0x01 -} ctl_stats_flags; - struct ctl_stats { int alloc_len; /* passed to kernel */ struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ @@ -157,6 +162,27 @@ struct ctl_stats { ctl_stats_flags flags; /* passed to userland */ struct timespec timestamp; /* passed to userland */ }; +#endif /* CTL_LEGACY_STATS */ + +struct ctl_io_stats { + uint32_t item; + uint64_t bytes[CTL_STATS_NUM_TYPES]; + uint64_t operations[CTL_STATS_NUM_TYPES]; + uint64_t dmas[CTL_STATS_NUM_TYPES]; + struct bintime time[CTL_STATS_NUM_TYPES]; + struct bintime dma_time[CTL_STATS_NUM_TYPES]; +}; + +struct ctl_get_io_stats { + struct ctl_io_stats *stats; /* passed to/from kernel */ + size_t alloc_len; /* passed to kernel */ + size_t fill_len; /* passed to userland */ + int first_item; /* passed to kernel */ + int num_items; /* passed to userland */ + ctl_stats_status status; /* passed to userland */ + ctl_stats_flags flags; /* passed to userland */ + struct timespec timestamp; /* passed to userland */ +}; /* * The types of errors that can be injected: @@ -342,12 +368,54 @@ typedef enum { CTL_LUNREQ_MODIFY, } ctl_lunreq_type; +/* + * The ID_REQ flag is used to say that the caller has requested a + * particular LUN ID in the req_lun_id field. If we cannot allocate that + * LUN ID, the ctl_add_lun() call will fail. + * + * The STOPPED flag tells us that the LUN should default to the powered + * off state. It will return 0x04,0x02 until it is powered up. ("Logical + * unit not ready, initializing command required.") + * + * The NO_MEDIA flag tells us that the LUN has no media inserted. + * + * The PRIMARY flag tells us that this LUN is registered as a Primary LUN + * which is accessible via the Master shelf controller in an HA. This flag + * being set indicates a Primary LUN. This flag being reset represents a + * Secondary LUN controlled by the Secondary controller in an HA + * configuration. Flag is applicable at this time to T_DIRECT types. + * + * The SERIAL_NUM flag tells us that the serial_num field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x80. + * + * The DEVID flag tells us that the device_id field is filled in and + * valid for use in SCSI INQUIRY VPD page 0x83. + * + * The DEV_TYPE flag tells us that the device_type field is filled in. + * + * The EJECTED flag tells us that the removable LUN has tray open. + * + * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. + */ +typedef enum { + CTL_LUN_FLAG_ID_REQ = 0x01, + CTL_LUN_FLAG_STOPPED = 0x02, + CTL_LUN_FLAG_NO_MEDIA = 0x04, + CTL_LUN_FLAG_PRIMARY = 0x08, + CTL_LUN_FLAG_SERIAL_NUM = 0x10, + CTL_LUN_FLAG_DEVID = 0x20, + CTL_LUN_FLAG_DEV_TYPE = 0x40, + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_EJECTED = 0x100, + CTL_LUN_FLAG_READONLY = 0x200 +} ctl_backend_lun_flags; /* * LUN creation parameters: * - * flags: Various LUN flags, see ctl_backend.h for a - * description of the flag values and meanings. + * flags: Various LUN flags, see above. * * device_type: The SCSI device type. e.g. 0 for Direct Access, * 3 for Processor, etc. Only certain backends may @@ -465,6 +533,7 @@ union ctl_lunreq_data { * kern_be_args: For kernel use only. */ struct ctl_lun_req { +#define CTL_BE_NAME_LEN 32 char backend[CTL_BE_NAME_LEN]; ctl_lunreq_type reqtype; union ctl_lunreq_data reqdata; @@ -777,6 +846,8 @@ struct ctl_lun_map { #define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req) #define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list) #define CTL_LUN_MAP _IOW(CTL_MINOR, 0x28, struct ctl_lun_map) +#define CTL_GET_LUN_STATS _IOWR(CTL_MINOR, 0x29, struct ctl_get_io_stats) +#define CTL_GET_PORT_STATS _IOWR(CTL_MINOR, 0x2a, struct ctl_get_io_stats) #endif /* _CTL_IOCTL_H_ */ diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index e118343d9f58..3f46769806b1 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2008 Silicon Graphics International Corp. - * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org> + * Copyright (c) 2014-2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -404,7 +404,10 @@ struct ctl_lun { struct callout ie_callout; /* INTERVAL TIMER */ struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages; - struct ctl_lun_io_stats stats; +#ifdef CTL_LEGACY_STATS + struct ctl_lun_io_stats legacy_stats; +#endif /* CTL_LEGACY_STATS */ + struct ctl_io_stats stats; uint32_t res_idx; uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; @@ -412,7 +415,7 @@ struct ctl_lun { uint32_t pr_res_idx; uint8_t pr_res_type; int prevent_count; - uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; + uint32_t *prevent; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; diff --git a/sys/conf/files b/sys/conf/files index 2f208e6c51cb..3abe344cfa78 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2824,6 +2824,7 @@ dev/scc/scc_dev_quicc.c optional scc quicc dev/scc/scc_dev_sab82532.c optional scc dev/scc/scc_dev_z8530.c optional scc dev/sdhci/sdhci.c optional sdhci +dev/sdhci/sdhci_fdt_gpio.c optional sdhci fdt gpio dev/sdhci/sdhci_if.m optional sdhci dev/sdhci/sdhci_pci.c optional sdhci pci dev/sf/if_sf.c optional sf pci diff --git a/sys/dev/etherswitch/etherswitch.c b/sys/dev/etherswitch/etherswitch.c index 0c35002d22f5..ee9b71086bed 100644 --- a/sys/dev/etherswitch/etherswitch.c +++ b/sys/dev/etherswitch/etherswitch.c @@ -99,17 +99,24 @@ etherswitch_probe(device_t dev) static int etherswitch_attach(device_t dev) { - struct etherswitch_softc *sc = (struct etherswitch_softc *)device_get_softc(dev); + int err; + struct etherswitch_softc *sc; + struct make_dev_args devargs; + sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_devnode = make_dev(ðerswitch_cdevsw, device_get_unit(dev), - UID_ROOT, GID_WHEEL, - 0600, "etherswitch%d", device_get_unit(dev)); - if (sc->sc_devnode == NULL) { + make_dev_args_init(&devargs); + devargs.mda_devsw = ðerswitch_cdevsw; + devargs.mda_uid = UID_ROOT; + devargs.mda_gid = GID_WHEEL; + devargs.mda_mode = 0600; + devargs.mda_si_drv1 = sc; + err = make_dev_s(&devargs, &sc->sc_devnode, "etherswitch%d", + device_get_unit(dev)); + if (err != 0) { device_printf(dev, "failed to create character device\n"); return (ENXIO); } - sc->sc_devnode->si_drv1 = sc; return (0); } diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c index 828abc3e2b1b..a5a9d8164781 100644 --- a/sys/dev/gpio/gpioc.c +++ b/sys/dev/gpio/gpioc.c @@ -78,18 +78,25 @@ gpioc_probe(device_t dev) static int gpioc_attach(device_t dev) { - struct gpioc_softc *sc = device_get_softc(dev); + int err; + struct gpioc_softc *sc; + struct make_dev_args devargs; + sc = device_get_softc(dev); sc->sc_dev = dev; sc->sc_pdev = device_get_parent(dev); sc->sc_unit = device_get_unit(dev); - sc->sc_ctl_dev = make_dev(&gpioc_cdevsw, sc->sc_unit, - UID_ROOT, GID_WHEEL, 0600, "gpioc%d", sc->sc_unit); - if (!sc->sc_ctl_dev) { + make_dev_args_init(&devargs); + devargs.mda_devsw = &gpioc_cdevsw; + devargs.mda_uid = UID_ROOT; + devargs.mda_gid = GID_WHEEL; + devargs.mda_mode = 0600; + devargs.mda_si_drv1 = sc; + err = make_dev_s(&devargs, &sc->sc_ctl_dev, "gpioc%d", sc->sc_unit); + if (err != 0) { printf("Failed to create gpioc%d", sc->sc_unit); return (ENXIO); } - sc->sc_ctl_dev->si_drv1 = sc; return (0); } diff --git a/sys/dev/hyperv/include/hyperv.h b/sys/dev/hyperv/include/hyperv.h index 0eda9f0691a3..f0161fc1d9d0 100644 --- a/sys/dev/hyperv/include/hyperv.h +++ b/sys/dev/hyperv/include/hyperv.h @@ -79,9 +79,17 @@ struct hyperv_guid { #define HYPERV_GUID_STRLEN 40 -int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); +typedef uint64_t (*hyperv_tc64_t)(void); -extern u_int hyperv_features; /* CPUID_HV_MSR_ */ +int hyperv_guid2str(const struct hyperv_guid *, char *, + size_t); + +/* + * hyperv_tc64 could be NULL, if there were no suitable Hyper-V + * specific timecounter. + */ +extern hyperv_tc64_t hyperv_tc64; +extern u_int hyperv_features; /* CPUID_HV_MSR_ */ #endif /* _KERNEL */ diff --git a/sys/dev/hyperv/utilities/vmbus_timesync.c b/sys/dev/hyperv/utilities/vmbus_timesync.c index 7610027f2a98..66b1e48af79d 100644 --- a/sys/dev/hyperv/utilities/vmbus_timesync.c +++ b/sys/dev/hyperv/utilities/vmbus_timesync.c @@ -52,8 +52,7 @@ __FBSDID("$FreeBSD$"); VMBUS_ICVER_LE(VMBUS_IC_VERSION(4, 0), (sc)->ic_msgver) #define VMBUS_TIMESYNC_DORTT(sc) \ - (VMBUS_TIMESYNC_MSGVER4((sc)) &&\ - (hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) + (VMBUS_TIMESYNC_MSGVER4((sc)) && hyperv_tc64 != NULL) static int vmbus_timesync_probe(device_t); static int vmbus_timesync_attach(device_t); @@ -117,7 +116,7 @@ vmbus_timesync(struct vmbus_ic_softc *sc, uint64_t hvtime, uint64_t sent_tc, uint64_t hv_ns, vm_ns, rtt = 0; if (VMBUS_TIMESYNC_DORTT(sc)) - rtt = rdmsr(MSR_HV_TIME_REF_COUNT) - sent_tc; + rtt = hyperv_tc64() - sent_tc; hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE + rtt) * HYPERV_TIMER_NS_FACTOR; nanotime(&vm_ts); diff --git a/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c b/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c index cb815bb163c5..d1c1b83f5935 100644 --- a/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c +++ b/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c @@ -133,8 +133,8 @@ hyperv_tsc_vdso_timehands(struct vdso_timehands *vdso_th, } #define HYPERV_TSC_TIMECOUNT(fence) \ -static u_int \ -hyperv_tsc_timecount_##fence(struct timecounter *tc) \ +static uint64_t \ +hyperv_tc64_tsc_##fence(void) \ { \ struct hyperv_reftsc *tsc_ref = hyperv_ref_tsc.tsc_ref; \ uint32_t seq; \ @@ -162,6 +162,13 @@ hyperv_tsc_timecount_##fence(struct timecounter *tc) \ /* Fallback to the generic timecounter, i.e. rdmsr. */ \ return (rdmsr(MSR_HV_TIME_REF_COUNT)); \ } \ + \ +static u_int \ +hyperv_tsc_timecount_##fence(struct timecounter *tc __unused) \ +{ \ + \ + return (hyperv_tc64_tsc_##fence()); \ +} \ struct __hack HYPERV_TSC_TIMECOUNT(lfence); @@ -170,6 +177,7 @@ HYPERV_TSC_TIMECOUNT(mfence); static void hyperv_tsc_tcinit(void *dummy __unused) { + hyperv_tc64_t tc64 = NULL; uint64_t val, orig; if ((hyperv_features & @@ -182,11 +190,13 @@ hyperv_tsc_tcinit(void *dummy __unused) case CPU_VENDOR_AMD: hyperv_tsc_timecounter.tc_get_timecount = hyperv_tsc_timecount_mfence; + tc64 = hyperv_tc64_tsc_mfence; break; case CPU_VENDOR_INTEL: hyperv_tsc_timecounter.tc_get_timecount = hyperv_tsc_timecount_lfence; + tc64 = hyperv_tc64_tsc_lfence; break; default: @@ -211,6 +221,10 @@ hyperv_tsc_tcinit(void *dummy __unused) /* Register "enlightened" timecounter. */ tc_init(&hyperv_tsc_timecounter); + /* Install 64 bits timecounter method for other modules to use. */ + KASSERT(tc64 != NULL, ("tc64 is not set")); + hyperv_tc64 = tc64; + /* Add device for mmap(2). */ make_dev(&hyperv_tsc_cdevsw, 0, UID_ROOT, GID_WHEEL, 0444, HYPERV_REFTSC_DEVNAME); diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c index 2df313b73507..144bff5a87d8 100644 --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -77,6 +77,8 @@ u_int hyperv_recommends; static u_int hyperv_pm_features; static u_int hyperv_features3; +hyperv_tc64_t hyperv_tc64; + static struct timecounter hyperv_timecounter = { .tc_get_timecount = hyperv_get_timecount, .tc_poll_pps = NULL, @@ -96,6 +98,13 @@ hyperv_get_timecount(struct timecounter *tc __unused) return rdmsr(MSR_HV_TIME_REF_COUNT); } +static uint64_t +hyperv_tc64_rdmsr(void) +{ + + return (rdmsr(MSR_HV_TIME_REF_COUNT)); +} + uint64_t hypercall_post_message(bus_addr_t msg_paddr) { @@ -232,6 +241,12 @@ hyperv_init(void *dummy __unused) if (hyperv_features & CPUID_HV_MSR_TIME_REFCNT) { /* Register Hyper-V timecounter */ tc_init(&hyperv_timecounter); + + /* + * Install 64 bits timecounter method for other modules + * to use. + */ + hyperv_tc64 = hyperv_tc64_rdmsr; } } SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, diff --git a/sys/dev/hyperv/vmbus/vmbus_et.c b/sys/dev/hyperv/vmbus/vmbus_et.c index feb639c06fec..722e5bf2103c 100644 --- a/sys/dev/hyperv/vmbus/vmbus_et.c +++ b/sys/dev/hyperv/vmbus/vmbus_et.c @@ -48,13 +48,10 @@ __FBSDID("$FreeBSD$"); MSR_HV_STIMER_CFG_SINT_MASK) /* - * Two additionally required features: + * Additionally required feature: * - SynIC is needed for interrupt generation. - * - Time reference counter is needed to set ABS reference count to - * STIMER0_COUNT. */ -#define CPUID_HV_ET_MASK (CPUID_HV_MSR_TIME_REFCNT | \ - CPUID_HV_MSR_SYNIC | \ +#define CPUID_HV_ET_MASK (CPUID_HV_MSR_SYNIC | \ CPUID_HV_MSR_SYNTIMER) static void vmbus_et_identify(driver_t *, device_t); @@ -102,7 +99,7 @@ vmbus_et_start(struct eventtimer *et __unused, sbintime_t first, { uint64_t current; - current = rdmsr(MSR_HV_TIME_REF_COUNT); + current = hyperv_tc64(); current += hyperv_sbintime2count(first); wrmsr(MSR_HV_STIMER0_COUNT, current); @@ -131,7 +128,8 @@ vmbus_et_identify(driver_t *driver, device_t parent) { if (device_get_unit(parent) != 0 || device_find_child(parent, VMBUS_ET_NAME, -1) != NULL || - (hyperv_features & CPUID_HV_ET_MASK) != CPUID_HV_ET_MASK) + (hyperv_features & CPUID_HV_ET_MASK) != CPUID_HV_ET_MASK || + hyperv_tc64 == NULL) return; device_add_child(parent, VMBUS_ET_NAME, -1); @@ -187,9 +185,8 @@ vmbus_et_attach(device_t dev) vmbus_et.et_start = vmbus_et_start; /* - * Delay a bit to make sure that MSR_HV_TIME_REF_COUNT will - * not return 0, since writing 0 to STIMER0_COUNT will disable - * STIMER0. + * Delay a bit to make sure that hyperv_tc64 will not return 0, + * since writing 0 to STIMER0_COUNT will disable STIMER0. */ DELAY(100); smp_rendezvous(NULL, vmbus_et_config, NULL, NULL); diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 77491234ca85..3132c21aea01 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -545,6 +545,8 @@ mmcsd_task(void *arg) bp->bio_error = EIO; bp->bio_resid = (end - block) * sz; bp->bio_flags |= BIO_ERROR; + } else { + bp->bio_resid = 0; } biodone(bp); } diff --git a/sys/dev/rtwn/if_rtwnvar.h b/sys/dev/rtwn/if_rtwnvar.h index f2d13dfa7dd0..642cdbf2f899 100644 --- a/sys/dev/rtwn/if_rtwnvar.h +++ b/sys/dev/rtwn/if_rtwnvar.h @@ -25,7 +25,6 @@ #define RTWN_TX_DESC_SIZE 64 -#define RTWN_RXBUFSZ (8 * 1024) #define RTWN_TXBUFSZ (16 * 1024) #define RTWN_BCN_MAX_SIZE 512 diff --git a/sys/dev/rtwn/usb/rtwn_usb_attach.c b/sys/dev/rtwn/usb/rtwn_usb_attach.c index 9a3ba9ea1ea8..6beed50ab357 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_attach.c +++ b/sys/dev/rtwn/usb/rtwn_usb_attach.c @@ -133,8 +133,9 @@ rtwn_usb_alloc_rx_list(struct rtwn_softc *sc) struct rtwn_usb_softc *uc = RTWN_USB_SOFTC(sc); int error, i; + /* XXX recheck */ error = rtwn_usb_alloc_list(sc, uc->uc_rx, RTWN_USB_RX_LIST_COUNT, - RTWN_RXBUFSZ); + sc->rx_dma_size + 1024); if (error != 0) return (error); diff --git a/sys/dev/rtwn/usb/rtwn_usb_ep.c b/sys/dev/rtwn/usb/rtwn_usb_ep.c index 8694e33dd2d1..328e5bd36e1a 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_ep.c +++ b/sys/dev/rtwn/usb/rtwn_usb_ep.c @@ -63,7 +63,6 @@ static struct usb_config rtwn_config[RTWN_N_TRANSFER] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = RTWN_RXBUFSZ, .flags = { .pipe_bof = 1, .short_xfer_ok = 1 @@ -222,6 +221,7 @@ rtwn_usb_setup_endpoints(struct rtwn_usb_softc *uc) break; } + rtwn_config[RTWN_BULK_RX].bufsize = sc->rx_dma_size + 1024; error = usbd_transfer_setup(uc->uc_udev, &iface_index, uc->uc_xfer, rtwn_config, RTWN_N_TRANSFER, uc, &sc->sc_mtx); if (error) { diff --git a/sys/dev/rtwn/usb/rtwn_usb_rx.c b/sys/dev/rtwn/usb/rtwn_usb_rx.c index f15d6c662525..1a8345933ee0 100644 --- a/sys/dev/rtwn/usb/rtwn_usb_rx.c +++ b/sys/dev/rtwn/usb/rtwn_usb_rx.c @@ -158,8 +158,12 @@ rtwn_rxeof(struct rtwn_softc *sc, uint8_t *buf, int len) /* Make sure everything fits in xfer. */ totlen = sizeof(*stat) + infosz + pktlen; - if (totlen > len) + if (totlen > len) { + device_printf(sc->sc_dev, + "%s: totlen (%d) > len (%d)!\n", + __func__, totlen, len); break; + } if (m0 == NULL) m0 = m = rtwn_rx_copy_to_mbuf(sc, stat, totlen); diff --git a/sys/dev/sdhci/fsl_sdhci.c b/sys/dev/sdhci/fsl_sdhci.c index 4e667bd04b73..7e9a983749b5 100644 --- a/sys/dev/sdhci/fsl_sdhci.c +++ b/sys/dev/sdhci/fsl_sdhci.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include <arm/freescale/imx/imx_ccmvar.h> #endif +#include <dev/gpio/gpiobusvar.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> @@ -67,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include <dev/mmc/mmcbrvar.h> #include <dev/sdhci/sdhci.h> +#include <dev/sdhci/sdhci_fdt_gpio.h> #include "sdhci_if.h" struct fsl_sdhci_softc { @@ -77,10 +79,10 @@ struct fsl_sdhci_softc { struct sdhci_slot slot; struct callout r1bfix_callout; sbintime_t r1bfix_timeout_at; + struct sdhci_fdt_gpio * gpio; uint32_t baseclk_hz; uint32_t cmd_and_mode; uint32_t r1bfix_intmask; - boolean_t force_card_present; uint16_t sdclockreg_freq_bits; uint8_t r1bfix_type; uint8_t hwtype; @@ -345,8 +347,6 @@ fsl_sdhci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) val32 &= 0x000F0F07; val32 |= (wrk32 >> 4) & SDHCI_STATE_DAT_MASK; val32 |= (wrk32 >> 9) & SDHCI_RETUNE_REQUEST; - if (sc->force_card_present) - val32 |= SDHCI_CARD_PRESENT; return (val32); } @@ -752,9 +752,15 @@ fsl_sdhci_get_ro(device_t bus, device_t child) { struct fsl_sdhci_softc *sc = device_get_softc(bus); - if (RD4(sc, SDHCI_PRESENT_STATE) & SDHC_PRES_WPSPL) - return (false); - return (true); + return (sdhci_fdt_gpio_get_readonly(sc->gpio)); +} + +static bool +fsl_sdhci_get_card_present(device_t dev, struct sdhci_slot *slot) +{ + struct fsl_sdhci_softc *sc = device_get_softc(dev); + + return (sdhci_fdt_gpio_get_present(sc->gpio)); } #ifdef __powerpc__ @@ -802,6 +808,7 @@ static int fsl_sdhci_detach(device_t dev) { + /* sdhci_fdt_gpio_teardown(sc->gpio); */ return (EBUSY); } @@ -810,8 +817,8 @@ fsl_sdhci_attach(device_t dev) { struct fsl_sdhci_softc *sc = device_get_softc(dev); int rid, err; - phandle_t node; #ifdef __powerpc__ + phandle_t node; uint32_t protctl; #endif @@ -887,24 +894,13 @@ fsl_sdhci_attach(device_t dev) sc->slot.max_clk = sc->baseclk_hz; /* - * If the slot is flagged with the non-removable property, set our flag - * to always force the SDHCI_CARD_PRESENT bit on. - * - * XXX Workaround for gpio-based card detect... - * - * We don't have gpio support yet. If there's a cd-gpios property just - * force the SDHCI_CARD_PRESENT bit on for now. If there isn't really a - * card there it will fail to probe at the mmc layer and nothing bad - * happens except instantiating an mmcN device for an empty slot. + * Set up any gpio pin handling described in the FDT data. This cannot + * fail; see comments in sdhci_fdt_gpio.h for details. */ - node = ofw_bus_get_node(dev); - if (OF_hasprop(node, "non-removable")) - sc->force_card_present = true; - else if (OF_hasprop(node, "cd-gpios")) { - /* XXX put real gpio hookup here. */ - sc->force_card_present = true; - } + sc->gpio = sdhci_fdt_gpio_setup(dev, &sc->slot); + #ifdef __powerpc__ + node = ofw_bus_get_node(dev); /* Default to big-endian on powerpc */ protctl = RD4(sc, SDHC_PROT_CTRL); protctl &= ~SDHC_PROT_EMODE_MASK; @@ -974,7 +970,7 @@ static device_method_t fsl_sdhci_methods[] = { DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), - /* SDHCI registers accessors */ + /* SDHCI accessors */ DEVMETHOD(sdhci_read_1, fsl_sdhci_read_1), DEVMETHOD(sdhci_read_2, fsl_sdhci_read_2), DEVMETHOD(sdhci_read_4, fsl_sdhci_read_4), @@ -983,6 +979,7 @@ static device_method_t fsl_sdhci_methods[] = { DEVMETHOD(sdhci_write_2, fsl_sdhci_write_2), DEVMETHOD(sdhci_write_4, fsl_sdhci_write_4), DEVMETHOD(sdhci_write_multi_4, fsl_sdhci_write_multi_4), + DEVMETHOD(sdhci_get_card_present,fsl_sdhci_get_card_present), { 0, 0 } }; diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 07828a3690ca..94db7ebc8b1d 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -73,6 +73,7 @@ static void sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock); static void sdhci_start(struct sdhci_slot *slot); static void sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data); +static void sdhci_card_poll(void *); static void sdhci_card_task(void *, int); /* helper routines */ @@ -89,6 +90,9 @@ static void sdhci_card_task(void *, int); #define SDHCI_200_MAX_DIVIDER 256 #define SDHCI_300_MAX_DIVIDER 2046 +#define SDHCI_CARD_PRESENT_TICKS (hz / 5) +#define SDHCI_INSERT_DELAY_TICKS (hz / 2) + /* * Broadcom BCM577xx Controller Constants */ @@ -229,10 +233,15 @@ sdhci_init(struct sdhci_slot *slot) slot->intmask = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT | - SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT | SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DMA_END | SDHCI_INT_DATA_END | SDHCI_INT_RESPONSE | SDHCI_INT_ACMD12ERR; + + if (!(slot->quirks & SDHCI_QUIRK_POLL_CARD_PRESENT) && + !(slot->opt & SDHCI_NON_REMOVABLE)) { + slot->intmask |= SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT; + } + WR4(slot, SDHCI_INT_ENABLE, slot->intmask); WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -367,6 +376,13 @@ sdhci_set_power(struct sdhci_slot *slot, u_char power) /* Turn on the power. */ pwr |= SDHCI_POWER_ON; WR1(slot, SDHCI_POWER_CONTROL, pwr); + + if (slot->quirks & SDHCI_QUIRK_INTEL_POWER_UP_RESET) { + WR1(slot, SDHCI_POWER_CONTROL, pwr | 0x10); + DELAY(10); + WR1(slot, SDHCI_POWER_CONTROL, pwr); + DELAY(300); + } } static void @@ -474,14 +490,6 @@ sdhci_transfer_pio(struct sdhci_slot *slot) } } -static void -sdhci_card_delay(void *arg) -{ - struct sdhci_slot *slot = arg; - - taskqueue_enqueue(taskqueue_swi_giant, &slot->card_task); -} - static void sdhci_card_task(void *arg, int pending) { @@ -491,6 +499,8 @@ sdhci_card_task(void *arg, int pending) if (SDHCI_GET_CARD_PRESENT(slot->bus, slot)) { if (slot->dev == NULL) { /* If card is present - attach mmc bus. */ + if (bootverbose || sdhci_debug) + slot_printf(slot, "Card inserted\n"); slot->dev = device_add_child(slot->bus, "mmc", -1); device_set_ivars(slot->dev, slot); SDHCI_UNLOCK(slot); @@ -500,6 +510,8 @@ sdhci_card_task(void *arg, int pending) } else { if (slot->dev != NULL) { /* If no card present - detach mmc bus. */ + if (bootverbose || sdhci_debug) + slot_printf(slot, "Card removed\n"); device_t d = slot->dev; slot->dev = NULL; SDHCI_UNLOCK(slot); @@ -509,6 +521,51 @@ sdhci_card_task(void *arg, int pending) } } +static void +sdhci_handle_card_present_locked(struct sdhci_slot *slot, bool is_present) +{ + bool was_present; + + /* + * If there was no card and now there is one, schedule the task to + * create the child device after a short delay. The delay is to + * debounce the card insert (sometimes the card detect pin stabilizes + * before the other pins have made good contact). + * + * If there was a card present and now it's gone, immediately schedule + * the task to delete the child device. No debouncing -- gone is gone, + * because once power is removed, a full card re-init is needed, and + * that happens by deleting and recreating the child device. + */ + was_present = slot->dev != NULL; + if (!was_present && is_present) { + taskqueue_enqueue_timeout(taskqueue_swi_giant, + &slot->card_delayed_task, -SDHCI_INSERT_DELAY_TICKS); + } else if (was_present && !is_present) { + taskqueue_enqueue(taskqueue_swi_giant, &slot->card_task); + } +} + +void +sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present) +{ + + SDHCI_LOCK(slot); + sdhci_handle_card_present_locked(slot, is_present); + SDHCI_UNLOCK(slot); +} + +static void +sdhci_card_poll(void *arg) +{ + struct sdhci_slot *slot = arg; + + sdhci_handle_card_present(slot, + SDHCI_GET_CARD_PRESENT(slot->bus, slot)); + callout_reset(&slot->card_poll_callout, SDHCI_CARD_PRESENT_TICKS, + sdhci_card_poll, slot); +} + int sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) { @@ -579,9 +636,11 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) device_printf(dev, "Hardware doesn't specify base clock " "frequency, using %dMHz as default.\n", SDHCI_DEFAULT_MAX_FREQ); } - /* Calculate timeout clock frequency. */ + /* Calculate/set timeout clock frequency. */ if (slot->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) { slot->timeout_clk = slot->max_clk / 1000; + } else if (slot->quirks & SDHCI_QUIRK_DATA_TIMEOUT_1MHZ) { + slot->timeout_clk = 1000; } else { slot->timeout_clk = (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; @@ -625,6 +684,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) slot->opt &= ~SDHCI_HAVE_DMA; if (slot->quirks & SDHCI_QUIRK_FORCE_DMA) slot->opt |= SDHCI_HAVE_DMA; + if (slot->quirks & SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE) + slot->opt |= SDHCI_NON_REMOVABLE; /* * Use platform-provided transfer backend @@ -637,8 +698,9 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) slot_printf(slot, "%uMHz%s %s%s%s%s %s\n", slot->max_clk / 1000000, (caps & SDHCI_CAN_DO_HISPD) ? " HS" : "", - (caps & MMC_CAP_8_BIT_DATA) ? "8bits" : - ((caps & MMC_CAP_4_BIT_DATA) ? "4bits" : "1bit"), + (slot->host.caps & MMC_CAP_8_BIT_DATA) ? "8bits" : + ((slot->host.caps & MMC_CAP_4_BIT_DATA) ? "4bits" : + "1bit"), (caps & SDHCI_CAN_VDD_330) ? " 3.3V" : "", (caps & SDHCI_CAN_VDD_300) ? " 3.0V" : "", (caps & SDHCI_CAN_VDD_180) ? " 1.8V" : "", @@ -652,9 +714,17 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) "timeout", CTLFLAG_RW, &slot->timeout, 0, "Maximum timeout for SDHCI transfers (in secs)"); TASK_INIT(&slot->card_task, 0, sdhci_card_task, slot); - callout_init(&slot->card_callout, 1); + TIMEOUT_TASK_INIT(taskqueue_swi_giant, &slot->card_delayed_task, 0, + sdhci_card_task, slot); + callout_init(&slot->card_poll_callout, 1); callout_init_mtx(&slot->timeout_callout, &slot->mtx, 0); + if ((slot->quirks & SDHCI_QUIRK_POLL_CARD_PRESENT) && + !(slot->opt & SDHCI_NON_REMOVABLE)) { + callout_reset(&slot->card_poll_callout, + SDHCI_CARD_PRESENT_TICKS, sdhci_card_poll, slot); + } + return (0); } @@ -670,8 +740,9 @@ sdhci_cleanup_slot(struct sdhci_slot *slot) device_t d; callout_drain(&slot->timeout_callout); - callout_drain(&slot->card_callout); + callout_drain(&slot->card_poll_callout); taskqueue_drain(taskqueue_swi_giant, &slot->card_task); + taskqueue_drain_timeout(taskqueue_swi_giant, &slot->card_delayed_task); SDHCI_LOCK(slot); d = slot->dev; @@ -721,6 +792,9 @@ bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot) { + if (slot->opt & SDHCI_NON_REMOVABLE) + return true; + return (RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); } @@ -821,7 +895,7 @@ static void sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) { int flags, timeout; - uint32_t mask, state; + uint32_t mask; slot->curcmd = cmd; slot->cmd_done = 0; @@ -836,8 +910,6 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) return; } - /* Read controller present state. */ - state = RD4(slot, SDHCI_PRESENT_STATE); /* Do not issue command if there is no card, clock or power. * Controller will not detect timeout without clock active. */ if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot) || @@ -866,7 +938,7 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) * (It's usually more like 20-30ms in the real world.) */ timeout = 250; - while (state & mask) { + while (mask & RD4(slot, SDHCI_PRESENT_STATE)) { if (timeout == 0) { slot_printf(slot, "Controller never released " "inhibit bit(s).\n"); @@ -877,7 +949,6 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) } timeout--; DELAY(1000); - state = RD4(slot, SDHCI_PRESENT_STATE); } /* Prepare command flags. */ @@ -1329,7 +1400,7 @@ sdhci_generic_intr(struct sdhci_slot *slot) /* Handle card presence interrupts. */ if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { - present = SDHCI_GET_CARD_PRESENT(slot->bus, slot); + present = (intmask & SDHCI_INT_CARD_INSERT) != 0; slot->intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); slot->intmask |= present ? SDHCI_INT_CARD_REMOVE : @@ -1338,20 +1409,7 @@ sdhci_generic_intr(struct sdhci_slot *slot) WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask); WR4(slot, SDHCI_INT_STATUS, intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)); - - if (intmask & SDHCI_INT_CARD_REMOVE) { - if (bootverbose || sdhci_debug) - slot_printf(slot, "Card removed\n"); - callout_stop(&slot->card_callout); - taskqueue_enqueue(taskqueue_swi_giant, - &slot->card_task); - } - if (intmask & SDHCI_INT_CARD_INSERT) { - if (bootverbose || sdhci_debug) - slot_printf(slot, "Card inserted\n"); - callout_reset(&slot->card_callout, hz / 2, - sdhci_card_delay, slot); - } + sdhci_handle_card_present_locked(slot, present); intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); } /* Handle command interrupts. */ diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h index ecee9ed3d94d..4626816a538c 100644 --- a/sys/dev/sdhci/sdhci.h +++ b/sys/dev/sdhci/sdhci.h @@ -65,6 +65,14 @@ #define SDHCI_QUIRK_DONT_SET_HISPD_BIT (1<<15) /* Alternate clock source is required when supplying a 400 KHz clock. */ #define SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC (1<<16) +/* Card insert/remove interrupts don't work, polling required. */ +#define SDHCI_QUIRK_POLL_CARD_PRESENT (1<<17) +/* All controller slots are non-removable. */ +#define SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE (1<<18) +/* Issue custom Intel controller reset sequence after power-up. */ +#define SDHCI_QUIRK_INTEL_POWER_UP_RESET (1<<19) +/* Data timeout is invalid, use 1 MHz clock instead. */ +#define SDHCI_QUIRK_DATA_TIMEOUT_1MHZ (1<<20) /* * Controller registers @@ -273,8 +281,9 @@ struct sdhci_slot { device_t dev; /* Slot device */ u_char num; /* Slot number */ u_char opt; /* Slot options */ -#define SDHCI_HAVE_DMA 1 -#define SDHCI_PLATFORM_TRANSFER 2 +#define SDHCI_HAVE_DMA 0x01 +#define SDHCI_PLATFORM_TRANSFER 0x02 +#define SDHCI_NON_REMOVABLE 0x04 u_char version; int timeout; /* Transfer timeout */ uint32_t max_clk; /* Max possible freq */ @@ -284,7 +293,9 @@ struct sdhci_slot { u_char *dmamem; bus_addr_t paddr; /* DMA buffer address */ struct task card_task; /* Card presence check task */ - struct callout card_callout; /* Card insert delay callout */ + struct timeout_task + card_delayed_task;/* Card insert delayed task */ + struct callout card_poll_callout;/* Card present polling callout */ struct callout timeout_callout;/* Card command/data response timeout */ struct mmc_host host; /* Host parameters */ struct mmc_request *req; /* Current request */ @@ -323,5 +334,6 @@ int sdhci_generic_release_host(device_t brdev, device_t reqdev); void sdhci_generic_intr(struct sdhci_slot *slot); uint32_t sdhci_generic_min_freq(device_t brdev, struct sdhci_slot *slot); bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot); +void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present); #endif /* __SDHCI_H__ */ diff --git a/sys/dev/sdhci/sdhci_fdt_gpio.c b/sys/dev/sdhci/sdhci_fdt_gpio.c new file mode 100644 index 000000000000..c3fa6ba583d3 --- /dev/null +++ b/sys/dev/sdhci/sdhci_fdt_gpio.c @@ -0,0 +1,256 @@ +/*- + * Copyright (c) 2017 Ian Lepore <ian@freebsd.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Support routines usable by any SoC sdhci bridge driver that uses gpio pins + * for card detect and write protect, and uses FDT data to describe those pins. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/param.h> +#include <sys/bus.h> +#include <sys/gpio.h> +#include <sys/sysctl.h> +#include <sys/taskqueue.h> + +#include <dev/gpio/gpiobusvar.h> +#include <dev/mmc/bridge.h> +#include <dev/ofw/ofw_bus.h> +#include <dev/ofw/ofw_bus_subr.h> +#include <dev/sdhci/sdhci.h> +#include <dev/sdhci/sdhci_fdt_gpio.h> + +struct sdhci_fdt_gpio { + device_t dev; + struct sdhci_slot * slot; + gpio_pin_t wp_pin; + gpio_pin_t cd_pin; + void * cd_ihandler; + struct resource * cd_ires; + int cd_irid; + bool wp_disabled; + bool wp_inverted; + bool cd_disabled; + bool cd_inverted; +}; + +/* + * Card detect interrupt handler. + */ +static void +cd_intr(void *arg) +{ + struct sdhci_fdt_gpio *gpio = arg; + + sdhci_handle_card_present(gpio->slot, sdhci_fdt_gpio_get_present(gpio)); +} + +/* + * Card detect setup. + */ +static void +cd_setup(struct sdhci_fdt_gpio *gpio, phandle_t node) +{ + int pincaps; + device_t dev; + const char *cd_mode_str; + + dev = gpio->dev; + + /* + * If the device is flagged as non-removable, set that slot option, and + * set a flag to make sdhci_fdt_gpio_get_present() always return true. + */ + if (OF_hasprop(node, "non-removable")) { + gpio->slot->opt |= SDHCI_NON_REMOVABLE; + gpio->cd_disabled = true; + if (bootverbose) + device_printf(dev, "Non-removable media"); + return; + } + + /* + * If there is no cd-gpios property, then presumably the hardware + * PRESENT_STATE register and interrupts will reflect card state + * properly, and there's nothing more for us to do. Our get_present() + * will return sdhci_generic_get_card_present() because cd_pin is NULL. + * + * If there is a property, make sure we can read the pin. + */ + if (gpio_pin_get_by_ofw_property(dev, node, "cd-gpios", &gpio->cd_pin)) + return; + + if (gpio_pin_getcaps(gpio->cd_pin, &pincaps) != 0 || + !(pincaps & GPIO_PIN_INPUT)) { + device_printf(dev, "Cannot read card-detect gpio pin; " + "setting card-always-present flag.\n"); + gpio->cd_disabled = true; + return; + } + + if (OF_hasprop(node, "cd-inverted")) + gpio->cd_inverted = true; + + /* + * If the pin can trigger an interrupt on both rising and falling edges, + * we can use it to detect card presence changes. If not, we'll request + * card presence polling instead of using interrupts. + */ + if (!(pincaps & GPIO_INTR_EDGE_BOTH)) { + if (bootverbose) + device_printf(dev, "Cannot configure " + "GPIO_INTR_EDGE_BOTH for card detect\n"); + goto without_interrupts; + } + + /* + * Create an interrupt resource from the pin and set up the interrupt. + */ + if ((gpio->cd_ires = gpio_alloc_intr_resource(dev, &gpio->cd_irid, + RF_ACTIVE, gpio->cd_pin, GPIO_INTR_EDGE_BOTH)) == NULL) { + if (bootverbose) + device_printf(dev, "Cannot allocate an IRQ for card " + "detect GPIO\n"); + goto without_interrupts; + } + + if (bus_setup_intr(dev, gpio->cd_ires, INTR_TYPE_BIO | INTR_MPSAFE, + NULL, cd_intr, gpio, &gpio->cd_ihandler) != 0) { + device_printf(dev, "Unable to setup card-detect irq handler\n"); + gpio->cd_ihandler = NULL; + goto without_interrupts; + } + +without_interrupts: + + /* + * If we have a readable gpio pin, but didn't successfully configure + * gpio interrupts, ask the sdhci driver to poll from a callout. + */ + if (gpio->cd_ihandler == NULL) { + cd_mode_str = "polling"; + gpio->slot->quirks |= SDHCI_QUIRK_POLL_CARD_PRESENT; + } else { + cd_mode_str = "interrupts"; + } + + if (bootverbose) { + device_printf(dev, "Card presence detect on %s pin %u, " + "configured for %s.\n", + device_get_nameunit(gpio->cd_pin->dev), gpio->cd_pin->pin, + cd_mode_str); + } +} + +/* + * Write protect setup. + */ +static void +wp_setup(struct sdhci_fdt_gpio *gpio, phandle_t node) +{ + device_t dev; + + dev = gpio->dev; + + if (OF_hasprop(node, "wp-disable")) + return; + + if (gpio_pin_get_by_ofw_property(dev, node, "wp-gpios", &gpio->wp_pin)) + return; + + if (OF_hasprop(node, "wp-inverted")) + gpio->wp_inverted = true; + + if (bootverbose) + device_printf(dev, "Write protect switch on %s pin %u\n", + device_get_nameunit(gpio->cd_pin->dev), gpio->cd_pin->pin); +} + +struct sdhci_fdt_gpio * +sdhci_fdt_gpio_setup(device_t dev, struct sdhci_slot *slot) +{ + phandle_t node; + struct sdhci_fdt_gpio *gpio; + + gpio = malloc(sizeof(*gpio), M_DEVBUF, M_ZERO | M_WAITOK); + gpio->dev = dev; + gpio->slot = slot; + + node = ofw_bus_get_node(dev); + + wp_setup(gpio, node); + cd_setup(gpio, node); + + return (gpio); +} + +void +sdhci_fdt_gpio_teardown(struct sdhci_fdt_gpio *gpio) +{ + + if (gpio == NULL) + return; + + if (gpio->cd_ihandler != NULL) { + bus_teardown_intr(gpio->dev, gpio->cd_ires, gpio->cd_ihandler); + } + + free(gpio, M_DEVBUF); +} + +bool +sdhci_fdt_gpio_get_present(struct sdhci_fdt_gpio *gpio) +{ + bool pinstate; + + if (gpio->cd_disabled) + return (true); + + if (gpio->cd_pin == NULL) + return (sdhci_generic_get_card_present(gpio->slot->bus, + gpio->slot)); + + gpio_pin_is_active(gpio->cd_pin, &pinstate); + + return (pinstate ^ gpio->cd_inverted); +} + +int +sdhci_fdt_gpio_get_readonly(struct sdhci_fdt_gpio *gpio) +{ + bool pinstate; + + if (gpio->wp_disabled) + return (false); + + if (gpio->wp_pin == NULL) + return (sdhci_generic_get_ro(gpio->slot->bus, gpio->slot->dev)); + + gpio_pin_is_active(gpio->wp_pin, &pinstate); + + return (pinstate ^ gpio->wp_inverted); +} diff --git a/sys/dev/sdhci/sdhci_fdt_gpio.h b/sys/dev/sdhci/sdhci_fdt_gpio.h new file mode 100644 index 000000000000..6d51737b5733 --- /dev/null +++ b/sys/dev/sdhci/sdhci_fdt_gpio.h @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2017 Ian Lepore <ian@freebsd.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Support routines usable by any SoC sdhci bridge driver that uses gpio pins + * for card detect and/or write protect, and uses FDT data to describe those + * pins. A bridge driver need only supply a couple 2-line forwarding functions + * to connect the get_present and get_readonly accessors to the corresponding + * driver interface functions, and add setup/teardown calls to its attach and + * detach functions. + */ + +#ifndef _SDHCI_FDT_GPIO_H_ +#define _SDHCI_FDT_GPIO_H_ + +struct sdhci_slot; +struct sdhci_fdt_gpio; + +/* + * sdhci_fdt_gpio_setup() + * sdhci_fdt_gpio_teardown() + * + * Process FDT properties that use gpio pins and set up interrupt handling (if + * supported by hardware) and accessor functions to read the pins. + * + * Setup cannot fail. If the properties are not present, the accessors will + * return the values from standard sdhci registers. If the gpio controller + * can't trigger interrupts on both edges, it configures the slot to use polling + * for card presence detection. If it can't access the gpio pin at all it sets + * up the get_present() accessor to always return true. Likewise the + * get_readonly() accessor always returns false if its pin can't be accessed. + */ +struct sdhci_fdt_gpio *sdhci_fdt_gpio_setup(device_t dev, struct sdhci_slot *slot); +void sdhci_fdt_gpio_teardown(struct sdhci_fdt_gpio *gpio); + +/* + * sdhci_fdt_gpio_get_present() + * sdhci_fdt_gpio_get_readonly() + * + * Gpio pin state accessor functions. + */ +bool sdhci_fdt_gpio_get_present(struct sdhci_fdt_gpio *gpio); +int sdhci_fdt_gpio_get_readonly(struct sdhci_fdt_gpio *gpio); + +#endif diff --git a/sys/dev/sdhci/sdhci_pci.c b/sys/dev/sdhci/sdhci_pci.c index f46897ec40ae..aec4000dc168 100644 --- a/sys/dev/sdhci/sdhci_pci.c +++ b/sys/dev/sdhci/sdhci_pci.c @@ -107,8 +107,19 @@ static const struct sdhci_device { SDHCI_QUIRK_RESET_AFTER_REQUEST }, { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC }, - { 0x22948086, 0xffff, "Intel Braswell Storage Cluster Control MMC Port", - 0 }, + { 0x0f148086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", + SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_INTEL_POWER_UP_RESET }, + { 0x0f508086, 0xffff, "Intel Bay Trail eMMC 4.5 Controller", + SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_INTEL_POWER_UP_RESET }, + { 0x22948086, 0xffff, "Intel Braswell eMMC 4.5.1 Controller", + SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_DATA_TIMEOUT_1MHZ | + SDHCI_QUIRK_INTEL_POWER_UP_RESET }, + { 0x5acc8086, 0xffff, "Intel Apollo Lake eMMC 5.0 Controller", + SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_INTEL_POWER_UP_RESET }, { 0, 0xffff, NULL, 0 } }; @@ -121,8 +132,8 @@ struct sdhci_pci_softc { int num_slots; /* Number of slots on this controller */ struct sdhci_slot slots[6]; struct resource *mem_res[6]; /* Memory resource */ - uint8_t cfg_freq; /* Saved mode */ - uint8_t cfg_mode; /* Saved frequency */ + uint8_t cfg_freq; /* Saved frequency */ + uint8_t cfg_mode; /* Saved mode */ }; static int sdhci_enable_msi = 1; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 0f565307998d..ebaaedcd5f8d 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -910,7 +910,7 @@ nd6_timer(void *arg) struct nd_defrouter *dr, *ndr; struct nd_prefix *pr, *npr; struct in6_ifaddr *ia6, *nia6; - bool onlink_locked; + uint64_t genid; TAILQ_INIT(&drq); LIST_INIT(&prl); @@ -1022,7 +1022,6 @@ nd6_timer(void *arg) } ND6_WLOCK(); - onlink_locked = false; restart: LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, npr) { /* @@ -1045,22 +1044,19 @@ restart: continue; } if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) { - if (!onlink_locked) { - onlink_locked = ND6_ONLINK_TRYLOCK(); - if (!onlink_locked) { - ND6_WUNLOCK(); - ND6_ONLINK_LOCK(); - onlink_locked = true; - ND6_WLOCK(); - goto restart; - } - } + genid = V_nd6_list_genid; + nd6_prefix_ref(pr); + ND6_WUNLOCK(); + ND6_ONLINK_LOCK(); (void)nd6_prefix_offlink(pr); + ND6_ONLINK_UNLOCK(); + ND6_WLOCK(); + nd6_prefix_rele(pr); + if (genid != V_nd6_list_genid) + goto restart; } } ND6_WUNLOCK(); - if (onlink_locked) - ND6_ONLINK_UNLOCK(); while ((pr = LIST_FIRST(&prl)) != NULL) { LIST_REMOVE(pr, ndpr_entry); diff --git a/sys/powerpc/include/vmparam.h b/sys/powerpc/include/vmparam.h index d7368ecb283c..3ed408dd207b 100644 --- a/sys/powerpc/include/vmparam.h +++ b/sys/powerpc/include/vmparam.h @@ -111,7 +111,7 @@ #define KERNBASE 0xc0000000 /* start of kernel virtual */ #define VM_MIN_KERNEL_ADDRESS KERNBASE -#define VM_MAX_KERNEL_ADDRESS 0xffffffff +#define VM_MAX_KERNEL_ADDRESS 0xffffefff #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS #endif /* AIM/E500 */ diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 6f00452540f2..c5cb094d3465 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -4444,6 +4444,8 @@ OLD_FILES+=usr/lib/libcxxrt.a OLD_FILES+=usr/lib/libcxxrt.so OLD_FILES+=usr/lib/libcxxrt_p.a OLD_FILES+=usr/include/c++/v1/__bit_reference +OLD_FILES+=usr/include/c++/v1/__bsd_locale_defaults.h +OLD_FILES+=usr/include/c++/v1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/__config OLD_FILES+=usr/include/c++/v1/__debug OLD_FILES+=usr/include/c++/v1/__functional_03 @@ -4452,10 +4454,12 @@ OLD_FILES+=usr/include/c++/v1/__functional_base_03 OLD_FILES+=usr/include/c++/v1/__hash_table OLD_FILES+=usr/include/c++/v1/__locale OLD_FILES+=usr/include/c++/v1/__mutex_base +OLD_FILES+=usr/include/c++/v1/__nullptr OLD_FILES+=usr/include/c++/v1/__refstring OLD_FILES+=usr/include/c++/v1/__split_buffer OLD_FILES+=usr/include/c++/v1/__sso_allocator OLD_FILES+=usr/include/c++/v1/__std_stream +OLD_FILES+=usr/include/c++/v1/__threading_support OLD_FILES+=usr/include/c++/v1/__tree OLD_FILES+=usr/include/c++/v1/__tuple OLD_FILES+=usr/include/c++/v1/__undef___deallocate @@ -4491,30 +4495,51 @@ OLD_FILES+=usr/include/c++/v1/cstdlib OLD_FILES+=usr/include/c++/v1/cstring OLD_FILES+=usr/include/c++/v1/ctgmath OLD_FILES+=usr/include/c++/v1/ctime +OLD_FILES+=usr/include/c++/v1/ctype.h OLD_FILES+=usr/include/c++/v1/cwchar OLD_FILES+=usr/include/c++/v1/cwctype OLD_FILES+=usr/include/c++/v1/cxxabi.h OLD_FILES+=usr/include/c++/v1/deque +OLD_FILES+=usr/include/c++/v1/errno.h OLD_FILES+=usr/include/c++/v1/exception OLD_FILES+=usr/include/c++/v1/experimental/__config +OLD_FILES+=usr/include/c++/v1/experimental/__memory +OLD_FILES+=usr/include/c++/v1/experimental/algorithm +OLD_FILES+=usr/include/c++/v1/experimental/any OLD_FILES+=usr/include/c++/v1/experimental/chrono +OLD_FILES+=usr/include/c++/v1/experimental/deque OLD_FILES+=usr/include/c++/v1/experimental/dynarray -OLD_FILES+=usr/include/c++/v1/experimental/dynarray +OLD_FILES+=usr/include/c++/v1/experimental/filesystem +OLD_FILES+=usr/include/c++/v1/experimental/forward_list +OLD_FILES+=usr/include/c++/v1/experimental/functional +OLD_FILES+=usr/include/c++/v1/experimental/iterator +OLD_FILES+=usr/include/c++/v1/experimental/list +OLD_FILES+=usr/include/c++/v1/experimental/map +OLD_FILES+=usr/include/c++/v1/experimental/memory_resource OLD_FILES+=usr/include/c++/v1/experimental/optional +OLD_FILES+=usr/include/c++/v1/experimental/propagate_const OLD_FILES+=usr/include/c++/v1/experimental/ratio +OLD_FILES+=usr/include/c++/v1/experimental/regex +OLD_FILES+=usr/include/c++/v1/experimental/set +OLD_FILES+=usr/include/c++/v1/experimental/string OLD_FILES+=usr/include/c++/v1/experimental/string_view OLD_FILES+=usr/include/c++/v1/experimental/system_error OLD_FILES+=usr/include/c++/v1/experimental/tuple OLD_FILES+=usr/include/c++/v1/experimental/type_traits +OLD_FILES+=usr/include/c++/v1/experimental/unordered_map +OLD_FILES+=usr/include/c++/v1/experimental/unordered_set OLD_FILES+=usr/include/c++/v1/experimental/utility +OLD_FILES+=usr/include/c++/v1/experimental/vector OLD_FILES+=usr/include/c++/v1/ext/__hash OLD_FILES+=usr/include/c++/v1/ext/hash_map OLD_FILES+=usr/include/c++/v1/ext/hash_set +OLD_FILES+=usr/include/c++/v1/float.h OLD_FILES+=usr/include/c++/v1/forward_list OLD_FILES+=usr/include/c++/v1/fstream OLD_FILES+=usr/include/c++/v1/functional OLD_FILES+=usr/include/c++/v1/future OLD_FILES+=usr/include/c++/v1/initializer_list +OLD_FILES+=usr/include/c++/v1/inttypes.h OLD_FILES+=usr/include/c++/v1/iomanip OLD_FILES+=usr/include/c++/v1/ios OLD_FILES+=usr/include/c++/v1/iosfwd @@ -4525,6 +4550,7 @@ OLD_FILES+=usr/include/c++/v1/limits OLD_FILES+=usr/include/c++/v1/list OLD_FILES+=usr/include/c++/v1/locale OLD_FILES+=usr/include/c++/v1/map +OLD_FILES+=usr/include/c++/v1/math.h OLD_FILES+=usr/include/c++/v1/memory OLD_FILES+=usr/include/c++/v1/mutex OLD_FILES+=usr/include/c++/v1/new @@ -4536,17 +4562,25 @@ OLD_FILES+=usr/include/c++/v1/ratio OLD_FILES+=usr/include/c++/v1/regex OLD_FILES+=usr/include/c++/v1/scoped_allocator OLD_FILES+=usr/include/c++/v1/set +OLD_FILES+=usr/include/c++/v1/setjmp.h OLD_FILES+=usr/include/c++/v1/shared_mutex OLD_FILES+=usr/include/c++/v1/sstream OLD_FILES+=usr/include/c++/v1/stack +OLD_FILES+=usr/include/c++/v1/stdbool.h +OLD_FILES+=usr/include/c++/v1/stddef.h OLD_FILES+=usr/include/c++/v1/stdexcept +OLD_FILES+=usr/include/c++/v1/stdio.h +OLD_FILES+=usr/include/c++/v1/stdlib.h OLD_FILES+=usr/include/c++/v1/streambuf OLD_FILES+=usr/include/c++/v1/string +OLD_FILES+=usr/include/c++/v1/string.h OLD_FILES+=usr/include/c++/v1/strstream OLD_FILES+=usr/include/c++/v1/system_error OLD_FILES+=usr/include/c++/v1/tgmath.h OLD_FILES+=usr/include/c++/v1/thread OLD_FILES+=usr/include/c++/v1/tr1/__bit_reference +OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_defaults.h +OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/tr1/__config OLD_FILES+=usr/include/c++/v1/tr1/__debug OLD_FILES+=usr/include/c++/v1/tr1/__functional_03 @@ -4555,13 +4589,15 @@ OLD_FILES+=usr/include/c++/v1/tr1/__functional_base_03 OLD_FILES+=usr/include/c++/v1/tr1/__hash_table OLD_FILES+=usr/include/c++/v1/tr1/__locale OLD_FILES+=usr/include/c++/v1/tr1/__mutex_base +OLD_FILES+=usr/include/c++/v1/tr1/__nullptr OLD_FILES+=usr/include/c++/v1/tr1/__refstring OLD_FILES+=usr/include/c++/v1/tr1/__split_buffer OLD_FILES+=usr/include/c++/v1/tr1/__sso_allocator OLD_FILES+=usr/include/c++/v1/tr1/__std_stream +OLD_FILES+=usr/include/c++/v1/tr1/__threading_support OLD_FILES+=usr/include/c++/v1/tr1/__tree OLD_FILES+=usr/include/c++/v1/tr1/__tuple -OLD_FILES+=usr/include/c++/v1/tr1/__tuple_03 +OLD_FILES+=usr/include/c++/v1/tr1/__undef___deallocate OLD_FILES+=usr/include/c++/v1/tr1/__undef_min_max OLD_FILES+=usr/include/c++/v1/tr1/algorithm OLD_FILES+=usr/include/c++/v1/tr1/array @@ -4594,15 +4630,19 @@ OLD_FILES+=usr/include/c++/v1/tr1/cstdlib OLD_FILES+=usr/include/c++/v1/tr1/cstring OLD_FILES+=usr/include/c++/v1/tr1/ctgmath OLD_FILES+=usr/include/c++/v1/tr1/ctime +OLD_FILES+=usr/include/c++/v1/tr1/ctype.h OLD_FILES+=usr/include/c++/v1/tr1/cwchar OLD_FILES+=usr/include/c++/v1/tr1/cwctype OLD_FILES+=usr/include/c++/v1/tr1/deque +OLD_FILES+=usr/include/c++/v1/tr1/errno.h OLD_FILES+=usr/include/c++/v1/tr1/exception +OLD_FILES+=usr/include/c++/v1/tr1/float.h OLD_FILES+=usr/include/c++/v1/tr1/forward_list OLD_FILES+=usr/include/c++/v1/tr1/fstream OLD_FILES+=usr/include/c++/v1/tr1/functional OLD_FILES+=usr/include/c++/v1/tr1/future OLD_FILES+=usr/include/c++/v1/tr1/initializer_list +OLD_FILES+=usr/include/c++/v1/tr1/inttypes.h OLD_FILES+=usr/include/c++/v1/tr1/iomanip OLD_FILES+=usr/include/c++/v1/tr1/ios OLD_FILES+=usr/include/c++/v1/tr1/iosfwd @@ -4613,6 +4653,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/limits OLD_FILES+=usr/include/c++/v1/tr1/list OLD_FILES+=usr/include/c++/v1/tr1/locale OLD_FILES+=usr/include/c++/v1/tr1/map +OLD_FILES+=usr/include/c++/v1/tr1/math.h OLD_FILES+=usr/include/c++/v1/tr1/memory OLD_FILES+=usr/include/c++/v1/tr1/mutex OLD_FILES+=usr/include/c++/v1/tr1/new @@ -4624,12 +4665,18 @@ OLD_FILES+=usr/include/c++/v1/tr1/ratio OLD_FILES+=usr/include/c++/v1/tr1/regex OLD_FILES+=usr/include/c++/v1/tr1/scoped_allocator OLD_FILES+=usr/include/c++/v1/tr1/set +OLD_FILES+=usr/include/c++/v1/tr1/setjmp.h OLD_FILES+=usr/include/c++/v1/tr1/shared_mutex OLD_FILES+=usr/include/c++/v1/tr1/sstream OLD_FILES+=usr/include/c++/v1/tr1/stack +OLD_FILES+=usr/include/c++/v1/tr1/stdbool.h +OLD_FILES+=usr/include/c++/v1/tr1/stddef.h OLD_FILES+=usr/include/c++/v1/tr1/stdexcept +OLD_FILES+=usr/include/c++/v1/tr1/stdio.h +OLD_FILES+=usr/include/c++/v1/tr1/stdlib.h OLD_FILES+=usr/include/c++/v1/tr1/streambuf OLD_FILES+=usr/include/c++/v1/tr1/string +OLD_FILES+=usr/include/c++/v1/tr1/string.h OLD_FILES+=usr/include/c++/v1/tr1/strstream OLD_FILES+=usr/include/c++/v1/tr1/system_error OLD_FILES+=usr/include/c++/v1/tr1/tgmath.h @@ -4643,6 +4690,8 @@ OLD_FILES+=usr/include/c++/v1/tr1/unordered_set OLD_FILES+=usr/include/c++/v1/tr1/utility OLD_FILES+=usr/include/c++/v1/tr1/valarray OLD_FILES+=usr/include/c++/v1/tr1/vector +OLD_FILES+=usr/include/c++/v1/tr1/wchar.h +OLD_FILES+=usr/include/c++/v1/tr1/wctype.h OLD_FILES+=usr/include/c++/v1/tuple OLD_FILES+=usr/include/c++/v1/type_traits OLD_FILES+=usr/include/c++/v1/typeindex @@ -4655,6 +4704,8 @@ OLD_FILES+=usr/include/c++/v1/unwind.h OLD_FILES+=usr/include/c++/v1/utility OLD_FILES+=usr/include/c++/v1/valarray OLD_FILES+=usr/include/c++/v1/vector +OLD_FILES+=usr/include/c++/v1/wchar.h +OLD_FILES+=usr/include/c++/v1/wctype.h OLD_FILES+=usr/lib32/libc++.a OLD_FILES+=usr/lib32/libc++.so OLD_LIBS+=usr/lib32/libc++.so.1 diff --git a/tools/tools/gensnmpdef/Makefile b/tools/tools/gensnmpdef/Makefile index 437e304d0ce7..470e1de2dc88 100644 --- a/tools/tools/gensnmpdef/Makefile +++ b/tools/tools/gensnmpdef/Makefile @@ -19,4 +19,6 @@ LDFLAGS+= -L${LOCALBASE}/lib LDADD+= -lsmi +WARNS?= 6 + .include <bsd.prog.mk> diff --git a/usr.bin/ctlstat/ctlstat.8 b/usr.bin/ctlstat/ctlstat.8 index ebf9f5c50502..038b8caee91e 100644 --- a/usr.bin/ctlstat/ctlstat.8 +++ b/usr.bin/ctlstat/ctlstat.8 @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.bin/ctlstat/ctlstat.8#2 $ .\" $FreeBSD$ .\" -.Dd September 21, 2015 +.Dd January 9, 2017 .Dt CTLSTAT 8 .Os .Sh NAME @@ -120,3 +120,4 @@ every 10 seconds. .Sh AUTHORS .An Ken Merry Aq Mt ken@FreeBSD.org .An Will Andrews Aq Mt will@FreeBSD.org +.An Alexander Motin Aq Mt mav@FreeBSD.org diff --git a/usr.bin/ctlstat/ctlstat.c b/usr.bin/ctlstat/ctlstat.c index 358758652aa0..d55e004feb2a 100644 --- a/usr.bin/ctlstat/ctlstat.c +++ b/usr.bin/ctlstat/ctlstat.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2004, 2008, 2009 Silicon Graphics International Corp. + * Copyright (c) 2017 Alexander Motin <mav@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,17 +67,17 @@ __FBSDID("$FreeBSD$"); #include <cam/ctl/ctl_ioctl.h> /* - * The default amount of space we allocate for LUN storage space. We - * dynamically allocate more if needed. + * The default amount of space we allocate for stats storage space. + * We dynamically allocate more if needed. */ -#define CTL_STAT_NUM_LUNS 30 +#define CTL_STAT_NUM_ITEMS 256 /* * The default number of LUN selection bits we allocate. This is large * because we don't currently increase it if the user specifies a LUN * number of 1024 or larger. */ -#define CTL_STAT_LUN_BITS 1024L +#define CTL_STAT_BITS 1024L static const char *ctlstat_opts = "Cc:Ddhjl:n:p:tw:"; static const char *ctlstat_usage = "Usage: ctlstat [-CDdjht] [-l lunnum]" @@ -101,31 +102,32 @@ typedef enum { #define CTLSTAT_FLAG_FIRST_RUN (1 << 2) #define CTLSTAT_FLAG_TOTALS (1 << 3) #define CTLSTAT_FLAG_DMA_TIME (1 << 4) -#define CTLSTAT_FLAG_LUN_TIME_VALID (1 << 5) -#define CTLSTAT_FLAG_LUN_MASK (1 << 6) -#define CTLSTAT_FLAG_PORT_MASK (1 << 7) +#define CTLSTAT_FLAG_TIME_VALID (1 << 5) +#define CTLSTAT_FLAG_MASK (1 << 6) +#define CTLSTAT_FLAG_LUNS (1 << 7) +#define CTLSTAT_FLAG_PORTS (1 << 8) #define F_CPU(ctx) ((ctx)->flags & CTLSTAT_FLAG_CPU) #define F_HDR(ctx) ((ctx)->flags & CTLSTAT_FLAG_HEADER) #define F_FIRST(ctx) ((ctx)->flags & CTLSTAT_FLAG_FIRST_RUN) #define F_TOTALS(ctx) ((ctx)->flags & CTLSTAT_FLAG_TOTALS) #define F_DMA(ctx) ((ctx)->flags & CTLSTAT_FLAG_DMA_TIME) -#define F_LUNVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_TIME_VALID) -#define F_LUNMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUN_MASK) -#define F_PORTMASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORT_MASK) +#define F_TIMEVAL(ctx) ((ctx)->flags & CTLSTAT_FLAG_TIME_VALID) +#define F_MASK(ctx) ((ctx)->flags & CTLSTAT_FLAG_MASK) +#define F_LUNS(ctx) ((ctx)->flags & CTLSTAT_FLAG_LUNS) +#define F_PORTS(ctx) ((ctx)->flags & CTLSTAT_FLAG_PORTS) struct ctlstat_context { ctlstat_mode_types mode; int flags; - struct ctl_lun_io_stats *cur_lun_stats, *prev_lun_stats, - *tmp_lun_stats; - struct ctl_lun_io_stats cur_total_stats[3], prev_total_stats[3]; + struct ctl_io_stats *cur_stats, *prev_stats; + struct ctl_io_stats cur_total_stats[3], prev_total_stats[3]; struct timespec cur_time, prev_time; struct ctl_cpu_stats cur_cpu, prev_cpu; uint64_t cur_total_jiffies, prev_total_jiffies; uint64_t cur_idle, prev_idle; - bitstr_t bit_decl(lun_mask, CTL_STAT_LUN_BITS); - bitstr_t bit_decl(port_mask, CTL_MAX_PORTS); - int num_luns; + bitstr_t bit_decl(item_mask, CTL_STAT_BITS); + int cur_items, prev_items; + int cur_alloc, prev_alloc; int numdevs; int header_interval; }; @@ -135,12 +137,11 @@ struct ctlstat_context { #endif static void usage(int error); -static int getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, - struct timespec *cur_time, int *lun_time_valid); +static int getstats(int fd, int *alloc_items, int *num_items, + struct ctl_io_stats **xstats, struct timespec *cur_time, int *time_valid); static int getcpu(struct ctl_cpu_stats *cpu_stats); -static void compute_stats(struct ctlstat_context *ctx, - struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, +static void compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, @@ -155,64 +156,55 @@ usage(int error) } static int -getstats(int fd, int *num_luns, struct ctl_lun_io_stats **xlun_stats, +getstats(int fd, int *alloc_items, int *num_items, struct ctl_io_stats **stats, struct timespec *cur_time, int *flags) { - struct ctl_lun_io_stats *lun_stats; - struct ctl_stats stats; - int more_space_count; + struct ctl_get_io_stats get_stats; + int more_space_count = 0; - more_space_count = 0; - - if (*num_luns == 0) - *num_luns = CTL_STAT_NUM_LUNS; - - lun_stats = *xlun_stats; + if (*alloc_items == 0) + *alloc_items = CTL_STAT_NUM_ITEMS; retry: + if (*stats == NULL) + *stats = malloc(sizeof(**stats) * *alloc_items); - if (lun_stats == NULL) { - lun_stats = (struct ctl_lun_io_stats *)malloc( - sizeof(*lun_stats) * *num_luns); - } - - memset(&stats, 0, sizeof(stats)); - stats.alloc_len = *num_luns * sizeof(*lun_stats); - memset(lun_stats, 0, stats.alloc_len); - stats.lun_stats = lun_stats; + memset(&get_stats, 0, sizeof(get_stats)); + get_stats.alloc_len = *alloc_items * sizeof(**stats); + memset(*stats, 0, get_stats.alloc_len); + get_stats.stats = *stats; - if (ioctl(fd, CTL_GETSTATS, &stats) == -1) - err(1, "error returned from CTL_GETSTATS ioctl"); + if (ioctl(fd, (*flags & CTLSTAT_FLAG_PORTS) ? CTL_GET_PORT_STATS : + CTL_GET_LUN_STATS, &get_stats) == -1) + err(1, "CTL_GET_*_STATS ioctl returned error"); - switch (stats.status) { + switch (get_stats.status) { case CTL_SS_OK: break; case CTL_SS_ERROR: - err(1, "CTL_SS_ERROR returned from CTL_GETSTATS ioctl"); + err(1, "CTL_GET_*_STATS ioctl returned CTL_SS_ERROR"); break; case CTL_SS_NEED_MORE_SPACE: - if (more_space_count > 0) { - errx(1, "CTL_GETSTATS returned NEED_MORE_SPACE again"); - } - *num_luns = stats.num_luns; - free(lun_stats); - lun_stats = NULL; + if (more_space_count >= 2) + errx(1, "CTL_GET_*_STATS returned NEED_MORE_SPACE again"); + *alloc_items = get_stats.num_items * 5 / 4; + free(*stats); + *stats = NULL; more_space_count++; goto retry; break; /* NOTREACHED */ default: - errx(1, "unknown status %d returned from CTL_GETSTATS ioctl", - stats.status); + errx(1, "CTL_GET_*_STATS ioctl returned unknown status %d", + get_stats.status); break; } - *xlun_stats = lun_stats; - *num_luns = stats.num_luns; - cur_time->tv_sec = stats.timestamp.tv_sec; - cur_time->tv_nsec = stats.timestamp.tv_nsec; - if (stats.flags & CTL_STATS_FLAG_TIME_VALID) - *flags |= CTLSTAT_FLAG_LUN_TIME_VALID; + *num_items = get_stats.fill_len / sizeof(**stats); + cur_time->tv_sec = get_stats.timestamp.tv_sec; + cur_time->tv_nsec = get_stats.timestamp.tv_nsec; + if (get_stats.flags & CTL_STATS_FLAG_TIME_VALID) + *flags |= CTLSTAT_FLAG_TIME_VALID; else - *flags &= ~CTLSTAT_FLAG_LUN_TIME_VALID; + *flags &= ~CTLSTAT_FLAG_TIME_VALID; return (0); } @@ -240,14 +232,13 @@ getcpu(struct ctl_cpu_stats *cpu_stats) } static void -compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, - struct ctl_lun_io_stats *prev_stats, long double etime, +compute_stats(struct ctl_io_stats *cur_stats, + struct ctl_io_stats *prev_stats, long double etime, long double *mbsec, long double *kb_per_transfer, long double *transfers_per_second, long double *ms_per_transfer, long double *ms_per_dma, long double *dmas_per_second) { uint64_t total_bytes = 0, total_operations = 0, total_dmas = 0; - uint32_t port; struct bintime total_time_bt, total_dma_bt; struct timespec total_time_ts, total_dma_ts; int i; @@ -256,31 +247,18 @@ compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, bzero(&total_dma_bt, sizeof(total_dma_bt)); bzero(&total_time_ts, sizeof(total_time_ts)); bzero(&total_dma_ts, sizeof(total_dma_ts)); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { - total_bytes += cur_stats->ports[port].bytes[i]; - total_operations += - cur_stats->ports[port].operations[i]; - total_dmas += cur_stats->ports[port].num_dmas[i]; - bintime_add(&total_time_bt, - &cur_stats->ports[port].time[i]); - bintime_add(&total_dma_bt, - &cur_stats->ports[port].dma_time[i]); - if (prev_stats != NULL) { - total_bytes -= - prev_stats->ports[port].bytes[i]; - total_operations -= - prev_stats->ports[port].operations[i]; - total_dmas -= - prev_stats->ports[port].num_dmas[i]; - bintime_sub(&total_time_bt, - &prev_stats->ports[port].time[i]); - bintime_sub(&total_dma_bt, - &prev_stats->ports[port].dma_time[i]); - } + for (i = 0; i < CTL_STATS_NUM_TYPES; i++) { + total_bytes += cur_stats->bytes[i]; + total_operations += cur_stats->operations[i]; + total_dmas += cur_stats->dmas[i]; + bintime_add(&total_time_bt, &cur_stats->time[i]); + bintime_add(&total_dma_bt, &cur_stats->dma_time[i]); + if (prev_stats != NULL) { + total_bytes -= prev_stats->bytes[i]; + total_operations -= prev_stats->operations[i]; + total_dmas -= prev_stats->dmas[i]; + bintime_sub(&total_time_bt, &prev_stats->time[i]); + bintime_sub(&total_dma_bt, &prev_stats->dma_time[i]); } } @@ -340,35 +318,25 @@ compute_stats(struct ctlstat_context *ctx, struct ctl_lun_io_stats *cur_stats, static const char *iotypes[] = {"NO IO", "READ", "WRITE"}; static void -ctlstat_dump(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; +ctlstat_dump(struct ctlstat_context *ctx) +{ + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - for (lun = 0; lun < ctx->num_luns;lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + for (i = 0; i < ctx->cur_items;i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("lun %d\n", lun); - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf(" port %d\n", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf(" io type %d (%s)\n", iotype, - iotypes[iotype]); - printf(" bytes %ju\n", (uintmax_t) - stats[lun].ports[port].bytes[iotype]); - printf(" operations %ju\n", (uintmax_t) - stats[lun].ports[port].operations[iotype]); - PRINT_BINTIME(" io time", - stats[lun].ports[port].time[iotype]); - printf(" num dmas %ju\n", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - PRINT_BINTIME(" dma time", - stats[lun].ports[port].dma_time[iotype]); - } + printf("%s %d\n", F_PORTS(ctx) ? "port" : "lun", stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf(" io type %d (%s)\n", iotype, iotypes[iotype]); + printf(" bytes %ju\n", (uintmax_t) + stats[i].bytes[iotype]); + printf(" operations %ju\n", (uintmax_t) + stats[i].operations[iotype]); + printf(" dmas %ju\n", (uintmax_t) + stats[i].dmas[iotype]); + PRINT_BINTIME(" io time", stats[i].time[iotype]); + PRINT_BINTIME(" dma time", stats[i].dma_time[iotype]); } } } @@ -378,63 +346,49 @@ ctlstat_dump(struct ctlstat_context *ctx) { (uintmax_t)(((bt).frac >> 32) * 1000000 >> 32)) static void ctlstat_json(struct ctlstat_context *ctx) { - int iotype, lun, port; - struct ctl_lun_io_stats *stats = ctx->cur_lun_stats; + int iotype, i; + struct ctl_io_stats *stats = ctx->cur_stats; - printf("{\"luns\":["); - for (lun = 0; lun < ctx->num_luns; lun++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, lun) == 0) + printf("{\"%s\":[", F_PORTS(ctx) ? "ports" : "luns"); + for (i = 0; i < ctx->cur_items; i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, i) == 0) continue; - printf("{\"ports\":["); - for (port = 0; port < CTL_MAX_PORTS;port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - printf("{\"num\":%d,\"io\":[", - stats[lun].ports[port].targ_port); - for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; - iotype++) { - printf("{\"type\":\"%s\",", iotypes[iotype]); - printf("\"bytes\":%ju,", (uintmax_t)stats[ - lun].ports[port].bytes[iotype]); - printf("\"operations\":%ju,", (uintmax_t)stats[ - lun].ports[port].operations[iotype]); - JSON_BINTIME("io time", - stats[lun].ports[port].time[iotype]); - JSON_BINTIME("dma time", - stats[lun].ports[port].dma_time[iotype]); - printf("\"num dmas\":%ju}", (uintmax_t) - stats[lun].ports[port].num_dmas[iotype]); - if (iotype < (CTL_STATS_NUM_TYPES - 1)) - printf(","); /* continue io array */ - } - printf("]}"); /* close port */ - if (port < (CTL_MAX_PORTS - 1)) - printf(","); /* continue port array */ + printf("{\"num\":%d,\"io\":[", + stats[i].item); + for (iotype = 0; iotype < CTL_STATS_NUM_TYPES; iotype++) { + printf("{\"type\":\"%s\",", iotypes[iotype]); + printf("\"bytes\":%ju,", (uintmax_t)stats[ + i].bytes[iotype]); + printf("\"operations\":%ju,", (uintmax_t)stats[ + i].operations[iotype]); + printf("\"dmas\":%ju}", (uintmax_t) + stats[i].dmas[iotype]); + JSON_BINTIME("io time", stats[i].time[iotype]); + JSON_BINTIME("dma time", stats[i].dma_time[iotype]); + if (iotype < (CTL_STATS_NUM_TYPES - 1)) + printf(","); /* continue io array */ } - printf("]}"); /* close lun */ - if (lun < (ctx->num_luns - 1)) + printf("]}"); + if (i < (ctx->cur_items - 1)) printf(","); /* continue lun array */ } - printf("]}"); /* close luns and toplevel */ + printf("]}"); } static void ctlstat_standard(struct ctlstat_context *ctx) { long double etime; uint64_t delta_jiffies, delta_idle; - uint32_t port; long double cpu_percentage; - int i; - int j; + int i, j; cpu_percentage = 0; if (F_CPU(ctx) && (getcpu(&ctx->cur_cpu) != 0)) errx(1, "error returned from getcpu()"); - etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec + - (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9; + etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec + + (ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9; if (F_CPU(ctx)) { ctx->prev_total_jiffies = ctx->cur_total_jiffies; @@ -465,29 +419,28 @@ ctlstat_standard(struct ctlstat_context *ctx) { if (F_TOTALS(ctx)) { fprintf(stdout, "%s Read %s" " Write %s Total\n", - (F_LUNVAL(ctx) != 0) ? " " : "", - (F_LUNVAL(ctx) != 0) ? " " : "", - (F_LUNVAL(ctx) != 0) ? " " : ""); + (F_TIMEVAL(ctx) != 0) ? " " : "", + (F_TIMEVAL(ctx) != 0) ? " " : "", + (F_TIMEVAL(ctx) != 0) ? " " : ""); hdr_devs = 3; } else { - for (i = 0; i < min(CTL_STAT_LUN_BITS, - ctx->num_luns); i++) { - int lun; + for (i = 0; i < min(CTL_STAT_BITS, + ctx->cur_items); i++) { + int item; /* * Obviously this won't work with * LUN numbers greater than a signed * integer. */ - lun = (int)ctx->cur_lun_stats[i - ].lun_number; + item = (int)ctx->cur_stats[i].item; - if (F_LUNMASK(ctx) && - bit_test(ctx->lun_mask, lun) == 0) + if (F_MASK(ctx) && + bit_test(ctx->item_mask, item) == 0) continue; fprintf(stdout, "%15.6s%d %s", - "lun", lun, - (F_LUNVAL(ctx) != 0) ? " " : ""); + F_PORTS(ctx) ? "port" : "lun", item, + (F_TIMEVAL(ctx) != 0) ? " " : ""); hdr_devs++; } fprintf(stdout, "\n"); @@ -496,7 +449,7 @@ ctlstat_standard(struct ctlstat_context *ctx) { fprintf(stdout, " "); for (i = 0; i < hdr_devs; i++) fprintf(stdout, "%s KB/t %s MB/s", - (F_LUNVAL(ctx) != 0) ? " ms" : "", + (F_TIMEVAL(ctx) != 0) ? " ms" : "", (F_DMA(ctx) == 0) ? "tps" : "dps"); fprintf(stdout, "\n"); ctx->header_interval = 20; @@ -519,55 +472,48 @@ ctlstat_standard(struct ctlstat_context *ctx) { memset(&ctx->cur_total_stats, 0, sizeof(ctx->cur_total_stats)); /* Use macros to make the next loop more readable. */ -#define ADD_STATS_BYTES(st, p, i, j) \ - ctx->cur_total_stats[st].ports[p].bytes[j] += \ - ctx->cur_lun_stats[i].ports[p].bytes[j] -#define ADD_STATS_OPERATIONS(st, p, i, j) \ - ctx->cur_total_stats[st].ports[p].operations[j] += \ - ctx->cur_lun_stats[i].ports[p].operations[j] -#define ADD_STATS_NUM_DMAS(st, p, i, j) \ - ctx->cur_total_stats[st].ports[p].num_dmas[j] += \ - ctx->cur_lun_stats[i].ports[p].num_dmas[j] -#define ADD_STATS_TIME(st, p, i, j) \ - bintime_add(&ctx->cur_total_stats[st].ports[p].time[j], \ - &ctx->cur_lun_stats[i].ports[p].time[j]) -#define ADD_STATS_DMA_TIME(st, p, i, j) \ - bintime_add(&ctx->cur_total_stats[st].ports[p].dma_time[j], \ - &ctx->cur_lun_stats[i].ports[p].dma_time[j]) - - for (i = 0; i < ctx->num_luns; i++) { - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, - (int)ctx->cur_lun_stats[i].lun_number) == 0) +#define ADD_STATS_BYTES(st, i, j) \ + ctx->cur_total_stats[st].bytes[j] += \ + ctx->cur_stats[i].bytes[j] +#define ADD_STATS_OPERATIONS(st, i, j) \ + ctx->cur_total_stats[st].operations[j] += \ + ctx->cur_stats[i].operations[j] +#define ADD_STATS_DMAS(st, i, j) \ + ctx->cur_total_stats[st].dmas[j] += \ + ctx->cur_stats[i].dmas[j] +#define ADD_STATS_TIME(st, i, j) \ + bintime_add(&ctx->cur_total_stats[st].time[j], \ + &ctx->cur_stats[i].time[j]) +#define ADD_STATS_DMA_TIME(st, i, j) \ + bintime_add(&ctx->cur_total_stats[st].dma_time[j], \ + &ctx->cur_stats[i].dma_time[j]) + + for (i = 0; i < ctx->cur_items; i++) { + if (F_MASK(ctx) && bit_test(ctx->item_mask, + (int)ctx->cur_stats[i].item) == 0) continue; - for (port = 0; port < CTL_MAX_PORTS; port++) { - if (F_PORTMASK(ctx) && - bit_test(ctx->port_mask, port) == 0) - continue; - for (j = 0; j < CTL_STATS_NUM_TYPES; j++) { - ADD_STATS_BYTES(2, port, i, j); - ADD_STATS_OPERATIONS(2, port, i, j); - ADD_STATS_NUM_DMAS(2, port, i, j); - ADD_STATS_TIME(2, port, i, j); - ADD_STATS_DMA_TIME(2, port, i, j); - } - ADD_STATS_BYTES(0, port, i, CTL_STATS_READ); - ADD_STATS_OPERATIONS(0, port, i, - CTL_STATS_READ); - ADD_STATS_NUM_DMAS(0, port, i, CTL_STATS_READ); - ADD_STATS_TIME(0, port, i, CTL_STATS_READ); - ADD_STATS_DMA_TIME(0, port, i, CTL_STATS_READ); - - ADD_STATS_BYTES(1, port, i, CTL_STATS_WRITE); - ADD_STATS_OPERATIONS(1, port, i, - CTL_STATS_WRITE); - ADD_STATS_NUM_DMAS(1, port, i, CTL_STATS_WRITE); - ADD_STATS_TIME(1, port, i, CTL_STATS_WRITE); - ADD_STATS_DMA_TIME(1, port, i, CTL_STATS_WRITE); + for (j = 0; j < CTL_STATS_NUM_TYPES; j++) { + ADD_STATS_BYTES(2, i, j); + ADD_STATS_OPERATIONS(2, i, j); + ADD_STATS_DMAS(2, i, j); + ADD_STATS_TIME(2, i, j); + ADD_STATS_DMA_TIME(2, i, j); } + ADD_STATS_BYTES(0, i, CTL_STATS_READ); + ADD_STATS_OPERATIONS(0, i, CTL_STATS_READ); + ADD_STATS_DMAS(0, i, CTL_STATS_READ); + ADD_STATS_TIME(0, i, CTL_STATS_READ); + ADD_STATS_DMA_TIME(0, i, CTL_STATS_READ); + + ADD_STATS_BYTES(1, i, CTL_STATS_WRITE); + ADD_STATS_OPERATIONS(1, i, CTL_STATS_WRITE); + ADD_STATS_DMAS(1, i, CTL_STATS_WRITE); + ADD_STATS_TIME(1, i, CTL_STATS_WRITE); + ADD_STATS_DMA_TIME(1, i, CTL_STATS_WRITE); } for (i = 0; i < 3; i++) { - compute_stats(ctx, &ctx->cur_total_stats[i], + compute_stats(&ctx->cur_total_stats[i], F_FIRST(ctx) ? NULL : &ctx->prev_total_stats[i], etime, &mbsec[i], &kb_per_transfer[i], &transfers_per_sec[i], @@ -576,7 +522,7 @@ ctlstat_standard(struct ctlstat_context *ctx) { if (F_DMA(ctx) != 0) fprintf(stdout, " %5.1Lf", ms_per_dma[i]); - else if (F_LUNVAL(ctx) != 0) + else if (F_TIMEVAL(ctx) != 0) fprintf(stdout, " %5.1Lf", ms_per_transfer[i]); fprintf(stdout, " %4.0Lf %5.0Lf %4.0Lf", @@ -585,25 +531,32 @@ ctlstat_standard(struct ctlstat_context *ctx) { dmas_per_sec[i], mbsec[i]); } } else { - for (i = 0; i < min(CTL_STAT_LUN_BITS, ctx->num_luns); i++) { + for (i = 0; i < min(CTL_STAT_BITS, ctx->cur_items); i++) { long double mbsec, kb_per_transfer; long double transfers_per_sec; long double ms_per_transfer; long double ms_per_dma; long double dmas_per_sec; - if (F_LUNMASK(ctx) && bit_test(ctx->lun_mask, - (int)ctx->cur_lun_stats[i].lun_number) == 0) + if (F_MASK(ctx) && bit_test(ctx->item_mask, + (int)ctx->cur_stats[i].item) == 0) continue; - compute_stats(ctx, &ctx->cur_lun_stats[i], - F_FIRST(ctx) ? NULL : &ctx->prev_lun_stats[i], + for (j = 0; j < ctx->prev_items; j++) { + if (ctx->prev_stats[j].item == + ctx->cur_stats[i].item) + break; + } + if (j >= ctx->prev_items) + j = -1; + compute_stats(&ctx->cur_stats[i], + j >= 0 ? &ctx->prev_stats[j] : NULL, etime, &mbsec, &kb_per_transfer, &transfers_per_sec, &ms_per_transfer, &ms_per_dma, &dmas_per_sec); if (F_DMA(ctx)) fprintf(stdout, " %5.1Lf", ms_per_dma); - else if (F_LUNVAL(ctx) != 0) + else if (F_TIMEVAL(ctx) != 0) fprintf(stdout, " %5.1Lf", ms_per_transfer); fprintf(stdout, " %4.0Lf %5.0Lf %4.0Lf", @@ -620,6 +573,7 @@ main(int argc, char **argv) int count, waittime; int fd, retval; struct ctlstat_context ctx; + struct ctl_io_stats *tmp_stats; /* default values */ retval = 0; @@ -658,15 +612,16 @@ main(int argc, char **argv) int cur_lun; cur_lun = atoi(optarg); - if (cur_lun > CTL_STAT_LUN_BITS) + if (cur_lun > CTL_STAT_BITS) errx(1, "Invalid LUN number %d", cur_lun); - if (!F_LUNMASK(&ctx)) + if (!F_MASK(&ctx)) ctx.numdevs = 1; else ctx.numdevs++; - bit_set(ctx.lun_mask, cur_lun); - ctx.flags |= CTLSTAT_FLAG_LUN_MASK; + bit_set(ctx.item_mask, cur_lun); + ctx.flags |= CTLSTAT_FLAG_MASK; + ctx.flags |= CTLSTAT_FLAG_LUNS; break; } case 'n': @@ -676,11 +631,16 @@ main(int argc, char **argv) int cur_port; cur_port = atoi(optarg); - if (cur_port > CTL_MAX_PORTS) - errx(1, "Invalid LUN number %d", cur_port); + if (cur_port > CTL_STAT_BITS) + errx(1, "Invalid port number %d", cur_port); - bit_set(ctx.port_mask, cur_port); - ctx.flags |= CTLSTAT_FLAG_PORT_MASK; + if (!F_MASK(&ctx)) + ctx.numdevs = 1; + else + ctx.numdevs++; + bit_set(ctx.item_mask, cur_port); + ctx.flags |= CTLSTAT_FLAG_MASK; + ctx.flags |= CTLSTAT_FLAG_PORTS; break; } case 't': @@ -697,29 +657,45 @@ main(int argc, char **argv) } } - if (!F_TOTALS(&ctx) && !F_LUNMASK(&ctx)) { + if (F_LUNS(&ctx) && F_PORTS(&ctx)) + errx(1, "Options -p and -l are exclusive."); + + if (!F_LUNS(&ctx) && !F_PORTS(&ctx)) { + if (F_TOTALS(&ctx)) + ctx.flags |= CTLSTAT_FLAG_PORTS; + else + ctx.flags |= CTLSTAT_FLAG_LUNS; + } + + if (!F_TOTALS(&ctx) && !F_MASK(&ctx)) { /* * Note that this just selects the first N LUNs to display, * but at this point we have no knoweledge of which LUN * numbers actually exist. So we may select LUNs that * aren't there. */ - bit_nset(ctx.lun_mask, 0, min(ctx.numdevs - 1, - CTL_STAT_LUN_BITS - 1)); - ctx.flags |= CTLSTAT_FLAG_LUN_MASK; + bit_nset(ctx.item_mask, 0, min(ctx.numdevs - 1, + CTL_STAT_BITS - 1)); + ctx.flags |= CTLSTAT_FLAG_MASK; } if ((fd = open(CTL_DEFAULT_DEV, O_RDWR)) == -1) err(1, "cannot open %s", CTL_DEFAULT_DEV); for (;count != 0;) { - ctx.tmp_lun_stats = ctx.prev_lun_stats; - ctx.prev_lun_stats = ctx.cur_lun_stats; - ctx.cur_lun_stats = ctx.tmp_lun_stats; + tmp_stats = ctx.prev_stats; + ctx.prev_stats = ctx.cur_stats; + ctx.cur_stats = tmp_stats; + c = ctx.prev_alloc; + ctx.prev_alloc = ctx.cur_alloc; + ctx.cur_alloc = c; + c = ctx.prev_items; + ctx.prev_items = ctx.cur_items; + ctx.cur_items = c; ctx.prev_time = ctx.cur_time; ctx.prev_cpu = ctx.cur_cpu; - if (getstats(fd, &ctx.num_luns, &ctx.cur_lun_stats, - &ctx.cur_time, &ctx.flags) != 0) + if (getstats(fd, &ctx.cur_alloc, &ctx.cur_items, + &ctx.cur_stats, &ctx.cur_time, &ctx.flags) != 0) errx(1, "error returned from getstats()"); switch(ctx.mode) { diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 4e4428d9d087..f26bf57c6b65 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -427,6 +427,9 @@ main(int argc, char *argv[]) if (xflag && Tflag) xo_errx(1, "-x and -T are incompatible, pick one."); + /* Load all necessary kvm symbols */ + kresolve_list(nl); + if (Bflag) { if (!live) usage(); @@ -507,9 +510,6 @@ main(int argc, char *argv[]) exit(0); } - /* Load all necessary kvm symbols */ - kresolve_list(nl); - if (tp) { xo_open_container("statistics"); printproto(tp, tp->pr_name, &first); diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index b4a86bbbf592..abefca32ea3e 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -496,7 +496,7 @@ fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags) cq = buf; slim = sa->sa_len + (u_char *) sa; cqlim = cq + sizeof(buf) - sizeof(" ffff"); - snprintf(cq, sizeof(cq), "(%d)", sa->sa_family); + snprintf(cq, sizeof(buf), "(%d)", sa->sa_family); cq += strlen(cq); while (s < slim && cq < cqlim) { snprintf(cq, sizeof(" ff"), " %02x", *s++); diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 32738869b854..dff4b5d7ea01 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -413,7 +413,7 @@ format_header(char *uname_field) { static char Header[128]; const char *prehead; - + if (ps.jail) jidlength = TOP_JID_LEN + 1; /* +1 for extra left space. */ else @@ -559,7 +559,7 @@ get_system_info(struct system_info *si) arc_stats[5] = arc_stat >> 10; si->arc = arc_stats; } - + /* set arrays and strings */ if (pcpu_stats) { si->cpustates = pcpu_cpu_states; @@ -585,7 +585,7 @@ get_system_info(struct system_info *si) mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; size = sizeof(boottime); - if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && + if (sysctl(mib, nitems(mib), &boottime, &size, NULL, 0) != -1 && boottime.tv_sec != 0) { si->boottime = boottime; } else { @@ -1072,7 +1072,7 @@ format_next_process(caddr_t handle, char *(*get_userid)(int), int flags) } } - if (ps.jail == 0) + if (ps.jail == 0) jid_buf[0] = '\0'; else snprintf(jid_buf, sizeof(jid_buf), "%*d", diff --git a/usr.sbin/bhyve/ps2mouse.c b/usr.sbin/bhyve/ps2mouse.c index e207a939a37d..cea7210e2a41 100644 --- a/usr.sbin/bhyve/ps2mouse.c +++ b/usr.sbin/bhyve/ps2mouse.c @@ -62,6 +62,16 @@ __FBSDID("$FreeBSD$"); /* mouse device id */ #define PS2MOUSE_DEV_ID 0x0 +/* mouse data bits */ +#define PS2M_DATA_Y_OFLOW 0x80 +#define PS2M_DATA_X_OFLOW 0x40 +#define PS2M_DATA_Y_SIGN 0x20 +#define PS2M_DATA_X_SIGN 0x10 +#define PS2M_DATA_AONE 0x08 +#define PS2M_DATA_MID_BUTTON 0x04 +#define PS2M_DATA_RIGHT_BUTTON 0x02 +#define PS2M_DATA_LEFT_BUTTON 0x01 + /* mouse status bits */ #define PS2M_STS_REMOTE_MODE 0x40 #define PS2M_STS_ENABLE_DEV 0x20 @@ -169,19 +179,20 @@ movement_get(struct ps2mouse_softc *sc) assert(pthread_mutex_isowned_np(&sc->mtx)); - val0 = sc->status & (PS2M_STS_LEFT_BUTTON | - PS2M_STS_RIGHT_BUTTON | PS2M_STS_MID_BUTTON); + val0 = PS2M_DATA_AONE; + val0 |= sc->status & (PS2M_DATA_LEFT_BUTTON | + PS2M_DATA_RIGHT_BUTTON | PS2M_DATA_MID_BUTTON); if (sc->delta_x >= 0) { if (sc->delta_x > 255) { - val0 |= (1 << 6); + val0 |= PS2M_DATA_X_OFLOW; val1 = 255; } else val1 = sc->delta_x; } else { - val0 |= (1 << 4); + val0 |= PS2M_DATA_X_SIGN; if (sc->delta_x < -255) { - val0 |= (1 << 6); + val0 |= PS2M_DATA_X_OFLOW; val1 = 255; } else val1 = sc->delta_x; @@ -190,14 +201,14 @@ movement_get(struct ps2mouse_softc *sc) if (sc->delta_y >= 0) { if (sc->delta_y > 255) { - val0 |= (1 << 7); + val0 |= PS2M_DATA_Y_OFLOW; val2 = 255; } else val2 = sc->delta_y; } else { - val0 |= (1 << 5); + val0 |= PS2M_DATA_Y_SIGN; if (sc->delta_y < -255) { - val0 |= (1 << 7); + val0 |= PS2M_DATA_Y_OFLOW; val2 = 255; } else val2 = sc->delta_y; diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index efb11f7f7003..f6c9fd946d75 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -209,8 +209,8 @@ struct vring_used { #define VIRTIO_VENDOR 0x1AF4 #define VIRTIO_DEV_NET 0x1000 #define VIRTIO_DEV_BLOCK 0x1001 -#define VIRTIO_DEV_RANDOM 0x1002 #define VIRTIO_DEV_CONSOLE 0x1003 +#define VIRTIO_DEV_RANDOM 0x1005 /* * PCI config space constants. diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt index 85339a3b3eb7..f2887418e212 100644 --- a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt +++ b/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt @@ -56,7 +56,9 @@ begemotAtmFreeBSDGroup MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The FreeBSD specific Begemot MIB for ATM interfaces." - + REVISION "200408060000Z" + DESCRIPTION + "Initial revision." ::= { begemotAtmSysGroup 1 } -- Netgraph diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile index 4bba7cb5d217..82bd325dcaa3 100644 --- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile @@ -2,7 +2,7 @@ # # Author: Harti Brandt <harti@freebsd.org> -CONTRIB= ${.CURDIR}/../../../../contrib/ngatm +CONTRIB= ${SRCTOP}/contrib/ngatm .PATH: ${CONTRIB}/snmp_atm MOD= atm diff --git a/usr.sbin/bsnmpd/modules/snmp_hast/Makefile b/usr.sbin/bsnmpd/modules/snmp_hast/Makefile index d0c3a48f22b0..9d5fcf3dbcec 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hast/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_hast/Makefile @@ -2,7 +2,7 @@ .include <src.opts.mk> -.PATH: ${.CURDIR}/../../../../sbin/hastd +.PATH: ${SRCTOP}/sbin/hastd MOD= hast SRCS= ebuf.c @@ -18,7 +18,7 @@ MAN= snmp_hast.3 NO_WFORMAT= NO_WCAST_ALIGN= NO_WMISSING_VARIABLE_DECLARATIONS= -CFLAGS+=-I${.CURDIR}/../../../../sbin/hastd +CFLAGS+=-I${SRCTOP}/sbin/hastd CFLAGS+=-DHAVE_CAPSICUM CFLAGS+=-DINET .if ${MK_INET6_SUPPORT} != "no" diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt index ee8d284af95f..3c15e090e1fd 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt @@ -54,6 +54,9 @@ begemotHostres MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The MIB for additional HOST-RESOURCES data." + REVISION "200601030000Z" + DESCRIPTION + "Initial revision." ::= { begemot 202 } begemotHostresObjects OBJECT IDENTIFIER ::= { begemotHostres 1 } diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile index 80349ca0414f..0895f56de929 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile @@ -28,7 +28,7 @@ # $FreeBSD$ # -LPRSRC= ${.CURDIR}/../../../lpr/common_source +LPRSRC= ${SRCTOP}/usr.sbin/lpr/common_source .PATH: ${LPRSRC} MOD= hostres @@ -76,6 +76,7 @@ LIBADD= kvm devinfo m geom memstat printcap.pico: printcap.c ${CC} ${PICFLAG} -DPIC ${CFLAGS:C/^-W.*//} -c ${.IMPSRC} -o ${.TARGET} -smilint: +smilint: .PHONY +smilint: ${BMIBS} env SMIPATH=.:/usr/share/snmp/mibs:/usr/local/share/snmp/mibs \ - smilint -c /dev/null -l6 -i group-membership BEGEMOT-HOSTRES-MIB + smilint -c /dev/null -l6 -i group-membership ${.ALLSRC} diff --git a/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile b/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile index 278dc24da68b..6362c0b7cf6d 100644 --- a/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile @@ -2,7 +2,7 @@ # # Author: Harti Brandt <harti@freebsd.org> -CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp +CONTRIB= ${SRCTOP}/contrib/bsnmp .PATH: ${CONTRIB}/snmp_mibII MOD= mibII @@ -22,6 +22,7 @@ BMIBS= BEGEMOT-IP-MIB.txt BEGEMOT-MIB2-MIB.txt .include <bsd.snmpmod.mk> -smilint: +smilint: .PHONY +smilint: ${BMIBS} env SMIPATH=/usr/share/snmp/mibs:/usr/local/share/snmp/mibs \ - smilint -c /dev/null -l6 -i group-membership ${BMIBS:C/^/${CONTRIB}\/snmp_mibII\//} + smilint -c /dev/null -l6 -i group-membership ${.ALLSRC} diff --git a/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt b/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt index 1896fe696ed8..b4f0e2a3f993 100644 --- a/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt +++ b/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt @@ -59,6 +59,19 @@ begemotNg MODULE-IDENTITY E-mail: harti@freebsd.org" DESCRIPTION "The MIB for the NetGraph access module for SNMP." + REVISION "200311140000Z" + DESCRIPTION + "The maximum width of the following OCTET STRINGs was increased + from 15 to 31: + + - NgTypeName + - NgNodeName + - NgNodeNameOrEmpty + - NgHookName + " + REVISION "200201310000Z" + DESCRIPTION + "Initial revision." ::= { begemot 2 } begemotNgObjects OBJECT IDENTIFIER ::= { begemotNg 1 } diff --git a/usr.sbin/bsnmpd/modules/snmp_target/Makefile b/usr.sbin/bsnmpd/modules/snmp_target/Makefile index e6216ea00b3e..b25e9f872453 100644 --- a/usr.sbin/bsnmpd/modules/snmp_target/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_target/Makefile @@ -2,7 +2,7 @@ # # Author: Shteryana Shopova <syrinx@freebsd.org> -CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp +CONTRIB= ${SRCTOP}/contrib/bsnmp .PATH: ${CONTRIB}/snmp_target MOD= target diff --git a/usr.sbin/bsnmpd/modules/snmp_usm/Makefile b/usr.sbin/bsnmpd/modules/snmp_usm/Makefile index 1c4224503753..f3c10fa61665 100644 --- a/usr.sbin/bsnmpd/modules/snmp_usm/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_usm/Makefile @@ -2,7 +2,7 @@ # # Author: Shteryana Shopova <syrinx@freebsd.org> -CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp +CONTRIB= ${SRCTOP}/contrib/bsnmp .PATH: ${CONTRIB}/snmp_usm MOD= usm diff --git a/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile b/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile index 4a09cde733bb..b0099fe344b8 100644 --- a/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile @@ -2,7 +2,7 @@ # # Author: Shteryana Shopova <syrinx@freebsd.org> -CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp +CONTRIB= ${SRCTOP}/contrib/bsnmp .PATH: ${CONTRIB}/snmp_vacm MOD= vacm diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 693493fd8486..90a492f7fe8a 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -34,44 +34,40 @@ static const char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 itojun Exp $"; #endif -#include <stdio.h> - -#include <time.h> -#include <unistd.h> -#include <fnmatch.h> -#include <stdlib.h> -#include <string.h> -#include <signal.h> -#ifdef __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif -#include <syslog.h> -#include <stddef.h> -#include <errno.h> -#include <err.h> -#ifdef HAVE_POLL_H -#include <poll.h> -#endif - -#include <sys/types.h> #include <sys/param.h> #include <sys/file.h> -#include <sys/socket.h> #include <sys/ioctl.h> +#include <sys/socket.h> #include <sys/sysctl.h> #include <sys/uio.h> +#include <arpa/inet.h> #include <net/if.h> #include <net/route.h> #include <netinet/in.h> #include <netinet/in_var.h> #include <netinet/ip6.h> #include <netinet/udp.h> -#include <netdb.h> +#include <err.h> +#include <errno.h> +#include <fnmatch.h> #include <ifaddrs.h> - -#include <arpa/inet.h> +#include <netdb.h> +#ifdef HAVE_POLL_H +#include <poll.h> +#endif +#include <signal.h> +#include <stdio.h> +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <syslog.h> +#include <time.h> +#include <unistd.h> #include "route6d.h" @@ -106,7 +102,7 @@ struct ifc { /* Configuration of an interface */ }; TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); -struct ifac { /* Adddress associated to an interface */ +struct ifac { /* Adddress associated to an interface */ TAILQ_ENTRY(ifac) ifac_next; struct ifc *ifac_ifc; /* back pointer */ @@ -673,7 +669,7 @@ init(void) fatal("rip IPV6_PKTINFO"); /*NOTREACHED*/ } -#endif +#endif #ifdef IPV6_RECVPKTINFO if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, @@ -819,8 +815,8 @@ ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) * Request from non-link local address is not * a regular route6d update. */ - maxrte = (IFMINMTU - sizeof(struct ip6_hdr) - - sizeof(struct udphdr) - + maxrte = (IFMINMTU - sizeof(struct ip6_hdr) - + sizeof(struct udphdr) - sizeof(struct rip6) + sizeof(struct netinfo6)) / sizeof(struct netinfo6); nh = NULL; @@ -868,8 +864,8 @@ ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) return; } - maxrte = (ifcp->ifc_mtu - sizeof(struct ip6_hdr) - - sizeof(struct udphdr) - + maxrte = (ifcp->ifc_mtu - sizeof(struct ip6_hdr) - + sizeof(struct udphdr) - sizeof(struct rip6) + sizeof(struct netinfo6)) / sizeof(struct netinfo6); @@ -953,13 +949,13 @@ out_filter(struct riprt *rrt, struct ifc *ifcp) /* * -A: filter out less specific routes, if we have aggregated * route configured. - */ + */ TAILQ_FOREACH(iffp, &ifcp->ifc_iff_head, iff_next) { if (iffp->iff_type != 'A') continue; if (rrt->rrt_info.rip6_plen <= iffp->iff_plen) continue; - ia = rrt->rrt_info.rip6_dest; + ia = rrt->rrt_info.rip6_dest; applyplen(&ia, iffp->iff_plen); if (IN6_ARE_ADDR_EQUAL(&ia, &iffp->iff_addr)) return 0; @@ -995,7 +991,7 @@ out_filter(struct riprt *rrt, struct ifc *ifcp) continue; if (rrt->rrt_info.rip6_plen < iffp->iff_plen) continue; - ia = rrt->rrt_info.rip6_dest; + ia = rrt->rrt_info.rip6_dest; applyplen(&ia, iffp->iff_plen); if (IN6_ARE_ADDR_EQUAL(&ia, &iffp->iff_addr)) { ok = 1; @@ -1195,8 +1191,8 @@ riprecv(void) } else { riprequest(NULL, np, nn, &fsock); } - return; - } + return; + } if (!IN6_IS_ADDR_LINKLOCAL(&fsock.sin6_addr)) { trace(1, "Response from non-ll addr: %s\n", @@ -1223,7 +1219,7 @@ riprecv(void) * source address to be forwarded to a different link. * So we also check whether the destination address is a link-local * address or the hop limit is 255. Note that RFC2080 does not require - * the specific hop limit for a unicast response, so we cannot assume + * the specific hop limit for a unicast response, so we cannot assume * the limitation. */ if (!IN6_IS_ADDR_LINKLOCAL(&pi->ipi6_addr) && *hlimp != 255) { @@ -1245,7 +1241,7 @@ riprecv(void) return; /* The packet is from me; ignore */ if (rp->rip6_cmd != RIP6_RESPONSE) { trace(1, "Invalid command %d\n", rp->rip6_cmd); - return; + return; } /* -N: no use */ @@ -1323,7 +1319,7 @@ riprecv(void) /* special rule: ::/0 means default, not "in /0" */ if (iffp->iff_plen == 0 && np->rip6_plen > 0) continue; - ia = np->rip6_dest; + ia = np->rip6_dest; applyplen(&ia, iffp->iff_plen); if (IN6_ARE_ADDR_EQUAL(&ia, &iffp->iff_addr)) { ok = 1; @@ -1374,7 +1370,7 @@ riprecv(void) } else if (nq->rip6_metric == np->rip6_metric && np->rip6_metric < HOPCNT_INFINITY6) { if (rrt->rrt_index == ifcp->ifc_index && - IN6_ARE_ADDR_EQUAL(&nh, &rrt->rrt_gw)) { + IN6_ARE_ADDR_EQUAL(&nh, &rrt->rrt_gw)) { /* same metric, same route from same gw */ rrt->rrt_t = t; } else if (rrt->rrt_t < t_half_lifetime) { @@ -1389,7 +1385,7 @@ riprecv(void) rrt->rrt_t = t; } } - /* + /* * if nq->rip6_metric == HOPCNT_INFINITY6 then * do not update age value. Do nothing. */ @@ -1667,7 +1663,7 @@ ifremove(int ifindex) break; } if (ifcp == NULL) - return; + return; tracet(1, "ifremove: %s is departed.\n", ifcp->ifc_name); TAILQ_REMOVE(&ifc_head, ifcp, ifc_next); @@ -1824,7 +1820,7 @@ rtrecv(void) #if 0 if (rta[RTAX_DST] == NULL) { trace(1, "\tno destination, ignored\n"); - continue; + continue; } if (rta[RTAX_DST]->sin6_family != AF_INET6) { trace(1, "\taf mismatch, ignored\n"); @@ -2422,7 +2418,7 @@ getifmtu(int ifindex) mib[3] = AF_INET6; mib[4] = NET_RT_IFLIST; mib[5] = ifindex; - if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), NULL, &msize, NULL, 0) < 0) { fatal("sysctl estimate NET_RT_IFLIST"); /*NOTREACHED*/ } @@ -2430,7 +2426,7 @@ getifmtu(int ifindex) fatal("malloc"); /*NOTREACHED*/ } - if (sysctl(mib, 6, buf, &msize, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, &msize, NULL, 0) < 0) { fatal("sysctl NET_RT_IFLIST"); /*NOTREACHED*/ } @@ -2602,7 +2598,7 @@ krtread(int again) free(buf); buf = NULL; } - if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), NULL, &msize, NULL, 0) < 0) { errmsg = "sysctl estimate"; continue; } @@ -2610,7 +2606,7 @@ krtread(int again) errmsg = "malloc"; continue; } - if (sysctl(mib, 6, buf, &msize, NULL, 0) < 0) { + if (sysctl(mib, nitems(mib), buf, &msize, NULL, 0) < 0) { errmsg = "sysctl NET_RT_DUMP"; continue; } @@ -3238,7 +3234,7 @@ ifonly: #if 0 /* * When the address has already been registered in the - * kernel routing table, it should be removed + * kernel routing table, it should be removed */ delroute(&rrt->rrt_info, &gw); #else @@ -3319,7 +3315,7 @@ mask2len(const struct in6_addr *addr, int lenlim) { int i = 0, j; const u_char *p = (const u_char *)addr; - + for (j = 0; j < lenlim; j++, p++) { if (*p != 0xff) break; @@ -3446,7 +3442,7 @@ ripsuptrig(void) time_t t; double r = rand(); - t = (int)(RIP_TRIG_INT6_MIN + + t = (int)(RIP_TRIG_INT6_MIN + (RIP_TRIG_INT6_MAX - RIP_TRIG_INT6_MIN) * (r / RAND_MAX)); sup_trig_update = time(NULL) + t; return t; diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c index ed45fe9aa0b5..9a9dad811ad7 100644 --- a/usr.sbin/rwhod/rwhod.c +++ b/usr.sbin/rwhod/rwhod.c @@ -43,14 +43,14 @@ static char sccsid[] = "@(#)rwhod.c 8.1 (Berkeley) 6/6/93"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/capsicum.h> #include <sys/param.h> +#include <sys/capsicum.h> +#include <sys/ioctl.h> +#include <sys/procdesc.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/signal.h> -#include <sys/ioctl.h> #include <sys/sysctl.h> -#include <sys/procdesc.h> #include <sys/wait.h> #include <net/if.h> @@ -548,7 +548,7 @@ getboottime(int signo __unused) mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; size = sizeof(tm); - if (sysctl(mib, 2, &tm, &size, NULL, 0) == -1) { + if (sysctl(mib, nitems(mib), &tm, &size, NULL, 0) == -1) { syslog(LOG_ERR, "cannot get boottime: %m"); exit(1); } @@ -629,11 +629,11 @@ configure(int so) mib[3] = AF_INET; mib[4] = NET_RT_IFLIST; mib[5] = 0; - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), NULL, &needed, NULL, 0) < 0) quit("route-sysctl-estimate"); if ((buf = malloc(needed)) == NULL) quit("malloc"); - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), buf, &needed, NULL, 0) < 0) quit("actual retrieval of interface table"); lim = buf + needed; |
