Re: svn commit: r362420 - head/share/misc

2020-06-19 Thread Alexey Dokuchaev
On Sat, Jun 20, 2020 at 04:07:44AM +, Warner Losh wrote:
> New Revision: 362420
> URL: https://svnweb.freebsd.org/changeset/base/362420
> 
> Log:
>   Correct 1BSD release date.
>   
>   The Quarter Century of Unix book said that 1BSD was released March 1979.
>   However, the 1BSD tape image that's on Kirk's historical unix collection
>   has an earlier date.
>   
>   It was common practice, at the time, to create a new copy of the tape
>   from the master system
 ^^
Ouch! :-)

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


svn commit: r362422 - head/sbin/dump

2020-06-19 Thread Warner Losh
Author: imp
Date: Sat Jun 20 04:19:17 2020
New Revision: 362422
URL: https://svnweb.freebsd.org/changeset/base/362422

Log:
  Increase the whimsy in this file by famring dump's work out to minions. Adjust
  variables accordingly. Thankfully, we are able to do this without additional
  banana expenditures.

Modified:
  head/sbin/dump/tape.c

Modified: head/sbin/dump/tape.c
==
--- head/sbin/dump/tape.c   Sat Jun 20 04:07:58 2020(r362421)
+++ head/sbin/dump/tape.c   Sat Jun 20 04:19:17 2020(r362422)
@@ -75,19 +75,19 @@ static  char *nexttape;
 static FILE *popenfp = NULL;
 
 static int atomic(ssize_t (*)(), int, char *, int);
