summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/sh/exec.c12
-rwxr-xr-xbin/sh/mkbuiltins15
-rw-r--r--bin/sh/tests/builtins/Makefile1
-rw-r--r--etc/Makefile7
-rw-r--r--etc/mtree/BSD.libsoft.dist14
-rw-r--r--etc/mtree/Makefile4
-rw-r--r--etc/ntp/leap-seconds334
-rw-r--r--etc/rc7
-rw-r--r--lib/libgssapi/gss_release_oid_set.c22
-rw-r--r--lib/libnv/tests/dnv_tests.cc1
-rw-r--r--lib/libnv/tests/nv_array_tests.cc295
-rw-r--r--lib/libstand/Makefile7
-rw-r--r--libexec/rtld-elf/aarch64/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/amd64/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/arm/reloc.c35
-rw-r--r--libexec/rtld-elf/arm/rtld_machdep.h5
-rw-r--r--libexec/rtld-elf/i386/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/mips/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/paths.h10
-rw-r--r--libexec/rtld-elf/powerpc/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/powerpc64/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/rtld.c22
-rw-r--r--libexec/rtld-elf/sparc64/rtld_machdep.h2
-rw-r--r--release/Makefile2
-rw-r--r--release/doc/en_US.ISO8859-1/hardware/article.xml3
-rw-r--r--share/mk/src.opts.mk5
-rw-r--r--share/vt/keymaps/gr.101.acc.kbd8
-rw-r--r--share/vt/keymaps/gr.elot.acc.kbd8
-rw-r--r--share/vt/keymaps/hu.101.kbd4
-rw-r--r--share/vt/keymaps/hu.102.kbd2
-rw-r--r--share/vt/keymaps/lt.kbd8
-rw-r--r--share/vt/keymaps/pt.acc.kbd2
-rw-r--r--share/vt/keymaps/pt.kbd2
-rw-r--r--share/vt/keymaps/ua.kbd4
-rw-r--r--share/vt/keymaps/ua.shift.alt.kbd4
-rw-r--r--sys/amd64/amd64/machdep.c6
-rw-r--r--sys/arm/arm/machdep.c15
-rw-r--r--sys/arm/arm/physmem.c29
-rw-r--r--sys/arm/xscale/ixp425/avila_machdep.c8
-rw-r--r--sys/arm64/arm64/machdep.c2
-rw-r--r--sys/arm64/arm64/ofw_machdep.c54
-rw-r--r--sys/arm64/include/ofw_machdep.h3
-rw-r--r--sys/boot/efi/loader/main.c5
-rw-r--r--sys/boot/libstand32/Makefile146
-rw-r--r--sys/boot/uboot/lib/copy.c24
-rw-r--r--sys/conf/files.arm641
-rw-r--r--sys/dev/ath/ah_osdep.c17
-rw-r--r--sys/dev/ath/ah_osdep.h36
-rw-r--r--sys/dev/iwm/if_iwm.c72
-rw-r--r--sys/dev/iwm/if_iwm_mac_ctxt.c2
-rw-r--r--sys/dev/iwm/if_iwmvar.h214
-rw-r--r--sys/dev/ixl/if_ixl.c4
-rw-r--r--sys/dev/ofw/ofw_bus_subr.c7
-rw-r--r--sys/dev/rt/if_rt.c24
-rw-r--r--sys/dev/sec/sec.c3
-rw-r--r--sys/dev/syscons/plasma/fp16.c98
-rw-r--r--sys/dev/syscons/plasma/fp16.h3
-rw-r--r--sys/dev/syscons/plasma/plasma_saver.c2
-rw-r--r--sys/dev/tsec/if_tsec.c2
-rw-r--r--sys/fs/devfs/devfs_vnops.c8
-rw-r--r--sys/i386/i386/machdep.c9
-rw-r--r--sys/kern/kern_environment.c38
-rw-r--r--sys/kgssapi/gss_impl.c19
-rw-r--r--sys/mips/beri/beri_machdep.c2
-rw-r--r--sys/modules/Makefile3
-rw-r--r--sys/net/route.c143
-rw-r--r--sys/net/route.h15
-rw-r--r--sys/net/rtsock.c27
-rw-r--r--sys/net80211/ieee80211_scan_sw.c2
-rw-r--r--sys/netgraph/netflow/netflow.c2
-rw-r--r--sys/netinet/in.c48
-rw-r--r--sys/netinet/in_fib.c9
-rw-r--r--sys/netinet6/icmp6.c6
-rw-r--r--sys/netinet6/in6.h2
-rw-r--r--sys/netinet6/in6_pcb.c2
-rw-r--r--sys/netinet6/in6_src.c39
-rw-r--r--sys/netinet6/ip6_output.c130
-rw-r--r--sys/netinet6/ip6_var.h2
-rw-r--r--sys/netinet6/nd6.c25
-rw-r--r--sys/netinet6/nd6_nbr.c87
-rw-r--r--sys/netinet6/raw_ip6.c4
-rw-r--r--sys/netinet6/udp6_usrreq.c2
-rw-r--r--sys/powerpc/aim/aim_machdep.c11
-rw-r--r--sys/powerpc/aim/locore64.S7
-rw-r--r--sys/powerpc/aim/mp_cpudep.c8
-rw-r--r--sys/powerpc/booke/booke_machdep.c10
-rw-r--r--sys/powerpc/include/cpu.h19
-rw-r--r--sys/powerpc/include/intr_machdep.h2
-rw-r--r--sys/powerpc/mpc85xx/lbc.c6
-rw-r--r--sys/powerpc/mpc85xx/pci_mpc85xx.c114
-rw-r--r--sys/powerpc/powerpc/cpu.c101
-rw-r--r--sys/powerpc/powerpc/intr_machdep.c6
-rw-r--r--sys/powerpc/powerpc/machdep.c3
-rw-r--r--sys/sparc64/include/ofw_machdep.h3
-rw-r--r--sys/sparc64/sparc64/machdep.c3
-rw-r--r--sys/x86/xen/pv.c9
-rw-r--r--tools/regression/geom_mirror/conf.sh7
-rw-r--r--tools/regression/geom_mirror/test-1.t19
-rw-r--r--tools/regression/geom_mirror/test-2.t25
-rw-r--r--tools/regression/geom_mirror/test-3.t24
-rw-r--r--tools/regression/geom_mirror/test-4.t26
-rw-r--r--tools/regression/geom_mirror/test-5.t24
-rw-r--r--tools/regression/geom_mirror/test-6.t25
-rw-r--r--tools/regression/geom_mirror/test-7.t24
-rw-r--r--tools/regression/geom_subr.sh3
-rw-r--r--usr.sbin/gssd/gssd.c2
-rw-r--r--usr.sbin/kbdcontrol/kbdmap.514
107 files changed, 1667 insertions, 1086 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c
index 7d18c3c..ab86b76 100644
--- a/bin/sh/exec.c
+++ b/bin/sh/exec.c
@@ -439,12 +439,14 @@ success:
int
find_builtin(const char *name, int *special)
{
- const struct builtincmd *bp;
+ const unsigned char *bp;
+ size_t len;
- for (bp = builtincmd ; bp->name ; bp++) {
- if (*bp->name == *name && equal(bp->name, name)) {
- *special = bp->special;
- return bp->code;
+ len = strlen(name);
+ for (bp = builtincmd ; *bp ; bp += 2 + bp[0]) {
+ if (bp[0] == len && memcmp(bp + 2, name, len) == 0) {
+ *special = (bp[1] & BUILTIN_SPECIAL) != 0;
+ return bp[1] & ~BUILTIN_SPECIAL;
}
}
return -1;
diff --git a/bin/sh/mkbuiltins b/bin/sh/mkbuiltins
index 1be7ff1..02be8ab 100755
--- a/bin/sh/mkbuiltins
+++ b/bin/sh/mkbuiltins
@@ -62,17 +62,16 @@ echo 'int (*const builtinfunc[])(int, char **) = {'
awk '/^[^#]/ { printf "\t%s,\n", $1}' $temp
echo '};
-const struct builtincmd builtincmd[] = {'
+const unsigned char builtincmd[] = {'
awk '{ for (i = 2 ; i <= NF ; i++) {
if ($i == "-s") {
spc = 1;
} else {
- printf "\t{ \"%s\", %d, %d },\n", $i, NR-1, spc
+ printf "\t\"\\%03o\\%03o%s\"\n", length($i), (spc ? 128 : 0) + NR-1, $i
spc = 0;
}
}}' $temp
-echo ' { NULL, 0, 0 }
-};'
+echo '};'
exec > builtins.h
cat <<\!
@@ -85,14 +84,10 @@ cat <<\!
tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ < $temp |
awk '{ printf "#define %s %d\n", $1, NR-1}'
echo '
-struct builtincmd {
- const char *name;
- int code;
- int special;
-};
+#define BUILTIN_SPECIAL 0x80
extern int (*const builtinfunc[])(int, char **);
-extern const struct builtincmd builtincmd[];
+extern const unsigned char builtincmd[];
'
awk '{ printf "int %s(int, char **);\n", $1}' $temp
rm -f $temp
diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile
index 46a0b41..63e6ab5 100644
--- a/bin/sh/tests/builtins/Makefile
+++ b/bin/sh/tests/builtins/Makefile
@@ -94,6 +94,7 @@ FILES+= getopts5.0
FILES+= getopts6.0
FILES+= getopts7.0
FILES+= getopts8.0 getopts8.0.stdout
+FILES+= getopts9.0 getopts9.0.stdout
FILES+= hash1.0 hash1.0.stdout
FILES+= hash2.0 hash2.0.stdout
FILES+= hash3.0 hash3.0.stdout
diff --git a/etc/Makefile b/etc/Makefile
index cf97988..5484c11 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -154,6 +154,9 @@ MTREE= BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
.if ${MK_LIB32} != "no"
MTREE+= BSD.lib32.dist
.endif
+.if ${MK_LIBSOFT} != "no"
+MTREE+= BSD.libsoft.dist
+.endif
.if ${MK_TESTS} != "no"
MTREE+= BSD.tests.dist
.endif
@@ -354,6 +357,10 @@ MTREES+= mtree/BSD.groff.dist /usr
MTREES+= mtree/BSD.lib32.dist /usr
MTREES+= mtree/BSD.lib32.dist /usr/lib/debug/usr
.endif
+.if ${MK_LIBSOFT} != "no"
+MTREES+= mtree/BSD.libsoft.dist /usr
+MTREES+= mtree/BSD.libsoft.dist /usr/lib/debug/usr
+.endif
.if ${MK_TESTS} != "no"
MTREES+= mtree/BSD.tests.dist ${TESTSBASE}
MTREES+= mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE}
diff --git a/etc/mtree/BSD.libsoft.dist b/etc/mtree/BSD.libsoft.dist
new file mode 100644
index 0000000..69026a7
--- /dev/null
+++ b/etc/mtree/BSD.libsoft.dist
@@ -0,0 +1,14 @@
+# $FreeBSD$
+#
+# Please see the file src/etc/mtree/README before making changes to this file.
+#
+
+/set type=dir uname=root gname=wheel mode=0755
+.
+ libsoft
+ dtrace
+ ..
+ i18n
+ ..
+ ..
+..
diff --git a/etc/mtree/Makefile b/etc/mtree/Makefile
index 1a941e4..d8df25d 100644
--- a/etc/mtree/Makefile
+++ b/etc/mtree/Makefile
@@ -6,6 +6,7 @@ FILES= ${_BSD.debug.dist} \
BSD.include.dist \
BSD.root.dist \
${_BSD.lib32.dist} \
+ ${_BSD.libsoft.dist} \
${_BSD.sendmail.dist} \
${_BSD.tests.dist} \
BSD.usr.dist \
@@ -20,6 +21,9 @@ _BSD.groff.dist= BSD.groff.dist
.if ${MK_LIB32} != "no"
_BSD.lib32.dist= BSD.lib32.dist
.endif
+.if ${MK_LIBSOFT} != "no"
+_BSD.libsoft.dist= BSD.libsoft.dist
+.endif
.if ${MK_SENDMAIL} != "no"
_BSD.sendmail.dist= BSD.sendmail.dist
.endif
diff --git a/etc/ntp/leap-seconds b/etc/ntp/leap-seconds
index b8b41f2..8fa6225 100644
--- a/etc/ntp/leap-seconds
+++ b/etc/ntp/leap-seconds
@@ -1,119 +1,221 @@
#
# $FreeBSD$
#
-# ATOMIC TIME.
-# The Coordinated Universal Time (UTC) is the reference time scale derived
-# from The "Temps Atomique International" (TAI) calculated by the Bureau
-# International des Poids et Mesures (BIPM) using a worldwide network of atomic
-# clocks. UTC differs from TAI by an integer number of seconds; it is the basis
-# of all activities in the world.
-#
-#
-# ASTRONOMICAL TIME (UT1) is the time scale based on the rate of rotation of the earth.
-# It is now mainly derived from Very Long Baseline Interferometry (VLBI). The various
-# irregular fluctuations progressively detected in the rotation rate of the Earth lead
-# in 1972 to the replacement of UT1 by UTC as the reference time scale.
-#
-#
-# LEAP SECOND
-# Atomic clocks are more stable than the rate of the earth rotatiob since the later
-# undergoes a full range of geophysical perturbations at various time scales (lunisolar
-# and core-mantle torques,atmospheric and oceanic effetcs, ...)
-# Leap seconds are needed to keep the two time scales in agreement, i.e. UT1-UTC smaller
-# than 0.9 second. So, when necessary a "leap second" is introduced in UTC.
-# Since the adoption of this system in 1972 it has been necessary to add 26 seconds to UTC,
-# firstly due to the initial choice of the value of the second (1/86400 mean solar day of
-# the year 1820) and secondly to the general slowing down of the Earth's rotation. It is
-# theorically possible to have a negative leap second (a second removed from UTC), but so far,
-# all leap seconds have been positive (a second has been added to UTC). Based on what we know about the earth's rotation,
-# it is unlikely that we will ever have a negative leap second.
-#
-#
-# HISTORY
-# The first leap second was added on June 30, 1972. Until 2000, it was necessary in average to add a leap second at a rate
-# of 1 to 2 years. Since 2000, due to the fact that the earth rate of rotation is accelerating, leap seconds are introduced
-# with an average frequency of 3 to 4 years.
-#
-#
-# RESPONSABILITY OF THE DECISION TO INTRODUCE A LEAP SECOND IN UTC
-# The decision to introduce a leap second in UTC is the responsibility of the Earth Orientation Center of
-# the International Earth Rotation and reference System Service (IERS). This center is located at Paris
-# Observatory. According to international agreements, leap second date have to occur at fixed date :
-# first preference is given to the end of December and June, and second preference at the end of March
-# and September. Since the system was introduced in 1972, only dates in June and December were used.
-#
-# Questions or comments to:
-# Daniel Gambis, daniel.gambis@obspm.fr
-# Christian Bizouard: christian.bizouard@obspm.fr
-# Earth orientation Center of the IERS
-# Paris Observatory, France
-#
-#
-#
-# VALIDITY OF THE FILE
-# It is important to express the validity of the file. These next two dates are
-# given in units of seconds since 1900.0.
-#
-# 1) Last update of the file.
-#
-# Updated through IERS Bulletin C (ftp://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat)
-#
-# The following line shows the last update of this file in NTP timestamp:
-#
-#$ 3645216000
-#
-# 2) Expiration date of the file given on a semi-annual basis: last June or last December
-#
-# File expires on 28 December 2015
-#
-# Expire date in NTP timestamp:
-#
-#@ 3660249600
-#
-#
-# LIST OF LEAP SECONDS
-# NTP timestamp (X parameter) is the number of seconds since 1900.0
-#
-# MJD: The Modified Julian Day number. MJD = X/86400 + 15020
-#
-# DTAI: The difference DTAI= TAI-UTC in units of seconds
-# It is the quantity to add to UTC to get the time in TAI
-#
-# Day Month Year : epoch in clear
-#
-#NTP Time DTAI Day Month Year
-#
-2272060800 10 # 1 Jan 1972
-2287785600 11 # 1 Jul 1972
-2303683200 12 # 1 Jan 1973
-2335219200 13 # 1 Jan 1974
-2366755200 14 # 1 Jan 1975
-2398291200 15 # 1 Jan 1976
-2429913600 16 # 1 Jan 1977
-2461449600 17 # 1 Jan 1978
-2492985600 18 # 1 Jan 1979
-2524521600 19 # 1 Jan 1980
-2571782400 20 # 1 Jul 1981
-2603318400 21 # 1 Jul 1982
-2634854400 22 # 1 Jul 1983
-2698012800 23 # 1 Jul 1985
-2776982400 24 # 1 Jan 1988
-2840140800 25 # 1 Jan 1990
-2871676800 26 # 1 Jan 1991
-2918937600 27 # 1 Jul 1992
-2950473600 28 # 1 Jul 1993
-2982009600 29 # 1 Jul 1994
-3029443200 30 # 1 Jan 1996
-3076704000 31 # 1 Jul 1997
-3124137600 32 # 1 Jan 1999
-3345062400 33 # 1 Jan 2006
-3439756800 34 # 1 Jan 2009
-3550089600 35 # 1 Jul 2012
-3644697600 36 # 1 Jul 2015
-#
-# In order to verify the integrity of this file, a hash code
-# has been generated. For more information how to use
-# this hash code, please consult the README file under the
-# 'sha' repertory.
-#
-#h 620ba8af 37900668 95ac09ba d77640f9 6fd75493
+# In the following text, the symbol '#' introduces
+# a comment, which continues from that symbol until
+# the end of the line. A plain comment line has a
+# whitespace character following the comment indicator.
+# There are also special comment lines defined below.
+# A special comment will always have a non-whitespace
+# character in column 2.
+#
+# A blank line should be ignored.
+#
+# The following table shows the corrections that must
+# be applied to compute International Atomic Time (TAI)
+# from the Coordinated Universal Time (UTC) values that
+# are transmitted by almost all time services.
+#
+# The first column shows an epoch as a number of seconds
+# since 1900.0 and the second column shows the number of
+# seconds that must be added to UTC to compute TAI for
+# any timestamp at or after that epoch. The value on
+# each line is valid from the indicated initial instant
+# until the epoch given on the next one or indefinitely
+# into the future if there is no next line.
+# (The comment on each line shows the representation of
+# the corresponding initial epoch in the usual
+# day-month-year format. The epoch always begins at
+# 00:00:00 UTC on the indicated day. See Note 5 below.)
+#
+# Important notes:
+#
+# 1. Coordinated Universal Time (UTC) is often referred to
+# as Greenwich Mean Time (GMT). The GMT time scale is no
+# longer used, and the use of GMT to designate UTC is
+# discouraged.
+#
+# 2. The UTC time scale is realized by many national
+# laboratories and timing centers. Each laboratory
+# identifies its realization with its name: Thus
+# UTC(NIST), UTC(USNO), etc. The differences among
+# these different realizations are typically on the
+# order of a few nanoseconds (i.e., 0.000 000 00x s)
+# and can be ignored for many purposes. These differences
+# are tabulated in Circular T, which is published monthly
+# by the International Bureau of Weights and Measures
+# (BIPM). See www.bipm.fr for more information.
+#
+# 3. The current defintion of the relationship between UTC
+# and TAI dates from 1 January 1972. A number of different
+# time scales were in use before than epoch, and it can be
+# quite difficult to compute precise timestamps and time
+# intervals in those "prehistoric" days. For more information,
+# consult:
+#
+# The Explanatory Supplement to the Astronomical
+# Ephemeris.
+# or
+# Terry Quinn, "The BIPM and the Accurate Measurement
+# of Time," Proc. of the IEEE, Vol. 79, pp. 894-905,
+# July, 1991.
+#
+# 4. The insertion of leap seconds into UTC is currently the
+# responsibility of the International Earth Rotation Service,
+# which is located at the Paris Observatory:
+#
+# Central Bureau of IERS
+# 61, Avenue de l'Observatoire
+# 75014 Paris, France.
+#
+# Leap seconds are announced by the IERS in its Bulletin C
+#
+# See hpiers.obspm.fr or www.iers.org for more details.
+#
+# All national laboratories and timing centers use the
+# data from the BIPM and the IERS to construct their
+# local realizations of UTC.
+#
+# Although the definition also includes the possibility
+# of dropping seconds ("negative" leap seconds), this has
+# never been done and is unlikely to be necessary in the
+# foreseeable future.
+#
+# 5. If your system keeps time as the number of seconds since
+# some epoch (e.g., NTP timestamps), then the algorithm for
+# assigning a UTC time stamp to an event that happens during a positive
+# leap second is not well defined. The official name of that leap
+# second is 23:59:60, but there is no way of representing that time
+# in these systems.
+# Many systems of this type effectively stop the system clock for
+# one second during the leap second and use a time that is equivalent
+# to 23:59:59 UTC twice. For these systems, the corresponding TAI
+# timestamp would be obtained by advancing to the next entry in the
+# following table when the time equivalent to 23:59:59 UTC
+# is used for the second time. Thus the leap second which
+# occurred on 30 June 1972 at 23:59:59 UTC would have TAI
+# timestamps computed as follows:
+#
+# ...
+# 30 June 1972 23:59:59 (2287785599, first time): TAI= UTC + 10 seconds
+# 30 June 1972 23:59:60 (2287785599,second time): TAI= UTC + 11 seconds
+# 1 July 1972 00:00:00 (2287785600) TAI= UTC + 11 seconds
+# ...
+#
+# If your system realizes the leap second by repeating 00:00:00 UTC twice
+# (this is possible but not usual), then the advance to the next entry
+# in the table must occur the second time that a time equivlent to
+# 00:00:00 UTC is used. Thus, using the same example as above:
+#
+# ...
+# 30 June 1972 23:59:59 (2287785599): TAI= UTC + 10 seconds
+# 30 June 1972 23:59:60 (2287785600, first time): TAI= UTC + 10 seconds
+# 1 July 1972 00:00:00 (2287785600,second time): TAI= UTC + 11 seconds
+# ...
+#
+# in both cases the use of timestamps based on TAI produces a smooth
+# time scale with no discontinuity in the time interval.
+#
+# This complexity would not be needed for negative leap seconds (if they
+# are ever used). The UTC time would skip 23:59:59 and advance from
+# 23:59:58 to 00:00:00 in that case. The TAI offset would decrease by
+# 1 second at the same instant. This is a much easier situation to deal
+# with, since the difficulty of unambiguously representing the epoch
+# during the leap second does not arise.
+#
+# Questions or comments to:
+# Jeff Prillaman
+# Time Service Department
+# US Naval Observatory
+# Washington, DC
+# jeffrey.prillaman@usno.navy.mil
+#
+# Last Update of leap second values: 31 Dec 2015
+#
+# The following line shows this last update date in NTP timestamp
+# format. This is the date on which the most recent change to
+# the leap second data was added to the file. This line can
+# be identified by the unique pair of characters in the first two
+# columns as shown below.
+#
+#$ 3660508800
+#
+# The data in this file will be updated periodically as new leap
+# seconds are announced. In addition to being entered on the line
+# above, the update time (in NTP format) will be added to the basic
+# file name leap-seconds to form the name leap-seconds.<NTP TIME>.
+# In addition, the generic name leap-seconds.list will always point to
+# the most recent version of the file.
+#
+# This update procedure will be performed only when a new leap second
+# is announced.
+#
+# The following entry specifies the expiration date of the data
+# in this file in units of seconds since 1900.0. This expiration date
+# will be changed at least twice per year whether or not a new leap
+# second is announced. These semi-annual changes will be made no
+# later than 1 June and 1 December of each year to indicate what
+# action (if any) is to be taken on 30 June and 31 December,
+# respectively. (These are the customary effective dates for new
+# leap seconds.) This expiration date will be identified by a
+# unique pair of characters in columns 1 and 2 as shown below.
+# In the unlikely event that a leap second is announced with an
+# effective date other than 30 June or 31 December, then this
+# file will be edited to include that leap second as soon as it is
+# announced or at least one month before the effective date
+# (whichever is later).
+# If an announcement by the IERS specifies that no leap second is
+# scheduled, then only the expiration date of the file will
+# be advanced to show that the information in the file is still
+# current -- the update time stamp, the data and the name of the file
+# will not change.
+#
+# Updated through IERS Bulletin C 50
+# File expires on: 1 Jun 2016
+#
+#@ 3673728000
+#
+2272060800 10 # 1 Jan 1972
+2287785600 11 # 1 Jul 1972
+2303683200 12 # 1 Jan 1973
+2335219200 13 # 1 Jan 1974
+2366755200 14 # 1 Jan 1975
+2398291200 15 # 1 Jan 1976
+2429913600 16 # 1 Jan 1977
+2461449600 17 # 1 Jan 1978
+2492985600 18 # 1 Jan 1979
+2524521600 19 # 1 Jan 1980
+2571782400 20 # 1 Jul 1981
+2603318400 21 # 1 Jul 1982
+2634854400 22 # 1 Jul 1983
+2698012800 23 # 1 Jul 1985
+2776982400 24 # 1 Jan 1988
+2840140800 25 # 1 Jan 1990
+2871676800 26 # 1 Jan 1991
+2918937600 27 # 1 Jul 1992
+2950473600 28 # 1 Jul 1993
+2982009600 29 # 1 Jul 1994
+3029443200 30 # 1 Jan 1996
+3076704000 31 # 1 Jul 1997
+3124137600 32 # 1 Jan 1999
+3345062400 33 # 1 Jan 2006
+3439756800 34 # 1 Jan 2009
+3550089600 35 # 1 Jul 2012
+3644697600 36 # 1 Jul 2015
+#
+# the following special comment contains the
+# hash value of the data in this file computed
+# use the secure hash algorithm as specified
+# by FIPS 180-1. See the files in ~/sha for
+# the details of how this hash value is
+# computed. Note that the hash computation
+# ignores comments and whitespace characters
+# in data lines. It includes the NTP values
+# of both the last modification time and the
+# expiration time of the file, but not the
+# white space on those lines.
+# the hash line is also ignored in the
+# computation.
+#
+#h 44a44c49 35b22601 a9c7054c 8c56cf57 9b6f6ed5
+#
diff --git a/etc/rc b/etc/rc
index 4efc293..2c90f38 100644
--- a/etc/rc
+++ b/etc/rc
@@ -131,11 +131,14 @@ done
# Remove the firstboot sentinel, and reboot if it was requested.
if [ -e ${firstboot_sentinel} ]; then
- rm ${firstboot_sentinel}
+ [ ${root_rw_mount} = "yes" ] || mount -uw /
+ /bin/rm ${firstboot_sentinel}
if [ -e ${firstboot_sentinel}-reboot ]; then
- rm ${firstboot_sentinel}-reboot
+ /bin/rm ${firstboot_sentinel}-reboot
+ [ ${root_rw_mount} = "yes" ] || mount -ur /
kill -INT 1
fi
+ [ ${root_rw_mount} = "yes" ] || mount -ur /
fi
echo ''
diff --git a/lib/libgssapi/gss_release_oid_set.c b/lib/libgssapi/gss_release_oid_set.c
index bedb90b..a46853a 100644
--- a/lib/libgssapi/gss_release_oid_set.c
+++ b/lib/libgssapi/gss_release_oid_set.c
@@ -32,15 +32,25 @@
OM_uint32
gss_release_oid_set(OM_uint32 *minor_status,
- gss_OID_set *set)
+ gss_OID_set *setp)
{
+ gss_OID_set set;
+ gss_OID o;
+ size_t i;
*minor_status = 0;
- if (set && *set) {
- if ((*set)->elements)
- free((*set)->elements);
- free(*set);
- *set = GSS_C_NO_OID_SET;
+ if (setp) {
+ set = *setp;
+ if (set) {
+ for (i = 0; i < set->count; i++) {
+ o = &set->elements[i];
+ if (o->elements)
+ free(o->elements);
+ }
+ free(set->elements);
+ free(set);
+ *setp = GSS_C_NO_OID_SET;
+ }
}
return (GSS_S_COMPLETE);
}
diff --git a/lib/libnv/tests/dnv_tests.cc b/lib/libnv/tests/dnv_tests.cc
index fe80d00..a21a91d 100644
--- a/lib/libnv/tests/dnv_tests.cc
+++ b/lib/libnv/tests/dnv_tests.cc
@@ -27,6 +27,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/types.h>
#include <sys/dnv.h>
#include <sys/nv.h>
diff --git a/lib/libnv/tests/nv_array_tests.cc b/lib/libnv/tests/nv_array_tests.cc
index 3de0ee8..f6ffcef 100644
--- a/lib/libnv/tests/nv_array_tests.cc
+++ b/lib/libnv/tests/nv_array_tests.cc
@@ -27,8 +27,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/nv.h>
+#include <sys/param.h>
#include <sys/types.h>
+#include <sys/nv.h>
#include <sys/socket.h>
#include <atf-c++.hpp>
@@ -50,7 +51,7 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__basic)
const bool *const_result;
bool *result;
nvlist_t *nvl;
- size_t nitems;
+ size_t num_items;
unsigned int i;
const char *key;
@@ -69,16 +70,16 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__basic)
ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
ATF_REQUIRE(nvlist_exists_bool_array(nvl, "nvl/bool"));
- const_result = nvlist_get_bool_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, 16);
+ const_result = nvlist_get_bool_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, 16);
ATF_REQUIRE(const_result != NULL);
- for (i = 0; i < nitems; i++)
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE_EQ(const_result[i], testbool[i]);
- result = nvlist_take_bool_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, 16);
+ result = nvlist_take_bool_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, 16);
ATF_REQUIRE(const_result != NULL);
- for (i = 0; i < nitems; i++)
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE_EQ(result[i], testbool[i]);
ATF_REQUIRE(!nvlist_exists_bool_array(nvl, key));
@@ -95,10 +96,10 @@ ATF_TEST_CASE_BODY(nvlist_string_array__basic)
const char * const *const_result;
char **result;
nvlist_t *nvl;
- size_t nitems;
+ size_t num_items;
unsigned int i;
const char *key;
- const char *string[8] = { "a", "b", "kot", "foo",
+ const char *string_arr[8] = { "a", "b", "kot", "foo",
"tests", "nice test", "", "abcdef" };
key = "nvl/string";
@@ -107,32 +108,33 @@ ATF_TEST_CASE_BODY(nvlist_string_array__basic)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
- nvlist_add_string_array(nvl, key, string, 8);
+ nvlist_add_string_array(nvl, key, string_arr, nitems(string_arr));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
ATF_REQUIRE(nvlist_exists_string_array(nvl, "nvl/string"));
- const_result = nvlist_get_string_array(nvl, key, &nitems);
+ const_result = nvlist_get_string_array(nvl, key, &num_items);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(const_result != NULL);
- ATF_REQUIRE(nitems == 8);
- for (i = 0; i < nitems; i++) {
- if (string[i] != NULL) {
- ATF_REQUIRE(strcmp(const_result[i], string[i]) == 0);
+ ATF_REQUIRE(num_items == nitems(string_arr));
+ for (i = 0; i < num_items; i++) {
+ if (string_arr[i] != NULL) {
+ ATF_REQUIRE(strcmp(const_result[i],
+ string_arr[i]) == 0);
} else {
- ATF_REQUIRE(const_result[i] == string[i]);
+ ATF_REQUIRE(const_result[i] == string_arr[i]);
}
}
- result = nvlist_take_string_array(nvl, key, &nitems);
+ result = nvlist_take_string_array(nvl, key, &num_items);
ATF_REQUIRE(result != NULL);
- ATF_REQUIRE_EQ(nitems, 8);
- for (i = 0; i < nitems; i++) {
- if (string[i] != NULL) {
- ATF_REQUIRE_EQ(strcmp(result[i], string[i]), 0);
+ ATF_REQUIRE_EQ(num_items, nitems(string_arr));
+ for (i = 0; i < num_items; i++) {
+ if (string_arr[i] != NULL) {
+ ATF_REQUIRE_EQ(strcmp(result[i], string_arr[i]), 0);
} else {
- ATF_REQUIRE_EQ(result[i], string[i]);
+ ATF_REQUIRE_EQ(result[i], string_arr[i]);
}
}
@@ -140,7 +142,7 @@ ATF_TEST_CASE_BODY(nvlist_string_array__basic)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
- for (i = 0; i < 8; i++)
+ for (i = 0; i < num_items; i++)
free(result[i]);
free(result);
nvlist_destroy(nvl);
@@ -152,11 +154,11 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__basic)
int fd[32], *result;
const int *const_result;
nvlist_t *nvl;
- size_t nitems;
+ size_t num_items;
unsigned int i;
const char *key;
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < nitems(fd); i++) {
fd[i] = dup(STDERR_FILENO);
ATF_REQUIRE(fd_is_valid(fd[i]));
}
@@ -167,26 +169,26 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__basic)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE(!nvlist_exists_descriptor_array(nvl, key));
- nvlist_add_descriptor_array(nvl, key, fd, 32);
+ nvlist_add_descriptor_array(nvl, key, fd, nitems(fd));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, "nvl/descriptor"));
- const_result = nvlist_get_descriptor_array(nvl, key, &nitems);
+ const_result = nvlist_get_descriptor_array(nvl, key, &num_items);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(const_result != NULL);
- ATF_REQUIRE(nitems == 32);
- for (i = 0; i < nitems; i++) {
+ ATF_REQUIRE(num_items == nitems(fd));
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE(fd_is_valid(const_result[i]));
if (i > 0)
ATF_REQUIRE(const_result[i] != const_result[i - 1]);
}
- result = nvlist_take_descriptor_array(nvl, key, &nitems);
+ result = nvlist_take_descriptor_array(nvl, key, &num_items);
ATF_REQUIRE(result != NULL);
- ATF_REQUIRE_EQ(nitems, 32);
- for (i = 0; i < nitems; i++) {
+ ATF_REQUIRE_EQ(num_items, nitems(fd));
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE(fd_is_valid(result[i]));
if (i > 0)
ATF_REQUIRE(const_result[i] != const_result[i - 1]);
@@ -196,7 +198,7 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__basic)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
- for (i = 0; i < nitems; i++) {
+ for (i = 0; i < num_items; i++) {
close(result[i]);
close(fd[i]);
}
@@ -210,7 +212,7 @@ ATF_TEST_CASE_BODY(nvlist_number_array__basic)
const uint64_t *const_result;
uint64_t *result;
nvlist_t *nvl;
- size_t nitems;
+ size_t num_items;
unsigned int i;
const char *key;
const uint64_t number[8] = { 0, UINT_MAX, 7, 123, 90,
@@ -222,23 +224,23 @@ ATF_TEST_CASE_BODY(nvlist_number_array__basic)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
- nvlist_add_number_array(nvl, key, number, 8);
+ nvlist_add_number_array(nvl, key, number, nitems(number));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
ATF_REQUIRE(nvlist_exists_number_array(nvl, "nvl/number"));
- const_result = nvlist_get_number_array(nvl, key, &nitems);
+ const_result = nvlist_get_number_array(nvl, key, &num_items);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(const_result != NULL);
- ATF_REQUIRE(nitems == 8);
- for (i = 0; i < nitems; i++)
+ ATF_REQUIRE(num_items == nitems(number));
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE_EQ(const_result[i], number[i]);
- result = nvlist_take_number_array(nvl, key, &nitems);
+ result = nvlist_take_number_array(nvl, key, &num_items);
ATF_REQUIRE(result != NULL);
- ATF_REQUIRE_EQ(nitems, 8);
- for (i = 0; i < nitems; i++)
+ ATF_REQUIRE_EQ(num_items, nitems(number));
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE_EQ(result[i], number[i]);
ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
@@ -256,7 +258,7 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__basic)
const nvlist_t * const *const_result;
nvlist_t **result;
nvlist_t *nvl;
- size_t nitems;
+ size_t num_items;
unsigned int i;
const char *somestr[8] = { "a", "b", "c", "d", "e", "f", "g", "h" };
const char *key;
@@ -282,14 +284,14 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__basic)
ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, key));
ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, "nvl/nvlist"));
- const_result = nvlist_get_nvlist_array(nvl, key, &nitems);
+ const_result = nvlist_get_nvlist_array(nvl, key, &num_items);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(const_result != NULL);
- ATF_REQUIRE(nitems == 8);
+ ATF_REQUIRE(num_items == nitems(testnvl));
- for (i = 0; i < nitems; i++) {
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE_EQ(nvlist_error(const_result[i]), 0);
- if (i < nitems - 1) {
+ if (i < num_items - 1) {
ATF_REQUIRE(nvlist_get_array_next(const_result[i]) ==
const_result[i + 1]);
} else {
@@ -304,10 +306,10 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__basic)
"nvl/string"), somestr[i]) == 0);
}
- result = nvlist_take_nvlist_array(nvl, key, &nitems);
+ result = nvlist_take_nvlist_array(nvl, key, &num_items);
ATF_REQUIRE(result != NULL);
- ATF_REQUIRE_EQ(nitems, 8);
- for (i = 0; i < nitems; i++) {
+ ATF_REQUIRE_EQ(num_items, 8);
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE_EQ(nvlist_error(result[i]), 0);
ATF_REQUIRE(nvlist_get_array_next(result[i]) == NULL);
ATF_REQUIRE(nvlist_get_array_next(const_result[i]) == NULL);
@@ -335,19 +337,19 @@ ATF_TEST_CASE_BODY(nvlist_clone_array)
const nvlist_t *nvl;
bool testbool[16];
int testfd[16];
- size_t i, nitems;
- const char *string[8] = { "a", "b", "kot", "foo",
+ size_t i, num_items;
+ const char *string_arr[8] = { "a", "b", "kot", "foo",
"tests", "nice test", "", "abcdef" };
const char *somestr[8] = { "a", "b", "c", "d", "e", "f", "g", "h" };
const uint64_t number[8] = { 0, UINT_MAX, 7, 123, 90,
100000, 8, 1 };
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < nitems(testfd); i++) {
testbool[i] = (i % 2 == 0);
testfd[i] = dup(STDERR_FILENO);
ATF_REQUIRE(fd_is_valid(testfd[i]));
}
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < nitems(testnvl); i++) {
testnvl[i] = nvlist_create(0);
ATF_REQUIRE(nvlist_error(testnvl[i]) == 0);
nvlist_add_string(testnvl[i], "nvl/nvl/teststr", somestr[i]);
@@ -358,28 +360,30 @@ ATF_TEST_CASE_BODY(nvlist_clone_array)
ATF_REQUIRE(nvlist_error(src) == 0);
ATF_REQUIRE(!nvlist_exists_bool_array(src, "nvl/bool"));
- nvlist_add_bool_array(src, "nvl/bool", testbool, 16);
+ nvlist_add_bool_array(src, "nvl/bool", testbool, nitems(testbool));
ATF_REQUIRE_EQ(nvlist_error(src), 0);
ATF_REQUIRE(nvlist_exists_bool_array(src, "nvl/bool"));
ATF_REQUIRE(!nvlist_exists_string_array(src, "nvl/string"));
- nvlist_add_string_array(src, "nvl/string", string, 8);
+ nvlist_add_string_array(src, "nvl/string", string_arr,
+ nitems(string_arr));
ATF_REQUIRE_EQ(nvlist_error(src), 0);
ATF_REQUIRE(nvlist_exists_string_array(src, "nvl/string"));
ATF_REQUIRE(!nvlist_exists_descriptor_array(src, "nvl/fd"));
- nvlist_add_descriptor_array(src, "nvl/fd", testfd, 16);
+ nvlist_add_descriptor_array(src, "nvl/fd", testfd, nitems(testfd));
ATF_REQUIRE_EQ(nvlist_error(src), 0);
ATF_REQUIRE(nvlist_exists_descriptor_array(src, "nvl/fd"));
ATF_REQUIRE(!nvlist_exists_number_array(src, "nvl/number"));
- nvlist_add_number_array(src, "nvl/number", number, 8);
+ nvlist_add_number_array(src, "nvl/number", number,
+ nitems(number));
ATF_REQUIRE_EQ(nvlist_error(src), 0);
ATF_REQUIRE(nvlist_exists_number_array(src, "nvl/number"));
ATF_REQUIRE(!nvlist_exists_nvlist_array(src, "nvl/array"));
nvlist_add_nvlist_array(src, "nvl/array",
- (const nvlist_t * const *)testnvl, 8);
+ (const nvlist_t * const *)testnvl, nitems(testnvl));
ATF_REQUIRE_EQ(nvlist_error(src), 0);
ATF_REQUIRE(nvlist_exists_nvlist_array(src, "nvl/array"));
@@ -387,62 +391,62 @@ ATF_TEST_CASE_BODY(nvlist_clone_array)
ATF_REQUIRE(dst != NULL);
ATF_REQUIRE(nvlist_exists_bool_array(dst, "nvl/bool"));
- (void) nvlist_get_bool_array(dst, "nvl/bool", &nitems);
- ATF_REQUIRE_EQ(nitems, 16);
- for (i = 0; i < nitems; i++) {
+ (void) nvlist_get_bool_array(dst, "nvl/bool", &num_items);
+ ATF_REQUIRE_EQ(num_items, nitems(testbool));
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE(
- nvlist_get_bool_array(dst, "nvl/bool", &nitems)[i] ==
- nvlist_get_bool_array(src, "nvl/bool", &nitems)[i]);
+ nvlist_get_bool_array(dst, "nvl/bool", &num_items)[i] ==
+ nvlist_get_bool_array(src, "nvl/bool", &num_items)[i]);
}
ATF_REQUIRE(nvlist_exists_string_array(dst, "nvl/string"));
- (void) nvlist_get_string_array(dst, "nvl/string", &nitems);
- ATF_REQUIRE_EQ(nitems, 8);
- for (i = 0; i < nitems; i++) {
+ (void) nvlist_get_string_array(dst, "nvl/string", &num_items);
+ ATF_REQUIRE_EQ(num_items, nitems(string_arr));
+ for (i = 0; i < num_items; i++) {
if (nvlist_get_string_array(dst, "nvl/string",
- &nitems)[i] == NULL) {
+ &num_items)[i] == NULL) {
ATF_REQUIRE(nvlist_get_string_array(dst, "nvl/string",
- &nitems)[i] == nvlist_get_string_array(src,
- "nvl/string", &nitems)[i]);
+ &num_items)[i] == nvlist_get_string_array(src,
+ "nvl/string", &num_items)[i]);
} else {
ATF_REQUIRE(strcmp(nvlist_get_string_array(dst,
- "nvl/string", &nitems)[i], nvlist_get_string_array(
- src, "nvl/string", &nitems)[i]) == 0);
+ "nvl/string", &num_items)[i], nvlist_get_string_array(
+ src, "nvl/string", &num_items)[i]) == 0);
}
}
ATF_REQUIRE(nvlist_exists_descriptor_array(dst, "nvl/fd"));
- (void) nvlist_get_descriptor_array(dst, "nvl/fd", &nitems);
- ATF_REQUIRE_EQ(nitems, 16);
- for (i = 0; i < nitems; i++) {
+ (void) nvlist_get_descriptor_array(dst, "nvl/fd", &num_items);
+ ATF_REQUIRE_EQ(num_items, nitems(testfd));
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE(fd_is_valid(
- nvlist_get_descriptor_array(dst, "nvl/fd", &nitems)[i]));
+ nvlist_get_descriptor_array(dst, "nvl/fd", &num_items)[i]));
}
ATF_REQUIRE(nvlist_exists_number_array(dst, "nvl/number"));
- (void) nvlist_get_number_array(dst, "nvl/number", &nitems);
- ATF_REQUIRE_EQ(nitems, 8);
+ (void) nvlist_get_number_array(dst, "nvl/number", &num_items);
+ ATF_REQUIRE_EQ(num_items, nitems(number));
- for (i = 0; i < nitems; i++) {
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE(
- nvlist_get_number_array(dst, "nvl/number", &nitems)[i] ==
- nvlist_get_number_array(src, "nvl/number", &nitems)[i]);
+ nvlist_get_number_array(dst, "nvl/number", &num_items)[i] ==
+ nvlist_get_number_array(src, "nvl/number", &num_items)[i]);
}
ATF_REQUIRE(nvlist_exists_nvlist_array(dst, "nvl/array"));
- (void) nvlist_get_nvlist_array(dst, "nvl/array", &nitems);
- ATF_REQUIRE_EQ(nitems, 8);
- for (i = 0; i < nitems; i++) {
- nvl = nvlist_get_nvlist_array(dst, "nvl/array", &nitems)[i];
+ (void) nvlist_get_nvlist_array(dst, "nvl/array", &num_items);
+ ATF_REQUIRE_EQ(num_items, nitems(testnvl));
+ for (i = 0; i < num_items; i++) {
+ nvl = nvlist_get_nvlist_array(dst, "nvl/array", &num_items)[i];
ATF_REQUIRE(nvlist_exists_string(nvl, "nvl/nvl/teststr"));
ATF_REQUIRE(strcmp(nvlist_get_string(nvl, "nvl/nvl/teststr"),
somestr[i]) == 0);
}
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < nitems(testfd); i++) {
close(testfd[i]);
- if (i < 8) {
- nvlist_destroy(testnvl[i]);
- }
+ }
+ for (i = 0; i < nitems(testnvl); i++) {
+ nvlist_destroy(testnvl[i]);
}
nvlist_destroy(src);
nvlist_destroy(dst);
@@ -454,7 +458,7 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__move)
bool *testbool;
const bool *const_result;
nvlist_t *nvl;
- size_t nitems, count;
+ size_t num_items, count;
unsigned int i;
const char *key;
@@ -475,11 +479,11 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__move)
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
- const_result = nvlist_get_bool_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, count);
+ const_result = nvlist_get_bool_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, count);
ATF_REQUIRE(const_result != NULL);
ATF_REQUIRE(const_result == testbool);
- for (i = 0; i < nitems; i++)
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE_EQ(const_result[i], (i % 2 == 0));
nvlist_destroy(nvl);
@@ -491,7 +495,7 @@ ATF_TEST_CASE_BODY(nvlist_string_array__move)
char **teststr;
const char * const *const_result;
nvlist_t *nvl;
- size_t nitems, count;
+ size_t num_items, count;
unsigned int i;
const char *key;
@@ -516,11 +520,11 @@ ATF_TEST_CASE_BODY(nvlist_string_array__move)
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
- const_result = nvlist_get_string_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, count);
+ const_result = nvlist_get_string_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, count);
ATF_REQUIRE(const_result != NULL);
ATF_REQUIRE((intptr_t)const_result == (intptr_t)teststr);
- for (i = 0; i < nitems; i++) {
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE_EQ(const_result[i][0], (char)('a' + i));
ATF_REQUIRE_EQ(const_result[i][1], '\0');
}
@@ -534,7 +538,7 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__move)
nvlist **testnv;
const nvlist * const *const_result;
nvlist_t *nvl;
- size_t nitems, count;
+ size_t num_items, count;
unsigned int i;
const char *key;
@@ -557,14 +561,14 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__move)
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_nvlist_array(nvl, key));
- const_result = nvlist_get_nvlist_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, count);
+ const_result = nvlist_get_nvlist_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, count);
ATF_REQUIRE(const_result != NULL);
ATF_REQUIRE((intptr_t)const_result == (intptr_t)testnv);
- for (i = 0; i < nitems; i++) {
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE_EQ(nvlist_error(const_result[i]), 0);
ATF_REQUIRE(nvlist_empty(const_result[i]));
- if (i < nitems - 1) {
+ if (i < num_items - 1) {
ATF_REQUIRE(nvlist_get_array_next(const_result[i]) ==
const_result[i + 1]);
} else {
@@ -584,7 +588,7 @@ ATF_TEST_CASE_BODY(nvlist_number_array__move)
uint64_t *testnumber;
const uint64_t *const_result;
nvlist_t *nvl;
- size_t nitems, count;
+ size_t num_items, count;
unsigned int i;
const char *key;
@@ -605,11 +609,11 @@ ATF_TEST_CASE_BODY(nvlist_number_array__move)
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_number_array(nvl, key));
- const_result = nvlist_get_number_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, count);
+ const_result = nvlist_get_number_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, count);
ATF_REQUIRE(const_result != NULL);
ATF_REQUIRE(const_result == testnumber);
- for (i = 0; i < nitems; i++)
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE_EQ(const_result[i], i);
nvlist_destroy(nvl);
@@ -621,7 +625,7 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__move)
int *testfd;
const int *const_result;
nvlist_t *nvl;
- size_t nitems, count;
+ size_t num_items, count;
unsigned int i;
const char *key;
@@ -644,11 +648,11 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__move)
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
- const_result = nvlist_get_descriptor_array(nvl, key, &nitems);
- ATF_REQUIRE_EQ(nitems, count);
+ const_result = nvlist_get_descriptor_array(nvl, key, &num_items);
+ ATF_REQUIRE_EQ(num_items, count);
ATF_REQUIRE(const_result != NULL);
ATF_REQUIRE(const_result == testfd);
- for (i = 0; i < nitems; i++)
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE(fd_is_valid(const_result[i]));
nvlist_destroy(nvl);
@@ -764,11 +768,12 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__travel)
{
nvlist_t *nvl, *test[5], *nasted;
const nvlist_t *travel;
- void *cookie;
- int index, i, type;
const char *name;
+ void *cookie;
+ int type;
+ unsigned int i, index;
- for (i = 0; i < 5; i++) {
+ for (i = 0; i < nitems(test); i++) {
test[i] = nvlist_create(0);
ATF_REQUIRE(test[i] != NULL);
nvlist_add_number(test[i], "nvl/number", i);
@@ -776,11 +781,12 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__travel)
}
nvl = nvlist_create(0);
ATF_REQUIRE(nvl != NULL);
- nvlist_add_nvlist_array(nvl, "nvl/nvlist_array", test, 5);
+ nvlist_add_nvlist_array(nvl, "nvl/nvlist_array", test, nitems(test));
ATF_REQUIRE(nvlist_error(nvl) == 0);
nasted = nvlist_create(0);
ATF_REQUIRE(nasted != NULL);
- nvlist_add_nvlist_array(nasted, "nvl/nvl/nvlist_array", test, 5);
+ nvlist_add_nvlist_array(nasted, "nvl/nvl/nvlist_array", test,
+ nitems(test));
ATF_REQUIRE(nvlist_error(nasted) == 0);
nvlist_move_nvlist(nvl, "nvl/nvl", nasted);
ATF_REQUIRE(nvlist_error(nvl) == 0);
@@ -794,15 +800,16 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__travel)
while ((name = nvlist_next(travel, &type, &cookie)) != NULL) {
if (index == 0) {
ATF_REQUIRE(type == NV_TYPE_NVLIST_ARRAY);
- } else if (index >= 1 && index <= 5) {
+ } else if (index >= 1 && index <= nitems(test)) {
ATF_REQUIRE(type == NV_TYPE_NUMBER);
- } else if (index == 6) {
+ } else if (index == nitems(test) + 1) {
ATF_REQUIRE(type == NV_TYPE_NVLIST);
- } else if (index == 7) {
+ } else if (index == nitems(test) + 2) {
ATF_REQUIRE(type == NV_TYPE_NVLIST_ARRAY);
- } else if (index >= 8 && index <= 12) {
+ } else if (index >= nitems(test) + 3 &&
+ index <= 2 * nitems(test) + 2) {
ATF_REQUIRE(type == NV_TYPE_NUMBER);
- } else if (index == 13) {
+ } else if (index == 2 * nitems(test) + 3) {
ATF_REQUIRE(type == NV_TYPE_STRING);
}
@@ -818,7 +825,7 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__travel)
}
} while ((travel = nvlist_get_pararr(travel, &cookie)) != NULL);
- for (i = 0; i < 5; i++)
+ for (i = 0; i < nitems(test); i++)
nvlist_destroy(test[i]);
nvlist_destroy(nvl);
@@ -908,7 +915,7 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__pack)
const bool *const_result;
bool testbool[16];
- for (i = 0; i < 16; i++)
+ for (i = 0; i < nitems(testbool); i++)
testbool[i] = (i % 2 == 0);
key = "nvl/bool";
@@ -917,7 +924,7 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__pack)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
- nvlist_add_bool_array(nvl, key, testbool, 16);
+ nvlist_add_bool_array(nvl, key, testbool, nitems(testbool));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_bool_array(nvl, key));
@@ -931,7 +938,7 @@ ATF_TEST_CASE_BODY(nvlist_bool_array__pack)
ATF_REQUIRE(nvlist_exists_bool_array(unpacked, key));
const_result = nvlist_get_bool_array(unpacked, key, &count);
- ATF_REQUIRE_EQ(count, 16);
+ ATF_REQUIRE_EQ(count, nitems(testbool));
for (i = 0; i < count; i++) {
ATF_REQUIRE_EQ(testbool[i], const_result[i]);
}
@@ -973,7 +980,7 @@ ATF_TEST_CASE_BODY(nvlist_number_array__pack)
ATF_REQUIRE(nvlist_exists_number_array(unpacked, key));
const_result = nvlist_get_number_array(unpacked, key, &count);
- ATF_REQUIRE_EQ(count, 8);
+ ATF_REQUIRE_EQ(count, nitems(number));
for (i = 0; i < count; i++) {
ATF_REQUIRE_EQ(number[i], const_result[i]);
}
@@ -988,7 +995,7 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__pack)
{
nvlist_t *nvl;
const char *key;
- size_t nitems;
+ size_t num_items;
unsigned int i;
const int *const_result;
int desc[32], fd, socks[2];
@@ -1004,7 +1011,7 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__pack)
/* Child. */
fd = socks[0];
close(socks[1]);
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < nitems(desc); i++) {
desc[i] = dup(STDERR_FILENO);
ATF_REQUIRE(fd_is_valid(desc[i]));
}
@@ -1014,14 +1021,14 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__pack)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE(!nvlist_exists_descriptor_array(nvl, key));
- nvlist_add_descriptor_array(nvl, key, desc, 32);
+ nvlist_add_descriptor_array(nvl, key, desc, nitems(desc));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
ATF_REQUIRE(nvlist_send(fd, nvl) >= 0);
- for (i = 0; i < nitems; i++)
+ for (i = 0; i < nitems(desc); i++)
close(desc[i]);
} else {
/* Parent */
@@ -1034,10 +1041,10 @@ ATF_TEST_CASE_BODY(nvlist_descriptor_array__pack)
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(nvlist_exists_descriptor_array(nvl, key));
- const_result = nvlist_get_descriptor_array(nvl, key, &nitems);
+ const_result = nvlist_get_descriptor_array(nvl, key, &num_items);
ATF_REQUIRE(const_result != NULL);
- ATF_REQUIRE_EQ(nitems, 32);
- for (i = 0; i < nitems; i++)
+ ATF_REQUIRE_EQ(num_items, nitems(desc));
+ for (i = 0; i < num_items; i++)
ATF_REQUIRE(fd_is_valid(const_result[i]));
atf::utils::wait(pid, 0, "", "");
@@ -1056,7 +1063,7 @@ ATF_TEST_CASE_BODY(nvlist_string_array__pack)
void *packed;
unsigned int i;
const char * const *const_result;
- const char *string[8] = { "a", "b", "kot", "foo",
+ const char *string_arr[8] = { "a", "b", "kot", "foo",
"tests", "nice test", "", "abcdef" };
key = "nvl/string";
@@ -1065,7 +1072,7 @@ ATF_TEST_CASE_BODY(nvlist_string_array__pack)
ATF_REQUIRE(nvlist_empty(nvl));
ATF_REQUIRE(!nvlist_exists_string_array(nvl, key));
- nvlist_add_string_array(nvl, key, string, 8);
+ nvlist_add_string_array(nvl, key, string_arr, nitems(string_arr));
ATF_REQUIRE_EQ(nvlist_error(nvl), 0);
ATF_REQUIRE(!nvlist_empty(nvl));
ATF_REQUIRE(nvlist_exists_string_array(nvl, key));
@@ -1079,9 +1086,9 @@ ATF_TEST_CASE_BODY(nvlist_string_array__pack)
ATF_REQUIRE(nvlist_exists_string_array(unpacked, key));
const_result = nvlist_get_string_array(unpacked, key, &count);
- ATF_REQUIRE_EQ(count, 8);
+ ATF_REQUIRE_EQ(count, nitems(string_arr));
for (i = 0; i < count; i++) {
- ATF_REQUIRE_EQ(strcmp(string[i], const_result[i]), 0);
+ ATF_REQUIRE_EQ(strcmp(string_arr[i], const_result[i]), 0);
}
nvlist_destroy(nvl);
@@ -1094,15 +1101,14 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__pack)
{
nvlist_t *testnvl[8], *unpacked;
const nvlist_t * const *const_result;
- nvlist_t **result;
nvlist_t *nvl;
- size_t nitems, packed_size;
+ size_t num_items, packed_size;
unsigned int i;
void *packed;
const char *somestr[8] = { "a", "b", "c", "d", "e", "f", "g", "h" };
const char *key;
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < nitems(testnvl); i++) {
testnvl[i] = nvlist_create(0);
ATF_REQUIRE(testnvl[i] != NULL);
ATF_REQUIRE_EQ(nvlist_error(testnvl[i]), 0);
@@ -1130,12 +1136,12 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__pack)
ATF_REQUIRE_EQ(nvlist_error(unpacked), 0);
ATF_REQUIRE(nvlist_exists_nvlist_array(unpacked, key));
- const_result = nvlist_get_nvlist_array(unpacked, key, &nitems);
+ const_result = nvlist_get_nvlist_array(unpacked, key, &num_items);
ATF_REQUIRE(const_result != NULL);
- ATF_REQUIRE_EQ(nitems, 8);
- for (i = 0; i < nitems; i++) {
+ ATF_REQUIRE_EQ(num_items, nitems(testnvl));
+ for (i = 0; i < num_items; i++) {
ATF_REQUIRE_EQ(nvlist_error(const_result[i]), 0);
- if (i < nitems - 1) {
+ if (i < num_items - 1) {
ATF_REQUIRE(nvlist_get_array_next(const_result[i]) ==
const_result[i + 1]);
} else {
@@ -1150,9 +1156,8 @@ ATF_TEST_CASE_BODY(nvlist_nvlist_array__pack)
"nvl/string"), somestr[i]) == 0);
}
- for (i = 0; i < 8; i++)
+ for (i = 0; i < nitems(testnvl); i++)
nvlist_destroy(testnvl[i]);
- free(result);
nvlist_destroy(nvl);
nvlist_destroy(unpacked);
free(packed);
diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile
index 3126c1c..9d1f6bc 100644
--- a/lib/libstand/Makefile
+++ b/lib/libstand/Makefile
@@ -11,13 +11,14 @@ MK_SSP= no
.include <src.opts.mk>
-LIBSTAND_SRC= ${.CURDIR}
+LIBSTAND_SRC?= ${.CURDIR}
+LIBSTAND_CPUARCH?=${MACHINE_CPUARCH}
LIBC_SRC= ${LIBSTAND_SRC}/../libc
LIB= stand
NO_PIC=
INCS= stand.h
-MAN= libstand.3
+MAN?= libstand.3
WARNS?= 0
@@ -78,7 +79,7 @@ SRCS+= syncicache.c
SRCS+= uuid_create_nil.c uuid_equal.c uuid_from_string.c uuid_is_nil.c uuid_to_string.c
# _setjmp/_longjmp
-.PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH}
+.PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH}
SRCS+= _setjmp.S
# decompression functionality from libbz2
diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h
index 943e3e6..a2fc74a 100644
--- a/libexec/rtld-elf/aarch64/rtld_machdep.h
+++ b/libexec/rtld-elf/aarch64/rtld_machdep.h
@@ -80,4 +80,6 @@ extern void *__tls_get_addr(tls_index *ti);
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/libexec/rtld-elf/amd64/rtld_machdep.h b/libexec/rtld-elf/amd64/rtld_machdep.h
index cb5e9a1..a8696fe 100644
--- a/libexec/rtld-elf/amd64/rtld_machdep.h
+++ b/libexec/rtld-elf/amd64/rtld_machdep.h
@@ -79,4 +79,6 @@ void *__tls_get_addr(tls_index *ti) __exported;
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c
index d0bf987..6bdda73 100644
--- a/libexec/rtld-elf/arm/reloc.c
+++ b/libexec/rtld-elf/arm/reloc.c
@@ -18,6 +18,41 @@ __FBSDID("$FreeBSD$");
#include "paths.h"
void
+arm_abi_variant_hook(Elf_Auxinfo **aux_info)
+{
+ Elf_Word ehdr;
+
+ /*
+ * If we're running an old kernel that doesn't provide any data fail
+ * safe by doing nothing.
+ */
+ if (aux_info[AT_EHDRFLAGS] == NULL)
+ return;
+ ehdr = aux_info[AT_EHDRFLAGS]->a_un.a_val;
+
+ /*
+ * Hard float ABI binaries are the default, and use the default paths
+ * and such.
+ */
+ if ((ehdr & EF_ARM_VFP_FLOAT) != 0)
+ return;
+
+ /*
+ * This is a soft float ABI binary. We need to use the soft float
+ * settings. For the moment, the standard library path includes the hard
+ * float paths as well. When upgrading, we need to execute the wrong
+ * kind of binary until we've installed the new binaries. We could go
+ * off whether or not /libsoft exists, but the simplicity of having it
+ * in the path wins.
+ */
+ ld_elf_hints_default = _PATH_SOFT_ELF_HINTS;
+ ld_path_libmap_conf = _PATH_SOFT_LIBMAP_CONF;
+ ld_path_rtld = _PATH_SOFT_RTLD;
+ ld_standard_library_path = SOFT_STANDARD_LIBRARY_PATH;
+ ld_env_prefix = LD_SOFT_;
+}
+
+void
init_pltgot(Obj_Entry *obj)
{
if (obj->pltgot != NULL) {
diff --git a/libexec/rtld-elf/arm/rtld_machdep.h b/libexec/rtld-elf/arm/rtld_machdep.h
index f980de0..c61bce0 100644
--- a/libexec/rtld-elf/arm/rtld_machdep.h
+++ b/libexec/rtld-elf/arm/rtld_machdep.h
@@ -75,4 +75,9 @@ extern void *__tls_get_addr(tls_index *ti);
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+extern void arm_abi_variant_hook(Elf_Auxinfo **);
+
+#define md_abi_variant_hook(x) arm_abi_variant_hook(x)
+#define RTLD_VARIANT_ENV_NAMES
+
#endif
diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h
index 5c328da..5237d4f 100644
--- a/libexec/rtld-elf/i386/rtld_machdep.h
+++ b/libexec/rtld-elf/i386/rtld_machdep.h
@@ -80,4 +80,6 @@ void *__tls_get_addr(tls_index *ti) __exported;
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/libexec/rtld-elf/mips/rtld_machdep.h b/libexec/rtld-elf/mips/rtld_machdep.h
index befbf13..34e8f3c 100644
--- a/libexec/rtld-elf/mips/rtld_machdep.h
+++ b/libexec/rtld-elf/mips/rtld_machdep.h
@@ -75,4 +75,6 @@ extern void *__tls_get_addr(tls_index *ti);
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/libexec/rtld-elf/paths.h b/libexec/rtld-elf/paths.h
index 709e4d3..abfeb3f 100644
--- a/libexec/rtld-elf/paths.h
+++ b/libexec/rtld-elf/paths.h
@@ -1,8 +1,6 @@
/*-
* Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra.
* Copyright 2003 Alexander Kabaev <kan@FreeBSD.ORG>.
- * Copyright 2009-2012 Konstantin Belousov <kib@FreeBSD.ORG>.
- * Copyright 2012 John Marino <draco@marino.st>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -61,7 +59,13 @@
#define LD_ "LD_"
#endif
-extern char *ld_path_elf_hints;
+#define _PATH_SOFT_ELF_HINTS "/var/run/ld-elf-soft.so.hints"
+#define _PATH_SOFT_LIBMAP_CONF "/etc/libmap-soft.conf"
+#define _PATH_SOFT_RTLD "/libexec/ld-elf.so.1"
+#define SOFT_STANDARD_LIBRARY_PATH "/libsoft:/usr/libsoft:/lib:/usr/lib"
+#define LD_SOFT_ "LD_SOFT_"
+
+extern char *ld_elf_hints_default;
extern char *ld_path_libmap_conf;
extern char *ld_path_rtld;
extern char *ld_standard_library_path;
diff --git a/libexec/rtld-elf/powerpc/rtld_machdep.h b/libexec/rtld-elf/powerpc/rtld_machdep.h
index 1ddf1bc..3e39c82 100644
--- a/libexec/rtld-elf/powerpc/rtld_machdep.h
+++ b/libexec/rtld-elf/powerpc/rtld_machdep.h
@@ -90,4 +90,6 @@ extern void *__tls_get_addr(tls_index* ti);
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/libexec/rtld-elf/powerpc64/rtld_machdep.h b/libexec/rtld-elf/powerpc64/rtld_machdep.h
index b88ed9d..32c7d12 100644
--- a/libexec/rtld-elf/powerpc64/rtld_machdep.h
+++ b/libexec/rtld-elf/powerpc64/rtld_machdep.h
@@ -82,4 +82,6 @@ extern void *__tls_get_addr(tls_index* ti);
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 4eee6c5..66edc15 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -204,8 +204,6 @@ extern Elf_Dyn _DYNAMIC;
#define RTLD_IS_DYNAMIC() (&_DYNAMIC != NULL)
#endif
-#define _LD(x) LD_ x
-
int dlclose(void *) __exported;
char *dlerror(void) __exported;
void *dlopen(const char *, int) __exported;
@@ -325,6 +323,24 @@ ld_utrace_log(int event, void *handle, void *mapbase, size_t mapsize,
utrace(&ut, sizeof(ut));
}
+#ifdef RTLD_VARIANT_ENV_NAMES
+/*
+ * construct the env variable based on the type of binary that's
+ * running.
+ */
+static inline const char *
+_LD(const char *var)
+{
+ static char buffer[128];
+
+ strlcpy(buffer, ld_env_prefix, sizeof(buffer));
+ strlcat(buffer, var, sizeof(buffer));
+ return (buffer);
+}
+#else
+#define _LD(x) LD_ x
+#endif
+
/*
* Main entry point for dynamic linking. The first argument is the
* stack pointer. The stack is expected to be laid out as described
@@ -419,6 +435,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
trust = !issetugid();
+ md_abi_variant_hook(aux_info);
+
ld_bind_now = getenv(_LD("BIND_NOW"));
/*
* If the process is tainted, then we un-set the dangerous environment
diff --git a/libexec/rtld-elf/sparc64/rtld_machdep.h b/libexec/rtld-elf/sparc64/rtld_machdep.h
index 44fe2cf..9df63b8 100644
--- a/libexec/rtld-elf/sparc64/rtld_machdep.h
+++ b/libexec/rtld-elf/sparc64/rtld_machdep.h
@@ -71,4 +71,6 @@ extern void *__tls_get_addr(tls_index *ti);
#define RTLD_DEFAULT_STACK_PF_EXEC 0
#define RTLD_DEFAULT_STACK_EXEC 0
+#define md_abi_variant_hook(x)
+
#endif
diff --git a/release/Makefile b/release/Makefile
index d9dbb4f..e3a233d 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -281,7 +281,7 @@ ftp: packagesystem
cp *.txz MANIFEST ftp
release: real-release vm-release cloudware-release
- touch ${.TARGET}
+ touch ${.OBJDIR}/${.TARGET}
real-release:
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
diff --git a/release/doc/en_US.ISO8859-1/hardware/article.xml b/release/doc/en_US.ISO8859-1/hardware/article.xml
index 191ac57..4b66434 100644
--- a/release/doc/en_US.ISO8859-1/hardware/article.xml
+++ b/release/doc/en_US.ISO8859-1/hardware/article.xml
@@ -1017,6 +1017,9 @@
&hwlist.rsu;
+ <para>Realtek RTL8188CE based PCIe IEEE 802.11b/g/n wireless network
+ adapters (&man.rtwn.4; driver)</para>
+
&hwlist.rum;
&hwlist.run;
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 65c4348..47a67e0 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -180,6 +180,7 @@ __DEFAULT_NO_OPTIONS = \
DTRACE_TESTS \
EISA \
HESIOD \
+ LIBSOFT \
NAND \
OFED \
OPENLDAP \
@@ -248,6 +249,10 @@ __DEFAULT_NO_OPTIONS+=LLDB
.if ${__T} == "arm" || ${__T} == "armeb"
BROKEN_OPTIONS+=LLDB
.endif
+# Only doing soft float API stuff on armv6
+.if ${__T} != "armv6"
+BROKEN_OPTIONS+=LIBSOFT
+.endif
.include <bsd.mkopt.mk>
diff --git a/share/vt/keymaps/gr.101.acc.kbd b/share/vt/keymaps/gr.101.acc.kbd
index 89a931f..7e8e661 100644
--- a/share/vt/keymaps/gr.101.acc.kbd
+++ b/share/vt/keymaps/gr.101.acc.kbd
@@ -18,7 +18,7 @@
009 '8' '*' nop nop '8' '*' nop nop O
010 '9' '(' nop nop '9' '(' nop nop O
011 '0' ')' nop nop '0' ')' nop nop O
- 012 '-' '_' ns ns '-' '_' ns ns O
+ 012 '-' '_' us us '-' '_' us us O
013 '=' '+' nop nop '=' '+' nop nop O
014 bs bs del del bs bs del del O
015 ht btab nop nop ht btab nop nop O
@@ -90,7 +90,7 @@
081 fkey59 '3' '3' '3' '3' '3' '3' '3' N
082 fkey60 '0' '0' '0' '0' '0' '0' '0' N
083 del '.' '.' '.' '.' '.' boot boot N
- 084 ns ns ns ns ns ns ns ns O
+ 084 us us us us us us us us O
085 nop nop nop nop nop nop nop nop O
086 '\' '|' nop nop '\' '|' nop nop O
087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
@@ -148,7 +148,7 @@
137 '8' '*' nop nop '8' '*' nop nop O
138 '9' '(' nop nop '9' '(' nop nop O
139 '0' ')' nop nop '0' ')' nop nop O
- 140 '-' '_' ns ns '-' '_' ns ns O
+ 140 '-' '_' us us '-' '_' us us O
141 '=' '+' nop nop '=' '+' nop nop O
142 bs bs del del bs bs del del O
143 ht btab nop nop ht btab nop nop O
@@ -220,7 +220,7 @@
209 fkey59 '3' '3' '3' '3' '3' '3' '3' N
210 fkey60 '0' '0' '0' '0' '0' '0' '0' N
211 del '.' '.' '.' '.' '.' boot boot N
- 212 ns ns ns ns ns ns ns ns O
+ 212 us us us us us us us us O
213 nop nop nop nop nop nop nop nop O
214 '\' '|' nop nop '\' '|' nop nop O
215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
diff --git a/share/vt/keymaps/gr.elot.acc.kbd b/share/vt/keymaps/gr.elot.acc.kbd
index 1a758a7..061717f 100644
--- a/share/vt/keymaps/gr.elot.acc.kbd
+++ b/share/vt/keymaps/gr.elot.acc.kbd
@@ -18,7 +18,7 @@
009 '8' '*' nop nop '8' '*' nop nop O
010 '9' '(' nop nop '9' '(' nop nop O
011 '0' ')' nop nop '0' ')' nop nop O
- 012 '-' '_' ns ns '-' '_' ns ns O
+ 012 '-' '_' us us '-' '_' us us O
013 '=' '+' nop nop '=' '+' nop nop O
014 bs bs del del bs bs del del O
015 ht btab nop nop ht btab nop nop O
@@ -90,7 +90,7 @@
081 fkey59 '3' '3' '3' '3' '3' '3' '3' N
082 fkey60 '0' '0' '0' '0' '0' '0' '0' N
083 del '.' '.' '.' '.' '.' boot boot N
- 084 ns ns ns ns ns ns ns ns O
+ 084 us us us us us us us us O
085 nop nop nop nop nop nop nop nop O
086 '\' '|' nop nop '\' '|' nop nop O
087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
@@ -148,7 +148,7 @@
137 '8' '*' nop nop '8' '*' nop nop O
138 '9' '(' nop nop '9' '(' nop nop O
139 '0' ')' nop nop '0' ')' nop nop O
- 140 '-' '_' ns ns '-' '_' ns ns O
+ 140 '-' '_' us us '-' '_' us us O
141 '=' '+' nop nop '=' '+' nop nop O
142 bs bs del del bs bs del del O
143 ht btab nop nop ht btab nop nop O
@@ -220,7 +220,7 @@
209 fkey59 '3' '3' '3' '3' '3' '3' '3' N
210 fkey60 '0' '0' '0' '0' '0' '0' '0' N
211 del '.' '.' '.' '.' '.' boot boot N
- 212 ns ns ns ns ns ns ns ns O
+ 212 us us us us us us us us O
213 nop nop nop nop nop nop nop nop O
214 '\' '|' nop nop '\' '|' nop nop O
215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
diff --git a/share/vt/keymaps/hu.101.kbd b/share/vt/keymaps/hu.101.kbd
index 3101b36..07be2b1 100644
--- a/share/vt/keymaps/hu.101.kbd
+++ b/share/vt/keymaps/hu.101.kbd
@@ -46,7 +46,7 @@
009 '8' '*' nop nop '8' '*' nop nop O
010 '9' '(' nop nop '9' '(' nop nop O
011 '0' ')' nop nop 0xf6 0xd6 nop nop O
- 012 '-' '_' ns ns 0xfc 0xdc ns ns C
+ 012 '-' '_' us us 0xfc 0xdc us us C
013 '=' '+' nop nop 0xf3 0xd3 nop nop C
014 bs bs del del bs bs del del O
015 ht btab nop nop ht btab nop nop O
@@ -175,7 +175,7 @@
137 '8' '*' nop nop '8' '*' nop nop O
138 '9' '(' nop nop '9' '(' nop nop O
139 0xf6 0xd6 nop nop '0' ')' nop nop O
- 140 0xfc 0xdc ns ns '-' '_' ns ns C
+ 140 0xfc 0xdc us us '-' '_' us us C
141 0xf3 0xd3 nop nop '=' '+' nop nop C
142 bs bs del del bs bs del del O
143 ht btab nop nop ht btab nop nop O
diff --git a/share/vt/keymaps/hu.102.kbd b/share/vt/keymaps/hu.102.kbd
index 532cbd8..244db9e 100644
--- a/share/vt/keymaps/hu.102.kbd
+++ b/share/vt/keymaps/hu.102.kbd
@@ -60,7 +60,7 @@
050 'm' 'M' cr cr '<' nop cr cr C
051 ',' '?' nop nop ';' nop nop nop O
052 '.' ':' nop nop '>' nop nop nop O
- 053 '-' '_' ns ns '*' nop nop nop O
+ 053 '-' '_' us us '*' nop nop nop O
054 rshift rshift rshift rshift rshift rshift rshift rshift O
055 '*' '*' '*' '*' '*' '*' '*' '*' O
056 lalt lalt lalt lalt lalt lalt lalt lalt O
diff --git a/share/vt/keymaps/lt.kbd b/share/vt/keymaps/lt.kbd
index 0f7ac09..ac8b17b 100644
--- a/share/vt/keymaps/lt.kbd
+++ b/share/vt/keymaps/lt.kbd
@@ -15,7 +15,7 @@
009 '8' '*' nop nop 0x016b 0x0172 nop nop O
010 '9' '(' nop nop '9' '(' nop nop O
011 '0' ')' nop nop '0' ')' nop nop O
- 012 '-' '_' ns ns '-' '_' ns ns O
+ 012 '-' '_' us us '-' '_' us us O
013 '=' '+' nop nop 0x017e 0x017d nop nop O
014 bs bs del del bs bs del del O
015 ht btab nop nop ht btab nop nop O
@@ -87,7 +87,7 @@
081 fkey59 '3' '3' '3' '3' '3' '3' '3' N
082 fkey60 '0' '0' '0' '0' '0' '0' '0' N
083 del '.' ',' ',' del ',' boot boot N
- 084 ns ns ns ns ns ns ns ns O
+ 084 us us us us us us us us O
085 nop nop nop nop nop nop nop nop O
086 ralt ralt ralt ralt ralt ralt ralt ralt O
087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
@@ -143,7 +143,7 @@
137 0x016b 0x016a nop nop '8' '*' nop nop C
138 '9' '(' nop nop '9' '(' nop nop O
139 '0' ')' nop nop '0' ')' nop nop O
- 140 '-' '_' ns ns '-' '_' ns ns O
+ 140 '-' '_' us us '-' '_' us us O
141 0x017e 0x017d nop nop '=' '+' nop nop C
142 bs bs del del bs bs del del O
143 ht btab nop nop ht btab nop nop O
@@ -215,7 +215,7 @@
209 fkey59 '3' '3' '3' '3' '3' '3' '3' N
210 fkey60 '0' '0' '0' '0' '0' '0' '0' N
211 del ',' '.' '.' del '.' boot boot N
- 212 ns ns ns ns ns ns ns ns O
+ 212 us us us us us us us us O
213 nop nop nop nop nop nop nop nop O
214 ralt ralt ralt ralt ralt ralt ralt ralt O
215 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O
diff --git a/share/vt/keymaps/pt.acc.kbd b/share/vt/keymaps/pt.acc.kbd
index 02ee9b5..8b6ee3b 100644
--- a/share/vt/keymaps/pt.acc.kbd
+++ b/share/vt/keymaps/pt.acc.kbd
@@ -17,7 +17,7 @@
009 '8' '(' nop nop '[' '*' nop nop O
010 '9' ')' nop nop ']' '(' nop nop O
011 '0' '=' nop nop '}' ')' nop nop O
- 012 ''' '?' ns ns '-' '_' ns ns O
+ 012 ''' '?' us us '-' '_' us us O
013 '=' '+' nop nop '=' '+' nop nop O
014 bs bs del del bs bs del del O
015 ht btab nop nop ht btab nop nop O
diff --git a/share/vt/keymaps/pt.kbd b/share/vt/keymaps/pt.kbd
index 46f781e..addd275 100644
--- a/share/vt/keymaps/pt.kbd
+++ b/share/vt/keymaps/pt.kbd
@@ -17,7 +17,7 @@
009 '8' '(' nop nop '[' '*' nop nop O
010 '9' ')' nop nop ']' '(' nop nop O
011 '0' '=' nop nop '}' ')' nop nop O
- 012 ''' '?' ns ns '-' '_' ns ns O
+ 012 ''' '?' us us '-' '_' us us O
013 '=' '+' nop nop '=' '+' nop nop O
014 bs bs del del bs bs del del O
015 ht btab nop nop ht btab nop nop O
diff --git a/share/vt/keymaps/ua.kbd b/share/vt/keymaps/ua.kbd
index d031f1d..3c20b8e 100644
--- a/share/vt/keymaps/ua.kbd
+++ b/share/vt/keymaps/ua.kbd
@@ -15,7 +15,7 @@
009 '8' '*' nop nop '8' ';' nop nop O
010 '9' '(' nop nop '9' '?' nop nop O
011 '0' ')' nop nop '0' '%' nop nop O
- 012 '-' '_' ns ns '-' '_' ns ns O
+ 012 '-' '_' us us '-' '_' us us O
013 '=' '+' nop nop '=' '+' nop nop O
014 bs bs del del bs bs del del O
015 ht btab nop nop btab btab nop nop O
@@ -144,7 +144,7 @@
137 '8' ';' nop nop '8' '*' nop nop O
138 '9' '?' nop nop '9' '(' nop nop O
139 '0' '%' nop nop '0' ')' nop nop O
- 140 '-' '_' ns ns '-' '_' ns ns O
+ 140 '-' '_' us us '-' '_' us us O
141 '=' '+' nop nop '=' '+' nop nop O
142 bs bs del del bs bs del del O
143 ht btab nop nop btab btab nop nop O
diff --git a/share/vt/keymaps/ua.shift.alt.kbd b/share/vt/keymaps/ua.shift.alt.kbd
index cef2c27..3159e9a 100644
--- a/share/vt/keymaps/ua.shift.alt.kbd
+++ b/share/vt/keymaps/ua.shift.alt.kbd
@@ -27,7 +27,7 @@
009 '8' '*' nop nop '8' '*' nop nop O
010 '9' '(' nop nop '9' '(' nop nop O
011 '0' ')' nop nop '0' ')' nop nop O
- 012 '-' '_' ns ns 0x0456 0x0406 0xf7 0xf7 O
+ 012 '-' '_' us us 0x0456 0x0406 0xf7 0xf7 O
013 '=' '+' nop nop 0x0454 0x0404 nop nop O
014 bs bs del del bs bs 0x042a 0x042a O
015 ht btab nop nop ht btab nop nop O
@@ -155,7 +155,7 @@
137 '8' '*' nop nop '8' '*' nop nop O
138 '9' '(' nop nop '9' '(' nop nop O
139 '0' ')' nop nop '0' ')' nop nop O
- 140 0x0456 0x0406 ns ns '-' '_' 0xf7 0xf7 O
+ 140 0x0456 0x0406 us us '-' '_' 0xf7 0xf7 O
141 0x0454 0x0404 nop nop '=' '+' nop nop O
142 bs bs del del bs bs 0x042a 0x042a O
143 ht btab nop nop ht btab nop nop O
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 6bf251f..1bf735f 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1484,6 +1484,7 @@ static caddr_t
native_parse_preload_data(u_int64_t modulep)
{
caddr_t kmdp;
+ char *envp;
#ifdef DDB
vm_offset_t ksym_start;
vm_offset_t ksym_end;
@@ -1495,7 +1496,10 @@ native_parse_preload_data(u_int64_t modulep)
if (kmdp == NULL)
kmdp = preload_search_by_type("elf64 kernel");
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *) + KERNBASE;
+ envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ if (envp != NULL)
+ envp += KERNBASE;
+ init_static_kenv(envp, 0);
#ifdef DDB
ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index af7ee99..b8e3ffd 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -194,6 +194,8 @@ int _min_bzero_size = 0;
extern int *end;
#ifdef FDT
+static char *loader_envp;
+
vm_paddr_t pmap_pa;
#ifdef ARM_NEW_PMAP
@@ -1002,6 +1004,8 @@ fake_preload_metadata(struct arm_boot_params *abp __unused)
fake_preload[i] = 0;
preload_metadata = (void *)fake_preload;
+ init_static_kenv(NULL, 0);
+
return (lastaddr);
}
@@ -1074,6 +1078,8 @@ linux_parse_boot_param(struct arm_boot_params *abp)
bcopy(atag_list, atags,
(char *)walker - (char *)atag_list + ATAG_SIZE(walker));
+ init_static_kenv(NULL, 0);
+
return fake_preload_metadata(abp);
}
#endif
@@ -1106,7 +1112,8 @@ freebsd_parse_boot_param(struct arm_boot_params *abp)
return 0;
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ init_static_kenv(loader_envp, 0);
lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
#ifdef DDB
ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
@@ -1429,13 +1436,13 @@ print_kenv(void)
char *cp;
debugf("loader passed (static) kenv:\n");
- if (kern_envp == NULL) {
+ if (loader_envp == NULL) {
debugf(" no env, null ptr\n");
return;
}
- debugf(" kern_envp = 0x%08x\n", (uint32_t)kern_envp);
+ debugf(" loader_envp = 0x%08x\n", (uint32_t)loader_envp);
- for (cp = kern_envp; cp != NULL; cp = kenv_next(cp))
+ for (cp = loader_envp; cp != NULL; cp = kenv_next(cp))
debugf(" %x %s\n", (uint32_t)cp, cp);
}
diff --git a/sys/arm/arm/physmem.c b/sys/arm/arm/physmem.c
index a922163..566ab85 100644
--- a/sys/arm/arm/physmem.c
+++ b/sys/arm/arm/physmem.c
@@ -161,7 +161,7 @@ static size_t
regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
{
size_t acnt, exi, hwi;
- vm_paddr_t end, start, xend, xstart;
+ uint64_t end, start, xend, xstart;
long availmem;
const struct region *exp, *hwp;
@@ -171,7 +171,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) {
start = hwp->addr;
end = hwp->size + start;
- realmem += arm32_btop(end - start);
+ realmem += arm32_btop((vm_offset_t)(end - start));
for (exi = 0, exp = exregions; exi < excnt; ++exi, ++exp) {
/*
* If the excluded region does not match given flags,
@@ -212,9 +212,10 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
* could affect the remainder of this hw region.
*/
if ((xstart > start) && (xend < end)) {
- avail[acnt++] = start;
- avail[acnt++] = xstart;
- availmem += arm32_btop(xstart - start);
+ avail[acnt++] = (vm_paddr_t)start;
+ avail[acnt++] = (vm_paddr_t)xstart;
+ availmem +=
+ arm32_btop((vm_offset_t)(xstart - start));
start = xend;
continue;
}
@@ -233,9 +234,9 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, long *pavail)
* available entry for it.
*/
if (end > start) {
- avail[acnt++] = start;
- avail[acnt++] = end;
- availmem += arm32_btop(end - start);
+ avail[acnt++] = (vm_paddr_t)start;
+ avail[acnt++] = (vm_paddr_t)end;
+ availmem += arm32_btop((vm_offset_t)(end - start));
}
if (acnt >= MAX_AVAIL_ENTRIES)
panic("Not enough space in the dump/phys_avail arrays");
@@ -279,10 +280,22 @@ arm_physmem_hardware_region(vm_paddr_t pa, vm_size_t sz)
/*
* Filter out the page at PA 0x00000000. The VM can't handle it, as
* pmap_extract() == 0 means failure.
+ *
+ * Also filter out the page at the end of the physical address space --
+ * if addr is non-zero and addr+size is zero we wrapped to the next byte
+ * beyond what vm_paddr_t can express. That leads to a NULL pointer
+ * deref early in startup; work around it by leaving the last page out.
+ *
+ * XXX This just in: subtract out a whole megabyte, not just 1 page.
+ * Reducing the size by anything less than 1MB results in the NULL
+ * pointer deref in _vm_map_lock_read(). Better to give up a megabyte
+ * than leave some folks with an unusable system while we investigate.
*/
if (pa == 0) {
pa = PAGE_SIZE;
sz -= PAGE_SIZE;
+ } else if (pa + sz == 0) {
+ sz -= 1024 * 1024;
}
/*
diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c
index e48fbb6..e033e13 100644
--- a/sys/arm/xscale/ixp425/avila_machdep.c
+++ b/sys/arm/xscale/ixp425/avila_machdep.c
@@ -225,8 +225,8 @@ initarm(struct arm_boot_params *abp)
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
- if (envmode == 1)
- kern_envp = static_env;
+ init_static_kenv(NULL, 0);
+
/* Do basic tuning, hz etc */
init_param1();
@@ -426,10 +426,6 @@ initarm(struct arm_boot_params *abp)
init_param2(physmem);
kdb_init();
- /* use static kernel environment if so configured */
- if (envmode == 1)
- kern_envp = static_env;
-
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
sizeof(struct pcb)));
#undef next_page
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index f7e1456..f256260 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -820,7 +820,7 @@ initarm(struct arm64_bootparams *abp)
kmdp = preload_search_by_type("elf64 kernel");
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0);
#ifdef FDT
try_load_dtb(kmdp);
diff --git a/sys/arm64/arm64/ofw_machdep.c b/sys/arm64/arm64/ofw_machdep.c
new file mode 100644
index 0000000..6a0b714
--- /dev/null
+++ b/sys/arm64/arm64/ofw_machdep.c
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 2015 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+
+#include <machine/bus.h>
+
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_subr.h>
+
+extern struct bus_space memmap_bus;
+
+int
+OF_decode_addr(phandle_t dev, int regno, bus_space_tag_t *tag,
+ bus_space_handle_t *handle)
+{
+ bus_addr_t addr;
+ bus_size_t size;
+ int err;
+
+ err = ofw_reg_to_paddr(dev, regno, &addr, &size, NULL);
+ if (err != 0)
+ return (err);
+
+ *tag = &memmap_bus;
+ return (bus_space_map(*tag, addr, size, 0, handle));
+}
diff --git a/sys/arm64/include/ofw_machdep.h b/sys/arm64/include/ofw_machdep.h
index e9c65ef..511fc8d 100644
--- a/sys/arm64/include/ofw_machdep.h
+++ b/sys/arm64/include/ofw_machdep.h
@@ -41,7 +41,4 @@ struct mem_region {
vm_size_t mr_size;
};
-/* FDT follows ePAPR */
-#define OFW_EPAPR
-
#endif /* _MACHINE_OFW_MACHDEP_H_ */
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c
index fc8949e..7a40709 100644
--- a/sys/boot/efi/loader/main.c
+++ b/sys/boot/efi/loader/main.c
@@ -359,10 +359,11 @@ command_mode(int argc, char *argv[])
return (CMD_OK);
}
- for (i = 0; ; i++) {
+ printf("Current mode: %d\n", conout->Mode->Mode);
+ for (i = 0; i <= conout->Mode->MaxMode; i++) {
status = conout->QueryMode(conout, i, &cols, &rows);
if (EFI_ERROR(status))
- break;
+ continue;
printf("Mode %d: %u columns, %u rows\n", i, (unsigned)cols,
(unsigned)rows);
}
diff --git a/sys/boot/libstand32/Makefile b/sys/boot/libstand32/Makefile
index 075a9ea..d1c9ba2 100644
--- a/sys/boot/libstand32/Makefile
+++ b/sys/boot/libstand32/Makefile
@@ -1,151 +1,23 @@
# $FreeBSD$
-# Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
-#
-# Notes:
-# - We don't use the libc strerror/sys_errlist because the string table is
-# quite large.
-#
-
-MAN=
.include <src.opts.mk>
-MK_SSP= no
LIBSTAND_SRC= ${.CURDIR}/../../../lib/libstand
-LIBC_SRC= ${LIBSTAND_SRC}/../libc
-
-.PATH: ${LIBSTAND_SRC}
-LIB= stand
-INTERNALLIB=
-MK_PROFILE= no
-NO_PIC=
-.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+= -m32 -I.
-.endif
-
-WARNS?= 0
-
-# standalone components and stuff we have modified locally
-SRCS+= gzguts.h zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
- globals.c pager.c printf.c strdup.c strerror.c strtol.c strtoul.c random.c \
- sbrk.c twiddle.c zalloc.c zalloc_malloc.c
-
-# private (pruned) versions of libc string functions
-SRCS+= strcasecmp.c
-
-.PATH: ${LIBC_SRC}/net
-
-SRCS+= ntoh.c
-
-# string functions from libc
-.PATH: ${LIBC_SRC}/string
-SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
- memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
- strcspn.c strlcat.c strlcpy.c strlen.c strncat.c strncmp.c strncpy.c \
- strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
-.if ${MACHINE_CPUARCH} == "arm"
-.PATH: ${LIBC_SRC}/arm/gen
-
-# Compiler support functions
-.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/
-# __clzsi2 and ctzsi2 for various builtin functions
-SRCS+= clzsi2.c ctzsi2.c
-# Divide and modulus functions called by the compiler
-SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c
-SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
-
-.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/builtins/arm/
-SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
-SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
-
-.endif
-.if ${MACHINE_CPUARCH} == "powerpc"
-.PATH: ${LIBC_SRC}/quad
-SRCS+= ashldi3.c ashrdi3.c
-SRCS+= syncicache.c
-.endif
-
-# uuid functions from libc
-.PATH: ${LIBC_SRC}/uuid
-SRCS+= uuid_equal.c uuid_is_nil.c
-
-# _setjmp/_longjmp
.if ${MACHINE_CPUARCH} == "amd64"
-.PATH: ${LIBSTAND_SRC}/i386
+LIBSTAND_CPUARCH=i386
.else
-.PATH: ${LIBSTAND_SRC}/${MACHINE_CPUARCH}
+LIBSTAND_CPUARCH=${MACHINE_CPUARCH}
.endif
-SRCS+= _setjmp.S
-
-# decompression functionality from libbz2
-# NOTE: to actually test this functionality after libbz2 upgrade compile
-# loader(8) with LOADER_BZIP2_SUPPORT defined
-.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
-CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
-SRCS+= libstand_bzlib_private.h
-
-.for file in bzlib.c crctable.c decompress.c huffman.c randtable.c
-SRCS+= _${file}
-CLEANFILES+= _${file}
-
-_${file}: ${file}
- sed "s|bzlib_private\.h|libstand_bzlib_private.h|" \
- ${.ALLSRC} > ${.TARGET}
-.endfor
-
-CLEANFILES+= libstand_bzlib_private.h
-libstand_bzlib_private.h: bzlib_private.h
- sed -e 's|<stdlib.h>|"stand.h"|' \
- ${.ALLSRC} > ${.TARGET}
-
-# decompression functionality from libz
-.PATH: ${LIBSTAND_SRC}/../libz
-CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz
-SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
-
-.for file in infback.c inffast.c inflate.c inftrees.c zutil.c
-SRCS+= _${file}
-CLEANFILES+= _${file}
-
-_${file}: ${file}
- sed -e "s|zutil\.h|libstand_zutil.h|" \
- -e "s|gzguts\.h|libstand_gzguts.h|" \
- ${.ALLSRC} > ${.TARGET}
-.endfor
-
-# depend on stand.h being able to be included multiple times
-.for file in zutil.h gzguts.h
-CLEANFILES+= libstand_${file}
-libstand_${file}: ${file}
- sed -e 's|<fcntl.h>|"stand.h"|' \
- -e 's|<stddef.h>|"stand.h"|' \
- -e 's|<string.h>|"stand.h"|' \
- -e 's|<stdio.h>|"stand.h"|' \
- -e 's|<stdlib.h>|"stand.h"|' \
- ${.ALLSRC} > ${.TARGET}
-.endfor
-
-# io routines
-SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
- fstat.c close.c lseek.c open.c read.c write.c readdir.c
-
-# network routines
-SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
-
-# network info services:
-SRCS+= bootp.c rarp.c bootparam.c
+LIBC_SRC= ${LIBSTAND_SRC}/../libc
+INTERNALLIB=
+MAN=
+.PATH: ${LIBSTAND_SRC}
-# boot filesystems
-SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c
-SRCS+= dosfs.c ext2fs.c
-SRCS+= splitfs.c
-SRCS+= pkgfs.c
-.if ${MK_NAND} != "no"
-SRCS+= nandfs.c
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+= -m32 -I.
.endif
-.include <bsd.stand.mk>
-.include <bsd.lib.mk>
+.include "${LIBSTAND_SRC}/Makefile"
.if ${MACHINE_CPUARCH} == "amd64"
CLEANFILES+= machine
diff --git a/sys/boot/uboot/lib/copy.c b/sys/boot/uboot/lib/copy.c
index 51416ac..c0e8b81 100644
--- a/sys/boot/uboot/lib/copy.c
+++ b/sys/boot/uboot/lib/copy.c
@@ -69,11 +69,11 @@ uint64_t
uboot_loadaddr(u_int type, void *data, uint64_t addr)
{
struct sys_info *si;
- uintptr_t sblock, eblock, subldr, eubldr;
- uintptr_t biggest_block, this_block;
- size_t biggest_size, this_size;
+ uint64_t sblock, eblock, subldr, eubldr;
+ uint64_t biggest_block, this_block;
+ uint64_t biggest_size, this_size;
int i;
- char * envstr;
+ char *envstr;
if (addr == 0) {
/*
@@ -100,14 +100,15 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr)
biggest_block = 0;
biggest_size = 0;
- subldr = rounddown2((uintptr_t)_start, KERN_ALIGN);
- eubldr = roundup2(uboot_heap_end, KERN_ALIGN);
+ subldr = rounddown2((uint64_t)(uintptr_t)_start, KERN_ALIGN);
+ eubldr = roundup2((uint64_t)uboot_heap_end, KERN_ALIGN);
for (i = 0; i < si->mr_no; i++) {
if (si->mr[i].flags != MR_ATTR_DRAM)
continue;
- sblock = roundup2(si->mr[i].start, KERN_ALIGN);
- eblock = rounddown2(si->mr[i].start + si->mr[i].size,
+ sblock = roundup2((uint64_t)si->mr[i].start,
KERN_ALIGN);
+ eblock = rounddown2((uint64_t)si->mr[i].start +
+ si->mr[i].size, KERN_ALIGN);
if (biggest_size == 0)
sblock += KERN_MINADDR;
if (subldr >= sblock && subldr < eblock) {
@@ -134,9 +135,10 @@ uboot_loadaddr(u_int type, void *data, uint64_t addr)
if (biggest_size == 0)
panic("Not enough DRAM to load kernel\n");
#if 0
- printf("Loading kernel into region 0x%08x-0x%08x (%u MiB)\n",
- biggest_block, biggest_block + biggest_size - 1,
- biggest_size / 1024 / 1024);
+ printf("Loading kernel into region 0x%08jx-0x%08jx (%ju MiB)\n",
+ (uintmax_t)biggest_block,
+ (uintmax_t)biggest_block + biggest_size - 1,
+ (uintmax_t)biggest_size / 1024 / 1024);
#endif
return (biggest_block);
}
diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index 6ecf36a..a128967 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -38,6 +38,7 @@ arm64/arm64/mem.c standard
arm64/arm64/minidump_machdep.c standard
arm64/arm64/mp_machdep.c optional smp
arm64/arm64/nexus.c standard
+arm64/arm64/ofw_machdep.c optional fdt
arm64/arm64/pic_if.m standard
arm64/arm64/pmap.c standard
arm64/arm64/stack_machdep.c optional ddb | stack
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c
index fe4a657..3d633a4 100644
--- a/sys/dev/ath/ah_osdep.c
+++ b/sys/dev/ath/ah_osdep.c
@@ -270,12 +270,14 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
bus_space_tag_t tag = BUSTAG(ah);
bus_space_handle_t h = ah->ah_sh;
+#ifdef AH_DEBUG
/* Debug - complain if we haven't fully waken things up */
if (! ath_hal_reg_whilst_asleep(ah, reg) &&
ah->ah_powerMode != HAL_PM_AWAKE) {
ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n",
__func__, reg, val, ah->ah_powerMode);
}
+#endif
if (ath_hal_alq) {
struct ale *ale = ath_hal_alq_get(ah);
@@ -291,6 +293,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
if (ah->ah_config.ah_serialise_reg_war)
mtx_lock_spin(&ah_regser_mtx);
bus_space_write_4(tag, h, reg, val);
+ OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_WRITE);
if (ah->ah_config.ah_serialise_reg_war)
mtx_unlock_spin(&ah_regser_mtx);
}
@@ -302,15 +305,18 @@ ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
bus_space_handle_t h = ah->ah_sh;
u_int32_t val;
+#ifdef AH_DEBUG
/* Debug - complain if we haven't fully waken things up */
if (! ath_hal_reg_whilst_asleep(ah, reg) &&
ah->ah_powerMode != HAL_PM_AWAKE) {
ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n",
__func__, reg, ah->ah_powerMode);
}
+#endif
if (ah->ah_config.ah_serialise_reg_war)
mtx_lock_spin(&ah_regser_mtx);
+ OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_READ);
val = bus_space_read_4(tag, h, reg);
if (ah->ah_config.ah_serialise_reg_war)
mtx_unlock_spin(&ah_regser_mtx);
@@ -343,7 +349,8 @@ OS_MARK(struct ath_hal *ah, u_int id, u_int32_t v)
}
}
}
-#elif defined(AH_DEBUG) || defined(AH_REGOPS_FUNC)
+#else /* AH_DEBUG_ALQ */
+
/*
* Memory-mapped device register read/write. These are here
* as routines when debugging support is enabled and/or when
@@ -361,16 +368,19 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val)
bus_space_tag_t tag = BUSTAG(ah);
bus_space_handle_t h = ah->ah_sh;
+#ifdef AH_DEBUG
/* Debug - complain if we haven't fully waken things up */
if (! ath_hal_reg_whilst_asleep(ah, reg) &&
ah->ah_powerMode != HAL_PM_AWAKE) {
ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n",
__func__, reg, val, ah->ah_powerMode);
}
+#endif
if (ah->ah_config.ah_serialise_reg_war)
mtx_lock_spin(&ah_regser_mtx);
bus_space_write_4(tag, h, reg, val);
+ OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_WRITE);
if (ah->ah_config.ah_serialise_reg_war)
mtx_unlock_spin(&ah_regser_mtx);
}
@@ -382,21 +392,24 @@ ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg)
bus_space_handle_t h = ah->ah_sh;
u_int32_t val;
+#ifdef AH_DEBUG
/* Debug - complain if we haven't fully waken things up */
if (! ath_hal_reg_whilst_asleep(ah, reg) &&
ah->ah_powerMode != HAL_PM_AWAKE) {
ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n",
__func__, reg, ah->ah_powerMode);
}
+#endif
if (ah->ah_config.ah_serialise_reg_war)
mtx_lock_spin(&ah_regser_mtx);
+ OS_BUS_BARRIER_REG(ah, reg, OS_BUS_BARRIER_READ);
val = bus_space_read_4(tag, h, reg);
if (ah->ah_config.ah_serialise_reg_war)
mtx_unlock_spin(&ah_regser_mtx);
return val;
}
-#endif /* AH_DEBUG || AH_REGOPS_FUNC */
+#endif /* AH_DEBUG_ALQ */
#ifdef AH_ASSERT
void
diff --git a/sys/dev/ath/ah_osdep.h b/sys/dev/ath/ah_osdep.h
index 50778f2..9460192 100644
--- a/sys/dev/ath/ah_osdep.h
+++ b/sys/dev/ath/ah_osdep.h
@@ -110,25 +110,35 @@ struct ath_hal;
do { } while (0)
/*
- * Register read/write operations are either handled through
- * platform-dependent routines (or when debugging is enabled
- * with AH_DEBUG); or they are inline expanded using the macros
- * defined below.
+ * Read and write barriers. Some platforms require more strongly ordered
+ * operations and unfortunately most of the HAL is written assuming everything
+ * is either an x86 or the bus layer will do the barriers for you.
+ *
+ * Read barriers should occur before each read, and write barriers
+ * occur after each write.
+ *
+ * Later on for SDIO/USB parts we will methodize this and make them no-ops;
+ * register accesses will go via USB commands.
+ */
+#define OS_BUS_BARRIER_READ BUS_SPACE_BARRIER_READ
+#define OS_BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE
+#define OS_BUS_BARRIER_RW \
+ (BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE)
+#define OS_BUS_BARRIER(_ah, _start, _len, _t) \
+ bus_space_barrier((bus_space_tag_t)(_ah)->ah_st, \
+ (bus_space_handle_t)(_ah)->ah_sh, (_start), (_len), (_t))
+#define OS_BUS_BARRIER_REG(_ah, _reg, _t) \
+ OS_BUS_BARRIER((_ah), (_reg), 4, (_t))
+
+/*
+ * Register read/write operations are handled through
+ * platform-dependent routines.
*/
-#if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ)
#define OS_REG_WRITE(_ah, _reg, _val) ath_hal_reg_write(_ah, _reg, _val)
#define OS_REG_READ(_ah, _reg) ath_hal_reg_read(_ah, _reg)
extern void ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val);
extern u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int reg);
-#else
-#define OS_REG_WRITE(_ah, _reg, _val) \
- bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \
- (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val))
-#define OS_REG_READ(_ah, _reg) \
- bus_space_read_4((bus_space_tag_t)(_ah)->ah_st, \
- (bus_space_handle_t)(_ah)->ah_sh, (_reg))
-#endif
#ifdef AH_DEBUG_ALQ
extern void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c
index ce3b603..73cccd9 100644
--- a/sys/dev/iwm/if_iwm.c
+++ b/sys/dev/iwm/if_iwm.c
@@ -270,7 +270,7 @@ static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *,
static int iwm_get_noise(const struct iwm_mvm_statistics_rx_non_phy *);
static void iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct iwm_rx_packet *,
struct iwm_rx_data *);
-static void iwm_mvm_rx_tx_cmd_single(struct iwm_softc *,
+static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *,
struct iwm_rx_packet *,
struct iwm_node *);
static void iwm_mvm_rx_tx_cmd(struct iwm_softc *, struct iwm_rx_packet *,
@@ -956,7 +956,7 @@ iwm_alloc_tx_ring(struct iwm_softc *sc, struct iwm_tx_ring *ring, int qid)
error = bus_dma_tag_create(sc->sc_dmat, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES,
- IWM_MAX_SCATTER - 1, MCLBYTES, 0, NULL, NULL, &ring->data_dmat);
+ IWM_MAX_SCATTER - 2, MCLBYTES, 0, NULL, NULL, &ring->data_dmat);
if (error != 0) {
device_printf(sc->sc_dev, "could not create TX buf DMA tag\n");
goto fail;
@@ -2400,12 +2400,13 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
IWM_LOCK(sc);
}
-static void
+static int
iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
struct iwm_node *in)
{
struct iwm_mvm_tx_resp *tx_resp = (void *)pkt->data;
- struct ieee80211vap *vap = in->in_ni.ni_vap;
+ struct ieee80211_node *ni = &in->in_ni;
+ struct ieee80211vap *vap = ni->ni_vap;
int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK;
int failack = tx_resp->failure_frame;
@@ -2414,14 +2415,13 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
/* Update rate control statistics. */
if (status != IWM_TX_STATUS_SUCCESS &&
status != IWM_TX_STATUS_DIRECT_DONE) {
- if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, 1);
- ieee80211_ratectl_tx_complete(vap, &in->in_ni,
+ ieee80211_ratectl_tx_complete(vap, ni,
IEEE80211_RATECTL_TX_FAILURE, &failack, NULL);
+ return (1);
} else {
- if_inc_counter(vap->iv_ifp, IFCOUNTER_OPACKETS, 1);
- ieee80211_ratectl_tx_complete(vap, &in->in_ni,
+ ieee80211_ratectl_tx_complete(vap, ni,
IEEE80211_RATECTL_TX_SUCCESS, &failack, NULL);
-
+ return (0);
}
}
@@ -2435,33 +2435,30 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc,
struct iwm_tx_ring *ring = &sc->txq[qid];
struct iwm_tx_data *txd = &ring->data[idx];
struct iwm_node *in = txd->in;
+ struct mbuf *m = txd->m;
+ int status;
+
+ KASSERT(txd->done == 0, ("txd not done"));
+ KASSERT(txd->in != NULL, ("txd without node"));
+ KASSERT(txd->m != NULL, ("txd without mbuf"));
- if (txd->done) {
- device_printf(sc->sc_dev,
- "%s: got tx interrupt that's already been handled!\n",
- __func__);
- return;
- }
bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
sc->sc_tx_timer = 0;
- iwm_mvm_rx_tx_cmd_single(sc, pkt, in);
+ status = iwm_mvm_rx_tx_cmd_single(sc, pkt, in);
/* Unmap and free mbuf. */
bus_dmamap_sync(ring->data_dmat, txd->map, BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(ring->data_dmat, txd->map);
- m_freem(txd->m);
IWM_DPRINTF(sc, IWM_DEBUG_XMIT,
"free txd %p, in %p\n", txd, txd->in);
- KASSERT(txd->done == 0, ("txd not done"));
txd->done = 1;
- KASSERT(txd->in, ("txd without node"));
-
txd->m = NULL;
txd->in = NULL;
- ieee80211_free_node((struct ieee80211_node *)in);
+
+ ieee80211_tx_complete(&in->in_ni, m, status);
if (--ring->queued < IWM_TX_RING_LOMARK) {
sc->qfullmsk &= ~(1 << ring->qid);
@@ -2649,7 +2646,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
- struct iwm_node *in = (struct iwm_node *)ni;
+ struct iwm_node *in = IWM_NODE(ni);
struct iwm_tx_ring *ring;
struct iwm_tx_data *data;
struct iwm_tfd *desc;
@@ -2706,7 +2703,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq);
tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags);
tap->wt_rate = rinfo->rate;
- tap->wt_hwqueue = ac;
if (k != NULL)
tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP;
ieee80211_radiotap_tx(vap, m);
@@ -2782,23 +2778,15 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac)
return error;
}
/* Too many DMA segments, linearize mbuf. */
- MGETHDR(m1, M_NOWAIT, MT_DATA);
+ m1 = m_collapse(m, M_NOWAIT, IWM_MAX_SCATTER - 2);
if (m1 == NULL) {
+ device_printf(sc->sc_dev,
+ "%s: could not defrag mbuf\n", __func__);
m_freem(m);
- return ENOBUFS;
- }
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m1, M_NOWAIT);
- if (!(m1->m_flags & M_EXT)) {
- m_freem(m);
- m_freem(m1);
- return ENOBUFS;
- }
+ return (ENOBUFS);
}
- m_copydata(m, 0, m->m_pkthdr.len, mtod(m1, void *));
- m1->m_pkthdr.len = m1->m_len = m->m_pkthdr.len;
- m_freem(m);
m = m1;
+
error = bus_dmamap_load_mbuf_sg(ring->data_dmat, data->map, m,
segs, &nsegs, BUS_DMA_NOWAIT);
if (error != 0) {
@@ -3182,7 +3170,7 @@ iwm_auth(struct ieee80211vap *vap, struct iwm_softc *sc)
* freed from underneath us. Grr.
*/
ni = ieee80211_ref_node(vap->iv_bss);
- in = (struct iwm_node *) ni;
+ in = IWM_NODE(ni);
IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_STATE,
"%s: called; vap=%p, bss ni=%p\n",
__func__,
@@ -3289,7 +3277,7 @@ out:
static int
iwm_assoc(struct ieee80211vap *vap, struct iwm_softc *sc)
{
- struct iwm_node *in = (struct iwm_node *)vap->iv_bss;
+ struct iwm_node *in = IWM_NODE(vap->iv_bss);
int error;
if ((error = iwm_mvm_update_sta(sc, in)) != 0) {
@@ -3515,7 +3503,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
if (vap->iv_state == IEEE80211_S_RUN && nstate != vap->iv_state) {
iwm_mvm_disable_beacon_filter(sc);
- if (((in = (void *)vap->iv_bss) != NULL))
+ if (((in = IWM_NODE(vap->iv_bss)) != NULL))
in->in_assoc = 0;
iwm_release(sc, NULL);
@@ -3591,7 +3579,7 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
break;
}
- in = (struct iwm_node *)vap->iv_bss;
+ in = IWM_NODE(vap->iv_bss);
iwm_mvm_power_mac_update_mode(sc, in);
iwm_mvm_enable_beacon_filter(sc, in);
iwm_mvm_update_quotas(sc, in);
@@ -4596,7 +4584,7 @@ iwm_attach(device_t dev)
int txq_i, i;
sc->sc_dev = dev;
- mtx_init(&sc->sc_mtx, "iwm_mtx", MTX_DEF, 0);
+ IWM_LOCK_INIT(sc);
mbufq_init(&sc->sc_snd, ifqmaxlen);
callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0);
TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc);
@@ -4985,7 +4973,7 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211)
iwm_pci_detach(dev);
mbufq_drain(&sc->sc_snd);
- mtx_destroy(&sc->sc_mtx);
+ IWM_LOCK_DESTROY(sc);
return (0);
}
diff --git a/sys/dev/iwm/if_iwm_mac_ctxt.c b/sys/dev/iwm/if_iwm_mac_ctxt.c
index edaacc9..50b1b13 100644
--- a/sys/dev/iwm/if_iwm_mac_ctxt.c
+++ b/sys/dev/iwm/if_iwm_mac_ctxt.c
@@ -426,7 +426,7 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_softc *sc, struct ieee80211vap *vap,
uint32_t action)
{
struct ieee80211_node *ni = vap->iv_bss;
- struct iwm_node *in = (struct iwm_node *) ni;
+ struct iwm_node *in = IWM_NODE(ni);
struct iwm_mac_ctx_cmd cmd;
IWM_DPRINTF(sc, IWM_DEBUG_RESET,
diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h
index 9434b83..52363c5 100644
--- a/sys/dev/iwm/if_iwmvar.h
+++ b/sys/dev/iwm/if_iwmvar.h
@@ -129,7 +129,6 @@ struct iwm_tx_radiotap_header {
uint8_t wt_rate;
uint16_t wt_chan_freq;
uint16_t wt_chan_flags;
- uint8_t wt_hwqueue;
} __packed;
#define IWM_TX_RADIOTAP_PRESENT \
@@ -152,9 +151,6 @@ struct iwm_tx_radiotap_header {
#define IWM_FW_STATUS_INPROGRESS 1
#define IWM_FW_STATUS_DONE 2
-#define IWM_LOCK(_sc) mtx_lock(&sc->sc_mtx)
-#define IWM_UNLOCK(_sc) mtx_unlock(&sc->sc_mtx)
-
enum iwm_ucode_type {
IWM_UCODE_TYPE_INIT,
IWM_UCODE_TYPE_REGULAR,
@@ -244,12 +240,12 @@ struct iwm_dma_info {
#define IWM_TX_RING_HIMARK 224
struct iwm_tx_data {
- bus_dmamap_t map;
- bus_addr_t cmd_paddr;
- bus_addr_t scratch_paddr;
- struct mbuf *m;
- struct iwm_node *in;
- int done;
+ bus_dmamap_t map;
+ bus_addr_t cmd_paddr;
+ bus_addr_t scratch_paddr;
+ struct mbuf *m;
+ struct iwm_node *in;
+ int done;
};
struct iwm_tx_ring {
@@ -295,12 +291,6 @@ struct iwm_rx_ring {
int cur;
};
-#define IWM_FLAG_USE_ICT 0x01
-#define IWM_FLAG_HW_INITED 0x02
-#define IWM_FLAG_STOPPED 0x04
-#define IWM_FLAG_RFKILL 0x08
-#define IWM_FLAG_BUSY 0x10
-
struct iwm_ucode_status {
uint32_t uc_error_event_table;
uint32_t uc_log_event_table;
@@ -371,68 +361,97 @@ struct iwm_bf_data {
};
struct iwm_vap {
- struct ieee80211vap iv_vap;
- uint8_t macaddr[IEEE80211_ADDR_LEN];
- int is_uploaded;
+ struct ieee80211vap iv_vap;
+ int is_uploaded;
- int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int);
+ int (*iv_newstate)(struct ieee80211vap *,
+ enum ieee80211_state, int);
};
+#define IWM_VAP(_vap) ((struct iwm_vap *)(_vap))
-#define IWM_VAP(_vap) ((struct iwm_vap *)(_vap))
+struct iwm_node {
+ struct ieee80211_node in_ni;
+ struct iwm_mvm_phy_ctxt *in_phyctxt;
+
+ /* status "bits" */
+ int in_assoc;
+
+ struct iwm_lq_cmd in_lq;
+
+ uint8_t in_ridx[IEEE80211_RATE_MAXSIZE];
+};
+#define IWM_NODE(_ni) ((struct iwm_node *)(_ni))
+
+#define IWM_STATION_ID 0
+
+#define IWM_DEFAULT_MACID 0
+#define IWM_DEFAULT_COLOR 0
+#define IWM_DEFAULT_TSFID 0
+
+#define IWM_ICT_SIZE 4096
+#define IWM_ICT_COUNT (IWM_ICT_SIZE / sizeof (uint32_t))
+#define IWM_ICT_PADDR_SHIFT 12
struct iwm_softc {
+ device_t sc_dev;
+ uint32_t sc_debug;
+
struct mtx sc_mtx;
struct mbufq sc_snd;
struct ieee80211com sc_ic;
- device_t sc_dev;
+
+ int sc_flags;
+#define IWM_FLAG_USE_ICT (1 << 0)
+#define IWM_FLAG_HW_INITED (1 << 1)
+#define IWM_FLAG_STOPPED (1 << 2)
+#define IWM_FLAG_RFKILL (1 << 3)
+#define IWM_FLAG_BUSY (1 << 4)
struct intr_config_hook sc_preinit_hook;
- struct callout sc_watchdog_to;
+ struct callout sc_watchdog_to;
struct task init_task;
- struct resource *sc_irq;
- struct resource *sc_mem;
- bus_space_tag_t sc_st;
- bus_space_handle_t sc_sh;
- bus_size_t sc_sz;
- bus_dma_tag_t sc_dmat;
- void *sc_ih;
+ struct resource *sc_irq;
+ struct resource *sc_mem;
+ bus_space_tag_t sc_st;
+ bus_space_handle_t sc_sh;
+ bus_size_t sc_sz;
+ bus_dma_tag_t sc_dmat;
+ void *sc_ih;
/* TX scheduler rings. */
- struct iwm_dma_info sched_dma;
- uint32_t sched_base;
+ struct iwm_dma_info sched_dma;
+ uint32_t sched_base;
/* TX/RX rings. */
- struct iwm_tx_ring txq[IWM_MVM_MAX_QUEUES];
- struct iwm_rx_ring rxq;
- int qfullmsk;
+ struct iwm_tx_ring txq[IWM_MVM_MAX_QUEUES];
+ struct iwm_rx_ring rxq;
+ int qfullmsk;
- int sc_sf_state;
+ int sc_sf_state;
/* ICT table. */
struct iwm_dma_info ict_dma;
int ict_cur;
- int sc_hw_rev;
- int sc_hw_id;
+ int sc_hw_rev;
+ int sc_hw_id;
- struct iwm_dma_info kw_dma;
- struct iwm_dma_info fw_dma;
+ struct iwm_dma_info kw_dma;
+ struct iwm_dma_info fw_dma;
- int sc_fw_chunk_done;
- int sc_init_complete;
+ int sc_fw_chunk_done;
+ int sc_init_complete;
- struct iwm_ucode_status sc_uc;
- enum iwm_ucode_type sc_uc_current;
- int sc_fwver;
+ struct iwm_ucode_status sc_uc;
+ enum iwm_ucode_type sc_uc_current;
+ int sc_fwver;
- int sc_capaflags;
- int sc_capa_max_probe_len;
+ int sc_capaflags;
+ int sc_capa_max_probe_len;
- int sc_intmask;
- int sc_flags;
- uint32_t sc_debug;
+ int sc_intmask;
/*
* So why do we need a separate stopped flag and a generation?
@@ -443,86 +462,63 @@ struct iwm_softc {
* the device from interrupt context when it craps out, so we
* don't have the luxury of waiting for quiescense.
*/
- int sc_generation;
+ int sc_generation;
- const char *sc_fwname;
- bus_size_t sc_fwdmasegsz;
- struct iwm_fw_info sc_fw;
- int sc_fw_phy_config;
+ const char *sc_fwname;
+ bus_size_t sc_fwdmasegsz;
+ struct iwm_fw_info sc_fw;
+ int sc_fw_phy_config;
struct iwm_tlv_calib_ctrl sc_default_calib[IWM_UCODE_TYPE_MAX];
- struct iwm_nvm_data sc_nvm;
- struct iwm_phy_db sc_phy_db;
+ struct iwm_nvm_data sc_nvm;
+ struct iwm_phy_db sc_phy_db;
- struct iwm_bf_data sc_bf;
+ struct iwm_bf_data sc_bf;
- int sc_tx_timer;
+ int sc_tx_timer;
- struct iwm_scan_cmd *sc_scan_cmd;
- size_t sc_scan_cmd_len;
- int sc_scan_last_antenna;
- int sc_scanband;
+ struct iwm_scan_cmd *sc_scan_cmd;
+ size_t sc_scan_cmd_len;
+ int sc_scan_last_antenna;
+ int sc_scanband;
- int sc_auth_prot;
+ int sc_auth_prot;
- int sc_fixed_ridx;
+ int sc_fixed_ridx;
- int sc_staid;
- int sc_nodecolor;
+ int sc_staid;
+ int sc_nodecolor;
- uint8_t sc_cmd_resp[IWM_CMD_RESP_MAX];
- int sc_wantresp;
+ uint8_t sc_cmd_resp[IWM_CMD_RESP_MAX];
+ int sc_wantresp;
- struct taskqueue *sc_tq;
- struct task sc_es_task;
+ struct taskqueue *sc_tq;
+ struct task sc_es_task;
- struct iwm_rx_phy_info sc_last_phy_info;
- int sc_ampdu_ref;
+ struct iwm_rx_phy_info sc_last_phy_info;
+ int sc_ampdu_ref;
- struct iwm_int_sta sc_aux_sta;
+ struct iwm_int_sta sc_aux_sta;
/* phy contexts. we only use the first one */
- struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX];
+ struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX];
struct iwm_notif_statistics sc_stats;
- int sc_noise;
+ int sc_noise;
- int host_interrupt_operation_mode;
+ int host_interrupt_operation_mode;
caddr_t sc_drvbpf;
- union {
- struct iwm_rx_radiotap_header th;
- uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
- } sc_rxtapu;
-#define sc_rxtap sc_rxtapu.th
-
- union {
- struct iwm_tx_radiotap_header th;
- uint8_t pad[IEEE80211_RADIOTAP_HDRLEN];
- } sc_txtapu;
-#define sc_txtap sc_txtapu.th
-
- int sc_max_rssi;
-};
-
-#define IWM_DEFAULT_MACID 0
-#define IWM_DEFAULT_COLOR 0
-#define IWM_DEFAULT_TSFID 0
-
-struct iwm_node {
- struct ieee80211_node in_ni;
- struct iwm_mvm_phy_ctxt *in_phyctxt;
-
- /* status "bits" */
- int in_assoc;
-
- struct iwm_lq_cmd in_lq;
+ struct iwm_rx_radiotap_header sc_rxtap;
+ struct iwm_tx_radiotap_header sc_txtap;
- uint8_t in_ridx[IEEE80211_RATE_MAXSIZE];
+ int sc_max_rssi;
};
-#define IWM_STATION_ID 0
-#define IWM_ICT_SIZE 4096
-#define IWM_ICT_COUNT (IWM_ICT_SIZE / sizeof (uint32_t))
-#define IWM_ICT_PADDR_SHIFT 12
+#define IWM_LOCK_INIT(_sc) \
+ mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
+ MTX_NETWORK_LOCK, MTX_DEF);
+#define IWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
+#define IWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
+#define IWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c
index 0428140..505d4b4 100644
--- a/sys/dev/ixl/if_ixl.c
+++ b/sys/dev/ixl/if_ixl.c
@@ -6606,7 +6606,11 @@ ixl_iov_uninit(device_t dev)
pf->veb_seid = 0;
}
+#if __FreeBSD_version > 1100022
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+#else
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+#endif
ixl_disable_intr(vsi);
vfs = pf->vfs;
diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c
index c286373..60a341c 100644
--- a/sys/dev/ofw/ofw_bus_subr.c
+++ b/sys/dev/ofw/ofw_bus_subr.c
@@ -361,10 +361,11 @@ ofw_bus_search_intrmap(void *intr, int intrsz, void *regs, int physsz,
paddrsz = 0;
while (i > 0) {
bcopy(mptr + physsz + intrsz, &parent, sizeof(parent));
-#ifdef OFW_EPAPR
+#ifndef OFW_IMAP_NO_IPARENT_ADDR_CELLS
/*
- * Find if we need to read the parent address data. Sparc64
- * uses a different encoding that doesn't include this data.
+ * Find if we need to read the parent address data.
+ * CHRP-derived OF bindings, including ePAPR-compliant FDTs,
+ * use this as an optional part of the specifier.
*/
if (OF_getencprop(OF_node_from_xref(parent),
"#address-cells", &paddrsz, sizeof(paddrsz)) == -1)
diff --git a/sys/dev/rt/if_rt.c b/sys/dev/rt/if_rt.c
index 4deb8de..3d3a3f3 100644
--- a/sys/dev/rt/if_rt.c
+++ b/sys/dev/rt/if_rt.c
@@ -227,20 +227,6 @@ macaddr_atoi(const char *str, uint8_t *mac)
}
#ifdef USE_GENERATED_MAC_ADDRESS
-static char *
-kernenv_next(char *cp)
-{
-
- if (cp != NULL) {
- while (*cp != 0)
- cp++;
- cp++;
- if (*cp == 0)
- cp = NULL;
- }
- return (cp);
-}
-
/*
* generate_mac(uin8_t *mac)
* This is MAC address generator for cases when real device MAC address
@@ -259,14 +245,8 @@ generate_mac(uint8_t *mac)
uint32_t crc = 0xffffffff;
/* Generate CRC32 on kenv */
- if (dynamic_kenv) {
- for (cp = kenvp[0]; cp != NULL; cp = kenvp[++i]) {
- crc = calculate_crc32c(crc, cp, strlen(cp) + 1);
- }
- } else {
- for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
- crc = calculate_crc32c(crc, cp, strlen(cp) + 1);
- }
+ for (cp = kenvp[0]; cp != NULL; cp = kenvp[++i]) {
+ crc = calculate_crc32c(crc, cp, strlen(cp) + 1);
}
crc = ~crc;
diff --git a/sys/dev/sec/sec.c b/sys/dev/sec/sec.c
index 3b99a3e..b83e7eb 100644
--- a/sys/dev/sec/sec.c
+++ b/sys/dev/sec/sec.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/random.h>
#include <sys/rman.h>
+#include <machine/_inttypes.h>
#include <machine/bus.h>
#include <machine/resource.h>
@@ -235,7 +236,7 @@ sec_probe(device_t dev)
sc->sc_version = 3;
break;
default:
- device_printf(dev, "unknown SEC ID 0x%016llx!\n", id);
+ device_printf(dev, "unknown SEC ID 0x%016"PRIx64"!\n", id);
return (ENXIO);
}
diff --git a/sys/dev/syscons/plasma/fp16.c b/sys/dev/syscons/plasma/fp16.c
index f0f97e3..dddba2e 100644
--- a/sys/dev/syscons/plasma/fp16.c
+++ b/sys/dev/syscons/plasma/fp16.c
@@ -71,42 +71,66 @@ fp16_sqrt(fp16_t x)
return (y);
}
-static fp16_t fp16_cos_table[256] = {
- 65536, 65534, 65531, 65524, 65516, 65505, 65491, 65475,
- 65457, 65436, 65412, 65386, 65358, 65327, 65294, 65258,
- 65220, 65179, 65136, 65091, 65043, 64992, 64939, 64884,
- 64826, 64766, 64703, 64638, 64571, 64501, 64428, 64353,
- 64276, 64197, 64115, 64030, 63943, 63854, 63762, 63668,
- 63571, 63473, 63371, 63268, 63162, 63053, 62942, 62829,
- 62714, 62596, 62475, 62353, 62228, 62100, 61971, 61839,
- 61705, 61568, 61429, 61288, 61144, 60998, 60850, 60700,
- 60547, 60392, 60235, 60075, 59913, 59749, 59583, 59414,
- 59243, 59070, 58895, 58718, 58538, 58356, 58172, 57986,
- 57797, 57606, 57414, 57219, 57022, 56822, 56621, 56417,
- 56212, 56004, 55794, 55582, 55368, 55152, 54933, 54713,
- 54491, 54266, 54040, 53811, 53581, 53348, 53114, 52877,
- 52639, 52398, 52155, 51911, 51665, 51416, 51166, 50914,
- 50660, 50403, 50146, 49886, 49624, 49360, 49095, 48828,
- 48558, 48288, 48015, 47740, 47464, 47186, 46906, 46624,
- 46340, 46055, 45768, 45480, 45189, 44897, 44603, 44308,
- 44011, 43712, 43412, 43110, 42806, 42501, 42194, 41885,
- 41575, 41263, 40950, 40636, 40319, 40002, 39682, 39362,
- 39039, 38716, 38390, 38064, 37736, 37406, 37075, 36743,
- 36409, 36074, 35738, 35400, 35061, 34721, 34379, 34036,
- 33692, 33346, 32999, 32651, 32302, 31952, 31600, 31247,
- 30893, 30538, 30181, 29824, 29465, 29105, 28745, 28383,
- 28020, 27656, 27291, 26925, 26557, 26189, 25820, 25450,
- 25079, 24707, 24334, 23960, 23586, 23210, 22833, 22456,
- 22078, 21699, 21319, 20938, 20557, 20175, 19792, 19408,
- 19024, 18638, 18253, 17866, 17479, 17091, 16702, 16313,
- 15923, 15533, 15142, 14751, 14359, 13966, 13573, 13179,
- 12785, 12390, 11995, 11600, 11204, 10807, 10410, 10013,
- 9616, 9218, 8819, 8421, 8022, 7623, 7223, 6823,
- 6423, 6023, 5622, 5222, 4821, 4420, 4018, 3617,
- 3215, 2814, 2412, 2010, 1608, 1206, 804, 402,
+static fp16_t fp16_sin_table[256] = {
+ 0, 402, 804, 1206, 1608, 2010, 2412, 2814,
+ 3215, 3617, 4018, 4420, 4821, 5222, 5622, 6023,
+ 6423, 6823, 7223, 7623, 8022, 8421, 8819, 9218,
+ 9616, 10013, 10410, 10807, 11204, 11600, 11995, 12390,
+ 12785, 13179, 13573, 13966, 14359, 14751, 15142, 15533,
+ 15923, 16313, 16702, 17091, 17479, 17866, 18253, 18638,
+ 19024, 19408, 19792, 20175, 20557, 20938, 21319, 21699,
+ 22078, 22456, 22833, 23210, 23586, 23960, 24334, 24707,
+ 25079, 25450, 25820, 26189, 26557, 26925, 27291, 27656,
+ 28020, 28383, 28745, 29105, 29465, 29824, 30181, 30538,
+ 30893, 31247, 31600, 31952, 32302, 32651, 32999, 33346,
+ 33692, 34036, 34379, 34721, 35061, 35400, 35738, 36074,
+ 36409, 36743, 37075, 37406, 37736, 38064, 38390, 38716,
+ 39039, 39362, 39682, 40002, 40319, 40636, 40950, 41263,
+ 41575, 41885, 42194, 42501, 42806, 43110, 43412, 43712,
+ 44011, 44308, 44603, 44897, 45189, 45480, 45768, 46055,
+ 46340, 46624, 46906, 47186, 47464, 47740, 48015, 48288,
+ 48558, 48828, 49095, 49360, 49624, 49886, 50146, 50403,
+ 50660, 50914, 51166, 51416, 51665, 51911, 52155, 52398,
+ 52639, 52877, 53114, 53348, 53581, 53811, 54040, 54266,
+ 54491, 54713, 54933, 55152, 55368, 55582, 55794, 56004,
+ 56212, 56417, 56621, 56822, 57022, 57219, 57414, 57606,
+ 57797, 57986, 58172, 58356, 58538, 58718, 58895, 59070,
+ 59243, 59414, 59583, 59749, 59913, 60075, 60235, 60392,
+ 60547, 60700, 60850, 60998, 61144, 61288, 61429, 61568,
+ 61705, 61839, 61971, 62100, 62228, 62353, 62475, 62596,
+ 62714, 62829, 62942, 63053, 63162, 63268, 63371, 63473,
+ 63571, 63668, 63762, 63854, 63943, 64030, 64115, 64197,
+ 64276, 64353, 64428, 64501, 64571, 64638, 64703, 64766,
+ 64826, 64884, 64939, 64992, 65043, 65091, 65136, 65179,
+ 65220, 65258, 65294, 65327, 65358, 65386, 65412, 65436,
+ 65457, 65475, 65491, 65505, 65516, 65524, 65531, 65534,
};
/*
+ * Compute the sine of theta.
+ */
+fp16_t
+fp16_sin(fp16_t theta)
+{
+ unsigned int i;
+
+ i = 1024 * (theta % FP16_2PI) / FP16_2PI;
+ switch (i / 256) {
+ case 0:
+ return (fp16_sin_table[i % 256]);
+ case 1:
+ return (fp16_sin_table[255 - i % 256]);
+ case 2:
+ return (-fp16_sin_table[i % 256]);
+ case 3:
+ return (-fp16_sin_table[255 - i % 256]);
+ default:
+ /* inconceivable! */
+ return (0);
+ }
+}
+
+/*
* Compute the cosine of theta.
*/
fp16_t
@@ -117,13 +141,13 @@ fp16_cos(fp16_t theta)
i = 1024 * (theta % FP16_2PI) / FP16_2PI;
switch (i / 256) {
case 0:
- return (fp16_cos_table[i % 256]);
+ return (fp16_sin_table[255 - i % 256]);
case 1:
- return (-fp16_cos_table[255 - i % 256]);
+ return (-fp16_sin_table[i % 256]);
case 2:
- return (-fp16_cos_table[i % 256]);
+ return (-fp16_sin_table[255 - i % 256]);
case 3:
- return (fp16_cos_table[255 - i % 256]);
+ return (fp16_sin_table[i % 256]);
default:
/* inconceivable! */
return (0);
diff --git a/sys/dev/syscons/plasma/fp16.h b/sys/dev/syscons/plasma/fp16.h
index bc0c117..ae54d20 100644
--- a/sys/dev/syscons/plasma/fp16.h
+++ b/sys/dev/syscons/plasma/fp16.h
@@ -78,7 +78,8 @@ fp16_t fp16_sqrt(fp16_t);
#define FP16_PI_2 102943
#define FP16_PI_4 51471
-/* cosine */
+/* sine and cosine */
+fp16_t fp16_sin(fp16_t);
fp16_t fp16_cos(fp16_t);
#endif
diff --git a/sys/dev/syscons/plasma/plasma_saver.c b/sys/dev/syscons/plasma/plasma_saver.c
index b5ed02f..761aa5c 100644
--- a/sys/dev/syscons/plasma/plasma_saver.c
+++ b/sys/dev/syscons/plasma/plasma_saver.c
@@ -104,7 +104,7 @@ plasma_update(video_adapter_t *adp)
sqd = ItoFP16(dx * dx + dy * dy);
d = fp16_sqrt(sqd);
/* divide by 4 to stretch out the pattern */
- m = fp16_add(m, fp16_cos(d / 4));
+ m = fp16_sub(m, fp16_cos(d / 4));
}
/*
* m is now in the range +/- FOCI, but we need a
diff --git a/sys/dev/tsec/if_tsec.c b/sys/dev/tsec/if_tsec.c
index 7ec2f98..3fd8726 100644
--- a/sys/dev/tsec/if_tsec.c
+++ b/sys/dev/tsec/if_tsec.c
@@ -561,7 +561,7 @@ tsec_set_mac_address(struct tsec_softc *sc)
TSEC_GLOBAL_LOCK_ASSERT(sc);
KASSERT((ETHER_ADDR_LEN <= sizeof(macbuf)),
- ("tsec_set_mac_address: (%d <= %d", ETHER_ADDR_LEN,
+ ("tsec_set_mac_address: (%d <= %zd", ETHER_ADDR_LEN,
sizeof(macbuf)));
macbufp = (char *)macbuf;
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index eb2f98a..8a6b0c5 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -244,18 +244,18 @@ devfs_populate_vp(struct vnode *vp)
if (DEVFS_DMP_DROP(dmp)) {
sx_xunlock(&dmp->dm_lock);
devfs_unmount_final(dmp);
- return (EBADF);
+ return (ERESTART);
}
if ((vp->v_iflag & VI_DOOMED) != 0) {
sx_xunlock(&dmp->dm_lock);
- return (EBADF);
+ return (ERESTART);
}
de = vp->v_data;
KASSERT(de != NULL,
("devfs_populate_vp: vp->v_data == NULL but vnode not doomed"));
if ((de->de_flags & DE_DOOMED) != 0) {
sx_xunlock(&dmp->dm_lock);
- return (EBADF);
+ return (ERESTART);
}
return (0);
@@ -1147,7 +1147,7 @@ devfs_open(struct vop_open_args *ap)
error = dsw->d_fdopen(dev, ap->a_mode, td, fp);
else
error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td);
- /* cleanup any cdevpriv upon error */
+ /* Clean up any cdevpriv upon error. */
if (error != 0)
devfs_clear_cdevpriv();
td->td_fpop = fpop;
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 894244c..67f6ee0 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2462,10 +2462,11 @@ init386(first)
} else {
metadata_missing = 1;
}
- if (envmode == 1)
- kern_envp = static_env;
- else if (bootinfo.bi_envp)
- kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
+
+ if (bootinfo.bi_envp)
+ init_static_kenv((caddr_t)bootinfo.bi_envp + KERNBASE, 0);
+ else
+ init_static_kenv(NULL, 0);
/* Init basic tunables, hz etc */
init_param1();
diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c
index 03c7226..cd6930b 100644
--- a/sys/kern/kern_environment.c
+++ b/sys/kern/kern_environment.c
@@ -210,12 +210,44 @@ done:
return (error);
}
+/*
+ * Populate the initial kernel environment.
+ *
+ * This is called very early in MD startup, either to provide a copy of the
+ * environment obtained from a boot loader, or to provide an empty buffer into
+ * which MD code can store an initial environment using kern_setenv() calls.
+ *
+ * If the global envmode is 1, the environment is initialized from the global
+ * static_env[], regardless of the arguments passed. This implements the env
+ * keyword described in config(5). In this case env_pos is set to env_len,
+ * causing kern_setenv() to return -1 (if len > 0) or panic (if len == 0) until
+ * the dynamic environment is available. The envmode and static_env variables
+ * are defined in env.c which is generated by config(8).
+ *
+ * If len is non-zero, the caller is providing an empty buffer. The caller will
+ * subsequently use kern_setenv() to add up to len bytes of initial environment
+ * before the dynamic environment is available.
+ *
+ * If len is zero, the caller is providing a pre-loaded buffer containing
+ * environment strings. Additional strings cannot be added until the dynamic
+ * environment is available. The memory pointed to must remain stable at least
+ * until sysinit runs init_dynamic_kenv(). If no initial environment is
+ * available from the boot loader, passing a NULL pointer allows the static_env
+ * to be installed if it is configured.
+ */
void
init_static_kenv(char *buf, size_t len)
{
- kern_envp = buf;
- env_len = len;
- env_pos = 0;
+
+ if (envmode == 1) {
+ kern_envp = static_env;
+ env_len = len;
+ env_pos = len;
+ } else {
+ kern_envp = buf;
+ env_len = len;
+ env_pos = 0;
+ }
}
/*
diff --git a/sys/kgssapi/gss_impl.c b/sys/kgssapi/gss_impl.c
index ab6e55b..3a427a5 100644
--- a/sys/kgssapi/gss_impl.c
+++ b/sys/kgssapi/gss_impl.c
@@ -105,14 +105,17 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscall_args *uap)
if (error)
return (error);
- sun.sun_family = AF_LOCAL;
- strcpy(sun.sun_path, path);
- sun.sun_len = SUN_LEN(&sun);
-
- nconf = getnetconfigent("local");
- cl = clnt_reconnect_create(nconf,
- (struct sockaddr *) &sun, GSSD, GSSDVERS,
- RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+ if (path[0] != '\0') {
+ sun.sun_family = AF_LOCAL;
+ strcpy(sun.sun_path, path);
+ sun.sun_len = SUN_LEN(&sun);
+
+ nconf = getnetconfigent("local");
+ cl = clnt_reconnect_create(nconf,
+ (struct sockaddr *) &sun, GSSD, GSSDVERS,
+ RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+ } else
+ cl = NULL;
mtx_lock(&kgss_gssd_lock);
oldcl = kgss_gssd_handle;
diff --git a/sys/mips/beri/beri_machdep.c b/sys/mips/beri/beri_machdep.c
index 758083f..54f61ab 100644
--- a/sys/mips/beri/beri_machdep.c
+++ b/sys/mips/beri/beri_machdep.c
@@ -273,7 +273,7 @@ platform_start(__register_t a0, __register_t a1, __register_t a2,
* Configure more boot-time parameters passed in by loader.
*/
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0);
/*
* Get bootargs from FDT if specified.
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 0fad8aa..76a12d3 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -312,7 +312,7 @@ SUBDIR= \
reiserfs \
rl \
rtwn \
- rtwnfw \
+ ${_rtwnfw} \
${_s3} \
${_safe} \
${_sbni} \
@@ -484,6 +484,7 @@ _fxp= fxp
_ispfw= ispfw
_mwlfw= mwlfw
_ralfw= ralfw
+_rtwnfw= rtwnfw
_sf= sf
_ti= ti
_txp= txp
diff --git a/sys/net/route.c b/sys/net/route.c
index 86f99ee..11a5b8d 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -147,6 +147,8 @@ static void rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info);
static struct radix_node *rt_mpath_unlink(struct radix_node_head *rnh,
struct rt_addrinfo *info, struct rtentry *rto, int *perror);
#endif
+static int rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info,
+ int flags);
struct if_mtuinfo
{
@@ -832,6 +834,147 @@ rtrequest_fib(int req,
/*
+ * Copy most of @rt data into @info.
+ *
+ * If @flags contains NHR_COPY, copies dst,netmask and gw to the
+ * pointers specified by @info structure. Assume such pointers
+ * are zeroed sockaddr-like structures with sa_len field initialized
+ * to reflect size of the provided buffer. if no NHR_COPY is specified,
+ * point dst,netmask and gw @info fields to appropriate @rt values.
+ *
+ * if @flags contains NHR_REF, do refcouting on rt_ifp.
+ *
+ * Returns 0 on success.
+ */
+int
+rt_exportinfo(struct rtentry *rt, struct rt_addrinfo *info, int flags)
+{
+ struct rt_metrics *rmx;
+ struct sockaddr *src, *dst;
+ int sa_len;
+
+ if (flags & NHR_COPY) {
+ /* Copy destination if dst is non-zero */
+ src = rt_key(rt);
+ dst = info->rti_info[RTAX_DST];
+ sa_len = src->sa_len;
+ if (src != NULL && dst != NULL) {
+ if (src->sa_len > dst->sa_len)
+ return (ENOMEM);
+ memcpy(dst, src, src->sa_len);
+ info->rti_addrs |= RTA_DST;
+ }
+
+ /* Copy mask if set && dst is non-zero */
+ src = rt_mask(rt);
+ dst = info->rti_info[RTAX_NETMASK];
+ if (src != NULL && dst != NULL) {
+
+ /*
+ * Radix stores different value in sa_len,
+ * assume rt_mask() to have the same length
+ * as rt_key()
+ */
+ if (sa_len > dst->sa_len)
+ return (ENOMEM);
+ memcpy(dst, src, src->sa_len);
+ info->rti_addrs |= RTA_NETMASK;
+ }
+
+ /* Copy gateway is set && dst is non-zero */
+ src = rt->rt_gateway;
+ dst = info->rti_info[RTAX_GATEWAY];
+ if ((rt->rt_flags & RTF_GATEWAY) && src != NULL && dst != NULL){
+ if (src->sa_len > dst->sa_len)
+ return (ENOMEM);
+ memcpy(dst, src, src->sa_len);
+ info->rti_addrs |= RTA_GATEWAY;
+ }
+ } else {
+ info->rti_info[RTAX_DST] = rt_key(rt);
+ info->rti_addrs |= RTA_DST;
+ if (rt_mask(rt) != NULL) {
+ info->rti_info[RTAX_NETMASK] = rt_mask(rt);
+ info->rti_addrs |= RTA_NETMASK;
+ }
+ if (rt->rt_flags & RTF_GATEWAY) {
+ info->rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+ info->rti_addrs |= RTA_GATEWAY;
+ }
+ }
+
+ rmx = info->rti_rmx;
+ if (rmx != NULL) {
+ info->rti_mflags |= RTV_MTU;
+ rmx->rmx_mtu = rt->rt_mtu;
+ }
+
+ info->rti_flags = rt->rt_flags;
+ info->rti_ifp = rt->rt_ifp;
+ info->rti_ifa = rt->rt_ifa;
+
+ if (flags & NHR_REF) {
+ /* Do 'traditional' refcouting */
+ if_ref(info->rti_ifp);
+ }
+
+ return (0);
+}
+
+/*
+ * Lookups up route entry for @dst in RIB database for fib @fibnum.
+ * Exports entry data to @info using rt_exportinfo().
+ *
+ * if @flags contains NHR_REF, refcouting is performed on rt_ifp.
+ * All references can be released later by calling rib_free_info()
+ *
+ * Returns 0 on success.
+ * Returns ENOENT for lookup failure, ENOMEM for export failure.
+ */
+int
+rib_lookup_info(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags,
+ uint32_t flowid, struct rt_addrinfo *info)
+{
+ struct radix_node_head *rh;
+ struct radix_node *rn;
+ struct rtentry *rt;
+ int error;
+
+ KASSERT((fibnum < rt_numfibs), ("rib_lookup_rte: bad fibnum"));
+ rh = rt_tables_get_rnh(fibnum, dst->sa_family);
+ if (rh == NULL)
+ return (ENOENT);
+
+ RADIX_NODE_HEAD_RLOCK(rh);
+ rn = rh->rnh_matchaddr(__DECONST(void *, dst), rh);
+ if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
+ rt = RNTORT(rn);
+ /* Ensure route & ifp is UP */
+ if (RT_LINK_IS_UP(rt->rt_ifp)) {
+ flags = (flags & NHR_REF) | NHR_COPY;
+ error = rt_exportinfo(rt, info, flags);
+ RADIX_NODE_HEAD_RUNLOCK(rh);
+
+ return (error);
+ }
+ }
+ RADIX_NODE_HEAD_RUNLOCK(rh);
+
+ return (ENOENT);
+}
+
+/*
+ * Releases all references acquired by rib_lookup_info() when
+ * called with NHR_REF flags.
+ */
+void
+rib_free_info(struct rt_addrinfo *info)
+{
+
+ if_rele(info->rti_ifp);
+}
+
+/*
* Iterates over all existing fibs in system calling
* @setwa_f function prior to traversing each fib.
* Calls @wa_f function for each element in current fib.
diff --git a/sys/net/route.h b/sys/net/route.h
index 743c830..7c69e1c 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -44,16 +44,17 @@
*/
/*
- * A route consists of a destination address, a reference
- * to a routing entry, and a reference to an llentry.
- * These are often held by protocols in their control
- * blocks, e.g. inpcb.
+ * Struct route consiste of a destination address,
+ * a route entry pointer, link-layer prepend data pointer along
+ * with its length.
*/
struct route {
struct rtentry *ro_rt;
char *ro_prepend;
uint16_t ro_plen;
uint16_t ro_flags;
+ uint16_t ro_mtu; /* saved ro_rt mtu */
+ uint16_t spare;
struct sockaddr ro_dst;
};
@@ -196,6 +197,9 @@ struct rtentry {
#define NHR_IFAIF 0x01 /* Return ifa_ifp interface */
#define NHR_REF 0x02 /* For future use */
+/* Control plane route request flags */
+#define NHR_COPY 0x100 /* Copy rte data */
+
/* rte<>nhop translation */
static inline uint16_t
fib_rte_to_nh_flags(int rt_flags)
@@ -459,6 +463,9 @@ void rtredirect_fib(struct sockaddr *, struct sockaddr *,
int rtrequest_fib(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
int rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int);
+int rib_lookup_info(uint32_t, const struct sockaddr *, uint32_t, uint32_t,
+ struct rt_addrinfo *);
+void rib_free_info(struct rt_addrinfo *info);
#include <sys/eventhandler.h>
typedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 6fcbbc6..a5ca9fa 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -614,11 +614,16 @@ route_output(struct mbuf *m, struct socket *so, ...)
*/
if (info.rti_info[RTAX_GATEWAY] != NULL &&
info.rti_info[RTAX_GATEWAY]->sa_family != AF_LINK) {
- struct route gw_ro;
+ struct rt_addrinfo ginfo;
+ struct sockaddr *gdst;
+
+ bzero(&ginfo, sizeof(ginfo));
+ bzero(&ss, sizeof(ss));
+ ss.ss_len = sizeof(ss);
+
+ ginfo.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&ss;
+ gdst = info.rti_info[RTAX_GATEWAY];
- bzero(&gw_ro, sizeof(gw_ro));
- gw_ro.ro_dst = *info.rti_info[RTAX_GATEWAY];
- rtalloc_ign_fib(&gw_ro, 0, fibnum);
/*
* A host route through the loopback interface is
* installed for each interface adddress. In pre 8.0
@@ -629,14 +634,14 @@ route_output(struct mbuf *m, struct socket *so, ...)
* AF_LINK sa_family type of the rt_gateway, and the
* rt_ifp has the IFF_LOOPBACK flag set.
*/
- if (gw_ro.ro_rt != NULL &&
- gw_ro.ro_rt->rt_gateway->sa_family == AF_LINK &&
- gw_ro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) {
- info.rti_flags &= ~RTF_GATEWAY;
- info.rti_flags |= RTF_GWFLAG_COMPAT;
+ if (rib_lookup_info(fibnum, gdst, NHR_REF, 0, &ginfo) == 0) {
+ if (ss.ss_family == AF_LINK &&
+ ginfo.rti_ifp->if_flags & IFF_LOOPBACK) {
+ info.rti_flags &= ~RTF_GATEWAY;
+ info.rti_flags |= RTF_GWFLAG_COMPAT;
+ }
+ rib_free_info(&ginfo);
}
- if (gw_ro.ro_rt != NULL)
- RTFREE(gw_ro.ro_rt);
}
switch (rtm->rtm_type) {
diff --git a/sys/net80211/ieee80211_scan_sw.c b/sys/net80211/ieee80211_scan_sw.c
index 163633c..53e4520 100644
--- a/sys/net80211/ieee80211_scan_sw.c
+++ b/sys/net80211/ieee80211_scan_sw.c
@@ -359,7 +359,7 @@ ieee80211_swscan_bg_scan(const struct ieee80211_scanner *scan,
duration = IEEE80211_SCAN_OFFCHANNEL;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
- "%s: %s scan, ticks %u duration %lu\n", __func__,
+ "%s: %s scan, ticks %u duration %u\n", __func__,
ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive",
ticks, duration);
diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c
index 7422fbd..9b3f7d8 100644
--- a/sys/netgraph/netflow/netflow.c
+++ b/sys/netgraph/netflow/netflow.c
@@ -451,7 +451,7 @@ hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r,
}
}
- if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) {
+ if ((flags & NG_NETFLOW_CONF_NOSRCLOOKUP) == 0) {
/* Do route lookup on source address, to fill in src_mask. */
bzero(&rin6, sizeof(struct route_in6));
src = (struct sockaddr_in6 *)&rin6.ro_dst;
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index c30c1f3..80b1448 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1106,34 +1106,48 @@ in_lltable_free_entry(struct lltable *llt, struct llentry *lle)
static int
in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr)
{
- struct rtentry *rt;
+ struct rt_addrinfo info;
+ struct sockaddr_in rt_key, rt_mask;
+ struct sockaddr rt_gateway;
+ int rt_flags;
KASSERT(l3addr->sa_family == AF_INET,
("sin_family %d", l3addr->sa_family));
- /* XXX rtalloc1_fib should take a const param */
- rt = rtalloc1_fib(__DECONST(struct sockaddr *, l3addr), 0, 0,
- ifp->if_fib);
+ bzero(&rt_key, sizeof(rt_key));
+ rt_key.sin_len = sizeof(rt_key);
+ bzero(&rt_mask, sizeof(rt_mask));
+ rt_mask.sin_len = sizeof(rt_mask);
+ bzero(&rt_gateway, sizeof(rt_gateway));
+ rt_gateway.sa_len = sizeof(rt_gateway);
- if (rt == NULL)
+ bzero(&info, sizeof(info));
+ info.rti_info[RTAX_DST] = (struct sockaddr *)&rt_key;
+ info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&rt_mask;
+ info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&rt_gateway;
+
+ if (rib_lookup_info(ifp->if_fib, l3addr, NHR_REF, 0, &info) != 0)
return (EINVAL);
+ rt_flags = info.rti_flags;
+
/*
* If the gateway for an existing host route matches the target L3
* address, which is a special route inserted by some implementation
* such as MANET, and the interface is of the correct type, then
* allow for ARP to proceed.
*/
- if (rt->rt_flags & RTF_GATEWAY) {
- if (!(rt->rt_flags & RTF_HOST) || !rt->rt_ifp ||
- rt->rt_ifp->if_type != IFT_ETHER ||
- (rt->rt_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 ||
- memcmp(rt->rt_gateway->sa_data, l3addr->sa_data,
+ if (rt_flags & RTF_GATEWAY) {
+ if (!(rt_flags & RTF_HOST) || !info.rti_ifp ||
+ info.rti_ifp->if_type != IFT_ETHER ||
+ (info.rti_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 ||
+ memcmp(rt_gateway.sa_data, l3addr->sa_data,
sizeof(in_addr_t)) != 0) {
- RTFREE_LOCKED(rt);
+ rib_free_info(&info);
return (EINVAL);
}
}
+ rib_free_info(&info);
/*
* Make sure that at least the destination address is covered
@@ -1142,21 +1156,19 @@ in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr
* on one interface and the corresponding outgoing packet leaves
* another interface.
*/
- if (!(rt->rt_flags & RTF_HOST) && rt->rt_ifp != ifp) {
+ if (!(rt_flags & RTF_HOST) && info.rti_ifp != ifp) {
const char *sa, *mask, *addr, *lim;
int len;
- mask = (const char *)rt_mask(rt);
+ mask = (const char *)&rt_mask;
/*
* Just being extra cautious to avoid some custom
* code getting into trouble.
*/
- if (mask == NULL) {
- RTFREE_LOCKED(rt);
+ if ((info.rti_addrs & RTA_NETMASK) == 0)
return (EINVAL);
- }
- sa = (const char *)rt_key(rt);
+ sa = (const char *)&rt_key;
addr = (const char *)l3addr;
len = ((const struct sockaddr_in *)l3addr)->sin_len;
lim = addr + len;
@@ -1167,13 +1179,11 @@ in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr
log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n",
inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr));
#endif
- RTFREE_LOCKED(rt);
return (EINVAL);
}
}
}
- RTFREE_LOCKED(rt);
return (0);
}
diff --git a/sys/netinet/in_fib.c b/sys/netinet/in_fib.c
index b4101b6..451b3747 100644
--- a/sys/netinet/in_fib.c
+++ b/sys/netinet/in_fib.c
@@ -97,7 +97,10 @@ fib4_rte_to_nh_extended(struct rtentry *rte, struct in_addr dst,
struct sockaddr_in *gw;
struct in_ifaddr *ia;
- pnh4->nh_ifp = rte->rt_ifa->ifa_ifp;
+ if ((flags & NHR_IFAIF) != 0)
+ pnh4->nh_ifp = rte->rt_ifa->ifa_ifp;
+ else
+ pnh4->nh_ifp = rte->rt_ifp;
pnh4->nh_mtu = min(rte->rt_mtu, rte->rt_ifp->if_mtu);
if (rte->rt_flags & RTF_GATEWAY) {
gw = (struct sockaddr_in *)rte->rt_gateway;
@@ -175,8 +178,8 @@ fib4_lookup_nh_basic(uint32_t fibnum, struct in_addr dst, uint32_t flags,
* - howewer mtu from "transmit" interface will be returned.
*/
int
-fib4_lookup_nh_ext(uint32_t fibnum, struct in_addr dst, uint32_t flowid,
- uint32_t flags, struct nhop4_extended *pnh4)
+fib4_lookup_nh_ext(uint32_t fibnum, struct in_addr dst, uint32_t flags,
+ uint32_t flowid, struct nhop4_extended *pnh4)
{
struct radix_node_head *rh;
struct radix_node *rn;
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index a7bbac0..54d7e1e 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2184,7 +2184,6 @@ icmp6_reflect(struct mbuf *m, size_t off)
if (srcp == NULL) {
int e;
struct sockaddr_in6 sin6;
- struct route_in6 ro;
/*
* This case matches to multicasts, our anycast, or unicasts
@@ -2196,10 +2195,7 @@ icmp6_reflect(struct mbuf *m, size_t off)
sin6.sin6_len = sizeof(sin6);
sin6.sin6_addr = ip6->ip6_dst; /* zone ID should be embedded */
- bzero(&ro, sizeof(ro));
- e = in6_selectsrc(&sin6, NULL, NULL, &ro, NULL, &outif, &src);
- if (ro.ro_rt)
- RTFREE(ro.ro_rt); /* XXX: we could use this */
+ e = in6_selectsrc(&sin6, NULL, NULL, NULL, &outif, &src);
if (e) {
char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG,
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 9bc142a..ae049f0 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -378,6 +378,8 @@ struct route_in6 {
char *ro_prepend;
uint16_t ro_plen;
uint16_t ro_flags;
+ uint16_t ro_mtu; /* saved ro_rt mtu */
+ uint16_t spare;
struct sockaddr_in6 ro_dst;
};
#endif
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 9f876a4..67ecb8c 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -359,7 +359,7 @@ in6_pcbladdr(register struct inpcb *inp, struct sockaddr *nam,
return (error);
error = in6_selectsrc(sin6, inp->in6p_outputopts,
- inp, NULL, inp->inp_cred, &ifp, &in6a);
+ inp, inp->inp_cred, &ifp, &in6a);
if (error)
return (error);
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index c2e26f8f..fb362e2 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -134,7 +134,7 @@ static int selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
struct ip6_moptions *, struct route_in6 *, struct ifnet **,
struct rtentry **, int, u_int);
static int in6_selectif(struct sockaddr_in6 *, struct ip6_pktopts *,
- struct ip6_moptions *, struct route_in6 *ro, struct ifnet **,
+ struct ip6_moptions *, struct ifnet **,
struct ifnet *, u_int);
static struct in6_addrpolicy *lookup_addrsel_policy(struct sockaddr_in6 *);
@@ -177,7 +177,7 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
int
in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
- struct inpcb *inp, struct route_in6 *ro, struct ucred *cred,
+ struct inpcb *inp, struct ucred *cred,
struct ifnet **ifpp, struct in6_addr *srcp)
{
struct rm_priotracker in6_ifa_tracker;
@@ -227,7 +227,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
struct in6_ifaddr *ia6;
/* get the outgoing interface */
- if ((error = in6_selectif(dstsock, opts, mopts, ro, &ifp, oifp,
+ if ((error = in6_selectif(dstsock, opts, mopts, &ifp, oifp,
(inp != NULL) ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB))
!= 0)
return (error);
@@ -293,7 +293,7 @@ in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
* the outgoing interface and the destination address.
*/
/* get the outgoing interface */
- if ((error = in6_selectif(dstsock, opts, mopts, ro, &ifp, oifp,
+ if ((error = in6_selectif(dstsock, opts, mopts, &ifp, oifp,
(inp != NULL) ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB)) != 0)
return (error);
@@ -761,24 +761,27 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
static int
in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
- struct ip6_moptions *mopts, struct route_in6 *ro, struct ifnet **retifp,
+ struct ip6_moptions *mopts, struct ifnet **retifp,
struct ifnet *oifp, u_int fibnum)
{
int error;
struct route_in6 sro;
struct rtentry *rt = NULL;
+ int rt_flags;
KASSERT(retifp != NULL, ("%s: retifp is NULL", __func__));
- if (ro == NULL) {
- bzero(&sro, sizeof(sro));
- ro = &sro;
- }
+ bzero(&sro, sizeof(sro));
+ rt_flags = 0;
+
+ error = selectroute(dstsock, opts, mopts, &sro, retifp, &rt, 1, fibnum);
+
+ if (rt)
+ rt_flags = rt->rt_flags;
+ if (rt && rt == sro.ro_rt)
+ RTFREE(rt);
- if ((error = selectroute(dstsock, opts, mopts, ro, retifp,
- &rt, 1, fibnum)) != 0) {
- if (ro == &sro && rt && rt == sro.ro_rt)
- RTFREE(rt);
+ if (error != 0) {
/* Help ND. See oifp comment in in6_selectsrc(). */
if (oifp != NULL && fibnum == RT_DEFAULT_FIB) {
*retifp = oifp;
@@ -804,16 +807,12 @@ in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
* Although this may not be very harmful, it should still be confusing.
* We thus reject the case here.
*/
- if (rt && (rt->rt_flags & (RTF_REJECT | RTF_BLACKHOLE))) {
- int flags = (rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
- if (ro == &sro && rt && rt == sro.ro_rt)
- RTFREE(rt);
- return (flags);
+ if (rt_flags & (RTF_REJECT | RTF_BLACKHOLE)) {
+ error = (rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
+ return (error);
}
- if (ro == &sro && rt && rt == sro.ro_rt)
- RTFREE(rt);
return (0);
}
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index af9fdba..ccbac7d 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -97,6 +97,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
+#include <netinet6/in6_fib.h>
#include <netinet6/in6_var.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
@@ -147,8 +148,11 @@ static int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int,
struct ip6_frag **);
static int ip6_insert_jumboopt(struct ip6_exthdrs *, u_int32_t);
static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *);
-static int ip6_getpmtu(struct route_in6 *, struct route_in6 *,
+static int ip6_getpmtu(struct route_in6 *, int,
struct ifnet *, struct in6_addr *, u_long *, int *, u_int);
+static int ip6_calcmtu(struct ifnet *, const struct in6_addr *, u_long,
+ u_long *, int *);
+static int ip6_getpmtu_ctl(u_int, struct in6_addr *, u_long *);
static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int);
@@ -712,7 +716,7 @@ again:
*ifpp = ifp;
/* Determine path MTU. */
- if ((error = ip6_getpmtu(ro_pmtu, ro, ifp, &finaldst, &mtu,
+ if ((error = ip6_getpmtu(ro_pmtu, ro != ro_pmtu, ifp, &finaldst, &mtu,
&alwaysfrag, fibnum)) != 0)
goto bad;
@@ -1045,8 +1049,6 @@ sendorfree:
done:
if (ro == &ip6route)
RO_RTFREE(ro);
- if (ro_pmtu == &ip6route)
- RO_RTFREE(ro_pmtu);
return (error);
freehdrs:
@@ -1215,35 +1217,105 @@ ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int hlen,
return (0);
}
+/*
+ * Calculates IPv6 path mtu for destination @dst.
+ * Resulting MTU is stored in @mtup.
+ *
+ * Returns 0 on success.
+ */
+static int
+ip6_getpmtu_ctl(u_int fibnum, struct in6_addr *dst, u_long *mtup)
+{
+ struct nhop6_extended nh6;
+ struct in6_addr kdst;
+ uint32_t scopeid;
+ struct ifnet *ifp;
+ u_long mtu;
+ int error;
+
+ in6_splitscope(dst, &kdst, &scopeid);
+ if (fib6_lookup_nh_ext(fibnum, &kdst, scopeid, NHR_REF, 0, &nh6) != 0)
+ return (EHOSTUNREACH);
+
+ ifp = nh6.nh_ifp;
+ mtu = nh6.nh_mtu;
+
+ error = ip6_calcmtu(ifp, dst, mtu, mtup, NULL);
+ fib6_free_nh_ext(fibnum, &nh6);
+
+ return (error);
+}
+
+/*
+ * Calculates IPv6 path MTU for @dst based on transmit @ifp,
+ * and cached data in @ro_pmtu.
+ * MTU from (successful) route lookup is saved (along with dst)
+ * inside @ro_pmtu to avoid subsequent route lookups after packet
+ * filter processing.
+ *
+ * Stores mtu and always-frag value into @mtup and @alwaysfragp.
+ * Returns 0 on success.
+ */
static int
-ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
+ip6_getpmtu(struct route_in6 *ro_pmtu, int do_lookup,
struct ifnet *ifp, struct in6_addr *dst, u_long *mtup,
int *alwaysfragp, u_int fibnum)
{
- u_int32_t mtu = 0;
- int alwaysfrag = 0;
- int error = 0;
+ struct nhop6_basic nh6;
+ struct in6_addr kdst;
+ uint32_t scopeid;
+ struct sockaddr_in6 *sa6_dst;
+ u_long mtu;
- if (ro_pmtu != ro) {
- /* The first hop and the final destination may differ. */
- struct sockaddr_in6 *sa6_dst =
- (struct sockaddr_in6 *)&ro_pmtu->ro_dst;
- if (ro_pmtu->ro_rt &&
- ((ro_pmtu->ro_rt->rt_flags & RTF_UP) == 0 ||
- !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst))) {
- RTFREE(ro_pmtu->ro_rt);
- ro_pmtu->ro_rt = (struct rtentry *)NULL;
- }
- if (ro_pmtu->ro_rt == NULL) {
+ mtu = 0;
+ if (do_lookup) {
+
+ /*
+ * Here ro_pmtu has final destination address, while
+ * ro might represent immediate destination.
+ * Use ro_pmtu destination since mtu might differ.
+ */
+ sa6_dst = (struct sockaddr_in6 *)&ro_pmtu->ro_dst;
+ if (!IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst))
+ ro_pmtu->ro_mtu = 0;
+
+ if (ro_pmtu->ro_mtu == 0) {
bzero(sa6_dst, sizeof(*sa6_dst));
sa6_dst->sin6_family = AF_INET6;
sa6_dst->sin6_len = sizeof(struct sockaddr_in6);
sa6_dst->sin6_addr = *dst;
- in6_rtalloc(ro_pmtu, fibnum);
+ in6_splitscope(dst, &kdst, &scopeid);
+ if (fib6_lookup_nh_basic(fibnum, &kdst, scopeid, 0, 0,
+ &nh6) == 0)
+ ro_pmtu->ro_mtu = nh6.nh_mtu;
}
+
+ mtu = ro_pmtu->ro_mtu;
}
- if (ro_pmtu->ro_rt) {
+
+ if (ro_pmtu->ro_rt)
+ mtu = ro_pmtu->ro_rt->rt_mtu;
+
+ return (ip6_calcmtu(ifp, dst, mtu, mtup, alwaysfragp));
+}
+
+/*
+ * Calculate MTU based on transmit @ifp, route mtu @rt_mtu and
+ * hostcache data for @dst.
+ * Stores mtu and always-frag value into @mtup and @alwaysfragp.
+ *
+ * Returns 0 on success.
+ */
+static int
+ip6_calcmtu(struct ifnet *ifp, const struct in6_addr *dst, u_long rt_mtu,
+ u_long *mtup, int *alwaysfragp)
+{
+ u_long mtu = 0;
+ int alwaysfrag = 0;
+ int error = 0;
+
+ if (rt_mtu > 0) {
u_int32_t ifmtu;
struct in_conninfo inc;
@@ -1251,14 +1323,12 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
inc.inc_flags |= INC_ISIPV6;
inc.inc6_faddr = *dst;
- if (ifp == NULL)
- ifp = ro_pmtu->ro_rt->rt_ifp;
ifmtu = IN6_LINKMTU(ifp);
mtu = tcp_hc_getmtu(&inc);
if (mtu)
- mtu = min(mtu, ro_pmtu->ro_rt->rt_mtu);
+ mtu = min(mtu, rt_mtu);
else
- mtu = ro_pmtu->ro_rt->rt_mtu;
+ mtu = rt_mtu;
if (mtu == 0)
mtu = ifmtu;
else if (mtu < IPV6_MMTU) {
@@ -1936,9 +2006,6 @@ do { \
{
u_long pmtu = 0;
struct ip6_mtuinfo mtuinfo;
- struct route_in6 sro;
-
- bzero(&sro, sizeof(sro));
if (!(so->so_state & SS_ISCONNECTED))
return (ENOTCONN);
@@ -1947,11 +2014,8 @@ do { \
* routing, or optional information to specify
* the outgoing interface.
*/
- error = ip6_getpmtu(&sro, NULL, NULL,
- &in6p->in6p_faddr, &pmtu, NULL,
- so->so_fibnum);
- if (sro.ro_rt)
- RTFREE(sro.ro_rt);
+ error = ip6_getpmtu_ctl(so->so_fibnum,
+ &in6p->in6p_faddr, &pmtu);
if (error)
break;
if (pmtu > IPV6_MAXPACKET)
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 2159f29..f43a28c 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -419,7 +419,7 @@ int dest6_input(struct mbuf **, int *, int);
int none_input(struct mbuf **, int *, int);
int in6_selectsrc(struct sockaddr_in6 *, struct ip6_pktopts *,
- struct inpcb *inp, struct route_in6 *, struct ucred *cred,
+ struct inpcb *inp, struct ucred *cred,
struct ifnet **, struct in6_addr *);
int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
struct ip6_moptions *, struct route_in6 *, struct ifnet **,
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index fbbf421..4371a02 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1210,6 +1210,10 @@ nd6_is_new_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp)
{
struct nd_prefix *pr;
struct ifaddr *dstaddr;
+ struct rt_addrinfo info;
+ struct sockaddr_in6 rt_key;
+ struct sockaddr *dst6;
+ int fibnum;
/*
* A link-local address is always a neighbor.
@@ -1234,6 +1238,13 @@ nd6_is_new_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp)
return (0);
}
+ bzero(&rt_key, sizeof(rt_key));
+ bzero(&info, sizeof(info));
+ info.rti_info[RTAX_DST] = (struct sockaddr *)&rt_key;
+
+ /* Always use the default FIB here. XXME - why? */
+ fibnum = RT_DEFAULT_FIB;
+
/*
* If the address matches one of our addresses,
* it should be a neighbor.
@@ -1245,12 +1256,13 @@ nd6_is_new_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp)
continue;
if (!(pr->ndpr_stateflags & NDPRF_ONLINK)) {
- struct rtentry *rt;
/* Always use the default FIB here. */
- rt = in6_rtalloc1((struct sockaddr *)&pr->ndpr_prefix,
- 0, 0, RT_DEFAULT_FIB);
- if (rt == NULL)
+ dst6 = (struct sockaddr *)&pr->ndpr_prefix;
+
+ /* Restore length field before retrying lookup */
+ rt_key.sin6_len = sizeof(rt_key);
+ if (rib_lookup_info(fibnum, dst6, 0, 0, &info) != 0)
continue;
/*
* This is the case where multiple interfaces
@@ -1263,11 +1275,8 @@ nd6_is_new_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp)
* differ.
*/
if (!IN6_ARE_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr,
- &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr)) {
- RTFREE_LOCKED(rt);
+ &rt_key.sin6_addr))
continue;
- }
- RTFREE_LOCKED(rt);
}
if (IN6_ARE_MASKED_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr,
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index a5ce2ec..b7ba0b2 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -248,37 +248,35 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
/* (2) check. */
if (ifa == NULL) {
- struct route_in6 ro;
- int need_proxy;
+ struct sockaddr_dl rt_gateway;
+ struct rt_addrinfo info;
+ struct sockaddr_in6 dst6;
- bzero(&ro, sizeof(ro));
- ro.ro_dst.sin6_len = sizeof(struct sockaddr_in6);
- ro.ro_dst.sin6_family = AF_INET6;
- ro.ro_dst.sin6_addr = taddr6;
+ bzero(&dst6, sizeof(dst6));
+ dst6.sin6_len = sizeof(struct sockaddr_in6);
+ dst6.sin6_family = AF_INET6;
+ dst6.sin6_addr = taddr6;
+
+ bzero(&rt_gateway, sizeof(rt_gateway));
+ rt_gateway.sdl_len = sizeof(rt_gateway);
+ bzero(&info, sizeof(info));
+ info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&rt_gateway;
/* Always use the default FIB. */
-#ifdef RADIX_MPATH
- rtalloc_mpath_fib((struct route *)&ro, ntohl(taddr6.s6_addr32[3]),
- RT_DEFAULT_FIB);
-#else
- in6_rtalloc(&ro, RT_DEFAULT_FIB);
-#endif
- need_proxy = (ro.ro_rt &&
- (ro.ro_rt->rt_flags & RTF_ANNOUNCE) != 0 &&
- ro.ro_rt->rt_gateway->sa_family == AF_LINK);
- if (ro.ro_rt != NULL) {
- if (need_proxy)
- proxydl = *SDL(ro.ro_rt->rt_gateway);
- RTFREE(ro.ro_rt);
- }
- if (need_proxy) {
- /*
- * proxy NDP for single entry
- */
- ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp,
- IN6_IFF_NOTREADY|IN6_IFF_ANYCAST);
- if (ifa)
- proxy = 1;
+ if (rib_lookup_info(RT_DEFAULT_FIB, (struct sockaddr *)&dst6,
+ 0, 0, &info) == 0) {
+ if ((info.rti_flags & RTF_ANNOUNCE) != 0 &&
+ rt_gateway.sdl_family == AF_LINK) {
+
+ /*
+ * proxy NDP for single entry
+ */
+ proxydl = *SDL(&rt_gateway);
+ ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(
+ ifp, IN6_IFF_NOTREADY|IN6_IFF_ANYCAST);
+ if (ifa)
+ proxy = 1;
+ }
}
}
if (ifa == NULL) {
@@ -408,7 +406,6 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
int icmp6len;
int maxlen;
caddr_t mac;
- struct route_in6 ro;
if (IN6_IS_ADDR_MULTICAST(taddr6))
return;
@@ -428,8 +425,6 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
return;
M_SETFIB(m, fibnum);
- bzero(&ro, sizeof(ro));
-
if (daddr6 == NULL || IN6_IS_ADDR_MULTICAST(daddr6)) {
m->m_flags |= M_MCAST;
im6o.im6o_multicast_ifp = ifp;
@@ -497,7 +492,7 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
oifp = ifp;
error = in6_selectsrc(&dst_sa, NULL,
- NULL, &ro, NULL, &oifp, &src_in);
+ NULL, NULL, &oifp, &src_in);
if (error) {
char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG, "%s: source can't be "
@@ -585,21 +580,15 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
m_tag_prepend(m, mtag);
}
- ip6_output(m, NULL, &ro, (nonce != NULL) ? IPV6_UNSPECSRC : 0,
+ ip6_output(m, NULL, NULL, (nonce != NULL) ? IPV6_UNSPECSRC : 0,
&im6o, NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit);
ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_SOLICIT]);
- /* We don't cache this route. */
- RO_RTFREE(&ro);
-
return;
bad:
- if (ro.ro_rt) {
- RTFREE(ro.ro_rt);
- }
m_freem(m);
return;
}
@@ -877,6 +866,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
*/
struct nd_defrouter *dr;
struct in6_addr *in6;
+ struct ifnet *nd6_ifp;
in6 = &ln->r_l3addr.addr6;
@@ -886,10 +876,11 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
* is only called under the network software interrupt
* context. However, we keep it just for safety.
*/
- dr = defrouter_lookup(in6, ln->lle_tbl->llt_ifp);
+ nd6_ifp = lltable_get_ifp(ln->lle_tbl);
+ dr = defrouter_lookup(in6, nd6_ifp);
if (dr)
defrtrlist_del(dr);
- else if (ND_IFINFO(ln->lle_tbl->llt_ifp)->flags &
+ else if (ND_IFINFO(nd6_ifp)->flags &
ND6_IFF_ACCEPT_RTADV) {
/*
* Even if the neighbor is not in the default
@@ -958,9 +949,6 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
struct sockaddr_in6 dst_sa;
int icmp6len, maxlen, error;
caddr_t mac = NULL;
- struct route_in6 ro;
-
- bzero(&ro, sizeof(ro));
daddr6 = *daddr6_0; /* make a local copy for modification */
@@ -1018,9 +1006,8 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
/*
* Select a source whose scope is the same as that of the dest.
*/
- bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa));
oifp = ifp;
- error = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, &oifp, &src);
+ error = in6_selectsrc(&dst_sa, NULL, NULL, NULL, &oifp, &src);
if (error) {
char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG, "nd6_na_output: source can't be "
@@ -1091,20 +1078,14 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
m_tag_prepend(m, mtag);
}
- ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL);
+ ip6_output(m, NULL, NULL, 0, &im6o, NULL, NULL);
icmp6_ifstat_inc(ifp, ifs6_out_msg);
icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert);
ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_ADVERT]);
- /* We don't cache this route. */
- RO_RTFREE(&ro);
-
return;
bad:
- if (ro.ro_rt) {
- RTFREE(ro.ro_rt);
- }
m_freem(m);
return;
}
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 3901944..0725842 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -460,7 +460,7 @@ rip6_output(struct mbuf *m, struct socket *so, ...)
/*
* Source address selection.
*/
- error = in6_selectsrc(dstsock, optp, in6p, NULL, so->so_cred,
+ error = in6_selectsrc(dstsock, optp, in6p, so->so_cred,
&oifp, &in6a);
if (error)
goto bad;
@@ -814,7 +814,7 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
INP_WLOCK(inp);
/* Source address selection. XXX: need pcblookup? */
error = in6_selectsrc(addr, inp->in6p_outputopts,
- inp, NULL, so->so_cred, &ifp, &in6a);
+ inp, so->so_cred, &ifp, &in6a);
if (error) {
INP_WUNLOCK(inp);
INP_INFO_WUNLOCK(&V_ripcbinfo);
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 375c00d..353b260 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -731,7 +731,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
}
if (!IN6_IS_ADDR_V4MAPPED(faddr)) {
- error = in6_selectsrc(sin6, optp, inp, NULL,
+ error = in6_selectsrc(sin6, optp, inp,
td->td_ucred, &oifp, &in6a);
if (error)
goto release;
diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c
index ab09ab6..835783f 100644
--- a/sys/powerpc/aim/aim_machdep.c
+++ b/sys/powerpc/aim/aim_machdep.c
@@ -179,6 +179,17 @@ aim_cpu_init(vm_offset_t toc)
trap_offset = 0;
cacheline_warn = 0;
+ #ifdef __powerpc64__
+ /*
+ * Switch to 64-bit mode, if the bootloader didn't, before we start
+ * using memory beyond what the bootloader might have set up.
+ * Guaranteed not to cause an implicit branch since we either (a)
+ * started with a 32-bit bootloader below 4 GB or (b) were already in
+ * 64-bit mode, making this a no-op.
+ */
+ mtmsrd(mfmsr() | PSL_SF);
+ #endif
+
/* Various very early CPU fix ups */
switch (mfpvr() >> 16) {
/*
diff --git a/sys/powerpc/aim/locore64.S b/sys/powerpc/aim/locore64.S
index fc2fa8d..7f93793 100644
--- a/sys/powerpc/aim/locore64.S
+++ b/sys/powerpc/aim/locore64.S
@@ -157,13 +157,6 @@ ASENTRY_NOPROF(__start)
ld %r5,64(%r1)
ld %r6,72(%r1)
- /* Switch to 64-bit mode */
- mfmsr %r9
- li %r8,1
- insrdi %r9,%r8,1,0
- mtmsrd %r9
- isync
-
/* Begin CPU init */
mr %r4,%r2 /* Replace ignored r4 with tocbase for trap handlers */
bl powerpc_init
diff --git a/sys/powerpc/aim/mp_cpudep.c b/sys/powerpc/aim/mp_cpudep.c
index 59a24e2..cedf53b 100644
--- a/sys/powerpc/aim/mp_cpudep.c
+++ b/sys/powerpc/aim/mp_cpudep.c
@@ -77,10 +77,10 @@ cpudep_ap_early_bootstrap(void)
#else
__asm __volatile("ld %0, 16(%2); sync; isync; \
mtspr %1, %0; sync; isync;"
- : "=r"(reg) : "K"(SPR_HID4), "r"(bsp_state));
+ : "=r"(reg) : "K"(SPR_HID4), "b"(bsp_state));
__asm __volatile("ld %0, 24(%2); sync; isync; \
mtspr %1, %0; sync; isync;"
- : "=r"(reg) : "K"(SPR_HID5), "r"(bsp_state));
+ : "=r"(reg) : "K"(SPR_HID5), "b"(bsp_state));
#endif
powerpc_sync();
break;
@@ -324,10 +324,10 @@ cpudep_ap_setup()
mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; \
mfspr %0, %1; mfspr %0, %1; mfspr %0, %1; \
sync; isync"
- : "=r"(reg) : "K"(SPR_HID0), "r"(bsp_state));
+ : "=r"(reg) : "K"(SPR_HID0), "b"(bsp_state));
__asm __volatile("ld %0, 8(%2); sync; isync; \
mtspr %1, %0; mtspr %1, %0; sync; isync"
- : "=r"(reg) : "K"(SPR_HID1), "r"(bsp_state));
+ : "=r"(reg) : "K"(SPR_HID1), "b"(bsp_state));
#endif
powerpc_sync();
diff --git a/sys/powerpc/booke/booke_machdep.c b/sys/powerpc/booke/booke_machdep.c
index f102677..a019597 100644
--- a/sys/powerpc/booke/booke_machdep.c
+++ b/sys/powerpc/booke/booke_machdep.c
@@ -173,7 +173,7 @@ uint32_t *bootinfo;
void print_kernel_section_addr(void);
void print_kenv(void);
-uintptr_t booke_init(uint32_t, uint32_t);
+uintptr_t booke_init(u_long, u_long);
void ivor_setup(void);
extern void *interrupt_vector_base;
@@ -211,6 +211,8 @@ void
booke_cpu_init(void)
{
+ cpu_features |= PPC_FEATURE_BOOKE;
+
pmap_mmu_install(MMU_TYPE_BOOKE, BUS_PROBE_GENERIC);
}
@@ -266,7 +268,7 @@ booke_check_for_fdt(uint32_t arg1, vm_offset_t *dtbp)
}
uintptr_t
-booke_init(uint32_t arg1, uint32_t arg2)
+booke_init(u_long arg1, u_long arg2)
{
uintptr_t ret;
void *mdp;
@@ -314,8 +316,6 @@ booke_init(uint32_t arg1, uint32_t arg2)
else /* U-Boot */
mdp = NULL;
- ret = powerpc_init(dtbp, 0, 0, mdp);
-
/* Default to 32 byte cache line size. */
switch ((mfpvr()) >> 16) {
case FSL_E500mc:
@@ -325,6 +325,8 @@ booke_init(uint32_t arg1, uint32_t arg2)
break;
}
+ ret = powerpc_init(dtbp, 0, 0, mdp);
+
/* Enable caches */
booke_enable_l1_cache();
booke_enable_l2_cache();
diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h
index ba45eb0..fffb2b4 100644
--- a/sys/powerpc/include/cpu.h
+++ b/sys/powerpc/include/cpu.h
@@ -48,19 +48,32 @@
*/
extern int cpu_features;
+extern int cpu_features2;
#define PPC_FEATURE_32 0x80000000 /* Always true */
#define PPC_FEATURE_64 0x40000000 /* Defined on a 64-bit CPU */
#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
#define PPC_FEATURE_HAS_FPU 0x08000000
#define PPC_FEATURE_HAS_MMU 0x04000000
-#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
-#define PPC_FEATURE_HAS_VSX 0x00000080
+#define PPC_FEATURE_UNIFIED_CACHE 0x01000000
+#define PPC_FEATURE_BOOKE 0x00008000
+#define PPC_FEATURE_SMT 0x00004000
+#define PPC_FEATURE_ARCH_2_05 0x00001000
+#define PPC_FEATURE_HAS_DFP 0x00000400
+#define PPC_FEATURE_ARCH_2_06 0x00000100
+#define PPC_FEATURE_HAS_VSX 0x00000080
+
+#define PPC_FEATURE2_ARCH_2_07 0x80000000
+#define PPC_FEATURE2_HAS_HTM 0x40000000
+#define PPC_FEATURE2_HAS_VCRYPTO 0x02000000
#define PPC_FEATURE_BITMASK \
"\20" \
"\040PPC32\037PPC64\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE" \
- "\010VSX"
+ "\020BOOKE\017SMT\015ARCH205\013DFP\011ARCH206\010VSX"
+#define PPC_FEATURE2_BITMASK \
+ "\20" \
+ "\040ARCH207\037HTM\032VCRYPTO"
#define TRAPF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0)
#define TRAPF_PC(frame) ((frame)->srr0)
diff --git a/sys/powerpc/include/intr_machdep.h b/sys/powerpc/include/intr_machdep.h
index c2529d5..32a94be 100644
--- a/sys/powerpc/include/intr_machdep.h
+++ b/sys/powerpc/include/intr_machdep.h
@@ -30,7 +30,7 @@
#define INTR_VECTORS 256
-#define MAX_PICS 5
+#define MAX_PICS 16
#define MAP_IRQ(node, pin) powerpc_get_irq(node, pin)
/*
diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c
index 62b56c3..8bb92b2 100644
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -126,11 +126,11 @@ lbc_address_mask(uint32_t size)
{
int n = 15;
- if (size == ~0UL)
+ if (size == ~0)
return (0);
while (n < 32) {
- if (size == (1UL << n))
+ if (size == (1U << n))
break;
n++;
}
@@ -267,7 +267,7 @@ lbc_banks_map(struct lbc_softc *sc)
static int
lbc_banks_enable(struct lbc_softc *sc)
{
- u_long size;
+ uint32_t size;
uint32_t regval;
int error, i;
diff --git a/sys/powerpc/mpc85xx/pci_mpc85xx.c b/sys/powerpc/mpc85xx/pci_mpc85xx.c
index 3c34c87..4397ac0 100644
--- a/sys/powerpc/mpc85xx/pci_mpc85xx.c
+++ b/sys/powerpc/mpc85xx/pci_mpc85xx.c
@@ -94,6 +94,29 @@ __FBSDID("$FreeBSD$");
#define REG_PEX_ERR_DR 0x0e00
#define REG_PEX_ERR_EN 0x0e08
+#define REG_PEX_ERR_DR 0x0e00
+#define REG_PEX_ERR_DR_ME 0x80000000
+#define REG_PEX_ERR_DR_PCT 0x800000
+#define REG_PEX_ERR_DR_PAT 0x400000
+#define REG_PEX_ERR_DR_PCAC 0x200000
+#define REG_PEX_ERR_DR_PNM 0x100000
+#define REG_PEX_ERR_DR_CDNSC 0x80000
+#define REG_PEX_ERR_DR_CRSNC 0x40000
+#define REG_PEX_ERR_DR_ICCA 0x20000
+#define REG_PEX_ERR_DR_IACA 0x10000
+#define REG_PEX_ERR_DR_CRST 0x8000
+#define REG_PEX_ERR_DR_MIS 0x4000
+#define REG_PEX_ERR_DR_IOIS 0x2000
+#define REG_PEX_ERR_DR_CIS 0x1000
+#define REG_PEX_ERR_DR_CIEP 0x800
+#define REG_PEX_ERR_DR_IOIEP 0x400
+#define REG_PEX_ERR_DR_OAC 0x200
+#define REG_PEX_ERR_DR_IOIA 0x100
+#define REG_PEX_ERR_DR_IMBA 0x80
+#define REG_PEX_ERR_DR_IIOBA 0x40
+#define REG_PEX_ERR_DR_LDDE 0x20
+#define REG_PEX_ERR_EN 0x0e08
+
#define PCIR_LTSSM 0x404
#define LTSSM_STAT_L0 0x16
@@ -113,6 +136,9 @@ struct fsl_pcib_softc {
bus_space_tag_t sc_bst;
int sc_rid;
+ struct resource *sc_irq_res;
+ void *sc_ih;
+
int sc_busnr;
int sc_pcie;
uint8_t sc_pcie_capreg; /* PCI-E Capability Reg Set */
@@ -122,6 +148,34 @@ struct fsl_pcib_softc {
int sc_devfn_via_ide;
};
+struct fsl_pcib_err_dr {
+ const char *msg;
+ uint32_t err_dr_mask;
+};
+
+static const struct fsl_pcib_err_dr pci_err[] = {
+ {"ME", REG_PEX_ERR_DR_ME},
+ {"PCT", REG_PEX_ERR_DR_PCT},
+ {"PAT", REG_PEX_ERR_DR_PAT},
+ {"PCAC", REG_PEX_ERR_DR_PCAC},
+ {"PNM", REG_PEX_ERR_DR_PNM},
+ {"CDNSC", REG_PEX_ERR_DR_CDNSC},
+ {"CRSNC", REG_PEX_ERR_DR_CRSNC},
+ {"ICCA", REG_PEX_ERR_DR_ICCA},
+ {"IACA", REG_PEX_ERR_DR_IACA},
+ {"CRST", REG_PEX_ERR_DR_CRST},
+ {"MIS", REG_PEX_ERR_DR_MIS},
+ {"IOIS", REG_PEX_ERR_DR_IOIS},
+ {"CIS", REG_PEX_ERR_DR_CIS},
+ {"CIEP", REG_PEX_ERR_DR_CIEP},
+ {"IOIEP", REG_PEX_ERR_DR_IOIEP},
+ {"OAC", REG_PEX_ERR_DR_OAC},
+ {"IOIA", REG_PEX_ERR_DR_IOIA},
+ {"IMBA", REG_PEX_ERR_DR_IMBA},
+ {"IIOBA", REG_PEX_ERR_DR_IIOBA},
+ {"LDDE", REG_PEX_ERR_DR_LDDE}
+};
+
/* Local forward declerations. */
static uint32_t fsl_pcib_cfgread(struct fsl_pcib_softc *, u_int, u_int, u_int,
u_int, int);
@@ -173,6 +227,35 @@ DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods,
DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0);
static int
+fsl_pcib_err_intr(void *v)
+{
+ struct fsl_pcib_softc *sc;
+ device_t dev;
+ uint32_t err_reg, clear_reg;
+ uint8_t i;
+
+ dev = (device_t)v;
+ sc = device_get_softc(dev);
+
+ clear_reg = 0;
+ err_reg = bus_space_read_4(sc->sc_bst, sc->sc_bsh, REG_PEX_ERR_DR);
+
+ /* Check which one error occurred */
+ for (i = 0; i < sizeof(pci_err)/sizeof(struct fsl_pcib_err_dr); i++) {
+ if (err_reg & pci_err[i].err_dr_mask) {
+ device_printf(dev, "PCI %d: report %s error\n",
+ device_get_unit(dev), pci_err[i].msg);
+ clear_reg |= pci_err[i].err_dr_mask;
+ }
+ }
+
+ /* Clear pending errors */
+ bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_PEX_ERR_DR, clear_reg);
+
+ return (0);
+}
+
+static int
fsl_pcib_probe(device_t dev)
{
@@ -198,7 +281,7 @@ fsl_pcib_attach(device_t dev)
struct fsl_pcib_softc *sc;
phandle_t node;
uint32_t cfgreg;
- int maxslot, error;
+ int error, maxslot, rid;
uint8_t ltssm, capptr;
sc = device_get_softc(dev);
@@ -279,6 +362,35 @@ fsl_pcib_attach(device_t dev)
}
}
+ /* Allocate irq */
+ rid = 0;
+ sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
+ RF_ACTIVE | RF_SHAREABLE);
+ if (sc->sc_irq_res == NULL) {
+ error = fsl_pcib_detach(dev);
+ if (error != 0) {
+ device_printf(dev,
+ "Detach of the driver failed with error %d\n",
+ error);
+ }
+ return (ENXIO);
+ }
+
+ /* Setup interrupt handler */
+ error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
+ NULL, (driver_intr_t *)fsl_pcib_err_intr, dev, &sc->sc_ih);
+ if (error != 0) {
+ device_printf(dev, "Could not setup irq, %d\n", error);
+ sc->sc_ih = NULL;
+ error = fsl_pcib_detach(dev);
+ if (error != 0) {
+ device_printf(dev,
+ "Detach of the driver failed with error %d\n",
+ error);
+ }
+ return (ENXIO);
+ }
+
fsl_pcib_err_init(dev);
return (ofw_pci_attach(dev));
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index 1d68531..8892417 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -91,6 +91,7 @@ struct cputab {
uint16_t revfmt;
int features; /* Do not include PPC_FEATURE_32 or
* PPC_FEATURE_HAS_MMU */
+ int features2;
void (*cpu_setup)(int cpuid, uint16_t vers);
};
#define REVFMT_MAJMIN 1 /* %u.%u */
@@ -98,93 +99,102 @@ struct cputab {
#define REVFMT_DEC 3 /* %u */
static const struct cputab models[] = {
{ "Motorola PowerPC 601", MPC601, REVFMT_DEC,
- PPC_FEATURE_HAS_FPU | PPC_FEATURE_UNIFIED_CACHE, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU | PPC_FEATURE_UNIFIED_CACHE, 0, cpu_6xx_setup },
{ "Motorola PowerPC 602", MPC602, REVFMT_DEC,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 603", MPC603, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 603e", MPC603e, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 603ev", MPC603ev, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 604", MPC604, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 604ev", MPC604ev, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 620", MPC620, REVFMT_HEX,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, NULL },
{ "Motorola PowerPC 750", MPC750, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "IBM PowerPC 750FX", IBM750FX, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "IBM PowerPC 970", IBM970, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
- cpu_970_setup },
+ 0, cpu_970_setup },
{ "IBM PowerPC 970FX", IBM970FX, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
- cpu_970_setup },
+ 0, cpu_970_setup },
{ "IBM PowerPC 970GX", IBM970GX, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
- cpu_970_setup },
+ 0, cpu_970_setup },
{ "IBM PowerPC 970MP", IBM970MP, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
- cpu_970_setup },
+ 0, cpu_970_setup },
{ "IBM POWER4", IBMPOWER4, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, NULL },
{ "IBM POWER4+", IBMPOWER4PLUS, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0, NULL },
{ "IBM POWER5", IBMPOWER5, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU | PPC_FEATURE_SMT, 0, NULL },
{ "IBM POWER5+", IBMPOWER5PLUS, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU | PPC_FEATURE_SMT, 0, NULL },
{ "IBM POWER6", IBMPOWER6, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
- NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
+ PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05, 0, NULL },
{ "IBM POWER7", IBMPOWER7, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
- PPC_FEATURE_HAS_VSX, NULL },
+ PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 |
+ PPC_FEATURE_HAS_VSX, 0, NULL },
{ "IBM POWER7+", IBMPOWER7PLUS, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
- PPC_FEATURE_HAS_VSX, NULL },
+ PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 |
+ PPC_FEATURE_HAS_VSX, 0, NULL },
{ "IBM POWER8E", IBMPOWER8E, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
- PPC_FEATURE_HAS_VSX, NULL },
+ PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 |
+ PPC_FEATURE_HAS_VSX,
+ PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM |
+ PPC_FEATURE2_HAS_VCRYPTO, NULL },
{ "IBM POWER8", IBMPOWER8, REVFMT_MAJMIN,
PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
- PPC_FEATURE_HAS_VSX, NULL },
+ PPC_FEATURE_SMT | PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_ARCH_2_06 |
+ PPC_FEATURE_HAS_VSX,
+ PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HAS_HTM |
+ PPC_FEATURE2_HAS_VCRYPTO, NULL },
{ "Motorola PowerPC 7400", MPC7400, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 7410", MPC7410, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 7450", MPC7450, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 7455", MPC7455, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 7457", MPC7457, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 7447A", MPC7447A, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 7448", MPC7448, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 8240", MPC8240, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Motorola PowerPC 8245", MPC8245, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_6xx_setup },
+ PPC_FEATURE_HAS_FPU, 0, cpu_6xx_setup },
{ "Freescale e500v1 core", FSL_E500v1, REVFMT_MAJMIN,
- 0, cpu_booke_setup },
+ PPC_FEATURE_BOOKE, 0, cpu_booke_setup },
{ "Freescale e500v2 core", FSL_E500v2, REVFMT_MAJMIN,
- 0, cpu_booke_setup },
+ PPC_FEATURE_BOOKE, 0, cpu_booke_setup },
{ "Freescale e500mc core", FSL_E500mc, REVFMT_MAJMIN,
- PPC_FEATURE_HAS_FPU, cpu_booke_setup },
+ PPC_FEATURE_BOOKE | PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup },
{ "Freescale e5500 core", FSL_E5500, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, cpu_booke_setup },
- { "Freescale e6500 core", FSL_E6500, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
+ PPC_FEATURE_BOOKE | PPC_FEATURE_64 | PPC_FEATURE_HAS_FPU, 0,
cpu_booke_setup },
+ { "Freescale e6500 core", FSL_E6500, REVFMT_MAJMIN,
+ PPC_FEATURE_BOOKE | PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC |
+ PPC_FEATURE_HAS_FPU, 0, cpu_booke_setup },
{ "IBM Cell Broadband Engine", IBMCELLBE, REVFMT_MAJMIN,
- PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU,
- NULL},
- { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, NULL },
+ PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
+ PPC_FEATURE_SMT, 0, NULL},
+ { "Unknown PowerPC CPU", 0, REVFMT_HEX, 0, 0, NULL },
};
static void cpu_6xx_print_cacheinfo(u_int, uint16_t);
@@ -194,8 +204,11 @@ static char model[64];
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, "");
int cpu_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU;
+int cpu_features2 = 0;
SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features, CTLFLAG_RD,
&cpu_features, sizeof(cpu_features), "IX", "PowerPC CPU features");
+SYSCTL_OPAQUE(_hw, OID_AUTO, cpu_features2, CTLFLAG_RD,
+ &cpu_features2, sizeof(cpu_features2), "IX", "PowerPC CPU features 2");
/* Provide some user-friendly aliases for bits in cpu_features */
SYSCTL_PROC(_hw, OID_AUTO, floatingpoint, CTLTYPE_INT | CTLFLAG_RD,
@@ -265,8 +278,12 @@ cpu_setup(u_int cpuid)
printf("\n");
cpu_features |= cp->features;
+ cpu_features2 |= cp->features2;
printf("cpu%d: Features %b\n", cpuid, cpu_features,
PPC_FEATURE_BITMASK);
+ if (cpu_features2 != 0)
+ printf("cpu%d: Features2 %b\n", cpuid, cpu_features2,
+ PPC_FEATURE2_BITMASK);
/*
* Configure CPU
diff --git a/sys/powerpc/powerpc/intr_machdep.c b/sys/powerpc/powerpc/intr_machdep.c
index b481279..a17d9ff 100644
--- a/sys/powerpc/powerpc/intr_machdep.c
+++ b/sys/powerpc/powerpc/intr_machdep.c
@@ -352,6 +352,9 @@ powerpc_register_pic(device_t dev, uint32_t node, u_int irqs, u_int ipis,
npics++;
}
+ KASSERT(npics < MAX_PICS,
+ ("Number of PICs exceeds maximum (%d)", MAX_PICS));
+
mtx_unlock(&intr_table_lock);
}
@@ -385,6 +388,9 @@ powerpc_get_irq(uint32_t node, u_int pin)
nirqs += 128;
npics++;
+ KASSERT(npics < MAX_PICS,
+ ("Number of PICs exceeds maximum (%d)", MAX_PICS));
+
mtx_unlock(&intr_table_lock);
return (piclist[idx].base + pin);
diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c
index dea3461..0913a60 100644
--- a/sys/powerpc/powerpc/machdep.c
+++ b/sys/powerpc/powerpc/machdep.c
@@ -261,7 +261,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp)
kmdp = preload_search_by_type("elf kernel");
if (kmdp != NULL) {
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *),
+ 0);
endkernel = ulmax(endkernel, MD_FETCH(kmdp,
MODINFOMD_KERNEND, vm_offset_t));
#ifdef DDB
diff --git a/sys/sparc64/include/ofw_machdep.h b/sys/sparc64/include/ofw_machdep.h
index bc69b3b..fcacc10 100644
--- a/sys/sparc64/include/ofw_machdep.h
+++ b/sys/sparc64/include/ofw_machdep.h
@@ -34,6 +34,9 @@
typedef uint64_t cell_t;
+/* sparc64 doesn't use the interrupt parent #address-cells in interrupt maps */
+#define OFW_IMAP_NO_IPARENT_ADDR_CELLS
+
int OF_decode_addr(phandle_t, int, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
u_int OF_getscsinitid(device_t);
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 95b10e3..d3cd7a2 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -379,7 +379,8 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
kmdp = preload_search_by_type("elf kernel");
if (kmdp != NULL) {
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *),
+ 0);
end = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
kernel_tlb_slots = MD_FETCH(kmdp, MODINFOMD_DTLB_SLOTS,
int);
diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c
index 58eb736..1cea294 100644
--- a/sys/x86/xen/pv.c
+++ b/sys/x86/xen/pv.c
@@ -296,7 +296,7 @@ xen_pv_set_env(void)
for (cmd_line_next = cmd_line; strsep(&cmd_line_next, ",") != NULL;)
;
- init_static_kenv(cmd_line, env_size);
+ init_static_kenv(cmd_line, 0);
}
static void
@@ -382,6 +382,7 @@ xen_pv_parse_preload_data(u_int64_t modulep)
caddr_t kmdp;
vm_ooffset_t off;
vm_paddr_t metadata;
+ char *envp;
if (HYPERVISOR_start_info->mod_start != 0) {
preload_metadata = (caddr_t)(HYPERVISOR_start_info->mod_start);
@@ -404,8 +405,10 @@ xen_pv_parse_preload_data(u_int64_t modulep)
preload_bootstrap_relocate(off);
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
- kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
- kern_envp += off;
+ envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
+ if (envp != NULL)
+ envp += off;
+ init_static_kenv(envp, 0);
} else {
/* Parse the extra boot information given by Xen */
xen_pv_set_env();
diff --git a/tools/regression/geom_mirror/conf.sh b/tools/regression/geom_mirror/conf.sh
index 5e7e15a..d8595f1 100644
--- a/tools/regression/geom_mirror/conf.sh
+++ b/tools/regression/geom_mirror/conf.sh
@@ -5,4 +5,11 @@ name="$(mktemp -u mirror.XXXXXX)"
class="mirror"
base=`basename $0`
+gmirror_test_cleanup()
+{
+ [ -c /dev/$class/$name ] && gmirror destroy $name
+ geom_test_cleanup
+}
+trap gmirror_test_cleanup ABRT EXIT INT TERM
+
. `dirname $0`/../geom_subr.sh
diff --git a/tools/regression/geom_mirror/test-1.t b/tools/regression/geom_mirror/test-1.t
index b07a8d1..af82a14 100644
--- a/tools/regression/geom_mirror/test-1.t
+++ b/tools/regression/geom_mirror/test-1.t
@@ -5,15 +5,11 @@
echo "1..1"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
+us0=$(attach_md -t malloc -s 1M) || exit 1
+us1=$(attach_md -t malloc -s 2M) || exit 1
+us2=$(attach_md -t malloc -s 3M) || exit 1
-mdconfig -a -t malloc -s 1M -u $us0 || exit 1
-mdconfig -a -t malloc -s 2M -u $us1 || exit 1
-mdconfig -a -t malloc -s 3M -u $us2 || exit 1
-
-gmirror label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
devwait
# Size of created device should be 1MB - 512b.
@@ -25,10 +21,3 @@ if [ $size -eq 1048064 ]; then
else
echo "not ok 1"
fi
-
-gmirror remove $name md${us0}
-gmirror remove $name md${us1}
-gmirror remove $name md${us2}
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
diff --git a/tools/regression/geom_mirror/test-2.t b/tools/regression/geom_mirror/test-2.t
index 3fb0822..5605c44 100644
--- a/tools/regression/geom_mirror/test-2.t
+++ b/tools/regression/geom_mirror/test-2.t
@@ -6,22 +6,19 @@
echo "1..4"
balance="round-robin"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -32,28 +29,24 @@ if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
else
echo "ok 1"
fi
-dd if=/dev/md${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us0} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
else
echo "ok 2"
fi
-dd if=/dev/md${us1} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us1} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
else
echo "ok 3"
fi
-dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
else
echo "ok 4"
fi
-gmirror remove $name md${us0} md${us1} md${us2}
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-3.t b/tools/regression/geom_mirror/test-3.t
index 5bdd2ab..b7f8525 100644
--- a/tools/regression/geom_mirror/test-3.t
+++ b/tools/regression/geom_mirror/test-3.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="round-robin"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -64,7 +61,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-4.t b/tools/regression/geom_mirror/test-4.t
index 0786bdb..6efcc02 100644
--- a/tools/regression/geom_mirror/test-4.t
+++ b/tools/regression/geom_mirror/test-4.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="load"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -57,6 +54,8 @@ else
echo "ok 4"
fi
+gmirror destroy $name
+
# mirror/${name} should be removed.
if [ -c /dev/${name} ]; then
echo "not ok 5"
@@ -64,7 +63,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-5.t b/tools/regression/geom_mirror/test-5.t
index 5b0a5ed..3a176b5 100644
--- a/tools/regression/geom_mirror/test-5.t
+++ b/tools/regression/geom_mirror/test-5.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="split"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=8192
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -64,7 +61,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-6.t b/tools/regression/geom_mirror/test-6.t
index ec86d06..68036e9 100644
--- a/tools/regression/geom_mirror/test-6.t
+++ b/tools/regression/geom_mirror/test-6.t
@@ -6,26 +6,23 @@
echo "1..2"
balance="split"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=8192
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/md${us0} /dev/md${us1} || exit 1
+gmirror label -b $balance -s `expr $ddbs / 2` $name /dev/${us0} /dev/${us1} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-dd if=/dev/zero of=/dev/md${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/zero of=/dev/${us2} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
@@ -35,18 +32,14 @@ else
fi
# Connect disk to the mirror.
-gmirror insert ${name} md${us2}
+gmirror insert ${name} ${us2}
# Wait for synchronization.
sleep 1
-dd if=/dev/md${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
+dd if=/dev/${us2} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
else
echo "ok 2"
fi
-gmirror remove $name md${us0} md${us1} md${us2}
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_mirror/test-7.t b/tools/regression/geom_mirror/test-7.t
index c911c03..f5bf71a 100644
--- a/tools/regression/geom_mirror/test-7.t
+++ b/tools/regression/geom_mirror/test-7.t
@@ -6,22 +6,19 @@
echo "1..5"
balance="prefer"
-us0=45
-us1=`expr $us0 + 1`
-us2=`expr $us0 + 2`
ddbs=2048
nblocks1=1024
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
-src=`mktemp /tmp/$base.XXXXXX` || exit 1
-dst=`mktemp /tmp/$base.XXXXXX` || exit 1
+src=`mktemp $base.XXXXXX` || exit 1
+dst=`mktemp $base.XXXXXX` || exit 1
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
-mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
+us0=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us1=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
+us2=$(attach_md -t malloc -s `expr $nblocks1 + 1`) || exit 1
-gmirror label -b $balance $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
+gmirror label -b $balance $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
devwait
dd if=${src} of=/dev/mirror/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
@@ -33,7 +30,7 @@ else
echo "ok 1"
fi
-gmirror remove $name md${us0}
+gmirror remove $name ${us0}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 2"
@@ -41,7 +38,7 @@ else
echo "ok 2"
fi
-gmirror remove $name md${us1}
+gmirror remove $name ${us1}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 3"
@@ -49,7 +46,7 @@ else
echo "ok 3"
fi
-gmirror remove $name md${us2}
+gmirror remove $name ${us2}
dd if=/dev/mirror/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
echo "not ok 4"
@@ -64,7 +61,4 @@ else
echo "ok 5"
fi
-mdconfig -d -u $us0
-mdconfig -d -u $us1
-mdconfig -d -u $us2
rm -f ${src} ${dst}
diff --git a/tools/regression/geom_subr.sh b/tools/regression/geom_subr.sh
index 0ffb8c8..58dc31d 100644
--- a/tools/regression/geom_subr.sh
+++ b/tools/regression/geom_subr.sh
@@ -23,7 +23,7 @@ devwait()
# a large number of md(4) devices lingering around
: ${TMPDIR=/tmp}
export TMPDIR
-TEST_MDS_FILE=${TMPDIR}/test_mds
+TEST_MDS_FILE=$(mktemp ${TMPDIR}/test_mds.XXXXXX) || exit 1
attach_md()
{
@@ -45,4 +45,5 @@ geom_test_cleanup()
mdconfig -d -u $test_md
done < $TEST_MDS_FILE
fi
+ rm -f $TEST_MDS_FILE
}
diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c
index e85dfd7..f3e5ce9 100644
--- a/usr.sbin/gssd/gssd.c
+++ b/usr.sbin/gssd/gssd.c
@@ -254,6 +254,7 @@ main(int argc, char **argv)
gssd_syscall(_PATH_GSSDSOCK);
svc_run();
+ gssd_syscall("");
return (0);
}
@@ -1285,6 +1286,7 @@ void gssd_terminate(int sig __unused)
if (hostbased_initiator_cred != 0)
unlink(GSSD_CREDENTIAL_CACHE_FILE);
#endif
+ gssd_syscall("");
exit(0);
}
diff --git a/usr.sbin/kbdcontrol/kbdmap.5 b/usr.sbin/kbdcontrol/kbdmap.5
index c7f437a..fda2ada 100644
--- a/usr.sbin/kbdcontrol/kbdmap.5
+++ b/usr.sbin/kbdcontrol/kbdmap.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 29, 2008
+.Dd January 2, 2016
.Dt KBDMAP 5
.Os
.Sh NAME
@@ -111,9 +111,9 @@ ack,
bel,
bs,
ht,
-nl,
+lf,
vt,
-np,
+ff,
cr,
so,
si,
@@ -132,10 +132,16 @@ esc,
fs,
gs,
rs,
-ns,
us,
sp,
del.
+.It Ar control-alias
+One of the historical aliases for certain
+.Tn ASCII
+control characters:
+nl,
+np,
+ns.
.It Ar accentname
By giving one of the accent names,
the next key pressed will produce
OpenPOWER on IntegriCloud