svn commit: r263983 - head

2014-04-01 Thread Baptiste Daroussin
Author: bapt
Date: Tue Apr  1 06:46:59 2014
New Revision: 263983
URL: http://svnweb.freebsd.org/changeset/base/263983

Log:
  Ensure make xdev respect which compiler is CC
  and which compilers should be built according to standard build options

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Apr  1 04:56:40 2014(r263982)
+++ head/Makefile.inc1  Tue Apr  1 06:46:59 2014(r263983)
@@ -1919,11 +1919,11 @@ _xb-build-tools:
 
 _xb-cross-tools:
 .for _tool in \
-gnu/usr.bin/binutils \
-gnu/usr.bin/cc \
+${_binutils} \
 usr.bin/ar \
 ${_clang_libs} \
-${_clang}
+${_clang} \
+${_cc}
${_+_}@${ECHODIR} === xdev ${_tool} (obj,depend,all); \
cd ${.CURDIR}/${_tool}  \
${CDMAKE} DIRPRFX=${_tool}/ obj  \
@@ -1947,10 +1947,11 @@ xdev-install: xdev-build _xi-mtree _xi-c
 _xi-cross-tools:
@echo _xi-cross-tools
 .for _tool in \
-gnu/usr.bin/binutils \
-gnu/usr.bin/cc \
+${_binutils} \
 usr.bin/ar \
-${_clang}
+${_clang_libs} \
+${_clang} \
+${_cc}
${_+_}@${ECHODIR} === xdev ${_tool} (install); \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r263978 - head/sys/cam/ctl

2014-04-01 Thread Kubilay Kocak
On 1/04/2014 7:49 AM, Edward Tomasz Napierala wrote:
 Author: trasz
 Date: Mon Mar 31 20:49:33 2014
 New Revision: 263978
 URL: http://svnweb.freebsd.org/changeset/base/263978
 
 Log:
   Make it possible to have multiple CTL worker threads.  Leave the default
   of 1 for now.
   
   Sponsored by:   The FreeBSD Foundation
 
 Modified:
   head/sys/cam/ctl/ctl.c
 
 Modified: head/sys/cam/ctl/ctl.c
 ==
 --- head/sys/cam/ctl/ctl.cMon Mar 31 19:58:08 2014(r263977)
 +++ head/sys/cam/ctl/ctl.cMon Mar 31 20:49:33 2014(r263978)
 @@ -60,6 +60,7 @@ __FBSDID($FreeBSD$);
  #include sys/ioccom.h
  #include sys/queue.h
  #include sys/sbuf.h
 +#include sys/smp.h
  #include sys/endian.h
  #include sys/sysctl.h
  
 @@ -320,6 +321,10 @@ static int ctl_is_single = 1;
  static int index_to_aps_page;
  
  SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, CAM Target Layer);
 +static int worker_threads = 1;
 +TUNABLE_INT(kern.cam.ctl.worker_threads, worker_threads);
 +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN,
 +worker_threads, 1, Number of worker threads);
  
  /*
   * Serial number (0x80), device id (0x83), and supported pages (0x00)
 @@ -950,10 +955,7 @@ ctl_init(void)
   struct ctl_frontend *fe;
   struct ctl_lun *lun;
  uint8_t sc_id =0;
 -#if 0
 - int i;
 -#endif
 - int error, retval;
 + int i, error, retval;
   //int isc_retval;
  
   retval = 0;
 @@ -1085,17 +1087,35 @@ ctl_init(void)
   mtx_unlock(softc-ctl_lock);
  #endif
  
 - error = kproc_create(ctl_work_thread, softc, softc-work_thread, 0, 0,
 -  ctl_thrd);
 - if (error != 0) {
 - printf(error creating CTL work thread!\n);
 - mtx_lock(softc-ctl_lock);
 - ctl_free_lun(lun);
 - mtx_unlock(softc-ctl_lock);
 - ctl_pool_free(internal_pool);
 - ctl_pool_free(emergency_pool);
 - ctl_pool_free(other_pool);
 - return (error);
 + if (worker_threads  MAXCPU || worker_threads == 0) {
 + printf(invalid kern.cam.ctl.worker_threads value; 
 + setting to 1);
 + worker_threads = 1;
 + } else if (worker_threads  0) {

Why is it that the  0 case is special enough that it gets the mp_ncpus
check below, but the == 0 and  MAXCPU cases don't?

 + if (mp_ncpus  2) {
 + /*
 +  * Using more than two worker threads actually hurts
 +  * performance due to lock contention.
 +  */

 + worker_threads = 2;
 + } else {
 + worker_threads = 1;
 + }

Are printf(Setting to N)'s worthwhile here as well given
worker_threads is set to a value that wasn't specified by the user, as
above?

 + }
 +
 + for (i = 0; i  worker_threads; i++) {
 + error = kproc_create(ctl_work_thread, softc, 
 softc-work_thread, 0, 0,
 + ctl_thrd%d, i);
 + if (error != 0) {
 + printf(error creating CTL work thread!\n);
 + mtx_lock(softc-ctl_lock);
 + ctl_free_lun(lun);
 + mtx_unlock(softc-ctl_lock);
 + ctl_pool_free(internal_pool);
 + ctl_pool_free(emergency_pool);
 + ctl_pool_free(other_pool);
 + return (error);
 + }
   }
   if (bootverbose)
   printf(ctl: CAM Target Layer loaded\n);
 @@ -12991,7 +13011,11 @@ ctl_work_thread(void *arg)
   if (io != NULL) {
   STAILQ_REMOVE_HEAD(softc-rtr_queue, links);
   mtx_unlock(softc-ctl_lock);
 - goto execute;
 + retval = ctl_scsiio(io-scsiio);
 + if (retval != CTL_RETVAL_COMPLETE)
 + CTL_DEBUG_PRINT((ctl_scsiio 
 failed\n));
 + mtx_lock(softc-ctl_lock);
 + continue;
   }
   }
   io = (union ctl_io *)STAILQ_FIRST(softc-incoming_queue);
 @@ -13022,19 +13046,6 @@ ctl_work_thread(void *arg)
  
   /* Back to the top of the loop to see what woke us up. */
   continue;
 -
 -execute:
 - retval = ctl_scsiio(io-scsiio);
 - switch (retval) {
 - case CTL_RETVAL_COMPLETE:
 - break;
 - default:
 - /*
 -  * Probably need to make sure this doesn't happen.
 -  */
 - break;
 - }
 - mtx_lock(softc-ctl_lock);
   }
  }
  
 ___
 

Re: svn commit: r263978 - head/sys/cam/ctl

2014-04-01 Thread Edward Tomasz Napierała
Wiadomość napisana przez Kubilay Kocak w dniu 1 kwi 2014, o godz. 10:08:
 On 1/04/2014 7:49 AM, Edward Tomasz Napierala wrote:
 Author: trasz
 Date: Mon Mar 31 20:49:33 2014
 New Revision: 263978
 URL: http://svnweb.freebsd.org/changeset/base/263978
 
 Log:
  Make it possible to have multiple CTL worker threads.  Leave the default
  of 1 for now.
 
  Sponsored by:   The FreeBSD Foundation
 
 Modified:
  head/sys/cam/ctl/ctl.c
 
 Modified: head/sys/cam/ctl/ctl.c
 ==
 --- head/sys/cam/ctl/ctl.c   Mon Mar 31 19:58:08 2014(r263977)
 +++ head/sys/cam/ctl/ctl.c   Mon Mar 31 20:49:33 2014(r263978)
 @@ -60,6 +60,7 @@ __FBSDID($FreeBSD$);
 #include sys/ioccom.h
 #include sys/queue.h
 #include sys/sbuf.h
 +#include sys/smp.h
 #include sys/endian.h
 #include sys/sysctl.h
 
 @@ -320,6 +321,10 @@ static int ctl_is_single = 1;
 static int index_to_aps_page;
 
 SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, CAM Target Layer);
 +static int worker_threads = 1;
 +TUNABLE_INT(kern.cam.ctl.worker_threads, worker_threads);
 +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN,
 +worker_threads, 1, Number of worker threads);
 
 /*
  * Serial number (0x80), device id (0x83), and supported pages (0x00)
 @@ -950,10 +955,7 @@ ctl_init(void)
  struct ctl_frontend *fe;
  struct ctl_lun *lun;
 uint8_t sc_id =0;
 -#if 0
 -int i;
 -#endif
 -int error, retval;
 +int i, error, retval;
  //int isc_retval;
 
  retval = 0;
 @@ -1085,17 +1087,35 @@ ctl_init(void)
  mtx_unlock(softc-ctl_lock);
 #endif
 
 -error = kproc_create(ctl_work_thread, softc, softc-work_thread, 0, 0,
 - ctl_thrd);
 -if (error != 0) {
 -printf(error creating CTL work thread!\n);
 -mtx_lock(softc-ctl_lock);
 -ctl_free_lun(lun);
 -mtx_unlock(softc-ctl_lock);
 -ctl_pool_free(internal_pool);
 -ctl_pool_free(emergency_pool);
 -ctl_pool_free(other_pool);
 -return (error);
 +if (worker_threads  MAXCPU || worker_threads == 0) {
 +printf(invalid kern.cam.ctl.worker_threads value; 
 +setting to 1);
 +worker_threads = 1;
 +} else if (worker_threads  0) {
 
 Why is it that the  0 case is special enough that it gets the mp_ncpus
 check below, but the == 0 and  MAXCPU cases don't?

It's to be able to set it to -1 (which will probably become the new default
soon) and let the code figure out the right number by itself.

 +if (mp_ncpus  2) {
 +/*
 + * Using more than two worker threads actually hurts
 + * performance due to lock contention.
 + */
 
 +worker_threads = 2;
 +} else {
 +worker_threads = 1;
 +}
 
 Are printf(Setting to N)'s worthwhile here as well given
 worker_threads is set to a value that wasn't specified by the user, as
 above?

The warning is to inform the user why the value supplied was ignored
as invalid.  The -1 setting is always valid.

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263985 - in head/sys/dev/usb: . wlan

2014-04-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Apr  1 10:34:39 2014
New Revision: 263985
URL: http://svnweb.freebsd.org/changeset/base/263985

Log:
  Add new USB ID.
  
  Submitted by: Tuomo Latto djv+f...@iki.fi
  PR:   usb/188046
  MFC after:1 week

Modified:
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue Apr  1 08:19:30 2014(r263984)
+++ head/sys/dev/usb/usbdevsTue Apr  1 10:34:39 2014(r263985)
@@ -4535,5 +4535,6 @@ product ZYXEL G220V2  0x340f  G-220 v2
 product ZYXEL G202 0x3410  G-202
 product ZYXEL RT2870_1 0x3416  RT2870
 product ZYXEL RT2870_2 0x341a  RT2870
+product ZYXEL RT3070   0x341e  NWD2105
 product ZYXEL RTL8192CU0x341f  RTL8192CU
 product ZYXEL NWD2705  0x3421  NWD2705

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Tue Apr  1 08:19:30 2014
(r263984)
+++ head/sys/dev/usb/wlan/if_run.c  Tue Apr  1 10:34:39 2014
(r263985)
@@ -316,6 +316,7 @@ static const STRUCT_USB_HOST_ID run_devs
 RUN_DEV(ZINWELL,   RT3072_2),
 RUN_DEV(ZYXEL, RT2870_1),
 RUN_DEV(ZYXEL, RT2870_2),
+RUN_DEV(ZYXEL, RT3070),
 RUN_DEV_EJECT(ZYXEL,   NWD2705),
 RUN_DEV_EJECT(RALINK,  RT_STOR),
 #undef RUN_DEV_EJECT
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263989 - in head: contrib/atf contrib/atf/atf-c contrib/atf/atf-c++ contrib/atf/atf-sh etc/mtree lib/atf/libatf-c lib/atf/libatf-c++ usr.bin/atf/atf-sh

2014-04-01 Thread Julio Merino
Author: jmmv
Date: Tue Apr  1 13:47:08 2014
New Revision: 263989
URL: http://svnweb.freebsd.org/changeset/base/263989

Log:
  Add atf m4 files from the vendor branch.
  
  These were originally deleted as not important but, actually we need them
  in place if we want to be able to use autoconf on software that provides
  atf-based tests.  (That includes being able to rebuild autotest from scratch
  on the Kyua cluster machines, as the automated setup does.)

Added:
  head/contrib/atf/atf-c++/atf-c++.m4
 - copied unchanged from r261889, vendor/atf/dist/atf-c++/atf-c++.m4
  head/contrib/atf/atf-c/atf-c.m4
 - copied unchanged from r261889, vendor/atf/dist/atf-c/atf-c.m4
  head/contrib/atf/atf-c/atf-common.m4
 - copied unchanged from r261889, vendor/atf/dist/atf-c/atf-common.m4
  head/contrib/atf/atf-sh/atf-sh.m4
 - copied unchanged from r261889, vendor/atf/dist/atf-sh/atf-sh.m4
Modified:
  head/contrib/atf/FREEBSD-Xlist
  head/etc/mtree/BSD.tests.dist
  head/lib/atf/libatf-c++/Makefile
  head/lib/atf/libatf-c/Makefile
  head/usr.bin/atf/atf-sh/Makefile

Modified: head/contrib/atf/FREEBSD-Xlist
==
--- head/contrib/atf/FREEBSD-Xlist  Tue Apr  1 12:08:58 2014
(r263988)
+++ head/contrib/atf/FREEBSD-Xlist  Tue Apr  1 13:47:08 2014
(r263989)
@@ -7,7 +7,6 @@ INSTALL
 Makefile*
 aclocal.m4
 admin/
-atf-*/atf-*.m4
 atf-config/
 atf-report/
 atf-run/

