svn commit: r308568 - head/sys/dev/acpi_support

2016-11-11 Thread Alexander Motin
Author: mav
Date: Sat Nov 12 05:09:39 2016
New Revision: 308568
URL: https://svnweb.freebsd.org/changeset/base/308568

Log:
  Set of improvements to acpi_hp(4) driver.
  
   - Attach only to WMI devices that provide supported GUIDs.  HP Spectre x360
  has two WMI devices, only one of which provides the GUIDs.
   - Pass proper device to ACPI_WMI_REMOVE_EVENT_HANDLER() on detach.
   - Improve error WMI handling separating status and data paths.  This allows
  to hide sysctls not supported by specific hardware/BIOS.
   - Improve CMI block parser to make it work on HP Spectre x360 laptop.
   - In verbose mode log all unknown events to help futher improvements.

Modified:
  head/sys/dev/acpi_support/acpi_hp.c

Modified: head/sys/dev/acpi_support/acpi_hp.c
==
--- head/sys/dev/acpi_support/acpi_hp.c Sat Nov 12 03:07:41 2016
(r308567)
+++ head/sys/dev/acpi_support/acpi_hp.c Sat Nov 12 05:09:39 2016
(r308568)
@@ -66,11 +66,17 @@ ACPI_MODULE_NAME("HP")
 #define ACPI_HP_WMI_BIOS_GUID  "5FB7F034-2C63-45E9-BE91-3D44E2C707E4"
 #define ACPI_HP_WMI_CMI_GUID   "2D114B49-2DFB-4130-B8FE-4A3C09E75133"
 
-#define ACPI_HP_WMI_DISPLAY_COMMAND0x1
-#define ACPI_HP_WMI_HDDTEMP_COMMAND0x2
-#define ACPI_HP_WMI_ALS_COMMAND0x3
-#define ACPI_HP_WMI_DOCK_COMMAND   0x4
-#define ACPI_HP_WMI_WIRELESS_COMMAND   0x5
+#define ACPI_HP_WMI_DISPLAY_COMMAND0x1
+#define ACPI_HP_WMI_HDDTEMP_COMMAND0x2
+#define ACPI_HP_WMI_ALS_COMMAND0x3
+#define ACPI_HP_WMI_DOCK_COMMAND   0x4
+#define ACPI_HP_WMI_WIRELESS_COMMAND   0x5
+#define ACPI_HP_WMI_BIOS_COMMAND   0x9
+#define ACPI_HP_WMI_FEATURE_COMMAND0xb
+#define ACPI_HP_WMI_HOTKEY_COMMAND 0xc
+#define ACPI_HP_WMI_FEATURE2_COMMAND   0xd
+#define ACPI_HP_WMI_WIRELESS2_COMMAND  0x1b
+#define ACPI_HP_WMI_POSTCODEERROR_COMMAND  0x2a
 
 #define ACPI_HP_METHOD_WLAN_ENABLED1
 #define ACPI_HP_METHOD_WLAN_RADIO  2
@@ -104,11 +110,32 @@ ACPI_MODULE_NAME("HP")
 #define HP_MASK_BLUETOOTH_ENABLED  0x2
 #define HP_MASK_WLAN_ENABLED   0x200
 
+#define ACPI_HP_EVENT_DOCK 0x01
+#define ACPI_HP_EVENT_PARK_HDD 0x02
+#define ACPI_HP_EVENT_SMART_ADAPTER0x03
+#define ACPI_HP_EVENT_BEZEL_BUTTON 0x04
+#define ACPI_HP_EVENT_WIRELESS 0x05
+#define ACPI_HP_EVENT_CPU_BATTERY_THROTTLE 0x06
+#define ACPI_HP_EVENT_LOCK_SWITCH  0x07
+#define ACPI_HP_EVENT_LID_SWITCH   0x08
+#define ACPI_HP_EVENT_SCREEN_ROTATION  0x09
+#define ACPI_HP_EVENT_COOLSENSE_SYSTEM_MOBILE  0x0A
+#define ACPI_HP_EVENT_COOLSENSE_SYSTEM_HOT 0x0B
+#define ACPI_HP_EVENT_PROXIMITY_SENSOR 0x0C
+#define ACPI_HP_EVENT_BACKLIT_KB_BRIGHTNESS0x0D
+#define ACPI_HP_EVENT_PEAKSHIFT_PERIOD 0x0F
+#define ACPI_HP_EVENT_BATTERY_CHARGE_PERIOD0x10
+
 #define ACPI_HP_CMI_DETAIL_PATHS   0x01
 #define ACPI_HP_CMI_DETAIL_ENUMS   0x02
 #define ACPI_HP_CMI_DETAIL_FLAGS   0x04
 #define ACPI_HP_CMI_DETAIL_SHOW_MAX_INSTANCE   0x08
 
