MFhead @ r289471

This commit is contained in:
ngie 2015-10-17 22:20:06 +00:00
commit 36dc345b9c
28 changed files with 843 additions and 338 deletions

View File

@ -243,14 +243,8 @@ cleanworld:
# Handle the user-driven targets, using the source relative mk files. # Handle the user-driven targets, using the source relative mk files.
# #
.if !(!empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n")
# skip this for -n to avoid changing previous behavior of
# 'make -n buildworld' etc. Using -n -n will run it.
${TGTS}: .MAKE
tinderbox toolchains kernel-toolchains: .MAKE tinderbox toolchains kernel-toolchains: .MAKE
.endif ${TGTS}: .PHONY .MAKE
${TGTS}: .PHONY
${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET} ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
# The historic default "all" target creates files which may cause stale # The historic default "all" target creates files which may cause stale

View File

@ -325,10 +325,6 @@ HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
.endif .endif
.if ${MK_CDDL} == "no"
WMAKEENV+= MK_CTF=no
.endif
.if defined(CROSS_TOOLCHAIN) .if defined(CROSS_TOOLCHAIN)
LOCALBASE?= /usr/local LOCALBASE?= /usr/local
.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
@ -624,7 +620,8 @@ _includes:
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> stage 4.1: building includes" @echo ">>> stage 4.1: building includes"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks buildincludes
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks installincludes
_libraries: _libraries:
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@ -2268,7 +2265,9 @@ _xi-cross-tools:
.endfor .endfor
_xi-includes: _xi-includes:
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 buildincludes \
DESTDIR=${XDDESTDIR}
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 installincludes \
DESTDIR=${XDDESTDIR} DESTDIR=${XDDESTDIR}
_xi-libraries: _xi-libraries:

View File

@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".) "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20151017:
The build previously allowed using 'make -n' to not recurse into
sub-directories while showing what commands would be executed, and
'make -n -n' to recursively show commands. Now 'make -n' will recurse
and 'make -N' will not.
20151012: 20151012:
If you specify SENDMAIL_MC or SENDMAIL_CF in make.conf, mergemaster If you specify SENDMAIL_MC or SENDMAIL_CF in make.conf, mergemaster
and etcupdate will now use this file. A custom sendmail.cf is now and etcupdate will now use this file. A custom sendmail.cf is now

View File

@ -39,6 +39,7 @@ CXXFLAGS.clang+= -stdlib=libc++
.PATH: ${LLVM_SRCS}/${SRCDIR} .PATH: ${LLVM_SRCS}/${SRCDIR}
.if ${MK_META_MODE} == "yes"
.if empty(TOOLSDIR) || !exists(${TOOLSDIR}/usr/bin/clang-tblgen) .if empty(TOOLSDIR) || !exists(${TOOLSDIR}/usr/bin/clang-tblgen)
.if ${MACHINE} == "host" && defined(BOOTSTRAPPING_TOOLS) .if ${MACHINE} == "host" && defined(BOOTSTRAPPING_TOOLS)
.if !empty(LEGACY_TOOLS) && exists(${LEGACY_TOOLS}/usr/bin/tblgen) .if !empty(LEGACY_TOOLS) && exists(${LEGACY_TOOLS}/usr/bin/tblgen)
@ -57,6 +58,7 @@ TOOLSDIR?=
TBLGEN= ${TOOLSDIR}/usr/bin/tblgen TBLGEN= ${TOOLSDIR}/usr/bin/tblgen
CLANG_TBLGEN= ${TOOLSDIR}/usr/bin/clang-tblgen CLANG_TBLGEN= ${TOOLSDIR}/usr/bin/clang-tblgen
.endif .endif
.endif # ${MK_META_MODE} == "yes"
TBLGEN?= tblgen TBLGEN?= tblgen
CLANG_TBLGEN?= clang-tblgen CLANG_TBLGEN?= clang-tblgen

View File

@ -30,7 +30,7 @@
.\" @(#)ffs.3 8.2 (Berkeley) 4/19/94 .\" @(#)ffs.3 8.2 (Berkeley) 4/19/94
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd September 29, 2012 .Dd October 17, 2015
.Dt FFS 3 .Dt FFS 3
.Os .Os
.Sh NAME .Sh NAME
@ -81,7 +81,8 @@ Bits are numbered starting at 1, the least significant bit.
A return value of zero from any of these functions means that the A return value of zero from any of these functions means that the
argument was zero. argument was zero.
.Sh SEE ALSO .Sh SEE ALSO
.Xr bitstring 3 .Xr bitstring 3 ,
.Xr bitset 9
.Sh HISTORY .Sh HISTORY
The The
.Fn ffs .Fn ffs

View File

@ -676,8 +676,10 @@ cam_close_spec_device(struct cam_device *dev)
if (dev == NULL) if (dev == NULL)
return; return;
if (dev->fd >= 0) if (dev->fd >= 0) {
close(dev->fd); close(dev->fd);
dev->fd = -1;
}
} }
char * char *

View File

@ -221,5 +221,10 @@ CRUNCH_ALIAS_chown= chgrp
################################################################## ##################################################################
CRUNCH_LIBS+= -lm CRUNCH_LIBS+= -lm
.if ${MK_ISCSI} != "no"
CRUNCH_PROGS_usr.bin+= iscsictl
CRUNCH_PROGS_usr.sbin+= iscsid
.endif
.include <bsd.crunchgen.mk> .include <bsd.crunchgen.mk>
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@ -26,7 +26,7 @@
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.\" .\"
.Dd July 7, 2013 .Dd October 17, 2013
.Dt MOUNT.CONF 8 .Dt MOUNT.CONF 8
.Os .Os
.Sh NAME .Sh NAME
@ -154,7 +154,7 @@ will direct the kernel to try mounting the root file system
first as an ISO CD9660 file system on first as an ISO CD9660 file system on
.Pa /dev/cd0 , .Pa /dev/cd0 ,
then if that does not work, as an ISO CD9660 file system on then if that does not work, as an ISO CD9660 file system on
.Pa /dev/acd0 , .Pa /dev/cd1 ,
and then if that does not work, as a UFS file system on and then if that does not work, as a UFS file system on
.Pa /dev/ada0s1a . .Pa /dev/ada0s1a .
If that does not work, a If that does not work, a
@ -167,7 +167,7 @@ Finally if that does not work, the kernel will panic.
.Li .timeout 3 .Li .timeout 3
cd9660:/dev/cd0 ro cd9660:/dev/cd0 ro
.Li .timeout 0 .Li .timeout 0
cd9660:/dev/acd0 ro cd9660:/dev/cd1 ro
.Li .timeout 3 .Li .timeout 3
ufs:/dev/ada0s1a ufs:/dev/ada0s1a
.Li .ask .Li .ask

View File

@ -30,7 +30,7 @@
.\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93 .\" @(#)bitstring.3 8.1 (Berkeley) 7/19/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 19, 1993 .Dd October 17, 2015
.Dt BITSTRING 3 .Dt BITSTRING 3
.Os .Os
.Sh NAME .Sh NAME
@ -178,7 +178,8 @@ make_lpr_available()
} }
.Ed .Ed
.Sh SEE ALSO .Sh SEE ALSO
.Xr malloc 3 .Xr malloc 3 ,
.Xr bitset 9
.Sh HISTORY .Sh HISTORY
The The
.Nm bitstring .Nm bitstring

View File

@ -11,6 +11,7 @@ MAN= accept_filter.9 \
altq.9 \ altq.9 \
atomic.9 \ atomic.9 \
bios.9 \ bios.9 \
bitset.9 \
boot.9 \ boot.9 \
bpf.9 \ bpf.9 \
buf.9 \ buf.9 \
@ -429,6 +430,32 @@ MLINKS+=atomic.9 atomic_add.9 \
atomic.9 atomic_subtract.9 \ atomic.9 atomic_subtract.9 \
atomic.9 atomic_swap.9 \ atomic.9 atomic_swap.9 \
atomic.9 atomic_testandset.9 atomic.9 atomic_testandset.9
MLINKS+=bitset.9 BITSET_DEFINE.9 \
bitset.9 BITSET_T_INITIALIZER.9 \
bitset.9 BITSET_FSET.9 \
bitset.9 BIT_CLR.9 \
bitset.9 BIT_COPY.9 \
bitset.9 BIT_ISSET.9 \
bitset.9 BIT_SET.9 \
bitset.9 BIT_ZERO.9 \
bitset.9 BIT_FILL.9 \
bitset.9 BIT_SETOF.9 \
bitset.9 BIT_EMPTY.9 \
bitset.9 BIT_ISFULLSET.9 \
bitset.9 BIT_FFS.9 \
bitset.9 BIT_COUNT.9 \
bitset.9 BIT_SUBSET.9 \
bitset.9 BIT_OVERLAP.9 \
bitset.9 BIT_CMP.9 \
bitset.9 BIT_OR.9 \
bitset.9 BIT_AND.9 \
bitset.9 BIT_NAND.9 \
bitset.9 BIT_CLR_ATOMIC.9 \
bitset.9 BIT_SET_ATOMIC.9 \
bitset.9 BIT_SET_ATOMIC_ACQ.9 \
bitset.9 BIT_AND_ATOMIC.9 \
bitset.9 BIT_OR_ATOMIC.9 \
bitset.9 BIT_COPY_STORE_REL.9
MLINKS+=bpf.9 bpfattach.9 \ MLINKS+=bpf.9 bpfattach.9 \
bpf.9 bpfattach2.9 \ bpf.9 bpfattach2.9 \
bpf.9 bpfdetach.9 \ bpf.9 bpfdetach.9 \