Copied: head/contrib/atf/atf-c++/atf-c++.m4 (from r261889, 
vendor/atf/dist/atf-c++/atf-c++.m4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/atf/atf-c++/atf-c++.m4 Tue Apr  1 13:47:08 2014
(r263989, copy of r261889, vendor/atf/dist/atf-c++/atf-c++.m4)
@@ -0,0 +1,48 @@
+dnl
+dnl Automated Testing Framework (atf)
+dnl
+dnl Copyright 2011 Google Inc.
+dnl All rights reserved.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that the following conditions are
+dnl met:
+dnl
+dnl * Redistributions of source code must retain the above copyright
+dnl   notice, this list of conditions and the following disclaimer.
+dnl * Redistributions in binary form must reproduce the above copyright
+dnl   notice, this list of conditions and the following disclaimer in the
+dnl   documentation and/or other materials provided with the distribution.
+dnl * Neither the name of Google Inc. nor the names of its contributors
+dnl   may be used to endorse or promote products derived from this software
+dnl   without specific prior written permission.
+dnl
+dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+dnl AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+dnl
+
+dnl ATF_CHECK_CXX([version-spec])
+dnl
+dnl Checks if atf-c++ is present.  If version-spec is provided, ensures that
+dnl the installed version of atf-sh matches the required version.  This
+dnl argument must be something like '= 0.14' and accepts any version
+dnl specification supported by pkg-config.
+dnl
+dnl Defines and substitutes ATF_CXX_CFLAGS and ATF_CXX_LIBS with the compiler
+dnl and linker flags need to build against atf-c++.
+AC_DEFUN([ATF_CHECK_CXX], [
+spec=atf-c++[]m4_default_nblank([ $1], [])
+_ATF_CHECK_ARG_WITH(
+[PKG_CHECK_MODULES([ATF_CXX], [${spec}],
+   [found=yes found_atf_cxx=yes], [found=no])],
+[required ${spec} not found])
+])

Copied: head/contrib/atf/atf-c/atf-c.m4 (from r261889, 
vendor/atf/dist/atf-c/atf-c.m4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/atf/atf-c/atf-c.m4 Tue Apr  1 13:47:08 2014
(r263989, copy of r261889, vendor/atf/dist/atf-c/atf-c.m4)
@@ -0,0 +1,48 @@
+dnl
+dnl Automated Testing Framework (atf)
+dnl
+dnl Copyright 2011 Google Inc.
+dnl All rights reserved.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that the following conditions are
+dnl met:
+dnl
+dnl * Redistributions of source code must retain the above copyright
+dnl   notice, this list 

svn commit: r263990 - head/share/man/man4

2014-04-01 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Apr  1 14:17:38 2014
New Revision: 263990
URL: http://svnweb.freebsd.org/changeset/base/263990

Log:
  Add gpiobus(4) as a link to gpio(4).

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Apr  1 13:47:08 2014
(r263989)
+++ head/share/man/man4/MakefileTue Apr  1 14:17:38 2014
(r263990)
@@ -636,6 +636,7 @@ MLINKS+=fxp.4 if_fxp.4
 MLINKS+=gem.4 if_gem.4
 MLINKS+=geom.4 GEOM.4
 MLINKS+=gif.4 if_gif.4
+MLINKS+=gpio.4 gpiobus.4
 MLINKS+=gre.4 if_gre.4
 MLINKS+=hatm.4 if_hatm.4
 MLINKS+=hme.4 if_hme.4
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263991 - in head: . gnu/lib

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:23:58 2014
New Revision: 263991
URL: http://svnweb.freebsd.org/changeset/base/263991

Log:
  It is possible that MK_GNUCXX is yes but MK_CXX is no so make sure
  MK_CXX isn't no before building these libraries.

Modified:
  head/Makefile.inc1
  head/gnu/lib/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Apr  1 14:17:38 2014(r263990)
+++ head/Makefile.inc1  Tue Apr  1 14:23:58 2014(r263991)
@@ -1486,7 +1486,7 @@ _prebuild_libs=   ${_kerberos5_lib_libasn1
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
${_secure_lib_libssh} ${_secure_lib_libssl}
-.if ${MK_GNUCXX} != no
+.if ${MK_GNUCXX} != no  ${MK_CXX} != no
 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
 .endif
 

Modified: head/gnu/lib/Makefile
==
--- head/gnu/lib/Makefile   Tue Apr  1 14:17:38 2014(r263990)
+++ head/gnu/lib/Makefile   Tue Apr  1 14:23:58 2014(r263991)
@@ -10,7 +10,7 @@ SUBDIR+= libssp
 
 # libsupc++ uses libstdc++ headers, although 'make includes' should
 # have taken care of that already.
-.if ${MK_GNUCXX} != no
+.if ${MK_GNUCXX} != no  ${MK_CXX} != no
 SUBDIR+= libstdc++ libsupc++
 .endif
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263992 - head/sys/conf

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:24:03 2014
New Revision: 263992
URL: http://svnweb.freebsd.org/changeset/base/263992

Log:
  Test MK_ARM_ABI rather than if WITHOUT_ARM_ABI is defined.

Modified:
  head/sys/conf/Makefile.arm

Modified: head/sys/conf/Makefile.arm
==
--- head/sys/conf/Makefile.arm  Tue Apr  1 14:23:58 2014(r263991)
+++ head/sys/conf/Makefile.arm  Tue Apr  1 14:24:03 2014(r263992)
@@ -44,10 +44,10 @@ CFLAGS += -mno-thumb-interwork
 .endif
 
 .if empty(DDB_ENABLED)
-.if defined(WITHOUT_ARM_EABI)  ${COMPILER_TYPE} != clang
+.if MK_ARM_EABI == no  ${COMPILER_TYPE} == gcc
 CFLAGS += -mno-apcs-frame
 .endif
-.elif !defined(WITHOUT_ARM_EABI)
+.elif MK_ARM_EABI != no
 CFLAGS += -funwind-tables
 .if ${COMPILER_TYPE} == clang
 # clang requires us to tell it to emit assembly with unwind information
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263995 - head/sys/conf

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:24:20 2014
New Revision: 263995
URL: http://svnweb.freebsd.org/changeset/base/263995

Log:
  Remove check for clang and expand the comment. Newer versions of gcc
  generate dwarf4 by default as well, so always force dwarf2 when
  generating debugging data. It is harmless on older versions of both
  clang and gcc, but required on newer ones.

Modified:
  head/sys/conf/kern.mk

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Apr  1 14:24:15 2014(r263994)
+++ head/sys/conf/kern.mk   Tue Apr  1 14:24:20 2014(r263995)
@@ -164,10 +164,12 @@ CFLAGS+=  -fstack-protector
 .endif
 
 #
-# Add -gdwarf-2 when compiling -g on clang. The default starting in v3.4
-# is to generate DWARF version 4. However, our tools don't cope well with
-# DWARF 4, so force it to genereate DWARF2, which they understand.
+# Add -gdwarf-2 when compiling -g. The default starting in clang v3.4
+# and gcc 4.8 is to generate DWARF version 4. However, our tools don't
+# cope well with DWARF 4, so force it to genereate DWARF2, which they
+# understand. Do this unconditionally as it is harmless when not needed,
+# but critical for these newer versions.
 #
-.if ${COMPILER_TYPE} == clang  ${CFLAGS:M-g} !=   ${CFLAGS:M-gdwarf*} 
== 
+.if ${CFLAGS:M-g} !=   ${CFLAGS:M-gdwarf*} == 
 CFLAGS+=   -gdwarf-2
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263993 - head/share/mk

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:24:08 2014
New Revision: 263993
URL: http://svnweb.freebsd.org/changeset/base/263993

Log:
  Eliminate FDT being treated specially. When the BSDL DTC was
  introduced, the meaning of WITH_FDT changed from 'do FDT in boot
  loader and build dtc compiler' to be simply 'do FDT things in the boot
  loader'. Now that we test for FDT in the architecture specific files,
  this test here is now redunant and encourages bad behavior, so just
  eliminate it and make it always yes. Those architectures whose boot
  loaders don't support FDT already omit it when it is set to yes
  anyway.

Modified:
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkTue Apr  1 14:24:03 2014(r263992)
+++ head/share/mk/bsd.own.mkTue Apr  1 14:24:08 2014(r263993)
@@ -272,6 +272,7 @@ __DEFAULT_YES_OPTIONS = \
 DYNAMICROOT \
 ED_CRYPTO \
 EXAMPLES \
+FDT \
 FLOPPY \
 FMTREE \
 FORMAT_EXTENSIONS \
@@ -381,8 +382,7 @@ __DEFAULT_NO_OPTIONS = \
 # this means that we have to test TARGET_ARCH (the buildworld case) as well
 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
 # used at all in bsd.*.mk, but we have to make an exception here if we want
-# to allow defaults for some things like clang and fdt to vary by target
-# architecture.
+# to allow defaults for some things like clang to vary by target architecture.
 #
 .if defined(TARGET_ARCH)
 __T=${TARGET_ARCH}
@@ -427,13 +427,6 @@ __DEFAULT_NO_OPTIONS+=GNUCXX
 __DEFAULT_YES_OPTIONS+=GNUCXX
 .endif
 .endif
-# FDT is needed only for arm, mips and powerpc
-.if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*}
-__DEFAULT_YES_OPTIONS+=FDT
-.else
-__DEFAULT_NO_OPTIONS+=FDT
-.endif
-.undef __T
 
 #
 # MK_* options which default to yes.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263994 - head/share/mk

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:24:15 2014
New Revision: 263994
URL: http://svnweb.freebsd.org/changeset/base/263994

Log:
  There's no need to set the default for GNUCXX based on WITHOUT_CXX
  being defined. The system works fine without it (because GNUCXX isn't
  built when WITHOUT_CXX is defined), and it is one of the few places we
  test WITHOUT_FOO instead of MK_FOO in the base system. Simply
  eliminate it to solve both problems. Also, minor tweak to make it
  clearer that the default is always NO for GNUGCC on i386.

Modified:
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkTue Apr  1 14:24:08 2014(r263993)
+++ head/share/mk/bsd.own.mkTue Apr  1 14:24:15 2014(r263994)
@@ -408,24 +408,18 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
 .if ${__T} == amd64 || ${__T} == arm || ${__T} == armv6 || \
 ${__T} == armv6hf || ${__T} == i386
 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
+__DEFAULT_NO_OPTIONS+=GNUCXX
 # The pc98 bootloader requires gcc to build and so we must leave gcc enabled
 # for pc98 for now.
 .if ${__TT} == pc98
-__DEFAULT_NO_OPTIONS+=GNUCXX
 __DEFAULT_YES_OPTIONS+=GCC
 .else
-__DEFAULT_NO_OPTIONS+=GCC GNUCXX
+__DEFAULT_NO_OPTIONS+=GCC
 .endif
 .else
 # If clang is not cc, then build gcc by default
 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC
-__DEFAULT_YES_OPTIONS+=GCC
-# And if g++ is c++, build the rest of the GNU C++ stack
-.if defined(WITHOUT_CXX)
-__DEFAULT_NO_OPTIONS+=GNUCXX
-.else
-__DEFAULT_YES_OPTIONS+=GNUCXX
-.endif
+__DEFAULT_YES_OPTIONS+=GCC GNUCXX
 .endif
 
 #
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263997 - in head: share/mk usr.bin/grep

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:24:32 2014
New Revision: 263997
URL: http://svnweb.freebsd.org/changeset/base/263997

Log:
  Don't test WITHOUT_FOO in program makefiles, test MK_FOO instead.

Modified:
  head/share/mk/bsd.own.mk
  head/usr.bin/grep/Makefile

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkTue Apr  1 14:24:25 2014(r263996)
+++ head/share/mk/bsd.own.mkTue Apr  1 14:24:32 2014(r263997)
@@ -283,6 +283,7 @@ __DEFAULT_YES_OPTIONS = \
 GCOV \
 GDB \
 GNU \
+GNU_GREP_COMPAT \
 GPIB \
 GPIO \
 GPL_DTC \
@@ -310,6 +311,7 @@ __DEFAULT_YES_OPTIONS = \
 LOCATE \
 LPR \
 LS_COLORS \
+LZMA_SUPPORT \
 MAIL \
 MAILWRAPPER \
 MAKE \

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Tue Apr  1 14:24:25 2014(r263996)
+++ head/usr.bin/grep/Makefile  Tue Apr  1 14:24:32 2014(r263997)
@@ -43,7 +43,7 @@ MLINKS= grep.1 egrep.1 \
 LDADD= -lz
 DPADD= ${LIBZ}
 
-.if !defined(WITHOUT_LZMA_SUPPORT)
+.if ${MK_LZMA_SUPPORT} != no
 LDADD+=-llzma
 DPADD+=${LIBLZMA}
 
@@ -57,7 +57,7 @@ LINKS+=   ${BINDIR}/${PROG} ${BINDIR}/xzgr
 CFLAGS+= -DWITHOUT_LZMA
 .endif
 
-.if !defined(WITHOUT_BZIP2_SUPPORT)
+.if ${MK_BZIP2_SUPPORT} != no
 LDADD+=-lbz2
 DPADD+=${LIBBZ2}
 
@@ -73,13 +73,13 @@ MLINKS+= grep.1 bzgrep.1 \
 CFLAGS+= -DWITHOUT_BZIP2
 .endif
 
-.if !defined(WITHOUT_GNU_COMPAT)
+.if ${MK_GNU_GREP_COMPAT} != no
 CFLAGS+= -I${DESTDIR}/usr/include/gnu
 LDADD+=-lgnuregex
 DPADD+=${LIBGNUREGEX}
 .endif
 
-.if !defined(WITHOUT_NLS)
+.if ${MK_NLS} != no
 .include ${.CURDIR}/nls/Makefile.inc
 .else
 CFLAGS+= -DWITHOUT_NLS
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263996 - head

2014-04-01 Thread Warner Losh
Author: imp
Date: Tue Apr  1 14:24:25 2014
New Revision: 263996
URL: http://svnweb.freebsd.org/changeset/base/263996

Log:
  Remove support for legacy mips*eb names. Remove tests for
  TARGET_BIG_ENDIAN.

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Tue Apr  1 14:24:20 2014(r263995)
+++ head/Makefile   Tue Apr  1 14:24:25 2014(r263996)
@@ -166,20 +166,6 @@ _TARGET_ARCH=  ${TARGET:S/pc98/i386/}
 ${TARGET_ARCH} != ${MACHINE_ARCH}
 _TARGET=   
${TARGET_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb|hf)?/arm/}
 .endif
-# Legacy names, for another transition period mips:mips(n32|64)?eb - 
mips:mips\1
-.if defined(TARGET)  defined(TARGET_ARCH)  \
-${TARGET} == mips  ${TARGET_ARCH:Mmips*eb}
-_TARGET_ARCH=  ${TARGET_ARCH:C/eb$//}
-.warning TARGET_ARCH of ${TARGET_ARCH} is deprecated in favor of 
${_TARGET_ARCH}
-.endif
-.if defined(TARGET)  ${TARGET} == mips  defined(TARGET_BIG_ENDIAN)
-.warning TARGET_BIG_ENDIAN is no longer necessary for MIPS.  Big-endian is 
not the default.
-.endif
-# arm with TARGET_BIG_ENDIAN - armeb
-.if defined(TARGET_ARCH)  ${TARGET_ARCH} == arm  
defined(TARGET_BIG_ENDIAN)
-.warning TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated.  use armeb
-_TARGET_ARCH=armeb
-.endif
 .if defined(TARGET)  !defined(_TARGET)
 _TARGET=${TARGET}
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r263981 - in head: lib/libc/gen sys/kern sys/sys

2014-04-01 Thread Bryan Drewery

On 2014-03-31 20:24, Mateusz Guzik wrote:

Author: mjg
Date: Tue Apr  1 03:20:35 2014

New Revision: 263981
URL: http://svnweb.freebsd.org/changeset/base/263981

Log:
  Add a new errno: EMACS - Editor too big.

  Make a best-effort to detect that Emacs is about to executed and 
return

  the error.

  MFC after:1 week

Modified:
  head/lib/libc/gen/errlst.c
  head/sys/kern/kern_exec.c
  head/sys/sys/errno.h

Modified: lib/libc/gen/errlst.c
===
--- head/lib/libc/gen/errlst.c  (263980)
+++ head/lib/libc/gen/errlst.c  (263981)
@@ -155,6 +155,7 @@
Not permitted in capability mode,   /* 94 - ECAPMODE */
State not recoverable,  /* 95 - ENOTRECOVERABLE */
Previous owner died,/* 96 - EOWNERDEAD */
+   Editor too big, /* 97 - EMACS */
 };
 const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);

Modified: sys/kern/kern_exec.c
===
--- head/sys/kern/kern_exec.c   (263980)
+++ head/sys/kern/kern_exec.c   (263981)
@@ -337,6 +337,7 @@
int (*img_first)(struct image_params *);
struct pargs *oldargs = NULL, *newargs = NULL;
struct sigacts *oldsigacts, *newsigacts;
+   char *e;
 #ifdef KTRACE
struct vnode *tracevp = NULL;
struct ucred *tracecred = NULL;
@@ -418,6 +419,19 @@

SDT_PROBE(proc, kernel, , exec, args-fname, 0, 0, 0, 0 );

+   /*
+* A best-effort to check whether the file to be run is EMACS
+*/
+   if (args-fname != NULL) {
+   e = args-fname + strlen(args-fname);
+   while (e  args-fname  *e != '/')
+   e--;
+   if (strcasecmp(e, /emacs) == 0) {
+   error = EMACS;
+   goto exec_fail;
+   }
+   }
+
 interpret:
