CVS commit: src/share/man/man4
Module Name:src Committed By: wiz Date: Sat Mar 28 05:47:41 UTC 2020 Modified Files: src/share/man/man4: audio.4 Log Message: Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/share/man/man4/audio.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/audio.4 diff -u src/share/man/man4/audio.4:1.102 src/share/man/man4/audio.4:1.103 --- src/share/man/man4/audio.4:1.102 Sat Mar 28 04:55:08 2020 +++ src/share/man/man4/audio.4 Sat Mar 28 05:47:41 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: audio.4,v 1.102 2020/03/28 04:55:08 isaki Exp $ +.\" $NetBSD: audio.4,v 1.103 2020/03/28 05:47:41 wiz Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -418,7 +418,7 @@ If the underlying driver only supports m or stereo (2channels), you can specify 1 or 2 regardless of number of channels supported by underlying driver. If the underlying driver supports three or more channels, you can specify -the number of channels supported by the underlying driver or less. +the number of channels supported by the underlying driver or less. .Pp The .Va gain ,
CVS commit: src/share/man/man4
Module Name:src Committed By: isaki Date: Sat Mar 28 04:55:08 UTC 2020 Modified Files: src/share/man/man4: audio.4 Log Message: Add description about channel limitation introduced in audio.c 1.43. PR kern/54973. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/share/man/man4/audio.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/audio.4 diff -u src/share/man/man4/audio.4:1.101 src/share/man/man4/audio.4:1.102 --- src/share/man/man4/audio.4:1.101 Sat Mar 28 04:21:58 2020 +++ src/share/man/man4/audio.4 Sat Mar 28 04:55:08 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: audio.4,v 1.101 2020/03/28 04:21:58 isaki Exp $ +.\" $NetBSD: audio.4,v 1.102 2020/03/28 04:55:08 isaki Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -400,18 +400,25 @@ unsigned linear encoding with big endian Dolby Digital AC3 .El .Pp -Regardless of formats supported by underlying driver, the +The .Nm driver accepts the following formats. .Va encoding and .Va precision are one of the values obtained by -.Dv AUDIO_GETENC . -.Va channels -ranges from 1 to 12. +.Dv AUDIO_GETENC , +regardless of formats supported by underlying driver. .Va frequency -ranges from 1000Hz to 192000Hz. +ranges from 1000Hz to 192000Hz, +regardless of frequency (ranges) supported by underlying driver. +.Va channels +depends your underlying driver. +If the underlying driver only supports monaural (1channel) +or stereo (2channels), you can specify 1 or 2 regardless of +number of channels supported by underlying driver. +If the underlying driver supports three or more channels, you can specify +the number of channels supported by the underlying driver or less. .Pp The .Va gain ,
CVS commit: src/share/man/man4
Module Name:src Committed By: isaki Date: Sat Mar 28 04:21:58 UTC 2020 Modified Files: src/share/man/man4: audio.4 Log Message: Revert 1.96, 1.97 and 1.100. (no response from nia@) These changes are not correct nor notable unresolvable problem. If you find any problems, please send a report before changing manpage. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/share/man/man4/audio.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/audio.4 diff -u src/share/man/man4/audio.4:1.100 src/share/man/man4/audio.4:1.101 --- src/share/man/man4/audio.4:1.100 Tue Mar 17 10:50:59 2020 +++ src/share/man/man4/audio.4 Sat Mar 28 04:21:58 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: audio.4,v 1.100 2020/03/17 10:50:59 nia Exp $ +.\" $NetBSD: audio.4,v 1.101 2020/03/28 04:21:58 isaki Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 16, 2020 +.Dd March 28, 2020 .Dt AUDIO 4 .Os .Sh NAME @@ -157,6 +157,14 @@ For historical reasons, only encodings t .Dv AUDIO_ENCODINGFLAG_EMULATED are able to .Xr mmap 2 . +.Pp +The audio device, like most devices, can be used in +.Xr select 2 , +can be set in non-blocking mode and can be set (with a +.Dv FIOASYNC +ioctl) to send a +.Dv SIGIO +when I/O is possible. The mixer device can be set to generate a .Dv SIGIO whenever a mixer value is changed. @@ -401,7 +409,7 @@ and are one of the values obtained by .Dv AUDIO_GETENC . .Va channels -ranges from 1 to 12 for playback. +ranges from 1 to 12. .Va frequency ranges from 1000Hz to 192000Hz. .Pp @@ -811,12 +819,6 @@ string values. .Sh HISTORY Support for virtual channels and mixing first appeared in .Nx 8.0 . -.Sh CAVEATS -The audio device cannot be reliably used with event notification mechanisms -such as -.Xr poll 2 . -Most users are expected to only read and write a limited number of samples at -a time, limiting the time spent in the system call. .Sh BUGS If the device is used in .Xr mmap 2
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Sat Mar 28 02:38:15 UTC 2020 Modified Files: src/lib/libterminfo: compile.c Log Message: support for older compilers To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libterminfo/compile.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/compile.c diff -u src/lib/libterminfo/compile.c:1.16 src/lib/libterminfo/compile.c:1.17 --- src/lib/libterminfo/compile.c:1.16 Fri Mar 27 13:39:53 2020 +++ src/lib/libterminfo/compile.c Fri Mar 27 22:38:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compile.c,v 1.16 2020/03/27 17:39:53 christos Exp $ */ +/* $NetBSD: compile.c,v 1.17 2020/03/28 02:38:15 christos Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2020 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include -__RCSID("$NetBSD: compile.c,v 1.16 2020/03/27 17:39:53 christos Exp $"); +__RCSID("$NetBSD: compile.c,v 1.17 2020/03/28 02:38:15 christos Exp $"); #if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H #include @@ -416,7 +416,9 @@ _ti_get_token(char **cap, char sep) static int _ti_find_rtype(const char *cap) { - for (const char *ptr = cap; (ptr = strchr(ptr, '#')) != NULL;) { + const char *ptr; + + for (ptr = cap; (ptr = strchr(ptr, '#')) != NULL;) { if (strtol(++ptr, NULL, 0) > SHRT_MAX) { return TERMINFO_RTYPE; }
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: christos Date: Sat Mar 28 01:08:43 UTC 2020 Modified Files: src/sys/ufs/lfs: lfs.h Log Message: Comment out some of the CTASSERTS for lint until I fix lint. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/sys/ufs/lfs/lfs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs.h diff -u src/sys/ufs/lfs/lfs.h:1.207 src/sys/ufs/lfs/lfs.h:1.208 --- src/sys/ufs/lfs/lfs.h:1.207 Sat Mar 21 02:11:05 2020 +++ src/sys/ufs/lfs/lfs.h Fri Mar 27 21:08:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs.h,v 1.207 2020/03/21 06:11:05 riastradh Exp $ */ +/* $NetBSD: lfs.h,v 1.208 2020/03/28 01:08:42 christos Exp $ */ /* from NetBSD: dinode.h,v 1.25 2016/01/22 23:06:10 dholland Exp */ /* from NetBSD: dir.h,v 1.25 2015/09/01 06:16:03 dholland Exp */ @@ -370,7 +370,9 @@ union lfs_dirheader { struct lfs_dirheader32 u_32; }; __CTASSERT(__alignof(union lfs_dirheader) == __alignof(struct lfs_dirheader64)); +#ifndef __lint__ __CTASSERT(__alignof(union lfs_dirheader) == __alignof(struct lfs_dirheader32)); +#endif typedef union lfs_dirheader LFS_DIRHEADER; @@ -583,7 +585,9 @@ typedef union finfo { struct finfo32 u_32; } FINFO; __CTASSERT(__alignof(union finfo) == __alignof(struct finfo64)); +#ifndef __lint__ __CTASSERT(__alignof(union finfo) == __alignof(struct finfo32)); +#endif /* * inode info (part of the segment summary) @@ -608,7 +612,9 @@ typedef union iinfo { struct iinfo32 u_32; } IINFO; __CTASSERT(__alignof(union iinfo) == __alignof(struct iinfo64)); +#ifndef __lint__ __CTASSERT(__alignof(union iinfo) == __alignof(struct iinfo32)); +#endif /* * Index file inode entries. @@ -663,8 +669,10 @@ typedef union ifile { struct ifile_v1 u_v1; } IFILE; __CTASSERT(__alignof(union ifile) == __alignof(struct ifile64)); +#ifndef __lint__ __CTASSERT(__alignof(union ifile) == __alignof(struct ifile32)); __CTASSERT(__alignof(union ifile) == __alignof(struct ifile_v1)); +#endif /* * Cleaner information structure. This resides in the ifile and is used @@ -702,8 +710,10 @@ typedef union _cleanerinfo { CLEANERINFO32 u_32; CLEANERINFO64 u_64; } CLEANERINFO; +#ifndef __lint__ __CTASSERT(__alignof(union _cleanerinfo) == __alignof(struct _cleanerinfo32)); __CTASSERT(__alignof(union _cleanerinfo) == __alignof(struct _cleanerinfo64)); +#endif /* * On-disk segment summary information @@ -781,7 +791,9 @@ union segsum { }; __CTASSERT(__alignof(union segsum) == __alignof(struct segsum64)); __CTASSERT(__alignof(union segsum) == __alignof(struct segsum32)); +#ifndef __lint__ __CTASSERT(__alignof(union segsum) == __alignof(struct segsum_v1)); +#endif /* * On-disk super block.
CVS commit: src/share/installboot/evbarm
Module Name:src Committed By: bad Date: Fri Mar 27 23:02:33 UTC 2020 Modified Files: src/share/installboot/evbarm: boards.plist Log Message: Belatedly add NanoPi R1. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/share/installboot/evbarm/boards.plist Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/installboot/evbarm/boards.plist diff -u src/share/installboot/evbarm/boards.plist:1.6 src/share/installboot/evbarm/boards.plist:1.7 --- src/share/installboot/evbarm/boards.plist:1.6 Fri Mar 27 02:01:48 2020 +++ src/share/installboot/evbarm/boards.plist Fri Mar 27 23:02:33 2020 @@ -1,4 +1,4 @@ - +
CVS commit: src/sys/arch/i386/i386
Module Name:src Committed By: ad Date: Fri Mar 27 21:05:03 UTC 2020 Modified Files: src/sys/arch/i386/i386: locore.S Log Message: PR kern/55114: Install fails with "cpu_switchto: switching above IPL_SCHED (8)" cpu_switch(): Remove stuff dealing with interrupt levels. From memory it was something to do with TLB shootdown interrupts but they have long been outside the SPL framework. To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/sys/arch/i386/i386/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.178 src/sys/arch/i386/i386/locore.S:1.179 --- src/sys/arch/i386/i386/locore.S:1.178 Mon Feb 10 22:13:50 2020 +++ src/sys/arch/i386/i386/locore.S Fri Mar 27 21:05:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.178 2020/02/10 22:13:50 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.179 2020/03/27 21:05:03 ad Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.178 2020/02/10 22:13:50 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.179 2020/03/27 21:05:03 ad Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -1301,17 +1301,6 @@ ENTRY(cpu_switchto) pushl %esi pushl %edi -#if defined(DIAGNOSTIC) && !defined(XENPV) - cmpl $IPL_SCHED,CPUVAR(ILEVEL) - jbe 0f - pushl CPUVAR(ILEVEL) - pushl $.Lstr - call _C_LABEL(panic) - addl $8,%esp -.Lstr: .string "cpu_switchto: switching above IPL_SCHED (%d)\0" -0: -#endif - movl 16(%esp),%esi /* oldlwp */ movl 20(%esp),%edi /* newlwp */ movl 24(%esp),%edx /* returning */ @@ -1408,10 +1397,6 @@ no_RAS: pushl %edi call _C_LABEL(i386_tls_switch) addl $4,%esp -#else - /* Raise the IPL to IPL_HIGH. Dropping the priority is deferred until - * mi_switch(), when cpu_switchto() returns. XXX Still needed? */ - movl $IPL_HIGH,CPUVAR(ILEVEL) #endif switch_return:
CVS commit: src/usr.bin/calendar/calendars
Module Name:src Committed By: sevan Date: Fri Mar 27 21:03:18 UTC 2020 Modified Files: src/usr.bin/calendar/calendars: calendar.music Log Message: Add higher state of consciousness https://twitter.com/joshwink1/status/1243360644042113024 To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/calendar/calendars/calendar.music Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/calendar/calendars/calendar.music diff -u src/usr.bin/calendar/calendars/calendar.music:1.22 src/usr.bin/calendar/calendars/calendar.music:1.23 --- src/usr.bin/calendar/calendars/calendar.music:1.22 Sun Feb 23 23:56:15 2020 +++ src/usr.bin/calendar/calendars/calendar.music Fri Mar 27 21:03:17 2020 @@ -56,6 +56,8 @@ 03/22 Ten Years After plays their last concert, 1974 03/25 Aretha Franklin is born in Detroit, 1943 03/26 Emerson, Lake, and Palmer record "Pictures at an Exhibition" live, 1971 +03/26 Josh Wink's "Higher State of Consciousness" released on Strictly Rythm, + 1995 03/29 Dr. Hook gets a group picture on the cover of "Rolling Stone", 1973 03/30 Eric Clapton is born in Surrey, England, 1945 04/02 Marvin Gaye is born in Washington, D.C., 1939
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: jdolecek Date: Fri Mar 27 18:37:30 UTC 2020 Modified Files: src/sys/arch/xen/xen: if_xennet_xenbus.c xennetback_xenbus.c Log Message: use standard deferred if_start framework instead of custom variant To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/xen/xen/if_xennet_xenbus.c cvs rdiff -u -r1.85 -r1.86 src/sys/arch/xen/xen/xennetback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/if_xennet_xenbus.c diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.96 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.97 --- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.96 Thu Mar 26 18:50:16 2020 +++ src/sys/arch/xen/xen/if_xennet_xenbus.c Fri Mar 27 18:37:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_xennet_xenbus.c,v 1.96 2020/03/26 18:50:16 jdolecek Exp $ */ +/* $NetBSD: if_xennet_xenbus.c,v 1.97 2020/03/27 18:37:30 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -61,11 +61,11 @@ * * For TX: * Purpose is to transmit packets to the outside. The start of day is in - * xennet_start() (default output routine of xennet) that schedules a softint, - * xennet_softstart(). xennet_softstart() generates the requests associated + * xennet_start() (output routine of xennet) scheduled via a softint. + * xennet_start() generates the requests associated * to the TX mbufs queued (see altq(9)). * The backend's responses are processed by xennet_tx_complete(), called - * from xennet_softstart() + * from xennet_start() * * for RX: * Purpose is to process the packets received from the outside. RX buffers @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.96 2020/03/26 18:50:16 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.97 2020/03/27 18:37:30 jdolecek Exp $"); #include "opt_xen.h" #include "opt_nfs_boot.h" @@ -190,7 +190,6 @@ struct xennet_xenbus_softc { netif_rx_front_ring_t sc_rx_ring; unsigned int sc_evtchn; - void *sc_softintr; struct intrhand *sc_ih; grant_ref_t sc_tx_ring_gntref; @@ -243,7 +242,6 @@ static void xennet_hex_dump(const unsign static int xennet_init(struct ifnet *); static void xennet_stop(struct ifnet *, int); static void xennet_reset(struct xennet_xenbus_softc *); -static void xennet_softstart(void *); static void xennet_start(struct ifnet *); static int xennet_ioctl(struct ifnet *, u_long, void *); static void xennet_watchdog(struct ifnet *); @@ -396,11 +394,8 @@ xennet_xenbus_attach(device_t parent, de IFQ_SET_READY(>if_snd); if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr); - sc->sc_softintr = softint_establish(SOFTINT_NET, xennet_softstart, sc); - if (sc->sc_softintr == NULL) - panic("%s: can't establish soft interrupt", - device_xname(self)); /* alloc shared rings */ tx_ring = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0, @@ -481,7 +476,6 @@ xennet_xenbus_detach(device_t self, int xengnt_revoke_access(sc->sc_rx_ring_gntref); uvm_km_free(kernel_map, (vaddr_t)sc->sc_rx_ring.sring, PAGE_SIZE, UVM_KMF_WIRED); - softint_disestablish(sc->sc_softintr); splx(s0); pmf_device_deregister(self); @@ -930,7 +924,7 @@ xennet_rx_free_req(struct xennet_rxreq * /* * Process responses associated to the TX mbufs sent previously through - * xennet_softstart() + * xennet_start() * Called at splsoftnet. */ static void @@ -999,10 +993,7 @@ xennet_handler(void *arg) return 1; /* Poke Tx queue if we run out of Tx buffers earlier */ - mutex_enter(>sc_tx_lock); - if (SLIST_EMPTY(>sc_txreq_head)) - softint_schedule(sc->sc_softintr); - mutex_exit(>sc_tx_lock); + if_schedule_deferred_start(ifp); rnd_add_uint32(>sc_rnd_source, sc->sc_tx_ring.req_prod_pvt); @@ -1141,38 +1132,14 @@ again: } /* - * The output routine of a xennet interface - * Called at splnet. + * The output routine of a xennet interface. Prepares mbufs for TX, + * and notify backend when finished. + * Called at splsoftnet. */ void xennet_start(struct ifnet *ifp) { struct xennet_xenbus_softc *sc = ifp->if_softc; - - DPRINTFN(XEDB_FOLLOW, ("%s: xennet_start()\n", device_xname(sc->sc_dev))); - - rnd_add_uint32(>sc_rnd_source, sc->sc_tx_ring.req_prod_pvt); - - /* - * The Xen communication channel is much more efficient if we can - * schedule batch of packets for domain0. To achieve this, we - * schedule a soft interrupt, and just return. This way, the network - * stack will enqueue all pending mbufs in the interface's send queue - * before it is processed by xennet_softstart(). - */ - softint_schedule(sc->sc_softintr); - return; -} - -/* - * Prepares mbufs for TX, and notify backend when finished - * Called at splsoftnet - */ -void -xennet_softstart(void *arg) -{ - struct xennet_xenbus_softc *sc = arg; - struct ifnet *ifp = >sc_ethercom.ec_if; struct
CVS commit: src/sys/dev/usb
Module Name:src Committed By: nisimura Date: Fri Mar 27 18:04:45 UTC 2020 Modified Files: src/sys/dev/usb: if_axe.c if_ure.c Log Message: - change to use rcvfilt_locked() name to clarify the intent. - stylise receive filter manipulation logic. - use ETHER_F_ALLMULTI flag. To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/sys/dev/usb/if_axe.c cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/if_ure.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_axe.c diff -u src/sys/dev/usb/if_axe.c:1.130 src/sys/dev/usb/if_axe.c:1.131 --- src/sys/dev/usb/if_axe.c:1.130 Sun Mar 15 23:04:50 2020 +++ src/sys/dev/usb/if_axe.c Fri Mar 27 18:04:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axe.c,v 1.130 2020/03/15 23:04:50 thorpej Exp $ */ +/* $NetBSD: if_axe.c,v 1.131 2020/03/27 18:04:45 nisimura Exp $ */ /* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */ /* @@ -87,7 +87,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.130 2020/03/15 23:04:50 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.131 2020/03/27 18:04:45 nisimura Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -426,7 +426,7 @@ axe_uno_mii_statchg(struct ifnet *ifp) } static void -axe_setiff_locked(struct usbnet *un) +axe_rcvfilt_locked(struct usbnet *un) { AXEHIST_FUNC(); AXEHIST_CALLED(); struct axe_softc * const sc = usbnet_softc(un); @@ -434,9 +434,9 @@ axe_setiff_locked(struct usbnet *un) struct ethercom *ec = usbnet_ec(un); struct ether_multi *enm; struct ether_multistep step; - uint32_t h = 0; uint16_t rxmode; - uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + uint32_t h = 0; + uint8_t mchash[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; if (usbnet_isdying(un)) return; @@ -450,38 +450,34 @@ axe_setiff_locked(struct usbnet *un) rxmode &= ~(AXE_RXCMD_ALLMULTI | AXE_RXCMD_PROMISC | AXE_RXCMD_MULTICAST); + ETHER_LOCK(ec); if (ifp->if_flags & IFF_PROMISC) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; + ec->ec_flags |= ETHER_F_ALLMULTI; + ETHER_UNLOCK(ec); + /* run promisc. mode */ + rxmode |= AXE_RXCMD_ALLMULTI; /* ??? */ + rxmode |= AXE_RXCMD_PROMISC; + goto update; } - ifp->if_flags &= ~IFF_ALLMULTI; - - /* Now program new ones */ - ETHER_LOCK(ec); + ec->ec_flags &= ~ETHER_F_ALLMULTI; ETHER_FIRST_MULTI(step, ec, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN) != 0) { + if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { + ec->ec_flags |= ETHER_F_ALLMULTI; ETHER_UNLOCK(ec); - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; + /* accept all mcast frames */ + rxmode |= AXE_RXCMD_ALLMULTI; + goto update; } - - h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26; - hashtbl[h >> 3] |= 1U << (h & 7); + h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); + mchash[h >> 29] |= 1U << ((h >> 26) & 7); ETHER_NEXT_MULTI(step, enm); } ETHER_UNLOCK(ec); - - rxmode |= AXE_RXCMD_MULTICAST; /* activate mcast hash filter */ - axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, hashtbl); - axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); - return; - - allmulti: - if (ifp->if_flags & IFF_PROMISC) - rxmode |= AXE_RXCMD_PROMISC; /* run promisc. mode */ - rxmode |= AXE_RXCMD_ALLMULTI; /* accept all mcast frames */ + if (h != 0) + rxmode |= AXE_RXCMD_MULTICAST; /* activate mcast hash filter */ + axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, mchash); + update: axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); } @@ -1311,7 +1307,7 @@ axe_init_locked(struct ifnet *ifp) axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); /* Accept multicast frame or run promisc. mode */ - axe_setiff_locked(un); + axe_rcvfilt_locked(un); return usbnet_init_rx_tx(un); } @@ -1341,7 +1337,7 @@ axe_uno_ioctl(struct ifnet *ifp, u_long switch (cmd) { case SIOCADDMULTI: case SIOCDELMULTI: - axe_setiff_locked(un); + axe_rcvfilt_locked(un); break; default: break; Index: src/sys/dev/usb/if_ure.c diff -u src/sys/dev/usb/if_ure.c:1.39 src/sys/dev/usb/if_ure.c:1.40 --- src/sys/dev/usb/if_ure.c:1.39 Sat Mar 21 06:54:43 2020 +++ src/sys/dev/usb/if_ure.c Fri Mar 27 18:04:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ure.c,v 1.39 2020/03/21 06:54:43 skrll Exp $ */ +/* $NetBSD: if_ure.c,v 1.40 2020/03/27 18:04:45 nisimura Exp $ */ /* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */ /*- @@ -30,7 +30,7 @@ /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.39 2020/03/21 06:54:43 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.40 2020/03/27 18:04:45 nisimura Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -331,15 +331,14 @@ ure_uno_miibus_statchg(struct ifnet *ifp } static void -ure_setiff_locked(struct usbnet *un) +ure_rcvfilt_locked(struct usbnet *un) { struct ethercom *ec =
CVS commit: src/usr.bin/tic
Module Name:src Committed By: christos Date: Fri Mar 27 17:42:36 UTC 2020 Modified Files: src/usr.bin/tic: tic.c Log Message: Use the new functions and add more error checking. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/tic/tic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tic/tic.c diff -u src/usr.bin/tic/tic.c:1.33 src/usr.bin/tic/tic.c:1.34 --- src/usr.bin/tic/tic.c:1.33 Fri Mar 27 11:11:57 2020 +++ src/usr.bin/tic/tic.c Fri Mar 27 13:42:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tic.c,v 1.33 2020/03/27 15:11:57 christos Exp $ */ +/* $NetBSD: tic.c,v 1.34 2020/03/27 17:42:36 christos Exp $ */ /* * Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include -__RCSID("$NetBSD: tic.c,v 1.33 2020/03/27 15:11:57 christos Exp $"); +__RCSID("$NetBSD: tic.c,v 1.34 2020/03/27 17:42:36 christos Exp $"); #include #include @@ -104,12 +104,13 @@ save_term(struct cdbw *db, TERM *term) size_t slen = strlen(term->name) + 1; if (term->base_term != NULL) { - len = (ssize_t)slen + 7; + char *cap; + len = (ssize_t)(1 + sizeof(uint32_t) + sizeof(uint16_t) + slen); buf = emalloc(len); - buf[0] = TERMINFO_ALIAS; - le32enc(buf + 1, term->base_term->id); - le16enc(buf + 5, slen); - memcpy(buf + 7, term->name, slen); + cap = (char *)buf; + *cap++ = TERMINFO_ALIAS; + _ti_encode_32(, term->base_term->id); + _ti_encode_count_str(, term->name, slen); if (cdbw_put(db, term->name, slen, buf, len)) err(1, "cdbw_put"); free(buf); @@ -229,63 +230,47 @@ merge(TIC *rtic, TIC *utic, int flags) cap = utic->flags.buf; for (n = utic->flags.entries; n > 0; n--) { - ind = le16dec(cap); - cap += sizeof(uint16_t); + ind = _ti_decode_16(); flag = *cap++; if (VALID_BOOLEAN(flag) && _ti_find_cap(rtic, >flags, 'f', ind) == NULL) { - _ti_grow_tbuf(>flags, sizeof(uint16_t) + 1); - le16enc(rtic->flags.buf + rtic->flags.bufpos, ind); - rtic->flags.bufpos += sizeof(uint16_t); - rtic->flags.buf[rtic->flags.bufpos++] = flag; - rtic->flags.entries++; + if (!_ti_encode_buf_id_flags(>flags, ind, flag)) +err(1, "encode flag"); } } cap = utic->nums.buf; for (n = utic->nums.entries; n > 0; n--) { - ind = le16dec(cap); - cap += sizeof(uint16_t); - num = _ti_decode_num(utic->rtype, ); + ind = _ti_decode_16(); + num = _ti_decode_num(, utic->rtype); if (VALID_NUMERIC(num) && _ti_find_cap(rtic, >nums, 'n', ind) == NULL) { - grow_tbuf(>nums, sizeof(uint16_t) + - _ti_numsize(rtic)); - le16enc(rtic->nums.buf + rtic->nums.bufpos, ind); - rtic->nums.bufpos += sizeof(uint16_t); - _ti_encode_num(rtic, >nums, num); - rtic->nums.entries++; + if (!_ti_encode_buf_id_num(>nums, ind, num, + _ti_numsize(rtic))) +err(1, "encode num"); } } cap = utic->strs.buf; for (n = utic->strs.entries; n > 0; n--) { - ind = le16dec(cap); - cap += sizeof(uint16_t); - len = le16dec(cap); - cap += sizeof(uint16_t); + ind = _ti_decode_16(); + len = _ti_decode_16(); if (len > 0 && _ti_find_cap(rtic, >strs, 's', ind) == NULL) { - grow_tbuf(>strs, (sizeof(uint16_t) * 2) + len); - le16enc(rtic->strs.buf + rtic->strs.bufpos, ind); - rtic->strs.bufpos += sizeof(uint16_t); - le16enc(rtic->strs.buf + rtic->strs.bufpos, len); - rtic->strs.bufpos += sizeof(uint16_t); - memcpy(rtic->strs.buf + rtic->strs.bufpos, - cap, len); - rtic->strs.bufpos += len; - rtic->strs.entries++; + if (!_ti_encode_buf_id_count_str(>strs, ind, cap, + len)) +err(1, "encode str"); + } cap += len; } cap = utic->extras.buf; for (n = utic->extras.entries; n > 0; n--) { - num = le16dec(cap); - cap += sizeof(uint16_t); + num = _ti_decode_16(); code = cap; cap += num; type = *cap++; @@ -298,13 +283,12 @@ merge(TIC *rtic, TIC *utic, int flags) continue; break; case 'n': - num = _ti_decode_num(utic->rtype, ); + num = _ti_decode_num(, utic->rtype); if (!VALID_NUMERIC(num)) continue; break; case 's': - num = le16dec(cap); - cap += sizeof(uint16_t); + num = _ti_decode_16(); str = cap; cap += num; if (num == 0) @@ -320,7 +304,7 @@ static size_t merge_use(int flags) { size_t skipped, merged, memn; - char *cap, *scap; + const char *cap; uint16_t num; TIC *rtic, *utic; TERM *term, *uterm;; @@ -368,10 +352,11 @@ merge_use(int flags) dowarn("%s: use no longer exists - impossible", rtic->name); else { -scap = cap - (4 + sizeof(uint16_t)); +char *scap = __UNCONST( +cap - (4 + sizeof(uint16_t))); cap++; -num = le16dec(cap); -cap += sizeof(uint16_t) + num; +num = _ti_decode_16(); +cap += num; memn = rtic->extras.bufpos - (cap - rtic->extras.buf); memmove(scap, cap, memn);
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Fri Mar 27 17:39:53 UTC 2020 Modified Files: src/lib/libterminfo: compile.c term.c term_private.h termcap.c Log Message: Introduce a bunch of inline functions and utilities to avoid code duplication. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/lib/libterminfo/compile.c cvs rdiff -u -r1.31 -r1.32 src/lib/libterminfo/term.c cvs rdiff -u -r1.13 -r1.14 src/lib/libterminfo/term_private.h cvs rdiff -u -r1.22 -r1.23 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/compile.c diff -u src/lib/libterminfo/compile.c:1.15 src/lib/libterminfo/compile.c:1.16 --- src/lib/libterminfo/compile.c:1.15 Fri Mar 27 11:11:57 2020 +++ src/lib/libterminfo/compile.c Fri Mar 27 13:39:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compile.c,v 1.15 2020/03/27 15:11:57 christos Exp $ */ +/* $NetBSD: compile.c,v 1.16 2020/03/27 17:39:53 christos Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2020 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include -__RCSID("$NetBSD: compile.c,v 1.15 2020/03/27 15:11:57 christos Exp $"); +__RCSID("$NetBSD: compile.c,v 1.16 2020/03/27 17:39:53 christos Exp $"); #if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H #include @@ -86,19 +86,18 @@ _ti_grow_tbuf(TBUF *tbuf, size_t len) return tbuf->buf; } -char * +const char * _ti_find_cap(TIC *tic, TBUF *tbuf, char type, short ind) { size_t n; uint16_t num; - char *cap; + const char *cap; _DIAGASSERT(tbuf != NULL); cap = tbuf->buf; for (n = tbuf->entries; n > 0; n--) { - num = le16dec(cap); - cap += sizeof(uint16_t); + num = _ti_decode_16(); if ((short)num == ind) return cap; switch (type) { @@ -109,8 +108,7 @@ _ti_find_cap(TIC *tic, TBUF *tbuf, char cap += _ti_numsize(tic); break; case 's': - num = le16dec(cap); - cap += sizeof(uint16_t); + num = _ti_decode_16(); cap += num; break; } @@ -120,20 +118,19 @@ _ti_find_cap(TIC *tic, TBUF *tbuf, char return NULL; } -char * +const char * _ti_find_extra(TIC *tic, TBUF *tbuf, const char *code) { size_t n; uint16_t num; - char *cap; + const char *cap; _DIAGASSERT(tbuf != NULL); _DIAGASSERT(code != NULL); cap = tbuf->buf; for (n = tbuf->entries; n > 0; n--) { - num = le16dec(cap); - cap += sizeof(uint16_t); + num = _ti_decode_16(); if (strcmp(cap, code) == 0) return cap + num; cap += num; @@ -145,8 +142,7 @@ _ti_find_extra(TIC *tic, TBUF *tbuf, con cap += _ti_numsize(tic); break; case 's': - num = le16dec(cap); - cap += sizeof(uint16_t); + num = _ti_decode_16(); cap += num; break; } @@ -156,34 +152,6 @@ _ti_find_extra(TIC *tic, TBUF *tbuf, con return NULL; } -void -_ti_encode_num(TIC *tic, TBUF *rbuf, int num) -{ - if (_ti_numsize(tic) == sizeof(uint16_t)) { - if (num > SHRT_MAX) - num = SHRT_MAX; - le16enc(rbuf->buf + rbuf->bufpos, (uint16_t)num); - } else { - le32enc(rbuf->buf + rbuf->bufpos, (uint32_t)num); - } - rbuf->bufpos += _ti_numsize(tic); -} - -int -_ti_decode_num(int rtype, const char **cap) -{ - int rv; - - if (rtype == TERMINFO_RTYPE_O1) { - rv = (int)le16dec(*cap); - *cap += sizeof(uint16_t); - } else { - rv = (int)le32dec(*cap); - *cap += sizeof(uint32_t); - } - return rv; -} - char * _ti_getname(int rtype, const char *orig) { @@ -226,34 +194,40 @@ _ti_store_extra(TIC *tic, int wrn, const if (!_ti_grow_tbuf(>extras, l + strl + sizeof(uint16_t) + _ti_numsize(tic) + 1)) return 0; - le16enc(tic->extras.buf + tic->extras.bufpos, (uint16_t)l); - tic->extras.bufpos += sizeof(uint16_t); - memcpy(tic->extras.buf + tic->extras.bufpos, id, l); - tic->extras.bufpos += l; + _ti_encode_buf_count_str(>extras, id, l); tic->extras.buf[tic->extras.bufpos++] = type; switch (type) { case 'f': tic->extras.buf[tic->extras.bufpos++] = flag; break; case 'n': - _ti_encode_num(tic, >extras, num); + _ti_encode_buf_num(>extras, num, tic->rtype); break; case 's': - le16enc(tic->extras.buf + tic->extras.bufpos, (uint16_t)strl); - tic->extras.bufpos += sizeof(uint16_t); - memcpy(tic->extras.buf + tic->extras.bufpos, str, strl); - tic->extras.bufpos += strl; + _ti_encode_buf_count_str(>extras, str, strl); break; } tic->extras.entries++; return 1; } +static void +_ti_encode_buf(char **cap, const TBUF *buf) +{ + if (buf->entries == 0) { + _ti_encode_16(cap, 0); + } else { + _ti_encode_16(cap, buf->bufpos + sizeof(uint16_t)); + _ti_encode_16(cap, buf->entries); + _ti_encode_str(cap, buf->buf, buf->bufpos); + } +} + ssize_t _ti_flatten(uint8_t **buf, const TIC *tic) { size_t buflen, len, alen, dlen; - uint8_t *cap; + char *cap; _DIAGASSERT(buf != NULL); _DIAGASSERT(tic != NULL); @@ -267,6 +241,7 @@ _ti_flatten(uint8_t **buf, const TIC *ti dlen = 0; else dlen = strlen(tic->desc) + 1; + buflen
CVS commit: src/sys/net
Module Name:src Committed By: jdolecek Date: Fri Mar 27 17:18:15 UTC 2020 Modified Files: src/sys/net: ether_sw_offload.c Log Message: replace the conditional m_pullup() on start of ether_sw_offload_tx() with a KASSERT(), to make it clear no mbuf manipulation is ever done here To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/net/ether_sw_offload.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/ether_sw_offload.c diff -u src/sys/net/ether_sw_offload.c:1.6 src/sys/net/ether_sw_offload.c:1.7 --- src/sys/net/ether_sw_offload.c:1.6 Sat Dec 15 07:38:58 2018 +++ src/sys/net/ether_sw_offload.c Fri Mar 27 17:18:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ether_sw_offload.c,v 1.6 2018/12/15 07:38:58 rin Exp $ */ +/* $NetBSD: ether_sw_offload.c,v 1.7 2020/03/27 17:18:15 jdolecek Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ether_sw_offload.c,v 1.6 2018/12/15 07:38:58 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ether_sw_offload.c,v 1.7 2020/03/27 17:18:15 jdolecek Exp $"); #include #include @@ -96,11 +96,7 @@ ether_sw_offload_tx(struct ifnet *ifp, s goto quit; KASSERT(m->m_pkthdr.len >= sizeof(*ep)); - if (m->m_len < sizeof(*ep)) { - m = m_pullup(m, sizeof(*ep)); - if (m == NULL) - return NULL; - } + KASSERT(m->m_len >= sizeof(*ep)); ep = mtod(m, struct ether_header *); switch (type = ntohs(ep->ether_type)) { case ETHERTYPE_IP:
CVS commit: src/sys/net
Module Name:src Committed By: jdolecek Date: Fri Mar 27 16:47:00 UTC 2020 Modified Files: src/sys/net: if_bridge.c Log Message: replace the conditional m_pullup() on start of bridge_output() with a KASSERT(), to make it clear no mbuf manipulation is ever done here the condition should never trigger, this always runs after ether_output() M_PREPEND()s ether_header To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/net/if_bridge.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_bridge.c diff -u src/sys/net/if_bridge.c:1.169 src/sys/net/if_bridge.c:1.170 --- src/sys/net/if_bridge.c:1.169 Tue Mar 24 13:30:54 2020 +++ src/sys/net/if_bridge.c Fri Mar 27 16:47:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bridge.c,v 1.169 2020/03/24 13:30:54 jdolecek Exp $ */ +/* $NetBSD: if_bridge.c,v 1.170 2020/03/27 16:47:00 jdolecek Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -80,7 +80,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.169 2020/03/24 13:30:54 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.170 2020/03/27 16:47:00 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_bridge_ipf.h" @@ -1496,11 +1496,7 @@ bridge_output(struct ifnet *ifp, struct * IFEF_MPSAFE here. */ - if (m->m_len < ETHER_HDR_LEN) { - m = m_pullup(m, ETHER_HDR_LEN); - if (m == NULL) - return 0; - } + KASSERT(m->m_len >= ETHER_HDR_LEN); eh = mtod(m, struct ether_header *); sc = ifp->if_bridge;
CVS commit: src/sys/netinet
Module Name:src Committed By: jdolecek Date: Fri Mar 27 16:34:58 UTC 2020 Modified Files: src/sys/netinet: in_offload.c Log Message: fix in4_cksum() panic "in4_cksum: mbuf 14 too short for IP header 20" triggered by bridge_output() when passing packet originally for interface supporting hw csum offload to destination interface not supporting it problem happens because bridge_output() is called after ether_output() M_PREPEND() the ether_header into the mbuf chain, if there is not enough space on the first mbuf of the chain, it ends up prepending a new short mbuf with just ether_header triggered by running UDP (IPv4) 'netio -u' benchmark with packet size 2 KB XXX seems in6_undefer_cksum() should have similar fix, however I was XXX not able to trigger the problem there To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/netinet/in_offload.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_offload.c diff -u src/sys/netinet/in_offload.c:1.13 src/sys/netinet/in_offload.c:1.14 --- src/sys/netinet/in_offload.c:1.13 Wed Dec 12 01:40:20 2018 +++ src/sys/netinet/in_offload.c Fri Mar 27 16:34:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: in_offload.c,v 1.13 2018/12/12 01:40:20 rin Exp $ */ +/* $NetBSD: in_offload.c,v 1.14 2020/03/27 16:34:58 jdolecek Exp $ */ /* * Copyright (c)2005, 2006 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.13 2018/12/12 01:40:20 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.14 2020/03/27 16:34:58 jdolecek Exp $"); #include #include @@ -197,15 +197,29 @@ ip_tso_output(struct ifnet *ifp, struct * hardware offloading. */ void -in_undefer_cksum(struct mbuf *m, size_t hdrlen, int csum_flags) +in_undefer_cksum(struct mbuf *mh, size_t hdrlen, int csum_flags) { - const size_t iphdrlen = M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data); + const size_t iphdrlen = M_CSUM_DATA_IPv4_IPHL(mh->m_pkthdr.csum_data); uint16_t csum; uint16_t ip_len; uint16_t *csump; + struct mbuf *m = mh; - KASSERT(m->m_flags & M_PKTHDR); - KASSERT((m->m_pkthdr.csum_flags & csum_flags) == csum_flags); + KASSERT(mh->m_flags & M_PKTHDR); + KASSERT(mh->m_pkthdr.len > hdrlen); + KASSERT((mh->m_pkthdr.csum_flags & csum_flags) == csum_flags); + + /* + * Deal with prepended frame header as done by e.g. ether_output(). + * If first mbuf in chain has just the header, use second mbuf + * for the actual checksum. in4_csum() expects the passed mbuf + * to have the whole (struct ip) area contiguous. + */ + if (m->m_len <= hdrlen) { + hdrlen -= m->m_len; + m = m->m_next; + KASSERT(m != NULL); + } if (__predict_true(hdrlen + sizeof(struct ip) <= m->m_len)) { struct ip *ip = (struct ip *)(mtod(m, uint8_t *) + hdrlen); @@ -249,7 +263,7 @@ in_undefer_cksum(struct mbuf *m, size_t } } - m->m_pkthdr.csum_flags ^= csum_flags; + mh->m_pkthdr.csum_flags ^= csum_flags; } /*
CVS commit: src/distrib/sparc64/instfs
Module Name:src Committed By: rin Date: Fri Mar 27 15:18:22 UTC 2020 Modified Files: src/distrib/sparc64/instfs: list Log Message: Get back to terminfo.cdb. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/distrib/sparc64/instfs/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sparc64/instfs/list diff -u src/distrib/sparc64/instfs/list:1.29 src/distrib/sparc64/instfs/list:1.30 --- src/distrib/sparc64/instfs/list:1.29 Mon Mar 16 10:02:47 2020 +++ src/distrib/sparc64/instfs/list Fri Mar 27 15:18:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.29 2020/03/16 10:02:47 rin Exp $ +# $NetBSD: list,v 1.30 2020/03/27 15:18:22 rin Exp $ SRCDIRS bin sbin libexec external/bsd/less/bin usr.bin usr.sbin @@ -87,7 +87,7 @@ COPY ${NETBSDSRCDIR}/etc/master.passwd e COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig COPY ${DISTRIBDIR}/common/protocols etc/protocols COPY ${DISTRIBDIR}/common/services etc/services -COPY ${DESTDIR}/usr/share/misc/terminfo2.cdb usr/share/misc/terminfo2.cdb +COPY ${DESTDIR}/usr/share/misc/terminfo.cdb usr/share/misc/terminfo.cdb # we need the boot block in /usr/mdec + the arch specific extras COPY ${DESTDIR}/usr/mdec/binstall usr/mdec/binstall 555
CVS commit: src
Module Name:src Committed By: christos Date: Fri Mar 27 15:11:57 UTC 2020 Modified Files: src/distrib/sets/lists/base: mi src/lib/libterminfo: compile.c term.c term_private.h tparm.c src/share/terminfo: Makefile src/usr.bin/tic: tic.c Log Message: As described in tech-userlevel: - Modify the writing code to only write entries in the new format for the terminal descriptions that require it. - Store new format entries as @v3 - Store old format entries with clamped values as for backwards compatibility - Lookup first @v3 and then if that is not found. - Don't create terminfo2 anymore; old programs keep working with clamped entries, and new programs be able to use the wide fields with using the original db file. To generate a diff of this commit: cvs rdiff -u -r1.1233 -r1.1234 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.14 -r1.15 src/lib/libterminfo/compile.c cvs rdiff -u -r1.30 -r1.31 src/lib/libterminfo/term.c cvs rdiff -u -r1.12 -r1.13 src/lib/libterminfo/term_private.h cvs rdiff -u -r1.17 -r1.18 src/lib/libterminfo/tparm.c cvs rdiff -u -r1.4 -r1.5 src/share/terminfo/Makefile cvs rdiff -u -r1.32 -r1.33 src/usr.bin/tic/tic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.1233 src/distrib/sets/lists/base/mi:1.1234 --- src/distrib/sets/lists/base/mi:1.1233 Sun Mar 22 16:21:53 2020 +++ src/distrib/sets/lists/base/mi Fri Mar 27 11:11:57 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1233 2020/03/22 20:21:53 thorpej Exp $ +# $NetBSD: mi,v 1.1234 2020/03/27 15:11:57 christos Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -4841,7 +4841,8 @@ ./usr/share/misc/more.help base-obsolete obsolete ./usr/share/misc/nslookup.help base-obsolete obsolete ./usr/share/misc/terminfo base-terminfo-share share -./usr/share/misc/terminfo2.cdb base-terminfo-share share +./usr/share/misc/terminfo.cdb base-terminfo-share share +./usr/share/misc/terminfo2.cdb base-obsolete obsolete ./usr/share/misc/units.lib base-reference-share share ./usr/share/misc/usb_hid_usages base-reference-share share ./usr/share/misc/vgrindefs.db base-groff-share share Index: src/lib/libterminfo/compile.c diff -u src/lib/libterminfo/compile.c:1.14 src/lib/libterminfo/compile.c:1.15 --- src/lib/libterminfo/compile.c:1.14 Fri Mar 13 11:19:25 2020 +++ src/lib/libterminfo/compile.c Fri Mar 27 11:11:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compile.c,v 1.14 2020/03/13 15:19:25 roy Exp $ */ +/* $NetBSD: compile.c,v 1.15 2020/03/27 15:11:57 christos Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2020 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include -__RCSID("$NetBSD: compile.c,v 1.14 2020/03/13 15:19:25 roy Exp $"); +__RCSID("$NetBSD: compile.c,v 1.15 2020/03/27 15:11:57 christos Exp $"); #if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H #include @@ -87,7 +87,7 @@ _ti_grow_tbuf(TBUF *tbuf, size_t len) } char * -_ti_find_cap(TBUF *tbuf, char type, short ind) +_ti_find_cap(TIC *tic, TBUF *tbuf, char type, short ind) { size_t n; uint16_t num; @@ -106,7 +106,7 @@ _ti_find_cap(TBUF *tbuf, char type, shor cap++; break; case 'n': - cap += sizeof(uint32_t); + cap += _ti_numsize(tic); break; case 's': num = le16dec(cap); @@ -121,7 +121,7 @@ _ti_find_cap(TBUF *tbuf, char type, shor } char * -_ti_find_extra(TBUF *tbuf, const char *code) +_ti_find_extra(TIC *tic, TBUF *tbuf, const char *code) { size_t n; uint16_t num; @@ -142,7 +142,7 @@ _ti_find_extra(TBUF *tbuf, const char *c cap++; break; case 'n': - cap += sizeof(uint32_t); + cap += _ti_numsize(tic); break; case 's': num = le16dec(cap); @@ -156,16 +156,58 @@ _ti_find_extra(TBUF *tbuf, const char *c return NULL; } +void +_ti_encode_num(TIC *tic, TBUF *rbuf, int num) +{ + if (_ti_numsize(tic) == sizeof(uint16_t)) { + if (num > SHRT_MAX) + num = SHRT_MAX; + le16enc(rbuf->buf + rbuf->bufpos, (uint16_t)num); + } else { + le32enc(rbuf->buf + rbuf->bufpos, (uint32_t)num); + } + rbuf->bufpos += _ti_numsize(tic); +} + +int +_ti_decode_num(int rtype, const char **cap) +{ + int rv; + + if (rtype == TERMINFO_RTYPE_O1) { + rv = (int)le16dec(*cap); + *cap += sizeof(uint16_t); + } else { + rv = (int)le32dec(*cap); + *cap += sizeof(uint32_t); + } + return rv; +} + +char * +_ti_getname(int rtype, const char *orig) +{ + char *name; + + if (rtype == TERMINFO_RTYPE) { + if (asprintf(, "%s@v3", orig) < 0) + name = NULL; + } else { + name = strdup(orig); + } + return name; +} + size_t -_ti_store_extra(TIC *tic, int wrn, char *id, char type, char flag, int num, -char *str, size_t strl, int flags) +_ti_store_extra(TIC *tic, int wrn, const char *id, char type, char flag, +int num, const char *str, size_t strl, int
CVS commit: src/sys/arch/arm/sociox
Module Name:src Committed By: nisimura Date: Fri Mar 27 13:00:13 UTC 2020 Modified Files: src/sys/arch/arm/sociox: if_scx.c Log Message: extend mii_statchg() to use ether_mediachange(). care about hash filter selection. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/sociox/if_scx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sociox/if_scx.c diff -u src/sys/arch/arm/sociox/if_scx.c:1.20 src/sys/arch/arm/sociox/if_scx.c:1.21 --- src/sys/arch/arm/sociox/if_scx.c:1.20 Fri Mar 27 09:19:33 2020 +++ src/sys/arch/arm/sociox/if_scx.c Fri Mar 27 13:00:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_scx.c,v 1.20 2020/03/27 09:19:33 nisimura Exp $ */ +/* $NetBSD: if_scx.c,v 1.21 2020/03/27 13:00:13 nisimura Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.20 2020/03/27 09:19:33 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.21 2020/03/27 13:00:13 nisimura Exp $"); #include #include @@ -224,8 +224,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define GMACEVCTL 0x0100 /* event counter control */ #define GMACEVCNT(i) ((i)*4+0x114) /* event counter 0x114~284 */ -#define GMACMHT0 0x0500 /* 256bit multicast hash table 0 - 7 */ -#define GMACMHT(i) ((i)*4+0x500) +#define GMACMHT(i) ((i)*4+0x500) /* 256bit multicast hash table 0 - 7 */ #define GMACVHT 0x0588 /* VLAN tag hash */ /* 0x0700-0734 ??? */ @@ -452,7 +451,6 @@ static void scx_stop(struct ifnet *, int static void scx_watchdog(struct ifnet *); static int scx_ioctl(struct ifnet *, u_long, void *); static void scx_set_rcvfilt(struct scx_softc *); -static int scx_ifmedia_upd(struct ifnet *); static void scx_ifmedia_sts(struct ifnet *, struct ifmediareq *); static void mii_statchg(struct ifnet *); static void phy_tick(void *); @@ -709,7 +707,7 @@ sc->sc_mdclk <<= 2; mii->mii_statchg = mii_statchg; sc->sc_ethercom.ec_mii = mii; - ifmedia_init(ifm, 0, scx_ifmedia_upd, scx_ifmedia_sts); + ifmedia_init(ifm, 0, ether_mediachange, scx_ifmedia_sts); mii_attach(sc->sc_dev, mii, 0x, sc->sc_phy_id, MII_OFFSET_ANY, MIIF_DOPAUSE); if (LIST_FIRST(>mii_phys) == NULL) { @@ -881,7 +879,7 @@ scx_init(struct ifnet *ifp) /* accept multicast frame or run promisc mode */ scx_set_rcvfilt(sc); - (void)scx_ifmedia_upd(ifp); + (void)ether_mediachange(ifp); /* build sane Tx */ memset(sc->sc_txdescs, 0, sizeof(struct tdes) * MD_NTXDESC); @@ -1077,16 +1075,16 @@ printf("[%d] %s\n", i, ether_sprintf(enm i++; } ETHER_UNLOCK(ec); - if (crc) - csr |= AFR_MHTE | AFR_HPF; /* use hash+perfect */ + csr |= AFR_MHTE; + csr |= AFR_HPF; /* use hash+perfect */ mac_write(sc, GMACMHTH, mchash[1]); mac_write(sc, GMACMHTL, mchash[0]); mac_write(sc, GMACAFR, csr); return; update: - /* With PM or AM, MHTE/MHT0-7 are never consulted. really? */ + /* With PR or PM, MHTE/MHTL/MHTH are never consulted. really? */ if (ifp->if_flags & IFF_PROMISC) csr |= AFR_PR; /* run promisc. mode */ else @@ -1095,39 +1093,6 @@ printf("[%d] %s\n", i, ether_sprintf(enm return; } -static int -scx_ifmedia_upd(struct ifnet *ifp) -{ - struct scx_softc *sc = ifp->if_softc; - struct ifmedia *ifm = >sc_mii.mii_media; - - if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_AUTO) { - ; /* restart AN */ - ; /* enable AN */ - ; /* advertise flow control pause */ - ; /* adv. 1000FDX,100FDX,100HDX,10FDX,10HDX */ - } else { -#if 1 /* XXX not sure to belong here XXX */ - uint32_t mcr = mac_read(sc, GMACMCR); - if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_1000_T) - mcr &= ~MCR_USEMII; /* RGMII+SPD1000 */ - else { - if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX - && sc->sc_100mii) -mcr |= MCR_SPD100; - mcr |= MCR_USEMII; - } - if (ifm->ifm_cur->ifm_media & IFM_FDX) - mcr |= MCR_USEFDX; - mcr |= MCR_CST | MCR_JE; - if (sc->sc_100mii == 0) - mcr |= MCR_IBN; - mac_write(sc, GMACMCR, mcr); -#endif - } - return 0; -} - static void scx_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { @@ -1145,7 +1110,8 @@ mii_statchg(struct ifnet *ifp) { struct scx_softc *sc = ifp->if_softc; struct mii_data *mii = >sc_mii; - uint32_t fcr; + struct ifmedia * ifm = >mii_media; + uint32_t mcr, fcr; #if 1 /* decode MIISR register value */ @@ -1165,14 +1131,31 @@ mii_statchg(struct ifnet *ifp) (mii->mii_media_active & IFM_ETH_FMASK) != sc->sc_flowflags) sc->sc_flowflags = mii->mii_media_active & IFM_ETH_FMASK; - /* Adjust PAUSE flow control. */ + /* Adjust speed 1000/100/10. */ + mcr = mac_read(sc, GMACMCR); + if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_1000_T) + mcr &= ~MCR_USEMII; /* RGMII+SPD1000 */ + else { + if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX + && sc->sc_100mii) + mcr |= MCR_SPD100; + mcr |= MCR_USEMII; + } + mcr
CVS commit: src/sys/arch/arm/sociox
Module Name:src Committed By: nisimura Date: Fri Mar 27 13:00:22 UTC 2020 Modified Files: src/sys/arch/arm/sociox: if_ave.c Log Message: extend mii_statchg() to use ether_mediachange(). care about hash filter selection. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/sociox/if_ave.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sociox/if_ave.c diff -u src/sys/arch/arm/sociox/if_ave.c:1.15 src/sys/arch/arm/sociox/if_ave.c:1.16 --- src/sys/arch/arm/sociox/if_ave.c:1.15 Tue Mar 24 03:08:02 2020 +++ src/sys/arch/arm/sociox/if_ave.c Fri Mar 27 13:00:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ave.c,v 1.15 2020/03/24 03:08:02 nisimura Exp $ */ +/* $NetBSD: if_ave.c,v 1.16 2020/03/27 13:00:22 nisimura Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -36,15 +36,16 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.15 2020/03/24 03:08:02 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ave.c,v 1.16 2020/03/27 13:00:22 nisimura Exp $"); #include #include #include #include #include -#include +#include #include +#include #include #include #include @@ -249,7 +250,6 @@ static void ave_watchdog(struct ifnet *) static int ave_ioctl(struct ifnet *, u_long, void *); static void ave_set_rcvfilt(struct ave_softc *); static void ave_write_filt(struct ave_softc *, int, const uint8_t *); -static int ave_ifmedia_upd(struct ifnet *); static void ave_ifmedia_sts(struct ifnet *, struct ifmediareq *); static void mii_statchg(struct ifnet *); static void lnkchg(struct ave_softc *); @@ -384,19 +384,17 @@ ave_fdt_attach(device_t parent, device_t sc->sc_model = of_search_compatible(phandle, compat_data)->data; phy_mode = fdtbus_get_string(phandle, "phy-mode"); - if (phy_mode == NULL) { + if (phy_mode == NULL) aprint_error(": missing 'phy-mode' property\n"); - phy_mode = "rgmii"; - } aprint_naive("\n"); aprint_normal(": Gigabit Ethernet Controller\n"); - aprint_normal_dev(self, "UniPhier %c%c%c%c AVE%d GbE (%d.%d) %s\n", + aprint_normal_dev(self, "UniPhier %c%c%c%c AVE%d GbE (%d.%d)\n", hwimp >> 24, hwimp >> 16, hwimp >> 8, hwimp, - sc->sc_model, hwver >> 8, hwver & 0xff, phy_mode); + sc->sc_model, hwver >> 8, hwver & 0xff); aprint_normal_dev(self, "interrupt on %s\n", intrstr); - sc->sc_100mii = (strcmp(phy_mode, "rgmii") != 0); + sc->sc_100mii = (phy_mode && strcmp(phy_mode, "rgmii") != 0); sc->sc_desops = (sc->sc_model == 64) ? : CSR_WRITE(sc, AVEGR, GR_GRST | GR_PHYRST); @@ -429,7 +427,7 @@ ave_fdt_attach(device_t parent, device_t sc->sc_phy_id = MII_PHY_ANY; sc->sc_ethercom.ec_mii = mii; - ifmedia_init(ifm, 0, ave_ifmedia_upd, ave_ifmedia_sts); + ifmedia_init(ifm, 0, ether_mediachange, ave_ifmedia_sts); mii_attach(sc->sc_dev, mii, 0x, sc->sc_phy_id, MII_OFFSET_ANY, MIIF_DOPAUSE); if (LIST_FIRST(>mii_phys) == NULL) { @@ -586,7 +584,7 @@ ave_init(struct ifnet *ifp) /* accept multicast frame or run promisc mode */ ave_set_rcvfilt(sc); - (void)ave_ifmedia_upd(ifp); + (void)ether_mediachange(ifp); csr = CSR_READ(sc, AVECFG); if (ifp->if_capenable & IFCAP_CSUM_IPv4_Tx) { @@ -636,49 +634,6 @@ ave_stop(struct ifnet *ifp, int disable) ifp->if_timer = 0; } -static int -ave_ifmedia_upd(struct ifnet *ifp) -{ - struct ave_softc *sc = ifp->if_softc; - struct ifmedia *ifm = >sc_mii.mii_media; - uint32_t txcr, rxcr, csr; - - txcr = CSR_READ(sc, AVETXC); - rxcr = CSR_READ(sc, AVERXC); - CSR_WRITE(sc, AVERXC, rxcr &~ RXC_EN); /* stop Rx first */ - - if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_AUTO) { - ; /* restart AN */ - ; /* enable AN */ - ; /* advertise flow control pause */ - ; /* adv. 1000FDX,100FDX,100HDX,10FDX,10HDX */ - } else { -#if 1 /* XXX not sure to belong here XXX */ - txcr &= ~(TXC_SPD1000 | TXC_SPD100); - rxcr &= ~RXC_USEFDX; - if ((sc->sc_100mii == 0) /* RGMII model */ - && IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_1000_T) - txcr |= TXC_SPD1000; - else if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX) - txcr |= TXC_SPD100; - if (ifm->ifm_media & IFM_FDX) - rxcr |= RXC_USEFDX; - - /* adjust LINKSEL when RMII/MII too */ - if (sc->sc_100mii) { - csr = CSR_READ(sc, AVELINKSEL) &~ LINKSEL_SPD100; - if (IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_100_TX) -csr |= LINKSEL_SPD100; - CSR_WRITE(sc, AVELINKSEL, csr); - } -#endif - } - sc->sc_rxc = rxcr; - CSR_WRITE(sc, AVETXC, txcr); - CSR_WRITE(sc, AVERXC, rxcr | RXC_EN); - return 0; -} - static void ave_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { @@ -696,7 +651,8 @@ mii_statchg(struct ifnet *ifp) { struct ave_softc *sc = ifp->if_softc; struct mii_data *mii = >sc_mii; - uint32_t txcr, rxcr; + struct ifmedia *ifm = >mii_media; + uint32_t txcr, rxcr, lsel; /* Get flow control negotiation result. */ if
CVS commit: src/sys/dev/scsipi
Module Name:src Committed By: mlelstv Date: Fri Mar 27 11:15:33 UTC 2020 Modified Files: src/sys/dev/scsipi: cd.c Log Message: Allow open of RAWPART even when no medium is loaded. Keep errors silent if no medium is loaded. Fixes PR kern/55104 To generate a diff of this commit: cvs rdiff -u -r1.342 -r1.343 src/sys/dev/scsipi/cd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/scsipi/cd.c diff -u src/sys/dev/scsipi/cd.c:1.342 src/sys/dev/scsipi/cd.c:1.343 --- src/sys/dev/scsipi/cd.c:1.342 Mon Sep 3 16:29:33 2018 +++ src/sys/dev/scsipi/cd.c Fri Mar 27 11:15:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.342 2018/09/03 16:29:33 riastradh Exp $ */ +/* $NetBSD: cd.c,v 1.343 2020/03/27 11:15:33 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation, @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.342 2018/09/03 16:29:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.343 2020/03/27 11:15:33 mlelstv Exp $"); #include #include @@ -401,8 +401,8 @@ cd_firstopen(device_t self, dev_t dev, i else silent = 0; - /* make cdclose() loud again */ - cd->flags &= ~CDF_EJECTED; + /* make cdclose() silent */ + cd->flags |= CDF_EJECTED; /* Check that it is still responding and ok. */ error = scsipi_test_unit_ready(periph, @@ -419,8 +419,11 @@ cd_firstopen(device_t self, dev_t dev, i if (error == EINVAL) error = EIO; } - if (error) + if (error) { + if (part == RAW_PART) + goto out; goto bad; + } /* Lock the pack in. */ error = scsipi_prevent(periph, SPAMR_PREVENT_DT, @@ -448,6 +451,9 @@ cd_firstopen(device_t self, dev_t dev, i SC_DEBUG(periph, SCSIPI_DB3, ("Params loaded ")); cd_set_geometry(cd); + + /* make cdclose() loud again */ + cd->flags &= ~CDF_EJECTED; } periph->periph_flags |= PERIPH_OPEN; @@ -519,7 +525,8 @@ cd_lastclose(device_t self) struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter; int silent; - if (cd->flags & CDF_EJECTED) + if ((cd->flags & CDF_EJECTED) != 0 || + (periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) silent = XS_CTL_SILENT; else silent = 0; @@ -1213,6 +1220,14 @@ cdioctl(dev_t dev, u_long cmd, void *add return (EIO); switch (cmd) { + case DIOCTUR: { + /* test unit ready */ + error = scsipi_test_unit_ready(cd->sc_periph, XS_CTL_SILENT); + *((int*)addr) = (error == 0); + if (error == ENODEV || error == EIO || error == 0) + return 0; + return error; + } case CDIOCPLAYTRACKS: { /* PLAY_MSF command */ struct ioc_play_track *args = addr; @@ -1447,15 +1462,18 @@ static void cd_label(device_t self, struct disklabel *lp) { struct cd_softc *cd = device_private(self); + struct scsipi_periph *periph = cd->sc_periph; struct cd_formatted_toc toc; - int lastsession; + int lastsession = 0; strncpy(lp->d_typename, "optical media", 16); lp->d_rpm = 300; - lp->d_flags |= D_REMOVABLE | D_SCSI_MMC; + lp->d_flags |= D_REMOVABLE; - if (cdreadmsaddr(cd, , ) != 0) - lastsession = 0; + if ((periph->periph_flags & PERIPH_MEDIA_LOADED) != 0) { + lp->d_flags |= D_SCSI_MMC; + (void) cdreadmsaddr(cd, , ); + } lp->d_partitions[0].p_offset = 0; lp->d_partitions[0].p_size = lp->d_secperunit;
CVS commit: src/sys/kern
Module Name:src Committed By: mlelstv Date: Fri Mar 27 11:13:57 UTC 2020 Modified Files: src/sys/kern: subr_disk.c Log Message: Avoid division by zero if label isn't valid. To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/sys/kern/subr_disk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_disk.c diff -u src/sys/kern/subr_disk.c:1.129 src/sys/kern/subr_disk.c:1.130 --- src/sys/kern/subr_disk.c:1.129 Mon Sep 30 23:23:59 2019 +++ src/sys/kern/subr_disk.c Fri Mar 27 11:13:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_disk.c,v 1.129 2019/09/30 23:23:59 cnst Exp $ */ +/* $NetBSD: subr_disk.c,v 1.130 2020/03/27 11:13:57 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.129 2019/09/30 23:23:59 cnst Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.130 2020/03/27 11:13:57 mlelstv Exp $"); #include #include @@ -440,6 +440,10 @@ int disk_read_sectors(void (*strat)(struct buf *), const struct disklabel *lp, struct buf *bp, unsigned int sector, int count) { + + if ((lp->d_secsize / DEV_BSIZE) == 0 || lp->d_secpercyl == 0) + return EINVAL; + bp->b_blkno = btodb((off_t)sector * lp->d_secsize); bp->b_bcount = count * lp->d_secsize; bp->b_flags = (bp->b_flags & ~B_WRITE) | B_READ;
CVS commit: src/sys/dev/pckbport
Module Name:src Committed By: nia Date: Fri Mar 27 11:10:07 UTC 2020 Modified Files: src/sys/dev/pckbport: synaptics.c Log Message: synaptics: Revert changes that broke gestures in cases where they worked. It seems I have to figure out another way to make scrolling work for me. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pckbport/synaptics.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pckbport/synaptics.c diff -u src/sys/dev/pckbport/synaptics.c:1.62 src/sys/dev/pckbport/synaptics.c:1.63 --- src/sys/dev/pckbport/synaptics.c:1.62 Mon Mar 16 11:13:19 2020 +++ src/sys/dev/pckbport/synaptics.c Fri Mar 27 11:10:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: synaptics.c,v 1.62 2020/03/16 11:13:19 nia Exp $ */ +/* $NetBSD: synaptics.c,v 1.63 2020/03/27 11:10:07 nia Exp $ */ /* * Copyright (c) 2005, Steve C. Woodford @@ -48,7 +48,7 @@ #include "opt_pms.h" #include -__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.62 2020/03/16 11:13:19 nia Exp $"); +__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.63 2020/03/27 11:10:07 nia Exp $"); #include #include @@ -115,10 +115,10 @@ static int synaptics_button3 = SYNAPTICS static int synaptics_two_fingers_emul = 0; static int synaptics_scale_x = 16; static int synaptics_scale_y = 16; -static int synaptics_scale_z = 64; +static int synaptics_scale_z = 32; static int synaptics_max_speed_x = 32; static int synaptics_max_speed_y = 32; -static int synaptics_max_speed_z = 1; +static int synaptics_max_speed_z = 2; static int synaptics_movement_threshold = 4; static int synaptics_fscroll_min = 13; static int synaptics_fscroll_max = 14; @@ -1285,7 +1285,13 @@ synaptics_finger_detect(struct synaptics return (0); } - if (sc->flags & SYN_FLAG_HAS_MULTI_FINGER) { + /* + * Detect 2 and 3 fingers if supported, but only if multiple + * fingers appear within the tap gesture time period. + */ + if (sc->flags & SYN_FLAG_HAS_MULTI_FINGER && + SYN_TIME(sc, sc->gesture_start_packet, + sp->sp_finger) < synaptics_gesture_length) { switch (sp->sp_w) { case SYNAPTICS_WIDTH_TWO_FINGERS: fingers = 2; @@ -1732,14 +1738,6 @@ pms_synaptics_process_packet(struct pms_ synaptics_movement(sc, sp, sp->sp_finger, z_emul, , , ); - } else if (fingers > 1) { - /* - * Multiple finger movement. Interpret it as scrolling. - */ - synaptics_movement(sc, sp, sp->sp_finger, 1, -, , ); - sc->rem_x[0] = sc->rem_y[0] = 0; - dx = dy = 0; } else { /* * No valid finger. Therefore no movement.
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: msaitoh Date: Fri Mar 27 09:47:03 UTC 2020 Modified Files: src/sys/arch/x86/x86: coretemp.c Log Message: Add special handling for model 0x0f stepping >=2 or mode 0x0e to get Tjmax. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/coretemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/coretemp.c diff -u src/sys/arch/x86/x86/coretemp.c:1.36 src/sys/arch/x86/x86/coretemp.c:1.37 --- src/sys/arch/x86/x86/coretemp.c:1.36 Wed Jul 11 03:36:32 2018 +++ src/sys/arch/x86/x86/coretemp.c Fri Mar 27 09:47:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: coretemp.c,v 1.36 2018/07/11 03:36:32 msaitoh Exp $ */ +/* $NetBSD: coretemp.c,v 1.37 2020/03/27 09:47:03 msaitoh Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36 2018/07/11 03:36:32 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.37 2020/03/27 09:47:03 msaitoh Exp $"); #include #include @@ -271,6 +271,19 @@ coretemp_tjmax(device_t self) sc->sc_tjmax = 100; if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) { + /* + * Check MSR_IA32_PLATFORM_ID(0x17) bit 28. It's not documented + * in the datasheet, but the following page describes the + * detail: + * http://software.intel.com/en-us/articles/ + * mobile-intel-core2-processor-detection-table/ + * Was: http://softwarecommunity.intel.com/Wiki/Mobility/ + * 720.htm + */ + if (rdmsr_safe(MSR_IA32_PLATFORM_ID, ) != 0) + goto notee; + if ((model < 0x17) && ((msr & __BIT(28)) == 0)) + goto notee; if (rdmsr_safe(MSR_IA32_EXT_CONFIG, ) == EFAULT) return; @@ -290,6 +303,7 @@ coretemp_tjmax(device_t self) } else sc->sc_tjmax = 90; } else { +notee: /* * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET, * but only consider the interval [70, 110] C as valid.
CVS commit: src/sys/arch/arm/sociox
Module Name:src Committed By: nisimura Date: Fri Mar 27 09:19:33 UTC 2020 Modified Files: src/sys/arch/arm/sociox: if_scx.c Log Message: try to be better register descriptions To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/sociox/if_scx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sociox/if_scx.c diff -u src/sys/arch/arm/sociox/if_scx.c:1.19 src/sys/arch/arm/sociox/if_scx.c:1.20 --- src/sys/arch/arm/sociox/if_scx.c:1.19 Fri Mar 27 07:59:50 2020 +++ src/sys/arch/arm/sociox/if_scx.c Fri Mar 27 09:19:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_scx.c,v 1.19 2020/03/27 07:59:50 nisimura Exp $ */ +/* $NetBSD: if_scx.c,v 1.20 2020/03/27 09:19:33 nisimura Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -40,24 +40,24 @@ * to designify ring number from which to arrive or to which go. * - memory mapped EEPROM to hold MAC address. The rest of the area is * occupied by a set of ucode for two DMA engines and one packet engine. - * - The size of frame address filter is 16 plus 32. + * - The size of frame address filter is 16 plus 16. * - The first slot is my own station address. Always enabled to perform * to identify oneself. - * - 1~16 are for supplimental MAC addresses. Independently enabled for + * - 1~15 are for supplimental MAC addresses. Independently enabled for * use. Good to catch multicast. Byte-wise selective match available. * Use the mask to catch { 0x01, 0x00, 0x00 } and/or { 0x33, 0x33 }. * - 16~32 might be exact match without byte-mask. * - The size of multicast hash filter store is 64 bit. - * - Socionext/Linaro "NetSec" code makes many cut shorts. Some constants - * are left unexplained. The values should be handled via external - * controls like FDT descriptions. Fortunately, Intel/Altera CycloneV PDFs - * describe every detail of "such the instance of" DW EMAC IP and - * most of them are likely applicable to SC2A11 GbE. - * - DW EMAC implmentation (0x20) is 0x10.0x36 + * - Socionext/Linaro "NetSec" code contains some constants left unexplained. + * Fortunately, Intel/Altera CycloneV PDFs describe every detail of + * "such the instance of" DW EMAC IP and most of them are likely applicable + * to SC2A11 GbE. + * - not known "NetSec" instanciates DW timestamp or builds its own. + * - DW EMAC implmentation (0x20) is known 0x10.36 */ #include -__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.19 2020/03/27 07:59:50 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.20 2020/03/27 09:19:33 nisimura Exp $"); #include #include @@ -212,7 +212,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define GMACMAH0 0x0040 /* MAC address 0 47:32 */ #define GMACMAL0 0x0044 /* MAC address 0 31:0 */ #define GMACMAH(i) ((i)*8+0x40) /* supplimental MAC addr 1 - 15 */ -#define GMACMAL(i) ((i)*8+0x44) +#define GMACMAL(i) ((i)*8+0x44) /* bit 31 to use, 30 SA, + * 29:24 byte-wise don'care */ #define GMACMIISR 0x00d8 /* resolved xMII link status */ /* 3 link up detected * 2:1 resovled speed @@ -227,12 +228,12 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define GMACMHT(i) ((i)*4+0x500) #define GMACVHT 0x0588 /* VLAN tag hash */ -/* 0x0700-0734 */ +/* 0x0700-0734 ??? */ #define GMACAMAH(i) ((i)*8+0x800) /* supplimental MAC addr 16-31 */ -#define GMACAMAL(i) ((i)*8+0x804) +#define GMACAMAL(i) ((i)*8+0x804) /* bit 31 to use */ #define GMACBMR 0x1000 /* DMA bus mode control - * 244PBL 8? + * 244PBL 8??? * 23USP * 22:17 RPBL * 16fixed burst, or undefined b. @@ -841,12 +842,11 @@ scx_reset(struct scx_softc *sc) int loop = 0, busy; mac_write(sc, GMACOMR, 0); - mac_write(sc, GMACBMR, BMR_RST); /* may take for a while */ + mac_write(sc, GMACBMR, BMR_RST); do { DELAY(1); busy = mac_read(sc, GMACBMR) & BMR_RST; } while (++loop < 3000 && busy); -printf("BMR reset done with %d loop\n", loop); mac_write(sc, GMACBMR, _BMR); mac_write(sc, GMACAFR, 0);
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: sborrill Date: Fri Mar 27 08:51:59 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.1 Log Message: Add missing line-break To generate a diff of this commit: cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/doc/CHANGES-9.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.1 diff -u src/doc/CHANGES-9.1:1.1.2.24 src/doc/CHANGES-9.1:1.1.2.25 --- src/doc/CHANGES-9.1:1.1.2.24 Fri Mar 27 08:46:07 2020 +++ src/doc/CHANGES-9.1 Fri Mar 27 08:51:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.1,v 1.1.2.24 2020/03/27 08:46:07 sborrill Exp $ +# $NetBSD: CHANGES-9.1,v 1.1.2.25 2020/03/27 08:51:59 sborrill Exp $ A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1 release: @@ -720,6 +720,7 @@ sys/arch/vax/vsa/ncr.c1.50 [ragge, ticket #802] etc/named.conf 1.8 + Stop using obsolete dnssec-lookaside (implies use of dlv.isc.org, which no longer serves any useful purpose). [christos, ticket #806]
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: sborrill Date: Fri Mar 27 08:49:53 UTC 2020 Modified Files: src/doc [netbsd-8]: CHANGES-8.2 Log Message: Fix ticket number To generate a diff of this commit: cvs rdiff -u -r1.1.2.110 -r1.1.2.111 src/doc/CHANGES-8.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.2 diff -u src/doc/CHANGES-8.2:1.1.2.110 src/doc/CHANGES-8.2:1.1.2.111 --- src/doc/CHANGES-8.2:1.1.2.110 Fri Mar 27 08:48:57 2020 +++ src/doc/CHANGES-8.2 Fri Mar 27 08:49:53 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.2,v 1.1.2.110 2020/03/27 08:48:57 sborrill Exp $ +# $NetBSD: CHANGES-8.2,v 1.1.2.111 2020/03/27 08:49:53 sborrill Exp $ A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2 release: @@ -2164,5 +2164,5 @@ etc/named.conf 1.8 Stop using obsolete dnssec-lookaside (implies use of dlv.isc.org, which no longer serves any useful purpose). - [christos, ticket #806] + [christos, ticket #1524]
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: sborrill Date: Fri Mar 27 08:48:57 UTC 2020 Modified Files: src/doc [netbsd-8]: CHANGES-8.2 Log Message: Ticket #1524 To generate a diff of this commit: cvs rdiff -u -r1.1.2.109 -r1.1.2.110 src/doc/CHANGES-8.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.2 diff -u src/doc/CHANGES-8.2:1.1.2.109 src/doc/CHANGES-8.2:1.1.2.110 --- src/doc/CHANGES-8.2:1.1.2.109 Mon Mar 23 10:17:07 2020 +++ src/doc/CHANGES-8.2 Fri Mar 27 08:48:57 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.2,v 1.1.2.109 2020/03/23 10:17:07 martin Exp $ +# $NetBSD: CHANGES-8.2,v 1.1.2.110 2020/03/27 08:48:57 sborrill Exp $ A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2 release: @@ -2160,3 +2160,9 @@ sys/external/bsd/drm2/dist/drm/radeon/ra Fix loading TAHITI VCE firmware. [mrg, ticket #1523] +etc/named.conf 1.8 + + Stop using obsolete dnssec-lookaside (implies use of dlv.isc.org, + which no longer serves any useful purpose). + [christos, ticket #806] +
CVS commit: [netbsd-8] src/etc
Module Name:src Committed By: sborrill Date: Fri Mar 27 08:48:23 UTC 2020 Modified Files: src/etc [netbsd-8]: named.conf Log Message: Pull up the following revisions(s) (requested by christos in ticket #1524): etc/named.conf: revision 1.8 Stop using obsolete dnssec-lookaside (implies use of dlv.isc.org, which no longer serves any useful purpose). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.22.1 src/etc/named.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/named.conf diff -u src/etc/named.conf:1.7 src/etc/named.conf:1.7.22.1 --- src/etc/named.conf:1.7 Thu Apr 25 20:28:05 2013 +++ src/etc/named.conf Fri Mar 27 08:48:23 2020 @@ -1,4 +1,4 @@ -# $NetBSD: named.conf,v 1.7 2013/04/25 20:28:05 christos Exp $ +# $NetBSD: named.conf,v 1.7.22.1 2020/03/27 08:48:23 sborrill Exp $ # boot file for secondary name server # Note that there should be one primary entry for each SOA record. @@ -12,7 +12,6 @@ options { directory "/etc/namedb"; dnssec-enable yes; dnssec-validation auto; - dnssec-lookaside auto; managed-keys-directory "keys"; bindkeys-file "bind.keys"; allow-recursion { localhost; localnets; };
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: sborrill Date: Fri Mar 27 08:46:07 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.1 Log Message: Ticket #806 To generate a diff of this commit: cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/doc/CHANGES-9.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.1 diff -u src/doc/CHANGES-9.1:1.1.2.23 src/doc/CHANGES-9.1:1.1.2.24 --- src/doc/CHANGES-9.1:1.1.2.23 Mon Mar 23 10:07:20 2020 +++ src/doc/CHANGES-9.1 Fri Mar 27 08:46:07 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.1,v 1.1.2.23 2020/03/23 10:07:20 martin Exp $ +# $NetBSD: CHANGES-9.1,v 1.1.2.24 2020/03/27 08:46:07 sborrill Exp $ A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1 release: @@ -719,3 +719,8 @@ sys/arch/vax/vsa/ncr.c1.50 Do not expect a struct buf to be present if doing DMA to kernel space. [ragge, ticket #802] +etc/named.conf 1.8 + Stop using obsolete dnssec-lookaside (implies use of dlv.isc.org, + which no longer serves any useful purpose). + [christos, ticket #806] +
CVS commit: [netbsd-9] src/etc
Module Name:src Committed By: sborrill Date: Fri Mar 27 08:43:42 UTC 2020 Modified Files: src/etc [netbsd-9]: named.conf Log Message: Pull up the following revisions(s) (requested by christos in ticket #806): etc/named.conf: revision 1.8 Stop using obsolete dnssec-lookaside (implies use of dlv.isc.org, which no longer serves any useful purpose). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.32.1 src/etc/named.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/named.conf diff -u src/etc/named.conf:1.7 src/etc/named.conf:1.7.32.1 --- src/etc/named.conf:1.7 Thu Apr 25 20:28:05 2013 +++ src/etc/named.conf Fri Mar 27 08:43:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: named.conf,v 1.7 2013/04/25 20:28:05 christos Exp $ +# $NetBSD: named.conf,v 1.7.32.1 2020/03/27 08:43:42 sborrill Exp $ # boot file for secondary name server # Note that there should be one primary entry for each SOA record. @@ -12,7 +12,6 @@ options { directory "/etc/namedb"; dnssec-enable yes; dnssec-validation auto; - dnssec-lookaside auto; managed-keys-directory "keys"; bindkeys-file "bind.keys"; allow-recursion { localhost; localnets; };
CVS commit: src/sys/arch/arm/sociox
Module Name:src Committed By: nisimura Date: Fri Mar 27 07:59:50 UTC 2020 Modified Files: src/sys/arch/arm/sociox: if_scx.c Log Message: more register mashup work To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/sociox/if_scx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sociox/if_scx.c diff -u src/sys/arch/arm/sociox/if_scx.c:1.18 src/sys/arch/arm/sociox/if_scx.c:1.19 --- src/sys/arch/arm/sociox/if_scx.c:1.18 Fri Mar 27 06:32:49 2020 +++ src/sys/arch/arm/sociox/if_scx.c Fri Mar 27 07:59:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_scx.c,v 1.18 2020/03/27 06:32:49 nisimura Exp $ */ +/* $NetBSD: if_scx.c,v 1.19 2020/03/27 07:59:50 nisimura Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.18 2020/03/27 06:32:49 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.19 2020/03/27 07:59:50 nisimura Exp $"); #include #include @@ -84,7 +84,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #include #include -/* SC2A11 register block 0x100-0x1204? */ +/* + * SC2A11 register block 0x100-0x1204? + */ #define SWRESET 0x104 #define COMINIT 0x120 #define xINTSR 0x200 /* aggregated interrupt status report */ @@ -96,7 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define xINTBEN 0x23c /* INT_B enable */ #define xINTB_SET 0x240 /* bit to set */ #define xINTB_CLR 0x244 /* bit to clr */ -/* 0x0c-48 *//* pkt,tls,s0,s1 SR/IE/SET/CLR */ +/* 0x00c-048 */ /* pkt,tls,s0,s1 SR/IE/SET/CLR */ #define TXISR 0x400 #define TXIEN 0x404 #define TXI_SET 0x428 @@ -127,6 +129,17 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define MCVER 0x22c /* micro controller version */ #define HWVER 0x230 /* hardware version */ +/* 0x800 */ /* dec Tx SR/EN/SET/CLR */ +/* 0x840 */ /* enc Rx SR/EN/SET/CLR */ +/* 0x880 */ /* enc TLS Tx SR/IE/SET/CLR */ +/* 0x8c0 */ /* dec TLS Tx SR/IE/SET/CLR */ +/* 0x900 */ /* enc TLS Rx SR/IE/SET/CLR */ +/* 0x940 */ /* dec TLS Rx SR/IE/SET/CLR */ +/* 0x980 */ /* enc RAW Tx SR/IE/SET/CLR */ +/* 0x9c0 */ /* dec RAW Tx SR/IE/SET/CLR */ +/* 0xA00 */ /* enc RAW Rx SR/IE/SET/CLR */ +/* 0xA40 */ /* dec RAW Rx SR/IE/SET/CLR */ + #define MACCMD 0x11c4 /* gmac operation */ #define CMD_IOWR (1U<<28) /* write op */ #define CMD_BUSY (1U<<31) /* busy bit */ @@ -136,23 +149,30 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define DESC_INIT 0x11fc /* desc engine init */ #define DESC_SRST 0x1204 /* desc engine sw reset */ -/* GMAC register block. use mac_write()/mac_read() to handle */ +/* + * GMAC register block. use mac_write()/mac_read() to handle + */ #define GMACMCR 0x /* MAC configuration */ -#define MCR_IBN (1U<<30) /* */ +#define MCR_IBN (1U<<30) /* ??? */ #define MCR_CST (1U<<25) /* strip CRC */ #define MCR_TC (1U<<24) /* keep RGMII PHY notified */ #define MCR_JE (1U<<20) /* ignore oversized >9018 condition */ +#define MCR_IFG (7U<<17) /* 19:17 IFG value 0~7 */ +#define MCR_DRCS (1U<<16) /* ignore (G)MII HDX Tx error */ #define MCR_USEMII (1U<<15) /* 1: RMII/MII, 0: RGMII (_PS) */ #define MCR_SPD100 (1U<<14) /* force speed 100 (_FES) */ +#define MCR_DO (1U<<13) /* */ +#define MCR_LOOP (1U<<12) /* */ #define MCR_USEFDX (1U<<11) /* force full duplex */ -#define MCR_IPCKEN (1U<<10) /* handle checksum */ +#define MCR_IPCEN (1U<<10) /* handle checksum */ #define MCR_ACS (1U<<7) /* auto pad strip CRC */ -#define MCR_TXE (1U<<3) /* start Tx DMA engine */ -#define MCR_RXE (1U<<2) /* start Rx DMA engine */ +#define MCR_TE (1U<<3) /* run Tx MAC engine, 0 to stop */ +#define MCR_RE (1U<<2) /* run Rx MAC engine, 0 to stop */ +#define MCR_PREA (3U) /* 1:0 preamble len. 0~2 */ #define _MCR_FDX 0x280c /* XXX TBD */ #define _MCR_HDX 0x0001a00c /* XXX TBD */ #define GMACAFR 0x0004 /* frame DA/SA address filter */ -#define AFR_RA (1U<<31) /* receive block all on */ +#define AFR_RA (1U<<31) /* accept all irrecspective of filt. */ #define AFR_HPF (1U<<10) /* hash+perfect filter, or hash only */ #define AFR_SAF (1U<<9) /* source address filter */ #define AFR_SAIF (1U<<8) /* SA inverse filtering */ @@ -161,9 +181,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define AFR_PM (1U<<4) /* accept all multicast frame */ #define AFR_DAIF (1U<<3) /* DA inverse filtering */ #define AFR_MHTE (1U<<2) /* use multicast hash table */ -#define AFR_UHTE (1U<<1) /* use additional MAC addresses */ +#define AFR_UHTE (1U<<1) /* use hash table for unicast */ #define AFR_PR (1U<<0) /* run promisc mode */ -#define _AFR 0x8001 /* XXX TBD */ #define GMACMHTH 0x0008 /* 64bit multicast hash table 63:32 */ #define GMACMHTL 0x000c /* 64bit multicast hash table 31:0 */ #define GMACGAR 0x0010 /* MDIO operation */ @@ -184,6 +203,12 @@ __KERNEL_RCSID(0,
CVS commit: src/sys/arch/arm/sociox
Module Name:src Committed By: nisimura Date: Fri Mar 27 06:32:49 UTC 2020 Modified Files: src/sys/arch/arm/sociox: if_scx.c Log Message: register definition mashed. from UEFI and CycloneV PDF To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/sociox/if_scx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/sociox/if_scx.c diff -u src/sys/arch/arm/sociox/if_scx.c:1.17 src/sys/arch/arm/sociox/if_scx.c:1.18 --- src/sys/arch/arm/sociox/if_scx.c:1.17 Thu Mar 26 10:38:16 2020 +++ src/sys/arch/arm/sociox/if_scx.c Fri Mar 27 06:32:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_scx.c,v 1.17 2020/03/26 10:38:16 nisimura Exp $ */ +/* $NetBSD: if_scx.c,v 1.18 2020/03/27 06:32:49 nisimura Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.17 2020/03/26 10:38:16 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.18 2020/03/27 06:32:49 nisimura Exp $"); #include #include @@ -84,29 +84,31 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #include #include -/* SC2A11 register block */ +/* SC2A11 register block 0x100-0x1204? */ #define SWRESET 0x104 -#define MACADRH 0x10c -#define MACADRL 0x110 #define COMINIT 0x120 -#define INTRST 0x200 -#define IRQ_RX (1U<<1) -#define IRQ_TX (1U<<0) -#define INTREN 0x204 -#define INTR_SET 0x234 -#define INTR_CLR 0x238 -#define TXINTST 0x400 -#define TXINTEN 0x404 -#define TXINT_SET 0x428 -#define TXINT_CLR 0x42c +#define xINTSR 0x200 /* aggregated interrupt status report */ +#define IRQ_RX (1U<<1) /* top level Rx interrupt */ +#define IRQ_TX (1U<<0) /* top level Rx interrupt */ +#define xINTAEN 0x204 /* INT_A enable */ +#define xINTA_SET 0x234 /* bit to set */ +#define xINTA_CLR 0x238 /* bit to clr */ +#define xINTBEN 0x23c /* INT_B enable */ +#define xINTB_SET 0x240 /* bit to set */ +#define xINTB_CLR 0x244 /* bit to clr */ +/* 0x0c-48 *//* pkt,tls,s0,s1 SR/IE/SET/CLR */ +#define TXISR 0x400 +#define TXIEN 0x404 +#define TXI_SET 0x428 +#define TXI_CLR 0x42c #define TXI_NTOWNR (1U<<17) #define TXI_TR_ERR (1U<<16) #define TXI_TXDONE (1U<<15) #define TXI_TMREXP (1U<<14) -#define RXINTST 0x440 -#define RXINTEN 0x444 -#define RXINT_SET 0x468 -#define RXINT_CLR 0x46c +#define RXISR 0x440 +#define RXIEN 0x444 +#define RXI_SET 0x468 +#define RXI_CLR 0x46c #define RXI_RC_ERR (1U<<16) #define RXI_PKTCNT (1U<<15) #define RXI_TMREXP (1U<<14) @@ -117,16 +119,22 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define H2MENG 0x210 /* DMAC host2media ucode port */ #define M2HENG 0x21c /* DMAC media2host ucode port */ #define PKTENG 0x0d0 /* packet engine ucode port */ +#define CLKEN 0x100 /* clock distribution enable */ +#define CLK_G (1U<<5) +#define CLK_ALL 0x24 +#define MACADRH 0x10c /* ??? */ +#define MACADRL 0x110 /* ??? */ #define MCVER 0x22c /* micro controller version */ #define HWVER 0x230 /* hardware version */ -#define MACSTAT 0x1024 /* gmac status */ -#define MACDATA 0x11c0 /* gmac rd/wr data */ #define MACCMD 0x11c4 /* gmac operation */ #define CMD_IOWR (1U<<28) /* write op */ #define CMD_BUSY (1U<<31) /* busy bit */ -#define DESCENG_INIT 0x11fc -#define DESCENG_SRST 0x1204 +#define MACSTAT 0x1024 /* gmac status */ +#define MACDATA 0x11c0 /* gmac rd/wr data */ +#define MACINTE 0x1028 /* interrupt enable */ +#define DESC_INIT 0x11fc /* desc engine init */ +#define DESC_SRST 0x1204 /* desc engine sw reset */ /* GMAC register block. use mac_write()/mac_read() to handle */ #define GMACMCR 0x /* MAC configuration */ @@ -134,8 +142,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define MCR_CST (1U<<25) /* strip CRC */ #define MCR_TC (1U<<24) /* keep RGMII PHY notified */ #define MCR_JE (1U<<20) /* ignore oversized >9018 condition */ -#define MCR_USEMII (1U<<15) /* 1: RMII/MII, 0: RGMII */ -#define MCR_SPD100 (1U<<14) /* force speed 100 */ +#define MCR_USEMII (1U<<15) /* 1: RMII/MII, 0: RGMII (_PS) */ +#define MCR_SPD100 (1U<<14) /* force speed 100 (_FES) */ #define MCR_USEFDX (1U<<11) /* force full duplex */ #define MCR_IPCKEN (1U<<10) /* handle checksum */ #define MCR_ACS (1U<<7) /* auto pad strip CRC */ @@ -145,19 +153,19 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1 #define _MCR_HDX 0x0001a00c /* XXX TBD */ #define GMACAFR 0x0004 /* frame DA/SA address filter */ #define AFR_RA (1U<<31) /* receive block all on */ -#define AFR_HPF (1U<<10) /* activate hash or perfect filter */ +#define AFR_HPF (1U<<10) /* hash+perfect filter, or hash only */ #define AFR_SAF (1U<<9) /* source address filter */ #define AFR_SAIF (1U<<8) /* SA inverse filtering */ -#define AFR_PCF (3U<<6) /* */ -#define AFR_RB (1U<<5) /* reject broadcast frame */ -#define AFR_AM (1U<<4) /* accept all multicast frame */ +#define