svn commit: r352938 - head/sys/arm/include

2019-10-01 Thread Ian Lepore
Author: ian
Date: Tue Oct  1 19:39:00 2019
New Revision: 352938
URL: https://svnweb.freebsd.org/changeset/base/352938

Log:
  Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm.
  
  This adds 8 and 16 bit versions of the cmpset and fcmpset functions. Macros
  are used to generate all the flavors from the same set of instructions; the
  macro expansion handles the couple minor differences between each size
  variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc).
  
  In addition to handling new sizes, the instruction sequences used for cmpset
  and fcmpset are rewritten to be a bit shorter/faster, and the new sequence
  will not return false when *dst==*old but the store-exclusive fails because
  of concurrent writers. Instead, it just loops like ldrex/strex sequences
  normally do until it gets a non-conflicted store. The manpage allows LL/SC
  architectures to bogusly return false, but there's no reason to actually do
  so, at least on arm.
  
  Reviewed by:  cognet

Modified:
  head/sys/arm/include/atomic-v4.h
  head/sys/arm/include/atomic-v6.h

Modified: head/sys/arm/include/atomic-v4.h
==
--- head/sys/arm/include/atomic-v4.hTue Oct  1 18:32:27 2019
(r352937)
+++ head/sys/arm/include/atomic-v4.hTue Oct  1 19:39:00 2019
(r352938)
@@ -113,6 +113,43 @@ atomic_clear_64(volatile uint64_t *address, uint64_t c
 }
 
 static __inline int
+atomic_fcmpset_8(volatile uint8_t *p, volatile uint8_t *cmpval, volatile 
uint8_t newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   ret = *p;
+   if (*p == *cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   *cmpval = *p;
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+static __inline int
+atomic_fcmpset_16(volatile uint16_t *p, volatile uint16_t *cmpval, volatile 
uint16_t newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   ret = *p;
+   if (*p == *cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   *cmpval = *p;
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
 atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile 
u_int32_t newval)
 {
int ret;
@@ -150,6 +187,40 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_in
 }
 
 static __inline int
+atomic_cmpset_8(volatile uint8_t *p, volatile uint8_t cmpval, volatile uint8_t 
newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   if (*p == cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
+atomic_cmpset_16(volatile uint16_t *p, volatile uint16_t cmpval, volatile 
uint16_t newval)
+{
+   int ret;
+
+   __with_interrupts_disabled(
+{
+   if (*p == cmpval) {
+   *p = newval;
+   ret = 1;
+   } else {
+   ret = 0;
+   }
+   });
+   return (ret);
+}
+
+static __inline int
 atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile 
u_int32_t newval)
 {
int ret;
@@ -450,6 +521,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v)
 #define atomic_fcmpset_rel_32  atomic_fcmpset_32
 #define atomic_fcmpset_acq_32  atomic_fcmpset_32
 #ifdef _KERNEL
+#define atomic_fcmpset_rel_8   atomic_fcmpset_8
+#define atomic_fcmpset_acq_8   atomic_fcmpset_8
+#define atomic_fcmpset_rel_16  atomic_fcmpset_16
+#define atomic_fcmpset_acq_16  atomic_fcmpset_16
 #define atomic_fcmpset_rel_64  atomic_fcmpset_64
 #define atomic_fcmpset_acq_64  atomic_fcmpset_64
 #endif
@@ -458,6 +533,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v)
 #define atomic_cmpset_rel_32   atomic_cmpset_32
 #define atomic_cmpset_acq_32   atomic_cmpset_32
 #ifdef _KERNEL
+#define atomic_cmpset_rel_8atomic_cmpset_8
+#define atomic_cmpset_acq_8atomic_cmpset_8
+#define atomic_cmpset_rel_16   atomic_cmpset_16
+#define atomic_cmpset_acq_16   atomic_cmpset_16
 #define atomic_cmpset_rel_64   atomic_cmpset_64
 #define atomic_cmpset_acq_64   atomic_cmpset_64
 #endif

Modified: head/sys/arm/include/atomic-v6.h
==
--- head/sys/arm/include/atomic-v6.hTue Oct  1 18:32:27 2019
(r352937)
+++ head/sys/arm/include/atomic-v6.hTue Oct  1 19:39:00 2019
(r352938)
@@ -190,224 +190,380 @@ ATOMIC_ACQ_REL(clear, 32)
 ATOMIC_ACQ_REL(clear, 64)
 ATOMIC_ACQ_REL_LONG(clear)
 
+#define ATOMIC_FCMPSET_CODE(RET, TYPE, SUF)   \
+ 

svn commit: r352871 - releng/12.1/sys/arm/freescale/imx

2019-09-29 Thread Ian Lepore
Author: ian
Date: Sun Sep 29 18:33:29 2019
New Revision: 352871
URL: https://svnweb.freebsd.org/changeset/base/352871

Log:
  MFC r352363:
  
  Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems.
  
  The latest imported FDT data defines a node for an iomuxc-gpr device,
  which we don't support (or need, right now) in addition to the usual
  iomuxc device.  Unfortunately, the dts improperly assigns overlapping
  ranges of mmio space to both devices.  The -gpr device is also a syscon
  and simple_mfd device.
  
  At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
  when the real iomuxc driver comes along later, it fails to attach because
  it tries to allocate its register space, and it's already partially in
  use by the bogus instance of simple_mfd.
  
  This change works around the problem by simply disabling the node for
  the iomuxc-gpr device, since we don't need it for anything.
  
  Approved by:  re@ (gjb)

Modified:
  releng/12.1/sys/arm/freescale/imx/imx6_machdep.c
Directory Properties:
  releng/12.1/   (props changed)

Modified: releng/12.1/sys/arm/freescale/imx/imx6_machdep.c
==
--- releng/12.1/sys/arm/freescale/imx/imx6_machdep.cSun Sep 29 17:30:10 
2019(r352870)
+++ releng/12.1/sys/arm/freescale/imx/imx6_machdep.cSun Sep 29 18:33:29 
2019(r352871)
@@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void)
OF_setprop(socnode, "interrupt-parent", , sizeof(gicxref));
 }
 
+static void
+fix_fdt_iomuxc_data(void)
+{
+   phandle_t node;
+
+   /*
+* The linux dts defines two nodes with the same mmio address range,
+* iomuxc-gpr and the regular iomuxc.  The -grp node is a simple_mfd and
+* a syscon, but it only has access to a small subset of the iomuxc
+* registers, so it can't serve as the accessor for the iomuxc driver's
+* register IO.  But right now, the simple_mfd driver attaches first,
+* preventing the real iomuxc driver from allocating its mmio register
+* range because it partially overlaps with the -gpr range.
+*
+* For now, by far the easiest thing to do to keep imx6 working is to
+* just disable the iomuxc-gpr node because we don't have a driver for
+* it anyway, we just need to prevent attachment of simple_mfd.
+*
+* If we ever write a -gpr driver, this code should probably switch to
+* modifying the reg property so that the range covers all the iomuxc
+* regs, then the -gpr driver can be a regular syscon driver that iomuxc
+* uses for register access.
+*/
+   node = OF_finddevice("/soc/aips-bus@200/iomuxc-gpr@20e");
+   if (node != -1)
+   OF_setprop(node, "status", "disabled", sizeof("disabled"));
+}
+
 static int
 imx6_attach(platform_t plat)
 {
 
/* Fix soc interrupt-parent property. */
fix_fdt_interrupt_data();
+
+   /* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */
+   fix_fdt_iomuxc_data();
 
/* Inform the MPCore timer driver that its clock is variable. */
arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r352838 - head/share/man/man3

2019-09-28 Thread Ian Lepore
On Sat, 2019-09-28 at 09:37 +, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Sat Sep 28 09:37:05 2019
> New Revision: 352838
> URL: https://svnweb.freebsd.org/changeset/base/352838
> 
> Log:
>   Sort MLINKS for arb(3), and actually make them work by fixing a '='
> vs '+='
>   mixup.
>   

::sigh::  This wouldn't happen if we just always used += for all lines
in lists of things, but sadly (IMO, surrealistically), style.Makefile
explicitly prohibits that.  I'm not sure what value the prohibition is
supposed to provide, but the downsides are making this mistake over and
over again, and if you manage to avoid the mistake your consolation
prize is a diff that's less-clear because you have to change lines that
aren't actually involed in the change you're making.

-- Ian


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


svn commit: r352762 - stable/12/sys/arm/freescale/imx

2019-09-26 Thread Ian Lepore
Author: ian
Date: Thu Sep 26 17:07:30 2019
New Revision: 352762
URL: https://svnweb.freebsd.org/changeset/base/352762

Log:
  MFC r352363:
  
  Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems.
  
  The latest imported FDT data defines a node for an iomuxc-gpr device,
  which we don't support (or need, right now) in addition to the usual
  iomuxc device.  Unfortunately, the dts improperly assigns overlapping
  ranges of mmio space to both devices.  The -gpr device is also a syscon
  and simple_mfd device.
  
  At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
  when the real iomuxc driver comes along later, it fails to attach because
  it tries to allocate its register space, and it's already partially in
  use by the bogus instance of simple_mfd.
  
  This change works around the problem by simply disabling the node for
  the iomuxc-gpr device, since we don't need it for anything.

Modified:
  stable/12/sys/arm/freescale/imx/imx6_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/freescale/imx/imx6_machdep.c
==
--- stable/12/sys/arm/freescale/imx/imx6_machdep.c  Thu Sep 26 16:51:51 
2019(r352761)
+++ stable/12/sys/arm/freescale/imx/imx6_machdep.c  Thu Sep 26 17:07:30 
2019(r352762)
@@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void)
OF_setprop(socnode, "interrupt-parent", , sizeof(gicxref));
 }
 
+static void
+fix_fdt_iomuxc_data(void)
+{
+   phandle_t node;
+
+   /*
+* The linux dts defines two nodes with the same mmio address range,
+* iomuxc-gpr and the regular iomuxc.  The -grp node is a simple_mfd and
+* a syscon, but it only has access to a small subset of the iomuxc
+* registers, so it can't serve as the accessor for the iomuxc driver's
+* register IO.  But right now, the simple_mfd driver attaches first,
+* preventing the real iomuxc driver from allocating its mmio register
+* range because it partially overlaps with the -gpr range.
+*
+* For now, by far the easiest thing to do to keep imx6 working is to
+* just disable the iomuxc-gpr node because we don't have a driver for
+* it anyway, we just need to prevent attachment of simple_mfd.
+*
+* If we ever write a -gpr driver, this code should probably switch to
+* modifying the reg property so that the range covers all the iomuxc
+* regs, then the -gpr driver can be a regular syscon driver that iomuxc
+* uses for register access.
+*/
+   node = OF_finddevice("/soc/aips-bus@200/iomuxc-gpr@20e");
+   if (node != -1)
+   OF_setprop(node, "status", "disabled", sizeof("disabled"));
+}
+
 static int
 imx6_attach(platform_t plat)
 {
 
/* Fix soc interrupt-parent property. */
fix_fdt_interrupt_data();
+
+   /* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */
+   fix_fdt_iomuxc_data();
 
/* Inform the MPCore timer driver that its clock is variable. */
arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r352513 - head/usr.sbin/freebsd-update

2019-09-19 Thread Ian Lepore
On Thu, 2019-09-19 at 11:34 +, Ed Maste wrote:
> Author: emaste
> Date: Thu Sep 19 11:34:35 2019
> New Revision: 352513
> URL: https://svnweb.freebsd.org/changeset/base/352513
> 
> Log:
>   freebsd-update.8: appease igor
>   
>   igor follows American style guides in the belief that abbreviations i.e.
>   and e.g. are always followed by a comma.  Make that change now so that
>   future updates to freebsd-update.8 do not complain about this.
>   
> 

Grammatically, English requires a comma after 'i.e.' because it is an
adverbial phrase functioning as a conjunctive adverb.

If you translate 'e.g.' idiomatically as "for example", then it is also
a conjunctive adverbial phrase requiring a comma.

-- Ian

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


Re: svn commit: r352451 - head/stand/libsa

2019-09-17 Thread Ian Lepore
On Tue, 2019-09-17 at 16:16 +, Toomas Soome wrote:
> Author: tsoome
> Date: Tue Sep 17 16:16:46 2019
> New Revision: 352451
> URL: https://svnweb.freebsd.org/changeset/base/352451
> 
> Log:
>   loader: revert r352421
>   
>   As insisted by kib, malloc(0) is quite legal.
> 
> Modified:
>   head/stand/libsa/zalloc_malloc.c
> 
> Modified: head/stand/libsa/zalloc_malloc.c
> ==
> --- head/stand/libsa/zalloc_malloc.c  Tue Sep 17 15:53:40 2019
> (r352450)
> +++ head/stand/libsa/zalloc_malloc.c  Tue Sep 17 16:16:46 2019
> (r352451)
> @@ -73,9 +73,6 @@ Malloc_align(size_t bytes, size_t alignment)
>  {
>   Guard *res;
>  
> - if (bytes == 0)
> - return (NULL);
> -
>  #ifdef USEENDGUARD
>   bytes += MALLOCALIGN + 1;
>  #else

For the record, you're both right.  In both the C and posix standards
for malloc(), an implementation is allowed to return either NULL or a
unique pointer which cannot be used to access any memory but must be
passed to free().

-- Ian

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


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

2019-09-15 Thread Ian Lepore
Author: ian
Date: Sun Sep 15 19:38:15 2019
New Revision: 352363
URL: https://svnweb.freebsd.org/changeset/base/352363

Log:
  Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems.
  
  The latest imported FDT data defines a node for an iomuxc-gpr device,
  which we don't support (or need, right now) in addition to the usual
  iomuxc device.  Unfortunately, the dts improperly assigns overlapping
  ranges of mmio space to both devices.  The -gpr device is also a syscon
  and simple_mfd device.
  
  At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
  when the real iomuxc driver comes along later, it fails to attach because
  it tries to allocate its register space, and it's already partially in
  use by the bogus instance of simple_mfd.
  
  This change works around the problem by simply disabling the node for
  the iomuxc-gpr device, since we don't need it for anything.

Modified:
  head/sys/arm/freescale/imx/imx6_machdep.c

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==
--- head/sys/arm/freescale/imx/imx6_machdep.c   Sun Sep 15 19:16:42 2019
(r352362)
+++ head/sys/arm/freescale/imx/imx6_machdep.c   Sun Sep 15 19:38:15 2019
(r352363)
@@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void)
OF_setprop(socnode, "interrupt-parent", , sizeof(gicxref));
 }
 
+static void
+fix_fdt_iomuxc_data(void)
+{
+   phandle_t node;
+
+   /*
+* The linux dts defines two nodes with the same mmio address range,
+* iomuxc-gpr and the regular iomuxc.  The -grp node is a simple_mfd and
+* a syscon, but it only has access to a small subset of the iomuxc
+* registers, so it can't serve as the accessor for the iomuxc driver's
+* register IO.  But right now, the simple_mfd driver attaches first,
+* preventing the real iomuxc driver from allocating its mmio register
+* range because it partially overlaps with the -gpr range.
+*
+* For now, by far the easiest thing to do to keep imx6 working is to
+* just disable the iomuxc-gpr node because we don't have a driver for
+* it anyway, we just need to prevent attachment of simple_mfd.
+*
+* If we ever write a -gpr driver, this code should probably switch to
+* modifying the reg property so that the range covers all the iomuxc
+* regs, then the -gpr driver can be a regular syscon driver that iomuxc
+* uses for register access.
+*/
+   node = OF_finddevice("/soc/aips-bus@200/iomuxc-gpr@20e");
+   if (node != -1)
+   OF_setprop(node, "status", "disabled", sizeof("disabled"));
+}
+
 static int
 imx6_attach(platform_t plat)
 {
 
/* Fix soc interrupt-parent property. */
fix_fdt_interrupt_data();
+
+   /* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */
+   fix_fdt_iomuxc_data();
 
/* Inform the MPCore timer driver that its clock is variable. */
arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-09-14 Thread Ian Lepore
Author: ian
Date: Sun Sep 15 01:02:01 2019
New Revision: 352342
URL: https://svnweb.freebsd.org/changeset/base/352342

Log:
  Make the ti_sysc device quiet.  It's an internal utility pseudo-device
  that makes the upstream FDT data work right, so we don't need to see a
  couple dozen instances of it spam the dmesg at boot time unless it's a
  verbose boot.

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

Modified: head/sys/arm/ti/ti_sysc.c
==
--- head/sys/arm/ti/ti_sysc.c   Sat Sep 14 21:49:42 2019(r352341)
+++ head/sys/arm/ti/ti_sysc.c   Sun Sep 15 01:02:01 2019(r352342)
@@ -71,6 +71,9 @@ ti_sysc_probe(device_t dev)
return (ENXIO);
 
device_set_desc(dev, "TI SYSC Interconnect");
+   if (!bootverbose)
+   device_quiet(dev);
+
return (BUS_PROBE_DEFAULT);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r352339 - stable/12/sys/dev/iicbus

2019-09-14 Thread Ian Lepore
Author: ian
Date: Sat Sep 14 20:26:50 2019
New Revision: 352339
URL: https://svnweb.freebsd.org/changeset/base/352339

Log:
  MFC r351885, r351887
  
  r351885:
  Ensure a measurement is complete before reading the result in ads111x.
  Also, disable the comparator by default; it's not used for anything.
  
  The previous logic would start a measurement, and then pause_sbt() for the
  averaging time currently configured in the chip.  After waiting that long,
  the code would blindly read the measurement register and return its value.
  The problem is that the chip's idea of averaging time is based on its
  internal free-running 1MHz oscillator, which may be running at a wildly
  different rate than the kernel clock.  If the chip's internal timer was
  running slower than the kernel clock, we'd end up grabbing a stale result
  from an old measurement.
  
  The driver now still uses pause_sbt() to yield the cpu while waiting for
  the measurement to complete, but after sleeping it checks the chip's status
  register to ensure the measurement engine is idle.  If it's not, the driver
  uses a retry loop to wait a bit (5% of the original wait time) then check
  again for completion.
  
  r351887:
  Use a single write of 3 bytes instead of iicdev_writeto() in ads111x.
  
  The iicdev_writeto() function basically does scatter-gather IO by filling
  in a pair of iic_msg structs to write the register address then the data
  from different locations but with a single bus START/xfer/STOP sequence.
  It turns out several low-level i2c controller drivers do not honor the
  IIC_NOSTART flag, so the second piece of the write gets a new START on
  the bus, and that confuses the ads111x chips which expect a continuous
  write of 3 bytes to set a register.
  
  A proper fix for this is to track down all the misbehaving controllers
  drivers and fix them.  For now this change makes this driver work again.

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

Modified: stable/12/sys/dev/iicbus/ads111x.c
==
--- stable/12/sys/dev/iicbus/ads111x.c  Sat Sep 14 19:33:36 2019
(r352338)
+++ stable/12/sys/dev/iicbus/ads111x.c  Sat Sep 14 20:26:50 2019
(r352339)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #define  ADS111x_CONF_GAIN_SHIFT9  /* Programmable gain 
amp */
 #define  ADS111x_CONF_MODE_SHIFT8  /* Operational mode */
 #define  ADS111x_CONF_RATE_SHIFT5  /* Sample rate */
+#define  ADS111x_CONF_COMP_DISABLE  3  /* Comparator disable */
 
 #defineADS111x_LOTHRESH2   /* Compare lo threshold 
(rw) */
 
@@ -81,7 +82,8 @@ __FBSDID("$FreeBSD$");
  * comparator and we'll leave it alone if they do.  That allows them connect 
the
  * alert pin to something and use the feature without any help from this 
driver.
  */
-#defineADS111x_CONF_DEFAULT(1 << ADS111x_CONF_MODE_SHIFT)
+#defineADS111x_CONF_DEFAULT\
+((1 << ADS111x_CONF_MODE_SHIFT) | ADS111x_CONF_COMP_DISABLE)
 #defineADS111x_CONF_USERMASK   0x001f
 
 /*
@@ -165,11 +167,21 @@ struct ads111x_softc {
 static int
 ads111x_write_2(struct ads111x_softc *sc, int reg, int val) 
 {
-   uint8_t data[2];
+   uint8_t data[3];
+   struct iic_msg msgs[1];
+   uint8_t slaveaddr;
 
-   be16enc(data, val);
+   slaveaddr = iicbus_get_addr(sc->dev);
 
-   return (iic2errno(iicdev_writeto(sc->dev, reg, data, 2, IIC_WAIT)));
+   data[0] = reg;
+   be16enc([1], val);
+
+   msgs[0].slave = slaveaddr;
+   msgs[0].flags = IIC_M_WR;
+   msgs[0].len   = sizeof(data);
+   msgs[0].buf   = data;
+
+   return (iicbus_transfer_excl(sc->dev, msgs, nitems(msgs), IIC_WAIT));
 }
 
 static int
@@ -189,7 +201,7 @@ static int
 ads111x_sample_voltage(struct ads111x_softc *sc, int channum, int *voltage) 
 {
struct ads111x_channel *chan;
-   int err, cfgword, convword, rate, waitns;
+   int err, cfgword, convword, rate, retries, waitns;
int64_t fsrange;
 
chan = >channels[channum];
@@ -205,7 +217,8 @@ ads111x_sample_voltage(struct ads111x_softc *sc, int c
 
/*
 * Calculate how long it will take to make the measurement at the
-* current sampling rate (round up), and sleep at least that long.
+* current sampling rate (round up).  The measurement averaging time
+* ranges from 300us to 125ms, so we yield the cpu while waiting.
 */
rate = sc->chipinfo->ratetab[chan->rateidx];
waitns = (10 + rate - 1) / rate;
@@ -213,20 +226,27 @@ ads111x_sample_voltage(struct ads111x_softc *sc, int c
if (err != 0 && err != EWOULDBLOCK)
return (err);
 
-#if 0
/*
-* Sanity-check that the measurement is complete.  Not enabled by
-* default because checking wastes 

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

2019-09-14 Thread Ian Lepore
Author: ian
Date: Sat Sep 14 19:33:36 2019
New Revision: 352338
URL: https://svnweb.freebsd.org/changeset/base/352338

Log:
  Create a mechanism for encoding a system errno into the IIC_Ex space.
  
  Errors are communicated between the i2c controller layer and upper layers
  (iicbus and slave device drivers) using a set of IIC_Exx constants which
  effectively define a private number space separate from (and having values
  that conflict with) the system errno number space. Sometimes it is necessary
  to report a plain old system error (especially EINTR) from the controller or
  bus layer and have that value make it back across the syscall interface
  intact.
  
  I initially considered replicating a few "crucial" errno values with similar
  names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like
  that had the potential to grow over time until many of the errno names were
  duplicated into the IIC_Ex space.
  
  So instead, this defines a mechanism to "encode" an errno into the IIC_E
  space by setting the high bit and putting the errno into the lower-order
  bits; a new errno2iic() function does this. The existing iic2errno()
  recognizes the encoded values and extracts the original errno out of the
  encoded value. An interesting wrinkle occurs with the pseudo-error values
  such as ERESTART -- they aleady have the high bit set, and turning it off
  would be the wrong thing to do. Instead, iic2errno() recognizes that lots of
  high bits are on (i.e., it's a negative number near to zero) and just
  returns that value as-is.
  
  Thus, existing drivers continue to work without needing any changes, and
  there is now a way to return errno values from the lower layers. The first
  use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag,
  and needs to return the errno from that up the call chain.
  
  Differential Revision:https://reviews.freebsd.org/D20975

Modified:
  head/sys/dev/iicbus/iiconf.c
  head/sys/dev/iicbus/iiconf.h

Modified: head/sys/dev/iicbus/iiconf.c
==
--- head/sys/dev/iicbus/iiconf.cSat Sep 14 19:23:46 2019
(r352337)
+++ head/sys/dev/iicbus/iiconf.cSat Sep 14 19:33:36 2019
(r352338)
@@ -42,6 +42,18 @@ __FBSDID("$FreeBSD$");
 #include "iicbus_if.h"
 
 /*
+ * Encode a system errno value into the IIC_Ex space by setting the
+ * IIC_ERRNO marker bit, so that iic2errno() can turn it back into a plain
+ * system errno value later.  This lets controller- and bus-layer code get
+ * important system errno values (such as EINTR/ERESTART) back to the caller.
+ */
+int
+errno2iic(int errno)
+{
+   return ((errno == 0) ? 0 : errno | IIC_ERRNO);
+}
+
+/*
  * Translate IIC_Ex status values to vaguely-equivelent errno values.
  */
 int
@@ -59,7 +71,22 @@ iic2errno(int iic_status)
case IIC_ENOTSUPP:  return (EOPNOTSUPP);
case IIC_ENOADDR:   return (EADDRNOTAVAIL);
case IIC_ERESOURCE: return (ENOMEM);
-   default:return (EIO);
+   default:
+   /*
+* If the high bit is set, that means it's a system errno value
+* that was encoded into the IIC_Exx space by setting the
+* IIC_ERRNO marker bit.  If lots of high-order bits are set,
+* then it's one of the negative pseudo-errors such as ERESTART
+* and we return it as-is.  Otherwise it's a plain "small
+* positive integer" errno, so just remove the IIC_ERRNO marker
+* bit.  If it's some unknown number without the high bit set,
+* there isn't much we can do except call it an I/O error.
+*/
+   if ((iic_status & IIC_ERRNO) == 0)
+   return (EIO);
+   if ((iic_status & 0x) != 0)
+   return (iic_status);
+   return (iic_status & ~IIC_ERRNO);
}
 }
 
@@ -97,7 +124,7 @@ iicbus_poll(struct iicbus_softc *sc, int how)
return (IIC_EBUSBSY);
}
 
-   return (error);
+   return (errno2iic(error));
 }
 
 /*

Modified: head/sys/dev/iicbus/iiconf.h
==
--- head/sys/dev/iicbus/iiconf.hSat Sep 14 19:23:46 2019
(r352337)
+++ head/sys/dev/iicbus/iiconf.hSat Sep 14 19:33:36 2019
(r352338)
@@ -96,12 +96,14 @@
 #define IIC_ENOTSUPP   0x8 /* request not supported */
 #define IIC_ENOADDR0x9 /* no address assigned to the interface */
 #define IIC_ERESOURCE  0xa /* resources (memory, whatever) unavailable */
+#define IIC_ERRNO  __INT_MIN /* marker bit: errno is in low-order bits */
 
 /*
  * Note that all iicbus functions return IIC_Ex status values,
  * except iic2errno() (obviously) and iicbus_started() (returns bool).
  */
 extern int 

svn commit: r352333 - head/sys/arm/ti/am335x

2019-09-14 Thread Ian Lepore
Author: ian
Date: Sat Sep 14 18:20:14 2019
New Revision: 352333
URL: https://svnweb.freebsd.org/changeset/base/352333

Log:
  Include , required to use spinlocks in this code.

Modified:
  head/sys/arm/ti/am335x/am335x_dmtpps.c

Modified: head/sys/arm/ti/am335x/am335x_dmtpps.c
==
--- head/sys/arm/ti/am335x/am335x_dmtpps.c  Sat Sep 14 14:26:30 2019
(r352332)
+++ head/sys/arm/ti/am335x/am335x_dmtpps.c  Sat Sep 14 18:20:14 2019
(r352333)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r352275 - in head/lib/libedit: . TEST edit readline

2019-09-14 Thread Ian Lepore
On Fri, 2019-09-13 at 22:25 -0600, Warner Losh wrote:
> On Fri, Sep 13, 2019, 10:11 PM Peter Jeremy 
> wrote:
> 
> > On 2019-Sep-13 16:33:15 -0400, Charlie Li 
> > wrote:
> > > Baptiste Daroussin wrote:
> > > > Author: bapt
> > > > Date: Fri Sep 13 06:50:02 2019
> > > > New Revision: 352275
> > > > URL: https://svnweb.freebsd.org/changeset/base/352275
> > > > 
> > > > Log:
> > > >   Update libedit to a snapshot from 2019-09-10
> > > >   Reviewed by:   Yuichiro Naito 
> > > >   MFC after: 3 weeks
> > > >   Differential Revision: https://reviews.freebsd.org/D21584
> > > > 
> > > 
> > > I posted in phab but repeating here, this breaks the build on (at
> > > least)
> > > aarch64:
> > 
> > It breaks the build on arm and arm64 only.
> > 
> > wint_t is int on all platforms:
> > sys/sys/_types.h:
> > typedef int __ct_rune_t;/* arg type for ctype funcs
> > */
> > typedef __ct_rune_t __wint_t;   /* wint_t (see above) */
> > 
> > but wchar_t varies between unsigned and signed:
> > $ grep '__wchar_t' sys/*/include/_types.h
> > sys/arm/include/_types.h:typedefunsigned int___wchar_t;
> > sys/arm64/include/_types.h:typedef  unsigned int___wchar_t;
> > sys/mips/include/_types.h:typedef   int ___wchar_t;
> > sys/powerpc/include/_types.h:typedefint ___wchar_t;
> > sys/riscv/include/_types.h:typedef  int ___wchar_t;
> > sys/sparc64/include/_types.h:typedefint ___wchar_t;
> > sys/x86/include/_types.h:typedefint ___wchar_t;
> > 
> > Looking back into history, it looks like the "unsigned" is part
> > of the ARM EABI.
> > 
> 
> We should confirm that. It is definitely part of the OABI stuff, but EABI
> was supposed to fix differences like this...
> 

The char type is unsigned by default on arm (it's part of eabi), and
also on powerpc and riscv.

-- Ian

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


Re: svn commit: r352231 - head/lib/libc/sys

2019-09-12 Thread Ian Lepore
On Thu, 2019-09-12 at 13:02 -0700, Cy Schubert wrote:
> In message <
> 63cf915c92b92b07e19337849269ec6bd0dc0d1b.ca...@freebsd.org>, 
> Ian Le
> pore writes:
> > On Wed, 2019-09-11 at 19:48 +, Alan Somers wrote:
> > > Author: asomers
> > > Date: Wed Sep 11 19:48:32 2019
> > > New Revision: 352231
> > > URL: https://svnweb.freebsd.org/changeset/base/352231
> > > 
> > > Log:
> > >   getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable
> > >   
> > >   When SO_TIMESTAMP is set, the kernel will attempt to attach a
> > > timestamp a
> > 
> > s
> > >   ancillary data to each IP datagram that is received on the
> > > socket. Howeve
> > 
> > r,
> > >   it may fail, for example due to insufficient memory. In that
> > > case the
> > >   packet will still be received but not timestamp will be
> > > attached.
> > >   
> > >   Reviewed by:kib
> > >   MFC after:  3 days
> > >   Differential Revision:  https://reviews.freebsd.org/D21607
> > > 
> > > Modified:
> > >   head/lib/libc/sys/getsockopt.2
> > > 
> > > Modified: head/lib/libc/sys/getsockopt.2
> > > =
> > > ==
> > 
> > ===
> > > --- head/lib/libc/sys/getsockopt.2Wed Sep 11 19:29:40
> > > 2019  (r35223
> > 
> > 0)
> > > +++ head/lib/libc/sys/getsockopt.2Wed Sep 11 19:48:32
> > > 2019  (r35223
> > 
> > 1)
> > > @@ -28,7 +28,7 @@
> > >  .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
> > >  .\" $FreeBSD$
> > >  .\"
> > > -.Dd February 10, 2019
> > > +.Dd September 11, 2019
> > >  .Dt GETSOCKOPT 2
> > >  .Os
> > >  .Sh NAME
> > > @@ -431,7 +431,8 @@ option is enabled on a
> > >  .Dv SOCK_DGRAM
> > >  socket, the
> > >  .Xr recvmsg 2
> > > -call will return a timestamp corresponding to when the datagram
> > > was receiv
> > 
> > ed.
> > > +call may return a timestamp corresponding to when the datagram
> > > was receive
> > 
> > d.
> > > +However, it may not, for example due to a resource shortage.
> > >  The
> > >  .Va msg_control
> > >  field in the
> > > 
> > 
> > So I guess this actually happened to someone... is it a common
> > thing
> > for the timestamp to fail?  I ask because ntpd relies on
> > SO_TIMESTAMP
> > and if this situation really happens and can persist for a long
> > time,
> > ntpd would effectively stop working.
> 
> This reminds me, something that's been on my plate for a couple of
> weeks. 
> Our NTP upline pinged me a few weeks ago regarding IEEE 1588 driver
> support 
> for NICs with hardware support. Linux already has it. I was told
> that 
> someone hrtr has attempted this but that the results weren't
> optimal. 
> That's all I know. Should I open discussion on arch@?

It's something I've been wanting to do for a while, and something that
would be helpful at $work, so a discussion on it sounds like a good
idea.

-- Ian

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


Re: svn commit: r352248 - head/usr.sbin/ntp/libntp

2019-09-12 Thread Ian Lepore
On Thu, 2019-09-12 at 15:46 +, Baptiste Daroussin wrote:
> Author: bapt
> Date: Thu Sep 12 15:46:58 2019
> New Revision: 352248
> URL: https://svnweb.freebsd.org/changeset/base/352248
> 
> Log:
>   Get the readline header from the installed header instead of the from the 
> source
>   location.
>   

How can this possibly be right?  One of the hallmarks of our build
system is that it is self-contained in the sense that it uses the
sources to build the sources, not sources or files from the host
machine being used to do the build.

-- Ian

>   With newer import of libedit, the path to be able to access
> readline/readline.h
>   will also include header which name will conflict with some
> expected by ntp in
>   another path and end up breaking the build.
> 
> Modified:
>   head/usr.sbin/ntp/libntp/Makefile
> 
> Modified: head/usr.sbin/ntp/libntp/Makefile
> =
> =
> --- head/usr.sbin/ntp/libntp/Makefile Thu Sep 12 15:44:53 2019(r352
> 247)
> +++ head/usr.sbin/ntp/libntp/Makefile Thu Sep 12 15:46:58 2019(r352
> 248)
> @@ -79,7 +79,7 @@ CFLAGS+= -I${SRCTOP}/contrib/ntp/include \
>   -I${SRCTOP}/contrib/ntp/lib/isc/pthreads/include \
>   -I${SRCTOP}/contrib/ntp/sntp/libopts \
>   -I${SRCTOP}/lib/libc/${MACHINE_ARCH} \
> - -I${SRCTOP}/lib/libedit/edit \
> + -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit \
>   -I${.CURDIR:H} \
>   -I${.CURDIR}/
>  
> 

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


Re: svn commit: r352231 - head/lib/libc/sys

2019-09-11 Thread Ian Lepore
On Wed, 2019-09-11 at 15:55 -0600, Alan Somers wrote:
> On Wed, Sep 11, 2019 at 3:50 PM Ian Lepore  wrote:
> 
> > On Wed, 2019-09-11 at 19:48 +, Alan Somers wrote:
> > > Author: asomers
> > > Date: Wed Sep 11 19:48:32 2019
> > > New Revision: 352231
> > > URL: https://svnweb.freebsd.org/changeset/base/352231
> > > 
> > > Log:
> > >   getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable
> > > 
> > >   When SO_TIMESTAMP is set, the kernel will attempt to attach a
> > 
> > timestamp as
> > >   ancillary data to each IP datagram that is received on the socket.
> > 
> > However,
> > >   it may fail, for example due to insufficient memory. In that case the
> > >   packet will still be received but not timestamp will be attached.
> > > 
> > >   Reviewed by:kib
> > >   MFC after:  3 days
> > >   Differential Revision:  https://reviews.freebsd.org/D21607
> > > 
> > > Modified:
> > >   head/lib/libc/sys/getsockopt.2
> > > 
> > > Modified: head/lib/libc/sys/getsockopt.2
> > > 
> > 
> > ==
> > > --- head/lib/libc/sys/getsockopt.2Wed Sep 11 19:29:40 2019
> > 
> > (r352230)
> > > +++ head/lib/libc/sys/getsockopt.2Wed Sep 11 19:48:32 2019
> > 
> > (r352231)
> > > @@ -28,7 +28,7 @@
> > >  .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
> > >  .\" $FreeBSD$
> > >  .\"
> > > -.Dd February 10, 2019
> > > +.Dd September 11, 2019
> > >  .Dt GETSOCKOPT 2
> > >  .Os
> > >  .Sh NAME
> > > @@ -431,7 +431,8 @@ option is enabled on a
> > >  .Dv SOCK_DGRAM
> > >  socket, the
> > >  .Xr recvmsg 2
> > > -call will return a timestamp corresponding to when the datagram was
> > 
> > received.
> > > +call may return a timestamp corresponding to when the datagram was
> > 
> > received.
> > > +However, it may not, for example due to a resource shortage.
> > >  The
> > >  .Va msg_control
> > >  field in the
> > > 
> > 
> > So I guess this actually happened to someone... is it a common thing
> > for the timestamp to fail?  I ask because ntpd relies on SO_TIMESTAMP
> > and if this situation really happens and can persist for a long time,
> > ntpd would effectively stop working.
> > 
> > -- Ian
> > 
> 
> pho discovered how to trigger it.  If you start 50 ping processes
> simultaneously, sometimes a few will fail.  Will ntpd be ok with a single
> failure, as long as the timestamp is received correctly in a subsequent
> packet?
> -Alan

Yeah, nptd is resilient to missing data and intermittent comms, within
reason.  If it goes hours without getting a timestamp, system time
would start to drift.  Running 50 concurrent pings sounds like
something that won't come up in the real world. :)

-- Ian

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


Re: svn commit: r352231 - head/lib/libc/sys

2019-09-11 Thread Ian Lepore
On Wed, 2019-09-11 at 19:48 +, Alan Somers wrote:
> Author: asomers
> Date: Wed Sep 11 19:48:32 2019
> New Revision: 352231
> URL: https://svnweb.freebsd.org/changeset/base/352231
> 
> Log:
>   getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable
>   
>   When SO_TIMESTAMP is set, the kernel will attempt to attach a timestamp as
>   ancillary data to each IP datagram that is received on the socket. However,
>   it may fail, for example due to insufficient memory. In that case the
>   packet will still be received but not timestamp will be attached.
>   
>   Reviewed by:kib
>   MFC after:  3 days
>   Differential Revision:  https://reviews.freebsd.org/D21607
> 
> Modified:
>   head/lib/libc/sys/getsockopt.2
> 
> Modified: head/lib/libc/sys/getsockopt.2
> ==
> --- head/lib/libc/sys/getsockopt.2Wed Sep 11 19:29:40 2019
> (r352230)
> +++ head/lib/libc/sys/getsockopt.2Wed Sep 11 19:48:32 2019
> (r352231)
> @@ -28,7 +28,7 @@
>  .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
>  .\" $FreeBSD$
>  .\"
> -.Dd February 10, 2019
> +.Dd September 11, 2019
>  .Dt GETSOCKOPT 2
>  .Os
>  .Sh NAME
> @@ -431,7 +431,8 @@ option is enabled on a
>  .Dv SOCK_DGRAM
>  socket, the
>  .Xr recvmsg 2
> -call will return a timestamp corresponding to when the datagram was received.
> +call may return a timestamp corresponding to when the datagram was received.
> +However, it may not, for example due to a resource shortage.
>  The
>  .Va msg_control
>  field in the
> 

So I guess this actually happened to someone... is it a common thing
for the timestamp to fail?  I ask because ntpd relies on SO_TIMESTAMP
and if this situation really happens and can persist for a long time,
ntpd would effectively stop working.

-- Ian

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


svn commit: r352196 - head/sys/arm/ti/am335x

2019-09-10 Thread Ian Lepore
Author: ian
Date: Tue Sep 10 22:08:34 2019
New Revision: 352196
URL: https://svnweb.freebsd.org/changeset/base/352196

Log:
  In am335x_dmtpps, use a spin mutex to interlock between PPS capture and PPS
  ioctl(2) handling.  This allows doing the pps_event() work in the polling
  routine, instead of using a taskqueue task to do that work.
  
  Also, add PNPINFO, and switch to using make_dev_s() to create the cdev.
  
  Using a spin mutex and calling pps_event() from the polling function works
  around the situation which requires more than 2 sets of timecounter
  timehands in a single-core system to get reliable PPS capture.  That problem
  would happen when a single-core system is idle in cpu_idle() then gets woken
  up with an event timer event which was scheduled to handle a hardclock tick.
  That processing path would end up calling tc_windup 3 or 4 times between
  when the tc polling function was called and when the taskqueue task would
  eventually run, and with only two sets of timehands, the th_generation count
  would always be too old to allow the captured PPS data to be used.

Modified:
  head/sys/arm/ti/am335x/am335x_dmtpps.c

Modified: head/sys/arm/ti/am335x/am335x_dmtpps.c
==
--- head/sys/arm/ti/am335x/am335x_dmtpps.c  Tue Sep 10 21:53:42 2019
(r352195)
+++ head/sys/arm/ti/am335x/am335x_dmtpps.c  Tue Sep 10 22:08:34 2019
(r352196)
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -79,7 +78,6 @@ struct dmtpps_softc {
uint32_ttclr;   /* Cached TCLR register. */
struct timecounter  tc;
int pps_curmode;/* Edge mode now set in hw. */
-   struct task pps_task;   /* For pps_event handling. */
struct cdev *   pps_cdev;
struct pps_statepps_state;
struct mtx  pps_mtx;
@@ -93,6 +91,7 @@ static struct ofw_compat_data compat_data[] = {
{"ti,am335x-timer-1ms", 1},
{NULL,  0},
 };