if (args-fname != NULL) {
 #ifdef CAPABILITY_MODE
Modified: sys/sys/errno.h
===
--- head/sys/sys/errno.h(263980)
+++ head/sys/sys/errno.h(263981)
@@ -178,10 +178,11 @@
 #defineECAPMODE94  /* Not permitted in capability 
mode */
 #defineENOTRECOVERABLE 95  /* State not recoverable */
 #defineEOWNERDEAD  96  /* Previous owner died */
+#defineEMACS   97  /* Editor too big */
 #endif /* _POSIX_SOURCE */

 #ifndef _POSIX_SOURCE
-#defineELAST   96  /* Must be equal largest errno 
*/
+#defineELAST   97  /* Must be equal largest errno 
*/
 #endif /* _POSIX_SOURCE */

 #ifdef _KERNEL


Don't forget errno(2):

Index: lib/libc/sys/intro.2
===
--- lib/libc/sys/intro.2(revision 263940)
+++ lib/libc/sys/intro.2(working copy)
@@ -28,7 +28,7 @@
 .\ @(#)intro.28.5 (Berkeley) 2/27/95
 .\ $FreeBSD$
 .\
-.Dd May 4, 2013
+.Dd April 1, 2014
 .Dt INTRO 2
 .Os
 .Sh NAME
@@ -474,6 +474,8 @@
 The state protected by a robust mutex is not recoverable.
 .It Er 96 EOWNERDEAD Em Previous owner died .
 The owner of a robust mutex terminated while holding the mutex lock.
+.It Er 97 EMACS Em Editor too big .
+Attempted to run EMACS.
 .El
 .Sh DEFINITIONS
 .Bl -tag -width Ds

--
Regards,
Bryan Drewery
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r263998 - in head: include sys/arm/include sys/ia64/include sys/mips/include sys/powerpc/include sys/sparc64/include sys/sys sys/x86/include

2014-04-01 Thread Tijl Coosemans
Author: tijl
Date: Tue Apr  1 14:46:11 2014
New Revision: 263998
URL: http://svnweb.freebsd.org/changeset/base/263998

Log:
  Rename __wchar_t so it no longer conflicts with __wchar_t from clang 3.4
  -fms-extensions.
  
  MFC after:2 weeks

Modified:
  head/include/inttypes.h
  head/include/stddef.h
  head/include/stdlib.h
  head/include/wchar.h
  head/sys/arm/include/_types.h
  head/sys/ia64/include/_types.h
  head/sys/mips/include/_types.h
  head/sys/powerpc/include/_types.h
  head/sys/sparc64/include/_types.h
  head/sys/sys/stdatomic.h
  head/sys/x86/include/_types.h

Modified: head/include/inttypes.h
==
--- head/include/inttypes.h Tue Apr  1 14:24:32 2014(r263997)
+++ head/include/inttypes.h Tue Apr  1 14:46:11 2014(r263998)
@@ -34,7 +34,7 @@
 
 #ifndef__cplusplus
 #ifndef _WCHAR_T_DECLARED
-typedef__wchar_t   wchar_t;
+typedef___wchar_t  wchar_t;
 #define_WCHAR_T_DECLARED
 #endif
 #endif

Modified: head/include/stddef.h
==
--- head/include/stddef.h   Tue Apr  1 14:24:32 2014(r263997)
+++ head/include/stddef.h   Tue Apr  1 14:46:11 2014(r263998)
@@ -54,7 +54,7 @@ typedef   __size_tsize_t;
 
 #ifndef__cplusplus
 #ifndef _WCHAR_T_DECLARED
-typedef__wchar_t   wchar_t;
+typedef___wchar_t  wchar_t;
 #define_WCHAR_T_DECLARED
 #endif
 #endif

Modified: head/include/stdlib.h
==
--- head/include/stdlib.h   Tue Apr  1 14:24:32 2014(r263997)
+++ head/include/stdlib.h   Tue Apr  1 14:46:11 2014(r263998)
@@ -51,7 +51,7 @@ typedef   __size_tsize_t;
 
 #ifndef__cplusplus
 #ifndef _WCHAR_T_DECLARED
-typedef__wchar_t   wchar_t;
+typedef___wchar_t  wchar_t;
 #define_WCHAR_T_DECLARED
 #endif
 #endif

Modified: head/include/wchar.h
==
--- head/include/wchar.hTue Apr  1 14:24:32 2014(r263997)
+++ head/include/wchar.hTue Apr  1 14:46:11 2014(r263998)
@@ -78,7 +78,7 @@ typedef   __size_tsize_t;
 
 #ifndef__cplusplus
 #ifndef _WCHAR_T_DECLARED
-typedef__wchar_t   wchar_t;
+typedef___wchar_t  wchar_t;
 #define_WCHAR_T_DECLARED
 #endif
 #endif

Modified: head/sys/arm/include/_types.h
==
--- head/sys/arm/include/_types.h   Tue Apr  1 14:24:32 2014
(r263997)
+++ head/sys/arm/include/_types.h   Tue Apr  1 14:46:11 2014
(r263998)
@@ -106,11 +106,11 @@ typedef   __uint64_t  __vm_pindex_t;
 typedef__uint32_t  __vm_size_t;
 
 #ifdef __ARM_EABI__
-typedefunsigned int__wchar_t;
+typedefunsigned int___wchar_t;
 #define__WCHAR_MIN 0   /* min value for a wchar_t */
 #define__WCHAR_MAX __UINT_MAX  /* max value for a wchar_t */
 #else
-typedefint __wchar_t;
+typedefint ___wchar_t;
 #define__WCHAR_MIN __INT_MIN   /* min value for a wchar_t */
 #define__WCHAR_MAX __INT_MAX   /* max value for a wchar_t */
 #endif

Modified: head/sys/ia64/include/_types.h
==
--- head/sys/ia64/include/_types.h  Tue Apr  1 14:24:32 2014
(r263997)
+++ head/sys/ia64/include/_types.h  Tue Apr  1 14:46:11 2014
(r263998)
@@ -96,7 +96,7 @@ typedef   __int64_t   __vm_ooffset_t;
 typedef__uint64_t  __vm_paddr_t;
 typedef__uint64_t  __vm_pindex_t;
 typedef__uint64_t  __vm_size_t;
-typedefint __wchar_t;
+typedefint ___wchar_t;
 
 #define__WCHAR_MIN __INT_MIN   /* min value for a wchar_t */
 #define__WCHAR_MAX __INT_MAX   /* max value for a wchar_t */

Modified: head/sys/mips/include/_types.h
==
--- head/sys/mips/include/_types.h  Tue Apr  1 14:24:32 2014
(r263997)
+++ head/sys/mips/include/_types.h  Tue Apr  1 14:46:11 2014
(r263998)
@@ -145,7 +145,7 @@ typedef __uint32_t  __vm_paddr_t;
 
 typedef__int64_t   __vm_ooffset_t;
 typedef__uint64_t  __vm_pindex_t;
-typedefint __wchar_t;
+typedefint ___wchar_t;
 
 #define__WCHAR_MIN __INT_MIN   /* min value for a wchar_t */
 #define__WCHAR_MAX __INT_MAX   /* max value for a wchar_t */

Modified: head/sys/powerpc/include/_types.h

svn commit: r264001 - in head/sys: conf dev/pci

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 14:49:25 2014
New Revision: 264001
URL: http://svnweb.freebsd.org/changeset/base/264001

Log:
  Add a method to get the PCI Routing ID for a device
  
  Reviewed by:  kib
  Sponsored by: Sandvine, Inc

Added:
  head/sys/dev/pci/pcib_support.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcireg.h
  head/sys/dev/pci/pcivar.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Apr  1 14:48:16 2014(r264000)
+++ head/sys/conf/files Tue Apr  1 14:49:25 2014(r264001)
@@ -1951,6 +1951,7 @@ dev/pci/pci_pci.c optional pci
 dev/pci/pci_subr.c optional pci
 dev/pci/pci_user.c optional pci
 dev/pci/pcib_if.m  standard
+dev/pci/pcib_support.c standard
 dev/pci/vga_pci.c  optional pci
 dev/pcn/if_pcn.c   optional pcn pci
 dev/pdq/if_fea.c   optional fea eisa

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue Apr  1 14:48:16 2014(r264000)
+++ head/sys/dev/pci/pci.c  Tue Apr  1 14:49:25 2014(r264001)
@@ -124,6 +124,8 @@ static void pci_resume_msix(device_t de
 static int pci_remap_intr_method(device_t bus, device_t dev,
u_int irq);
 
+static uint16_tpci_get_rid_method(device_t dev, device_t 
child);
+
 static device_method_t pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, pci_probe),
@@ -182,6 +184,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(pci_release_msi,  pci_release_msi_method),
DEVMETHOD(pci_msi_count,pci_msi_count_method),
DEVMETHOD(pci_msix_count,   pci_msix_count_method),
+   DEVMETHOD(pci_get_rid,  pci_get_rid_method),
 
DEVMETHOD_END
 };
@@ -351,6 +354,11 @@ SYSCTL_INT(_hw_pci, OID_AUTO, clear_buse
 Ignore firmware-assigned bus numbers.);
 #endif
 
+static int pci_enable_ari = 1;
+TUNABLE_INT(hw.pci.enable_ari, pci_enable_ari);
+SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, pci_enable_ari,
+0, Enable support for PCIe Alternative RID Interpretation);
+
 static int
 pci_has_quirk(uint32_t devid, int quirk)
 {
@@ -3451,6 +3459,19 @@ pci_add_resources(device_t bus, device_t
 #endif
 }
 
+static struct pci_devinfo *
+pci_identify_function(device_t pcib, device_t dev, int domain, int busno,
+int slot, int func, size_t dinfo_size)
+{
+   struct pci_devinfo *dinfo;
+
+   dinfo = pci_read_device(pcib, domain, busno, slot, func, dinfo_size);
+   if (dinfo != NULL)
+   pci_add_child(dev, dinfo);
+
+   return (dinfo);
+}
+
 void
 pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
 {
@@ -3460,6 +3481,24 @@ pci_add_children(device_t dev, int domai
int maxslots;
int s, f, pcifunchigh;
uint8_t hdrtype;
+   int first_func;
+
+   /*
+* Try to detect a device at slot 0, function 0.  If it exists, try to
+* enable ARI.  We must enable ARI before detecting the rest of the
+* functions on this bus as ARI changes the set of slots and functions
+* that are legal on this bus.
+*/
+   dinfo = pci_identify_function(pcib, dev, domain, busno, 0, 0,
+   dinfo_size);
+   if (dinfo != NULL  pci_enable_ari)
+   PCIB_TRY_ENABLE_ARI(pcib, dinfo-cfg.dev);
+
+   /*
+* Start looking for new devices on slot 0 at function 1 because we
+* just identified the device at slot 0, function 0.
+*/
+   first_func = 1;
 
KASSERT(dinfo_size = sizeof(struct pci_devinfo),
(dinfo_size too small));
@@ -3472,14 +3511,13 @@ pci_add_children(device_t dev, int domai
if ((hdrtype  PCIM_HDRTYPE)  PCI_MAXHDRTYPE)
continue;
if (hdrtype  PCIM_MFDEV)
-   pcifunchigh = PCI_FUNCMAX;
-   for (f = 0; f = pcifunchigh; f++) {
-   dinfo = pci_read_device(pcib, domain, busno, s, f,
+   pcifunchigh = PCIB_MAXFUNCS(pcib);
+   for (f = first_func; f = pcifunchigh; f++)
+   pci_identify_function(pcib, dev, domain, busno, s, f,
dinfo_size);
-   if (dinfo != NULL) {
-   pci_add_child(dev, dinfo);
-   }
-   }
+
+   /* For slots after slot 0 we need to check for function 0. */
+   first_func = 0;
}
 #undef REG
 }
@@ -5055,3 +5093,10 @@ pci_restore_state(device_t dev)
dinfo = 

svn commit: r264002 - head/sys/x86/iommu

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 14:51:45 2014
New Revision: 264002
URL: http://svnweb.freebsd.org/changeset/base/264002

Log:
  Re-implement the DMAR I/O MMU code in terms of PCI RIDs
  
  Under the hood the VT-d spec is really implemented in terms of
  PCI RIDs instead of bus/slot/function, even though the spec makes
  pains to convert back to bus/slot/function in examples.  However
  working with bus/slot/function is not correct when PCI ARI is
  in use, so convert to using RIDs in most cases.  bus/slot/function
  will only be used when reporting errors to a user.
  
  Reviewed by:  kib
  Sponsored by: Sandvine Inc.

Modified:
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/iommu/intel_ctx.c
  head/sys/x86/iommu/intel_dmar.h
  head/sys/x86/iommu/intel_drv.c
  head/sys/x86/iommu/intel_fault.c
  head/sys/x86/iommu/intel_utils.c

Modified: head/sys/x86/iommu/busdma_dmar.c
==
--- head/sys/x86/iommu/busdma_dmar.cTue Apr  1 14:49:25 2014
(r264001)
+++ head/sys/x86/iommu/busdma_dmar.cTue Apr  1 14:51:45 2014
(r264002)
@@ -93,7 +93,7 @@ dmar_bus_dma_is_dev_disabled(int domain,
  * bounce mapping.
  */
 static device_t
-dmar_get_requester(device_t dev, int *bus, int *slot, int *func)
+dmar_get_requester(device_t dev, uint16_t *rid)
 {
devclass_t pci_class;
device_t pci, pcib, requester;
@@ -102,9 +102,7 @@ dmar_get_requester(device_t dev, int *bu
pci_class = devclass_find(pci);
requester = dev;
 
-   *bus = pci_get_bus(dev);
-   *slot = pci_get_slot(dev);
-   *func = pci_get_function(dev);
+   *rid = pci_get_rid(dev);
 
/*
 * Walk the bridge hierarchy from the target device to the
@@ -161,8 +159,7 @@ dmar_get_requester(device_t dev, int *bu
 * same page tables for taken and
 * non-taken transactions.
 */
-   *bus = pci_get_bus(dev);
-   *slot = *func = 0;
+   *rid = PCI_RID(pci_get_bus(dev), 0, 0);
} else {
/*
 * Neither the device nor the bridge
@@ -171,9 +168,7 @@ dmar_get_requester(device_t dev, int *bu
 * will use the bridge's BSF as the
 * requester ID.
 */
-   *bus = pci_get_bus(pcib);
-   *slot = pci_get_slot(pcib);
-   *func = pci_get_function(pcib);
+   *rid = pci_get_rid(pcib);
}
}
/*
@@ -193,9 +188,9 @@ dmar_instantiate_ctx(struct dmar_unit *d
device_t requester;
struct dmar_ctx *ctx;
bool disabled;
-   int bus, slot, func;
+   uint16_t rid;
 
-   requester = dmar_get_requester(dev, bus, slot, func);
+   requester = dmar_get_requester(dev, rid);
 
/*
 * If the user requested the IOMMU disabled for the device, we
@@ -204,9 +199,10 @@ dmar_instantiate_ctx(struct dmar_unit *d
 * Instead provide the identity mapping for the device
 * context.
 */
-   disabled = dmar_bus_dma_is_dev_disabled(pci_get_domain(dev), bus,
-   slot, func);
-   ctx = dmar_get_ctx(dmar, requester, bus, slot, func, disabled, rmrr);
+   disabled = dmar_bus_dma_is_dev_disabled(pci_get_domain(requester), 
+   pci_get_bus(requester), pci_get_slot(requester), 
+   pci_get_function(requester));
+   ctx = dmar_get_ctx(dmar, requester, rid, disabled, rmrr);
if (ctx == NULL)
return (NULL);
if (disabled) {

Modified: head/sys/x86/iommu/intel_ctx.c
==
--- head/sys/x86/iommu/intel_ctx.c  Tue Apr  1 14:49:25 2014
(r264001)
+++ head/sys/x86/iommu/intel_ctx.c  Tue Apr  1 14:51:45 2014
(r264002)
@@ -63,6 +63,7 @@ __FBSDID($FreeBSD$);
 #include x86/iommu/intel_reg.h
 #include x86/iommu/busdma_dmar.h
 #include x86/iommu/intel_dmar.h
+#include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
 
 static MALLOC_DEFINE(M_DMAR_CTX, dmar_ctx, Intel DMAR Context);
@@ -105,14 +106,14 @@ dmar_map_ctx_entry(struct dmar_ctx *ctx,
 {
dmar_ctx_entry_t *ctxp;
 
-   ctxp = dmar_map_pgtbl(ctx-dmar-ctx_obj, 1 + ctx-bus,
+   ctxp = dmar_map_pgtbl(ctx-dmar-ctx_obj, 1 + PCI_RID2BUS(ctx-rid),
DMAR_PGF_NOALLOC | DMAR_PGF_WAITOK, sfp);
-   ctxp += ((ctx-slot  0x1f)  3) + (ctx-func  0x7);
+   ctxp += ctx-rid  0xff;
return (ctxp);
 }
 
 static void
-ctx_tag_init(struct dmar_ctx *ctx)
+ctx_tag_init(struct dmar_ctx *ctx, device_t dev)
 {
bus_addr_t maxaddr;
 
@@ -126,6 +127,7 @@ ctx_tag_init(struct 

Re: svn commit: r263981 - in head: lib/libc/gen sys/kern sys/sys

2014-04-01 Thread Sergey Kandaurov
On 1 April 2014 18:45, Bryan Drewery bdrew...@freebsd.org wrote:
 On 2014-03-31 20:24, Mateusz Guzik wrote:

 Author: mjg
 Date: Tue Apr  1 03:20:35 2014

 New Revision: 263981
 URL: http://svnweb.freebsd.org/changeset/base/263981

 Log:
   Add a new errno: EMACS - Editor too big.

   Make a best-effort to detect that Emacs is about to executed and return
   the error.

   MFC after:1 week

 Modified:
   head/lib/libc/gen/errlst.c
   head/sys/kern/kern_exec.c
   head/sys/sys/errno.h

 Modified: lib/libc/gen/errlst.c
 ===
 --- head/lib/libc/gen/errlst.c  (263980)
 +++ head/lib/libc/gen/errlst.c  (263981)
 @@ -155,6 +155,7 @@
 Not permitted in capability mode, /* 94 - ECAPMODE */
 State not recoverable,/* 95 - ENOTRECOVERABLE */
 Previous owner died,  /* 96 - EOWNERDEAD */
 +   Editor too big,   /* 97 - EMACS */
  };
  const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);

 Modified: sys/kern/kern_exec.c
 ===
 --- head/sys/kern/kern_exec.c   (263980)
 +++ head/sys/kern/kern_exec.c   (263981)
 @@ -337,6 +337,7 @@
 int (*img_first)(struct image_params *);
 struct pargs *oldargs = NULL, *newargs = NULL;
 struct sigacts *oldsigacts, *newsigacts;
 +   char *e;
  #ifdef KTRACE
 struct vnode *tracevp = NULL;
 struct ucred *tracecred = NULL;
 @@ -418,6 +419,19 @@

 SDT_PROBE(proc, kernel, , exec, args-fname, 0, 0, 0, 0 );

 +   /*
 +* A best-effort to check whether the file to be run is EMACS
 +*/
 +   if (args-fname != NULL) {
 +   e = args-fname + strlen(args-fname);
 +   while (e  args-fname  *e != '/')
 +   e--;
 +   if (strcasecmp(e, /emacs) == 0) {
 +   error = EMACS;
 +   goto exec_fail;
 +   }
 +   }
 +
  interpret:
 if (args-fname != NULL) {
  #ifdef CAPABILITY_MODE
 Modified: sys/sys/errno.h
 ===
 --- head/sys/sys/errno.h(263980)
 +++ head/sys/sys/errno.h(263981)
 @@ -178,10 +178,11 @@
  #defineECAPMODE94  /* Not permitted in
 capability mode */
  #defineENOTRECOVERABLE 95  /* State not recoverable
 */
  #defineEOWNERDEAD  96  /* Previous owner died */
 +#defineEMACS   97  /* Editor too big */
  #endif /* _POSIX_SOURCE */

  #ifndef _POSIX_SOURCE
 -#defineELAST   96  /* Must be equal largest
 errno */
 +#defineELAST   97  /* Must be equal largest
 errno */
  #endif /* _POSIX_SOURCE */

  #ifdef _KERNEL


 Don't forget errno(2):


As well as lib/libc/nls/C.msg

-- 
wbr,
pluknet
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264000 - head/release/doc/en_US.ISO8859-1/relnotes

2014-04-01 Thread Glen Barber
Author: gjb
Date: Tue Apr  1 14:48:16 2014
New Revision: 264000
URL: http://svnweb.freebsd.org/changeset/base/264000

Log:
  Add the svn revision number to the IPX note.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Tue Apr  1 
14:48:10 2014(r263999)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Tue Apr  1 
14:48:16 2014(r264000)
@@ -191,9 +191,9 @@
 sect3 xml:id=net-proto
   titleNetwork Protocols/title
 
-  paraSupport for the IPX network transport protocol has
-   been removed, and will not be supported in os;nbsp;11
-   and later releases./para
+  para revision=263140Support for the IPX network transport
+   protocol has been removed, and will not be supported in
+   os;nbsp;11 and later releases./para
 /sect3
 
 sect3 xml:id=disks
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264003 - in head/sys/amd64/vmm: amd intel io

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 14:54:43 2014
New Revision: 264003
URL: http://svnweb.freebsd.org/changeset/base/264003

Log:
  Re-write bhyve's I/O MMU handling in terms of PCI RIDs
  
  Reviewed by:  neel
  Sponsored by: Sandvine Inc

Modified:
  head/sys/amd64/vmm/amd/amdv.c
  head/sys/amd64/vmm/intel/vtd.c
  head/sys/amd64/vmm/io/iommu.c
  head/sys/amd64/vmm/io/iommu.h
  head/sys/amd64/vmm/io/ppt.c

Modified: head/sys/amd64/vmm/amd/amdv.c
==
--- head/sys/amd64/vmm/amd/amdv.c   Tue Apr  1 14:51:45 2014
(r264002)
+++ head/sys/amd64/vmm/amd/amdv.c   Tue Apr  1 14:54:43 2014
(r264003)
@@ -242,14 +242,14 @@ amd_iommu_remove_mapping(void *domain, v
 }
 
 static void
-amd_iommu_add_device(void *domain, int bus, int slot, int func)
+amd_iommu_add_device(void *domain, uint16_t rid)
 {
 
printf(amd_iommu_add_device: not implemented\n);
 }
 
 static void
-amd_iommu_remove_device(void *domain, int bus, int slot, int func)
+amd_iommu_remove_device(void *domain, uint16_t rid)
 {
 
printf(amd_iommu_remove_device: not implemented\n);

Modified: head/sys/amd64/vmm/intel/vtd.c
==
--- head/sys/amd64/vmm/intel/vtd.c  Tue Apr  1 14:51:45 2014
(r264002)
+++ head/sys/amd64/vmm/intel/vtd.c  Tue Apr  1 14:54:43 2014
(r264003)
@@ -99,6 +99,8 @@ struct vtdmap {
 #defineVTD_PTE_SUPERPAGE   (1UL  7)
 #defineVTD_PTE_ADDR_M  (0x000FF000UL)
 
+#define VTD_RID2IDX(rid)   (((rid)  0xff) * 2)
+
 struct domain {
uint64_t*ptp;   /* first level page table page */
int pt_levels;  /* number of page table levels */
@@ -360,27 +362,24 @@ vtd_disable(void)
 }
 
 static void
-vtd_add_device(void *arg, int bus, int slot, int func)
+vtd_add_device(void *arg, uint16_t rid)
 {
int idx;
uint64_t *ctxp;
struct domain *dom = arg;
vm_paddr_t pt_paddr;
struct vtdmap *vtdmap;
-
-   if (bus  0 || bus  PCI_BUSMAX ||
-   slot  0 || slot  PCI_SLOTMAX ||
-   func  0 || func  PCI_FUNCMAX)
-   panic(vtd_add_device: invalid bsf %d/%d/%d, bus, slot, func);
+   uint8_t bus;
 
vtdmap = vtdmaps[0];
+   bus = PCI_RID2BUS(rid);
ctxp = ctx_tables[bus];
pt_paddr = vtophys(dom-ptp);
-   idx = (slot  3 | func) * 2;
+   idx = VTD_RID2IDX(rid);
 
if (ctxp[idx]  VTD_CTX_PRESENT) {
-   panic(vtd_add_device: device %d/%d/%d is already owned by 
- domain %d, bus, slot, func,
+   panic(vtd_add_device: device %x is already owned by 
+ domain %d, rid,
  (uint16_t)(ctxp[idx + 1]  8));
}
 
@@ -404,19 +403,16 @@ vtd_add_device(void *arg, int bus, int s
 }
 
 static void
-vtd_remove_device(void *arg, int bus, int slot, int func)
+vtd_remove_device(void *arg, uint16_t rid)
 {
int i, idx;
uint64_t *ctxp;
struct vtdmap *vtdmap;
+   uint8_t bus;
 
-   if (bus  0 || bus  PCI_BUSMAX ||
-   slot  0 || slot  PCI_SLOTMAX ||
-   func  0 || func  PCI_FUNCMAX)
-   panic(vtd_add_device: invalid bsf %d/%d/%d, bus, slot, func);
-
+   bus = PCI_RID2BUS(rid);
ctxp = ctx_tables[bus];
-   idx = (slot  3 | func) * 2;
+   idx = VTD_RID2IDX(rid);
 
/*
 * Order is important. The 'present' bit is must be cleared first.

Modified: head/sys/amd64/vmm/io/iommu.c
==
--- head/sys/amd64/vmm/io/iommu.c   Tue Apr  1 14:51:45 2014
(r264002)
+++ head/sys/amd64/vmm/io/iommu.c   Tue Apr  1 14:54:43 2014
(r264003)
@@ -109,19 +109,19 @@ IOMMU_REMOVE_MAPPING(void *domain, vm_pa
 }
 
 static __inline void
-IOMMU_ADD_DEVICE(void *domain, int bus, int slot, int func)
+IOMMU_ADD_DEVICE(void *domain, uint16_t rid)
 {
 
if (ops != NULL  iommu_avail)
-   (*ops-add_device)(domain, bus, slot, func);
+   (*ops-add_device)(domain, rid);
 }
 
 static __inline void
-IOMMU_REMOVE_DEVICE(void *domain, int bus, int slot, int func)
+IOMMU_REMOVE_DEVICE(void *domain, uint16_t rid)
 {
 
if (ops != NULL  iommu_avail)
-   (*ops-remove_device)(domain, bus, slot, func);
+   (*ops-remove_device)(domain, rid);
 }
 
 static __inline void
@@ -196,7 +196,8 @@ iommu_init(void)
continue;
 
/* everything else belongs to the host domain */
-   iommu_add_device(host_domain, bus, slot, func);
+   iommu_add_device(host_domain,
+   pci_get_rid(dev));
}
}
}
@@ -263,17 +264,17 @@ 

svn commit: r264006 - in head/sys: amd64/vmm/amd amd64/vmm/intel amd64/vmm/io conf dev/pci x86/iommu

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 15:06:03 2014
New Revision: 264006
URL: http://svnweb.freebsd.org/changeset/base/264006

Log:
  Revert PCI RID changes.
  
  My PCI RID changes somehow got intermixed with my PCI ARI patch when I
  committed it.  I may have accidentally applied a patch to a non-clean
  working tree.  Revert everything while I figure out what went wrong.
  
  Pointy hat to: rstone

Deleted:
  head/sys/dev/pci/pcib_support.c
Modified:
  head/sys/amd64/vmm/amd/amdv.c
  head/sys/amd64/vmm/intel/vtd.c
  head/sys/amd64/vmm/io/iommu.c
  head/sys/amd64/vmm/io/iommu.h
  head/sys/amd64/vmm/io/ppt.c
  head/sys/conf/files
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcireg.h
  head/sys/dev/pci/pcivar.h
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/iommu/intel_ctx.c
  head/sys/x86/iommu/intel_dmar.h
  head/sys/x86/iommu/intel_drv.c
  head/sys/x86/iommu/intel_fault.c
  head/sys/x86/iommu/intel_utils.c

Modified: head/sys/amd64/vmm/amd/amdv.c
==
--- head/sys/amd64/vmm/amd/amdv.c   Tue Apr  1 14:55:29 2014
(r264005)
+++ head/sys/amd64/vmm/amd/amdv.c   Tue Apr  1 15:06:03 2014
(r264006)
@@ -242,14 +242,14 @@ amd_iommu_remove_mapping(void *domain, v
 }
 
 static void
-amd_iommu_add_device(void *domain, uint16_t rid)
+amd_iommu_add_device(void *domain, int bus, int slot, int func)
 {
 
printf(amd_iommu_add_device: not implemented\n);
 }
 
 static void
-amd_iommu_remove_device(void *domain, uint16_t rid)
+amd_iommu_remove_device(void *domain, int bus, int slot, int func)
 {
 
printf(amd_iommu_remove_device: not implemented\n);

Modified: head/sys/amd64/vmm/intel/vtd.c
==
--- head/sys/amd64/vmm/intel/vtd.c  Tue Apr  1 14:55:29 2014
(r264005)
+++ head/sys/amd64/vmm/intel/vtd.c  Tue Apr  1 15:06:03 2014
(r264006)
@@ -99,8 +99,6 @@ struct vtdmap {
 #defineVTD_PTE_SUPERPAGE   (1UL  7)
 #defineVTD_PTE_ADDR_M  (0x000FF000UL)
 
-#define VTD_RID2IDX(rid)   (((rid)  0xff) * 2)
-
 struct domain {
uint64_t*ptp;   /* first level page table page */
int pt_levels;  /* number of page table levels */
@@ -362,24 +360,27 @@ vtd_disable(void)
 }
 
 static void
-vtd_add_device(void *arg, uint16_t rid)
+vtd_add_device(void *arg, int bus, int slot, int func)
 {
int idx;
uint64_t *ctxp;
struct domain *dom = arg;
vm_paddr_t pt_paddr;
struct vtdmap *vtdmap;
-   uint8_t bus;
+
+   if (bus  0 || bus  PCI_BUSMAX ||
+   slot  0 || slot  PCI_SLOTMAX ||
+   func  0 || func  PCI_FUNCMAX)
+   panic(vtd_add_device: invalid bsf %d/%d/%d, bus, slot, func);
 
vtdmap = vtdmaps[0];
-   bus = PCI_RID2BUS(rid);
ctxp = ctx_tables[bus];
pt_paddr = vtophys(dom-ptp);
-   idx = VTD_RID2IDX(rid);
+   idx = (slot  3 | func) * 2;
 
if (ctxp[idx]  VTD_CTX_PRESENT) {
-   panic(vtd_add_device: device %x is already owned by 
- domain %d, rid,
+   panic(vtd_add_device: device %d/%d/%d is already owned by 
+ domain %d, bus, slot, func,
  (uint16_t)(ctxp[idx + 1]  8));
}
 
@@ -403,16 +404,19 @@ vtd_add_device(void *arg, uint16_t rid)
 }
 
 static void
-vtd_remove_device(void *arg, uint16_t rid)
+vtd_remove_device(void *arg, int bus, int slot, int func)
 {
int i, idx;
uint64_t *ctxp;
struct vtdmap *vtdmap;
-   uint8_t bus;
 
-   bus = PCI_RID2BUS(rid);
+   if (bus  0 || bus  PCI_BUSMAX ||
+   slot  0 || slot  PCI_SLOTMAX ||
+   func  0 || func  PCI_FUNCMAX)
+   panic(vtd_add_device: invalid bsf %d/%d/%d, bus, slot, func);
+
ctxp = ctx_tables[bus];
-   idx = VTD_RID2IDX(rid);
+   idx = (slot  3 | func) * 2;
 
/*
 * Order is important. The 'present' bit is must be cleared first.

Modified: head/sys/amd64/vmm/io/iommu.c
==
--- head/sys/amd64/vmm/io/iommu.c   Tue Apr  1 14:55:29 2014
(r264005)
+++ head/sys/amd64/vmm/io/iommu.c   Tue Apr  1 15:06:03 2014
(r264006)
@@ -109,19 +109,19 @@ IOMMU_REMOVE_MAPPING(void *domain, vm_pa
 }
 
 static __inline void
-IOMMU_ADD_DEVICE(void *domain, uint16_t rid)
+IOMMU_ADD_DEVICE(void *domain, int bus, int slot, int func)
 {
 
if (ops != NULL  iommu_avail)
-   (*ops-add_device)(domain, rid);
+   (*ops-add_device)(domain, bus, slot, func);
 }
 
 static __inline void
-IOMMU_REMOVE_DEVICE(void *domain, uint16_t rid)
+IOMMU_REMOVE_DEVICE(void *domain, int bus, int slot, int func)
 {
 
  

svn commit: r264007 - in head/sys: conf dev/pci

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 15:47:24 2014
New Revision: 264007
URL: http://svnweb.freebsd.org/changeset/base/264007

Log:
  Add a method to get the PCI RID for a device.
  
  Reviewed by:  kib
  MFC after:2 months
  Sponsored by: Sandvine Inc.

Added:
  head/sys/dev/pci/pcib_support.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcireg.h
  head/sys/dev/pci/pcivar.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Apr  1 15:06:03 2014(r264006)
+++ head/sys/conf/files Tue Apr  1 15:47:24 2014(r264007)
@@ -1951,6 +1951,7 @@ dev/pci/pci_pci.c optional pci
 dev/pci/pci_subr.c optional pci
 dev/pci/pci_user.c optional pci
 dev/pci/pcib_if.m  standard
+dev/pci/pcib_support.c standard
 dev/pci/vga_pci.c  optional pci
 dev/pcn/if_pcn.c   optional pcn pci
 dev/pdq/if_fea.c   optional fea eisa

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue Apr  1 15:06:03 2014(r264006)
+++ head/sys/dev/pci/pci.c  Tue Apr  1 15:47:24 2014(r264007)
@@ -124,6 +124,8 @@ static void pci_resume_msix(device_t de
 static int pci_remap_intr_method(device_t bus, device_t dev,
u_int irq);
 
+static uint16_tpci_get_rid_method(device_t dev, device_t 
child);
+
 static device_method_t pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, pci_probe),
@@ -182,6 +184,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(pci_release_msi,  pci_release_msi_method),
DEVMETHOD(pci_msi_count,pci_msi_count_method),
DEVMETHOD(pci_msix_count,   pci_msix_count_method),
+   DEVMETHOD(pci_get_rid,  pci_get_rid_method),
 
DEVMETHOD_END
 };
@@ -5055,3 +5058,10 @@ pci_restore_state(device_t dev)
dinfo = device_get_ivars(dev);
pci_cfg_restore(dev, dinfo);
 }
+
+static uint16_t
+pci_get_rid_method(device_t dev, device_t child)
+{
+
+   return (PCIB_GET_RID(device_get_parent(dev), child));
+}

Modified: head/sys/dev/pci/pci_if.m
==
--- head/sys/dev/pci/pci_if.m   Tue Apr  1 15:06:03 2014(r264006)
+++ head/sys/dev/pci/pci_if.m   Tue Apr  1 15:47:24 2014(r264007)
@@ -159,3 +159,9 @@ METHOD int msix_count {
device_tdev;
device_tchild;
 } DEFAULT null_msi_count;
+
+METHOD uint16_t get_rid {
+   device_t dev;
+   device_t child;
+};
+

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Tue Apr  1 15:06:03 2014(r264006)
+++ head/sys/dev/pci/pci_pci.c  Tue Apr  1 15:47:24 2014(r264007)
@@ -93,6 +93,7 @@ static device_method_t pcib_methods[] = 
 DEVMETHOD(pcib_release_msix,   pcib_release_msix),
 DEVMETHOD(pcib_map_msi,pcib_map_msi),
 DEVMETHOD(pcib_power_for_sleep,pcib_power_for_sleep),
+DEVMETHOD(pcib_get_rid,pcib_get_rid),
 
 DEVMETHOD_END
 };
@@ -1934,3 +1935,4 @@ pcib_power_for_sleep(device_t pcib, devi
bus = device_get_parent(pcib);
return (PCIB_POWER_FOR_SLEEP(bus, dev, pstate));
 }
+

Modified: head/sys/dev/pci/pcib_if.m
==
--- head/sys/dev/pci/pcib_if.m  Tue Apr  1 15:06:03 2014(r264006)
+++ head/sys/dev/pci/pcib_if.m  Tue Apr  1 15:47:24 2014(r264007)
@@ -154,3 +154,12 @@ METHOD int power_for_sleep {
device_tdev;
int *pstate;
 };
+
+#
+# Return the PCI Routing Identifier (RID) for the device.
+#
+METHOD uint16_t get_rid {
+   device_t pcib;
+   device_t dev;
+};
+

Modified: head/sys/dev/pci/pcib_private.h
==
--- head/sys/dev/pci/pcib_private.h Tue Apr  1 15:06:03 2014
(r264006)
+++ head/sys/dev/pci/pcib_private.h Tue Apr  1 15:47:24 2014
(r264007)
@@ -167,5 +167,7 @@ int pcib_release_msi(device_t pcib, dev
 intpcib_alloc_msix(device_t pcib, device_t dev, int *irq);
 intpcib_release_msix(device_t pcib, device_t dev, int irq);
 intpcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t 
*addr, uint32_t *data);
+uint16_t   pcib_get_rid(device_t pcib, device_t dev);
+
 
 #endif

Added: head/sys/dev/pci/pcib_support.c
==
--- /dev/null  

svn commit: r264008 - head/sys/x86/iommu

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 15:48:46 2014
New Revision: 264008
URL: http://svnweb.freebsd.org/changeset/base/264008

Log:
  Re-implement the DMAR I/O MMU code in terms of PCI RIDs
  
  Under the hood the VT-d spec is really implemented in terms of
  PCI RIDs instead of bus/slot/function, even though the spec makes
  pains to convert back to bus/slot/function in examples.  However
  working with bus/slot/function is not correct when PCI ARI is
  in use, so convert to using RIDs in most cases.  bus/slot/function
  will only be used when reporting errors to a user.
  
  Reviewed by:  kib
  MFC after:2 months
  Sponsored by: Sandvine Inc.

Modified:
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/iommu/intel_ctx.c
  head/sys/x86/iommu/intel_dmar.h
  head/sys/x86/iommu/intel_drv.c
  head/sys/x86/iommu/intel_fault.c
  head/sys/x86/iommu/intel_utils.c

Modified: head/sys/x86/iommu/busdma_dmar.c
==
--- head/sys/x86/iommu/busdma_dmar.cTue Apr  1 15:47:24 2014
(r264007)
+++ head/sys/x86/iommu/busdma_dmar.cTue Apr  1 15:48:46 2014
(r264008)
@@ -93,7 +93,7 @@ dmar_bus_dma_is_dev_disabled(int domain,
  * bounce mapping.
  */
 static device_t
-dmar_get_requester(device_t dev, int *bus, int *slot, int *func)
+dmar_get_requester(device_t dev, uint16_t *rid)
 {
devclass_t pci_class;
device_t pci, pcib, requester;
@@ -102,9 +102,7 @@ dmar_get_requester(device_t dev, int *bu
pci_class = devclass_find(pci);
requester = dev;
 
-   *bus = pci_get_bus(dev);
-   *slot = pci_get_slot(dev);
-   *func = pci_get_function(dev);
+   *rid = pci_get_rid(dev);
 
/*
 * Walk the bridge hierarchy from the target device to the
@@ -161,8 +159,7 @@ dmar_get_requester(device_t dev, int *bu
 * same page tables for taken and
 * non-taken transactions.
 */
-   *bus = pci_get_bus(dev);
-   *slot = *func = 0;
+   *rid = PCI_RID(pci_get_bus(dev), 0, 0);
} else {
/*
 * Neither the device nor the bridge
@@ -171,9 +168,7 @@ dmar_get_requester(device_t dev, int *bu
 * will use the bridge's BSF as the
 * requester ID.
 */
-   *bus = pci_get_bus(pcib);
-   *slot = pci_get_slot(pcib);
-   *func = pci_get_function(pcib);
+   *rid = pci_get_rid(pcib);
}
}
/*
@@ -193,9 +188,9 @@ dmar_instantiate_ctx(struct dmar_unit *d
device_t requester;
struct dmar_ctx *ctx;
bool disabled;
-   int bus, slot, func;
+   uint16_t rid;
 
-   requester = dmar_get_requester(dev, bus, slot, func);
+   requester = dmar_get_requester(dev, rid);
 
/*
 * If the user requested the IOMMU disabled for the device, we
@@ -204,9 +199,10 @@ dmar_instantiate_ctx(struct dmar_unit *d
 * Instead provide the identity mapping for the device
 * context.
 */
-   disabled = dmar_bus_dma_is_dev_disabled(pci_get_domain(dev), bus,
-   slot, func);
-   ctx = dmar_get_ctx(dmar, requester, bus, slot, func, disabled, rmrr);
+   disabled = dmar_bus_dma_is_dev_disabled(pci_get_domain(requester), 
+   pci_get_bus(requester), pci_get_slot(requester), 
+   pci_get_function(requester));
+   ctx = dmar_get_ctx(dmar, requester, rid, disabled, rmrr);
if (ctx == NULL)
return (NULL);
if (disabled) {

Modified: head/sys/x86/iommu/intel_ctx.c
==
--- head/sys/x86/iommu/intel_ctx.c  Tue Apr  1 15:47:24 2014
(r264007)
+++ head/sys/x86/iommu/intel_ctx.c  Tue Apr  1 15:48:46 2014
(r264008)
@@ -63,6 +63,7 @@ __FBSDID($FreeBSD$);
 #include x86/iommu/intel_reg.h
 #include x86/iommu/busdma_dmar.h
 #include x86/iommu/intel_dmar.h
+#include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
 
 static MALLOC_DEFINE(M_DMAR_CTX, dmar_ctx, Intel DMAR Context);
@@ -105,14 +106,14 @@ dmar_map_ctx_entry(struct dmar_ctx *ctx,
 {
dmar_ctx_entry_t *ctxp;
 
-   ctxp = dmar_map_pgtbl(ctx-dmar-ctx_obj, 1 + ctx-bus,
+   ctxp = dmar_map_pgtbl(ctx-dmar-ctx_obj, 1 + PCI_RID2BUS(ctx-rid),
DMAR_PGF_NOALLOC | DMAR_PGF_WAITOK, sfp);
-   ctxp += ((ctx-slot  0x1f)  3) + (ctx-func  0x7);
+   ctxp += ctx-rid  0xff;
return (ctxp);
 }
 
 static void
-ctx_tag_init(struct dmar_ctx *ctx)
+ctx_tag_init(struct dmar_ctx *ctx, device_t dev)
 {
bus_addr_t maxaddr;
 
@@ -126,6 +127,7 

svn commit: r264009 - in head/sys/amd64/vmm: amd intel io

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 15:54:03 2014
New Revision: 264009
URL: http://svnweb.freebsd.org/changeset/base/264009

Log:
  Re-write bhyve's I/O MMU handling in terms of PCI RID.
  
  Reviewed by:  neel
  MFC after:2 months
  Sponsored by: Sandvine Inc.

Modified:
  head/sys/amd64/vmm/amd/amdv.c
  head/sys/amd64/vmm/intel/vtd.c
  head/sys/amd64/vmm/io/iommu.c
  head/sys/amd64/vmm/io/iommu.h
  head/sys/amd64/vmm/io/ppt.c

Modified: head/sys/amd64/vmm/amd/amdv.c
==
--- head/sys/amd64/vmm/amd/amdv.c   Tue Apr  1 15:48:46 2014
(r264008)
+++ head/sys/amd64/vmm/amd/amdv.c   Tue Apr  1 15:54:03 2014
(r264009)
@@ -242,14 +242,14 @@ amd_iommu_remove_mapping(void *domain, v
 }
 
 static void
-amd_iommu_add_device(void *domain, int bus, int slot, int func)
+amd_iommu_add_device(void *domain, uint16_t rid)
 {
 
printf(amd_iommu_add_device: not implemented\n);
 }
 
 static void
-amd_iommu_remove_device(void *domain, int bus, int slot, int func)
+amd_iommu_remove_device(void *domain, uint16_t rid)
 {
 
printf(amd_iommu_remove_device: not implemented\n);

Modified: head/sys/amd64/vmm/intel/vtd.c
==
--- head/sys/amd64/vmm/intel/vtd.c  Tue Apr  1 15:48:46 2014
(r264008)
+++ head/sys/amd64/vmm/intel/vtd.c  Tue Apr  1 15:54:03 2014
(r264009)
@@ -99,6 +99,8 @@ struct vtdmap {
 #defineVTD_PTE_SUPERPAGE   (1UL  7)
 #defineVTD_PTE_ADDR_M  (0x000FF000UL)
 
+#define VTD_RID2IDX(rid)   (((rid)  0xff) * 2)
+
 struct domain {
uint64_t*ptp;   /* first level page table page */
int pt_levels;  /* number of page table levels */
@@ -360,27 +362,24 @@ vtd_disable(void)
 }
 
 static void
-vtd_add_device(void *arg, int bus, int slot, int func)
+vtd_add_device(void *arg, uint16_t rid)
 {
int idx;
uint64_t *ctxp;
struct domain *dom = arg;
vm_paddr_t pt_paddr;
struct vtdmap *vtdmap;
-
-   if (bus  0 || bus  PCI_BUSMAX ||
-   slot  0 || slot  PCI_SLOTMAX ||
-   func  0 || func  PCI_FUNCMAX)
-   panic(vtd_add_device: invalid bsf %d/%d/%d, bus, slot, func);
+   uint8_t bus;
 
vtdmap = vtdmaps[0];
+   bus = PCI_RID2BUS(rid);
ctxp = ctx_tables[bus];
pt_paddr = vtophys(dom-ptp);
-   idx = (slot  3 | func) * 2;
+   idx = VTD_RID2IDX(rid);
 
if (ctxp[idx]  VTD_CTX_PRESENT) {
-   panic(vtd_add_device: device %d/%d/%d is already owned by 
- domain %d, bus, slot, func,
+   panic(vtd_add_device: device %x is already owned by 
+ domain %d, rid,
  (uint16_t)(ctxp[idx + 1]  8));
}
 
@@ -404,19 +403,16 @@ vtd_add_device(void *arg, int bus, int s
 }
 
 static void
-vtd_remove_device(void *arg, int bus, int slot, int func)
+vtd_remove_device(void *arg, uint16_t rid)
 {
int i, idx;
uint64_t *ctxp;
struct vtdmap *vtdmap;
+   uint8_t bus;
 
-   if (bus  0 || bus  PCI_BUSMAX ||
-   slot  0 || slot  PCI_SLOTMAX ||
-   func  0 || func  PCI_FUNCMAX)
-   panic(vtd_add_device: invalid bsf %d/%d/%d, bus, slot, func);
-
+   bus = PCI_RID2BUS(rid);
ctxp = ctx_tables[bus];
-   idx = (slot  3 | func) * 2;
+   idx = VTD_RID2IDX(rid);
 
/*
 * Order is important. The 'present' bit is must be cleared first.

Modified: head/sys/amd64/vmm/io/iommu.c
==
--- head/sys/amd64/vmm/io/iommu.c   Tue Apr  1 15:48:46 2014
(r264008)
+++ head/sys/amd64/vmm/io/iommu.c   Tue Apr  1 15:54:03 2014
(r264009)
@@ -109,19 +109,19 @@ IOMMU_REMOVE_MAPPING(void *domain, vm_pa
 }
 
 static __inline void
-IOMMU_ADD_DEVICE(void *domain, int bus, int slot, int func)
+IOMMU_ADD_DEVICE(void *domain, uint16_t rid)
 {
 
if (ops != NULL  iommu_avail)
-   (*ops-add_device)(domain, bus, slot, func);
+   (*ops-add_device)(domain, rid);
 }
 
 static __inline void
-IOMMU_REMOVE_DEVICE(void *domain, int bus, int slot, int func)
+IOMMU_REMOVE_DEVICE(void *domain, uint16_t rid)
 {
 
if (ops != NULL  iommu_avail)
-   (*ops-remove_device)(domain, bus, slot, func);
+   (*ops-remove_device)(domain, rid);
 }
 
 static __inline void
@@ -196,7 +196,8 @@ iommu_init(void)
continue;
 
/* everything else belongs to the host domain */
-   iommu_add_device(host_domain, bus, slot, func);
+   iommu_add_device(host_domain,
+   pci_get_rid(dev));
}
}
}
@@ -263,17 

svn commit: r264011 - head/sys/dev/pci

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 16:02:02 2014
New Revision: 264011
URL: http://svnweb.freebsd.org/changeset/base/264011

Log:
  Add support for PCIe ARI
  
  PCIe Alternate RID Interpretation (ARI) is an optional feature that
  allows devices to have up to 256 different functions.  It is
  implemented by always setting the PCI slot number to 0 and
  re-purposing the 5 bits used to encode the slot number to instead
  contain the function number.  Combined with the original 3 bits
  allocated for the function number, this allows for 256 functions.
  
  This is enabled by default, but it's expected to be a no-op on currently
  supported hardware.  It's a prerequisite for supporting PCI SR-IOV, and
  I want the ARI support to go in early to help shake out any bugs in it.
  ARI can be disabled by setting the tunable hw.pci.enable_ari=0.
  
  Reviewed by:  kib
  MFC after:2 months
  Sponsored by: Sandvine Inc.

Modified:
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/pci/pcib_if.m
  head/sys/dev/pci/pcib_private.h
  head/sys/dev/pci/pcib_support.c
  head/sys/dev/pci/pcireg.h

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue Apr  1 15:56:31 2014(r264010)
+++ head/sys/dev/pci/pci.c  Tue Apr  1 16:02:02 2014(r264011)
@@ -354,6 +354,11 @@ SYSCTL_INT(_hw_pci, OID_AUTO, clear_buse
 Ignore firmware-assigned bus numbers.);
 #endif
 
+static int pci_enable_ari = 1;
+TUNABLE_INT(hw.pci.enable_ari, pci_enable_ari);
+SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, pci_enable_ari,
+0, Enable support for PCIe Alternative RID Interpretation);
+
 static int
 pci_has_quirk(uint32_t devid, int quirk)
 {
@@ -3454,6 +3459,19 @@ pci_add_resources(device_t bus, device_t
 #endif
 }
 
+static struct pci_devinfo *
+pci_identify_function(device_t pcib, device_t dev, int domain, int busno,
+int slot, int func, size_t dinfo_size)
+{
+   struct pci_devinfo *dinfo;
+
+   dinfo = pci_read_device(pcib, domain, busno, slot, func, dinfo_size);
+   if (dinfo != NULL)
+   pci_add_child(dev, dinfo);
+
+   return (dinfo);
+}
+
 void
 pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
 {
@@ -3463,6 +3481,24 @@ pci_add_children(device_t dev, int domai
int maxslots;
int s, f, pcifunchigh;
uint8_t hdrtype;
+   int first_func;
+
+   /*
+* Try to detect a device at slot 0, function 0.  If it exists, try to
+* enable ARI.  We must enable ARI before detecting the rest of the
+* functions on this bus as ARI changes the set of slots and functions
+* that are legal on this bus.
+*/
+   dinfo = pci_identify_function(pcib, dev, domain, busno, 0, 0,
+   dinfo_size);
+   if (dinfo != NULL  pci_enable_ari)
+   PCIB_TRY_ENABLE_ARI(pcib, dinfo-cfg.dev);
+
+   /*
+* Start looking for new devices on slot 0 at function 1 because we
+* just identified the device at slot 0, function 0.
+*/
+   first_func = 1;
 
KASSERT(dinfo_size = sizeof(struct pci_devinfo),
(dinfo_size too small));
@@ -3475,14 +3511,13 @@ pci_add_children(device_t dev, int domai
if ((hdrtype  PCIM_HDRTYPE)  PCI_MAXHDRTYPE)
continue;
if (hdrtype  PCIM_MFDEV)
-   pcifunchigh = PCI_FUNCMAX;
-   for (f = 0; f = pcifunchigh; f++) {
-   dinfo = pci_read_device(pcib, domain, busno, s, f,
+   pcifunchigh = PCIB_MAXFUNCS(pcib);
+   for (f = first_func; f = pcifunchigh; f++)
+   pci_identify_function(pcib, dev, domain, busno, s, f,
dinfo_size);
-   if (dinfo != NULL) {
-   pci_add_child(dev, dinfo);
-   }
-   }
+
+   /* For slots after slot 0 we need to check for function 0. */
+   first_func = 0;
}
 #undef REG
 }

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Tue Apr  1 15:56:31 2014(r264010)
+++ head/sys/dev/pci/pci_pci.c  Tue Apr  1 16:02:02 2014(r264011)
@@ -56,6 +56,14 @@ static int   pcib_suspend(device_t dev);
 static int pcib_resume(device_t dev);
 static int pcib_power_for_sleep(device_t pcib, device_t dev,
int *pstate);
+static uint16_tpcib_ari_get_rid(device_t pcib, device_t dev);
+static uint32_tpcib_read_config(device_t dev, u_int b, u_int 
s, 
+u_int f, u_int reg, int width);
+static voidpcib_write_config(device_t dev, u_int b, u_int s,
+u_int f, u_int reg, uint32_t val, int width);
+static int 

svn commit: r264010 - head/sys/dev/usb/serial

2014-04-01 Thread Ian Lepore
Author: ian
Date: Tue Apr  1 15:56:31 2014
New Revision: 264010
URL: http://svnweb.freebsd.org/changeset/base/264010

Log:
  Support serial speeds up to 12mbaud with newer FTDI chips.
  
  Recent FDTI chips have the ability to operate at up to 12mbps.  The newer
  chips with faster clocks have the same usb vendor/product IDs as the older
  chips; the bcdDevice field must be used to detect the newer versions.  This
  change includes a new function to do that instead of using just the IDs from
  the vendor/product table.
  
  The code to choose the baud clock divisor is completely rewritten.  In
  addition to supporting the new higher clock rates, the rewrite fixes a
  longstanding bug in the old code which put the high bits of the fractional
  part of the divisor into the wrong place in the wIndex field.  That bug
  was mostly harmless -- it accidentally didn't affect standard baud rates
  and would only show up when using relatively fast non-standard rates.

Modified:
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/uftdi_reg.h

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Tue Apr  1 15:54:03 2014
(r264009)
+++ head/sys/dev/usb/serial/uftdi.c Tue Apr  1 15:56:31 2014
(r264010)
@@ -92,6 +92,21 @@ enum {
UFTDI_N_TRANSFER,
 };
 
+enum {
+   DEVT_SIO,
+   DEVT_232A,
+   DEVT_232B,
+   DEVT_2232D, /* Includes 2232C */
+   DEVT_232R,
+   DEVT_2232H,
+   DEVT_4232H,
+   DEVT_232H,
+   DEVT_230X,
+};
+
+#defineDEVF_BAUDBITS_HINDEX0x01/* Baud bits in high byte of 
index. */
+#defineDEVF_BAUDCLK_12M0X02/* Base baud clock is 12MHz. */
+
 struct uftdi_softc {
struct ucom_super_softc sc_super_ucom;
struct ucom_softc sc_ucom;
@@ -105,15 +120,16 @@ struct uftdi_softc {
 
uint16_t sc_last_lcr;
 
-   uint8_t sc_type;
-   uint8_t sc_iface_index;
+   uint8_t sc_devtype;
+   uint8_t sc_devflags;
uint8_t sc_hdrlen;
uint8_t sc_msr;
uint8_t sc_lsr;
 };
 
 struct uftdi_param_config {
-   uint16_t rate;
+   uint16_t baud_lobits;
+   uint16_t baud_hibits;
uint16_t lcr;
uint8_t v_start;
uint8_t v_stop;
@@ -135,8 +151,8 @@ static void uftdi_cfg_open(struct ucom_s
 static voiduftdi_cfg_set_dtr(struct ucom_softc *, uint8_t);
 static voiduftdi_cfg_set_rts(struct ucom_softc *, uint8_t);
 static voiduftdi_cfg_set_break(struct ucom_softc *, uint8_t);
-static int uftdi_set_parm_soft(struct termios *,
-   struct uftdi_param_config *, uint8_t);
+static int uftdi_set_parm_soft(struct ucom_softc *, struct termios *,
+   struct uftdi_param_config *);
 static int uftdi_pre_param(struct ucom_softc *, struct termios *);
 static voiduftdi_cfg_param(struct ucom_softc *, struct termios *);
 static voiduftdi_cfg_get_status(struct ucom_softc *, uint8_t *,
@@ -145,7 +161,6 @@ static void uftdi_start_read(struct ucom
 static voiduftdi_stop_read(struct ucom_softc *);
 static voiduftdi_start_write(struct ucom_softc *);
 static voiduftdi_stop_write(struct ucom_softc *);
-static uint8_t uftdi_8u232am_getrate(uint32_t, uint16_t *);
 static voiduftdi_poll(struct ucom_softc *ucom);
 
 static const struct usb_config uftdi_config[UFTDI_N_TRANSFER] = {
@@ -846,6 +861,80 @@ static const STRUCT_USB_HOST_ID uftdi_de
 #undef UFTDI_DEV
 };
 
+/*
+ * Set up softc fields whose value depends on the device type.
+ *
+ * Note that the 2232C and 2232D devices are the same for our purposes.  In the
+ * silicon the difference is that the D series has CPU FIFO mode and C doesn't.
+ * I haven't found any way of determining the C/D difference from info provided
+ * by the chip other than trying to set CPU FIFO mode and having it work or 
not.
+ * 
+ * Due to a hardware bug, a 232B chip without an eeprom reports itself as a 
+ * 232A, but if the serial number is also zero we know it's really a 232B. 
+ */
+static void
+uftdi_devtype_setup(struct uftdi_softc *sc, struct usb_attach_arg *uaa)
+{
+   struct usb_device_descriptor *dd;
+
+   switch (uaa-info.bcdDevice) {
+   case 0x200:
+   dd = usbd_get_device_descriptor(sc-sc_udev);
+   if (dd-iSerialNumber == 0) {
+   sc-sc_devtype = DEVT_232B;
+   } else {
+   sc-sc_devtype = DEVT_232A;
+   }
+   sc-sc_ucom.sc_portno = 0;
+   break;
+   case 0x400:
+   sc-sc_devtype = DEVT_232B;
+   sc-sc_ucom.sc_portno = 0;
+   break;
+   case 0x500:
+   sc-sc_devtype = DEVT_2232D;
+   sc-sc_devflags |= DEVF_BAUDBITS_HINDEX;
+   sc-sc_ucom.sc_portno = FTDI_PIT_SIOA + uaa-info.bIfaceNum;
+   break;
+   case 0x600:
+   

svn commit: r264013 - head/sys/dev/pci

2014-04-01 Thread Ryan Stone
Author: rstone
Date: Tue Apr  1 17:35:31 2014
New Revision: 264013
URL: http://svnweb.freebsd.org/changeset/base/264013

Log:
  Add missing copyright date.
  
  MFC after:2 months

Modified:
  head/sys/dev/pci/pcib_support.c

Modified: head/sys/dev/pci/pcib_support.c
==
--- head/sys/dev/pci/pcib_support.c Tue Apr  1 16:03:52 2014
(r264012)
+++ head/sys/dev/pci/pcib_support.c Tue Apr  1 17:35:31 2014
(r264013)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2014 Sandvine Inc.  All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264018 - head/share/man/man4

2014-04-01 Thread Ian Lepore
Author: ian
Date: Tue Apr  1 18:41:54 2014
New Revision: 264018
URL: http://svnweb.freebsd.org/changeset/base/264018

Log:
  Update the list of FTDI chips supported by uftdi(4).

Modified:
  head/share/man/man4/uftdi.4

Modified: head/share/man/man4/uftdi.4
==
--- head/share/man/man4/uftdi.4 Tue Apr  1 18:38:04 2014(r264017)
+++ head/share/man/man4/uftdi.4 Tue Apr  1 18:41:54 2014(r264018)
@@ -29,12 +29,13 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd November 20, 2011
+.Dd March 31, 2014
 .Dt UFTDI 4
 .Os
 .Sh NAME
 .Nm uftdi
-.Nd USB support for serial adapters based on the FT8U100AX and FT8U232AM chips
+.Nd USB support for serial adapters based on the FTDI family of USB
+serial adapter chips.
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -54,8 +55,29 @@ uftdi_load=YES
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for various serial adapters based on the FTDI
-FT2232C, FT8U100AX and FT8U232AM chips.
+driver provides support for various serial adapters based on the
+following FTDI chips:
+.Pp
+.Bl -bullet -compact
+.It
+FT8U100AX
+.It
+FT8U232AM
+.It
+FT8U232BM
+.It
+FT232R
+.It
+FT2232C
+.It
+FT2232D
+.It
+FT2232H
+.It
+FT4232H
+.It
+FT230X
+.El
 .Pp
 The device is accessed through the
 .Xr ucom 4
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264016 - head/tools/test/ppsapi

2014-04-01 Thread George V. Neville-Neil
Author: gnn
Date: Tue Apr  1 18:37:00 2014
New Revision: 264016
URL: http://svnweb.freebsd.org/changeset/base/264016

Log:
  Silence an unnecessary warning.
  
  MFC after:2 weeks

Modified:
  head/tools/test/ppsapi/Makefile

Modified: head/tools/test/ppsapi/Makefile
==
--- head/tools/test/ppsapi/Makefile Tue Apr  1 18:24:40 2014
(r264015)
+++ head/tools/test/ppsapi/Makefile Tue Apr  1 18:37:00 2014
(r264016)
@@ -7,5 +7,7 @@ WARNS?= 5
 
 .include bsd.prog.mk
 
+CFLAGS+=-Wno-format-security
+
 test:  ${PROG}
./${PROG} /dev/cuau0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264019 - head/sys/arm/ti

2014-04-01 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Apr  1 18:46:56 2014
New Revision: 264019
URL: http://svnweb.freebsd.org/changeset/base/264019

Log:
  Fix some of the style(9) problems on ti_gpio.  Note that this commit does
  not fix all the style(9) problems, but will open room for the next commits.
  
  Remove redundant code and declarations.
  
  No functional changes.

Modified:
  head/sys/arm/ti/ti_gpio.c

Modified: head/sys/arm/ti/ti_gpio.c
==
--- head/sys/arm/ti/ti_gpio.c   Tue Apr  1 18:41:54 2014(r264018)
+++ head/sys/arm/ti/ti_gpio.c   Tue Apr  1 18:46:56 2014(r264019)
@@ -66,92 +66,88 @@ __FBSDID($FreeBSD$);
 
 #include gpio_if.h
 
- /* Register definitions */
-#define TI_GPIO_REVISION   0x
-#define TI_GPIO_SYSCONFIG  0x0010
+/* Register definitions */
+#defineTI_GPIO_REVISION0x
+#defineTI_GPIO_SYSCONFIG   0x0010
 #if defined(SOC_OMAP3)
-#define TI_GPIO_REVISION   0x
-#define TI_GPIO_SYSCONFIG  0x0010
-#define TI_GPIO_SYSSTATUS  0x0014
-#define TI_GPIO_IRQSTATUS1 0x0018
-#define TI_GPIO_IRQENABLE1 0x001C
-#define TI_GPIO_WAKEUPENABLE   0x0020
-#define TI_GPIO_IRQSTATUS2 0x0028
-#define TI_GPIO_IRQENABLE2 0x002C
-#define TI_GPIO_CTRL   0x0030
-#define TI_GPIO_OE 0x0034
-#define TI_GPIO_DATAIN 0x0038
-#define TI_GPIO_DATAOUT0x003C
-#define TI_GPIO_LEVELDETECT0   0x0040
-#define TI_GPIO_LEVELDETECT1   0x0044
-#define TI_GPIO_RISINGDETECT   0x0048
-#define TI_GPIO_FALLINGDETECT  0x004C
-#define TI_GPIO_DEBOUNCENABLE  0x0050
-#define TI_GPIO_DEBOUNCINGTIME 0x0054
-#define TI_GPIO_CLEARIRQENABLE10x0060
-#define TI_GPIO_SETIRQENABLE1  0x0064
-#define TI_GPIO_CLEARIRQENABLE20x0070
-#define TI_GPIO_SETIRQENABLE2  0x0074
-#define TI_GPIO_CLEARWKUENA0x0080
-#define TI_GPIO_SETWKUENA  0x0084
-#define TI_GPIO_CLEARDATAOUT   0x0090
-#define TI_GPIO_SETDATAOUT 0x0094
+#defineTI_GPIO_SYSSTATUS   0x0014
+#defineTI_GPIO_IRQSTATUS1  0x0018
+#defineTI_GPIO_IRQENABLE1  0x001C
+#defineTI_GPIO_WAKEUPENABLE0x0020
+#defineTI_GPIO_IRQSTATUS2  0x0028
+#defineTI_GPIO_IRQENABLE2  0x002C
+#defineTI_GPIO_CTRL0x0030
+#defineTI_GPIO_OE  0x0034
+#defineTI_GPIO_DATAIN  0x0038
+#defineTI_GPIO_DATAOUT 0x003C
+#defineTI_GPIO_LEVELDETECT00x0040
+#defineTI_GPIO_LEVELDETECT10x0044
+#defineTI_GPIO_RISINGDETECT0x0048
+#defineTI_GPIO_FALLINGDETECT   0x004C
+#defineTI_GPIO_DEBOUNCENABLE   0x0050
+#defineTI_GPIO_DEBOUNCINGTIME  0x0054
+#defineTI_GPIO_CLEARIRQENABLE1 0x0060
+#defineTI_GPIO_SETIRQENABLE1   0x0064
+#defineTI_GPIO_CLEARIRQENABLE2 0x0070
+#defineTI_GPIO_SETIRQENABLE2   0x0074
+#defineTI_GPIO_CLEARWKUENA 0x0080
+#defineTI_GPIO_SETWKUENA   0x0084
+#defineTI_GPIO_CLEARDATAOUT0x0090
+#defineTI_GPIO_SETDATAOUT  0x0094
 #elif defined(SOC_OMAP4) || defined(SOC_TI_AM335X)
-#define TI_GPIO_IRQSTATUS_RAW_00x0024
-#define TI_GPIO_IRQSTATUS_RAW_10x0028
-#define TI_GPIO_IRQSTATUS_00x002C
-#define TI_GPIO_IRQSTATUS_10x0030
-#define TI_GPIO_IRQSTATUS_SET_00x0034
-#define TI_GPIO_IRQSTATUS_SET_10x0038
-#define TI_GPIO_IRQSTATUS_CLR_00x003C
-#define TI_GPIO_IRQSTATUS_CLR_10x0040
-#define TI_GPIO_IRQWAKEN_0 0x0044
-#define TI_GPIO_IRQWAKEN_1 0x0048
-#define TI_GPIO_SYSSTATUS  0x0114
-#define TI_GPIO_IRQSTATUS1 0x0118
-#define TI_GPIO_IRQENABLE1 0x011C
-#define TI_GPIO_WAKEUPENABLE   0x0120
-#define TI_GPIO_IRQSTATUS2 0x0128
-#define TI_GPIO_IRQENABLE2 0x012C
-#define TI_GPIO_CTRL   0x0130
-#define TI_GPIO_OE 0x0134
-#define TI_GPIO_DATAIN 0x0138
-#define TI_GPIO_DATAOUT0x013C
-#define TI_GPIO_LEVELDETECT0   0x0140
-#define TI_GPIO_LEVELDETECT1   0x0144
-#define TI_GPIO_RISINGDETECT   0x0148
-#define TI_GPIO_FALLINGDETECT  0x014C
-#define TI_GPIO_DEBOUNCENABLE  0x0150
-#define TI_GPIO_DEBOUNCINGTIME 0x0154
-#define TI_GPIO_CLEARIRQENABLE10x0160
-#define TI_GPIO_SETIRQENABLE1  

svn commit: r264020 - head/sys/cam/ctl

2014-04-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr  1 21:13:05 2014
New Revision: 264020
URL: http://svnweb.freebsd.org/changeset/base/264020

Log:
  Remove the homegrown ctl_be_block_io allocator, replacing it with UMA.
  There is no performance difference.
  
  Reviewed by:  mav@
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cTue Apr  1 18:46:56 2014
(r264019)
+++ head/sys/cam/ctl/ctl_backend_block.cTue Apr  1 21:13:05 2014
(r264020)
@@ -173,9 +173,7 @@ struct ctl_be_block_lun {
  * Overall softc structure for the block backend module.
  */
 struct ctl_be_block_softc {
-   STAILQ_HEAD(, ctl_be_block_io)   beio_free_queue;
struct mtx   lock;
-   int  prealloc_beio;
int  num_disks;
STAILQ_HEAD(, ctl_block_disk)disk_list;
int  num_luns;
@@ -205,7 +203,6 @@ struct ctl_be_block_io {
uint64_tio_offset;
struct ctl_be_block_softc   *softc;
struct ctl_be_block_lun *lun;
-   STAILQ_ENTRY(ctl_be_block_io)   links;
 };
 
 static int cbb_num_threads = 14;
@@ -217,10 +214,6 @@ SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO
 
 static struct ctl_be_block_io *ctl_alloc_beio(struct ctl_be_block_softc 
*softc);
 static void ctl_free_beio(struct ctl_be_block_io *beio);
-static int ctl_grow_beio(struct ctl_be_block_softc *softc, int count);
-#if 0
-static void ctl_shrink_beio(struct ctl_be_block_softc *softc);
-#endif
 static void ctl_complete_beio(struct ctl_be_block_io *beio);
 static int ctl_be_block_move_done(union ctl_io *io);
 static void ctl_be_block_biodone(struct bio *bio);
@@ -282,68 +275,24 @@ static struct ctl_backend_driver ctl_be_
 MALLOC_DEFINE(M_CTLBLK, ctlblk, Memory used for CTL block backend);
 CTL_BACKEND_DECLARE(cbb, ctl_be_block_driver);
 
+static uma_zone_t beio_zone;
+
 static struct ctl_be_block_io *
 ctl_alloc_beio(struct ctl_be_block_softc *softc)
 {
struct ctl_be_block_io *beio;
-   int count;
-
-   mtx_lock(softc-lock);
-
-   beio = STAILQ_FIRST(softc-beio_free_queue);
-   if (beio != NULL) {
-   STAILQ_REMOVE(softc-beio_free_queue, beio,
- ctl_be_block_io, links);
-   }
-   mtx_unlock(softc-lock);
-
-   if (beio != NULL) {
-   bzero(beio, sizeof(*beio));
-   beio-softc = softc;
-   return (beio);
-   }
-
-   for (;;) {
-
-   count = ctl_grow_beio(softc, /*count*/ 10);
-
-   /*
-* This shouldn't be possible, since ctl_grow_beio() uses a
-* blocking malloc.
-*/
-   if (count == 0)
-   return (NULL);
-
-   /*
-* Since we have to drop the lock when we're allocating beio
-* structures, it's possible someone else can come along and
-* allocate the beio's we've just allocated.
-*/
-   mtx_lock(softc-lock);
-   beio = STAILQ_FIRST(softc-beio_free_queue);
-   if (beio != NULL) {
-   STAILQ_REMOVE(softc-beio_free_queue, beio,
- ctl_be_block_io, links);
-   }
-   mtx_unlock(softc-lock);
 
-   if (beio != NULL) {
-   bzero(beio, sizeof(*beio));
-   beio-softc = softc;
-   break;
-   }
-   }
+   beio = uma_zalloc(beio_zone, M_WAITOK | M_ZERO);
+   beio-softc = softc;
return (beio);
 }
 
 static void
 ctl_free_beio(struct ctl_be_block_io *beio)
 {
-   struct ctl_be_block_softc *softc;
int duplicate_free;
int i;
 
-   softc = beio-softc;
duplicate_free = 0;
 
for (i = 0; i  beio-num_segs; i++) {
@@ -358,47 +307,10 @@ ctl_free_beio(struct ctl_be_block_io *be
printf(%s: %d duplicate frees out of %d segments\n, __func__,
   duplicate_free, beio-num_segs);
}
-   mtx_lock(softc-lock);
-   STAILQ_INSERT_TAIL(softc-beio_free_queue, beio, links);
-   mtx_unlock(softc-lock);
-}
 
-static int
-ctl_grow_beio(struct ctl_be_block_softc *softc, int count)
-{
-   int i;
-
-   for (i = 0; i  count; i++) {
-   struct ctl_be_block_io *beio;
-
-   beio = (struct ctl_be_block_io *)malloc(sizeof(*beio),
-  M_CTLBLK,
-  M_WAITOK | M_ZERO);
-   beio-softc = softc;
-   mtx_lock(softc-lock);
-   STAILQ_INSERT_TAIL(softc-beio_free_queue, 

svn commit: r264021 - head/lib/libnv

2014-04-01 Thread Jilles Tjoelker
Author: jilles
Date: Tue Apr  1 21:30:54 2014
New Revision: 264021
URL: http://svnweb.freebsd.org/changeset/base/264021

Log:
  libnv: Don't lose big-endian flag when receiving a message.
  
  A bug caused the big endian flag to be lost when receiving a message. As a
  result, the bits are interpreted as little endian and an extremely large
  allocation is attempted.
  
  This change fixes ping(8)'s communication to casperd(8) on big-endian
  architectures.
  
  Reported by:  Anton Shterenlikht
  Tested by:danfe

Modified:
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/nvlist.c
==
--- head/lib/libnv/nvlist.c Tue Apr  1 21:13:05 2014(r264020)
+++ head/lib/libnv/nvlist.c Tue Apr  1 21:30:54 2014(r264021)
@@ -582,7 +582,7 @@ nvlist_check_header(struct nvlist_header
errno = EINVAL;
return (false);
}
-   if ((nvlhdrp-nvlh_flags = ~NV_FLAG_ALL_MASK) != 0) {
+   if ((nvlhdrp-nvlh_flags  ~NV_FLAG_ALL_MASK) != 0) {
errno = EINVAL;
return (false);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264022 - in head/sys: cam/ctl dev/iscsi

2014-04-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr  1 21:40:46 2014
New Revision: 264022
URL: http://svnweb.freebsd.org/changeset/base/264022

Log:
  Get rid of ICL lock; use upper-layer (initiator or target) lock instead.
  This avoids extra locking in icl_pdu_queue(); the upper layer needs to call
  it while holding its own lock anyway, to avoid sending PDUs out of order.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/dev/iscsi/icl.c
  head/sys/dev/iscsi/icl.h
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Tue Apr  1 21:30:54 2014
(r264021)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Tue Apr  1 21:40:46 2014
(r264022)
@@ -1215,7 +1215,7 @@ cfiscsi_session_new(struct cfiscsi_softc
cv_init(cs-cs_login_cv, cfiscsi_login);
 #endif
 
-   cs-cs_conn = icl_conn_new();
+   cs-cs_conn = icl_conn_new(cs-cs_lock);
cs-cs_conn-ic_receive = cfiscsi_receive_callback;
cs-cs_conn-ic_error = cfiscsi_error_callback;
cs-cs_conn-ic_prv0 = cs;

Modified: head/sys/dev/iscsi/icl.c
==
--- head/sys/dev/iscsi/icl.cTue Apr  1 21:30:54 2014(r264021)
+++ head/sys/dev/iscsi/icl.cTue Apr  1 21:40:46 2014(r264022)
@@ -88,9 +88,10 @@ static volatile u_inticl_ncons;
}   \
} while (0)
 
-#define ICL_CONN_LOCK(X)   mtx_lock(X-ic_lock)
-#define ICL_CONN_UNLOCK(X) mtx_unlock(X-ic_lock)
-#define ICL_CONN_LOCK_ASSERT(X)mtx_assert(X-ic_lock, 
MA_OWNED)
+#define ICL_CONN_LOCK(X)   mtx_lock(X-ic_lock)
+#define ICL_CONN_UNLOCK(X) mtx_unlock(X-ic_lock)
+#define ICL_CONN_LOCK_ASSERT(X)mtx_assert(X-ic_lock, MA_OWNED)
+#define ICL_CONN_LOCK_ASSERT_NOT(X)mtx_assert(X-ic_lock, MA_NOTOWNED)
 
 static void
 icl_conn_fail(struct icl_conn *ic)
@@ -896,7 +897,7 @@ icl_send_thread(void *arg)
break;
}
icl_conn_send_pdus(ic);
-   cv_wait(ic-ic_send_cv, ic-ic_lock);
+   cv_wait(ic-ic_send_cv, ic-ic_lock);
}
 
ic-ic_send_running = false;
@@ -961,20 +962,19 @@ icl_pdu_queue(struct icl_pdu *ip)
 
ic = ip-ip_conn;
 
-   ICL_CONN_LOCK(ic);
+   ICL_CONN_LOCK_ASSERT(ic);
+
if (ic-ic_disconnecting || ic-ic_socket == NULL) {
ICL_DEBUG(icl_pdu_queue on closed connection);
-   ICL_CONN_UNLOCK(ic);
icl_pdu_free(ip);
return;
}
TAILQ_INSERT_TAIL(ic-ic_to_send, ip, ip_next);
-   ICL_CONN_UNLOCK(ic);
cv_signal(ic-ic_send_cv);
 }
 
 struct icl_conn *
-icl_conn_new(void)
+icl_conn_new(struct mtx *lock)
 {
struct icl_conn *ic;
 
@@ -983,7 +983,7 @@ icl_conn_new(void)
ic = uma_zalloc(icl_conn_zone, M_WAITOK | M_ZERO);
 
TAILQ_INIT(ic-ic_to_send);
-   mtx_init(ic-ic_lock, icl_lock, NULL, MTX_DEF);
+   ic-ic_lock = lock;
cv_init(ic-ic_send_cv, icl_tx);
cv_init(ic-ic_receive_cv, icl_rx);
 #ifdef DIAGNOSTIC
@@ -998,7 +998,6 @@ void
 icl_conn_free(struct icl_conn *ic)
 {
 
-   mtx_destroy(ic-ic_lock);
cv_destroy(ic-ic_send_cv);
cv_destroy(ic-ic_receive_cv);
uma_zfree(icl_conn_zone, ic);
@@ -1102,6 +1101,8 @@ icl_conn_handoff(struct icl_conn *ic, in
cap_rights_t rights;
int error;
 
+   ICL_CONN_LOCK_ASSERT_NOT(ic);
+
/*
 * Steal the socket from userland.
 */
@@ -1141,6 +1142,7 @@ icl_conn_handoff(struct icl_conn *ic, in
 void
 icl_conn_shutdown(struct icl_conn *ic)
 {
+   ICL_CONN_LOCK_ASSERT_NOT(ic);
 
ICL_CONN_LOCK(ic);
if (ic-ic_socket == NULL) {
@@ -1157,6 +1159,8 @@ icl_conn_close(struct icl_conn *ic)
 {
struct icl_pdu *pdu;
 
+   ICL_CONN_LOCK_ASSERT_NOT(ic);
+
ICL_CONN_LOCK(ic);
if (ic-ic_socket == NULL) {
ICL_CONN_UNLOCK(ic);
@@ -1214,6 +1218,7 @@ icl_conn_close(struct icl_conn *ic)
 bool
 icl_conn_connected(struct icl_conn *ic)
 {
+   ICL_CONN_LOCK_ASSERT_NOT(ic);
 
ICL_CONN_LOCK(ic);
if (ic-ic_socket == NULL) {
@@ -1234,6 +1239,8 @@ icl_conn_handoff_sock(struct icl_conn *i
 {
int error;
 
+   ICL_CONN_LOCK_ASSERT_NOT(ic);
+
if (so-so_type != SOCK_STREAM)
return (EINVAL);
 

Modified: head/sys/dev/iscsi/icl.h
==
--- head/sys/dev/iscsi/icl.hTue Apr  1 21:30:54 2014(r264021)
+++ head/sys/dev/iscsi/icl.hTue Apr  1 21:40:46 2014(r264022)
@@ -74,7 +74,7 @@ void  icl_pdu_free(struct icl_pdu *ip);
 #define

svn commit: r264023 - in head/sys: cam/ctl dev/iscsi

2014-04-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr  1 21:47:22 2014
New Revision: 264023
URL: http://svnweb.freebsd.org/changeset/base/264023

Log:
  Instead of icltx and iclrx, use thread names with prefix from upper
  layer, so that one can see which side of the stack the threads are for.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/dev/iscsi/icl.c
  head/sys/dev/iscsi/icl.h
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Tue Apr  1 21:40:46 2014
(r264022)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Tue Apr  1 21:47:22 2014
(r264023)
@@ -1215,7 +1215,7 @@ cfiscsi_session_new(struct cfiscsi_softc
cv_init(cs-cs_login_cv, cfiscsi_login);
 #endif
 
-   cs-cs_conn = icl_conn_new(cs-cs_lock);
+   cs-cs_conn = icl_conn_new(cfiscsi, cs-cs_lock);
cs-cs_conn-ic_receive = cfiscsi_receive_callback;
cs-cs_conn-ic_error = cfiscsi_error_callback;
cs-cs_conn-ic_prv0 = cs;

Modified: head/sys/dev/iscsi/icl.c
==
--- head/sys/dev/iscsi/icl.cTue Apr  1 21:40:46 2014(r264022)
+++ head/sys/dev/iscsi/icl.cTue Apr  1 21:47:22 2014(r264023)
@@ -974,7 +974,7 @@ icl_pdu_queue(struct icl_pdu *ip)
 }
 
 struct icl_conn *
-icl_conn_new(struct mtx *lock)
+icl_conn_new(const char *name, struct mtx *lock)
 {
struct icl_conn *ic;
 
@@ -990,6 +990,7 @@ icl_conn_new(struct mtx *lock)
refcount_init(ic-ic_outstanding_pdus, 0);
 #endif
ic-ic_max_data_segment_length = ICL_MAX_DATA_SEGMENT_LENGTH;
+   ic-ic_name = name;
 
return (ic);
 }
@@ -1065,14 +1066,16 @@ icl_conn_start(struct icl_conn *ic)
/*
 * Start threads.
 */
-   error = kthread_add(icl_send_thread, ic, NULL, NULL, 0, 0, icltx);
+   error = kthread_add(icl_send_thread, ic, NULL, NULL, 0, 0, %stx,
+   ic-ic_name);
if (error != 0) {
ICL_WARN(kthread_add(9) failed with error %d, error);
icl_conn_close(ic);
return (error);
}
 
-   error = kthread_add(icl_receive_thread, ic, NULL, NULL, 0, 0, iclrx);
+   error = kthread_add(icl_receive_thread, ic, NULL, NULL, 0, 0, %srx,
+   ic-ic_name);
if (error != 0) {
ICL_WARN(kthread_add(9) failed with error %d, error);
icl_conn_close(ic);

Modified: head/sys/dev/iscsi/icl.h
==
--- head/sys/dev/iscsi/icl.hTue Apr  1 21:40:46 2014(r264022)
+++ head/sys/dev/iscsi/icl.hTue Apr  1 21:47:22 2014(r264023)
@@ -92,6 +92,7 @@ struct icl_conn {
size_t  ic_max_data_segment_length;
boolic_disconnecting;
boolic_iser;
+   const char  *ic_name;
 
void(*ic_receive)(struct icl_pdu *);
void(*ic_error)(struct icl_conn *);
@@ -102,7 +103,7 @@ struct icl_conn {
void*ic_prv0;
 };
 
-struct icl_conn*icl_conn_new(struct mtx *lock);
+struct icl_conn*icl_conn_new(const char *name, struct mtx 
*lock);
 void   icl_conn_free(struct icl_conn *ic);
 inticl_conn_handoff(struct icl_conn *ic, int fd);
 void   icl_conn_shutdown(struct icl_conn *ic);

Modified: head/sys/dev/iscsi/iscsi.c
==
--- head/sys/dev/iscsi/iscsi.c  Tue Apr  1 21:40:46 2014(r264022)
+++ head/sys/dev/iscsi/iscsi.c  Tue Apr  1 21:47:22 2014(r264023)
@@ -1641,7 +1641,7 @@ iscsi_ioctl_session_add(struct iscsi_sof
return (EBUSY);
}
 
-   is-is_conn = icl_conn_new(is-is_lock);
+   is-is_conn = icl_conn_new(iscsi, is-is_lock);
is-is_conn-ic_receive = iscsi_receive_callback;
is-is_conn-ic_error = iscsi_error_callback;
is-is_conn-ic_prv0 = is;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264024 - head/sys/cam/ctl

2014-04-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr  1 21:54:20 2014
New Revision: 264024
URL: http://svnweb.freebsd.org/changeset/base/264024

Log:
  Use atomic ops instead of mutexes where appropriate.
  
  Submitted by: mav@
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Tue Apr  1 21:47:22 2014
(r264023)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Tue Apr  1 21:54:20 2014
(r264024)
@@ -967,9 +967,7 @@ cfiscsi_callout(void *context)
 
callout_schedule(cs-cs_callout, 1 * hz);
 
-   CFISCSI_SESSION_LOCK(cs);
-   cs-cs_timeout++;
-   CFISCSI_SESSION_UNLOCK(cs);
+   atomic_add_int(cs-cs_timeout, 1);
 
 #ifdef ICL_KERNEL_PROXY
if (cs-cs_waiting_for_ctld || cs-cs_login_phase) {
@@ -2522,10 +2520,8 @@ cfiscsi_datamove_out(union ctl_io *io)
 */
PDU_TOTAL_TRANSFER_LEN(request) = io-scsiio.kern_total_len;
 
-   CFISCSI_SESSION_LOCK(cs);
-   target_transfer_tag = cs-cs_target_transfer_tag;
-   cs-cs_target_transfer_tag++;
-   CFISCSI_SESSION_UNLOCK(cs);
+   target_transfer_tag =
+   atomic_fetchadd_32(cs-cs_target_transfer_tag, 1);
 
 #if 0
CFISCSI_SESSION_DEBUG(cs, expecting Data-Out with initiator 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264025 - head/sys/dev/iscsi

2014-04-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr  1 22:03:03 2014
New Revision: 264025
URL: http://svnweb.freebsd.org/changeset/base/264025

Log:
  Get rid of the autoscaling, instead just set socket buffer sizes
  in the usual way.  The only thing the old code did was making things
  less predictable.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/icl.c

Modified: head/sys/dev/iscsi/icl.c
==
--- head/sys/dev/iscsi/icl.cTue Apr  1 21:54:20 2014(r264024)
+++ head/sys/dev/iscsi/icl.cTue Apr  1 22:03:03 2014(r264025)
@@ -68,6 +68,14 @@ TUNABLE_INT(kern.icl.partial_receive_le
 SYSCTL_INT(_kern_icl, OID_AUTO, partial_receive_len, CTLFLAG_RW,
 partial_receive_len, 1 * 1024, Minimum read size for partially received 
 data segment);
+static int sendspace = 1048576;
+TUNABLE_INT(kern.icl.sendspace, sendspace);
+SYSCTL_INT(_kern_icl, OID_AUTO, sendspace, CTLFLAG_RW,
+sendspace, 1048576, Default send socket buffer size);
+static int recvspace = 1048576;
+TUNABLE_INT(kern.icl.recvspace, recvspace);
+SYSCTL_INT(_kern_icl, OID_AUTO, recvspace, CTLFLAG_RW,
+recvspace, 1048576, Default receive socket buffer size);
 
 static uma_zone_t icl_conn_zone;
 static uma_zone_t icl_pdu_zone;
@@ -1008,7 +1016,7 @@ icl_conn_free(struct icl_conn *ic)
 static int
 icl_conn_start(struct icl_conn *ic)
 {
-   size_t bufsize;
+   size_t minspace;
struct sockopt opt;
int error, one = 1;
 
@@ -1029,18 +1037,28 @@ icl_conn_start(struct icl_conn *ic)
ICL_CONN_UNLOCK(ic);
 
/*
-* Use max available sockbuf size for sending.  Do it manually
-* instead of sbreserve(9) to work around resource limits.
+* For sendspace, this is required because the current code cannot
+* send a PDU in pieces; thus, the minimum buffer size is equal
+* to the maximum PDU size.  +4 is to account for possible padding.
 *
-* XXX: This kind of sucks.  On one hand, we don't currently support
-*  sending a part of data segment; we always do it in one piece,
-*  so we have to make sure it can fit in the socket buffer.
-*  Once I've implemented partial send, we'll get rid of this
-*  and use autoscaling.
+* What we should actually do here is to use autoscaling, but set
+* some minimal buffer size to minspace.  I don't know a way to do
+* that, though.
 */
-bufsize = (sizeof(struct iscsi_bhs) +
-ic-ic_max_data_segment_length) * 8;
-   error = soreserve(ic-ic_socket, bufsize, bufsize);
+   minspace = sizeof(struct iscsi_bhs) + ic-ic_max_data_segment_length +
+   ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4;
+   if (sendspace  minspace) {
+   ICL_WARN(kern.icl.sendspace too low; must be at least %jd,
+   minspace);
+   sendspace = minspace;
+   }
+   if (recvspace  minspace) {
+   ICL_WARN(kern.icl.recvspace too low; must be at least %jd,
+   minspace);
+   recvspace = minspace;
+   }
+
+   error = soreserve(ic-ic_socket, sendspace, recvspace);
if (error != 0) {
ICL_WARN(soreserve failed with error %d, error);
icl_conn_close(ic);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264026 - head/sys/dev/iscsi

2014-04-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Apr  1 22:21:56 2014
New Revision: 264026
URL: http://svnweb.freebsd.org/changeset/base/264026

Log:
  Enable a KASSERT.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/icl.c

Modified: head/sys/dev/iscsi/icl.c
==
--- head/sys/dev/iscsi/icl.cTue Apr  1 22:03:03 2014(r264025)
+++ head/sys/dev/iscsi/icl.cTue Apr  1 22:21:56 2014(r264026)
@@ -1225,10 +1225,7 @@ icl_conn_close(struct icl_conn *ic)
 
KASSERT(TAILQ_EMPTY(ic-ic_to_send),
(destroying session with non-empty send queue));
-   /*
-* XXX
-*/
-#if 0
+#ifdef DIAGNOSTIC
KASSERT(ic-ic_outstanding_pdus == 0,
(destroying session with %d outstanding PDUs,
 ic-ic_outstanding_pdus));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264027 - in head: release share/man/man7

2014-04-01 Thread Glen Barber
Author: gjb
Date: Tue Apr  1 22:41:26 2014
New Revision: 264027
URL: http://svnweb.freebsd.org/changeset/base/264027

Log:
  Add a new release build variable, WITH_COMPRESSED_IMAGES.
  
  When set to a non-empty value, the installation medium is
  compressed with gzip(1) as part of the 'install' target in
  the release/ directory.
  
  With gzip(1) compression, downloadable image are reduced in
  size quite significantly.  Build test against head@263927
  shows the following:
  
   bootonly.iso:64% smaller
   disc1.iso:   44% smaller
   memstick.img:47% smaller
   mini-memstick.img:   65% smaller
   dvd1.iso:untested
  
  This option is off by default, I would eventually like to
  turn it on by default, and remove the '-k' flag to gzip(1)
  so only compressed images are published on FTP.
  
  Requested by: wkoszek
  MFC After:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/Makefile
  head/release/release.conf.sample
  head/release/release.sh
  head/share/man/man7/release.7

Modified: head/release/Makefile
==
--- head/release/Makefile   Tue Apr  1 22:21:56 2014(r264026)
+++ head/release/Makefile   Tue Apr  1 22:41:26 2014(r264027)
@@ -21,6 +21,8 @@
 #  NOSRC:if set, do not distribute source tree
 #  NODOC:if set, do not generate release documentation
 #  WITH_DVD: if set, generate dvd1.iso
+#  WITH_COMPRESSED_IMAGES: if set, compress installation images with gzip(1)
+#  (uncompressed images are not removed)
 #  TARGET/TARGET_ARCH: architecture of built release 
 #
 
@@ -251,6 +253,9 @@ install:
cp -a ftp ${DESTDIR}/
 .for I in ${IMAGES}
cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
+. if defined(WITH_COMPRESSED_IMAGES) || !empty(WITH_COMPRESSED_IMAGES)
+   gzip -k ${DESTDIR}/${OSRELEASE}-${I}
+. endif
 .endfor
cd ${DESTDIR}  sha256 ${OSRELEASE}*  ${DESTDIR}/CHECKSUM.SHA256
cd ${DESTDIR}  md5 ${OSRELEASE}*  ${DESTDIR}/CHECKSUM.MD5

Modified: head/release/release.conf.sample
==
--- head/release/release.conf.sampleTue Apr  1 22:21:56 2014
(r264026)
+++ head/release/release.conf.sampleTue Apr  1 22:41:26 2014
(r264027)
@@ -46,6 +46,7 @@ PORTBRANCH=ports/head@rHEAD
 #NODOC=
 #NOPORTS=
 #WITH_DVD=
+#WITH_COMPRESSED_IMAGES=
 
 ## Set when building embedded images.
 #EMBEDDEDBUILD=

Modified: head/release/release.sh
==
--- head/release/release.sh Tue Apr  1 22:21:56 2014(r264026)
+++ head/release/release.sh Tue Apr  1 22:41:26 2014(r264027)
@@ -83,6 +83,7 @@ NOPORTS=
 
 # Set to non-empty value to build dvd1.iso as part of the release.
 WITH_DVD=
+WITH_COMPRESSED_IMAGES=
 
 usage() {
echo Usage: $0 [-c release.conf]
@@ -128,6 +129,7 @@ if [ -n ${EMBEDDEDBUILD} ]; then
exit 1
fi
WITH_DVD=
+   WITH_COMPRESSED_IMAGES=
NODOC=yes
 fi
 
@@ -262,4 +264,4 @@ eval chroot ${CHROOTDIR} make -C /usr/sr
 eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \
release
 eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \
-   install DESTDIR=/R
+   install DESTDIR=/R WITH_COMPRESSED_IMAGES=${WITH_COMPRESSED_IMAGES}

Modified: head/share/man/man7/release.7
==
--- head/share/man/man7/release.7   Tue Apr  1 22:21:56 2014
(r264026)
+++ head/share/man/man7/release.7   Tue Apr  1 22:41:26 2014
(r264027)
@@ -250,6 +250,12 @@ Setting this also sets
 Set to a non-empty value to include the
 .Cm dvdrom
 target.
+.It Va WITH_COMPRESSED_IMAGES
+Set to a non-empty value to compress the release images with
+.Xr gzip 1 .
+The original
+.Pq uncompressed
+images are not removed.
 .It Va VCSCMD
 The command run to obtain the source trees.
 Defaults to
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264028 - head/release

2014-04-01 Thread Glen Barber
Author: gjb
Date: Tue Apr  1 22:46:46 2014
New Revision: 264028
URL: http://svnweb.freebsd.org/changeset/base/264028

Log:
  Clean up trailing whitespace in release/Makefile.
  
  MFC after:1 week
  X-MFC-With:   r264027
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/Makefile

Modified: head/release/Makefile
==
--- head/release/Makefile   Tue Apr  1 22:41:26 2014(r264027)
+++ head/release/Makefile   Tue Apr  1 22:46:46 2014(r264028)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 #
 # Makefile for building releases and release media.
-# 
+#
 # User-driven targets:
 #  cdrom: Builds release CD-ROM media (disc1.iso)
 #  dvdrom: Builds release DVD-ROM media (dvd1.iso)
@@ -13,7 +13,7 @@
 #
 # Variables affecting the build process:
 #  WORLDDIR: location of src tree -- must have built world and default kernel
-#(by default, the directory above this one) 
+#(by default, the directory above this one)
 #  PORTSDIR: location of ports tree to distribute (default: /usr/ports)
 #  DOCDIR:   location of doc tree (default: /usr/doc)
 #  NOPKG:if set, do not distribute third-party packages
@@ -23,7 +23,7 @@
 #  WITH_DVD: if set, generate dvd1.iso
 #  WITH_COMPRESSED_IMAGES: if set, compress installation images with gzip(1)
 #  (uncompressed images are not removed)
-#  TARGET/TARGET_ARCH: architecture of built release 
+#  TARGET/TARGET_ARCH: architecture of built release
 #
 
 WORLDDIR?= ${.CURDIR}/..
@@ -65,7 +65,7 @@ NODOC= true
 NOPORTS= true
 .endif
 
-EXTRA_PACKAGES= 
+EXTRA_PACKAGES=
 .if !defined(NOPORTS)
 EXTRA_PACKAGES+= ports.txz
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264029 - head/release

2014-04-01 Thread Glen Barber
Author: gjb
Date: Tue Apr  1 22:52:27 2014
New Revision: 264029
URL: http://svnweb.freebsd.org/changeset/base/264029

Log:
  Fix logic error: s/||//
  
  Pointyhat:gjb
  MFC after:1 week
  X-MFC-With:   r264027,r264028
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/Makefile

Modified: head/release/Makefile
==
--- head/release/Makefile   Tue Apr  1 22:46:46 2014(r264028)
+++ head/release/Makefile   Tue Apr  1 22:52:27 2014(r264029)
@@ -253,7 +253,7 @@ install:
cp -a ftp ${DESTDIR}/
 .for I in ${IMAGES}
cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
-. if defined(WITH_COMPRESSED_IMAGES) || !empty(WITH_COMPRESSED_IMAGES)
+. if defined(WITH_COMPRESSED_IMAGES)  !empty(WITH_COMPRESSED_IMAGES)
gzip -k ${DESTDIR}/${OSRELEASE}-${I}
 . endif
 .endfor
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264030 - head/release

2014-04-01 Thread Glen Barber
Author: gjb
Date: Tue Apr  1 22:54:54 2014
New Revision: 264030
URL: http://svnweb.freebsd.org/changeset/base/264030

Log:
  If WITH_COMPRESSED_IMAGES is set, add the compressed images to
  the CLEANFILES list.
  
  MFC after:1 week
  X-MFC-With:   r264027,r264028,r264029
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/Makefile

Modified: head/release/Makefile
==
--- head/release/Makefile   Tue Apr  1 22:52:27 2014(r264029)
+++ head/release/Makefile   Tue Apr  1 22:54:54 2014(r264030)
@@ -94,6 +94,11 @@ IMAGES+= mini-memstick.img
 .endif
 
 CLEANFILES=packagesystem *.txz MANIFEST system ${IMAGES}
+.if defined(WITH_COMPRESSED_IMAGES)  !empty(WITH_COMPRESSED_IMAGES)
+. for I in ${IMAGES}
+CLEANFILES+=   ${I}.gz
+. endfor
+.endif
 CLEANDIRS= dist ftp release bootonly dvd
 beforeclean:
chflags -R noschg .
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r264031 - head/sys/dev/usb/serial

2014-04-01 Thread Ian Lepore
Author: ian
Date: Wed Apr  2 01:58:54 2014
New Revision: 264031
URL: http://svnweb.freebsd.org/changeset/base/264031

Log:
  Use 2K buffers for IO to help achieve full device speed, rather than the
  default wMaxPacketSize (64 or 512 bytes).  This actually helps older FTDI
  devices (which were USB 1/full speed) more than the new H-series high
  speed, but even for the new chips it helps cut the number of interrupts
  when doing very high speed (3-12mbaud).

Modified:
  head/sys/dev/usb/serial/uftdi.c

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Tue Apr  1 22:54:54 2014
(r264030)
+++ head/sys/dev/usb/serial/uftdi.c Wed Apr  2 01:58:54 2014
(r264031)
@@ -63,6 +63,7 @@ __FBSDID($FreeBSD$);
 #include dev/usb/usb.h
 #include dev/usb/usbdi.h
 #include dev/usb/usbdi_util.h
+#include dev/usb/usb_core.h
 #include usbdevs.h
 
 #defineUSB_DEBUG_VAR uftdi_debug
@@ -83,8 +84,34 @@ SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debu
 #defineUFTDI_CONFIG_INDEX  0
 #defineUFTDI_IFACE_INDEX_JTAG  0
 
-#defineUFTDI_OBUFSIZE 64   /* bytes, cannot be increased 
due to
-* do size encoding */
+/*
+ * IO buffer sizes and FTDI device procotol sizes.
+ *
+ * Note that the output packet size in the following defines is not the usb
+ * protocol packet size based on bus speed, it is the size dictated by the FTDI
+ * device itself, and is used only on older chips.
+ *
+ * We allocate buffers bigger than the hardware's packet size, and process
+ * multiple packets within each buffer.  This allows the controller to make
+ * optimal use of the usb bus by conducting multiple transfers with the device
+ * during a single bus timeslice to fill or drain the chip's fifos.
+ *
+ * The output data on newer chips has no packet header, and we are able to pack
+ * any number of output bytes into a buffer.  On some older chips, each output
+ * packet contains a 1-byte header and up to 63 bytes of payload.  The size is
+ * encoded in 6 bits of the header, hence the 64-byte limit on packet size.  We
+ * loop to fill the buffer with many of these header+payload packets.
+ *
+ * The input data on all chips consists of packets which contain a 2-byte 
header
+ * followed by data payload.  The total size of the packet is wMaxPacketSize
+ * which can change based on the bus speed (e.g., 64 for full speed, 512 for
+ * high speed).  We loop to extract the headers and payloads from the packets
+ * packed into an input buffer.
+ */
+#defineUFTDI_IBUFSIZE  2048
+#defineUFTDI_IHDRSIZE 2
+#defineUFTDI_OBUFSIZE  2048
+#defineUFTDI_OPKTSIZE64
 
 enum {
UFTDI_BULK_DT_WR,
@@ -178,7 +205,7 @@ static const struct usb_config uftdi_con
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
-   .bufsize = 0,   /* use wMaxPacketSize */
+   .bufsize = UFTDI_IBUFSIZE,
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
.callback = uftdi_read_callback,
},
@@ -1096,35 +1123,47 @@ uftdi_write_callback(struct usb_xfer *xf
 {
struct uftdi_softc *sc = usbd_xfer_softc(xfer);
struct usb_page_cache *pc;
-   uint32_t actlen;
+   uint32_t pktlen;
+   uint32_t buflen;
uint8_t buf[1];
 
switch (USB_GET_STATE(xfer)) {
+   default:/* Error */
+   if (error != USB_ERR_CANCELLED) {
+   /* try to clear stall first */
+   usbd_xfer_set_stall(xfer);
+   }
+   /* FALLTHROUGH */
case USB_ST_SETUP:
case USB_ST_TRANSFERRED:
-tr_setup:
+   /*
+* If output packets don't require headers (the common case) we
+* can just load the buffer up with payload bytes all at once.
+* Otherwise, loop to format packets into the buffer while there
+* is data available, and room for a packet header and at least
+* one byte of payload.
+*/
pc = usbd_xfer_get_frame(xfer, 0);
-   if (ucom_get_data(sc-sc_ucom, pc,
-   sc-sc_hdrlen, UFTDI_OBUFSIZE - sc-sc_hdrlen,
-   actlen)) {
-
-   if (sc-sc_hdrlen  0) {
-   buf[0] =
-   FTDI_OUT_TAG(actlen, sc-sc_ucom.sc_portno);
-   usbd_copy_in(pc, 0, buf, 1);
+   if (sc-sc_hdrlen == 0) {
+   ucom_get_data(sc-sc_ucom, pc, 0, UFTDI_OBUFSIZE, 
+   buflen);
+   } else {
+   buflen = 0;
+   while (buflen  UFTDI_OBUFSIZE - sc-sc_hdrlen - 1 
+   

Re: svn commit: r263885 - in head/sys/dev/vt: . hw/vga

2014-04-01 Thread Nathan Whitehorn

On 03/29/14 15:35, Aleksandr Rybalko wrote:

On Sat, 29 Mar 2014 09:18:03 -0700
Nathan Whitehorn nwhiteh...@freebsd.org wrote:


On 03/28/14 15:04, Aleksandr Rybalko wrote:

Author: ray
Date: Fri Mar 28 22:04:27 2014
New Revision: 263885
URL: http://svnweb.freebsd.org/changeset/base/263885

Log:
o Add new vd_driver method to do bitblt with mask, named
vd_maskbitbltchr. o Move vd_bitbltchr vga's driver method to
vd_maskbitbltchr. o Implement new vd_bitbltchr method for vga
driver. (It do single write for 8 pixels, have to be a bit faster).


Can you describe what this does? From the commit message, it sounds
like it might repair vt performance on cards with 8-bit framebuffers
generally, but I can't figure out the code.
-Nathan


Hi Nathan!

np, it is result of our discussion with jhibbits@.

vt(4) have to use bitblt like method which is able to do masked write,
since mouse cursor have to left visible characters under itself.
But masked bitblt quite expensive due to read from framebuffer to apply
mask or due to VGA graphics mode problem (described here [1], lot of
small read and writes which can't be well optimized).

Characters can be drown with simple (not masked) method, so vd_bitbltchr
used most frequently.
Mouse cursor only one (at least vt(4) can care about one :) ). And
currently mouse support only single consumer for masked method.

I did both methods have same set of arguments, to not reimplement
vd_bitbltchr method for all drivers. And driver can implement only
vd_bitbltchr or both. W/o vd_maskbitbltchr, vd_bitbltchr will be used.

Currently only one driver implement both methods, it is vt_vga.
Its not masked method do write 8 pixels at once, but masked method
continue to use 1 bit at once.

Other drivers (f.e. vt_ofwfb) in TODO list.

Thanks!

[1]http://lists.freebsd.org/pipermail/freebsd-arch/2014-March/015108.html

WBW


Any chance you could give an example or sketch of what to do? This issue 
is at least doubling the boot time of my Thinkpad if I use an EFI kernel.

-Nathan
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org