-static void doslave(int, int);
-static void enslave(void);
+static void dominion(int, int);
+static void enminion(void);
 static void flushtape(void);
 static void killall(void);
 static void rollforward(void);
 
 /*
  * Concurrent dump mods (Caltech) - disk block reading and tape writing
- * are exported to several slave processes.  While one slave writes the
+ * are exported to several minion processes.  While one minion writes the
  * tape, the others read disk blocks; they pass control of the tape in
  * a ring via signals. The parent process traverses the file system and
- * sends writeheader()'s and lists of daddr's to the slaves via pipes.
- * The following structure defines the instruction packets sent to slaves.
+ * sends writeheader()'s and lists of daddr's to the minions via pipes.
+ * The following structure defines the instruction packets sent to minions.
  */
 struct req {
ufs2_daddr_t dblk;
@@ -95,20 +95,20 @@ struct req {
 };
 static int reqsiz;
 
-#define SLAVES 3   /* 1 slave writing, 1 reading, 1 for slack */
-static struct slave {
+#define MINIONS 3  /* 1 minion writing, 1 reading, 1 for slack */
+static struct minion {
int64_t tapea;  /* header number at start of this chunk */
int64_t firstrec;   /* record number of this block */
int count;  /* count to next header (used for TS_TAPE */
/* after EOT) */
int inode;  /* inode that we are currently dealing with */
-   int fd; /* FD for this slave */
-   int pid;/* PID for this slave */
-   int sent;   /* 1 == we've sent this slave requests */
+   int fd; /* FD for this minion */
+   int pid;/* PID for this minion */
+   int sent;   /* 1 == we've sent this minion requests */
char (*tblock)[TP_BSIZE]; /* buffer for data blocks */
struct req *req;/* buffer for requests */
-} slaves[SLAVES+1];
-static struct slave *slp;
+} minions[MINIONS+1];
+static struct minion *mlp;
 
 static char(*nextblock)[TP_BSIZE];
 
@@ -116,9 +116,9 @@ static int master;  /* pid of master, for sending error
 static int tenths; /* length of tape used per block written */
 static volatile sig_atomic_t caught; /* have we caught the signal to proceed? 
*/
 static volatile sig_atomic_t ready; /* reached the lock point without having */
-   /* received the SIGUSR2 signal from the prev slave? */
+   /* received the SIGUSR2 signal from the prev minion? */
 static jmp_buf jmpbuf; /* where to jump to if we are ready when the */
-   /* SIGUSR2 arrives from the previous slave */
+   /* SIGUSR2 arrives from the previous minion */
 
 int
 alloctape(void)
@@ -143,20 +143,20 @@ alloctape(void)
 * packets, so flushtape() can write them together with one write().
 * Align tape buffer on page boundary to speed up tape write().
 */
-   for (i = 0; i <= SLAVES; i++) {
+   for (i = 0; i <= MINIONS; i++) {
buf = (char *)
malloc((unsigned)(reqsiz + writesize + pgoff + TP_BSIZE));
if (buf == NULL)
return(0);
-   slaves[i].tblock = (char (*)[TP_BSIZE])
+   minions[i].tblock = (char (*)[TP_BSIZE])
(((long)[ntrec + 1] + pgoff) &~ pgoff);
-   slaves[i].req = (struct req *)slaves[i].tblock - ntrec - 1;
+   minions[i].req = (struct req *)minions[i].tblock - ntrec - 1;
}
-   slp = [0];
-   slp->count = 1;
-   slp->tapea = 0;
-   slp->firstrec = 0;
-   nextblock = slp->tblock;
+   mlp = [0];
+   mlp->count = 1;
+   mlp->tapea = 0;
+   mlp->firstrec = 0;
+   nextblock = mlp->tblock;
return(1);
 }
 
@@ -164,8 +164,8 @@ void
 writerec(char *dp, int isspcl)
 {
 
-   slp->req[trecno].dblk = (ufs2_daddr_t)0;
-   slp->req[trecno].count = 1;
+   mlp->req[trecno].dblk = (ufs2_daddr_t)0;
+   mlp->req[trecno].count = 1;
/* Can't do a structure assignment due to alignment problems */
 

svn commit: r362419 - head/sys/cam

2020-06-19 Thread Warner Losh
Author: imp
Date: Sat Jun 20 04:07:23 2020
New Revision: 362419
URL: https://svnweb.freebsd.org/changeset/base/362419

Log:
  Use the more descriptive src_ccb and dst_ccb for the two ccbs being merged.
  
  MFC after: 1 week

Modified:
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt.h

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Fri Jun 19 23:32:40 2020(r362418)
+++ head/sys/cam/cam_xpt.c  Sat Jun 20 04:07:23 2020(r362419)
@@ -3526,22 +3526,22 @@ xpt_run_devq(struct cam_devq *devq)
 }
 
 /*
- * This function merges stuff from the slave ccb into the master ccb, while
- * keeping important fields in the master ccb constant.
+ * This function merges stuff from the src ccb into the dst ccb, while keeping
+ * important fields in the dst ccb constant.
  */
 void
-xpt_merge_ccb(union ccb *master_ccb, union ccb *slave_ccb)
+xpt_merge_ccb(union ccb *dst_ccb, union ccb *src_ccb)
 {
 
/*
 * Pull fields that are valid for peripheral drivers to set
-* into the master CCB along with the CCB "payload".
+* into the dst CCB along with the CCB "payload".
 */
-   master_ccb->ccb_h.retry_count = slave_ccb->ccb_h.retry_count;
-   master_ccb->ccb_h.func_code = slave_ccb->ccb_h.func_code;
-   master_ccb->ccb_h.timeout = slave_ccb->ccb_h.timeout;
-   master_ccb->ccb_h.flags = slave_ccb->ccb_h.flags;
-   bcopy(&(_ccb->ccb_h)[1], &(_ccb->ccb_h)[1],
+   dst_ccb->ccb_h.retry_count = src_ccb->ccb_h.retry_count;
+   dst_ccb->ccb_h.func_code = src_ccb->ccb_h.func_code;
+   dst_ccb->ccb_h.timeout = src_ccb->ccb_h.timeout;
+   dst_ccb->ccb_h.flags = src_ccb->ccb_h.flags;
+   bcopy(&(_ccb->ccb_h)[1], &(_ccb->ccb_h)[1],
  sizeof(union ccb) - sizeof(struct ccb_hdr));
 }
 

Modified: head/sys/cam/cam_xpt.h
==
--- head/sys/cam/cam_xpt.h  Fri Jun 19 23:32:40 2020(r362418)
+++ head/sys/cam/cam_xpt.h  Sat Jun 20 04:07:23 2020(r362419)
@@ -86,8 +86,8 @@ void  xpt_setup_ccb_flags(struct ccb_hdr 
*ccb_h,
 void   xpt_setup_ccb(struct ccb_hdr *ccb_h,
  struct cam_path *path,
  u_int32_t priority);
-void   xpt_merge_ccb(union ccb *master_ccb,
- union ccb *slave_ccb);
+void   xpt_merge_ccb(union ccb *dst_ccb,
+ union ccb *src_ccb);
 cam_status xpt_create_path(struct cam_path **new_path_ptr,
struct cam_periph *perph,
path_id_t path_id,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362420 - head/share/misc

2020-06-19 Thread Warner Losh
Author: imp
Date: Sat Jun 20 04:07:44 2020
New Revision: 362420
URL: https://svnweb.freebsd.org/changeset/base/362420

Log:
  Correct 1BSD release date.
  
  The Quarter Century of Unix book said that 1BSD was released March 1979.
  However, the 1BSD tape image that's on Kirk's historical unix collection has 
an
  earlier date.
  
  It was common practice, at the time, to create a new copy of the tape from the
  master system when a new tape was to go out, so several different versions of
  1BSD, etc were shipped from Berkerely. The date on the 1BSD tape in the 
Berkeley
  archives on Kirk's DVD is dated in January 16 1979 on the label, and has dates
  as late as Jan 29 (there's an UPDATE file that says this includes updates
  through this date). Note this date as well.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Sat Jun 20 04:07:23 2020
(r362419)
+++ head/share/misc/bsd-family-tree Sat Jun 20 04:07:44 2020
(r362420)
@@ -477,6 +477,7 @@ Ninth   Edition 1986-09-xx [QCU]
 Tenth   Edition 1989-10-xx [QCU]
 
 1BSDlate 1977
+   1978-01-16 [DOC]
1978-03-09 [QCU]
PDP-11, Pascal, ex(1)
30 free copies of 1BSD sent out
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Kyle Evans
Author: kevans
Date: Sat Jun 20 04:07:58 2020
New Revision: 362421
URL: https://svnweb.freebsd.org/changeset/base/362421

Log:
  raspberry pi 4: cpufreq support
  
  The submitter notes that the bcm2835_cpufreq driver really just needs the
  rpi4 compat string added to it; powerd subsequently works and the dev.cpu.0
  sysctl values look sane and can be successfully manipulated.
  
  Submitted by: James Mintram 
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D25349

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

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sat Jun 20 04:07:44 
2020(r362420)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Sat Jun 20 04:07:58 
2020(r362421)
@@ -129,6 +129,7 @@ static struct ofw_compat_data compat_data[] = {
{ "brcm,bcm2835",   1 },
{ "brcm,bcm2836",   1 },
{ "brcm,bcm2837",   1 },
+   { "brcm,bcm2711",   1 },
{ NULL, 0 }
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362418 - head/usr.sbin/makefs/ffs

2020-06-19 Thread Kirk McKusick
Author: mckusick
Date: Fri Jun 19 23:32:40 2020
New Revision: 362418
URL: https://svnweb.freebsd.org/changeset/base/362418

Log:
  Allocate an fs_summary_info structure when creating a UFS filesystem
  needed since introduced in -r362358.
  
  PR:   247425
  Sponsored by: Netflix

Modified:
  head/usr.sbin/makefs/ffs/mkfs.c

Modified: head/usr.sbin/makefs/ffs/mkfs.c
==
--- head/usr.sbin/makefs/ffs/mkfs.c Fri Jun 19 19:33:19 2020
(r362417)
+++ head/usr.sbin/makefs/ffs/mkfs.c Fri Jun 19 23:32:40 2020
(r362418)
@@ -408,6 +408,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, tim
if (sblock.fs_contigsumsize > 0)
size += sblock.fs_ncg * sizeof(int32_t);
space = ecalloc(1, size);
+   sblock.fs_si = ecalloc(1, sizeof(struct fs_summary_info));
sblock.fs_csp = space;
space = (char *)space + sblock.fs_cssize;
if (sblock.fs_contigsumsize > 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Alexey Dokuchaev
On Fri, Jun 19, 2020 at 06:04:41PM +, Michal Meloun wrote:
> New Revision: 362399
> URL: https://svnweb.freebsd.org/changeset/base/362399
> 
> Log:
>   Use naming nomenclature used in DesignWare TRM.
>   Use naming nomenclature used in DesignWare TRM.

Please trim repeated lines from the commit logs.  It breaks reading
prefetch and thus makes it rather annoying.

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


svn commit: r362416 - head/sys/compat/linux

2020-06-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jun 19 19:33:06 2020
New Revision: 362416
URL: https://svnweb.freebsd.org/changeset/base/362416

Log:
  Add warnings for unsupported Linux clockids.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25322

Modified:
  head/sys/compat/linux/linux_time.c

Modified: head/sys/compat/linux/linux_time.c
==
--- head/sys/compat/linux/linux_time.c  Fri Jun 19 19:26:55 2020
(r362415)
+++ head/sys/compat/linux/linux_time.c  Fri Jun 19 19:33:06 2020
(r362416)
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/0
 #include 
 #include 
 #include 
+#include 
 
 /* DTrace init */
 LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
@@ -268,6 +269,8 @@ linux_clock_gettime(struct thread *td, struct linux_cl
 
error = linux_to_native_clockid(, args->which);
if (error != 0) {
+   linux_msg(curthread,
+   "unsupported clock_gettime clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_gettime, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
@@ -399,6 +402,8 @@ linux_clock_settime(struct thread *td, struct linux_cl
 
error = linux_to_native_clockid(, args->which);
if (error != 0) {
+   linux_msg(curthread,
+   "unsupported clock_settime clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
@@ -441,6 +446,8 @@ linux_clock_getres(struct thread *td, struct linux_clo
 
error = linux_to_native_clockid(, args->which);
if (error != 0) {
+   linux_msg(curthread,
+   "unsupported clock_getres clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error,
error);
LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
@@ -600,6 +607,8 @@ linux_clock_nanosleep(struct thread *td, struct linux_
 
error = linux_to_native_clockid(, args->which);
if (error != 0) {
+   linux_msg(curthread,
+   "unsupported clock_nanosleep clockid %d", args->which);
LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid,
args->which);
LIN_SDT_PROBE1(time, linux_clock_settime, return, error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362415 - head/sys/dev/dwc

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 19:26:55 2020
New Revision: 362415
URL: https://svnweb.freebsd.org/changeset/base/362415

Log:
  Improve if_dwc:
   - refactorize packet receive path. Make sure that we don't leak mbufs
 and/or that we don't create holes in RX descriptor ring
   - slightly simplify handling with TX descriptors
  
  MFC after:4 weeks

Modified:
  head/sys/dev/dwc/if_dwc.c
  head/sys/dev/dwc/if_dwcvar.h

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Jun 19 19:25:47 2020(r362414)
+++ head/sys/dev/dwc/if_dwc.c   Fri Jun 19 19:26:55 2020(r362415)
@@ -235,45 +235,39 @@ dwc_get1paddr(void *arg, bus_dma_segment_t *segs, int 
*(bus_addr_t *)arg = segs[0].ds_addr;
 }
 
-inline static uint32_t
+inline static void
 dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr,
 uint32_t len)
 {
-   uint32_t flags;
-   uint32_t nidx;
+   uint32_t desc0, desc1;
 
-   nidx = next_txidx(sc, idx);
-
/* Addr/len 0 means we're clearing the descriptor after xmit done. */
if (paddr == 0 || len == 0) {
-   flags = 0;
+   desc0 = 0;
+   desc1 = 0;
--sc->txcount;
} else {
-   if (sc->mactype != DWC_GMAC_EXT_DESC)
-   flags = NTDESC1_TCH | NTDESC1_FS
-   | NTDESC1_LS | NTDESC1_IC;
-   else
-   flags = ETDESC0_TCH | ETDESC0_FS | ETDESC0_LS |
-   ETDESC0_IC;
+   if (sc->mactype != DWC_GMAC_EXT_DESC) {
+   desc0 = 0;
+   desc1 = NTDESC1_TCH | NTDESC1_FS | NTDESC1_LS |
+   NTDESC1_IC | len;
+   } else {
+   desc0 = ETDESC0_TCH | ETDESC0_FS | ETDESC0_LS |
+   ETDESC0_IC;
+   desc1 = len;
+   }
++sc->txcount;
}
 
sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr);
-   if (sc->mactype != DWC_GMAC_EXT_DESC) {
-   sc->txdesc_ring[idx].desc0 = 0;
-   sc->txdesc_ring[idx].desc1 = flags | len;
-   } else {
-   sc->txdesc_ring[idx].desc0 = flags;
-   sc->txdesc_ring[idx].desc1 = len;
-   }
+   sc->txdesc_ring[idx].desc0 = desc0;
+   sc->txdesc_ring[idx].desc1 = desc1;
 
if (paddr && len) {
wmb();
sc->txdesc_ring[idx].desc0 |= TDESC0_OWN;
wmb();
}
-
-   return (nidx);
 }
 
 static int
@@ -528,6 +522,7 @@ dwc_init(void *if_softc)
DWC_UNLOCK(sc);
 }
 
+
 inline static uint32_t
 dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_addr_t paddr)
 {
@@ -538,14 +533,15 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad
sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr +
(nidx * sizeof(struct dwc_hwdesc));
if (sc->mactype != DWC_GMAC_EXT_DESC)
-   sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | RX_MAX_PACKET;
+   sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH |
+   MIN(MCLBYTES, NRDESC1_RBS1_MASK);
else
-   sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | MCLBYTES;
+   sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH |
+   MIN(MCLBYTES, ERDESC1_RBS1_MASK);
 
wmb();
sc->rxdesc_ring[idx].desc0 = RDESC0_OWN;
wmb();
-
return (nidx);
 }
 
@@ -585,6 +581,74 @@ dwc_alloc_mbufcl(struct dwc_softc *sc)
return (m);
 }
 
+static struct mbuf *
+dwc_rxfinish_one(struct dwc_softc *sc, struct dwc_hwdesc *desc,
+struct dwc_bufmap *map)
+{
+   struct ifnet *ifp;
+   struct mbuf *m, *m0;
+   int len;
+   uint32_t rdesc0;
+
+   m = map->mbuf;
+   ifp = sc->ifp;
+   rdesc0 = desc ->desc0;
+   /* Validate descriptor. */
+   if (rdesc0 & RDESC0_ES) {
+   /*
+* Errored packet. Statistic counters are updated
+* globally, so do nothing
+*/
+   return (NULL);
+   }
+
+   if ((rdesc0 & (RDESC0_FS | RDESC0_LS)) !=
+   (RDESC0_FS | RDESC0_LS)) {
+   /*
+* Something very wrong happens. The whole packet should be
+* recevied in one descriptr. Report problem.
+*/
+   device_printf(sc->dev,
+   "%s: RX descriptor without FIRST and LAST bit set: 0x%08X",
+   __func__, rdesc0);
+   return (NULL);
+   }
+
+   len = (rdesc0 >> RDESC0_FL_SHIFT) & RDESC0_FL_MASK;
+   if (len < 64) {
+   /*
+* Lenght is invalid, recycle old mbuf
+* Probably impossible case
+*/
+   return (NULL);
+   }
+
+   /* Allocate new buffer */
+   m0 

svn commit: r362412 - head/sbin/md5

2020-06-19 Thread Allan Jude
Author: allanjude
Date: Fri Jun 19 19:16:25 2020
New Revision: 362412
URL: https://svnweb.freebsd.org/changeset/base/362412

Log:
  md5(1): fix -c flag to work with input on stdin
  
  Previously, the -p and -c flags were ignored when reading from stdin
  Additionally, -s and -c can be used together now.
  
  PR:   247295
  Reviewed by:  kevans
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: Klara Inc.
  Differential Revision:https://reviews.freebsd.org/D25362

Modified:
  head/sbin/md5/md5.c

Modified: head/sbin/md5/md5.c
==
--- head/sbin/md5/md5.c Fri Jun 19 18:54:55 2020(r362411)
+++ head/sbin/md5/md5.c Fri Jun 19 19:16:25 2020(r362412)
@@ -52,11 +52,14 @@ __FBSDID("$FreeBSD$");
 #define TEST_BLOCK_COUNT 10
 #define MDTESTCOUNT 8
 
+static int pflag;
 static int qflag;
 static int rflag;
 static int sflag;
+static int skip;
 static char* checkAgainst;
 static int checksFailed;
+static int failed;
 
 typedef void (DIGEST_Init)(void *);
 typedef void (DIGEST_Update)(void *, const unsigned char *, size_t);
@@ -86,10 +89,10 @@ typedef struct Algorithm_t {
 } Algorithm_t;
 
 static void MD5_Update(MD5_CTX *, const unsigned char *, size_t);
-static void MDString(const Algorithm_t *, const char *);
+static void MDOutput(const Algorithm_t *, char *, char **);
 static void MDTimeTrial(const Algorithm_t *);
 static void MDTestSuite(const Algorithm_t *);
-static void MDFilter(const Algorithm_t *, int);
+static char *MDFilter(const Algorithm_t *, char*, int);
 static void usage(const Algorithm_t *);
 
 typedef union {
@@ -170,9 +173,9 @@ main(int argc, char *argv[])
cap_rights_trights;
 #endif
int ch, fd;
-   char   *p;
+   char   *p, *string;
charbuf[HEX_DIGEST_LENGTH];
-   int failed;
+   size_t  len;
unsigneddigest;
const char* progname;
 
@@ -191,13 +194,14 @@ main(int argc, char *argv[])
failed = 0;
checkAgainst = NULL;
checksFailed = 0;
+   skip = 0;
while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1)
switch (ch) {
case 'c':
checkAgainst = optarg;
break;
case 'p':
-   MDFilter([digest], 1);
+   pflag = 1;
break;
case 'q':
qflag = 1;
@@ -207,13 +211,15 @@ main(int argc, char *argv[])
break;
case 's':
sflag = 1;
-   MDString([digest], optarg);
+   string = optarg;
break;
case 't':
MDTimeTrial([digest]);
+   skip = 1;
break;
case 'x':
MDTestSuite([digest]);
+   skip = 1;
break;
default:
usage([digest]);
@@ -249,32 +255,19 @@ main(int argc, char *argv[])
}
p = Algorithm[digest].Fd(fd, buf);
(void)close(fd);
-   if (p == NULL) {
-   warn("%s", *argv);
-   failed++;
-   } else {
-   if (qflag)
-   printf("%s", p);
-   else if (rflag)
-   printf("%s %s", p, *argv);
-   else
-   printf("%s (%s) = %s",
-   Algorithm[digest].name, *argv, p);
-   if (checkAgainst && strcasecmp(checkAgainst, p) 
!= 0)
-   {
-   checksFailed++;
-   if (!qflag)
-   printf(" [ Failed ]");
-   }
-   printf("\n");
-   }
+   MDOutput([digest], p, argv);
} while (*++argv);
-   } else if (!sflag && (optind == 1 || qflag || rflag)) {
+   } else if (!sflag && !skip) {
 #ifdef HAVE_CAPSICUM
if (caph_limit_stdin() < 0 || caph_enter() < 0)
err(1, "capsicum");
 #endif
-   MDFilter([digest], 0);
+   p = MDFilter([digest], (char *), pflag);
+   MDOutput([digest], p, NULL);
+   } else if (sflag) {
+   len = strlen(string);
+   p = Algorithm[digest].Data(string, len, buf);
+   MDOutput([digest], p, );
}
 
if (failed != 0)
@@ -284,30 +277,38 @@ main(int argc, char *argv[])
 
   

svn commit: r362409 - head/sys/powerpc/conf

2020-06-19 Thread Brandon Bergren
Author: bdragon
Date: Fri Jun 19 18:43:13 2020
New Revision: 362409
URL: https://svnweb.freebsd.org/changeset/base/362409

Log:
  [PowerPC] Add virtio to GENERIC
  
  Due to kldxref not being able to generate hints for nonnative platforms,
  any cross built VM images do not have /boot/kernel/linker.hints.
  
  This prevents the virtio modules from being loaded, as the fallback code
  will always fail the version check when the hints are missing.
  
  Since we want to be able to generate VM images for 32 bit powerpc, add the
  virtio modules to GENERIC like we do on powerpc64.
  
  Reviewed by:  jhibbits
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:https://reviews.freebsd.org/D25271

Modified:
  head/sys/powerpc/conf/GENERIC

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Fri Jun 19 18:43:02 2020
(r362408)
+++ head/sys/powerpc/conf/GENERIC   Fri Jun 19 18:43:13 2020
(r362409)
@@ -230,3 +230,12 @@ device snd_uaudio  # USB Audio
 optionsEVDEV_SUPPORT   # evdev support in legacy drivers
 device evdev   # input event device support
 device uinput  # install /dev/uinput cdev
+
+# VirtIO support
+device virtio  # Generic VirtIO bus (required)
+device virtio_pci  # VirtIO PCI device
+device vtnet   # VirtIO Ethernet device
+device virtio_blk  # VirtIO Block device
+device virtio_scsi # VirtIO SCSI device
+device virtio_balloon  # VirtIO Memory Balloon device
+
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362407 - in head/sys/powerpc: booke include

2020-06-19 Thread Brandon Bergren
Author: bdragon
Date: Fri Jun 19 18:40:39 2020
New Revision: 362407
URL: https://svnweb.freebsd.org/changeset/base/362407

Log:
  [PowerPC] Fix booke64 qemu infinite loop in L2 cache enable
  
  Since qemu does not implement the L2 cache, we get stuck forever waiting
  for a bit to be set when trying to invalidate it.
  
  To prevent that, we should bail out if the L2 cache is missing.
  One easy way to check this is L2CFG0 == 0 (since L2CSIZE always has at
  least one bit set in a valid implementation)
  
  (tested on qemu, rb800, and x5000)
  
  Reviewed by:  jhibbits
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:https://reviews.freebsd.org/D25225

Modified:
  head/sys/powerpc/booke/machdep_e500.c
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/booke/machdep_e500.c
==
--- head/sys/powerpc/booke/machdep_e500.c   Fri Jun 19 18:36:10 2020
(r362406)
+++ head/sys/powerpc/booke/machdep_e500.c   Fri Jun 19 18:40:39 2020
(r362407)
@@ -91,7 +91,17 @@ booke_enable_l2_cache(void)
if mfpvr() >> 16) & 0x) == FSL_E500mc) ||
(((mfpvr() >> 16) & 0x) == FSL_E5500)) {
csr = mfspr(SPR_L2CSR0);
-   if ((csr & L2CSR0_L2E) == 0) {
+   /*
+* Don't actually attempt to manipulate the L2 cache if
+* L2CFG0 is zero.
+*
+* Any chip with a working L2 cache will have a nonzero
+* L2CFG0, as it will have a nonzero L2CSIZE field.
+*
+* This fixes waiting forever for cache enable in qemu,
+* which does not implement the L2 cache.
+*/
+   if (mfspr(SPR_L2CFG0) != 0 && (csr & L2CSR0_L2E) == 0) {
l2cache_inval();
l2cache_enable();
}

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Fri Jun 19 18:36:10 2020
(r362406)
+++ head/sys/powerpc/include/spr.h  Fri Jun 19 18:40:39 2020
(r362407)
@@ -887,6 +887,7 @@
 #define  L1CSR1_ICFI   0x0002  /* Instruction Cache 
Flash Invalidate */
 #define  L1CSR1_ICE0x0001  /* Instruction Cache 
Enable */
 
+#defineSPR_L2CFG0  0x207   /* ..8 L2 Configuration 
Register 0 */
 #defineSPR_L2CSR0  0x3F9   /* ..8 L2 Cache Control and 
Status Register 0 */
 #define  L2CSR0_L2E0x8000  /* L2 Cache Enable */
 #define  L2CSR0_L2PE   0x4000  /* L2 Cache Parity 
Enable */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362406 - in head: share/man/man4/man4.powerpc sys/dev/powermac_nvram usr.sbin/nvram

2020-06-19 Thread Brandon Bergren
Author: bdragon
Date: Fri Jun 19 18:36:10 2020
New Revision: 362406
URL: https://svnweb.freebsd.org/changeset/base/362406

Log:
  [PowerPC] De-giant powermac_nvram, update documentation
  
  * Remove the giant lock requirement from powermac_nvram.
  * Update manual pages to reflect current state.
  
  Reviewed by:  bcr (manpages), jhibbits
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:https://reviews.freebsd.org/D24812

Modified:
  head/share/man/man4/man4.powerpc/powermac_nvram.4
  head/sys/dev/powermac_nvram/powermac_nvram.c
  head/sys/dev/powermac_nvram/powermac_nvramvar.h
  head/usr.sbin/nvram/nvram.8

Modified: head/share/man/man4/man4.powerpc/powermac_nvram.4
==
--- head/share/man/man4/man4.powerpc/powermac_nvram.4   Fri Jun 19 18:34:27 
2020(r362405)
+++ head/share/man/man4/man4.powerpc/powermac_nvram.4   Fri Jun 19 18:36:10 
2020(r362406)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 5, 2010
+.Dd June 19, 2020
 .Dt POWERMAC_NVRAM 4 powerpc
 .Os
 .Sh NAME
@@ -50,8 +50,10 @@ The
 .Nm
 driver provides access to the Open Firmware configuration NVRAM
 available on the Apple PowerPC-based machines.
+.Pp
+This driver currently supports "Core99" machines containing a Sharp, Micron,
+or AMD NVRAM.
 .Sh SEE ALSO
-.Xr eeprom 8 ,
 .Xr nvram 8
 .Sh HISTORY
 The

Modified: head/sys/dev/powermac_nvram/powermac_nvram.c
==
--- head/sys/dev/powermac_nvram/powermac_nvram.cFri Jun 19 18:34:27 
2020(r362405)
+++ head/sys/dev/powermac_nvram/powermac_nvram.cFri Jun 19 18:36:10 
2020(r362406)
@@ -34,6 +34,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -99,7 +101,6 @@ static   d_write_t   powermac_nvram_write;
 
 static struct cdevsw powermac_nvram_cdevsw = {
.d_version =D_VERSION,
-   .d_flags =  D_NEEDGIANT,
.d_open =   powermac_nvram_open,
.d_close =  powermac_nvram_close,
.d_read =   powermac_nvram_read,
@@ -180,6 +181,8 @@ powermac_nvram_attach(device_t dev)
"powermac_nvram");
sc->sc_cdev->si_drv1 = sc;
 
+   sx_init(>sc_lock, "powermac_nvram");
+
return 0;
 }
 
@@ -195,6 +198,8 @@ powermac_nvram_detach(device_t dev)
 
if (sc->sc_cdev != NULL)
destroy_dev(sc->sc_cdev);
+
+   sx_destroy(>sc_lock);

return 0;
 }
@@ -203,11 +208,17 @@ static int
 powermac_nvram_open(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
struct powermac_nvram_softc *sc = dev->si_drv1;
+   int err;
 
+   err = 0;
+   sx_xlock(>sc_lock);
if (sc->sc_isopen)
-   return EBUSY;
-   sc->sc_isopen = 1;
+   err = EBUSY;
+   else
+   sc->sc_isopen = 1;
sc->sc_rpos = sc->sc_wpos = 0;
+   sx_xunlock(>sc_lock);
+
return 0;
 }
 
@@ -218,10 +229,12 @@ powermac_nvram_close(struct cdev *dev, int fflag, int 
struct core99_header *header;
vm_offset_t bank;
 
+   sx_xlock(>sc_lock);
if (sc->sc_wpos != sizeof(sc->sc_data)) {
/* Short write, restore in-memory copy */
bcopy((void *)sc->sc_bank, (void *)sc->sc_data, NVRAM_SIZE);
sc->sc_isopen = 0;
+   sx_xunlock(>sc_lock);
return 0;
}
 
@@ -242,10 +255,12 @@ powermac_nvram_close(struct cdev *dev, int fflag, int 
if (erase_bank(sc->sc_dev, (uint8_t *)bank) != 0 ||
write_bank(sc->sc_dev, (uint8_t *)bank, sc->sc_data) != 0) {
sc->sc_isopen = 0;
+   sx_xunlock(>sc_lock);
return ENOSPC;
}
sc->sc_bank = bank;
sc->sc_isopen = 0;
+   sx_xunlock(>sc_lock);
return 0;
 }
 
@@ -256,6 +271,8 @@ powermac_nvram_read(struct cdev *dev, struct uio *uio,
struct powermac_nvram_softc *sc = dev->si_drv1;
 
rv = 0;
+
+   sx_xlock(>sc_lock);
while (uio->uio_resid > 0) {
data_available = sizeof(sc->sc_data) - sc->sc_rpos;
if (data_available > 0) {
@@ -269,6 +286,8 @@ powermac_nvram_read(struct cdev *dev, struct uio *uio,
break;
}
}
+   sx_xunlock(>sc_lock);
+
return rv;
 }
 
@@ -282,6 +301,8 @@ powermac_nvram_write(struct cdev *dev, struct uio *uio
return EINVAL;
 
rv = 0;
+
+   sx_xlock(>sc_lock);
while (uio->uio_resid > 0) {
data_available = sizeof(sc->sc_data) - sc->sc_wpos;
if (data_available > 0) {
@@ -295,6 +316,8 @@ powermac_nvram_write(struct cdev *dev, struct uio *uio
break;
}
}
+   sx_xunlock(>sc_lock);
+
return rv;
 }
 
@@ -500,6 +523,8 @@ erase_bank(device_t dev, 

svn commit: r362405 - in head/sys: arm/allwinner arm/amlogic/aml8726 arm64/rockchip dev/altera/dwc dev/dwc

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 18:34:27 2020
New Revision: 362405
URL: https://svnweb.freebsd.org/changeset/base/362405

Log:
  Finish renaming in if_dwc.
  By using DWC TRM terminology, normal descriptor format should be named
  extended and alternate descriptor format should be named normal.
  
  Should not been functional change.
  
  MFC after:4 weeks

Modified:
  head/sys/arm/allwinner/aw_if_dwc.c
  head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c
  head/sys/arm64/rockchip/if_dwc_rk.c
  head/sys/dev/altera/dwc/if_dwc_socfpga.c
  head/sys/dev/dwc/if_dwc.c
  head/sys/dev/dwc/if_dwc.h
  head/sys/dev/dwc/if_dwc_if.m

Modified: head/sys/arm/allwinner/aw_if_dwc.c
==
--- head/sys/arm/allwinner/aw_if_dwc.c  Fri Jun 19 18:27:22 2020
(r362404)
+++ head/sys/arm/allwinner/aw_if_dwc.c  Fri Jun 19 18:34:27 2020
(r362405)
@@ -114,7 +114,7 @@ static int
 a20_if_dwc_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC_ALT_DESC);
+   return (DWC_GMAC_NORMAL_DESC);
 }
 
 static int

Modified: head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c   Fri Jun 19 18:27:22 
2020(r362404)
+++ head/sys/arm/amlogic/aml8726/aml8726_if_dwc.c   Fri Jun 19 18:34:27 
2020(r362405)
@@ -66,7 +66,7 @@ static int
 aml8726_if_dwc_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC_ALT_DESC);
+   return (DWC_GMAC_NORMAL_DESC);
 }
 
 static int

Modified: head/sys/arm64/rockchip/if_dwc_rk.c
==
--- head/sys/arm64/rockchip/if_dwc_rk.c Fri Jun 19 18:27:22 2020
(r362404)
+++ head/sys/arm64/rockchip/if_dwc_rk.c Fri Jun 19 18:34:27 2020
(r362405)
@@ -160,7 +160,7 @@ static int
 if_dwc_rk_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC_ALT_DESC);
+   return (DWC_GMAC_NORMAL_DESC);
 }
 
 static int

Modified: head/sys/dev/altera/dwc/if_dwc_socfpga.c
==
--- head/sys/dev/altera/dwc/if_dwc_socfpga.cFri Jun 19 18:27:22 2020
(r362404)
+++ head/sys/dev/altera/dwc/if_dwc_socfpga.cFri Jun 19 18:34:27 2020
(r362405)
@@ -74,7 +74,7 @@ static int
 if_dwc_socfpga_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC);
+   return (DWC_GMAC_EXT_DESC);
 }
 
 static int

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Jun 19 18:27:22 2020(r362404)
+++ head/sys/dev/dwc/if_dwc.c   Fri Jun 19 18:34:27 2020(r362405)
@@ -249,7 +249,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_ad
flags = 0;
--sc->txcount;
} else {
-   if (sc->mactype == DWC_GMAC_ALT_DESC)
+   if (sc->mactype != DWC_GMAC_EXT_DESC)
flags = NTDESC1_TCH | NTDESC1_FS
| NTDESC1_LS | NTDESC1_IC;
else
@@ -259,7 +259,7 @@ dwc_setup_txdesc(struct dwc_softc *sc, int idx, bus_ad
}
 
sc->txdesc_ring[idx].addr1 = (uint32_t)(paddr);
-   if (sc->mactype == DWC_GMAC_ALT_DESC) {
+   if (sc->mactype != DWC_GMAC_EXT_DESC) {
sc->txdesc_ring[idx].desc0 = 0;
sc->txdesc_ring[idx].desc1 = flags | len;
} else {
@@ -537,7 +537,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad
nidx = next_rxidx(sc, idx);
sc->rxdesc_ring[idx].addr2 = sc->rxdesc_ring_paddr +
(nidx * sizeof(struct dwc_hwdesc));
-   if (sc->mactype == DWC_GMAC_ALT_DESC)
+   if (sc->mactype != DWC_GMAC_EXT_DESC)
sc->rxdesc_ring[idx].desc1 = NRDESC1_RCH | RX_MAX_PACKET;
else
sc->rxdesc_ring[idx].desc1 = ERDESC1_RCH | MCLBYTES;
@@ -661,7 +661,7 @@ dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_i
crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN);
/* Take lower 8 bits and reverse it */
val = bitreverse(~crc & 0xff);
-   if (ctx->sc->mactype == DWC_GMAC_ALT_DESC)
+   if (ctx->sc->mactype != DWC_GMAC_EXT_DESC)
val >>= 2; /* Only need lower 6 bits */
hashreg = (val >> 5);
hashbit = (val & 31);
@@ -682,7 +682,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
DWC_ASSERT_LOCKED(sc);
 
ifp = sc->ifp;
-   nhash = sc->mactype == DWC_GMAC_ALT_DESC ? 2 : 8;
+   nhash = sc->mactype != DWC_GMAC_EXT_DESC ? 2 : 8;
 
/*
 * Set the multicast (group) filter hash.
@@ -715,7 +715,7 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
WRITE4(sc, MAC_ADDRESS_LOW(0), lo);
WRITE4(sc, MAC_ADDRESS_HIGH(0), hi);
WRITE4(sc, MAC_FRAME_FILTER, ffval);
-   if (sc->mactype == DWC_GMAC_ALT_DESC) {
+   if (sc->mactype != 

svn commit: r362399 - head/sys/dev/dwc

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 18:04:41 2020
New Revision: 362399
URL: https://svnweb.freebsd.org/changeset/base/362399

Log:
  Use naming nomenclature used in DesignWare TRM.
  Use naming nomenclature used in DesignWare TRM.
  This driver was written by using Altera (now Intel) documentation for Arria
  FPGA manual. Unfortunately this manual used very different (and in some cases
  opposite naming) for registers and descriptor fields. Unfortunately,
  this makes future expansion extremely hard.
  
  Should not been functional change.
  
  MFC after:4 weeks

Modified:
  head/sys/dev/dwc/if_dwc.c

Modified: head/sys/dev/dwc/if_dwc.c
==
--- head/sys/dev/dwc/if_dwc.c   Fri Jun 19 18:02:29 2020(r362398)
+++ head/sys/dev/dwc/if_dwc.c   Fri Jun 19 18:04:41 2020(r362399)
@@ -93,46 +93,113 @@ __FBSDID("$FreeBSD$");
 #defineDWC_ASSERT_LOCKED(sc)   mtx_assert(&(sc)->mtx, MA_OWNED)
 #defineDWC_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, 
MA_NOTOWNED)
 
-#defineDDESC_TDES0_OWN (1U << 31)
-#defineDDESC_TDES0_TXINT   (1U << 30)
-#defineDDESC_TDES0_TXLAST  (1U << 29)
-#defineDDESC_TDES0_TXFIRST (1U << 28)
-#defineDDESC_TDES0_TXCRCDIS(1U << 27)
-#defineDDESC_TDES0_TXRINGEND   (1U << 21)
-#defineDDESC_TDES0_TXCHAIN (1U << 20)
+/* TX descriptors - TDESC0 is almost unified */
+#defineTDESC0_OWN  (1U << 31)
+#defineTDESC0_IHE  (1U << 16)  /* IP Header Error */
+#defineTDESC0_ES   (1U << 15)  /* Error Summary */
+#defineTDESC0_JT   (1U << 14)  /* Jabber Timeout */
+#defineTDESC0_FF   (1U << 13)  /* Frame Flushed */
+#defineTDESC0_PCE  (1U << 12)  /* Payload Checksum 
Error */
+#defineTDESC0_LOC  (1U << 11)  /* Loss of Carrier */
+#defineTDESC0_NC   (1U << 10)  /* No Carrier */
+#defineTDESC0_LC   (1U <<  9)  /* Late Collision */
+#defineTDESC0_EC   (1U <<  8)  /* Excessive Collision 
*/
+#defineTDESC0_VF   (1U <<  7)  /* VLAN Frame */
+#defineTDESC0_CC_MASK  0xf
+#defineTDESC0_CC_SHIFT 3   /* Collision Count */
+#defineTDESC0_ED   (1U <<  2)  /* Excessive Deferral */
+#defineTDESC0_UF   (1U <<  1)  /* Underflow Error */
+#defineTDESC0_DB   (1U <<  0)  /* Deferred Bit */
+/* TX descriptors - TDESC0 extended format only */
+#defineETDESC0_IC  (1U << 30)  /* Interrupt on 
Completion */
+#defineETDESC0_LS  (1U << 29)  /* Last Segment */
+#defineETDESC0_FS  (1U << 28)  /* First Segment */
+#defineETDESC0_DC  (1U << 27)  /* Disable CRC */
+#defineETDESC0_DP  (1U << 26)  /* Disable Padding */
+#defineETDESC0_CIC_NONE(0U << 22)  /* Checksum Insertion 
Control */
+#defineETDESC0_CIC_HDR (1U << 22)
+#defineETDESC0_CIC_SEG (2U << 22)
+#defineETDESC0_CIC_FULL(3U << 22)
+#defineETDESC0_TER (1U << 21)  /* Transmit End of Ring 
*/
+#defineETDESC0_TCH (1U << 20)  /* Second Address 
Chained */
 
-#defineDDESC_RDES0_OWN (1U << 31)
-#defineDDESC_RDES0_FL_MASK 0x3fff
-#defineDDESC_RDES0_FL_SHIFT16  /* Frame Length */
-#defineDDESC_RDES1_CHAINED (1U << 14)
+/* TX descriptors - TDESC1 normal format */
+#defineNTDESC1_IC  (1U << 31)  /* Interrupt on 
Completion */
+#defineNTDESC1_LS  (1U << 30)  /* Last Segment */
+#defineNTDESC1_FS  (1U << 29)  /* First Segment */
+#defineNTDESC1_CIC_NONE(0U << 27)  /* Checksum Insertion 
Control */
+#defineNTDESC1_CIC_HDR (1U << 27)
+#defineNTDESC1_CIC_SEG (2U << 27)
+#defineNTDESC1_CIC_FULL(3U << 27)
+#defineNTDESC1_DC  (1U << 26)  /* Disable CRC */
+#defineNTDESC1_TER (1U << 25)  /* Transmit End of Ring 
*/
+#defineNTDESC1_TCH (1U << 24)  /* Second Address 
Chained */
+/* TX descriptors - TDESC1 extended format */
+#defineETDESC1_DP  (1U << 23)  /* Disable Padding */
+#defineETDESC1_TBS2_MASK   0x7ff
+#defineETDESC1_TBS2_SHIFT  11  /* Receive Buffer 2 
Size */
+#defineETDESC1_TBS1_MASK   0x7ff
+#defineETDESC1_TBS1_SHIFT  0   /* Receive Buffer 1 
Size */
 
-/* 

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

2020-06-19 Thread Andrew Turner
Author: andrew
Date: Fri Jun 19 18:00:20 2020
New Revision: 362397
URL: https://svnweb.freebsd.org/changeset/base/362397

Log:
  Use the correct address when creating pci resources
  
  When the PCI and CPU physical addresses are identical it doesn't matter
  which is used to create the resources, however on some systems, e.g.
  qemu armv7 virt, they are different. This leads to a panic as we try to
  map the wrong physical address into the kernel address space.
  
  Reported by:  Jenkins via trasz
  Sponsored by: Innovate UK

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

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Fri Jun 19 17:59:55 2020
(r362396)
+++ head/sys/dev/pci/pci_host_generic.c Fri Jun 19 18:00:20 2020
(r362397)
@@ -143,15 +143,15 @@ pci_host_generic_core_attach(device_t dev)
case FLAG_TYPE_PMEM:
sc->has_pmem = true;
error = rman_manage_region(>pmem_rman,
-  phys_base, phys_base + size - 1);
+  pci_base, pci_base + size - 1);
break;
case FLAG_TYPE_MEM:
error = rman_manage_region(>mem_rman,
-  phys_base, phys_base + size - 1);
+  pci_base, pci_base + size - 1);
break;
case FLAG_TYPE_IO:
error = rman_manage_region(>io_rman,
-  phys_base, phys_base + size - 1);
+  pci_base, pci_base + size - 1);
break;
default:
continue;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362396 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-06-19 Thread Allan Jude
Author: allanjude
Date: Fri Jun 19 17:59:55 2020
New Revision: 362396
URL: https://svnweb.freebsd.org/changeset/base/362396

Log:
  ZFS: Allow setting checksum=skein on boot pools
  
  PR:   245889
  Reported by:  delphij
  Sponsored by: Klara Inc.

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Jun 19 17:56:05 2020
(r362395)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Jun 19 17:59:55 2020
(r362396)
@@ -1001,9 +1001,9 @@ for more information on these algorithms.
 .Pp
 Changing this property affects only newly-written data.
 .Pp
-Salted checksum algorithms
-.Pq Cm edonr , skein
-are currently not supported for any filesystem on the boot pools.
+The salted checksum algorithm
+.Pq Cm edonr
+is currently not supported on FreeBSD.
 .It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle 
| Cm lz4
 Controls the compression algorithm used for this dataset.
 Setting compression to

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Fri Jun 19 
17:56:05 2020(r362395)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7Fri Jun 19 
17:59:55 2020(r362396)
@@ -632,6 +632,9 @@ and will return to being
 once all filesystems that have ever had their checksum set to
 .Sy skein
 are destroyed.
+Booting off of pools using
+.Sy skein
+is supported.
 .It Sy allocation_classes
 .Bl -column "READ\-ONLY COMPATIBLE" "com.intel:allocation_classes"
 .It GUID Ta com.intel:allocation_classes

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jun 
19 17:56:05 2020(r362395)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jun 
19 17:59:55 2020(r362396)
@@ -4373,16 +4373,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair,
 
if ((err = spa_open(dsname, , FTAG)) != 0)
return (err);
-   /*
-* Salted checksums are not supported on root pools.
-*/
-   if (spa_bootfs(spa) != 0 &&
-   intval < ZIO_CHECKSUM_FUNCTIONS &&
-   (zio_checksum_table[intval].ci_flags &
-   ZCHECKSUM_FLAG_SALTED)) {
-   spa_close(spa, FTAG);
-   return (SET_ERROR(ERANGE));
-   }
+
if (!spa_feature_is_enabled(spa, feature)) {
spa_close(spa, FTAG);
return (SET_ERROR(ENOTSUP));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 17:33:54 2020
New Revision: 362392
URL: https://svnweb.freebsd.org/changeset/base/362392

Log:
  Adapt ARMADA8k PCIe driver to newly imported 5.7 DT.
  - temporarily disable handling with phy, we don't have driver for it yet
  - always clear cause for administartive interrupt.
  While I'm in, fix style(9) (mainly whitespace).
  
  MFC after:4 weeks

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

Modified: head/sys/dev/pci/pci_dw_mv.c
==
--- head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:32:50 2020
(r362391)
+++ head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:33:54 2020
(r362392)
@@ -64,15 +64,11 @@ __FBSDID("$FreeBSD$");
 
 #define MV_GLOBAL_CONTROL_REG  0x8000
 #define PCIE_APP_LTSSM_EN  (1 << 2)
-//#define PCIE_DEVICE_TYPE_SHIFT   4
-//#define PCIE_DEVICE_TYPE_MASK0xF
-//#define PCIE_DEVICE_TYPE_RC  0x4/
 
 #define MV_GLOBAL_STATUS_REG   0x8008
 #define MV_STATUS_RDLH_LINK_UP (1 << 1)
 #define  MV_STATUS_PHY_LINK_UP (1 << 9)
 
-
 #define MV_INT_CAUSE1  0x801C
 #define MV_INT_MASK1   0x8020
 #define  INT_A_ASSERT_MASK (1 <<  9)
@@ -90,11 +86,7 @@ __FBSDID("$FreeBSD$");
 #define MV_ARUSER_REG  0x805C
 #define MV_AWUSER_REG  0x8060
 
-
-
 #defineMV_MAX_LANES8
-
-
 struct pci_mv_softc {
struct pci_dw_softc dw_sc;
device_tdev;
@@ -112,7 +104,6 @@ static struct ofw_compat_data compat_data[] = {
{NULL,0},
 };
 
-
 static int
 pci_mv_phy_init(struct pci_mv_softc *sc)
 {
@@ -121,18 +112,23 @@ pci_mv_phy_init(struct pci_mv_softc *sc)
for (i = 0; i < MV_MAX_LANES; i++) {
rv =  phy_get_by_ofw_idx(sc->dev, sc->node, i, &(sc->phy[i]));
if (rv != 0 && rv != ENOENT) {
-   device_printf(sc->dev, "Cannot get phy[%d]\n", i);
-   goto fail;
-   }
-   if (sc->phy[i] == NULL)
-   continue;
-   rv = phy_enable(sc->phy[i]);
-   if (rv != 0) {
-   device_printf(sc->dev, "Cannot enable phy[%d]\n", i);
-   goto fail;
-   }
- }
- return (0);
+   device_printf(sc->dev, "Cannot get phy[%d]\n", i);
+/* XXX revert when phy driver will be implemented */
+#if 0
+   goto fail;
+#else
+   continue;
+#endif
+   }
+   if (sc->phy[i] == NULL)
+   continue;
+   rv = phy_enable(sc->phy[i]);
+   if (rv != 0) {
+   device_printf(sc->dev, "Cannot enable phy[%d]\n", i);
+   goto fail;
+   }
+   }
+   return (0);
 
 fail:
for (i = 0; i < MV_MAX_LANES; i++) {
@@ -173,13 +169,14 @@ pci_mv_init(struct pci_mv_softc *sc)
/* Enable local interrupts */
pci_dw_dbi_wr4(sc->dev, DW_MSI_INTR0_MASK, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_MASK1, 0x);
-   pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0x);
+   pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0xFFFD);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, 0x);
 
/* Errors have own interrupt, not yet populated in DTt */
pci_dw_dbi_wr4(sc->dev, MV_ERR_INT_MASK, 0);
 }
+
 static int pci_mv_intr(void *arg)
 {
struct pci_mv_softc *sc = arg;
@@ -188,8 +185,6 @@ static int pci_mv_intr(void *arg)
/* Ack all interrups */
cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1);
cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2);
-   if (cause1 == 0 || cause2 == 0)
-   return(FILTER_STRAY);
 
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2);
@@ -325,4 +320,4 @@ DEFINE_CLASS_1(pcib, pci_mv_driver, pci_mv_methods,
 sizeof(struct pci_mv_softc), pci_dw_driver);
 static devclass_t pci_mv_devclass;
 DRIVER_MODULE( pci_mv, simplebus, pci_mv_driver, pci_mv_devclass,
-NULL, NULL);
\ No newline at end of file
+NULL, NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 17:32:50 2020
New Revision: 362391
URL: https://svnweb.freebsd.org/changeset/base/362391