+SIMPLEBUS_PNP_INFO(compat_data);
 
 /*
  * A table relating pad names to the hardware timer number they can be mux'd 
to.
@@ -285,48 +284,29 @@ dmtpps_poll(struct timecounter *tc)
 * populates it from the current DMT_TCRR register) with the latched
 * value from the TCAR1 register.
 *
-* There is no locking here, by design.  pps_capture() writes into an
-* area of struct pps_state which is read only by pps_event().  The
-* synchronization of access to that area is temporal rather than
-* interlock based... we write in this routine and trigger the task that
-* will read the data, so no simultaneous access can occur.
-*
 * Note that we don't have the TCAR interrupt enabled, but the hardware
 * still provides the status bits in the "RAW" status register even when
 * they're masked from generating an irq.  However, when clearing the
 * TCAR status to re-arm the capture for the next second, we have to
 * write to the IRQ status register, not the RAW register.  Quirky.
+*
+* We do not need to hold a lock while capturing the pps data, because
+* it is captured into an area of the pps_state struct which is read
+* only by pps_event().  We do need to hold a lock while calling
+* pps_event(), because it manipulates data which is also accessed from
+* the ioctl(2) context by userland processes.
 */
if (DMTIMER_READ4(sc, DMT_IRQSTATUS_RAW) & DMT_IRQ_TCAR) {
pps_capture(>pps_state);
sc->pps_state.capcount = DMTIMER_READ4(sc, DMT_TCAR1);
DMTIMER_WRITE4(sc, DMT_IRQSTATUS, DMT_IRQ_TCAR);
-   taskqueue_enqueue(taskqueue_fast, >pps_task);
+
+   mtx_lock_spin(>pps_mtx);
+   pps_event(>pps_state, PPS_CAPTUREASSERT);
+   mtx_unlock_spin(>pps_mtx);
}
 }
 
-static void
-dmtpps_event(void *arg, int pending)
-{
-   struct dmtpps_softc *sc;
-
-   sc = arg;
-
-   /* This is the task function that gets enqueued by poll_pps.  Once the
-* time has been captured by the timecounter polling code which runs in
-* primary interrupt context, the remaining (more expensive) work to
-* process the event is done later in a threaded context.
-*
-* Here there is an interlock that protects the event data in struct
-* pps_state.  That data can be accessed at any time from userland via
-* ioctl() calls so we must ensure that there is no read access to
-* partially updated data while pps_event() does its work.
-*/
-   mtx_lock(>pps_mtx);
-   pps_event(>pps_state, PPS_CAPTUREASSERT);
-   mtx_unlock(>pps_mtx);
-}
-
 static int
 dmtpps_open(struct cdev *dev, int 

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

2019-09-10 Thread Ian Lepore
On Tue, 2019-09-10 at 01:56 +, Conrad Meyer wrote:
> Author: cem
> Date: Tue Sep 10 01:56:47 2019
> New Revision: 352113
> URL: https://svnweb.freebsd.org/changeset/base/352113
> 
> Log:
>   Appease Clang false-positive Werrors in r352112
>   
>   Reported by:bcran
> 
> Modified:
>   head/sys/net/rtsock.c
> 
> Modified: head/sys/net/rtsock.c
> =
> =
> --- head/sys/net/rtsock.c Mon Sep  9 22:54:27 2019(r352112)
> +++ head/sys/net/rtsock.c Tue Sep 10 01:56:47 2019(r352113)
> @@ -2105,7 +2105,7 @@ rt_dumpentry_ddb(struct radix_node *rn, void
> *arg __un
>  
>   if (flags != rt->rt_flags)
>   db_printf(",");
> - db_printf(rt_flag_name(idx));
> + db_printf("%s", rt_flag_name(idx));
>  
>   flags &= ~(1ul << idx);
>   }
> @@ -2374,8 +2374,12 @@ _DB_FUNC(_show, route, db_show_route_cmd,
> db_show_tabl
>   u.dest_sin6.sin6_addr.s6_addr16[i] =
> htons(hextets[i]);
>   dstp = (void *)_sin6;
>   dst_addrp = _sin6.sin6_addr;
> - } else
> + } else {
>   MPASS(false);
> + /* UNREACHABLE */
> + /* Appease Clang false positive: */
> + dstp = NULL;
> + }
>  
>   bp = inet_ntop(af, dst_addrp, buf, sizeof(buf));
>   if (bp != NULL)
> 

I don't think this was a false positive.  MPASS resolves to KASSERT
which resolves to nothing when built without INVARIANTS defined.  So
that comment is misleading, the code isn't unreachable, and after
falling through, dstp is going to be dereferenced a few lines later.

Instead of just squelching the coverity error, I think it should lead
to the question: Does it make any sense to assert in a ddb command
handler?  Would it make more sense to make that else block do something
like db_printf("Unexpected address family %d\n", af); goto exit; ?

-- Ian

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


Re: svn commit: r351918 - head/sys/kern

2019-09-06 Thread Ian Lepore
On Fri, 2019-09-06 at 12:15 +0800, Philip Paeps wrote:
> On 2019-09-06 11:15:12 (+0800), Ian Lepore wrote:
> > On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:
> > > Author: philip
> > > Date: Fri Sep  6 01:19:31 2019
> > > New Revision: 351918
> > > URL: https://svnweb.freebsd.org/changeset/base/351918
> > > 
> > > Log:
> > >   riscv: default to HZ=100
> > > 
> > >   Most current RISC-V development platforms are not fast enough
> > > to
> > > benefit
> > >   from the increased granularity provided by HZ=1000.
> > > 
> > >   Sponsored by:   Axiado
> > > 
> > > Modified:
> > >   head/sys/kern/subr_param.c
> > > 
> > > Modified: head/sys/kern/subr_param.c
> > > =
> > > 
> > > =
> > > --- head/sys/kern/subr_param.cFri Sep  6 00:06:55 2019(
> > > r351
> > > 917)
> > > +++ head/sys/kern/subr_param.cFri Sep  6 01:19:31 2019(
> > > r351
> > > 918)
> > > @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
> > >   */
> > > 
> > >  #ifndef HZ
> > > -#  if defined(__mips__) || defined(__arm__)
> > > +#  if defined(__mips__) || defined(__arm__) || defined(__riscv)
> > >  #define  HZ 100
> > >  #  else
> > >  #define  HZ 1000
> > > 
> > 
> > This seems like a bad idea.  I've run a 90mhz armv4 chip with
> > HZ=1000 
> > and didn't notice any performance hit from doing so.  Almost all
> > arm 
> > kernel config files set HZ as an option, so that define doesn't do 
> > much for arm these days.  It probably does still set HZ for
> > various 
> > mips platforms.
> > 
> > I would think 1000 is appropriate for anything modern running at 
> > 200mhz or more.
> > 
> > Setting it to 100 has the bad side effect of making things like 
> > msleep(), tsleep(), and pause() (which show up in plenty of
> > drivers) 
> > all have a minimum timeout of 10ms, which is a long long time on 
> > modern hardware.
> > 
> > What benefit do you think you'll get from the lower number?
> 
> On systems running at 10s of MHz (or slower, ick), with HZ=1000 you 
> spend an awful lot of time servicing the timer interrupt and not
> very 
> much time doing anything else.
> 
> My rationale was that most RISC-V systems (including emulation and
> FPGA 
> prototypes) I've encountered are running slower than the tipping
> point 
> where HZ=1000 makes sense.  With the default of HZ=100, faster 
> exceptions can still set HZ=1000 in their individual configs.
> 
> When the RISC-V world evolves to having more actual silicon and
> fewer 
> slow prototypes, I definitely agree this default should be flipped
> again 
> for HZ=1000 by default and HZ=100 in the config files for the 
> exceptions.
> 
> Philip
> 

Wait a second... are you saying that the riscv implementation doesn't
support event timers and uses an old-style periodic tick based on HZ? 
I thought only ancient mips and armv5 systems still did that.  Event
timer based (so-called "tickless") systems only take timer interrupts
when actually necessary -- either because something needs to wake up at
that time, or just often enough to prevent timer rollovers, which is
typically a number like 2 or 4 hz.

-- Ian

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


Re: svn commit: r351918 - head/sys/kern

2019-09-05 Thread Ian Lepore
On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:
> Author: philip
> Date: Fri Sep  6 01:19:31 2019
> New Revision: 351918
> URL: https://svnweb.freebsd.org/changeset/base/351918
> 
> Log:
>   riscv: default to HZ=100
>   
>   Most current RISC-V development platforms are not fast enough to
> benefit
>   from the increased granularity provided by HZ=1000.
>   
>   Sponsored by:   Axiado
> 
> Modified:
>   head/sys/kern/subr_param.c
> 
> Modified: head/sys/kern/subr_param.c
> =
> =
> --- head/sys/kern/subr_param.cFri Sep  6 00:06:55 2019(r351
> 917)
> +++ head/sys/kern/subr_param.cFri Sep  6 01:19:31 2019(r351
> 918)
> @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
>   */
>  
>  #ifndef HZ
> -#  if defined(__mips__) || defined(__arm__)
> +#  if defined(__mips__) || defined(__arm__) || defined(__riscv)
>  #define  HZ 100
>  #  else
>  #define  HZ 1000
> 

This seems like a bad idea.  I've run a 90mhz armv4 chip with HZ=1000
and didn't notice any performance hit from doing so.  Almost all arm
kernel config files set HZ as an option, so that define doesn't do much
for arm these days.  It probably does still set HZ for various mips
platforms.  

I would think 1000 is appropriate for anything modern running at 200mhz
or more.

Setting it to 100 has the bad side effect of making things like
msleep(), tsleep(), and pause() (which show up in plenty of drivers)
all have a minimum timeout of 10ms, which is a long long time on modern
hardware.

What benefit do you think you'll get from the lower number?

-- Ian

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


svn commit: r351888 - stable/12/sys/arm/ti/am335x

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 19:25:44 2019
New Revision: 351888
URL: https://svnweb.freebsd.org/changeset/base/351888

Log:
  MFC r350848:
  
  The am335x_ehrpwm driver now requires the pwmbus_if interface, add it.

Modified:
  stable/12/sys/arm/ti/am335x/files.am335x
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/ti/am335x/files.am335x
==
--- stable/12/sys/arm/ti/am335x/files.am335xThu Sep  5 19:17:53 2019
(r351887)
+++ stable/12/sys/arm/ti/am335x/files.am335xThu Sep  5 19:25:44 2019
(r351888)
@@ -10,6 +10,7 @@ arm/ti/am335x/am335x_lcd_syscons.coptionalsc
 arm/ti/am335x/am335x_pmic.coptionalam335x_pmic
 arm/ti/am335x/am335x_prcm.cstandard
 arm/ti/am335x/am335x_pwmss.c   standard
+dev/pwm/pwmbus_if.mstandard
 arm/ti/am335x/am335x_ehrpwm.c  standard
 arm/ti/am335x/am335x_ecap.cstandard
 arm/ti/am335x/am335x_rtc.c optionalam335x_rtc
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 19:17:53 2019
New Revision: 351887
URL: https://svnweb.freebsd.org/changeset/base/351887

Log:
  Use a single write of 3 bytes instead of iicdev_writeto() in ads111x.
  
  The iicdev_writeto() function basically does scatter-gather IO by filling
  in a pair of iic_msg structs to write the register address then the data
  from different locations but with a single bus START/xfer/STOP sequence.
  It turns out several low-level i2c controller drivers do not honor the
  IIC_NOSTART flag, so the second piece of the write gets a new START on
  the bus, and that confuses the ads111x chips which expect a continuous
  write of 3 bytes to set a register.
  
  A proper fix for this is to track down all the misbehaving controllers
  drivers and fix them.  For now this change makes this driver work again.

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

