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.
#
.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
.endif
${TGTS}: .PHONY
${TGTS}: .PHONY .MAKE
${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
# 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
.endif
.if ${MK_CDDL} == "no"
WMAKEENV+= MK_CTF=no
.endif
.if defined(CROSS_TOOLCHAIN)
LOCALBASE?= /usr/local
.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
@ -624,7 +620,8 @@ _includes:
@echo "--------------------------------------------------------------"
@echo ">>> stage 4.1: building includes"
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks buildincludes
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks installincludes
_libraries:
@echo
@echo "--------------------------------------------------------------"
@ -2268,7 +2265,9 @@ _xi-cross-tools:
.endfor
_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}
_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
"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:
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

View File

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

View File

@ -30,7 +30,7 @@
.\" @(#)ffs.3 8.2 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
.Dd September 29, 2012
.Dd October 17, 2015
.Dt FFS 3
.Os
.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
argument was zero.
.Sh SEE ALSO
.Xr bitstring 3
.Xr bitstring 3 ,
.Xr bitset 9
.Sh HISTORY
The
.Fn ffs

View File

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

View File

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

View File

@ -26,7 +26,7 @@
.\" $FreeBSD$
.\"
.\"
.Dd July 7, 2013
.Dd October 17, 2013
.Dt MOUNT.CONF 8
.Os
.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
.Pa /dev/cd0 ,
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
.Pa /dev/ada0s1a .
If that does not work, a
@ -167,7 +167,7 @@ Finally if that does not work, the kernel will panic.
.Li .timeout 3
cd9660:/dev/cd0 ro
.Li .timeout 0
cd9660:/dev/acd0 ro
cd9660:/dev/cd1 ro
.Li .timeout 3
ufs:/dev/ada0s1a
.Li .ask

View File

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

View File

@ -11,6 +11,7 @@ MAN= accept_filter.9 \
altq.9 \
atomic.9 \
bios.9 \
bitset.9 \
boot.9 \
bpf.9 \
buf.9 \
@ -429,6 +430,32 @@ MLINKS+=atomic.9 atomic_add.9 \
atomic.9 atomic_subtract.9 \
atomic.9 atomic_swap.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 \
bpf.9 bpfattach2.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" && \
${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.
SSP_CFLAGS?= -fstack-protector-strong
CFLAGS+= ${SSP_CFLAGS}
.endif
.endif # SSP && !ARM && !MIPS
# Allow user-specified additional warning flags, plus compiler specific flag overrides.

View File

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

View File

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

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
*/
ENTRY(copyio_fault)
SET_FAULT_HANDLER(xzr, x1) /* Clear the handler */
copyio_fault_nopcb:
mov x0, #EFAULT
ret
END(copyio_fault)
@ -51,6 +52,10 @@ END(copyio_fault)
*/
ENTRY(copyout)
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 */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */
@ -73,6 +78,10 @@ END(copyout)
*/
ENTRY(copyin)
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 */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */
@ -97,11 +106,14 @@ ENTRY(copyinstr)
mov x5, xzr /* count = 0 */
mov w4, #1 /* If zero return faulure */
cbz x2, 3f /* If len == 0 then skip loop */
ldr x7, =VM_MAXUSER_ADDRESS
adr x6, copyio_fault /* Get the handler address */
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 */
add x5, x5, #1 /* count++ */
cbz w4, 2f /* Break when NUL-terminated */

View File

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

View File