Log:
  Revert r362389, it was committed with .diff instead of .txt as
  commit log.

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

Modified: head/sys/dev/pci/pci_dw_mv.c
==
--- head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:32:30 2020
(r362390)
+++ head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:32:50 2020
(r362391)
@@ -64,11 +64,15 @@ __FBSDID("$FreeBSD$");
 
 #define MV_GLOBAL_CONTROL_REG  0x8000
 #define PCIE_APP_LTSSM_EN  (1 << 2)
+//#define PCIE_DEVICE_TYPE_SHIFT   4
+//#define PCIE_DEVICE_TYPE_MASK0xF
+//#define PCIE_DEVICE_TYPE_RC  0x4/
 
 #define MV_GLOBAL_STATUS_REG   0x8008
 #define MV_STATUS_RDLH_LINK_UP (1 << 1)
 #define  MV_STATUS_PHY_LINK_UP (1 << 9)
 
+
 #define MV_INT_CAUSE1  0x801C
 #define MV_INT_MASK1   0x8020
 #define  INT_A_ASSERT_MASK (1 <<  9)
@@ -86,7 +90,11 @@ __FBSDID("$FreeBSD$");
 #define MV_ARUSER_REG  0x805C
 #define MV_AWUSER_REG  0x8060
 
+
+
 #defineMV_MAX_LANES8