400
share/man/man9/bitset.9 Normal file
View File

@ -0,0 +1,400 @@
.\" Copyright (c) 2015 Conrad Meyer <cem@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.
.\"
.\" $FreeBSD$
.\"
.Dd October 17, 2015
.Dt BITSET 9
.Os
.Sh NAME
.Nm bitset(9)
\(em
.Nm BITSET_DEFINE ,
.Nm BITSET_T_INITIALIZER ,
.Nm BITSET_FSET ,
.Nm BIT_CLR ,
.Nm BIT_COPY ,
.Nm BIT_ISSET ,
.Nm BIT_SET ,
.Nm BIT_ZERO ,
.Nm BIT_FILL ,
.Nm BIT_SETOF ,
.Nm BIT_EMPTY ,
.Nm BIT_ISFULLSET ,
.Nm BIT_FFS ,
.Nm BIT_COUNT ,
.Nm BIT_SUBSET ,
.Nm BIT_OVERLAP ,
.Nm BIT_CMP ,
.Nm BIT_OR ,
.Nm BIT_AND ,
.Nm BIT_NAND ,
.Nm BIT_CLR_ATOMIC ,
.Nm BIT_SET_ATOMIC ,
.Nm BIT_SET_ATOMIC_ACQ ,
.Nm BIT_AND_ATOMIC ,
.Nm BIT_OR_ATOMIC ,
.Nm BIT_COPY_STORE_REL
.Nd bitset manipulation macros
.Sh SYNOPSIS
.In sys/_bitset.h
.In sys/bitset.h
.\"
.Fn BITSET_DEFINE "STRUCTNAME" "const SETSIZE"
.Fn BITSET_T_INITIALIZER "ARRAY_CONTENTS"
.Fn BITSET_FSET "N_WORDS"
.\"
.Fn BIT_CLR "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.Fn BIT_COPY "const SETSIZE" "struct STRUCTNAME *from" "struct STRUCTNAME *to"
.Ft bool
.Fn BIT_ISSET "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.Fn BIT_SET "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.Fn BIT_ZERO "const SETSIZE" "struct STRUCTNAME *bitset"
.Fn BIT_FILL "const SETSIZE" "struct STRUCTNAME *bitset"
.Fn BIT_SETOF "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.Ft bool
.Fn BIT_EMPTY "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft bool
.Fn BIT_ISFULLSET "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft size_t
.Fn BIT_FFS "const SETSIZE" "struct STRUCTNAME *bitset"
.Ft size_t
.Fn BIT_COUNT "const SETSIZE" "struct STRUCTNAME *bitset"
.\"
.Ft bool
.Fo BIT_SUBSET
.Fa "const SETSIZE" "struct STRUCTNAME *haystack" "struct STRUCTNAME *needle"
.Fc
.Ft bool
.Fo BIT_OVERLAP
.Fa "const SETSIZE" "struct STRUCTNAME *bitset1" "struct STRUCTNAME *bitset2"
.Fc
.Ft bool
.Fo BIT_CMP
.Fa "const SETSIZE" "struct STRUCTNAME *bitset1" "struct STRUCTNAME *bitset2"
.Fc
.Fn BIT_OR "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
.Fn BIT_AND "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
.Fn BIT_NAND "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
.\"
.Fn BIT_CLR_ATOMIC "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.Fn BIT_SET_ATOMIC "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.Fn BIT_SET_ATOMIC_ACQ "const SETSIZE" "size_t bit" "struct STRUCTNAME *bitset"
.\"
.Fo BIT_AND_ATOMIC
.Fa "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
.Fc
.Fo BIT_OR_ATOMIC
.Fa "const SETSIZE" "struct STRUCTNAME *dst" "struct STRUCTNAME *src"
.Fc
.Fo BIT_COPY_STORE_REL
.Fa "const SETSIZE" "struct STRUCTNAME *from" "struct STRUCTNAME *to"
.Fc
.Sh DESCRIPTION
The
.Nm
family of macros provide a flexible and efficient bitset implementation if the
maximum size of the set is known at compilation.
Throughout this manual page, the name
.Fa SETSIZE
refers to the size of the bitset in bits.
Individual bits in bitsets are referenced with indices zero through
.Fa SETSIZE - 1 .
One example use of
.In sys/bitset.h
is
.In sys/cpuset.h .
.Pp
The
.Fn BITSET_DEFINE
macro defines a bitset struct
.Fa STRUCTNAME
with room to represent
.Fa SETSIZE
bits.
.Pp
The
.Fn BITSET_T_INITIALIZER
macro allows one to initialize a bitset struct with a compile time literal
value.
.Pp
The
.Fn BITSET_FSET
macro generates a compile time literal, usable by
.Fn BITSET_T_INITIALIZER ,
representing a full bitset (all bits set).
For examples of
.Fn BITSET_T_INITIALIZER
and
.Fn BITSET_FSET
usage, see the
.Sx BITSET_T_INITIALIZER EXAMPLE
section.
The
.Fa N_WORDS
parameter to
.Fn BITSET_FSET
should be:
.Bd -literal -offset indent
__bitset_words(SETSIZE)
.Ed
.Pp
The
.Fn BIT_CLR
macro clears bit
.Fa bit
in the bitset pointed to by
.Fa bitset .
The
.Fn BIT_CLR_ATOMIC
macro is identical, but the bit is cleared atomically.
.Pp
The
.Fn BIT_COPY
macro copies the contents of the bitset
.Fa from
to the bitset
.Fa to .
.Fn BIT_COPY_STORE_REL
is similar, but copies component machine words from
.Fa from
and writes them to
.Fa to
with atomic store with release semantics.
(That is, if
.Fa to
is composed of multiple machine words,
.Fn BIT_COPY_STORE_REL
performs multiple individually atomic operations.)
.Pp
The
.Fn BIT_SET
macro sets bit
.Fa bit
in the bitset pointed to by
.Fa bitset .
The
.Fn BIT_SET_ATOMIC
macro is identical, but the bit is set atomically.
The
.Fn BIT_SET_ATOMIC_ACQ
macro sets the bit with acquire semantics.
.Pp
The
.Fn BIT_ZERO
macro clears all bits in
.Fa bitset .
.Pp
The
.Fn BIT_FILL
macro sets all bits in
.Fa bitset .
.Pp
The
.Fn BIT_SETOF
macro clears all bits in
.Fa bitset
before setting only bit
.Fa bit .
.Pp
The
.Fn BIT_EMPTY
macro returns
.Dv true
if
.Fa bitset
is empty.
.Pp
The
.Fn BIT_ISFULLSET
macro returns
.Dv true
if
.Fa bitset
is full (all bits set).
.Pp
The
.Fn BIT_FFS
macro returns the 1-index of the first (lowest) set bit in
.Fa bitset ,
or zero if
.Fa bitset
is empty.
Like with
.Xr ffs 3 ,
to use the non-zero result of
.Fn BIT_FFS
as a
.Fa bit
index parameter to any other
.Nm
macro, you must subtract one from the result.
.Pp
The
.Fn BIT_COUNT
macro returns the total number of set bits in
.Fa bitset .
.Pp
The
.Fn BIT_SUBSET
macro returns
.Dv true
if
.Fa needle
is a subset of
.Fa haystack .
.Pp
The
.Fn BIT_OVERLAP
macro returns
.Dv true
if
.Fa bitset1
and
.Fa bitset2
have any common bits.
(That is, if
.Fa bitset1
AND
.Fa bitset2
is not the empty set.)
.Pp
The
.Fn BIT_CMP
macro returns
.Dv true
if
.Fa bitset1
is NOT equal to
.Fa bitset2 .
.Pp
The
.Fn BIT_OR
macro sets bits present in
.Fa src
in
.Fa dst .
(It is the
.Nm
equivalent of the scalar:
.Fa dst
|=
.Fa src . )
.Fn BIT_OR_ATOMIC
is similar, but sets bits in the component machine words in
.Fa dst
atomically.
(That is, if
.Fa dst
is composed of multiple machine words,
.Fn BIT_OR_ATOMIC
performs multiple individually atomic operations.)
.Pp
The
.Fn BIT_AND
macro clears bits absent from
.Fa src
from
.Fa dst .
(It is the
.Nm
equivalent of the scalar:
.Fa dst
&=
.Fa src . )
.Fn BIT_AND_ATOMIC
is similar, with the same atomic semantics as
.Fn BIT_OR_ATOMIC .
.Pp
The
.Fn BIT_NAND
macro clears bits set in
.Fa src
from
.Fa dst .
(It is the
.Nm
equivalent of the scalar:
.Fa dst
&=
.Fa ~ src . )
.Sh BITSET_T_INITIALIZER EXAMPLE
.Bd -literal
BITSET_DEFINE(_myset, MYSETSIZE);
struct _myset myset;
/* Initialize myset to filled (all bits set) */
myset = BITSET_T_INITIALIZER(BITSET_FSET(__bitset_words(MYSETSIZE)));
/* Initialize myset to only the lowest bit set */
myset = BITSET_T_INITIALIZER(0x1);
.Ed
.Sh SEE ALSO
The older
.Xr bitstring 3 .
.Sh HISTORY
.In sys/cpuset.h
first appeared in
.Fx 7.1 ,
released in January 2009, and in
.Fx 8.0 ,
released in November 2009 .
.Pp
The
.Nm
macros first appeared in
.Fx 10.0
in January 2014.
They were MFCed to
.Fx 9.3 ,
released in July 2014.
.Pp
This manual page first appeared in
.Fx 11.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
macros were written for
.In sys/cpuset.h
by
.An Jeff Roberson Aq Mt jeff@FreeBSD.org ;
they were generalized and pulled out as
.In sys/_bitset.h
and
.In sys/bitset.h
by
.An Attilio Rao Aq Mt attilio@FreeBSD.org .
This manual page was written by
.An Conrad Meyer Aq Mt cem@FreeBSD.org .
.Sh CAVEATS
The
.Fa SETSIZE
argument to all of these macros must match the value given to
.Fn BITSET_DEFINE .
.Pp
Unlike every other reference to individual set members, which are zero-indexed,
.Fn BIT_FFS
returns a one-indexed result (or zero if the set is empty).

View File

@ -148,9 +148,13 @@ CXXFLAGS.clang+= -Wno-c++11-extensions
.if ${MK_SSP} != "no" && \ .if ${MK_SSP} != "no" && \
${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
.if (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30500) || \
(${COMPILER_TYPE} == "gcc" && \
(${COMPILER_VERSION} == 40201 || ${COMPILER_VERSION} >= 40800))
# Don't use -Wstack-protector as it breaks world with -Werror. # Don't use -Wstack-protector as it breaks world with -Werror.
SSP_CFLAGS?= -fstack-protector-strong SSP_CFLAGS?= -fstack-protector-strong
CFLAGS+= ${SSP_CFLAGS} CFLAGS+= ${SSP_CFLAGS}
.endif
.endif # SSP && !ARM && !MIPS .endif # SSP && !ARM && !MIPS
# Allow user-specified additional warning flags, plus compiler specific flag overrides. # Allow user-specified additional warning flags, plus compiler specific flag overrides.

View File

@ -145,13 +145,12 @@ ECHODIR ?= true
.endif .endif
.endif .endif
.if defined(.PARSEDIR) .if ${.MAKEFLAGS:M-N}
# _+_ appears to be a workaround for the special src .MAKE not working. # bmake -N is supposed to skip executing anything but it does not skip
# setting it to + interferes with -N # exeucting '+' commands. The '+' feature is used where .MAKE
_+_ ?= # is not safe for the entire target. -N is intended to skip building sub-makes
.elif !empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n" # so it executing '+' commands is not right. Work around the bug by not
# the check above matches only a single -n, so -n -n will result # setting '+' when -N is used.
# in _+_ = +
_+_ ?= _+_ ?=
.else .else
_+_ ?= + _+_ ?= +

View File

@ -79,7 +79,7 @@ zoneinfo: yearistype ${TDATA}
beforeinstall: beforeinstall:
cd ${TZBUILDDIR} && \ cd ${TZBUILDDIR} && \
find * -type f -print -exec ${INSTALL} \ find -s * -type f -print -exec ${INSTALL} \
-o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
\{} ${DESTDIR}/usr/share/zoneinfo/\{} \; \{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
*/ */
ENTRY(copyio_fault) ENTRY(copyio_fault)
SET_FAULT_HANDLER(xzr, x1) /* Clear the handler */ SET_FAULT_HANDLER(xzr, x1) /* Clear the handler */
copyio_fault_nopcb:
mov x0, #EFAULT mov x0, #EFAULT
ret ret
END(copyio_fault) END(copyio_fault)
@ -51,6 +52,10 @@ END(copyio_fault)
*/ */
ENTRY(copyout) ENTRY(copyout)
cbz x2, 2f /* If len == 0 then skip loop */ cbz x2, 2f /* If len == 0 then skip loop */
add x3, x1, x2
ldr x4, =VM_MAXUSER_ADDRESS
cmp x3, x4
b.hi copyio_fault_nopcb
adr x6, copyio_fault /* Get the handler address */ adr x6, copyio_fault /* Get the handler address */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */ SET_FAULT_HANDLER(x6, x7) /* Set the handler */
@ -73,6 +78,10 @@ END(copyout)
*/ */
ENTRY(copyin) ENTRY(copyin)
cbz x2, 2f /* If len == 0 then skip loop */ cbz x2, 2f /* If len == 0 then skip loop */
add x3, x0, x2
ldr x4, =VM_MAXUSER_ADDRESS
cmp x3, x4
b.hi copyio_fault_nopcb
adr x6, copyio_fault /* Get the handler address */ adr x6, copyio_fault /* Get the handler address */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */ SET_FAULT_HANDLER(x6, x7) /* Set the handler */
@ -97,11 +106,14 @@ ENTRY(copyinstr)
mov x5, xzr /* count = 0 */ mov x5, xzr /* count = 0 */
mov w4, #1 /* If zero return faulure */ mov w4, #1 /* If zero return faulure */
cbz x2, 3f /* If len == 0 then skip loop */ cbz x2, 3f /* If len == 0 then skip loop */
ldr x7, =VM_MAXUSER_ADDRESS
adr x6, copyio_fault /* Get the handler address */ adr x6, copyio_fault /* Get the handler address */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */ SET_FAULT_HANDLER(x6, x7) /* Set the handler */
1: ldrb w4, [x0], #1 /* Load from uaddr */ 1: cmp x0, x7
b.cs copyio_fault
ldrb w4, [x0], #1 /* Load from uaddr */
strb w4, [x1], #1 /* Store in kaddr */ strb w4, [x1], #1 /* Store in kaddr */
add x5, x5, #1 /* count++ */ add x5, x5, #1 /* count++ */
cbz w4, 2f /* Break when NUL-terminated */ cbz w4, 2f /* Break when NUL-terminated */

View File

@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
#include <machine/vmparam.h> #include <machine/vmparam.h>
ASSYM(KERNBASE, KERNBASE); ASSYM(KERNBASE, KERNBASE);
ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);

View File

@ -357,7 +357,7 @@ create_pagetables:
mov x7, #NORMAL_MEM mov x7, #NORMAL_MEM
mov x8, #(KERNBASE & L2_BLOCK_MASK) mov x8, #(KERNBASE & L2_BLOCK_MASK)
mov x9, x28 mov x9, x28
bl build_block_pagetable bl build_l2_block_pagetable
/* Move to the l1 table */ /* Move to the l1 table */
add x26, x26, #PAGE_SIZE add x26, x26, #PAGE_SIZE
@ -379,7 +379,8 @@ create_pagetables:
mov x7, #DEVICE_MEM mov x7, #DEVICE_MEM
mov x8, #(SOCDEV_VA) /* VA start */ mov x8, #(SOCDEV_VA) /* VA start */
mov x9, #(SOCDEV_PA) /* PA start */ mov x9, #(SOCDEV_PA) /* PA start */
bl build_section_pagetable mov x10, #1
bl build_l1_block_pagetable
#endif #endif
/* Create the VA = PA map */ /* Create the VA = PA map */
@ -387,47 +388,18 @@ create_pagetables:
mov x7, #NORMAL_UNCACHED /* Uncached as it's only needed early on */ mov x7, #NORMAL_UNCACHED /* Uncached as it's only needed early on */
mov x9, x27 mov x9, x27
mov x8, x9 /* VA start (== PA start) */ mov x8, x9 /* VA start (== PA start) */
bl build_section_pagetable mov x10, #1
bl build_l1_block_pagetable
/* Restore the Link register */ /* Restore the Link register */
mov x30, x5 mov x30, x5
ret ret
/*
* Builds a 1 GiB page table entry
* x6 = L1 table
* x7 = Type (0 = Device, 1 = Normal)
* x8 = VA start
* x9 = PA start (trashed)
* x11, x12 and x13 are trashed
*/
build_section_pagetable:
/*
* Build the L1 table entry.
*/
/* Find the table index */
lsr x11, x8, #L1_SHIFT
and x11, x11, #Ln_ADDR_MASK
/* Build the L1 block entry */
lsl x12, x7, #2
orr x12, x12, #L1_BLOCK
orr x12, x12, #(ATTR_AF)
/* Only use the output address bits */
lsr x9, x9, #L1_SHIFT
orr x12, x12, x9, lsl #L1_SHIFT
/* Store the entry */
str x12, [x6, x11, lsl #3]
ret
/* /*
* Builds an L1 -> L2 table descriptor * Builds an L1 -> L2 table descriptor
* *
* This is a link for a 1GiB block of memory with up to 2MiB regions mapped * This is a link for a 1GiB block of memory with up to 2MiB regions mapped
* within it by build_block_pagetable. * within it by build_l2_block_pagetable.
* *
* x6 = L1 table * x6 = L1 table
* x8 = Virtual Address * x8 = Virtual Address
@ -454,6 +426,50 @@ link_l1_pagetable:
ret ret
/*
* Builds count 1 GiB page table entry
* x6 = L1 table
* x7 = Type (0 = Device, 1 = Normal)
* x8 = VA start
* x9 = PA start (trashed)
* x10 = Entry count (TODO)
* x11, x12 and x13 are trashed
*/
build_l1_block_pagetable:
/*
* Build the L1 table entry.
*/
/* Find the table index */
lsr x11, x8, #L1_SHIFT
and x11, x11, #Ln_ADDR_MASK
/* Build the L1 block entry */
lsl x12, x7, #2
orr x12, x12, #L1_BLOCK
orr x12, x12, #(ATTR_AF)
#ifdef SMP
orr x12, x12, ATTR_SH(ATTR_SH_IS)
#endif
/* Only use the output address bits */
lsr x9, x9, #L1_SHIFT
/* Set the physical address for this virtual address */
1: orr x12, x12, x9, lsl #L1_SHIFT
/* Store the entry */
str x12, [x6, x11, lsl #3]
/* Clear the address bits */
and x12, x12, #ATTR_MASK_L
sub x10, x10, #1
add x11, x11, #1
add x9, x9, #1
cbnz x10, 1b
2: ret
/* /*
* Builds count 2 MiB page table entry * Builds count 2 MiB page table entry
* x6 = L2 table * x6 = L2 table
@ -463,7 +479,7 @@ link_l1_pagetable:
* x10 = Entry count (TODO) * x10 = Entry count (TODO)
* x11, x12 and x13 are trashed * x11, x12 and x13 are trashed
*/ */
build_block_pagetable: build_l2_block_pagetable:
/* /*
* Build the L2 table entry. * Build the L2 table entry.
*/ */

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
*/ */
ENTRY(fsu_fault) ENTRY(fsu_fault)
SET_FAULT_HANDLER(xzr, x1) /* Reset the handler function */ SET_FAULT_HANDLER(xzr, x1) /* Reset the handler function */
fsu_fault_nopcb:
mov x0, #-1 mov x0, #-1
ret ret
END(fsu_fault) END(fsu_fault)
@ -49,6 +50,9 @@ END(fsu_fault)
* int casueword32(volatile uint32_t *, uint32_t, uint32_t *, uint32_t) * int casueword32(volatile uint32_t *, uint32_t, uint32_t *, uint32_t)
*/ */
ENTRY(casueword32) ENTRY(casueword32)
ldr x4, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x4
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x4) /* And set it */ SET_FAULT_HANDLER(x6, x4) /* And set it */
1: ldxr w4, [x0] /* Load-exclusive the data */ 1: ldxr w4, [x0] /* Load-exclusive the data */
@ -67,6 +71,9 @@ END(casueword32)
* int casueword(volatile u_long *, u_long, u_long *, u_long) * int casueword(volatile u_long *, u_long, u_long *, u_long)
*/ */
ENTRY(casueword) ENTRY(casueword)
ldr x4, =(VM_MAXUSER_ADDRESS-7)
cmp x0, x4
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x4) /* And set it */ SET_FAULT_HANDLER(x6, x4) /* And set it */
1: ldxr x4, [x0] /* Load-exclusive the data */ 1: ldxr x4, [x0] /* Load-exclusive the data */
@ -85,6 +92,9 @@ END(casueword)
* int fubyte(volatile const void *) * int fubyte(volatile const void *)
*/ */
ENTRY(fubyte) ENTRY(fubyte)
ldr x1, =VM_MAXUSER_ADDRESS
cmp x0, x1
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x1) /* And set it */ SET_FAULT_HANDLER(x6, x1) /* And set it */
ldrb w0, [x0] /* Try loading the data */ ldrb w0, [x0] /* Try loading the data */
@ -96,6 +106,9 @@ END(fubyte)
* int fuword(volatile const void *) * int fuword(volatile const void *)
*/ */
ENTRY(fuword16) ENTRY(fuword16)
ldr x1, =(VM_MAXUSER_ADDRESS-1)
cmp x0, x1
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x1) /* And set it */ SET_FAULT_HANDLER(x6, x1) /* And set it */
ldrh w0, [x0] /* Try loading the data */ ldrh w0, [x0] /* Try loading the data */
@ -107,6 +120,9 @@ END(fuword16)
* int32_t fueword32(volatile const void *, int32_t *) * int32_t fueword32(volatile const void *, int32_t *)
*/ */
ENTRY(fueword32) ENTRY(fueword32)
ldr x2, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
ldr w0, [x0] /* Try loading the data */ ldr w0, [x0] /* Try loading the data */
@ -122,6 +138,9 @@ END(fueword32)
*/ */
ENTRY(fueword) ENTRY(fueword)
EENTRY(fueword64) EENTRY(fueword64)
ldr x2, =(VM_MAXUSER_ADDRESS-7)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
ldr x0, [x0] /* Try loading the data */ ldr x0, [x0] /* Try loading the data */
@ -136,6 +155,9 @@ END(fueword)
* int subyte(volatile void *, int) * int subyte(volatile void *, int)
*/ */
ENTRY(subyte) ENTRY(subyte)
ldr x2, =VM_MAXUSER_ADDRESS
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
strb w1, [x0] /* Try storing the data */ strb w1, [x0] /* Try storing the data */
@ -148,6 +170,9 @@ END(subyte)
* int suword16(volatile void *, int) * int suword16(volatile void *, int)
*/ */
ENTRY(suword16) ENTRY(suword16)
ldr x2, =(VM_MAXUSER_ADDRESS-1)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
strh w1, [x0] /* Try storing the data */ strh w1, [x0] /* Try storing the data */
@ -160,6 +185,9 @@ END(suword16)
* int suword32(volatile void *, int) * int suword32(volatile void *, int)
*/ */
ENTRY(suword32) ENTRY(suword32)
ldr x2, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
str w1, [x0] /* Try storing the data */ str w1, [x0] /* Try storing the data */
@ -173,6 +201,9 @@ END(suword32)
*/ */
ENTRY(suword) ENTRY(suword)
EENTRY(suword64) EENTRY(suword64)
ldr x2, =(VM_MAXUSER_ADDRESS-7)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */ adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
str x1, [x0] /* Try storing the data */ str x1, [x0] /* Try storing the data */
@ -201,6 +232,9 @@ END(fsu_fault)
* int fuswintr(void *) * int fuswintr(void *)
*/ */
ENTRY(fuswintr) ENTRY(fuswintr)
ldr x1, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x1
b.cs fsu_fault_nopcb
adr x6, fsu_intr_fault /* Load the fault handler */ adr x6, fsu_intr_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x1) /* And set it */ SET_FAULT_HANDLER(x6, x1) /* And set it */
ldr w0, [x0] /* Try loading the data */ ldr w0, [x0] /* Try loading the data */
@ -212,6 +246,9 @@ END(fuswintr)
* int suswintr(void *base, int word) * int suswintr(void *base, int word)
*/ */
ENTRY(suswintr) ENTRY(suswintr)
ldr x2, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_intr_fault /* Load the fault handler */ adr x6, fsu_intr_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */ SET_FAULT_HANDLER(x6, x2) /* And set it */
str w1, [x0] /* Try storing the data */ str w1, [x0] /* Try storing the data */

