svn commit: r368293 - head/sys/kern

2020-12-02 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Dec  3 05:39:27 2020
New Revision: 368293
URL: https://svnweb.freebsd.org/changeset/base/368293

Log:
  Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms
  
  hw.physmem tunable allows to limit number of physical memory available to the
  system. It's handled in machdep files for x86 and PowerPC. This patch adds
  required logic to the consolidated physmem management interface that is used 
by
  ARM, ARM64, and RISC-V.
  
  Submitted by: Klara, Inc.
  Reviewed by:  mhorne
  Sponsored by: Ampere Computing
  Differential Revision:https://reviews.freebsd.org/D27152

Modified:
  head/sys/kern/subr_physmem.c

Modified: head/sys/kern/subr_physmem.c
==
--- head/sys/kern/subr_physmem.cThu Dec  3 02:22:05 2020
(r368292)
+++ head/sys/kern/subr_physmem.cThu Dec  3 05:39:27 2020
(r368293)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -141,6 +142,10 @@ physmem_print_tables(void)
 /*
  * Walk the list of hardware regions, processing it against the list of
  * exclusions that contain the given exflags, and generating an "avail list".
+ * 
+ * If maxphyssz is not zero it sets upper limit, in bytes, for the total
+ * "avail list" size. Walk stops once the limit is reached and the last region
+ * is cut short if necessary.
  *
  * Updates the value at *pavail with the sum of all pages in all hw regions.
  *
@@ -148,15 +153,17 @@ physmem_print_tables(void)
  */
 static size_t
 regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail,
-long *pavail, long *prealmem)
+uint64_t maxphyssz, long *pavail, long *prealmem)
 {
size_t acnt, exi, hwi;
uint64_t end, start, xend, xstart;
long availmem, totalmem;
const struct region *exp, *hwp;
+   uint64_t availsz;
 
totalmem = 0;
availmem = 0;
+   availsz = 0;
acnt = 0;
for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) {
start = hwp->addr;
@@ -202,6 +209,13 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
 * could affect the remainder of this hw region.
 */
if ((xstart > start) && (xend < end)) {
+
+   if ((maxphyssz != 0) &&
+   (availsz + xstart - start > maxphyssz)) {
+   xstart = maxphyssz + start - availsz;
+   }
+   if (xstart <= start)
+   continue;
if (acnt > 0 &&
avail[acnt - 1] == (vm_paddr_t)start) {
avail[acnt - 1] = (vm_paddr_t)xstart;
@@ -209,6 +223,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
avail[acnt++] = (vm_paddr_t)start;
avail[acnt++] = (vm_paddr_t)xstart;
}
+   availsz += (xstart - start);
availmem += atop((vm_offset_t)(xstart - start));
start = xend;
continue;
@@ -228,12 +243,20 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, 
 * available entry for it.
 */
if (end > start) {
+   if ((maxphyssz != 0) &&
+   (availsz + end - start > maxphyssz)) {
+   end = maxphyssz + start - availsz;
+   }
+   if (end <= start)
+   break;
+
if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) {
avail[acnt - 1] = (vm_paddr_t)end;
} else {
avail[acnt++] = (vm_paddr_t)start;
avail[acnt++] = (vm_paddr_t)end;
}
+   availsz += end - start;
availmem += atop((vm_offset_t)(end - start));
}
if (acnt >= maxavail)
@@ -362,7 +385,7 @@ size_t
 physmem_avail(vm_paddr_t *avail, size_t maxavail)
 {
 
-   return (regions_to_avail(avail, EXFLAG_NOALLOC, maxavail, NULL, NULL));
+   return (regions_to_avail(avail, EXFLAG_NOALLOC, maxavail, 0, NULL, 
NULL));
 }
 
 /*
@@ -378,11 +401,15 @@ void
 physmem_init_kernel_globals(void)
 {
size_t nextidx;
+   u_long hwphyssz;
 
-   regions_to_avail(dump_avail, EXFLAG_NODUMP, PHYS_AVAIL_ENTRIES, NULL,
-   NULL);
+   hwphyssz = 0;
+   TUNABLE_ULONG_FETCH("hw.physmem", );
+
+   regions_to_avail(dump_avail, EXFLAG_NODUMP, 

svn commit: r368259 - head/sys/dev/acpica

2020-12-01 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Dec  1 20:27:06 2020
New Revision: 368259
URL: https://svnweb.freebsd.org/changeset/base/368259

Log:
  [arm64] Parse ACPI _PXM property on ARM64 platform
  
  Enable devices' NUMA proximity infromation parsing on ARM64 systems
  
  Sponsored by: Ampere Computing
  Submitted by: Klara, Inc.

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Tue Dec  1 20:10:55 2020(r368258)
+++ head/sys/dev/acpica/acpi.c  Tue Dec  1 20:27:06 2020(r368259)
@@ -1122,7 +1122,7 @@ static int
 acpi_parse_pxm(device_t dev)
 {
 #ifdef NUMA
-#if defined(__i386__) || defined(__amd64__)
+#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__)
ACPI_HANDLE handle;
ACPI_STATUS status;
int pxm;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r368258 - head/sys/arm64/include

2020-12-01 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Dec  1 20:10:55 2020
New Revision: 368258
URL: https://svnweb.freebsd.org/changeset/base/368258

Log:
  [arm64] Bump MAXMEMDOM value to 8 to match amd64
  
  On some of the server-grade ARM64 machines the number of NUMA domains is 
higher
  than 2. When booting GENERIC kernel on such machines the SRAT parser fails
  leaving the system with a single domain. To make GENERIC kernel usable on 
those
  server, match the parameter value with the one for amd64 arch.
  
  Reviewed by:  allanjude
  Differential Revision:https://reviews.freebsd.org/D27368
  Sponsored by: Ampere Computing
  Submitted by: Klara, Inc.

Modified:
  head/sys/arm64/include/param.h

Modified: head/sys/arm64/include/param.h
==
--- head/sys/arm64/include/param.h  Tue Dec  1 19:40:58 2020
(r368257)
+++ head/sys/arm64/include/param.h  Tue Dec  1 20:10:55 2020
(r368258)
@@ -63,7 +63,7 @@
 #endif
 
 #ifndef MAXMEMDOM
-#defineMAXMEMDOM   2
+#defineMAXMEMDOM   8
 #endif
 
 #defineALIGNBYTES  _ALIGNBYTES
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366924 - head/sys/arm64/include

2020-10-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Oct 22 05:07:25 2020
New Revision: 366924
URL: https://svnweb.freebsd.org/changeset/base/366924

Log:
  [hwpmc] Fix call chain capture for ARM64
  
  Use ELR register value instead of LR for PMC_TRAPFRAME_TO_PC macro since
  it's the former that indicates PC if the interrupted execution thread.
  
  This fixes a bug where pmcstat lost the leaf function of the call chain
  and started with the second function in the chain.
  
  Although this change is an improvement over the previous logic there is still
  posibility for incomplete data: if the leaf function does not have stack
  variables and does not call any other functions compiler would not generate
  a stack frame for it and the FP value would point to the caller's frame, so
  instead of the actual "caller1 -> caller2 -> leaf" chain only
  "caller1 -> leaf" would be captured.
  
  Sponsored by: Ampere Computing
  Submitted by: Klara, Inc.

Modified:
  head/sys/arm64/include/pmc_mdep.h

Modified: head/sys/arm64/include/pmc_mdep.h
==
--- head/sys/arm64/include/pmc_mdep.h   Thu Oct 22 04:49:14 2020
(r366923)
+++ head/sys/arm64/include/pmc_mdep.h   Thu Oct 22 05:07:25 2020
(r366924)
@@ -54,7 +54,7 @@ union pmc_md_pmc {
((S) >= (START) && (S) < (END))
 #definePMC_IN_KERNEL(va)   INKERNEL((va))
 #definePMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
-#definePMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_lr)
+#definePMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_elr)
 #definePMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_x[29])
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366923 - head/sys/crypto/armv8

2020-10-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Oct 22 04:49:14 2020
New Revision: 366923
URL: https://svnweb.freebsd.org/changeset/base/366923

Log:
  [armv8crypto] Fix cryptodev probe logic in armv8crypto
  
  Add missing break to prevent falling through to the default case statement
  and returning EINVAL for all session configs.
  
  Sponsored by: Ampere Computing
  Submitted by: Klara, Inc.

Modified:
  head/sys/crypto/armv8/armv8_crypto.c

Modified: head/sys/crypto/armv8/armv8_crypto.c
==
--- head/sys/crypto/armv8/armv8_crypto.cThu Oct 22 03:30:39 2020
(r366922)
+++ head/sys/crypto/armv8/armv8_crypto.cThu Oct 22 04:49:14 2020
(r366923)
@@ -207,6 +207,7 @@ armv8_crypto_probesession(device_t dev,
default:
return (EINVAL);
}
+   break;
default:
return (EINVAL);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364098 - head/sys/dev/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Li-Wen Hsu (lw...@freebsd.org) wrote:
> Author: lwhsu
> Date: Tue Aug 11 05:17:10 2020
> New Revision: 364098
> URL: https://svnweb.freebsd.org/changeset/base/364098
> 
> Log:
>   Fix armv{6,7} build after r364088
>   
>   Sponsored by:   The FreeBSD Foundation

I overlooked this change when it was committed. Thanks for fixing and
sorry for the breakage.

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


Re: svn commit: r353419 - head/sys/net

2020-09-03 Thread Oleksandr Tymoshenko
Gleb Smirnoff (gleb...@freebsd.org) wrote:
> On Fri, Aug 28, 2020 at 02:31:30PM -0700, Oleksandr Tymoshenko wrote:
> O> Gleb Smirnoff (gleb...@freebsd.org) wrote:
> O> > Author: glebius
> O> > Date: Thu Oct 10 23:42:55 2019
> O> > New Revision: 353419
> O> > URL: https://svnweb.freebsd.org/changeset/base/353419
> O> > 
> O> > Log:
> O> >   Provide new KPI for network drivers to access lists of interface
> O> >   addresses.  The KPI doesn't reveal neither how addresses are stored,
> O> >   how the access to them is synchronized, neither reveal struct ifaddr
> O> >   and struct ifmaddr.
> O> >   
> O> >   Reviewed by:   gallatin, erj, hselasky, philip, stevek
> O> >   Differential Revision: https://reviews.freebsd.org/D21943
> O> 
> O> Hi Gleb,
> O> 
> O> Are there any plans to MFC this change and the subsequent API consumer 
> changes?
> O> Lack of this API in 12 makes MFCing unrelated eth driver fixes hard.
> 
> I don't plan to MFC it, but there is nothing that would blocks such MFC.
> 
> Of course internals of the functions would be different - using mutex instead
> of the epoch to sync access to address lists.
> 
> I can provide patch for you, but you would be responsive for MFC. I don't
> have any 12-based systems to test changes.

I only need it for if_dwc, I don't plan to merge code for any other
drivers. I tested this patch[1] and there were no issues. Does it look
sane? Do I need to run specific steps to trigger codepaths with these
new API calls?

[1] https://people.freebsd.org/~gonzo/patches/if-foreach-mfc.diff
-- 
gonzo
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353419 - head/sys/net

2020-08-28 Thread Oleksandr Tymoshenko
Gleb Smirnoff (gleb...@freebsd.org) wrote:
> Author: glebius
> Date: Thu Oct 10 23:42:55 2019
> New Revision: 353419
> URL: https://svnweb.freebsd.org/changeset/base/353419
> 
> Log:
>   Provide new KPI for network drivers to access lists of interface
>   addresses.  The KPI doesn't reveal neither how addresses are stored,
>   how the access to them is synchronized, neither reveal struct ifaddr
>   and struct ifmaddr.
>   
>   Reviewed by:gallatin, erj, hselasky, philip, stevek
>   Differential Revision:  https://reviews.freebsd.org/D21943

Hi Gleb,

Are there any plans to MFC this change and the subsequent API consumer changes?
Lack of this API in 12 makes MFCing unrelated eth driver fixes hard.

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


Re: svn commit: r364222 - in head: lib/liblua libexec/flua

2020-08-13 Thread Oleksandr Tymoshenko
Ed Maste (ema...@freebsd.org) wrote:
> Author: emaste
> Date: Thu Aug 13 23:13:05 2020
> New Revision: 364222
> URL: https://svnweb.freebsd.org/changeset/base/364222
> 
> Log:
>   flua: support "require" for binary objects in the base system
>   
>   Export symbols from flua, and enable dlopen.
>   
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D26059
> 
> Modified:
>   head/lib/liblua/luaconf.h
>   head/libexec/flua/Makefile

Hi Ed,

This change breaks the build. flua segfaults when it is called during
libifconfig build.

Backtrace:

* thread #1, name = 'flua', stop reason = signal SIGSEGV
  * frame #0: 0x002e166c flua.full`__je_malloc_tsd_boot0 [inlined] 
tsd_fetch_impl(init=true, minimal=false) at tsd.h:265:6
frame #1: 0x002e166c flua.full`__je_malloc_tsd_boot0 [inlined] 
tsd_fetch at tsd.h:292
frame #2: 0x002e166c flua.full`__je_malloc_tsd_boot0 at 
jemalloc_tsd.c:266
frame #3: 0x002c30d5 flua.full`__malloc [inlined] malloc_init_hard 
at jemalloc_jemalloc.c:1527:8
frame #4: 0x002c30bd flua.full`__malloc [inlined] malloc_init at 
jemalloc_jemalloc.c:221
frame #5: 0x002c30bd flua.full`__malloc [inlined] 
imalloc(sopts=, dopts=) at jemalloc_jemalloc.c:1990
frame #6: 0x002c2d10 flua.full`__malloc(size=1560) at 
jemalloc_jemalloc.c:2042
frame #7: 0x0027e742 flua.full`lua_newstate(f=(flua.full`l_alloc at 
lauxlib.c:1008), ud=0x) at lstate.c:299:11
frame #8: 0x0027e0d2 flua.full`luaL_newstate at lauxlib.c:1027:18
frame #9: 0x0026d316 flua.full`main(argc=3, 
argv=0x7fffc458) at lua.c:598:18
frame #10: 0x0026d10f flua.full`_start(ap=, 
cleanup=) at crt1.c:76:7

Host build system: 12.1-RELEASE-p7
Target: arm64

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


svn commit: r364088 - in head/sys: arm64/rockchip dev/dwc

2020-08-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Aug 10 19:37:06 2020
New Revision: 364088
URL: https://svnweb.freebsd.org/changeset/base/364088

Log:
  Improve Rockchip's integration of if_dwc
  
  - Do not rely on U-Boot for clocks configuration, enable and set frequencies
  in the driver's attach method.
  - Adjust MAC settings according to detected linespeed on RK3399 and RK3328.
  - Add support for RMII PHY mode on RK3328.
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D26006

Modified:
  head/sys/arm64/rockchip/if_dwc_rk.c
  head/sys/dev/dwc/if_dwc.c
  head/sys/dev/dwc/if_dwc.h
  head/sys/dev/dwc/if_dwc_if.m
  head/sys/dev/dwc/if_dwcvar.h

Modified: head/sys/arm64/rockchip/if_dwc_rk.c
==
--- head/sys/arm64/rockchip/if_dwc_rk.c Mon Aug 10 18:26:18 2020
(r364087)
+++ head/sys/arm64/rockchip/if_dwc_rk.c Mon Aug 10 19:37:06 2020
(r364088)
@@ -23,7 +23,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- */
+*/
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -33,97 +33,350 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
-
 #include 
 
+#include "if_dwc_if.h"
 #include "syscon_if.h"
 
-#include "if_dwc_if.h"
-
 #defineRK3328_GRF_MAC_CON0 0x0900
-#define RK3328_GRF_MAC_CON0_TX_MASK0x7F
-#define RK3328_GRF_MAC_CON0_TX_SHIFT   0
-#define RK3328_GRF_MAC_CON0_RX_MASK0x7F
-#define RK3328_GRF_MAC_CON0_RX_SHIFT   7
+#define MAC_CON0_GMAC2IO_TX_DL_CFG_MASK0x7F
+#define MAC_CON0_GMAC2IO_TX_DL_CFG_SHIFT   0
+#define MAC_CON0_GMAC2IO_RX_DL_CFG_MASK0x7F
+#define MAC_CON0_GMAC2IO_RX_DL_CFG_SHIFT   7
 
 #defineRK3328_GRF_MAC_CON1 0x0904
-#define RK3328_GRF_MAC_CON1_RX_ENA (1 << 1)
-#define RK3328_GRF_MAC_CON1_TX_ENA (1 << 0)
+#define MAC_CON1_GMAC2IO_GMAC_TXCLK_DLY_ENA(1 << 0)
+#define MAC_CON1_GMAC2IO_GMAC_RXCLK_DLY_ENA(1 << 1)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_MASK (3 << 11)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_125  (0 << 11)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_25   (3 << 11)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_2_5  (2 << 11)
+#define MAC_CON1_GMAC2IO_RMII_MODE_MASK(1 << 9)
+#define MAC_CON1_GMAC2IO_RMII_MODE (1 << 9)
+#define MAC_CON1_GMAC2IO_INTF_SEL_MASK (7 << 4)
+#define MAC_CON1_GMAC2IO_INTF_RMII (4 << 4)
+#define MAC_CON1_GMAC2IO_INTF_RGMII(1 << 4)
+#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_MASK (1 << 7)
+#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_25   (1 << 7)
+#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_2_5  (0 << 7)
+#define MAC_CON1_GMAC2IO_MAC_SPEED_MASK(1 << 2)
+#define MAC_CON1_GMAC2IO_MAC_SPEED_100 (1 << 2)
+#define MAC_CON1_GMAC2IO_MAC_SPEED_10  (0 << 2)
 #defineRK3328_GRF_MAC_CON2 0x0908
 #defineRK3328_GRF_MACPHY_CON0  0x0B00
+#define MACPHY_CON0_CLK_50M_MASK   (1 << 14)
+#define MACPHY_CON0_CLK_50M(1 << 14)
+#define MACPHY_CON0_RMII_MODE_MASK (3 << 6)
+#define MACPHY_CON0_RMII_MODE  (1 << 6)
 #defineRK3328_GRF_MACPHY_CON1  0x0B04
+#define MACPHY_CON1_RMII_MODE_MASK (1 << 9)
+#define MACPHY_CON1_RMII_MODE  (1 << 9)
 #defineRK3328_GRF_MACPHY_CON2  0x0B08
 #defineRK3328_GRF_MACPHY_CON3  0x0B0C
 #defineRK3328_GRF_MACPHY_STATUS0x0B10
 
+#defineRK3399_GRF_SOC_CON5 0xc214
+#define SOC_CON5_GMAC_CLK_SEL_MASK (3 << 4)
+#define SOC_CON5_GMAC_CLK_SEL_125  (0 << 4)
+#define SOC_CON5_GMAC_CLK_SEL_25   (3 << 4)
+#define SOC_CON5_GMAC_CLK_SEL_2_5  (2 << 4)
+#defineRK3399_GRF_SOC_CON6 0xc218
+#define SOC_CON6_GMAC_TXCLK_DLY_ENA(1 << 7)
+#define SOC_CON6_TX_DL_CFG_MASK0x7F
+#define SOC_CON6_TX_DL_CFG_SHIFT   0
+#define SOC_CON6_RX_DL_CFG_MASK0x7F
+#define SOC_CON6_GMAC_RXCLK_DLY_ENA(1 << 15)
+#define SOC_CON6_RX_DL_CFG_SHIFT   8
+
+struct if_dwc_rk_softc;
+
+typedef void (*if_dwc_rk_set_delaysfn_t)(struct if_dwc_rk_softc *);
+typedef int (*if_dwc_rk_set_speedfn_t)(struct if_dwc_rk_softc *, int);
+typedef void (*if_dwc_rk_set_phy_modefn_t)(struct if_dwc_rk_softc *);
+typedef void 

svn commit: r363927 - head/sys/arm64/rockchip/clk

2020-08-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Aug  5 18:22:24 2020
New Revision: 363927
URL: https://svnweb.freebsd.org/changeset/base/363927

Log:
  Add clocks for ethernet controllers on RK3328
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D25918

Modified:
  head/sys/arm64/rockchip/clk/rk3328_cru.c

Modified: head/sys/arm64/rockchip/clk/rk3328_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3328_cru.cWed Aug  5 18:21:22 2020
(r363926)
+++ head/sys/arm64/rockchip/clk/rk3328_cru.cWed Aug  5 18:22:24 2020
(r363927)
@@ -49,10 +49,31 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+/* Registers */
+#defineRK3328_GRF_SOC_CON4 0x410
+#defineRK3328_GRF_MAC_CON1 0x904
+#defineRK3328_GRF_MAC_CON2 0x908
+
 /* GATES */
 
+#defineSCLK_MAC2PHY_RXTX   83
+#defineSCLK_MAC2PHY_SRC84
+#defineSCLK_MAC2PHY_REF85
+#defineSCLK_MAC2PHY_OUT86
+#defineSCLK_MAC2IO_RX  87
+#defineSCLK_MAC2IO_TX  88
+#defineSCLK_MAC2IO_REFOUT  89
+#defineSCLK_MAC2IO_REF 90
+#defineSCLK_MAC2IO_OUT 91
 #defineSCLK_USB3OTG_REF96
+#defineSCLK_MAC2IO_SRC 99
+#defineSCLK_MAC2IO 100
+#defineSCLK_MAC2PHY101
+#defineSCLK_MAC2IO_EXT 102
 #defineACLK_USB3OTG132
+#define ACLK_GMAC  146
+#define ACLK_MAC2PHY   149
+#define ACLK_MAC2IO150
 #defineACLK_PERI   153
 #definePCLK_GPIO0  200
 #definePCLK_GPIO1  201
@@ -63,6 +84,9 @@ __FBSDID("$FreeBSD$");
 #definePCLK_I2C2   207
 #definePCLK_I2C3   208
 #definePCLK_TSADC  213
+#define PCLK_GMAC  220
+#define PCLK_MAC2PHY   222
+#define PCLK_MAC2IO223
 #definePCLK_USB3PHY_OTG224
 #definePCLK_USB3PHY_PIPE   225
 #definePCLK_USB3_GRF   226
@@ -87,6 +111,14 @@ static struct rk_cru_gate rk3328_gates[] = {
CRU_GATE(0, "pclk_bus", "pclk_bus_pre", 0x220, 3)
CRU_GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0x220, 4)
 
+   /* CRU_CLKGATE_CON8 */
+   CRU_GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0x224, 7)
+   CRU_GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0x224, 
6)
+   CRU_GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0x224, 5)
+   CRU_GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0x224, 4)
+   CRU_GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0x224, 3)
+   CRU_GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0x224, 1)
+
/* CRU_CLKGATE_CON10 */
CRU_GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", 0x228, 0)
 
@@ -116,6 +148,12 @@ static struct rk_cru_gate rk3328_gates[] = {
CRU_GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0x24C, 14)
CRU_GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0x24C, 15)
 
+   /* CRU_CLKGATE_CON26 */
+   CRU_GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0x268, 0)
+   CRU_GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0x268, 1)
+   CRU_GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0x268, 2)
+   CRU_GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0x268, 3)
+
/* CRU_CLKGATE_CON28 */
CRU_GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0x270, 1)
CRU_GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0x270, 
2)
@@ -1077,6 +1115,210 @@ static struct rk_clk_composite_def ref_usb3otg_src = {
.flags = RK_CLK_COMPOSITE_HAVE_GATE,
 };
 
+static const char *mac2io_src_parents[] = { "cpll", "gpll" };
+
+static struct rk_clk_composite_def mac2io_src = {
+   .clkdef = {
+   .id = SCLK_MAC2IO_SRC,
+   .name = "clk_mac2io_src",
+   .parent_names = mac2io_src_parents,
+   .parent_cnt = nitems(mac2io_src_parents),
+   },
+   /* CRU_CLKSEL_CON27 */
+   .muxdiv_offset = 0x16c,
+
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 5,
+
+   /* CRU_CLKGATE_CON3 */
+   .gate_offset = 0x20c,
+   .gate_shift = 1,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_GATE | RK_CLK_COMPOSITE_HAVE_MUX,
+};
+
+static const char *mac2io_out_parents[] = { "cpll", "gpll" };
+
+static struct rk_clk_composite_def mac2io_out = {
+   .clkdef = {
+   .id = SCLK_MAC2IO_OUT,
+   .name = "clk_mac2io_out",
+   .parent_names = mac2io_out_parents,
+   .parent_cnt = nitems(mac2io_out_parents),
+   },
+   /* CRU_CLKSEL_CON27 */
+   .muxdiv_offset = 0x16c,
+
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 5,
+
+   /* 

svn commit: r363926 - head/sys/arm64/rockchip/clk

2020-08-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Aug  5 18:21:22 2020
New Revision: 363926
URL: https://svnweb.freebsd.org/changeset/base/363926

Log:
  Add flag for SYSCON-controlled clocks on Rockhip platform
  
  Ethernet clocks on RK3328 are controlled by SYSCON registers, so add
  RK_CLK_COMPOSITE_GRF flag to indicate that clock node should access grf
  registers instead of CRU's
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D25918

Modified:
  head/sys/arm64/rockchip/clk/rk_clk_composite.c
  head/sys/arm64/rockchip/clk/rk_clk_composite.h

Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c
==
--- head/sys/arm64/rockchip/clk/rk_clk_composite.c  Wed Aug  5 17:26:20 
2020(r363925)
+++ head/sys/arm64/rockchip/clk/rk_clk_composite.c  Wed Aug  5 18:21:22 
2020(r363926)
@@ -35,10 +35,12 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 
 #include "clkdev_if.h"
+#include "syscon_if.h"
 
 struct rk_clk_composite_sc {
uint32_tmuxdiv_offset;
@@ -54,12 +56,14 @@ struct rk_clk_composite_sc {
uint32_tgate_shift;
 
uint32_tflags;
+
+   struct syscon   *grf;
 };
 
 #defineWRITE4(_clk, off, val)  
\
-   CLKDEV_WRITE_4(clknode_get_device(_clk), off, val)
+   rk_clk_composite_write_4(_clk, off, val)
 #defineREAD4(_clk, off, val)   
\
-   CLKDEV_READ_4(clknode_get_device(_clk), off, val)
+   rk_clk_composite_read_4(_clk, off, val)
 #defineDEVICE_LOCK(_clk)   
\
CLKDEV_DEVICE_LOCK(clknode_get_device(_clk))
 #defineDEVICE_UNLOCK(_clk) 
\
@@ -74,6 +78,49 @@ struct rk_clk_composite_sc {
 #definedprintf(format, arg...)
 #endif
 
+static void
+rk_clk_composite_read_4(struct clknode *clk, bus_addr_t addr, uint32_t *val)
+{
+   struct rk_clk_composite_sc *sc;
+
+   sc = clknode_get_softc(clk);
+   if (sc->grf)
+   *val = SYSCON_READ_4(sc->grf, addr);
+   else
+   CLKDEV_READ_4(clknode_get_device(clk), addr, val);
+}
+
+static void
+rk_clk_composite_write_4(struct clknode *clk, bus_addr_t addr, uint32_t val)
+{
+   struct rk_clk_composite_sc *sc;
+
+   sc = clknode_get_softc(clk);
+   if (sc->grf)
+   SYSCON_WRITE_4(sc->grf, addr, val | (0x << 16));
+   else
+   CLKDEV_WRITE_4(clknode_get_device(clk), addr, val);
+}
+
+static struct syscon *
+rk_clk_composite_get_grf(struct clknode *clk)
+{
+   device_t dev;
+   phandle_t node;
+   struct syscon *grf;
+
+   grf = NULL;
+   dev = clknode_get_device(clk);
+   node = ofw_bus_get_node(dev);
+   if (OF_hasprop(node, "rockchip,grf") &&
+   syscon_get_by_ofw_property(dev, node,
+   "rockchip,grf", ) != 0) {
+   return (NULL);
+}
+
+   return (grf);
+}
+
 static int
 rk_clk_composite_init(struct clknode *clk, device_t dev)
 {
@@ -81,6 +128,12 @@ rk_clk_composite_init(struct clknode *clk, device_t de
uint32_t val, idx;
 
sc = clknode_get_softc(clk);
+   if ((sc->flags & RK_CLK_COMPOSITE_GRF) != 0) {
+   sc->grf = rk_clk_composite_get_grf(clk);
+   if (sc->grf == NULL)
+   panic("clock %s has GRF flag set but no syscon is 
available",
+   clknode_get_name(clk));
+   }
 
idx = 0;
if ((sc->flags & RK_CLK_COMPOSITE_HAVE_MUX) != 0) {

Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.h
==
--- head/sys/arm64/rockchip/clk/rk_clk_composite.h  Wed Aug  5 17:26:20 
2020(r363925)
+++ head/sys/arm64/rockchip/clk/rk_clk_composite.h  Wed Aug  5 18:21:22 
2020(r363926)
@@ -53,6 +53,7 @@ struct rk_clk_composite_def {
 #defineRK_CLK_COMPOSITE_HAVE_GATE  0x0002
 #defineRK_CLK_COMPOSITE_DIV_EXP0x0004  /* Register   0, 1, 2, 
2, ... */
/* Divider1, 2, 4, 8, ... */
+#defineRK_CLK_COMPOSITE_GRF0x0008 /* Use syscon registers 
instead of CRU's */
 int rk_clk_composite_register(struct clkdom *clkdom,
 struct rk_clk_composite_def *clkdef);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363187 - head/release/tools

2020-07-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jul 14 18:02:24 2020
New Revision: 363187
URL: https://svnweb.freebsd.org/changeset/base/363187

Log:
  Enable EFI system partition on amd64 and i386 VM images
  
  EFI support is a hard requirement for generating Hyper-V Gen2 VM images.
  
  Reviewed by:  gjb
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25655

Modified:
  head/release/tools/vmimage.subr

Modified: head/release/tools/vmimage.subr
==
--- head/release/tools/vmimage.subr Tue Jul 14 17:46:40 2020
(r363186)
+++ head/release/tools/vmimage.subr Tue Jul 14 18:02:24 2020
(r363187)
@@ -24,12 +24,17 @@ write_partition_layout() {
 
case "${TARGET}:${TARGET_ARCH}" in
amd64:amd64 | i386:i386)
+   # Create an ESP
+   espfilename=$(mktemp /tmp/efiboot.XX)
+   make_esp_file ${espfilename} ${fat32min} 
${BOOTFILES}/efi/loader_lua/loader_lua.efi
mkimg -s gpt -f ${VMFORMAT} \
-b ${BOOTFILES}/i386/pmbr/pmbr \
-p 
freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot \
+   -p efi:=${espfilename} \
${SWAPOPT} \
-p freebsd-ufs/rootfs:=${VMBASE} \
-o ${VMIMAGE}
+   rm ${espfilename}
;;
arm64:aarch64)
# Create an ESP
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363140 - head/usr.bin/mkimg