+
+
 struct pci_mv_softc {
struct pci_dw_softc dw_sc;
device_tdev;
@@ -104,6 +112,7 @@ static struct ofw_compat_data compat_data[] = {
{NULL,0},
 };
 
+
 static int
 pci_mv_phy_init(struct pci_mv_softc *sc)
 {
@@ -112,23 +121,18 @@ pci_mv_phy_init(struct pci_mv_softc *sc)
for (i = 0; i < MV_MAX_LANES; i++) {
rv =  phy_get_by_ofw_idx(sc->dev, sc->node, i, &(sc->phy[i]));
if (rv != 0 && rv != ENOENT) {
-   device_printf(sc->dev, "Cannot get phy[%d]\n", i);
-/* XXX revert when phy driver will be implemented */
-#if 0
-   goto fail;
-#else
-   continue;
-#endif
-   }
-   if (sc->phy[i] == NULL)
-   continue;
-   rv = phy_enable(sc->phy[i]);
-   if (rv != 0) {
-   device_printf(sc->dev, "Cannot enable phy[%d]\n", i);
-   goto fail;
-   }
-   }
-   return (0);
+   device_printf(sc->dev, "Cannot get phy[%d]\n", i);
+   goto fail;
+   }
+   if (sc->phy[i] == NULL)
+   continue;
+   rv = phy_enable(sc->phy[i]);
+   if (rv != 0) {
+   device_printf(sc->dev, "Cannot enable phy[%d]\n", i);
+   goto fail;
+   }
+ }
+ return (0);
 
 fail:
for (i = 0; i < MV_MAX_LANES; i++) {
@@ -169,14 +173,13 @@ pci_mv_init(struct pci_mv_softc *sc)
/* Enable local interrupts */
pci_dw_dbi_wr4(sc->dev, DW_MSI_INTR0_MASK, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_MASK1, 0x);
-   pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0xFFFD);
+   pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, 0x);
 
/* Errors have own interrupt, not yet populated in DTt */
pci_dw_dbi_wr4(sc->dev, MV_ERR_INT_MASK, 0);
 }
-
 static int pci_mv_intr(void *arg)
 {
struct pci_mv_softc *sc = arg;
@@ -185,6 +188,8 @@ static int pci_mv_intr(void *arg)
/* Ack all interrups */
cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1);
cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2);
+   if (cause1 == 0 || cause2 == 0)
+   return(FILTER_STRAY);
 
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2);
@@ -320,4 +325,4 @@ DEFINE_CLASS_1(pcib, pci_mv_driver, pci_mv_methods,
 sizeof(struct pci_mv_softc), pci_dw_driver);
 static devclass_t pci_mv_devclass;
 DRIVER_MODULE( pci_mv, simplebus, pci_mv_driver, pci_mv_devclass,
-NULL, NULL);
+NULL, NULL);
\ No newline at end of file
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362390 - in head/usr.sbin: fstyp/tests makefs/tests

2020-06-19 Thread Li-Wen Hsu
Author: lwhsu
Date: Fri Jun 19 17:32:30 2020
New Revision: 362390
URL: https://svnweb.freebsd.org/changeset/base/362390

Log:
  Skip ufs related tests in fstyp(8) and makefs(8) temporarily
  
  They are failing after r362358 and r362359.
  
  PR:   247425
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/fstyp/tests/fstyp_test.sh
  head/usr.sbin/makefs/tests/makefs_ffs_tests.sh

Modified: head/usr.sbin/fstyp/tests/fstyp_test.sh
==
--- head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jun 19 17:25:54 2020
(r362389)
+++ head/usr.sbin/fstyp/tests/fstyp_test.sh Fri Jun 19 17:32:30 2020
(r362390)
@@ -197,6 +197,9 @@ ufs1_head() {
atf_set "descr" "fstyp(8) should detect UFS version 1 filesystems"
 }
 ufs1_body() {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
atf_check -s exit:0 mkdir dir
atf_check -s exit:0 -o ignore makefs -Z -s 64m ufs.img dir
atf_check -s exit:0 -o inline:"ufs\n" fstyp ufs.img
@@ -208,6 +211,9 @@ ufs2_head() {
atf_set "descr" "fstyp(8) should detect UFS version 2 filesystems"
 }
 ufs2_body() {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
atf_check -s exit:0 mkdir dir
atf_check -s exit:0 -o ignore makefs -o version=2 -Z -s 64m ufs.img dir
atf_check -s exit:0 -o inline:"ufs\n" fstyp ufs.img
@@ -219,6 +225,9 @@ ufs2_label_head() {
atf_set "descr" "fstyp(8) can read the label on a UFS v2 filesystem"
 }
 ufs2_label_body() {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
atf_check -s exit:0 mkdir dir
atf_check -s exit:0 -o ignore makefs -o version=2,label="foo" -Z -s 64m 
ufs.img dir
atf_check -s exit:0 -o inline:"ufs foo\n" fstyp -l ufs.img

Modified: head/usr.sbin/makefs/tests/makefs_ffs_tests.sh
==
--- head/usr.sbin/makefs/tests/makefs_ffs_tests.sh  Fri Jun 19 17:25:54 
2020(r362389)
+++ head/usr.sbin/makefs/tests/makefs_ffs_tests.sh  Fri Jun 19 17:32:30 
2020(r362390)
@@ -106,6 +106,10 @@ D_flag_cleanup()
 atf_test_case F_flag cleanup
 F_flag_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
+
create_test_inputs
 
atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
@@ -125,6 +129,10 @@ F_flag_cleanup()
 atf_test_case from_mtree_spec_file cleanup
 from_mtree_spec_file_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
+
create_test_inputs
 
atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
@@ -146,6 +154,10 @@ from_mtree_spec_file_cleanup()
 atf_test_case from_multiple_dirs cleanup
 from_multiple_dirs_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
+
test_inputs_dir2=$TMPDIR/inputs2
 
create_test_inputs
@@ -168,6 +180,10 @@ from_multiple_dirs_cleanup()
 atf_test_case from_single_dir cleanup
 from_single_dir_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
+
create_test_inputs
 
atf_check -e empty -o not-empty -s exit:0 \
@@ -184,6 +200,10 @@ from_single_dir_cleanup()
 atf_test_case o_flag_version_1 cleanup
 o_flag_version_1_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
+
ffs_version=1
 
platform=$(uname)
@@ -216,6 +236,10 @@ o_flag_version_1_cleanup()
 atf_test_case o_flag_version_2 cleanup
 o_flag_version_2_body()
 {
+   if [ "$(atf_config_get ci false)" = "true" ]; then
+   atf_skip "https://bugs.freebsd.org/247425;
+   fi
+
ffs_version=2
 
platform=$(uname)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 17:25:54 2020
New Revision: 362389
URL: https://svnweb.freebsd.org/changeset/base/362389

Log:
  diff --git a/sys/dev/pci/pci_dw_mv.c b/sys/dev/pci/pci_dw_mv.c
  index 06a29fefbdd..571fc00f6c1 100644
  --- a/sys/dev/pci/pci_dw_mv.c
  +++ b/sys/dev/pci/pci_dw_mv.c
  @@ -64,15 +64,11 @@ __FBSDID("$FreeBSD$");
  
   #define MV_GLOBAL_CONTROL_REG0x8000
   #define PCIE_APP_LTSSM_EN(1 << 2)
  -//#define PCIE_DEVICE_TYPE_SHIFT 4
  -//#define PCIE_DEVICE_TYPE_MASK  0xF
  -//#define PCIE_DEVICE_TYPE_RC0x4/
  
   #define MV_GLOBAL_STATUS_REG 0x8008
   #define   MV_STATUS_RDLH_LINK_UP (1 << 1)
   #define  MV_STATUS_PHY_LINK_UP   (1 << 9)
  
  -
   #define MV_INT_CAUSE10x801C
   #define MV_INT_MASK1 0x8020
   #define  INT_A_ASSERT_MASK   (1 <<  9)
  @@ -90,11 +86,7 @@ __FBSDID("$FreeBSD$");
   #define MV_ARUSER_REG0x805C
   #define MV_AWUSER_REG0x8060
  
  -
  -
   #define  MV_MAX_LANES8
  -
  -
   struct pci_mv_softc {
struct pci_dw_softc dw_sc;
device_tdev;
  @@ -112,7 +104,6 @@ static struct ofw_compat_data compat_data[] = {
{NULL,0},
   };
  
  -
   static int
   pci_mv_phy_init(struct pci_mv_softc *sc)
   {
  @@ -121,18 +112,23 @@ pci_mv_phy_init(struct pci_mv_softc *sc)
for (i = 0; i < MV_MAX_LANES; i++) {
rv =  phy_get_by_ofw_idx(sc->dev, sc->node, i, &(sc->phy[i]));
if (rv != 0 && rv != ENOENT) {
  - device_printf(sc->dev, "Cannot get phy[%d]\n", i);
  - goto fail;
  - }
  - if (sc->phy[i] == NULL)
  - continue;
  - rv = phy_enable(sc->phy[i]);
  - if (rv != 0) {
  - device_printf(sc->dev, "Cannot enable phy[%d]\n", i);
  - goto fail;
  - }
  -   }
  -   return (0);
  + device_printf(sc->dev, "Cannot get phy[%d]\n", i);
  +/* XXX revert when phy driver will be implemented */
  +#if 0
  + goto fail;
  +#else
  + continue;
  +#endif
  + }
  + if (sc->phy[i] == NULL)
  + continue;
  + rv = phy_enable(sc->phy[i]);
  + if (rv != 0) {
  + device_printf(sc->dev, "Cannot enable phy[%d]\n", i);
  + goto fail;
  + }
  + }
  + return (0);
  
   fail:
for (i = 0; i < MV_MAX_LANES; i++) {
  @@ -173,13 +169,14 @@ pci_mv_init(struct pci_mv_softc *sc)
/* Enable local interrupts */
pci_dw_dbi_wr4(sc->dev, DW_MSI_INTR0_MASK, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_MASK1, 0x);
  - pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0x);
  + pci_dw_dbi_wr4(sc->dev, MV_INT_MASK2, 0xFFFD);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, 0x);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, 0x);
  
/* Errors have own interrupt, not yet populated in DTt */
pci_dw_dbi_wr4(sc->dev, MV_ERR_INT_MASK, 0);
   }
  +
   static int pci_mv_intr(void *arg)
   {
struct pci_mv_softc *sc = arg;
  @@ -188,8 +185,6 @@ static int pci_mv_intr(void *arg)
/* Ack all interrups */
cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1);
cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2);
  - if (cause1 == 0 || cause2 == 0)
  - return(FILTER_STRAY);
  
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1);
pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2);

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