View File

@ -555,12 +555,12 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
} }
static int static int
intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte, intel_dp_i2c_aux_ch(device_t adapter, int mode,
uint8_t *read_byte) uint8_t write_byte, uint8_t *read_byte)
{ {
struct iic_dp_aux_data *data; struct iic_dp_aux_data *data = device_get_softc(adapter);
struct intel_dp *intel_dp; struct intel_dp *intel_dp = data->priv;
uint16_t address; uint16_t address = data->address;
uint8_t msg[5]; uint8_t msg[5];
uint8_t reply[2]; uint8_t reply[2];
unsigned retry; unsigned retry;
@ -568,10 +568,6 @@ intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte,
int reply_bytes; int reply_bytes;
int ret; int ret;
data = device_get_softc(idev);
intel_dp = data->priv;
address = data->address;
intel_dp_check_edp(intel_dp); intel_dp_check_edp(intel_dp);
/* Set up the command byte */ /* Set up the command byte */
if (mode & MODE_I2C_READ) if (mode & MODE_I2C_READ)
@ -609,7 +605,7 @@ intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte,
reply, reply_bytes); reply, reply_bytes);
if (ret < 0) { if (ret < 0) {
DRM_DEBUG_KMS("aux_ch failed %d\n", ret); DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
return (ret); return ret;
} }
switch (reply[0] & AUX_NATIVE_REPLY_MASK) { switch (reply[0] & AUX_NATIVE_REPLY_MASK) {
@ -620,14 +616,14 @@ intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte,
break; break;
case AUX_NATIVE_REPLY_NACK: case AUX_NATIVE_REPLY_NACK:
DRM_DEBUG_KMS("aux_ch native nack\n"); DRM_DEBUG_KMS("aux_ch native nack\n");
return (-EREMOTEIO); return -EREMOTEIO;
case AUX_NATIVE_REPLY_DEFER: case AUX_NATIVE_REPLY_DEFER:
DELAY(100); DELAY(100);
continue; continue;
default: default:
DRM_ERROR("aux_ch invalid native reply 0x%02x\n", DRM_ERROR("aux_ch invalid native reply 0x%02x\n",
reply[0]); reply[0]);
return (-EREMOTEIO); return -EREMOTEIO;
} }
switch (reply[0] & AUX_I2C_REPLY_MASK) { switch (reply[0] & AUX_I2C_REPLY_MASK) {
@ -638,19 +634,19 @@ intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte,
return (0/*reply_bytes - 1*/); return (0/*reply_bytes - 1*/);
case AUX_I2C_REPLY_NACK: case AUX_I2C_REPLY_NACK:
DRM_DEBUG_KMS("aux_i2c nack\n"); DRM_DEBUG_KMS("aux_i2c nack\n");
return (-EREMOTEIO); return -EREMOTEIO;
case AUX_I2C_REPLY_DEFER: case AUX_I2C_REPLY_DEFER:
DRM_DEBUG_KMS("aux_i2c defer\n"); DRM_DEBUG_KMS("aux_i2c defer\n");
DELAY(100); DELAY(100);
break; break;
default: default:
DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]); DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]);
return (-EREMOTEIO); return -EREMOTEIO;
} }
} }
DRM_ERROR("too many retries, giving up\n"); DRM_ERROR("too many retries, giving up\n");
return (-EREMOTEIO); return -EREMOTEIO;
} }
static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp); static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp);
@ -669,7 +665,7 @@ intel_dp_i2c_init(struct intel_dp *intel_dp,
intel_dp_i2c_aux_ch, intel_dp, &intel_dp->dp_iic_bus, intel_dp_i2c_aux_ch, intel_dp, &intel_dp->dp_iic_bus,
&intel_dp->adapter); &intel_dp->adapter);
ironlake_edp_panel_vdd_off(intel_dp, false); ironlake_edp_panel_vdd_off(intel_dp, false);
return (ret); return ret;
} }
static bool static bool
@ -956,8 +952,7 @@ static void ironlake_wait_panel_status(struct intel_dp *intel_dp,
I915_READ(PCH_PP_STATUS), I915_READ(PCH_PP_STATUS),
I915_READ(PCH_PP_CONTROL)); I915_READ(PCH_PP_CONTROL));
if (_intel_wait_for(dev, if (_intel_wait_for(dev, (I915_READ(PCH_PP_STATUS) & mask) == value, 5000, 10, "915iwp")) {
(I915_READ(PCH_PP_STATUS) & mask) == value, 5000, 10, "915iwp")) {
DRM_ERROR("Panel status timeout: status %08x control %08x\n", DRM_ERROR("Panel status timeout: status %08x control %08x\n",
I915_READ(PCH_PP_STATUS), I915_READ(PCH_PP_STATUS),
I915_READ(PCH_PP_CONTROL)); I915_READ(PCH_PP_CONTROL));

View File

@ -96,51 +96,10 @@ struct intel_iic_softc {
uint32_t reg0; uint32_t reg0;
}; };
static void
intel_iic_quirk_set(struct drm_i915_private *dev_priv, bool enable)
{
u32 val;
/* When using bit bashing for I2C, this bit needs to be set to 1 */
if (!IS_PINEVIEW(dev_priv->dev))
return;
val = I915_READ(DSPCLK_GATE_D);
if (enable)
val |= DPCUNIT_CLOCK_GATE_DISABLE;
else
val &= ~DPCUNIT_CLOCK_GATE_DISABLE;
I915_WRITE(DSPCLK_GATE_D, val);
}
static u32
intel_iic_get_reserved(device_t idev)
{
struct intel_iic_softc *sc;
struct drm_device *dev;
struct drm_i915_private *dev_priv;
u32 reserved;
sc = device_get_softc(idev);
dev = sc->drm_dev;
dev_priv = dev->dev_private;
if (!IS_I830(dev) && !IS_845G(dev)) {
reserved = I915_READ_NOTRACE(sc->reg) &
(GPIO_DATA_PULLUP_DISABLE | GPIO_CLOCK_PULLUP_DISABLE);
} else {
reserved = 0;
}
return (reserved);
}
void void
intel_iic_reset(struct drm_device *dev) intel_iic_reset(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv = dev->dev_private;
dev_priv = dev->dev_private;
I915_WRITE(dev_priv->gpio_mmio_base + GMBUS0, 0); I915_WRITE(dev_priv->gpio_mmio_base + GMBUS0, 0);
} }
@ -157,40 +116,65 @@ intel_iicbus_reset(device_t idev, u_char speed, u_char addr, u_char *oldaddr)
return (0); return (0);
} }
static void static void intel_i2c_quirk_set(struct drm_i915_private *dev_priv, bool enable)
intel_iicbb_setsda(device_t idev, int val)
{ {
struct intel_iic_softc *sc; u32 val;
struct drm_i915_private *dev_priv;
u32 reserved;
u32 data_bits;
sc = device_get_softc(idev); /* When using bit bashing for I2C, this bit needs to be set to 1 */
dev_priv = sc->drm_dev->dev_private; if (!IS_PINEVIEW(dev_priv->dev))
return;
reserved = intel_iic_get_reserved(idev); val = I915_READ(DSPCLK_GATE_D);
if (val) if (enable)
data_bits = GPIO_DATA_DIR_IN | GPIO_DATA_DIR_MASK; val |= DPCUNIT_CLOCK_GATE_DISABLE;
else else
data_bits = GPIO_DATA_DIR_OUT | GPIO_DATA_DIR_MASK | val &= ~DPCUNIT_CLOCK_GATE_DISABLE;
GPIO_DATA_VAL_MASK; I915_WRITE(DSPCLK_GATE_D, val);
I915_WRITE_NOTRACE(sc->reg, reserved | data_bits);
POSTING_READ(sc->reg);
} }
static void static u32 get_reserved(device_t idev)
intel_iicbb_setscl(device_t idev, int val)
{ {
struct intel_iic_softc *sc; struct intel_iic_softc *sc = device_get_softc(idev);
struct drm_i915_private *dev_priv; struct drm_device *dev = sc->drm_dev;
u32 clock_bits, reserved; struct drm_i915_private *dev_priv = dev->dev_private;
u32 reserved = 0;
sc = device_get_softc(idev); if (!IS_I830(dev) && !IS_845G(dev))
dev_priv = sc->drm_dev->dev_private; reserved = I915_READ_NOTRACE(sc->reg) &
(GPIO_DATA_PULLUP_DISABLE |
GPIO_CLOCK_PULLUP_DISABLE);
reserved = intel_iic_get_reserved(idev); return reserved;
if (val) }
static int get_clock(device_t adapter)
{
struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
u32 reserved = get_reserved(adapter);
I915_WRITE_NOTRACE(sc->reg, reserved | GPIO_CLOCK_DIR_MASK);
I915_WRITE_NOTRACE(sc->reg, reserved);
return ((I915_READ_NOTRACE(sc->reg) & GPIO_CLOCK_VAL_IN) != 0);
}
static int get_data(device_t adapter)
{
struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
u32 reserved = get_reserved(adapter);
I915_WRITE_NOTRACE(sc->reg, reserved | GPIO_DATA_DIR_MASK);
I915_WRITE_NOTRACE(sc->reg, reserved);
return ((I915_READ_NOTRACE(sc->reg) & GPIO_DATA_VAL_IN) != 0);
}
static void set_clock(device_t adapter, int state_high)
{
struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
u32 reserved = get_reserved(adapter);
u32 clock_bits;
if (state_high)
clock_bits = GPIO_CLOCK_DIR_IN | GPIO_CLOCK_DIR_MASK; clock_bits = GPIO_CLOCK_DIR_IN | GPIO_CLOCK_DIR_MASK;
else else
clock_bits = GPIO_CLOCK_DIR_OUT | GPIO_CLOCK_DIR_MASK | clock_bits = GPIO_CLOCK_DIR_OUT | GPIO_CLOCK_DIR_MASK |
@ -200,38 +184,46 @@ intel_iicbb_setscl(device_t idev, int val)
POSTING_READ(sc->reg); POSTING_READ(sc->reg);
} }
static int static void set_data(device_t adapter, int state_high)
intel_iicbb_getsda(device_t idev)
{ {
struct intel_iic_softc *sc; struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
u32 reserved; u32 reserved = get_reserved(adapter);
u32 data_bits;
sc = device_get_softc(idev); if (state_high)
dev_priv = sc->drm_dev->dev_private; data_bits = GPIO_DATA_DIR_IN | GPIO_DATA_DIR_MASK;
else
data_bits = GPIO_DATA_DIR_OUT | GPIO_DATA_DIR_MASK |
GPIO_DATA_VAL_MASK;
reserved = intel_iic_get_reserved(idev); I915_WRITE_NOTRACE(sc->reg, reserved | data_bits);
POSTING_READ(sc->reg);
I915_WRITE_NOTRACE(sc->reg, reserved | GPIO_DATA_DIR_MASK);
I915_WRITE_NOTRACE(sc->reg, reserved);
return ((I915_READ_NOTRACE(sc->reg) & GPIO_DATA_VAL_IN) != 0);
} }
static int static int
intel_iicbb_getscl(device_t idev) intel_gpio_pre_xfer(device_t adapter)
{ {
struct intel_iic_softc *sc; struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
u32 reserved;
sc = device_get_softc(idev); intel_iic_reset(sc->drm_dev);
dev_priv = sc->drm_dev->dev_private; intel_i2c_quirk_set(dev_priv, true);
IICBB_SETSDA(adapter, 1);
IICBB_SETSCL(adapter, 1);
DELAY(I2C_RISEFALL_TIME);
return 0;
}
reserved = intel_iic_get_reserved(idev); static void
intel_gpio_post_xfer(device_t adapter)
{
struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
I915_WRITE_NOTRACE(sc->reg, reserved | GPIO_CLOCK_DIR_MASK); IICBB_SETSDA(adapter, 1);
I915_WRITE_NOTRACE(sc->reg, reserved); IICBB_SETSCL(adapter, 1);
return ((I915_READ_NOTRACE(sc->reg) & GPIO_CLOCK_VAL_IN) != 0); intel_i2c_quirk_set(dev_priv, false);
} }
static int static int
@ -258,15 +250,15 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct iic_msg *msg,
(GMBUS_SATOER | GMBUS_HW_RDY)), (GMBUS_SATOER | GMBUS_HW_RDY)),
50, 1, "915gbr"); 50, 1, "915gbr");
if (ret) if (ret)
return (-ETIMEDOUT); return -ETIMEDOUT;
if (gmbus2 & GMBUS_SATOER) if (gmbus2 & GMBUS_SATOER)
return (-ENXIO); return -ENXIO;
val = I915_READ(GMBUS3 + reg_offset); val = I915_READ(GMBUS3 + reg_offset);
do { do {
*buf++ = val & 0xff; *buf++ = val & 0xff;
val >>= 8; val >>= 8;
} while (--len != 0 && ++loop < 4); } while (--len && ++loop < 4);
} }
return 0; return 0;
@ -299,7 +291,7 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct iic_msg *msg)
val = loop = 0; val = loop = 0;
do { do {
val |= *buf++ << (8 * loop); val |= *buf++ << (8 * loop);
} while (--len != 0 && ++loop < 4); } while (--len && ++loop < 4);
I915_WRITE(GMBUS3 + reg_offset, val); I915_WRITE(GMBUS3 + reg_offset, val);
@ -308,9 +300,9 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct iic_msg *msg)
(GMBUS_SATOER | GMBUS_HW_RDY)), (GMBUS_SATOER | GMBUS_HW_RDY)),
50, 1, "915gbw"); 50, 1, "915gbw");
if (ret) if (ret)
return (-ETIMEDOUT); return -ETIMEDOUT;
if (gmbus2 & GMBUS_SATOER) if (gmbus2 & GMBUS_SATOER)
return (-ENXIO); return -ENXIO;
} }
return 0; return 0;
} }
@ -356,20 +348,20 @@ gmbus_xfer_index_read(struct drm_i915_private *dev_priv, struct iic_msg *msgs)
} }
static int static int
intel_gmbus_transfer(device_t idev, struct iic_msg *msgs, uint32_t nmsgs) gmbus_xfer(device_t adapter,
struct iic_msg *msgs,
uint32_t num)
{ {
struct intel_iic_softc *sc; struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
int error, i, ret, reg_offset, unit; int error, i, ret, reg_offset, unit;
error = 0; error = 0;
sc = device_get_softc(idev); unit = device_get_unit(adapter);
dev_priv = sc->drm_dev->dev_private;
unit = device_get_unit(idev);
sx_xlock(&dev_priv->gmbus_sx); sx_xlock(&dev_priv->gmbus_sx);
if (sc->force_bit_dev) { if (sc->force_bit_dev) {
error = -IICBUS_TRANSFER(dev_priv->bbbus[unit], msgs, nmsgs); error = -IICBUS_TRANSFER(dev_priv->bbbus[unit], msgs, num);
goto out; goto out;
} }
@ -377,10 +369,10 @@ intel_gmbus_transfer(device_t idev, struct iic_msg *msgs, uint32_t nmsgs)
I915_WRITE(GMBUS0 + reg_offset, sc->reg0); I915_WRITE(GMBUS0 + reg_offset, sc->reg0);
for (i = 0; i < nmsgs; i++) { for (i = 0; i < num; i++) {
u32 gmbus2; u32 gmbus2;
if (gmbus_is_index_read(msgs, i, nmsgs)) { if (gmbus_is_index_read(msgs, i, num)) {
error = gmbus_xfer_index_read(dev_priv, &msgs[i]); error = gmbus_xfer_index_read(dev_priv, &msgs[i]);
i += 1; /* set i to the index of the read xfer */ i += 1; /* set i to the index of the read xfer */
} else if (msgs[i].flags & IIC_M_RD) { } else if (msgs[i].flags & IIC_M_RD) {
@ -462,78 +454,13 @@ intel_gmbus_transfer(device_t idev, struct iic_msg *msgs, uint32_t nmsgs)
sc->name, sc->reg0 & 0xff); sc->name, sc->reg0 & 0xff);
I915_WRITE(GMBUS0 + reg_offset, 0); I915_WRITE(GMBUS0 + reg_offset, 0);
/* /* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */
* Hardware may not support GMBUS over these pins?
* Try GPIO bitbanging instead.
*/
sc->force_bit_dev = true; sc->force_bit_dev = true;
error = -IICBUS_TRANSFER(idev, msgs, nmsgs); error = -IICBUS_TRANSFER(adapter, msgs, num);
goto out;
out: out:
sx_xunlock(&dev_priv->gmbus_sx); sx_xunlock(&dev_priv->gmbus_sx);
return (-error); return -error;
}
device_t
intel_gmbus_get_adapter(struct drm_i915_private *dev_priv,
unsigned port)
{
if (!intel_gmbus_is_port_valid(port))
DRM_ERROR("GMBUS get adapter %d: invalid port\n", port);
return (intel_gmbus_is_port_valid(port) ? dev_priv->gmbus[port - 1] :
NULL);
}
void
intel_gmbus_set_speed(device_t idev, int speed)
{
struct intel_iic_softc *sc;
sc = device_get_softc(device_get_parent(idev));
sc->reg0 = (sc->reg0 & ~(0x3 << 8)) | speed;
}
void
intel_gmbus_force_bit(device_t idev, bool force_bit)
{
struct intel_iic_softc *sc;
sc = device_get_softc(device_get_parent(idev));
sc->force_bit_dev = force_bit;
}
static int
intel_iicbb_pre_xfer(device_t idev)
{
struct intel_iic_softc *sc;
struct drm_i915_private *dev_priv;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
intel_iic_reset(sc->drm_dev);
intel_iic_quirk_set(dev_priv, true);
IICBB_SETSDA(idev, 1);
IICBB_SETSCL(idev, 1);
DELAY(I2C_RISEFALL_TIME);
return (0);
}
static void
intel_iicbb_post_xfer(device_t idev)
{
struct intel_iic_softc *sc;
struct drm_i915_private *dev_priv;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
IICBB_SETSDA(idev, 1);
IICBB_SETSCL(idev, 1);
intel_iic_quirk_set(dev_priv, false);
} }
static int static int
@ -663,7 +590,7 @@ static device_method_t intel_gmbus_methods[] = {
DEVMETHOD(device_attach, intel_gmbus_attach), DEVMETHOD(device_attach, intel_gmbus_attach),
DEVMETHOD(device_detach, intel_gmbus_detach), DEVMETHOD(device_detach, intel_gmbus_detach),
DEVMETHOD(iicbus_reset, intel_iicbus_reset), DEVMETHOD(iicbus_reset, intel_iicbus_reset),
DEVMETHOD(iicbus_transfer, intel_gmbus_transfer), DEVMETHOD(iicbus_transfer, gmbus_xfer),
DEVMETHOD_END DEVMETHOD_END
}; };
static driver_t intel_gmbus_driver = { static driver_t intel_gmbus_driver = {
@ -686,12 +613,12 @@ static device_method_t intel_iicbb_methods[] = {
DEVMETHOD(iicbb_callback, iicbus_null_callback), DEVMETHOD(iicbb_callback, iicbus_null_callback),
DEVMETHOD(iicbb_reset, intel_iicbus_reset), DEVMETHOD(iicbb_reset, intel_iicbus_reset),
DEVMETHOD(iicbb_setsda, intel_iicbb_setsda), DEVMETHOD(iicbb_setsda, set_data),
DEVMETHOD(iicbb_setscl, intel_iicbb_setscl), DEVMETHOD(iicbb_setscl, set_clock),
DEVMETHOD(iicbb_getsda, intel_iicbb_getsda), DEVMETHOD(iicbb_getsda, get_data),
DEVMETHOD(iicbb_getscl, intel_iicbb_getscl), DEVMETHOD(iicbb_getscl, get_clock),
DEVMETHOD(iicbb_pre_xfer, intel_iicbb_pre_xfer), DEVMETHOD(iicbb_pre_xfer, intel_gpio_pre_xfer),
DEVMETHOD(iicbb_post_xfer, intel_iicbb_post_xfer), DEVMETHOD(iicbb_post_xfer, intel_gpio_post_xfer),
DEVMETHOD_END DEVMETHOD_END
}; };
static driver_t intel_iicbb_driver = { static driver_t intel_iicbb_driver = {
@ -704,20 +631,19 @@ DRIVER_MODULE_ORDERED(intel_iicbb, drmn, intel_iicbb_driver,
intel_iicbb_devclass, 0, 0, SI_ORDER_FIRST); intel_iicbb_devclass, 0, 0, SI_ORDER_FIRST);
DRIVER_MODULE(iicbb, intel_iicbb, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, intel_iicbb, iicbb_driver, iicbb_devclass, 0, 0);
int int intel_setup_gmbus(struct drm_device *dev)
intel_setup_gmbus(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv = dev->dev_private;
device_t iic_dev; device_t iic_dev;
int i, ret; int ret, i;
dev_priv = dev->dev_private;
sx_init(&dev_priv->gmbus_sx, "gmbus");
if (HAS_PCH_SPLIT(dev)) if (HAS_PCH_SPLIT(dev))
dev_priv->gpio_mmio_base = PCH_GPIOA - GPIOA; dev_priv->gpio_mmio_base = PCH_GPIOA - GPIOA;
else else
dev_priv->gpio_mmio_base = 0; dev_priv->gpio_mmio_base = 0;
sx_init(&dev_priv->gmbus_sx, "gmbus");
/* /*
* The Giant there is recursed, most likely. Normally, the * The Giant there is recursed, most likely. Normally, the
* intel_setup_gmbus() is called from the attach method of the * intel_setup_gmbus() is called from the attach method of the
@ -786,14 +712,41 @@ intel_setup_gmbus(struct drm_device *dev)
intel_iic_reset(dev); intel_iic_reset(dev);
} }
mtx_unlock(&Giant); mtx_unlock(&Giant);
return (0);
return 0;
err: err:
intel_teardown_gmbus_m(dev, i); intel_teardown_gmbus_m(dev, i);
mtx_unlock(&Giant); mtx_unlock(&Giant);
return (ret); return ret;
}
device_t intel_gmbus_get_adapter(struct drm_i915_private *dev_priv,
unsigned port)
{
if (!intel_gmbus_is_port_valid(port))
DRM_ERROR("GMBUS get adapter %d: invalid port\n", port);
return (intel_gmbus_is_port_valid(port) ? dev_priv->gmbus[port - 1] :
NULL);
}
void intel_gmbus_set_speed(device_t adapter, int speed)
{
struct intel_iic_softc *sc;
sc = device_get_softc(device_get_parent(adapter));
sc->reg0 = (sc->reg0 & ~(0x3 << 8)) | speed;
}
void intel_gmbus_force_bit(device_t adapter, bool force_bit)
{
struct intel_iic_softc *sc;
sc = device_get_softc(device_get_parent(adapter));
sc->force_bit_dev = force_bit;
} }
static void static void
@ -806,8 +759,7 @@ intel_teardown_gmbus_m(struct drm_device *dev, int m)
sx_destroy(&dev_priv->gmbus_sx); sx_destroy(&dev_priv->gmbus_sx);
} }
void void intel_teardown_gmbus(struct drm_device *dev)
intel_teardown_gmbus(struct drm_device *dev)
{ {
mtx_lock(&Giant); mtx_lock(&Giant);

View File

@ -468,9 +468,9 @@ parse_dir_ask(char **conf)
printf("\n"); printf("\n");
printf(" eg. ufs:/dev/da0s1a\n"); printf(" eg. ufs:/dev/da0s1a\n");
printf(" zfs:tank\n"); printf(" zfs:tank\n");
printf(" cd9660:/dev/acd0 ro\n"); printf(" cd9660:/dev/cd0 ro\n");
printf(" (which is equivalent to: "); printf(" (which is equivalent to: ");
printf("mount -t cd9660 -o ro /dev/acd0 /)\n"); printf("mount -t cd9660 -o ro /dev/cd0 /)\n");
printf("\n"); printf("\n");
printf(" ? List valid disk boot devices\n"); printf(" ? List valid disk boot devices\n");
printf(" . Yield 1 second (for background tasks)\n"); printf(" . Yield 1 second (for background tasks)\n");
@ -837,7 +837,7 @@ vfs_mountroot_conf0(struct sbuf *sb)
if (boothowto & RB_CDROM) { if (boothowto & RB_CDROM) {
sbuf_printf(sb, "cd9660:/dev/cd0 ro\n"); sbuf_printf(sb, "cd9660:/dev/cd0 ro\n");
sbuf_printf(sb, ".timeout 0\n"); sbuf_printf(sb, ".timeout 0\n");
sbuf_printf(sb, "cd9660:/dev/acd0 ro\n"); sbuf_printf(sb, "cd9660:/dev/cd1 ro\n");
sbuf_printf(sb, ".timeout %d\n", root_mount_timeout); sbuf_printf(sb, ".timeout %d\n", root_mount_timeout);
} }
s = kern_getenv("vfs.root.mountfrom"); s = kern_getenv("vfs.root.mountfrom");

View File

@ -931,13 +931,6 @@ rt_flushifroutes(struct ifnet *ifp)
#define ifpaddr info->rti_info[RTAX_IFP] #define ifpaddr info->rti_info[RTAX_IFP]
#define flags info->rti_flags #define flags info->rti_flags
int
rt_getifa(struct rt_addrinfo *info)
{
return (rt_getifa_fib(info, RT_DEFAULT_FIB));
}
/* /*
* Look up rt_addrinfo for a specific fib. Note that if rti_ifa is defined, * Look up rt_addrinfo for a specific fib. Note that if rti_ifa is defined,
* it will be referenced so the caller must free it. * it will be referenced so the caller must free it.

View File

@ -387,7 +387,6 @@ void rt_flushifroutes(struct ifnet *ifp);
/* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */ /* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */
/* Thes are used by old code not yet converted to use multiple FIBS */ /* Thes are used by old code not yet converted to use multiple FIBS */
int rt_getifa(struct rt_addrinfo *);
void rtalloc_ign(struct route *ro, u_long ignflags); void rtalloc_ign(struct route *ro, u_long ignflags);
void rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */ void rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */
struct rtentry *rtalloc1(struct sockaddr *, int, u_long); struct rtentry *rtalloc1(struct sockaddr *, int, u_long);

View File

@ -228,19 +228,6 @@ in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum)
rtalloc_ign_fib(ro, ignflags, fibnum); rtalloc_ign_fib(ro, ignflags, fibnum);
} }
int
in_rtrequest( int req,
struct sockaddr *dst,
struct sockaddr *gateway,
struct sockaddr *netmask,
int flags,
struct rtentry **ret_nrt,
u_int fibnum)
{
return (rtrequest_fib(req, dst, gateway, netmask,
flags, ret_nrt, fibnum));
}
struct rtentry * struct rtentry *
in_rtalloc1(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum) in_rtalloc1(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum)
{ {
@ -264,10 +251,3 @@ in_rtalloc(struct route *ro, u_int fibnum)
rtalloc_ign_fib(ro, 0UL, fibnum); rtalloc_ign_fib(ro, 0UL, fibnum);
} }
#if 0
int in_rt_getifa(struct rt_addrinfo *, u_int fibnum);
int in_rtioctl(u_long, caddr_t, u_int);
int in_rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int);
#endif