2020-07-12 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jul 13 02:24:31 2020
New Revision: 363140
URL: https://svnweb.freebsd.org/changeset/base/363140

Log:
  Fix invalid VHDX generation for image larger than 4Gb
  
  - Part of BAT payload location was lost due to invalid
  BAT entry encoding type (32 bits instead of 64 bits)
  - The sequence of PB/SB entries in BAT was broken due to
  off-by-one index check. It worked for smaller than
  4Gb because there were no SB entries in BAT.
  
  MFC after:1 day

Modified:
  head/usr.bin/mkimg/vhdx.c

Modified: head/usr.bin/mkimg/vhdx.c
==
--- head/usr.bin/mkimg/vhdx.c   Mon Jul 13 02:09:21 2020(r363139)
+++ head/usr.bin/mkimg/vhdx.c   Mon Jul 13 02:24:31 2020(r363140)
@@ -429,7 +429,7 @@ vhdx_write_bat(int fd, uint64_t image_size)
payload_offset = 3 + (bat_size / SIZE_1MB);
bat_ptr = 0;
for (idx = 0; idx < data_block_count; idx++) {
-   le32enc(bat + bat_ptr,
+   le64enc(bat + bat_ptr,
BAT_ENTRY(payload_offset, PAYLOAD_BLOCK_FULLY_PRESENT));
bat_ptr += 8;
payload_offset += (PAYLOAD_BLOCK_SIZE / SIZE_1MB);
@@ -445,9 +445,9 @@ vhdx_write_bat(int fd, uint64_t image_size)
bat_ptr = 0;
}
 
-   if ((idx % chunk_ratio) == 0 &&
-   (idx > 0) && (idx != data_block_count - 1)) {
-   le32enc(bat + bat_ptr,
+   if (((idx + 1) % chunk_ratio) == 0 &&
+   (idx != data_block_count - 1)) {
+   le64enc(bat + bat_ptr,
BAT_ENTRY(0, SB_BLOCK_NOT_PRESENT));
bat_ptr += 8;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362736 - head/sys/arm64/rockchip

2020-07-06 Thread Oleksandr Tymoshenko
Peter Jeremy (pe...@rulingia.com) wrote:
> On 2020-Jul-02 17:26:23 -0700, Oleksandr Tymoshenko  wrote:
> >Could you try kernel with this patch? It's mostly debug output,
> >with one possible clock-related fix.
> >
> >https://people.freebsd.org/~gonzo/patches/rk3328-gmac-debug.patch
> 
> It's still not working for me.  I get the following:
> dwc0:  mem 0xff54-0xff54 irq 44 
> on ofwbus0
> setting RK3328 RX/TX delays:  24/36
> >>> RK3328_GRF_MAC_CON1 (0413):
> >>> gmac2io_gmii_clk_sel: 0x0
> >>> gmac2io_rmii_extclk_sel: 0x1
> >>> gmac2io_rmii_mode: 0x0
> >>> gmac2io_rmii_clk_sel: 0x0
> >>> gmac2io_phy_intf_sel: 0x1
> >>> gmac2io_flowctrl: 0x0
> >>> gmac2io_rxclk_dly_ena: 0x1
> >>> gmac2io_txclk_dly_ena: 0x1
> >>> RK3328_GRF_MAC_CON0 (0c24):
> miibus0:  on dwc0
> rgephy0:  PHY 0 on miibus0
> rgephy0: OUI 0x00e04c, model 0x0011, rev. 6
> rgephy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 
> 1000baseT-FDX, 1000baseT-FDX-master, auto

Thanks for running the test. Register values seem OK :(
 
> >I have Rock64 v2, which, as you mentioned, has a known issue with GigE, so
> >my tests are not reliable. I'll try to get another RK3328 board for tests,
> >but it may take some time.
> 
> I've asked on -arm if anyone else has tried this on a Rock64 v2 or v3.
> 
> >If the clock fix doesn't help, I'll make
> >delays configuration run-time configurable with off by default until
> >more hardware is tested.
> 
> That sounds like a good way forward - maybe boot and run-time configurable.
> It's a pity that there doesn't seem to be any documentation on what the
> numbers represent (or what the "default" value is) - which means that
> actually adjusting the delay numbers would be very time consuming.

There are no "default" values AFAIK. They depend on the board schematics.
I was told that Rockhip partners use some kind of proprietary tool
which they feed with values based on the scematics (like trace lengths)
and tool calculates delays.

With boot-time or run-time configuration I think it's possible to
automate the search for good value. Something like this:
https://github.com/ayufan-rock64/linux-build/blob/master/recipes/gmac-delays-test/range-test

but with loader.conf modifications instead of DTB

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


Re: svn commit: r362736 - head/sys/arm64/rockchip

2020-07-02 Thread Oleksandr Tymoshenko
Peter Jeremy (pe...@rulingia.com) wrote:
> On 2020-Jul-01 18:57:47 +1000, Peter Jeremy  wrote:
> >On 2020-Jun-28 21:11:10 +, Oleksandr Tymoshenko  
> >wrote:
> >>Log:
> >>  Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC
> >>  
> >>  For 1000Mb mode to work reliably TX/RX delays need to be configured
> >>  between the TX/RX clock and the respective signals on the PHY
> >>  to compensate for differing trace lengths on the PCB.
> >
> >This breaks (at least) diskless booting on my Rock64.
> 
> I've studied the RK3328 TRM[1] and the RK3328 code following r362736
> matches[2] the GRF_MAC_CON0/1 documentation on p201-203 (though p574
> says the delay line is configured via GRF_SOC_CON3 - which doesn't
> match the documentation on GRF_SOC_CON3 on p175-177).  That suggests
> that the delay values in the FDT are incorrect.  Unfortunately, the
> TRM doesn't include any details on how to configure the delay values
> so it's difficult to adjust the numbers in the FDT.
> 
> One possible explanation I have is that there are (at least) 2
> different Rock64 variants.  Later versions have increased the RGMII
> bus voltage to improve GigE reliability.  I initially had problems
> with GigE reliability and mod'd my Rock64[3] to use the higher RGMII
> bus voltage - which made it rock solid at GigE.  It's possible that
> different variants need different delay values, due to different track
> skew or different driver behaviour at different bus voltages.
> 
> [1] Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf
> [2] There's one typo: RK3328_GRF_MAC_CON0_TX_MASK instead of
> RK3328_GRF_MAC_CON0_RX_MASK but the values are the same).
> [3] Move 1 resistor to change a pull-up to a pull-down

Hi Peter,

Could you try kernel with this patch? It's mostly debug output,
with one possible clock-related fix.

https://people.freebsd.org/~gonzo/patches/rk3328-gmac-debug.patch

I have Rock64 v2, which, as you mentioned, has a known issue with GigE, so
my tests are not reliable. I'll try to get another RK3328 board for tests,
but it may take some time. If the clock fix doesn't help, I'll make
delays configuration run-time configurable with off by default until
more hardware is tested.

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


svn commit: r362817 - in head/sys: arm/freescale/imx arm64/conf arm64/freescale arm64/freescale/imx arm64/freescale/imx/clk conf dev/ffec dev/uart modules/dtb/imx8

2020-06-30 Thread Oleksandr Tymoshenko
 best_pre_div = pre_div;
+   best_post_div = pre_div;
+   best_parent = p_idx;
+   dprintf("Best parent so far %s (%d) with best freq at "
+   "%ju\n", clknode_get_name(p_clk), p_idx, best);
+   }
+   }
+
+   *stop = 1;
+   if (best_diff == INT64_MAX)
+   return (ERANGE);
+
+   if ((flags & CLK_SET_DRYRUN) != 0) {
+   *fout = best;
+   return (0);
+   }
+
+   p_idx = clknode_get_parent_idx(clk);
+   if (p_idx != best_parent) {
+   dprintf("Switching parent index from %d to %d\n", p_idx,
+   best_parent);
+   clknode_set_parent_by_idx(clk, best_parent);
+   }
+
+   dprintf("Setting dividers to pre=%d, post=%d\n", best_pre_div, 
best_post_div);
+
+   DEVICE_LOCK(clk);
+   READ4(clk, sc->offset, );
+   val &= ~(TARGET_ROOT_PRE_PODF_MASK | TARGET_ROOT_POST_PODF_MASK);
+   val |= TARGET_ROOT_PRE_PODF(pre_div);
+   val |= TARGET_ROOT_POST_PODF(post_div);
+   DEVICE_UNLOCK(clk);
+
+   *fout = best;
+   return (0);
+}
+
+static clknode_method_t imx_clk_composite_clknode_methods[] = {
+   /* Device interface */
+   CLKNODEMETHOD(clknode_init, imx_clk_composite_init),
+   CLKNODEMETHOD(clknode_set_gate, imx_clk_composite_set_gate),
+   CLKNODEMETHOD(clknode_set_mux,  imx_clk_composite_set_mux),
+   CLKNODEMETHOD(clknode_recalc_freq,  imx_clk_composite_recalc),
+   CLKNODEMETHOD(clknode_set_freq, imx_clk_composite_set_freq),
+   CLKNODEMETHOD_END
+};
+
+DEFINE_CLASS_1(imx_clk_composite_clknode, imx_clk_composite_clknode_class,
+imx_clk_composite_clknode_methods, sizeof(struct imx_clk_composite_sc),
+clknode_class);
+
+int
+imx_clk_composite_register(struct clkdom *clkdom,
+struct imx_clk_composite_def *clkdef)
+{
+   struct clknode *clk;
+   struct imx_clk_composite_sc *sc;
+
+   clk = clknode_create(clkdom, _clk_composite_clknode_class,
+   >clkdef);
+   if (clk == NULL)
+   return (1);
+
+   sc = clknode_get_softc(clk);
+
+   sc->offset = clkdef->offset;
+   sc->flags = clkdef->flags;
+
+   clknode_register(clkdom, clk);
+
+   return (0);
+}

Added: head/sys/arm64/freescale/imx/clk/imx_clk_composite.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/freescale/imx/clk/imx_clk_composite.hWed Jul  1 
00:33:16 2020(r362817)
@@ -0,0 +1,45 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright 2018 Emmanuel Vadot 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _IMX_CLK_COMPOSITE_H_
+#define _IMX_CLK_COMPOSITE_H_
+
+#include 
+
+struct imx_clk_composite_def {
+   struct clknode_init_def clkdef;
+
+   uint32_toffset;
+   uint32_tflags;
+};
+
+int imx_clk_composite_register(struct clkdom *clkdom,
+struct imx_clk_composite_def *clkdef);
+
+#endif /* _IMX_CLK_COMPOSITE_H_ */

Added: head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.c Wed Jul  1 00:33:16 
2020(r362817)
@@ -0,0 +1,177 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 Oleksandr Tymoshenko 
+ *
+ * Redistribution and use in s

svn commit: r362736 - head/sys/arm64/rockchip

2020-06-28 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jun 28 21:11:10 2020
New Revision: 362736
URL: https://svnweb.freebsd.org/changeset/base/362736

Log:
  Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC
  
  For 1000Mb mode to work reliably TX/RX delays need to be configured
  between the TX/RX clock and the respective signals on the PHY
  to compensate for differing trace lengths on the PCB.
  
  Reviewed by:  manu
  MFC after:1 week

Modified:
  head/sys/arm64/rockchip/if_dwc_rk.c

Modified: head/sys/arm64/rockchip/if_dwc_rk.c
==
--- head/sys/arm64/rockchip/if_dwc_rk.c Sun Jun 28 18:56:32 2020
(r362735)
+++ head/sys/arm64/rockchip/if_dwc_rk.c Sun Jun 28 21:11:10 2020
(r362736)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #define RK3328_GRF_MAC_CON0_RX_SHIFT   7
 
 #defineRK3328_GRF_MAC_CON1 0x0904
+#define RK3328_GRF_MAC_CON1_RX_ENA (1 << 1)
+#define RK3328_GRF_MAC_CON1_TX_ENA (1 << 0)
 #defineRK3328_GRF_MAC_CON2 0x0908
 #defineRK3328_GRF_MACPHY_CON0  0x0B00
 #defineRK3328_GRF_MACPHY_CON1  0x0B04
@@ -71,7 +73,6 @@ static struct ofw_compat_data compat_data[] = {
{NULL,   0}
 };
 
-#ifdef notyet
 static void
 rk3328_set_delays(struct syscon *grf, phandle_t node)
 {
@@ -82,22 +83,26 @@ rk3328_set_delays(struct syscon *grf, phandle_t node)
if (OF_getencprop(node, "rx_delay", , sizeof(rx)) <= 0)
rx = 0x10;
 
+   if (bootverbose)
+   printf("setting RK3328 RX/TX delays:  %d/%d\n", rx, tx);
tx = ((tx & RK3328_GRF_MAC_CON0_TX_MASK) <<
RK3328_GRF_MAC_CON0_TX_SHIFT);
rx = ((rx & RK3328_GRF_MAC_CON0_TX_MASK) <<
RK3328_GRF_MAC_CON0_RX_SHIFT);
 
SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON0, tx | rx | 0x);
+   SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON1, RK3328_GRF_MAC_CON1_TX_ENA | 
RK3328_GRF_MAC_CON1_RX_ENA | 
+   ((RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA) << 16));
 }
-#endif
 
 #defineRK3399_GRF_SOC_CON6 0xc218
+#define RK3399_GRF_SOC_CON6_TX_ENA (1 << 7)
 #define RK3399_GRF_SOC_CON6_TX_MASK0x7F
 #define RK3399_GRF_SOC_CON6_TX_SHIFT   0
 #define RK3399_GRF_SOC_CON6_RX_MASK0x7F
+#define RK3399_GRF_SOC_CON6_RX_ENA (1 << 15)
 #define RK3399_GRF_SOC_CON6_RX_SHIFT   8
 
-#ifdef notyet
 static void
 rk3399_set_delays(struct syscon *grf, phandle_t node)
 {
@@ -108,14 +113,15 @@ rk3399_set_delays(struct syscon *grf, phandle_t node)
if (OF_getencprop(node, "rx_delay", , sizeof(rx)) <= 0)
rx = 0x10;
 
+   if (bootverbose)
+   printf("setting RK3399 RX/TX delays:  %d/%d\n", rx, tx);
tx = ((tx & RK3399_GRF_SOC_CON6_TX_MASK) <<
-   RK3399_GRF_SOC_CON6_TX_SHIFT);
+   RK3399_GRF_SOC_CON6_TX_SHIFT) | RK3399_GRF_SOC_CON6_TX_ENA;
rx = ((rx & RK3399_GRF_SOC_CON6_TX_MASK) <<
-   RK3399_GRF_SOC_CON6_RX_SHIFT);
+   RK3399_GRF_SOC_CON6_RX_SHIFT) | RK3399_GRF_SOC_CON6_RX_ENA;
 
SYSCON_WRITE_4(grf, RK3399_GRF_SOC_CON6, tx | rx | 0x);
 }
-#endif
 
 static int
 if_dwc_rk_probe(device_t dev)
@@ -144,12 +150,10 @@ if_dwc_rk_init(device_t dev)
return (ENXIO);
}
 
-#ifdef notyet
if (ofw_bus_is_compatible(dev, "rockchip,rk3399-gmac"))
rk3399_set_delays(grf, node);
else if (ofw_bus_is_compatible(dev, "rockchip,rk3328-gmac"))
rk3328_set_delays(grf, node);
-#endif
 
/* Mode should be set according to dtb property */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362516 - head/contrib/ldns/drill

2020-06-22 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jun 22 23:13:14 2020
New Revision: 362516
URL: https://svnweb.freebsd.org/changeset/base/362516

Log:
  Fix crash in drill(1) when IP has two subsequent dots
  
  Cherry-pick crash fix from the upstream repo
  
  PR:   226575
  Reported by:  Goran Mekić 
  Obtained from:https://git.nlnetlabs.nl/ldns/commit/?id=98291475
  MFC after:2 weeks

Modified:
  head/contrib/ldns/drill/drill.c

Modified: head/contrib/ldns/drill/drill.c
==
--- head/contrib/ldns/drill/drill.c Mon Jun 22 22:59:03 2020
(r362515)
+++ head/contrib/ldns/drill/drill.c Mon Jun 22 23:13:14 2020
(r362516)
@@ -787,15 +787,17 @@ main(int argc, char *argv[])
qname = ldns_dname_new_frm_str(ip6_arpa_str);
} else {
qname = ldns_dname_new_frm_str(name);
-   qname_tmp = ldns_dname_reverse(qname);
-   ldns_rdf_deep_free(qname);
-   qname = qname_tmp;
-   qname_tmp = 
ldns_dname_new_frm_str("in-addr.arpa.");
-   status = ldns_dname_cat(qname, qname_tmp);
-   if (status != LDNS_STATUS_OK) {
-   error("%s", "could not create reverse 
address for ip4: %s\n", ldns_get_errorstr_by_id(status));
+   if (qname) {
+   qname_tmp = ldns_dname_reverse(qname);
+   ldns_rdf_deep_free(qname);
+   qname = qname_tmp;
+   qname_tmp = 
ldns_dname_new_frm_str("in-addr.arpa.");
+   status = ldns_dname_cat(qname, 
qname_tmp);
+   if (status != LDNS_STATUS_OK) {
+   error("%s", "could not create 
reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status));
+   }
+   ldns_rdf_deep_free(qname_tmp);
}
-   ldns_rdf_deep_free(qname_tmp);
}
if (!qname) {
error("%s", "-x implies an ip address");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362029 - head/sys/dev/hdmi

2020-06-11 Thread Oleksandr Tymoshenko
Rodney W. Grimes (free...@gndrsh.dnsmgr.net) wrote:
> > Author: gonzo
> > Date: Wed Jun 10 21:38:35 2020
> > New Revision: 362029
> > URL: https://svnweb.freebsd.org/changeset/base/362029
> > 
> > Log:
> >   Fix reading EDID on TVs/monitors without E-DCC support
> >   
> >   Writing segment id to I2C device 0x30 only required if the segment is
> >   non-zero. On the devices without E-DCC support writing to that address
> >   fails and whole transaction then fails too. To avoid this do
> >   not attempt write to the segment selection device unless required.
> >   
> >   MFC after:2 weeks
> 
> Is it possible that this bad write is what has caused me to corrupt
> the EDID of 3 monitors over the last year while using a Display
> Port to HDMI cable on them?

Very unlikely. This write just sets segment index for the following
EDID read. 

Also the driver is used only on iMX6 and MIPS Creator CI20.

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


svn commit: r362030 - head/sys/arm/freescale/imx

2020-06-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun 10 22:00:31 2020
New Revision: 362030
URL: https://svnweb.freebsd.org/changeset/base/362030

Log:
  Add mode selection to iMX6 IPU driver
  
  - Configure ipu1_di0 tob e sourced from the VIDEO_PLL(PLL5) and hardcode
frequency to (45500/3)Mhz. This value, further divided, can yield
frequencies close enough to support 1080p, 720p, 1024x768, and 640x480
modes. This is not ideal but it's an improvement comparing to the only
hardcoded 1024x768 mode.
  
  - Fix memory leaks if attach method failed
  - Print EDID when -v passed to the kernel

Modified:
  head/sys/arm/freescale/imx/imx6_ccm.c
  head/sys/arm/freescale/imx/imx6_ccmreg.h
  head/sys/arm/freescale/imx/imx6_ipu.c
  head/sys/arm/freescale/imx/imx_ccmvar.h

Modified: head/sys/arm/freescale/imx/imx6_ccm.c
==
--- head/sys/arm/freescale/imx/imx6_ccm.c   Wed Jun 10 21:38:35 2020
(r362029)
+++ head/sys/arm/freescale/imx/imx6_ccm.c   Wed Jun 10 22:00:31 2020
(r362030)
@@ -393,6 +393,53 @@ imx_ccm_ahb_hz(void)
return (13200);
 }
 
+int
+imx_ccm_pll_video_enable(void)
+{
+   uint32_t reg;
+   int timeout;
+
+   /* Power down PLL */
+   reg = RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO);
+   reg &= ~CCM_ANALOG_PLL_VIDEO_POWERDOWN;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   /*
+* Fvideo = Fref * (37 + 11/12) / 2
+* Fref = 24MHz, Fvideo = 455MHz
+*/
+   reg &= ~CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK;
+   reg |= CCM_ANALOG_PLL_VIDEO_POST_DIV_2;
+   reg &= ~CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK;
+   reg |= 37 << CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO_NUM, 11);
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO_DENOM, 12);
+
+   /* Power up and wait for PLL lock down */
+   reg = RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO);
+   reg &= ~CCM_ANALOG_PLL_VIDEO_POWERDOWN;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   for (timeout = 10; timeout > 0; timeout--) {
+   if (RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO) &
+  CCM_ANALOG_PLL_VIDEO_LOCK) {
+   break;
+   }
+   }
+   if (timeout <= 0) {
+   return ETIMEDOUT;
+   }
+
+   /* Enable the PLL */
+   reg |= CCM_ANALOG_PLL_VIDEO_ENABLE;
+   reg &= ~CCM_ANALOG_PLL_VIDEO_BYPASS;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   return (0);
+}
+
 void
 imx_ccm_ipu_enable(int ipu)
 {
@@ -406,8 +453,26 @@ imx_ccm_ipu_enable(int ipu)
else
reg |= CCGR3_IPU2_IPU | CCGR3_IPU2_DI0;
WR4(sc, CCM_CCGR3, reg);
+
+   /* Set IPU1_DI0 clock to source from PLL5 and divide it by 3 */
+   reg = RD4(sc, CCM_CHSCCDR);
+   reg &= ~(CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK |
+   CHSCCDR_IPU1_DI0_PODF_MASK | CHSCCDR_IPU1_DI0_CLK_SEL_MASK);
+   reg |= (CHSCCDR_PODF_DIVIDE_BY_3 << CHSCCDR_IPU1_DI0_PODF_SHIFT);
+   reg |= (CHSCCDR_IPU_PRE_CLK_PLL5 << CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT);
+   WR4(sc, CCM_CHSCCDR, reg);
+
+   reg |= (CHSCCDR_CLK_SEL_PREMUXED << CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT);
+   WR4(sc, CCM_CHSCCDR, reg);
 }
 
+uint32_t
+imx_ccm_ipu_hz(void)
+{
+
+   return (45500 / 3);
+}
+
 void
 imx_ccm_hdmi_enable(void)
 {
@@ -418,16 +483,6 @@ imx_ccm_hdmi_enable(void)
reg = RD4(sc, CCM_CCGR2);
reg |= CCGR2_HDMI_TX | CCGR2_HDMI_TX_ISFR;
WR4(sc, CCM_CCGR2, reg);
-
-   /* Set HDMI clock to 280MHz */
-   reg = RD4(sc, CCM_CHSCCDR);
-   reg &= ~(CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK |
-   CHSCCDR_IPU1_DI0_PODF_MASK | CHSCCDR_IPU1_DI0_CLK_SEL_MASK);
-   reg |= (CHSCCDR_PODF_DIVIDE_BY_3 << CHSCCDR_IPU1_DI0_PODF_SHIFT);
-   reg |= (CHSCCDR_IPU_PRE_CLK_540M_PFD << 
CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT);
-   WR4(sc, CCM_CHSCCDR, reg);
-   reg |= (CHSCCDR_CLK_SEL_LDB_DI0 << CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT);
-   WR4(sc, CCM_CHSCCDR, reg);
 }
 
 uint32_t

Modified: head/sys/arm/freescale/imx/imx6_ccmreg.h
==
--- head/sys/arm/freescale/imx/imx6_ccmreg.hWed Jun 10 21:38:35 2020
(r362029)
+++ head/sys/arm/freescale/imx/imx6_ccmreg.hWed Jun 10 22:00:31 2020
(r362030)
@@ -64,9 +64,12 @@
 #define  CHSCCDR_IPU1_DI0_PODF_SHIFT 3
 #define  CHSCCDR_IPU1_DI0_CLK_SEL_MASK   (0x7)
 #define  CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT  0
+#define  CHSCCDR_CLK_SEL_PREMUXED0
 #define  CHSCCDR_CLK_SEL_LDB_DI0 3
 #define  CHSCCDR_PODF_DIVIDE_BY_32
+#define  CHSCCDR_PODF_DIVIDE_BY_10
 #define  CHSCCDR_IPU_PRE_CLK_540M_PFD5
+#define  CHSCCDR_IPU_PRE_CLK_PLL52
 #define  

svn commit: r362029 - head/sys/dev/hdmi

2020-06-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun 10 21:38:35 2020
New Revision: 362029
URL: https://svnweb.freebsd.org/changeset/base/362029

Log:
  Fix reading EDID on TVs/monitors without E-DCC support
  
  Writing segment id to I2C device 0x30 only required if the segment is
  non-zero. On the devices without E-DCC support writing to that address
  fails and whole transaction then fails too. To avoid this do
  not attempt write to the segment selection device unless required.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/hdmi/dwc_hdmi.c

Modified: head/sys/dev/hdmi/dwc_hdmi.c
==
--- head/sys/dev/hdmi/dwc_hdmi.cWed Jun 10 21:18:19 2020
(r362028)
+++ head/sys/dev/hdmi/dwc_hdmi.cWed Jun 10 21:38:35 2020
(r362029)
@@ -658,6 +658,11 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u
int result;
uint8_t addr = block & 1 ? EDID_LENGTH : 0;
uint8_t segment = block >> 1;
+   /*
+* Some devices do not support E-DDC so attempt
+* writing segment address only if it's neccessary
+*/
+   unsigned char xfers = segment ? 3 : 2;
struct iic_msg msg[] = {
{ I2C_DDC_SEGADDR, IIC_M_WR, 1,  },
{ I2C_DDC_ADDR, IIC_M_WR, 1,  },
@@ -687,7 +692,7 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u
return (result);
}
 
-   result = iicbus_transfer(i2c_dev, msg, 3);
+   result = iicbus_transfer(i2c_dev, [3 - xfers], xfers);
iicbus_release_bus(i2c_dev, sc->sc_dev);
 
if (result) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361935 - in head/usr.bin/mkimg: . tests

2020-06-08 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jun  8 20:28:32 2020
New Revision: 361935
URL: https://svnweb.freebsd.org/changeset/base/361935