Modified: head/sys/dev/pci/pci_dw_mv.c
==
--- head/sys/dev/pci/pci_dw_mv.cFri Jun 19 16:26:42 2020
(r362388)
+++ head/sys/dev/pci/pci_dw_mv.cFri Jun 19 17:25:54 2020
(r362389)
@@ -64,15 +64,11 @@ __FBSDID("$FreeBSD$");
 
 #define MV_GLOBAL_CONTROL_REG  0x8000
 #define PCIE_APP_LTSSM_EN  (1 << 2)
-//#define PCIE_DEVICE_TYPE_SHIFT   4
-//#define PCIE_DEVICE_TYPE_MASK0xF
-//#define PCIE_DEVICE_TYPE_RC  0x4/
 
 #define MV_GLOBAL_STATUS_REG   0x8008
 #define MV_STATUS_RDLH_LINK_UP (1 << 1)
 #define  MV_STATUS_PHY_LINK_UP (1 << 9)
 
-
 #define MV_INT_CAUSE1  0x801C
 #define MV_INT_MASK1   0x8020
 #define  INT_A_ASSERT_MASK (1 <<  9)
@@ -90,11 +86,7 @@ __FBSDID("$FreeBSD$");
 #define MV_ARUSER_REG  0x805C
 #define MV_AWUSER_REG  0x8060
 
-
-
 #defineMV_MAX_LANES8
-
-
 struct pci_mv_softc {
struct pci_dw_softc dw_sc;
device_t   

svn commit: r362388 - head/sys/arm64/arm64

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 16:26:42 2020
New Revision: 362388
URL: https://svnweb.freebsd.org/changeset/base/362388

Log:
  Use native-sized accesses when accessing memory from kdb.
  Not all MMIO mapped devices supports byte access.
  
  MFC after:4 weeks

Modified:
  head/sys/arm64/arm64/db_interface.c

Modified: head/sys/arm64/arm64/db_interface.c
==
--- head/sys/arm64/arm64/db_interface.c Fri Jun 19 16:15:06 2020
(r362387)
+++ head/sys/arm64/arm64/db_interface.c Fri Jun 19 16:26:42 2020
(r362388)
@@ -118,12 +118,25 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat
void *prev_jb;
const char *src;
int ret;
+   uint64_t tmp64;
+   uint32_t tmp32;
+   uint16_t tmp16;
 
prev_jb = kdb_jmpbuf(jb);
ret = setjmp(jb);
 
if (ret == 0) {
src = (const char *)addr;
+   if (size == 8 && (addr & 7) == 0) {
+   tmp64 = *((const int *)src);
+   src = (const char *)
+   } else if (size == 4 && (addr & 3) == 0) {
+   tmp32 = *((const int *)src);
+   src = (const char *)
+   } else if (size == 2 && (addr & 1) == 0) {
+   tmp16 = *((const short *)src);
+   src = (const char *)
+   }
while (size-- > 0)
*data++ = *src++;
}
@@ -142,14 +155,33 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da
void *prev_jb;
char *dst;
int ret;
+   uint64_t tmp64;
+   uint32_t tmp32;
+   uint16_t tmp16;
 
prev_jb = kdb_jmpbuf(jb);
ret = setjmp(jb);
if (ret == 0) {
-   dst = (char *)addr;
-   while (size-- > 0)
-   *dst++ = *data++;
-
+   if (size == 8 && (addr & 7) == 0) {
+   dst = (char *)
+   while (size-- > 0)
+   *dst++ = *data++;
+   *((uint64_t *)addr) = tmp64;
+   } else if (size == 4 && (addr & 3) == 0) {
+   dst = (char *)
+   while (size-- > 0)
+   *dst++ = *data++;
+   *((uint32_t *)addr) = tmp32;
+   } else if (size == 2 && (addr & 1) == 0) {
+   dst = (char *)
+   while (size-- > 0)
+   *dst++ = *data++;
+   *((uint32_t *)addr) = tmp16;
+   } else {
+   dst = (char *)addr;
+   while (size-- > 0)
+   *dst++ = *data++;
+   }
dsb(ish);
 
/* Clean D-cache and invalidate I-cache */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 16:15:06 2020
New Revision: 362387
URL: https://svnweb.freebsd.org/changeset/base/362387

Log:
  Improve DesignWare PCIe driver:
  - only normal memory window is mandatory, prefetchable memory and
I/O windows should be optional
  - full PCIe configuration space is supported
  - remove duplicated check from function for accessing configuration space.
It is already contained in pci_dw_check_dev()
  
  MFC after:2 weeks

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

Modified: head/sys/dev/pci/pci_dw.c
==
--- head/sys/dev/pci/pci_dw.c   Fri Jun 19 15:32:55 2020(r362386)
+++ head/sys/dev/pci/pci_dw.c   Fri Jun 19 16:15:06 2020(r362387)
@@ -156,7 +156,7 @@ pci_dw_check_dev(struct pci_dw_softc *sc, u_int bus, u
int rv;
 
if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX ||
-   func > PCI_FUNCMAX || reg > PCI_REGMAX)
+   func > PCI_FUNCMAX || reg > PCIE_REGMAX)
return (false);
 
/* link is needed for access to all non-root busses */
@@ -234,7 +234,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc)
return (rv);
 
/* If we have enouht viewports ..*/
-   if (sc->num_viewport >= 3) {
+   if (sc->num_viewport >= 3 && sc->io_range.size != 0) {
/* Setup outbound I/O window */
rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM,
sc->io_range.host, sc->io_range.pci, sc->io_range.size);
@@ -345,7 +345,7 @@ pci_dw_decode_ranges(struct pci_dw_softc *sc, struct o
}
}
}
-   if ((sc->io_range.size == 0) || (sc->mem_range.size == 0)) {
+   if (sc->mem_range.size == 0) {
device_printf(sc->dev,
" Not all required ranges are found in DT\n");
return (ENXIO);
@@ -375,10 +375,6 @@ pci_dw_read_config(device_t dev, u_int bus, u_int slot
if (!pci_dw_check_dev(sc, bus, slot, func, reg))
return (0xU);
 
-   if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) ||
-   (reg > PCI_REGMAX))
-   return (0xU);
-
if (bus == sc->root_bus) {
res = (sc->dbi_res);
} else {
@@ -424,10 +420,6 @@ pci_dw_write_config(device_t dev, u_int bus, u_int slo
 
sc = device_get_softc(dev);
if (!pci_dw_check_dev(sc, bus, slot, func, reg))
-   return;
-
-   if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) ||
-   (reg > PCI_REGMAX))
return;
 
if (bus == sc->root_bus) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf

2020-06-19 Thread John Baldwin
On 6/18/20 12:32 PM, Mark Johnston wrote:
> Author: markj
> Date: Thu Jun 18 19:32:34 2020
> New Revision: 362338
> URL: https://svnweb.freebsd.org/changeset/base/362338
> 
> Log:
>   Add the SCTP_SUPPORT kernel option.
>   
>   This is in preparation for enabling a loadable SCTP stack.  Analogous to
>   IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured
>   in order to support a loadable SCTP implementation.
>   
>   Discussed with: tuexen
>   MFC after:  2 weeks
>   Sponsored by:   The FreeBSD Foundation

Do you want to add similar handling to sys/conf/config.mk that we have
for IPsec?  Also, do we want to avoid building sctp.ko if it is in the
kernel like we do for ipsec.ko and/or only build it if the kernel contains
SCTP_SUPPORT?  (For ipsec.ko we had to do that as it wouldn't compile, not
sure if the same is true for sctp.ko)

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


svn commit: r362386 - head/sys/arm/mv/armada38x

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 15:32:55 2020
New Revision: 362386
URL: https://svnweb.freebsd.org/changeset/base/362386

Log:
  Add specific stub for ARMADA 8k SoC to Marvell RTC driver.
  The AXI bridge is different between ARMADA 38x and 8K, and both platforms
  needs specific setup to mitigate HW issues with accessing RTC registers.
  
  MFC after:2 weeks

Modified:
  head/sys/arm/mv/armada38x/armada38x_rtc.c

Modified: head/sys/arm/mv/armada38x/armada38x_rtc.c
==
--- head/sys/arm/mv/armada38x/armada38x_rtc.c   Fri Jun 19 15:21:33 2020
(r362385)
+++ head/sys/arm/mv/armada38x/armada38x_rtc.c   Fri Jun 19 15:32:55 2020
(r362386)
@@ -72,14 +72,27 @@ __FBSDID("$FreeBSD$");
 #defineMV_RTC_LOCK(sc) mtx_lock_spin(&(sc)->mutex)
 #defineMV_RTC_UNLOCK(sc)   mtx_unlock_spin(&(sc)->mutex)
 
-#defineRTC_BRIDGE_TIMING_CTRL  0x0
-#defineRTC_WRCLK_PERIOD_SHIFT  0
-#defineRTC_WRCLK_PERIOD_MASK   0x0003FF
-#defineRTC_WRCLK_PERIOD_MAX0x3FF
-#defineRTC_READ_OUTPUT_DELAY_SHIFT 26
-#defineRTC_READ_OUTPUT_DELAY_MASK  0x007C00
-#defineRTC_READ_OUTPUT_DELAY_MAX   0x1F
+#defineA38X_RTC_BRIDGE_TIMING_CTRL 0x0
+#defineA38X_RTC_WRCLK_PERIOD_SHIFT 0
+#defineA38X_RTC_WRCLK_PERIOD_MASK  0x0003FF
+#defineA38X_RTC_WRCLK_PERIOD_MAX   0x3FF
+#defineA38X_RTC_READ_OUTPUT_DELAY_SHIFT26
+#defineA38X_RTC_READ_OUTPUT_DELAY_MASK 0x007C00
+#defineA38X_RTC_READ_OUTPUT_DELAY_MAX  0x1F
 
+#defineA8K_RTC_BRIDGE_TIMING_CTRL0 0x0
+#defineA8K_RTC_WRCLK_PERIOD_SHIFT  0
+#defineA8K_RTC_WRCLK_PERIOD_MASK   0x00
+#defineA8K_RTC_WRCLK_PERIOD_VAL0x3FF
+#defineA8K_RTC_WRCLK_SETUP_SHIFT   16
+#defineA8K_RTC_WRCLK_SETUP_MASK0x00
+#defineA8K_RTC_WRCLK_SETUP_VAL 29
+#defineA8K_RTC_BRIDGE_TIMING_CTRL1 0x4
+#defineA8K_RTC_READ_OUTPUT_DELAY_SHIFT 0
+#defineA8K_RTC_READ_OUTPUT_DELAY_MASK  0x00
+#defineA8K_RTC_READ_OUTPUT_DELAY_VAL   0x3F
+
+
 #defineRTC_RES 0
 #defineRTC_SOC_RES 1
 
@@ -94,6 +107,7 @@ struct mv_rtc_softc {
device_tdev;
struct resource *res[2];
struct mtx  mutex;
+   int rtc_type;
 };
 
 static int mv_rtc_probe(device_t dev);
@@ -107,7 +121,8 @@ static inline uint32_t mv_rtc_reg_read(struct mv_rtc_s
 bus_size_t off);
 static inline int mv_rtc_reg_write(struct mv_rtc_softc *sc, bus_size_t off,
 uint32_t val);
-static inline void mv_rtc_configure_bus(struct mv_rtc_softc *sc);
+static inline void mv_rtc_configure_bus_a38x(struct mv_rtc_softc *sc);
+static inline void mv_rtc_configure_bus_a8k(struct mv_rtc_softc *sc);
 
 static device_method_t mv_rtc_methods[] = {
DEVMETHOD(device_probe, mv_rtc_probe),
@@ -126,10 +141,13 @@ static driver_t mv_rtc_driver = {
sizeof(struct mv_rtc_softc),
 };
 
+#define  RTC_A38X  1
+#define  RTC_A8K   2
+
 static struct ofw_compat_data mv_rtc_compat[] = {
-   {"marvell,armada-380-rtc",  true},
-   {"marvell,armada-8k-rtc",   true},
-   {NULL,  false},
+   {"marvell,armada-380-rtc",  RTC_A38X},
+   {"marvell,armada-8k-rtc",   RTC_A8K},
+   {NULL,  0},
 };
 
 static devclass_t mv_rtc_devclass;
@@ -198,20 +216,29 @@ mv_rtc_attach(device_t dev)
 
sc = device_get_softc(dev);
sc->dev = dev;
+   sc->rtc_type = ofw_bus_search_compatible(dev, mv_rtc_compat)->ocd_data;
 
-   clock_register(dev, RTC_RES_US);
-
mtx_init(>mutex, device_get_nameunit(dev), NULL, MTX_SPIN);
 
ret = bus_alloc_resources(dev, res_spec, sc->res);
-
if (ret != 0) {
device_printf(dev, "could not allocate resources\n");
mtx_destroy(>mutex);
return (ENXIO);
}
-   mv_rtc_configure_bus(sc);
 
+   switch (sc->rtc_type) {
+   case RTC_A38X:
+   mv_rtc_configure_bus_a38x(sc);
+   break;
+   case RTC_A8K:
+   mv_rtc_configure_bus_a8k(sc);
+   break;
+   default:
+   panic("Unknown RTC type: %d", sc->rtc_type);
+   }
+   clock_register(dev, RTC_RES_US);
+
return (0);
 }
 
@@ -239,13 +266,15 @@ mv_rtc_gettime(device_t dev, struct timespec *ts)
 
MV_RTC_LOCK(sc);
/*
-* According to HW Errata if more than one second between
-* two time reads is detected, then read once again
+* 

svn commit: r362385 - in head/sys: arm/mv conf

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 15:21:33 2020
New Revision: 362385
URL: https://svnweb.freebsd.org/changeset/base/362385

Log:
  Add specialized gpio driver for ARMADA 8k SoC.
  Older marvell gpio blocks are to different for reusing/enhancing
  existing frivers.
  
  MFC after:2 weeks

Added:
  head/sys/arm/mv/mvebu_gpio.c   (contents, props changed)
Modified:
  head/sys/arm/mv/gpio.c
  head/sys/conf/files.arm64

Modified: head/sys/arm/mv/gpio.c
==
--- head/sys/arm/mv/gpio.c  Fri Jun 19 14:28:56 2020(r362384)
+++ head/sys/arm/mv/gpio.c  Fri Jun 19 15:21:33 2020(r362385)
@@ -60,9 +60,6 @@ __FBSDID("$FreeBSD$");
 
 #include "gpio_if.h"
 
-#ifdef __aarch64__
-#include "opt_soc.h"
-#endif
 
 #define GPIO_MAX_INTR_COUNT8
 #define GPIO_PINS_PER_REG  32
@@ -199,9 +196,6 @@ EARLY_DRIVER_MODULE(mv_gpio, simplebus, mv_gpio_driver
 struct ofw_compat_data compat_data[] = {
{ "mrvl,gpio", 1 },
{ "marvell,orion-gpio", 1 },
-#ifdef SOC_MARVELL_8K
-   { "marvell,armada-8k-gpio", 1 },
-#endif
{ NULL, 0 }
 };
 

Added: head/sys/arm/mv/mvebu_gpio.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/mv/mvebu_gpio.cFri Jun 19 15:21:33 2020
(r362385)
@@ -0,0 +1,869 @@
+/*-
+ * Copyright (c) 2020 Michal Meloun 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * ARMADA 8040 GPIO driver.
+ */
+#include "opt_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include "pic_if.h"
+#include "syscon_if.h"
+
+#defineGPIO_LOCK(_sc)  mtx_lock(&(_sc)->mtx)
+#defineGPIO_UNLOCK(_sc)mtx_unlock(&(_sc)->mtx)
+#defineGPIO_LOCK_INIT(_sc) mtx_init(&_sc->mtx, 
\
+   device_get_nameunit(_sc->dev), "mvebu_gpio", MTX_DEF)
+#defineGPIO_LOCK_DESTROY(_sc)  mtx_destroy(&_sc->mtx);
+#defineGPIO_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED);
+#defineGPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED);
+
+#defineGPIO_DATA_OUT   0x00
+#defineGPIO_CONTROL0x04
+#defineGPIO_BLINK_ENA  0x08
+#defineGPIO_DATA_IN_POL0x0C
+#defineGPIO_DATA_IN0x10
+#defineGPIO_INT_CAUSE  0x14
+#defineGPIO_INT_MASK   0x18
+#defineGPIO_INT_LEVEL_MASK 0x1C
+#defineGPIO_CONTROL_SET0x28
+#defineGPIO_CONTROL_CLR0x2C
+#defineGPIO_DATA_SET   0x30
+#defineGPIO_DATA_CLR   0x34
+
+#defineGPIO_BIT(_p)((_p) % 32)
+#defineGPIO_REGNUM(_p) ((_p) / 32)
+
+#defineMV_GPIO_MAX_NIRQS   4
+#defineMV_GPIO_MAX_NPINS   32
+
+#defineRD4(sc, reg)SYSCON_READ_4((sc)->syscon, (reg))
+#defineWR4(sc, reg, val)   SYSCON_WRITE_4((sc)->syscon, (reg), 
(val))
+
+struct mvebu_gpio_irqsrc {
+   struct intr_irqsrc  isrc;
+   u_int   irq;
+   boolis_level;
+   boolis_inverted;
+};
+
+struct mvebu_gpio_softc;
+struct mvebu_gpio_irq_cookie {
+   struct mvebu_gpio_softc *sc;
+   int bank_num;
+};
+
+struct mvebu_gpio_softc {
+   device_tdev;
+   device_tbusdev;
+   struct mtx  

Re: svn commit: r362126 - head/sys/vm

2020-06-19 Thread John Baldwin
On 6/18/20 10:53 AM, Conrad Meyer wrote:
> On Thu, Jun 18, 2020 at 10:19 AM John Baldwin  wrote:
>>
>> On 6/17/20 5:48 PM, Conrad Meyer wrote:
>>> db_printf checks the pager, via db_putc.
>>
>> It doesn't break out of the loops for you though (e.g. via setjmp or the
>> like).  Commands still have to check db_pager_quit directly if they wish
>> to abort early to honor a user entering 'q' at the pager prompt.
> 
> It does for Ctrl-C, but not 'q', true.  It could easily do the same
> for 'q' as Ctrl-C: db_error(NULL) => kdb_reenter_silent().