View File

@ -391,8 +391,6 @@ void in_rtalloc(struct route *ro, u_int fibnum);
struct rtentry *in_rtalloc1(struct sockaddr *, int, u_long, u_int); struct rtentry *in_rtalloc1(struct sockaddr *, int, u_long, u_int);
void in_rtredirect(struct sockaddr *, struct sockaddr *, void in_rtredirect(struct sockaddr *, struct sockaddr *,
struct sockaddr *, int, struct sockaddr *, u_int); struct sockaddr *, int, struct sockaddr *, u_int);
int in_rtrequest(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
#endif /* _KERNEL */ #endif /* _KERNEL */
/* INET6 stuff */ /* INET6 stuff */

View File

@ -1006,7 +1006,8 @@ add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr,
bpage->busaddr |= addr & PAGE_MASK; bpage->busaddr |= addr & PAGE_MASK;
} }
bpage->datavaddr = vaddr; bpage->datavaddr = vaddr;
bpage->datapage = PHYS_TO_VM_PAGE(addr & ~PAGE_MASK); /* PHYS_TO_VM_PAGE() will truncate unaligned addresses. */
bpage->datapage = PHYS_TO_VM_PAGE(addr);
bpage->dataoffs = addr & PAGE_MASK; bpage->dataoffs = addr & PAGE_MASK;
bpage->datacount = size; bpage->datacount = size;
STAILQ_INSERT_TAIL(&(map->bpages), bpage, links); STAILQ_INSERT_TAIL(&(map->bpages), bpage, links);