Log:
  Add VHDX support to mkimg(1)
  
  VHDX is the successor of Microsoft's VHD file format. It increases
  maximum capacity of the virtual drive to 64TB and introduces features
  to better handle power/system failures.
  
  VHDX is the required format for 2nd generation Hyper-V VMs.
  
  Reviewed by:  marcel
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25184

Added:
  head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-1x1-512-apm.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdx.hex   (contents, props changed)
  head/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-4096-apm.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-512-apm.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-512-bsd.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-512-ebr.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-512-mbr.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhdx.hex   (contents, props 
changed)
  head/usr.bin/mkimg/vhdx.c   (contents, props changed)
Modified:
  head/usr.bin/mkimg/Makefile
  head/usr.bin/mkimg/mkimg.1
  head/usr.bin/mkimg/tests/mkimg_test.sh

Modified: head/usr.bin/mkimg/Makefile
==
--- head/usr.bin/mkimg/Makefile Mon Jun  8 20:23:20 2020(r361934)
+++ head/usr.bin/mkimg/Makefile Mon Jun  8 20:28:32 2020(r361935)
@@ -18,6 +18,7 @@ SRCS+= \
qcow.c \
raw.c \
vhd.c \
+   vhdx.c \
vmdk.c
 
 # List of schemes to support

Modified: head/usr.bin/mkimg/mkimg.1
==
--- head/usr.bin/mkimg/mkimg.1  Mon Jun  8 20:23:20 2020(r361934)
+++ head/usr.bin/mkimg/mkimg.1  Mon Jun  8 20:28:32 2020(r361935)
@@ -257,6 +257,16 @@ To create a fixed VHD file for use by Azure, specify
 .Fl f Ar vhdf
 on the command line.
 The preferred file extension is ".vhd".
+.Ss Dynamic VHDX
+Microsoft's "Virtual Hard Disk v2" file formats, the
+successor to VHD.
+VHDX is the required format for the 2nd generation Hyper-V VMs.
+To have
+.Nm
+create a dynamic VHDX file, specify
+.Fl f Ar vhdx
+on the command line.
+The preferred file extension is ".vhdx".
 .Ss VMDK
 VMware's "Virtual Machine Disk" file format.
 It's a sparse file format akin to QCOW and VHD and supported by many

Added: head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdx.hex
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdx.hex  Mon Jun  8 20:28:32 
2020(r361935)
@@ -0,0 +1,79 @@
+# $FreeBSD$
+  76 68 64 78 66 69 6c 65  00 00 00 00 00 00 00 00  |vhdxfile|
+0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
+*
+0001  68 65 61 64 64 db 05 73  00 00 00 00 00 00 00 00  |headd..s|
+00010010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
+*
+00010040  00 00 01 00 00 00 10 00  00 00 10 00 00 00 00 00  ||
+00010050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
+*
+0002  68 65 61 64 13 47 fd f1  01 00 00 00 00 00 00 00  |head.G..|
+00020010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
+*
+00020040  00 00 01 00 00 00 10 00  00 00 10 00 00 00 00 00  ||

Re: svn commit: r361796 - head/sys/dts/arm64/overlays

2020-06-04 Thread Oleksandr Tymoshenko
Oleksandr Tymoshenko (go...@freebsd.org) wrote:
> Author: gonzo
> Date: Thu Jun  4 17:20:58 2020
> New Revision: 361796
> URL: https://svnweb.freebsd.org/changeset/base/361796
> 
> Log:
>   Remove licenses
>   
>   I haven't requested explicit permission from authors and shouldn't have
>   added BSDL headers without it.
>   
>   Requestes by:   imp

Some comments on this commit.

Adding license texts was a knee-jerk reaction to the request
to get over with a minor change. Not asking actual
contributors for permissions was the wrong thing to do, so I
reverted it.

I agree with Warner's view that dts files are not subject to
copyright because they're statements of facts. I also
checked other files in sys/dts/{arm,arm64}/overlays/ - none
of them has a license header, so my original commit was
consistent with the standards of that particular part of the
codebase and didn't introduce any legal exposure
(hypothetical or not) FreeBSD didn't have at the time of the
commit. Summing up everything above: I think r361796
brings files to the form they should be in.

If the eventual consensus in the Project is that dtso files
require licenses and copyright statements there need to be a
wider effort organized to get permissions from the respective
contributors. 

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


svn commit: r361796 - head/sys/dts/arm64/overlays

2020-06-04 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jun  4 17:20:58 2020
New Revision: 361796
URL: https://svnweb.freebsd.org/changeset/base/361796

Log:
  Remove licenses
  
  I haven't requested explicit permission from authors and shouldn't have
  added BSDL headers without it.
  
  Requestes by: imp

Modified:
  head/sys/dts/arm64/overlays/spigen-rpi3.dtso
  head/sys/dts/arm64/overlays/spigen-rpi4.dtso

Modified: head/sys/dts/arm64/overlays/spigen-rpi3.dtso
==
--- head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4 17:08:07 
2020(r361795)
+++ head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4 17:20:58 
2020(r361796)
@@ -1,31 +1,4 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2019 Bob Frazier 
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
+/* $FreeBSD$ */
 
 /dts-v1/;
 /plugin/;

Modified: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
==
--- head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4 17:08:07 
2020(r361795)
+++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4 17:20:58 
2020(r361796)
@@ -1,31 +1,4 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2020 Gergely Czuczy 
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
+/* $FreeBSD$ */
 
 /dts-v1/;
 /plugin/;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361782 - head/sys/dts/arm64/overlays

2020-06-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jun  4 02:36:41 2020
New Revision: 361782
URL: https://svnweb.freebsd.org/changeset/base/361782

Log:
  Add copyright headers to spigen overlays for rpi3 and rpi4
  
  Reported by:  Rodney W. Grimes  (for rpi4)

Modified:
  head/sys/dts/arm64/overlays/spigen-rpi3.dtso
  head/sys/dts/arm64/overlays/spigen-rpi4.dtso

Modified: head/sys/dts/arm64/overlays/spigen-rpi3.dtso
==
--- head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4 01:49:29 
2020(r361781)
+++ head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4 02:36:41 
2020(r361782)
@@ -1,4 +1,31 @@
-/* $FreeBSD$ */
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Bob Frazier 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
 
 /dts-v1/;
 /plugin/;

Modified: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
==
--- head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4 01:49:29 
2020(r361781)
+++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4 02:36:41 
2020(r361782)
@@ -1,4 +1,31 @@
-/* $FreeBSD$ */
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 Gergely Czuczy 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
 
 /dts-v1/;
 /plugin/;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Oleksandr Tymoshenko
Rodney W. Grimes (free...@gndrsh.dnsmgr.net) wrote:
> [ Charset UTF-8 unsupported, converting... ]
> > Author: gonzo
> > Date: Wed Jun  3 22:18:15 2020
> > New Revision: 361775
> > URL: https://svnweb.freebsd.org/changeset/base/361775
> > 
> > Log:
> >   Add spigen overlay for Raspberry Pi 4
> >   
> >   Submitted by: gergely.czu...@harmless.hu
> > 
> > Added:
> >   head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props changed)
> > Modified:
> >   head/sys/modules/dtb/rpi/Makefile
> > 
> > Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
> > ==
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoWed Jun  3 22:18:15 
> > 2020(r361775)
> > @@ -0,0 +1,30 @@
> > +/* $FreeBSD$ */
> 
> This file needs some form of copyright/license.

Whom should I put as a copyright folder, The FreeBSD Project or the
person who submitted the patch?

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


svn commit: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun  3 22:18:15 2020
New Revision: 361775
URL: https://svnweb.freebsd.org/changeset/base/361775

Log:
  Add spigen overlay for Raspberry Pi 4
  
  Submitted by: gergely.czu...@harmless.hu

Added:
  head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props changed)
Modified:
  head/sys/modules/dtb/rpi/Makefile

Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoWed Jun  3 22:18:15 
2020(r361775)
@@ -0,0 +1,30 @@
+/* $FreeBSD$ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+   compatible = "brcm,bcm2711";
+};
+   
+&{/soc/spi@7e204000} {
+   status = "okay";
+   spigen0: spigen0 {
+   compatible = "freebsd,spigen";
+   reg = <0>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
+   status = "okay";
+   };
+   spigen1: spigen1 {
+   compatible = "freebsd,spigen";
+   reg = <1>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
+   status = "okay";
+   };
+};
+
+&{/soc/gpio@7e20/spi0_cs_pins} {
+   brcm,pins = <8 7>;
+   brcm,function = <4>; /* ALT0 */
+};
+

Modified: head/sys/modules/dtb/rpi/Makefile
==
--- head/sys/modules/dtb/rpi/Makefile   Wed Jun  3 22:15:11 2020
(r361774)
+++ head/sys/modules/dtb/rpi/Makefile   Wed Jun  3 22:18:15 2020
(r361775)
@@ -6,7 +6,8 @@ DTSO=   \
spigen-rpi2.dtso
 .elif ${MACHINE_ARCH} == "aarch64"
 DTSO=  \
-   spigen-rpi3.dtso
+   spigen-rpi3.dtso \
+   spigen-rpi4.dtso
 .endif
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r361771 - head/sys/modules/dtb/rockchip

2020-06-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun  3 21:19:57 2020
New Revision: 361771
URL: https://svnweb.freebsd.org/changeset/base/361771

Log:
  Add dtb for Firefly RK3399 to the list of Rockchip dtbs

Modified:
  head/sys/modules/dtb/rockchip/Makefile

Modified: head/sys/modules/dtb/rockchip/Makefile
==
--- head/sys/modules/dtb/rockchip/Makefile  Wed Jun  3 20:54:36 2020
(r361770)
+++ head/sys/modules/dtb/rockchip/Makefile  Wed Jun  3 21:19:57 2020
(r361771)
@@ -5,6 +5,7 @@ DTS=\
rockchip/rk3399-khadas-edge.dts \
rockchip/rk3399-khadas-edge-v.dts \
rockchip/rk3328-rock64.dts \
+   rockchip/rk3399-firefly.dts \
rockchip/rk3399-rockpro64.dts
 
 DTSO=  rk3328-dwc3.dtso
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359587 - head/usr.bin/calendar/calendars

2020-04-02 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Apr  3 02:39:46 2020
New Revision: 359587
URL: https://svnweb.freebsd.org/changeset/base/359587

Log:
  Remove hardcoded US Election Day from calendar.usholiday
  
  calendar(1) syntax is not capable of representing the rules for the
  US Election Day. The hardcoded date was set in r15066 in 1996 and
  hasn't changed since then.
  
  PR:   173389
  Reported by:  Steve Ames 
  MFC after:1 week

Modified:
  head/usr.bin/calendar/calendars/calendar.usholiday

Modified: head/usr.bin/calendar/calendars/calendar.usholiday
==
--- head/usr.bin/calendar/calendars/calendar.usholiday  Fri Apr  3 01:31:48 
2020(r359586)
+++ head/usr.bin/calendar/calendars/calendar.usholiday  Fri Apr  3 02:39:46 
2020(r359587)
@@ -30,7 +30,6 @@
 09/22* Autumnal Equinox
 10/MonSecond   Columbus Day in USA (2nd Monday of October)
 10/31  All Hallows Eve  (Halloween)
-11/05* Election Day in USA (1st Tuesday after 1st Monday for even years)
 11/SunFirstDaylight Savings Time ends in USA; clocks move back (1st Sunday 
of November)
 11/11  Veterans' Day
 11/ThuFourth   Thanksgiving Day (4th Thursday in November)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r359585 - in head/usr.bin/calendar: . tests

2020-04-02 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Apr  3 01:17:43 2020
New Revision: 359585
URL: https://svnweb.freebsd.org/changeset/base/359585

Log:
  Fix calculation of the recurring weekdays
  
  Both the result of the first_dayofweek_of_year and the target
  weekday are zero-based (0 fo sunday) while the target month-day
  or year-day is 1-based. Adjust logic accordingly.
  
  Also add testcase for this PR to the kyua test suite
  
  PR:   201062
  Submitted by: Richard Narron 
  MFC after:1 week

Added:
  head/usr.bin/calendar/tests/regress.s5.out   (contents, props changed)
Modified:
  head/usr.bin/calendar/parsedata.c
  head/usr.bin/calendar/tests/calendar.calibrate
  head/usr.bin/calendar/tests/regress.sh