@ -357,7 +357,7 @@ create_pagetables:
mov x7, #NORMAL_MEM
mov x8, #(KERNBASE & L2_BLOCK_MASK)
mov x9, x28
bl build_block_pagetable
bl build_l2_block_pagetable
/* Move to the l1 table */
add x26, x26, #PAGE_SIZE
@ -379,7 +379,8 @@ create_pagetables:
mov x7, #DEVICE_MEM
mov x8, #(SOCDEV_VA) /* VA start */
mov x9, #(SOCDEV_PA) /* PA start */
bl build_section_pagetable
mov x10, #1
bl build_l1_block_pagetable
#endif
/* Create the VA = PA map */
@ -387,47 +388,18 @@ create_pagetables:
mov x7, #NORMAL_UNCACHED /* Uncached as it's only needed early on */
mov x9, x27
mov x8, x9 /* VA start (== PA start) */
bl build_section_pagetable
mov x10, #1
bl build_l1_block_pagetable
/* Restore the Link register */
mov x30, x5
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
*
* 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
* x8 = Virtual Address
@ -454,6 +426,50 @@ link_l1_pagetable:
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
* x6 = L2 table
@ -463,7 +479,7 @@ link_l1_pagetable:
* x10 = Entry count (TODO)
* x11, x12 and x13 are trashed
*/
build_block_pagetable:
build_l2_block_pagetable:
/*
* Build the L2 table entry.
*/

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
*/
ENTRY(fsu_fault)
SET_FAULT_HANDLER(xzr, x1) /* Reset the handler function */
fsu_fault_nopcb:
mov x0, #-1
ret
END(fsu_fault)
@ -49,6 +50,9 @@ END(fsu_fault)
* int casueword32(volatile uint32_t *, uint32_t, uint32_t *, uint32_t)
*/
ENTRY(casueword32)
ldr x4, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x4
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x4) /* And set it */
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)
*/
ENTRY(casueword)
ldr x4, =(VM_MAXUSER_ADDRESS-7)
cmp x0, x4
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x4) /* And set it */
1: ldxr x4, [x0] /* Load-exclusive the data */
@ -85,6 +92,9 @@ END(casueword)
* int fubyte(volatile const void *)
*/
ENTRY(fubyte)
ldr x1, =VM_MAXUSER_ADDRESS
cmp x0, x1
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x1) /* And set it */
ldrb w0, [x0] /* Try loading the data */
@ -96,6 +106,9 @@ END(fubyte)
* int fuword(volatile const void *)
*/
ENTRY(fuword16)
ldr x1, =(VM_MAXUSER_ADDRESS-1)
cmp x0, x1
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x1) /* And set it */
ldrh w0, [x0] /* Try loading the data */
@ -107,6 +120,9 @@ END(fuword16)
* int32_t fueword32(volatile const void *, int32_t *)
*/
ENTRY(fueword32)
ldr x2, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */
ldr w0, [x0] /* Try loading the data */
@ -122,6 +138,9 @@ END(fueword32)
*/
ENTRY(fueword)
EENTRY(fueword64)
ldr x2, =(VM_MAXUSER_ADDRESS-7)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */
ldr x0, [x0] /* Try loading the data */
@ -136,6 +155,9 @@ END(fueword)
* int subyte(volatile void *, int)
*/
ENTRY(subyte)
ldr x2, =VM_MAXUSER_ADDRESS
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */
strb w1, [x0] /* Try storing the data */
@ -148,6 +170,9 @@ END(subyte)
* int suword16(volatile void *, int)
*/
ENTRY(suword16)
ldr x2, =(VM_MAXUSER_ADDRESS-1)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */
strh w1, [x0] /* Try storing the data */
@ -160,6 +185,9 @@ END(suword16)
* int suword32(volatile void *, int)
*/
ENTRY(suword32)
ldr x2, =(VM_MAXUSER_ADDRESS-3)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */
str w1, [x0] /* Try storing the data */
@ -173,6 +201,9 @@ END(suword32)
*/
ENTRY(suword)
EENTRY(suword64)
ldr x2, =(VM_MAXUSER_ADDRESS-7)
cmp x0, x2
b.cs fsu_fault_nopcb
adr x6, fsu_fault /* Load the fault handler */
SET_FAULT_HANDLER(x6, x2) /* And set it */
str x1, [x0] /* Try storing the data */
@ -201,6 +232,9 @@ END(fsu_fault)
* int fuswintr(void *)
*/
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 */
SET_FAULT_HANDLER(x6, x1) /* And set it */
ldr w0, [x0] /* Try loading the data */
@ -212,6 +246,9 @@ END(fuswintr)
* int suswintr(void *base, int word)
*/
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 */
SET_FAULT_HANDLER(x6, x2) /* And set it */
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
intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte,
uint8_t *read_byte)
intel_dp_i2c_aux_ch(device_t adapter, int mode,
uint8_t write_byte, uint8_t *read_byte)
{
struct iic_dp_aux_data *data;
struct intel_dp *intel_dp;
uint16_t address;
struct iic_dp_aux_data *data = device_get_softc(adapter);
struct intel_dp *intel_dp = data->priv;
uint16_t address = data->address;
uint8_t msg[5];
uint8_t reply[2];
unsigned retry;
@ -568,10 +568,6 @@ intel_dp_i2c_aux_ch(device_t idev, int mode, uint8_t write_byte,
int reply_bytes;
int ret;
data = device_get_softc(idev);
intel_dp = data->priv;
address = data->address;
intel_dp_check_edp(intel_dp);
/* Set up the command byte */
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);
if (ret < 0) {
DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
return (ret);
return ret;
}
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;
case AUX_NATIVE_REPLY_NACK:
DRM_DEBUG_KMS("aux_ch native nack\n");
return (-EREMOTEIO);
return -EREMOTEIO;
case AUX_NATIVE_REPLY_DEFER:
DELAY(100);
continue;
default:
DRM_ERROR("aux_ch invalid native reply 0x%02x\n",
reply[0]);
return (-EREMOTEIO);
return -EREMOTEIO;
}
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*/);
case AUX_I2C_REPLY_NACK:
DRM_DEBUG_KMS("aux_i2c nack\n");
return (-EREMOTEIO);
return -EREMOTEIO;
case AUX_I2C_REPLY_DEFER:
DRM_DEBUG_KMS("aux_i2c defer\n");
DELAY(100);
break;
default:
DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]);
return (-EREMOTEIO);
return -EREMOTEIO;
}
}
DRM_ERROR("too many retries, giving up\n");
return (-EREMOTEIO);
return -EREMOTEIO;
}
static void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp);
@ -660,7 +656,7 @@ static int
intel_dp_i2c_init(struct intel_dp *intel_dp,
struct intel_connector *intel_connector, const char *name)
{
int ret;
int ret;
DRM_DEBUG_KMS("i2c_init %s\n", name);
@ -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->adapter);
ironlake_edp_panel_vdd_off(intel_dp, false);
return (ret);
return ret;
}
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_CONTROL));
if (_intel_wait_for(dev,
(I915_READ(PCH_PP_STATUS) & mask) == value, 5000, 10, "915iwp")) {
if (_intel_wait_for(dev, (I915_READ(PCH_PP_STATUS) & mask) == value, 5000, 10, "915iwp")) {
DRM_ERROR("Panel status timeout: status %08x control %08x\n",
I915_READ(PCH_PP_STATUS),
I915_READ(PCH_PP_CONTROL));

View File

@ -96,51 +96,10 @@ struct intel_iic_softc {
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
intel_iic_reset(struct drm_device *dev)
{
struct drm_i915_private *dev_priv;
dev_priv = dev->dev_private;
struct drm_i915_private *dev_priv = dev->dev_private;
I915_WRITE(dev_priv->gpio_mmio_base + GMBUS0, 0);
}
@ -157,86 +116,119 @@ intel_iicbus_reset(device_t idev, u_char speed, u_char addr, u_char *oldaddr)
return (0);
}
static void
intel_iicbb_setsda(device_t idev, int val)
static void intel_i2c_quirk_set(struct drm_i915_private *dev_priv, bool enable)
{
struct intel_iic_softc *sc;
struct drm_i915_private *dev_priv;
u32 reserved;
u32 data_bits;
u32 val;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
/* When using bit bashing for I2C, this bit needs to be set to 1 */
if (!IS_PINEVIEW(dev_priv->dev))
return;
reserved = intel_iic_get_reserved(idev);
if (val)
data_bits = GPIO_DATA_DIR_IN | GPIO_DATA_DIR_MASK;
val = I915_READ(DSPCLK_GATE_D);
if (enable)
val |= DPCUNIT_CLOCK_GATE_DISABLE;
else
data_bits = GPIO_DATA_DIR_OUT | GPIO_DATA_DIR_MASK |
GPIO_DATA_VAL_MASK;
I915_WRITE_NOTRACE(sc->reg, reserved | data_bits);
POSTING_READ(sc->reg);
val &= ~DPCUNIT_CLOCK_GATE_DISABLE;
I915_WRITE(DSPCLK_GATE_D, val);
}
static void
intel_iicbb_setscl(device_t idev, int val)
static u32 get_reserved(device_t idev)
{
struct intel_iic_softc *sc;
struct drm_i915_private *dev_priv;
u32 clock_bits, reserved;
struct intel_iic_softc *sc = device_get_softc(idev);
struct drm_device *dev = sc->drm_dev;
struct drm_i915_private *dev_priv = dev->dev_private;
u32 reserved = 0;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
if (!IS_I830(dev) && !IS_845G(dev))
reserved = I915_READ_NOTRACE(sc->reg) &
(GPIO_DATA_PULLUP_DISABLE |
GPIO_CLOCK_PULLUP_DISABLE);
reserved = intel_iic_get_reserved(idev);
if (val)
clock_bits = GPIO_CLOCK_DIR_IN | GPIO_CLOCK_DIR_MASK;
else
clock_bits = GPIO_CLOCK_DIR_OUT | GPIO_CLOCK_DIR_MASK |
GPIO_CLOCK_VAL_MASK;
I915_WRITE_NOTRACE(sc->reg, reserved | clock_bits);
POSTING_READ(sc->reg);
return reserved;
}
static int
intel_iicbb_getsda(device_t idev)
static int get_clock(device_t adapter)
{
struct intel_iic_softc *sc;
struct drm_i915_private *dev_priv;
u32 reserved;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
reserved = intel_iic_get_reserved(idev);
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
intel_iicbb_getscl(device_t idev)
{
struct intel_iic_softc *sc;
struct drm_i915_private *dev_priv;
u32 reserved;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
reserved = intel_iic_get_reserved(idev);
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;
else
clock_bits = GPIO_CLOCK_DIR_OUT | GPIO_CLOCK_DIR_MASK |
GPIO_CLOCK_VAL_MASK;
I915_WRITE_NOTRACE(sc->reg, reserved | clock_bits);
POSTING_READ(sc->reg);
}
static void set_data(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 data_bits;
if (state_high)
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;
I915_WRITE_NOTRACE(sc->reg, reserved | data_bits);
POSTING_READ(sc->reg);
}
static int
intel_gpio_pre_xfer(device_t adapter)
{
struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
intel_iic_reset(sc->drm_dev);
intel_i2c_quirk_set(dev_priv, true);
IICBB_SETSDA(adapter, 1);
IICBB_SETSCL(adapter, 1);
DELAY(I2C_RISEFALL_TIME);
return 0;
}
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;
IICBB_SETSDA(adapter, 1);
IICBB_SETSCL(adapter, 1);
intel_i2c_quirk_set(dev_priv, false);
}
static int
gmbus_xfer_read(struct drm_i915_private *dev_priv, struct iic_msg *msg,
u32 gmbus1_index)
u32 gmbus1_index)
{
int reg_offset = dev_priv->gpio_mmio_base;
u16 len = msg->len;
@ -254,19 +246,19 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct iic_msg *msg,
u32 gmbus2;
ret = _intel_wait_for(sc->drm_dev,
((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_RDY)),
50, 1, "915gbr");
((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_RDY)),
50, 1, "915gbr");
if (ret)
return (-ETIMEDOUT);
return -ETIMEDOUT;
if (gmbus2 & GMBUS_SATOER)
return (-ENXIO);
return -ENXIO;
val = I915_READ(GMBUS3 + reg_offset);
do {
*buf++ = val & 0xff;
val >>= 8;
} while (--len != 0 && ++loop < 4);
} while (--len && ++loop < 4);
}
return 0;
@ -299,18 +291,18 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct iic_msg *msg)
val = loop = 0;
do {
val |= *buf++ << (8 * loop);
} while (--len != 0 && ++loop < 4);
} while (--len && ++loop < 4);
I915_WRITE(GMBUS3 + reg_offset, val);
ret = _intel_wait_for(sc->drm_dev,
((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_RDY)),
50, 1, "915gbw");
((gmbus2 = I915_READ(GMBUS2 + reg_offset)) &
(GMBUS_SATOER | GMBUS_HW_RDY)),
50, 1, "915gbw");
if (ret)
return (-ETIMEDOUT);
return -ETIMEDOUT;
if (gmbus2 & GMBUS_SATOER)
return (-ENXIO);
return -ENXIO;
}
return 0;
}
@ -356,20 +348,20 @@ gmbus_xfer_index_read(struct drm_i915_private *dev_priv, struct iic_msg *msgs)
}
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 drm_i915_private *dev_priv;
struct intel_iic_softc *sc = device_get_softc(adapter);
struct drm_i915_private *dev_priv = sc->drm_dev->dev_private;
int error, i, ret, reg_offset, unit;
error = 0;
sc = device_get_softc(idev);
dev_priv = sc->drm_dev->dev_private;
unit = device_get_unit(idev);
unit = device_get_unit(adapter);
sx_xlock(&dev_priv->gmbus_sx);
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;
}
@ -377,10 +369,10 @@ intel_gmbus_transfer(device_t idev, struct iic_msg *msgs, uint32_t nmsgs)
I915_WRITE(GMBUS0 + reg_offset, sc->reg0);
for (i = 0; i < nmsgs; i++) {
for (i = 0; i < num; i++) {
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]);
i += 1; /* set i to the index of the read xfer */
} else if (msgs[i].flags & IIC_M_RD) {
@ -413,12 +405,12 @@ intel_gmbus_transfer(device_t idev, struct iic_msg *msgs, uint32_t nmsgs)
/* Mark the GMBUS interface as disabled after waiting for idle.
* We will re-enable it at the start of the next xfer,
* till then let it sleep.
*/
*/
if (_intel_wait_for(dev,
(I915_READ(GMBUS2 + reg_offset) & GMBUS_ACTIVE) == 0,
10, 1, "915gbu")) {
DRM_DEBUG_KMS("GMBUS [%s] timed out waiting for idle\n",
sc->name);
sc->name);
error = -ETIMEDOUT;
}
I915_WRITE(GMBUS0 + reg_offset, 0);
@ -459,81 +451,16 @@ intel_gmbus_transfer(device_t idev, struct iic_msg *msgs, uint32_t nmsgs)
timeout:
DRM_INFO("GMBUS [%s] timed out, falling back to bit banging on pin %d\n",
sc->name, sc->reg0 & 0xff);
sc->name, sc->reg0 & 0xff);
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;
error = -IICBUS_TRANSFER(idev, msgs, nmsgs);
goto out;
error = -IICBUS_TRANSFER(adapter, msgs, num);
out:
sx_xunlock(&dev_priv->gmbus_sx);
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);
return -error;
}
static int
@ -663,7 +590,7 @@ static device_method_t intel_gmbus_methods[] = {
DEVMETHOD(device_attach, intel_gmbus_attach),
DEVMETHOD(device_detach, intel_gmbus_detach),
DEVMETHOD(iicbus_reset, intel_iicbus_reset),
DEVMETHOD(iicbus_transfer, intel_gmbus_transfer),
DEVMETHOD(iicbus_transfer, gmbus_xfer),
DEVMETHOD_END
};
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_reset, intel_iicbus_reset),
DEVMETHOD(iicbb_setsda, intel_iicbb_setsda),
DEVMETHOD(iicbb_setscl, intel_iicbb_setscl),
DEVMETHOD(iicbb_getsda, intel_iicbb_getsda),
DEVMETHOD(iicbb_getscl, intel_iicbb_getscl),
DEVMETHOD(iicbb_pre_xfer, intel_iicbb_pre_xfer),
DEVMETHOD(iicbb_post_xfer, intel_iicbb_post_xfer),
DEVMETHOD(iicbb_setsda, set_data),
DEVMETHOD(iicbb_setscl, set_clock),
DEVMETHOD(iicbb_getsda, get_data),
DEVMETHOD(iicbb_getscl, get_clock),
DEVMETHOD(iicbb_pre_xfer, intel_gpio_pre_xfer),
DEVMETHOD(iicbb_post_xfer, intel_gpio_post_xfer),
DEVMETHOD_END
};
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);
DRIVER_MODULE(iicbb, intel_iicbb, iicbb_driver, iicbb_devclass, 0, 0);
int
intel_setup_gmbus(struct drm_device *dev)
int 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;
int i, ret;
int ret, i;
dev_priv = dev->dev_private;
sx_init(&dev_priv->gmbus_sx, "gmbus");
if (HAS_PCH_SPLIT(dev))
dev_priv->gpio_mmio_base = PCH_GPIOA - GPIOA;
else
dev_priv->gpio_mmio_base = 0;
sx_init(&dev_priv->gmbus_sx, "gmbus");
/*
* The Giant there is recursed, most likely. Normally, 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);
}
mtx_unlock(&Giant);
return (0);
return 0;
err:
intel_teardown_gmbus_m(dev, i);
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
@ -806,8 +759,7 @@ intel_teardown_gmbus_m(struct drm_device *dev, int m)
sx_destroy(&dev_priv->gmbus_sx);
}
void
intel_teardown_gmbus(struct drm_device *dev)
void intel_teardown_gmbus(struct drm_device *dev)
{
mtx_lock(&Giant);

View File

@ -468,9 +468,9 @@ parse_dir_ask(char **conf)
printf("\n");
printf(" eg. ufs:/dev/da0s1a\n");
printf(" zfs:tank\n");
printf(" cd9660:/dev/acd0 ro\n");
printf(" cd9660:/dev/cd0 ro\n");
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(" ? List valid disk boot devices\n");
printf(" . Yield 1 second (for background tasks)\n");
@ -837,7 +837,7 @@ vfs_mountroot_conf0(struct sbuf *sb)
if (boothowto & RB_CDROM) {
sbuf_printf(sb, "cd9660:/dev/cd0 ro\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);
}
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 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,
* 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 */
/* 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(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */
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);
}
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 *
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);
}
#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);
void in_rtredirect(struct sockaddr *, struct sockaddr *,
struct sockaddr *, int, struct sockaddr *, u_int);
int in_rtrequest(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
#endif /* _KERNEL */
/* 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->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->datacount = size;
STAILQ_INSERT_TAIL(&(map->bpages), bpage, links);

View File

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

View File

@ -592,12 +592,68 @@ kernel_list(int iscsi_fd, const struct target *targ __unused,
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
usage(void)
{
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 "
"[-u user -s secret]\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 -a\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);
}
@ -631,6 +687,7 @@ main(int argc, char **argv)
const char *conf_path = DEFAULT_CONFIG_PATH;
char *nickname = NULL, *discovery_host = NULL, *portal = NULL,
*target = NULL, *user = NULL, *secret = NULL;
int timeout = -1;
long long session_id = -1;
char *end;
int ch, error, iscsi_fd, retval, saved_errno;
@ -641,7 +698,7 @@ main(int argc, char **argv)
argc = xo_parse_args(argc, argv);
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) {
case 'A':
Aflag = 1;
@ -692,6 +749,13 @@ main(int argc, char **argv)
case 'v':
vflag = 1;
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 '?':
default:
usage();
@ -782,6 +846,8 @@ main(int argc, char **argv)
if (vflag != 0)
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) {
if (user != NULL)
@ -811,6 +877,8 @@ main(int argc, char **argv)
xo_errx(1, "-i cannot be used with -R");
if (vflag != 0)
xo_errx(1, "-v cannot be used with -R");
if (timeout != -1)
xo_errx(1, "-w cannot be used with -R");
} else {
assert(Lflag != 0);
@ -896,6 +964,9 @@ main(int argc, char **argv)
failed += kernel_list(iscsi_fd, targ, vflag);
}
if (timeout != -1)
failed += kernel_wait(iscsi_fd, timeout);
error = close(iscsi_fd);
if (error != 0)
xo_err(1, "close");