That's only safe if commands are always idempotent.  Some commands can
use try locks (though they really shouldn't).  Having printf() auto-convert
is potentially worse for this as it affects doing a 'call' of an arbitrary
function (which is likely not written to be safe for DDB).  Though that's
already a bit fraught with dragons since any nested panic already does the
longjmp.  We skip locking (though only somewhat, you can "unlock" a lock
held by the interrupted code in your thread by calling a function).

It may be that having 'q' longjmp is ok and wouldn't really be more fragile
than what is already there.  That is still orthogonal to your patch (which
is printf -> db_printf in effect) (and so 2 separate things to consider).

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


svn commit: r362384 - head/sys/modules/dtb/mv

2020-06-19 Thread Michal Meloun
Author: mmel
Date: Fri Jun 19 14:28:56 2020
New Revision: 362384
URL: https://svnweb.freebsd.org/changeset/base/362384

Log:
  Add DTB files for ARMADA 8040 based boards.
  
  MFC after:2 weeks

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

Modified: head/sys/modules/dtb/mv/Makefile
==
--- head/sys/modules/dtb/mv/MakefileFri Jun 19 13:48:23 2020
(r362383)
+++ head/sys/modules/dtb/mv/MakefileFri Jun 19 14:28:56 2020
(r362384)
@@ -7,7 +7,11 @@ DTS=   \
armada-388-gp.dts
 .elif ${MACHINE_ARCH} == "aarch64"
 DTS=   \
-   marvell/armada-3720-espressobin.dts
+   marvell/armada-3720-espressobin.dts \
+   marvell/armada-8040-clearfog-gt-8k.dts \
+   marvell/armada-8040-db \
+   marvell/armada-8040-mcbin.dts \
+   marvell/armada-8040-mcbin-singleshot.dts
 .endif
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-19 Thread Tom Jones
Author: thj
Date: Fri Jun 19 13:09:00 2020
New Revision: 362379
URL: https://svnweb.freebsd.org/changeset/base/362379

Log:
  Fix typo in apic.4
  
  Reviewed by:  bcr (manpages)
  Approved by:  jtl (co-mentor)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D25357

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

Modified: head/share/man/man4/apic.4
==
--- head/share/man/man4/apic.4  Fri Jun 19 12:38:27 2020(r362378)
+++ head/share/man/man4/apic.4  Fri Jun 19 13:09:00 2020(r362379)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2011
+.Dd June 19, 2020
 .Dt APIC 4
 .Os
 .Sh NAME
@@ -64,7 +64,7 @@ they receive from peripheral buses to one or more loca
 .Pp
 Each local APIC includes one 32-bit programmable timer.
 This driver uses them to supply kernel with one event timer named "LAPIC".
-Event timer provided by the driver supports both one-shot an periodic modes.
+Event timer provided by the driver supports both one-shot and periodic modes.
 Because of local APIC nature it is per-CPU.
 The timer frequency is not reported by the platform and so automatically
 measured by the driver on the first use.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362377 - head/sys/netinet

2020-06-19 Thread Michael Tuexen
Author: tuexen
Date: Fri Jun 19 12:35:29 2020
New Revision: 362377
URL: https://svnweb.freebsd.org/changeset/base/362377

Log:
  Remove last argument of sctp_addr_mgmt_ep_sa(), since it is not used.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_asconf.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_asconf.c
==
--- head/sys/netinet/sctp_asconf.c  Fri Jun 19 11:47:40 2020
(r362376)
+++ head/sys/netinet/sctp_asconf.c  Fri Jun 19 12:35:29 2020
(r362377)
@@ -3165,7 +3165,7 @@ sctp_check_address_list(struct sctp_tcb *stcb, struct 
  */
 uint32_t
 sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
-uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap)
+uint32_t type, uint32_t vrf_id)
 {
struct sctp_ifa *ifa;
struct sctp_laddr *laddr, *nladdr;
@@ -3174,9 +3174,7 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct so
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, 
EINVAL);
return (EINVAL);
}
-   if (sctp_ifap) {
-   ifa = sctp_ifap;
-   } else if (type == SCTP_ADD_IP_ADDRESS) {
+   if (type == SCTP_ADD_IP_ADDRESS) {
/* For an add the address MUST be on the system */
ifa = sctp_find_ifa_by_addr(sa, vrf_id, SCTP_ADDR_NOT_LOCKED);
} else if (type == SCTP_DEL_IP_ADDRESS) {

Modified: head/sys/netinet/sctp_asconf.h
==
--- head/sys/netinet/sctp_asconf.h  Fri Jun 19 11:47:40 2020
(r362376)
+++ head/sys/netinet/sctp_asconf.h  Fri Jun 19 12:35:29 2020
(r362377)
@@ -56,8 +56,8 @@ sctp_handle_asconf_ack(struct mbuf *, int, struct sctp
 struct sctp_tcb *, struct sctp_nets *, int *);
 
 extern uint32_t
-sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *,
-uint32_t, uint32_t, struct sctp_ifa *);
+sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *, uint32_t,
+uint32_t);
 
 
 extern int

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Fri Jun 19 11:47:40 2020(r362376)
+++ head/sys/netinet/sctputil.c Fri Jun 19 12:35:29 2020(r362377)
@@ -6804,8 +6804,7 @@ sctp_bindx_add_address(struct socket *so, struct sctp_
} else if (lep == NULL) {
((struct sockaddr_in *)addr_touse)->sin_port = 0;
*error = sctp_addr_mgmt_ep_sa(inp, addr_touse,
-   SCTP_ADD_IP_ADDRESS,
-   vrf_id, NULL);
+   SCTP_ADD_IP_ADDRESS, vrf_id);
} else {
*error = EADDRINUSE;
}
@@ -6896,8 +6895,7 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp,
if (assoc_id == 0) {
/* delete the address */
*error = sctp_addr_mgmt_ep_sa(inp, addr_touse,
-   SCTP_DEL_IP_ADDRESS,
-   vrf_id, NULL);
+   SCTP_DEL_IP_ADDRESS, vrf_id);
} else {
/*
 * FIX: decide whether we allow assoc based bindx
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362361 - in head/sys: compat/linuxkpi/common/src vm

2020-06-19 Thread Mark Johnston
On Fri, Jun 19, 2020 at 06:02:18PM +0800, Li-Wen Hsu wrote:
> On Fri, Jun 19, 2020 at 11:32 AM Mark Johnston  wrote:
> >
> > Author: markj
> > Date: Fri Jun 19 03:32:04 2020
> > New Revision: 362361
> > URL: https://svnweb.freebsd.org/changeset/base/362361
> >
> > Log:
> >   Add a helper function for validating VA ranges.
> >
> >   Functions which take untrusted user ranges must validate against the
> >   bounds of the map, and also check for wraparound.  Instead of having the
> >   same logic duplicated in a number of places, add a function to check.
> >
> >   Reviewed by:  dougm, kib
> >   Sponsored by: The FreeBSD Foundation
> >   MFC after:1 week
> >   Differential Revision:https://reviews.freebsd.org/D25328
> 
> I'm not sure if it's this one, or 3623630, the following i386 tests
> all panicked:

It was 3623630, which was totally wrong.

> https://ci.freebsd.org/job/FreeBSD-head-i386-test/9681/console
> 
> 00:11:31.669 lib/libc/net/protoent_test:protoent  ->  panic:
> __rw_wlock_hard: recursing but non-recursive rw vm object @
> /usr/src/sys/vm/vm_object.c:869
> 
> https://ci.freebsd.org/job/FreeBSD-head-i386-test/9682/console
> (includes the fix or r362363)
> 
> 00:27:53.864 bin/pkill/pkill-j_test:main  ->  Sleeping thread (tid
> 100115, pid 65628) owns a non-sleepable lock
> 
> https://ci.freebsd.org/job/FreeBSD-head-i386-test/9683/console
> 
> 00:02:26.917 bin/pkill/pkill-j_test:main  ->  Sleeping thread (tid
> 100152, pid 26582) owns a non-sleepable lock
> 
> Can you help check these?

I reverted the change.  Sorry for the breakage.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362371 - head/sys/vm

2020-06-19 Thread Mark Johnston
Author: markj
Date: Fri Jun 19 11:04:49 2020
New Revision: 362371
URL: https://svnweb.freebsd.org/changeset/base/362371

Log:
  Revert r362360.
  
  This commit was simply wrong since two different objects are locked.
  
  Reported by:  lwhsu, pho
  Pointy hat:   markj

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Fri Jun 19 10:33:45 2020(r362370)
+++ head/sys/vm/vm_object.c Fri Jun 19 11:04:49 2020(r362371)
@@ -864,6 +864,7 @@ vm_object_backing_collapse_wait(vm_object_t object)
VM_OBJECT_WLOCK(backing_object);
if ((backing_object->flags & (OBJ_DEAD | OBJ_COLLAPSING)) == 0)
break;
+   VM_OBJECT_WUNLOCK(object);
vm_object_pip_sleep(backing_object, "vmbckwait");
counter_u64_add(object_collapse_waits, 1);
VM_OBJECT_WLOCK(object);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362361 - in head/sys: compat/linuxkpi/common/src vm

2020-06-19 Thread Li-Wen Hsu
On Fri, Jun 19, 2020 at 11:32 AM Mark Johnston  wrote:
>
> Author: markj
> Date: Fri Jun 19 03:32:04 2020
> New Revision: 362361
> URL: https://svnweb.freebsd.org/changeset/base/362361
>
> Log:
>   Add a helper function for validating VA ranges.
>
>   Functions which take untrusted user ranges must validate against the
>   bounds of the map, and also check for wraparound.  Instead of having the
>   same logic duplicated in a number of places, add a function to check.
>
>   Reviewed by:  dougm, kib
>   Sponsored by: The FreeBSD Foundation
>   MFC after:1 week
>   Differential Revision:https://reviews.freebsd.org/D25328

I'm not sure if it's this one, or 3623630, the following i386 tests
all panicked:

https://ci.freebsd.org/job/FreeBSD-head-i386-test/9681/console

00:11:31.669 lib/libc/net/protoent_test:protoent  ->  panic:
__rw_wlock_hard: recursing but non-recursive rw vm object @
/usr/src/sys/vm/vm_object.c:869

https://ci.freebsd.org/job/FreeBSD-head-i386-test/9682/console
(includes the fix or r362363)

00:27:53.864 bin/pkill/pkill-j_test:main  ->  Sleeping thread (tid
100115, pid 65628) owns a non-sleepable lock

https://ci.freebsd.org/job/FreeBSD-head-i386-test/9683/console

00:02:26.917 bin/pkill/pkill-j_test:main  ->  Sleeping thread (tid
100152, pid 26582) owns a non-sleepable lock

Can you help check these?

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


svn commit: r362369 - head/bin/ps

2020-06-19 Thread Lorenzo Salvadore
Author: salvadore (ports committer)
Date: Fri Jun 19 09:27:58 2020
New Revision: 362369
URL: https://svnweb.freebsd.org/changeset/base/362369

Log:
  bin/ps: Make the rtprio option actually show realtime priorities
  
  Fix the rtprio option that for some reason was progessively becoming an
  option showing the priority class of threads. In particular:
  
  - use the constants defined in sys/sys/rtprio.h instead of those defined in
sys/sys/priority.h: this helps making clearer that the code actually is
about realtime priorities and not standard scheduler priorities;
  - remove the PRI_ITHD case that has nothing to do with realtime priorities;
  - convert the priority levels to realtime priority levels using the same
formulas used for pri_to_rtp function in sys/kern/kern_resource.c.
  - remove outdated note "101 = not a realtime process" in the man page and
replace it with a more useful reference to man 1 rtprio.
  
  Approved by:  src (mckusick), manpages (bcr), gerald (mentor)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25266

Modified:
  head/bin/ps/print.c
  head/bin/ps/ps.1

Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Fri Jun 19 07:07:10 2020(r362368)
+++ head/bin/ps/print.c Fri Jun 19 09:27:58 2020(r362369)
@@ -704,17 +704,17 @@ priorityr(KINFO *k, VARENT *ve __unused)
class = lpri->pri_class;
level = lpri->pri_level;
switch (class) {
-   case PRI_ITHD:
-   asprintf(, "intr:%u", level);
+   case RTP_PRIO_REALTIME:
+   /* alias for PRI_REALTIME */
+   asprintf(, "real:%u", level - PRI_MIN_REALTIME);
break;
-   case PRI_REALTIME:
-   asprintf(, "real:%u", level);
+   case RTP_PRIO_NORMAL:
+   /* alias for PRI_TIMESHARE */
+   asprintf(, "normal:%u", level - PRI_MIN_TIMESHARE);
break;
-   case PRI_TIMESHARE:
-   asprintf(, "normal");
-   break;
-   case PRI_IDLE:
-   asprintf(, "idle:%u", level);
+   case RTP_PRIO_IDLE:
+   /* alias for PRI_IDLE */
+   asprintf(, "idle:%u", level - PRI_MIN_IDLE);
break;
default:
asprintf(, "%u:%u", class, level);

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Fri Jun 19 07:07:10 2020(r362368)
+++ head/bin/ps/ps.1Fri Jun 19 09:27:58 2020(r362369)
@@ -648,7 +648,8 @@ group name (from rgid)
 .It Cm rss
 resident set size
 .It Cm rtprio
-realtime priority (101 = not a realtime process)
+realtime priority (see
+.Xr rtprio 1)
 .It Cm ruid
 real user ID
 .It Cm ruser
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362367 - head/usr.bin/diff

2020-06-19 Thread Fernando ApesteguĂ­a
Author: fernape (ports committer)
Date: Fri Jun 19 06:48:16 2020
New Revision: 362367
URL: https://svnweb.freebsd.org/changeset/base/362367

Log:
  diff(1): Add EXAMPLES section
  
  Add examples for -r, -u, -N, -x, -q and -I
  
  Approved by:  0mp@
  Differential Revision:https://reviews.freebsd.org/D25345

Modified:
  head/usr.bin/diff/diff.1

Modified: head/usr.bin/diff/diff.1
==
--- head/usr.bin/diff/diff.1Fri Jun 19 06:35:57 2020(r362366)
+++ head/usr.bin/diff/diff.1Fri Jun 19 06:48:16 2020(r362367)
@@ -30,7 +30,7 @@
 .\" @(#)diff.1 8.1 (Berkeley) 6/30/93
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2020
+.Dd June 19, 2020
 .Dt DIFF 1
 .Os
 .Sh NAME
@@ -277,8 +277,7 @@ Produces a script similar to that of
 .Fl e ,
 but in the opposite order and with a count of changed lines on each
 insert or delete command.
-This is the form used by
-.Xr rcsdiff 1 .
+This is the form used by rcsdiff.
 .It Fl q -brief
 Just print a line when the files differ.
 Does not output a list of changes.
@@ -613,6 +612,49 @@ Differences were found.
 .It >1
 An error occurred.
 .El
+.Sh EXAMPLES
+Compare
+.Pa old_dir
+and
+.Pa new_dir
+recursively generating an unified diff and treating files found only in one
+of those directories as new files:
+.Bd -literal -offset indent
+$ diff -ruN /path/to/old_dir /path/to/new_dir
+.Ed
+.Pp
+Same as above but excluding files matching the expressions
+.Dq *.h
+and
+.Dq *.c :
+.Bd -literal -offset indent
+$ diff -ruN -x '*.h' -x '*.c' /path/to/old_dir /path/to/new_dir
+.Ed
+.Pp
+Show a single line indicating if the files differ:
+.Bd -literal -offset indent
+$ diff -q /boot/loader.conf /boot/defaults/loader.conf
+Files /boot/loader.conf and /boot/defaults/loader.conf differ
+.Ed
+.Pp
+Assuming a file named
+.Pa example.txt
+with the following contents:
+.Bd -literal -offset indent
+FreeBSD is an operating system
+Linux is a kernel
+OpenBSD is an operating system
+.Ed
+.Pp
+Compare stdin with
+.Pa example.txt
+excluding from the comparison those lines containing either
+.Qq Linux
+or
+.Qq Open :
+.Bd -literal -offset indent
+$ echo "FreeBSD is an operating system" | diff -q -I 'Linux|Open' example.txt -
+.Ed
 .Sh SEE ALSO
 .Xr cmp 1 ,
 .Xr comm 1 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362365 - head/sbin/md5

2020-06-19 Thread Fernando ApesteguĂ­a
Author: fernape (ports committer)
Date: Fri Jun 19 06:23:55 2020
New Revision: 362365
URL: https://svnweb.freebsd.org/changeset/base/362365

Log:
  md5(1): Add EXAMPLES section
  
  Add EXAMLES covering -c, -s and -r
  
  Approved by:  bcr@, 0mp@
  Differential Revision:https://reviews.freebsd.org/D25278

Modified:
  head/sbin/md5/md5.1

Modified: head/sbin/md5/md5.1
==
--- head/sbin/md5/md5.1 Fri Jun 19 05:54:15 2020(r362364)
+++ head/sbin/md5/md5.1 Fri Jun 19 06:23:55 2020(r362365)
@@ -1,5 +1,5 @@
 .\" $FreeBSD$
-.Dd June 15, 2020
+.Dd June 19, 2020
 .Dt MD5 1
 .Os
 .Sh NAME
@@ -95,6 +95,48 @@ utilities exit 0 on success,
 and 2 if at least one file does not have the same hash as the
 .Fl c
 option.
+.Sh EXAMPLES
+Calculate the MD5 checksum of the string
+.Dq Hello .
+.Bd -literal -offset indent
+$ md5 -s Hello
+MD5 ("Hello") = 8b1a9953c4611296a827abf8c47804d7
+.Ed
+.Pp
+Same as above, but note the absence of the newline character in the input
+string:
+.Bd -literal -offset indent
+$ echo -n Hello | md5
+8b1a9953c4611296a827abf8c47804d7
+.Ed
+.Pp
+Calculate the checksum of multiple files reversing the output:
+.Bd -literal -offset indent
+$ md5 -r /boot/loader.conf /etc/rc.conf
+ada5f60f23af88ff95b8091d6d67bef6 /boot/loader.conf
+d80bf36c332dc0fdc479366ec3fa44cd /etc/rc.conf
+.Ed
+.Pp
+Write the digest for
+.Pa /boot/loader.conf
+in a file named
+.Pa digest .
+Then calculate the checksum again and validate it against the checksum string
+extracted from the
+.Pa digest
+file:
+.Bd -literal -offset indent
+$ md5 /boot/loader.conf > digest && md5 -c $(cut -f2 -d= digest) 
/boot/loader.conf
+MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6
+.Ed
+.Pp
+Same as above but comparing the digest against an invalid string
+.Pq Dq randomstring ,
+which results in a failure.
+.Bd -literal -offset indent
+$ md5 -c randomstring /boot/loader.conf
+MD5 (/boot/loader.conf) = ada5f60f23af88ff95b8091d6d67bef6 [ Failed ]
+.Ed
 .Sh SEE ALSO
 .Xr cksum 1 ,
 .Xr md5 3 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"