Modified: head/usr.bin/calendar/parsedata.c
==
--- head/usr.bin/calendar/parsedata.c   Fri Apr  3 00:38:12 2020
(r359584)
+++ head/usr.bin/calendar/parsedata.c   Fri Apr  3 01:17:43 2020
(r359585)
@@ -578,7 +578,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int
/* Every dayofweek of the year */
if (lflags == (F_DAYOFWEEK | F_VARIABLE)) {
dow = first_dayofweek_of_year(year);
-   d = (idayofweek - dow + 8) % 7;
+   if (dow < 0)
+   continue;
+   d = (idayofweek - dow + 7) % 7 + 1;
while (d <= 366) {
if (remember_yd(year, d, , ))
remember(,
@@ -616,7 +618,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int
(F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) {
offset = indextooffset(modifierindex);
dow = first_dayofweek_of_month(year, imonth);
-   d = (idayofweek - dow + 8) % 7;
+   if (dow < 0)
+   continue;
+   d = (idayofweek - dow + 7) % 7 + 1;
 
if (offset > 0) {
while (d <= yearinfo->monthdays[imonth]) {
@@ -650,7 +654,9 @@ parsedaymonth(char *date, int *yearp, int *monthp, int
/* Every dayofweek of the month */
if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) {
dow = first_dayofweek_of_month(year, imonth);
-   d = (idayofweek - dow + 8) % 7;
+   if (dow < 0)
+   continue;
+   d = (idayofweek - dow + 7) % 7 + 1;
while (d <= yearinfo->monthdays[imonth]) {
if (remember_ymd(year, imonth, d))
remember(,

Modified: head/usr.bin/calendar/tests/calendar.calibrate
==
--- head/usr.bin/calendar/tests/calendar.calibrate  Fri Apr  3 00:38:12 
2020(r359584)
+++ head/usr.bin/calendar/tests/calendar.calibrate  Fri Apr  3 01:17:43 
2020(r359585)
@@ -188,6 +188,7 @@ LANG=C
 06/28  jun 28
 06/29  jun 29
 06/30  jun 30
+06/SunThirdsunthird
 07/01  jul 1
 07/02  jul 2
 07/03  jul 3

Added: head/usr.bin/calendar/tests/regress.s5.out
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/calendar/tests/regress.s5.out  Fri Apr  3 01:17:43 2020
(r359585)
@@ -0,0 +1,3 @@
+Jun 21*sunthird
+Jun 21 jun 21
+Jun 22 jun 22

Modified: head/usr.bin/calendar/tests/regress.sh
==
--- head/usr.bin/calendar/tests/regress.sh  Fri Apr  3 00:38:12 2020
(r359584)
+++ head/usr.bin/calendar/tests/regress.sh  Fri Apr  3 01:17:43 2020
(r359585)
@@ -7,12 +7,13 @@ CALENDAR="${CALENDAR_BIN} ${CALENDAR_FILE}"
 
 REGRESSION_START($1)
 
-echo 1..28
+echo 1..29
 
 REGRESSION_TEST(`s1',`$CALENDAR -t 29.12.2006')
 REGRESSION_TEST(`s2',`$CALENDAR -t 30.12.2006')
 REGRESSION_TEST(`s3',`$CALENDAR -t 31.12.2006')
 REGRESSION_TEST(`s4',`$CALENDAR -t 01.01.2007')
+REGRESSION_TEST(`s5',`$CALENDAR -t 21.06.2015')
 
 REGRESSION_TEST(`a1',`$CALENDAR -A 3 -t 28.12.2006')
 REGRESSION_TEST(`a2',`$CALENDAR -A 3 -t 29.12.2006')
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r354103 - in head/sys: arm64/conf arm64/rockchip conf

2019-10-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Oct 25 21:38:38 2019
New Revision: 354103
URL: https://svnweb.freebsd.org/changeset/base/354103

Log:
  arm64: rk3399: add SPI driver and include it in GENERIC config
  
  SPI driver for Rockchip's RK3399 SoC. Implements PIO mode, CS selection,
  SPI mode and frequency configuration.
  
  Reviewed by:  manu
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D22148

Added:
  head/sys/arm64/rockchip/rk_spi.c   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Oct 25 21:32:28 2019(r354102)
+++ head/sys/arm64/conf/GENERIC Fri Oct 25 21:38:38 2019(r354103)
@@ -286,6 +286,7 @@ device  mv_thermal  # Marvell Thermal 
Sensor Controller
 # SPI
 device spibus
 device bcm2835_spi # Broadcom BCM283x SPI bus
+device rk_spi  # RockChip SPI controller
 
 # PWM
 device pwm

Added: head/sys/arm64/rockchip/rk_spi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/rockchip/rk_spi.cFri Oct 25 21:38:38 2019
(r354103)
@@ -0,0 +1,483 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Oleksandr Tymoshenko 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "spibus_if.h"
+
+#defineRK_SPI_CTRLR0   0x
+#defineCTRLR0_OPM_MASTER   (0 << 20)
+#defineCTRLR0_XFM_TR   (0 << 18)
+#defineCTRLR0_FRF_MOTO (0 << 16)
+#defineCTRLR0_BHT_8BIT (1 << 13)
+#defineCTRLR0_EM_BIG   (1 << 11)
+#defineCTRLR0_SSD_ONE  (1 << 10)
+#defineCTRLR0_SCPOL(1 <<  7)
+#defineCTRLR0_SCPH (1 <<  6)
+#defineCTRLR0_DFS_8BIT (1 <<  0)
+#defineRK_SPI_CTRLR1   0x0004
+#defineRK_SPI_ENR  0x0008
+#defineRK_SPI_SER  0x000c
+#defineRK_SPI_BAUDR0x0010
+#defineRK_SPI_TXFTLR   0x0014
+#defineRK_SPI_RXFTLR   0x0018
+#defineRK_SPI_TXFLR0x001c
+#defineRK_SPI_RXFLR0x0020
+#defineRK_SPI_SR   0x0024
+#defineSR_BUSY (1 <<  0)
+#defineRK_SPI_IPR  0x0028
+#defineRK_SPI_IMR  0x002c
+#defineIMR_RFFIM   (1 <<  4)
+#defineIMR_TFEIM   (1 <<  0)
+#defineRK_SPI_ISR  0x0030
+#defineISR_RFFIS   (1 <<  4)
+#defineISR_TFEIS   (1 <<  0)
+#defineRK_SPI_RISR 0x0034
+#defineRK_SPI_ICR  0x0038
+#defineRK_SPI_DMACR0x003c
+#defineRK_SPI_DMATDLR  0x0040
+#defineRK_SPI_DMARDLR  0x0044
+#defineRK_SPI_TXDR 0x0400
+#defineRK_SPI_RXDR 0x0800
+
+#defineCS_MAX  1
+
+static struct ofw_compat_data compat_data[] = 

svn commit: r354100 - head/sys/arm64/rockchip/clk

2019-10-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Oct 25 21:21:21 2019
New Revision: 354100
URL: https://svnweb.freebsd.org/changeset/base/354100

Log:
  arm64: rk3399: Add clock and gate for SPI clocks
  
  MFC after:1 month

Modified:
  head/sys/arm64/rockchip/clk/rk3399_cru.c

Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c
==
--- head/sys/arm64/rockchip/clk/rk3399_cru.cFri Oct 25 21:20:04 2019
(r354099)
+++ head/sys/arm64/rockchip/clk/rk3399_cru.cFri Oct 25 21:21:21 2019
(r354100)
@@ -75,6 +75,11 @@ __FBSDID("$FreeBSD$");
 #definePCLK_I2C5   344
 #definePCLK_I2C6   345
 #definePCLK_I2C7   346
+#definePCLK_SPI0   347
+#definePCLK_SPI1   348
+#definePCLK_SPI2   349
+#definePCLK_SPI4   350
+#definePCLK_SPI5   351
 #defineHCLK_HOST0  456
 #defineHCLK_HOST0_ARB  457
 #defineHCLK_HOST1  458
@@ -132,6 +137,12 @@ static struct rk_cru_gate rk3399_gates[] = {
CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9)
CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10)
 
+   /* CRU_CLKGATE_CON23 */
+   CRU_GATE(PCLK_SPI0, "pclk_spi0", "pclk_perilp1", 0x35C, 10)
+   CRU_GATE(PCLK_SPI1, "pclk_spi1", "pclk_perilp1", 0x35C, 11)
+   CRU_GATE(PCLK_SPI2, "pclk_spi2", "pclk_perilp1", 0x35C, 12)
+   CRU_GATE(PCLK_SPI4, "pclk_spi4", "pclk_perilp1", 0x35C, 13)
+
/* CRU_CLKGATE_CON30 */
CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0)
CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1)
@@ -151,6 +162,9 @@ static struct rk_cru_gate rk3399_gates[] = {
 
/* CRU_CLKGATE_CON33 */
CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0x384, 8)
+
+   /* CRU_CLKGATE_CON34 */
+   CRU_GATE(PCLK_SPI4, "pclk_spi5", "pclk_perilp1", 0x388, 5)
 };
 
 
@@ -1367,6 +1381,127 @@ static struct rk_clk_composite_def uphy1_tcpdcore = {
 };
 
 /*
+ * spi
+ */
+static const char *spi_parents[] = {"cpll", "gpll"};
+
+#defineSCLK_SPI0   71
+#defineSCLK_SPI1   72
+#defineSCLK_SPI2   73
+#defineSCLK_SPI4   74
+#defineSCLK_SPI5   75
+
+static struct rk_clk_composite_def spi0 = {
+   .clkdef = {
+   .id = SCLK_SPI0,
+   .name = "clk_spi0",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON59 */
+   .muxdiv_offset = 0x01ec,
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 12,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi1 = {
+   .clkdef = {
+   .id = SCLK_SPI1,
+   .name = "clk_spi1",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON59 */
+   .muxdiv_offset = 0x01ec,
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 13,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi2 = {
+   .clkdef = {
+   .id = SCLK_SPI2,
+   .name = "clk_spi2",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON60 */
+   .muxdiv_offset = 0x01f0,
+   .mux_shift = 7,
+   .mux_width = 1,
+
+   .div_shift = 0,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 14,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi4 = {
+   .clkdef = {
+   .id = SCLK_SPI4,
+   .name = "clk_spi4",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON60 */
+   .muxdiv_offset = 0x01f0,
+   .mux_shift = 15,
+   .mux_width = 1,
+
+   .div_shift = 8,
+   .div_width = 7,
+
+   /* CRU_CLKGATE_CON9 */
+   .gate_offset = 0x0324,
+   .gate_shift = 15,
+
+   .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE,
+};
+
+static struct rk_clk_composite_def spi5 = {
+   .clkdef = {
+   .id = SCLK_SPI5,
+   .name = "clk_spi5",
+   .parent_names = spi_parents,
+   .parent_cnt = nitems(spi_parents),
+   },
+   /* CRU_CLKSEL_CON58 */
+   .muxdiv_offset = 0x01e8,
+   

svn commit: r352776 - head/sys/dev/sound/pci/hda

2019-09-26 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Sep 26 21:04:36 2019
New Revision: 352776
URL: https://svnweb.freebsd.org/changeset/base/352776

Log:
  snd_hda: Add Intel Cannon Lake support
  
  Add missing header change ommitted in r352775
  
  MFC after:2 weeks
  X-MFC-with:   352775

Modified:
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Thu Sep 26 21:02:21 2019
(r352775)
+++ head/sys/dev/sound/pci/hda/hdac.h   Thu Sep 26 21:04:36 2019
(r352776)
@@ -77,6 +77,7 @@
 #define HDA_INTEL_KBLK HDA_MODEL_CONSTRUCT(INTEL, 0xa171)
 #define HDA_INTEL_KBLKHHDA_MODEL_CONSTRUCT(INTEL, 0xa2f0)
 #define HDA_INTEL_CFLK HDA_MODEL_CONSTRUCT(INTEL, 0xa348)
+#define HDA_INTEL_CNLK HDA_MODEL_CONSTRUCT(INTEL, 0x9dc8)
 #define HDA_INTEL_ALL  HDA_MODEL_CONSTRUCT(INTEL, 0x)
 
 /* Nvidia */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r352775 - head/sys/dev/sound/pci/hda

2019-09-26 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Sep 26 21:02:21 2019
New Revision: 352775
URL: https://svnweb.freebsd.org/changeset/base/352775

Log:
  snd_hda: Add Intel Cannon Lake support
  
  Add PCI ids for Intel Cannon Lake PCH
  
  Tested on:HP Spectre x360 13-p0043dx
  PR:   240574
  Submitted by: Neel Chauhan 
  Reviewed by:  imp, mizhka, ray
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D21789

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Thu Sep 26 20:56:07 2019
(r352774)
+++ head/sys/dev/sound/pci/hda/hdac.c   Thu Sep 26 21:02:21 2019
(r352775)
@@ -102,6 +102,7 @@ static const struct {
{ HDA_INTEL_KBLK,"Intel Kaby Lake", 0, 0 },
{ HDA_INTEL_KBLKH,   "Intel Kaby Lake-H",   0, 0 },
{ HDA_INTEL_CFLK,"Intel Coffee Lake",   0, 0 },
+   { HDA_INTEL_CNLK,"Intel Cannon Lake",   0, 0 },
{ HDA_INTEL_82801F,  "Intel 82801F",0, 0 },
{ HDA_INTEL_63XXESB, "Intel 631x/632xESB",  0, 0 },
{ HDA_INTEL_82801G,  "Intel 82801G",0, 0 },
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r352028 - head/sys/arm/broadcom/bcm2835

2019-09-08 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  8 09:47:21 2019
New Revision: 352028
URL: https://svnweb.freebsd.org/changeset/base/352028

Log:
  [rpi] Inherit framebuffer BPP value from the VideoCore firmware
  
  Instead of using hardcoded bpp of 24, obtain current/configured value
  from VideoCore. This solves certain problems with Xorg/Qt apps that
  require bpp of 32 to work properly. The mode can be forced by setting
  framebuffer_depth value in config.txt
  
  PR:   235363
  Submitted by: Steve Peurifoy 

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Sun Sep  8 01:58:02 2019
(r352027)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Sun Sep  8 09:47:21 2019
(r352028)
@@ -85,7 +85,13 @@ bcm_fb_init(struct bcmsc_softc *sc, struct bcm2835_fb_
memset(fb, 0, sizeof(*fb));
if (bcm2835_mbox_fb_get_w_h(fb) != 0)
return (ENXIO);
-   fb->bpp = FB_DEPTH;
+   if (bcm2835_mbox_fb_get_bpp(fb) != 0)
+   return (ENXIO);
+   if (fb->bpp < FB_DEPTH) {
+   device_printf(sc->dev, "changing fb bpp from %d to %d\n", 
fb->bpp, FB_DEPTH);
+   fb->bpp = FB_DEPTH;
+   } else
+   device_printf(sc->dev, "keeping existing fb bpp of %d\n", 
fb->bpp);
 
fb->vxres = fb->xres;
fb->vyres = fb->yres;

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cSun Sep  8 01:58:02 
2019(r352027)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cSun Sep  8 09:47:21 
2019(r352028)
@@ -499,6 +499,26 @@ bcm2835_mbox_fb_get_w_h(struct bcm2835_fb_config *fb)
 }
 
 int
+bcm2835_mbox_fb_get_bpp(struct bcm2835_fb_config *fb)
+{
+   int err;
+   struct msg_fb_get_bpp msg;
+   
+   memset(, 0, sizeof(msg));
+   msg.hdr.buf_size = sizeof(msg);
+   msg.hdr.code = BCM2835_MBOX_CODE_REQ;
+   BCM2835_MBOX_INIT_TAG(, GET_DEPTH);
+   msg.bpp.tag_hdr.val_len = 0;
+   msg.end_tag = 0;
+   
+   err = bcm2835_mbox_property(, sizeof(msg));
+   if (err == 0)
+   fb->bpp = msg.bpp.body.resp.bpp;
+   
+   return (err);
+}
+
+int
 bcm2835_mbox_fb_init(struct bcm2835_fb_config *fb)
 {
int err;

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h   Sun Sep  8 01:58:02 
2019(r352027)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h   Sun Sep  8 09:47:21 
2019(r352028)
@@ -474,6 +474,14 @@ struct msg_fb_get_w_h {
 
 int bcm2835_mbox_fb_get_w_h(struct bcm2835_fb_config *);
 
+struct msg_fb_get_bpp {
+   struct bcm2835_mbox_hdr hdr;
+   struct bcm2835_mbox_tag_depth bpp;
+   uint32_t end_tag;
+};
+
+int bcm2835_mbox_fb_get_bpp(struct bcm2835_fb_config *);
+
 struct msg_fb_setup {
struct bcm2835_mbox_hdr hdr;
struct bcm2835_mbox_tag_fb_w_h physical_w_h;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r351616 - head/sys/dev/usb/net

2019-09-02 Thread Oleksandr Tymoshenko
Hans Petter Selasky (h...@selasky.org) wrote:
> On 2019-09-02 02:29, Oleksandr Tymoshenko wrote:
> > Gleb Smirnoff (gleb...@freebsd.org) wrote:
> >> Author: glebius
> >> Date: Fri Aug 30 00:05:04 2019
> >> New Revision: 351616
> >> URL: https://svnweb.freebsd.org/changeset/base/351616
> >>
> >> Log:
> >>Use mbuf queue instead of ifqueue in USB network drivers.
> > 
> > Hi Gleb,
> > 
> > This change broke NFS root on RPi. I suspect it's not just NFS root
> > but USB ethernet functionality in general. Patch below fixes it for me.
> > The same patch probably should also be applied to if_axe and if_axge.
> > 
> 
> Hi,
> 
> 1) axe and axge use the common code, so no patch needed there from what 
> I can see.
> 
> 2) This queue should be unlimited.
> 
> See:
> https://svnweb.freebsd.org/changeset/base/351692

Thanks for a quick fix. Can confirm that latest HEAD boots fine now with
NFS root.

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


Re: svn commit: r351616 - head/sys/dev/usb/net

2019-09-01 Thread Oleksandr Tymoshenko
Gleb Smirnoff (gleb...@freebsd.org) wrote:
> Author: glebius
> Date: Fri Aug 30 00:05:04 2019
> New Revision: 351616
> URL: https://svnweb.freebsd.org/changeset/base/351616
> 
> Log:
>   Use mbuf queue instead of ifqueue in USB network drivers.

Hi Gleb,

This change broke NFS root on RPi. I suspect it's not just NFS root
but USB ethernet functionality in general. Patch below fixes it for me.
The same patch probably should also be applied to if_axe and if_axge.

Index: sys/dev/usb/net/usb_ethernet.c
===
--- sys/dev/usb/net/usb_ethernet.c  (revision 351673)
+++ sys/dev/usb/net/usb_ethernet.c  (working copy)
@@ -219,6 +219,7 @@
ue->ue_unit = alloc_unr(ueunit);
usb_callout_init_mtx(>ue_watchdog, ue->ue_mtx, 0);
sysctl_ctx_init(>ue_sysctl_ctx);
+   mbufq_init(>ue_rxq, ifqmaxlen);
 
error = 0;
CURVNET_SET_QUIET(vnet0);
@@ -330,6 +331,9 @@
/* free sysctl */
sysctl_ctx_free(>ue_sysctl_ctx);
 
+   /* drain mbuf queue */
+   mbufq_drain(>ue_rxq);
+
/* free unit */
free_unr(ueunit, ue->ue_unit);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-04-24 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Apr 24 23:10:19 2019
New Revision: 346647
URL: https://svnweb.freebsd.org/changeset/base/346647

Log:
  [acpi_ibm] Add support for newer Thinkpad models
  
  Add support for newer Thinkpad models with id LEN0268. Was tested on
  Thinkpad T480 and ThinkPad X1 Yoga 2nd gen.
  
  PR:   229120
  Submitted by: Ali Abdallah 
  MFC after:1 week

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

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==
--- head/sys/dev/acpi_support/acpi_ibm.cWed Apr 24 22:35:29 2019
(r346646)
+++ head/sys/dev/acpi_support/acpi_ibm.cWed Apr 24 23:10:19 2019
(r346647)
@@ -349,7 +349,7 @@ static devclass_t acpi_ibm_devclass;
 DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass,
  0, 0);
 MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1);
-static char*ibm_ids[] = {"IBM0068", "LEN0068", NULL};
+static char*ibm_ids[] = {"IBM0068", "LEN0068", "LEN0268", NULL};
 
 static void
 ibm_led(void *softc, int onoff)
@@ -428,9 +428,14 @@ static int
 acpi_ibm_attach(device_t dev)
 {
int i;
+   int hkey;
struct acpi_ibm_softc   *sc;
char *maker, *product;
-   devclass_t  ec_devclass;
+   ACPI_OBJECT_LIST input;
+   ACPI_OBJECT params[1];
+   ACPI_OBJECT out_obj;
+   ACPI_BUFFER result;
+   devclass_t ec_devclass;
 
ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
 
@@ -465,15 +470,42 @@ acpi_ibm_attach(device_t dev)
"initialmask", CTLFLAG_RD,
>events_initialmask, 0, "Initial eventmask");
 
-   /* The availmask is the bitmask of supported events */
-   if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
-   IBM_NAME_EVENTS_AVAILMASK, >events_availmask)))
+   if (ACPI_SUCCESS (acpi_GetInteger(sc->handle, "MHKV", ))) {
+   device_printf(dev, "Firmware version is 0x%X\n", hkey);
+   switch(hkey >> 8)
+   {
+   case 1:
+   /* The availmask is the bitmask of supported 
events */
+   if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
+   IBM_NAME_EVENTS_AVAILMASK, 
>events_availmask)))
+   sc->events_availmask = 0x;
+   break;
+
+   case 2:
+   result.Length = sizeof(out_obj);
+   result.Pointer = _obj;
+   params[0].Type = ACPI_TYPE_INTEGER;
+   params[0].Integer.Value = 1;
+   input.Pointer = params;
+   input.Count = 1;
+
+   sc->events_availmask = 0x;
+
+   if (ACPI_SUCCESS(AcpiEvaluateObject (sc->handle,
+   IBM_NAME_EVENTS_AVAILMASK, , 
)))
+   sc->events_availmask = 
out_obj.Integer.Value;
+   break;
+   default:
+   device_printf(dev, "Unknown firmware version 
0x%x\n", hkey);
+   break;
+   }
+   } else
sc->events_availmask = 0x;
 
SYSCTL_ADD_UINT(sc->sysctl_ctx,
-   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
-   "availmask", CTLFLAG_RD,
-   >events_availmask, 0, "Mask of supported events");
+   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+   "availmask", CTLFLAG_RD,
+   >events_availmask, 0, "Mask of supported 
events");
}
 
/* Hook up proc nodes */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345550 - head/sys/kern

2019-03-26 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Mar 26 18:03:18 2019
New Revision: 345550
URL: https://svnweb.freebsd.org/changeset/base/345550

Log:
  Change default value of kern.bootfile to reflect reality
  
  In most cases kernel.bootfile is populated from the information
  provided by loader(8). There are certain scenarios when loader
  is not available, for instance when kernel is loaded by u-boot
  or some other BootROM directly. In this case the default value
  "/kernel" points to invalid location and breaks some functinality,
  like using installkernel on self-hosted system or dtrace's CTF
  lookup. This can be fixed by setting the value manually but the
  default that reflects correct location is better than default that
  points to invalid one.
  
  Current default was set around FreeBSD 1, when "/kernel" was the
  actual path. Transition to /boot/kernel/kernel happened circa FreeBSD 3.
  
  PR:   221550
  Reviewed by:  ian, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D18902

Modified:
  head/sys/kern/kern_mib.c

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cTue Mar 26 15:47:13 2019(r345549)
+++ head/sys/kern/kern_mib.cTue Mar 26 18:03:18 2019(r345550)
@@ -136,7 +136,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_R
 SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available");
 #endif
 
-char kernelname[MAXPATHLEN] = "/kernel";   /* XXX bloat */
+char kernelname[MAXPATHLEN] = "/boot/kernel/kernel";   /* XXX bloat */
 
 SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE,
 kernelname, sizeof kernelname, "Name of kernel file booted");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r345220 - head/share/examples/kld/dyn_sysctl

2019-03-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Mar 16 04:24:02 2019
New Revision: 345220
URL: https://svnweb.freebsd.org/changeset/base/345220

Log:
  Fix build for KLD dyn_sysctl example
  
  Looks like the example was broken by change of SYSCTL_STATIC_CHILDREN
  definition in r267992. Fix build by switching to using SYSCTL_ADD_ROOT_NODE
  
  PR:   236139
  Submitted by: Andrew Reiter 
  MFC after:1 week

Modified:
  head/share/examples/kld/dyn_sysctl/dyn_sysctl.c

Modified: head/share/examples/kld/dyn_sysctl/dyn_sysctl.c
==
--- head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Sat Mar 16 04:02:19 
2019(r345219)
+++ head/share/examples/kld/dyn_sysctl/dyn_sysctl.c Sat Mar 16 04:24:02 
2019(r345220)
@@ -72,12 +72,10 @@ load(module_t mod, int cmd, void *arg)
 * to different contexts.
 */
printf("TREEROOT  NAME\n");
-   a_root = SYSCTL_ADD_NODE(,
-   SYSCTL_STATIC_CHILDREN(/* top of sysctl tree */),
+   a_root = SYSCTL_ADD_ROOT_NODE(,
OID_AUTO, "dyn_sysctl", CTLFLAG_RW, 0,
"dyn_sysctl root node");
-   a_root = SYSCTL_ADD_NODE(,
-   SYSCTL_STATIC_CHILDREN(/* top of sysctl tree */),
+   a_root = SYSCTL_ADD_ROOT_NODE(,
OID_AUTO, "dyn_sysctl", CTLFLAG_RW, 0,
"dyn_sysctl root node");
if (a_root == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343998 - head/sys/dev/beri/virtio

2019-02-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Feb 11 07:42:32 2019
New Revision: 343998
URL: https://svnweb.freebsd.org/changeset/base/343998

Log:
  Fix off-by-one error in BERI virtio driver
  
  The hardcoded ident is exactly 20 bytes long but sprintf adds terminating 
zero,
  so there is one byte written out of array bounds.As a fix use strncpy it
  appends \0 only if space allows and its behavior matches virtio spec:
  
  When VIRTIO_BLK_T_GET_ID is issued, the device identifier, up to 20 bytes, is
  written to the buffer. The identifier should be interpreted as an ascii 
string.
  It is terminated with \0, unless it is exactly 20 bytes long.
  
  PR:   202298
  Reviewed by:  br
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D18852

Modified:
  head/sys/dev/beri/virtio/virtio_block.c

Modified: head/sys/dev/beri/virtio/virtio_block.c
==
--- head/sys/dev/beri/virtio/virtio_block.c Mon Feb 11 07:09:02 2019
(r343997)
+++ head/sys/dev/beri/virtio/virtio_block.c Mon Feb 11 07:42:32 2019
(r343998)
@@ -187,7 +187,7 @@ vtblk_proc(struct beri_vtblk_softc *sc, struct vqueue_
break;
case VIRTIO_BLK_T_GET_ID:
/* Assume a single buffer */
-   strlcpy(iov[1].iov_base, sc->ident,
+   strncpy(iov[1].iov_base, sc->ident,
MIN(iov[1].iov_len, sizeof(sc->ident)));
err = 0;
break;
@@ -401,7 +401,7 @@ backend_info(struct beri_vtblk_softc *sc)
s+=1;
}
 
-   sprintf(sc->ident, "Virtio block backend");
+   strncpy(sc->ident, "Virtio block backend", sizeof(sc->ident));
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343560 - head/usr.bin/calendar/calendars/de_AT.ISO_8859-15

2019-01-29 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan 29 19:54:37 2019
New Revision: 343560
URL: https://svnweb.freebsd.org/changeset/base/343560

Log:
  calendar(1): Fix Aschermittwoch date for Austrian calendar
  
  PR:   165516
  Submitted by: j...@berklix.com
  MFC after:1 week

Modified:
  head/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag

Modified: head/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag
==
--- head/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag Tue Jan 
29 18:18:55 2019(r343559)
+++ head/usr.bin/calendar/calendars/de_AT.ISO_8859-15/calendar.feiertag Tue Jan 
29 19:54:37 2019(r343560)
@@ -37,7 +37,7 @@ Easter+60 Fronleichnam
 
 /*  Gedenktage - nicht arbeitsfreie Feiertage */
 02/14  Valentinstag
-02/WednesdayLast   Aschermittwoch
+Easter-46  Aschermittwoch
 Easter-7   Palmsonntag
 Nov Sun+3  Totensonntag
 Nov Sun+4  1. Advent
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343533 - in head/sys/dev/usb: . quirk

2019-01-28 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jan 28 20:22:17 2019
New Revision: 343533
URL: https://svnweb.freebsd.org/changeset/base/343533

Log:
  [usb] Add UQ_KBD_BOOTPROTO quirk for Corsair K68 keyboard
  
  PR:   222114
  Submitted by: Zane C. Bowers-Hadley 
  MFC after:1 week

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Mon Jan 28 19:54:58 2019
(r343532)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Mon Jan 28 20:22:17 2019
(r343533)
@@ -165,6 +165,8 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(MICROSOFT, WLINTELLIMOUSE, 0x, 0x, 
UQ_MS_LEADING_BYTE),
/* Quirk for Corsair Vengeance K60 keyboard */
USB_QUIRK(CORSAIR, K60, 0x, 0x, UQ_KBD_BOOTPROTO),
+   /* Quirk for Corsair Gaming K68 keyboard */
+   USB_QUIRK(CORSAIR, K68, 0x, 0x, UQ_KBD_BOOTPROTO),
/* Quirk for Corsair Vengeance K70 keyboard */
USB_QUIRK(CORSAIR, K70, 0x, 0x, UQ_KBD_BOOTPROTO),
/* Quirk for Corsair K70 RGB keyboard */

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsMon Jan 28 19:54:58 2019(r343532)
+++ head/sys/dev/usb/usbdevsMon Jan 28 20:22:17 2019(r343533)
@@ -1581,6 +1581,7 @@ product COREGA FETHER_USB_TXC 0x9601  FEther USB-TXC
 
 /* Corsair products */
 product CORSAIR K600x0a60  Corsair Vengeance K60 keyboard
+product CORSAIR K680x1b3f  Corsair Gaming K68 keyboard
 product CORSAIR K700x1b09  Corsair Vengeance K70 keyboard
 product CORSAIR K70_RGB0x1b13  Corsair K70 RGB Keyboard
 product CORSAIR STRAFE 0x1b15  Corsair STRAFE Gaming keyboard
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343516 - head/usr.bin/find

2019-01-27 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jan 28 02:00:39 2019
New Revision: 343516
URL: https://svnweb.freebsd.org/changeset/base/343516

Log:
  Fix whiteout support in find(1)
  
  find(1) ignores -type w passed to it. With this patch find(1) properly
  identifies and prints whiteouts.
  
  PR:   126384, 156703
  Submitted by: o...@mamontov.net
  MFC after:1 week

Modified:
  head/usr.bin/find/find.c

Modified: head/usr.bin/find/find.c
==
--- head/usr.bin/find/find.cMon Jan 28 01:50:47 2019(r343515)
+++ head/usr.bin/find/find.cMon Jan 28 02:00:39 2019(r343516)
@@ -208,8 +208,10 @@ find_execute(PLAN *plan, char *paths[])
entry->fts_path, strerror(entry->fts_errno));
exitstatus = 1;
continue;
-#ifdef FTS_W
+#if defined(FTS_W) && defined(FTS_WHITEOUT)
case FTS_W:
+   if (ftsoptions & FTS_WHITEOUT)
+   break;
continue;
 #endif /* FTS_W */
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343458 - head/sys/dev/bhnd/cores/pmu

2019-01-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 25 21:38:28 2019
New Revision: 343458
URL: https://svnweb.freebsd.org/changeset/base/343458

Log:
  Fix format/arg mismatch
  
  USe correct format for int arguments
  
  PR:   229549
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c

Modified: head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
==
--- head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c Fri Jan 25 21:24:09 2019
(r343457)
+++ head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c Fri Jan 25 21:38:28 2019
(r343458)
@@ -1036,7 +1036,7 @@ bhnd_pmu_res_init(struct bhnd_pmu_softc *sc)
return (error);
}
 
-   PMU_DEBUG(sc, "Applying %s=%s to rsrc %d res_updn_timer\n",
+   PMU_DEBUG(sc, "Applying %s=%d to rsrc %d res_updn_timer\n",
name, val, i);
 
BHND_PMU_WRITE_4(sc, BHND_PMU_RES_TABLE_SEL, i);
@@ -,7 +,7 @@ bhnd_pmu_res_init(struct bhnd_pmu_softc *sc)
return (error);
}
 
-   PMU_DEBUG(sc, "Applying %s=%s to rsrc %d res_dep_mask\n", name,
+   PMU_DEBUG(sc, "Applying %s=%d to rsrc %d res_dep_mask\n", name,
val, i);
 
BHND_PMU_WRITE_4(sc, BHND_PMU_RES_TABLE_SEL, i);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343452 - head/sys/mips/nlm

2019-01-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 25 20:14:28 2019
New Revision: 343452
URL: https://svnweb.freebsd.org/changeset/base/343452

Log:
  [mips] Fix error condition check that always evaluates to false
  
  Use proper logical operand when checking the value of srcid
  
  PR:   200988
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/mips/nlm/cms.c

Modified: head/sys/mips/nlm/cms.c
==
--- head/sys/mips/nlm/cms.c Fri Jan 25 20:13:28 2019(r343451)
+++ head/sys/mips/nlm/cms.c Fri Jan 25 20:14:28 2019(r343452)
@@ -204,7 +204,7 @@ xlp_handle_msg_vc(u_int vcmask, int max_msgs)
nlm_restore_flags(mflags);
if (status != 0)/*  no msg or error */
continue;
-   if (srcid < 0 && srcid >= 1024) {
+   if (srcid < 0 || srcid >= 1024) {
printf("[%s]: bad src id %d\n", __func__,
srcid);
continue;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343450 - head/sys/mips/ingenic

2019-01-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 25 20:10:57 2019
New Revision: 343450
URL: https://svnweb.freebsd.org/changeset/base/343450

Log:
  [mips] Unbreak kernel build for CI20
  
  - Include header required for boot_parse_XXX functions
  - Use boot_parse_args when parsing argc/argv style arguments
  - Remove unused function

Modified:
  head/sys/mips/ingenic/jz4780_machdep.c

Modified: head/sys/mips/ingenic/jz4780_machdep.c
==
--- head/sys/mips/ingenic/jz4780_machdep.c  Fri Jan 25 20:07:18 2019
(r343449)
+++ head/sys/mips/ingenic/jz4780_machdep.c  Fri Jan 25 20:10:57 2019
(r343450)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -173,20 +174,6 @@ mips_init(void)
 #endif
 }
 
-#ifdef FDT
-static void
-_parse_bootargs(char *cmdline)
-{
-   char *v;
-
-   while ((v = strsep(, " \n")) != NULL) {
-   if (*v == '\0')
-   continue;
-   boothowto |= boot_parse_arg(v);
-   }
-}
-#endif
-
 void
 platform_start(__register_t a0,  __register_t a1,
 __register_t a2 __unused, __register_t a3 __unused)
@@ -247,7 +234,7 @@ platform_start(__register_t a0,  __register_t a1,
/* Parse cmdline from U-Boot */
argc = a0;
argv = (char **)a1;
-   boothowto |= boot_parse_cmdline(argc, argv);
+   boothowto |= boot_parse_args(argc, argv);
 
mips_init();
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343448 - head/sys/mips/ingenic

2019-01-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 25 20:02:55 2019
New Revision: 343448
URL: https://svnweb.freebsd.org/changeset/base/343448

Log:
  [mips] Fix counter mask in jz4780 timer driver
  
  Fix dublicate value in what is apparent copypaste mistake. The last value
  in mask is supposed to be for counter 7, not counter 3.
  
  PR:   229790
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/mips/ingenic/jz4780_timer.c

Modified: head/sys/mips/ingenic/jz4780_timer.c
==
--- head/sys/mips/ingenic/jz4780_timer.cFri Jan 25 20:00:59 2019
(r343447)
+++ head/sys/mips/ingenic/jz4780_timer.cFri Jan 25 20:02:55 2019
(r343448)
@@ -185,7 +185,7 @@ jz4780_timer_attach(device_t dev)
CSR_WRITE_4(sc, JZ_TC_TECR, TESR_OST);
/* Stop all other channels as well */
CSR_WRITE_4(sc, JZ_TC_TECR, TESR_TCST0 | TESR_TCST1 | TESR_TCST2 |
-   TESR_TCST3 | TESR_TCST4 | TESR_TCST5 | TESR_TCST6 | TESR_TCST3);
+   TESR_TCST3 | TESR_TCST4 | TESR_TCST5 | TESR_TCST6 | TESR_TCST7);
/* Clear detect mask flags */
CSR_WRITE_4(sc, JZ_TC_TFCR, 0x);
/* Mask all interrupts */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343446 - head/sys/mips/mips

2019-01-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 25 19:58:56 2019
New Revision: 343446
URL: https://svnweb.freebsd.org/changeset/base/343446

Log:
  [mips] remove check that is always false (unsinged < 0)
  
  cpuid and local cpu variable are unsigned so checking if value is less than 
zero
  always yields false.
  
  PR:   211088
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/mips/mips/tlb.c

Modified: head/sys/mips/mips/tlb.c
==
--- head/sys/mips/mips/tlb.cFri Jan 25 19:56:06 2019(r343445)
+++ head/sys/mips/mips/tlb.cFri Jan 25 19:58:56 2019(r343446)
@@ -348,7 +348,7 @@ DB_SHOW_COMMAND(tlb, ddb_dump_tlb)
else
cpu = PCPU_GET(cpuid);
 
-   if (cpu < 0 || cpu >= mp_ncpus) {
+   if (cpu >= mp_ncpus) {
db_printf("Invalid CPU %u\n", cpu);
return;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343443 - head/sys/mips/nlm

2019-01-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 25 19:36:20 2019
New Revision: 343443
URL: https://svnweb.freebsd.org/changeset/base/343443

Log:
  [mips] remove dublicate values in enable mask in nlm_usb_intr_en
  
  PR:   230572
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/mips/nlm/usb_init.c

Modified: head/sys/mips/nlm/usb_init.c
==
--- head/sys/mips/nlm/usb_init.cFri Jan 25 18:48:20 2019
(r343442)
+++ head/sys/mips/nlm/usb_init.cFri Jan 25 19:36:20 2019
(r343443)
@@ -52,8 +52,7 @@ nlm_usb_intr_en(int node, int port)
port_addr = nlm_get_usb_regbase(node, port);
val = nlm_read_usb_reg(port_addr, USB_INT_EN);
val = USB_CTRL_INTERRUPT_EN  | USB_OHCI_INTERRUPT_EN |
-   USB_OHCI_INTERRUPT1_EN | USB_CTRL_INTERRUPT_EN  |
-   USB_OHCI_INTERRUPT_EN | USB_OHCI_INTERRUPT2_EN;
+   USB_OHCI_INTERRUPT1_EN | USB_OHCI_INTERRUPT2_EN;
 nlm_write_usb_reg(port_addr, USB_INT_EN, val);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r343391 - head/tools/tools/tinybsd

2019-01-24 Thread Oleksandr Tymoshenko
Rodney W. Grimes (free...@pdx.rh.cn85.dnsmgr.net) wrote:
> > Author: gonzo
> > Date: Thu Jan 24 06:34:29 2019
> > New Revision: 343391
> > URL: https://svnweb.freebsd.org/changeset/base/343391
> > 
> > Log:
> >   Fix prompt for MFSROOT in tinybsd
> >   
> >   tinybsd offers two choices when prompting user for MFSROOT: 'YES'
> >   and 'NO'. Script logic only handles 'yes'. Change offered values
> >   to lower case.
> 
> Why not fix this so that [Yy][Ee][Ss] is accepted?

I thought about it but actual end-to-end verification of such fix would
require going through whole build (and learning how tinybsd script
works). It's a bit more effort than I would like to spend on the tool I
don't work with and with the number of users I don't know of. The
committed patch was readily available, easily verifiable and a step
forward, a tiny one but nevertheless.

If anybody wants to implement proper fix - feel free to reopen PR and
take over it.

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


svn commit: r343391 - head/tools/tools/tinybsd

2019-01-23 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jan 24 06:34:29 2019
New Revision: 343391
URL: https://svnweb.freebsd.org/changeset/base/343391

Log:
  Fix prompt for MFSROOT in tinybsd
  
  tinybsd offers two choices when prompting user for MFSROOT: 'YES'
  and 'NO'. Script logic only handles 'yes'. Change offered values
  to lower case.
  
  PR:   131059
  Submitted by: Brock Williams 
  MFC after:1 week

Modified:
  head/tools/tools/tinybsd/tinybsd

Modified: head/tools/tools/tinybsd/tinybsd
==
--- head/tools/tools/tinybsd/tinybsdThu Jan 24 03:50:27 2019
(r343390)
+++ head/tools/tools/tinybsd/tinybsdThu Jan 24 06:34:29 2019
(r343391)
@@ -206,7 +206,7 @@ loadconfig () {
   break
 fi
   done
-  MFSROOT=`confirm_action "$MFSROOT" "Use an MFSROOT? (YES/NO)"`
+  MFSROOT=`confirm_action "$MFSROOT" "Use an MFSROOT? (yes/no)"`
   IMG=`confirm_action "$IMG" "Image file to generate?"`
 
 # example of formatted value (NNN in this case)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343338 - head/usr.bin/systat

2019-01-22 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jan 23 02:46:35 2019
New Revision: 343338
URL: https://svnweb.freebsd.org/changeset/base/343338

Log:
  Fix systat's :only command parser for the multiple arguments case
  
  According to systat(1) :only option is supposed to accept multiple drives
  but the parser for its arguments stops after first entry. Fix the parser
  logic to accept multiple drives.
  
  PR:   59220
  Reported by:  Andy Farkas 
  MFC after:1 week

Modified:
  head/usr.bin/systat/devs.c

Modified: head/usr.bin/systat/devs.c
==
--- head/usr.bin/systat/devs.c  Wed Jan 23 02:43:49 2019(r343337)
+++ head/usr.bin/systat/devs.c  Wed Jan 23 02:46:35 2019(r343338)
@@ -288,7 +288,7 @@ dsselect(const char *args, devstat_select_mode select_
;
if (*cp)
*cp++ = '\0';
-   if (cp - args == 0)
+   if (cp - tmpstr1 == 0)
break;
for (i = 0; i < num_devices; i++) {
asprintf(, "%s%d", dev_select[i].device_name,
@@ -312,7 +312,7 @@ dsselect(const char *args, devstat_select_mode select_
}
if (i >= num_devices)
error("%s: unknown drive", args);
-   args = cp;
+   tmpstr1 = cp;
}
free(tmpstr);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343298 - head/sys/compat/ndis

2019-01-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan 22 03:53:42 2019
New Revision: 343298
URL: https://svnweb.freebsd.org/changeset/base/343298

Log:
  [ndis] Fix unregistered use of FPU by NDIS in kernel on amd64
  
  amd64 miniport drivers are allowed to use FPU which triggers "Unregistered use
  of FPU in kernel" panic.
  
  Wrap all variants of MSCALL with fpu_kern_enter/fpu_kern_leave.  To reduce
  amount of allocations/deallocations done via
  fpu_kern_alloc_ctx/fpu_kern_free_ctx maintain cache of fpu_kern_ctx elements.
  
  Based on the patch by Paul B Mahol
  
  PR:   165622
  Submitted by: Vlad Movchan 
  MFC after:1 month

Modified:
  head/sys/compat/ndis/kern_windrv.c
  head/sys/compat/ndis/pe_var.h

Modified: head/sys/compat/ndis/kern_windrv.c
==
--- head/sys/compat/ndis/kern_windrv.c  Tue Jan 22 02:56:36 2019
(r343297)
+++ head/sys/compat/ndis/kern_windrv.c  Tue Jan 22 03:53:42 2019
(r343298)
@@ -58,6 +58,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#ifdef __amd64__
+#include 
+#endif
+
 #include 
 
 #include 
@@ -68,6 +72,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef __amd64__
+struct fpu_cc_ent {
+   struct fpu_kern_ctx *ctx;
+   LIST_ENTRY(fpu_cc_ent)  entries;
+};
+static LIST_HEAD(fpu_ctx_free, fpu_cc_ent) fpu_free_head =
+LIST_HEAD_INITIALIZER(fpu_free_head);
+static LIST_HEAD(fpu_ctx_busy, fpu_cc_ent) fpu_busy_head =
+LIST_HEAD_INITIALIZER(fpu_busy_head);
+static struct mtx fpu_free_mtx;
+static struct mtx fpu_busy_mtx;
+#endif
+
 static struct mtx drvdb_mtx;
 static STAILQ_HEAD(drvdb, drvdb_ent) drvdb_head;
 
@@ -98,6 +115,13 @@ windrv_libinit(void)
mtx_init(_mtx, "Windows driver DB lock",
"Windows internal lock", MTX_DEF);
 
+#ifdef __amd64__
+   LIST_INIT(_free_head);
+   LIST_INIT(_busy_head);
+   mtx_init(_free_mtx, "free fpu context list lock", NULL, MTX_DEF);
+   mtx_init(_busy_mtx, "busy fpu context list lock", NULL, MTX_DEF);
+#endif
+
/*
 * PCI and pccard devices don't need to use IRPs to
 * interact with their bus drivers (usually), so our
@@ -132,6 +156,9 @@ int
 windrv_libfini(void)
 {
struct drvdb_ent*d;
+#ifdef __amd64__
+   struct fpu_cc_ent   *ent;
+#endif
 
mtx_lock(_mtx); 
while(STAILQ_FIRST(_head) != NULL) {
@@ -150,6 +177,18 @@ windrv_libfini(void)
smp_rendezvous(NULL, x86_oldldt, NULL, NULL);
ExFreePool(my_tids);
 #endif
+#ifdef __amd64__
+   while ((ent = LIST_FIRST(_free_head)) != NULL) {
+   LIST_REMOVE(ent, entries);
+   fpu_kern_free_ctx(ent->ctx);
+   free(ent, M_DEVBUF);
+   }
+   mtx_destroy(_free_mtx);
+
+   ent = LIST_FIRST(_busy_head);
+   KASSERT(ent == NULL, ("busy fpu context list is not empty"));
+   mtx_destroy(_busy_mtx);
+#endif
return (0);
 }
 
@@ -614,6 +653,148 @@ windrv_wrap(func, wrap, argcnt, ftype)
*wrap = p;
 
return (0);
+}
+
+static struct fpu_cc_ent *
+request_fpu_cc_ent(void)
+{
+   struct fpu_cc_ent *ent;
+
+   mtx_lock(_free_mtx);
+   if ((ent = LIST_FIRST(_free_head)) != NULL) {
+   LIST_REMOVE(ent, entries);
+   mtx_unlock(_free_mtx);
+   mtx_lock(_busy_mtx);
+   LIST_INSERT_HEAD(_busy_head, ent, entries);
+   mtx_unlock(_busy_mtx);
+   return (ent);
+   }
+   mtx_unlock(_free_mtx);
+
+   if ((ent = malloc(sizeof(struct fpu_cc_ent), M_DEVBUF, M_NOWAIT |
+   M_ZERO)) != NULL) {
+   ent->ctx = fpu_kern_alloc_ctx(FPU_KERN_NORMAL |
+   FPU_KERN_NOWAIT);
+   if (ent->ctx != NULL) {
+   mtx_lock(_busy_mtx);
+   LIST_INSERT_HEAD(_busy_head, ent, entries);
+   mtx_unlock(_busy_mtx);
+   } else {
+   free(ent, M_DEVBUF);
+   ent = NULL;
+   }
+   }
+
+   return (ent);
+}
+
+static void
+release_fpu_cc_ent(struct fpu_cc_ent *ent)
+{
+   mtx_lock(_busy_mtx);
+   LIST_REMOVE(ent, entries);
+   mtx_unlock(_busy_mtx);
+   mtx_lock(_free_mtx);
+   LIST_INSERT_HEAD(_free_head, ent, entries);
+   mtx_unlock(_free_mtx);
+}
+
+uint64_t
+_x86_64_call1(void *fn, uint64_t a)
+{
+   struct fpu_cc_ent *ent;
+   uint64_t ret;
+
+   if ((ent = request_fpu_cc_ent()) == NULL)
+   return (ENOMEM);
+   fpu_kern_enter(curthread, ent->ctx, FPU_KERN_NORMAL);
+   ret = x86_64_call1(fn, a);
+   fpu_kern_leave(curthread, ent->ctx);
+   release_fpu_cc_ent(ent);
+
+   return (ret);
+}
+
+uint64_t
+_x86_64_call2(void *fn, uint64_t a, uint64_t b)
+{
+   struct fpu_cc_ent *ent;
+   uint64_t ret;
+
+   if ((ent = request_fpu_cc_ent()) == NULL)
+   return (ENOMEM);
+   

svn commit: r343225 - head/stand/mips/beri/boot2

2019-01-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 21:09:44 2019
New Revision: 343225
URL: https://svnweb.freebsd.org/changeset/base/343225

Log:
  Unbreak mip64 build after r328437
  
  Add exit and getchar functions to beri/boot2 code. They are required by
  panic_action functin introduced in r328437

Modified:
  head/stand/mips/beri/boot2/boot2.c

Modified: head/stand/mips/beri/boot2/boot2.c
==
--- head/stand/mips/beri/boot2/boot2.c  Sun Jan 20 20:29:26 2019
(r343224)
+++ head/stand/mips/beri/boot2/boot2.c  Sun Jan 20 21:09:44 2019
(r343225)
@@ -651,3 +651,19 @@ xgetc(int fn)
return 0;
 }
 }
+
+int
+getchar(void)
+{
+
+   return xgetc(0);
+}
+
+void
+exit(int code)
+{
+
+printf("error: loader exit\n");
+while (1);
+__unreachable();
+}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343232 - head/tools/build/mk

2019-01-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 22:34:04 2019
New Revision: 343232
URL: https://svnweb.freebsd.org/changeset/base/343232

Log:
  Add more profile-enabled libraries to remove when WITHOUT_PROFILE is defined
  
  PR:   230898
  Submitted by: Herbert J. Skuhra 
  MFC after:1 week

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

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Jan 20 22:08:49 
2019(r343231)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Jan 20 22:34:04 
2019(r343232)
@@ -7464,6 +7464,8 @@ OLD_FILES+=usr/share/man/man8/pppctl.8.gz
 .endif
 
 .if ${MK_PROFILE} == no
+OLD_FILES+=usr/lib/lib80211_p.a
+OLD_FILES+=usr/lib/libBlocksRuntime_p.a
 OLD_FILES+=usr/lib/libalias_cuseeme_p.a
 OLD_FILES+=usr/lib/libalias_dummy_p.a
 OLD_FILES+=usr/lib/libalias_ftp_p.a
@@ -7475,40 +7477,64 @@ OLD_FILES+=usr/lib/libalias_skinny_p.a
 OLD_FILES+=usr/lib/libalias_smedia_p.a
 OLD_FILES+=usr/lib/libarchive_p.a
 OLD_FILES+=usr/lib/libasn1_p.a
+OLD_FILES+=usr/lib/libauditd_p.a
+OLD_FILES+=usr/lib/libavl_p.a
+OLD_FILES+=usr/lib/libbe_p.a
 OLD_FILES+=usr/lib/libbegemot_p.a
+OLD_FILES+=usr/lib/libblacklist_p.a
 OLD_FILES+=usr/lib/libbluetooth_p.a
 OLD_FILES+=usr/lib/libbsdxml_p.a
 OLD_FILES+=usr/lib/libbsm_p.a
 OLD_FILES+=usr/lib/libbsnmp_p.a
 OLD_FILES+=usr/lib/libbz2_p.a
+OLD_FILES+=usr/lib/libc++_p.a
 OLD_FILES+=usr/lib/libc_p.a
 OLD_FILES+=usr/lib/libcalendar_p.a
 OLD_FILES+=usr/lib/libcam_p.a
 OLD_FILES+=usr/lib/libcom_err_p.a
 OLD_FILES+=usr/lib/libcompat_p.a
+OLD_FILES+=usr/lib/libcompiler_rt_p.a
 OLD_FILES+=usr/lib/libcrypt_p.a
 OLD_FILES+=usr/lib/libcrypto_p.a
+OLD_FILES+=usr/lib/libctf_p.a
 OLD_FILES+=usr/lib/libcurses_p.a
 OLD_FILES+=usr/lib/libcursesw_p.a
+OLD_FILES+=usr/lib/libcuse_p.a
+OLD_FILES+=usr/lib/libcxxrt_p.a
+OLD_FILES+=usr/lib/libdevctl_p.a
 OLD_FILES+=usr/lib/libdevinfo_p.a
 OLD_FILES+=usr/lib/libdevstat_p.a
 OLD_FILES+=usr/lib/libdialog_p.a
+OLD_FILES+=usr/lib/libdl_p.a
+OLD_FILES+=usr/lib/libdpv_p.a
+OLD_FILES+=usr/lib/libdtrace_p.a
+OLD_FILES+=usr/lib/libdwarf_p.a
 OLD_FILES+=usr/lib/libedit_p.a
+OLD_FILES+=usr/lib/libefivar_p.a
 OLD_FILES+=usr/lib/libelf_p.a
+OLD_FILES+=usr/lib/libexecinfo_p.a
 OLD_FILES+=usr/lib/libfetch_p.a
+OLD_FILES+=usr/lib/libfigpar_p.a
 OLD_FILES+=usr/lib/libfl_p.a
 OLD_FILES+=usr/lib/libform_p.a
 OLD_FILES+=usr/lib/libformw_p.a
+OLD_FILES+=usr/lib/libgcc_eh_p.a
 OLD_FILES+=usr/lib/libgcc_p.a
 OLD_FILES+=usr/lib/libgeom_p.a
 OLD_FILES+=usr/lib/libgnuregex_p.a
+OLD_FILES+=usr/lib/libgpio_p.a
 OLD_FILES+=usr/lib/libgssapi_krb5_p.a
+OLD_FILES+=usr/lib/libgssapi_ntlm_p.a
 OLD_FILES+=usr/lib/libgssapi_p.a
+OLD_FILES+=usr/lib/libgssapi_spnego_p.a
 OLD_FILES+=usr/lib/libhdb_p.a
 OLD_FILES+=usr/lib/libheimbase_p.a
+OLD_FILES+=usr/lib/libheimntlm_p.a
 OLD_FILES+=usr/lib/libheimsqlite_p.a
 OLD_FILES+=usr/lib/libhistory_p.a
+OLD_FILES+=usr/lib/libhx509_p.a
 OLD_FILES+=usr/lib/libipsec_p.a
+OLD_FILES+=usr/lib/libipt_p.a
 OLD_FILES+=usr/lib/libjail_p.a
 OLD_FILES+=usr/lib/libkadm5clnt_p.a
 OLD_FILES+=usr/lib/libkadm5srv_p.a
@@ -7519,6 +7545,7 @@ OLD_FILES+=usr/lib/libkrb5_p.a
 OLD_FILES+=usr/lib/libkvm_p.a
 OLD_FILES+=usr/lib/libl_p.a
 OLD_FILES+=usr/lib/libln_p.a
+OLD_FILES+=usr/lib/liblzma_p.a
 OLD_FILES+=usr/lib/libm_p.a
 OLD_FILES+=usr/lib/libmagic_p.a
 OLD_FILES+=usr/lib/libmd_p.a
@@ -7527,26 +7554,52 @@ OLD_FILES+=usr/lib/libmenu_p.a
 OLD_FILES+=usr/lib/libmenuw_p.a
 OLD_FILES+=usr/lib/libmilter_p.a
 OLD_FILES+=usr/lib/libmp_p.a
+OLD_FILES+=usr/lib/libmt_p.a
 OLD_FILES+=usr/lib/libncurses_p.a
 OLD_FILES+=usr/lib/libncursesw_p.a
 OLD_FILES+=usr/lib/libnetgraph_p.a
 OLD_FILES+=usr/lib/libngatm_p.a
+OLD_FILES+=usr/lib/libnv_p.a
+OLD_FILES+=usr/lib/libnvpair_p.a
+OLD_FILES+=usr/lib/libopencsd_p.a
 OLD_FILES+=usr/lib/libopie_p.a
 OLD_FILES+=usr/lib/libpanel_p.a
 OLD_FILES+=usr/lib/libpanelw_p.a
+OLD_FILES+=usr/lib/libpathconv_p.a
 OLD_FILES+=usr/lib/libpcap_p.a
+OLD_FILES+=usr/lib/libpjdlog_p.a
 OLD_FILES+=usr/lib/libpmc_p.a
+OLD_FILES+=usr/lib/libprivatebsdstat_p.a
+OLD_FILES+=usr/lib/libprivatedevdctl_p.a
+OLD_FILES+=usr/lib/libprivateevent_p.a
+OLD_FILES+=usr/lib/libprivateheimipcc_p.a
+OLD_FILES+=usr/lib/libprivateheimipcs_p.a
+OLD_FILES+=usr/lib/libprivateifconfig_p.a
+OLD_FILES+=usr/lib/libprivateldns_p.a
+OLD_FILES+=usr/lib/libprivatesqlite3_p.a
+OLD_FILES+=usr/lib/libprivatessh_p.a
+OLD_FILES+=usr/lib/libprivateucl_p.a
+OLD_FILES+=usr/lib/libprivateunbound_p.a
+OLD_FILES+=usr/lib/libprivatezstd_p.a
+OLD_FILES+=usr/lib/libproc_p.a
+OLD_FILES+=usr/lib/libprocstat_p.a
 OLD_FILES+=usr/lib/libpthread_p.a
 OLD_FILES+=usr/lib/libradius_p.a
+OLD_FILES+=usr/lib/libregex_p.a
 OLD_FILES+=usr/lib/libroken_p.a
 OLD_FILES+=usr/lib/librpcsvc_p.a
+OLD_FILES+=usr/lib/librss_p.a
 OLD_FILES+=usr/lib/librt_p.a
+OLD_FILES+=usr/lib/librtld_db_p.a
 OLD_FILES+=usr/lib/libsbuf_p.a
 

svn commit: r343224 - in head/sys/dev/usb: . quirk

2019-01-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 20:29:26 2019
New Revision: 343224
URL: https://svnweb.freebsd.org/changeset/base/343224

Log:
  Add KBD_BOOTPROTO quirk for Logitech G510s USB keyboard
  
  PR:   232136
  Submitted by: dgilb...@eicat.ca
  MFC after:1 week

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Sun Jan 20 19:55:54 2019
(r343223)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Sun Jan 20 20:29:26 2019
(r343224)
@@ -96,6 +96,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(TELEX, MIC1, 0x009, 0x009, UQ_AU_NO_FRAC),
USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC),
USB_QUIRK(LOGITECH, UN53B, 0x, 0x, UQ_NO_STRINGS),
+   USB_QUIRK(LOGITECH, G510S, 0x, 0x, UQ_KBD_BOOTPROTO),
USB_QUIRK(REALTEK, RTL8196EU, 0x, 0x, UQ_CFG_INDEX_1),
USB_QUIRK(ELSA, MODEM1, 0x, 0x, UQ_CFG_INDEX_1),
USB_QUIRK(PLANEX2, MZKUE150N, 0x, 0x, UQ_CFG_INDEX_1),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSun Jan 20 19:55:54 2019(r343223)
+++ head/sys/dev/usb/usbdevsSun Jan 20 20:29:26 2019(r343224)
@@ -2842,6 +2842,7 @@ product LOGITECH UN58A0xc030  iFeel Mouse
 product LOGITECH UN53B 0xc032  iFeel MouseMan
 product LOGITECH WMPAD 0xc208  WingMan GamePad Extreme
 product LOGITECH WMRPAD0xc20a  WingMan RumblePad
+product LOGITECH G510S 0xc22d  G510s Keyboard
 product LOGITECH WMJOY 0xc281  WingMan Force joystick
 product LOGITECH BB13  0xc401  USB-PS/2 Trackball
 product LOGITECH RK53  0xc501  Cordless mouse
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343222 - head/usr.bin/systat

2019-01-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 19:47:33 2019
New Revision: 343222
URL: https://svnweb.freebsd.org/changeset/base/343222

Log:
  Fix crash in systat(4) when certain commands are called without arguments
  
  Add check for missing arguments to dsmatchselect and dsselect
  
  PR:   219689
  Submitted by: Marko Turk 
  MFC after:1 week

Modified:
  head/usr.bin/systat/devs.c

Modified: head/usr.bin/systat/devs.c
==
--- head/usr.bin/systat/devs.c  Sun Jan 20 18:53:32 2019(r343221)
+++ head/usr.bin/systat/devs.c  Sun Jan 20 19:47:33 2019(r343222)
@@ -193,6 +193,11 @@ dsmatchselect(const char *args, devstat_select_mode se
int i;
int retval = 0;
 
+   if (!args) {
+   warnx("dsmatchselect: no arguments");
+   return(0);
+   }
+
/*
 * Break the (pipe delimited) input string out into separate
 * strings.
@@ -250,6 +255,11 @@ dsselect(const char *args, devstat_select_mode select_
char *cp, *tmpstr, *tmpstr1, *buffer;
int i;
int retval = 0;
+
+   if (!args) {
+   warnx("dsselect: no argument");
+   return(1);
+   }
 
/*
 * If we've gone through this code before, free previously
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343223 - head/usr.bin/systat

2019-01-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 19:55:54 2019
New Revision: 343223
URL: https://svnweb.freebsd.org/changeset/base/343223

Log:
  Fix inconsistency in return values introduced by r343222
  
  Consistently return 1 or the case of missing arguments in both functions
  
  PR:   219689
  MFC after:1 week
  X-MFC-With:   343222

Modified:
  head/usr.bin/systat/devs.c

Modified: head/usr.bin/systat/devs.c
==
--- head/usr.bin/systat/devs.c  Sun Jan 20 19:47:33 2019(r343222)
+++ head/usr.bin/systat/devs.c  Sun Jan 20 19:55:54 2019(r343223)
@@ -195,7 +195,7 @@ dsmatchselect(const char *args, devstat_select_mode se
 
if (!args) {
warnx("dsmatchselect: no arguments");
-   return(0);
+   return(1);
}
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343209 - head/sys/fs/smbfs

2019-01-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 05:52:16 2019
New Revision: 343209
URL: https://svnweb.freebsd.org/changeset/base/343209

Log:
  [smbfs] Allow semicolon in mounts that support long names
  
  Semicolon is a legal character in long names but not in 8.3 format.
  Move it to respective character set.
  
  PR:   140068
  Submitted by: t...@uffner.com
  MFC after:3 weeks

Modified:
  head/sys/fs/smbfs/smbfs_vnops.c

Modified: head/sys/fs/smbfs/smbfs_vnops.c
==
--- head/sys/fs/smbfs/smbfs_vnops.c Sun Jan 20 03:58:21 2019
(r343208)
+++ head/sys/fs/smbfs/smbfs_vnops.c Sun Jan 20 05:52:16 2019
(r343209)
@@ -1120,8 +1120,8 @@ smbfs_advlock(ap)
 static int
 smbfs_pathcheck(struct smbmount *smp, const char *name, int nmlen, int nameiop)
 {
-   static const char *badchars = "*/:<>;?";
-   static const char *badchars83 = " +|,[]=";
+   static const char *badchars = "*/:<>?";
+   static const char *badchars83 = " +|,[]=;";
const char *cp;
int i, error;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343204 - in head: sbin/ifconfig sys/net80211

2019-01-19 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jan 20 00:45:44 2019
New Revision: 343204
URL: https://svnweb.freebsd.org/changeset/base/343204

Log:
  [ifconfig] Print more WPS attributes in verbose "list scan" output
  
  - Move WPS related defines to dedicated file
  - Add handlers for more WPS attributes
  
  PR:   217317
  Submitted by: J.R. Oldroyd 
  MFC after:3 weeks

Added:
  head/sys/net80211/ieee80211_wps.h   (contents, props changed)
Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211.h

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cSat Jan 19 20:45:41 2019
(r343203)
+++ head/sbin/ifconfig/ifieee80211.cSun Jan 20 00:45:44 2019
(r343204)
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3129,13 +3130,6 @@ printrsnie(const char *tag, const u_int8_t *ie, size_t
}
 }
 
-/* XXX move to a public include file */
-#define IEEE80211_WPS_DEV_PASS_ID  0x1012
-#define IEEE80211_WPS_SELECTED_REG 0x1041
-#define IEEE80211_WPS_SETUP_STATE  0x1044
-#define IEEE80211_WPS_UUID_E   0x1047
-#define IEEE80211_WPS_VERSION  0x104a
-
 #define BE_READ_2(p)   \
((u_int16_t)\
 const u_int8_t *)(p))[1]  ) |  \
@@ -3157,6 +3151,7 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t
"R" /* Registrar-specified */
};
int n;
+   int f;
 
ie +=6, len -= 4;   /* NB: len is payload only */
 
@@ -3165,6 +3160,7 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t
while (len) {
uint16_t tlv_type = BE_READ_2(ie);
uint16_t tlv_len  = BE_READ_2(ie + 2);
+   uint16_t cfg_mthd;
 
/* some devices broadcast invalid WPS frames */
if (tlv_len > len) {
@@ -3177,30 +3173,191 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t
ie += 4, len -= 4;
 
switch (tlv_type) {
-   case IEEE80211_WPS_VERSION:
+   case IEEE80211_WPS_ATTR_VERSION:
printf("v:%d.%d", *ie >> 4, *ie & 0xf);
break;
-   case IEEE80211_WPS_SETUP_STATE:
-   /* Only 1 and 2 are valid */
-   if (*ie == 0 || *ie >= 3)
-   printf(" state:B");
+   case IEEE80211_WPS_ATTR_AP_SETUP_LOCKED:
+   printf(" ap_setup:%s", *ie ? "locked" :
+   "unlocked");
+   break;
+   case IEEE80211_WPS_ATTR_CONFIG_METHODS:
+   case 
IEEE80211_WPS_ATTR_SELECTED_REGISTRAR_CONFIG_METHODS:
+   if (tlv_type == 
IEEE80211_WPS_ATTR_SELECTED_REGISTRAR_CONFIG_METHODS)
+   printf(" sel_reg_cfg_mthd:");
else
-   printf(" st:%s", *ie == 1 ? "N" : "C");
+   printf(" cfg_mthd:" );
+   cfg_mthd = BE_READ_2(ie);
+   f = 0;
+   for (n = 15; n >= 0; n--) {
+   if (f) {
+   printf(",");
+   f = 0;
+   }
+   switch (cfg_mthd & (1 << n)) {
+   case 0:
+   break;
+   case IEEE80211_WPS_CONFIG_USBA:
+   printf("usba");
+   f++;
+   break;
+   case IEEE80211_WPS_CONFIG_ETHERNET:
+   printf("ethernet");
+   f++;
+   break;
+   case IEEE80211_WPS_CONFIG_LABEL:
+   printf("label");
+   f++;
+   break;
+   case IEEE80211_WPS_CONFIG_DISPLAY:
+   if (!(cfg_mthd &
+   
(IEEE80211_WPS_CONFIG_VIRT_DISPLAY |
+  

svn commit: r343170 - head/sys/dev/aic7xxx

2019-01-19 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Jan 19 05:31:48 2019
New Revision: 343170
URL: https://svnweb.freebsd.org/changeset/base/343170

Log:
  [aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE
  
  The PCI id belongs to Adaptec 29320LPE controller. The same fix also was
  merged[1] to OpenBSD driver ~6 years ago.
  
  [1] https://github.com/openbsd/src/commit/f997b5
  
  PR:   172133
  Submitted by: henning.peter...@t-online.de
  MFC after: 1 week

Modified:
  head/sys/dev/aic7xxx/aic79xx_pci.c

Modified: head/sys/dev/aic7xxx/aic79xx_pci.c
==
--- head/sys/dev/aic7xxx/aic79xx_pci.c  Sat Jan 19 05:20:31 2019
(r343169)
+++ head/sys/dev/aic7xxx/aic79xx_pci.c  Sat Jan 19 05:31:48 2019
(r343170)
@@ -75,6 +75,7 @@ ahd_compose_id(u_int device, u_int vendor, u_int subde
 #define ID_AIC7901 0x800F90059005ull
 #define ID_AHA_29320A  0x8000900500609005ull
 #define ID_AHA_29320ALP0x8017900500449005ull
+#define ID_AHA_29320LPE0x8017900500459005ull
 
 #define ID_AIC7901A0x801E90059005ull
 #define ID_AHA_29320LP 0x8014900500449005ull
@@ -91,7 +92,6 @@ ahd_compose_id(u_int device, u_int vendor, u_int subde
 #define ID_AHA_39320D_B0x801C900500419005ull
 #define ID_AHA_39320D_HP   0x8011900500AC0E11ull
 #define ID_AHA_39320D_B_HP 0x801C900500AC0E11ull
-#define ID_AHA_39320LPE0x8017900500459005ull
 #define ID_AIC7902_PCI_REV_A4  0x3
 #define ID_AIC7902_PCI_REV_B0  0x10
 #define SUBID_HP   0x0E11
@@ -144,6 +144,12 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
"Adaptec 29320ALP Ultra320 SCSI adapter",
ahd_aic7901_setup
},
+   {
+   ID_AHA_29320LPE,
+   ID_ALL_MASK,
+   "Adaptec 29320LPE Ultra320 SCSI adapter",
+   ahd_aic7901_setup
+   },
/* aic7901A based controllers */
{
ID_AHA_29320LP,
@@ -210,12 +216,6 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
ID_AHA_39320D_B_HP,
ID_ALL_MASK,
"Adaptec (HP OEM) 39320D Ultra320 SCSI adapter",
-   ahd_aic7902_setup
-   },
-   {
-   ID_AHA_39320LPE,
-   ID_ALL_MASK,
-   "Adaptec 39320LPE Ultra320 SCSI adapter",
ahd_aic7902_setup
},
/* Generic chip probes for devices we don't know 'exactly' */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343156 - in head/sys/dev/usb: . quirk

2019-01-18 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 18 21:00:54 2019
New Revision: 343156
URL: https://svnweb.freebsd.org/changeset/base/343156

Log:
  [usb] Add HID_IGNORE quirks for multiple UPS devices
  
  Without HID_IGNORE quirk enabled these models appear in the system as a uhid
  devices while NUT (Network UPS Tool) expects them to be ugen.
  
  PR:   131521
  Submitted by: Naoyuki Tai , John Bayly 

  MFC after:1 week

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Fri Jan 18 20:59:06 2019
(r343155)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Fri Jan 18 21:00:54 2019
(r343156)
@@ -110,8 +110,19 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(XEROX, WCM15, 0x, 0x, UQ_BROKEN_BIDIR),
/* Devices which should be ignored by uhid */
USB_QUIRK(APC, UPS, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6H375USB, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(BELKIN, F6C550AVR, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C1250TWRK, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C1500TWRK, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C900UNV, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C100UNV, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C120UNV, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C800UNV, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(BELKIN, F6C1100UNV, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(CYBERPOWER, BC900D, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(CYBERPOWER, 1500CAVRLCD, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(CYBERPOWER, OR2200LCDRM2U, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(DELL2, VARIOUS_UPS, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(CYPRESS, SILVERSHIELD, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(DELORME, EARTHMATE, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(DREAMLINK, DL100B, 0x, 0x, UQ_HID_IGNORE),
@@ -119,8 +130,26 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(ITUNERNET, USBLCD4X20, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(LIEBERT, POWERSURE_PXT, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(LIEBERT2, PSI1000, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(LIEBERT2, POWERSURE_PSA, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(MGE, UPS1, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(MGE, UPS2, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(POWERCOM, IMPERIAL_SERIES, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(POWERCOM, SMART_KING_PRO, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(POWERCOM, WOW, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(POWERCOM, VANGUARD, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(POWERCOM, BLACK_KNIGHT_PRO, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, AVR550U, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, AVR750U, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, ECO550UPS, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, T750_INTL, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, RT_2200_INTL, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, OMNI1000LCD, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, OMNI900LCD, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, SMART_2200RMXL2U, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, UPS_3014, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, SU1500RTXL2UA, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, SU6000RT4U, 0x, 0x, UQ_HID_IGNORE),
+   USB_QUIRK(TRIPPLITE2, SU1500RTXL2UA_2, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(APPLE, IPHONE, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(APPLE, IPHONE_3G, 0x, 0x, UQ_HID_IGNORE),
USB_QUIRK(MEGATEC, UPS, 0x, 0x, UQ_HID_IGNORE),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsFri Jan 18 20:59:06 2019(r343155)
+++ head/sys/dev/usb/usbdevsFri Jan 18 21:00:54 2019(r343156)
@@ -140,6 +140,7 @@ vendor SANYO0x0474  Sanyo Electric
 vendor SEAGATE 0x0477  Seagate
 vendor CONNECTIX   0x0478  Connectix
 vendor SEMTECH 0x047a  Semtech
+vendor DELL2   0x047c  Dell
 vendor KENSINGTON  0x047d  Kensington
 vendor LUCENT  0x047e  Lucent
 vendor PLANTRONICS 0x047f  Plantronics
@@ -554,6 +555,7 @@ vendor ACDC 0x0d7e  American Computer & Digital 
Compon
 vendor CMEDIA  0x0d8c  CMEDIA
 vendor CONCEPTRONIC0x0d8e  Conceptronic
 vendor SKANHEX 0x0d96  Skanhex Technology, Inc.
+vendor POWERCOM

svn commit: r343129 - head/sys/cam/ata

2019-01-17 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 18 04:23:52 2019
New Revision: 343129
URL: https://svnweb.freebsd.org/changeset/base/343129

Log:
  [ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command
  
  - Add ADA_Q_NO_TRIM quirk to be used with the device that falsely advertise 
TRIM support
  - Add ADA_Q_NO_TRIM entry for KingDian S200 SSD
  
  PR:   222802
  Submitted by: Bertrand Petit 
  MFC after:1 week

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Fri Jan 18 00:39:17 2019(r343128)
+++ head/sys/cam/ata/ata_da.c   Fri Jan 18 04:23:52 2019(r343129)
@@ -118,7 +118,8 @@ typedef enum {
ADA_Q_4K= 0x01,
ADA_Q_NCQ_TRIM_BROKEN   = 0x02,
ADA_Q_LOG_BROKEN= 0x04,
-   ADA_Q_SMR_DM= 0x08
+   ADA_Q_SMR_DM= 0x08,
+   ADA_Q_NO_TRIM   = 0x10
 } ada_quirks;
 
 #define ADA_Q_BIT_STRING   \
@@ -126,7 +127,8 @@ typedef enum {
"\0014K"\
"\002NCQ_TRIM_BROKEN"   \
"\003LOG_BROKEN"\
-   "\004SMR_DM"
+   "\004SMR_DM"\
+   "\005NO_TRIM"
 
 typedef enum {
ADA_CCB_RAHEAD  = 0x01,
@@ -543,6 +545,14 @@ static struct ada_quirk_entry ada_quirk_table[] =
},
{
/*
+* KingDian S200 60GB P0921B
+* Trimming crash the SSD
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "KingDian S200 *", "*" },
+   /*quirks*/ADA_Q_NO_TRIM
+   },
+   {
+   /*
 * Kingston E100 Series SSDs
 * 4k optimised & trim only works in 4k requests + 4k aligned
 */
@@ -1810,6 +1820,10 @@ adaregister(struct cam_periph *periph, void *arg)
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE)
softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
+   /* Device lies about TRIM capability. */
+   if ((softc->quirks & ADA_Q_NO_TRIM) &&
+   (softc->flags & ADA_FLAG_CAN_TRIM))
+   softc->flags &= ~ADA_FLAG_CAN_TRIM;
if (softc->flags & ADA_FLAG_CAN_TRIM) {
softc->disk->d_flags |= DISKFLAG_CANDELETE;
softc->disk->d_delmaxsize = softc->params.secsize *
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343128 - head/tools/build/mk

2019-01-17 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 18 00:39:17 2019
New Revision: 343128
URL: https://svnweb.freebsd.org/changeset/base/343128

Log:
  Add ypldap to the list of conditional obsolete files
  
  ypldap should be removed during delete-old if WITHOUT_NIS flag is enabled
  
  PR:   230727
  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   Fri Jan 18 00:26:25 
2019(r343127)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Jan 18 00:39:17 
2019(r343128)
@@ -6522,6 +6522,7 @@ OLD_FILES+=usr/bin/ypcat
 OLD_FILES+=usr/bin/ypchfn
 OLD_FILES+=usr/bin/ypchpass
 OLD_FILES+=usr/bin/ypchsh
+OLD_FILES+=usr/bin/ypldap
 OLD_FILES+=usr/bin/ypmatch
 OLD_FILES+=usr/bin/yppasswd
 OLD_FILES+=usr/bin/ypwhich
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343127 - head/usr.bin/compress

2019-01-17 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jan 18 00:26:25 2019
New Revision: 343127
URL: https://svnweb.freebsd.org/changeset/base/343127

Log:
  Fix descriptor/memory leak in compress(1) code
  
  This is mostly a style fix since the code in question is not called multiple
  times and doesn't have cummulative effect.
  
  PR:   204953
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/usr.bin/compress/compress.c

Modified: head/usr.bin/compress/compress.c
==
--- head/usr.bin/compress/compress.cThu Jan 17 23:22:56 2019
(r343126)
+++ head/usr.bin/compress/compress.cFri Jan 18 00:26:25 2019
(r343127)
@@ -322,6 +322,8 @@ decompress(const char *in, const char *out, int bits)
if ((ofp = fopen(out, "w")) == NULL ||
(nr != 0 && fwrite(buf, 1, nr, ofp) != nr)) {
cwarn("%s", out);
+   if (ofp)
+   (void)fclose(ofp);
(void)fclose(ifp);
return;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343110 - head/tools/build/mk

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jan 17 06:34:39 2019
New Revision: 343110
URL: https://svnweb.freebsd.org/changeset/base/343110

Log:
  Fix conditional obsolete files entry for WITHOUT_EXAMPLES
  
  Add all the files under /usr/share/examples to the MK_EXAMPLES
  section. OLD_DIRS entries are not removed if they're not empty so
  prior to this change WITHOUT_EXAMPLES didn't have significant effect
  on the updated system.
  
  PR:   228484
  Submitted by: Dmitry Wagin  (original patch)
  MFC after:1 week

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

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 06:22:14 
2019(r343109)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 06:34:39 
2019(r343110)
@@ -2303,22 +2303,274 @@ OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat
 .endif
 
 .if ${MK_EXAMPLES} == no
+OLD_FILES+=usr/share/examples/BSD_daemon/FreeBSD.pfa
+OLD_FILES+=usr/share/examples/BSD_daemon/README
+OLD_FILES+=usr/share/examples/BSD_daemon/beastie.eps
+OLD_FILES+=usr/share/examples/BSD_daemon/beastie.fig
+OLD_FILES+=usr/share/examples/BSD_daemon/eps.patch
+OLD_FILES+=usr/share/examples/BSD_daemon/poster.sh
+OLD_FILES+=usr/share/examples/FreeBSD_version/FreeBSD_version.c
+OLD_FILES+=usr/share/examples/FreeBSD_version/Makefile
+OLD_FILES+=usr/share/examples/FreeBSD_version/README
+OLD_FILES+=usr/share/examples/IPv6/USAGE
+OLD_FILES+=usr/share/examples/bhyve/vmrun.sh
+OLD_FILES+=usr/share/examples/bootforth/README
+OLD_FILES+=usr/share/examples/bootforth/boot.4th
+OLD_FILES+=usr/share/examples/bootforth/frames.4th
+OLD_FILES+=usr/share/examples/bootforth/loader.rc
+OLD_FILES+=usr/share/examples/bootforth/menu.4th
+OLD_FILES+=usr/share/examples/bootforth/menuconf.4th
+OLD_FILES+=usr/share/examples/bootforth/screen.4th
+OLD_FILES+=usr/share/examples/bsdconfig/add_some_packages.sh
+OLD_FILES+=usr/share/examples/bsdconfig/browse_packages_http.sh
+OLD_FILES+=usr/share/examples/bsdconfig/bsdconfigrc
+OLD_FILES+=usr/share/examples/csh/dot.cshrc
+OLD_FILES+=usr/share/examples/diskless/ME
+OLD_FILES+=usr/share/examples/diskless/README.BOOTP
+OLD_FILES+=usr/share/examples/diskless/README.TEMPLATING
+OLD_FILES+=usr/share/examples/diskless/clone_root
+OLD_FILES+=usr/share/examples/dma/mailer.conf
+OLD_FILES+=usr/share/examples/drivers/README
+OLD_FILES+=usr/share/examples/drivers/make_device_driver.sh
+OLD_FILES+=usr/share/examples/drivers/make_pseudo_driver.sh
+OLD_FILES+=usr/share/examples/dwatch/profile_template
+OLD_FILES+=usr/share/examples/etc/README.examples
+OLD_FILES+=usr/share/examples/etc/bsd-style-copyright
+OLD_FILES+=usr/share/examples/etc/group
+OLD_FILES+=usr/share/examples/etc/login.access
+OLD_FILES+=usr/share/examples/etc/make.conf
+OLD_FILES+=usr/share/examples/etc/rc.bsdextended
+OLD_FILES+=usr/share/examples/etc/rc.firewall
+OLD_FILES+=usr/share/examples/etc/rc.sendmail
+OLD_FILES+=usr/share/examples/etc/termcap.small
+OLD_FILES+=usr/share/examples/etc/wpa_supplicant.conf
+OLD_FILES+=usr/share/examples/find_interface/Makefile
+OLD_FILES+=usr/share/examples/find_interface/README
+OLD_FILES+=usr/share/examples/find_interface/find_interface.c
+OLD_FILES+=usr/share/examples/hast/ucarp.sh
+OLD_FILES+=usr/share/examples/hast/ucarp_down.sh
+OLD_FILES+=usr/share/examples/hast/ucarp_up.sh
+OLD_FILES+=usr/share/examples/hast/vip-down.sh
+OLD_FILES+=usr/share/examples/hast/vip-up.sh
+OLD_FILES+=usr/share/examples/hostapd/hostapd.conf
+OLD_FILES+=usr/share/examples/hostapd/hostapd.eap_user
+OLD_FILES+=usr/share/examples/hostapd/hostapd.wpa_psk
+OLD_FILES+=usr/share/examples/indent/indent.pro
+OLD_FILES+=usr/share/examples/ipfilter/BASIC.NAT
+OLD_FILES+=usr/share/examples/ipfilter/BASIC_1.FW
+OLD_FILES+=usr/share/examples/ipfilter/BASIC_2.FW
+OLD_FILES+=usr/share/examples/ipfilter/README
+OLD_FILES+=usr/share/examples/ipfilter/example.1
+OLD_FILES+=usr/share/examples/ipfilter/example.10
+OLD_FILES+=usr/share/examples/ipfilter/example.11
+OLD_FILES+=usr/share/examples/ipfilter/example.12
+OLD_FILES+=usr/share/examples/ipfilter/example.13
+OLD_FILES+=usr/share/examples/ipfilter/example.14
+OLD_FILES+=usr/share/examples/ipfilter/example.2
+OLD_FILES+=usr/share/examples/ipfilter/example.3
+OLD_FILES+=usr/share/examples/ipfilter/example.4
+OLD_FILES+=usr/share/examples/ipfilter/example.5
+OLD_FILES+=usr/share/examples/ipfilter/example.6
+OLD_FILES+=usr/share/examples/ipfilter/example.7
+OLD_FILES+=usr/share/examples/ipfilter/example.8
+OLD_FILES+=usr/share/examples/ipfilter/example.9
+OLD_FILES+=usr/share/examples/ipfilter/example.sr
+OLD_FILES+=usr/share/examples/ipfilter/examples.txt
+OLD_FILES+=usr/share/examples/ipfilter/firewall
+OLD_FILES+=usr/share/examples/ipfilter/firewall.1
+OLD_FILES+=usr/share/examples/ipfilter/firewall.2
+OLD_FILES+=usr/share/examples/ipfilter/ftp-proxy

svn commit: r343109 - head/tools/build/mk

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jan 17 06:22:14 2019
New Revision: 343109
URL: https://svnweb.freebsd.org/changeset/base/343109

Log:
  Add optional obsolete files for the installworld without sendmail
  
  Add two more entries for WITHOUT_SENDMAIL install. The /var/spool/clientmqueue
  entry would be deleted only if there are no files/dirs in it, so the
  content generated during previous lifecycle of the system is safe
  
  PR:   228484
  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   Thu Jan 17 05:15:25 
2019(r343108)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Thu Jan 17 06:22:14 
2019(r343109)
@@ -7354,6 +7354,7 @@ OLD_FILES+=usr/share/man/man8/rtquery.8.gz
 .endif
 
 .if ${MK_SENDMAIL} == no
+OLD_FILES+=etc/mtree/BSD.sendmail.dist
 OLD_FILES+=etc/newsyslog.conf.d/sendmail.conf
 OLD_FILES+=etc/periodic/daily/150.clean-hoststat
 OLD_FILES+=etc/periodic/daily/440.status-mailq
@@ -7592,6 +7593,7 @@ OLD_FILES+=usr/share/sendmail/cf/siteconfig/uucp.ucbva
 OLD_DIRS+=usr/share/sendmail/cf/siteconfig
 OLD_DIRS+=usr/share/sendmail/cf
 OLD_DIRS+=usr/share/sendmail
+OLD_DIRS+=var/spool/clientmqueue
 .endif
 
 .if ${MK_SERVICESDB} == no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343106 - in head/sys/dev/usb: . quirk

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jan 16 22:29:34 2019
New Revision: 343106
URL: https://svnweb.freebsd.org/changeset/base/343106

Log:
  [usb] Add quirk for SmartG2 USB memory key
  
  PR:   167001
  Submitted by: Daan Vreeken [PA4DAN] 
  MFC after:1 week

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Wed Jan 16 21:59:18 2019
(r343105)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Wed Jan 16 22:29:34 2019
(r343106)
@@ -498,6 +498,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(VIALABS, USB30SATABRIDGE, 0x, 0x, 
UQ_MSC_NO_SYNC_CACHE),
USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x, 0x, UQ_MSC_NO_GETMAXLUN,
UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0),
+   USB_QUIRK(SMART2, G2MEMKEY, 0x, 0x, UQ_MSC_NO_INQUIRY),
/* Non-standard USB MIDI devices */
USB_QUIRK(ROLAND, UM1, 0x, 0x, UQ_AU_VENDOR_CLASS),
USB_QUIRK(ROLAND, SC8850, 0x, 0x, UQ_AU_VENDOR_CLASS),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsWed Jan 16 21:59:18 2019(r343105)
+++ head/sys/dev/usb/usbdevsWed Jan 16 22:29:34 2019(r343106)
@@ -561,6 +561,7 @@ vendor NETAC0x0dd8  Netac
 vendor SITECOMEU   0x0df6  Sitecom Europe
 vendor MOBILEACTION0x0df7  Mobile Action
 vendor AMIGO   0x0e0b  Amigo Technology
+vendor SMART2  0x0e39  Smart Modular Technologies
 vendor SPEEDDRAGON 0x0e55  Speed Dragon Multimedia
 vendor HAWKING 0x0e66  Hawking
 vendor FOSSIL  0x0e67  Fossil, Inc
@@ -4372,6 +4373,9 @@ product SKANHEX SX_520Z   0x5200  SX 520z Camera
 
 /* Smart Technologies products */
 product SMART PL2303   0x2303  Serial adapter
+
+/* Smart Modular Technologies products */
+product SMART2 G2MEMKEY0x1700  G2 Memory Key
 
 /* SmartBridges products */
 product SMARTBRIDGES SMARTLINK 0x0001  SmartLink USB Ethernet
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343104 - head/sys/arm/mv

2019-01-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jan 16 21:13:50 2019
New Revision: 343104
URL: https://svnweb.freebsd.org/changeset/base/343104

Log:
  [mv] Fix invalid condition in fdt_fixup_ranges
  
  Add parentheses to perform assignment before comparison. The prior
  condition worked because fdt_parent_addr_cells returns 1 for the DTB
  on which fdt_fixup_ranges is called and accidentally par_addr_cells
  ends up to be set to the same value.
  
  PR:   210705
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/sys/arm/mv/mv_common.c

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Wed Jan 16 20:46:39 2019(r343103)
+++ head/sys/arm/mv/mv_common.c Wed Jan 16 21:13:50 2019(r343104)
@@ -2935,7 +2935,7 @@ fdt_fixup_ranges(phandle_t root)
/* Fix-up SoC ranges according to real fdt_immr_pa */
if ((node = fdt_find_compatible(root, "simple-bus", 1)) != 0) {
if (fdt_addrsize_cells(node, _cells, _cells) == 0 &&
-   (par_addr_cells = fdt_parent_addr_cells(node) <= 2)) {
+   ((par_addr_cells = fdt_parent_addr_cells(node)) <= 2)) {
tuple_size = sizeof(pcell_t) * (par_addr_cells +
   addr_cells + size_cells);
len = OF_getprop(node, "ranges", ranges,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343069 - in head/sys: arm64/conf dts/arm/overlays dts/arm64/overlays modules/dtb/rpi

2019-01-15 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jan 16 01:08:34 2019
New Revision: 343069
URL: https://svnweb.freebsd.org/changeset/base/343069

Log:
  [rpi] Reorganize spigen(4) overlays for Raspberry Pi
  
  - Remove CS=2 entry from spigen-rpi2 since it didn't work
  - Add spigen-rpi3 overlay for Raspberry Pi 3
  - Enable rpi overlay modules for GENERIC kernel on aarch64
  
  PR:   233489
  Submitted by: b...@mrp3.com
  Reviewed by:  db
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D16088

Added:
  head/sys/dts/arm64/overlays/spigen-rpi3.dtso   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/dts/arm/overlays/spigen-rpi2.dtso
  head/sys/modules/dtb/rpi/Makefile

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Wed Jan 16 00:39:23 2019(r343068)
+++ head/sys/arm64/conf/GENERIC Wed Jan 16 01:08:34 2019(r343069)
@@ -296,4 +296,4 @@ options FDT
 device acpi
 
 # DTBs
-makeoptionsMODULES_EXTRA="dtb/allwinner dtb/rockchip"
+makeoptionsMODULES_EXTRA="dtb/allwinner dtb/rockchip dtb/rpi"

Modified: head/sys/dts/arm/overlays/spigen-rpi2.dtso
==
--- head/sys/dts/arm/overlays/spigen-rpi2.dtso  Wed Jan 16 00:39:23 2019
(r343068)
+++ head/sys/dts/arm/overlays/spigen-rpi2.dtso  Wed Jan 16 01:08:34 2019
(r343069)
@@ -12,6 +12,7 @@
spigen0: spigen0 {
compatible = "freebsd,spigen";
reg = <0>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
status = "okay";
};
spigen1: spigen1 {
@@ -20,20 +21,10 @@
spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
status = "okay";
};
-   spigen2: spigen2 {
-   compatible = "freebsd,spigen";
-   reg = <2>;
-   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
-   status = "okay";
-   };
 };
 
 &{/soc/gpio@7e20/spi0_cs_pins} {
-   brcm,pins = <8 7 16>;
+   brcm,pins = <8 7>;
brcm,function = <4>; /* ALT0 */
-};
-
-&{/soc/gpio@7e20/spi0_gpio7} {
-   brcm,pins = <7 8 16 9 10 11>;
 };
 

Added: head/sys/dts/arm64/overlays/spigen-rpi3.dtso
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dts/arm64/overlays/spigen-rpi3.dtsoWed Jan 16 01:08:34 
2019(r343069)
@@ -0,0 +1,30 @@
+/* $FreeBSD$ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+   compatible = "brcm,bcm2837";
+};
+   
+&{/soc/spi@7e204000} {
+   status = "okay";
+   spigen0: spigen0 {
+   compatible = "freebsd,spigen";
+   reg = <0>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
+   status = "okay";
+   };
+   spigen1: spigen1 {
+   compatible = "freebsd,spigen";
+   reg = <1>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
+   status = "okay";
+   };
+};
+
+&{/soc/gpio@7e20/spi0_cs_pins} {
+   brcm,pins = <8 7>;
+   brcm,function = <4>; /* ALT0 */
+};
+

Modified: head/sys/modules/dtb/rpi/Makefile
==
--- head/sys/modules/dtb/rpi/Makefile   Wed Jan 16 00:39:23 2019
(r343068)
+++ head/sys/modules/dtb/rpi/Makefile   Wed Jan 16 01:08:34 2019
(r343069)
@@ -1,7 +1,12 @@
 # $FreeBSD$
 # DTS files for the Raspberry Pi-B
+.if ${MACHINE_ARCH:Marmv[67]*} != ""
 DTSO=  \
spigen-rpi-b.dtso \
-   spigen-rpi2.dtso \
+   spigen-rpi2.dtso
+.elif ${MACHINE_ARCH} == "aarch64"
+DTSO=  \
+   spigen-rpi3.dtso
+.endif
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343060 - head/sys/dev/drm

2019-01-15 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan 15 21:06:58 2019
New Revision: 343060
URL: https://svnweb.freebsd.org/changeset/base/343060

Log:
  [drm] Fix off-by-one error when accessing driver-specific ioctl handlers array
  
  PR:   231513
  Submitted by: Young_X 
  Approved by:  imp
  MFC after:1 week

Modified:
  head/sys/dev/drm/drm_drv.c

Modified: head/sys/dev/drm/drm_drv.c
==
--- head/sys/dev/drm/drm_drv.c  Tue Jan 15 20:27:21 2019(r343059)
+++ head/sys/dev/drm/drm_drv.c  Tue Jan 15 21:06:58 2019(r343060)
@@ -745,7 +745,7 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t d
if (ioctl->func == NULL && nr >= DRM_COMMAND_BASE) {
/* The array entries begin at DRM_COMMAND_BASE ioctl nr */
nr -= DRM_COMMAND_BASE;
-   if (nr > dev->driver->max_ioctl) {
+   if (nr >= dev->driver->max_ioctl) {
DRM_DEBUG("Bad driver ioctl number, 0x%x (of 0x%x)\n",
nr, dev->driver->max_ioctl);
return EINVAL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343029 - head/sys/dev/led

2019-01-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan 15 00:52:41 2019
New Revision: 343029
URL: https://svnweb.freebsd.org/changeset/base/343029

Log:
  [led] propagate error from set_led() to the caller
  
  Do not lose error condition by always returning 0 from set_led.
  None of the calls to set_led checks for return value at the moment so
  none of API consumers in base is affected.
  
  PR:   231567
  Submitted by: Bertrand Petit 
  MFC after:1 week

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

Modified: head/sys/dev/led/led.c
==
--- head/sys/dev/led/led.c  Tue Jan 15 00:37:37 2019(r343028)
+++ head/sys/dev/led/led.c  Tue Jan 15 00:52:41 2019(r343029)
@@ -261,7 +261,7 @@ led_set(char const *name, char const *cmd)
mtx_unlock(_mtx);
if (sb != NULL)
sbuf_delete(sb);
-   return (0);
+   return (error);
 }
 
 static struct cdevsw led_cdevsw = {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343028 - head/sys/arm/mv

2019-01-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan 15 00:37:37 2019
New Revision: 343028
URL: https://svnweb.freebsd.org/changeset/base/343028

Log:
  [mv_pci] Increase default PCI space size for mv_pci
  
  mv_pci driver reads PCI memory window layout from DTB data and if the
  data is incomplete falls back to default value. The value is too small
  to fit two PCI spaces for mwlwifi devices on WRT3200ACM so the resource
  allocation for them fails. Increase the default to 4Mb from 1Mb so
  the devices can be properly attached.
  
  MFC after:1 week

Modified:
  head/sys/arm/mv/mv_pci.c

Modified: head/sys/arm/mv/mv_pci.c
==
--- head/sys/arm/mv/mv_pci.cTue Jan 15 00:35:19 2019(r343027)
+++ head/sys/arm/mv/mv_pci.cTue Jan 15 00:37:37 2019(r343028)
@@ -100,7 +100,7 @@ struct mv_pci_range {
 };
 
 #define FDT_RANGES_CELLS   ((3 + 3 + 2) * 2)
-#define PCI_SPACE_LEN  0x0010
+#define PCI_SPACE_LEN  0x0040
 
 static void
 mv_pci_range_dump(struct mv_pci_range *range)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342106 - head/sys/arm/mv

2018-12-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Dec 15 02:35:48 2018
New Revision: 342106
URL: https://svnweb.freebsd.org/changeset/base/342106

Log:
  [mv_pci] Do not attempt to attach disabled PCI ports
  
  Fail probe for PCI port if the respective FDT node is not enabled
  
  Differential Revision:https://reviews.freebsd.org/D18385

Modified:
  head/sys/arm/mv/mv_pci.c

Modified: head/sys/arm/mv/mv_pci.c
==
--- head/sys/arm/mv/mv_pci.cFri Dec 14 23:53:28 2018(r342105)
+++ head/sys/arm/mv/mv_pci.cSat Dec 15 02:35:48 2018(r342106)
@@ -429,6 +429,9 @@ mv_pcib_probe(device_t self)
OF_parent(node), "marvell,armada-370-pcie")))
return (ENXIO);
 
+   if (!ofw_bus_status_okay(self))
+   return (ENXIO);
+
device_set_desc(self, "Marvell Integrated PCI/PCI-E Controller");
return (BUS_PROBE_DEFAULT);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342102 - head/sys/dev/iicbus/twsi

2018-12-14 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Dec 14 21:17:42 2018
New Revision: 342102
URL: https://svnweb.freebsd.org/changeset/base/342102

Log:
  [twsi] Make extres/clk part conditional based on the EXT_RESOURCES option 
value
  
  This should fix kernel build for ARMADA38X and possibly some other ARM configs
  
  Approved by:  manu

Modified:
  head/sys/dev/iicbus/twsi/mv_twsi.c
  head/sys/dev/iicbus/twsi/twsi.h

Modified: head/sys/dev/iicbus/twsi/mv_twsi.c
==
--- head/sys/dev/iicbus/twsi/mv_twsi.c  Fri Dec 14 21:16:04 2018
(r342101)
+++ head/sys/dev/iicbus/twsi/mv_twsi.c  Fri Dec 14 21:17:42 2018
(r342102)
@@ -61,7 +61,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef EXT_RESOURCES
 #include 
+#endif
 
 #include 
 #include 

Modified: head/sys/dev/iicbus/twsi/twsi.h
==
--- head/sys/dev/iicbus/twsi/twsi.h Fri Dec 14 21:16:04 2018
(r342101)
+++ head/sys/dev/iicbus/twsi/twsi.h Fri Dec 14 21:17:42 2018
(r342102)
@@ -34,7 +34,9 @@
 #ifndef _TWSI_H_
 #define_TWSI_H_
 
+#ifdef EXT_RESOURCES
 #include 
+#endif
 
 struct twsi_baud_rate {
uint32_traw;
@@ -48,8 +50,10 @@ struct twsi_softc {
struct resource *res[1];/* SYS_RES_MEMORY */
struct mtx  mutex;
device_tiicbus;
+#ifdef EXT_RESOURCES
clk_t   clk_core;
clk_t   clk_reg;
+#endif
 
bus_size_t  reg_data;
bus_size_t  reg_slave_addr;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r341406 - head/sys/arm/mv

2018-12-02 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Dec  2 21:58:36 2018
New Revision: 341406
URL: https://svnweb.freebsd.org/changeset/base/341406

Log:
  Fix PCI driver unload for Marvell PCI controller
  
  Add generic implementation for bus_deactivate_resource method. Without
  it bus_release_resource fails with "Failed to release active resource"
  message
  
  MFC after:1 week

Modified:
  head/sys/arm/mv/mv_pci_ctrl.c

Modified: head/sys/arm/mv/mv_pci_ctrl.c
==
--- head/sys/arm/mv/mv_pci_ctrl.c   Sun Dec  2 19:36:20 2018
(r341405)
+++ head/sys/arm/mv/mv_pci_ctrl.c   Sun Dec  2 21:58:36 2018
(r341406)
@@ -97,6 +97,7 @@ static device_method_t mv_pcib_ctrl_methods[] = {
DEVMETHOD(bus_alloc_resource,   mv_pcib_ctrl_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource,bus_generic_activate_resource),
+   DEVMETHOD(bus_deactivate_resource,  
bus_generic_deactivate_resource),
DEVMETHOD(bus_setup_intr,   bus_generic_setup_intr),
 
/* ofw_bus interface */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r339523 - in head/sys: conf dev/amdgpio modules modules/amdgpio

2018-10-21 Thread Oleksandr Tymoshenko
Nathan Whitehorn (nwhiteh...@freebsd.org) wrote:
> 
> 
> On 10/20/18 9:52 PM, Oleksandr Tymoshenko wrote:
> > Author: gonzo
> > Date: Sun Oct 21 04:52:37 2018
> > New Revision: 339523
> > URL: https://svnweb.freebsd.org/changeset/base/339523
> >
> > Log:
> >   Add amdgpio, driver for GPIO controller on AMD-based x86_64 platforms
> >   
> >   Submitted by: Rajesh Kumar 
> >   Differential Revision:https://reviews.freebsd.org/D16865
> >
> [...]
> > Modified: head/sys/modules/Makefile
> > ==
> > --- head/sys/modules/Makefile   Sun Oct 21 02:39:13 2018
> > (r339522)
> > +++ head/sys/modules/Makefile   Sun Oct 21 04:52:37 2018
> > (r339523)
> > @@ -34,6 +34,7 @@ SUBDIR=   \
> > ale \
> > alq \
> > ${_amd_ecc_inject} \
> > +   ${_amdgpio} \
> > ${_amdsbwd} \
> > ${_amdsmn} \
> > ${_amdtemp} \
> > @@ -717,6 +718,7 @@ _x86bios=   x86bios
> >  .endif
> >  
> >  .if ${MACHINE_CPUARCH} == "amd64"
> > +_amdgpio=  amdgpio
> >  _ccp=  ccp
> >  _efirt=efirt
> >  _iavf= iavf
> >
> 
> Does this not work on 64-bit AMD processors running i386 kernels?

I see no reason why it wouldn't. Probably just haven't been tested.

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


svn commit: r339523 - in head/sys: conf dev/amdgpio modules modules/amdgpio

2018-10-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Oct 21 04:52:37 2018
New Revision: 339523
URL: https://svnweb.freebsd.org/changeset/base/339523

Log:
  Add amdgpio, driver for GPIO controller on AMD-based x86_64 platforms
  
  Submitted by: Rajesh Kumar 
  Differential Revision:https://reviews.freebsd.org/D16865

Added:
  head/sys/dev/amdgpio/
  head/sys/dev/amdgpio/amdgpio.c   (contents, props changed)
  head/sys/dev/amdgpio/amdgpio.h   (contents, props changed)
  head/sys/modules/amdgpio/
  head/sys/modules/amdgpio/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/modules/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Sun Oct 21 02:39:13 2018(r339522)
+++ head/sys/conf/files.amd64   Sun Oct 21 04:52:37 2018(r339523)
@@ -208,6 +208,7 @@ dev/acpi_support/acpi_wmi_if.m  standard
 dev/agp/agp_amd64.coptionalagp
 dev/agp/agp_i810.c optionalagp
 dev/agp/agp_via.c  optionalagp
+dev/amdgpio/amdgpio.c  optionalamdgpio
 dev/amdsbwd/amdsbwd.c  optionalamdsbwd
 dev/amdsmn/amdsmn.coptionalamdsmn | amdtemp
 dev/amdtemp/amdtemp.c  optionalamdtemp

Added: head/sys/dev/amdgpio/amdgpio.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/amdgpio/amdgpio.c  Sun Oct 21 04:52:37 2018
(r339523)
@@ -0,0 +1,468 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 Advanced Micro Devices
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_acpi.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "gpio_if.h"
+#include "amdgpio.h"
+
+static struct resource_spec amdgpio_spec[] = {
+   { SYS_RES_MEMORY, 0, RF_ACTIVE },
+   { -1, 0, 0 }
+};
+
+static inline uint32_t
+amdgpio_read_4(struct amdgpio_softc *sc, bus_size_t off)
+{
+   return (bus_read_4(sc->sc_res[0], off));
+}
+
+static inline void
+amdgpio_write_4(struct amdgpio_softc *sc, bus_size_t off,
+   uint32_t val)
+{
+   bus_write_4(sc->sc_res[0], off, val);
+}
+
+static bool
+amdgpio_is_pin_output(struct amdgpio_softc *sc, uint32_t pin)
+{
+   uint32_t reg, val;
+   bool ret;
+
+   /* Get the current pin state */
+   AMDGPIO_LOCK(sc);
+
+   reg = AMDGPIO_PIN_REGISTER(pin);
+   val = amdgpio_read_4(sc, reg);
+
+   if (val & BIT(OUTPUT_ENABLE_OFF))
+   ret = true;
+   else
+   ret = false;
+
+   AMDGPIO_UNLOCK(sc);
+
+   return (ret);
+}
+
+static device_t
+amdgpio_get_bus(device_t dev)
+{
+   struct amdgpio_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   dprintf("busdev %p\n", sc->sc_busdev);
+   return (sc->sc_busdev);
+}
+
+static int
+amdgpio_pin_max(device_t dev, int *maxpin)
+{
+   struct amdgpio_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   *maxpin = sc->sc_npins - 1;
+   dprintf("npins %d maxpin %d\n", sc->sc_npins, *maxpin);
+
+   return (0);
+}
+
+static bool
+amdgpio_valid_pin(struct amdgpio_softc *sc, int pin)
+{
+   dprintf("pin %d\n", pin);
+   if (sc->sc_res[0] == NULL)
+   return (false);
+
+   if ((sc->sc_gpio_pins[pin].gp_pin == pin) &&
+   (sc->sc_gpio_pins[pin].gp_caps != 0))
+

svn commit: r339182 - head/sys/dev/ichiic

2018-10-04 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Oct  4 19:54:47 2018
New Revision: 339182
URL: https://svnweb.freebsd.org/changeset/base/339182

Log:
  [ig4] style(9) clean-up
  
  Submitted by: Rajesh Kumar 
  Approved by:  re (gjb, kib)

Modified:
  head/sys/dev/ichiic/ig4_iic.c

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Thu Oct  4 17:35:32 2018
(r339181)
+++ head/sys/dev/ichiic/ig4_iic.c   Thu Oct  4 19:54:47 2018
(r339182)
@@ -729,9 +729,9 @@ ig4iic_intr(void *cookie)
 * Workaround to trigger pending interrupt if IG4_REG_INTR_STAT
 * is changed after clearing it
 */
-   if(sc->access_intr_mask) {
+   if (sc->access_intr_mask != 0) {
status = reg_read(sc, IG4_REG_INTR_MASK);
-   if(status) {
+   if (status != 0) {
reg_write(sc, IG4_REG_INTR_MASK, 0);
reg_write(sc, IG4_REG_INTR_MASK, status);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r339007 - head/sys/dev/sdhci

2018-09-28 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Sep 29 00:35:36 2018
New Revision: 339007
URL: https://svnweb.freebsd.org/changeset/base/339007

Log:
  [sdhci] Add ACPI identifier for AMD eMMC 5.0 controller
  
  Submitted by: Rajesh Kumar 
  Approved by:  re (rgrimes)
  Differential Revision:https://reviews.freebsd.org/D17189

Modified:
  head/sys/dev/sdhci/sdhci_acpi.c

Modified: head/sys/dev/sdhci/sdhci_acpi.c
==
--- head/sys/dev/sdhci/sdhci_acpi.c Fri Sep 28 22:02:01 2018
(r339006)
+++ head/sys/dev/sdhci/sdhci_acpi.c Sat Sep 29 00:35:36 2018
(r339007)
@@ -79,6 +79,8 @@ static const struct sdhci_acpi_device {
SDHCI_QUIRK_MMC_DDR52 |
SDHCI_QUIRK_CAPS_BIT63_FOR_MMC_HS400 |
SDHCI_QUIRK_PRESET_VALUE_BROKEN },
+   { "AMDI0040",   0, "AMD eMMC 5.0 Controller",
+   SDHCI_QUIRK_32BIT_DMA_SIZE },
{ NULL, 0, NULL, 0}
 };
 
@@ -87,6 +89,7 @@ static char *sdhci_ids[] = {
"80860F16",
"80865ACA",
"80865ACC",
+   "AMDI0040",
NULL
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338701 - head/sys/dev/ichiic

2018-09-16 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep 16 21:44:36 2018
New Revision: 338701
URL: https://svnweb.freebsd.org/changeset/base/338701

Log:
  [ig4] Fix device description for Kaby Lake systems
  
  Kaby Lake I2C controller is Intel Sunrise Point-H not Intel Sunrise Point-LP.
  
  Submitted by: Dmitry Luhtionov
  Approved by:  re (kib)

Modified:
  head/sys/dev/ichiic/ig4_pci.c

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Sun Sep 16 19:28:27 2018
(r338700)
+++ head/sys/dev/ichiic/ig4_pci.c   Sun Sep 16 21:44:36 2018
(r338701)
@@ -112,8 +112,8 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] =
{ PCI_CHIP_SKYLAKE_I2C_3, "Intel Sunrise Point-LP I2C Controller-3", 
IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_4, "Intel Sunrise Point-LP I2C Controller-4", 
IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_5, "Intel Sunrise Point-LP I2C Controller-5", 
IG4_SKYLAKE},
-   { PCI_CHIP_KABYLAKE_I2C_0, "Intel Sunrise Point-LP I2C Controller-0", 
IG4_SKYLAKE},
-   { PCI_CHIP_KABYLAKE_I2C_1, "Intel Sunrise Point-LP I2C Controller-1", 
IG4_SKYLAKE},
+   { PCI_CHIP_KABYLAKE_I2C_0, "Intel Sunrise Point-H I2C Controller-0", 
IG4_SKYLAKE},
+   { PCI_CHIP_KABYLAKE_I2C_1, "Intel Sunrise Point-H I2C Controller-1", 
IG4_SKYLAKE},
{ PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", IG4_APL},
{ PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", IG4_APL},
{ PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", IG4_APL},
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2018-09-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Sep 13 17:39:08 2018
New Revision: 338655
URL: https://svnweb.freebsd.org/changeset/base/338655

Log:
  [ig4] Update list of supported hardware
  
  Reflect the fact that ig4(4) is not an Intel-specific device but
  a driver for Synopsys DesignWare I2C controller that now ships in
  AMD systems too.
  
  Approved by:  re (kib), rpokala

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

Modified: head/share/man/man4/ig4.4
==
--- head/share/man/man4/ig4.4   Thu Sep 13 17:36:55 2018(r338654)
+++ head/share/man/man4/ig4.4   Thu Sep 13 17:39:08 2018(r338655)
@@ -24,12 +24,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 03, 2016
+.Dd September 13, 2018
 .Dt IG4 4
 .Os
 .Sh NAME
 .Nm ig4
-.Nd Intel(R) fourth generation mobile CPU integrated I2C driver
+.Nd Synopsys DesignWare I2C Controller
 .Sh SYNOPSIS
 To compile this driver into the kernel, place the following lines into
 the kernel configuration file:
@@ -49,9 +49,9 @@ The
 driver provides access to peripherals attached to an I2C controller.
 .Sh HARDWARE
 .Nm
-supports the I2C controllers found in fourth generation Intel(R) Core(TM)
-processors based on the mobile U-processor line for intelligent systems.
-This includes the i7-4650U, i5-4300U, i3-4010U, and 2980U.
+supports the I2C controllers based on Synopsys DesignWare IP that can be found
+in Intel(R) Core(TM) processors starting from the fourth generation, Intel(R)
+Bay Trail, Apollo Lake SoC families, and some AMD systems.
 .Sh SYSCTL VARIABLES
 These
 .Xr sysctl 8
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338654 - head/sys/dev/ichiic

2018-09-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Sep 13 17:36:55 2018
New Revision: 338654
URL: https://svnweb.freebsd.org/changeset/base/338654

Log:
  [ig4] Add PCI IDs for I2C controller on Intel Kaby Lake systems
  
  PR:   221777
  Approved by:  re (kib)
  Submitted by: marc.priggeme...@gmail.com

Modified:
  head/sys/dev/ichiic/ig4_pci.c

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Thu Sep 13 16:41:15 2018
(r338653)
+++ head/sys/dev/ichiic/ig4_pci.c   Thu Sep 13 17:36:55 2018
(r338654)
@@ -80,6 +80,8 @@ static int ig4iic_pci_detach(device_t dev);
 #define PCI_CHIP_SKYLAKE_I2C_3 0x9d638086
 #define PCI_CHIP_SKYLAKE_I2C_4 0x9d648086
 #define PCI_CHIP_SKYLAKE_I2C_5 0x9d658086
+#define PCI_CHIP_KABYLAKE_I2C_00xa1608086
+#define PCI_CHIP_KABYLAKE_I2C_10xa1618086
 #define PCI_CHIP_APL_I2C_0 0x5aac8086
 #define PCI_CHIP_APL_I2C_1 0x5aae8086
 #define PCI_CHIP_APL_I2C_2 0x5ab08086
@@ -110,6 +112,8 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] =
{ PCI_CHIP_SKYLAKE_I2C_3, "Intel Sunrise Point-LP I2C Controller-3", 
IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_4, "Intel Sunrise Point-LP I2C Controller-4", 
IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_5, "Intel Sunrise Point-LP I2C Controller-5", 
IG4_SKYLAKE},
+   { PCI_CHIP_KABYLAKE_I2C_0, "Intel Sunrise Point-LP I2C Controller-0", 
IG4_SKYLAKE},
+   { PCI_CHIP_KABYLAKE_I2C_1, "Intel Sunrise Point-LP I2C Controller-1", 
IG4_SKYLAKE},
{ PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", IG4_APL},
{ PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", IG4_APL},
{ PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", IG4_APL},
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338574 - head/share/man/man4/man4.arm

2018-09-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Sep 10 22:48:26 2018
New Revision: 338574
URL: https://svnweb.freebsd.org/changeset/base/338574

Log:
  [bcm283x_pwm] Add documentation for the second PWM channel
  
  Document sysctls for the second PWM channel added in r335855
  Also fix some minor style issues and a typo.
  
  Approved by:  re (gjb)
  Submitted by: b...@mrp3.com
  Reviewed by:  0mp
  Differential Revision:https://reviews.freebsd.org/D17084

Modified:
  head/share/man/man4/man4.arm/bcm283x_pwm.4

Modified: head/share/man/man4/man4.arm/bcm283x_pwm.4
==
--- head/share/man/man4/man4.arm/bcm283x_pwm.4  Mon Sep 10 20:46:17 2018
(r338573)
+++ head/share/man/man4/man4.arm/bcm283x_pwm.4  Mon Sep 10 22:48:26 2018
(r338574)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 22, 2017
+.Dd September 10, 2018
 .Dt BCM283X_PWM 4
 .Os
 .Sh NAME
@@ -38,43 +38,56 @@
 .Sh DESCRIPTION
 The
 .Nm
-driver provides access to the PWM engine on GPIO12 of Rpi 2 and 3 hardware.
+driver provides access to the PWM engine on GPIO12 of Raspberry Pi 2 and 3 
hardware.
 .Pp
 The PWM hardware is controlled via the
 .Xr sysctl 8
 interface:
 .Bd -literal
 dev.pwm.0.mode: 1
+dev.pwm.0.mode2: 1
 dev.pwm.0.freq: 12500
 dev.pwm.0.ratio: 2500
+dev.pwm.0.ratio2: 2500
 dev.pwm.0.period: 1
+dev.pwm.0.period2: 1
 dev.pwm.0.pwm_freq: 12500
+dev.pwm.0.pwm_freq2: 12500
 .Ed
-.Bl -tag -width ".Va dev.pwm.0.mode"
-.It Va dev.pwm.0.mode
+.Bl -tag -width ".Va dev.pwm"
+.It Va dev.pwm.0.mode , dev.pwm.0.mode2
+PWM Mode for channels 1 and 2.
 Three modes exist, 0=off, 1=PWM, 2=N/M.
 The N/M mode is a first order delta-sigma mode, which makes a quite
 handy DAC output with a trivial RC lowpass filter.
 .Pp
 .It Va dev.pwm.0.freq
 The input frequency to the PWM hardware in Hz.
-Minmum frequency is 123 kHz, maximum frequency is 125 MHz.
-.It Va dev.pwm.0.period
+Applies to both channels 1 and 2.
+Minimum frequency is 123 kHz, maximum frequency is 125 MHz.
+.It Va dev.pwm.0.period , dev.pwm.0.period2
 The period length in cycles.
-In PWM mode, the output frequency will be
+In PWM mode, the output frequencies will be
 (
 .Va dev.pwm.0.freq
 /
-.Va dev.pwm.0.period .
-)
-In N/M mode this is the 'M'
-.It Va dev.pwm.0.ratio
-The "on" period in cycles.
+.Va dev.pwm.period
+) and (
+.Va dev.pwm.0.freq2
+/
+.Va dev.pwm.0.period2
+).
+In N/M mode this is the 'M'.
+.It Va dev.pwm.0.ratio , dev.pwm.0.ratio2
+The "on" period in cycles for PWM channels 1 and 2.
 In PWM mode, to get a 25% dutycycle, set this to 25% of
-.Va dev.pwm.0.period .
-In N/M mode this is the 'N'
-.It Va dev.pwm.0.pwm_freq
-The calculated PWM output frequency in PWM mode.
+.Va dev.pwm.0.period
+or
+.Va dev.pwm.0.period2 ,
+as appropriate.
+In N/M mode this is the 'N'.
+.It Va dev.pwm.0.pwm_freq , dev.pwm.0.pwm_freq2
+The calculated PWM output frequencies in PWM mode, for channels 1 and 2.
 .El
 .Pp
 .Sh NOTES
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338215 - head/sys/dev/ichiic

2018-08-22 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Aug 22 22:56:01 2018
New Revision: 338215
URL: https://svnweb.freebsd.org/changeset/base/338215

Log:
  [ig4] Fix I/O timeout issue with Designware I2C controller on AMD platforms
  
  Due to hardware limitation AMD I2C controller can't trigger pending
  interrupt if interrupt status has been changed after clearing
  interrupt status bits.  So, I2C will lose the interrupt and IO will be
  timed out. Implements a workaround to disable I2C controller interrupt
  and re-enable I2C interrupt before existing interrupt handler.
  
  Submitted by: rajf...@gmail.com
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D16720

Modified:
  head/sys/dev/ichiic/ig4_acpi.c
  head/sys/dev/ichiic/ig4_iic.c
  head/sys/dev/ichiic/ig4_var.h

Modified: head/sys/dev/ichiic/ig4_acpi.c
==
--- head/sys/dev/ichiic/ig4_acpi.c  Wed Aug 22 22:19:42 2018
(r338214)
+++ head/sys/dev/ichiic/ig4_acpi.c  Wed Aug 22 22:56:01 2018
(r338215)
@@ -68,10 +68,20 @@ static char *ig4iic_ids[] = {
 static int
 ig4iic_acpi_probe(device_t dev)
 {
+   ig4iic_softc_t *sc;
+   char *hid;
 
-   if (acpi_disabled("ig4iic") ||
-   ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids) == NULL)
-   return (ENXIO);
+   sc = device_get_softc(dev);
+
+   if (acpi_disabled("ig4iic"))
+   return (ENXIO);
+
+   hid = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids);
+   if (hid == NULL)
+   return (ENXIO);
+
+   if (strcmp("AMDI0010", hid) == 0)
+   sc->access_intr_mask = 1;
 
device_set_desc(dev, "Designware I2C Controller");
return (0);

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Wed Aug 22 22:19:42 2018
(r338214)
+++ head/sys/dev/ichiic/ig4_iic.c   Wed Aug 22 22:56:01 2018
(r338215)
@@ -724,6 +724,19 @@ ig4iic_intr(void *cookie)
++sc->rnext;
status = reg_read(sc, IG4_REG_I2C_STA);
}
+
+   /* 
+* Workaround to trigger pending interrupt if IG4_REG_INTR_STAT
+* is changed after clearing it
+*/
+   if(sc->access_intr_mask) {
+   status = reg_read(sc, IG4_REG_INTR_MASK);
+   if(status) {
+   reg_write(sc, IG4_REG_INTR_MASK, 0);
+   reg_write(sc, IG4_REG_INTR_MASK, status);
+   }
+   }
+
wakeup(sc);
mtx_unlock(>io_lock);
 }

Modified: head/sys/dev/ichiic/ig4_var.h
==
--- head/sys/dev/ichiic/ig4_var.h   Wed Aug 22 22:19:42 2018
(r338214)
+++ head/sys/dev/ichiic/ig4_var.h   Wed Aug 22 22:56:01 2018
(r338215)
@@ -72,6 +72,7 @@ struct ig4iic_softc {
int slave_valid : 1;
int read_started : 1;
int write_started : 1;
+   int access_intr_mask : 1;
 
/*
 * Locking semantics:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338157 - in head/sys: arm64/conf conf

2018-08-21 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Aug 21 21:30:19 2018
New Revision: 338157
URL: https://svnweb.freebsd.org/changeset/base/338157

Log:
  Add muge(4) to the arm64 GENERIC kernel
  
  muge(4) is the USB ethernet adapter that is used in RPi 3B+. Shipping it
  in GENERIC kernel allows using NFS root out of the box instead of either
  building custom kernel or modifying loader.conf for early loading of 
if_muge.ko
  
  No objections:emaste

Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Tue Aug 21 21:08:58 2018(r338156)
+++ head/sys/arm64/conf/GENERIC Tue Aug 21 21:30:19 2018(r338157)
@@ -188,6 +188,7 @@ device  ukbd# Keyboard
 device umass   # Disks/Mass storage - Requires scbus 
and da
 
 # USB ethernet support
+device muge
 device smcphy
 device smsc
 

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Aug 21 21:08:58 2018(r338156)
+++ head/sys/conf/files Tue Aug 21 21:30:19 2018(r338157)
@@ -3298,6 +3298,7 @@ dev/usb/net/if_cue.c  optional cue
 dev/usb/net/if_ipheth.coptional ipheth
 dev/usb/net/if_kue.c   optional kue
 dev/usb/net/if_mos.c   optional mos
+dev/usb/net/if_muge.c  optional muge
 dev/usb/net/if_rue.c   optional rue
 dev/usb/net/if_smsc.c  optional smsc
 dev/usb/net/if_udav.c  optional udav
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r338111 - head/sys/dev/ichiic

2018-08-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Aug 20 18:50:56 2018
New Revision: 338111
URL: https://svnweb.freebsd.org/changeset/base/338111

Log:
  [ig4] add ACPI Device HID for AMD platforms
  
  Added ACPI Device HID AMDI0010 for the designware I2C controllers in
  future AMD platforms. Also, when verifying component version check for
  minimal value instead of exact match.
  
  PR:   230641
  Submitted by: Rajesh 
  Reviewed by:  cem, gonzo
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D16670

Modified:
  head/sys/dev/ichiic/ig4_acpi.c
  head/sys/dev/ichiic/ig4_iic.c
  head/sys/dev/ichiic/ig4_reg.h

Modified: head/sys/dev/ichiic/ig4_acpi.c
==
--- head/sys/dev/ichiic/ig4_acpi.c  Mon Aug 20 18:17:50 2018
(r338110)
+++ head/sys/dev/ichiic/ig4_acpi.c  Mon Aug 20 18:50:56 2018
(r338111)
@@ -60,6 +60,7 @@ static char *ig4iic_ids[] = {
"80860F41",
"808622C1",
"AMDI0510",
+   "AMDI0010",
"APMC0D0F",
NULL
 };

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Mon Aug 20 18:17:50 2018
(r338110)
+++ head/sys/dev/ichiic/ig4_iic.c   Mon Aug 20 18:50:56 2018
(r338111)
@@ -563,7 +563,7 @@ ig4iic_attach(ig4iic_softc_t *sc)
 
if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) {
v = reg_read(sc, IG4_REG_COMP_VER);
-   if (v != IG4_COMP_VER) {
+   if (v < IG4_COMP_MIN_VER) {
error = ENXIO;
goto done;
}

Modified: head/sys/dev/ichiic/ig4_reg.h
==
--- head/sys/dev/ichiic/ig4_reg.h   Mon Aug 20 18:17:50 2018
(r338110)
+++ head/sys/dev/ichiic/ig4_reg.h   Mon Aug 20 18:50:56 2018
(r338111)
@@ -73,7 +73,6 @@
  * SDA_HOLD0x0001
  * SDA_SETUP   0x0064
  * COMP_PARAM1 0x006E
- * COMP_VER0x3131352A
  */
 
 #define IG4_REG_CTL0x  /* RW   Control Register */
@@ -552,11 +551,10 @@
 
 /*
  * COMP_VER - (RO) Component Version Register  22.2.36
- *Default Value 0x3131352A
  *
  * Contains the chip version number.  All 32 bits.
  */
-#define IG4_COMP_VER   0x3131352A
+#define IG4_COMP_MIN_VER   0x3131352A
 
 /*
  * COMP_TYPE - (RO) (linux) Endian and bus width probe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r337719 - head/sys/dev/ichiic

2018-08-13 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Aug 13 18:53:14 2018
New Revision: 337719
URL: https://svnweb.freebsd.org/changeset/base/337719

Log:
  [ig4] Fix initialization sequence for newer ig4 chips
  
  Newer chips may require assert/deassert after power down for proper
  startup. Check respective flag in DEVIDLE_CTRL and perform operation
  if neccesssary.
  
  PR:   221777
  Submitted by: marc.priggeme...@gmail.com
  Obtained from:DragonFly BSD
  Tested on:Thinkpad T470

Modified:
  head/sys/dev/ichiic/ig4_iic.c
  head/sys/dev/ichiic/ig4_reg.h

Modified: head/sys/dev/ichiic/ig4_iic.c
==
--- head/sys/dev/ichiic/ig4_iic.c   Mon Aug 13 17:24:31 2018
(r337718)
+++ head/sys/dev/ichiic/ig4_iic.c   Mon Aug 13 18:53:14 2018
(r337719)
@@ -525,6 +525,16 @@ ig4iic_attach(ig4iic_softc_t *sc)
mtx_init(>io_lock, "IG4 I/O lock", NULL, MTX_DEF);
sx_init(>call_lock, "IG4 call lock");
 
+   v = reg_read(sc, IG4_REG_DEVIDLE_CTRL);
+   if (sc->version == IG4_SKYLAKE && (v & IG4_RESTORE_REQUIRED) ) {
+   reg_write(sc, IG4_REG_DEVIDLE_CTRL, IG4_DEVICE_IDLE | 
IG4_RESTORE_REQUIRED);
+   reg_write(sc, IG4_REG_DEVIDLE_CTRL, 0);
+
+   reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_ASSERT_SKL);
+   reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_DEASSERT_SKL);
+   DELAY(1000);
+   }
+
if (sc->version == IG4_ATOM)
v = reg_read(sc, IG4_REG_COMP_TYPE);


Modified: head/sys/dev/ichiic/ig4_reg.h
==
--- head/sys/dev/ichiic/ig4_reg.h   Mon Aug 13 17:24:31 2018
(r337718)
+++ head/sys/dev/ichiic/ig4_reg.h   Mon Aug 13 18:53:14 2018
(r337719)
@@ -78,6 +78,7 @@
 
 #define IG4_REG_CTL0x  /* RW   Control Register */
 #define IG4_REG_TAR_ADD0x0004  /* RW   Target Address */
+#define IG4_REG_HS_MADDR   0x000C  /* RW   High Speed Master Mode Code 
Address*/
 #define IG4_REG_DATA_CMD   0x0010  /* RW   Data Buffer and Command */
 #define IG4_REG_SS_SCL_HCNT0x0014  /* RW   Std Speed clock High Count */
 #define IG4_REG_SS_SCL_LCNT0x0018  /* RW   Std Speed clock Low Count */
@@ -92,7 +93,9 @@
 #define IG4_REG_CLR_RX_UNDER   0x0044  /* RO   Clear RX_Under Interrupt */
 #define IG4_REG_CLR_RX_OVER0x0048  /* RO   Clear RX_Over Interrupt */
 #define IG4_REG_CLR_TX_OVER0x004C  /* RO   Clear TX_Over Interrupt */
+#define IG4_REG_CLR_RD_REQ 0x0050  /* RO   Clear RD_Req Interrupt */
 #define IG4_REG_CLR_TX_ABORT   0x0054  /* RO   Clear TX_Abort Interrupt */
+#define IG4_REG_CLR_RX_DONE0x0058  /* RO   Clear RX_Done Interrupt */
 #define IG4_REG_CLR_ACTIVITY   0x005C  /* RO   Clear Activity Interrupt */
 #define IG4_REG_CLR_STOP_DET   0x0060  /* RO   Clear STOP Detection Int */
 #define IG4_REG_CLR_START_DET  0x0064  /* RO   Clear START Detection Int */
@@ -108,6 +111,7 @@
 #define IG4_REG_DMA_TDLR   0x008C  /* RW   DMA Transmit Data Level */
 #define IG4_REG_DMA_RDLR   0x0090  /* RW   DMA Receive Data Level */
 #define IG4_REG_SDA_SETUP  0x0094  /* RW   SDA Setup */
+#define IG4_REG_ACK_GENERAL_CALL 0x0098/* RW   I2C ACK General Call */
 #define IG4_REG_ENABLE_STATUS  0x009C  /* RO   Enable Status */
 /* Available at least on Atom SoCs and Haswell mobile. */
 #define IG4_REG_COMP_PARAM10x00F4  /* RO   Component Parameter */
@@ -118,6 +122,9 @@
 #define IG4_REG_RESETS_SKL 0x0204  /* RW   Reset Register */
 #define IG4_REG_ACTIVE_LTR_VALUE 0x0210/* RW   Active LTR Value */
 #define IG4_REG_IDLE_LTR_VALUE 0x0214  /* RW   Idle LTR Value */
+#define IG4_REG_TX_ACK_COUNT   0x0218  /* RO   TX ACK Count */
+#define IG4_REG_RX_BYTE_COUNT  0x021C  /* RO   RX ACK Count */
+#define IG4_REG_DEVIDLE_CTRL   0x024C  /* RW   Device Control */
 /* Available at least on Atom SoCs */
 #define IG4_REG_CLK_PARMS  0x0800  /* RW   Clock Parameters */
 /* Available at least on Atom SoCs and Haswell mobile */
@@ -581,6 +588,17 @@
 /* Skylake-U/Y and Kaby Lake-U/Y have the reset bits inverted */
 #define IG4_RESETS_DEASSERT_SKL0x0003
 #define IG4_RESETS_ASSERT_SKL  0x
+
+/* Newer versions of the I2C controller allow to check whether
+ * the above ASSERT/DEASSERT is necessary by querying the DEVIDLE_CONTROL
+ * register.
+ * 
+ * the RESTORE_REQUIRED bit can be cleared by writing 1
+ * the DEVICE_IDLE status can be set to put the controller in an idle state
+ *
+ */
+#define IG4_RESTORE_REQUIRED   0x0008
+#define IG4_DEVICE_IDLE0x0004
 
 /*
  * GENERAL - (RW) General Reigster 22.2.38
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r336326 - head/sys/dev/ichiic

2018-07-15 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jul 16 01:34:45 2018
New Revision: 336326
URL: https://svnweb.freebsd.org/changeset/base/336326

Log:
  Remove MODULE_PNP_INFO for ig4(4) driver
  
  ig4(4) does not support suspend/resume but present on the hardware where
  such functionality is critical, like laptops. Remove PNP info to avoid
  breaking suspend/resume on the systems where ig4(4) load is not explicitly
  requested by the user.
  
  PR: 229791
  Reported by:Ali Abdallah

Modified:
  head/sys/dev/ichiic/ig4_pci.c

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Mon Jul 16 01:07:28 2018
(r336325)
+++ head/sys/dev/ichiic/ig4_pci.c   Mon Jul 16 01:34:45 2018
(r336326)
@@ -228,5 +228,7 @@ DRIVER_MODULE_ORDERED(ig4iic_pci, pci, ig4iic_pci_driv
 MODULE_DEPEND(ig4iic_pci, pci, 1, 1, 1);
 MODULE_DEPEND(ig4iic_pci, iicbus, IICBUS_MINVER, IICBUS_PREFVER, 
IICBUS_MAXVER);
 MODULE_VERSION(ig4iic_pci, 1);
-MODULE_PNP_INFO("W32:vendor/device", pci, ig4iic_pci, ig4iic_pci_devices,
-sizeof(ig4iic_pci_devices[0]), nitems(ig4iic_pci_devices));
+/*
+ * Loading this module breaks suspend/resume on laptops
+ * Do not add MODULE_PNP_INFO until it's impleneted
+ */ 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r336325 - head/sys/arm/broadcom/bcm2835

2018-07-15 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jul 16 01:07:28 2018
New Revision: 336325
URL: https://svnweb.freebsd.org/changeset/base/336325

Log:
  Remove two checks that are always false
  
  Outer loop condition contradicts inner check so code under inner condition
  is not reachable. Remove it.
  
  PR:   229722
  Reported by:  David Binderman

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c  Mon Jul 16 00:28:33 
2018(r336324)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c  Mon Jul 16 01:07:28 
2018(r336325)
@@ -1022,12 +1022,8 @@ bcm_sdhost_read_multi_4(device_t dev, struct sdhci_slo
for (i = 0; i < count;) {
edm = RD4(sc, HC_DEBUG);
avail = ((edm >> 4) & 0x1f);
-   if (i + avail > count) {
-   if (i >= count)
-   return;
-   else
-   avail = count - i;
-   }
+   if (i + avail > count)
+   avail = count - i;
if (avail > 0)
bus_space_read_multi_4(sc->sc_bst, sc->sc_bsh,
HC_DATAPORT, data + i, avail);
@@ -1234,12 +1230,8 @@ bcm_sdhost_write_multi_4(device_t dev, struct sdhci_sl
for (i = 0; i < count;) {
edm = RD4(sc, HC_DEBUG);
space = HC_FIFO_SIZE - ((edm >> 4) & 0x1f);
-   if (i + space > count) {
-   if (i >= count)
-   return;
-   else
-   space = count - i;
-   }
+   if (i + space > count)
+   space = count - i;
if (space > 0)
bus_space_write_multi_4(sc->sc_bst, sc->sc_bsh,
HC_DATAPORT, data + i, space);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r336142 - head/sys/dev/ichiic

2018-07-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jul  9 20:00:45 2018
New Revision: 336142
URL: https://svnweb.freebsd.org/changeset/base/336142

Log:
  ig4(4): add devmatch(8) PNP info
  
  Now that we have all devices ids in a table add MODULE_PNP_INFO macro
  to let devmatch autoload module

Modified:
  head/sys/dev/ichiic/ig4_pci.c

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Mon Jul  9 19:58:01 2018
(r336141)
+++ head/sys/dev/ichiic/ig4_pci.c   Mon Jul  9 20:00:45 2018
(r336142)
@@ -117,8 +117,7 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] =
{ PCI_CHIP_APL_I2C_4, "Intel Apollo Lake I2C Controller-4", IG4_APL},
{ PCI_CHIP_APL_I2C_5, "Intel Apollo Lake I2C Controller-5", IG4_APL},
{ PCI_CHIP_APL_I2C_6, "Intel Apollo Lake I2C Controller-6", IG4_APL},
-   { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL},
-   { 0, NULL, 0 },
+   { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL}
 };
 
 static int
@@ -129,7 +128,7 @@ ig4iic_pci_probe(device_t dev)
int i;
 
devid = pci_get_devid(dev);
-   for (i = 0; ig4iic_pci_devices[i].devid != 0; i++) {
+   for (i = 0; i < nitems(ig4iic_pci_devices); i++) {
if (ig4iic_pci_devices[i].devid == devid) {
device_set_desc(dev, ig4iic_pci_devices[i].desc);
sc->version = ig4iic_pci_devices[i].version;
@@ -229,3 +228,5 @@ DRIVER_MODULE_ORDERED(ig4iic_pci, pci, ig4iic_pci_driv
 MODULE_DEPEND(ig4iic_pci, pci, 1, 1, 1);
 MODULE_DEPEND(ig4iic_pci, iicbus, IICBUS_MINVER, IICBUS_PREFVER, 
IICBUS_MAXVER);
 MODULE_VERSION(ig4iic_pci, 1);
+MODULE_PNP_INFO("W32:vendor/device", pci, ig4iic_pci, ig4iic_pci_devices,
+sizeof(ig4iic_pci_devices[0]), nitems(ig4iic_pci_devices));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r336051 - head/sys/dev/ichiic

2018-07-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jul  6 22:01:00 2018
New Revision: 336051
URL: https://svnweb.freebsd.org/changeset/base/336051

Log:
  ig4(4): Fix Apollo lake entries platform identifier
  
  Identify Apollo Lake controllers as IG4_APL and not as a IG4_SKYLAKE
  
  Reported by:  rpokala@

Modified:
  head/sys/dev/ichiic/ig4_pci.c

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Fri Jul  6 21:22:50 2018
(r336050)
+++ head/sys/dev/ichiic/ig4_pci.c   Fri Jul  6 22:01:00 2018
(r336051)
@@ -110,14 +110,14 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] =
{ PCI_CHIP_SKYLAKE_I2C_3, "Intel Sunrise Point-LP I2C Controller-3", 
IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_4, "Intel Sunrise Point-LP I2C Controller-4", 
IG4_SKYLAKE},
{ PCI_CHIP_SKYLAKE_I2C_5, "Intel Sunrise Point-LP I2C Controller-5", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_3, "Intel Apollo Lake I2C Controller-3", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_4, "Intel Apollo Lake I2C Controller-4", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_5, "Intel Apollo Lake I2C Controller-5", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_6, "Intel Apollo Lake I2C Controller-6", 
IG4_SKYLAKE},
-   { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", IG4_APL},
+   { PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", IG4_APL},
+   { PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", IG4_APL},
+   { PCI_CHIP_APL_I2C_3, "Intel Apollo Lake I2C Controller-3", IG4_APL},
+   { PCI_CHIP_APL_I2C_4, "Intel Apollo Lake I2C Controller-4", IG4_APL},
+   { PCI_CHIP_APL_I2C_5, "Intel Apollo Lake I2C Controller-5", IG4_APL},
+   { PCI_CHIP_APL_I2C_6, "Intel Apollo Lake I2C Controller-6", IG4_APL},
+   { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", IG4_APL},
{ 0, NULL, 0 },
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r336050 - head/sys/dev/ichiic

2018-07-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Jul  6 21:22:50 2018
New Revision: 336050
URL: https://svnweb.freebsd.org/changeset/base/336050

Log:
  ig4(4): add support for Apollo Lake I2C controllers
  
  Add PCI ids for I2C controllers on Apollo Lake platform. Also convert
  switch/case probe logic into a table.
  
  Reviewed by:  avg
  Differential Revision:https://reviews.freebsd.org/D16120

Modified:
  head/sys/dev/ichiic/ig4_pci.c
  head/sys/dev/ichiic/ig4_var.h

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Fri Jul  6 21:01:52 2018
(r336049)
+++ head/sys/dev/ichiic/ig4_pci.c   Fri Jul  6 21:22:50 2018
(r336050)
@@ -80,73 +80,63 @@ static int ig4iic_pci_detach(device_t dev);
 #define PCI_CHIP_SKYLAKE_I2C_3 0x9d638086
 #define PCI_CHIP_SKYLAKE_I2C_4 0x9d648086
 #define PCI_CHIP_SKYLAKE_I2C_5 0x9d658086
+#define PCI_CHIP_APL_I2C_0 0x5aac8086
+#define PCI_CHIP_APL_I2C_1 0x5aae8086
+#define PCI_CHIP_APL_I2C_2 0x5ab08086
+#define PCI_CHIP_APL_I2C_3 0x5ab28086
+#define PCI_CHIP_APL_I2C_4 0x5ab48086
+#define PCI_CHIP_APL_I2C_5 0x5ab68086
+#define PCI_CHIP_APL_I2C_6 0x5ab88086
+#define PCI_CHIP_APL_I2C_7 0x5aba8086
 
+struct ig4iic_pci_device {
+   uint32_tdevid;
+   const char  *desc;
+   enum ig4_vers   version;
+};
+
+static struct ig4iic_pci_device ig4iic_pci_devices[] = {
+   { PCI_CHIP_LYNXPT_LP_I2C_1, "Intel Lynx Point-LP I2C Controller-1", 
IG4_HASWELL},
+   { PCI_CHIP_LYNXPT_LP_I2C_2, "Intel Lynx Point-LP I2C Controller-2", 
IG4_HASWELL},
+   { PCI_CHIP_BRASWELL_I2C_1, "Intel Braswell Serial I/O I2C Port 1", 
IG4_ATOM},
+   { PCI_CHIP_BRASWELL_I2C_2, "Intel Braswell Serial I/O I2C Port 2", 
IG4_ATOM},
+   { PCI_CHIP_BRASWELL_I2C_3, "Intel Braswell Serial I/O I2C Port 3", 
IG4_ATOM},
+   { PCI_CHIP_BRASWELL_I2C_5, "Intel Braswell Serial I/O I2C Port 5", 
IG4_ATOM},
+   { PCI_CHIP_BRASWELL_I2C_6, "Intel Braswell Serial I/O I2C Port 6", 
IG4_ATOM},
+   { PCI_CHIP_BRASWELL_I2C_7, "Intel Braswell Serial I/O I2C Port 7", 
IG4_ATOM},
+   { PCI_CHIP_SKYLAKE_I2C_0, "Intel Sunrise Point-LP I2C Controller-0", 
IG4_SKYLAKE},
+   { PCI_CHIP_SKYLAKE_I2C_1, "Intel Sunrise Point-LP I2C Controller-1", 
IG4_SKYLAKE},
+   { PCI_CHIP_SKYLAKE_I2C_2, "Intel Sunrise Point-LP I2C Controller-2", 
IG4_SKYLAKE},
+   { PCI_CHIP_SKYLAKE_I2C_3, "Intel Sunrise Point-LP I2C Controller-3", 
IG4_SKYLAKE},
+   { PCI_CHIP_SKYLAKE_I2C_4, "Intel Sunrise Point-LP I2C Controller-4", 
IG4_SKYLAKE},
+   { PCI_CHIP_SKYLAKE_I2C_5, "Intel Sunrise Point-LP I2C Controller-5", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_0, "Intel Apollo Lake I2C Controller-0", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_1, "Intel Apollo Lake I2C Controller-1", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_2, "Intel Apollo Lake I2C Controller-2", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_3, "Intel Apollo Lake I2C Controller-3", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_4, "Intel Apollo Lake I2C Controller-4", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_5, "Intel Apollo Lake I2C Controller-5", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_6, "Intel Apollo Lake I2C Controller-6", 
IG4_SKYLAKE},
+   { PCI_CHIP_APL_I2C_7, "Intel Apollo Lake I2C Controller-7", 
IG4_SKYLAKE},
+   { 0, NULL, 0 },
+};
+
 static int
 ig4iic_pci_probe(device_t dev)
 {
ig4iic_softc_t *sc = device_get_softc(dev);
+   uint32_t devid;
+   int i;
 
-   switch(pci_get_devid(dev)) {
-   case PCI_CHIP_LYNXPT_LP_I2C_1:
-   device_set_desc(dev, "Intel Lynx Point-LP I2C Controller-1");
-   sc->version = IG4_HASWELL;
-   break;
-   case PCI_CHIP_LYNXPT_LP_I2C_2:
-   device_set_desc(dev, "Intel Lynx Point-LP I2C Controller-2");
-   sc->version = IG4_HASWELL;
-   break;
-   case PCI_CHIP_BRASWELL_I2C_1:
-   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 1");
-   sc->version = IG4_ATOM;
-   break;
-   case PCI_CHIP_BRASWELL_I2C_2:
-   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 2");
-   sc->version = IG4_ATOM;
-   break;
-   case PCI_CHIP_BRASWELL_I2C_3:
-   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 3");
-   sc->version = IG4_ATOM;
-   break;
-   case PCI_CHIP_BRASWELL_I2C_5:
-   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 5");
-   sc->version = IG4_ATOM;
-   break;
-   case PCI_CHIP_BRASWELL_I2C_6:
-   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 6");
-   sc->version = IG4_ATOM;
-   break;
-   case PCI_CHIP_BRASWELL_I2C_7:
-

svn commit: r335925 - head/sys/dev/usb/net

2018-07-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jul  4 03:02:53 2018
New Revision: 335925
URL: https://svnweb.freebsd.org/changeset/base/335925

Log:
  muge(4): add DTB blob as one more possible source of MAC address
  
  On FDT-enabled platforms check if DTB blob has MAC address configured by
  a boot loader. This information passed as a "local-mac-address" or
  "mac-address" property of the device node. For USB NICs node
  can be found by looking for compatibility string "usbVVV,PPP" where
  VVV - vendor id (hex) and PPP - product id (hex)
  
  Reviewed by:  emaste
  Differential Revision:https://reviews.freebsd.org/D16117

Modified:
  head/sys/dev/usb/net/if_muge.c

Modified: head/sys/dev/usb/net/if_muge.c
==
--- head/sys/dev/usb/net/if_muge.c  Wed Jul  4 02:47:16 2018
(r335924)
+++ head/sys/dev/usb/net/if_muge.c  Wed Jul  4 03:02:53 2018
(r335925)
@@ -95,6 +95,12 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_platform.h"
 
+#ifdef FDT
+#include 
+#include 
+#include 
+#endif
+
 #include 
 #include 
 #include 
@@ -1427,30 +1433,117 @@ tr_setup:
}
 }
 
+#ifdef FDT
 /**
- * muge_attach_post - Called after the driver attached to the USB interface
- * @ue: the USB ethernet device
+ * muge_fdt_find_eth_node - find descendant node with required 
compatibility
+ * @start: start node
+ * @compatible: compatible string used to identify the node
  *
- * This is where the chip is intialised for the first time.  This is
- * different from the muge_init() function in that that one is designed to
- * setup the H/W to match the UE settings and can be called after a reset.
+ * Loop through all descendant nodes and return first match with required
+ * compatibility.
  *
+ * RETURNS:
+ * Returns node's phandle on success -1 otherwise
  */
+static phandle_t
+muge_fdt_find_eth_node(phandle_t start, const char *compatible)
+{
+   phandle_t child, node;
+
+   /* Traverse through entire tree to find usb ethernet nodes. */
+   for (node = OF_child(start); node != 0; node = OF_peer(node)) {
+   if (ofw_bus_node_is_compatible(node, compatible))
+   return (node);
+   child = muge_fdt_find_eth_node(node, compatible);
+   if (child != -1)
+   return (child);
+   }
+
+   return (-1);
+}
+
+/**
+ * muge_fdt_read_mac_property - read MAC address from node
+ * @node: USB device node
+ * @mac: memory to store MAC address to
+ *
+ * Check for common properties that might contain MAC address
+ * passed by boot loader.
+ *
+ * RETURNS:
+ * Returns 0 on success, error code otherwise
+ */
+static int
+muge_fdt_read_mac_property(phandle_t node, unsigned char *mac)
+{
+   int len;
+
+   /* Check if there is property */
+   if ((len = OF_getproplen(node, "local-mac-address")) > 0) {
+   if (len != ETHER_ADDR_LEN)
+   return (EINVAL);
+
+   OF_getprop(node, "local-mac-address", mac,
+   ETHER_ADDR_LEN);
+   return (0);
+   }
+
+   if ((len = OF_getproplen(node, "mac-address")) > 0) {
+   if (len != ETHER_ADDR_LEN)
+   return (EINVAL);
+
+   OF_getprop(node, "mac-address", mac,
+   ETHER_ADDR_LEN);
+   return (0);
+   }
+
+   return (ENXIO);
+}
+
+/**
+ * muge_fdt_find_mac - read MAC address from node
+ * @compatible: compatible string for DTB node in the form 
"usb[N]NNN,[M]MMM"
+ * where NNN is vendor id and MMM is product id
+ * @mac: memory to store MAC address to
+ *
+ * Tries to find matching node in DTS and obtain MAC address info from it
+ *
+ * RETURNS:
+ * Returns 0 on success, error code otherwise
+ */
+static int
+muge_fdt_find_mac(const char *compatible, unsigned char *mac)
+{
+   phandle_t node, root;
+
+   root = OF_finddevice("/");
+   node = muge_fdt_find_eth_node(root, compatible);
+   if (node != -1) {
+   if (muge_fdt_read_mac_property(node, mac) == 0)
+   return (0);
+   }
+
+   return (ENXIO);
+}
+#endif
+
+/**
+ * muge_set_mac_addr - Initiailizes NIC MAC address
+ * @ue: the USB ethernet device
+ *
+ * Tries to obtain MAC address from number of sources: registers,
+ * EEPROM, DTB blob. If all sources fail - generates random MAC.
+ */
 static void
-muge_attach_post(struct usb_ether *ue)
+muge_set_mac_addr(struct usb_ether *ue)
 {
struct muge_softc *sc = uether_getsc(ue);
uint32_t mac_h, mac_l;
-   muge_dbg_printf(sc, "Calling muge_attach_post.\n");
+#ifdef FDT
+   char compatible[16];
+   struct usb_attach_arg *uaa = device_get_ivars(ue->ue_dev);
+#endif
 
-   /* Setup some of the basics */
-   sc->sc_phyno = 1;
-
-   /*
-* Attempt to get the mac 

svn commit: r335855 - head/sys/arm/broadcom/bcm2835

2018-07-01 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jul  2 01:30:33 2018
New Revision: 335855
URL: https://svnweb.freebsd.org/changeset/base/335855

Log:
  [rpi] Add support for the second PWM channel
  
  Add support for the second channel to bcm2835_pwm driver. Configurable
  parameters like mode, period, ratio are exposed as sysctls with postfix '2',
  e.g.: dev.pwm.N.mode2, dev.pwm.N.period2, dev.pwm.N.ratio2
  
  Second channel can be enabled in DTB by configuring pwn-2chan overlay
  instead of pwm in config.txt. See [1]
  
  [1] https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README
  
  Submitted by: Bob Frazier
  Differential Revision:https://reviews.freebsd.org/D15769

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sun Jul  1 22:48:00 2018
(r335854)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Mon Jul  2 01:30:33 2018
(r335855)
@@ -63,11 +63,13 @@ struct bcm_pwm_softc {
 
device_tclkman;
 
-   uint32_tfreq;
-   uint32_tperiod;
+   uint32_tfreq;/* shared between channels 1 and 2 */
+   uint32_tperiod;  /* channel 1 */
uint32_tratio;
uint32_tmode;
-
+   uint32_tperiod2; /* channel 2 */
+   uint32_tratio2;
+   uint32_tmode2;
 };
 
 #define BCM_PWM_MEM_WRITE(_sc, _off, _val) \
@@ -87,11 +89,15 @@ struct bcm_pwm_softc {
 #define R_RNG(_sc) BCM_PWM_MEM_READ(_sc, 0x10)
 #define W_DAT(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x14, _val)
 #define R_DAT(_sc) BCM_PWM_MEM_READ(_sc, 0x14)
+#define W_RNG2(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x20, _val)
+#define R_RNG2(_sc) BCM_PWM_MEM_READ(_sc, 0x20)
+#define W_DAT2(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x24, _val)
+#define R_DAT2(_sc) BCM_PWM_MEM_READ(_sc, 0x24)
 
 static int
 bcm_pwm_reconf(struct bcm_pwm_softc *sc)
 {
-   uint32_t u;
+   uint32_t u, ctlr;
 
/* Disable PWM */
W_CTL(sc, 0);
@@ -99,26 +105,78 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc)
/* Stop PWM clock */
(void)bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, 0);
 
-   if (sc->mode == 0)
-   return (0);
+   ctlr = 0; /* pre-assign zero, enable bits, write to CTL at end */
 
+   if (sc->mode == 0 && sc->mode2 == 0) /* both modes are zero */
+   return 0; /* device is now off - return */
+
+   /* set the PWM clock frequency */
+   /* TODO:  should I only do this if it changes and not stop it first? */
u = bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, sc->freq);
if (u == 0)
return (EINVAL);
sc->freq = u;
 
-   /* Config PWM */
-   W_RNG(sc, sc->period);
-   if (sc->ratio > sc->period)
-   sc->ratio = sc->period;
-   W_DAT(sc, sc->ratio);
+   /* control register CTL bits:
+* (from BCM2835 ARM Peripherals manual, section 9.6)
+*
+* 15 MSEN2  chan 2 M/S enable; 0 for PWM algo, 1 for M/S transmission
+* 14 unused; always reads as 0
+* 13 USEF2  chan 2 use FIFO (0 uses data; 1 uses FIFO)
+* 12 POLA2  chan 2 invert polarity (0 normal, 1 inverted polarity)
+* 11 SBIT2  chan 2 'Silence' bit (when not transmitting data)
+* 10 RPTL2  chan 2 FIFO repeat last data (1 repeats, 0 interrupts)
+*  9 MODE2  chan 2 PWM/Serializer mode (0 PWM, 1 Serializer)
+*  8 PWEN2  chan 2 enable (0 disable, 1 enable)
+*  7 MSEN1  chan 1 M/S enable; 0 for PWM algo, 1 for M/S transmission
+*  6 CLRF1  chan 1 clear FIFO (set 1 to clear; always reads as 0)
+*  5 USEF1  chan 1 use FIFO (0 uses data; 1 uses FIFO)
+*  4 POLA1  chan 1 invert polarity (0 normal, 1 inverted polarity)
+*  3 SBIT1  chan 1 'Silence' bit (when not transmitting data)
+*  2 RTPL1  chan 1 FIFO repeat last data (1 repeats, 0 interrupts)
+*  1 MODE1  chan 1 PWM/Serializer mode (0 PWM, 1 Serializer)
+*  0 PWMEN1 chan 1 enable (0 disable, 1 enable)
+*
+* Notes on M/S enable:  when this bit is '1', a simple M/S ratio is 
used. In short,
+* the value of 'ratio' is the number of 'on' bits, and the total 
length of the data is
+* defined by 'period'.  So if 'ratio' is 2500 and 'period' is 1, 
then the output
+* remains 'on' for 2500 clocks, and goes 'off' for the remaining 7500 
clocks.
+* When the M/S enable is '0', a more complicated algorithm effectively 
'dithers' the
+* pulses in order to obtain the desired ratio.  For details, see 
section 9.3 of the
+* BCM2835 ARM Peripherals manual.
+*/
 
-   /* Start PWM */
-   if (sc->mode == 1)
-   

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

2018-07-01 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Jul  1 22:48:00 2018
New Revision: 335854
URL: https://svnweb.freebsd.org/changeset/base/335854

Log:
  [man] Get uhid(4) man page in sync with current API
  
  API documented in previous version of uhid(4) man page has been obsolete
  since May 2009 when old USB stack was replaced with USB2 implentation.
  Current API has the same set of ioctl calls but uses usb_gen_descriptor
  structure to pass data to/from kernel.
  
  MFC after:1 week

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

Modified: head/share/man/man4/uhid.4
==
--- head/share/man/man4/uhid.4  Sun Jul  1 20:52:50 2018(r335853)
+++ head/share/man/man4/uhid.4  Sun Jul  1 22:48:00 2018(r335854)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 24, 2018
+.Dd July 1, 2018
 .Dt UHID 4
 .Os
 .Sh NAME
@@ -61,17 +61,28 @@ calls:
 .Bl -tag -width indent
 .It Dv USB_GET_REPORT_ID Pq Vt int
 Get the report identifier used by this HID report.
-.It Dv USB_GET_REPORT_DESC Pq Vt "struct usb_ctl_report_desc"
+.It Dv USB_GET_REPORT_DESC Pq Vt "struct usb_gen_descriptor"
 Get the HID report descriptor.
+Copies a maximum of
+.Va ugd_maxlen
+bytes of the report descriptor data into the memory
+specified by
+.Va ugd_data .
+Upon return
+.Va ugd_actlen
+is set to the number of bytes copied.
 Using
 this descriptor the exact layout and meaning of data to/from
 the device can be found.
 The report descriptor is delivered
 without any processing.
 .Bd -literal
-struct usb_ctl_report_desc {
-int ucrd_size;
-u_char  ucrd_data[1024];   /* filled data size will vary */
+struct usb_gen_descriptor {
+   void   *ugd_data;
+   uint16_t ugd_maxlen;
+   uint16_t ugd_actlen;
+   uint8_t ugd_report_type;
+   ...
 };
 .Ed
 .It Dv USB_SET_IMMED Pq Vt int
@@ -85,11 +96,18 @@ will only return the data that the device reports on i
 interrupt pipe.
 This call may fail if the device does not support
 this feature.
-.It Dv USB_GET_REPORT Pq Vt "struct usb_ctl_report"
+.It Dv USB_GET_REPORT Pq Vt "struct usb_gen_descriptor"
 Get a report from the device without waiting for data on
 the interrupt pipe.
+Copies a maximum of
+.Va ugd_maxlen
+bytes of the report data into the memory specified by
+.Va ugd_data .
+Upon return
+.Va ugd_actlen
+is set to the number of bytes copied.
 The
-.Va report
+.Va ugd_report_type
 field indicates which report is requested.
 It should be
 .Dv UHID_INPUT_REPORT ,
@@ -97,22 +115,21 @@ It should be
 or
 .Dv UHID_FEATURE_REPORT .
 This call may fail if the device does not support this feature.
-.Bd -literal
-struct usb_ctl_report {
-   int ucr_report;
-   u_char  ucr_data[1024]; /* used data size will vary */
-};
-.Ed
-.It Dv USB_SET_REPORT Pq Vt "struct usb_ctl_report"
+.It Dv USB_SET_REPORT Pq Vt "struct usb_gen_descriptor"
 Set a report in the device.
 The
-.Va report
+.Va ugd_report_type
 field indicates which report is to be set.
 It should be
 .Dv UHID_INPUT_REPORT ,
 .Dv UHID_OUTPUT_REPORT ,
 or
 .Dv UHID_FEATURE_REPORT .
+The value of the report is specified by the
+.Va ugd_data
+and the
+.Va ugd_maxlen
+fields.
 This call may fail if the device does not support this feature.
 .El
 .Pp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


  1   2   3   4   5   6   7   >