svn commit: r343019 - stable/11/sys/net80211

2019-01-13 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Jan 14 07:54:11 2019
New Revision: 343019
URL: https://svnweb.freebsd.org/changeset/base/343019

Log:
  MFC r342883:
  net80211: fix panic when device is removed during initialization
  
  if_dead() is called during device detach - check if interface is
  still exists before trying to refresh vap MAC address
  (IF_LLADDR will trigger page fault otherwise).

Modified:
  stable/11/sys/net80211/ieee80211_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net80211/ieee80211_ioctl.c
==
--- stable/11/sys/net80211/ieee80211_ioctl.cMon Jan 14 07:50:23 2019
(r343018)
+++ stable/11/sys/net80211/ieee80211_ioctl.cMon Jan 14 07:54:11 2019
(r343019)
@@ -3394,9 +3394,13 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
/*
 * Check if the MAC address was changed
 * via SIOCSIFLLADDR ioctl.
+*
+* NB: device may be detached during initialization;
+* use if_ioctl for existence check.
 */
if_addr_rlock(ifp);
-   if ((ifp->if_flags & IFF_UP) == 0 &&
+   if (ifp->if_ioctl == ieee80211_ioctl &&
+   (ifp->if_flags & IFF_UP) == 0 &&
!IEEE80211_ADDR_EQ(vap->iv_myaddr, IF_LLADDR(ifp)))
IEEE80211_ADDR_COPY(vap->iv_myaddr,
IF_LLADDR(ifp));
___
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: r343018 - stable/12/sys/net80211

2019-01-13 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Jan 14 07:50:23 2019
New Revision: 343018
URL: https://svnweb.freebsd.org/changeset/base/343018

Log:
  MFC r342883:
  net80211: fix panic when device is removed during initialization
  
  if_dead() is called during device detach - check if interface is
  still exists before trying to refresh vap MAC address
  (IF_LLADDR will trigger page fault otherwise).

Modified:
  stable/12/sys/net80211/ieee80211_ioctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net80211/ieee80211_ioctl.c
==
--- stable/12/sys/net80211/ieee80211_ioctl.cMon Jan 14 07:31:19 2019
(r343017)
+++ stable/12/sys/net80211/ieee80211_ioctl.cMon Jan 14 07:50:23 2019
(r343018)
@@ -3537,9 +3537,13 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t
/*
 * Check if the MAC address was changed
 * via SIOCSIFLLADDR ioctl.
+*
+* NB: device may be detached during initialization;
+* use if_ioctl for existence check.
 */
if_addr_rlock(ifp);
-   if ((ifp->if_flags & IFF_UP) == 0 &&
+   if (ifp->if_ioctl == ieee80211_ioctl &&
+   (ifp->if_flags & IFF_UP) == 0 &&
!IEEE80211_ADDR_EQ(vap->iv_myaddr, IF_LLADDR(ifp)))
IEEE80211_ADDR_COPY(vap->iv_myaddr,
IF_LLADDR(ifp));
___
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: r343017 - head/sys/kern

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 14 07:31:19 2019
New Revision: 343017
URL: https://svnweb.freebsd.org/changeset/base/343017

Log:
  Handle overflow in calculating max kmem size.
  
  vm_kmem_size is u_long, and it might be not capable of holding page
  count times PAGE_SIZE, even when scaled down by VM_KMEM_SIZE_SCALE.  As
  bde reported, 12G PAE config ends up with zero for kmem size.
  
  Explicitly check for overflow and clamp kmem size at vm_kmem_size_max.
  If we end up at zero size because VM_KMEM_SIZE_MAX is not defined,
  panic with clear explanation rather then failing in a way which is
  hard to relate.
  
  Reported by:  bde, pho
  Tested by:pho
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D18767

Modified:
  head/sys/kern/kern_malloc.c

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Mon Jan 14 07:25:44 2019(r343016)
+++ head/sys/kern/kern_malloc.c Mon Jan 14 07:31:19 2019(r343017)
@@ -920,13 +920,16 @@ kmeminit(void)
 * variable:
 */
if (vm_kmem_size == 0) {
-   vm_kmem_size = (mem_size / vm_kmem_size_scale) * PAGE_SIZE;
-
+   vm_kmem_size = mem_size / vm_kmem_size_scale;
+   vm_kmem_size = vm_kmem_size * PAGE_SIZE < vm_kmem_size ?
+   vm_kmem_size_max : vm_kmem_size * PAGE_SIZE;
if (vm_kmem_size_min > 0 && vm_kmem_size < vm_kmem_size_min)
vm_kmem_size = vm_kmem_size_min;
if (vm_kmem_size_max > 0 && vm_kmem_size >= vm_kmem_size_max)
vm_kmem_size = vm_kmem_size_max;
}
+   if (vm_kmem_size == 0)
+   panic("Tune VM_KMEM_SIZE_* for the platform");
 
/*
 * The amount of KVA space that is preallocated to the
___
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: r343016 - in stable/11: lib/libc/sys sys/vm

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 14 07:25:44 2019
New Revision: 343016
URL: https://svnweb.freebsd.org/changeset/base/343016

Log:
  MFC r342853:
  Add a tunable which changes mincore(2) algorithm to only report data
  from the local mapping.

Modified:
  stable/11/lib/libc/sys/mincore.2
  stable/11/sys/vm/vm_mmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/mincore.2
==
--- stable/11/lib/libc/sys/mincore.2Mon Jan 14 07:24:49 2019
(r343015)
+++ stable/11/lib/libc/sys/mincore.2Mon Jan 14 07:25:44 2019
(r343016)
@@ -28,7 +28,7 @@
 .\"@(#)mincore.2   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2018
+.Dd January 7, 2019
 .Dt MINCORE 2
 .Os
 .Sh NAME
@@ -47,7 +47,8 @@ system call determines whether each of the pages in th
 .Fa addr
 and continuing for
 .Fa len
-bytes is resident.
+bytes is resident or mapped, depending on the value of sysctl
+.Va vm.mincore_mapped .
 .\"The beginning address,
 .\".Fa addr ,
 .\"is first rounded down to a multiple of the page size (see
@@ -85,6 +86,18 @@ The only way to ensure that a page is resident is to l
 with the
 .Xr mlock 2
 system call.
+.Pp
+If the
+.Va vm.mincore_mapped
+sysctl is set to a non-zero value (default), only the current process'
+mappings of the pages in the specified virtual address range are examined.
+This does not preclude the system from returning
+.Dv MINCORE_REFERENCED_OTHER
+and
+.Dv MINCORE_MODIFIED_OTHER
+statuses.
+Otherwise, if the sysctl value is zero, all resident pages backing the
+specified address range are examined, regardless of the mapping state.
 .Sh RETURN VALUES
 .Rv -std mincore
 .Sh ERRORS

Modified: stable/11/sys/vm/vm_mmap.c
==
--- stable/11/sys/vm/vm_mmap.c  Mon Jan 14 07:24:49 2019(r343015)
+++ stable/11/sys/vm/vm_mmap.c  Mon Jan 14 07:25:44 2019(r343016)
@@ -96,6 +96,9 @@ __FBSDID("$FreeBSD$");
 int old_mlock = 0;
 SYSCTL_INT(_vm, OID_AUTO, old_mlock, CTLFLAG_RWTUN, &old_mlock, 0,
 "Do not apply RLIMIT_MEMLOCK on mlockall");
+static int mincore_mapped = 1;
+SYSCTL_INT(_vm, OID_AUTO, mincore_mapped, CTLFLAG_RWTUN, &mincore_mapped, 0,
+"mincore reports mappings, not residency");
 
 #ifdef MAP_32BIT
 #defineMAP_32BIT_MAX_ADDR  ((vm_offset_t)1 << 31)
@@ -814,7 +817,16 @@ RestartScan:
retry:
m = NULL;
mincoreinfo = pmap_mincore(pmap, addr, &locked_pa);
-   if (locked_pa != 0) {
+   if (mincore_mapped) {
+   /*
+* We only care about this pmap's
+* mapping of the page, if any.
+*/
+   if (locked_pa != 0) {
+   vm_page_unlock(PHYS_TO_VM_PAGE(
+   locked_pa));
+   }
+   } else if (locked_pa != 0) {
/*
 * The page is mapped by this process but not
 * both accessed and modified.  It is also
___
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: r343015 - in stable/12: lib/libc/sys sys/vm

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 14 07:24:49 2019
New Revision: 343015
URL: https://svnweb.freebsd.org/changeset/base/343015

Log:
  MFC r342853:
  Add a tunable which changes mincore(2) algorithm to only report data
  from the local mapping.

Modified:
  stable/12/lib/libc/sys/mincore.2
  stable/12/sys/vm/vm_mmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/mincore.2
==
--- stable/12/lib/libc/sys/mincore.2Mon Jan 14 07:22:58 2019
(r343014)
+++ stable/12/lib/libc/sys/mincore.2Mon Jan 14 07:24:49 2019
(r343015)
@@ -28,7 +28,7 @@
 .\"@(#)mincore.2   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2018
+.Dd January 7, 2019
 .Dt MINCORE 2
 .Os
 .Sh NAME
@@ -47,7 +47,8 @@ system call determines whether each of the pages in th
 .Fa addr
 and continuing for
 .Fa len
-bytes is resident.
+bytes is resident or mapped, depending on the value of sysctl
+.Va vm.mincore_mapped .
 .\"The beginning address,
 .\".Fa addr ,
 .\"is first rounded down to a multiple of the page size (see
@@ -85,6 +86,18 @@ The only way to ensure that a page is resident is to l
 with the
 .Xr mlock 2
 system call.
+.Pp
+If the
+.Va vm.mincore_mapped
+sysctl is set to a non-zero value (default), only the current process'
+mappings of the pages in the specified virtual address range are examined.
+This does not preclude the system from returning
+.Dv MINCORE_REFERENCED_OTHER
+and
+.Dv MINCORE_MODIFIED_OTHER
+statuses.
+Otherwise, if the sysctl value is zero, all resident pages backing the
+specified address range are examined, regardless of the mapping state.
 .Sh RETURN VALUES
 .Rv -std mincore
 .Sh ERRORS

Modified: stable/12/sys/vm/vm_mmap.c
==
--- stable/12/sys/vm/vm_mmap.c  Mon Jan 14 07:22:58 2019(r343014)
+++ stable/12/sys/vm/vm_mmap.c  Mon Jan 14 07:24:49 2019(r343015)
@@ -97,6 +97,9 @@ __FBSDID("$FreeBSD$");
 int old_mlock = 0;
 SYSCTL_INT(_vm, OID_AUTO, old_mlock, CTLFLAG_RWTUN, &old_mlock, 0,
 "Do not apply RLIMIT_MEMLOCK on mlockall");
+static int mincore_mapped = 1;
+SYSCTL_INT(_vm, OID_AUTO, mincore_mapped, CTLFLAG_RWTUN, &mincore_mapped, 0,
+"mincore reports mappings, not residency");
 
 #ifdef MAP_32BIT
 #defineMAP_32BIT_MAX_ADDR  ((vm_offset_t)1 << 31)
@@ -814,7 +817,16 @@ RestartScan:
retry:
m = NULL;
mincoreinfo = pmap_mincore(pmap, addr, &locked_pa);
-   if (locked_pa != 0) {
+   if (mincore_mapped) {
+   /*
+* We only care about this pmap's
+* mapping of the page, if any.
+*/
+   if (locked_pa != 0) {
+   vm_page_unlock(PHYS_TO_VM_PAGE(
+   locked_pa));
+   }
+   } else if (locked_pa != 0) {
/*
 * The page is mapped by this process but not
 * both accessed and modified.  It is also
___
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: r343014 - stable/11/sys/dev/ahci

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 14 07:22:58 2019
New Revision: 343014
URL: https://svnweb.freebsd.org/changeset/base/343014

Log:
  MFC r342826:
  Fix use of busdma(9) KPI in ahci(4).

Modified:
  stable/11/sys/dev/ahci/ahci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ahci/ahci.c
==
--- stable/11/sys/dev/ahci/ahci.c   Mon Jan 14 07:21:43 2019
(r343013)
+++ stable/11/sys/dev/ahci/ahci.c   Mon Jan 14 07:22:58 2019
(r343014)
@@ -937,18 +937,22 @@ ahci_dmainit(device_t dev)
struct ahci_channel *ch = device_get_softc(dev);
struct ahci_dc_cb_args dcba;
size_t rfsize;
+   int error;
 
/* Command area. */
-   if (bus_dma_tag_create(bus_get_dma_tag(dev), 1024, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), 1024, 0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, AHCI_WORK_SIZE, 1, AHCI_WORK_SIZE,
-   0, NULL, NULL, &ch->dma.work_tag))
+   0, NULL, NULL, &ch->dma.work_tag);
+   if (error != 0)
goto error;
-   if (bus_dmamem_alloc(ch->dma.work_tag, (void **)&ch->dma.work,
-   BUS_DMA_ZERO, &ch->dma.work_map))
+   error = bus_dmamem_alloc(ch->dma.work_tag, (void **)&ch->dma.work,
+   BUS_DMA_ZERO, &ch->dma.work_map);
+   if (error != 0)
goto error;
-   if (bus_dmamap_load(ch->dma.work_tag, ch->dma.work_map, ch->dma.work,
-   AHCI_WORK_SIZE, ahci_dmasetupc_cb, &dcba, 0) || dcba.error) {
+   error = bus_dmamap_load(ch->dma.work_tag, ch->dma.work_map, 
ch->dma.work,
+   AHCI_WORK_SIZE, ahci_dmasetupc_cb, &dcba, BUS_DMA_NOWAIT);
+   if (error != 0 || (error = dcba.error) != 0) {
bus_dmamem_free(ch->dma.work_tag, ch->dma.work, 
ch->dma.work_map);
goto error;
}
@@ -958,33 +962,37 @@ ahci_dmainit(device_t dev)
rfsize = 4096;
else
rfsize = 256;
-   if (bus_dma_tag_create(bus_get_dma_tag(dev), rfsize, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), rfsize, 0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, rfsize, 1, rfsize,
-   0, NULL, NULL, &ch->dma.rfis_tag))
+   0, NULL, NULL, &ch->dma.rfis_tag);
+   if (error != 0)
goto error;
-   if (bus_dmamem_alloc(ch->dma.rfis_tag, (void **)&ch->dma.rfis, 0,
-   &ch->dma.rfis_map))
+   error = bus_dmamem_alloc(ch->dma.rfis_tag, (void **)&ch->dma.rfis, 0,
+   &ch->dma.rfis_map);
+   if (error != 0)
goto error;
-   if (bus_dmamap_load(ch->dma.rfis_tag, ch->dma.rfis_map, ch->dma.rfis,
-   rfsize, ahci_dmasetupc_cb, &dcba, 0) || dcba.error) {
+   error = bus_dmamap_load(ch->dma.rfis_tag, ch->dma.rfis_map, 
ch->dma.rfis,
+   rfsize, ahci_dmasetupc_cb, &dcba, BUS_DMA_NOWAIT);
+   if (error != 0 || (error = dcba.error) != 0) {
bus_dmamem_free(ch->dma.rfis_tag, ch->dma.rfis, 
ch->dma.rfis_map);
goto error;
}
ch->dma.rfis_bus = dcba.maddr;
/* Data area. */
-   if (bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL,
AHCI_SG_ENTRIES * PAGE_SIZE * ch->numslots,
AHCI_SG_ENTRIES, AHCI_PRD_MAX,
-   0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag)) {
+   0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag);
+   if (error != 0)
goto error;
-   }
return;
 
 error:
-   device_printf(dev, "WARNING - DMA initialization failed\n");
+   device_printf(dev, "WARNING - DMA initialization failed, error %d\n",
+   error);
ahci_dmafini(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: r343013 - stable/12/sys/dev/ahci

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Mon Jan 14 07:21:43 2019
New Revision: 343013
URL: https://svnweb.freebsd.org/changeset/base/343013

Log:
  MFC r342826:
  Fix use of busdma(9) KPI in ahci(4).

Modified:
  stable/12/sys/dev/ahci/ahci.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ahci/ahci.c
==
--- stable/12/sys/dev/ahci/ahci.c   Mon Jan 14 06:57:39 2019
(r343012)
+++ stable/12/sys/dev/ahci/ahci.c   Mon Jan 14 07:21:43 2019
(r343013)
@@ -940,18 +940,22 @@ ahci_dmainit(device_t dev)
struct ahci_channel *ch = device_get_softc(dev);
struct ahci_dc_cb_args dcba;
size_t rfsize;
+   int error;
 
/* Command area. */
-   if (bus_dma_tag_create(bus_get_dma_tag(dev), 1024, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), 1024, 0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, AHCI_WORK_SIZE, 1, AHCI_WORK_SIZE,
-   0, NULL, NULL, &ch->dma.work_tag))
+   0, NULL, NULL, &ch->dma.work_tag);
+   if (error != 0)
goto error;
-   if (bus_dmamem_alloc(ch->dma.work_tag, (void **)&ch->dma.work,
-   BUS_DMA_ZERO, &ch->dma.work_map))
+   error = bus_dmamem_alloc(ch->dma.work_tag, (void **)&ch->dma.work,
+   BUS_DMA_ZERO, &ch->dma.work_map);
+   if (error != 0)
goto error;
-   if (bus_dmamap_load(ch->dma.work_tag, ch->dma.work_map, ch->dma.work,
-   AHCI_WORK_SIZE, ahci_dmasetupc_cb, &dcba, 0) || dcba.error) {
+   error = bus_dmamap_load(ch->dma.work_tag, ch->dma.work_map, 
ch->dma.work,
+   AHCI_WORK_SIZE, ahci_dmasetupc_cb, &dcba, BUS_DMA_NOWAIT);
+   if (error != 0 || (error = dcba.error) != 0) {
bus_dmamem_free(ch->dma.work_tag, ch->dma.work, 
ch->dma.work_map);
goto error;
}
@@ -961,33 +965,37 @@ ahci_dmainit(device_t dev)
rfsize = 4096;
else
rfsize = 256;
-   if (bus_dma_tag_create(bus_get_dma_tag(dev), rfsize, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), rfsize, 0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, rfsize, 1, rfsize,
-   0, NULL, NULL, &ch->dma.rfis_tag))
+   0, NULL, NULL, &ch->dma.rfis_tag);
+   if (error != 0)
goto error;
-   if (bus_dmamem_alloc(ch->dma.rfis_tag, (void **)&ch->dma.rfis, 0,
-   &ch->dma.rfis_map))
+   error = bus_dmamem_alloc(ch->dma.rfis_tag, (void **)&ch->dma.rfis, 0,
+   &ch->dma.rfis_map);
+   if (error != 0)
goto error;
-   if (bus_dmamap_load(ch->dma.rfis_tag, ch->dma.rfis_map, ch->dma.rfis,
-   rfsize, ahci_dmasetupc_cb, &dcba, 0) || dcba.error) {
+   error = bus_dmamap_load(ch->dma.rfis_tag, ch->dma.rfis_map, 
ch->dma.rfis,
+   rfsize, ahci_dmasetupc_cb, &dcba, BUS_DMA_NOWAIT);
+   if (error != 0 || (error = dcba.error) != 0) {
bus_dmamem_free(ch->dma.rfis_tag, ch->dma.rfis, 
ch->dma.rfis_map);
goto error;
}
ch->dma.rfis_bus = dcba.maddr;
/* Data area. */
-   if (bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL,
AHCI_SG_ENTRIES * PAGE_SIZE * ch->numslots,
AHCI_SG_ENTRIES, AHCI_PRD_MAX,
-   0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag)) {
+   0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag);
+   if (error != 0)
goto error;
-   }
return;
 
 error:
-   device_printf(dev, "WARNING - DMA initialization failed\n");
+   device_printf(dev, "WARNING - DMA initialization failed, error %d\n",
+   error);
ahci_dmafini(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: r343012 - in stable/12/sys/gnu/dts/include/dt-bindings: bus clock dma gce iio/adc memory pinctrl regulator reset soc usb

2019-01-13 Thread Emmanuel Vadot
Author: manu
Date: Mon Jan 14 06:57:39 2019
New Revision: 343012
URL: https://svnweb.freebsd.org/changeset/base/343012

Log:
  MFC r342935:
  
  Import DTS includes from 4.19
  This was missed in r340337

Added:
  stable/12/sys/gnu/dts/include/dt-bindings/clock/actions,s700-cmu.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/actions,s700-cmu.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/axg-audio-clkc.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/axg-audio-clkc.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/maxim,max9485.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/maxim,max9485.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/px30-cru.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/px30-cru.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/qcom,dispcc-sdm845.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/qcom,dispcc-sdm845.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/r9a06g032-sysctrl.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/r9a06g032-sysctrl.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/rk3399-ddr.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/rk3399-ddr.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/sun8i-tcon-top.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/clock/sun8i-tcon-top.h
  stable/12/sys/gnu/dts/include/dt-bindings/dma/jz4780-dma.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/dma/jz4780-dma.h
  stable/12/sys/gnu/dts/include/dt-bindings/gce/
 - copied from r342935, head/sys/gnu/dts/include/dt-bindings/gce/
  stable/12/sys/gnu/dts/include/dt-bindings/iio/adc/at91-sama5d2_adc.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/iio/adc/at91-sama5d2_adc.h
  stable/12/sys/gnu/dts/include/dt-bindings/memory/mt2712-larb-port.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/memory/mt2712-larb-port.h
  stable/12/sys/gnu/dts/include/dt-bindings/regulator/qcom,rpmh-regulator.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/regulator/qcom,rpmh-regulator.h
  stable/12/sys/gnu/dts/include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/reset/amlogic,meson-axg-audio-arb.h
  stable/12/sys/gnu/dts/include/dt-bindings/reset/qcom,sdm845-aoss.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/reset/qcom,sdm845-aoss.h
  stable/12/sys/gnu/dts/include/dt-bindings/soc/qcom,rpmh-rsc.h
 - copied unchanged from r342935, 
head/sys/gnu/dts/include/dt-bindings/soc/qcom,rpmh-rsc.h
  stable/12/sys/gnu/dts/include/dt-bindings/usb/
 - copied from r342935, head/sys/gnu/dts/include/dt-bindings/usb/
Deleted:
  stable/12/sys/gnu/dts/include/dt-bindings/clock/exynos5440.h
Modified:
  stable/12/sys/gnu/dts/include/dt-bindings/bus/ti-sysc.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/aspeed-clock.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/axg-clkc.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/dra7.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/gxbb-clkc.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/imx6sll-clock.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/imx6ul-clock.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/pxa-clock.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/qcom,gcc-sdm845.h
  stable/12/sys/gnu/dts/include/dt-bindings/clock/sun8i-r40-ccu.h
  stable/12/sys/gnu/dts/include/dt-bindings/pinctrl/at91.h
  stable/12/sys/gnu/dts/include/dt-bindings/pinctrl/samsung.h
  stable/12/sys/gnu/dts/include/dt-bindings/regulator/maxim,max77802.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/gnu/dts/include/dt-bindings/bus/ti-sysc.h
==
--- stable/12/sys/gnu/dts/include/dt-bindings/bus/ti-sysc.h Mon Jan 14 
06:34:54 2019(r343011)
+++ stable/12/sys/gnu/dts/include/dt-bindings/bus/ti-sysc.h Mon Jan 14 
06:57:39 2019(r343012)
@@ -15,6 +15,8 @@
 /* SmartReflex sysc found on 36xx and later */
 #define SYSC_OMAP3_SR_ENAWAKEUP(1 << 26)
 
+#define SYSC_DRA7_MCAN_ENAWAKEUP   (1 << 4)
+
 /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
 #define SYSC_IDLE_FORCE0
 #define SYSC_IDLE_NO   1

Copied: stable/12/sys/gnu/dts/include/dt-bindings/clock/actions,s700-cmu.h 
(from r342935, head/sys/gnu/dts/include/dt-bindings/clock/actions,s700-cmu.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/gnu/dts/include/dt-bindings/clock/actions

svn commit: r343011 - in head/kerberos5: lib/libasn1 lib/libgssapi_krb5 lib/libhdb lib/libheimntlm lib/libhx509 lib/libkadm5clnt lib/libkadm5srv lib/libkdc lib/libkrb5 lib/libwind libexec/digest-se...

2019-01-13 Thread Takahashi Yoshihiro
Author: nyan
Date: Mon Jan 14 06:34:54 2019
New Revision: 343011
URL: https://svnweb.freebsd.org/changeset/base/343011

Log:
  Use ${SRCTOP}/contrib/com_err/com_err.h instead of the installed com_err.h.
  This fixes build when com_err.h is not installed.
  
  PR:   234691
  MFC after:1 week

Modified:
  head/kerberos5/lib/libasn1/Makefile
  head/kerberos5/lib/libgssapi_krb5/Makefile
  head/kerberos5/lib/libhdb/Makefile
  head/kerberos5/lib/libheimntlm/Makefile
  head/kerberos5/lib/libhx509/Makefile
  head/kerberos5/lib/libkadm5clnt/Makefile
  head/kerberos5/lib/libkadm5srv/Makefile
  head/kerberos5/lib/libkdc/Makefile
  head/kerberos5/lib/libkrb5/Makefile
  head/kerberos5/lib/libwind/Makefile
  head/kerberos5/libexec/digest-service/Makefile
  head/kerberos5/libexec/hprop/Makefile
  head/kerberos5/libexec/hpropd/Makefile
  head/kerberos5/libexec/kadmind/Makefile
  head/kerberos5/libexec/kdc/Makefile
  head/kerberos5/usr.bin/hxtool/Makefile
  head/kerberos5/usr.bin/kadmin/Makefile
  head/kerberos5/usr.bin/string2key/Makefile
  head/kerberos5/usr.bin/verify_krb5_conf/Makefile
  head/kerberos5/usr.sbin/kstash/Makefile

Modified: head/kerberos5/lib/libasn1/Makefile
==
--- head/kerberos5/lib/libasn1/Makefile Mon Jan 14 03:19:08 2019
(r343010)
+++ head/kerberos5/lib/libasn1/Makefile Mon Jan 14 06:34:54 2019
(r343011)
@@ -21,7 +21,8 @@ SRCS= asn1_err.c \
timegm.c \
${GEN:S/.x$/.c/:S/.hx$/.h/}
 
-CFLAGS+=-I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/roken -I.
+CFLAGS+=-I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/roken \
+   -I${SRCTOP}/contrib/com_err -I.
 
 GEN_RFC2459=   asn1_rfc2459_asn1.x rfc2459_asn1.hx rfc2459_asn1-priv.hx
 GEN_CMS=   asn1_cms_asn1.x cms_asn1.hx cms_asn1-priv.hx

Modified: head/kerberos5/lib/libgssapi_krb5/Makefile
==
--- head/kerberos5/lib/libgssapi_krb5/Makefile  Mon Jan 14 03:19:08 2019
(r343010)
+++ head/kerberos5/lib/libgssapi_krb5/Makefile  Mon Jan 14 06:34:54 2019
(r343011)
@@ -78,7 +78,9 @@ CFLAGS+=-I${KRB5DIR}/lib/gssapi/krb5
 CFLAGS+=-I${KRB5DIR}/lib/gssapi/gssapi
 CFLAGS+=-I${KRB5DIR}/lib/krb5
 CFLAGS+=-I${KRB5DIR}/lib/asn1
-CFLAGS+=-I${KRB5DIR}/lib/roken -I.
+CFLAGS+=-I${KRB5DIR}/lib/roken
+CFLAGS+=-I${SRCTOP}/contrib/com_err
+CFLAGS+=-I.
 
 .include 
 

Modified: head/kerberos5/lib/libhdb/Makefile
==
--- head/kerberos5/lib/libhdb/Makefile  Mon Jan 14 03:19:08 2019
(r343010)
+++ head/kerberos5/lib/libhdb/Makefile  Mon Jan 14 06:34:54 2019
(r343011)
@@ -59,6 +59,7 @@ SRCS= common.c \
 CFLAGS+=-I${KRB5DIR}/lib/hdb -I${KRB5DIR}/lib/asn1 \
-I${KRB5DIR}/lib/roken -I${SRCTOP}/contrib/sqlite3/ \
-I${KRB5DIR}/lib/krb5 \
+   -I${SRCTOP}/contrib/com_err \
-I. ${LDAPCFLAGS}
 CFLAGS+=-DHDB_DB_DIR="\"/var/heimdal\""
 

Modified: head/kerberos5/lib/libheimntlm/Makefile
==
--- head/kerberos5/lib/libheimntlm/Makefile Mon Jan 14 03:19:08 2019
(r343010)
+++ head/kerberos5/lib/libheimntlm/Makefile Mon Jan 14 06:34:54 2019
(r343011)
@@ -5,7 +5,8 @@ LDFLAGS=-Wl,--no-undefined
 LIBADD=crypto com_err krb5 roken
 SRCS=  ntlm.c ntlm_err.c ntlm_err.h
 INCS=  heimntlm.h heimntlm-protos.h ntlm_err.h
-CFLAGS+=-I${KRB5DIR}/lib/ntlm -I${KRB5DIR}/lib/roken
+CFLAGS+=-I${KRB5DIR}/lib/ntlm -I${KRB5DIR}/lib/roken \
+   -I${SRCTOP}/contrib/com_err
 VERSION_MAP= ${KRB5DIR}/lib/ntlm/version-script.map
 
 MAN=   ntlm_buf.3 \

Modified: head/kerberos5/lib/libhx509/Makefile
==
--- head/kerberos5/lib/libhx509/MakefileMon Jan 14 03:19:08 2019
(r343010)
+++ head/kerberos5/lib/libhx509/MakefileMon Jan 14 06:34:54 2019
(r343011)
@@ -211,7 +211,9 @@ CFLAGS+=-I${KRB5DIR}/lib/hx509
 CFLAGS+=-I${KRB5DIR}/lib/hx509/ref
 CFLAGS+=-I${KRB5DIR}/lib/asn1
 CFLAGS+=-I${KRB5DIR}/lib/wind
-CFLAGS+=-I${KRB5DIR}/lib/roken -I.
+CFLAGS+=-I${KRB5DIR}/lib/roken
+CFLAGS+=-I${SRCTOP}/contrib/com_err
+CFLAGS+=-I.
 
 GEN_OCSP= \
asn1_OCSPBasicOCSPResponse.x \

Modified: head/kerberos5/lib/libkadm5clnt/Makefile
==
--- head/kerberos5/lib/libkadm5clnt/MakefileMon Jan 14 03:19:08 2019
(r343010)
+++ head/kerberos5/lib/libkadm5clnt/MakefileMon Jan 14 06:34:54 2019
(r343011)
@@ -34,7 +34,8 @@ SRCS= ad.c \
rename_c.c \
send_recv.c
 
-CFLAGS+=-I${KRB5DIR}/lib/kadm5 -I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/roken -I.
+CFLAGS+=-I${KRB5DIR}/lib/kadm5 -I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/roken \
+   -I${SRCTOP}/contrib/com_err -I.
 
 .include 
 

Modified: head/kerberos5/lib/libkadm5srv/Makefil

svn commit: r343010 - stable/12/share/man/man5

2019-01-13 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 14 03:19:08 2019
New Revision: 343010
URL: https://svnweb.freebsd.org/changeset/base/343010

Log:
  MFC r342632:
  ext2fs.5: Update the manpage.
  
  General update of the driver description and mention some important credits.
  Add a symlink for ext4fs as it is of special interest nowadays.
  
  Fix some `mandoc -Tlint` issues while here.

Modified:
  stable/12/share/man/man5/Makefile
  stable/12/share/man/man5/ext2fs.5
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man5/Makefile
==
--- stable/12/share/man/man5/Makefile   Mon Jan 14 03:13:31 2019
(r343009)
+++ stable/12/share/man/man5/Makefile   Mon Jan 14 03:19:08 2019
(r343010)
@@ -70,6 +70,7 @@ MAN=  acct.5 \
tmpfs.5
 
 MLINKS=dir.5 dirent.5
+MLINKS+=ext2fs.5 ext4fs.5
 MLINKS+=fs.5 inode.5
 MLINKS+=hosts.equiv.5 rhosts.5
 MLINKS+=msdosfs.5 msdos.5

Modified: stable/12/share/man/man5/ext2fs.5
==
--- stable/12/share/man/man5/ext2fs.5   Mon Jan 14 03:13:31 2019
(r343009)
+++ stable/12/share/man/man5/ext2fs.5   Mon Jan 14 03:19:08 2019
(r343010)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 4, 2018
+.Dd December 30, 2018
 .Dt EXT2FS 5
 .Os
 .Sh NAME
@@ -47,13 +47,15 @@ The
 driver will permit the
 .Fx
 kernel to access
-.Tn ext2 ,
-.Tn ext3 ,
+ext2
+file systems and its derivatives.
+It currently implements most of the features required by
+.Em ext3
 and
-.Tn ext4
+.Em ext4
 file systems.
 Support for Extended Attributes in
-.Tn ext4
+.Em ext4
 is experimental.
 Journalling and encryption are currently not supported.
 .Sh EXAMPLES
@@ -77,14 +79,28 @@ driver first appeared in
 .An -nosplit
 The
 .Nm
-kernel implementation was written by
+kernel implementation is derived from code written,
+or modified,
+by
 .An Godmar Back
-or modified by him using the CSRG sources.
+using the UFS CSRG sources for CMU Mach.
 .Pp
 .An John Dyson
-and others in the
+did the initial port to
+.Fx .
+.An Aditya Sarawgi
+merged important parts of the allocation code from a clean-room
+.Nx
+implementation.
+.An Zheng Liu
+and
+.An Fedor Upurov
+implemented the read and write support respectively for
+.Em ext4
+filesystems.
+The
 .Fx
-Project made modifications.
+community has contributed a huge amount of modifications.
 .Pp
-This manual page was written by
+The initial version of this manual page was written by
 .An Craig Rodrigues Aq Mt rodr...@freebsd.org .
___
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: r343009 - head/tools/build/mk

2019-01-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jan 14 03:13:31 2019
New Revision: 343009
URL: https://svnweb.freebsd.org/changeset/base/343009

Log:
  Add four kerberos CLI utilities to OptionalObsoleteFiles.inc
  
  Add asn1_compile, make-roken, kcc, and slc to the OptionalObsoleteFiles.inc
  so they would be removed during delete-old stage if the new world is built
  without Kerberos support.
  
  PR:   230725
  Submitted by: Dmitry Wagin 
  MFC after:1 week

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Mon Jan 14 01:30:48 
2019(r343008)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Mon Jan 14 03:13:31 
2019(r343009)
@@ -2989,9 +2989,11 @@ OLD_FILES+=usr/share/man/man1/truss.1.gz
 .if ${MK_KERBEROS} == no
 OLD_FILES+=etc/rc.d/ipropd_master
 OLD_FILES+=etc/rc.d/ipropd_slave
+OLD_FILES+=usr/bin/asn1_compile
 OLD_FILES+=usr/bin/compile_et
 OLD_FILES+=usr/bin/hxtool
 OLD_FILES+=usr/bin/kadmin
+OLD_FILES+=usr/bin/kcc
 OLD_FILES+=usr/bin/kdestroy
 OLD_FILES+=usr/bin/kf
 OLD_FILES+=usr/bin/kgetcred
@@ -3001,6 +3003,8 @@ OLD_FILES+=usr/bin/kpasswd
 OLD_FILES+=usr/bin/krb5-config
 OLD_FILES+=usr/bin/ksu
 OLD_FILES+=usr/bin/kswitch
+OLD_FILES+=usr/bin/make-roken
+OLD_FILES+=usr/bin/slc
 OLD_FILES+=usr/bin/string2key
 OLD_FILES+=usr/bin/verify_krb5_conf
 OLD_FILES+=usr/include/asn1-common.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: r343008 - head/stand/i386/libi386

2019-01-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jan 14 01:30:48 2019
New Revision: 343008
URL: https://svnweb.freebsd.org/changeset/base/343008

Log:
  Add Dell Chromebook to the list of devices with E820 extmem quirk enabled
  
  Just like for Acer C270 chromebook the E820 extmem workaround is required for
  FreeBSD to boot on Dell chromebook.
  
  PR:   204916
  Submitted by: Keith White 
  MFC after:1 week

Modified:
  head/stand/i386/libi386/biosmem.c

Modified: head/stand/i386/libi386/biosmem.c
==
--- head/stand/i386/libi386/biosmem.c   Sun Jan 13 23:41:56 2019
(r343007)
+++ head/stand/i386/libi386/biosmem.c   Mon Jan 14 01:30:48 2019
(r343008)
@@ -74,6 +74,7 @@ struct bios_getmem_quirks {
 
 static struct bios_getmem_quirks quirks[] = {
{"coreboot", "Acer", "Peppy", BQ_DISTRUST_E820_EXTMEM},
+   {"coreboot", "Dell", "Wolf", BQ_DISTRUST_E820_EXTMEM},
{NULL, NULL, NULL, 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: r343007 - head/sys/arm64/arm64

2019-01-13 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 23:41:56 2019
New Revision: 343007
URL: https://svnweb.freebsd.org/changeset/base/343007

Log:
  Don't forget to add the needed #includes.
  
  Pointy hat to:cognet

Modified:
  head/sys/arm64/arm64/cpufunc_asm.S

Modified: head/sys/arm64/arm64/cpufunc_asm.S
==
--- head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 23:29:46 2019
(r343006)
+++ head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 23:41:56 2019
(r343007)
@@ -29,8 +29,12 @@
  *
  */
 
+#include 
 #include 
 #include 
+
+#include "assym.inc"
+
 __FBSDID("$FreeBSD$");
 
 /*
___
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: r343006 - in head/sys/arm64: arm64 include

2019-01-13 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 23:29:46 2019
New Revision: 343006
URL: https://svnweb.freebsd.org/changeset/base/343006

Log:
  Introduce cpu_icache_sync_range_checked(), that does the same thing as
  cpu_icache_sync_range(), except that it sets pcb_onfault to catch any page
  fault, as doing cache maintenance operations for non-mapped generates a
  data abort, and use it in freebsd32_sysarch(), so that a userland program
  attempting to sync the icache with unmapped addresses doesn't crash the
  kernel.
  
  Spotted out by:   andrew

Modified:
  head/sys/arm64/arm64/cpufunc_asm.S
  head/sys/arm64/arm64/freebsd32_machdep.c
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/cpufunc_asm.S
==
--- head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 20:33:54 2019
(r343005)
+++ head/sys/arm64/arm64/cpufunc_asm.S  Sun Jan 13 23:29:46 2019
(r343006)
@@ -147,3 +147,24 @@ ENTRY(arm64_icache_sync_range)
ic  ialluis
dsb ish
 END(arm64_icache_sync_range)
+
+/*
+ * int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t)
+ */
+ENTRY(arm64_icache_sync_range_checked)
+   adr x5, cache_maint_fault
+   SET_FAULT_HANDLER(x5, x6)
+   /* XXX: See comment in arm64_icache_sync_range */
+   cache_handle_range  dcop = cvau
+   ic  ialluis
+   dsb ish
+   SET_FAULT_HANDLER(xzr, x6)
+   mov x0, #0
+   ret
+END(arm64_icache_sync_range_checked)
+
+ENTRY(cache_maint_fault)
+   SET_FAULT_HANDLER(xzr, x1)
+   mov x0, #EFAULT
+   ret
+END(cache_maint_fault)

Modified: head/sys/arm64/arm64/freebsd32_machdep.c
==
--- head/sys/arm64/arm64/freebsd32_machdep.cSun Jan 13 20:33:54 2019
(r343005)
+++ head/sys/arm64/arm64/freebsd32_machdep.cSun Jan 13 23:29:46 2019
(r343006)
@@ -85,7 +85,7 @@ freebsd32_sysarch(struct thread *td, struct freebsd32_
return (error);
if ((uint64_t)args.addr + (uint64_t)args.size > 
0x)
return (EINVAL);
-   cpu_icache_sync_range(args.addr, args.size);
+   cpu_icache_sync_range_checked(args.addr, args.size);
return 0;
}
case ARM_GET_VFPSTATE:

Modified: head/sys/arm64/include/cpufunc.h
==
--- head/sys/arm64/include/cpufunc.hSun Jan 13 20:33:54 2019
(r343005)
+++ head/sys/arm64/include/cpufunc.hSun Jan 13 23:29:46 2019
(r343006)
@@ -138,12 +138,14 @@ extern int64_t dczva_line_size;
 
 #definecpu_idcache_wbinv_range(a, s)   arm64_idcache_wbinv_range((a), 
(s))
 #definecpu_icache_sync_range(a, s) arm64_icache_sync_range((a), 
(s))
+#define cpu_icache_sync_range_checked(a, s) 
arm64_icache_sync_range_checked((a), (s))
 
 void arm64_nullop(void);
 void arm64_setttb(vm_offset_t);
 void arm64_tlb_flushID(void);
 void arm64_tlb_flushID_SE(vm_offset_t);
 void arm64_icache_sync_range(vm_offset_t, vm_size_t);
+int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t);
 void arm64_idcache_wbinv_range(vm_offset_t, vm_size_t);
 void arm64_dcache_wbinv_range(vm_offset_t, vm_size_t);
 void arm64_dcache_inv_range(vm_offset_t, vm_size_t);
___
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: r343003 - stable/11/usr.bin/getconf

2019-01-13 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 13 18:48:13 2019
New Revision: 343003
URL: https://svnweb.freebsd.org/changeset/base/343003

Log:
  MFC r342817: getconf(1): Minor mdoc fix

Modified:
  stable/11/usr.bin/getconf/getconf.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/getconf/getconf.1
==
--- stable/11/usr.bin/getconf/getconf.1 Sun Jan 13 18:47:37 2019
(r343002)
+++ stable/11/usr.bin/getconf/getconf.1 Sun Jan 13 18:48:13 2019
(r343003)
@@ -70,7 +70,7 @@ Otherwise,
 all system configuration variables are reported using
 .Xr confstr 3
 and
-.Xr sysconf 3.
+.Xr sysconf 3 .
 .Pp
 The second form of the command, with two mandatory
 arguments, retrieves file- and file system-specific
___
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: r343005 - head/sys/kern

2019-01-13 Thread Jason A. Harmening
Author: jah
Date: Sun Jan 13 20:33:54 2019
New Revision: 343005
URL: https://svnweb.freebsd.org/changeset/base/343005

Log:
  Handle SIGIO for listening sockets
  
  r319722 separated struct socket and parts of the socket I/O path into
  listening-socket-specific and dataflow-socket-specific pieces.  Listening
  socket connection notifications are now handled by solisten_wakeup() instead
  of sowakeup(), but solisten_wakeup() does not currently post SIGIO to the
  owning process.
  
  PR:   234258
  Reported by:  Kenneth Adelman
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D18664

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Sun Jan 13 19:49:46 2019(r343004)
+++ head/sys/kern/uipc_socket.c Sun Jan 13 20:33:54 2019(r343005)
@@ -886,6 +886,8 @@ solisten_wakeup(struct socket *sol)
}
SOLISTEN_UNLOCK(sol);
wakeup_one(&sol->sol_comp);
+   if ((sol->so_state & SS_ASYNC) && sol->so_sigio != NULL)
+   pgsigio(&sol->so_sigio, SIGIO, 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: r343001 - stable/12/lib/libc/sys

2019-01-13 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 13 13:57:56 2019
New Revision: 343001
URL: https://svnweb.freebsd.org/changeset/base/343001

Log:
  MFC r342816: thr_wake(2): Minor mdoc fixes

Modified:
  stable/12/lib/libc/sys/thr_wake.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/thr_wake.2
==
--- stable/12/lib/libc/sys/thr_wake.2   Sun Jan 13 13:57:11 2019
(r343000)
+++ stable/12/lib/libc/sys/thr_wake.2   Sun Jan 13 13:57:56 2019
(r343001)
@@ -67,7 +67,7 @@ of that thread in the kernel to fail immediately with 
 .Er EINTR
 error.
 The flag is cleared by an interruptible sleep attempt or by a call to
-.Xr thr_suspend 2.
+.Xr thr_suspend 2 .
 This is used by the system threading library to implement cancellation.
 .Pp
 If
@@ -96,7 +96,7 @@ of the calling thread.
 .El
 .Sh SEE ALSO
 .Xr ps 1 ,
-.Xr thr_self 2
+.Xr thr_self 2 ,
 .Xr thr_suspend 2 ,
 .Xr pthread_cancel 3 ,
 .Xr pthread_resume_np 3 ,
___
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: r343004 - in head/sys/arm64: arm64 conf include

2019-01-13 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 19:49:46 2019
New Revision: 343004
URL: https://svnweb.freebsd.org/changeset/base/343004

Log:
  Impleent COMPAT_FREEBSD32 for arm64.
  This is based on early work by andrew@.

Modified:
  head/sys/arm64/arm64/elf32_machdep.c
  head/sys/arm64/arm64/freebsd32_machdep.c
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/undefined.c
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/arm64/conf/GENERIC
  head/sys/arm64/include/armreg.h
  head/sys/arm64/include/elf.h
  head/sys/arm64/include/frame.h
  head/sys/arm64/include/reg.h
  head/sys/arm64/include/ucontext.h
  head/sys/arm64/include/vfp.h

Modified: head/sys/arm64/arm64/elf32_machdep.c
==
--- head/sys/arm64/arm64/elf32_machdep.cSun Jan 13 18:48:13 2019
(r343003)
+++ head/sys/arm64/arm64/elf32_machdep.cSun Jan 13 19:49:46 2019
(r343004)
@@ -1,6 +1,15 @@
 /*-
- * Copyright (c) 2017 Nuxi, https://nuxi.nl/
+ * Copyright (c) 2014, 2015 The FreeBSD Foundation.
+ * Copyright (c) 2014, 2017 Andrew Turner.
+ * Copyright (c) 2018 Olivier Houchard
+ * All rights reserved.
  *
+ * This software was developed by Andrew Turner under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -26,13 +35,225 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-#define__ELF_WORD_SIZE 32
+#define__ELF_WORD_SIZE 32
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 
-void
-elf32_dump_thread(struct thread *td __unused, void *dst __unused,
-size_t *off __unused)
+#include 
+
+#include 
+
+#defineFREEBSD32_MINUSER   0x1000
+#defineFREEBSD32_MAXUSER   ((1ul << 32) - PAGE_SIZE)
+#defineFREEBSD32_SHAREDPAGE(FREEBSD32_MAXUSER - PAGE_SIZE)
+#defineFREEBSD32_USRSTACK  FREEBSD32_SHAREDPAGE
+
+extern const char *freebsd32_syscallnames[];
+
+extern char aarch32_sigcode[];
+extern int sz_aarch32_sigcode;
+
+static int freebsd32_fetch_syscall_args(struct thread *td);
+static void freebsd32_setregs(struct thread *td, struct image_params *imgp,
+   u_long stack);
+static void freebsd32_set_syscall_retval(struct thread *, int);
+
+static boolean_t elf32_arm_abi_supported(struct image_params *);
+
+extern void freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);
+
+static struct sysentvec elf32_freebsd_sysvec = {
+   .sv_size= SYS_MAXSYSCALL,
+   .sv_table   = freebsd32_sysent,
+   .sv_errsize = 0,
+   .sv_errtbl  = NULL,
+   .sv_transtrap   = NULL,
+   .sv_fixup   = elf32_freebsd_fixup,
+   .sv_sendsig = freebsd32_sendsig,
+   .sv_sigcode = aarch32_sigcode,
+   .sv_szsigcode   = &sz_aarch32_sigcode,
+   .sv_name= "FreeBSD ELF32",
+   .sv_coredump= elf32_coredump,
+   .sv_imgact_try  = NULL,
+   .sv_minsigstksz = MINSIGSTKSZ,
+   .sv_pagesize= PAGE_SIZE,
+   .sv_minuser = FREEBSD32_MINUSER,
+   .sv_maxuser = FREEBSD32_MAXUSER,
+   .sv_usrstack= FREEBSD32_USRSTACK,
+   .sv_psstrings   = FREEBSD32_PS_STRINGS,
+   .sv_stackprot   = VM_PROT_READ | VM_PROT_WRITE,
+   .sv_copyout_strings = freebsd32_copyout_strings,
+   .sv_setregs = freebsd32_setregs,
+   .sv_fixlimit= NULL, // XXX
+   .sv_maxssiz = NULL,
+   .sv_flags   = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP,
+   .sv_set_syscall_retval = freebsd32_set_syscall_retval,
+   .sv_fetch_syscall_args = freebsd32_fetch_syscall_args,
+   .sv_syscallnames = freebsd32_syscallnames,
+   .sv_shared_page_base = FREEBSD32_SHAREDPAGE,
+   .sv_shared_page_len = PAGE_SIZE,
+   .sv_schedtail   = NULL,
+   .sv_thread_detach = NULL,
+   .sv_trap= NULL,
+};
+INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
+
+static Elf32_Brandinfo freebsd32_brand_info = {
+   .brand  = ELFOSABI_FREEBSD,
+   .machine= EM_ARM,
+   .compat_3_brand = "FreeBSD",
+   .emul_path  = NULL,
+   .interp_path= "/libexec/ld-elf.so.1",
+   .sysvec = &elf32_freebsd_sysvec,
+   .interp_newpath = NULL,
+   .brand_note = &elf32_freebsd_brandnote,
+   .flags  = BI_CAN_EXEC_DYN | BI_BRAND_NOTE,
+   .header_supported= elf32_arm_abi_supported,
+};
+
+SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
+(sysinit_cfunc_t)elf32_insert_brand_entry, &freebsd32_brand_info);
+
+static boolean_t
+elf32_arm_abi_supported(struct image_params *imgp)
 {
+   const Elf32_Ehdr *

svn commit: r343002 - stable/11/lib/libc/sys

2019-01-13 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 13 18:47:37 2019
New Revision: 343002
URL: https://svnweb.freebsd.org/changeset/base/343002

Log:
  MFC r342816: thr_wake(2): Minor mdoc fixes

Modified:
  stable/11/lib/libc/sys/thr_wake.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/thr_wake.2
==
--- stable/11/lib/libc/sys/thr_wake.2   Sun Jan 13 13:57:56 2019
(r343001)
+++ stable/11/lib/libc/sys/thr_wake.2   Sun Jan 13 18:47:37 2019
(r343002)
@@ -67,7 +67,7 @@ of that thread in the kernel to fail immediately with 
 .Er EINTR
 error.
 The flag is cleared by an interruptible sleep attempt or by a call to
-.Xr thr_suspend 2.
+.Xr thr_suspend 2 .
 This is used by the system threading library to implement cancellation.
 .Pp
 If
@@ -96,7 +96,7 @@ of the calling thread.
 .El
 .Sh SEE ALSO
 .Xr ps 1 ,
-.Xr thr_self 2
+.Xr thr_self 2 ,
 .Xr thr_suspend 2 ,
 .Xr pthread_cancel 3 ,
 .Xr pthread_resume_np 3 ,
___
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: r342998 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux i386/linux

2019-01-13 Thread Fedor Uporov
Author: fsu
Date: Sun Jan 13 12:12:50 2019
New Revision: 342998
URL: https://svnweb.freebsd.org/changeset/base/342998

Log:
  MFC r342933:
  Fix errno values returned from DUMMY_XATTR linuxulator calls
  
  Reported by: we...@uni-mainz.de
  Reviewed by: markj
  Differential Revision: https://reviews.freebsd.org/D18812

Modified:
  stable/12/sys/amd64/linux/linux_dummy.c
  stable/12/sys/amd64/linux32/linux32_dummy.c
  stable/12/sys/arm64/linux/linux_dummy.c
  stable/12/sys/i386/linux/linux_dummy.c

Modified: stable/12/sys/amd64/linux/linux_dummy.c
==
--- stable/12/sys/amd64/linux/linux_dummy.c Sun Jan 13 08:49:55 2019
(r342997)
+++ stable/12/sys/amd64/linux/linux_dummy.c Sun Jan 13 12:12:50 2019
(r342998)
@@ -162,7 +162,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);

Modified: stable/12/sys/amd64/linux32/linux32_dummy.c
==
--- stable/12/sys/amd64/linux32/linux32_dummy.c Sun Jan 13 08:49:55 2019
(r342997)
+++ stable/12/sys/amd64/linux32/linux32_dummy.c Sun Jan 13 12:12:50 2019
(r342998)
@@ -168,7 +168,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);

Modified: stable/12/sys/arm64/linux/linux_dummy.c
==
--- stable/12/sys/arm64/linux/linux_dummy.c Sun Jan 13 08:49:55 2019
(r342997)
+++ stable/12/sys/arm64/linux/linux_dummy.c Sun Jan 13 12:12:50 2019
(r342998)
@@ -161,7 +161,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);

Modified: stable/12/sys/i386/linux/linux_dummy.c
==
--- stable/12/sys/i386/linux/linux_dummy.c  Sun Jan 13 08:49:55 2019
(r342997)
+++ stable/12/sys/i386/linux/linux_dummy.c  Sun Jan 13 12:12:50 2019
(r342998)
@@ -164,7 +164,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);
___
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: r342996 - stable/12/share/timedef

2019-01-13 Thread Xin LI
Author: delphij
Date: Sun Jan 13 08:46:06 2019
New Revision: 342996
URL: https://svnweb.freebsd.org/changeset/base/342996

Log:
  MFC r342614, r342633
  
  r342614:
  Properly set svn:mimetype for zh_CN.UTF-8.src.
  
  r342633:
  Fix various issues with Chinese locales:
  
   - Change short weekday names to use only one Chinese character.
 (note: this is a somewhat misunfortunate compromise due to the fact
 that some applications are using short buffer for weekday names,
 and in ~1905 when 星期 system was created to replace the traditional
 七曜 system, which can use 日月火水木金土 to represent Sunday through
 Saturday with just one character without any confusion).
   - for zh_CN locales: use Arabic numerals for month names, matching the
 practice of all other CJK locales
   - Regenerate zh_CN.{GB2312,GBK} locales from zh_CN.UTF-8.
  
  Reported by:  ygy
  Reviewed by:  kevlo
  Differential Revision:https://reviews.freebsd.org/D18689

Modified:
  stable/12/share/timedef/zh_CN.GB2312.src
  stable/12/share/timedef/zh_CN.GBK.src
  stable/12/share/timedef/zh_CN.UTF-8.src   (contents, props changed)
  stable/12/share/timedef/zh_HK.UTF-8.src
  stable/12/share/timedef/zh_TW.UTF-8.src
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/timedef/zh_CN.GB2312.src
==
--- stable/12/share/timedef/zh_CN.GB2312.srcSun Jan 13 07:25:55 2019
(r342995)
+++ stable/12/share/timedef/zh_CN.GB2312.srcSun Jan 13 08:46:06 2019
(r342996)
@@ -4,41 +4,41 @@
 # -
 #
 # Short month names
-!!#1TB
-!!#2TB
-!!#3TB
-!!#4TB
-!!#5TB
-!!#6TB
-!!#7TB
-!!#8TB
-!!#9TB
-#1#0TB
-#1#1TB
-#1#2TB
+ 1��
+ 2��
+ 3��
+ 4��
+ 5��
+ 6��
+ 7��
+ 8��
+ 9��
+10��
+11��
+12��
 #
 # Long month names (as in a date)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # Short weekday names
-
-��һ
-�ܶ�
-
-
-
-
+��
+һ
+��
+��
+��
+��
+��
 #
 # Long weekday names
 ��
@@ -66,18 +66,18 @@
 %Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # md_order
 md

Modified: stable/12/share/timedef/zh_CN.GBK.src
==
--- stable/12/share/timedef/zh_CN.GBK.src   Sun Jan 13 07:25:55 2019
(r342995)
+++ stable/12/share/timedef/zh_CN.GBK.src   Sun Jan 13 08:46:06 2019
(r342996)
@@ -18,27 +18,27 @@
 12��
 #
 # Long month names (as in a date)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # Short weekday names
-
-��һ
-�ܶ�
-
-
-
-
+��
+һ
+��
+��
+��
+��
+��
 #
 # Long weekday names
 ��
@@ -66,18 +66,18 @@
 %Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # md_order
 md

Modified: stable/12/share/timedef/zh_CN.UTF-8.src
==
Binary file (source and/or target). No diff available.

Modified: stable/12/share/timedef/zh_HK.UTF-8.src
==
--- stable/12/share/timedef/zh_HK.UTF-8.src Sun Jan 13 07:25:55 2019
(r342995)
+++ stable/12/share/timedef/zh_HK.UTF-8.src Sun Jan 13 08:46:06 2019
(r342996)
@@ -32,13 +32,13 @@
 12月
 #
 # Short weekday names
-週日
-週一
-週二
-週三
-週四
-週五
-週六
+日
+一
+二
+三
+四
+五
+六
 #
 # Long weekday names
 星期日

Modified: stable/12/share/timedef/zh_TW.UTF-8.src
==
--- stable/12/share/timedef/zh_TW.UTF-8.src Sun Jan 13 07:25:55 2019
(r342995)
+++ stable/12/share/timedef/zh_TW.UTF-8.src Sun Jan 13 08:46:06 2019
(r342996)
@@ -32,13 +32,13 @@
 12月
 #
 # Short weekday names
-週日
-週一
-週二
-週三
-週四
-週五
-週六
+日
+一
+二
+三
+四
+五
+六
 #
 # Long weekday names
 星期日
___
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: r342993 - in stable/12/stand/efi: include libefi loader

2019-01-13 Thread Toomas Soome
Author: tsoome
Date: Sun Jan 13 07:19:20 2019
New Revision: 342993
URL: https://svnweb.freebsd.org/changeset/base/342993

Log:
  loader.efi: update memmap command to recognize new attributes
  
  Also move memory type to string translation to libefi for later use.

Modified:
  stable/12/stand/efi/include/efidef.h
  stable/12/stand/efi/include/efilib.h
  stable/12/stand/efi/libefi/env.c
  stable/12/stand/efi/loader/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/include/efidef.h
==
--- stable/12/stand/efi/include/efidef.hSun Jan 13 07:12:50 2019
(r342992)
+++ stable/12/stand/efi/include/efidef.hSun Jan 13 07:19:20 2019
(r342993)
@@ -157,23 +157,27 @@ typedef enum {
 EfiMemoryMappedIO,
 EfiMemoryMappedIOPortSpace,
 EfiPalCode,
+EfiPersistentMemory,
 EfiMaxMemoryType
 } EFI_MEMORY_TYPE;
 
 // possible caching types for the memory range
-#define EFI_MEMORY_UC   0x0001
-#define EFI_MEMORY_WC   0x0002
-#define EFI_MEMORY_WT   0x0004
-#define EFI_MEMORY_WB   0x0008
-#define EFI_MEMORY_UCE  0x0010  
+#define EFI_MEMORY_UC  0x0001
+#define EFI_MEMORY_WC  0x0002
+#define EFI_MEMORY_WT  0x0004
+#define EFI_MEMORY_WB  0x0008
+#define EFI_MEMORY_UCE 0x0010  
 
 // physical memory protection on range 
-#define EFI_MEMORY_WP   0x1000
-#define EFI_MEMORY_RP   0x2000
-#define EFI_MEMORY_XP   0x4000
+#define EFI_MEMORY_WP  0x1000
+#define EFI_MEMORY_RP  0x2000
+#define EFI_MEMORY_XP  0x4000
+#defineEFI_MEMORY_NV   0x8000
+#defineEFI_MEMORY_MORE_RELIABLE0x0001
+#defineEFI_MEMORY_RO   0x0002
 
 // range requires a runtime mapping
-#define EFI_MEMORY_RUNTIME  0x8000
+#define EFI_MEMORY_RUNTIME 0x8000
 
 #define EFI_MEMORY_DESCRIPTOR_VERSION  1
 typedef struct {

Modified: stable/12/stand/efi/include/efilib.h
==
--- stable/12/stand/efi/include/efilib.hSun Jan 13 07:12:50 2019
(r342992)
+++ stable/12/stand/efi/include/efilib.hSun Jan 13 07:19:20 2019
(r342993)
@@ -108,6 +108,9 @@ void delay(int usecs);
 /* EFI environment initialization. */
 void efi_init_environment(void);
 
+/* EFI Memory type strings. */
+const char *efi_memory_type(EFI_MEMORY_TYPE);
+
 /* CHAR16 utility functions. */
 int wcscmp(CHAR16 *, CHAR16 *);
 void cpy8to16(const char *, CHAR16 *, size_t);

Modified: stable/12/stand/efi/libefi/env.c
==
--- stable/12/stand/efi/libefi/env.cSun Jan 13 07:12:50 2019
(r342992)
+++ stable/12/stand/efi/libefi/env.cSun Jan 13 07:19:20 2019
(r342993)
@@ -47,6 +47,49 @@ efi_init_environment(void)
 
 COMMAND_SET(efishow, "efi-show", "print some or all EFI variables", 
command_efi_show);
 
+const char *
+efi_memory_type(EFI_MEMORY_TYPE type)
+{
+   const char *types[] = {
+   "Reserved",
+   "LoaderCode",
+   "LoaderData",
+   "BootServicesCode",
+   "BootServicesData",
+   "RuntimeServicesCode",
+   "RuntimeServicesData",
+   "ConventionalMemory",
+   "UnusableMemory",
+   "ACPIReclaimMemory",
+   "ACPIMemoryNVS",
+   "MemoryMappedIO",
+   "MemoryMappedIOPortSpace",
+   "PalCode",
+   "PersistentMemory"
+   };
+
+   switch (type) {
+   case EfiReservedMemoryType:
+   case EfiLoaderCode:
+   case EfiLoaderData:
+   case EfiBootServicesCode:
+   case EfiBootServicesData:
+   case EfiRuntimeServicesCode:
+   case EfiRuntimeServicesData:
+   case EfiConventionalMemory:
+   case EfiUnusableMemory:
+   case EfiACPIReclaimMemory:
+   case EfiACPIMemoryNVS:
+   case EfiMemoryMappedIO:
+   case EfiMemoryMappedIOPortSpace:
+   case EfiPalCode:
+   case EfiPersistentMemory:
+   return (types[type]);
+   default:
+   return ("Unknown");
+   }
+}
+
 static int
 efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag)
 {

Modified: stable/12/stand/efi/loader/main.c
==
--- stable/12/stand/efi/loader/main.c   Sun Jan 13 07:12:50 2019
(r342992)
+++ stable/12/stand/efi/loader/main.c   Sun Jan 13 07:19:20 2019
(r342993)
@@ -1041,7 +1041,7 @@ c

svn commit: r342992 - stable/12/stand/i386/libi386

2019-01-13 Thread Toomas Soome
Author: tsoome
Date: Sun Jan 13 07:12:50 2019
New Revision: 342992
URL: https://svnweb.freebsd.org/changeset/base/342992

Log:
  With buggy int13 ah=15, we can mis-identify the floppy devices.
  
  We have no option than trust INT13 ah=08 return code during the init phase.
  
  PR:   234460
  Reported by:  Oleh Hushchenkov

Modified:
  stable/12/stand/i386/libi386/biosdisk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/libi386/biosdisk.c
==
--- stable/12/stand/i386/libi386/biosdisk.c Sun Jan 13 06:01:36 2019
(r342991)
+++ stable/12/stand/i386/libi386/biosdisk.c Sun Jan 13 07:12:50 2019
(r342992)
@@ -136,6 +136,8 @@ static int bd_ioctl(struct open_file *f, u_long cmd, v
 static int bd_print(int verbose);
 static int cd_print(int verbose);
 static int fd_print(int verbose);
+static void bd_reset_disk(int);
+static int bd_get_diskinfo_std(struct bdinfo *);
 
 struct devsw biosfd = {
.dv_name = "fd",
@@ -252,20 +254,52 @@ bd_unit2bios(struct i386_devdesc *dev)
 }
 
 /*
+ * Use INT13 AH=15 - Read Drive Type.
+ */
+static int
+fd_count(void)
+{
+   int drive;
+
+   for (drive = 0; drive < MAXBDDEV; drive++) {
+   bd_reset_disk(drive);
+
+   v86.ctl = V86_FLAGS;
+   v86.addr = 0x13;
+   v86.eax = 0x1500;
+   v86.edx = drive;
+   v86int();
+
+   if (V86_CY(v86.efl))
+   break;
+
+   if ((v86.eax & 0x300) == 0)
+   break;
+   }
+
+   return (drive);
+}
+
+/*
  * Quiz the BIOS for disk devices, save a little info about them.
  */
 static int
 fd_init(void)
 {
-   int unit;
+   int unit, numfd;
bdinfo_t *bd;
 
-   for (unit = 0; unit < MAXBDDEV; unit++) {
+   numfd = fd_count();
+   for (unit = 0; unit < numfd; unit++) {
if ((bd = calloc(1, sizeof(*bd))) == NULL)
break;
+
+   bd->bd_sectorsize = BIOSDISK_SECSIZE;
bd->bd_flags = BD_FLOPPY;
bd->bd_unit = unit;
-   if (!bd_int13probe(bd)) {
+
+   /* Use std diskinfo for floppy drive */
+   if (bd_get_diskinfo_std(bd) != 0) {
free(bd);
break;
}
@@ -382,6 +416,10 @@ bc_add(int biosdev)
 static int
 bd_check_extensions(int unit)
 {
+   /* do not use ext calls for floppy devices */
+   if (unit < 0x80)
+   return (0);
+
/* Determine if we can use EDD with this device. */
v86.ctl = V86_FLAGS;
v86.addr = 0x13;
___
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: r342990 - head/tests/sys/netpfil/pf

2019-01-13 Thread Kristof Provost
Author: kp
Date: Sun Jan 13 05:31:53 2019
New Revision: 342990
URL: https://svnweb.freebsd.org/changeset/base/342990

Log:
  pf tests: Test PR 229241
  
  pfctl has an issue with 'set skip on ', which causes inconsistent
  behaviour: the set skip directive works initially, but does not take
  effect when the same rules are re-applied.
  
  PR:   229241
  MFC after:1 week

Modified:
  head/tests/sys/netpfil/pf/set_skip.sh
  head/tests/sys/netpfil/pf/utils.subr

Modified: head/tests/sys/netpfil/pf/set_skip.sh
==
--- head/tests/sys/netpfil/pf/set_skip.sh   Sun Jan 13 05:30:26 2019
(r342989)
+++ head/tests/sys/netpfil/pf/set_skip.sh   Sun Jan 13 05:31:53 2019
(r342990)
@@ -30,7 +30,38 @@ set_skip_group_cleanup()
pft_cleanup
 }
 
+atf_test_case "set_skip_group_lo" "cleanup"
+set_skip_group_lo_head()
+{
+   atf_set descr 'Basic set skip test, lo'
+   atf_set require.user root
+}
+
+set_skip_group_lo_body()
+{
+   # See PR 229241
+   pft_init
+
+   pft_mkjail alcatraz
+   jexec alcatraz ifconfig lo0 127.0.0.1/8 up
+   jexec alcatraz pfctl -e
+   pft_set_rules alcatraz "set skip on lo" \
+   "block on lo0"
+
+   atf_check -s exit:0 -o ignore jexec alcatraz ping -c 1 127.0.0.1
+   pft_set_rules noflush alcatraz "set skip on lo" \
+   "block on lo0"
+   atf_check -s exit:0 -o ignore jexec alcatraz ping -c 1 127.0.0.1
+   jexec alcatraz pfctl -s rules
+}
+
+set_skip_group_lo_cleanup()
+{
+   pft_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "set_skip_group"
+   atf_add_test_case "set_skip_group_lo"
 }

Modified: head/tests/sys/netpfil/pf/utils.subr
==
--- head/tests/sys/netpfil/pf/utils.subrSun Jan 13 05:30:26 2019
(r342989)
+++ head/tests/sys/netpfil/pf/utils.subrSun Jan 13 05:31:53 2019
(r342990)
@@ -49,8 +49,14 @@ pft_set_rules()
jname=$1
shift
 
-   # Flush all states, rules, fragments, ...
-   jexec ${jname} pfctl -F all
+   if [ $jname == "noflush" ];
+   then
+   jname=$1
+   shift
+   else
+   # Flush all states, rules, fragments, ...
+   jexec ${jname} pfctl -F all
+   fi
 
while [ $# -gt 0 ]; do
printf "$1\n"
___
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: r343000 - stable/12/usr.bin/getconf

2019-01-13 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jan 13 13:57:11 2019
New Revision: 343000
URL: https://svnweb.freebsd.org/changeset/base/343000

Log:
  MFC r342817: getconf(1): Minor mdoc fix

Modified:
  stable/12/usr.bin/getconf/getconf.1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/getconf/getconf.1
==
--- stable/12/usr.bin/getconf/getconf.1 Sun Jan 13 12:13:08 2019
(r342999)
+++ stable/12/usr.bin/getconf/getconf.1 Sun Jan 13 13:57:11 2019
(r343000)
@@ -70,7 +70,7 @@ Otherwise,
 all system configuration variables are reported using
 .Xr confstr 3
 and
-.Xr sysconf 3.
+.Xr sysconf 3 .
 .Pp
 The second form of the command, with two mandatory
 arguments, retrieves file- and file system-specific
___
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: r342999 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux

2019-01-13 Thread Fedor Uporov
Author: fsu
Date: Sun Jan 13 12:13:08 2019
New Revision: 342999
URL: https://svnweb.freebsd.org/changeset/base/342999

Log:
  MFC r342933:
  Fix errno values returned from DUMMY_XATTR linuxulator calls
  
  Reported by: we...@uni-mainz.de
  Reviewed by: markj
  Differential Revision: https://reviews.freebsd.org/D18812

Modified:
  stable/11/sys/amd64/linux/linux_dummy.c
  stable/11/sys/amd64/linux32/linux32_dummy.c
  stable/11/sys/i386/linux/linux_dummy.c

Modified: stable/11/sys/amd64/linux/linux_dummy.c
==
--- stable/11/sys/amd64/linux/linux_dummy.c Sun Jan 13 12:12:50 2019
(r342998)
+++ stable/11/sys/amd64/linux/linux_dummy.c Sun Jan 13 12:13:08 2019
(r342999)
@@ -164,7 +164,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);

Modified: stable/11/sys/amd64/linux32/linux32_dummy.c
==
--- stable/11/sys/amd64/linux32/linux32_dummy.c Sun Jan 13 12:12:50 2019
(r342998)
+++ stable/11/sys/amd64/linux32/linux32_dummy.c Sun Jan 13 12:13:08 2019
(r342999)
@@ -170,7 +170,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);

Modified: stable/11/sys/i386/linux/linux_dummy.c
==
--- stable/11/sys/i386/linux/linux_dummy.c  Sun Jan 13 12:12:50 2019
(r342998)
+++ stable/11/sys/i386/linux/linux_dummy.c  Sun Jan 13 12:13:08 2019
(r342999)
@@ -166,7 +166,7 @@ linux_ ## s ## xattr(   
\
 struct thread *td, struct linux_ ## s ## xattr_args *arg)  \
 {  \
\
-   return (ENOATTR);   \
+   return (EOPNOTSUPP);\
 }
 DUMMY_XATTR(set);
 DUMMY_XATTR(lset);
___
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: r342997 - stable/11/share/timedef

2019-01-13 Thread Xin LI
Author: delphij
Date: Sun Jan 13 08:49:55 2019
New Revision: 342997
URL: https://svnweb.freebsd.org/changeset/base/342997

Log:
  MFC r342614, r342633
  
  r342614:
  Properly set svn:mimetype for zh_CN.UTF-8.src.
  
  r342633:
  Fix various issues with Chinese locales:
  
   - Change short weekday names to use only one Chinese character.
 (note: this is a somewhat misunfortunate compromise due to the fact
 that some applications are using short buffer for weekday names,
 and in ~1905 when 星期 system was created to replace the traditional
 七曜 system, which can use 日月火水木金土 to represent Sunday through
 Saturday with just one character without any confusion).
   - for zh_CN locales: use Arabic numerals for month names, matching the
 practice of all other CJK locales
   - Regenerate zh_CN.{GB2312,GBK} locales from zh_CN.UTF-8.
  
  Reported by:  ygy
  Reviewed by:  kevlo
  Differential Revision:https://reviews.freebsd.org/D18689

Modified:
  stable/11/share/timedef/zh_CN.GB2312.src
  stable/11/share/timedef/zh_CN.GBK.src
  stable/11/share/timedef/zh_CN.UTF-8.src   (contents, props changed)
  stable/11/share/timedef/zh_HK.UTF-8.src
  stable/11/share/timedef/zh_TW.UTF-8.src
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/timedef/zh_CN.GB2312.src
==
--- stable/11/share/timedef/zh_CN.GB2312.srcSun Jan 13 08:46:06 2019
(r342996)
+++ stable/11/share/timedef/zh_CN.GB2312.srcSun Jan 13 08:49:55 2019
(r342997)
@@ -4,41 +4,41 @@
 # -
 #
 # Short month names
-!!#1TB
-!!#2TB
-!!#3TB
-!!#4TB
-!!#5TB
-!!#6TB
-!!#7TB
-!!#8TB
-!!#9TB
-#1#0TB
-#1#1TB
-#1#2TB
+ 1��
+ 2��
+ 3��
+ 4��
+ 5��
+ 6��
+ 7��
+ 8��
+ 9��
+10��
+11��
+12��
 #
 # Long month names (as in a date)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # Short weekday names
-
-��һ
-�ܶ�
-
-
-
-
+��
+һ
+��
+��
+��
+��
+��
 #
 # Long weekday names
 ��
@@ -66,18 +66,18 @@
 %Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # md_order
 md

Modified: stable/11/share/timedef/zh_CN.GBK.src
==
--- stable/11/share/timedef/zh_CN.GBK.src   Sun Jan 13 08:46:06 2019
(r342996)
+++ stable/11/share/timedef/zh_CN.GBK.src   Sun Jan 13 08:49:55 2019
(r342997)
@@ -18,27 +18,27 @@
 12��
 #
 # Long month names (as in a date)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # Short weekday names
-
-��һ
-�ܶ�
-
-
-
-
+��
+һ
+��
+��
+��
+��
+��
 #
 # Long weekday names
 ��
@@ -66,18 +66,18 @@
 %Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
-һ��
-
-
-
-
-
-
-
-
-ʮ��
-ʮһ��
-ʮ
+1��
+2��
+3��
+4��
+5��
+6��
+7��
+8��
+9��
+10��
+11��
+12��
 #
 # md_order
 md

Modified: stable/11/share/timedef/zh_CN.UTF-8.src
==
Binary file (source and/or target). No diff available.

Modified: stable/11/share/timedef/zh_HK.UTF-8.src
==
--- stable/11/share/timedef/zh_HK.UTF-8.src Sun Jan 13 08:46:06 2019
(r342996)
+++ stable/11/share/timedef/zh_HK.UTF-8.src Sun Jan 13 08:49:55 2019
(r342997)
@@ -32,13 +32,13 @@
 12月
 #
 # Short weekday names
-週日
-週一
-週二
-週三
-週四
-週五
-週六
+日
+一
+二
+三
+四
+五
+六
 #
 # Long weekday names
 星期日

Modified: stable/11/share/timedef/zh_TW.UTF-8.src
==
--- stable/11/share/timedef/zh_TW.UTF-8.src Sun Jan 13 08:46:06 2019
(r342996)
+++ stable/11/share/timedef/zh_TW.UTF-8.src Sun Jan 13 08:49:55 2019
(r342997)
@@ -32,13 +32,13 @@
 12月
 #
 # Short weekday names
-週日
-週一
-週二
-週三
-週四
-週五
-週六
+日
+一
+二
+三
+四
+五
+六
 #
 # Long weekday names
 星期日
___
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: r342989 - head/sbin/pfctl

2019-01-13 Thread Kristof Provost
Author: kp
Date: Sun Jan 13 05:30:26 2019
New Revision: 342989
URL: https://svnweb.freebsd.org/changeset/base/342989

Log:
  pfctl: Fix 'set skip' handling for groups
  
  When we skip on a group the kernel will automatically skip on the member
  interfaces. We still need to update our own cache though, or we risk
  overruling the kernel afterwards.
  
  This manifested as 'set skip' working initially, then not working when
  the rules were reloaded.
  
  PR:   229241
  MFC after:1 week

Modified:
  head/sbin/pfctl/pfctl.c

Modified: head/sbin/pfctl/pfctl.c
==
--- head/sbin/pfctl/pfctl.c Sun Jan 13 04:51:24 2019(r342988)
+++ head/sbin/pfctl/pfctl.c Sun Jan 13 05:30:26 2019(r342989)
@@ -1977,6 +1977,7 @@ int
 pfctl_set_interface_flags(struct pfctl *pf, char *ifname, int flags, int how)
 {
struct pfioc_iface  pi;
+   struct node_host*h = NULL, *n = NULL;
 
if ((loadopt & PFCTL_FLAG_OPTION) == 0)
return (0);
@@ -1984,6 +1985,12 @@ pfctl_set_interface_flags(struct pfctl *pf, char *ifna
bzero(&pi, sizeof(pi));
 
pi.pfiio_flags = flags;
+
+   /* Make sure our cache matches the kernel. If we set or clear the flag
+* for a group this applies to all members. */
+   h = ifa_grouplookup(ifname, 0);
+   for (n = h; n != NULL; n = n->next)
+   pfctl_set_interface_flags(pf, n->ifname, flags, how);
 
if (strlcpy(pi.pfiio_name, ifname, sizeof(pi.pfiio_name)) >=
sizeof(pi.pfiio_name))
___
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: r342995 - stable/12/stand/i386/libi386

2019-01-13 Thread Toomas Soome
Author: tsoome
Date: Sun Jan 13 07:25:55 2019
New Revision: 342995
URL: https://svnweb.freebsd.org/changeset/base/342995

Log:
  MFC: r342619, r342626
  
  loader: create bio_alloc and bio_free for bios bounce buffer
  
  We do have 16KB buffer space defined in pxe.c, move it to bio.c and implement
  bio_alloc()/bio_free() interface to make it possible to use this space for
  other BIOS calls (notably, from biosdisk.c).

Added:
  stable/12/stand/i386/libi386/bio.c
 - copied, changed from r342619, head/stand/i386/libi386/bio.c
Modified:
  stable/12/stand/i386/libi386/Makefile
  stable/12/stand/i386/libi386/biosdisk.c
  stable/12/stand/i386/libi386/libi386.h
  stable/12/stand/i386/libi386/pxe.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/libi386/Makefile
==
--- stable/12/stand/i386/libi386/Makefile   Sun Jan 13 07:22:16 2019
(r342994)
+++ stable/12/stand/i386/libi386/Makefile   Sun Jan 13 07:25:55 2019
(r342995)
@@ -4,7 +4,7 @@
 
 LIB=   i386
 
-SRCS=  biosacpi.c biosdisk.c biosmem.c biospnp.c \
+SRCS=  bio.c biosacpi.c biosdisk.c biosmem.c biospnp.c \
biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \
comconsole.c devicename.c elf32_freebsd.c \
elf64_freebsd.c multiboot.c multiboot_tramp.S relocater_tramp.S \

Copied and modified: stable/12/stand/i386/libi386/bio.c (from r342619, 
head/stand/i386/libi386/bio.c)
==
--- head/stand/i386/libi386/bio.c   Sun Dec 30 09:35:47 2018
(r342619, copy source)
+++ stable/12/stand/i386/libi386/bio.c  Sun Jan 13 07:25:55 2019
(r342995)
@@ -1,4 +1,6 @@
 /*-
+ * Copyright 2018 Toomas Soome 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

Modified: stable/12/stand/i386/libi386/biosdisk.c
==
--- stable/12/stand/i386/libi386/biosdisk.c Sun Jan 13 07:22:16 2019
(r342994)
+++ stable/12/stand/i386/libi386/biosdisk.c Sun Jan 13 07:25:55 2019
(r342995)
@@ -507,10 +507,10 @@ bd_get_diskinfo_ext(struct bdinfo *bd)
 * Sector size must be a multiple of 512 bytes.
 * An alternate test would be to check power of 2,
 * powerof2(params.sector_size).
-* 4K is largest read buffer we can use at this time.
+* 16K is largest read buffer we can use at this time.
 */
if (params.sector_size >= 512 &&
-   params.sector_size <= 4096 &&
+   params.sector_size <= 16384 &&
(params.sector_size % BIOSDISK_SECSIZE) == 0)
bd->bd_sectorsize = params.sector_size;
 
@@ -899,8 +899,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
struct disk_devdesc *dev = (struct disk_devdesc *)devdata;
bdinfo_t *bd;
uint64_t disk_blocks, offset, d_offset;
-   size_t blks, blkoff, bsize, rest;
-   caddr_t bbuf;
+   size_t blks, blkoff, bsize, bio_size, rest;
+   caddr_t bbuf = NULL;
int rc;
 
bd = bd_get_bdinfo(&dev->dd);
@@ -975,14 +975,25 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
DEBUG("short I/O %d", blks);
}
 
-   if (V86_IO_BUFFER_SIZE / bd->bd_sectorsize == 0)
-   panic("BUG: Real mode buffer is too small");
+   bio_size = min(BIO_BUFFER_SIZE, size);
+   while (bio_size > bd->bd_sectorsize) {
+   bbuf = bio_alloc(bio_size);
+   if (bbuf != NULL)
+   break;
+   bio_size -= bd->bd_sectorsize;
+   }
+   if (bbuf == NULL) {
+   bio_size = V86_IO_BUFFER_SIZE;
+   if (bio_size / bd->bd_sectorsize == 0)
+   panic("BUG: Real mode buffer is too small");
 
-   bbuf = PTOV(V86_IO_BUFFER);
+   /* Use alternate 4k buffer */
+   bbuf = PTOV(V86_IO_BUFFER);
+   }
rest = size;
-
+   rc = 0;
while (blks > 0) {
-   int x = min(blks, V86_IO_BUFFER_SIZE / bd->bd_sectorsize);
+   int x = min(blks, bio_size / bd->bd_sectorsize);
 
switch (rw & F_MASK) {
case F_READ:
@@ -991,8 +1002,10 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
if (rest < bsize)
bsize = rest;
 
-   if ((rc = bd_io(dev, bd, dblk, x, bbuf, BD_RD)) != 0)
-   return (EIO);
+   if ((rc = bd_io(dev, bd, dblk, x, bbuf, BD_RD)) != 0) {
+   rc = EIO;
+   goto error;
+   }
 
bcopy(bbuf + blkoff, buf, bsize);
 

svn commit: r342991 - head/sys/net80211

2019-01-13 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jan 13 06:01:36 2019
New Revision: 342991
URL: https://svnweb.freebsd.org/changeset/base/342991

Log:
  net80211: provide rate validation for injected frames.
  
  There may be various side effects (device timeout, firmware and / or
  kernel panic) when an invalid (or inapplicable - e.g., an MCS rate
  for 11g-only device) is set; check rates before sending the frame to
  the driver.
  
  How-to-reproduce:
  Set an MCS (real or bogus - with 0x80 bit set) rate in ibp_rate0 field
  for any device that uses ieee80211_isratevalid() for rate checks -
  rum(4), run(4), ural(4), bwi(4) or ral(4); if kernel is compiled
  with INVARIANTS the check will result in "rate %d is basic/mcs?" panic.
  
  Tested with WUSB54GC (rum(4)), AP mode.
  
  MFC after:1 week

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cSun Jan 13 05:31:53 2019
(r342990)
+++ head/sys/net80211/ieee80211_output.cSun Jan 13 06:01:36 2019
(r342991)
@@ -604,6 +604,97 @@ ieee80211_validate_frame(struct mbuf *m,
return (0);
 }
 
+static int
+ieee80211_validate_rate(struct ieee80211_node *ni, uint8_t rate)
+{
+   struct ieee80211com *ic = ni->ni_ic;
+
+   if (IEEE80211_IS_HT_RATE(rate)) {
+   if ((ic->ic_htcaps & IEEE80211_HTC_HT) == 0)
+   return (EINVAL);
+
+   rate = IEEE80211_RV(rate);
+   if (rate <= 31) {
+   if (rate > ic->ic_txstream * 8 - 1)
+   return (EINVAL);
+
+   return (0);
+   }
+
+   if (rate == 32) {
+   if ((ic->ic_htcaps & IEEE80211_HTC_TXMCS32) == 0)
+   return (EINVAL);
+
+   return (0);
+   }
+
+   if ((ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL) == 0)
+   return (EINVAL);
+
+   switch (ic->ic_txstream) {
+   case 0:
+   case 1:
+   return (EINVAL);
+   case 2:
+   if (rate > 38)
+   return (EINVAL);
+
+   return (0);
+   case 3:
+   if (rate > 52)
+   return (EINVAL);
+
+   return (0);
+   case 4:
+   default:
+   if (rate > 76)
+   return (EINVAL);
+
+   return (0);
+   }
+   }
+
+   if (!ieee80211_isratevalid(ic->ic_rt, rate))
+   return (EINVAL);
+
+   return (0);
+}
+
+static int
+ieee80211_sanitize_rates(struct ieee80211_node *ni, struct mbuf *m,
+const struct ieee80211_bpf_params *params)
+{
+   int error;
+
+   if (!params)
+   return (0); /* nothing to do */
+
+   /* NB: most drivers assume that ibp_rate0 is set (!= 0). */
+   if (params->ibp_rate0 != 0) {
+   error = ieee80211_validate_rate(ni, params->ibp_rate0);
+   if (error != 0)
+   return (error);
+   } else {
+   /* XXX pre-setup some default (e.g., mgmt / mcast) rate */
+   /* XXX __DECONST? */
+   (void) m;
+   }
+
+   if (params->ibp_rate1 != 0 &&
+   (error = ieee80211_validate_rate(ni, params->ibp_rate1)) != 0)
+   return (error);
+
+   if (params->ibp_rate2 != 0 &&
+   (error = ieee80211_validate_rate(ni, params->ibp_rate2)) != 0)
+   return (error);
+
+   if (params->ibp_rate3 != 0 &&
+   (error = ieee80211_validate_rate(ni, params->ibp_rate3)) != 0)
+   return (error);
+
+   return (0);
+}
+
 /*
  * 802.11 output routine. This is (currently) used only to
  * connect bpf write calls to the 802.11 layer for injecting
@@ -717,6 +808,10 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m,
m->m_pkthdr.len - ieee80211_hdrsize(wh));
} else
M_WME_SETAC(m, WME_AC_BE);
+
+   error = ieee80211_sanitize_rates(ni, m, params);
+   if (error != 0)
+   senderr(error);
 
IEEE80211_NODE_STAT(ni, tx_data);
if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
___
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: r342994 - stable/12/stand/i386/libi386

2019-01-13 Thread Toomas Soome
Author: tsoome
Date: Sun Jan 13 07:22:16 2019
New Revision: 342994
URL: https://svnweb.freebsd.org/changeset/base/342994

Log:
  i386_parsedev() needs to support fd devices
  
  After introduction of fd device list to BIOS loader, the i386_parsedev()
  needs to recognize fd devices.

Modified:
  stable/12/stand/i386/libi386/devicename.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/libi386/devicename.c
==
--- stable/12/stand/i386/libi386/devicename.c   Sun Jan 13 07:19:20 2019
(r342993)
+++ stable/12/stand/i386/libi386/devicename.c   Sun Jan 13 07:22:16 2019
(r342994)
@@ -103,23 +103,42 @@ i386_parsedev(struct i386_devdesc **dev, const char *d
 }
 if (dv == NULL)
return(ENOENT);
-idev = malloc(sizeof(struct i386_devdesc));
-err = 0;
+
 np = (devspec + strlen(dv->dv_name));
+idev = NULL;
+err = 0;
 
 switch(dv->dv_type) {
-case DEVT_NONE:/* XXX what to do here?  Do we care? */
+case DEVT_NONE:
break;
 
 case DEVT_DISK:
+   idev = malloc(sizeof(struct i386_devdesc));
+   if (idev == NULL)
+   return (ENOMEM);
+
err = disk_parsedev((struct disk_devdesc *)idev, np, path);
if (err != 0)
goto fail;
break;
 
-case DEVT_CD:
-case DEVT_NET:
+case DEVT_ZFS:
+   idev = malloc(sizeof (struct zfs_devdesc));
+   if (idev == NULL)
+   return (ENOMEM);
+
+   err = zfs_parsedev((struct zfs_devdesc *)idev, np, path);
+   if (err != 0)
+   goto fail;
+   break;
+
+default:
+   idev = malloc(sizeof (struct devdesc));
+   if (idev == NULL)
+   return (ENOMEM);
+
unit = 0;
+   cp = (char *)np;
 
if (*np && (*np != ':')) {
unit = strtol(np, &cp, 0);  /* get unit number if present */
@@ -127,9 +146,8 @@ i386_parsedev(struct i386_devdesc **dev, const char *d
err = EUNIT;
goto fail;
}
-   } else {
-   cp = (char *)np;
}
+
if (*cp && (*cp != ':')) {
err = EINVAL;
goto fail;
@@ -139,21 +157,13 @@ i386_parsedev(struct i386_devdesc **dev, const char *d
if (path != NULL)
*path = (*cp == 0) ? cp : cp + 1;
break;
-case DEVT_ZFS:
-   err = zfs_parsedev((struct zfs_devdesc *)idev, np, path);
-   if (err != 0)
-   goto fail;
-   break;
-default:
-   err = EINVAL;
-   goto fail;
 }
 idev->dd.d_dev = dv;
-if (dev == NULL) {
-   free(idev);
-} else {
+if (dev != NULL)
*dev = idev;
-}
+else
+   free(idev);
+
 return(0);
 
  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: r342985 - head/libexec/rtld-elf/powerpc64

2019-01-13 Thread Justin Hibbits
Author: jhibbits
Date: Sun Jan 13 02:33:20 2019
New Revision: 342985
URL: https://svnweb.freebsd.org/changeset/base/342985

Log:
  Fix rtld-elf compilation warning for powerpc64 ELFv2 ABI
  
  Summary: reloc_jmpslot function parameter 'defobj' is not used when using 
ELFv2
  ABI
  
  Submitted by: alfredo.junior_eldorado.org.br
  Reviewed By: kib, git_bdragon.rtk0.net, emaste, jhibbits
  Differential Revision: https://reviews.freebsd.org/D18808

Modified:
  head/libexec/rtld-elf/powerpc64/reloc.c

Modified: head/libexec/rtld-elf/powerpc64/reloc.c
==
--- head/libexec/rtld-elf/powerpc64/reloc.c Sun Jan 13 02:28:37 2019
(r342984)
+++ head/libexec/rtld-elf/powerpc64/reloc.c Sun Jan 13 02:33:20 2019
(r342985)
@@ -447,7 +447,7 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat
  * Update the value of a PLT jump slot.
  */
 Elf_Addr
-reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *defobj,
+reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *defobj 
__unused,
 const Obj_Entry *obj __unused, const Elf_Rel *rel __unused)
 {
 
___
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: r342986 - stable/12/contrib/xz/src/common

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Sun Jan 13 02:36:58 2019
New Revision: 342986
URL: https://svnweb.freebsd.org/changeset/base/342986

Log:
  MFC r342823:
  Clamp tuklib_physmem() return value to SIZE_T_MAX.

Modified:
  stable/12/contrib/xz/src/common/tuklib_physmem.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/xz/src/common/tuklib_physmem.c
==
--- stable/12/contrib/xz/src/common/tuklib_physmem.cSun Jan 13 02:33:20 
2019(r342985)
+++ stable/12/contrib/xz/src/common/tuklib_physmem.cSun Jan 13 02:36:58 
2019(r342986)
@@ -45,6 +45,7 @@
 #  include 
 
 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
+#  include 
 #  include 
 
 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
@@ -145,13 +146,16 @@ tuklib_physmem(void)
 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
const long pagesize = sysconf(_SC_PAGESIZE);
const long pages = sysconf(_SC_PHYS_PAGES);
-   if (pagesize != -1 && pages != -1)
+   if (pagesize != -1 && pages != -1) {
// According to docs, pagesize * pages can overflow.
// Simple case is 32-bit box with 4 GiB or more RAM,
// which may report exactly 4 GiB of RAM, and "long"
// being 32-bit will overflow. Casting to uint64_t
// hopefully avoids overflows in the near future.
ret = (uint64_t)pagesize * (uint64_t)pages;
+   if (ret > SIZE_T_MAX)
+   ret = SIZE_T_MAX;
+   }
 
 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
int name[2] = {
___
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: r342987 - stable/11/contrib/xz/src/common

2019-01-13 Thread Konstantin Belousov
Author: kib
Date: Sun Jan 13 02:38:14 2019
New Revision: 342987
URL: https://svnweb.freebsd.org/changeset/base/342987

Log:
  MFC r342823:
  Clamp tuklib_physmem() return value to SIZE_T_MAX.

Modified:
  stable/11/contrib/xz/src/common/tuklib_physmem.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/xz/src/common/tuklib_physmem.c
==
--- stable/11/contrib/xz/src/common/tuklib_physmem.cSun Jan 13 02:36:58 
2019(r342986)
+++ stable/11/contrib/xz/src/common/tuklib_physmem.cSun Jan 13 02:38:14 
2019(r342987)
@@ -45,6 +45,7 @@
 #  include 
 
 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
+#  include 
 #  include 
 
 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
@@ -145,13 +146,16 @@ tuklib_physmem(void)
 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
const long pagesize = sysconf(_SC_PAGESIZE);
const long pages = sysconf(_SC_PHYS_PAGES);
-   if (pagesize != -1 && pages != -1)
+   if (pagesize != -1 && pages != -1) {
// According to docs, pagesize * pages can overflow.
// Simple case is 32-bit box with 4 GiB or more RAM,
// which may report exactly 4 GiB of RAM, and "long"
// being 32-bit will overflow. Casting to uint64_t
// hopefully avoids overflows in the near future.
ret = (uint64_t)pagesize * (uint64_t)pages;
+   if (ret > SIZE_T_MAX)
+   ret = SIZE_T_MAX;
+   }
 
 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
int name[2] = {
___
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: r342988 - head/sys/powerpc/booke

2019-01-13 Thread Justin Hibbits
Author: jhibbits
Date: Sun Jan 13 04:51:24 2019
New Revision: 342988
URL: https://svnweb.freebsd.org/changeset/base/342988

Log:
  powerpcspe: Correct SPE high-component loading
  
  Don't clobber the low part of the register restoring the high component of.
  This could lead to very bad behavior if it's an ABI-affected register.
  
  While here, also mark the asm volatile in the SPE high save case, to match
  the load case.
  
  Reported by:  Branden Bergren (git_bdragon.rtk0.net)
  MFC after:1 week

Modified:
  head/sys/powerpc/booke/spe.c

Modified: head/sys/powerpc/booke/spe.c
==
--- head/sys/powerpc/booke/spe.cSun Jan 13 02:38:14 2019
(r342987)
+++ head/sys/powerpc/booke/spe.cSun Jan 13 04:51:24 2019
(r342988)
@@ -425,7 +425,7 @@ static uint32_t
 spe_save_reg_high(int reg)
 {
uint32_t vec[2];
-#define EVSTDW(n)   case n: __asm ("evstdw %1,0(%0)" \
+#define EVSTDW(n)   case n: __asm __volatile ("evstdw %1,0(%0)" \
:: "b"(vec), "n"(n)); break;
switch (reg) {
EVSTDW(0);  EVSTDW(1);  EVSTDW(2);  EVSTDW(3);
@@ -448,7 +448,7 @@ spe_save_reg_high(int reg)
 static void
 spe_load_reg_high(int reg, uint32_t val)
 {
-#defineEVLDW(n)   case n: __asm __volatile("evmergelo "#n",%0,0," \
+#defineEVLDW(n)   case n: __asm __volatile("evmergelo "#n",%0,"#n \
:: "r"(val)); break;
switch (reg) {
EVLDW(1);   EVLDW(2);   EVLDW(3);   EVLDW(4);
___
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: r342982 - stable/11/usr.sbin/powerd

2019-01-13 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jan 13 02:23:18 2019
New Revision: 342982
URL: https://svnweb.freebsd.org/changeset/base/342982

Log:
  MFC r342810:
  powerd(8): allow to force a method of battery state query
  
  This change allows to determine power source via sysctl or /dev/apm
  when devd(8) is running (used by default).
  
  Based on patch from PR; other changes on top of it:
  - '-f' (force) -> '-s' (source) parameter renaming;
  - allow 'apm' -> 'devd' transition when '-s devd' is set
  (if APM is enabled);
  - man page update.
  
  PR:   125707
  Submitted by: Konstantin Stepanov 
  Reviewed by:  bcr, imp
  Differential Revision:https://reviews.freebsd.org/D18742

Modified:
  stable/11/usr.sbin/powerd/powerd.8
  stable/11/usr.sbin/powerd/powerd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/powerd/powerd.8
==
--- stable/11/usr.sbin/powerd/powerd.8  Sun Jan 13 02:19:01 2019
(r342981)
+++ stable/11/usr.sbin/powerd/powerd.8  Sun Jan 13 02:23:18 2019
(r342982)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 4, 2013
+.Dd January 13, 2019
 .Dt POWERD 8
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .Op Fl p Ar ival
 .Op Fl P Ar pidfile
 .Op Fl r Ar percent
+.Op Fl s Ar source
 .Op Fl v
 .Sh DESCRIPTION
 The
@@ -117,6 +118,14 @@ The default is
 Specifies the CPU load percent level where adaptive
 mode should consider the CPU running and increase performance.
 The default is 75% or higher.
+.It Fl s Ar source
+Enforces method for AC line state refresh; by default, it is chosen
+automatically.
+The set of valid methods is
+.Cm sysctl , devd
+and
+.Cm apm
+(i386 only).
 .It Fl v
 Verbose mode.
 Messages about power changes will be printed to stdout and

Modified: stable/11/usr.sbin/powerd/powerd.c
==
--- stable/11/usr.sbin/powerd/powerd.c  Sun Jan 13 02:19:01 2019
(r342981)
+++ stable/11/usr.sbin/powerd/powerd.c  Sun Jan 13 02:23:18 2019
(r342982)
@@ -113,14 +113,16 @@ static intvflag;
 
 static volatile sig_atomic_t exit_requested;
 static power_src_t acline_status;
-static enum {
+typedef enum {
ac_none,
ac_sysctl,
ac_acpi_devd,
 #ifdef USE_APM
ac_apm,
 #endif
-} acline_mode;
+} acline_mode_t;
+static acline_mode_t acline_mode;
+static acline_mode_t acline_mode_user = ac_none;
 #ifdef USE_APM
 static int apm_fd = -1;
 #endif
@@ -286,21 +288,28 @@ get_freq_id(int freq, int *freqs, int numfreqs)
 static void
 acline_init(void)
 {
+   int skip_source_check;
+
acline_mib_len = 4;
acline_status = SRC_UNKNOWN;
+   skip_source_check = (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd);
 
-   if (sysctlnametomib(ACPIAC, acline_mib, &acline_mib_len) == 0) {
+   if ((skip_source_check || acline_mode_user == ac_sysctl) &&
+   sysctlnametomib(ACPIAC, acline_mib, &acline_mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
 #if __powerpc__
-   } else if (sysctlnametomib(PMUAC, acline_mib, &acline_mib_len) == 0) {
+   } else if ((skip_source_check || acline_mode_user == ac_sysctl) &&
+  sysctlnametomib(PMUAC, acline_mib, &acline_mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
 #endif
 #ifdef USE_APM
-   } else if ((apm_fd = open(APMDEV, O_RDONLY)) >= 0) {
+   } else if ((skip_source_check || acline_mode_user == ac_apm) &&
+  (apm_fd = open(APMDEV, O_RDONLY)) >= 0) {
if (vflag)
warnx("using APM for AC line status");
acline_mode = ac_apm;
@@ -360,7 +369,17 @@ acline_read(void)
}
 #endif
/* try to (re)connect to devd */
-   if (acline_mode == ac_sysctl) {
+#ifdef USE_APM
+   if ((acline_mode == ac_sysctl &&
+   (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd)) ||
+   (acline_mode == ac_apm &&
+acline_mode_user == ac_acpi_devd)) {
+#else
+   if (acline_mode == ac_sysctl &&
+   (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd)) {
+#endif
struct timeval now;
 
gettimeofday(&now, NULL);
@@ -426,6 +445,21 @@ parse_mode(char *arg, int *mode, int ch)
 }
 
 static void
+parse_acline_mode(char *arg, int ch)
+{
+   if (strcmp(arg, "sysctl") == 0)
+   acline_mode_user = ac_sysctl;
+   else if (strcmp(arg, "devd") == 0)
+   acline_mode_user = ac_acpi_devd;
+#ifdef USE_APM
+   else if (strcmp(arg, "apm") == 0)
+   acline_mode_user = ac_apm;
+#endif
+   else
+   errx(1, "bad optio

svn commit: r342981 - stable/12/usr.sbin/powerd

2019-01-13 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Jan 13 02:19:01 2019
New Revision: 342981
URL: https://svnweb.freebsd.org/changeset/base/342981

Log:
  MFC r342810:
  powerd(8): allow to force a method of battery state query
  
  This change allows to determine power source via sysctl or /dev/apm
  when devd(8) is running (used by default).
  
  Based on patch from PR; other changes on top of it:
  - '-f' (force) -> '-s' (source) parameter renaming;
  - allow 'apm' -> 'devd' transition when '-s devd' is set
  (if APM is enabled);
  - man page update.
  
  PR:   125707
  Submitted by: Konstantin Stepanov 
  Reviewed by:  bcr, imp
  Differential Revision:https://reviews.freebsd.org/D18742

Modified:
  stable/12/usr.sbin/powerd/powerd.8
  stable/12/usr.sbin/powerd/powerd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/powerd/powerd.8
==
--- stable/12/usr.sbin/powerd/powerd.8  Sun Jan 13 00:38:55 2019
(r342980)
+++ stable/12/usr.sbin/powerd/powerd.8  Sun Jan 13 02:19:01 2019
(r342981)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 4, 2013
+.Dd January 13, 2019
 .Dt POWERD 8
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 .Op Fl p Ar ival
 .Op Fl P Ar pidfile
 .Op Fl r Ar percent
+.Op Fl s Ar source
 .Op Fl v
 .Sh DESCRIPTION
 The
@@ -117,6 +118,14 @@ The default is
 Specifies the CPU load percent level where adaptive
 mode should consider the CPU running and increase performance.
 The default is 75% or higher.
+.It Fl s Ar source
+Enforces method for AC line state refresh; by default, it is chosen
+automatically.
+The set of valid methods is
+.Cm sysctl , devd
+and
+.Cm apm
+(i386 only).
 .It Fl v
 Verbose mode.
 Messages about power changes will be printed to stdout and

Modified: stable/12/usr.sbin/powerd/powerd.c
==
--- stable/12/usr.sbin/powerd/powerd.c  Sun Jan 13 00:38:55 2019
(r342980)
+++ stable/12/usr.sbin/powerd/powerd.c  Sun Jan 13 02:19:01 2019
(r342981)
@@ -113,14 +113,16 @@ static intvflag;
 
 static volatile sig_atomic_t exit_requested;
 static power_src_t acline_status;
-static enum {
+typedef enum {
ac_none,
ac_sysctl,
ac_acpi_devd,
 #ifdef USE_APM
ac_apm,
 #endif
-} acline_mode;
+} acline_mode_t;
+static acline_mode_t acline_mode;
+static acline_mode_t acline_mode_user = ac_none;
 #ifdef USE_APM
 static int apm_fd = -1;
 #endif
@@ -286,21 +288,28 @@ get_freq_id(int freq, int *freqs, int numfreqs)
 static void
 acline_init(void)
 {
+   int skip_source_check;
+
acline_mib_len = 4;
acline_status = SRC_UNKNOWN;
+   skip_source_check = (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd);
 
-   if (sysctlnametomib(ACPIAC, acline_mib, &acline_mib_len) == 0) {
+   if ((skip_source_check || acline_mode_user == ac_sysctl) &&
+   sysctlnametomib(ACPIAC, acline_mib, &acline_mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
 #ifdef __powerpc__
-   } else if (sysctlnametomib(PMUAC, acline_mib, &acline_mib_len) == 0) {
+   } else if ((skip_source_check || acline_mode_user == ac_sysctl) &&
+  sysctlnametomib(PMUAC, acline_mib, &acline_mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
 #endif
 #ifdef USE_APM
-   } else if ((apm_fd = open(APMDEV, O_RDONLY)) >= 0) {
+   } else if ((skip_source_check || acline_mode_user == ac_apm) &&
+  (apm_fd = open(APMDEV, O_RDONLY)) >= 0) {
if (vflag)
warnx("using APM for AC line status");
acline_mode = ac_apm;
@@ -360,7 +369,17 @@ acline_read(void)
}
 #endif
/* try to (re)connect to devd */
-   if (acline_mode == ac_sysctl) {
+#ifdef USE_APM
+   if ((acline_mode == ac_sysctl &&
+   (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd)) ||
+   (acline_mode == ac_apm &&
+acline_mode_user == ac_acpi_devd)) {
+#else
+   if (acline_mode == ac_sysctl &&
+   (acline_mode_user == ac_none ||
+acline_mode_user == ac_acpi_devd)) {
+#endif
struct timeval now;
 
gettimeofday(&now, NULL);
@@ -426,6 +445,21 @@ parse_mode(char *arg, int *mode, int ch)
 }
 
 static void
+parse_acline_mode(char *arg, int ch)
+{
+   if (strcmp(arg, "sysctl") == 0)
+   acline_mode_user = ac_sysctl;
+   else if (strcmp(arg, "devd") == 0)
+   acline_mode_user = ac_acpi_devd;
+#ifdef USE_APM
+   else if (strcmp(arg, "apm") == 0)
+   acline_mode_user = ac_apm;
+#endif
+   else
+   errx(1, "bad op