View File

@ -27,7 +27,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd September 12, 2014 .Dd October 17, 2015
.Dt ISCSICTL 8 .Dt ISCSICTL 8
.Os .Os
.Sh NAME .Sh NAME
@ -36,7 +36,9 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Fl A .Fl A
.Fl p Ar portal Fl t Ar target Op Fl u Ar user Fl s Ar secret .Fl p Ar portal Fl t Ar target
.Op Fl u Ar user Fl s Ar secret
.Op Fl w Ar timeout
.Nm .Nm
.Fl A .Fl A
.Fl d Ar discovery-host Op Fl u Ar user Fl s Ar secret .Fl d Ar discovery-host Op Fl u Ar user Fl s Ar secret
@ -70,6 +72,7 @@
.Nm .Nm
.Fl L .Fl L
.Op Fl v .Op Fl v
.Op Fl w Ar timeout
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Nm .Nm
@ -113,6 +116,10 @@ Target name.
CHAP login. CHAP login.
.It Fl v .It Fl v
Verbose mode. Verbose mode.
.It Fl w
Instead of returning immediately, wait up to
.Ar timeout
seconds until all configured sessions are successfully established.
.El .El
.Pp .Pp
Certain parameters are necessary when adding a session. Certain parameters are necessary when adding a session.
@ -132,9 +139,11 @@ via configuration file.
.Pp .Pp
Since connecting to the target is performed in background, non-zero Since connecting to the target is performed in background, non-zero
exit status does not mean that the session was successfully established. exit status does not mean that the session was successfully established.
Use Use either
.Nm Fl L .Nm Fl L
to check the connection status. to check the connection status, or the
.Fl w
flag to wait for session establishment.
.Pp .Pp
Note that in order for the iSCSI initiator to be able to connect to a target, Note that in order for the iSCSI initiator to be able to connect to a target,
the the