Modified: head/sys/dev/iicbus/ads111x.c
==
--- head/sys/dev/iicbus/ads111x.c   Thu Sep  5 19:17:17 2019
(r351886)
+++ head/sys/dev/iicbus/ads111x.c   Thu Sep  5 19:17:53 2019
(r351887)
@@ -167,11 +167,21 @@ struct ads111x_softc {
 static int
 ads111x_write_2(struct ads111x_softc *sc, int reg, int val) 
 {
-   uint8_t data[2];
+   uint8_t data[3];
+   struct iic_msg msgs[1];
+   uint8_t slaveaddr;
 
-   be16enc(data, val);
+   slaveaddr = iicbus_get_addr(sc->dev);
 
-   return (iic2errno(iicdev_writeto(sc->dev, reg, data, 2, IIC_WAIT)));
+   data[0] = reg;
+   be16enc([1], val);
+
+   msgs[0].slave = slaveaddr;
+   msgs[0].flags = IIC_M_WR;
+   msgs[0].len   = sizeof(data);
+   msgs[0].buf   = data;
+
+   return (iicbus_transfer_excl(sc->dev, msgs, nitems(msgs), IIC_WAIT));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 19:07:48 2019
New Revision: 351885
URL: https://svnweb.freebsd.org/changeset/base/351885

Log:
  Ensure a measurement is complete before reading the result in ads111x.
  Also, disable the comparator by default; it's not used for anything.
  
  The previous logic would start a measurement, and then pause_sbt() for the
  averaging time currently configured in the chip.  After waiting that long,
  the code would blindly read the measurement register and return its value.
  The problem is that the chip's idea of averaging time is based on its
  internal free-running 1MHz oscillator, which may be running at a wildly
  different rate than the kernel clock.  If the chip's internal timer was
  running slower than the kernel clock, we'd end up grabbing a stale result
  from an old measurement.
  
  The driver now still uses pause_sbt() to yield the cpu while waiting for
  the measurement to complete, but after sleeping it checks the chip's status
  register to ensure the measurement engine is idle.  If it's not, the driver
  uses a retry loop to wait a bit (5% of the original wait time) then check
  again for completion.

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

Modified: head/sys/dev/iicbus/ads111x.c
==
--- head/sys/dev/iicbus/ads111x.c   Thu Sep  5 18:54:46 2019
(r351884)
+++ head/sys/dev/iicbus/ads111x.c   Thu Sep  5 19:07:48 2019
(r351885)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #define  ADS111x_CONF_GAIN_SHIFT9  /* Programmable gain 
amp */
 #define  ADS111x_CONF_MODE_SHIFT8  /* Operational mode */
 #define  ADS111x_CONF_RATE_SHIFT5  /* Sample rate */
+#define  ADS111x_CONF_COMP_DISABLE  3  /* Comparator disable */
 
 #defineADS111x_LOTHRESH2   /* Compare lo threshold 
(rw) */
 
@@ -81,7 +82,8 @@ __FBSDID("$FreeBSD$");
  * comparator and we'll leave it alone if they do.  That allows them connect 
the
  * alert pin to something and use the feature without any help from this 
driver.
  */
-#defineADS111x_CONF_DEFAULT(1 << ADS111x_CONF_MODE_SHIFT)
+#defineADS111x_CONF_DEFAULT\
+((1 << ADS111x_CONF_MODE_SHIFT) | ADS111x_CONF_COMP_DISABLE)
 #defineADS111x_CONF_USERMASK   0x001f
 
 /*
@@ -189,7 +191,7 @@ static int
 ads111x_sample_voltage(struct ads111x_softc *sc, int channum, int *voltage) 
 {
struct ads111x_channel *chan;
-   int err, cfgword, convword, rate, waitns;
+   int err, cfgword, convword, rate, retries, waitns;
int64_t fsrange;
 
chan = >channels[channum];
@@ -205,7 +207,8 @@ ads111x_sample_voltage(struct ads111x_softc *sc, int c
 
/*
 * Calculate how long it will take to make the measurement at the
-* current sampling rate (round up), and sleep at least that long.
+* current sampling rate (round up).  The measurement averaging time
+* ranges from 300us to 125ms, so we yield the cpu while waiting.
 */
rate = sc->chipinfo->ratetab[chan->rateidx];
waitns = (10 + rate - 1) / rate;
@@ -213,20 +216,27 @@ ads111x_sample_voltage(struct ads111x_softc *sc, int c
if (err != 0 && err != EWOULDBLOCK)
return (err);
 
-#if 0
/*
-* Sanity-check that the measurement is complete.  Not enabled by
-* default because checking wastes 200-800us just in moving the status
-* command and result across the i2c bus, which could double the time it
-* takes to get one measurement.  Unlike most i2c slaves, this device
-* does not auto-increment the register number on reads, so we can't
-* read both status and measurement in one operation.
+* In theory the measurement should be available now; we waited long
+* enough.  However, the chip times its averaging intervals using an
+* internal 1 MHz oscillator which likely isn't running at the same rate
+* as the system clock, so we have to double-check that the measurement
+* is complete before reading the result.  If it's not ready yet, yield
+* the cpu again for 5% of the time we originally calculated.
+*
+* Unlike most i2c slaves, this device does not auto-increment the
+* register number on reads, so we can't read both status and
+* measurement in one operation.
 */
-   if ((err = ads111x_read_2(sc, ADS111x_CONF, )) != 0)
-   return (err);
-   if (!(cfgword & ADS111x_CONF_IDLE))
-   return (EIO);
-#endif
+   for (retries = 5; ; --retries) {
+   if (retries == 0)
+   return (EWOULDBLOCK);
+   if ((err = ads111x_read_2(sc, ADS111x_CONF, )) != 0)
+   return (err);
+   if (cfgword & ADS111x_CONF_IDLE)
+   break;
+ 

svn commit: r351877 - stable/12/sys/fs/nandfs

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 17:20:48 2019
New Revision: 351877
URL: https://svnweb.freebsd.org/changeset/base/351877

Log:
  Fix LINT kernel builds on powerpc64 and sparc64.  This is a direct commit
  to 12-stable because the nandfs code no longer exists in 13-current.
  
  The build was failing with
  
   nandfs_dat.c:301:
warning: comparison is always false due to limited range of data type
  
  I tried to fix it with an inline (size_t) cast of nargv->nv_nmembs in the
  if() expression, but that didn't help (which seems a bit buggy), but using
  an intermediate variable fixed it.  Elegance doesn't matter as much as
  suppressing the warning; this code is long-dead even on this branch.

Modified:
  stable/12/sys/fs/nandfs/nandfs_dat.c

Modified: stable/12/sys/fs/nandfs/nandfs_dat.c
==
--- stable/12/sys/fs/nandfs/nandfs_dat.cThu Sep  5 17:20:24 2019
(r351876)
+++ stable/12/sys/fs/nandfs/nandfs_dat.cThu Sep  5 17:20:48 2019
(r351877)
@@ -295,10 +295,11 @@ nandfs_get_dat_bdescs_ioctl(struct nandfs_device *nffs
 struct nandfs_argv *nargv)
 {
struct nandfs_bdesc *bd;
-   size_t size;
+   size_t size, sizecheck;
int error;
 
-   if (nargv->nv_nmembs >= SIZE_MAX / sizeof(struct nandfs_bdesc))
+   sizecheck = nargv->nv_nmembs;
+   if (sizecheck >= SIZE_MAX / sizeof(struct nandfs_bdesc))
return (EINVAL);

size = nargv->nv_nmembs * sizeof(struct nandfs_bdesc);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351874 - stable/12/sys/dev/sdhci

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 16:53:55 2019
New Revision: 351874
URL: https://svnweb.freebsd.org/changeset/base/351874

Log:
  MFC r350847:
  
  Allow the sdhci timeout sysctl var to be set as a tunable.  Also, add a
  missing newline in a warning printf.

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

Modified: stable/12/sys/dev/sdhci/sdhci.c
==
--- stable/12/sys/dev/sdhci/sdhci.c Thu Sep  5 16:53:34 2019
(r351873)
+++ stable/12/sys/dev/sdhci/sdhci.c Thu Sep  5 16:53:55 2019
(r351874)
@@ -476,7 +476,7 @@ sdhci_set_power(struct sdhci_slot *slot, u_char power)
DELAY(100);
}
if (!(RD1(slot, SDHCI_POWER_CONTROL) & SDHCI_POWER_ON))
-   slot_printf(slot, "Bus power failed to enable");
+   slot_printf(slot, "Bus power failed to enable\n");
 
if (slot->quirks & SDHCI_QUIRK_INTEL_POWER_UP_RESET) {
WR1(slot, SDHCI_POWER_CONTROL, pwr | 0x10);
@@ -,7 +,7 @@ no_tuning:
slot->timeout = 10;
SYSCTL_ADD_INT(device_get_sysctl_ctx(slot->bus),
SYSCTL_CHILDREN(device_get_sysctl_tree(slot->bus)), OID_AUTO,
-   "timeout", CTLFLAG_RW, >timeout, 0,
+   "timeout", CTLFLAG_RWTUN, >timeout, 0,
"Maximum timeout for SDHCI transfers (in secs)");
TASK_INIT(>card_task, 0, sdhci_card_task, slot);
TIMEOUT_TASK_INIT(taskqueue_swi_giant, >card_delayed_task, 0,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351871 - stable/12/sys/dev/gpio

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 16:48:43 2019
New Revision: 351871
URL: https://svnweb.freebsd.org/changeset/base/351871

Log:
  MFC r350988:
  
  Add PNP_INFO to the gpiopps driver.

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

Modified: stable/12/sys/dev/gpio/gpiopps.c
==
--- stable/12/sys/dev/gpio/gpiopps.cThu Sep  5 16:46:16 2019
(r351870)
+++ stable/12/sys/dev/gpio/gpiopps.cThu Sep  5 16:48:43 2019
(r351871)
@@ -47,6 +47,7 @@ static struct ofw_compat_data compat_data[] = {
{"pps-gpio",1},
{NULL,  0}
 };
+SIMPLEBUS_PNP_INFO(compat_data);
 #endif /* FDT */
 
 static devclass_t pps_devclass;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351870 - stable/12/sys/arm/ti/am335x

2019-09-05 Thread Ian Lepore
Author: ian
Date: Thu Sep  5 16:46:16 2019
New Revision: 351870
URL: https://svnweb.freebsd.org/changeset/base/351870

Log:
  MFC r350838, r350840-r350841, r350849, r350879
  
  r350838:
  Switch the am335x_pmic driver to using iicdev_readfrom/writeto.
  
  PR:   239697
  Submitted by: Chuhong Yuan
  
  r350840:
  Garbage collect the no-longer-necessary MAX_IIC_DATA_SIZE (there is not a
  buffer allocated at that fixed size anymore).
  
  r350841:
  When responding to an interrupt in the am335x_pmic driver, use a taskqueue
  thread to do the work that involves i2c IO, which sleeps while the IO is
  in progress.
  
  r350849:
  Remove use of intr_config_hook from the am335x_pmic and tda19988 drivers.
  Long ago this was needed, but now low-level i2c controller drivers cleverly
  defer attachment of the bus until interrupts are enabled (if they require
  interrupts to function), so that every i2c slave device doesn't have to.
  
  r350879:
  Revert r350841.  I didn't realize that on this chip, reading the interrupt
  status register clears pending interrupts.  By moving that code out of the
  interrupt handler into a taskqueue task, I effectively created an interrupt
  storm by returning from the handler with the interrupt source still active.
  
  We'll have to find a different solution for this driver's need to sleep
  in an ithread context.

Modified:
  stable/12/sys/arm/ti/am335x/am335x_pmic.c
  stable/12/sys/arm/ti/am335x/tda19988.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/ti/am335x/am335x_pmic.c
==
--- stable/12/sys/arm/ti/am335x/am335x_pmic.c   Thu Sep  5 16:37:10 2019
(r351869)
+++ stable/12/sys/arm/ti/am335x/am335x_pmic.c   Thu Sep  5 16:46:16 2019
(r351870)
@@ -56,13 +56,9 @@ __FBSDID("$FreeBSD$");
 
 #include "iicbus_if.h"
 
-#define MAX_IIC_DATA_SIZE  2
-
-
 struct am335x_pmic_softc {
device_tsc_dev;
uint32_tsc_addr;
-   struct intr_config_hook enum_hook;
struct resource *sc_irq_res;
void*sc_intrhand;
 };
@@ -79,30 +75,13 @@ static void am335x_pmic_shutdown(void *, int);
 static int
 am335x_pmic_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size)
 {
-   struct am335x_pmic_softc *sc = device_get_softc(dev);
-   struct iic_msg msg[] = {
-   { sc->sc_addr, IIC_M_WR, 1,  },
-   { sc->sc_addr, IIC_M_RD, size, data },
-   };
-   return (iicbus_transfer(dev, msg, 2));
+   return (iicdev_readfrom(dev, addr, data, size, IIC_INTRWAIT));
 }
 
 static int
 am335x_pmic_write(device_t dev, uint8_t address, uint8_t *data, uint8_t size)
 {
-   uint8_t buffer[MAX_IIC_DATA_SIZE + 1];
-   struct am335x_pmic_softc *sc = device_get_softc(dev);
-   struct iic_msg msg[] = {
-   { sc->sc_addr, IIC_M_WR, size + 1, buffer },
-   };
-
-   if (size > MAX_IIC_DATA_SIZE)
-   return (ENOMEM);
-
-   buffer[0] = address;
-   memcpy(buffer + 1, data, size);
-
-   return (iicbus_transfer(dev, msg, 1));
+   return (iicdev_writeto(dev, address, data, size, IIC_INTRWAIT));
 }
 
 static void
@@ -220,10 +199,9 @@ am335x_pmic_setvo(device_t dev, uint8_t vo)
 }
 
 static void
-am335x_pmic_start(void *xdev)
+am335x_pmic_start(struct am335x_pmic_softc *sc)
 {
-   struct am335x_pmic_softc *sc;
-   device_t dev = (device_t)xdev;
+   device_t dev;
struct tps65217_status_reg status_reg;
struct tps65217_chipid_reg chipid_reg;
uint8_t reg, vo;
@@ -231,8 +209,7 @@ am335x_pmic_start(void *xdev)
char pwr[4][11] = {"Battery", "USB", "AC", "USB and AC"};
int rv;
 
-   sc = device_get_softc(dev);
-
+   dev = sc->sc_dev;
am335x_pmic_read(dev, TPS65217_CHIPID_REG, (uint8_t *)_reg, 1);
switch (chipid_reg.chip) {
case TPS65217A:
@@ -275,8 +252,6 @@ am335x_pmic_start(void *xdev)
EVENTHANDLER_REGISTER(shutdown_final, am335x_pmic_shutdown, dev,
SHUTDOWN_PRI_LAST);
 
-   config_intrhook_disestablish(>enum_hook);
-
/* Unmask all interrupts and clear pending status */
reg = 0;
am335x_pmic_write(dev, TPS65217_INT_REG, , 1);
@@ -308,11 +283,7 @@ am335x_pmic_attach(device_t dev)
/* return (ENXIO); */
}
 
-   sc->enum_hook.ich_func = am335x_pmic_start;
-   sc->enum_hook.ich_arg = dev;
-
-   if (config_intrhook_establish(>enum_hook) != 0)
-   return (ENOMEM);
+   am335x_pmic_start(sc);
 
return (0);
 }

Modified: stable/12/sys/arm/ti/am335x/tda19988.c
==
--- stable/12/sys/arm/ti/am335x/tda19988.c  Thu Sep  5 16:37:10 2019
(r351869)
+++ stable/12/sys/arm/ti/am335x/tda19988.c  Thu Sep  5 16:46:16 2019
(r351870)
@@ -242,7 

svn commit: r351869 - in stable/12: share/man/man4 sys/conf sys/dev/iicbus sys/modules/i2c sys/modules/i2c/ads111x

2019-09-05 Thread Ian Lepore
ts eight available gain values, chosen
@@ -134,7 +134,7 @@ by setting a value of 0 through 7 into the correspondi
 register bits.
 This variable sets the value used for those bits when making a
 measurement on the given channel.
-.It Va dev.ads1115...voltage
+.It Va dev.ads111x...voltage
 Reading this variable causes the device to make a measurement on
 the corresponding input pin(s) and return the voltage in microvolts.
 .Pp
@@ -160,7 +160,7 @@ based system, the
 device is defined as a slave device subnode
 of the i2c bus controller node.
 All properties documented in the
-.Va ads1115.txt
+.Va ads1015.txt
 bindings document can be used with the
 .Nm
 device.
@@ -182,7 +182,7 @@ I2c slave address of device.
 .Pp
 Specific channels can be configured by adding child nodes to the
 .Nm
-node, as described in the standard ads1115.txt bindings document.
+node, as described in the standard ads1015.txt bindings document.
 If no channels are configured, sysctl variables will be created
 for all possible channels supported by the device type, otherwise
 only the specified channels are created.
@@ -215,16 +215,16 @@ based system, such as
 these values are configurable for
 .Nm :
 .Bl -tag -width indent
-.It Va hint.ads1115..at
+.It Va hint.ads111x..at
 The iicbus instance the
 .Nm
 instance is attached to.
-.It Va hint.ads1115...gain_index
+.It Va hint.ads111x...gain_index
 The amplifier gain, as described above for the sysctl variable
-.Va dev.ads1115...gain_index .
-.It Va hint.ads1115...rate_index
+.Va dev.ads111x...gain_index .
+.It Va hint.ads111x...rate_index
 The sample rate, as described above for the sysctl variable
-.Va dev.ads1115...rate_index .
+.Va dev.ads111x...rate_index .
 .El
 .Pp
 If no channels are configured, sysctl variables will be created

Modified: stable/12/sys/conf/NOTES
==
--- stable/12/sys/conf/NOTESThu Sep  5 15:55:24 2019(r351868)
+++ stable/12/sys/conf/NOTESThu Sep  5 16:37:10 2019(r351869)
@@ -2525,6 +2525,7 @@ deviceiicoc   # OpenCores I2C 
controller support
 # I2C peripheral devices
 #
 device ad7418  # Analog Devices temp and voltage sensor
+device ads111x # Texas Instruments ADS101x and ADS111x ADCs
 device ds1307  # Dallas DS1307 RTC and compatible
 device ds13rtc # All Dallas/Maxim ds13xx chips
 device ds1672  # Dallas DS1672 RTC

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesThu Sep  5 15:55:24 2019(r351868)
+++ stable/12/sys/conf/filesThu Sep  5 16:37:10 2019(r351869)
@@ -1843,6 +1843,7 @@ dev/ida/ida.c optional ida
 dev/ida/ida_disk.c optional ida
 dev/ida/ida_pci.c  optional ida pci
 dev/iicbus/ad7418.coptional ad7418
+dev/iicbus/ads111x.c   optional ads111x
 dev/iicbus/ds1307.coptional ds1307
 dev/iicbus/ds13rtc.c   optional ds13rtc | ds133x | ds1374
 dev/iicbus/ds1672.coptional ds1672

Copied: stable/12/sys/dev/iicbus/ads111x.c (from r350591, 
head/sys/dev/iicbus/ads111x.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/dev/iicbus/ads111x.c  Thu Sep  5 16:37:10 2019
(r351869, copy of r350591, head/sys/dev/iicbus/ads111x.c)
@@ -0,0 +1,582 @@
+/*-
+ * Copyright (c) 2019 Ian Lepore.
+ *
+ * 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.
+ */
+
+/*
+ * Driver for Texas Instruments ADS101x and ADS111x family i2c ADC chips.
+ */
+
+#include 
+__FBSDID("$Fre

Re: svn commit: r351818 - in head/sys: arm/conf arm64/conf conf

2019-09-04 Thread Ian Lepore
On Wed, 2019-09-04 at 15:55 +, Ruslan Bukin wrote:
> Author: br
> Date: Wed Sep  4 15:55:44 2019
> New Revision: 351818
> URL: https://svnweb.freebsd.org/changeset/base/351818
> 
> Log:
>   Include dwgpio to the build.
>   
>   Sponsored by:   DARPA, AFRL
> 
> Modified:
>   head/sys/arm/conf/GENERIC
>   head/sys/arm64/conf/GENERIC
>   head/sys/conf/files
> 

This should probably also be added to sys/conf/NOTES so it gets built
in LINT kernels.

-- Ian

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


svn commit: r346523 - stable/11/sys/dev/efidev

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:23:49 2019
New Revision: 346523
URL: https://svnweb.freebsd.org/changeset/base/346523

Log:
  MFC r335766:
  
  Add missing MODULE_VERSION() and MODULE_DEPEND().

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

Modified: stable/11/sys/dev/efidev/efirtc.c
==
--- stable/11/sys/dev/efidev/efirtc.c   Mon Apr 22 04:15:22 2019
(r346522)
+++ stable/11/sys/dev/efidev/efirtc.c   Mon Apr 22 04:23:49 2019
(r346523)
@@ -203,3 +203,5 @@ static driver_t efirtc_driver = {
 };
 
 DRIVER_MODULE(efirtc, nexus, efirtc_driver, efirtc_devclass, 0, 0);
+MODULE_VERSION(efirtc, 1);
+MODULE_DEPEND(efirtc, efirt, 1, 1, 1);


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


svn commit: r346548 - stable/11/sys/dev/iicbus

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 13:51:25 2019
New Revision: 346548
URL: https://svnweb.freebsd.org/changeset/base/346548

Log:
  MFC r337731:
  
  Export the eeprom device size via readonly sysctl.  Also export the write
  page size and address size, although they are likely to be inherently
  less-interesting values outside of the driver.

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

Modified: stable/11/sys/dev/iicbus/icee.c
==
--- stable/11/sys/dev/iicbus/icee.c Mon Apr 22 13:45:08 2019
(r346547)
+++ stable/11/sys/dev/iicbus/icee.c Mon Apr 22 13:51:25 2019
(r346548)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -184,6 +185,8 @@ static int
 icee_attach(device_t dev)
 {
struct icee_softc *sc = device_get_softc(dev);
+   struct sysctl_ctx_list *ctx;
+   struct sysctl_oid_list *tree;
 
sc->dev = dev;
sc->addr = iicbus_get_addr(dev);
@@ -203,6 +206,16 @@ icee_attach(device_t dev)
return (ENOMEM);
}
sc->cdev->si_drv1 = sc;
+
+   ctx = device_get_sysctl_ctx(dev);
+   tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
+   SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "address_size", CTLFLAG_RD,
+   >type, 0, "Memory array address size in bits");
+   SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "device_size", CTLFLAG_RD,
+   >size, 0, "Memory array capacity in bytes");
+   SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "write_size", CTLFLAG_RD,
+   >wr_sz, 0, "Memory array page write size in bytes");
+
return (0);
 }
 


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


svn commit: r346526 - in stable/11: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx6_snvs

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 05:00:29 2019
New Revision: 346526
URL: https://svnweb.freebsd.org/changeset/base/346526

Log:
  MFC r336094, r336096
  
  r336094:
  Catch up with improvements in RTC handling... It's no longer necessary to
  ignore the timestamp passed in to settime() due to inaccuracy, the core
  routines now pass in a nanosecond-accurate time freshly-obtained before
  calling each driver's settime() method.  Also, add calls to the new
  debugging output helpers.
  
  r336096:
  Make the imx6_snvs driver usable as a module, add pnp info.  Add a manpage.

Added:
  stable/11/share/man/man4/man4.arm/imx6_snvs.4
 - copied unchanged from r336096, head/share/man/man4/man4.arm/imx6_snvs.4
  stable/11/sys/modules/imx/imx6_snvs/
 - copied from r336096, head/sys/modules/imx/imx6_snvs/
Modified:
  stable/11/share/man/man4/man4.arm/Makefile
  stable/11/sys/arm/freescale/imx/imx6_snvs.c
  stable/11/sys/modules/imx/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/man4.arm/Makefile
==
--- stable/11/share/man/man4/man4.arm/Makefile  Mon Apr 22 04:58:01 2019
(r346525)
+++ stable/11/share/man/man4/man4.arm/Makefile  Mon Apr 22 05:00:29 2019
(r346526)
@@ -5,6 +5,7 @@ PACKAGE=runtime-manuals
 MAN=   cgem.4 \
devcfg.4 \
imx6_ahci.4 \
+   imx6_snvs.4 \
imx_wdog.4 \
mge.4 \
npe.4 \

Copied: stable/11/share/man/man4/man4.arm/imx6_snvs.4 (from r336096, 
head/share/man/man4/man4.arm/imx6_snvs.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/man4.arm/imx6_snvs.4   Mon Apr 22 05:00:29 
2019(r346526, copy of r336096, head/share/man/man4/man4.arm/imx6_snvs.4)
@@ -0,0 +1,78 @@
+.\"
+.\" Copyright (c) 2018 Ian Lepore 
+.\" 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 ``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$
+.\"
+.Dd July 8, 2018
+.Dt IMX6_SNVS 4
+.Os
+.Sh NAME
+.Nm imx6_snvs
+.Nd device driver for the NXP i.MX6 on-chip Realtime Clock
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device imx6_snvs"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+imx6_snvs_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+support for the i.MX6 on-chip realtime clock.
+It provides the time of day with a resolution of approximately
+30 microseconds.
+.Pp
+.Sq SNVS
+stands for Secure Non-Volatile Storage, and refers to the subsystem
+within the chip that (optionally) remains powered by a battery when
+the rest of the system is powered down.
+The on-chip realtime clock is part of that subsystem.
+Other features of the SNVS subsystem are related to security, tamper
+monitoring, and power control; the
+.Nm
+driver does not currently support those features.
+.Pp
+Many i.MX6 systems do not use a battery to provide power to the SNVS
+due to its relatively high power draw.  In such systems, this driver
+is able to provide a very accurate time following a reboot, but cannot
+provide time at all if the power is cycled.  If the system provides an
+i2c or other type of alternate realtime clock with lower resolution,
+there is value in configuring both clock drivers.
+Doing so allows SNVS to provide accurate time after a reboot, whi

svn commit: r346562 - stable/11/share/man/man7

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 15:26:21 2019
New Revision: 346562
URL: https://svnweb.freebsd.org/changeset/base/346562

Log:
  MFC r337364:
  
  Document 64-bit arm in terms of arch name (aarch64) not machine (arm64).
  Other architectures are documented in terms of the name that is displayed by
  'uname -p', aka MACHINE_ARCH and TARGET_ARCH in the build system, now
  aarch64 matches the rest of them.
  
  PR:   220297

Modified:
  stable/11/share/man/man7/arch.7
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man7/arch.7
==
--- stable/11/share/man/man7/arch.7 Mon Apr 22 15:23:06 2019
(r346561)
+++ stable/11/share/man/man7/arch.7 Mon Apr 22 15:26:21 2019
(r346562)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 16, 2017
+.Dd August 5, 2018
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -90,12 +90,12 @@ architectures, the final release.
 .Pp
 .Bl -column -offset indent "Sy Architecture" "Sy Initial Release" "Sy Final 
Release"
 .It Sy Architecture Ta Sy Initial Release Ta Sy Final Release
+.It aarch64 Ta 11.0
 .It alpha   Ta 3.2   Ta 6.4
 .It amd64   Ta 5.1
 .It arm Ta 6.0
 .It armeb   Ta 8.0
 .It armv6   Ta 10.0
-.It arm64   Ta 11.0
 .It ia64Ta 5.0   Ta 10.x
 .It i386Ta 1.0
 .It mipsTa 8.0
@@ -161,7 +161,7 @@ Examples are:
 .It Dv powerpc64   Ta Dv powerpc
 .It Dv mips64* Ta Dv mips*
 .El
-.Dv arm64
+.Dv aarch64
 currently does not support execution of
 .Dv armv6
 binaries, even if the CPU implements
@@ -188,11 +188,11 @@ require only 4-byte alignment for 64-bit integers.
 Machine-dependent type sizes:
 .Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy 
time_t"
 .It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
+.It aarch64 Ta 8 Ta 16 Ta 8
 .It amd64   Ta 8 Ta 16 Ta 8
 .It arm Ta 4 Ta  8 Ta 8
 .It armeb   Ta 4 Ta  8 Ta 8
 .It armv6   Ta 4 Ta  8 Ta 8
-.It arm64   Ta 8 Ta 16 Ta 8
 .It i386Ta 4 Ta 12 Ta 4
 .It mipsTa 4 Ta  8 Ta 8
 .It mipsel  Ta 4 Ta  8 Ta 8
@@ -217,11 +217,11 @@ variants of powerpc.
 .Ss Endianness and Char Signedness
 .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char 
Signedness"
 .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
+.It aarch64 Ta little Ta unsigned
 .It amd64   Ta little Ta   signed
 .It arm Ta little Ta unsigned
 .It armeb   Ta bigTa unsigned
 .It armv6   Ta little Ta unsigned
-.It arm64   Ta little Ta unsigned
 .It i386Ta little Ta   signed
 .It mipsTa bigTa   signed
 .It mipsel  Ta little Ta   signed
@@ -242,11 +242,11 @@ variants of powerpc.
 .Ss Page Size
 .Bl -column -offset indent "Sy Architecture" "Sy Page Sizes"
 .It Sy Architecture Ta Sy Page Sizes
+.It aarch64 Ta 4K, 2M, 1G
 .It amd64   Ta 4K, 2M, 1G
 .It arm Ta 4K
 .It armeb   Ta 4K
 .It armv6   Ta 4K, 1M
-.It arm64   Ta 4K, 2M, 1G
 .It i386Ta 4K, 2M (PAE), 4M
 .It mipsTa 4K
 .It mipsel  Ta 4K
@@ -267,11 +267,11 @@ variants of powerpc.
 .Ss Floating Point
 .Bl -column -offset indent "Sy Architecture" "Sy float, double" "Sy long 
double"
 .It Sy Architecture Ta Sy float, double Ta Sy long double
+.It aarch64 Ta hard Ta soft, quad precision
 .It amd64   Ta hard Ta hard, 80 bit
 .It arm Ta soft Ta soft, double precision
 .It armeb   Ta soft Ta soft, double precision
 .It armv6   Ta hard(1) Ta hard, double precision
-.It arm64   Ta hard Ta soft, quad precision
 .It i386Ta hard Ta hard, 80 bit
 .It mipsTa soft Ta identical to double
 .It mipsel  Ta soft Ta identical to double
@@ -319,11 +319,11 @@ is not used on
 Architecture-specific macros:
 .Bl -column -offset indent "Sy Architecture" "Sy Predefined macros"
 .It Sy Architecture Ta Sy Predefined macros
+.It aarch64 Ta Dv __aarch64__
 .It amd64   Ta Dv __amd64__, Dv __x86_64__
 .It arm Ta Dv __arm__
 .It armeb   Ta Dv __arm__
 .It armv6   Ta Dv __arm__, Dv __ARM_ARCH >= 6
-.It arm64   Ta Dv __aarch64__
 .It i386Ta Dv __i386__
 .It mipsTa Dv __mips__, Dv __MIPSEB__, Dv __mips_o32
 .It mipsel  Ta Dv __mips__, Dv __mips_o32


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


svn commit: r346501 - in stable/12/stand: i386/common i386/gptboot i386/loader i386/zfsboot libsa/zfs

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 22:13:07 2019
New Revision: 346501
URL: https://svnweb.freebsd.org/changeset/base/346501

Log:
  MFC r341420, r341473, r341651
  
  r341420:
  Eliminate duplicated code and struct member definitions in the handoff
  of args data between gptboot/zfsboot and loader(8).
  
  Despite what seems like a lot of changes here, there are no actual
  changes in behavior, or in the data layout in the structures involved.
  This is just eliminating identical code pasted into multiple locations.
  
  In detail, the changes are...
  
  - Move struct zfs_boot_args definition from libsa/zfs/libzfs.h to
i386/common/bootargs.h because it is specific to x86 booting and the
handoff between zfsboot and loader, and has no relation to the zfs
library code in general.
  
  - The geli_boot_args and zfs_boot_args structs both contain an identical
set of member variables containing geli information.  Extract this out
to a new geli_boot_data struct, and embed it in the arg-passing structs.
  
  - Provide new routines geli_import_boot_data() and geli_export_boot_data()
that can be shared between gptboot, zfsboot, and loader instead of
pasting identical code into several different .c files.
  
  - Remove some checks for a NULL pointer that can never be true because the
pointer being tested was set using pointer math (kargs + 1) and that can
never result in NULL in this code.
  
  r341473:
  Fix args cross-threading between gptboot(8) and loader(8) with zfs support.
  
  When loader(8) is built with zfs support enabled, it assumes that any extarg
  data present is a zfs_boot_args struct, but if the first-stage loader was
  gptboot(8) the extarg data is actually a geli_boot_args struct.  Luckily,
  zfsboot(8) and gptzfsboot(8) have always passed KARGS_FLAGS_ZFS along with
  KARGS_FLAGS_EXTARG, so we can use KARGS_FLAGS_ZFS to decide whether the
  extarg data is a zfs_boot_args struct.
  
  To avoid similar problems in the future, gptboot(8) now passes a new
  KARGS_FLAGS_GELI to indicate that extarg data is geli_boot_args.  In
  loader(8), if the neither KARGS_FLAGS_ZFS nor KARGS_FLAGS_GELI is set but
  extarg data is present (which will be the case for gptboot compiled before
  this change), we now check for the known size of the geli_boot_args struct
  passed by the older versions of gptboot as a way of confirming what type of
  extarg data is present.
  
  In a semi-related tidying up, since loader's main() has already decided
  what type of extarg data is present and set the global 'zargs' var
  accordingly, don't repeat the check in extract_currdev, just check whether
  zargs is NULL or not.
  
  r341651:
  Don't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined
  because the variables will be undefined too.

Modified:
  stable/12/stand/i386/common/bootargs.h
  stable/12/stand/i386/gptboot/gptboot.c
  stable/12/stand/i386/loader/main.c
  stable/12/stand/i386/zfsboot/zfsboot.c
  stable/12/stand/libsa/zfs/libzfs.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/i386/common/bootargs.h
==
--- stable/12/stand/i386/common/bootargs.h  Sun Apr 21 20:55:33 2019
(r346500)
+++ stable/12/stand/i386/common/bootargs.h  Sun Apr 21 22:13:07 2019
(r346501)
@@ -18,10 +18,11 @@
 #ifndef _BOOT_I386_ARGS_H_
 #define_BOOT_I386_ARGS_H_
 
-#defineKARGS_FLAGS_CD  0x1
-#defineKARGS_FLAGS_PXE 0x2
-#defineKARGS_FLAGS_ZFS 0x4
-#defineKARGS_FLAGS_EXTARG  0x8 /* variably sized extended 
argument */
+#defineKARGS_FLAGS_CD  0x0001  /* .bootdev is a bios CD dev */
+#defineKARGS_FLAGS_PXE 0x0002  /* .pxeinfo is valid */
+#defineKARGS_FLAGS_ZFS 0x0004  /* .zfspool is valid, EXTARG is 
zfs_boot_args */
+#defineKARGS_FLAGS_EXTARG  0x0008  /* variably sized extended 
argument */
+#defineKARGS_FLAGS_GELI0x0010  /* EXTARG is geli_boot_args */
 
 #defineBOOTARGS_SIZE   24  /* sizeof(struct bootargs) */
 #defineBA_BOOTFLAGS8   /* offsetof(struct bootargs, bootflags) 
*/
@@ -84,11 +85,15 @@ struct bootargs
 
 #ifdef LOADER_GELI_SUPPORT
 #include 
+#include "geliboot.h"
 #endif
 
-struct geli_boot_args
+/*
+ * geli_boot_data is embedded in geli_boot_args (passed from gptboot to loader)
+ * and in zfs_boot_args (passed from zfsboot and gptzfsboot to loader).
+ */
+struct geli_boot_data
 {
-uint32_t   size;
 union {
 chargelipw[256];
 struct {
@@ -104,6 +109,49 @@ struct geli_boot_args
 #endif
 };
 };
+};
+
+#ifdef LOADER_GELI_SUPPORT
+
+static inline void
+export_geli_boot_data(struct geli_boot_data *gbdata)
+{
+
+   gbdata->notapw = '\0';
+   gbdata->keybuf_sentinel = KEYBUF_SENTINEL;
+   gbdata->keybuf = malloc(sizeof(struct 

svn commit: r346549 - stable/11/sys/dev/vt

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 13:55:06 2019
New Revision: 346549
URL: https://svnweb.freebsd.org/changeset/base/346549

Log:
  MFC r342639:
  
  When allocating a new keyboard at vt_upgrade() time, unwind any cngrabs
  done on the old keyboard and then do the corresponding number of grabs
  on the new keyboard.
  
  This fixes a race that can leave the system with a non-functioning
  keyboard.  It goes like this...
  
   - The bios claims there is an AT keyboard, atkbd attaches.
   - SI_SUB_INT_CONFIG_HOOKS runs.
   - USB probes devices. Devices begin attaching, including disks.
   - GELI prompts for a password for a just-attached disk, which results
 in a cngrab() while atkbd is the keyboard.
   - A USB keyboard attaches.
   - vt_upgrade() runs and switches the keyboard to the new USB keyboard,
 but because cngrab was never called for it, it's not activated and
 keystrokes are ignored.
   - Now there is no functional keyboard and no way to get one; even
 plugging in a different USB keyboard doesn't help, because the console
 is still grabbed, still waiting for a GELI pw.

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

Modified: stable/11/sys/dev/vt/vt_core.c
==
--- stable/11/sys/dev/vt/vt_core.c  Mon Apr 22 13:51:25 2019
(r346548)
+++ stable/11/sys/dev/vt/vt_core.c  Mon Apr 22 13:55:06 2019
(r346549)
@@ -937,10 +937,22 @@ vt_kbdevent(keyboard_t *kbd, int event, void *arg)
 static int
 vt_allocate_keyboard(struct vt_device *vd)
 {
-   int  idx0, idx;
+   int  grabbed, i, idx0, idx;
keyboard_t  *k0, *k;
keyboard_info_t  ki;
 
+   /*
+* If vt_upgrade() happens while the console is grabbed, we are
+* potentially going to switch keyboard devices while the keyboard is in
+* use. Unwind the grabbing of the current keyboard first, then we will
+* re-grab the new keyboard below, before we return.
+*/
+   if (vd->vd_curwindow == _conswindow) {
+   grabbed = vd->vd_curwindow->vw_grabbed;
+   for (i = 0; i < grabbed; ++i)
+   vtterm_cnungrab(vd->vd_curwindow->vw_terminal);
+   }
+
idx0 = kbd_allocate("kbdmux", -1, vd, vt_kbdevent, vd);
if (idx0 >= 0) {
DPRINTF(20, "%s: kbdmux allocated, idx = %d\n", __func__, idx0);
@@ -971,6 +983,11 @@ vt_allocate_keyboard(struct vt_device *vd)
}
vd->vd_keyboard = idx0;
DPRINTF(20, "%s: vd_keyboard = %d\n", __func__, vd->vd_keyboard);
+
+   if (vd->vd_curwindow == _conswindow) {
+   for (i = 0; i < grabbed; ++i)
+   vtterm_cngrab(vd->vd_curwindow->vw_terminal);
+   }
 
return (idx0);
 }


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


svn commit: r346522 - in stable/11: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx_wdog

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:15:22 2019
New Revision: 346522
URL: https://svnweb.freebsd.org/changeset/base/346522

Log:
  MFC r336070, r336072-r336073, r336076
  
  r336070:
  Add pnp info and a module makefile for the imx_wdog watchdog driver.
  
  r336072:
  Correctly calculate the value to put in the imx wdog countdown register.
  
  The correct value is seconds*2-1.  The code was using just seconds*2, which
  led to being off by a half-second -- usually not a big deal, except when the
  value was the max (128) it overflowed so zero would get written to the
  countdown register, which equates to a timeout of a half second.
  
  r336073:
  Add support to the imx watchdog for the FDT "timeout-sec" property, by
  automatically initializing the watchdog using the given value.  Also,
  attach at BUS_PASS_TIMER to extend watchdog protection to more of the
  kernel init process.
  
  r336076:
  Add a manpage for the imx5/6 watchdog driver.

Added:
  stable/11/share/man/man4/man4.arm/imx_wdog.4
 - copied unchanged from r336076, head/share/man/man4/man4.arm/imx_wdog.4
  stable/11/sys/modules/imx/imx_wdog/
 - copied from r336070, head/sys/modules/imx/imx_wdog/
Modified:
  stable/11/share/man/man4/man4.arm/Makefile
  stable/11/sys/arm/freescale/imx/imx_wdog.c
  stable/11/sys/modules/imx/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/man4.arm/Makefile
==
--- stable/11/share/man/man4/man4.arm/Makefile  Mon Apr 22 04:11:37 2019
(r346521)
+++ stable/11/share/man/man4/man4.arm/Makefile  Mon Apr 22 04:15:22 2019
(r346522)
@@ -4,11 +4,13 @@ PACKAGE=runtime-manuals
 
 MAN=   cgem.4 \
devcfg.4 \
+   imx_wdog.4 \
mge.4 \
npe.4 \
ti_adc.4
 
 MLINKS= cgem.4 if_cgem.4
+MLINKS+= imx_wdog.4 imxwdt.4
 MLINKS+= mge.4 if_mge.4
 MLINKS+=npe.4 if_npe.4
 

Copied: stable/11/share/man/man4/man4.arm/imx_wdog.4 (from r336076, 
head/share/man/man4/man4.arm/imx_wdog.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/man4.arm/imx_wdog.4Mon Apr 22 04:15:22 
2019(r346522, copy of r336076, head/share/man/man4/man4.arm/imx_wdog.4)
@@ -0,0 +1,112 @@
+.\"
+.\" Copyright (c) 2018 Ian Lepore 
+.\" 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 ``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$
+.\"
+.Dd July 7, 2018
+.Dt IMX_WDOG 4
+.Os
+.Sh NAME
+.Nm imx_wdog
+.Nd device driver for the NXP i.MX5 and i.MX6 watchdog timer
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device imxwdt"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+imx_wdog_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+.Xr watchdog 4
+support for the watchdog timer present on NXP i.MX5 and i.MX6 processors.
+The i.MX watchdog hardware supports programmable timeouts ranging from
+0.5 to 128 seconds, in half-second increments.
+Once activated, the watchdog hardware cannot be deactivated, but the
+timeout period can be changed to any valid non-zero value.
+.Pp
+At power-on, a special 16-second
+.Sq power-down timer
+mode is automatically enabled by the hardware.
+It will assert the external WDOG_B signal, which may be connected to
+external hardware that cause

svn commit: r346504 - stable/12/stand/uboot/common

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 22:28:50 2019
New Revision: 346504
URL: https://svnweb.freebsd.org/changeset/base/346504

Log:
  MFC r344254-r344255
  
  r344254:
  Use DEV_TYP_NONE instead of -1 to indicate no device was specified.
  
  DEV_TYP_NONE has a value of zero, which makes more sense since the device
  type is a bunch of bits describing the device, crammed into an int.
  
  r344255:
  Fix more places to use DEV_TYP_NONE instead of -1 to indicate 'no device'.

Modified:
  stable/12/stand/uboot/common/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/uboot/common/main.c
==
--- stable/12/stand/uboot/common/main.c Sun Apr 21 22:26:27 2019
(r346503)
+++ stable/12/stand/uboot/common/main.c Sun Apr 21 22:28:50 2019
(r346504)
@@ -156,7 +156,7 @@ get_device_type(const char *devstr, int *devtype)
printf("Unknown device type '%s'\n", devstr);
}
 
-   *devtype = -1;
+   *devtype = DEV_TYP_NONE;
return (NULL);
 }
 
@@ -211,7 +211,7 @@ get_load_device(int *type, int *unit, int *slice, int 
const char *p;
char *endp;
 
-   *type = -1;
+   *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
*partition = -1;
@@ -250,13 +250,13 @@ get_load_device(int *type, int *unit, int *slice, int 
p++;
 
/* Unknown device name, or a known name without unit number.  */
-   if ((*type == -1) || (*p == '\0')) {
+   if ((*type == DEV_TYP_NONE) || (*p == '\0')) {
return;
}
 
/* Malformed unit number. */
if (!isdigit(*p)) {
-   *type = -1;
+   *type = DEV_TYP_NONE;
return;
}
 
@@ -271,7 +271,7 @@ get_load_device(int *type, int *unit, int *slice, int 
 
/* Device string is malformed beyond unit number. */
if (*p != ':') {
-   *type = -1;
+   *type = DEV_TYP_NONE;
*unit = -1;
return;
}
@@ -284,7 +284,7 @@ get_load_device(int *type, int *unit, int *slice, int 
 
/* Only DEV_TYP_STOR devices can have a slice specification. */
if (!(*type & DEV_TYP_STOR)) {
-   *type = -1;
+   *type = DEV_TYP_NONE;
*unit = -1;
return;
}
@@ -293,7 +293,7 @@ get_load_device(int *type, int *unit, int *slice, int 
 
/* Malformed slice number. */
if (p == endp) {
-   *type = -1;
+   *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
return;
@@ -307,7 +307,7 @@ get_load_device(int *type, int *unit, int *slice, int 
 
/* Device string is malformed beyond slice number. */
if (*p != '.') {
-   *type = -1;
+   *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
return;
@@ -327,7 +327,7 @@ get_load_device(int *type, int *unit, int *slice, int 
return;
 
/* Junk beyond partition number. */
-   *type = -1;
+   *type = DEV_TYP_NONE;
*unit = -1;
*slice = 0;
*partition = -1;
@@ -496,14 +496,14 @@ main(int argc, char **argv)
currdev.dd.d_dev = devsw[i];
currdev.dd.d_unit = 0;
 
-   if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
+   if ((load_type == DEV_TYP_NONE || (load_type & DEV_TYP_STOR)) &&
strcmp(devsw[i]->dv_name, "disk") == 0) {
if (probe_disks(i, load_type, load_unit, load_slice, 
load_partition) == 0)
break;
}
 
-   if ((load_type == -1 || (load_type & DEV_TYP_NET)) &&
+   if ((load_type == DEV_TYP_NONE || (load_type & DEV_TYP_NET)) &&
strcmp(devsw[i]->dv_name, "net") == 0)
break;
}


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


svn commit: r346524 - in stable/11/sys/arm: allwinner cavium/cns11xx freescale/imx freescale/vybrid samsung/exynos ti/usb xilinx

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:56:41 2019
New Revision: 346524
URL: https://svnweb.freebsd.org/changeset/base/346524

Log:
  MFC r333073-r333074
  
  r333073 by manu:
  arm: Fix duplicate ahci DRIVER_MODULE
  
  Name each ahci driver uniquely.
  This remove the warning printed at each arm boot :
  module_register: cannot register simplebus/ahci from kernel; already loaded 
from kernel
  
  r333074 by manu:
  arm: Fix duplicate ehci DRIVER_MODULE
  
  Name each ehci driver uniquely.
  This remove the warning printed at each arm boot :
  module_register: cannot register simplebus/ehci from kernel; already loaded 
from kernel

Modified:
  stable/11/sys/arm/allwinner/a10_ahci.c
  stable/11/sys/arm/allwinner/a10_ehci.c
  stable/11/sys/arm/cavium/cns11xx/ehci_ebus.c
  stable/11/sys/arm/freescale/imx/imx6_ahci.c
  stable/11/sys/arm/freescale/vybrid/vf_ehci.c
  stable/11/sys/arm/samsung/exynos/exynos5_ehci.c
  stable/11/sys/arm/ti/usb/omap_ehci.c
  stable/11/sys/arm/xilinx/zy7_ehci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_ahci.c
==
--- stable/11/sys/arm/allwinner/a10_ahci.c  Mon Apr 22 04:23:49 2019
(r346523)
+++ stable/11/sys/arm/allwinner/a10_ahci.c  Mon Apr 22 04:56:41 2019
(r346524)
@@ -392,4 +392,4 @@ static driver_t ahci_ata_driver = {
 sizeof(struct ahci_controller)
 };
 
-DRIVER_MODULE(ahci, simplebus, ahci_ata_driver, ahci_devclass, 0, 0);
+DRIVER_MODULE(a10_ahci, simplebus, ahci_ata_driver, ahci_devclass, 0, 0);

Modified: stable/11/sys/arm/allwinner/a10_ehci.c
==
--- stable/11/sys/arm/allwinner/a10_ehci.c  Mon Apr 22 04:23:49 2019
(r346523)
+++ stable/11/sys/arm/allwinner/a10_ehci.c  Mon Apr 22 04:56:41 2019
(r346524)
@@ -361,5 +361,5 @@ static driver_t ehci_driver = {
 
 static devclass_t ehci_devclass;
 
-DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
-MODULE_DEPEND(ehci, usb, 1, 1, 1);
+DRIVER_MODULE(a10_ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
+MODULE_DEPEND(a10_ehci, usb, 1, 1, 1);

Modified: stable/11/sys/arm/cavium/cns11xx/ehci_ebus.c
==
--- stable/11/sys/arm/cavium/cns11xx/ehci_ebus.cMon Apr 22 04:23:49 
2019(r346523)
+++ stable/11/sys/arm/cavium/cns11xx/ehci_ebus.cMon Apr 22 04:56:41 
2019(r346524)
@@ -244,5 +244,5 @@ static driver_t ehci_driver = {
 
 static devclass_t ehci_devclass;
 
-DRIVER_MODULE(ehci, econaarm, ehci_driver, ehci_devclass, 0, 0);
-MODULE_DEPEND(ehci, usb, 1, 1, 1);
+DRIVER_MODULE(ebus_ehci, econaarm, ehci_driver, ehci_devclass, 0, 0);
+MODULE_DEPEND(ebus_ehci, usb, 1, 1, 1);

Modified: stable/11/sys/arm/freescale/imx/imx6_ahci.c
==
--- stable/11/sys/arm/freescale/imx/imx6_ahci.c Mon Apr 22 04:23:49 2019
(r346523)
+++ stable/11/sys/arm/freescale/imx/imx6_ahci.c Mon Apr 22 04:56:41 2019
(r346524)
@@ -353,4 +353,4 @@ static driver_t ahci_ata_driver = {
sizeof(struct ahci_controller)
 };
 
-DRIVER_MODULE(ahci, simplebus, ahci_ata_driver, ahci_devclass, 0, 0);
+DRIVER_MODULE(imx6_ahci, simplebus, ahci_ata_driver, ahci_devclass, 0, 0);

Modified: stable/11/sys/arm/freescale/vybrid/vf_ehci.c
==
--- stable/11/sys/arm/freescale/vybrid/vf_ehci.cMon Apr 22 04:23:49 
2019(r346523)
+++ stable/11/sys/arm/freescale/vybrid/vf_ehci.cMon Apr 22 04:56:41 
2019(r346524)
@@ -166,8 +166,8 @@ static driver_t ehci_driver = {
 
 static devclass_t ehci_devclass;
 
-DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
-MODULE_DEPEND(ehci, usb, 1, 1, 1);
+DRIVER_MODULE(vybrid_ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
+MODULE_DEPEND(vybrid_ehci, usb, 1, 1, 1);
 
 static void
 vybrid_ehci_post_reset(struct ehci_softc *ehci_softc)

Modified: stable/11/sys/arm/samsung/exynos/exynos5_ehci.c
==
--- stable/11/sys/arm/samsung/exynos/exynos5_ehci.c Mon Apr 22 04:23:49 
2019(r346523)
+++ stable/11/sys/arm/samsung/exynos/exynos5_ehci.c Mon Apr 22 04:56:41 
2019(r346524)
@@ -131,8 +131,8 @@ static driver_t ehci_driver = {
 
 static devclass_t ehci_devclass;
 
-DRIVER_MODULE(ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
-MODULE_DEPEND(ehci, usb, 1, 1, 1);
+DRIVER_MODULE(exynos_ehci, simplebus, ehci_driver, ehci_devclass, 0, 0);
+MODULE_DEPEND(exynos_ehci, usb, 1, 1, 1);
 
 /*
  * Public methods

Modified: stable/11/sys/arm/ti/usb/omap_ehci.c
==
--- stable/11/sys/arm/ti/usb/omap_ehci.cMon Apr 22 04:23:49 

svn commit: r346496 - in stable/12/stand/uboot: common lib

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 20:40:49 2019
New Revision: 346496
URL: https://svnweb.freebsd.org/changeset/base/346496

Log:
  MFC r344247:
  
  Make uboot_devdesc properly alias disk_devdesc, so that parsing the u-boot
  loaderdev variable works correctly.
  
  The uboot_devdesc struct is variously cast back and forth between
  uboot_devdesc and disk_devdesc as pointers are handed off through various
  opaque interfaces.  uboot_devdesc attempted to mimic the layout of
  disk_devdesc by having a devdesc struct, followed by a union of some
  device-specific stuff that included a struct that contains the same fields
  as a disk_devdesc.  However, one of those fields inside the struct is 64-bit
  which causes the entire union to be 64-bit aligned -- 32 bits of padding
  is added between the struct devdesc and the union, so the whole mess ends
  up NOT properly mimicking a disk_devdesc after all.  (In disk_devdesc there
  is also 32 bits of padding, but it shows up immediately before the d_offset
  field, rather than before the whole collection of d_* fields.)
  
  This fixes the problem by using an anonymous union to overlay the devdesc
  field uboot network devices need with the disk_devdesc that uboot storage
  devices need.  This is a different solution than the one contributed with
  the PR (so if anything goes wrong, the blame goes to me), but 95% of the
  credit for this fix goes to Pawel Worach and Manuel Stuhn who analyzed the
  problem and proposed a fix.
  
  PR:   233097

Modified:
  stable/12/stand/uboot/common/main.c
  stable/12/stand/uboot/lib/libuboot.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/uboot/common/main.c
==
--- stable/12/stand/uboot/common/main.c Sun Apr 21 19:50:30 2019
(r346495)
+++ stable/12/stand/uboot/common/main.c Sun Apr 21 20:40:49 2019
(r346496)
@@ -310,13 +310,13 @@ print_disk_probe_info()
char slice[32];
char partition[32];
 
-   if (currdev.d_disk.slice > 0)
-   sprintf(slice, "%d", currdev.d_disk.slice);
+   if (currdev.d_disk.d_slice > 0)
+   sprintf(slice, "%d", currdev.d_disk.d_slice);
else
strcpy(slice, "");
 
-   if (currdev.d_disk.partition >= 0)
-   sprintf(partition, "%d", currdev.d_disk.partition);
+   if (currdev.d_disk.d_partition >= 0)
+   sprintf(partition, "%d", currdev.d_disk.d_partition);
else
strcpy(partition, "");
 
@@ -332,8 +332,8 @@ probe_disks(int devidx, int load_type, int load_unit, 
int open_result, unit;
struct open_file f;
 
-   currdev.d_disk.slice = load_slice;
-   currdev.d_disk.partition = load_partition;
+   currdev.d_disk.d_slice = load_slice;
+   currdev.d_disk.d_partition = load_partition;
 
f.f_devdata = 
open_result = -1;

Modified: stable/12/stand/uboot/lib/libuboot.h
==
--- stable/12/stand/uboot/lib/libuboot.hSun Apr 21 19:50:30 2019
(r346495)
+++ stable/12/stand/uboot/lib/libuboot.hSun Apr 21 20:40:49 2019
(r346496)
@@ -27,18 +27,14 @@
  * $FreeBSD$
  */
 
+#include 
+
 struct uboot_devdesc {
-   struct devdesc  dd; /* Must be first. */
union {
-   struct {
-   int slice;
-   int partition;
-   off_t   offset;
-   } disk;
-   } d_kind;
+   struct devdesc  dd;
+   struct disk_devdesc d_disk;
+   };
 };
-
-#define d_disk d_kind.disk
 
 /*
  * Default network packet alignment in memory.  On arm arches packets must be


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


svn commit: r346495 - stable/12/sys/arm/arm

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 19:50:30 2019
New Revision: 346495
URL: https://svnweb.freebsd.org/changeset/base/346495

Log:
  MFC r342850: Add a missing \n to a bootverbose printf.

Modified:
  stable/12/sys/arm/arm/mpcore_timer.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/arm/mpcore_timer.c
==
--- stable/12/sys/arm/arm/mpcore_timer.cSun Apr 21 19:49:15 2019
(r346494)
+++ stable/12/sys/arm/arm/mpcore_timer.cSun Apr 21 19:50:30 2019
(r346495)
@@ -420,7 +420,7 @@ arm_tmr_attach(device_t dev)
tc_err = attach_tc(sc);
else if (bootverbose)
device_printf(sc->dev,
-   "not using variable-frequency device as 
timecounter");
+   "not using variable-frequency device as 
timecounter\n");
sc->memrid++;
sc->irqrid++;
}


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


svn commit: r346551 - stable/11/sys/arm/arm

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 13:58:28 2019
New Revision: 346551
URL: https://svnweb.freebsd.org/changeset/base/346551

Log:
  MFC r342850:
  
  Add a missing \n to a bootverbose printf.

Modified:
  stable/11/sys/arm/arm/mpcore_timer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/arm/mpcore_timer.c
==
--- stable/11/sys/arm/arm/mpcore_timer.cMon Apr 22 13:57:52 2019
(r346550)
+++ stable/11/sys/arm/arm/mpcore_timer.cMon Apr 22 13:58:28 2019
(r346551)
@@ -415,7 +415,7 @@ arm_tmr_attach(device_t dev)
tc_err = attach_tc(sc);
else if (bootverbose)
device_printf(sc->dev,
-   "not using variable-frequency device as 
timecounter");
+   "not using variable-frequency device as 
timecounter\n");
sc->memrid++;
sc->irqrid++;
}


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


svn commit: r346547 - in stable/11: share/man/man4 share/man/man4/man4.arm sys/arm/freescale/imx sys/conf sys/dev/spibus

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 13:45:08 2019
New Revision: 346547
URL: https://svnweb.freebsd.org/changeset/base/346547

Log:
  MFC r336137-r336138, r336202, r336214, r336216
  
  r336137:
  Add a manpage for the imx_spi driver.
  
  r336138:
  Add pnp info to the imx_spi driver.
  
  r336202:
  Enhancements and fixes for the spigen(4) driver...
  
  - Resources used by spigen_mmap_single() are now tracked using
devfs_set_cdevpriv() rather than in the softc.
  
  - Since resources are now tracked per-open-fd, there is no need to try to
impose any exclusive-open logic, so flags related to that are removed.
  
  - Flags used to track open status to prevent detach() when the device is
open are replaced with calls to device_busy()/device_unbusy().  That
extends the protection up the hierarchy so that the spibus and hardware
controller drivers also can't be detached while the device is open/in use.
  
  - Arbitrary limits on the maximum size of a transfer are removed, along with
the sysctl variables that allowed the limits to be changed.  There is just
no reason to limit the size of a spi transfer to the machine's page size.
Or to any other arbitrary value, really.
  
  - Most of the locking is removed.  It was mostly protecting access to flags
and fields in the softc that no longer exist.  The locking that remains is
just to prevent concurrent calls to device_[un]busy().
  
  - The code was calling malloc() with M_WAITOK while holding a mutex in
several places.  Since most of the locking is gone, that's fixed.
  
  r336214:
  Add various spi devices to NOTES.
  
  r336216:
  Actually build and install the spigen.4 manpage.

Added:
  stable/11/share/man/man4/man4.arm/imx_spi.4
 - copied unchanged from r336138, head/share/man/man4/man4.arm/imx_spi.4
Modified:
  stable/11/share/man/man4/Makefile
  stable/11/sys/arm/freescale/imx/imx_spi.c
  stable/11/sys/conf/NOTES
  stable/11/sys/dev/spibus/spigen.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/Makefile
==
--- stable/11/share/man/man4/Makefile   Mon Apr 22 13:45:08 2019
(r346546)
+++ stable/11/share/man/man4/Makefile   Mon Apr 22 13:45:08 2019
(r346547)
@@ -522,6 +522,7 @@ MAN=aac.4 \
snd_vibes.4 \
snp.4 \
spic.4 \
+   spigen.4 \
${_spkr.4} \
splash.4 \
sppp.4 \

Copied: stable/11/share/man/man4/man4.arm/imx_spi.4 (from r336138, 
head/share/man/man4/man4.arm/imx_spi.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/man4.arm/imx_spi.4 Mon Apr 22 13:45:08 2019
(r346547, copy of r336138, head/share/man/man4/man4.arm/imx_spi.4)
@@ -0,0 +1,90 @@
+.\"
+.\" Copyright (c) 2018 Ian Lepore 
+.\" 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 ``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$
+.\"
+.Dd July 9, 2018
+.Dt IMX_SPI 4
+.Os
+.Sh NAME
+.Nm imx_spi
+.Nd device driver for the NXP i.MX family Serial Peripheral Interface (SPI)
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device imx_spi"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+imx_spi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the
+.

svn commit: r346508 - in stable/12: share/man/man4 sys/conf sys/dev/fdt sys/dev/flash sys/modules sys/modules/fdt sys/modules/fdt/fdt_slicer sys/sys

2019-09-03 Thread Ian Lepore
.
 .It Va spi-cpha
 Empty property indicating the slave device requires shifted clock
 phase (CPHA) mode.
@@ -156,6 +160,10 @@ The chip-select number to assert when performing I/O f
 Set the high bit (1 << 31) to invert the logic level of the chip select line.
 .It Va hint.at45d.%d.mode
 The SPI mode (0-3) to use when communicating with this device.
+.It Va hint.at45d.%d.sectorsize
+The sector size of the disk created for this storage device.
+It must be a multiple of the device's page size.
+The default is the device page size.
 .El
 .Sh FILES
 .Bl -tag -width /dev/flash/at45d?

Copied: stable/12/share/man/man4/mx25l.4 (from r344612, 
head/share/man/man4/mx25l.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man4/mx25l.4Mon Apr 22 00:38:25 2019
(r346508, copy of r344612, head/share/man/man4/mx25l.4)
@@ -0,0 +1,209 @@
+.\"
+.\" Copyright (c) 2019 Ian Lepore 
+.\"
+.\" 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$
+.\"
+.Dd February 26, 2019
+.Dt MX25L 4
+.Os
+.Sh NAME
+.Nm mx25l
+.Nd driver for SpiFlash(tm) compatible non-volatile storage devices
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mx25l"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mx25l_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the family of non-volatile storage
+devices known collectively as SpiFlash(tm).
+SpiFlash chips typically have part numbers beginning with EN25,
+IS25, MX25, S25, SST25, or W25.
+.Pp
+The
+.Nm
+driver uses opcode 0x9f to read the manufacturer and device ID
+data to determine whether the device is supported.
+The device ID is looked up using a table of data within the driver
+which describes the attributes of each supported device,
+such as block size, sector size, and device capacity.
+When a supported device is found, the
+.Nm
+driver creates a disk device and makes it accessible at
+.Pa /dev/flash/mx25l? .
+The new disk device is then tasted by the available
+.Xr geom 4
+modules as with any disk device.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following devices:
+.Pp
+.Bl -bullet -compact
+.It
+AT25DF641
+.It
+EN25F32
+.It
+EN25P32
+.It
+EN25P64
+.It
+EN25Q32
+.It
+EN25Q64
+.It
+GD25Q64
+.It
+M25P32
+.It
+M25P64
+.It
+MX25L1606E
+.It
+MX25LL128
+.It
+MX25LL256
+.It
+MX25LL32
+.It
+MX25LL64
+.It
+S25FL032
+.It
+S25FL064
+.It
+S25FL128
+.It
+S25FL256S
+.It
+SST25VF010A
+.It
+SST25VF032B
+.It
+W25Q128
+.It
+W25Q256
+.It
+W25Q32
+.It
+W25Q64
+.It
+W25Q64BV
+.It
+W25X32
+.It
+W25X64
+.El
+.Sh FDT CONFIGURATION
+On an
+.Xr fdt 4
+based system, the
+.Nm
+device is defined as a slave device subnode
+of the SPI bus controller node.
+All properties documented in the
+.Va spibus.txt
+bindings document can be used with the
+.Nm
+device.
+The most commonly-used ones are documented below.
+.Pp
+The following properties are required in the
+.Nm
+device subnode:
+.Bl -tag -width indent
+.It Va compatible
+Must be the string "jedec,spi-nor".
+.It Va reg
+Chip select address of device.
+.It Va spi-max-frequency
+The maximum bus frequency to use when communicating with this slave device.
+Actual bus speed may be lower, depending on the capabilities of the SPI
+bus controller hardware.
+.El
+.Pp
+The following properties are optional for the

svn commit: r346525 - in stable/11: share/man/man4/man4.arm sys/arm/freescale/imx sys/modules/imx sys/modules/imx/imx6_ahci

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:58:01 2019
New Revision: 346525
URL: https://svnweb.freebsd.org/changeset/base/346525

Log:
  MFC r336079:
  
  Add pnp info to imx6_ahci, and add a module makefile, and a manpage for it.

Added:
  stable/11/share/man/man4/man4.arm/imx6_ahci.4
 - copied unchanged from r336079, head/share/man/man4/man4.arm/imx6_ahci.4
  stable/11/sys/modules/imx/imx6_ahci/
 - copied from r336079, head/sys/modules/imx/imx6_ahci/
Modified:
  stable/11/share/man/man4/man4.arm/Makefile
  stable/11/sys/arm/freescale/imx/imx6_ahci.c
  stable/11/sys/modules/imx/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/man4.arm/Makefile
==
--- stable/11/share/man/man4/man4.arm/Makefile  Mon Apr 22 04:56:41 2019
(r346524)
+++ stable/11/share/man/man4/man4.arm/Makefile  Mon Apr 22 04:58:01 2019
(r346525)
@@ -4,6 +4,7 @@ PACKAGE=runtime-manuals
 
 MAN=   cgem.4 \
devcfg.4 \
+   imx6_ahci.4 \
imx_wdog.4 \
mge.4 \
npe.4 \

Copied: stable/11/share/man/man4/man4.arm/imx6_ahci.4 (from r336079, 
head/share/man/man4/man4.arm/imx6_ahci.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/man4.arm/imx6_ahci.4   Mon Apr 22 04:58:01 
2019(r346525, copy of r336079, head/share/man/man4/man4.arm/imx6_ahci.4)
@@ -0,0 +1,65 @@
+.\"
+.\" Copyright (c) 2018 Ian Lepore 
+.\" 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 ``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$
+.\"
+.Dd July 7, 2018
+.Dt IMX6_AHCI 4
+.Os
+.Sh NAME
+.Nm imx6_ahci
+.Nd device driver for the NXP i.MX6 on-chip SATA controller
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device ahci"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+imx6_ahci_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides
+support for the on-chip SATA controller found on some models of
+the NXP i.MX6 chip.
+The driver is a thin glue layer to interpret the platform's FDT
+data and marshall resources for the standard
+.Xr ahci 4
+driver.
+.Sh SEE ALSO
+.Xr ahci 4 ,
+.Xr fdt 4 ,
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 12.0 .

Modified: stable/11/sys/arm/freescale/imx/imx6_ahci.c
==
--- stable/11/sys/arm/freescale/imx/imx6_ahci.c Mon Apr 22 04:56:41 2019
(r346524)
+++ stable/11/sys/arm/freescale/imx/imx6_ahci.c Mon Apr 22 04:58:01 2019
(r346525)
@@ -64,6 +64,11 @@ __FBSDID("$FreeBSD$");
 #defineSATA_PHY_LANE0_OUT_STAT 0x2003
 #define  SATA_PHY_LANE0_OUT_STAT_RX_PLL_STATE(1 << 1)
 
+static struct ofw_compat_data compat_data[] = {
+   {"fsl,imx6q-ahci", true},
+   {NULL, false}
+};
+
 static int
 imx6_ahci_phy_ctrl(struct ahci_controller* sc, uint32_t bitmask, bool on)
 {
@@ -215,7 +220,7 @@ imx6_ahci_probe(device_t dev)
return (ENXIO);
}
 
-   if (!ofw_bus_is_compatible(dev, "fsl,imx6q-ahci")) {
+   if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) {
return (ENXIO);
}
device_set_desc(dev, "i.MX6 Integrat

svn commit: r346510 - stable/12/sys/dev/spibus

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 00:49:13 2019
New Revision: 346510
URL: https://svnweb.freebsd.org/changeset/base/346510

Log:
  MFC r344556:
  
  Set maximum bus clock speed from hints when attaching hinted spibus(4) 
children.
  
  Some devices (such as spigen(4)) document that this works, but it appears
  that the code to implement it never got added.

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

Modified: stable/12/sys/dev/spibus/spibus.c
==
--- stable/12/sys/dev/spibus/spibus.c   Mon Apr 22 00:45:09 2019
(r346509)
+++ stable/12/sys/dev/spibus/spibus.c   Mon Apr 22 00:49:13 2019
(r346510)
@@ -216,6 +216,7 @@ spibus_hinted_child(device_t bus, const char *dname, i
child = BUS_ADD_CHILD(bus, 0, dname, dunit);
devi = SPIBUS_IVAR(child);
devi->mode = SPIBUS_MODE_NONE;
+   resource_int_value(dname, dunit, "clock", >clock);
resource_int_value(dname, dunit, "cs", >cs);
resource_int_value(dname, dunit, "mode", >mode);
 }


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


svn commit: r346553 - stable/11/sys/arm/ti

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 14:10:40 2019
New Revision: 346553
URL: https://svnweb.freebsd.org/changeset/base/346553

Log:
  MFC r342652:
  
  Support the SPI mode and bus clock frequency parameters set by the devices
  requesting SPI transfers.
  
  Reported by:  SAITOU Toshihide 

Modified:
  stable/11/sys/arm/ti/ti_spi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/ti/ti_spi.c
==
--- stable/11/sys/arm/ti/ti_spi.c   Mon Apr 22 13:59:21 2019
(r346552)
+++ stable/11/sys/arm/ti/ti_spi.c   Mon Apr 22 14:10:40 2019
(r346553)
@@ -447,7 +447,7 @@ ti_spi_transfer(device_t dev, device_t child, struct s
 {
int err;
struct ti_spi_softc *sc;
-   uint32_t reg, cs;
+   uint32_t clockhz, cs, mode, reg;
 
sc = device_get_softc(dev);
 
@@ -458,6 +458,8 @@ ti_spi_transfer(device_t dev, device_t child, struct s
 
/* Get the proper chip select for this child. */
spibus_get_cs(child, );
+   spibus_get_clock(child, );
+   spibus_get_mode(child, );
 
cs &= ~SPIBUS_CS_HIGH;
 
@@ -467,6 +469,13 @@ ti_spi_transfer(device_t dev, device_t child, struct s
return (EINVAL);
}
 
+   if (mode > 3)
+   {
+   device_printf(dev, "Invalid mode %d requested by %s\n", mode,
+   device_get_nameunit(child));
+   return (EINVAL);
+   }
+
TI_SPI_LOCK(sc);
 
/* If the controller is in use wait until it is available. */
@@ -488,8 +497,8 @@ ti_spi_transfer(device_t dev, device_t child, struct s
/* Disable FIFO for now. */
sc->sc_fifolvl = 1;
 
-   /* Use a safe clock - 500kHz. */
-   ti_spi_set_clock(sc, sc->sc_cs, 50);
+   /* Set the bus frequency. */
+   ti_spi_set_clock(sc, sc->sc_cs, clockhz);
 
/* Disable the FIFO. */
TI_SPI_WRITE(sc, MCSPI_XFERLEVEL, 0);
@@ -501,6 +510,7 @@ ti_spi_transfer(device_t dev, device_t child, struct s
MCSPI_CONF_DPE1 | MCSPI_CONF_DPE0 | MCSPI_CONF_DMAR |
MCSPI_CONF_DMAW | MCSPI_CONF_EPOL);
reg |= MCSPI_CONF_DPE0 | MCSPI_CONF_EPOL | MCSPI_CONF_WL8BITS;
+   reg |= mode; /* POL and PHA are the low bits, we can just OR-in mode */
TI_SPI_WRITE(sc, MCSPI_CONF_CH(sc->sc_cs), reg);
 
 #if 0


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


svn commit: r346561 - stable/11/sys/arm/arm

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 15:23:06 2019
New Revision: 346561
URL: https://svnweb.freebsd.org/changeset/base/346561

Log:
  MFC r346312:
  
  Only set up the interrupts that will actually be used in arm generic_timer.
  
  The code previously set up interrupt handlers for all the interrupt
  resources available, including for timers that are not in use.  That could
  lead to interrupt storms.  For example, if boot firmware enabled the virtual
  timer but the kernel is using the physical timer, it could get flooded with
  interrupts on the virtual timer which it cannot shut off.  By only setting
  up an interrupt handler for the hardware that will actually be used, any
  interrupts from other timer units will remain masked in the interrupt
  controller.
  
  Differential Revision:https://reviews.freebsd.org/D19871

Modified:
  stable/11/sys/arm/arm/generic_timer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/arm/generic_timer.c
==
--- stable/11/sys/arm/arm/generic_timer.c   Mon Apr 22 15:20:46 2019
(r346560)
+++ stable/11/sys/arm/arm/generic_timer.c   Mon Apr 22 15:23:06 2019
(r346561)
@@ -359,7 +359,7 @@ arm_tmr_attach(device_t dev)
pcell_t clock;
 #endif
int error;
-   int i;
+   int i, first_timer, last_timer;
 
sc = device_get_softc(dev);
if (arm_tmr_sc)
@@ -391,17 +391,25 @@ arm_tmr_attach(device_t dev)
return (ENXIO);
}
 
-#ifdef __arm__
-   sc->physical = true;
-#else /* __aarch64__ */
-   /* If we do not have a virtual timer use the physical. */
-   sc->physical = (sc->res[2] == NULL) ? true : false;
+#ifdef __aarch64__
+   /* Use the virtual timer if we have one. */
+   if (sc->res[2] != NULL) {
+   sc->physical = false;
+   first_timer = 2;
+   last_timer = 2;
+   } else
 #endif
+   /* Otherwise set up the secure and non-secure physical timers. */
+   {
+   sc->physical = true;
+   first_timer = 0;
+   last_timer = 1;
+   }
 
arm_tmr_sc = sc;
 
/* Setup secure, non-secure and virtual IRQs handler */
-   for (i = 0; i < 3; i++) {
+   for (i = first_timer; i <= last_timer; i++) {
/* If we do not have the interrupt, skip it. */
if (sc->res[i] == NULL)
continue;


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


svn commit: r346519 - stable/11/sys/arm/broadcom/bcm2835

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:02:16 2019
New Revision: 346519
URL: https://svnweb.freebsd.org/changeset/base/346519

Log:
  MFC r335594:
  
  Retrieve the bus clock speed and mode (polarity/phase) from the child device
  and set up the hardware accordingly on each transfer.  This replaces the old
  configuration done via sysctl, and allows both fdt configuration data and
  userland control via the spigen device to work.
  
  Submitted by: Bob Frazier
  Differential Revision:https://reviews.freebsd.org/D15031

Modified:
  stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c
==
--- stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.cMon Apr 22 03:55:02 
2019(r346518)
+++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.cMon Apr 22 04:02:16 
2019(r346519)
@@ -132,17 +132,6 @@ bcm_spi_clock_proc(SYSCTL_HANDLER_ARGS)
if (error != 0 || req->newptr == NULL)
return (error);
 
-   clk = SPI_CORE_CLK / clk;
-   if (clk <= 1)
-   clk = 2;
-   else if (clk % 2)
-   clk--;
-   if (clk > 0x)
-   clk = 0;
-   BCM_SPI_LOCK(sc);
-   BCM_SPI_WRITE(sc, SPI_CLK, clk);
-   BCM_SPI_UNLOCK(sc);
-
return (0);
 }
 
@@ -163,12 +152,6 @@ bcm_spi_cs_bit_proc(SYSCTL_HANDLER_ARGS, uint32_t bit)
if (error != 0 || req->newptr == NULL)
return (error);
 
-   if (reg)
-   reg = bit;
-   BCM_SPI_LOCK(sc);
-   bcm_spi_modifyreg(sc, SPI_CS, bit, reg);
-   BCM_SPI_UNLOCK(sc);
-
return (0);
 }
 
@@ -200,6 +183,13 @@ bcm_spi_cspol1_proc(SYSCTL_HANDLER_ARGS)
return (bcm_spi_cs_bit_proc(oidp, arg1, arg2, req, SPI_CS_CSPOL1));
 }
 
+static int
+bcm_spi_cspol2_proc(SYSCTL_HANDLER_ARGS)
+{
+
+   return (bcm_spi_cs_bit_proc(oidp, arg1, arg2, req, SPI_CS_CSPOL2));
+}
+
 static void
 bcm_spi_sysctl_init(struct bcm_spi_softc *sc)
 {
@@ -214,20 +204,23 @@ bcm_spi_sysctl_init(struct bcm_spi_softc *sc)
tree_node = device_get_sysctl_tree(sc->sc_dev);
tree = SYSCTL_CHILDREN(tree_node);
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "clock",
-   CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
+   CTLFLAG_RD | CTLTYPE_UINT, sc, sizeof(*sc),
bcm_spi_clock_proc, "IU", "SPI BUS clock frequency");
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cpol",
-   CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
+   CTLFLAG_RD | CTLTYPE_UINT, sc, sizeof(*sc),
bcm_spi_cpol_proc, "IU", "SPI BUS clock polarity");
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cpha",
-   CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
+   CTLFLAG_RD | CTLTYPE_UINT, sc, sizeof(*sc),
bcm_spi_cpha_proc, "IU", "SPI BUS clock phase");
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cspol0",
-   CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
+   CTLFLAG_RD | CTLTYPE_UINT, sc, sizeof(*sc),
bcm_spi_cspol0_proc, "IU", "SPI BUS chip select 0 polarity");
SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cspol1",
-   CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
+   CTLFLAG_RD | CTLTYPE_UINT, sc, sizeof(*sc),
bcm_spi_cspol1_proc, "IU", "SPI BUS chip select 1 polarity");
+   SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "cspol2",
+   CTLFLAG_RD | CTLTYPE_UINT, sc, sizeof(*sc),
+   bcm_spi_cspol2_proc, "IU", "SPI BUS chip select 2 polarity");
 }
 
 static int
@@ -313,9 +306,6 @@ bcm_spi_attach(device_t dev)
 */
BCM_SPI_WRITE(sc, SPI_CS, SPI_CS_CLEAR_RXFIFO | SPI_CS_CLEAR_TXFIFO);
 
-   /* Set the SPI clock to 500Khz. */
-   BCM_SPI_WRITE(sc, SPI_CLK, SPI_CORE_CLK / 50);
-
 #ifdef BCM_SPI_DEBUG
bcm_spi_printr(dev);
 #endif
@@ -422,7 +412,7 @@ static int
 bcm_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
 {
struct bcm_spi_softc *sc;
-   uint32_t cs;
+   uint32_t cs, mode, clock;
int err;
 
sc = device_get_softc(dev);
@@ -432,21 +422,34 @@ bcm_spi_transfer(device_t dev, device_t child, struct 
KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, 
("TX/RX data sizes should be equal"));
 
-   /* Get the proper chip select for this child. */
+   /* Get the bus speed, mode, and chip select for this child. */
+
spibus_get_cs(child, );
+   if ((cs & (~SPIBUS_CS_HIGH)) > 2) {
+   device_printf(dev,
+   "Invalid chip select %u requested by %s\n", cs,
+   device_get_nameunit(child));
+   return (EINVAL);
+   }
 
-   cs &= ~SPIBUS_CS_HIGH;
+   spibus_get_clock(child, );
+   if (clock == 0) {
+   device_printf(dev,
+   "Invalid clock %uHz requested by %s\n", clock,
+   

svn commit: r346557 - in stable/11: share/man/man4 sys/conf sys/dev/fdt sys/dev/flash sys/dev/spibus sys/modules sys/modules/fdt sys/modules/fdt/fdt_slicer sys/sys

2019-09-03 Thread Ian Lepore
@@ -126,6 +126,10 @@ The following properties are optional for the
 .Nm
 device subnode:
 .Bl -tag -width indent
+.It Va freebsd,sectorsize
+The sector size of the disk created for this storage device.
+It must be a multiple of the device's page size.
+The default is the device page size.
 .It Va spi-cpha
 Empty property indicating the slave device requires shifted clock
 phase (CPHA) mode.
@@ -156,6 +160,10 @@ The chip-select number to assert when performing I/O f
 Set the high bit (1 << 31) to invert the logic level of the chip select line.
 .It Va hint.at45d.%d.mode
 The SPI mode (0-3) to use when communicating with this device.
+.It Va hint.at45d.%d.sectorsize
+The sector size of the disk created for this storage device.
+It must be a multiple of the device's page size.
+The default is the device page size.
 .El
 .Sh FILES
 .Bl -tag -width /dev/flash/at45d?

Copied: stable/11/share/man/man4/mx25l.4 (from r344612, 
head/share/man/man4/mx25l.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/mx25l.4Mon Apr 22 15:04:11 2019
(r346557, copy of r344612, head/share/man/man4/mx25l.4)
@@ -0,0 +1,209 @@
+.\"
+.\" Copyright (c) 2019 Ian Lepore 
+.\"
+.\" 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$
+.\"
+.Dd February 26, 2019
+.Dt MX25L 4
+.Os
+.Sh NAME
+.Nm mx25l
+.Nd driver for SpiFlash(tm) compatible non-volatile storage devices
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mx25l"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mx25l_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the family of non-volatile storage
+devices known collectively as SpiFlash(tm).
+SpiFlash chips typically have part numbers beginning with EN25,
+IS25, MX25, S25, SST25, or W25.
+.Pp
+The
+.Nm
+driver uses opcode 0x9f to read the manufacturer and device ID
+data to determine whether the device is supported.
+The device ID is looked up using a table of data within the driver
+which describes the attributes of each supported device,
+such as block size, sector size, and device capacity.
+When a supported device is found, the
+.Nm
+driver creates a disk device and makes it accessible at
+.Pa /dev/flash/mx25l? .
+The new disk device is then tasted by the available
+.Xr geom 4
+modules as with any disk device.
+.Sh HARDWARE
+The
+.Nm
+driver provides support for the following devices:
+.Pp
+.Bl -bullet -compact
+.It
+AT25DF641
+.It
+EN25F32
+.It
+EN25P32
+.It
+EN25P64
+.It
+EN25Q32
+.It
+EN25Q64
+.It
+GD25Q64
+.It
+M25P32
+.It
+M25P64
+.It
+MX25L1606E
+.It
+MX25LL128
+.It
+MX25LL256
+.It
+MX25LL32
+.It
+MX25LL64
+.It
+S25FL032
+.It
+S25FL064
+.It
+S25FL128
+.It
+S25FL256S
+.It
+SST25VF010A
+.It
+SST25VF032B
+.It
+W25Q128
+.It
+W25Q256
+.It
+W25Q32
+.It
+W25Q64
+.It
+W25Q64BV
+.It
+W25X32
+.It
+W25X64
+.El
+.Sh FDT CONFIGURATION
+On an
+.Xr fdt 4
+based system, the
+.Nm
+device is defined as a slave device subnode
+of the SPI bus controller node.
+All properties documented in the
+.Va spibus.txt
+bindings document can be used with the
+.Nm
+device.
+The most commonly-used ones are documented below.
+.Pp
+The following properties are required in the
+.Nm
+device subnode:
+.Bl -tag -width indent
+.It Va compatible
+Must be the string "jedec,spi-nor".
+.It Va reg
+Chip select

svn commit: r346559 - in stable/11/sys: conf geom geom/label modules/geom/geom_label

2019-09-03 Thread Ian Lepore
ad(dev, pp, slicer, ) == 0)
break;
 
-   g_flashmap_modify(gp, cp->provider->name,
+   g_flashmap_modify(gfp, gp, cp->provider->name,
cp->provider->sectorsize, );
} while (0);
 

Copied: stable/11/sys/geom/geom_flashmap.h (from r345480, 
head/sys/geom/geom_flashmap.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/sys/geom/geom_flashmap.h  Mon Apr 22 15:09:47 2019
(r346559, copy of r345480, head/sys/geom/geom_flashmap.h)
@@ -0,0 +1,39 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ian Lepore 
+ *
+ * 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 _GEOM_GEOM_FLASHMAP_H_
+
+#defineFLASHMAP_CLASS_NAME "Flashmap"
+
+struct g_flashmap {
+   const char *labels[FLASH_SLICES_MAX_NUM];
+};
+
+#endif
+

Modified: stable/11/sys/geom/label/g_label.c
==
--- stable/11/sys/geom/label/g_label.c  Mon Apr 22 15:06:56 2019
(r346558)
+++ stable/11/sys/geom/label/g_label.c  Mon Apr 22 15:09:47 2019
(r346559)
@@ -93,6 +93,7 @@ const struct g_label_desc *g_labels[] = {
_label_reiserfs,
_label_ntfs,
_label_disk_ident,
+   _label_flashmap,
 #endif
NULL
 };

Modified: stable/11/sys/geom/label/g_label.h
==
--- stable/11/sys/geom/label/g_label.h  Mon Apr 22 15:06:56 2019
(r346558)
+++ stable/11/sys/geom/label/g_label.h  Mon Apr 22 15:09:47 2019
(r346559)
@@ -86,6 +86,7 @@ extern struct g_label_desc g_label_ntfs;
 extern struct g_label_desc g_label_gpt;
 extern struct g_label_desc g_label_gpt_uuid;
 extern struct g_label_desc g_label_disk_ident;
+extern struct g_label_desc g_label_flashmap;
 
 extern void g_label_rtrim(char *label, size_t size);
 #endif /* _KERNEL */

Copied: stable/11/sys/geom/label/g_label_flashmap.c (from r345480, 
head/sys/geom/label/g_label_flashmap.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/sys/geom/label/g_label_flashmap.c Mon Apr 22 15:09:47 2019
(r346559, copy of r345480, head/sys/geom/label/g_label_flashmap.c)
@@ -0,0 +1,77 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Ian Lepore 
+ *
+ * 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
+ * LIABILI

svn commit: r346503 - stable/12/stand/common

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 22:26:27 2019
New Revision: 346503
URL: https://svnweb.freebsd.org/changeset/base/346503

Log:
  MFC r344238-r344241
  
  r344238:
  Restore loader(8)'s ability for lsdev to show partitions within a bsd slice.
  
  I'm pretty sure this used to work at one time, perhaps long ago.  It has
  been failing recently because if you call disk_open() with dev->d_partition
  set to -1 when d_slice refers to a bsd slice, it assumes you want it to
  open the first partition within that slice.  When you then pass that open
  dev instance to ptable_open(), it tries to read the start of the 'a'
  partition and decides there is no recognizable partition type there.
  
  This restores the old functionality by resetting d_offset to the start
  of the raw slice after disk_open() returns.  For good measure, d_partition
  is also set back to -1, although that doesn't currently affect anything.
  
  I would have preferred to make disk_open() avoid such rude assumptions and
  if you ask for partition -1 you get the raw slice.  But the commit history
  shows that someone already did that once (r239058), and had to revert it
  (r239232), so I didn't even try to go down that road.
  
  r344239:
  Use a couple local variables to avoid repetitive long expressions that
  cause line-wrapping.
  
  r344240:
  Make lsdev -v output line up in neat columns by using a fixed width for
  the size field and a tab between the partition type and the size.
  
  Changes this
  
disk devices:
  disk0 (MMC)
  disk0s1: DOS/Windows49MB
  disk0s2: FreeBSD14GB
  disk0s2a: FreeBSD UFS 14GB
  disk0s2b: Unknown 2048KB
  disk0s2d: FreeBSD UFS 2040KB
  
  to this
  
disk devices:
  disk0 (MMC)
  disk0s1: DOS/Windows  49MB
  disk0s2: FreeBSD  14GB
  disk0s2a: FreeBSD UFS 14GB
  disk0s2b: Unknown   2048KB
  disk0s2d: FreeBSD UFS   2040KB
  
  r344241:
  Garbage collect no-longer-used constant.

Modified:
  stable/12/stand/common/disk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/common/disk.c
==
--- stable/12/stand/common/disk.c   Sun Apr 21 22:21:36 2019
(r346502)
+++ stable/12/stand/common/disk.c   Sun Apr 21 22:26:27 2019
(r346503)
@@ -75,7 +75,7 @@ display_size(uint64_t size, u_int sectorsize)
size /= 1024;
unit = 'M';
}
-   sprintf(buf, "%ld%cB", (long)size, unit);
+   sprintf(buf, "%4ld%cB", (long)size, unit);
return (buf);
 }
 
@@ -102,7 +102,6 @@ ptblread(void *d, void *buf, size_t blocks, uint64_t o
blocks * od->sectorsize, (char *)buf, NULL));
 }
 
-#definePWIDTH  35
 static int
 ptable_print(void *arg, const char *pname, const struct ptable_entry *part)
 {
@@ -112,16 +111,16 @@ ptable_print(void *arg, const char *pname, const struc
struct ptable *table;
char line[80];
int res;
+   u_int sectsize;
+   uint64_t partsize;
 
pa = (struct print_args *)arg;
od = (struct open_disk *)pa->dev->dd.d_opendata;
-   sprintf(line, "  %s%s: %s", pa->prefix, pname,
-   parttype2str(part->type));
-   if (pa->verbose)
-   sprintf(line, "%-*s%s", PWIDTH, line,
-   display_size(part->end - part->start + 1,
-   od->sectorsize));
-   strcat(line, "\n");
+   sectsize = od->sectorsize;
+   partsize = part->end - part->start + 1;
+   sprintf(line, "  %s%s: %s\t%s\n", pa->prefix, pname,
+   parttype2str(part->type),
+   pa->verbose ? display_size(partsize, sectsize) : "");
if (pager_output(line))
return 1;
res = 0;
@@ -131,10 +130,15 @@ ptable_print(void *arg, const char *pname, const struc
dev.dd.d_unit = pa->dev->dd.d_unit;
dev.d_slice = part->index;
dev.d_partition = -1;
-   if (disk_open(, part->end - part->start + 1,
-   od->sectorsize) == 0) {
-   table = ptable_open(, part->end - part->start + 1,
-   od->sectorsize, ptblread);
+   if (disk_open(, partsize, sectsize) == 0) {
+   /*
+* disk_open() for partition -1 on a bsd slice assumes
+* you want the first bsd partition.  Reset things so
+* that we're looking at the start of the raw slice.
+*/
+   dev.d_partition = -1;
+   dev.d_offset = part->start;
+   table = ptable_open(, partsize, sectsize, ptblread);
if (table != NULL) {
sprintf(line, "  %s%s", pa->prefix, pname);
 

svn commit: r346500 - stable/12/sys/arm/arm

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 20:55:33 2019
New Revision: 346500
URL: https://svnweb.freebsd.org/changeset/base/346500

Log:
  MFC r346312:
  
  Only set up the interrupts that will actually be used in arm generic_timer.
  
  The code previously set up interrupt handlers for all the interrupt
  resources available, including for timers that are not in use.  That could
  lead to interrupt storms.  For example, if boot firmware enabled the virtual
  timer but the kernel is using the physical timer, it could get flooded with
  interrupts on the virtual timer which it cannot shut off.  By only setting
  up an interrupt handler for the hardware that will actually be used, any
  interrupts from other timer units will remain masked in the interrupt
  controller.
  
  Differential Revision:https://reviews.freebsd.org/D19871

Modified:
  stable/12/sys/arm/arm/generic_timer.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/arm/generic_timer.c
==
--- stable/12/sys/arm/arm/generic_timer.c   Sun Apr 21 20:53:15 2019
(r346499)
+++ stable/12/sys/arm/arm/generic_timer.c   Sun Apr 21 20:55:33 2019
(r346500)
@@ -396,7 +396,7 @@ arm_tmr_attach(device_t dev)
pcell_t clock;
 #endif
int error;
-   int i;
+   int i, first_timer, last_timer;
 
sc = device_get_softc(dev);
if (arm_tmr_sc)
@@ -436,17 +436,25 @@ arm_tmr_attach(device_t dev)
return (ENXIO);
}
 
-#ifdef __arm__
-   sc->physical = true;
-#else /* __aarch64__ */
-   /* If we do not have a virtual timer use the physical. */
-   sc->physical = (sc->res[2] == NULL) ? true : false;
+#ifdef __aarch64__
+   /* Use the virtual timer if we have one. */
+   if (sc->res[2] != NULL) {
+   sc->physical = false;
+   first_timer = 2;
+   last_timer = 2;
+   } else
 #endif
+   /* Otherwise set up the secure and non-secure physical timers. */
+   {
+   sc->physical = true;
+   first_timer = 0;
+   last_timer = 1;
+   }
 
arm_tmr_sc = sc;
 
/* Setup secure, non-secure and virtual IRQs handler */
-   for (i = 0; i < 3; i++) {
+   for (i = first_timer; i <= last_timer; i++) {
/* If we do not have the interrupt, skip it. */
if (sc->res[i] == NULL)
continue;


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


svn commit: r346499 - stable/12/sys/kern

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 20:53:15 2019
New Revision: 346499
URL: https://svnweb.freebsd.org/changeset/base/346499

Log:
  MFC r345475-r345476
  
  r345475:
  Truncate a too-long interrupt handler name when there is only one handler.
  
  There are only 19 bytes available for the name of an interrupt plus the
  name(s) of handlers/drivers using it. There is a mechanism from the days of
  shared interrupts that replaces some of the handler names with '+' when they
  don't all fit into 19 bytes.
  
  In modern times there is typically only one device on an interrupt, but long
  device names are the norm, especially with embedded systems. Also, in systems
  with multiple interrupt controllers, the names of the interrupts themselves
  can be long. For example, 'gic0,s54: imx6_anatop0' doesn't fit, and
  replacing the device driver name with a '+' provides no useful info at all.
  
  When there is only one handler but its name was too long to fit, this
  change truncates enough leading chars of the handler name (replacing them
  with a '-' char to indicate that some chars are missing) to use all 19
  bytes, preserving the unit number typically on the end of the name. Using
  the prior example, this results in: 'gic0,s54:-6_anatop0' which provides
  plenty of info to figure out which device is involved.
  
  PR:   211946
  Reviewed by:  gonzo@ (prior version without the '-' char)
  Differential Revision:https://reviews.freebsd.org/D19675
  
  r345476:
  Revert accidental change that should not have been included in r345475.
  I had changed this value as part of a local experiment, and neglected to
  change it back before committing the other changes.

Modified:
  stable/12/sys/kern/kern_intr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_intr.c
==
--- stable/12/sys/kern/kern_intr.c  Sun Apr 21 20:50:55 2019
(r346498)
+++ stable/12/sys/kern/kern_intr.c  Sun Apr 21 20:53:15 2019
(r346499)
@@ -209,10 +209,20 @@ intr_event_update(struct intr_event *ie)
}
 
/*
-* If the handler names were too long, add +'s to indicate missing
-* names. If we run out of room and still have +'s to add, change
-* the last character from a + to a *.
+* If there is only one handler and its name is too long, just copy in
+* as much of the end of the name (includes the unit number) as will
+* fit.  Otherwise, we have multiple handlers and not all of the names
+* will fit.  Add +'s to indicate missing names.  If we run out of room
+* and still have +'s to add, change the last character from a + to a *.
 */
+   if (missed == 1 && space == 1) {
+   ih = CK_SLIST_FIRST(>ie_handlers);
+   missed = strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 -
+   sizeof(ie->ie_fullname);
+   strcat(ie->ie_fullname, (missed == 0) ? " " : "-");
+   strcat(ie->ie_fullname, >ih_name[missed]);
+   missed = 0;
+   }
last = >ie_fullname[sizeof(ie->ie_fullname) - 2];
while (missed-- > 0) {
if (strlen(ie->ie_fullname) + 1 == sizeof(ie->ie_fullname)) {


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


svn commit: r346518 - in stable/11/usr.sbin: . spi

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 03:55:02 2019
New Revision: 346518
URL: https://svnweb.freebsd.org/changeset/base/346518

Log:
  MFC r335527, r335529, r335593
  
  r335527:
  Add spi(8), a utility for communicating with a device on a SPI bus from
  userland, conceptually similar to what i2c(8) provides for i2c devices.
  
  Submitted by: Bob Frazier
  Differential Revision:https://reviews.freebsd.org/D15029
  
  r335529:
  Eliminate gcc "shadowed declaration" warnings by using idx rather than
  index as a variable name.
  
  r335593:
  Add an example for displaying the manufacturer and size info from a
  standard spiflash chip.

Added:
  stable/11/usr.sbin/spi/
 - copied from r335527, head/usr.sbin/spi/
Modified:
  stable/11/usr.sbin/Makefile
  stable/11/usr.sbin/spi/spi.8
  stable/11/usr.sbin/spi/spi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/Makefile
==
--- stable/11/usr.sbin/Makefile Mon Apr 22 03:52:11 2019(r346517)
+++ stable/11/usr.sbin/Makefile Mon Apr 22 03:55:02 2019(r346518)
@@ -82,6 +82,7 @@ SUBDIR=   adduser \
setpmac \
smbmsg \
snapinfo \
+   spi \
spray \
syslogd \
sysrc \

Modified: stable/11/usr.sbin/spi/spi.8
==
--- head/usr.sbin/spi/spi.8 Fri Jun 22 01:59:19 2018(r335527)
+++ stable/11/usr.sbin/spi/spi.8Mon Apr 22 03:55:02 2019
(r346518)
@@ -191,6 +191,12 @@ as binary data, piped through
 displaying it as two hexadecimal unsigned short integer values.
 .Pp
 echo "00 01" | spi -A -b -d rw -c 4 | od -t x2
+.It
+Query the manufacturer ID and size from a standard spiflash device, by
+sending the command byte 0x9f and displaying the 3-byte reply in ASCII hex.
+.Pp
+spi -f spigen0.0 -m 0 -s 100 -d r -c 3 -A -C 9f
+
 .El
 .Pp
 .Sh SEE ALSO

Modified: stable/11/usr.sbin/spi/spi.c
==
--- head/usr.sbin/spi/spi.c Fri Jun 22 01:59:19 2018(r335527)
+++ stable/11/usr.sbin/spi/spi.cMon Apr 22 03:55:02 2019
(r346518)
@@ -722,7 +722,7 @@ _read_write(int hdev, void *bufw, void *bufr, int cbrw
 static int
 _do_data_output(void *pr, struct spi_options *popt)
 {
-   int err, index, icount;
+   int err, idx, icount;
const char *sz_bytes, *sz_byte2;
const uint8_t *pbuf;
 
@@ -758,8 +758,8 @@ _do_data_output(void *pr, struct spi_options *popt)
sz_bytes);
 
/* ASCII output */
-   for (index = 0; !err && index < icount; index++) {
-   if (index) {
+   for (idx = 0; !err && idx < icount; idx++) {
+   if (idx) {
/*
 * not the first time, insert separating space
 */
@@ -767,7 +767,7 @@ _do_data_output(void *pr, struct spi_options *popt)
}
 
if (!err)
-   err = fprintf(stdout, "%02hhx", pbuf[index]) < 
0;
+   err = fprintf(stdout, "%02hhx", pbuf[idx]) < 0;
}
 
if (!err)
@@ -902,7 +902,7 @@ static void
 verbose_dump_buffer(void *pbuf, int icount, int lsb)
 {
uint8_t ch;
-   int ictr, ictr2, index;
+   int ictr, ictr2, idx;
 
fputs("|  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F "
  "|  |\n", stderr);
@@ -911,10 +911,10 @@ verbose_dump_buffer(void *pbuf, int icount, int lsb)
fprintf(stderr, " %6x | ", ictr & 0xf0);
 
for (ictr2 = 0; ictr2 < 16; ictr2++) {
-   index = ictr + ictr2;
+   idx = ictr + ictr2;
 
-   if (index < icount) {
-   ch = ((uint8_t *) pbuf)[index];
+   if (idx < icount) {
+   ch = ((uint8_t *) pbuf)[idx];
 
if (lsb)
ch = reversebits[ch];
@@ -929,10 +929,10 @@ verbose_dump_buffer(void *pbuf, int icount, int lsb)
fputs("| ", stderr);
 
for (ictr2 = 0; ictr2 < 16; ictr2++) {
-   index = ictr + ictr2;
+   idx = ictr + ictr2;
 
-   if (index < icount) {
-   ch = ((uint8_t *) pbuf)[index];
+   if (idx < icount) {
+   ch = ((uint8_t *) pbuf)[idx];
 
if (lsb)
ch = reversebits[ch];
@@ -942,7 +942,7 @@ verbose_dump_buffer(void *pbuf, int icount, int lsb)
 

svn commit: r346502 - stable/12/sys/dev/vt

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 22:21:36 2019
New Revision: 346502
URL: https://svnweb.freebsd.org/changeset/base/346502

Log:
  MFC r342639:
  
  When allocating a new keyboard at vt_upgrade() time, unwind any cngrabs
  done on the old keyboard and then do the corresponding number of grabs
  on the new keyboard.
  
  This fixes a race that can leave the system with a non-functioning
  keyboard.  It goes like this...
  
   - The bios claims there is an AT keyboard, atkbd attaches.
   - SI_SUB_INT_CONFIG_HOOKS runs.
   - USB probes devices. Devices begin attaching, including disks.
   - GELI prompts for a password for a just-attached disk, which results
 in a cngrab() while atkbd is the keyboard.
   - A USB keyboard attaches.
   - vt_upgrade() runs and switches the keyboard to the new USB keyboard,
 but because cngrab was never called for it, it's not activated and
 keystrokes are ignored.
   - Now there is no functional keyboard and no way to get one; even
 plugging in a different USB keyboard doesn't help, because the console
 is still grabbed, still waiting for a GELI pw.

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

Modified: stable/12/sys/dev/vt/vt_core.c
==
--- stable/12/sys/dev/vt/vt_core.c  Sun Apr 21 22:13:07 2019
(r346501)
+++ stable/12/sys/dev/vt/vt_core.c  Sun Apr 21 22:21:36 2019
(r346502)
@@ -977,10 +977,22 @@ vt_kbdevent(keyboard_t *kbd, int event, void *arg)
 static int
 vt_allocate_keyboard(struct vt_device *vd)
 {
-   int  idx0, idx;
+   int  grabbed, i, idx0, idx;
keyboard_t  *k0, *k;
keyboard_info_t  ki;
 
+   /*
+* If vt_upgrade() happens while the console is grabbed, we are
+* potentially going to switch keyboard devices while the keyboard is in
+* use. Unwind the grabbing of the current keyboard first, then we will
+* re-grab the new keyboard below, before we return.
+*/
+   if (vd->vd_curwindow == _conswindow) {
+   grabbed = vd->vd_curwindow->vw_grabbed;
+   for (i = 0; i < grabbed; ++i)
+   vtterm_cnungrab(vd->vd_curwindow->vw_terminal);
+   }
+
idx0 = kbd_allocate("kbdmux", -1, vd, vt_kbdevent, vd);
if (idx0 >= 0) {
DPRINTF(20, "%s: kbdmux allocated, idx = %d\n", __func__, idx0);
@@ -1011,6 +1023,11 @@ vt_allocate_keyboard(struct vt_device *vd)
}
vd->vd_keyboard = idx0;
DPRINTF(20, "%s: vd_keyboard = %d\n", __func__, vd->vd_keyboard);
+
+   if (vd->vd_curwindow == _conswindow) {
+   for (i = 0; i < grabbed; ++i)
+   vtterm_cngrab(vd->vd_curwindow->vw_terminal);
+   }
 
return (idx0);
 }


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


svn commit: r346512 - in stable/11/share/man: man4 man9

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 02:37:46 2019
New Revision: 346512
URL: https://svnweb.freebsd.org/changeset/base/346512

Log:
  MFC r330358, r330360
  
  r330358: Minor changes to wording.
  r330360: Minor (mostly) wording changes.

Modified:
  stable/11/share/man/man4/fdt_pinctrl.4
  stable/11/share/man/man9/fdt_pinctrl.9
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/fdt_pinctrl.4
==
--- stable/11/share/man/man4/fdt_pinctrl.4  Mon Apr 22 01:08:14 2019
(r346511)
+++ stable/11/share/man/man4/fdt_pinctrl.4  Mon Apr 22 02:37:46 2019
(r346512)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 2, 2018
+.Dd March 3, 2018
 .Dt "FDT_PINCTRL" 4
 .Os
 .Sh NAME
@@ -36,13 +36,13 @@
 .Pp
 Pin multiplexing is a technology used to re-purpose a single
 physical connection (depending on chip packaging it may be
-pin, ball, or pad) to pull signal from one of SoC internal
-controllers to peripheral devices.
+pin, ball, or pad) by routing its signal to any one of several 
+different SoC internal devices.
 For example, based on the actual device design, a single SoC chip
-pin can perform any of these roles: SPI clock, I2C
+pin might perform any of these roles: SPI clock, I2C
 data, GPIO pin, or PWM signal.
 Function selection is performed by the pinmux controller, a SoC
-hardware block, usually controlled a set of registers.
+hardware block which is usually controlled by a set of registers.
 Pinmux controller capabilities and register format depend
 on the actual hardware implementation.
 .Pp
@@ -104,11 +104,11 @@ backlight@7f00 {
 }
 .Ed
 .Pp
-The pinctrl driver should implement FDT_PINCTRL_CONFIGURE
-method, register itself as pin configuration handler by
+The pinctrl driver should implement the FDT_PINCTRL_CONFIGURE
+method, register itself as a pin configuration handler by
 calling fdt_pinctrl_register function, and call
 .Xr fdt_pinctrl_configure_tree 9
-to configure pins for all enabled devices (device where
+to configure pins for all enabled devices (devices where
 the "status" property is not set to "disabled").
 .Sh SEE ALSO
 .Xr fdt_pinctrl 9

Modified: stable/11/share/man/man9/fdt_pinctrl.9
==
--- stable/11/share/man/man9/fdt_pinctrl.9  Mon Apr 22 01:08:14 2019
(r346511)
+++ stable/11/share/man/man9/fdt_pinctrl.9  Mon Apr 22 02:37:46 2019
(r346512)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 2, 2018
+.Dd March 3, 2018
 .Dt fdt_pinctrl 9
 .Os
 .Sh NAME
@@ -50,15 +50,17 @@ provides an API for manipulating I/O pin configuration
 pinmux controllers and pinmux clients.
 On the controller side, the standard newbus probe and
 attach methods are implemented.
-This driver also implements the
-.Fn fdt_pinctrl_configure
-method, in which it calls the
+As part of handling attach, it calls the
 .Fn fdt_pinctrl_register
 function to register itself as a pinmux controller.
 Then
 .Fn fdt_pinctrl_configure_tree
 is used to walk the device tree and configure pins specified by the pinctrl-0
 property for all active devices.
+The driver also implements the
+.Fn fdt_pinctrl_configure
+method, which allows client devices to change their
+pin configurations after startup.
 If a client device requires a pin configuration change at some
 point of its lifecycle, it uses the
 .Fn fdt_pinctrl_configure
@@ -84,14 +86,9 @@ registers a pinctrl driver so that it can be used by o
 .Fn fdt_pinctrl_configure
 or
 .Fn fdt_pinctrl_configure_by_name .
-The
-.Fa pinprop
-argument is the name of a property that
-identifies each descendant of the pinctrl
-node.
-The pinctrl node is a pin configuration
-node whose xref phandle can be passed to
-.Fn FDT_PINCTRL_CONFIGURE .
+It also registers each child node of the pinctrl driver's node which contains
+a property with the name given in
+.Fa pinprop .
 If
 .Fa pinprop
 is


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


Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-09-03 Thread Ian Lepore
On Wed, 2019-04-17 at 11:16 -0600, Warner Losh wrote:
> On Wed, Apr 17, 2019 at 10:06 AM John Baldwin  wrote:
> 
> > On 4/16/19 4:48 PM, Conrad Meyer wrote:
> > > On Tue, Apr 16, 2019 at 4:31 PM John Baldwin  wrote:
> > > > bhyveload is effectively the loader in this case.  It runs the normal
> > 
> > loader
> > > > scripts and logic and so would load the guests's /boot/entropy and pass
> > 
> > it
> > > > to the guest kernel as metadata just like the regular loader.
> > > 
> > > Right, except it doesn't seem to do things like nuke /boot/nextboot.conf
> > 
> > :-(.
> > 
> > It just needs a disk write method I think for that to work, but I'm not
> > sure
> > that's currently in the userboot interface.
> > 
> 
> It isn't. Write support was added to the boot loader after bhyveload was
> forked. It hasn't been updated.
> 
> 
> > > > In addition, bhyve also supports virtio-rng which is another way to
> > 
> > provide
> > > > entropy to guest OS's.  That's why in my reply I focused on qemu for
> > 
> > mips
> > > > (or riscv) as for x86 hypervisors there are existing,
> > 
> > somewhat-standarized
> > > > solutions for the hypervisor to provide entropy to the guest.
> > > 
> > > Perhaps cryptographically random stack-protector cookies are simply
> > > inappropriate for MIPS or RISCV.  Do we have any other examples of
> > > kernel random consumers blocking after that immediate hiccup is
> > > overcome?
> > 
> > There may be MIPS and RISCV designs that do have suitable entropy available
> > (especially I would expect future RISCV designs to have them), so I think
> > blacklisting stack protector wholesale on those architectures is overboard.
> > I think some sort of off-by-default knob (even a compile option) is fine
> > for
> > people who need fast and loose vs safe as you already agreed to earlier.
> > 
> > Also, for development testing we still want coverage of using stack cookies
> > on MIPS and RISCV even if the simulator environment gives not-very-strong
> > cookie values.
> 
> 
> I'm going to put a very fine point on this: any hard-requirement of entropy
> sources is a non-starter. If you require that, your commit will be backed
> out and/or hacked around by the addition of a nob in the future. It will
> happen. Don't pretend you can say 'but things weren't random enough' will
> carry the day. It will not.
> 
> That's why I specifically requested a MD routine to be called when there's
> no source of entropy: that will let special needs folks do the right thing.
> It's also why I asked for a way to say "don't ever block waiting for
> entropy, soldier on the best you can, but set some variable that can be
> exposed to userland so that early in /etc/rc automation can be written to
> decide what to do when that condition exists: generate entropy and reboot,
> report it to some central control, nothing" since that will give the tools
> for different reactions.
> 
> For our application it is *NEVER* OK to block the boot because there's not
> enough randomness. We'd rather solider on with crappy randomness and want
> the boot to proceed not matter what. We want the information that we had to
> make compromises along the way to make it happen so we can decide the right
> course of action for our appliances.
> 
> Warner

I'll add a big +1 to all of that, it all directly applies to our
embedded products at $work as well, and would give us the control we
need to handle things in an application-specific way.

-- Ian




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


svn commit: r346521 - in stable/11/sys/modules: uchcom ucycom

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:11:37 2019
New Revision: 346521
URL: https://svnweb.freebsd.org/changeset/base/346521

Log:
  MFC r336052:
  
  Set .PATH to dev/usb/serial so that these modules compile again.

Modified:
  stable/11/sys/modules/uchcom/Makefile
  stable/11/sys/modules/ucycom/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/modules/uchcom/Makefile
==
--- stable/11/sys/modules/uchcom/Makefile   Mon Apr 22 04:07:51 2019
(r346520)
+++ stable/11/sys/modules/uchcom/Makefile   Mon Apr 22 04:11:37 2019
(r346521)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 S= ${SRCTOP}/sys
-.PATH: $S/dev/usb
+.PATH: $S/dev/usb/serial
 
 KMOD=  uchcom
 SRCS=  uchcom.c opt_usb.h device_if.h bus_if.h usbdevs.h

Modified: stable/11/sys/modules/ucycom/Makefile
==
--- stable/11/sys/modules/ucycom/Makefile   Mon Apr 22 04:07:51 2019
(r346520)
+++ stable/11/sys/modules/ucycom/Makefile   Mon Apr 22 04:11:37 2019
(r346521)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 S= ${SRCTOP}/sys
-.PATH: $S/dev/usb
+.PATH: $S/dev/usb/serial
 
 KMOD=  ucycom
 SRCS=  ucycom.c opt_usb.h device_if.h bus_if.h usbdevs.h


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


svn commit: r346494 - stable/12/sys/arm/ti

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 19:49:15 2019
New Revision: 346494
URL: https://svnweb.freebsd.org/changeset/base/346494

Log:
  MFC r342652:
  
  Support the SPI mode and bus clock frequency parameters set by the devices
  requesting SPI transfers.

Modified:
  stable/12/sys/arm/ti/ti_spi.c

Modified: stable/12/sys/arm/ti/ti_spi.c
==
--- stable/12/sys/arm/ti/ti_spi.c   Sun Apr 21 19:30:37 2019
(r346493)
+++ stable/12/sys/arm/ti/ti_spi.c   Sun Apr 21 19:49:15 2019
(r346494)
@@ -446,7 +446,7 @@ ti_spi_transfer(device_t dev, device_t child, struct s
 {
int err;
struct ti_spi_softc *sc;
-   uint32_t reg, cs;
+   uint32_t clockhz, cs, mode, reg;
 
sc = device_get_softc(dev);
 
@@ -457,6 +457,8 @@ ti_spi_transfer(device_t dev, device_t child, struct s
 
/* Get the proper chip select for this child. */
spibus_get_cs(child, );
+   spibus_get_clock(child, );
+   spibus_get_mode(child, );
 
cs &= ~SPIBUS_CS_HIGH;
 
@@ -466,6 +468,13 @@ ti_spi_transfer(device_t dev, device_t child, struct s
return (EINVAL);
}
 
+   if (mode > 3)
+   {
+   device_printf(dev, "Invalid mode %d requested by %s\n", mode,
+   device_get_nameunit(child));
+   return (EINVAL);
+   }
+
TI_SPI_LOCK(sc);
 
/* If the controller is in use wait until it is available. */
@@ -487,8 +496,8 @@ ti_spi_transfer(device_t dev, device_t child, struct s
/* Disable FIFO for now. */
sc->sc_fifolvl = 1;
 
-   /* Use a safe clock - 500kHz. */
-   ti_spi_set_clock(sc, sc->sc_cs, 50);
+   /* Set the bus frequency. */
+   ti_spi_set_clock(sc, sc->sc_cs, clockhz);
 
/* Disable the FIFO. */
TI_SPI_WRITE(sc, MCSPI_XFERLEVEL, 0);
@@ -500,6 +509,7 @@ ti_spi_transfer(device_t dev, device_t child, struct s
MCSPI_CONF_DPE1 | MCSPI_CONF_DPE0 | MCSPI_CONF_DMAR |
MCSPI_CONF_DMAW | MCSPI_CONF_EPOL);
reg |= MCSPI_CONF_DPE0 | MCSPI_CONF_EPOL | MCSPI_CONF_WL8BITS;
+   reg |= mode; /* POL and PHA are the low bits, we can just OR-in mode */
TI_SPI_WRITE(sc, MCSPI_CONF_CH(sc->sc_cs), reg);
 
 #if 0


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


svn commit: r346498 - stable/12/sys/arm/freescale/imx

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 20:50:55 2019
New Revision: 346498
URL: https://svnweb.freebsd.org/changeset/base/346498

Log:
  MFC r345000:
  
  Mark the imx_spi device busy while transfers are in progress, so that the
  module can't be unloaded while interrupts are pending.

Modified:
  stable/12/sys/arm/freescale/imx/imx_spi.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/freescale/imx/imx_spi.c
==
--- stable/12/sys/arm/freescale/imx/imx_spi.c   Sun Apr 21 20:46:49 2019
(r346497)
+++ stable/12/sys/arm/freescale/imx/imx_spi.c   Sun Apr 21 20:50:55 2019
(r346498)
@@ -424,6 +424,7 @@ spi_transfer(device_t dev, device_t child, struct spi_
}
 
mtx_lock(>mtx);
+   device_busy(sc->dev);
 
if (sc->debug >= 1) {
device_printf(sc->dev,
@@ -448,6 +449,7 @@ spi_transfer(device_t dev, device_t child, struct spi_
spi_set_chipsel(sc, cs, false);
WR4(sc, ECSPI_CTLREG, 0);
 
+   device_unbusy(sc->dev);
mtx_unlock(>mtx);
 
return (err);
@@ -468,11 +470,11 @@ static int
 spi_detach(device_t dev)
 {
struct spi_softc *sc = device_get_softc(dev);
-   int idx;
+   int error, idx;
 
-   mtx_lock(>mtx);
+   if ((error = bus_generic_detach(sc->dev)) != 0)
+   return (error);
 
-   bus_generic_detach(sc->dev);
if (sc->spibus != NULL)
device_delete_child(dev, sc->spibus);
 
@@ -488,7 +490,6 @@ spi_detach(device_t dev)
if (sc->memres != NULL)
bus_release_resource(sc->dev, SYS_RES_MEMORY, 0, sc->memres);
 
-   mtx_unlock(>mtx);
mtx_destroy(>mtx);
 
return (0);


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


svn commit: r346558 - stable/11/sys/arm/freescale/imx

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 15:06:56 2019
New Revision: 346558
URL: https://svnweb.freebsd.org/changeset/base/346558

Log:
  MFC r345000:
  
  Mark the imx_spi device busy while transfers are in progress, so that the
  module can't be unloaded while interrupts are pending.

Modified:
  stable/11/sys/arm/freescale/imx/imx_spi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/freescale/imx/imx_spi.c
==
--- stable/11/sys/arm/freescale/imx/imx_spi.c   Mon Apr 22 15:04:11 2019
(r346557)
+++ stable/11/sys/arm/freescale/imx/imx_spi.c   Mon Apr 22 15:06:56 2019
(r346558)
@@ -424,6 +424,7 @@ spi_transfer(device_t dev, device_t child, struct spi_
}
 
mtx_lock(>mtx);
+   device_busy(sc->dev);
 
if (sc->debug >= 1) {
device_printf(sc->dev,
@@ -448,6 +449,7 @@ spi_transfer(device_t dev, device_t child, struct spi_
spi_set_chipsel(sc, cs, false);
WR4(sc, ECSPI_CTLREG, 0);
 
+   device_unbusy(sc->dev);
mtx_unlock(>mtx);
 
return (err);
@@ -468,11 +470,11 @@ static int
 spi_detach(device_t dev)
 {
struct spi_softc *sc = device_get_softc(dev);
-   int idx;
+   int error, idx;
 
-   mtx_lock(>mtx);
+   if ((error = bus_generic_detach(sc->dev)) != 0)
+   return (error);
 
-   bus_generic_detach(sc->dev);
if (sc->spibus != NULL)
device_delete_child(dev, sc->spibus);
 
@@ -488,7 +490,6 @@ spi_detach(device_t dev)
if (sc->memres != NULL)
bus_release_resource(sc->dev, SYS_RES_MEMORY, 0, sc->memres);
 
-   mtx_unlock(>mtx);
mtx_destroy(>mtx);
 
return (0);


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


svn commit: r346520 - in stable/11/sys: arm/freescale/imx arm/freescale/vybrid dev/usb/controller

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 04:07:51 2019
New Revision: 346520
URL: https://svnweb.freebsd.org/changeset/base/346520

Log:
  MFC r335982, r335985, r335988-r335989
  
  r335982:
  Fix an out-of-bounds array access... the irq data for teardown is in two
  arrays, as elements 0 and 1 of one array and elements 1 and 2 of the other.
  Run the loop 0..1 instead of 1..2 and use named constants to offset into
  one of the arrays.
  
  PR:   229508
  
  r335985:
  Remove a test and early-out which just can't possibly be right.  It causes
  detach() to do nothing if attach() succeeded, which is the opposite of
  what's needed.  Also, move device_delete_children() from the end to the
  beginning of detach(), so that children won't be trying to make use of the
  hardware we're in the process of shutting down.
  
  PR:   229510
  
  r335988:
  Add a missing call to usb_bus_mem_free_all() when detaching.
  
  r335989:
  Detach all children before beginning to tear down the hardware, instead of
  doing it last.  Also, remove the local tracking of whether usb's busdma
  memory allocation got done, because it's safe to call the free_all
  function even if it wasn't.

Modified:
  stable/11/sys/arm/freescale/imx/imx_gpio.c
  stable/11/sys/arm/freescale/vybrid/vf_ehci.c
  stable/11/sys/dev/usb/controller/ehci_imx.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/freescale/imx/imx_gpio.c
==
--- stable/11/sys/arm/freescale/imx/imx_gpio.c  Mon Apr 22 04:02:16 2019
(r346519)
+++ stable/11/sys/arm/freescale/imx/imx_gpio.c  Mon Apr 22 04:07:51 2019
(r346520)
@@ -135,6 +135,8 @@ static struct resource_spec imx_gpio_spec[] = {
{ SYS_RES_IRQ,  1,  RF_ACTIVE },
{ -1, 0 }
 };
+#defineFIRST_IRQRES1
+#defineNUM_IRQRES  2
 
 /*
  * Helpers
@@ -853,9 +855,10 @@ imx51_gpio_detach(device_t dev)
sc = device_get_softc(dev);
 
gpiobus_detach_bus(dev);
-   for (irq = 1; irq <= 2; irq++) {
+   for (irq = 0; irq < NUM_IRQRES; irq++) {
if (sc->gpio_ih[irq])
-   bus_teardown_intr(dev, sc->sc_res[irq], 
sc->gpio_ih[irq]);
+   bus_teardown_intr(dev, sc->sc_res[irq + FIRST_IRQRES],
+   sc->gpio_ih[irq]);
}
bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
mtx_destroy(>sc_mtx);

Modified: stable/11/sys/arm/freescale/vybrid/vf_ehci.c
==
--- stable/11/sys/arm/freescale/vybrid/vf_ehci.cMon Apr 22 04:02:16 
2019(r346519)
+++ stable/11/sys/arm/freescale/vybrid/vf_ehci.cMon Apr 22 04:07:51 
2019(r346520)
@@ -390,8 +390,9 @@ vybrid_ehci_detach(device_t dev)
esc = device_get_softc(dev);
sc = >base;
 
-   if (sc->sc_flags & EHCI_SCFLG_DONEINIT)
-   return (0);
+   /* First detach all children; we can't detach if that fails. */
+   if ((err = device_delete_children(dev)) != 0)
+   return (err);
 
/*
 * only call ehci_detach() after ehci_init()
@@ -420,13 +421,7 @@ vybrid_ehci_detach(device_t dev)
sc->sc_intr_hdl = NULL;
}
 
-   if (sc->sc_bus.bdev) {
-   device_delete_child(dev, sc->sc_bus.bdev);
-   sc->sc_bus.bdev = NULL;
-   }
-
-   /* During module unload there are lots of children leftover */
-   device_delete_children(dev);
+   usb_bus_mem_free_all(>sc_bus, _iterate_hw_softc);
 
bus_release_resources(dev, vybrid_ehci_spec, esc->res);
 

Modified: stable/11/sys/dev/usb/controller/ehci_imx.c
==
--- stable/11/sys/dev/usb/controller/ehci_imx.c Mon Apr 22 04:02:16 2019
(r346519)
+++ stable/11/sys/dev/usb/controller/ehci_imx.c Mon Apr 22 04:07:51 2019
(r346520)
@@ -266,7 +266,6 @@ struct imx_ehci_softc {
device_tdev;
struct resource *ehci_mem_res;  /* EHCI core regs. */
struct resource *ehci_irq_res;  /* EHCI core IRQ. */ 
-   boolusb_mem_allocated;
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -311,13 +310,16 @@ imx_ehci_detach(device_t dev)
 {
struct imx_ehci_softc *sc;
ehci_softc_t *esc;
+   int err;
 
sc = device_get_softc(dev);
 
esc = >ehci_softc;
 
-   if (esc->sc_bus.bdev != NULL)
-   device_delete_child(dev, esc->sc_bus.bdev);
+   /* First detach all children; we can't detach if that fails. */
+   if ((err = device_delete_children(dev)) != 0)
+   return (err);
+
if (esc->sc_flags & EHCI_SCFLG_DONEINIT)
ehci_detach(esc);
if (esc->sc_intr_hdl != NULL)
@@ -330,12 +332,8 @@ imx_ehci_detach(device_t dev)

svn commit: r346497 - stable/12/stand/uboot/common

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 20:46:49 2019
New Revision: 346497
URL: https://svnweb.freebsd.org/changeset/base/346497

Log:
  MFC r344260, r344335
  
  r344260:
  Allow the u-boot loaderdev env var to be formatted in the "usual" loader(8)
  way: device[s|p].  E.g., disk0s2a or disk3p12.
  The code first tries to parse the variable in this format using the
  standard disk_parsedev().  If that fails, it falls back to parsing the
  legacy format that has been supported by ubldr for years.
  
  In addition to 'disk', all the valid uboot device names can also be used:
  mmc, sata, usb, ide, scsi. The 'disk' device serves as an alias for all
  those types and will match the Nth storage-type device found (where N is
  the unit number).
  
  r344335:
  Fix the handling of legacy-format devices in the u-boot loaderdev variable.
  When I added support for the standard loader(8) disk0s2a: type formats,
  the parsing of legacy format was broken because it also contains a colon,
  but it comes before the slice and partition. That would cause disk_parsedev()
  to return success with the slice and partition set to wildcard values.
  
  This change examines the string first, and if it contains spaces, dots, or
  a colon at any position other than the end, it must be a legacy-format
  string and we don't even try to use disk_parsedev() on it.

Modified:
  stable/12/stand/uboot/common/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/uboot/common/main.c
==
--- stable/12/stand/uboot/common/main.c Sun Apr 21 20:40:49 2019
(r346496)
+++ stable/12/stand/uboot/common/main.c Sun Apr 21 20:46:49 2019
(r346497)
@@ -182,6 +182,14 @@ device_typename(int type)
  * The returned values for slice and partition are interpreted by
  * disk_open().
  *
+ * The device string can be a standard loader(8) disk specifier:
+ *
+ * disks  disk0s1
+ * disks   disk1s2a
+ * diskp  disk0p4
+ *
+ * or one of the following formats:
+ *
  * Valid device strings: For device types:
  *
  *DEV_TYP_STOR, DEV_TYP_NET
@@ -198,6 +206,7 @@ device_typename(int type)
 static void
 get_load_device(int *type, int *unit, int *slice, int *partition)
 {
+   struct disk_devdesc dev;
char *devstr;
const char *p;
char *endp;
@@ -215,6 +224,26 @@ get_load_device(int *type, int *unit, int *slice, int 
printf("U-Boot env: loaderdev='%s'\n", devstr);
 
p = get_device_type(devstr, type);
+
+   /*
+* If type is DEV_TYP_STOR we have a disk-like device.  If the remainder
+* of the string contains spaces, dots, or a colon in any location other
+* than the last char, it's legacy format.  Otherwise it might be
+* standard loader(8) format (e.g., disk0s2a or mmc1p12), so try to
+* parse the remainder of the string as such, and if it works, return
+* those results. Otherwise we'll fall through to the code that parses
+* the legacy format.
+*/
+   if (*type & DEV_TYP_STOR) {
+   size_t len = strlen(p);
+   if (strcspn(p, " .") == len && strcspn(p, ":") >= len - 1 &&
+   disk_parsedev(, p, NULL) == 0) {
+   *unit = dev.dd.d_unit;
+   *slice = dev.d_slice;
+   *partition = dev.d_partition;
+   return;
+   }
+   }
 
/* Ignore optional spaces after the device name. */
while (*p == ' ')


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


svn commit: r346560 - stable/11/sys/kern

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 15:20:46 2019
New Revision: 346560
URL: https://svnweb.freebsd.org/changeset/base/346560

Log:
  MFC r345475-r345476
  
  r345475:
  Truncate a too-long interrupt handler name when there is only one handler.
  
  There are only 19 bytes available for the name of an interrupt plus the
  name(s) of handlers/drivers using it. There is a mechanism from the days of
  shared interrupts that replaces some of the handler names with '+' when they
  don't all fit into 19 bytes.
  
  In modern times there is typically only one device on an interrupt, but long
  device names are the norm, especially with embedded systems. Also, in systems
  with multiple interrupt controllers, the names of the interrupts themselves
  can be long. For example, 'gic0,s54: imx6_anatop0' doesn't fit, and
  replacing the device driver name with a '+' provides no useful info at all.
  
  When there is only one handler but its name was too long to fit, this
  change truncates enough leading chars of the handler name (replacing them
  with a '-' char to indicate that some chars are missing) to use all 19
  bytes, preserving the unit number typically on the end of the name. Using
  the prior example, this results in: 'gic0,s54:-6_anatop0' which provides
  plenty of info to figure out which device is involved.
  
  PR:   211946
  Reviewed by:  gonzo@ (prior version without the '-' char)
  Differential Revision:https://reviews.freebsd.org/D19675
  
  r345476:
  Revert accidental change that should not have been included in r345475.
  I had changed this value as part of a local experiment, and neglected to
  change it back before committing the other changes.

Modified:
  stable/11/sys/kern/kern_intr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_intr.c
==
--- stable/11/sys/kern/kern_intr.c  Mon Apr 22 15:09:47 2019
(r346559)
+++ stable/11/sys/kern/kern_intr.c  Mon Apr 22 15:20:46 2019
(r346560)
@@ -219,10 +219,20 @@ intr_event_update(struct intr_event *ie)
}
 
/*
-* If the handler names were too long, add +'s to indicate missing
-* names. If we run out of room and still have +'s to add, change
-* the last character from a + to a *.
+* If there is only one handler and its name is too long, just copy in
+* as much of the end of the name (includes the unit number) as will
+* fit.  Otherwise, we have multiple handlers and not all of the names
+* will fit.  Add +'s to indicate missing names.  If we run out of room
+* and still have +'s to add, change the last character from a + to a *.
 */
+   if (missed == 1 && space == 1) {
+   ih = TAILQ_FIRST(>ie_handlers);
+   missed = strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 -
+   sizeof(ie->ie_fullname);
+   strcat(ie->ie_fullname, (missed == 0) ? " " : "-");
+   strcat(ie->ie_fullname, >ih_name[missed]);
+   missed = 0;
+   }
last = >ie_fullname[sizeof(ie->ie_fullname) - 2];
while (missed-- > 0) {
if (strlen(ie->ie_fullname) + 1 == sizeof(ie->ie_fullname)) {


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


svn commit: r346517 - in stable/11/sys: conf dev/spibus

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 03:52:11 2019
New Revision: 346517
URL: https://svnweb.freebsd.org/changeset/base/346517

Log:
  MFC r335506
  
  r335506:
  Incorporate bus and chip select numbers into spigen(4) cdev names.  Rather
  than assigning spigen device names in order of creation, this uses a device
  name that corresponds to the owning spibus and chip-select index.
  
  Example: /dev/spigen0.1 would be a child of spibus0, and use cs = 1
  
  The intent is for systems like Raspberry Pi to have a consistent way of
  using an SPI interface with a specific cs value from a user application.
  Otherwise, there is no consistent way of knowing which cs pin will be
  assigned to a particular spigen device. The alternative is to specify
  everything in "the right order" in an overlay file, which is less than
  ideal. Additionally, this duplicates (to some extent) the way Linux handles
  a similar situation with their 'spidev' device, so it would be somewhat
  familiar to those who also use Linux.
  
  A new kernel config option, SPIGEN_LEGACY_CDEVNAME, causes the driver to
  also create /dev/spigenN device name aliases, with N incrementing in the
  order of device instantiation.  This is provided to ease the transition
  for existing systems using the original naming convention (particularly
  when these changes are MFC'd to stable branches).
  
  Differential Revision:https://reviews.freebsd.org/D15301

Modified:
  stable/11/sys/conf/NOTES
  stable/11/sys/conf/options
  stable/11/sys/dev/spibus/spibus.c
  stable/11/sys/dev/spibus/spigen.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/conf/NOTES
==
--- stable/11/sys/conf/NOTESMon Apr 22 03:25:49 2019(r346516)
+++ stable/11/sys/conf/NOTESMon Apr 22 03:52:11 2019(r346517)
@@ -3074,4 +3074,7 @@ options   EVDEV_DEBUG # enable event debug msgs
 device uinput  # install /dev/uinput cdev
 optionsUINPUT_DEBUG# enable uinput debug msgs
 
+# Enable legacy /dev/spigenN name aliases for /dev/spigenX.Y devices.
+optionsSPIGEN_LEGACY_CDEVNAME # legacy device names for spigen
+
 device xz  # xz_embedded LZMA de-compression library

Modified: stable/11/sys/conf/options
==
--- stable/11/sys/conf/options  Mon Apr 22 03:25:49 2019(r346516)
+++ stable/11/sys/conf/options  Mon Apr 22 03:52:11 2019(r346517)
@@ -992,6 +992,9 @@ BHND_LOGLEVEL   opt_global.h
 # GPIO and child devices
 GPIO_SPI_DEBUG opt_gpio.h
 
+# SPI devices
+SPIGEN_LEGACY_CDEVNAME opt_spi.h
+
 # etherswitch(4) driver
 RTL8366_SOFT_RESET opt_etherswitch.h
 

Modified: stable/11/sys/dev/spibus/spibus.c
==
--- stable/11/sys/dev/spibus/spibus.c   Mon Apr 22 03:25:49 2019
(r346516)
+++ stable/11/sys/dev/spibus/spibus.c   Mon Apr 22 03:52:11 2019
(r346517)
@@ -122,8 +122,10 @@ spibus_child_location_str(device_t bus, device_t child
 size_t buflen)
 {
struct spibus_ivar *devi = SPIBUS_IVAR(child);
+   int cs;
 
-   snprintf(buf, buflen, "cs=%d", devi->cs);
+   cs = devi->cs & ~SPIBUS_CS_HIGH; /* trim 'cs high' bit */
+   snprintf(buf, buflen, "bus=%d cs=%d", device_get_unit(bus), cs);
return (0);
 }
 

Modified: stable/11/sys/dev/spibus/spigen.c
==
--- stable/11/sys/dev/spibus/spigen.c   Mon Apr 22 03:25:49 2019
(r346516)
+++ stable/11/sys/dev/spibus/spigen.c   Mon Apr 22 03:52:11 2019
(r346517)
@@ -26,6 +26,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_platform.h"
+#include "opt_spi.h"
 
 #include 
 #include 
@@ -64,6 +65,9 @@ __FBSDID("$FreeBSD$");
 struct spigen_softc {
device_t sc_dev;
struct cdev *sc_cdev;
+#ifdef SPIGEN_LEGACY_CDEVNAME
+   struct cdev *sc_adev;   /* alias device */
+#endif
struct mtx sc_mtx;
uint32_t sc_command_length_max; /* cannot change while mmapped */
uint32_t sc_data_length_max;/* cannot change while mmapped */
@@ -186,15 +190,46 @@ spigen_attach(device_t dev)
 {
struct spigen_softc *sc;
const int unit = device_get_unit(dev);
+   int cs, res;
+   struct make_dev_args mda;
 
+   spibus_get_cs(dev, );
+   cs &= ~SPIBUS_CS_HIGH; /* trim 'cs high' bit */
+
sc = device_get_softc(dev);
sc->sc_dev = dev;
-   sc->sc_cdev = make_dev(_cdevsw, unit,
-   UID_ROOT, GID_OPERATOR, 0660, "spigen%d", unit);
-   sc->sc_cdev->si_drv1 = dev;
sc->sc_command_length_max = PAGE_SIZE;
sc->sc_data_length_max = PAGE_SIZE;
+
mtx_init(>sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
+
+   make_dev_args_init();
+   mda.mda_flags = MAKEDEV_WAITOK;
+   

svn commit: r346312 - head/sys/arm/arm

2019-09-03 Thread Ian Lepore
Author: ian
Date: Wed Apr 17 15:27:11 2019
New Revision: 346312
URL: https://svnweb.freebsd.org/changeset/base/346312

Log:
  Only set up the interrupts that will actually be used in arm generic_timer.
  
  The code previously set up interrupt handlers for all the interrupt
  resources available, including for timers that are not in use.  That could
  lead to interrupt storms.  For example, if boot firmware enabled the virtual
  timer but the kernel is using the physical timer, it could get flooded with
  interrupts on the virtual timer which it cannot shut off.  By only setting
  up an interrupt handler for the hardware that will actually be used, any
  interrupts from other timer units will remain masked in the interrupt
  controller.
  
  Differential Revision:https://reviews.freebsd.org/D19871

Modified:
  head/sys/arm/arm/generic_timer.c

Modified: head/sys/arm/arm/generic_timer.c
==
--- head/sys/arm/arm/generic_timer.cWed Apr 17 14:20:55 2019
(r346311)
+++ head/sys/arm/arm/generic_timer.cWed Apr 17 15:27:11 2019
(r346312)
@@ -393,7 +393,7 @@ arm_tmr_attach(device_t dev)
pcell_t clock;
 #endif
int error;
-   int i;
+   int i, first_timer, last_timer;
 
sc = device_get_softc(dev);
if (arm_tmr_sc)
@@ -433,17 +433,25 @@ arm_tmr_attach(device_t dev)
return (ENXIO);
}
 
-#ifdef __arm__
-   sc->physical = true;
-#else /* __aarch64__ */
-   /* If we do not have a virtual timer use the physical. */
-   sc->physical = (sc->res[2] == NULL) ? true : false;
+#ifdef __aarch64__
+   /* Use the virtual timer if we have one. */
+   if (sc->res[2] != NULL) {
+   sc->physical = false;
+   first_timer = 2;
+   last_timer = 2;
+   } else
 #endif
+   /* Otherwise set up the secure and non-secure physical timers. */
+   {
+   sc->physical = true;
+   first_timer = 0;
+   last_timer = 1;
+   }
 
arm_tmr_sc = sc;
 
/* Setup secure, non-secure and virtual IRQs handler */
-   for (i = 0; i < 3; i++) {
+   for (i = first_timer; i <= last_timer; i++) {
/* If we do not have the interrupt, skip it. */
if (sc->res[i] == NULL)
continue;


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


svn commit: r346317 - head/tools/boot

2019-09-03 Thread Ian Lepore
Author: ian
Date: Wed Apr 17 16:27:43 2019
New Revision: 346317
URL: https://svnweb.freebsd.org/changeset/base/346317

Log:
  Allow this test script to be run from within src/tools/boot dir, and create
  the temporary image in $TMPDIR.
  
  Allow the script to be run from the src/tools/boot directory by using make
  -V SRCTOP to find the top of the tree, because this script is handy for
  quick smoke-testing of loader changes, as well as being useful in CI testing.
  
  Also, use a temp directory in $TMPDIR to assemble the boot image, and write
  the boot log file to $TMPDIR.  Arrange to have the temporary image clean
  itself up, but leave the log file in $TMPDIR for post-mortem analysis of
  failures when the script is run interactively.
  
  Differential Revision:https://reviews.freebsd.org/D19876

Modified:
  head/tools/boot/ci-qemu-test.sh

Modified: head/tools/boot/ci-qemu-test.sh
==
--- head/tools/boot/ci-qemu-test.sh Wed Apr 17 16:18:14 2019
(r346316)
+++ head/tools/boot/ci-qemu-test.sh Wed Apr 17 16:27:43 2019
(r346317)
@@ -2,62 +2,105 @@
 
 # Install loader, kernel, and enough of userland to boot in QEMU and echo
 # "Hello world." from init, as a very quick smoke test for CI.  Uses QEMU's
-# virtual FAT filesystem to avoid the need to create a disk image.
+# virtual FAT filesystem to avoid the need to create a disk image.  While
+# designed for CI automated testing, this script can also be run by hand as
+# a quick smoke-test.  The rootgen.sh and related scripts generate much more
+# extensive tests for many combinations of boot env (ufs, zfs, geli, etc).
 #
 # $FreeBSD$
 
 set -e
 
-# Root directory for minimal FreeBSD installation.
-ROOTDIR=$(pwd)/fat-root
+die()
+{
+   echo "$*" 1>&2
+   exit 1
+}
 
-# Create minimal directory structure.
-rm -f $ROOTDIR/efi/boot/BOOTx64.EFI
-for dir in dev bin efi/boot etc lib libexec sbin usr/libexec; do
-   mkdir -p $ROOTDIR/$dir
-done
+tempdir_cleanup()
+{
+   trap - EXIT SIGINT SIGHUP SIGTERM SIGQUIT
+   rm -rf ${ROOTDIR}
+}
 
-# Install kernel, loader and minimal userland.
-make -DNO_ROOT DESTDIR=$ROOTDIR \
-MODULES_OVERRIDE= \
-WITHOUT_DEBUG_FILES=yes \
-WITHOUT_KERNEL_SYMBOLS=yes \
-installkernel
-for dir in stand \
-lib/libc lib/libedit lib/ncurses \
-libexec/rtld-elf \
-bin/sh sbin/init sbin/shutdown; do
-   make -DNO_ROOT DESTDIR=$ROOTDIR INSTALL="install -U" \
-   WITHOUT_MAN= \
-   WITHOUT_PROFILE= \
-   WITHOUT_TESTS= \
-   WITHOUT_TOOLCHAIN= \
-   -C $dir install
-done
+tempdir_setup()
+{
+   # Create minimal directory structure and populate it.
+   # Caller must cd ${SRCTOP} before calling this function.
 
-# Put loader in standard EFI location.
-mv $ROOTDIR/boot/loader.efi $ROOTDIR/efi/boot/BOOTx64.EFI
+   for dir in dev bin efi/boot etc lib libexec sbin usr/lib usr/libexec; do
+   mkdir -p ${ROOTDIR}/${dir}
+   done
 
-# Configuration files.
-cat > $ROOTDIR/boot/loader.conf < ${ROOTDIR}/boot/loader.conf < $ROOTDIR/etc/rc < ${ROOTDIR}/etc/rc <&1 | tee boot.log
-grep -q 'Hello world.' boot.log
-echo OK
+qemu-system-x86_64 -m 256M -bios ${OVMF} \
+-serial stdio -vga none -nographic -monitor none \
+-snapshot -hda fat:${ROOTDIR} 2>&1 | tee ${BOOTLOG}
+
+# Check whether we succesfully booted...
+if grep -q 'Hello world.' ${BOOTLOG}; then
+   echo "OK"
+else
+   die "Did not boot successfully, see ${BOOTLOG}"
+fi


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


svn commit: r346505 - stable/12/sys/arm/freescale/imx

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 22:31:52 2019
New Revision: 346505
URL: https://svnweb.freebsd.org/changeset/base/346505

Log:
  MFC r344267:
  
  Add a compatible string to match recent changes in the upstream dts.

Modified:
  stable/12/sys/arm/freescale/imx/imx6_snvs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/freescale/imx/imx6_snvs.c
==
--- stable/12/sys/arm/freescale/imx/imx6_snvs.c Sun Apr 21 22:28:50 2019
(r346504)
+++ stable/12/sys/arm/freescale/imx/imx6_snvs.c Sun Apr 21 22:31:52 2019
(r346505)
@@ -73,6 +73,7 @@ struct snvs_softc {
 };
 
 static struct ofw_compat_data compat_data[] = {
+   {"fsl,sec-v4.0-mon-rtc-lp", true},
{"fsl,sec-v4.0-mon", true},
{NULL,   false}
 };


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


svn commit: r346509 - in stable/12/sys: conf geom geom/label modules/geom/geom_label

2019-09-03 Thread Ian Lepore
ad(dev, pp, slicer, ) == 0)
break;
 
-   g_flashmap_modify(gp, cp->provider->name,
+   g_flashmap_modify(gfp, gp, cp->provider->name,
cp->provider->sectorsize, );
} while (0);
 

Copied: stable/12/sys/geom/geom_flashmap.h (from r345480, 
head/sys/geom/geom_flashmap.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/geom/geom_flashmap.h  Mon Apr 22 00:45:09 2019
(r346509, copy of r345480, head/sys/geom/geom_flashmap.h)
@@ -0,0 +1,39 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Ian Lepore 
+ *
+ * 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 _GEOM_GEOM_FLASHMAP_H_
+
+#defineFLASHMAP_CLASS_NAME "Flashmap"
+
+struct g_flashmap {
+   const char *labels[FLASH_SLICES_MAX_NUM];
+};
+
+#endif
+

Modified: stable/12/sys/geom/label/g_label.c
==
--- stable/12/sys/geom/label/g_label.c  Mon Apr 22 00:38:25 2019
(r346508)
+++ stable/12/sys/geom/label/g_label.c  Mon Apr 22 00:45:09 2019
(r346509)
@@ -95,6 +95,7 @@ const struct g_label_desc *g_labels[] = {
_label_reiserfs,
_label_ntfs,
_label_disk_ident,
+   _label_flashmap,
 #endif
NULL
 };

Modified: stable/12/sys/geom/label/g_label.h
==
--- stable/12/sys/geom/label/g_label.h  Mon Apr 22 00:38:25 2019
(r346508)
+++ stable/12/sys/geom/label/g_label.h  Mon Apr 22 00:45:09 2019
(r346509)
@@ -88,6 +88,7 @@ extern struct g_label_desc g_label_ntfs;
 extern struct g_label_desc g_label_gpt;
 extern struct g_label_desc g_label_gpt_uuid;
 extern struct g_label_desc g_label_disk_ident;
+extern struct g_label_desc g_label_flashmap;
 
 extern void g_label_rtrim(char *label, size_t size);
 #endif /* _KERNEL */

Copied: stable/12/sys/geom/label/g_label_flashmap.c (from r345480, 
head/sys/geom/label/g_label_flashmap.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/geom/label/g_label_flashmap.c Mon Apr 22 00:45:09 2019
(r346509, copy of r345480, head/sys/geom/label/g_label_flashmap.c)
@@ -0,0 +1,77 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Ian Lepore 
+ *
+ * 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
+ * LIABILI

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

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr 21 17:39:01 2019
New Revision: 346489
URL: https://svnweb.freebsd.org/changeset/base/346489

Log:
  Move the reporting of spurious interrupts under bootverbose control, because
  occasional spurious interrupts are a normal thing on this hardware.  Also,
  change the name of the cpu-local interrupt controller driver from local_intc
  to lintc, because the name gets built into interrupt names, which have to
  fit into a 19-byte field for stats reporting (so this allows 5 more bytes
  of the actual interrupt name to be displayed).

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
  head/sys/arm/broadcom/bcm2835/bcm2836.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_intr.cSun Apr 21 16:17:35 
2019(r346488)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.cSun Apr 21 17:39:01 
2019(r346489)
@@ -230,7 +230,7 @@ bcm2835_intc_intr(void *arg)
}
arm_irq_memory_barrier(0); /* XXX */
}
-   if (num == 0)
+   if (num == 0 && bootverbose)
device_printf(sc->sc_dev, "Spurious interrupt detected\n");
 
return (FILTER_HANDLED);

Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2836.c Sun Apr 21 16:17:35 2019
(r346488)
+++ head/sys/arm/broadcom/bcm2835/bcm2836.c Sun Apr 21 17:39:01 2019
(r346489)
@@ -421,7 +421,7 @@ bcm_lintc_intr(void *arg)
reg &= ~BCM_LINTC_PENDING_MASK;
if (reg != 0)
device_printf(sc->bls_dev, "Unknown interrupt(s) %x\n", reg);
-   else if (num == 0)
+   else if (num == 0 && bootverbose)
device_printf(sc->bls_dev, "Spurious interrupt detected\n");
 
return (FILTER_HANDLED);
@@ -730,12 +730,12 @@ static device_method_t bcm_lintc_methods[] = {
 };
 
 static driver_t bcm_lintc_driver = {
-   "local_intc",
+   "lintc",
bcm_lintc_methods,
sizeof(struct bcm_lintc_softc),
 };
 
 static devclass_t bcm_lintc_devclass;
 
-EARLY_DRIVER_MODULE(local_intc, simplebus, bcm_lintc_driver, 
bcm_lintc_devclass,
+EARLY_DRIVER_MODULE(lintc, simplebus, bcm_lintc_driver, bcm_lintc_devclass,
 0, 0, BUS_PASS_INTERRUPT);


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


svn commit: r346552 - stable/11/sys/arm/freescale/imx

2019-09-03 Thread Ian Lepore
Author: ian
Date: Mon Apr 22 13:59:21 2019
New Revision: 346552
URL: https://svnweb.freebsd.org/changeset/base/346552

Log:
  MFC r344267:
  
  Add a compatible string to match recent changes in the upstream dts.

Modified:
  stable/11/sys/arm/freescale/imx/imx6_snvs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/freescale/imx/imx6_snvs.c
==
--- stable/11/sys/arm/freescale/imx/imx6_snvs.c Mon Apr 22 13:58:28 2019
(r346551)
+++ stable/11/sys/arm/freescale/imx/imx6_snvs.c Mon Apr 22 13:59:21 2019
(r346552)
@@ -73,6 +73,7 @@ struct snvs_softc {
 };
 
 static struct ofw_compat_data compat_data[] = {
+   {"fsl,sec-v4.0-mon-rtc-lp", true},
{"fsl,sec-v4.0-mon", true},
{NULL,   false}
 };


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


Re: svn commit: r346341 - head/tools/build

2019-09-03 Thread Ian Lepore
On Wed, 2019-04-17 at 20:32 -0700, Cy Schubert wrote:
> In message <201904180107.x3i17qdc002...@gndrsh.dnsmgr.net>, "Rodney
> W. 
> Grimes"
> writes:
> > > Author: cy
> > > Date: Thu Apr 18 01:02:00 2019
> > > New Revision: 346341
> > > URL: https://svnweb.freebsd.org/changeset/base/346341
> > > 
> > > Log:
> > >   As an interim measure until a more permanent solution is
> > > implemented
> > >   workaround the following error:
> > >   
> > >   /usr/src/contrib/elftoolchain/strings/strings.c:198:55: error:
> > > use of
> > >   undeclared identifier
> > >   'FA_OPEN' fa = fileargs_init(argc, argv, O_RDONLY, 0, ,
> > > FA_OPEN);
> > >   
> > >   Reported by:O. Hartmann 
> > >   Reported by:Michael Butler 
> > >   Reported by:gjb@ & cy@ (implicit)
> > >   Reviewed by:emaste@
> > >   Noted by:   rgrimes@
> > > 
> > > Modified:
> > >   head/tools/build/Makefile
> > > 
> > > Modified: head/tools/build/Makefile
> > > =
> > > ==
> > 
> > ===
> > > --- head/tools/build/Makefile Thu Apr 18 00:38:54 2019(
> > > r34634
> > 
> > 0)
> > > +++ head/tools/build/Makefile Thu Apr 18 01:02:00 2019(
> > > r34634
> > 
> > 1)
> > > @@ -59,9 +59,7 @@ INCS+=  capsicum_helpers.h
> > >  INCS+=   libcasper.h
> > >  .endif
> > >  
> > > -.if !exists(/usr/include/casper/cap_fileargs.h)
> > >  CASPERINC+=  ${SRCTOP}/lib/libcasper/services/cap_fileargs/c
> > > ap_filea
> > 
> > rgs.h
> > > -.endif
> > 
> > As a further note, we should probably hunt for any thing
> > that is explicity looking at /usr/include/... in a Makefile,
> > as that is minimally missing a ${DESTDIR} argument.
> > 
> > The above may of actually worked if it had been written:
> > .if !exists(${DESTDIR}/usr/include/casper/cap_fileargs.h)
> > someone may wish to test that.
> > 
> > Also a pathname rooted at / without ${DESTDIR} is almost certainly
> > a mistake.
> 
> This is a better solution. I tested this in a tree with a duplicated 
> environment: Problem solved. Before this is committed it should be 
> tested on one of the universe machines.
> 
> 

I'm having a hard time understanding how adding $DESTDIR is any kind of
solution to something that happens at build time as opposed to install
time.  I typically run buildworld/kernel without DESTDIR defined.

-- Ian



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


Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-09-03 Thread Ian Lepore
On Tue, 2019-04-16 at 09:58 -0700, Conrad Meyer wrote:
> Systems lacking both an NV store and an entropy source available
> during mi_startup (i.e., not interrupts...) cannot safely provide
> entropy in early boot.  On those systems, we must disable random
> consumption during early boot.

Or you could remember that one of the core unix philosphies is "tools,
not policy" and leave it to embedded systems developers to decide for
themselves what's "safe" or not.  Not every application needs
cryptographic strength entropy, especially for things like retrying
after a short random delay or generating a random MAC address or
whatever.

-- Ian



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


Re: svn commit: r346295 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/mv arm/nvidia/tegra124

2019-09-03 Thread Ian Lepore
On Wed, 2019-04-17 at 11:23 +0200, Andrew Turner wrote:
> > On 16 Apr 2019, at 22:04, Emmanuel Vadot  wrote:
> > 
> > Author: manu
> > Date: Tue Apr 16 20:04:22 2019
> > New Revision: 346295
> > URL: https://svnweb.freebsd.org/changeset/base/346295
> > 
> > Log:
> >  arm: Add kern_clocksource.c directly in files.arm
> > 
> >  This files is needed and included in all our config so move it to
> > a common
> >  location.
> > 
> >  MFC after: 2 weeks
> 
> ...
> > Modified: head/sys/conf/files.arm
> > ===
> > ===
> > --- head/sys/conf/files.arm Tue Apr 16 19:46:02 2019(r346294)
> > +++ head/sys/conf/files.arm Tue Apr 16 20:04:22 2019(r346295)
> > @@ -11,6 +11,9 @@ cloudabi32_vdso_blob.ooptionalcom
> > pat_cloudabi32  \
> > no-implicit-rule\
> > clean   "cloudabi32_vdso_blob.o"
> > #
> > +
> > +kern/kern_clocksource.cstandard
> 
> Could this be moved from the various files.* to files? It seems we
> define it as standard on all architectures.
> 
> 

I thought mips still had some variants that didn't implement event
timers.  That's why this stuff was ever in arch-specific files, arm and
mips had some flavors without ET support.

If we no longer have any platforms that need to run without event
timers, there is some more extensive cleanup that could be done beyond
just moving this entry to sys/conf/files (and I'd be up for doing that
work, if I can find time).

-- Ian




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


Re: svn commit: r346250 - in head: share/man/man4 share/man/man9 sys/dev/random sys/kern sys/libkern sys/sys

2019-09-03 Thread Ian Lepore
On Tue, 2019-04-16 at 07:18 -0600, Warner Losh wrote:
> On Tue, Apr 16, 2019, 7:04 AM Emmanuel Vadot 
> wrote:
> 
> > On Mon, 15 Apr 2019 17:54:56 -0700
> > Conrad Meyer  wrote:
> > 
> > > On Mon, Apr 15, 2019 at 5:53 PM Conrad Meyer 
> > > wrote:
> > > > E.g., the CI infrastructure for
> > > > Riscv/Arm is/was generating minimal filesystem images and not
> > > > populating /boot/entropy.
> > > 
> > > I should add, I say "is/was" because I have a PR out which may
> > > address
> > > the problem: https://github.com/freebsd/freebsd-ci/pull/31
> > > 
> > > Best,
> > > Conrad
> > 
> >  It's not only CI, all release images (memstick, iso) don't have
> > a /boot/entropy.
> >  Also all arm/arm64 image don't have this file too.
> >  If /boot/entropy is needed and isn't present loader(8) should
> > gather
> > some entropy and pass this to the kernel for the first boot.
> > 
> 
> Maybe we need to bootstrap the entropy file as part of buildworld.
> I'm not
> sure if the loader can find enough...
> 
> 
Isn't a file full of data which is distributed in identical form to
everyone the exact opposite of entropy?

-- Ian



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


Re: svn commit: r346096 - head/sys/arm/conf

2019-09-03 Thread Ian Lepore
On Thu, 2019-04-11 at 21:23 +0200, Svatopluk Kraus wrote:
> I understand the reason for GENERIC. But are we so blind that we will
> delete everything that is not GENERIC? In other words, why to delete
> nice specific KERNEL configurations for boards we support when only
> reason I see is that GENERIC is so cool for some people?
> 
> Svatopluk Kraus
> 
> 

I completely agree with this.  We had a plan for removing board-
specific configs that had been rolled into GENERIC, and it did not
involve just deleting them without providing any alternative to people
who have custom configs based on them.  That plan's execution has
stalled, but that's not a good reason for this abrupt deletion without
any warning.

I think these deletions fall into two categories:

 1. Configs for hardware that isn't adequately supported anymore.
 2. Configs for popular supported hardware which can use GENERIC.

We need to figure out which ones count as #2 and restore them until
we've implemented our original plan for phasing them out.  I think
those would be:

  BEAGLEBONE
  PANDABOARD
  RPI2

For the others, we need to evaluate:  if we are removing the only
config file that refers to some chunks of sys/arm code, shouldn't we be
removing that code too?  For example, removing AML8726 probably implies
that all of arm/amlogic/* can be deleted.

-- Ian

> 
> On Wed, Apr 10, 2019 at 9:27 PM Emmanuel Vadot 
> wrote:
> > 
> > Author: manu
> > Date: Wed Apr 10 19:27:14 2019
> > New Revision: 346096
> > URL: https://svnweb.freebsd.org/changeset/base/346096
> > 
> > Log:
> >   arm: kernel: Remove old kernel configs
> > 
> >   Follow up to r346095
> >   All those kernels are either not working or the release have
> > switched
> >   to GENERIC
> > 
> > Deleted:
> >   head/sys/arm/conf/AML8726
> >   head/sys/arm/conf/BEAGLEBONE
> >   head/sys/arm/conf/CHROMEBOOK
> >   head/sys/arm/conf/CHROMEBOOK-PEACH-PIT
> >   head/sys/arm/conf/CHROMEBOOK-PEACH-PIT.hints
> >   head/sys/arm/conf/CHROMEBOOK-SNOW
> >   head/sys/arm/conf/CHROMEBOOK-SPRING
> >   head/sys/arm/conf/CHROMEBOOK.hints
> >   head/sys/arm/conf/EXYNOS5.common
> >   head/sys/arm/conf/EXYNOS5250
> >   head/sys/arm/conf/EXYNOS5420
> >   head/sys/arm/conf/ODROIDC1
> >   head/sys/arm/conf/PANDABOARD
> >   head/sys/arm/conf/PANDABOARD.hints
> >   head/sys/arm/conf/RADXA
> >   head/sys/arm/conf/RADXA-LITE
> >   head/sys/arm/conf/RK3188
> >   head/sys/arm/conf/RPI2
> > 
> 
> 



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


Re: svn commit: r346252 - in head/usr.sbin/cron: cron crontab

2019-09-03 Thread Ian Lepore
On Mon, 2019-04-15 at 18:53 +, Kyle Evans wrote:
> Author: kevans
> Date: Mon Apr 15 18:53:28 2019
> New Revision: 346252
> URL: https://svnweb.freebsd.org/changeset/base/346252
> 
> Log:
>   cron(8): Add MAILFROM ability for crontabs
>   
>   This changes the sender mail address in a similar fashion to how MAILTO may
>   change the recipient. The default from address remains unchanged.
>   
>   MFC after:  1 week
> 
> Modified:
>   head/usr.sbin/cron/cron/cron.8
>   head/usr.sbin/cron/cron/do_command.c
>   head/usr.sbin/cron/crontab/crontab.5
> 

Is this going to allow normal users to spoof the From: using private
crontabs?  That sounds mildly dangerous.

-- Ian

> Modified: head/usr.sbin/cron/cron/cron.8
> =
> =
> --- head/usr.sbin/cron/cron/cron.8Mon Apr 15 18:49:04 2019(r346
> 251)
> +++ head/usr.sbin/cron/cron/cron.8Mon Apr 15 18:53:28 2019(r346
> 252)
> @@ -17,7 +17,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd July 19, 2017
> +.Dd April 15, 2019
>  .Dt CRON 8
>  .Os
>  .Sh NAME
> @@ -79,6 +79,9 @@ commands, any output is mailed to the owner of the
> cro
>  named in the
>  .Ev MAILTO
>  environment variable in the crontab, if such exists).
> +The from address of this mail may be set with the
> +.Ev MAILFROM
> +environment variable.
>  .Pp
>  Additionally,
>  .Nm
> 
> Modified: head/usr.sbin/cron/cron/do_command.c
> =
> =
> --- head/usr.sbin/cron/cron/do_command.c  Mon Apr 15 18:49:04
> 2019  (r346251)
> +++ head/usr.sbin/cron/cron/do_command.c  Mon Apr 15 18:53:28
> 2019  (r346252)
> @@ -93,7 +93,7 @@ child_process(e, u)
>  {
>   int stdin_pipe[2], stdout_pipe[2];
>   register char   *input_data;
> - char*usernm, *mailto;
> + char*usernm, *mailto, *mailfrom;
>   int children = 0;
>  # if defined(LOGIN_CAP)
>   struct passwd   *pwd;
> @@ -111,6 +111,7 @@ child_process(e, u)
>*/
>   usernm = env_get("LOGNAME", e->envp);
>   mailto = env_get("MAILTO", e->envp);
> + mailfrom = env_get("MAILFROM", e->envp);
>  
>  #ifdef PAM
>   /* use PAM to see if the user's account is available,
> @@ -503,8 +504,12 @@ child_process(e, u)
>   warn("%s", MAILCMD);
>   (void) _exit(ERROR_EXIT);
>   }
> - fprintf(mail, "From: Cron Daemon
> <%s@%s>\n",
> - usernm, hostname);
> + if (mailfrom == NULL || *mailfrom ==
> '\0')
> + fprintf(mail, "From: Cron
> Daemon <%s@%s>\n",
> + usernm, hostname);
> + else
> + fprintf(mail, "From: Cron
> Daemon <%s>\n",
> + mailfrom);
>   fprintf(mail, "To: %s\n", mailto);
>   fprintf(mail, "Subject: Cron <%s@%s>
> %s\n",
>   usernm, first_word(hostname,
> "."),
> 
> Modified: head/usr.sbin/cron/crontab/crontab.5
> =
> =
> --- head/usr.sbin/cron/crontab/crontab.5  Mon Apr 15 18:49:04
> 2019  (r346251)
> +++ head/usr.sbin/cron/crontab/crontab.5  Mon Apr 15 18:53:28
> 2019  (r346252)
> @@ -17,7 +17,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd June 6, 2018
> +.Dd April 15, 2019
>  .Dt CRONTAB 5
>  .Os
>  .Sh NAME
> @@ -116,6 +116,9 @@ If
>  .Ev MAILTO
>  is defined (and non-empty), mail is
>  sent to the user so named.
> +If
> +.Ev MAILFROM
> +is defined (and non-empty), its value will be used as the from
> address.
>  .Ev MAILTO
>  may also be used to direct mail to multiple recipients
>  by separating recipient users with a comma.
> 



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


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

2019-09-03 Thread Ian Lepore
On Tue, 2019-04-09 at 09:33 -0700, John Baldwin wrote:
> On 4/9/19 9:17 AM, Ian Lepore wrote:
> > On Tue, 2019-04-09 at 09:11 -0700, John Baldwin wrote:
> > > On 4/9/19 6:54 AM, Ganbold Tsagaankhuu wrote:
> > > > Author: ganbold
> > > > Date: Tue Apr  9 13:54:08 2019
> > > > New Revision: 346052
> > > > URL: https://svnweb.freebsd.org/changeset/base/346052
> > > > 
> > > > Log:
> > > >   In some cases like NanoPI R1, its second USB ethernet
> > > >   RTL8152 (chip version URE_CHIP_VER_4C10) doesn't
> > > >   have hardwired MAC address, in other words, it is all zeros.
> > > >   This commit fixes it by setting random MAC address
> > > >   when MAC address is all zeros.
> > > >   
> > > >   Reviewed by:  kevlo
> > > >   Differential Revision:
> > > > https://reviews.freebsd.org/D19856
> > > 
> > > It would be best to not use a purely random mac address and to
> > > use
> > > the
> > > function kevans@ added recently.  That function generates a MAC
> > > address
> > > from the FreeBSD OUI using a cryptographic hash so you get a
> > > stable address across boots on a given host.
> > > 
> > 
> > How could that possibly work?  If it's not random, you can't have
> > two
> > such devices on the same network.  If it is random, it's not stable
> > from one boot to the next.
> 
> It uses the UUID and interface name as input into the hash.  

> The UUID is per-host.

Oh, so it only works on x86 (or I guess any system that has something
like a bios that can provide you with a uuid that doesn't change from
one boot to the next).

-- Ian

>   In this particular use case, the first USB device will
> have a varying MAC address which is an input into the UUID.  Though,
> the other option this driver could use for this specific case would
> be
> to just take the first MAC address and +1 to get the second one.
> 





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


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

2019-09-03 Thread Ian Lepore
On Tue, 2019-04-09 at 09:11 -0700, John Baldwin wrote:
> On 4/9/19 6:54 AM, Ganbold Tsagaankhuu wrote:
> > Author: ganbold
> > Date: Tue Apr  9 13:54:08 2019
> > New Revision: 346052
> > URL: https://svnweb.freebsd.org/changeset/base/346052
> > 
> > Log:
> >   In some cases like NanoPI R1, its second USB ethernet
> >   RTL8152 (chip version URE_CHIP_VER_4C10) doesn't
> >   have hardwired MAC address, in other words, it is all zeros.
> >   This commit fixes it by setting random MAC address
> >   when MAC address is all zeros.
> >   
> >   Reviewed by:  kevlo
> >   Differential Revision:https://reviews.freebsd.org/D19856
> 
> It would be best to not use a purely random mac address and to use
> the
> function kevans@ added recently.  That function generates a MAC
> address
> from the FreeBSD OUI using a cryptographic hash so you get a
> stable address across boots on a given host.
> 

How could that possibly work?  If it's not random, you can't have two
such devices on the same network.  If it is random, it's not stable
from one boot to the next.

-- Ian



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


Re: svn commit: r346039 - head/sys/conf

2019-09-03 Thread Ian Lepore
On Tue, 2019-04-09 at 11:19 -0600, Rebecca Cran wrote:
> On 2019-04-08 12:25, Warner Losh wrote:
> > Author: imp
> > Date: Mon Apr  8 18:25:14 2019
> > New Revision: 346039
> > URL: https://svnweb.freebsd.org/changeset/base/346039
> > 
> > Log:
> >Style only change: Prefer $() to ``
> >
> >$() is more modern and also nests. Convert the mix of styles to
> > using
> >only the former (although the latter was more common). It's the
> > more
> >dominant style in other shell scripts these days as well.
> >
> >Differential Revision:  https://reviews.freebsd.org/D19840
> > 
> > Modified:
> >head/sys/conf/newvers.sh
> > 
> > Modified: head/sys/conf/newvers.sh
> 
> 
> I thought I saw an email a few weeks ago that suggested that the list
> of 
> people who reviewed the patch should be copied into a "Reviewed by:" 
> line, to avoid only having that information in Phabricator.
> 
> Am I remembering correctly, or is just mentioning the Phab review 
> considered sufficient?
> 
> 

As far as I'm concerned, if I've gone to all the trouble to have
something phab-reviewed, I'm not going to waste a bunch of time hand-
copying metadata from the review to the commit message; citing the
review is sufficient.

-- Ian



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


svn commit: r346013 - head/sys/modules/geom/geom_label

2019-09-03 Thread Ian Lepore
Author: ian
Date: Sun Apr  7 16:33:22 2019
New Revision: 346013
URL: https://svnweb.freebsd.org/changeset/base/346013

Log:
  Add g_label_flashmap.c to the module, should have been part of r345480.
  
  Reported by:  Jia-Shiun Li 

Modified:
  head/sys/modules/geom/geom_label/Makefile

Modified: head/sys/modules/geom/geom_label/Makefile
==
--- head/sys/modules/geom/geom_label/Makefile   Sun Apr  7 16:07:41 2019
(r346012)
+++ head/sys/modules/geom/geom_label/Makefile   Sun Apr  7 16:33:22 2019
(r346013)
@@ -6,6 +6,7 @@ KMOD=   geom_label
 SRCS=  g_label.c
 SRCS+= g_label_disk_ident.c
 SRCS+= g_label_ext2fs.c
+SRCS+= g_label_flashmap.c
 SRCS+= g_label_gpt.c
 SRCS+= g_label_iso9660.c
 SRCS+= g_label_msdosfs.c


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


Re: svn commit: r345900 - head/sbin/fsck_msdosfs

2019-09-03 Thread Ian Lepore
On Sat, 2019-04-06 at 01:47 +1100, Bruce Evans wrote:
> On Fri, 5 Apr 2019, Ed Maste wrote:
> 
> > On Fri, 5 Apr 2019 at 00:49, Rodney W. Grimes  
> > wrote:
> >>
> >
> >>> +static const u_char dot_name[] = {
> >>> + '.', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
> >>> +static const u_char dotdot_name[] = {
> >>> + '.', '.',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
> >>> +
> >>
> >> Does it make since to encode these as hex or octal constants,
> >> one can not tell that those are different values in an easy
> >> manner.  They all look like '.' in the diff, and probably
> >> in most editors.
> 
> No, but it makes sense to write them as string constants.  They are just
> the strings "." and ".." padded with spaces to length 11, except they
> are not actually strings since they are not NUL terminated.  11 is for
> 8+3 msdos short file names.  These are not NUL terminated either, but
> it should be easy to ignore the extra NUL given by the string constants.
> 

Defining them as nulterminated strings will also affect
sizeof(dot_name), better make sure nothing relies on that.

-- Ian




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


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

2019-09-02 Thread Ian Lepore
Author: ian
Date: Mon Sep  2 18:32:08 2019
New Revision: 351724
URL: https://svnweb.freebsd.org/changeset/base/351724

Log:
  Fix the name of the devicetree bindings document file cited in the manpage.
  
  Reported by:  thj@

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

Modified: head/share/man/man4/ads111x.4
==
--- head/share/man/man4/ads111x.4   Mon Sep  2 18:10:35 2019
(r351723)
+++ head/share/man/man4/ads111x.4   Mon Sep  2 18:32:08 2019
(r351724)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 12, 2019
+.Dd September 2, 2019
 .Dt ADS111x 4
 .Os
 .Sh NAME
@@ -160,7 +160,7 @@ based system, the
 device is defined as a slave device subnode
 of the i2c bus controller node.
 All properties documented in the
-.Va ads1115.txt
+.Va ads1015.txt
 bindings document can be used with the
 .Nm
 device.
@@ -182,7 +182,7 @@ I2c slave address of device.
 .Pp
 Specific channels can be configured by adding child nodes to the
 .Nm
-node, as described in the standard ads1115.txt bindings document.
+node, as described in the standard ads1015.txt bindings document.
 If no channels are configured, sysctl variables will be created
 for all possible channels supported by the device type, otherwise
 only the specified channels are created.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351471 - in head/sys: kern sys

2019-08-30 Thread Ian Lepore
On Sat, 2019-08-31 at 00:03 +0200, Mateusz Guzik wrote:
> On 8/25/19, Oliver Pinter  wrote:
> > On Sunday, August 25, 2019, Mateusz Guzik  wrote:
> > 
> > > Author: mjg
> > > Date: Sun Aug 25 05:11:43 2019
> > > New Revision: 351471
> > > URL: https://svnweb.freebsd.org/changeset/base/351471
> > > 
> > > Log:
> > >   vfs: add vholdnz (for already held vnodes)
> > 
> > 
> > Why?
> > 
> > (Yes, is can read the real reason in phabricator, but the
> > phabricator
> > didn't considered a persistent information in relation to commit
> > message.
> > Review helper tool just comes and goes as time goes forward, but
> > commit
> > messages survives the repo conversions to other VCS...)
> > 
> > And once you have taken the time to write a correct description in
> > phabricator, it would be really really nice and helpful if you
> > would copy
> > them into commit message.
> > 
> 
> I think it's a fair point that if I included this info in the review
> it
> should make it's way into the commit message.
> 

When I open a new phab review, I specifically write the one-line
summary and text that follows with the idea that I'm going to cut and
paste that exact text as the commit message (mostly because it's easier
to just write all that stuff once).  If there are things I want to say
there that don't make sense for the commit I typically add them as a
separate comment right after I open the initial review.

-- Ian

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


Re: svn commit: r351253 - in head/contrib/libc++: include src

2019-08-21 Thread Ian Lepore
On Wed, 2019-08-21 at 09:01 -0700, Marshall Clow wrote:
> On Wed, Aug 21, 2019 at 6:20 AM Tijl Coosemans 
> wrote:
> 
> > On Wed, 21 Aug 2019 15:07:56 +0200 Dimitry Andric 
> > wrote:
> > > On 21 Aug 2019, at 14:49, Tijl Coosemans  wrote:
> > > > On Tue, 20 Aug 2019 17:39:33 + (UTC) Dimitry Andric
> > > >  wrote:
> > > > > Author: dim
> > > > > Date: Tue Aug 20 17:39:32 2019
> > > > > New Revision: 351253
> > > > > URL: https://svnweb.freebsd.org/changeset/base/351253
> > > > > 
> > > > > Log:
> > > > >  Pull in r368867 from upstream libc++ trunk (by Marshall
> > > > > Clow):
> > > > > 
> > > > >Rework recursive_timed_mutex so that it uses __thread_id
> > > > > instead of
> > > > >using the lower-level __libcpp_thread_id. This is prep for
> > > > > fixing
> > > > >PR42918. Reviewed as https://reviews.llvm.org/D65895
> > > > > 
> > > > >  Pull in r368916 from upstream libc++ trunk (by Marshall
> > > > > Clow):
> > > > > 
> > > > >Fix thread comparison by making sure we never pass our
> > > > > special 'not
> > 
> > a
> > > > >thread' value to the underlying implementation. Fixes
> > > > > PR#42918.
> > > > > 
> > > > >  This should fix std::thread::id::operator==() attempting to
> > > > > call
> > > > >  pthread_equal(3) with zero values.
> > > 
> > > ...
> > > > This seems to break building Firefox:
> > > > 
> > > > In file included from
> > 
> > /usr/ports/www/firefox/work/firefox-
> > 68.0.2/media/mtransport/nricectx.cpp:82:
> > > > In file included from
> > 
> > /usr/ports/www/firefox/work/firefox-
> > 68.0.2/media/mtransport/third_party/nICEr/src/stun/stun_client_ctx.
> > h:41:
> > > > In file included from
> > 
> > /usr/ports/www/firefox/work/firefox-
> > 68.0.2/media/mtransport/third_party/nICEr/src/stun/stun.h:45:
> > > > In file included from /usr/include/net/if_var.h:84:
> > > > /usr/include/sys/lock.h:68:15: error: reference to 'thread' is
> > > > ambiguous
> > > >struct thread **owner);
> > > >   ^
> > > > /usr/include/sys/lock.h:42:8: note: candidate found by name
> > > > lookup is
> > 
> > 'thread'
> > > > struct thread;
> > > >   ^
> > > > /usr/include/c++/v1/__threading_support:397:24: note: candidate
> > > > found
> > 
> > by name
> > > >  lookup is 'std::__1::thread'
> > > > class _LIBCPP_TYPE_VIS thread;
> > > >   ^
> > > > 
> > > > This "class thread" conflicts with "struct thread" in
> > > > sys/lock.h.
> > > > Should everything in sys/lock.h be under #ifdef _KERNEL?
> > > 
> > > Maybe, but is Firefox using "using namespace std;" here?  It is a
> > > likely
> > > explanation for the ambiguity between the global struct thread
> > > from
> > > sys/lock.h, and std::thread from libc++.
> > 
> > Yes, several headers in media/mtransport/third_party/nICEr/src
> > start
> > with:
> > 
> > #ifdef __cplusplus
> > using namespace std;
> > extern "C" {
> > #endif /* __cplusplus */
> > 
> 
> libc++ has always had a `std::thread` struct.
> 
> The change here is that forward declaration moved from  to
> <__threading_support>, and
> that was included by .
> 
> 

It doesn't matter what the change was, because the error is in firefox.
It violates the c++ convention that you NEVER put 'using namespace'
statements in a header file.  Never.  Because, this stuff happens if
you do.

-- Ian


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


svn commit: r350988 - head/sys/dev/gpio

2019-08-13 Thread Ian Lepore
Author: ian
Date: Tue Aug 13 15:38:05 2019
New Revision: 350988
URL: https://svnweb.freebsd.org/changeset/base/350988

Log:
  Add PNP_INFO to the gpiopps driver.

Modified:
  head/sys/dev/gpio/gpiopps.c

Modified: head/sys/dev/gpio/gpiopps.c
==
--- head/sys/dev/gpio/gpiopps.c Tue Aug 13 15:30:29 2019(r350987)
+++ head/sys/dev/gpio/gpiopps.c Tue Aug 13 15:38:05 2019(r350988)
@@ -47,6 +47,7 @@ static struct ofw_compat_data compat_data[] = {
{"pps-gpio",1},
{NULL,  0}
 };
+SIMPLEBUS_PNP_INFO(compat_data);
 #endif /* FDT */
 
 static devclass_t pps_devclass;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-08-12 Thread Ian Lepore
Author: ian
Date: Tue Aug 13 03:49:53 2019
New Revision: 350971
URL: https://svnweb.freebsd.org/changeset/base/350971

Log:
  Fix the driver name in ads111x.4, and hook the manpage up to the build.
  
  The driver was originally written with the name ads1115, but at the last
  minute it got renamed to ads111x to reflect its support for many related
  chips, but I forgot to update the manpage to match the renaming before
  committing it all.

Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/ads111x.4

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Aug 13 01:25:07 2019
(r350970)
+++ head/share/man/man4/MakefileTue Aug 13 03:49:53 2019
(r350971)
@@ -21,6 +21,7 @@ MAN=  aac.4 \
${_acpi_wmi.4} \
ada.4 \
adm6996fc.4 \
+   ads111x.4 \
ae.4 \
${_aesni.4} \
age.4 \
@@ -568,7 +569,13 @@ MAN=   aac.4 \
xpt.4 \
zero.4
 
-MLINKS=ae.4 if_ae.4
+MLINKS=ads111x.4 ads1013.4 \
+   ads111x.4 ads1014.4 \
+   ads111x.4 ads1015.4 \
+   ads111x.4 ads1113.4 \
+   ads111x.4 ads1114.4 \
+   ads111x.4 ads1115.4
+MLINKS+=ae.4 if_ae.4
 MLINKS+=age.4 if_age.4
 MLINKS+=agp.4 agpgart.4
 MLINKS+=alc.4 if_alc.4

Modified: head/share/man/man4/ads111x.4
==
--- head/share/man/man4/ads111x.4   Tue Aug 13 01:25:07 2019
(r350970)
+++ head/share/man/man4/ads111x.4   Tue Aug 13 03:49:53 2019
(r350971)
@@ -24,25 +24,25 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 5, 2019
-.Dt ADS1115 4
+.Dd August 12, 2019
+.Dt ADS111x 4
 .Os
 .Sh NAME
-.Nm ads1115
+.Nm ads111x
 .Nd driver for ADS101x and ADS111x i2c analog to digital converters
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
-.Cd "device ads1115"
+.Cd "device ads111x"
 .Ed
 .Pp
 Alternatively, to load the driver as a
 module at boot time, place the following line in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
-ads1115_load="YES"
+ads111x_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
@@ -58,7 +58,7 @@ set via hints, FDT data, and
 .Xr Sysctl 8
 provides access to the voltage measurements made by the device.
 Each time the
-.Va dev.ads1115...voltage
+.Va dev.ads111x...voltage
 variable is accessed for a given channel, the driver switches the
 chip's internal mux to choose the right input pins for that channel,
 directs it to make a single measurement, and returns the measured value
@@ -106,16 +106,16 @@ All writeable variables may also be set as
 tunables.
 Channel numbers in these sysctl variables range from 0 through 7.
 .Bl -tag -width indent
-.It Va dev.ads1115..config
+.It Va dev.ads111x..config
 Provides access to the configuration register bits that control the
 alert pin configuration.
 Other bits which are controlled by the driver are masked out, and
 cannot be viewed or changed using this variable.
-.It Va dev.ads1115..lo_thresh
+.It Va dev.ads111x..lo_thresh
 Sets the low threshold for activating the alert pin.
-.It Va dev.ads1115..hi_thresh
+.It Va dev.ads111x..hi_thresh
 Sets the high threshold for activating the alert pin.
-.It Va dev.ads1115...rate_index
+.It Va dev.ads111x...rate_index
 Sets the sample rate for the channel.
 The device datasheet documents eight available sample rates, chosen
 by setting a value of 0 through 7 into the corresponding control
@@ -126,7 +126,7 @@ measurement on the given channel.
 Because measurements are always made in single-shot mode, think of
 this variable as controlling the averaging time for a single sample;
 the time to make a measurement is 1 / samplerate.
-.It Va dev.ads1115...gain_index
+.It Va dev.ads111x...gain_index
 Sets the programmable gain amplifier for the channel on devices
 which have an internal amplifier.
 The device datasheet documents eight available gain values, chosen
@@ -134,7 +134,7 @@ by setting a value of 0 through 7 into the correspondi
 register bits.
 This variable sets the value used for those bits when making a
 measurement on the given channel.
-.It Va dev.ads1115...voltage
+.It Va dev.ads111x...voltage
 Reading this variable causes the device to make a measurement on
 the corresponding input pin(s) and return the voltage in microvolts.
 .Pp
@@ -215,16 +215,16 @@ based system, such as
 these values are configurable for
 .Nm :
 .Bl -tag -width indent
-.It Va hint.ads1115..at
+.It Va hint.ads111x..at
 The iicbus instance the
 .Nm
 instance is attached to.
-.It Va hint.ads1115...gain_index
+.It Va hint.ads111x...gain_index
 The amplifier gain, as described above for the sysctl variable
-.Va dev.ads1115...gain_index .
-.It Va hint.ads1115...rate_index
+.Va dev.ads111x...gain_index .
+.It Va hint.ads111x...rate_index
 The sample rate, as described above for the sysctl variable

svn commit: r350879 - head/sys/arm/ti/am335x

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 23:19:56 2019
New Revision: 350879
URL: https://svnweb.freebsd.org/changeset/base/350879

Log:
  Revert r350841.  I didn't realize that on this chip, reading the interrupt
  status register clears pending interrupts.  By moving that code out of the
  interrupt handler into a taskqueue task, I effectively created an interrupt
  storm by returning from the handler with the interrupt source still active.
  
  We'll have to find a different solution for this driver's need to sleep
  in an ithread context.

Modified:
  head/sys/arm/ti/am335x/am335x_pmic.c

Modified: head/sys/arm/ti/am335x/am335x_pmic.c
==
--- head/sys/arm/ti/am335x/am335x_pmic.cSun Aug 11 23:01:31 2019
(r350878)
+++ head/sys/arm/ti/am335x/am335x_pmic.cSun Aug 11 23:19:56 2019
(r350879)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -62,7 +61,6 @@ struct am335x_pmic_softc {
uint32_tsc_addr;
struct resource *sc_irq_res;
void*sc_intrhand;
-   struct task intr_task;
 };
 
 static const char *tps65217_voreg_c[4] = {"4.10V", "4.15V", "4.20V", "4.25V"};
@@ -87,7 +85,7 @@ am335x_pmic_write(device_t dev, uint8_t address, uint8
 }
 
 static void
-am335x_pmic_intrtask(void *arg, int pending)
+am335x_pmic_intr(void *arg)
 {
struct am335x_pmic_softc *sc = (struct am335x_pmic_softc *)arg;
struct tps65217_status_reg status_reg;
@@ -95,16 +93,20 @@ am335x_pmic_intrtask(void *arg, int pending)
int rv;
char notify_buf[16];
 
+   THREAD_SLEEPING_OK();
rv = am335x_pmic_read(sc->sc_dev, TPS65217_INT_REG, (uint8_t 
*)_reg, 1);
if (rv != 0) {
device_printf(sc->sc_dev, "Cannot read interrupt register\n");
+   THREAD_NO_SLEEPING();
return;
}
rv = am335x_pmic_read(sc->sc_dev, TPS65217_STATUS_REG, (uint8_t 
*)_reg, 1);
if (rv != 0) {
device_printf(sc->sc_dev, "Cannot read status register\n");
+   THREAD_NO_SLEEPING();
return;
}
+   THREAD_NO_SLEEPING();
 
if (int_reg.pbi && status_reg.pb)
shutdown_nice(RB_POWEROFF);
@@ -115,18 +117,6 @@ am335x_pmic_intrtask(void *arg, int pending)
}
 }
 
-static void
-am335x_pmic_intr(void *arg)
-{
-   struct am335x_pmic_softc *sc = arg;
-
-   /*
-* Handling the interrupt requires doing i2c IO, which sleeps while the
-* IO is in progress, so do the processing on a taskqueue thread.
-*/
-   taskqueue_enqueue(taskqueue_thread, >intr_task);
-}
-
 static int
 am335x_pmic_probe(device_t dev)
 {
@@ -284,8 +274,6 @@ am335x_pmic_attach(device_t dev)
int rid;
 
sc = device_get_softc(dev);
-
-   TASK_INIT(>intr_task, 0, am335x_pmic_intrtask, sc);
 
rid = 0;
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350878 - in stable/12: . etc/mtree libexec/rc/rc.d usr.sbin/periodic/etc/daily

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 23:01:31 2019
New Revision: 350878
URL: https://svnweb.freebsd.org/changeset/base/350878

Log:
  MFC r349807, r349974, r349976, r350324, r350361, r350445
  
  r349807:
  Eliminate spurious periodic.daily error message for rotating accounting log.
  
  In 2011, r218961 removed local code for rotating logs in favor of using the
  rotate_log command in etc/rc.d/accounting.  If the accounting service is
  activated then subsequently de-activated in rc.conf but still remains active
  in periodic.conf, then you get an error message every day in the periodic
  jobs about being unable to rotate the logs.
  
  With this change to use "onerotate_log", the log rotation will happen the
  first time periodic daily runs after accounting was disabled but periodic
  accounting was left enabled.  After that happens once, the /var/account/acct
  will no longer exist, which results in a different path through the periodic
  code and no more error messages will appear (unless daily_show_badconfig is
  set, in which case the admin will be told that periodic security processing
  is enabled but the accounting file is not present).
  
  This is only a partial fix for the problems reported in PR 202203.
  
  PR:   202203
  
  r349974:
  Limit access to system accounting files.
  
  In 2013 the security chapter of the Handbook was updated in r42501 to
  suggest limiting access to the system accounting file [*1] by creating the
  initial file with a mode of 0600. This was in part based on a discussion in
  the forums [*2]. Unfortunately, this advice is overridden by the fact that a
  new file is created as part of periodic daily processing, and the file mode
  is set by the rc.d/accounting script.
  
  These changes update the accounting script to create the directory with mode
  0750 if it doesn't already exist, and to create the daily file with mode
  0640. This limits write access to root only, read access to root and members
  of wheel, and eliminates world access completely. For admins who want to
  prevent even members of wheel from accessing the files, the mode of the
  /var/account directory can be manually changed to 0700, because the script
  never creates or changes that directory if it already exists.
  
  The accounting_rotate_log() function now also handles the error cases of no
  existing log file to rotate, and attempting to rotate the file multiple
  times (.0 file already exists).
  
  Another small change here eliminates the complexity of the mktemp/chmod/mv
  sequence for creating a new acct file by using install(1) with the flags
  needed to directly create the file with the desired ownership and
  modes. That allows coalescing two separate if checkyesno accounting_enable
  blocks into one.
  
  These changes were inspired by my investigation of PR 202203.
  
  [1] https://www.freebsd.org/doc/handbook/security-accounting.html
  [2] http://forums.freebsd.org/showthread.php?t=41059
  
  PR:   202203
  Differential Revision:https://reviews.freebsd.org/D20876
  
  r349976:
  Add an entry mentioning the permission/mode change to daily accounting files.
  
  r350324:
  Fix indentation (spaces->tab).
  
  r350361:
  Re-wrap the text at 80 columns after fixing the indent in the prior commit.
  
  r350445:
  Create the /var/account dir with mode 0750; this is a followup to r349974.
  
  The rc.d/account script contains code to create the /var/account dir, so
  it hadn't occurred to me that it is normally created via mtree; thanks to
  jilles@ for pointing it out.

Modified:
  stable/12/UPDATING
  stable/12/etc/mtree/BSD.var.dist
  stable/12/libexec/rc/rc.d/accounting
  stable/12/usr.sbin/periodic/etc/daily/310.accounting
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/UPDATING
==
--- stable/12/UPDATING  Sun Aug 11 22:46:58 2019(r350877)
+++ stable/12/UPDATING  Sun Aug 11 23:01:31 2019(r350878)
@@ -16,6 +16,15 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20190811:
+   Default permissions on the /var/account/acct file (and copies of it 
+   rotated by periodic daily scripts) are changed from 0644 to 0640 
+   because the file contains sensitive information that should not be 
+   world-readable.  If the /var/account directory must be created by 
+   rc.d/accounting, the mode used is now 0750.  Admins who use the 
+   accounting feature are encouraged to change the mode of an existing 
+   /var/account directory to 0750 or 0700.  
+
 20190723:
Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have
been upgraded to 8.0.1.  Please see the 20141231 entry below for

Modified: stable/12/etc/mtree/BSD.var.dist

svn commit: r350877 - in stable/12: lib/libc/arm lib/libc/arm/gen sys/sys

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 22:46:58 2019
New Revision: 350877
URL: https://svnweb.freebsd.org/changeset/base/350877

Log:
  MFC r349891, r349972
  
  r349891:
  Reorganize the SRCS lists as one file per line, and then alphabetize them.
  No functional changes.
  
  r349972:
  Add arm_sync_icache() and arm_drain_writebuf() sysarch syscall wrappers.
  
  NetBSD and OpenBSD have libc wrapper functions for the ARM_SYNC_ICACHE and
  ARM_DRAIN_WRITEBUF sysarch operations. This change adds compatible functions
  to our library. This should make it easier for various upstream sources to
  support *BSD operating systems with a single variation of cache maintence
  code in tools like interpreters and JIT compilers.
  
  I consider the argument types passed to arm_sync_icache() to be especially
  unfortunate, but this is intended to match the other BSDs.
  
  Differential Revision:https://reviews.freebsd.org/D20906

Added:
  stable/12/lib/libc/arm/gen/arm_drain_writebuf.2
 - copied unchanged from r349972, head/lib/libc/arm/gen/arm_drain_writebuf.2
  stable/12/lib/libc/arm/gen/arm_drain_writebuf.c
 - copied unchanged from r349972, head/lib/libc/arm/gen/arm_drain_writebuf.c
  stable/12/lib/libc/arm/gen/arm_sync_icache.2
 - copied unchanged from r349972, head/lib/libc/arm/gen/arm_sync_icache.2
  stable/12/lib/libc/arm/gen/arm_sync_icache.c
 - copied unchanged from r349972, head/lib/libc/arm/gen/arm_sync_icache.c
Modified:
  stable/12/lib/libc/arm/Symbol.map
  stable/12/lib/libc/arm/gen/Makefile.inc
  stable/12/sys/sys/param.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/arm/Symbol.map
==
--- stable/12/lib/libc/arm/Symbol.map   Sun Aug 11 22:32:52 2019
(r350876)
+++ stable/12/lib/libc/arm/Symbol.map   Sun Aug 11 22:46:58 2019
(r350877)
@@ -41,6 +41,11 @@ FBSD_1.4 {
dl_unwind_find_exidx;
 };
 
+FBSD_1.6 {
+   arm_drain_writebuf;
+   arm_sync_icache;
+};
+
 FBSDprivate_1.0 {
/* PSEUDO syscalls */
__sys_getlogin;

Modified: stable/12/lib/libc/arm/gen/Makefile.inc
==
--- stable/12/lib/libc/arm/gen/Makefile.inc Sun Aug 11 22:32:52 2019
(r350876)
+++ stable/12/lib/libc/arm/gen/Makefile.inc Sun Aug 11 22:46:58 2019
(r350877)
@@ -1,13 +1,37 @@
 #  @(#)Makefile.inc8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
-SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \
-   infinity.c ldexp.c makecontext.c \
-   __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \
+SRCS+= \
+   __aeabi_read_tp.S \
+   _ctx_start.S \
+   _set_tp.c \
+   _setjmp.S \
+   alloca.S \
arm_initfini.c \
-   getcontextx.c
+   arm_drain_writebuf.c \
+   arm_sync_icache.c \
+   fabs.c \
+   flt_rounds.c \
+   getcontextx.c \
+   infinity.c \
+   ldexp.c \
+   makecontext.c \
+   setjmp.S \
+   signalcontext.c \
+   sigsetjmp.S \
 
+MAN+=  \
+   arm_drain_writebuf.2 \
+   arm_sync_icache.2 \
+
 .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == 
"")
-SRCS+= fpgetmask_vfp.c fpgetround_vfp.c fpgetsticky_vfp.c fpsetmask_vfp.c \
-   fpsetround_vfp.c fpsetsticky_vfp.c
+
+SRCS+= \
+   fpgetmask_vfp.c \
+   fpgetround_vfp.c \
+   fpgetsticky_vfp.c \
+   fpsetmask_vfp.c \
+   fpsetround_vfp.c \
+   fpsetsticky_vfp.c \
+
 .endif

Copied: stable/12/lib/libc/arm/gen/arm_drain_writebuf.2 (from r349972, 
head/lib/libc/arm/gen/arm_drain_writebuf.2)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/lib/libc/arm/gen/arm_drain_writebuf.2 Sun Aug 11 22:46:58 
2019(r350877, copy of r349972, 
head/lib/libc/arm/gen/arm_drain_writebuf.2)
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2019 Ian Lepore 
+.\"
+.\" 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE

svn commit: r350876 - stable/12/sys/dev/mmc

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 22:32:52 2019
New Revision: 350876
URL: https://svnweb.freebsd.org/changeset/base/350876

Log:
  MFC r350231: Correct spelling, partion -> partition.

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

Modified: stable/12/sys/dev/mmc/mmcsd.c
==
--- stable/12/sys/dev/mmc/mmcsd.c   Sun Aug 11 22:31:38 2019
(r350875)
+++ stable/12/sys/dev/mmc/mmcsd.c   Sun Aug 11 22:32:52 2019
(r350876)
@@ -575,7 +575,7 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con
speed / 100, (speed / 10) % 10,
mmcsd_bus_bit_width(dev), sc->max_data);
} else if (type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
-   printf("%s: %ju%sB partion %d%s at %s\n", part->name, bytes,
+   printf("%s: %ju%sB partition %d%s at %s\n", part->name, bytes,
unit, type, ro ? " (read-only)" : "",
device_get_nameunit(dev));
} else {
@@ -611,12 +611,12 @@ mmcsd_add_part(struct mmcsd_softc *sc, u_int type, con
}
}
if (ext == NULL)
-   printf("%s%d: %ju%sB partion %d%s%s at %s\n",
+   printf("%s%d: %ju%sB partition %d%s%s at %s\n",
part->name, cnt, bytes, unit, type, enh ?
" enhanced" : "", ro ? " (read-only)" : "",
device_get_nameunit(dev));
else
-   printf("%s%d: %ju%sB partion %d extended 0x%x "
+   printf("%s%d: %ju%sB partition %d extended 0x%x "
"(%s)%s at %s\n", part->name, cnt, bytes, unit,
type, extattr, ext, ro ? " (read-only)" : "",
device_get_nameunit(dev));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350875 - stable/12/sys/dev/iicbus

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 22:31:38 2019
New Revision: 350875
URL: https://svnweb.freebsd.org/changeset/base/350875

Log:
  MFC r350104, r350106, r350185, r350203
  
  r350104:
  Handle the PCF2127 RTC chip the same as PCF2129 when init'ing the chip.
  
  This affects the detection of 24-hour vs AM/PM mode... the ampm bit is in a
  different location on 2127 and 2129 chips compared to other nxp rtc chips.
  I noticed the 2127 case wasn't being handled correctly when I accidentally
  misconfiged my system by claiming my PCF2129 was a 2127.
  
  r350106:
  Fix a paste-o, set is212x = false for other chip types.  Doh!
  
  r350185:
  Rewrite the nxprtc chip init to extend battery life by using power-saving
  features offered by the chips.
  
  For 2127 and 2129 chips, fix the detection of when chip-init is needed.  The
  chip config needs to be reset whenever power was lost, but the logic was
  wrong for 212x chips (it only worked for 8523).  Now the "oscillator
  stopped" bit rather than the power manager mode is used to detect startup
  after powerfail.
  
  For all chips, disable the clock output pin.
  
  For chips that have a timestamp/tamper-monitor feature, turn off monitoring
  of the timestamp trigger pin.
  
  The 8523, 2127, and 2129 chips have a "power manager" feature that offers
  several options.  We've been using the default mode which enables
  everything.  Now the code sets the power manager options to
  
   - direct-switch (when Vdd < Vbat, without extra threshold check)
   - no battery monitor
   - no external powerfail monitor
  
  This reduces the current draw while running on battery from 1930nA to 880nA,
  which should roughly double the lifespan of the battery under load.
  
  Because battery checking is a nice thing to have, the code now does a check
  at startup, and then once a day after that, instead of checking continuously
  (but only actually reporting at startup).  The battery check is now done by
  setting the power manager back to default mode, sleeping briefly while it
  makes a voltage measurement, then switching back to power-saving mode.
  
  r350203:
  Add support for setting the aging/frequency-offset register via sysctl.
  
  The 2127 and 2129 chips support a frequency tuning value in the range of
  -7 through +8 PPM; add a sysctl handler to read and set the value.

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

Modified: stable/12/sys/dev/iicbus/nxprtc.c
==
--- stable/12/sys/dev/iicbus/nxprtc.c   Sun Aug 11 22:19:54 2019
(r350874)
+++ stable/12/sys/dev/iicbus/nxprtc.c   Sun Aug 11 22:31:38 2019
(r350875)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -106,6 +107,11 @@ __FBSDID("$FreeBSD$");
 #definePCF2127_B_TMR_CD0x40/* Run in countdown mode */
 #definePCF2127_B_TMR_64HZ  0x01/* Timer frequency 64Hz */
 
+#definePCF2127_R_TS_CTL0x12/* Timestamp control */
+#definePCF2127_B_TSOFF 0x40/* Turn off timestamp function 
*/
+
+#definePCF2127_R_AGING_OFFSET  0x19/* Frequency aging offset in 
PPM */
+
 /*
  * PCA/PCF2129-specific registers, bits, and masks.
  */
@@ -134,12 +140,16 @@ __FBSDID("$FreeBSD$");
 #definePCF8523_M_CS3_PM0xE0/* Power mode mask */
 #definePCF8523_B_CS3_PM_NOBAT  0xE0/* PM bits: no battery usage */
 #definePCF8523_B_CS3_PM_STD0x00/* PM bits: standard */
+#definePCF8523_B_CS3_PM_DSNBM  0xa0/* PM bits: direct switch, no 
bat mon */
 #definePCF8523_B_CS3_BLF   0x04/* Battery Low Flag bit */
 
 /*
  * PCF8563-specific registers, bits, and masks.
  */
 #definePCF8563_R_SECOND0x02/* Seconds */
+
+#definePCF8563_R_CLKOUT0x0d/* Clock output control */
+
 #definePCF8563_R_TMR_CTRL  0x0e/* Timer control */
 #definePCF8563_R_TMR_COUNT 0x0f/* Timer count */
 
@@ -196,10 +206,13 @@ struct nxprtc_softc {
config_hook;
u_int   flags;  /* SC_F_* flags */
u_int   chiptype;   /* Type of PCF85xx chip */
+   time_t  bat_time;   /* Next time to check battery */
+   int freqadj;/* Current freq adj in PPM */
uint8_t secaddr;/* Address of seconds register */
uint8_t tmcaddr;/* Address of timer count register */
booluse_timer;  /* Use timer for fractional sec */
booluse_ampm;   /* Chip is set to use am/pm mode */
+   boolis212x; /* Chip type is 2127 or 2129 */
 };
 
 #defineSC_F_CPOL   (1 << 0)/* Century bit means 19xx */
@@ -347,99 +360,197 @@ write_timeregs(struct nxprtc_softc *sc, struct 

svn commit: r350874 - stable/12/sys/dev/iicbus

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 22:19:54 2019
New Revision: 350874
URL: https://svnweb.freebsd.org/changeset/base/350874

Log:
  MFC r350015-r350016
  
  r350015:
  Fix nxprtc(4) on systems that support i2c repeat-start correctly.
  
  An obscure footnote in the datasheets for the PCx2127, PCx2129, and
  PCF8523 rtc chips states that the chips do not support i2c repeat-start
  operations.  When the driver was originally written and tested, the i2c
  bus on that system also didn't support repeat-start and just quietly
  turned repeat-start operations into a stop-then-start, making it appear
  that the nxprtc driver was working properly.
  
  The repeat-start situation only comes up on reads, so instead of using
  the standard iicdev_readfrom(), use a local nxprtc_readfrom(), which is
  just a cut-and-pasted copy of iicdev_readfrom(), modified to send two
  separate start-data-stop sequences instead of using repeat-start.
  
  r350016:
  In nxprtc(4), use the countdown timer for better timekeeping resolution
  on PCx2129 chips too.
  
  The datasheet for the PCx2129 chips says that there is only a watchdog
  timer, no countdown timer.  It turns out the countdown timer hardware is
  there and works just the same as it does on a PCx2127 chip, except that you
  can't use it to trigger an interrupt or toggle an output pin.  We don't need
  interrupts or output pins, we only need to read the timer register to get
  sub-second resolution.  So start treating the 2129 chips the same as 2127.

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

Modified: stable/12/sys/dev/iicbus/nxprtc.c
==
--- stable/12/sys/dev/iicbus/nxprtc.c   Sun Aug 11 22:11:59 2019
(r350873)
+++ stable/12/sys/dev/iicbus/nxprtc.c   Sun Aug 11 22:19:54 2019
(r350874)
@@ -33,8 +33,8 @@ __FBSDID("$FreeBSD$");
  *  - PCA8565 = like PCF8563, automotive temperature range
  *  - PCF8523 = low power, countdown timer, oscillator freq tuning, 2 timers
  *  - PCF2127 = like PCF8523, industrial, tcxo, tamper/ts, i2c & spi, 512B ram
- *  - PCA2129 = like PCF8523, automotive, tcxo, tamper/ts, i2c & spi, no timer
- *  - PCF2129 = like PCF8523, industrial, tcxo, tamper/ts, i2c & spi, no timer
+ *  - PCA2129 = like PCF8523, automotive, tcxo, tamper/ts, i2c & spi, (note 1)
+ *  - PCF2129 = like PCF8523, industrial, tcxo, tamper/ts, i2c & spi, (note 1)
  *
  *  Most chips have a countdown timer, ostensibly intended to generate periodic
  *  interrupt signals on an output pin.  The timer is driven from the same
@@ -42,6 +42,13 @@ __FBSDID("$FreeBSD$");
  *  in sync when the STOP bit is cleared after the time and timer registers are
  *  set.  The timer register can also be read on the fly, so we use it to count
  *  fractional seconds and get a resolution of ~15ms.
+ *
+ *  [1] Note that the datasheets for the PCx2129 chips state that they have 
only
+ *  a watchdog timer, not a countdown timer.  Empirical testing shows that the
+ *  countdown timer is actually there and it works fine, except that it can't
+ *  trigger an interrupt or toggle an output pin like it can on other chips.  
We
+ *  don't care about interrupts and output pins, we just read the timer 
register
+ *  to get better resolution.
  */
 
 #include "opt_platform.h"
@@ -236,10 +243,43 @@ static nxprtc_compat_data compat_data[] = {
 };
 
 static int
+nxprtc_readfrom(device_t slavedev, uint8_t regaddr, void *buffer,
+uint16_t buflen, int waithow)
+{
+   struct iic_msg msg;
+   int err;
+   uint8_t slaveaddr;
+
+   /*
+* Two transfers back to back with a stop and start between them; first 
we
+* write the address-within-device, then we read from the device.  This
+* is used instead of the standard iicdev_readfrom() because some of the
+* chips we service don't support i2c repeat-start operations (gr)
+* so we do two completely separate transfers with a full stop between.
+*/
+   slaveaddr = iicbus_get_addr(slavedev);
+
+   msg.slave = slaveaddr;
+   msg.flags = IIC_M_WR;
+   msg.len   = 1;
+   msg.buf   = 
+
+   if ((err = iicbus_transfer_excl(slavedev, , 1, waithow)) != 0)
+   return (err);
+
+   msg.slave = slaveaddr;
+   msg.flags = IIC_M_RD;
+   msg.len   = buflen;
+   msg.buf   = buffer;
+
+   return (iicbus_transfer_excl(slavedev, , 1, waithow));
+}
+
+static int
 read_reg(struct nxprtc_softc *sc, uint8_t reg, uint8_t *val)
 {
 
-   return (iicdev_readfrom(sc->dev, reg, val, sizeof(*val), WAITFLAGS));
+   return (nxprtc_readfrom(sc->dev, reg, val, sizeof(*val), WAITFLAGS));
 }
 
 static int
@@ -272,7 +312,7 @@ read_timeregs(struct nxprtc_softc *sc, struct time_reg
if (tmr1 != tmr2)
continue;
}
-   if ((err = iicdev_readfrom(sc->dev, 

svn commit: r350873 - stable/12/sys/arm/include

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 22:11:59 2019
New Revision: 350873
URL: https://svnweb.freebsd.org/changeset/base/350873

Log:
  MFC r349887:
  
  De-pollute arm's sysarch.h.
  
  Instead of including stdint.h for uintptr_t, include sys/_types.h and use
  __types for everything that isn't a native C keyword type.
  
  Remove the #include of cdefs.h.  It appears after the include of armreg.h
  which has a precondition of cdefs.h being included before it, so everyone
  including sysarch.h is already including cdefs.h.  (When armv5 support
  goes away, there will be no need include armreg.h here either.)
  
  Unfortunately, the unprefixed struct member names "addr" and "len" cannot
  be changed, because 3rd-party software is relying on them (libcompiler_rt
  is one known consumer).

Modified:
  stable/12/sys/arm/include/sysarch.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/include/sysarch.h
==
--- stable/12/sys/arm/include/sysarch.h Sun Aug 11 21:40:18 2019
(r350872)
+++ stable/12/sys/arm/include/sysarch.h Sun Aug 11 22:11:59 2019
(r350873)
@@ -65,12 +65,10 @@
 #ifndef LOCORE
 #ifndef __ASSEMBLER__
 
-#include 
-
 /*
- * Pickup definition of uintptr_t
+ * Pickup definition of various __types.
  */
-#include 
+#include 
 
 /*
  * Architecture specific syscalls (arm)
@@ -83,19 +81,19 @@
 #define ARM_GET_VFPSTATE   4
 
 struct arm_sync_icache_args {
-   uintptr_t   addr;   /* Virtual start address */
-   size_t  len;/* Region size */
+   __uintptr_t addr;   /* Virtual start address */
+   __size_tlen;/* Region size */
 };
 
 struct arm_get_vfpstate_args {
-   size_t  mc_vfp_size;
+   __size_tmc_vfp_size;
void*mc_vfp;
 };
 
 #ifndef _KERNEL
 __BEGIN_DECLS
-intarm_sync_icache (u_int addr, int len);
-intarm_drain_writebuf (void);
+intarm_sync_icache(unsigned int, int);
+intarm_drain_writebuf(void);
 intsysarch(int, void *);
 __END_DECLS
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350872 - stable/12

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 21:40:18 2019
New Revision: 350872
URL: https://svnweb.freebsd.org/changeset/base/350872

Log:
  MFC r349873:
  
  Add pwm.9, it was also deleted during the big round of pwm changes.

Modified:
  stable/12/ObsoleteFiles.inc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/ObsoleteFiles.inc
==
--- stable/12/ObsoleteFiles.inc Sun Aug 11 21:24:44 2019(r350871)
+++ stable/12/ObsoleteFiles.inc Sun Aug 11 21:40:18 2019(r350872)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20190811: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed
+OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9
 # 20190723: new clang import which bumps version from 8.0.0 to 8.0.1.
 OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/8.0.0/include/sanitizer/asan_interface.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350871 - stable/12/sys/arm/ti

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 21:24:44 2019
New Revision: 350871
URL: https://svnweb.freebsd.org/changeset/base/350871

Log:
  MFC r349116:
  
  In detach(), call bus_generic_detach() before deleting the iicbus child.
  This gives the bus and its children the chance to return EBUSY to abort
  the detach if they're in the middle of doing some IO.

Modified:
  stable/12/sys/arm/ti/ti_i2c.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/ti/ti_i2c.c
==
--- stable/12/sys/arm/ti/ti_i2c.c   Sun Aug 11 21:21:32 2019
(r350870)
+++ stable/12/sys/arm/ti/ti_i2c.c   Sun Aug 11 21:24:44 2019
(r350871)
@@ -735,8 +735,6 @@ ti_i2c_deactivate(device_t dev)
sc->sc_irq_h = NULL;
}
 
-   bus_generic_detach(sc->sc_dev);
-
/* Unmap the I2C controller registers. */
if (sc->sc_mem_res != NULL) {
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
@@ -925,11 +923,18 @@ ti_i2c_detach(device_t dev)
int rv;
 
sc = device_get_softc(dev);
-   ti_i2c_deactivate(dev);
-   TI_I2C_LOCK_DESTROY(sc);
-   if (sc->sc_iicbus &&
+
+   if ((rv = bus_generic_detach(dev)) != 0) {
+   device_printf(dev, "cannot detach child devices\n");
+   return (rv);
+   }
+
+if (sc->sc_iicbus &&
(rv = device_delete_child(dev, sc->sc_iicbus)) != 0)
return (rv);
+
+   ti_i2c_deactivate(dev);
+   TI_I2C_LOCK_DESTROY(sc);
 
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350870 - stable/12/sys/dev/iicbus

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 21:21:32 2019
New Revision: 350870
URL: https://svnweb.freebsd.org/changeset/base/350870

Log:
  MFC r349839, r349850
  
  r349839:
  Call device_unbusy() on the error exit path, because if iicbus_request_bus()
  returns an error, iicbus_release_bus() is not going to be called.
  
  r349850:
  Restore the ability for i2c slave devices to do IO from their probe method.
  
  r348164 added code to iicbus_request_bus/iicbus_release_bus to automatically
  call device_busy()/device_unbusy() as part of aquiring exclusive use of the
  bus (so modules can't be unloaded while the bus is exclusively owned and/or
  IO is in progress).  That broke the ability to do i2c IO from a slave device
  probe method, because the slave isn't attached yet, so calling device_busy()
  triggers a sanity-check panic for trying to busy a non-attached device.
  
  Now we check whether the device status is < DS_ATTACHING, and if so we busy
  the iicbus rather than the slave device.  I think this leaves a small window
  where a module could be unloaded while probing is in progress.  But I think
  that's true of all devices, and probably should be fixed by introducing a
  DS_PROBING state for devices, and handling that at various points in the
  newbus code.

Modified:
  stable/12/sys/dev/iicbus/iicbus.h
  stable/12/sys/dev/iicbus/iiconf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iicbus/iicbus.h
==
--- stable/12/sys/dev/iicbus/iicbus.h   Sun Aug 11 21:15:30 2019
(r350869)
+++ stable/12/sys/dev/iicbus/iicbus.h   Sun Aug 11 21:21:32 2019
(r350870)
@@ -41,6 +41,7 @@ struct iicbus_softc
 {
device_t dev;   /* Myself */
device_t owner; /* iicbus owner device structure */
+   device_t busydev;   /* iicbus_release_bus calls unbusy on this */
u_int owncount; /* iicbus ownership nesting count */
u_char started; /* address of the 'started' slave
 * 0 if no start condition succeeded */

Modified: stable/12/sys/dev/iicbus/iiconf.c
==
--- stable/12/sys/dev/iicbus/iiconf.c   Sun Aug 11 21:15:30 2019
(r350869)
+++ stable/12/sys/dev/iicbus/iiconf.c   Sun Aug 11 21:21:32 2019
(r350870)
@@ -131,9 +131,15 @@ iicbus_request_bus(device_t bus, device_t dev, int how
/*
 * Mark the device busy while it owns the bus, to
 * prevent detaching the device, bus, or hardware
-* controller, until ownership is relinquished.
+* controller, until ownership is relinquished.  If the
+* device is doing IO from its probe method before
+* attaching, it cannot be busied; mark the bus busy.
 */
-   device_busy(dev);
+   if (device_get_state(dev) < DS_ATTACHING)
+   sc->busydev = bus;
+   else
+   sc->busydev = dev;
+   device_busy(sc->busydev);
/* 
 * Drop the lock around the call to the bus driver, it
 * should be allowed to sleep in the IIC_WAIT case.
@@ -150,6 +156,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how
sc->owner = NULL;
sc->owncount = 0;
wakeup_one(sc);
+   device_unbusy(sc->busydev);
}
}
}
@@ -183,7 +190,7 @@ iicbus_release_bus(device_t bus, device_t dev)
IICBUS_LOCK(sc);
sc->owner = NULL;
wakeup_one(sc);
-   device_unbusy(dev);
+   device_unbusy(sc->busydev);
}
IICBUS_UNLOCK(sc);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350869 - stable/12/sys/conf

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 21:15:30 2019
New Revision: 350869
URL: https://svnweb.freebsd.org/changeset/base/350869

Log:
  MFC r349319, r349328-r349330
  
  r349319:
  Add some i2c slave-device drivers that were missing from NOTES.
  
  r349328:
  The gpiopps(4) driver currently has probe and attach code only for FDT based
  systems, so conditionalize it accordingly in conf/files.
  
  r349329:
  Add gpio(4) and related drivers to NOTES.
  
  r349330:
  Add pwm devices to NOTES.

Modified:
  stable/12/sys/conf/NOTES
  stable/12/sys/conf/files
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/NOTES
==
--- stable/12/sys/conf/NOTESSun Aug 11 21:12:29 2019(r350868)
+++ stable/12/sys/conf/NOTESSun Aug 11 21:15:30 2019(r350869)
@@ -2524,14 +2524,19 @@ device  iicoc   # OpenCores I2C 
controller support
 
 # I2C peripheral devices
 #
+device ad7418  # Analog Devices temp and voltage sensor
 device ds1307  # Dallas DS1307 RTC and compatible
 device ds13rtc # All Dallas/Maxim ds13xx chips
 device ds1672  # Dallas DS1672 RTC
 device ds3231  # Dallas DS3231 RTC + temperature
 device icee# AT24Cxxx and compatible EEPROMs
+device isl12xx # Intersil ISL12xx RTC
 device lm75# LM75 compatible temperature sensor
 device nxprtc  # NXP RTCs: PCA/PFC212x PCA/PCF85xx
+device rtc8583 # Epson RTC-8583
 device s35390a # Seiko Instruments S-35390A RTC
+device sy8106a # Silergy Corp. SY8106A buck regulator
+device syr827  # Silergy Corp. DC/DC regulator
 
 # Parallel-Port Bus
 #
@@ -2578,6 +2583,22 @@ device   ppi
 device pps
 device lpbb
 device pcfclock
+
+# General Purpose I/O pins
+device gpio# gpio interfaces and bus support
+device gpiobacklight   # sysctl control of gpio-based backlight
+device gpioiic # i2c via gpio bitbang
+device gpiokeys# kbd(4) glue for gpio-based key input
+device gpioled # led(4) gpio glue
+device gpiopower   # event handler for gpio-based powerdown
+device gpiopps # Pulse per second input from gpio pin
+device gpioregulator   # extres/regulator glue for gpio pin
+device gpiospi # SPI via gpio bitbang
+device gpioths # 1-wire temp/humidity sensor on gpio pin
+
+# Pulse width modulation
+device pwmbus  # pwm interface and bus support
+device pwmc# userland control access to pwm outputs
 
 #
 # Etherswitch framework and drivers

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesSun Aug 11 21:12:29 2019(r350868)
+++ stable/12/sys/conf/filesSun Aug 11 21:15:30 2019(r350869)
@@ -1824,7 +1824,7 @@ dev/gpio/gpiospi.coptional gpiospi
 dev/gpio/gpioths.c optional gpioths
 dev/gpio/gpio_if.m optional gpio
 dev/gpio/gpiobus_if.m  optional gpio
-dev/gpio/gpiopps.c optional gpiopps
+dev/gpio/gpiopps.c optional gpiopps fdt
 dev/gpio/ofw_gpiobus.c optional fdt gpio
 dev/hifn/hifn7751.coptional hifn
 dev/hme/if_hme.c   optional hme
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350868 - in stable/12: . sys/arm/allwinner sys/conf sys/dev/iicbus

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 21:12:29 2019
New Revision: 350868
URL: https://svnweb.freebsd.org/changeset/base/350868

Log:
  MFC r349072, r349316-r349318
  
  r349072:
  Remove pcf8563reg.h, the driver it was associated with was replaced in 2017
  with the nxprtc multi-chip driver.
  
  r349316:
  Remove some unused header files from the ad7418 driver.
  
  r349317:
  Add the rtc8583 driver to conf/files.  Also, move sy8106a from
  file.allwinner to conf/files... it's not allwinner-specific, some day
  other platforms could use the same regulator chip.
  
  r349318:
  The sy8106a and syr827 drviers require FDT and the ext_resources subsystem.

Modified:
  stable/12/ObsoleteFiles.inc
  stable/12/sys/arm/allwinner/files.allwinner
  stable/12/sys/conf/files
  stable/12/sys/dev/iicbus/ad7418.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/ObsoleteFiles.inc
==
--- stable/12/ObsoleteFiles.inc Sun Aug 11 20:50:41 2019(r350867)
+++ stable/12/ObsoleteFiles.inc Sun Aug 11 21:12:29 2019(r350868)
@@ -1477,6 +1477,8 @@ OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat1
 OLD_DIRS+=usr/share/openssl/man/en.ISO8859-1/cat3
 # 20170802: ksyms(4) ioctl interface was removed
 OLD_FILES+=usr/include/sys/ksyms.h
+# 20170729: the iicbus/pcf8563 driver is replaced with iicbus/nxprtc
+OLD_FILES+=usr/include/dev/iicbus/pcf8563reg.h
 # 20170722: new clang import which bumps version from 4.0.0 to 5.0.0.
 OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/asan_interface.h

Modified: stable/12/sys/arm/allwinner/files.allwinner
==
--- stable/12/sys/arm/allwinner/files.allwinner Sun Aug 11 20:50:41 2019
(r350867)
+++ stable/12/sys/arm/allwinner/files.allwinner Sun Aug 11 21:12:29 2019
(r350868)
@@ -28,7 +28,6 @@ dev/usb/controller/generic_ohci.c optionalohci
 dev/usb/controller/generic_usb_if.moptionalohci
 arm/allwinner/aw_sid.c optionalaw_sid
 arm/allwinner/aw_thermal.c optionalaw_thermal
-dev/iicbus/sy8106a.c   optionalsy8106a
 arm/allwinner/aw_cir.c optionalaw_cir evdev
 
 arm/allwinner/aw_reset.c   standard

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesSun Aug 11 20:50:41 2019(r350867)
+++ stable/12/sys/conf/filesSun Aug 11 21:12:29 2019(r350868)
@@ -1848,7 +1848,7 @@ dev/iicbus/ds13rtc.c  optional ds13rtc | 
ds133x | ds13
 dev/iicbus/ds1672.coptional ds1672
 dev/iicbus/ds3231.coptional ds3231
 dev/iicbus/rtc8583.c   optional rtc8583
-dev/iicbus/syr827.coptional ext_resources syr827
+dev/iicbus/syr827.coptional syr827 ext_resources fdt
 dev/iicbus/icee.c  optional icee
 dev/iicbus/if_ic.c optional ic
 dev/iicbus/iic.c   optional iic
@@ -1865,7 +1865,9 @@ dev/iicbus/isl12xx.c  optional isl12xx
 dev/iicbus/lm75.c  optional lm75
 dev/iicbus/nxprtc.coptional nxprtc | pcf8563
 dev/iicbus/ofw_iicbus.coptional fdt iicbus
+dev/iicbus/rtc8583.c   optional rtc8583
 dev/iicbus/s35390a.c   optional s35390a
+dev/iicbus/sy8106a.c   optional sy8106a ext_resources fdt
 dev/iir/iir.c  optional iir
 dev/iir/iir_ctrl.c optional iir
 dev/iir/iir_pci.c  optional iir pci

Modified: stable/12/sys/dev/iicbus/ad7418.c
==
--- stable/12/sys/dev/iicbus/ad7418.c   Sun Aug 11 20:50:41 2019
(r350867)
+++ stable/12/sys/dev/iicbus/ad7418.c   Sun Aug 11 21:12:29 2019
(r350868)
@@ -35,17 +35,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350867 - in stable/12/sys: arm/conf conf

2019-08-11 Thread Ian Lepore
Author: ian
Date: Sun Aug 11 20:50:41 2019
New Revision: 350867
URL: https://svnweb.freebsd.org/changeset/base/350867

Log:
  MFC r349325, r349327
  
  r349325:
  Allow compiling ukbdmap.h on arm, since it appears to work fine.
  
  r349327:
  Build an armv7 LINT kernel in addition to armv5 LINT.  You might think this
  had been done years ago.  I did.  All this time we've only compiled a LINT
  kernel for TARGET_ARCH=arm.  Now separate LINT-V5 and LINT-V7 configs are
  generated and built.
  
  There are two new files in arm/conf, NOTES.armv5 and NOTES.armv7, containing
  some of what used to be in the arm NOTES file.  That file now contains only
  the bits that are common to v5 and v7.
  
  The makeLINT.mk file now creates the LINT-V5 and LINT-V7 files by concatening
  sys/conf/NOTES, arm/conf/NOTES, and arm/conf/NOTES.armv{5,7} in that order.

Added:
  stable/12/sys/arm/conf/NOTES.armv5
 - copied unchanged from r349327, head/sys/arm/conf/NOTES.armv5
  stable/12/sys/arm/conf/NOTES.armv7
 - copied unchanged from r349327, head/sys/arm/conf/NOTES.armv7
Modified:
  stable/12/sys/arm/conf/NOTES
  stable/12/sys/conf/files.arm
  stable/12/sys/conf/makeLINT.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/conf/NOTES
==
--- stable/12/sys/arm/conf/NOTESSun Aug 11 20:47:01 2019
(r350866)
+++ stable/12/sys/arm/conf/NOTESSun Aug 11 20:50:41 2019
(r350867)
@@ -1,44 +1,22 @@
 # $FreeBSD$
 
-machinearm
-
-cpuCPU_ARM9E
-
-files  "../mv/files.mv"
-files  "../mv/discovery/files.db78xxx"
-files  "../mv/kirkwood/files.kirkwood"
-files  "../mv/orion/files.db88f5xxx"
-files  "../mv/orion/files.ts7800"
-
-makeoptionsCONF_CFLAGS+="-march=armv5te"
-makeoptionsLDFLAGS="-zmuldefs"
-makeoptionsKERNPHYSADDR=0x
-
 optionsFDT
 
-optionsSOC_MV_DISCOVERY
-optionsSOC_MV_KIRKWOOD
-optionsSOC_MV_ORION
+# Undo options from sys/conf/NOTES that we do not want...
 
-optionsARM_MANY_BOARD
-device nand
-
-# IIC
-device twsi
-
-nooptions  SMP
-nooptions  MAXCPU
-
 nooptions  COMPAT_FREEBSD4
 nooptions  COMPAT_FREEBSD5
 nooptions  COMPAT_FREEBSD6
 nooptions  COMPAT_FREEBSD7
 nooptions  COMPAT_FREEBSD9
-nooption   PPC_PROBE_CHIPSET
+nooptions  PPC_PROBE_CHIPSET
+nooptions  MAXCPU  # value is set in machine/param.h
 
+# Devices in sys/conf/NOTES for which no such hardware exists on arm,
+# or the drivers don't compile...
+
 nodevice   fdc
 nodevice   sym
-nodevice   ukbd
 
 nodevice   sc
 nodevice   blank_saver
@@ -58,24 +36,9 @@ nodevice cxgbe
 nodevice   cxgbev
 nodevice   snd_cmi
 
-#
-# Enable the kernel DTrace hooks which are required to load the DTrace
-# kernel modules.
-#
-optionsKDTRACE_HOOKS
+nodevice   mpr
+nodevice   mps
 
-# DTrace core
-# NOTE: introduces CDDL-licensed components into the kernel
-#devicedtrace
+# Add devices which are specific to various arm platforms...
 
-# DTrace modules
-#devicedtrace_profile
-#devicedtrace_sdt
-#devicedtrace_fbt
-#devicedtrace_systrace
-#devicedtrace_prototype
-#devicedtnfscl
-#devicedtmalloc
-
-# Alternatively include all the DTrace modules
-#devicedtraceall
+device twsi# i2c controller on Marvel and Allwinner

Copied: stable/12/sys/arm/conf/NOTES.armv5 (from r349327, 
head/sys/arm/conf/NOTES.armv5)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/arm/conf/NOTES.armv5  Sun Aug 11 20:50:41 2019
(r350867, copy of r349327, head/sys/arm/conf/NOTES.armv5)
@@ -0,0 +1,38 @@
+# armv5-specific changes for doing a LINT build.
+#
+# The contents of sys/conf/NOTES, sys/arm/conf/NOTES, and this file are
+# concatenated (in that order) to create the LINT-V5 kernel config file.
+#
+# $FreeBSD$
+
+#NO_UNIVERSE  
+
+machinearm arm
+cpuCPU_ARM9E
+
+files  "../mv/files.mv"
+files  "../mv/discovery/files.db78xxx"
+files  "../mv/kirkwood/files.kirkwood"
+files  "../mv/orion/files.db88f5xxx"
+files  "../mv/orion/files.ts7800"
+
+makeoptionsCONF_CFLAGS+="-march=armv5te"
+makeoptionsLDFLAGS="-zmuldefs"
+makeoptionsKERNPHYSADDR=0x
+
+# Undo options from sys/conf/NOTES that we do not want...
+
+nooptions  SMP # All armv5 are single-core
+
+# Add options for armv5 that are not in sys/conf/NOTES...
+
+optionsARM_MANY_BOARD
+
+optionsSOC_MV_DISCOVERY
+optionsSOC_MV_KIRKWOOD
+optionsSOC_MV_ORION
+
+# Add devices which are specific to various arm platforms...
+
+device nand
+

Copied: 

<    1   2   3   4   5   6   7   8   9   10   >