+#define ACPI_HP_WMI_RET_WRONG_SIGNATURE0x02
+#define ACPI_HP_WMI_RET_UNKNOWN_COMMAND0x03
+#define ACPI_HP_WMI_RET_UNKNOWN_CMDTYPE0x04
+#define ACPI_HP_WMI_RET_INVALID_PARAMETERS 0x05
+
 struct acpi_hp_inst_seq_pair {
UINT32  sequence;   /* sequence number as suggested by cmi bios */
UINT8   instance;   /* object instance on guid */
@@ -119,6 +146,7 @@ struct acpi_hp_softc {
device_twmi_dev;
int has_notify; /* notification GUID found */
int has_cmi;/* CMI GUID found */
+   int has_wireless;   /* Wireless command found */
int cmi_detail; /* CMI detail level
   (set by sysctl) */
int verbose;/* add debug output */
@@ -287,7 +315,7 @@ static int  acpi_hp_sysctl_set(struct acp
int arg, int oldarg);
 static int acpi_hp_sysctl_get(struct acpi_hp_softc *sc, int method);
 static int acpi_hp_exec_wmi_command(device_t wmi_dev, int command,
-   int is_write, int val);
+   int is_write, int val, int *retval);
 static voidacpi_hp_notify(ACPI_HANDLE h, UINT32 notify, void *context);
 static int acpi_hp_get_cmi_block(device_t wmi_dev, const char* guid,
UINT8 instance, char* outbuf, size_t outsize,
@@ -332,13 +360,18 @@ MODULE_DEPEND(acpi_hp, acpi, 1, 1, 1);
 static void
 acpi_hp_evaluate_auto_on_off(struct acpi_hp_softc *sc)
 {
+   int res;
int wireless;
int 

Re: svn commit: r308175 - head/libexec/ftpd

2016-11-11 Thread Kurt Lidl

On 11/10/16 4:25 PM, Matteo Riondato wrote:



On Nov 1, 2016, at 2:18 PM, Kurt Lidl  wrote:

Author: lidl
Date: Tue Nov  1 18:18:09 2016
New Revision: 308175
URL: https://svnweb.freebsd.org/changeset/base/308175

Log:
 Revisit blacklistd support in ftpd


This commit is breaking buildworld for me with WITHOUT_BLACKLIST=y in src.conf :


Oops.

Should be fixed in r308567.

-Kurt


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


svn commit: r308567 - head/libexec/ftpd

2016-11-11 Thread Kurt Lidl
Author: lidl
Date: Sat Nov 12 03:07:41 2016
New Revision: 308567
URL: https://svnweb.freebsd.org/changeset/base/308567

Log:
  Fix build when WITHOUT_BLACKLIST=yes is specified
  
  PR:   214409
  Submitted by: matthew
  Reported by:  matteo
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/libexec/ftpd/ftpd.c

Modified: head/libexec/ftpd/ftpd.c
==
--- head/libexec/ftpd/ftpd.cSat Nov 12 01:41:43 2016(r308566)
+++ head/libexec/ftpd/ftpd.cSat Nov 12 03:07:41 2016(r308567)
@@ -93,10 +93,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#ifdef USE_BLACKLIST
 #include "blacklist_client.h"
-#endif
-
 #include "pathnames.h"
 #include "extern.h"
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308566 - head/sys/dev/virtio/console

2016-11-11 Thread Jakub Wojciech Klama
Author: jceel
Date: Sat Nov 12 01:41:43 2016
New Revision: 308566
URL: https://svnweb.freebsd.org/changeset/base/308566

Log:
  Reserve space for control message payload (currently a port name).
  
  Approved by:  trasz (mentor)
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/dev/virtio/console/virtio_console.c

Modified: head/sys/dev/virtio/console/virtio_console.c
==
--- head/sys/dev/virtio/console/virtio_console.cSat Nov 12 00:23:09 
2016(r308565)
+++ head/sys/dev/virtio/console/virtio_console.cSat Nov 12 01:41:43 
2016(r308566)
@@ -600,7 +600,7 @@ vtcon_ctrl_event_enqueue(struct vtcon_so
 
sglist_init(, 2, segs);
error = sglist_append(, control,
-   sizeof(struct virtio_console_control));
+   sizeof(struct virtio_console_control) + VTCON_BULK_BUFSZ);
KASSERT(error == 0, ("%s: error %d adding control to sglist",
__func__, error));
 
@@ -633,7 +633,8 @@ vtcon_ctrl_event_requeue(struct vtcon_so
 {
int error;
 
-   bzero(control, sizeof(struct virtio_console_control));
+   bzero(control, sizeof(struct virtio_console_control) +
+   VTCON_BULK_BUFSZ);
 
error = vtcon_ctrl_event_enqueue(sc, control);
KASSERT(error == 0,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308565 - head/sys/kern

2016-11-11 Thread John Baldwin
Author: jhb
Date: Sat Nov 12 00:23:09 2016
New Revision: 308565
URL: https://svnweb.freebsd.org/changeset/base/308565

Log:
  Allow scheduling during early boot.
  
  - Send IPI wakeups once SMP is started even if cold is true.
  - Permit preemptions when cold is true.
  
  These changes are needed for EARLY_AP_STARTUP.
  
  MFC after:2 weeks
  Sponsored by: Netflix

Modified:
  head/sys/kern/sched_4bsd.c

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Sat Nov 12 00:14:13 2016(r308564)
+++ head/sys/kern/sched_4bsd.c  Sat Nov 12 00:23:09 2016(r308565)
@@ -326,7 +326,6 @@ maybe_preempt(struct thread *td)
 *  - The current thread has a higher (numerically lower) or
 *equivalent priority.  Note that this prevents curthread from
 *trying to preempt to itself.
-*  - It is too early in the boot for context switches (cold is set).
 *  - The current thread has an inhibitor set or is in the process of
 *exiting.  In this case, the current thread is about to switch
 *out anyways, so there's no point in preempting.  If we did,
@@ -347,7 +346,7 @@ maybe_preempt(struct thread *td)
("maybe_preempt: trying to run inhibited thread"));
pri = td->td_priority;
cpri = ctd->td_priority;
-   if (panicstr != NULL || pri >= cpri || cold /* || dumping */ ||
+   if (panicstr != NULL || pri >= cpri /* || dumping */ ||
TD_IS_INHIBITED(ctd))
return (0);
 #ifndef FULL_PREEMPTION
@@ -1105,7 +1104,7 @@ forward_wakeup(int cpunum)
if ((!forward_wakeup_enabled) ||
 (forward_wakeup_use_mask == 0 && forward_wakeup_use_loop == 0))
return (0);
-   if (!smp_started || cold || panicstr)
+   if (!smp_started || panicstr)
return (0);
 
forward_wakeups_requested++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308564 - head/sys/kern

2016-11-11 Thread John Baldwin
Author: jhb
Date: Sat Nov 12 00:14:13 2016
New Revision: 308564
URL: https://svnweb.freebsd.org/changeset/base/308564

Log:
  Don't place threads on the run queue after waking up other CPUs.
  
  The other CPU might resume and see a still-empty runq and go back to
  sleep before sched_add() adds the thread to the runq.  This results
  in a lost wakeup and a potential hang if the system is otherwise
  completely idle.
  
  The race originated due to a micro-optimization (my fault) in 4BSD in
  that it avoided putting a thread on the run queue if the scheduler was
  going to preempt to the new thread.  To avoid complexity while fixing
  this race, just drop this optimization.  4BSD now always sets the
  "owepreempt" flag when a preemption is warranted and defers the actual
  preemption to the thread_unlock of the caller the same as ULE.
  
  MFC after:2 weeks
  Sponsored by: Netflix

Modified:
  head/sys/kern/sched_4bsd.c

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Fri Nov 11 23:28:07 2016(r308563)
+++ head/sys/kern/sched_4bsd.c  Sat Nov 12 00:14:13 2016(r308564)
@@ -308,9 +308,8 @@ maybe_resched(struct thread *td)
 /*
  * This function is called when a thread is about to be put on run queue
  * because it has been made runnable or its priority has been adjusted.  It
- * determines if the new thread should be immediately preempted to.  If so,
- * it switches to it and eventually returns true.  If not, it returns false
- * so that the caller may place the thread on an appropriate run queue.
+ * determines if the new thread should preempt the current thread.  If so,
+ * it sets td_owepreempt to request a preemption.
  */
 int
 maybe_preempt(struct thread *td)
@@ -356,29 +355,8 @@ maybe_preempt(struct thread *td)
return (0);
 #endif
 
-   if (ctd->td_critnest > 1) {
-   CTR1(KTR_PROC, "maybe_preempt: in critical section %d",
-   ctd->td_critnest);
-   ctd->td_owepreempt = 1;
-   return (0);
-   }
-   /*
-* Thread is runnable but not yet put on system run queue.
-*/
-   MPASS(ctd->td_lock == td->td_lock);
-   MPASS(TD_ON_RUNQ(td));
-   TD_SET_RUNNING(td);
-   CTR3(KTR_PROC, "preempting to thread %p (pid %d, %s)\n", td,
-   td->td_proc->p_pid, td->td_name);
-   mi_switch(SW_INVOL | SW_PREEMPT | SWT_PREEMPT, td);
-   /*
-* td's lock pointer may have changed.  We have to return with it
-* locked.
-*/
-   spinlock_enter();
-   thread_unlock(ctd);
-   thread_lock(td);
-   spinlock_exit();
+   CTR0(KTR_PROC, "maybe_preempt: scheduling preemption");
+   ctd->td_owepreempt = 1;
return (1);
 #else
return (0);
@@ -1332,6 +1310,12 @@ sched_add(struct thread *td, int flags)
ts->ts_runq = 
}
 
+   if ((td->td_flags & TDF_NOLOAD) == 0)
+   sched_load_add();
+   runq_add(ts->ts_runq, td, flags);
+   if (cpu != NOCPU)
+   runq_length[cpu]++;
+
cpuid = PCPU_GET(cpuid);
if (single_cpu && cpu != cpuid) {
kick_other_cpu(td->td_priority, cpu);
@@ -1348,18 +1332,10 @@ sched_add(struct thread *td, int flags)
}
 
if (!forwarded) {
-   if ((flags & SRQ_YIELDING) == 0 && maybe_preempt(td))
-   return;
-   else
+   if (!maybe_preempt(td))
maybe_resched(td);
}
}
-
-   if ((td->td_flags & TDF_NOLOAD) == 0)
-   sched_load_add();
-   runq_add(ts->ts_runq, td, flags);
-   if (cpu != NOCPU)
-   runq_length[cpu]++;
 }
 #else /* SMP */
 {
@@ -1393,23 +1369,11 @@ sched_add(struct thread *td, int flags)
CTR2(KTR_RUNQ, "sched_add: adding td_sched:%p (td:%p) to runq", ts, td);
ts->ts_runq = 
 
-   /*
-* If we are yielding (on the way out anyhow) or the thread
-* being saved is US, then don't try be smart about preemption
-* or kicking off another CPU as it won't help and may hinder.
-* In the YIEDLING case, we are about to run whoever is being
-* put in the queue anyhow, and in the OURSELF case, we are
-* putting ourself on the run queue which also only happens
-* when we are about to yield.
-*/
-   if ((flags & SRQ_YIELDING) == 0) {
-   if (maybe_preempt(td))
-   return;
-   }
if ((td->td_flags & TDF_NOLOAD) == 0)
sched_load_add();
runq_add(ts->ts_runq, td, flags);
-   maybe_resched(td);
+   if (!maybe_preempt(td))
+   maybe_resched(td);
 }
 #endif /* SMP */
 
___
svn-src-all@freebsd.org mailing list

Re: svn commit: r308563 - in head/lib: libgcc_eh libgcc_s

2016-11-11 Thread Joerg Sonnenberger
On Fri, Nov 11, 2016 at 11:28:08PM +, Ed Maste wrote:
> Author: emaste
> Date: Fri Nov 11 23:28:07 2016
> New Revision: 308563
> URL: https://svnweb.freebsd.org/changeset/base/308563
> 
> Log:
>   libcc_{s,eh}: build without SSP
>   
>   As in the gnu/lib/libgcc Makefile:
>   libgcc is linked in last and thus cannot depend on ssp
>   symbols coming from earlier libraries. Disable stack protection
>   for this library.

That doesn't make sense to me given that libgcc_s at least definitely
depends on libc for the system calls?

Joerg
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308563 - in head/lib: libgcc_eh libgcc_s

2016-11-11 Thread Ed Maste
Author: emaste
Date: Fri Nov 11 23:28:07 2016
New Revision: 308563
URL: https://svnweb.freebsd.org/changeset/base/308563

Log:
  libcc_{s,eh}: build without SSP
  
  As in the gnu/lib/libgcc Makefile:
  libgcc is linked in last and thus cannot depend on ssp
  symbols coming from earlier libraries. Disable stack protection
  for this library.
  
  Reviewed by:  dim
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libgcc_eh/Makefile
  head/lib/libgcc_s/Makefile

Modified: head/lib/libgcc_eh/Makefile
==
--- head/lib/libgcc_eh/Makefile Fri Nov 11 23:07:31 2016(r308562)
+++ head/lib/libgcc_eh/Makefile Fri Nov 11 23:28:07 2016(r308563)
@@ -5,6 +5,7 @@
 PACKAGE=   clibs
 LIB=   gcc_eh
 NO_PIC=
+MK_SSP=no
 WARNS?=2
 
 .include "Makefile.inc"

Modified: head/lib/libgcc_s/Makefile
==
--- head/lib/libgcc_s/Makefile  Fri Nov 11 23:07:31 2016(r308562)
+++ head/lib/libgcc_s/Makefile  Fri Nov 11 23:28:07 2016(r308563)
@@ -4,6 +4,7 @@ PACKAGE=clibs
 SHLIB_NAME=libgcc_s.so.1
 SHLIBDIR?= /lib
 
+MK_SSP=no
 WARNS?=2
 
 LDFLAGS+=  -nodefaultlibs
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308562 - head/tools/tools/git

2016-11-11 Thread Ryan Stone
Author: rstone
Date: Fri Nov 11 23:07:31 2016
New Revision: 308562
URL: https://svnweb.freebsd.org/changeset/base/308562

Log:
  Fix git tools when run against a worktree
  
  In a git worktree, the gitdir is in an entirely different location.
  In arcgit, use git rev-parse --git-dir to get the correct path to it
  always.
  
  When running git from outside of the work tree, as in importgit,
  the path provided by git rev-parse --git-dir can be either a
  relative or absolute path depending on the work tree.  Rather
  than trying to deal with that, just use git -C.
  
  Differential Revision:https://reviews.freebsd.org/D8501
  Reviewed by: markj

Modified:
  head/tools/tools/git/arcgit
  head/tools/tools/git/importgit

Modified: head/tools/tools/git/arcgit
==
--- head/tools/tools/git/arcgit Fri Nov 11 21:53:38 2016(r308561)
+++ head/tools/tools/git/arcgit Fri Nov 11 23:07:31 2016(r308562)
@@ -69,7 +69,7 @@ create_review()
 
git checkout $commit > /dev/null || error "Could not checkout $commit"
 
-   arc_dir="$(git rev-parse --show-toplevel)/.git/arc"
+   arc_dir="$(git rev-parse --git-dir)/arc"
arc_msg="$arc_dir/create-message"
mkdir -p $arc_dir
git show -s --format='%B' HEAD > $arc_msg

Modified: head/tools/tools/git/importgit
==
--- head/tools/tools/git/importgit  Fri Nov 11 21:53:38 2016
(r308561)
+++ head/tools/tools/git/importgit  Fri Nov 11 23:07:31 2016
(r308562)
@@ -50,7 +50,7 @@ error()
exit 1
 }
 
-unset git range commit dry_run
+unset git_repo range commit dry_run
 
 while getopts ":c:g:nr:" o
 do
@@ -95,16 +95,16 @@ then
error -u "-g  argument is mandatory"
 fi
 
-git="$git_repo/.git"
-
-if [ ! -d "$git" ]
+if ! type git > /dev/null 2> /dev/null
 then
-   error "$git_repo does not seem to be a git repo"
+   error "Install devel/git first"
 fi
 
-if ! type git > /dev/null 2> /dev/null
+GIT="git -C $git_repo"
+
+if ! $GIT rev-parse --git-dir 2> /dev/null > /dev/null
 then
-   error "Install devel/git first"
+   error "$git_repo does not seem to be a git repo"
 fi
 
 if ! type svn > /dev/null 2> /dev/null
@@ -122,21 +122,21 @@ then
error "Could not communicate with svn server.  Is your ssh key loaded?"
 fi
 
-git --git-dir=$git log --format=%H $range | tail -r | while read -r commit
+$GIT log --format=%H $range | tail -r | while read -r commit
 do
-   echo "Applying `git --git-dir=$git show -s --oneline $commit`"
+   echo "Applying `$GIT show -s --oneline $commit`"
 
-   if [ -n "$(git --git-dir=$git show --diff-filter=CDRTUXB $commit)" ]
+   if [ -n "$($GIT show --diff-filter=CDRTUXB $commit)" ]
then
error "Commit performed unsupported change (e.g. delete/rename)"
fi
 
-   if [ "$(git --git-dir=$git show -s --format=%P $commit | wc -w)" -ne 1 ]
+   if [ "$($GIT show -s --format=%P $commit | wc -w)" -ne 1 ]
then
error "Cannot import merge commits"
fi
 
-   git --git-dir=$git diff --diff-filter=A --name-only \
+   $GIT diff --diff-filter=A --name-only \
${commit}~..$commit | while read -r newfile
do
if [ -f "$newfile" ]
@@ -158,10 +158,10 @@ do
continue
fi
 
-   git --git-dir=$git show $commit | patch -p 1 -s || \
+   $GIT show $commit | patch -p 1 -s || \
error "Failed to apply patch"
 
-   git --git-dir=$git diff --diff-filter=A --name-only \
+   $GIT diff --diff-filter=A --name-only \
${commit}~..$commit | while read -r newfile
do
svn add --parents --depth=infinity $newfile || \
@@ -176,7 +176,7 @@ do
exit $ret
fi
 
-   git --git-dir=$git show -s --format='%B' $commit | svn commit -F - || \
+   $GIT show -s --format='%B' $commit | svn commit -F - || \
error "Failed to commit"
 done
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308561 - head/usr.sbin/bsnmpd/modules/snmp_bridge

2016-11-11 Thread Gavin Atkinson
Author: gavin
Date: Fri Nov 11 21:53:38 2016
New Revision: 308561
URL: https://svnweb.freebsd.org/changeset/base/308561

Log:
  Correct spelling in syslog: getttimeofday -> gettimeofday

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.cFri Nov 11 
21:29:48 2016(r308560)
+++ head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.cFri Nov 11 
21:53:38 2016(r308561)
@@ -356,7 +356,7 @@ bridge_get_time_since_tc(struct bridge_i
 
if (gettimeofday(, NULL) < 0) {
syslog(LOG_ERR, "bridge get time since last TC:"
-   "getttimeofday failed: %s", strerror(errno));
+   "gettimeofday failed: %s", strerror(errno));
return (-1);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308560 - head/sys/dev/fdt

2016-11-11 Thread Justin Hibbits
Author: jhibbits
Date: Fri Nov 11 21:29:48 2016
New Revision: 308560
URL: https://svnweb.freebsd.org/changeset/base/308560

Log:
  Replace another fdt_is_compatible() call.

Modified:
  head/sys/dev/fdt/fdt_powerpc.c

Modified: head/sys/dev/fdt/fdt_powerpc.c
==
--- head/sys/dev/fdt/fdt_powerpc.c  Fri Nov 11 21:01:45 2016
(r308559)
+++ head/sys/dev/fdt/fdt_powerpc.c  Fri Nov 11 21:29:48 2016
(r308560)
@@ -112,7 +112,7 @@ fdt_fixup_fman(phandle_t root)
 * That frequency is equal to /soc node bus-frequency.
 */
for (node = OF_child(node); node != 0; node = OF_peer(node)) {
-   if (fdt_is_compatible(node, "fsl,fman") == 0)
+   if (ofw_bus_node_is_compatible(node, "fsl,fman") == 0)
continue;
 
if (OF_setprop(node, "clock-frequency", (void *),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308559 - head/contrib/llvm/lib/Target/AArch64

2016-11-11 Thread Dimitry Andric
Author: dim
Date: Fri Nov 11 21:01:45 2016
New Revision: 308559
URL: https://svnweb.freebsd.org/changeset/base/308559

Log:
  Pull in r263169 from upstream llvm trunk (by Tim Northover):
  
AArch64: only try to use scaled fcvt ops on legal vector types.
  
Before we ended up calling getSimpleVectorType on a <3 x float>, which
asserted.
  
  This fixes an assertion when building the print/ghostscript9-agpl-base
  port for AArch64.
  
  PR:   213865
  MFC after:3 days

Modified:
  head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
==
--- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cppFri Nov 
11 20:44:33 2016(r308558)
+++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cppFri Nov 
11 21:01:45 2016(r308559)
@@ -7581,7 +7581,8 @@ static SDValue performFpToIntCombine(SDN
 return SDValue();
 
   SDValue Op = N->getOperand(0);
-  if (!Op.getValueType().isVector() || Op.getOpcode() != ISD::FMUL)
+  if (!Op.getValueType().isVector() || !Op.getValueType().isSimple() ||
+  Op.getOpcode() != ISD::FMUL)
 return SDValue();
 
   SDValue ConstVec = Op->getOperand(1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308558 - head/sys/sys

2016-11-11 Thread Conrad E. Meyer
Author: cem
Date: Fri Nov 11 20:44:33 2016
New Revision: 308558
URL: https://svnweb.freebsd.org/changeset/base/308558

Log:
  queue.3: Document existing QMD_* macros
  
  Feedback from:bapt, bdrewery, emaste
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D3983

Modified:
  head/sys/sys/queue.h

Modified: head/sys/sys/queue.h
==
--- head/sys/sys/queue.hFri Nov 11 20:31:23 2016(r308557)
+++ head/sys/sys/queue.hFri Nov 11 20:44:33 2016(r308558)
@@ -472,6 +472,12 @@ struct {   
\
  */
 
 #if (defined(_KERNEL) && defined(INVARIANTS))
+/*
+ * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME)
+ *
+ * If the list is non-empty, validates that the first element of the list
+ * points back at 'head.'
+ */
 #defineQMD_LIST_CHECK_HEAD(head, field) do {   
\
if (LIST_FIRST((head)) != NULL &&   \
LIST_FIRST((head))->field.le_prev !=\
@@ -479,6 +485,12 @@ struct {   
\
panic("Bad list head %p first->prev != head", (head));  \
 } while (0)
 
+/*
+ * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME)
+ *
+ * If an element follows 'elm' in the list, validates that the next element
+ * points back at 'elm.'
+ */
 #defineQMD_LIST_CHECK_NEXT(elm, field) do {
\
if (LIST_NEXT((elm), field) != NULL &&  \
LIST_NEXT((elm), field)->field.le_prev !=   \
@@ -486,6 +498,11 @@ struct {   
\
panic("Bad link elm %p next->prev != elm", (elm));  \
 } while (0)
 
+/*
+ * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME)
+ *
+ * Validates that the previous element (or head of the list) points to 'elm.'
+ */
 #defineQMD_LIST_CHECK_PREV(elm, field) do {
\
if (*(elm)->field.le_prev != (elm)) \
panic("Bad link elm %p prev->next != elm", (elm));  \
@@ -634,6 +651,12 @@ struct {   
\
  * Tail queue functions.
  */
 #if (defined(_KERNEL) && defined(INVARIANTS))
+/*
+ * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
+ *
+ * If the tailq is non-empty, validates that the first element of the tailq
+ * points back at 'head.'
+ */
 #defineQMD_TAILQ_CHECK_HEAD(head, field) do {  
\
if (!TAILQ_EMPTY(head) &&   \
TAILQ_FIRST((head))->field.tqe_prev !=  \
@@ -641,11 +664,22 @@ struct {  
\
panic("Bad tailq head %p first->prev != head", (head)); \
 } while (0)
 
+/*
+ * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME)
+ *
+ * Validates that the tail of the tailq is a pointer to pointer to NULL.
+ */
 #defineQMD_TAILQ_CHECK_TAIL(head, field) do {  
\
if (*(head)->tqh_last != NULL)  \
panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head));  \
 } while (0)
 
+/*
+ * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME)
+ *
+ * If an element follows 'elm' in the tailq, validates that the next element
+ * points back at 'elm.'
+ */
 #defineQMD_TAILQ_CHECK_NEXT(elm, field) do {   
\
if (TAILQ_NEXT((elm), field) != NULL && \
TAILQ_NEXT((elm), field)->field.tqe_prev != \
@@ -653,6 +687,11 @@ struct {   
\
panic("Bad link elm %p next->prev != elm", (elm));  \
 } while (0)
 
+/*
+ * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME)
+ *
+ * Validates that the previous element (or head of the tailq) points to 'elm.'
+ */
 #defineQMD_TAILQ_CHECK_PREV(elm, field) do {   
\
if (*(elm)->field.tqe_prev != (elm))\
panic("Bad link elm %p prev->next != elm", (elm));  \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308557 - stable/11/sys/i386/i386

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:31:23 2016
New Revision: 308557
URL: https://svnweb.freebsd.org/changeset/base/308557

Log:
  MFC r308029:
  Handle pmap_enter() over an existing 4/2M page in KVA on i386.

Modified:
  stable/11/sys/i386/i386/pmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/i386/i386/pmap.c
==
--- stable/11/sys/i386/i386/pmap.c  Fri Nov 11 20:27:00 2016
(r308556)
+++ stable/11/sys/i386/i386/pmap.c  Fri Nov 11 20:31:23 2016
(r308557)
@@ -3466,11 +3466,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
PMAP_LOCK(pmap);
sched_pin();
 
-   /*
-* In the case that a page table page is not
-* resident, we are creating it here.
-*/
+   pde = pmap_pde(pmap, va);
if (va < VM_MAXUSER_ADDRESS) {
+   /*
+* va is for UVA.
+* In the case that a page table page is not resident,
+* we are creating it here.  pmap_allocpte() handles
+* demotion.
+*/
mpte = pmap_allocpte(pmap, va, flags);
if (mpte == NULL) {
KASSERT((flags & PMAP_ENTER_NOSLEEP) != 0,
@@ -3480,19 +3483,28 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
PMAP_UNLOCK(pmap);
return (KERN_RESOURCE_SHORTAGE);
}
+   } else {
+   /*
+* va is for KVA, so pmap_demote_pde() will never fail
+* to install a page table page.  PG_V is also
+* asserted by pmap_demote_pde().
+*/
+   KASSERT(pde != NULL && (*pde & PG_V) != 0,
+   ("KVA %#x invalid pde pdir %#jx", va,
+   (uintmax_t)pmap->pm_pdir[PTDPTDI]));
+   if ((*pde & PG_PS) != 0)
+   pmap_demote_pde(pmap, pde, va);
}
-
-   pde = pmap_pde(pmap, va);
-   if ((*pde & PG_PS) != 0)
-   panic("pmap_enter: attempted pmap_enter on 4MB page");
pte = pmap_pte_quick(pmap, va);
 
/*
-* Page Directory table entry not valid, we need a new PT page
+* Page Directory table entry is not valid, which should not
+* happen.  We should have either allocated the page table
+* page or demoted the existing mapping above.
 */
if (pte == NULL) {
panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x",
-   (uintmax_t)pmap->pm_pdir[PTDPTDI], va);
+   (uintmax_t)pmap->pm_pdir[PTDPTDI], va);
}
 
pa = VM_PAGE_TO_PHYS(m);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308556 - stable/11/sys/fs/cd9660

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:27:00 2016
New Revision: 308556
URL: https://svnweb.freebsd.org/changeset/base/308556

Log:
  MFC r308028:
  Use buffer pager for cd9660.
  
  For now, on stable/11, default is to use generic getpages() as before.

Modified:
  stable/11/sys/fs/cd9660/cd9660_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/cd9660/cd9660_vnops.c
==
--- stable/11/sys/fs/cd9660/cd9660_vnops.c  Fri Nov 11 20:24:54 2016
(r308555)
+++ stable/11/sys/fs/cd9660/cd9660_vnops.c  Fri Nov 11 20:27:00 2016
(r308556)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -74,6 +75,7 @@ static vop_readdir_t  cd9660_readdir;
 static vop_readlink_t  cd9660_readlink;
 static vop_strategy_t  cd9660_strategy;
 static vop_vptofh_tcd9660_vptofh;
+static vop_getpages_t  cd9660_getpages;
 
 /*
  * Setattr call. Only allowed for block and character special devices.
@@ -836,6 +838,45 @@ cd9660_vptofh(ap)
return (0);
 }
 
+SYSCTL_NODE(_vfs, OID_AUTO, cd9660, CTLFLAG_RW, 0, "cd9660 filesystem");
+static int use_buf_pager = 0;
+SYSCTL_INT(_vfs_cd9660, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN,
+_buf_pager, 0,
+"Use buffer pager instead of bmap");
+
+static daddr_t
+cd9660_gbp_getblkno(struct vnode *vp, vm_ooffset_t off)
+{
+
+   return (lblkno(VTOI(vp)->i_mnt, off));
+}
+
+static int
+cd9660_gbp_getblksz(struct vnode *vp, daddr_t lbn)
+{
+   struct iso_node *ip;
+
+   ip = VTOI(vp);
+   return (blksize(ip->i_mnt, ip, lbn));
+}
+
+static int
+cd9660_getpages(struct vop_getpages_args *ap)
+{
+   struct vnode *vp;
+
+   vp = ap->a_vp;
+   if (vp->v_type == VCHR || vp->v_type == VBLK)
+   return (EOPNOTSUPP);
+
+   if (use_buf_pager)
+   return (vfs_bio_getpages(vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, cd9660_gbp_getblkno,
+   cd9660_gbp_getblksz));
+   return (vnode_pager_generic_getpages(vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, NULL, NULL));
+}
+
 /*
  * Global vfs data structures for cd9660
  */
@@ -857,6 +898,7 @@ struct vop_vector cd9660_vnodeops = {
.vop_setattr =  cd9660_setattr,
.vop_strategy = cd9660_strategy,
.vop_vptofh =   cd9660_vptofh,
+   .vop_getpages = cd9660_getpages,
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308555 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:24:54 2016
New Revision: 308555
URL: https://svnweb.freebsd.org/changeset/base/308555

Log:
  MFC r308027:
  Use buffer pager for msdosfs.
  
  For now, on stable/11, default is to use generic getpages() as before.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_vnops.cFri Nov 11 20:18:08 2016
(r308554)
+++ stable/11/sys/fs/msdosfs/msdosfs_vnops.cFri Nov 11 20:24:54 2016
(r308555)
@@ -62,11 +62,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -97,6 +99,7 @@ static vop_rmdir_tmsdosfs_rmdir;
 static vop_symlink_t   msdosfs_symlink;
 static vop_readdir_t   msdosfs_readdir;
 static vop_bmap_t  msdosfs_bmap;
+static vop_getpages_t  msdosfs_getpages;
 static vop_strategy_t  msdosfs_strategy;
 static vop_print_t msdosfs_print;
 static vop_pathconf_t  msdosfs_pathconf;
@@ -1798,6 +1801,38 @@ msdosfs_bmap(struct vop_bmap_args *ap)
return (0);
 }
 
+SYSCTL_NODE(_vfs, OID_AUTO, msdosfs, CTLFLAG_RW, 0, "msdos filesystem");
+static int use_buf_pager = 0;
+SYSCTL_INT(_vfs_msdosfs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN,
+_buf_pager, 0,
+"Use buffer pager instead of bmap");
+
+static daddr_t
+msdosfs_gbp_getblkno(struct vnode *vp, vm_ooffset_t off)
+{
+
+   return (de_cluster(VTODE(vp)->de_pmp, off));
+}
+
+static int
+msdosfs_gbp_getblksz(struct vnode *vp, daddr_t lbn)
+{
+
+   return (VTODE(vp)->de_pmp->pm_bpcluster);
+}
+
+static int
+msdosfs_getpages(struct vop_getpages_args *ap)
+{
+
+   if (use_buf_pager)
+   return (vfs_bio_getpages(ap->a_vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, msdosfs_gbp_getblkno,
+   msdosfs_gbp_getblksz));
+   return (vnode_pager_generic_getpages(ap->a_vp, ap->a_m, ap->a_count,
+   ap->a_rbehind, ap->a_rahead, NULL, NULL));
+}
+
 static int
 msdosfs_strategy(struct vop_strategy_args *ap)
 {
@@ -1898,6 +1933,7 @@ struct vop_vector msdosfs_vnodeops = {
 
.vop_access =   msdosfs_access,
.vop_bmap = msdosfs_bmap,
+   .vop_getpages = msdosfs_getpages,
.vop_cachedlookup = msdosfs_lookup,
.vop_open = msdosfs_open,
.vop_close =msdosfs_close,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308554 - in stable/11/sys: kern sys ufs/ffs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:18:08 2016
New Revision: 308554
URL: https://svnweb.freebsd.org/changeset/base/308554

Log:
  MFC r308026:
  Generalize UFS buffer pager.
  
  MFC r308442:
  Tweaks for the buffer pager.

Modified:
  stable/11/sys/kern/vfs_bio.c
  stable/11/sys/sys/buf.h
  stable/11/sys/ufs/ffs/ffs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/vfs_bio.c
==
--- stable/11/sys/kern/vfs_bio.cFri Nov 11 20:09:54 2016
(r308553)
+++ stable/11/sys/kern/vfs_bio.cFri Nov 11 20:18:08 2016
(r308554)
@@ -75,9 +75,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -4691,6 +4692,165 @@ bdata2bio(struct buf *bp, struct bio *bi
}
 }
 
+static int buf_pager_relbuf;
+SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN,
+_pager_relbuf, 0,
+"Make buffer pager release buffers after reading");
+
+/*
+ * The buffer pager.  It uses buffer reads to validate pages.
+ *
+ * In contrast to the generic local pager from vm/vnode_pager.c, this
+ * pager correctly and easily handles volumes where the underlying
+ * device block size is greater than the machine page size.  The
+ * buffer cache transparently extends the requested page run to be
+ * aligned at the block boundary, and does the necessary bogus page
+ * replacements in the addends to avoid obliterating already valid
+ * pages.
+ *
+ * The only non-trivial issue is that the exclusive busy state for
+ * pages, which is assumed by the vm_pager_getpages() interface, is
+ * incompatible with the VMIO buffer cache's desire to share-busy the
+ * pages.  This function performs a trivial downgrade of the pages'
+ * state before reading buffers, and a less trivial upgrade from the
+ * shared-busy to excl-busy state after the read.
+ */
+int
+vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int count,
+int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno,
+vbg_get_blksize_t get_blksize)
+{
+   vm_page_t m;
+   vm_object_t object;
+   struct buf *bp;
+   struct mount *mp;
+   daddr_t lbn, lbnp;
+   vm_ooffset_t la, lb, poff, poffe;
+   long bsize;
+   int bo_bs, br_flags, error, i;
+   bool redo, lpart;
+
+   object = vp->v_object;
+   mp = vp->v_mount;
+   la = IDX_TO_OFF(ma[count - 1]->pindex);
+   if (la >= object->un_pager.vnp.vnp_size)
+   return (VM_PAGER_BAD);
+   lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size;
+   bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex)));
+   if (rbehind != NULL) {
+   lb = IDX_TO_OFF(ma[0]->pindex);
+   *rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs));
+   }
+   if (rahead != NULL) {
+   *rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la);
+   if (la + IDX_TO_OFF(*rahead) >= object->un_pager.vnp.vnp_size) {
+   *rahead = OFF_TO_IDX(roundup2(object->un_pager.
+   vnp.vnp_size, PAGE_SIZE) - la);
+   }
+   }
+   br_flags = (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS)
+   != 0) ? GB_UNMAPPED : 0;
+   VM_OBJECT_WLOCK(object);
+again:
+   for (i = 0; i < count; i++)
+   vm_page_busy_downgrade(ma[i]);
+   VM_OBJECT_WUNLOCK(object);
+
+   lbnp = -1;
+   for (i = 0; i < count; i++) {
+   m = ma[i];
+
+   /*
+* Pages are shared busy and the object lock is not
+* owned, which together allow for the pages'
+* invalidation.  The racy test for validity avoids
+* useless creation of the buffer for the most typical
+* case when invalidation is not used in redo or for
+* parallel read.  The shared->excl upgrade loop at
+* the end of the function catches the race in a
+* reliable way (protected by the object lock).
+*/
+   if (m->valid == VM_PAGE_BITS_ALL)
+   continue;
+
+   poff = IDX_TO_OFF(m->pindex);
+   poffe = MIN(poff + PAGE_SIZE, object->un_pager.vnp.vnp_size);
+   for (; poff < poffe; poff += bsize) {
+   lbn = get_lblkno(vp, poff);
+   if (lbn == lbnp)
+   goto next_page;
+   lbnp = lbn;
+
+   bsize = get_blksize(vp, lbn);
+   error = bread_gb(vp, lbn, bsize, curthread->td_ucred,
+   br_flags, );
+   if (error != 0)
+   goto end_pages;
+   if (LIST_EMPTY(>b_dep)) {
+   /*
+* 

svn commit: r308553 - head/sys/dev/ioat

2016-11-11 Thread Conrad E. Meyer
Author: cem
Date: Fri Nov 11 20:09:54 2016
New Revision: 308553
URL: https://svnweb.freebsd.org/changeset/base/308553

Log:
  ioat(4): Fix race between process_events and reset_hw
  
  In the case where a hardware error is detected during
  ioat_process_events, hardware may advance (by one descriptor, probably)
  and a subsequent ioat_process_events may race the intended ioat_reset_hw
  followup.  In that case, the second process_events would observe a
  completion update that does not match the software "last_seen" status,
  and attempt to successfully complete already-failed descriptors.
  
  Guard against this race with the resetting_cleanup flag.
  
  Reviewed by:  bdrewery, markj
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cFri Nov 11 20:08:45 2016(r308552)
+++ head/sys/dev/ioat/ioat.cFri Nov 11 20:09:54 2016(r308553)
@@ -765,6 +765,15 @@ out:
mtx_lock(>submit_lock);
mtx_lock(>cleanup_lock);
ioat->quiescing = TRUE;
+   /*
+* This is safe to do here because we have both locks and the submit
+* queue is quiesced.  We know that we will drain all outstanding
+* events, so ioat_reset_hw can't deadlock.  It is necessary to
+* protect other ioat_process_event threads from racing ioat_reset_hw,
+* reading an indeterminate hw state, and attempting to continue
+* issuing completions.
+*/
+   ioat->resetting_cleanup = TRUE;
 
chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
if (1 <= g_ioat_debug_level)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308552 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:08:45 2016
New Revision: 308552
URL: https://svnweb.freebsd.org/changeset/base/308552

Log:
  MFC r308025:
  Enable vn_io_fault() deadlock avoidance for msdosfs.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
  stable/10/sys/fs/msdosfs/msdosfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 20:06:07 2016
(r308551)
+++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 20:08:45 2016
(r308552)
@@ -743,7 +743,7 @@ mountmsdosfs(struct vnode *devvp, struct
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
-   mp->mnt_kern_flag |= MNTK_USES_BCACHE;
+   mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF;
MNT_IUNLOCK(mp);
 
if (pmp->pm_flags & MSDOSFS_LARGEFS)

Modified: stable/10/sys/fs/msdosfs/msdosfs_vnops.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_vnops.cFri Nov 11 20:06:07 2016
(r308551)
+++ stable/10/sys/fs/msdosfs/msdosfs_vnops.cFri Nov 11 20:08:45 2016
(r308552)
@@ -640,7 +640,7 @@ msdosfs_read(ap)
diff = blsize - bp->b_resid;
if (diff < n)
n = diff;
-   error = uiomove(bp->b_data + on, (int) n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio);
brelse(bp);
} while (error == 0 && uio->uio_resid > 0 && n != 0);
if (!isadir && (error == 0 || uio->uio_resid != orig_resid) &&
@@ -776,6 +776,12 @@ msdosfs_write(ap)
 * then no need to read data from disk.
 */
bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0);
+   /*
+* This call to vfs_bio_clrbuf() ensures that
+* even if vn_io_fault_uiomove() below faults,
+* garbage from the newly instantiated buffer
+* is not exposed to the userspace via mmap().
+*/
vfs_bio_clrbuf(bp);
/*
 * Do the bmap now, since pcbmap needs buffers
@@ -813,7 +819,7 @@ msdosfs_write(ap)
/*
 * Copy the data from user space into the buf header.
 */
-   error = uiomove(bp->b_data + croffset, n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio);
if (error) {
brelse(bp);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308551 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:06:07 2016
New Revision: 308551
URL: https://svnweb.freebsd.org/changeset/base/308551

Log:
  MFC r308024:
  Ensure that cluster allocations never allocate clusters outside the
  volume limits.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 20:04:19 2016
(r308550)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 20:06:07 2016
(r308551)
@@ -401,6 +401,8 @@ usemap_alloc(pmp, cn)
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
+   KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn,
+   pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_alloc on ro msdosfs mount"));
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
@@ -419,6 +421,9 @@ usemap_free(pmp, cn)
 {
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
+   KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn,
+   pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_free on ro msdosfs mount"));
pmp->pm_freeclustercount++;
@@ -672,6 +677,8 @@ chainlength(pmp, start, count)
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
+   if (start > pmp->pm_maxcluster)
+   return (0);
max_idx = pmp->pm_maxcluster / N_INUSEBITS;
idx = start / N_INUSEBITS;
start %= N_INUSEBITS;
@@ -679,11 +686,18 @@ chainlength(pmp, start, count)
map &= ~((1 << start) - 1);
if (map) {
len = ffs(map) - 1 - start;
-   return (len > count ? count : len);
+   len = MIN(len, count);
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
}
len = N_INUSEBITS - start;
-   if (len >= count)
-   return (count);
+   if (len >= count) {
+   len = count;
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
+   }
while (++idx <= max_idx) {
if (len >= count)
break;
@@ -694,7 +708,10 @@ chainlength(pmp, start, count)
}
len += N_INUSEBITS;
}
-   return (len > count ? count : len);
+   len = MIN(len, count);
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
 }
 
 /*
@@ -961,6 +978,11 @@ fillinusemap(pmp)
}
if (bp != NULL)
brelse(bp);
+
+   for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster +
+   N_INUSEBITS) / N_INUSEBITS; cn++)
+   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
+
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308550 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:04:19 2016
New Revision: 308550
URL: https://svnweb.freebsd.org/changeset/base/308550

Log:
  MFC r308023:
  If the fatchain() call in chainalloc() returned an error, revert
  marking the cluster run as in-use.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 20:01:56 2016
(r308549)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 20:04:19 2016
(r308550)
@@ -731,8 +731,11 @@ chainalloc(pmp, start, count, fillwith, 
pmp->pm_nxtfree = CLUST_FIRST;
pmp->pm_flags |= MSDOSFS_FSIMOD;
error = fatchain(pmp, start, count, fillwith);
-   if (error != 0)
+   if (error != 0) {
+   for (cl = start, n = count; n-- > 0;)
+   usemap_free(pmp, cl++);
return (error);
+   }
 #ifdef MSDOSFS_DEBUG
printf("clusteralloc(): allocated cluster chain at %lu (%lu 
clusters)\n",
start, count);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308549 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 20:01:56 2016
New Revision: 308549
URL: https://svnweb.freebsd.org/changeset/base/308549

Log:
  MFC r308022:
  Use symbolic name for the value of fully free word in pm_inusemap.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:59:42 2016
(r308548)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 20:01:56 2016
(r308549)
@@ -60,6 +60,8 @@
 #include 
 #include 
 
+#defineFULL_RUN((u_int)0x)
+
 static int chainalloc(struct msdosfsmount *pmp, u_long start,
u_long count, u_long fillwith, u_long *retcluster,
u_long *got);
@@ -792,8 +794,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
map |= (1 << (cn % N_INUSEBITS)) - 1;
-   if (map != (u_int)-1) {
-   cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+   if (map != FULL_RUN) {
+   cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
return (chainalloc(pmp, cn, count, fillwith, 
retcluster, got));
if (l > foundl) {
@@ -809,8 +811,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
map |= (1 << (cn % N_INUSEBITS)) - 1;
-   if (map != (u_int)-1) {
-   cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+   if (map != FULL_RUN) {
+   cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
return (chainalloc(pmp, cn, count, fillwith, 
retcluster, got));
if (l > foundl) {
@@ -921,7 +923,7 @@ fillinusemap(pmp)
 * loop further down.
 */
for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; 
cn++)
-   pmp->pm_inusemap[cn] = (u_int)-1;
+   pmp->pm_inusemap[cn] = FULL_RUN;
 
/*
 * Figure how many free clusters are in the filesystem by ripping
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308548 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:59:42 2016
New Revision: 308548
URL: https://svnweb.freebsd.org/changeset/base/308548

Log:
  MFC r308021:
  Use symbolic name for the free cluster number.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:58:25 2016
(r308547)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:59:42 2016
(r308548)
@@ -951,7 +951,7 @@ fillinusemap(pmp)
readcn >>= 4;
readcn &= pmp->pm_fatmask;
 
-   if (readcn == 0)
+   if (readcn == CLUST_FREE)
usemap_free(pmp, cn);
}
if (bp != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308547 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:58:25 2016
New Revision: 308547
URL: https://svnweb.freebsd.org/changeset/base/308547

Log:
  MFC r308020:
  Fix comment formatting.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:57:10 2016
(r308546)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:58:25 2016
(r308547)
@@ -1019,12 +1019,14 @@ extendfile(dep, count, bpp, ncp, flags)
while (count > 0) {
/*
 * Allocate a new cluster chain and cat onto the end of the
-* file.  * If the file is empty we make de_StartCluster point
-* to the new block.  Note that de_StartCluster being 0 is
-* sufficient to be sure the file is empty since we exclude
-* attempts to extend the root directory above, and the root
-* dir is the only file with a startcluster of 0 that has
-* blocks allocated (sort of).
+* file.
+* If the file is empty we make de_StartCluster point
+* to the new block.  Note that de_StartCluster being
+* 0 is sufficient to be sure the file is empty since
+* we exclude attempts to extend the root directory
+* above, and the root dir is the only file with a
+* startcluster of 0 that has blocks allocated (sort
+* of).
 */
if (dep->de_StartCluster == 0)
cn = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308546 - stable/10/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:57:10 2016
New Revision: 308546
URL: https://svnweb.freebsd.org/changeset/base/308546

Log:
  MFC r308019:
  Remove useless NULL check.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 19:40:34 2016
(r308545)
+++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 19:57:10 2016
(r308546)
@@ -763,8 +763,7 @@ error_exit:
}
if (pmp) {
lockdestroy(>pm_fatlock);
-   if (pmp->pm_inusemap)
-   free(pmp->pm_inusemap, M_MSDOSFSFAT);
+   free(pmp->pm_inusemap, M_MSDOSFSFAT);
free(pmp, M_MSDOSFSMNT);
mp->mnt_data = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308545 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:40:34 2016
New Revision: 308545
URL: https://svnweb.freebsd.org/changeset/base/308545

Log:
  MFC r308025:
  Enable vn_io_fault() deadlock avoidance for msdosfs.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_vfsops.c
  stable/11/sys/fs/msdosfs/msdosfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 19:37:51 2016
(r308544)
+++ stable/11/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 19:40:34 2016
(r308545)
@@ -742,7 +742,7 @@ mountmsdosfs(struct vnode *devvp, struct
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
MNT_ILOCK(mp);
mp->mnt_flag |= MNT_LOCAL;
-   mp->mnt_kern_flag |= MNTK_USES_BCACHE;
+   mp->mnt_kern_flag |= MNTK_USES_BCACHE | MNTK_NO_IOPF;
MNT_IUNLOCK(mp);
 
if (pmp->pm_flags & MSDOSFS_LARGEFS)

Modified: stable/11/sys/fs/msdosfs/msdosfs_vnops.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_vnops.cFri Nov 11 19:37:51 2016
(r308544)
+++ stable/11/sys/fs/msdosfs/msdosfs_vnops.cFri Nov 11 19:40:34 2016
(r308545)
@@ -593,7 +593,7 @@ msdosfs_read(struct vop_read_args *ap)
diff = blsize - bp->b_resid;
if (diff < n)
n = diff;
-   error = uiomove(bp->b_data + on, (int) n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + on, (int) n, uio);
brelse(bp);
} while (error == 0 && uio->uio_resid > 0 && n != 0);
if (!isadir && (error == 0 || uio->uio_resid != orig_resid) &&
@@ -723,6 +723,12 @@ msdosfs_write(struct vop_write_args *ap)
 * then no need to read data from disk.
 */
bp = getblk(thisvp, bn, pmp->pm_bpcluster, 0, 0, 0);
+   /*
+* This call to vfs_bio_clrbuf() ensures that
+* even if vn_io_fault_uiomove() below faults,
+* garbage from the newly instantiated buffer
+* is not exposed to the userspace via mmap().
+*/
vfs_bio_clrbuf(bp);
/*
 * Do the bmap now, since pcbmap needs buffers
@@ -760,7 +766,7 @@ msdosfs_write(struct vop_write_args *ap)
/*
 * Copy the data from user space into the buf header.
 */
-   error = uiomove(bp->b_data + croffset, n, uio);
+   error = vn_io_fault_uiomove(bp->b_data + croffset, n, uio);
if (error) {
brelse(bp);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308544 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:37:51 2016
New Revision: 308544
URL: https://svnweb.freebsd.org/changeset/base/308544

Log:
  MFC r308024:
  Ensure that cluster allocations never allocate clusters outside the
  volume limits.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:35:58 2016
(r308543)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:37:51 2016
(r308544)
@@ -382,6 +382,8 @@ usemap_alloc(struct msdosfsmount *pmp, u
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
+   KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn,
+   pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_alloc on ro msdosfs mount"));
KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
@@ -398,6 +400,9 @@ usemap_free(struct msdosfsmount *pmp, u_
 {
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
+
+   KASSERT(cn <= pmp->pm_maxcluster, ("cn too large %lu %lu", cn,
+   pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_free on ro msdosfs mount"));
pmp->pm_freeclustercount++;
@@ -637,6 +642,8 @@ chainlength(struct msdosfsmount *pmp, u_
 
MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
+   if (start > pmp->pm_maxcluster)
+   return (0);
max_idx = pmp->pm_maxcluster / N_INUSEBITS;
idx = start / N_INUSEBITS;
start %= N_INUSEBITS;
@@ -644,11 +651,18 @@ chainlength(struct msdosfsmount *pmp, u_
map &= ~((1 << start) - 1);
if (map) {
len = ffs(map) - 1 - start;
-   return (len > count ? count : len);
+   len = MIN(len, count);
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
}
len = N_INUSEBITS - start;
-   if (len >= count)
-   return (count);
+   if (len >= count) {
+   len = count;
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
+   }
while (++idx <= max_idx) {
if (len >= count)
break;
@@ -659,7 +673,10 @@ chainlength(struct msdosfsmount *pmp, u_
}
len += N_INUSEBITS;
}
-   return (len > count ? count : len);
+   len = MIN(len, count);
+   if (start + len > pmp->pm_maxcluster)
+   len = pmp->pm_maxcluster - start + 1;
+   return (len);
 }
 
 /*
@@ -918,6 +935,11 @@ fillinusemap(struct msdosfsmount *pmp)
}
if (bp != NULL)
brelse(bp);
+
+   for (cn = pmp->pm_maxcluster + 1; cn < (pmp->pm_maxcluster +
+   N_INUSEBITS) / N_INUSEBITS; cn++)
+   pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS);
+
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308543 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:35:58 2016
New Revision: 308543
URL: https://svnweb.freebsd.org/changeset/base/308543

Log:
  MFC r308023:
  If the fatchain() call in chainalloc() returned an error, revert
  marking the cluster run as in-use.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:33:26 2016
(r308542)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:35:58 2016
(r308543)
@@ -691,8 +691,11 @@ chainalloc(struct msdosfsmount *pmp, u_l
pmp->pm_nxtfree = CLUST_FIRST;
pmp->pm_flags |= MSDOSFS_FSIMOD;
error = fatchain(pmp, start, count, fillwith);
-   if (error != 0)
+   if (error != 0) {
+   for (cl = start, n = count; n-- > 0;)
+   usemap_free(pmp, cl++);
return (error);
+   }
 #ifdef MSDOSFS_DEBUG
printf("clusteralloc(): allocated cluster chain at %lu (%lu 
clusters)\n",
start, count);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308542 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:33:26 2016
New Revision: 308542
URL: https://svnweb.freebsd.org/changeset/base/308542

Log:
  MFC r308022:
  Use symbolic name for the value of fully free word in pm_inusemap.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:31:06 2016
(r308541)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:33:26 2016
(r308542)
@@ -60,6 +60,8 @@
 #include 
 #include 
 
+#defineFULL_RUN((u_int)0x)
+
 static int chainalloc(struct msdosfsmount *pmp, u_long start,
u_long count, u_long fillwith, u_long *retcluster,
u_long *got);
@@ -752,8 +754,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
map |= (1 << (cn % N_INUSEBITS)) - 1;
-   if (map != (u_int)-1) {
-   cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+   if (map != FULL_RUN) {
+   cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
return (chainalloc(pmp, cn, count, fillwith, 
retcluster, got));
if (l > foundl) {
@@ -769,8 +771,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
idx = cn / N_INUSEBITS;
map = pmp->pm_inusemap[idx];
map |= (1 << (cn % N_INUSEBITS)) - 1;
-   if (map != (u_int)-1) {
-   cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+   if (map != FULL_RUN) {
+   cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
return (chainalloc(pmp, cn, count, fillwith, 
retcluster, got));
if (l > foundl) {
@@ -878,7 +880,7 @@ fillinusemap(struct msdosfsmount *pmp)
 * loop further down.
 */
for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; 
cn++)
-   pmp->pm_inusemap[cn] = (u_int)-1;
+   pmp->pm_inusemap[cn] = FULL_RUN;
 
/*
 * Figure how many free clusters are in the filesystem by ripping
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308541 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:31:06 2016
New Revision: 308541
URL: https://svnweb.freebsd.org/changeset/base/308541

Log:
  MFC r308021:
  Use symbolic name for the free cluster number.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:29:01 2016
(r308540)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:31:06 2016
(r308541)
@@ -908,7 +908,7 @@ fillinusemap(struct msdosfsmount *pmp)
readcn >>= 4;
readcn &= pmp->pm_fatmask;
 
-   if (readcn == 0)
+   if (readcn == CLUST_FREE)
usemap_free(pmp, cn);
}
if (bp != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308540 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:29:01 2016
New Revision: 308540
URL: https://svnweb.freebsd.org/changeset/base/308540

Log:
  MFC r308020:
  Fix comment formatting.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:26:41 2016
(r308539)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Nov 11 19:29:01 2016
(r308540)
@@ -972,12 +972,14 @@ extendfile(struct denode *dep, u_long co
while (count > 0) {
/*
 * Allocate a new cluster chain and cat onto the end of the
-* file.  * If the file is empty we make de_StartCluster point
-* to the new block.  Note that de_StartCluster being 0 is
-* sufficient to be sure the file is empty since we exclude
-* attempts to extend the root directory above, and the root
-* dir is the only file with a startcluster of 0 that has
-* blocks allocated (sort of).
+* file.
+* If the file is empty we make de_StartCluster point
+* to the new block.  Note that de_StartCluster being
+* 0 is sufficient to be sure the file is empty since
+* we exclude attempts to extend the root directory
+* above, and the root dir is the only file with a
+* startcluster of 0 that has blocks allocated (sort
+* of).
 */
if (dep->de_StartCluster == 0)
cn = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308539 - stable/11/sys/fs/msdosfs

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 19:26:41 2016
New Revision: 308539
URL: https://svnweb.freebsd.org/changeset/base/308539

Log:
  MFC r308019:
  Remove useless NULL check.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_vfsops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 18:57:41 2016
(r308538)
+++ stable/11/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Nov 11 19:26:41 2016
(r308539)
@@ -760,8 +760,7 @@ error_exit:
}
if (pmp) {
lockdestroy(>pm_fatlock);
-   if (pmp->pm_inusemap)
-   free(pmp->pm_inusemap, M_MSDOSFSFAT);
+   free(pmp->pm_inusemap, M_MSDOSFSFAT);
free(pmp, M_MSDOSFSMNT);
mp->mnt_data = NULL;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308538 - head/sys/dev/cpuctl

2016-11-11 Thread Konstantin Belousov
Author: kib
Date: Fri Nov 11 18:57:41 2016
New Revision: 308538
URL: https://svnweb.freebsd.org/changeset/base/308538

Log:
  Increase the max allowed size of the microcode update blob for x86.
  
  Newer CPUs (SkyLakes) have updates of 100K size, which is bigger than
  current limit 32K. Increase it to 4M but leave the check around to
  prevent kernel memory allocator abuse.  Some time ago, the memory for
  update was allocated by contigmalloc(9), and it was reasonable to be
  conservative as much as possible.  Since all uses of contigmalloc(9)
  appear to be either misunderstanding or too cautious, and were
  removed, provide more slack than strictly neccessary.
  
  Submitted by: Oliver Pinter
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D8486

Modified:
  head/sys/dev/cpuctl/cpuctl.c

Modified: head/sys/dev/cpuctl/cpuctl.c
==
--- head/sys/dev/cpuctl/cpuctl.cFri Nov 11 18:47:53 2016
(r308537)
+++ head/sys/dev/cpuctl/cpuctl.cFri Nov 11 18:57:41 2016
(r308538)
@@ -63,7 +63,7 @@ static d_ioctl_t cpuctl_ioctl;
 # define   DPRINTF(...)
 #endif
 
-#defineUCODE_SIZE_MAX  (32 * 1024)
+#defineUCODE_SIZE_MAX  (4 * 1024 * 1024)
 
 static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd,
 struct thread *td);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308537 - head/lib/libgcc_s

2016-11-11 Thread Glen Barber
Author: gjb
Date: Fri Nov 11 18:47:53 2016
New Revision: 308537
URL: https://svnweb.freebsd.org/changeset/base/308537

Log:
  Spell 'PACKAGE' correctly.
  
  Submitted by: Kyle Evans, emaste
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libgcc_s/Makefile

Modified: head/lib/libgcc_s/Makefile
==
--- head/lib/libgcc_s/Makefile  Fri Nov 11 18:10:13 2016(r308536)
+++ head/lib/libgcc_s/Makefile  Fri Nov 11 18:47:53 2016(r308537)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-PKG=   clibs
+PACKAGE=   clibs
 SHLIB_NAME=libgcc_s.so.1
 SHLIBDIR?= /lib
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sy

2016-11-11 Thread Toomas Soome

> On 11. nov 2016, at 19:08, Warner Losh  wrote:
> 
> This suggests we've created an update / upgrade problem. Do we?
> 
> Warner


Not if the normal build suggestion (make buildworld buildkernel) is followed, 
as then the headers from the source tree are put in proper place as part of the 
build procedure - in this case the source was fetched by svn update and attempt 
was made to build part of the fetched tree.

In that sense, I don’t see the problem, as direct build without scene setup is 
not really supported. Or am I wrong? The same issue will happen with any header 
change, as you can not really build new source with using old headers.

rgds,
toomas

> 
> On Thu, Nov 10, 2016 at 11:52 PM, Kamil Czekirda  wrote:
>> cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that
>> 
>> thanks
>> 
>> 2016-11-10 23:28 GMT+01:00 Toomas Soome :
>>> 
>>> the patch does update the lib/libstand/stand.h to have:
>>> 
>>> struct devsw {
>>> . . .
>>> int (*dv_print)(int verbose);
>>> 
>>> it was void before; from your svnlite log I can see the
>>> lib/libstand/stand.h is updated, could you confirm if it is int now? if it
>>> is, I suspect the build is getting the old stand.h from somewhere in the
>>> tree and not your /lib/libstand.
>>> 
>>> if so, does the build has target to copy headers in place? I’m sorry, I
>>> don't know all the tricks the build system does as part of the buildworld..
>>> 
>>> rgds,
>>> toomas
>>> 
>>> 
>>> On 11. nov 2016, at 0:21, Kamil Czekirda  wrote:
>>> 
>>> Hi,
>>> 
>>> I got the following:
>>> 
>>> root@current:/usr/src # svnlite up -r r308434
>>> Updating '.':
>>> Ulib/libstand/stand.h
>>> Usys/boot/common/dev_net.c
>>> Usys/boot/common/module.c
>>> Usys/boot/common/part.c
>>> Usys/boot/common/util.c
>>> Usys/boot/common/util.h
>>> Usys/boot/efi/libefi/efinet.c
>>> Usys/boot/efi/libefi/efipart.c
>>> Usys/boot/efi/loader/main.c
>>> Usys/boot/i386/libfirewire/firewire.c
>>> Usys/boot/i386/libi386/bioscd.c
>>> Usys/boot/i386/libi386/biosdisk.c
>>> Usys/boot/mips/beri/loader/beri_disk_cfi.c
>>> Usys/boot/mips/beri/loader/beri_disk_sdcard.c
>>> Usys/boot/ofw/libofw/ofw_disk.c
>>> Usys/boot/pc98/libpc98/bioscd.c
>>> Usys/boot/pc98/libpc98/biosdisk.c
>>> Usys/boot/powerpc/kboot/hostdisk.c
>>> Usys/boot/powerpc/ps3/ps3cdrom.c
>>> Usys/boot/powerpc/ps3/ps3disk.c
>>> Usys/boot/uboot/lib/disk.c
>>> Usys/boot/usb/storage/umass_loader.c
>>> Usys/boot/userboot/userboot/host.c
>>> Usys/boot/userboot/userboot/userboot_disk.c
>>> Usys/boot/zfs/zfs.c
>>> Usys/boot/zfs/zfsimpl.c
>>> Usys/boot/i386/libi386/pxe.c
>>> Updated to revision 308434.
>>> root@current:/usr/src # cd sys/boot/
>>> root@current:/usr/src/sys/boot # make clean
>>> (...)
>>> root@current:/usr/src/sys/boot # make obj
>>> (...)
>>> root@current:/usr/src/sys/boot # make
>>> (...)
>>> cc  -O2 -pipe   -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader
>>> -I/usr/src/sys/boot/efi/loader/arch/amd64
>>> -I/usr/src/sys/boot/efi/loader/../include
>>> -I/usr/src/sys/boot/efi/loader/../include/amd64
>>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include
>>> -I/usr/src/sys/boot/efi/loader/../../..
>>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386
>>> -I/usr/src/sys/boot/efi/loader/../../zfs
>>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs
>>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO_PCI
>>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH
>>> -I/usr/src/sys/boot/efi/loader/../../ficl
>>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT
>>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl
>>> -I/usr/src/sys/boot/ficl/amd64  -I/usr/src/sys/boot/ficl/../common
>>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat
>>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno-aes
>>> -g -MD  -MF.depend.vers.o -MTvers.o -std=gnu99 -Wsystem-headers -Werror
>>> -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
>>> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign
>>> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable
>>> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality
>>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef
>>> -Qunused-arguments  -c vers.c -o vers.o
>>> cc  -O2 -pipe   -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader
>>> -I/usr/src/sys/boot/efi/loader/arch/amd64
>>> -I/usr/src/sys/boot/efi/loader/../include
>>> -I/usr/src/sys/boot/efi/loader/../include/amd64
>>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include
>>> -I/usr/src/sys/boot/efi/loader/../../..
>>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386
>>> -I/usr/src/sys/boot/efi/loader/../../zfs
>>> 

svn commit: r308536 - head/sys/dev/dpaa

2016-11-11 Thread Justin Hibbits
Author: jhibbits
Date: Fri Nov 11 18:10:13 2016
New Revision: 308536
URL: https://svnweb.freebsd.org/changeset/base/308536

Log:
  Use ofw_bus_node_is_compatible() instead of fdt_is_compatible()
  
  No need to have two functions that do the same thing, let's let fdt_* go away,
  and use ofw_bus_* equivalents instead.
  
  Requested by: andrew

Modified:
  head/sys/dev/dpaa/bman_fdt.c
  head/sys/dev/dpaa/if_dtsec_fdt.c
  head/sys/dev/dpaa/qman_fdt.c

Modified: head/sys/dev/dpaa/bman_fdt.c
==
--- head/sys/dev/dpaa/bman_fdt.cFri Nov 11 17:41:17 2016
(r308535)
+++ head/sys/dev/dpaa/bman_fdt.cFri Nov 11 18:10:13 2016
(r308536)
@@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -154,7 +152,7 @@ bman_portals_fdt_attach(device_t dev)
 
/* Find portals tied to CPUs */
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
-   if (!fdt_is_compatible(child, "fsl,bman-portal")) {
+   if (!ofw_bus_node_is_compatible(child, "fsl,bman-portal")) {
continue;
}
/* Checkout related cpu */

Modified: head/sys/dev/dpaa/if_dtsec_fdt.c
==
--- head/sys/dev/dpaa/if_dtsec_fdt.cFri Nov 11 17:41:17 2016
(r308535)
+++ head/sys/dev/dpaa/if_dtsec_fdt.cFri Nov 11 18:10:13 2016
(r308536)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -156,9 +155,9 @@ dtsec_fdt_attach(device_t dev)
}
 
/* Get link speed */
-   if (fdt_is_compatible(enet_node, "fsl,fman-1g-mac") != 0)
+   if (ofw_bus_node_is_compatible(enet_node, "fsl,fman-1g-mac") != 0)
sc->sc_eth_dev_type = ETH_DTSEC;
-   else if (fdt_is_compatible(enet_node, "fsl,fman-10g-mac") != 0)
+   else if (ofw_bus_node_is_compatible(enet_node, "fsl,fman-10g-mac") != 0)
sc->sc_eth_dev_type = ETH_10GSEC;
else
return(ENXIO);
@@ -211,10 +210,12 @@ dtsec_fdt_attach(device_t dev)
fman_rxtx_node[0] = OF_instance_to_package(fman_rxtx_node[0]);
fman_rxtx_node[1] = OF_instance_to_package(fman_rxtx_node[1]);
 
-   if (fdt_is_compatible(fman_rxtx_node[0], "fsl,fman-port-1g-rx") == 0)
+   if (ofw_bus_node_is_compatible(fman_rxtx_node[0],
+   "fsl,fman-port-1g-rx") == 0)
return (ENXIO);
 
-   if (fdt_is_compatible(fman_rxtx_node[1], "fsl,fman-port-1g-tx") == 0)
+   if (ofw_bus_node_is_compatible(fman_rxtx_node[1],
+   "fsl,fman-port-1g-tx") == 0)
return (ENXIO);
 
/* Get RX port HW id */

Modified: head/sys/dev/dpaa/qman_fdt.c
==
--- head/sys/dev/dpaa/qman_fdt.cFri Nov 11 17:41:17 2016
(r308535)
+++ head/sys/dev/dpaa/qman_fdt.cFri Nov 11 18:10:13 2016
(r308536)
@@ -36,8 +36,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
@@ -154,7 +152,7 @@ qman_portals_fdt_attach(device_t dev)
 
/* Find portals tied to CPUs */
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
-   if (!fdt_is_compatible(child, "fsl,qman-portal")) {
+   if (!ofw_bus_node_is_compatible(child, "fsl,qman-portal")) {
continue;
}
/* Checkout related cpu */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308535 - head/sys/boot/common

2016-11-11 Thread Stephen J. Kiernan
Author: stevek
Date: Fri Nov 11 17:41:17 2016
New Revision: 308535
URL: https://svnweb.freebsd.org/changeset/base/308535

Log:
  Add support for LOADER_RC setting in the pkgfs manifest (defaults to
  /loader.rc) to specify a Forth file to read from the pkgfs tarball and
  process by Ficl.
  
  This allows for the tarball to do runtime things like load a
  platform-specific FDT blob, among other things.
  
  Reviewed by:  imp
  Approved by:  sjg (mentor)
  MFC after:2 weeks
  Sponsored by: Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D8494

Modified:
  head/sys/boot/common/install.c

Modified: head/sys/boot/common/install.c
==
--- head/sys/boot/common/install.c  Fri Nov 11 16:59:26 2016
(r308534)
+++ head/sys/boot/common/install.c  Fri Nov 11 17:41:17 2016
(r308535)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
-extern struct in_addr rootip;
 extern struct in_addr servip;
 
 extern int pkgfs_init(const char *, struct fs_ops *);
@@ -50,6 +49,7 @@ COMMAND_SET(install, "install", "install
 static char *inst_kernel;
 static char **inst_modules;
 static char *inst_rootfs;
+static char *inst_loader_rc;
 
 static int
 setpath(char **what, char *val)
@@ -146,6 +146,8 @@ read_metatags(int fd)
error = setmultipath(_modules, val);
else if (strcmp(tag, "ROOTFS") == 0)
error = setpath(_rootfs, val);
+   else if (strcmp(tag, "LOADER_RC") == 0)
+   error = setpath(_loader_rc, val);
 
tag = p;
}
@@ -173,6 +175,10 @@ cleanup(void)
free(inst_rootfs);
inst_rootfs = NULL;
}
+   if (inst_loader_rc != NULL) {
+   free(inst_loader_rc);
+   inst_loader_rc = NULL;
+   }
pkgfs_cleanup();
 }
 
@@ -275,6 +281,16 @@ install(char *pkgname)
goto fail;
}
 
+   /* If there is a loader.rc in the package, execute it */
+   s = (inst_loader_rc == NULL) ? "/loader.rc" : inst_loader_rc;
+   fd = open(s, O_RDONLY);
+   if (fd != -1) {
+   close(fd);
+   error = include(s);
+   if (error == CMD_ERROR)
+   goto fail;
+   }
+
i = 0;
while (inst_modules != NULL && inst_modules[i] != NULL) {
error = mod_loadkld(inst_modules[i], 0, NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sy

2016-11-11 Thread Warner Losh
On Fri, Nov 11, 2016 at 10:20 AM, Toomas Soome  wrote:
>
>> On 11. nov 2016, at 19:08, Warner Losh  wrote:
>>
>> This suggests we've created an update / upgrade problem. Do we?
>>
>> Warner
>
>
> Not if the normal build suggestion (make buildworld buildkernel) is followed, 
> as then the headers from the source tree are put in proper place as part of 
> the build procedure - in this case the source was fetched by svn update and 
> attempt was made to build part of the fetched tree.
>
> In that sense, I don’t see the problem, as direct build without scene setup 
> is not really supported. Or am I wrong? The same issue will happen with any 
> header change, as you can not really build new source with using old headers.

OK. Nah, this is cool. libstand's API is somewhat unstable and not
needed in the upgrade path.

Warner

> rgds,
> toomas
>
>>
>> On Thu, Nov 10, 2016 at 11:52 PM, Kamil Czekirda  wrote:
>>> cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that
>>>
>>> thanks
>>>
>>> 2016-11-10 23:28 GMT+01:00 Toomas Soome :

 the patch does update the lib/libstand/stand.h to have:

 struct devsw {
 . . .
 int (*dv_print)(int verbose);

 it was void before; from your svnlite log I can see the
 lib/libstand/stand.h is updated, could you confirm if it is int now? if it
 is, I suspect the build is getting the old stand.h from somewhere in the
 tree and not your /lib/libstand.

 if so, does the build has target to copy headers in place? I’m sorry, I
 don't know all the tricks the build system does as part of the buildworld..

 rgds,
 toomas


 On 11. nov 2016, at 0:21, Kamil Czekirda  wrote:

 Hi,

 I got the following:

 root@current:/usr/src # svnlite up -r r308434
 Updating '.':
 Ulib/libstand/stand.h
 Usys/boot/common/dev_net.c
 Usys/boot/common/module.c
 Usys/boot/common/part.c
 Usys/boot/common/util.c
 Usys/boot/common/util.h
 Usys/boot/efi/libefi/efinet.c
 Usys/boot/efi/libefi/efipart.c
 Usys/boot/efi/loader/main.c
 Usys/boot/i386/libfirewire/firewire.c
 Usys/boot/i386/libi386/bioscd.c
 Usys/boot/i386/libi386/biosdisk.c
 Usys/boot/mips/beri/loader/beri_disk_cfi.c
 Usys/boot/mips/beri/loader/beri_disk_sdcard.c
 Usys/boot/ofw/libofw/ofw_disk.c
 Usys/boot/pc98/libpc98/bioscd.c
 Usys/boot/pc98/libpc98/biosdisk.c
 Usys/boot/powerpc/kboot/hostdisk.c
 Usys/boot/powerpc/ps3/ps3cdrom.c
 Usys/boot/powerpc/ps3/ps3disk.c
 Usys/boot/uboot/lib/disk.c
 Usys/boot/usb/storage/umass_loader.c
 Usys/boot/userboot/userboot/host.c
 Usys/boot/userboot/userboot/userboot_disk.c
 Usys/boot/zfs/zfs.c
 Usys/boot/zfs/zfsimpl.c
 Usys/boot/i386/libi386/pxe.c
 Updated to revision 308434.
 root@current:/usr/src # cd sys/boot/
 root@current:/usr/src/sys/boot # make clean
 (...)
 root@current:/usr/src/sys/boot # make obj
 (...)
 root@current:/usr/src/sys/boot # make
 (...)
 cc  -O2 -pipe   -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader
 -I/usr/src/sys/boot/efi/loader/arch/amd64
 -I/usr/src/sys/boot/efi/loader/../include
 -I/usr/src/sys/boot/efi/loader/../include/amd64
 -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include
 -I/usr/src/sys/boot/efi/loader/../../..
 -I/usr/src/sys/boot/efi/loader/../../i386/libi386
 -I/usr/src/sys/boot/efi/loader/../../zfs
 -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs
 -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT 
 -DNO_PCI
 -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH
 -I/usr/src/sys/boot/efi/loader/../../ficl
 -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT
 -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl
 -I/usr/src/sys/boot/ficl/amd64  -I/usr/src/sys/boot/ficl/../common
 -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat
 -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone 
 -mno-aes
 -g -MD  -MF.depend.vers.o -MTvers.o -std=gnu99 -Wsystem-headers -Werror
 -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
 -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign
 -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable
 -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality
 -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef
 -Qunused-arguments  -c vers.c -o vers.o
 cc  -O2 -pipe   -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader
 -I/usr/src/sys/boot/efi/loader/arch/amd64
 -I/usr/src/sys/boot/efi/loader/../include
 

Re: svn commit: r308434 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sy

2016-11-11 Thread Warner Losh
This suggests we've created an update / upgrade problem. Do we?

Warner

On Thu, Nov 10, 2016 at 11:52 PM, Kamil Czekirda  wrote:
> cp /usr/src/lib/libstand/libstand.h /usr/include/stand.h fixed that
>
> thanks
>
> 2016-11-10 23:28 GMT+01:00 Toomas Soome :
>>
>> the patch does update the lib/libstand/stand.h to have:
>>
>> struct devsw {
>> . . .
>> int (*dv_print)(int verbose);
>>
>> it was void before; from your svnlite log I can see the
>> lib/libstand/stand.h is updated, could you confirm if it is int now? if it
>> is, I suspect the build is getting the old stand.h from somewhere in the
>> tree and not your /lib/libstand.
>>
>> if so, does the build has target to copy headers in place? I’m sorry, I
>> don't know all the tricks the build system does as part of the buildworld..
>>
>> rgds,
>> toomas
>>
>>
>> On 11. nov 2016, at 0:21, Kamil Czekirda  wrote:
>>
>> Hi,
>>
>> I got the following:
>>
>> root@current:/usr/src # svnlite up -r r308434
>> Updating '.':
>> Ulib/libstand/stand.h
>> Usys/boot/common/dev_net.c
>> Usys/boot/common/module.c
>> Usys/boot/common/part.c
>> Usys/boot/common/util.c
>> Usys/boot/common/util.h
>> Usys/boot/efi/libefi/efinet.c
>> Usys/boot/efi/libefi/efipart.c
>> Usys/boot/efi/loader/main.c
>> Usys/boot/i386/libfirewire/firewire.c
>> Usys/boot/i386/libi386/bioscd.c
>> Usys/boot/i386/libi386/biosdisk.c
>> Usys/boot/mips/beri/loader/beri_disk_cfi.c
>> Usys/boot/mips/beri/loader/beri_disk_sdcard.c
>> Usys/boot/ofw/libofw/ofw_disk.c
>> Usys/boot/pc98/libpc98/bioscd.c
>> Usys/boot/pc98/libpc98/biosdisk.c
>> Usys/boot/powerpc/kboot/hostdisk.c
>> Usys/boot/powerpc/ps3/ps3cdrom.c
>> Usys/boot/powerpc/ps3/ps3disk.c
>> Usys/boot/uboot/lib/disk.c
>> Usys/boot/usb/storage/umass_loader.c
>> Usys/boot/userboot/userboot/host.c
>> Usys/boot/userboot/userboot/userboot_disk.c
>> Usys/boot/zfs/zfs.c
>> Usys/boot/zfs/zfsimpl.c
>> Usys/boot/i386/libi386/pxe.c
>> Updated to revision 308434.
>> root@current:/usr/src # cd sys/boot/
>> root@current:/usr/src/sys/boot # make clean
>> (...)
>> root@current:/usr/src/sys/boot # make obj
>> (...)
>> root@current:/usr/src/sys/boot # make
>> (...)
>> cc  -O2 -pipe   -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader
>> -I/usr/src/sys/boot/efi/loader/arch/amd64
>> -I/usr/src/sys/boot/efi/loader/../include
>> -I/usr/src/sys/boot/efi/loader/../include/amd64
>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include
>> -I/usr/src/sys/boot/efi/loader/../../..
>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386
>> -I/usr/src/sys/boot/efi/loader/../../zfs
>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs
>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO_PCI
>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH
>> -I/usr/src/sys/boot/efi/loader/../../ficl
>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT
>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl
>> -I/usr/src/sys/boot/ficl/amd64  -I/usr/src/sys/boot/ficl/../common
>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat
>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno-aes
>> -g -MD  -MF.depend.vers.o -MTvers.o -std=gnu99 -Wsystem-headers -Werror
>> -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
>> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign
>> -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable
>> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality
>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef
>> -Qunused-arguments  -c vers.c -o vers.o
>> cc  -O2 -pipe   -DSKEIN_LOOP=111 -fPIC -I/usr/src/sys/boot/efi/loader
>> -I/usr/src/sys/boot/efi/loader/arch/amd64
>> -I/usr/src/sys/boot/efi/loader/../include
>> -I/usr/src/sys/boot/efi/loader/../include/amd64
>> -I/usr/src/sys/boot/efi/loader/../../../contrib/dev/acpica/include
>> -I/usr/src/sys/boot/efi/loader/../../..
>> -I/usr/src/sys/boot/efi/loader/../../i386/libi386
>> -I/usr/src/sys/boot/efi/loader/../../zfs
>> -I/usr/src/sys/boot/efi/loader/../../../cddl/boot/zfs
>> -I/usr/src/sys/boot/efi/loader/../../../crypto/skein -DEFI_ZFS_BOOT -DNO_PCI
>> -DEFI -DSMBIOS_SERIAL_NUMBERS -DBOOT_FORTH
>> -I/usr/src/sys/boot/efi/loader/../../ficl
>> -I/usr/src/sys/boot/efi/loader/../../ficl/amd64 -DLOADER_DISK_SUPPORT
>> -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -fPIC -I/usr/src/sys/boot/ficl
>> -I/usr/src/sys/boot/ficl/amd64  -I/usr/src/sys/boot/ficl/../common
>> -I/usr/src/sys/boot/efi/loader/../../common -ffreestanding -Wformat
>> -msoft-float -mno-mmx -mno-sse -mno-avx -fshort-wchar -mno-red-zone -mno-aes
>> -g -MD  -MF.depend.zfs.o -MTzfs.o -std=gnu99 -Wsystem-headers -Werror -Wall
>> -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
>> -Wmissing-prototypes 

svn commit: r308534 - head/sys/boot/common

2016-11-11 Thread Stephen J. Kiernan
Author: stevek
Date: Fri Nov 11 16:59:26 2016
New Revision: 308534
URL: https://svnweb.freebsd.org/changeset/base/308534

Log:
  The file_loadraw function grew an argument, update install function
  accordingly.
  
  Reviewed by:  imp
  Approved by:  sjg (mentor)
  MFC after:2 weeks
  Sponsored by: Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D8494

Modified:
  head/sys/boot/common/install.c

Modified: head/sys/boot/common/install.c
==
--- head/sys/boot/common/install.c  Fri Nov 11 15:42:12 2016
(r308533)
+++ head/sys/boot/common/install.c  Fri Nov 11 16:59:26 2016
(r308534)
@@ -286,7 +286,7 @@ install(char *pkgname)
}
 
s = (inst_rootfs == NULL) ? "/install.iso" : inst_rootfs;
-   if (file_loadraw(s, "mfs_root") == NULL) {
+   if (file_loadraw(s, "mfs_root", 1) == NULL) {
error = errno;
command_errmsg = "cannot load root file system";
goto fail;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308533 - in head/sys/dev: fdt uart usb/net

2016-11-11 Thread Andrew Turner
Author: andrew
Date: Fri Nov 11 15:42:12 2016
New Revision: 308533
URL: https://svnweb.freebsd.org/changeset/base/308533

Log:
  Use ofw_bus_node_is_compatible in more drivers used on arm.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/dev/fdt/fdt_arm_platform.c
  head/sys/dev/uart/uart_bus_fdt.c
  head/sys/dev/usb/net/if_smsc.c

Modified: head/sys/dev/fdt/fdt_arm_platform.c
==
--- head/sys/dev/fdt/fdt_arm_platform.c Fri Nov 11 15:16:37 2016
(r308532)
+++ head/sys/dev/fdt/fdt_arm_platform.c Fri Nov 11 15:42:12 2016
(r308533)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 
 #include "platform_if.h"
@@ -58,7 +59,7 @@ fdt_platform_probe(platform_t plat)
/* Is the device is compatible? */
root = OF_finddevice("/");
compat = FDT_PLATFORM(plat)->fdt_compatible;
-   if (fdt_is_compatible(root, compat) != 0)
+   if (ofw_bus_node_is_compatible(root, compat) != 0)
return 0;
 
/* Not compatible, return an error */

Modified: head/sys/dev/uart/uart_bus_fdt.c
==
--- head/sys/dev/uart/uart_bus_fdt.cFri Nov 11 15:16:37 2016
(r308532)
+++ head/sys/dev/uart/uart_bus_fdt.cFri Nov 11 15:42:12 2016
(r308533)
@@ -123,7 +123,7 @@ uart_fdt_find_compatible(phandle_t node,
const struct ofw_compat_data *ocd;
 
for (ocd = cd; ocd->ocd_str != NULL; ocd++) {
-   if (fdt_is_compatible(node, ocd->ocd_str))
+   if (ofw_bus_node_is_compatible(node, ocd->ocd_str))
return (ocd);
}
return (NULL);

Modified: head/sys/dev/usb/net/if_smsc.c
==
--- head/sys/dev/usb/net/if_smsc.c  Fri Nov 11 15:16:37 2016
(r308532)
+++ head/sys/dev/usb/net/if_smsc.c  Fri Nov 11 15:42:12 2016
(r308533)
@@ -1566,8 +1566,8 @@ smsc_fdt_find_eth_node(phandle_t start)
 
/* Traverse through entire tree to find usb ethernet nodes. */
for (node = OF_child(start); node != 0; node = OF_peer(node)) {
-   if (fdt_is_compatible(node, "net,ethernet") &&
-   fdt_is_compatible(node, "usb,device"))
+   if (ofw_bus_node_is_compatible(node, "net,ethernet") &&
+   ofw_bus_node_is_compatible(node, "usb,device"))
return (node);
child = smsc_fdt_find_eth_node(node);
if (child != -1)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-11-11 Thread Andriy Gapon
Author: avg
Date: Fri Nov 11 15:16:37 2016
New Revision: 308532
URL: https://svnweb.freebsd.org/changeset/base/308532

Log:
  update SMB_BWRITE documentation, clarify SMB_BREAD
  
  After removal of SMB_TRANS some information in the description of
  SMB_BWRITE has become stale.  E.g., the maximum block size has been
  restored to 32.
  
  Also, the descriptions of SMB_BREAD and SMB_BWRITE had some
  incorrect information on the SMBus protocol details.
  
  MFC after:1 week
  X-MFC with:   r308242
  Differential Revision: https://reviews.freebsd.org/D8431

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

Modified: head/share/man/man4/smb.4
==
--- head/share/man/man4/smb.4   Fri Nov 11 15:13:30 2016(r308531)
+++ head/share/man/man4/smb.4   Fri Nov 11 15:16:37 2016(r308532)
@@ -141,26 +141,25 @@ in
 .Em BlockWrite
 first sends the byte from
 .Fa cmd
-to the device, followed by
+to the device, then the byte from
+.Fa wcount
+followed by
 .Fa wcount
 bytes of data that are taken from the buffer pointed to by
 .Fa wbuf .
 The SMBus specification mandates that no more than 32 bytes of
-data can be transferred in a single block read or write command,
-but since
-.Xr smbus 4
-is also used to access I2C devices, the limit has been increased
-to 1024.
+data can be transferred in a single block read or write command.
 This value can be read from the constant
 .Dv SMB_MAXBLOCKSIZE .
 .It Dv SMB_BREAD Ta
 .Em BlockRead
 first sends the byte from
 .Fa cmd
-to the device, then reads
-.Fa rcount
-bytes of data that from the device.
-This data is returned in the buffer pointed to by
+to the device, then reads a count of data bytes that the device
+is going to provide and then reads that many bytes.
+The count is returned in
+.Fa rcount.
+The data is returned in the buffer pointed to by
 .Fa rbuf .
 .El
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308531 - in head/sys/arm: allwinner annapurna/alpine arm at91 broadcom/bcm2835 lpc mv rockchip ti/am335x versatile

2016-11-11 Thread Andrew Turner
Author: andrew
Date: Fri Nov 11 15:13:30 2016
New Revision: 308531
URL: https://svnweb.freebsd.org/changeset/base/308531

Log:
  Use the modern spelling of ofw_bus_node_is_compatible in sys/arm.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/allwinner/aw_ccu.c
  head/sys/arm/annapurna/alpine/alpine_machdep_mp.c
  head/sys/arm/arm/gic.c
  head/sys/arm/at91/at91_common.c
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
  head/sys/arm/lpc/lpc_intc.c
  head/sys/arm/mv/gpio.c
  head/sys/arm/mv/mv_common.c
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/mv/mv_pci.c
  head/sys/arm/rockchip/rk30xx_gpio.c
  head/sys/arm/ti/am335x/am335x_lcd_syscons.c
  head/sys/arm/versatile/versatile_common.c

Modified: head/sys/arm/allwinner/aw_ccu.c
==
--- head/sys/arm/allwinner/aw_ccu.c Fri Nov 11 15:11:54 2016
(r308530)
+++ head/sys/arm/allwinner/aw_ccu.c Fri Nov 11 15:13:30 2016
(r308531)
@@ -195,7 +195,7 @@ aw_ccu_search_compatible(void) 
 
root = OF_finddevice("/");
for (compat = compat_data; compat->ocd_str != NULL; compat++)
-   if (fdt_is_compatible(root, compat->ocd_str))
+   if (ofw_bus_node_is_compatible(root, compat->ocd_str))
break;
 
return (compat);

Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c
==
--- head/sys/arm/annapurna/alpine/alpine_machdep_mp.c   Fri Nov 11 15:11:54 
2016(r308530)
+++ head/sys/arm/annapurna/alpine/alpine_machdep_mp.c   Fri Nov 11 15:13:30 
2016(r308531)
@@ -81,7 +81,7 @@ static boolean_t alpine_validate_cpu(u_i
 static boolean_t
 alpine_validate_cpu(u_int id, phandle_t child, u_int addr_cell, pcell_t *reg)
 {
-   return fdt_is_compatible(child, "arm,cortex-a15");
+   return ofw_bus_node_is_compatible(child, "arm,cortex-a15");
 }
 
 static int

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Fri Nov 11 15:11:54 2016(r308530)
+++ head/sys/arm/arm/gic.c  Fri Nov 11 15:13:30 2016(r308531)
@@ -312,7 +312,7 @@ gic_decode_fdt(phandle_t iparent, pcell_
 
if (self == 0) {
for (ocd = compat_data; ocd->ocd_str != NULL; ocd++) {
-   if (fdt_is_compatible(iparent, ocd->ocd_str)) {
+   if (ofw_bus_node_is_compatible(iparent, ocd->ocd_str)) {
self = iparent;
break;
}

Modified: head/sys/arm/at91/at91_common.c
==
--- head/sys/arm/at91/at91_common.c Fri Nov 11 15:11:54 2016
(r308530)
+++ head/sys/arm/at91/at91_common.c Fri Nov 11 15:13:30 2016
(r308531)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -56,7 +57,7 @@ fdt_aic_decode_ic(phandle_t node, pcell_
 {
int offset;
 
-   if (fdt_is_compatible(node, "atmel,at91rm9200-aic"))
+   if (ofw_bus_node_is_compatible(node, "atmel,at91rm9200-aic"))
offset = 0;
else
return (ENXIO);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Fri Nov 11 15:11:54 
2016(r308530)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Fri Nov 11 15:13:30 
2016(r308531)
@@ -1261,7 +1261,7 @@ bcm2835_cpufreq_identify(driver_t *drive
 
root = OF_finddevice("/");
for (compat = compat_data; compat->ocd_str != NULL; compat++)
-   if (fdt_is_compatible(root, compat->ocd_str))
+   if (ofw_bus_node_is_compatible(root, compat->ocd_str))
break;
 
if (compat->ocd_data == 0)

Modified: head/sys/arm/lpc/lpc_intc.c
==
--- head/sys/arm/lpc/lpc_intc.c Fri Nov 11 15:11:54 2016(r308530)
+++ head/sys/arm/lpc/lpc_intc.c Fri Nov 11 15:13:30 2016(r308531)
@@ -232,7 +232,7 @@ static int
 fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
 int *pol)
 {
-   if (!fdt_is_compatible(node, "lpc,pic"))
+   if (!ofw_bus_node_is_compatible(node, "lpc,pic"))
return (ENXIO);
 
*interrupt = fdt32_to_cpu(intr[0]);

Modified: head/sys/arm/mv/gpio.c
==
--- head/sys/arm/mv/gpio.c  Fri Nov 11 15:11:54 2016(r308530)
+++ head/sys/arm/mv/gpio.c  Fri Nov 11 15:13:30 2016(r308531)
@@ -643,7 +643,7 @@ mv_gpio_init(void)
 */
ctrl = 

svn commit: r308530 - head/sys/dev/iicbus

2016-11-11 Thread Andriy Gapon
Author: avg
Date: Fri Nov 11 15:11:54 2016
New Revision: 308530
URL: https://svnweb.freebsd.org/changeset/base/308530

Log:
  iicsmb: SMB_MAXBLOCKSIZE can be used again
  
  The constant was set to the correct value in r308242.
  While there, fix iicsmb_bread() to not use a value of an out parameter
  'count'.
  
  MFC after:3 weeks
  X-MFC after:  r308242

Modified:
  head/sys/dev/iicbus/iicsmb.c

Modified: head/sys/dev/iicbus/iicsmb.c
==
--- head/sys/dev/iicbus/iicsmb.cFri Nov 11 15:08:12 2016
(r308529)
+++ head/sys/dev/iicbus/iicsmb.cFri Nov 11 15:11:54 2016
(r308530)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include "iicbus_if.h"
@@ -432,7 +433,7 @@ iicsmb_bwrite(device_t dev, u_char slave
};
int error;
 
-   if (count > 32 || count == 0)
+   if (count > SMB_MAXBLOCKSIZE || count == 0)
return (SMB_EINVAL);
error = TRANSFER_MSGS(dev, msgs);
return (iic2smb_error(error));
@@ -450,12 +451,6 @@ iicsmb_bread(device_t dev, u_char slave,
};
device_t parent = device_get_parent(dev);
int error;
-   u_char bufsz;
-
-   /* Stash output buffer size before overwriting it. */
-   bufsz = *count;
-   if (bufsz == 0)
-   return (SMB_EINVAL);
 
/* Have to do this because the command is split in two transfers. */
error = iicbus_request_bus(parent, dev, IIC_WAIT);
@@ -465,18 +460,13 @@ iicsmb_bread(device_t dev, u_char slave,
/*
 * If the slave offers an empty or a too long reply,
 * read one byte to generate the stop or abort.
-* XXX 32 is hardcoded until SMB_MAXBLOCKSIZE is restored
-* to sanity.
 */
-   if (*count > 32 || *count == 0)
+   if (*count > SMB_MAXBLOCKSIZE || *count == 0)
block_msg[0].len = 1;
-   /* If longer than the buffer, then clamp at the buffer size. */
-   if (*count > bufsz)
-   block_msg[0].len = bufsz;
else
block_msg[0].len = *count;
error = TRANSFER_MSGS(dev, block_msg);
-   if (*count > 32 || *count == 0)
+   if (*count > SMB_MAXBLOCKSIZE || *count == 0)
error = SMB_EINVAL;
}
(void)iicbus_release_bus(parent, dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308529 - head/sys/dev/intpm

2016-11-11 Thread Andriy Gapon
Author: avg
Date: Fri Nov 11 15:08:12 2016
New Revision: 308529
URL: https://svnweb.freebsd.org/changeset/base/308529

Log:
  intpm: clean up intsmb_bread and intsmb_pcall
  
  The hardware does not implement SMBus Process Call command, so remove
  ifdef-ed out code from intsmb_pcall.  The code used exactly the same
  start sequence as for Write Word command.
  
  intsmb_bread code used to access an in value of the count parameter,
  but that parameter is supposed to be an out only parameter.
  For example, smb(4) does not initialize it before calling smbus_bread.
  
  MFC after:3 weeks

Modified:
  head/sys/dev/intpm/intpm.c

Modified: head/sys/dev/intpm/intpm.c
==
--- head/sys/dev/intpm/intpm.c  Fri Nov 11 15:00:13 2016(r308528)
+++ head/sys/dev/intpm/intpm.c  Fri Nov 11 15:08:12 2016(r308529)
@@ -785,39 +785,11 @@ intsmb_readw(device_t dev, u_char slave,
return (error);
 }
 
-/*
- * Data sheet claims that it implements all function, but also claims
- * that it implements 7 function and not mention PCALL. So I don't know
- * whether it will work.
- */
 static int
 intsmb_pcall(device_t dev, u_char slave, char cmd, short sdata, short *rdata)
 {
-#ifdef PROCCALL_TEST
-   struct intsmb_softc *sc = device_get_softc(dev);
-   int error;
 
-   INTSMB_LOCK(sc);
-   error = intsmb_free(sc);
-   if (error) {
-   INTSMB_UNLOCK(sc);
-   return (error);
-   }
-   bus_write_1(sc->io_res, PIIX4_SMBHSTADD, slave & ~LSB);
-   bus_write_1(sc->io_res, PIIX4_SMBHSTCMD, cmd);
-   bus_write_1(sc->io_res, PIIX4_SMBHSTDAT0, sdata & 0xff);
-   bus_write_1(sc->io_res, PIIX4_SMBHSTDAT1, (sdata & 0xff) >> 8);
-   intsmb_start(sc, PIIX4_SMBHSTCNT_PROT_WDATA, 0);
-   error = intsmb_stop(sc);
-   if (error == 0) {
-   *rdata = bus_read_1(sc->io_res, PIIX4_SMBHSTDAT0);
-   *rdata |= bus_read_1(sc->io_res, PIIX4_SMBHSTDAT1) << 8;
-   }
-   INTSMB_UNLOCK(sc);
-   return (error);
-#else
return (SMB_ENOTSUPP);
-#endif
 }
 
 static int
@@ -857,9 +829,6 @@ intsmb_bread(device_t dev, u_char slave,
int error, i;
u_char data, nread;
 
-   if (*count > SMBBLOCKTRANS_MAX || *count == 0)
-   return (SMB_EINVAL);
-
INTSMB_LOCK(sc);
error = intsmb_free(sc);
if (error) {
@@ -872,18 +841,14 @@ intsmb_bread(device_t dev, u_char slave,
 
bus_write_1(sc->io_res, PIIX4_SMBHSTADD, slave | LSB);
bus_write_1(sc->io_res, PIIX4_SMBHSTCMD, cmd);
-   bus_write_1(sc->io_res, PIIX4_SMBHSTDAT0, *count);
intsmb_start(sc, PIIX4_SMBHSTCNT_PROT_BLOCK, 0);
error = intsmb_stop(sc);
if (error == 0) {
nread = bus_read_1(sc->io_res, PIIX4_SMBHSTDAT0);
if (nread != 0 && nread <= SMBBLOCKTRANS_MAX) {
-   for (i = 0; i < nread; i++) {
-   data = bus_read_1(sc->io_res, PIIX4_SMBBLKDAT);
-   if (i < *count)
-   buf[i] = data;
-   }
*count = nread;
+   for (i = 0; i < nread; i++)
+   data = bus_read_1(sc->io_res, PIIX4_SMBBLKDAT);
} else
error = SMB_EBUSERR;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308528 - head/usr.sbin/smbmsg

2016-11-11 Thread Andriy Gapon
Author: avg
Date: Fri Nov 11 15:00:13 2016
New Revision: 308528
URL: https://svnweb.freebsd.org/changeset/base/308528

Log:
  smbmsg: use a more convenient way of accessing data read from a slave
  
  Developers writing code for accessing /dev/smb may use this base utility
  as an example.  Now that SMB_READB, SMB_READW, SMB_PCALL behave as
  documented, wwe can use them in a more convenient way than before.
  
  MFC after:4 weeks
  X-MFC after:  r308527

Modified:
  head/usr.sbin/smbmsg/smbmsg.c

Modified: head/usr.sbin/smbmsg/smbmsg.c
==
--- head/usr.sbin/smbmsg/smbmsg.c   Fri Nov 11 14:41:02 2016
(r308527)
+++ head/usr.sbin/smbmsg/smbmsg.c   Fri Nov 11 15:00:13 2016
(r308528)
@@ -61,7 +61,7 @@ static int wflag; /* word IO */
 
 static unsigned char ibuf[SMB_MAXBLOCKSIZE];
 static unsigned char obuf[SMB_MAXBLOCKSIZE];
-static unsigned short oword, iword;
+static unsigned short oword;
 
 /*
  * The I2C specs say that all addresses below 16 and above or equal
@@ -135,6 +135,8 @@ do_io(void)
 
c.slave = slave;
c.cmd = cflag;
+   c.rcount = 0;
+   c.wcount = 0;
 
if (fmt == NULL && iflag > 0)
fmt = wflag? wordfmt: bytefmt;
@@ -163,11 +165,9 @@ do_io(void)
}
if (iflag == 1 && oflag == -1) {
/* command + 1 byte input: read byte op. */
-   c.rbuf = ibuf;
-   c.rcount = iflag;
if (ioctl(fd, SMB_READB, ) == -1)
return (-1);
-   printf(fmt, (int)(unsigned char)ibuf[0]);
+   printf(fmt, (unsigned char)c.rdata.byte);
putchar('\n');
return (0);
} else if (iflag == -1 && oflag == 1) {
@@ -176,11 +176,9 @@ do_io(void)
return (ioctl(fd, SMB_WRITEB, ));
} else if (wflag && iflag == 2 && oflag == -1) {
/* command + 2 bytes input: read word op. */
-   c.rbuf = (char*) 
-   c.rcount = iflag;
if (ioctl(fd, SMB_READW, ) == -1)
return (-1);
-   printf(fmt, (int)(unsigned short)iword);
+   printf(fmt, (unsigned short)c.rdata.word);
putchar('\n');
return (0);
} else if (wflag && iflag == -1 && oflag == 2) {
@@ -193,11 +191,9 @@ do_io(void)
 * "process call" op.
 */
c.wdata.word = oword;
-   c.rbuf = (char*) 
-   c.rcount = iflag;
if (ioctl(fd, SMB_PCALL, ) == -1)
return (-1);
-   printf(fmt, (int)(unsigned short)iword);
+   printf(fmt, (unsigned short)c.rdata.word);
putchar('\n');
return (0);
} else if (iflag > 1 && oflag == -1) {
@@ -206,7 +202,7 @@ do_io(void)
c.rcount = iflag;
if (ioctl(fd, SMB_BREAD, ) == -1)
return (-1);
-   for (i = 0; i < iflag; i++) {
+   for (i = 0; i < c.rcount; i++) {
if (i != 0)
putchar(' ');
printf(fmt, ibuf[i]);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308527 - head/sys/dev/smbus

2016-11-11 Thread Andriy Gapon
Author: avg
Date: Fri Nov 11 14:41:02 2016
New Revision: 308527
URL: https://svnweb.freebsd.org/changeset/base/308527

Log:
  smb: fix SMB_READB, SMB_READW, SMB_PCALL to work as documented
  
  Previously, those ioctls were defined as 'in' only, so rdata.byte and
  rdata.word were never updated in the userland.  The read data went only
  to rbuf if it was provided.  Thus, consumers were forced to always use it.
  
  Now the ioctls are marked as in-out.
  Compatibility handlers are provided for old ioctls.
  
  PR:   213481
  Reported by:  Lewis Donzis 
  MFC after:2 weeks
  Relnotes: maybe
  Differential Revision: https://reviews.freebsd.org/D8430

Modified:
  head/sys/dev/smbus/smb.c
  head/sys/dev/smbus/smb.h

Modified: head/sys/dev/smbus/smb.c
==
--- head/sys/dev/smbus/smb.cFri Nov 11 14:30:09 2016(r308526)
+++ head/sys/dev/smbus/smb.cFri Nov 11 14:41:02 2016(r308527)
@@ -41,7 +41,9 @@
 
 #include "smbus_if.h"
 
-#define BUFSIZE 1024
+#define SMB_OLD_READB  _IOW('i', 7, struct smbcmd)
+#define SMB_OLD_READW  _IOW('i', 8, struct smbcmd)
+#define SMB_OLD_PCALL  _IOW('i', 9, struct smbcmd)
 
 struct smb_softc {
device_t sc_dev;
@@ -224,7 +226,9 @@ smbioctl(struct cdev *dev, u_long cmd, c
s->cmd, s->wdata.word));
break;
 
+   case SMB_OLD_READB:
case SMB_READB:
+   /* NB: for SMB_OLD_READB the read data goes to rbuf only. */
error = smbus_error(smbus_readb(parent, s->slave, s->cmd,
>rdata.byte));
if (error)
@@ -235,7 +239,9 @@ smbioctl(struct cdev *dev, u_long cmd, c
}
break;
 
+   case SMB_OLD_READW:
case SMB_READW:
+   /* NB: for SMB_OLD_READW the read data goes to rbuf only. */
error = smbus_error(smbus_readw(parent, s->slave, s->cmd,
>rdata.word));
if (error)
@@ -248,7 +254,9 @@ smbioctl(struct cdev *dev, u_long cmd, c
}
break;
 
+   case SMB_OLD_PCALL:
case SMB_PCALL:
+   /* NB: for SMB_OLD_PCALL the read data goes to rbuf only. */
error = smbus_error(smbus_pcall(parent, s->slave, s->cmd,
s->wdata.word, >rdata.word));
if (error)

Modified: head/sys/dev/smbus/smb.h
==
--- head/sys/dev/smbus/smb.hFri Nov 11 14:30:09 2016(r308526)
+++ head/sys/dev/smbus/smb.hFri Nov 11 14:41:02 2016(r308527)
@@ -63,11 +63,10 @@ struct smbcmd {
 #define SMB_RECVB  _IOWR('i', 4, struct smbcmd)
 #define SMB_WRITEB _IOW('i', 5, struct smbcmd)
 #define SMB_WRITEW _IOW('i', 6, struct smbcmd)
-#define SMB_READB  _IOW('i', 7, struct smbcmd)
-#define SMB_READW  _IOW('i', 8, struct smbcmd)
-#define SMB_PCALL  _IOW('i', 9, struct smbcmd)
+#define SMB_READB  _IOWR('i', 7, struct smbcmd)
+#define SMB_READW  _IOWR('i', 8, struct smbcmd)
+#define SMB_PCALL  _IOWR('i', 9, struct smbcmd)
 #define SMB_BWRITE _IOW('i', 10, struct smbcmd)
-#define SMB_OLD_BREAD  _IOW('i', 11, struct smbcmd)
 #define SMB_BREAD  _IOWR('i', 11, struct smbcmd)
 #define SMB_OLD_TRANS  _IOWR('i', 12, struct smbcmd)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308525 - in head/sys/arm: altera/socfpga freescale/vybrid rockchip samsung/exynos xilinx

2016-11-11 Thread Andrew Turner
Author: andrew
Date: Fri Nov 11 14:22:35 2016
New Revision: 308525
URL: https://svnweb.freebsd.org/changeset/base/308525

Log:
  Remove more unneeded users of the fdt_pic_decode_t table.
  
  Sponsored by: ABT Systems Ltd

Deleted:
  head/sys/arm/rockchip/rk30xx_common.c
Modified:
  head/sys/arm/altera/socfpga/socfpga_common.c
  head/sys/arm/freescale/vybrid/vf_common.c
  head/sys/arm/rockchip/files.rk30xx
  head/sys/arm/samsung/exynos/exynos5_common.c
  head/sys/arm/xilinx/zy7_machdep.c

Modified: head/sys/arm/altera/socfpga/socfpga_common.c
==
--- head/sys/arm/altera/socfpga/socfpga_common.cFri Nov 11 14:19:12 
2016(r308524)
+++ head/sys/arm/altera/socfpga/socfpga_common.cFri Nov 11 14:22:35 
2016(r308525)
@@ -69,24 +69,3 @@ cpu_reset(void)
 end:
while (1);
 }
-
-#ifndef INTRNG
-static int
-fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
-int *pol)
-{
-
-   if (!fdt_is_compatible(node, "arm,gic"))
-   return (ENXIO);
-
-   *interrupt = fdt32_to_cpu(intr[0]);
-   *trig = INTR_TRIGGER_CONFORM;
-   *pol = INTR_POLARITY_CONFORM;
-   return (0);
-}
-
-fdt_pic_decode_t fdt_pic_table[] = {
-   _pic_decode_ic,
-   NULL
-};
-#endif

Modified: head/sys/arm/freescale/vybrid/vf_common.c
==
--- head/sys/arm/freescale/vybrid/vf_common.c   Fri Nov 11 14:19:12 2016
(r308524)
+++ head/sys/arm/freescale/vybrid/vf_common.c   Fri Nov 11 14:22:35 2016
(r308525)
@@ -61,24 +61,3 @@ cpu_reset(void)
 end:
while (1);
 }
-
-#ifndef INTRNG
-static int
-fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
-int *pol)
-{
-
-   if (!fdt_is_compatible(node, "arm,gic"))
-   return (ENXIO);
-
-   *interrupt = fdt32_to_cpu(intr[0]);
-   *trig = INTR_TRIGGER_CONFORM;
-   *pol = INTR_POLARITY_CONFORM;
-   return (0);
-}
-
-fdt_pic_decode_t fdt_pic_table[] = {
-   _pic_decode_ic,
-   NULL
-};
-#endif

Modified: head/sys/arm/rockchip/files.rk30xx
==
--- head/sys/arm/rockchip/files.rk30xx  Fri Nov 11 14:19:12 2016
(r308524)
+++ head/sys/arm/rockchip/files.rk30xx  Fri Nov 11 14:22:35 2016
(r308525)
@@ -1,7 +1,6 @@
 # $FreeBSD$
 kern/kern_clocksource.cstandard
 
-arm/rockchip/rk30xx_common.c   standard
 arm/rockchip/rk30xx_machdep.c  standard
 arm/rockchip/rk30xx_pmu.c  standard
 arm/rockchip/rk30xx_grf.c  standard

Modified: head/sys/arm/samsung/exynos/exynos5_common.c
==
--- head/sys/arm/samsung/exynos/exynos5_common.cFri Nov 11 14:19:12 
2016(r308524)
+++ head/sys/arm/samsung/exynos/exynos5_common.cFri Nov 11 14:22:35 
2016(r308525)
@@ -48,24 +48,3 @@ cpu_reset(void)
 
while (1);
 }
-
-#ifndef INTRNG
-static int
-fdt_pic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
-int *pol)
-{
-
-   if (!fdt_is_compatible(node, "arm,gic"))
-   return (ENXIO);
-
-   *interrupt = fdt32_to_cpu(intr[0]);
-   *trig = INTR_TRIGGER_CONFORM;
-   *pol = INTR_POLARITY_CONFORM;
-   return (0);
-}
-
-fdt_pic_decode_t fdt_pic_table[] = {
-   _pic_decode_ic,
-   NULL
-};
-#endif

Modified: head/sys/arm/xilinx/zy7_machdep.c
==
--- head/sys/arm/xilinx/zy7_machdep.c   Fri Nov 11 14:19:12 2016
(r308524)
+++ head/sys/arm/xilinx/zy7_machdep.c   Fri Nov 11 14:22:35 2016
(r308525)
@@ -92,29 +92,6 @@ platform_devmap_init(void)
return (0);
 }
 
-
-#ifndef INTRNG
-static int
-fdt_gic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
-int *pol)
-{
-
-   if (!fdt_is_compatible(node, "arm,gic"))
-   return (ENXIO);
-
-   *interrupt = fdt32_to_cpu(intr[0]);
-   *trig = INTR_TRIGGER_CONFORM;
-   *pol = INTR_POLARITY_CONFORM;
-
-   return (0);
-}
-
-fdt_pic_decode_t fdt_pic_table[] = {
-   _gic_decode_ic,
-   NULL
-};
-#endif
-
 void
 cpu_reset()
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308526 - head/sys/arm/at91

2016-11-11 Thread Andrew Turner
Author: andrew
Date: Fri Nov 11 14:30:09 2016
New Revision: 308526
URL: https://svnweb.freebsd.org/changeset/base/308526

Log:
  Fix ata_at91_alloc_resource to use rman_res_t.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/at91/at91_cfata.c

Modified: head/sys/arm/at91/at91_cfata.c
==
--- head/sys/arm/at91/at91_cfata.c  Fri Nov 11 14:22:35 2016
(r308525)
+++ head/sys/arm/at91/at91_cfata.c  Fri Nov 11 14:30:09 2016
(r308526)
@@ -114,7 +114,7 @@ at91_cfata_detach(device_t dev)
 
 static struct resource *
 ata_at91_alloc_resource(device_t dev, device_t child, int type, int *rid,
-u_long start, u_long end, u_long count, u_int flags)
+rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 {
struct at91_cfata_softc *sc = device_get_softc(dev);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308524 - head/sys/dev/fdt

2016-11-11 Thread Andrew Turner
Author: andrew
Date: Fri Nov 11 14:19:12 2016
New Revision: 308524
URL: https://svnweb.freebsd.org/changeset/base/308524

Log:
  Replace OF_getprop ... fdt32_to_cpu with OF_getencprop. The latter
  correctly adjusts for the endian.
  
  MFC after:1 week
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Fri Nov 11 09:03:13 2016
(r308523)
+++ head/sys/dev/fdt/fdt_common.c   Fri Nov 11 14:19:12 2016
(r308524)
@@ -419,13 +419,13 @@ fdt_addrsize_cells(phandle_t node, int *
 * Retrieve #{address,size}-cells.
 */
cell_size = sizeof(cell);
-   if (OF_getprop(node, "#address-cells", , cell_size) < cell_size)
-   cell = 2;
-   *addr_cells = fdt32_to_cpu((int)cell);
+   if (OF_getencprop(node, "#address-cells", , cell_size) < cell_size)
+   *addr_cells = 2;
+   *addr_cells = (int)cell;
 
-   if (OF_getprop(node, "#size-cells", , cell_size) < cell_size)
+   if (OF_getencprop(node, "#size-cells", , cell_size) < cell_size)
cell = 1;
-   *size_cells = fdt32_to_cpu((int)cell);
+   *size_cells = (int)cell;
 
if (*addr_cells > 3 || *size_cells > 2)
return (ERANGE);
@@ -540,11 +540,11 @@ fdt_get_phyaddr(phandle_t node, device_t
 
phy_node = OF_node_from_xref(phy_handle);
 
-   if (OF_getprop(phy_node, "reg", (void *)_reg,
+   if (OF_getencprop(phy_node, "reg", (void *)_reg,
sizeof(phy_reg)) <= 0)
return (ENXIO);
 
-   *phy_addr = fdt32_to_cpu(phy_reg);
+   *phy_addr = phy_reg;
 
/*
 * Search for softc used to communicate with phy.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308523 - stable/11/sys/dev/hyperv/utilities

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 09:03:13 2016
New Revision: 308523
URL: https://svnweb.freebsd.org/changeset/base/308523

Log:
  MFC 307845
  
  hyperv/ic: Rework framework/message version negotiation.
  
  Submitted by:   Hongjiang Zhang 
  Modified by:sephe
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8280

Modified:
  stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c
  stable/11/sys/dev/hyperv/utilities/hv_kvp.c
  stable/11/sys/dev/hyperv/utilities/hv_kvp.h
  stable/11/sys/dev/hyperv/utilities/hv_shutdown.c
  stable/11/sys/dev/hyperv/utilities/hv_timesync.c
  stable/11/sys/dev/hyperv/utilities/hv_util.c
  stable/11/sys/dev/hyperv/utilities/hv_util.h
  stable/11/sys/dev/hyperv/utilities/hv_utilreg.h
  stable/11/sys/dev/hyperv/utilities/vmbus_icreg.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c   Fri Nov 11 09:00:29 
2016(r308522)
+++ stable/11/sys/dev/hyperv/utilities/hv_heartbeat.c   Fri Nov 11 09:03:13 
2016(r308523)
@@ -40,6 +40,14 @@ __FBSDID("$FreeBSD$");
 
 #include "vmbus_if.h"
 
+#define VMBUS_HEARTBEAT_FWVER_MAJOR3
+#define VMBUS_HEARTBEAT_FWVER  \
+   VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0)
+
+#define VMBUS_HEARTBEAT_MSGVER_MAJOR   3
+#define VMBUS_HEARTBEAT_MSGVER \
+   VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0)
+
 static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = {
{
.ic_guid = { .hv_guid = {
@@ -80,7 +88,8 @@ vmbus_heartbeat_cb(struct vmbus_channel 
 */
switch (hdr->ic_type) {
case VMBUS_ICMSG_TYPE_NEGOTIATE:
-   error = vmbus_ic_negomsg(sc, data, );
+   error = vmbus_ic_negomsg(sc, data, ,
+   VMBUS_HEARTBEAT_FWVER, VMBUS_HEARTBEAT_MSGVER);
if (error)
return;
break;

Modified: stable/11/sys/dev/hyperv/utilities/hv_kvp.c
==
--- stable/11/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 09:00:29 2016
(r308522)
+++ stable/11/sys/dev/hyperv/utilities/hv_kvp.c Fri Nov 11 09:03:13 2016
(r308523)
@@ -61,7 +61,9 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
+#include 
 
 #include "hv_util.h"
 #include "unicode.h"
@@ -74,6 +76,12 @@ __FBSDID("$FreeBSD$");
 #define KVP_ERROR  1
 #define kvp_hdrhdr.kvp_hdr
 
+#define KVP_FWVER_MAJOR3
+#define KVP_FWVER  VMBUS_IC_VERSION(KVP_FWVER_MAJOR, 0)
+
+#define KVP_MSGVER_MAJOR   4
+#define KVP_MSGVER VMBUS_IC_VERSION(KVP_MSGVER_MAJOR, 0)
+
 /* hv_kvp debug control */
 static int hv_kvp_log = 0;
 
@@ -208,52 +216,10 @@ hv_kvp_transaction_init(hv_kvp_sc *sc, u
sc->host_msg_id = request_id;
sc->rcv_buf = rcv_buf;
sc->host_kvp_msg = (struct hv_kvp_msg *)_buf[
-   sizeof(struct hv_vmbus_pipe_hdr) +
-   sizeof(struct hv_vmbus_icmsg_hdr)];
+   sizeof(struct hv_vmbus_pipe_hdr) +
+   sizeof(struct hv_vmbus_icmsg_hdr)];
 }
 
-
-/*
- * hv_kvp - version neogtiation function
- */
-static void
-hv_kvp_negotiate_version(struct hv_vmbus_icmsg_hdr *icmsghdrp, uint8_t *buf)
-{
-   struct hv_vmbus_icmsg_negotiate *negop;
-   int icframe_vercnt;
-   int icmsg_vercnt;
-
-   icmsghdrp->icmsgsize = 0x10;
-
-   negop = (struct hv_vmbus_icmsg_negotiate *)[
-   sizeof(struct hv_vmbus_pipe_hdr) +
-   sizeof(struct hv_vmbus_icmsg_hdr)];
-   icframe_vercnt = negop->icframe_vercnt;
-   icmsg_vercnt = negop->icmsg_vercnt;
-
-   /*
-* Select the framework version number we will support
-*/
-   if ((icframe_vercnt >= 2) && (negop->icversion_data[1].major == 3)) {
-   icframe_vercnt = 3;
-   if (icmsg_vercnt > 2)
-   icmsg_vercnt = 4;
-   else
-   icmsg_vercnt = 3;
-   } else {
-   icframe_vercnt = 1;
-   icmsg_vercnt = 1;
-   }
-
-   negop->icframe_vercnt = 1;
-   negop->icmsg_vercnt = 1;
-   negop->icversion_data[0].major = icframe_vercnt;
-   negop->icversion_data[0].minor = 0;
-   negop->icversion_data[1].major = icmsg_vercnt;
-   negop->icversion_data[1].minor = 0;
-}
-
-
 /*
  * Convert ip related info in umsg from utf8 to utf16 and store in hmsg
  */
@@ -578,7 +544,8 @@ hv_kvp_respond_host(hv_kvp_sc *sc, int e
error = HV_KVP_E_FAIL;
 
hv_icmsg_hdrp->status = error;
-   hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION | 
HV_ICMSGHDRFLAG_RESPONSE;
+   hv_icmsg_hdrp->icflags = HV_ICMSGHDRFLAG_TRANSACTION |
+   HV_ICMSGHDRFLAG_RESPONSE;
 

svn commit: r308522 - stable/11/sys/dev/hyperv/netvsc

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 09:00:29 2016
New Revision: 308522
URL: https://svnweb.freebsd.org/changeset/base/308522

Log:
  MFC 307844
  
  hyperv/hn: Nuke unused forward declaration.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8314

Modified:
  stable/11/sys/dev/hyperv/netvsc/if_hnvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/netvsc/if_hnvar.h
==
--- stable/11/sys/dev/hyperv/netvsc/if_hnvar.h  Fri Nov 11 08:57:52 2016
(r308521)
+++ stable/11/sys/dev/hyperv/netvsc/if_hnvar.h  Fri Nov 11 09:00:29 2016
(r308522)
@@ -48,11 +48,6 @@ struct hn_send_ctx {
void*hn_cbarg;
 };
 
-struct rndis_hash_info;
-struct rndix_hash_value;
-struct ndis_8021q_info_;
-struct rndis_tcp_ip_csum_info_;
-
 #define HN_NDIS_VLAN_INFO_INVALID  0x
 #define HN_NDIS_RXCSUM_INFO_INVALID0
 #define HN_NDIS_HASH_INFO_INVALID  0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308521 - in stable/11/sys: dev/hyperv/netvsc net

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 08:57:52 2016
New Revision: 308521
URL: https://svnweb.freebsd.org/changeset/base/308521

Log:
  MFC 307843
  
  hyperv/hn: Fix RX filter settings.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8313

Modified:
  stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/11/sys/net/rndis.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.hFri Nov 11 08:55:45 
2016(r308520)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.hFri Nov 11 08:57:52 
2016(r308521)
@@ -232,6 +232,7 @@ struct hn_softc {
struct sysctl_oid *hn_rx_sysctl_tree;
struct vmbus_xact_ctx *hn_xact;
uint32_thn_nvs_ver;
+   uint32_thn_rx_filter;
 
struct taskqueue*hn_mgmt_taskq;
struct taskqueue*hn_mgmt_taskq0;

Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:55:45 2016(r308520)
+++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:57:52 2016(r308521)
@@ -326,6 +326,7 @@ static int hn_tx_conf_int_sysctl(SYSCTL_
 static int hn_ndis_version_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_check_iplen(const struct mbuf *, int);
@@ -367,6 +368,7 @@ static int netvsc_detach(device_t dev);
 static void hn_link_status(struct hn_softc *);
 static int hn_sendpkt_rndis_sglist(struct hn_tx_ring *, struct hn_txdesc *);
 static int hn_sendpkt_rndis_chim(struct hn_tx_ring *, struct hn_txdesc *);
+static int hn_set_rxfilter(struct hn_softc *);
 
 static void hn_nvs_handle_notify(struct hn_softc *sc,
const struct vmbus_chanpkt_hdr *pkt);
@@ -455,6 +457,43 @@ hn_sendpkt_rndis_chim(struct hn_tx_ring 
 }
 
 static int
+hn_set_rxfilter(struct hn_softc *sc)
+{
+   struct ifnet *ifp = sc->hn_ifp;
+   uint32_t filter;
+   int error = 0;
+
+   HN_LOCK_ASSERT(sc);
+
+   if (ifp->if_flags & IFF_PROMISC) {
+   filter = NDIS_PACKET_TYPE_PROMISCUOUS;
+   } else {
+   filter = NDIS_PACKET_TYPE_DIRECTED;
+   if (ifp->if_flags & IFF_BROADCAST)
+   filter |= NDIS_PACKET_TYPE_BROADCAST;
+#ifdef notyet
+   /*
+* See the comment in SIOCADDMULTI/SIOCDELMULTI.
+*/
+   /* TODO: support multicast list */
+   if ((ifp->if_flags & IFF_ALLMULTI) ||
+   !TAILQ_EMPTY(>if_multiaddrs))
+   filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
+#else
+   /* Always enable ALLMULTI */
+   filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
+#endif
+   }
+
+   if (sc->hn_rx_filter != filter) {
+   error = hn_rndis_set_rxfilter(sc, filter);
+   if (!error)
+   sc->hn_rx_filter = filter;
+   }
+   return (error);
+}
+
+static int
 hn_get_txswq_depth(const struct hn_tx_ring *txr)
 {
 
@@ -728,6 +767,9 @@ netvsc_attach(device_t dev)
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "hwassist",
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
hn_hwassist_sysctl, "A", "hwassist");
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rxfilter",
+   CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0,
+   hn_rxfilter_sysctl, "A", "rxfilter");
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key",
CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0,
hn_rss_key_sysctl, "IU", "RSS key");
@@ -1840,31 +1882,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
}
 
if (ifp->if_flags & IFF_UP) {
-   /*
-* If only the state of the PROMISC flag changed,
-* then just use the 'set promisc mode' command
-* instead of reinitializing the entire NIC. Doing
-* a full re-init means reloading the firmware and
-* waiting for it to start up, which may take a
-* second or two.
-*/
-#ifdef notyet
-   /* Fixme:  Promiscuous mode? */
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-   ifp->if_flags & IFF_PROMISC &&
-   

svn commit: r308520 - stable/11/sys/dev/hyperv/netvsc

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 08:55:45 2016
New Revision: 308520
URL: https://svnweb.freebsd.org/changeset/base/308520

Log:
  MFC 307840,307842
  
  307840
  hyperv/hn: Properly handle synthetic parts reattach failure.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8310
  
  307842
  hyperv/hn: Start link status check, if no network changes were pending.
  
  Link status check is much more lightweight than network change detection.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8311

Modified:
  stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:52:23 2016(r308519)
+++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:55:45 2016(r308520)
@@ -1783,19 +1783,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
break;
}
 
-   /* Obtain and record requested MTU */
-   ifp->if_mtu = ifr->ifr_mtu;
-
-#if __FreeBSD_version >= 1100099
-   /*
-* Make sure that LRO aggregation length limit is still
-* valid, after the MTU change.
-*/
-   if (sc->hn_rx_ring[0].hn_lro.lro_length_lim <
-   HN_LRO_LENLIM_MIN(ifp))
-   hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp));
-#endif
-
/*
 * Suspend this interface before the synthetic parts
 * are ripped.
@@ -1810,13 +1797,31 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
/*
 * Reattach the synthetic parts, i.e. NVS and RNDIS,
 * with the new MTU setting.
-* XXX check error.
 */
-   hn_synth_attach(sc, ifr->ifr_mtu);
+   error = hn_synth_attach(sc, ifr->ifr_mtu);
+   if (error) {
+   HN_UNLOCK(sc);
+   break;
+   }
 
+   /*
+* Commit the requested MTU, after the synthetic parts
+* have been successfully attached.
+*/
+   ifp->if_mtu = ifr->ifr_mtu;
+
+   /*
+* Make sure that various parameters based on MTU are
+* still valid, after the MTU change.
+*/
if (sc->hn_tx_ring[0].hn_chim_size > sc->hn_chim_szmax)
hn_set_chim_size(sc, sc->hn_chim_szmax);
-   hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu);
+   hn_set_tso_maxsize(sc, hn_tso_maxlen, ifp->if_mtu);
+#if __FreeBSD_version >= 1100099
+   if (sc->hn_rx_ring[0].hn_lro.lro_length_lim <
+   HN_LRO_LENLIM_MIN(ifp))
+   hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp));
+#endif
 
/*
 * All done!  Resume the interface now.
@@ -3903,12 +3908,18 @@ static void
 hn_resume_mgmt(struct hn_softc *sc)
 {
 
+   sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0;
+
/*
-* Kick off network change detection, which will
-* do link status check too.
+* Kick off network change detection, if it was pending.
+* If no network change was pending, start link status
+* checks, which is more lightweight than network change
+* detection.
 */
-   sc->hn_mgmt_taskq = sc->hn_mgmt_taskq0;
-   hn_network_change(sc);
+   if (sc->hn_link_flags & HN_LINK_FLAG_NETCHG)
+   hn_network_change(sc);
+   else
+   hn_link_status_update(sc);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308519 - stable/11/sys/dev/hyperv/netvsc

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 08:52:23 2016
New Revision: 308519
URL: https://svnweb.freebsd.org/changeset/base/308519

Log:
  MFC 307838,307839
  
  307838
  hyperv/hn: Move chimney buffer index and size to txdesc.
  
  All RNDIS control messages have used SG list for a while.  This makes
  the send context suitable for further refactoring.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8308
  
  307839
  hyperv/hn: Fix chimney sending buffer leakage upon NVS sending failure.
  
  This will not happen in real world, since TX consumption of the vmbus
  TX bufring is limitted.  Better safe than sorry.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8309

Modified:
  stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  stable/11/sys/dev/hyperv/netvsc/if_hnvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.cFri Nov 11 08:49:28 
2016(r308518)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.cFri Nov 11 08:52:23 
2016(r308519)
@@ -117,7 +117,7 @@ hn_nvs_xact_execute(struct hn_softc *sc,
/*
 * Execute the xact setup by the caller.
 */
-   hn_send_ctx_init_simple(, hn_nvs_sent_xact, xact);
+   hn_send_ctx_init(, hn_nvs_sent_xact, xact);
 
vmbus_xact_activate(xact);
error = hn_nvs_send(sc->hn_prichan, VMBUS_CHANPKT_FLAG_RC,
@@ -669,34 +669,6 @@ hn_chim_free(struct hn_softc *sc, uint32
atomic_clear_long(>hn_chim_bmap[idx], mask);
 }
 
-/*
- * Net VSC on send
- * Sends a packet on the specified Hyper-V device.
- * Returns 0 on success, non-zero on failure.
- */
-int
-hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype,
-struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt)
-{
-   struct hn_nvs_rndis rndis;
-   int ret;
-
-   rndis.nvs_type = HN_NVS_TYPE_RNDIS;
-   rndis.nvs_rndis_mtype = rndis_mtype;
-   rndis.nvs_chim_idx = sndc->hn_chim_idx;
-   rndis.nvs_chim_sz = sndc->hn_chim_sz;
-
-   if (gpa_cnt) {
-   ret = hn_nvs_send_sglist(chan, gpa, gpa_cnt,
-   , sizeof(rndis), sndc);
-   } else {
-   ret = hn_nvs_send(chan, VMBUS_CHANPKT_FLAG_RC,
-   , sizeof(rndis), sndc);
-   }
-
-   return (ret);
-}
-
 int
 hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0)
 {

Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.hFri Nov 11 08:49:28 
2016(r308518)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.hFri Nov 11 08:52:23 
2016(r308519)
@@ -104,8 +104,8 @@ struct vmbus_channel;
 #define HN_XACT_REQ_SIZE   (HN_XACT_REQ_PGCNT * PAGE_SIZE)
 #define HN_XACT_RESP_SIZE  (HN_XACT_RESP_PGCNT * PAGE_SIZE)
 
-#ifndef HN_USE_TXDESC_BUFRING
 struct hn_txdesc;
+#ifndef HN_USE_TXDESC_BUFRING
 SLIST_HEAD(hn_txdesc_list, hn_txdesc);
 #else
 struct buf_ring;
@@ -179,6 +179,7 @@ struct hn_tx_ring {
bus_dma_tag_t   hn_tx_data_dtag;
uint64_thn_csum_assist;
 
+   int (*hn_sendpkt)(struct hn_tx_ring *, struct hn_txdesc *);
int hn_suspended;
int hn_gpa_cnt;
struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE];
@@ -276,13 +277,5 @@ struct hn_softc {
 #define HN_LINK_FLAG_LINKUP0x0001
 #define HN_LINK_FLAG_NETCHG0x0002
 
-/*
- * Externs
- */
-struct hn_send_ctx;
-
-int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype,
-   struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt);
-
 #endif  /* __HV_NET_VSC_H__ */
 

Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:49:28 2016(r308518)
+++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:52:23 2016(r308519)
@@ -169,6 +169,8 @@ struct hn_txdesc {
int refs;
uint32_tflags;  /* HN_TXD_FLAG_ */
struct hn_send_ctx send_ctx;
+   uint32_tchim_index;
+   int chim_size;
 
bus_dmamap_tdata_dmap;
 
@@ -363,6 +365,8 @@ static void hn_tx_resume(struct hn_softc
 static void hn_tx_ring_qflush(struct hn_tx_ring *);
 static int netvsc_detach(device_t dev);
 static void hn_link_status(struct hn_softc *);
+static int hn_sendpkt_rndis_sglist(struct 

svn commit: r308518 - in stable/11/sys: dev/hyperv/netvsc net

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 08:49:28 2016
New Revision: 308518
URL: https://svnweb.freebsd.org/changeset/base/308518

Log:
  MFC 307710-307712,307714
  
  307710
  hyperv/hn: Always query RSS capabilities.
  
  - This avoid distributing NDIS version check.
  - Only NDIS 6.20 required (earlier NDIS uses different indirect table
format).
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8291
  
  307711
  hyperv/hn: Check NVS version for HASHVAL pktinfo on sending path.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8293
  
  307712
  hyperv/hn: Add network change support.
  
  Currently the network change is simulated by link status changes.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8295
  
  307714
  hyperv/hn: Function renaming; consistent w/ hardware capabilities query.
  
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8296

Modified:
  stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
  stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/11/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  stable/11/sys/dev/hyperv/netvsc/if_hnreg.h
  stable/11/sys/dev/hyperv/netvsc/if_hnvar.h
  stable/11/sys/dev/hyperv/netvsc/ndis.h
  stable/11/sys/net/rndis.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.cFri Nov 11 08:43:34 
2016(r308517)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.cFri Nov 11 08:49:28 
2016(r308518)
@@ -544,8 +544,9 @@ hn_nvs_init(struct hn_softc *sc)
if (error) {
if_printf(sc->hn_ifp, "reinit NVS version 0x%x "
"failed: %d\n", sc->hn_nvs_ver, error);
+   return (error);
}
-   return (error);
+   goto done;
}
 
/*
@@ -567,11 +568,16 @@ hn_nvs_init(struct hn_softc *sc)
HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver),
HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver));
}
-   return (0);
+   goto done;
}
}
if_printf(sc->hn_ifp, "no NVS available\n");
return (ENXIO);
+
+done:
+   if (sc->hn_nvs_ver >= HN_NVS_VERSION_5)
+   sc->hn_caps |= HN_CAP_HASHVAL;
+   return (0);
 }
 
 int

Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.hFri Nov 11 08:43:34 
2016(r308517)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.hFri Nov 11 08:49:28 
2016(r308518)
@@ -207,7 +207,6 @@ struct hn_softc {
struct ifnet*hn_ifp;
struct ifmedia  hn_media;
device_thn_dev;
-   int hn_carrier;
int hn_if_flags;
struct sx   hn_lock;
struct vmbus_channel *hn_prichan;
@@ -236,6 +235,9 @@ struct hn_softc {
struct taskqueue*hn_mgmt_taskq;
struct taskqueue*hn_mgmt_taskq0;
struct task hn_link_task;
+   struct task hn_netchg_init;
+   struct timeout_task hn_netchg_status;
+   uint32_thn_link_flags;  /* HN_LINK_FLAG_ */
 
uint32_thn_caps;/* HN_CAP_ */
uint32_thn_flags;   /* HN_FLAG_ */
@@ -269,6 +271,10 @@ struct hn_softc {
 #define HN_CAP_UDP6CS  0x0040
 #define HN_CAP_TSO40x0080
 #define HN_CAP_TSO60x0100
+#define HN_CAP_HASHVAL 0x0200
+
+#define HN_LINK_FLAG_LINKUP0x0001
+#define HN_LINK_FLAG_NETCHG0x0002
 
 /*
  * Externs

Modified: stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:43:34 2016(r308517)
+++ stable/11/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Nov 11 
08:49:28 2016(r308518)
@@ -335,6 +335,8 @@ static void hn_destroy_tx_data(struct hn
 static void hn_start_taskfunc(void *, int);
 static void hn_start_txeof_taskfunc(void *, int);
 static void hn_link_taskfunc(void *, int);
+static void hn_netchg_init_taskfunc(void *, int);
+static void hn_netchg_status_taskfunc(void *, int);
 static void hn_suspend_mgmt_taskfunc(void *, int);
 static int hn_encap(struct hn_tx_ring *, struct hn_txdesc *, struct mbuf **);
 static int hn_create_rx_data(struct 

svn commit: r308517 - in stable/11/sys/dev/hyperv: include vmbus

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 08:43:34 2016
New Revision: 308517
URL: https://svnweb.freebsd.org/changeset/base/308517

Log:
  MFC 307624
  
  hyperv/vmbus: Expose channel management taskqueue for driver to use.
  
  MFC after:  3 days
  Sponsored by:   Microsoft

Modified:
  stable/11/sys/dev/hyperv/include/vmbus.h
  stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/hyperv/include/vmbus.h
==
--- stable/11/sys/dev/hyperv/include/vmbus.hFri Nov 11 08:04:24 2016
(r308516)
+++ stable/11/sys/dev/hyperv/include/vmbus.hFri Nov 11 08:43:34 2016
(r308517)
@@ -118,6 +118,7 @@ struct vmbus_chan_br {
 struct vmbus_channel;
 struct hyperv_guid;
 struct task;
+struct taskqueue;
 
 typedef void   (*vmbus_chan_callback_t)(struct vmbus_channel *, void *);
 
@@ -179,5 +180,7 @@ int vmbus_chan_prplist_nelem(int br_siz
int dlen_max);
 bool   vmbus_chan_rx_empty(const struct vmbus_channel *chan);
 bool   vmbus_chan_tx_empty(const struct vmbus_channel *chan);
+struct taskqueue *
+   vmbus_chan_mgmt_tq(const struct vmbus_channel *chan);
 
 #endif /* !_VMBUS_H_ */

Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 08:04:24 2016
(r308516)
+++ stable/11/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 11 08:43:34 2016
(r308517)
@@ -1721,3 +1721,10 @@ vmbus_chan_run_task(struct vmbus_channel
taskqueue_enqueue(chan->ch_tq, task);
taskqueue_drain(chan->ch_tq, task);
 }
+
+struct taskqueue *
+vmbus_chan_mgmt_tq(const struct vmbus_channel *chan)
+{
+
+   return (chan->ch_mgmt_tq);
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r308516 - in stable/10: contrib/hyperv/tools sys/dev/hyperv/utilities

2016-11-11 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Nov 11 08:04:24 2016
New Revision: 308516
URL: https://svnweb.freebsd.org/changeset/base/308516

Log:
  MFC 308201
  
  hyperv/kvp: Don't mix message status codes and function return values.
  
  While I'm here, move message status codes to hv_utilreg.h, since they
  will be used by the upcoming VSS stuffs.
  
  Submitted by:   Hongjiang Zhang 
  Sponsored by:   Microsoft
  Differential Revision:  https://reviews.freebsd.org/D8391

Modified:
  stable/10/contrib/hyperv/tools/hv_kvp_daemon.c
  stable/10/sys/dev/hyperv/utilities/hv_kvp.c
  stable/10/sys/dev/hyperv/utilities/hv_kvp.h
  stable/10/sys/dev/hyperv/utilities/hv_utilreg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/hyperv/tools/hv_kvp_daemon.c
==
--- stable/10/contrib/hyperv/tools/hv_kvp_daemon.c  Fri Nov 11 07:52:29 
2016(r308515)
+++ stable/10/contrib/hyperv/tools/hv_kvp_daemon.c  Fri Nov 11 08:04:24 
2016(r308516)
@@ -52,9 +52,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "hv_kvp.h"
-
+#include "hv_utilreg.h"
 typedef uint8_t__u8;
 typedef uint16_t   __u16;
 typedef uint32_t   __u32;
@@ -684,18 +685,16 @@ kvp_get_ipconfig_info(char *if_name, str
 */
kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way,
(MAX_GATEWAY_SIZE * 2), INET_ADDRSTRLEN, 0);
-
/*
 * Retrieve the IPV6 address of default gateway.
 */
-   snprintf(cmd, sizeof(cmd), "netstat -rn inet6 | grep %s | awk 
'/default/ {print $2 }", if_name);
+   snprintf(cmd, sizeof(cmd), "netstat -rn inet6 | grep %s | awk 
'/default/ {print $2 }'", if_name);
 
/*
 * Execute the command to gather gateway IPV6 info.
 */
kvp_process_ipconfig_file(cmd, (char *)buffer->gate_way,
(MAX_GATEWAY_SIZE * 2), INET6_ADDRSTRLEN, 1);
-
/*
 * we just invoke an external script to get the DNS info.
 *
@@ -782,11 +781,11 @@ kvp_process_ip_address(void *addrp,
}
 
if ((length - *offset) < addr_length + 1) {
-   return (HV_KVP_E_FAIL);
+   return (EINVAL);
}
if (str == NULL) {
strlcpy(buffer, "inet_ntop failed\n", length);
-   return (HV_KVP_E_FAIL);
+   return (errno);
}
if (*offset == 0) {
strlcpy(buffer, tmp, length);
@@ -832,7 +831,7 @@ kvp_get_ip_info(int family, char *if_nam
 
if (getifaddrs()) {
strlcpy(buffer, "getifaddrs failed\n", buffer_length);
-   return (HV_KVP_E_FAIL);
+   return (errno);
}
 
curp = ifap;
@@ -924,7 +923,6 @@ kvp_get_ip_info(int family, char *if_nam
/*
 * Collect other ip configuration info.
 */
-
kvp_get_ipconfig_info(if_name, ip_buffer);
}
 
@@ -954,7 +952,7 @@ kvp_write_file(FILE *f, const char *s1, 
ret = fprintf(f, "%s%s%s%s\n", s1, s2, "=", s3);
 
if (ret < 0) {
-   return (HV_KVP_E_FAIL);
+   return (EIO);
}
 
return (0);
@@ -979,7 +977,7 @@ kvp_set_ip_info(char *if_name, struct hv
 
if (file == NULL) {
KVP_LOG(LOG_ERR, "FreeBSD Failed to open config file\n");
-   return (HV_KVP_E_FAIL);
+   return (errno);
}
 
/*
@@ -988,7 +986,7 @@ kvp_set_ip_info(char *if_name, struct hv
 
mac_addr = kvp_if_name_to_mac(if_name);
if (mac_addr == NULL) {
-   error = HV_KVP_E_FAIL;
+   error = EINVAL;
goto kvp_set_ip_info_error;
}
/* MAC Address */
@@ -1091,28 +1089,30 @@ kvp_op_getipinfo(struct hv_kvp_msg *op_m
 {
struct hv_kvp_ipaddr_value *ip_val;
char *if_name;
+   int error = 0;
 
assert(op_msg != NULL);
KVP_LOG(LOG_DEBUG, "In kvp_op_getipinfo.\n");
 
ip_val = _msg->body.kvp_ip_val;
-   op_msg->hdr.error = HV_KVP_S_OK;
+   op_msg->hdr.error = HV_S_OK;
 
if_name = kvp_mac_to_if_name((char *)ip_val->adapter_id);
 
if (if_name == NULL) {
/* No interface found with the mac address. */
-   op_msg->hdr.error = HV_KVP_E_FAIL;
+   op_msg->hdr.error = HV_E_FAIL;
goto kvp_op_getipinfo_done;
}
 
-   op_msg->hdr.error = kvp_get_ip_info(0, if_name,
+   error = kvp_get_ip_info(0, if_name,
HV_KVP_OP_GET_IP_INFO, ip_val, (MAX_IP_ADDR_SIZE * 2));
-
+   if (error)
+   op_msg->hdr.error = HV_E_FAIL;
free(if_name);
 
 kvp_op_getipinfo_done:
-   return(op_msg->hdr.error);
+   return (error);
 }
 
 
@@ -1121,25 +1121,27 @@ kvp_op_setipinfo(struct hv_kvp_msg *op_m
 {
struct