View File

@ -592,12 +592,68 @@ kernel_list(int iscsi_fd, const struct target *targ __unused,
return (0); return (0);
} }
static int
kernel_wait(int iscsi_fd, int timeout)
{
struct iscsi_session_state *states = NULL;
const struct iscsi_session_state *state;
struct iscsi_session_list isl;
unsigned int i, nentries = 1;
bool all_connected;
int error;
for (;;) {
for (;;) {
states = realloc(states,
nentries * sizeof(struct iscsi_session_state));
if (states == NULL)
xo_err(1, "realloc");
memset(&isl, 0, sizeof(isl));
isl.isl_nentries = nentries;
isl.isl_pstates = states;
error = ioctl(iscsi_fd, ISCSISLIST, &isl);
if (error != 0 && errno == EMSGSIZE) {
nentries *= 4;
continue;
}
break;
}
if (error != 0) {
xo_warn("ISCSISLIST");
return (error);
}
all_connected = true;
for (i = 0; i < isl.isl_nentries; i++) {
state = &states[i];
if (!state->iss_connected) {
all_connected = false;
break;
}
}
if (all_connected)
return (0);
sleep(1);
if (timeout > 0) {
timeout--;
if (timeout == 0)
return (1);
}
}
}
static void static void
usage(void) usage(void)
{ {
fprintf(stderr, "usage: iscsictl -A -p portal -t target " fprintf(stderr, "usage: iscsictl -A -p portal -t target "
"[-u user -s secret]\n"); "[-u user -s secret] [-w timeout]\n");
fprintf(stderr, " iscsictl -A -d discovery-host " fprintf(stderr, " iscsictl -A -d discovery-host "
"[-u user -s secret]\n"); "[-u user -s secret]\n");
fprintf(stderr, " iscsictl -A -a [-c path]\n"); fprintf(stderr, " iscsictl -A -a [-c path]\n");
@ -609,7 +665,7 @@ usage(void)
fprintf(stderr, " iscsictl -R [-p portal] [-t target]\n"); fprintf(stderr, " iscsictl -R [-p portal] [-t target]\n");
fprintf(stderr, " iscsictl -R -a\n"); fprintf(stderr, " iscsictl -R -a\n");
fprintf(stderr, " iscsictl -R -n nickname [-c path]\n"); fprintf(stderr, " iscsictl -R -n nickname [-c path]\n");
fprintf(stderr, " iscsictl -L [-v]\n"); fprintf(stderr, " iscsictl -L [-v] [-w timeout]\n");
exit(1); exit(1);
} }
@ -631,6 +687,7 @@ main(int argc, char **argv)
const char *conf_path = DEFAULT_CONFIG_PATH; const char *conf_path = DEFAULT_CONFIG_PATH;
char *nickname = NULL, *discovery_host = NULL, *portal = NULL, char *nickname = NULL, *discovery_host = NULL, *portal = NULL,
*target = NULL, *user = NULL, *secret = NULL; *target = NULL, *user = NULL, *secret = NULL;
int timeout = -1;
long long session_id = -1; long long session_id = -1;
char *end; char *end;
int ch, error, iscsi_fd, retval, saved_errno; int ch, error, iscsi_fd, retval, saved_errno;
@ -641,7 +698,7 @@ main(int argc, char **argv)
argc = xo_parse_args(argc, argv); argc = xo_parse_args(argc, argv);
xo_open_container("iscsictl"); xo_open_container("iscsictl");
while ((ch = getopt(argc, argv, "AMRLac:d:i:n:p:t:u:s:v")) != -1) { while ((ch = getopt(argc, argv, "AMRLac:d:i:n:p:t:u:s:vw:")) != -1) {
switch (ch) { switch (ch) {
case 'A': case 'A':
Aflag = 1; Aflag = 1;
@ -692,6 +749,13 @@ main(int argc, char **argv)
case 'v': case 'v':
vflag = 1; vflag = 1;
break; break;
case 'w':
timeout = strtol(optarg, &end, 10);
if ((size_t)(end - optarg) != strlen(optarg))
xo_errx(1, "trailing characters after timeout");
if (timeout < 0)
xo_errx(1, "timeout cannot be negative");
break;
case '?': case '?':
default: default:
usage(); usage();
@ -782,6 +846,8 @@ main(int argc, char **argv)
if (vflag != 0) if (vflag != 0)
xo_errx(1, "-v cannot be used with -M"); xo_errx(1, "-v cannot be used with -M");
if (timeout != -1)
xo_errx(1, "-w cannot be used with -M");
} else if (Rflag != 0) { } else if (Rflag != 0) {
if (user != NULL) if (user != NULL)
@ -811,6 +877,8 @@ main(int argc, char **argv)
xo_errx(1, "-i cannot be used with -R"); xo_errx(1, "-i cannot be used with -R");
if (vflag != 0) if (vflag != 0)
xo_errx(1, "-v cannot be used with -R"); xo_errx(1, "-v cannot be used with -R");
if (timeout != -1)
xo_errx(1, "-w cannot be used with -R");
} else { } else {
assert(Lflag != 0); assert(Lflag != 0);
@ -896,6 +964,9 @@ main(int argc, char **argv)
failed += kernel_list(iscsi_fd, targ, vflag); failed += kernel_list(iscsi_fd, targ, vflag);
} }
if (timeout != -1)
failed += kernel_wait(iscsi_fd, timeout);
error = close(iscsi_fd); error = close(iscsi_fd);
if (error != 0) if (error != 0)
xo_err(1, "close"); xo_err(1, "close");