CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 23 06:13:35 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Weed out duplicate sample rates and add comment about UAC2 clocks. To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.180 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.179 src/sys/dev/usb/uaudio.c:1.180 --- src/sys/dev/usb/uaudio.c:1.179 Sun Apr 16 19:26:20 2023 +++ src/sys/dev/usb/uaudio.c Sun Apr 23 06:13:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.179 2023/04/16 19:26:20 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.180 2023/04/23 06:13:35 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.179 2023/04/16 19:26:20 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.180 2023/04/23 06:13:35 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2479,9 +2479,20 @@ Static u_int uaudio_get_rates(struct uaudio_softc *sc, int mode, u_int *freqs, u_int len) { struct mixerctl *mc; - u_int n, freq, start, end, step; - int j, k, count; + u_int freq, start, end, step; + u_int i, n; + u_int k, count; + int j; + /* + * With UAC2 the sample rate isn't part of the data format, + * instead, you have separate clock sources that may be + * assigned to individual terminals (inputs, outputs). + * + * For audio(4) we only distinguish between input and output + * formats and collect the unique rates from all possible clock + * sources. + */ n = 0; for (j = 0; j < sc->sc_nratectls; ++j) { @@ -2499,6 +2510,18 @@ uaudio_get_rates(struct uaudio_softc *sc end = (u_int) mc->ranges[k].maxval; step = (u_int) mc->ranges[k].resval; for (freq = start; freq <= end; freq += step) { +/* remove duplicates */ +for (i = 0; i < n; ++i) { + if (freqs[i] == freq) + break; +} +if (i < n) { + if (step == 0) + break; + continue; +} + +/* store or count */ if (len != 0) { if (n >= len) goto done;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 23 06:13:35 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Weed out duplicate sample rates and add comment about UAC2 clocks. To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.180 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Wed Apr 19 22:00:18 UTC 2023 Modified Files: src/sys/netinet: ip_output.c Log Message: Again allow multicast packets to be sent from unnumbered interfaces. To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/sys/netinet/ip_output.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/ip_output.c diff -u src/sys/netinet/ip_output.c:1.325 src/sys/netinet/ip_output.c:1.326 --- src/sys/netinet/ip_output.c:1.325 Wed Apr 19 02:43:40 2023 +++ src/sys/netinet/ip_output.c Wed Apr 19 22:00:18 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.325 2023/04/19 02:43:40 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.326 2023/04/19 22:00:18 mlelstv Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.325 2023/04/19 02:43:40 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.326 2023/04/19 22:00:18 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -348,11 +348,6 @@ ip_output(struct mbuf *m0, struct mbuf * } mtu = ifp->if_mtu; ia = in_get_ia_from_ifp_psref(ifp, _ia); - if (ia == NULL) { - IP_STATINC(IP_STAT_IFNOADDR); - error = EADDRNOTAVAIL; - goto bad; - } if (IN_MULTICAST(ip->ip_dst.s_addr) || ip->ip_dst.s_addr == INADDR_BROADCAST) { isbroadcast = 0;
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Wed Apr 19 22:00:18 UTC 2023 Modified Files: src/sys/netinet: ip_output.c Log Message: Again allow multicast packets to be sent from unnumbered interfaces. To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/audio
Module Name:src Committed By: mlelstv Date: Mon Apr 17 20:33:45 UTC 2023 Modified Files: src/sys/dev/audio: audio.c Log Message: Input and output codecs produce and consume internal audio data, so don't byteswap it. To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/dev/audio/audio.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/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.136 src/sys/dev/audio/audio.c:1.137 --- src/sys/dev/audio/audio.c:1.136 Thu Aug 25 11:16:33 2022 +++ src/sys/dev/audio/audio.c Mon Apr 17 20:33:45 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.136 2022/08/25 11:16:33 riastradh Exp $ */ +/* $NetBSD: audio.c,v 1.137 2023/04/17 20:33:45 mlelstv Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -181,7 +181,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.136 2022/08/25 11:16:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.137 2023/04/17 20:33:45 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -5628,7 +5628,7 @@ audio_pmixer_process(struct audio_softc } m = mixer->mixsample; - if (mixer->swap_endian) { + if (!mixer->codec && mixer->swap_endian) { for (i = 0; i < sample_count; i++) { *h++ = bswap16(*m++); } @@ -6031,7 +6031,7 @@ audio_rmixer_process(struct audio_softc mixersrc = >hwbuf; } - if (mixer->swap_endian) { + if (!mixer->codec && mixer->swap_endian) { /* inplace conversion */ p = auring_headptr_aint(mixersrc); for (i = 0; i < count * mixer->track_fmt.channels; i++, p++) {
CVS commit: src/sys/dev/audio
Module Name:src Committed By: mlelstv Date: Mon Apr 17 20:33:45 UTC 2023 Modified Files: src/sys/dev/audio: audio.c Log Message: Input and output codecs produce and consume internal audio data, so don't byteswap it. To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/locale
Module Name:src Committed By: mlelstv Date: Sun Apr 16 20:37:59 UTC 2023 Modified Files: src/lib/libc/locale: newlocale.c Log Message: Fix parsing a locale string with multiple components. Also check for truncation of a long locale string. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libc/locale/newlocale.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/libc/locale/newlocale.c diff -u src/lib/libc/locale/newlocale.c:1.3 src/lib/libc/locale/newlocale.c:1.4 --- src/lib/libc/locale/newlocale.c:1.3 Fri Sep 13 13:13:32 2013 +++ src/lib/libc/locale/newlocale.c Sun Apr 16 20:37:59 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: newlocale.c,v 1.3 2013/09/13 13:13:32 joerg Exp $ */ +/* $NetBSD: newlocale.c,v 1.4 2023/04/16 20:37:59 mlelstv Exp $ */ /*- * Copyright (c)2008, 2011 Citrus Project, @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: newlocale.c,v 1.3 2013/09/13 13:13:32 joerg Exp $"); +__RCSID("$NetBSD: newlocale.c,v 1.4 2023/04/16 20:37:59 mlelstv Exp $"); #include "namespace.h" #include @@ -57,7 +57,10 @@ newlocale(int mask, const char *name, lo if (src == NULL) src = _current_locale(); memcpy(dst, src, sizeof(*src)); - strlcpy([0], name, sizeof(head)); + if (strlcpy([0], name, sizeof(head)) >= sizeof(head)) { + free(dst); + return (locale_t)NULL; + } tokens[0] = (const char *)[0]; tail = strchr(tokens[0], '/'); if (tail == NULL) { @@ -77,6 +80,7 @@ newlocale(int mask, const char *name, lo } if (howmany-- > 0) { for (i = 1; i < howmany; ++i) { +*tail++ = '\0'; tokens[i] = (const char *)tail; tail = strchr(tokens[i], '/'); if (tail == NULL) { @@ -84,6 +88,7 @@ newlocale(int mask, const char *name, lo return NULL; } } + *tail++ = '\0'; tokens[howmany] = tail; tail = strchr(tokens[howmany], '/'); if (tail != NULL) {
CVS commit: src/lib/libc/locale
Module Name:src Committed By: mlelstv Date: Sun Apr 16 20:37:59 UTC 2023 Modified Files: src/lib/libc/locale: newlocale.c Log Message: Fix parsing a locale string with multiple components. Also check for truncation of a long locale string. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libc/locale/newlocale.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 16 19:26:20 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c uaudioreg.h Log Message: Handle packet scheduling for high/super speed. More UAC2 handling for input/output/feature/selector units. Setting sample rate for UAC2 now works, still no support for clock selectors and multipliers. Added sysctl to set debug level. Minor fixes. To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/sys/dev/usb/uaudio.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/uaudioreg.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/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.178 src/sys/dev/usb/uaudio.c:1.179 --- src/sys/dev/usb/uaudio.c:1.178 Mon Apr 10 15:14:50 2023 +++ src/sys/dev/usb/uaudio.c Sun Apr 16 19:26:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.178 2023/04/10 15:14:50 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.179 2023/04/16 19:26:20 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.178 2023/04/10 15:14:50 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.179 2023/04/16 19:26:20 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -59,6 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1 #include #include #include +#include #include #include @@ -99,8 +100,12 @@ int uaudiodebug = 0; #define DPRINTFN(n,x,y...) #endif -#define UAUDIO_NCHANBUFS 6 /* number of outstanding request */ -#define UAUDIO_NFRAMES 10 /* ms of sound in each request */ +/* number of outstanding requests */ +#define UAUDIO_NCHANBUFS 6 +/* number of USB frames per request, also the number of ms */ +#define UAUDIO_NFRAMES 10 +/* number of microframes per requewst (high, super) */ +#define UAUDIO_NFRAMES_HI (UAUDIO_NFRAMES * USB_UFRAMES_PER_FRAME) #define MIX_MAX_CHAN 8 @@ -133,7 +138,6 @@ struct mixerctl { u_int nranges; u_int delta; u_int mul; - u_int high; uint8_t class; char ctlname[MAX_AUDIO_DEV_LEN]; const char *ctlunit; @@ -147,6 +151,7 @@ struct as_info { uint8_t attributes; /* Copy of bmAttributes of * usb_audio_streaming_endpoint_descriptor */ + uint8_t terminal; /* connected Terminal ID */ struct usbd_interface * ifaceh; const usb_interface_descriptor_t *idesc; const usb_endpoint_descriptor_audio_t *edesc; @@ -177,12 +182,14 @@ struct chan { int altidx; /* currently used altidx */ int curchanbuf; + u_int nframes; /* UAUDIO_NFRAMES or UAUDIO_NFRAMES_HI */ + u_int nchanbufs; /* 1..UAUDIO_NCHANBUFS */ struct chanbuf { struct chan *chan; struct usbd_xfer *xfer; u_char *buffer; - uint16_t sizes[UAUDIO_NFRAMES]; - uint16_t offsets[UAUDIO_NFRAMES]; + uint16_t sizes[UAUDIO_NFRAMES_HI]; + uint16_t offsets[UAUDIO_NFRAMES_HI]; uint16_t size; } chanbufs[UAUDIO_NCHANBUFS]; @@ -223,9 +230,13 @@ struct uaudio_softc { int sc_nratectls; /* V2 sample rates */ int sc_ratectls[AUFMT_MAX_FREQUENCIES]; int sc_ratemode[AUFMT_MAX_FREQUENCIES]; + int sc_playclock; + int sc_recclock; struct audio_format *sc_formats; int sc_nformats; + uint8_t sc_clock[256]; /* map terminals to clocks */ u_int sc_channel_config; + u_int sc_usb_frames_per_second; char sc_dying; struct audio_device sc_adev; }; @@ -244,7 +255,7 @@ struct io_terminal { const union usb_audio_output_terminal *ot; const struct usb_audio_mixer_unit *mu; const struct usb_audio_selector_unit *su; - const struct usb_audio_feature_unit *fu; + const union usb_audio_feature_unit *fu; const struct usb_audio_processing_unit *pu; const struct usb_audio_extension_unit *eu; const struct usb_audio_clksrc_unit *cu; @@ -254,6 +265,7 @@ struct io_terminal { struct terminal_list **inputs; /* list of source input terminals */ struct terminal_list *output; /* list of destination output terminals */ int direct; /* directly connected to an output terminal */ + uint8_t clock; }; #define UAC_OUTPUT 0 @@ -286,7 +298,7 @@ Static const usb_interface_descriptor_t Static void uaudio_mixer_add_ctl(struct uaudio_softc *, struct mixerctl *); Static char *uaudio_id_name - (struct uaudio_softc *, const struct io_terminal *, int); + (struct uaudio_softc *, const struct io_terminal *, uint8_t); #ifdef UAUDIO_DEBUG Static void uaudio_dump_cluster (struct uaudio_softc *, const union usb_audio_cluster *); @@ -307,7 +319,7 @@ Static const char *uaudio_get_terminal_n Static int uaudio_determine_class (const struct io_terminal *, struct mixerctl *); Static const char *uaudio_feature_name - (const struct io_terminal *, struct mixerctl *); + (const struct io_terminal *, uint8_t, int); Static void uaudio_add_feature (struct uaudio_softc *, const struct io_terminal *, int); Static void uaudio_add_processing_updown @@ -348,6 +360,7 @@ Static void
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 16 19:26:20 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c uaudioreg.h Log Message: Handle packet scheduling for high/super speed. More UAC2 handling for input/output/feature/selector units. Setting sample rate for UAC2 now works, still no support for clock selectors and multipliers. Added sysctl to set debug level. Minor fixes. To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/sys/dev/usb/uaudio.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/uaudioreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/audio/play
Module Name:src Committed By: mlelstv Date: Sat Apr 15 16:54:39 UTC 2023 Modified Files: src/usr.bin/audio/play: play.c Log Message: Revert accidentially committed part. The 'latency' report isn't ready to be useful. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/usr.bin/audio/play/play.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/audio/play/play.c diff -u src/usr.bin/audio/play/play.c:1.62 src/usr.bin/audio/play/play.c:1.63 --- src/usr.bin/audio/play/play.c:1.62 Sat Apr 15 12:39:44 2023 +++ src/usr.bin/audio/play/play.c Sat Apr 15 16:54:39 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: play.c,v 1.62 2023/04/15 12:39:44 mlelstv Exp $ */ +/* $NetBSD: play.c,v 1.63 2023/04/15 16:54:39 mlelstv Exp $ */ /* * Copyright (c) 1999, 2000, 2001, 2002, 2010, 2015, 2019, 2021 Matthew R. Green @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: play.c,v 1.62 2023/04/15 12:39:44 mlelstv Exp $"); +__RCSID("$NetBSD: play.c,v 1.63 2023/04/15 16:54:39 mlelstv Exp $"); #endif #include @@ -65,7 +65,6 @@ static int volume; static int balance; static int port; static int fflag; -static int lflag; static int qflag; int verbose; static int sample_rate; @@ -88,7 +87,7 @@ main(int argc, char *argv[]) const char *defdevice = _PATH_SOUND; const char *device = NULL; - while ((ch = getopt(argc, argv, "b:B:C:c:d:e:fhilp:P:qs:Vv:")) != -1) { + while ((ch = getopt(argc, argv, "b:B:C:c:d:e:fhip:P:qs:Vv:")) != -1) { switch (ch) { case 'b': decode_int(optarg, ); @@ -119,9 +118,6 @@ main(int argc, char *argv[]) case 'i': iflag++; break; - case 'l': - lflag++; - break; case 'q': qflag++; break; @@ -301,57 +297,6 @@ audio_write(int fd, void *buf, size_t le return write(fd, convert_buffer, len); } -/* - * print audio output offset - */ -static void -print_offset(off_t written, int ratelimit) -{ - static time_t last; - time_t now; - static off_t base = 0; - static off_t played = 0; - off_t bps; - audio_offset_t aoff; - u_int blocksize; - - if (!lflag) - return; - - if (ioctl(audiofd, AUDIO_GETOOFFS, )) - return; - - bps = info.play.sample_rate - * info.play.channels - * info.play.precision / NBBY; - blocksize = info.blocksize > 0 ? info.blocksize : 1; - - /* Check if aoff.samples overflowed */ - if (aoff.samples < played) { - base += UINT_MAX; - base += 1; - } - - /* Overflow base + number of samples in completed blocks + offset in currently played block */ - played = base + aoff.samples + (aoff.offset % blocksize); - - /* Print only every second */ - if (ratelimit) { - time(); - if (now == last) - return; - last = now; - } - - if (bps > 0) { - printf("%jdms\n", (written - played) * 1000 / bps); - } else { - /* unknown rate, report bytes */ - printf("%jd\n", written - played); - } - fflush(stdout); -} - static void play(char *file) { @@ -360,7 +305,7 @@ play(char *file) void *addr, *oaddr; off_t filesize; size_t sizet_filesize; - off_t datasize = 0, written = 0; + off_t datasize = 0; ssize_t hdrlen; int fd; int nw; @@ -424,7 +369,6 @@ play(char *file) } while ((uint64_t)datasize > bufsize) { - print_offset(written, 0); nw = audio_write(audiofd, addr, bufsize, conv); if (nw == -1) err(1, "write failed"); @@ -432,17 +376,13 @@ play(char *file) errx(1, "write failed"); addr = (char *)addr + bufsize; datasize -= bufsize; - written += nw; } - print_offset(written, 0); nw = audio_write(audiofd, addr, datasize, conv); if (nw == -1) err(1, "final write failed"); if ((off_t)nw != datasize) errx(1, "final write failed"); - written += nw; - print_offset(written, 0); if (ioctl(audiofd, AUDIO_DRAIN) < 0 && !qflag) warn("audio drain ioctl failed"); if (munmap(oaddr, sizet_filesize) < 0) @@ -461,7 +401,7 @@ play_fd(const char *file, int fd) char*buffer = malloc(bufsize); ssize_t hdrlen; int nr, nw; - off_t datasize = 0, written = 0; + off_t datasize = 0; off_t dataout = 0; if (buffer == NULL) @@ -490,8 +430,6 @@ play_fd(const char *file, int fd) memmove(buffer, buffer + hdrlen, nr - hdrlen); nr -= hdrlen; } - - print_offset(written, 0); while (datasize == 0 || dataout < datasize) { if (datasize != 0 && dataout + nr > datasize) nr = datasize - dataout; @@ -506,13 +444,10 @@ play_fd(const char *file, int fd) goto read_error; if (nr == 0) break; - print_offset(written, 1); - written += nw; } /* something to think about: no message given for dataout < datasize */ if (ioctl(audiofd, AUDIO_DRAIN) < 0 && !qflag) warn("audio drain ioctl failed"); - print_offset(written, 0); return; read_error: err(1, "read of standard input failed"); @@ -638,8 +573,6 @@ set_audio_mode: if (ioctl(fd, AUDIO_SETINFO, ) < 0) err(1, "failed to set audio info"); - if (ioctl(fd, AUDIO_GETINFO, ) < 0) - err(1,
CVS commit: src/usr.bin/audio/play
Module Name:src Committed By: mlelstv Date: Sat Apr 15 16:54:39 UTC 2023 Modified Files: src/usr.bin/audio/play: play.c Log Message: Revert accidentially committed part. The 'latency' report isn't ready to be useful. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/usr.bin/audio/play/play.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/audio
Module Name:src Committed By: mlelstv Date: Sat Apr 15 12:39:44 UTC 2023 Modified Files: src/usr.bin/audio/common: auconv.h wav.c src/usr.bin/audio/play: play.c src/usr.bin/audio/record: record.c Log Message: Add support for recording 24bit wav files. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/audio/common/auconv.h cvs rdiff -u -r1.15 -r1.16 src/usr.bin/audio/common/wav.c cvs rdiff -u -r1.61 -r1.62 src/usr.bin/audio/play/play.c cvs rdiff -u -r1.56 -r1.57 src/usr.bin/audio/record/record.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/audio/common/auconv.h diff -u src/usr.bin/audio/common/auconv.h:1.5 src/usr.bin/audio/common/auconv.h:1.6 --- src/usr.bin/audio/common/auconv.h:1.5 Mon Apr 28 20:24:12 2008 +++ src/usr.bin/audio/common/auconv.h Sat Apr 15 12:39:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: auconv.h,v 1.5 2008/04/28 20:24:12 martin Exp $ */ +/* $NetBSD: auconv.h,v 1.6 2023/04/15 12:39:44 mlelstv Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -78,6 +78,24 @@ change_sign16_be(u_char *p, int cc) } static inline void +change_sign24_le(u_char *p, int cc) +{ + while ((cc -= 3) >= 0) { + p[2] ^= 0x80; + p += 3; + } +} + +static inline void +change_sign24_be(u_char *p, int cc) +{ + while ((cc -= 3) >= 0) { + p[0] ^= 0x80; + p += 3; + } +} + +static inline void change_sign32_le(u_char *p, int cc) { while ((cc -= 4) >= 0) { @@ -163,6 +181,44 @@ change_sign16_swap_bytes_be(u_char *p, i } static inline void +swap_bytes_change_sign24_le(u_char *p, int cc) +{ + u_char t; + + while ((cc -= 3) >= 0) { + t = p[2]; + p[2] = p[0] ^ 0x80; + p[0] = t; + p += 3; + } +} + +static inline void +swap_bytes_change_sign24_be(u_char *p, int cc) +{ + u_char t; + + while ((cc -= 3) >= 0) { + t = p[0]; + p[0] = p[2] ^ 0x80; + p[2] = t; + p += 3; + } +} + +static inline void +change_sign24_swap_bytes_le(u_char *p, int cc) +{ + swap_bytes_change_sign24_be(p, cc); +} + +static inline void +change_sign24_swap_bytes_be(u_char *p, int cc) +{ + swap_bytes_change_sign24_le(p, cc); +} + +static inline void swap_bytes_change_sign32_le(u_char *p, int cc) { u_char t; Index: src/usr.bin/audio/common/wav.c diff -u src/usr.bin/audio/common/wav.c:1.15 src/usr.bin/audio/common/wav.c:1.16 --- src/usr.bin/audio/common/wav.c:1.15 Sat Nov 9 12:46:44 2019 +++ src/usr.bin/audio/common/wav.c Sat Apr 15 12:39:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: wav.c,v 1.15 2019/11/09 12:46:44 mrg Exp $ */ +/* $NetBSD: wav.c,v 1.16 2023/04/15 12:39:44 mlelstv Exp $ */ /* * Copyright (c) 2002, 2009, 2013, 2015, 2019 Matthew R. Green @@ -33,7 +33,7 @@ #include #ifndef lint -__RCSID("$NetBSD: wav.c,v 1.15 2019/11/09 12:46:44 mrg Exp $"); +__RCSID("$NetBSD: wav.c,v 1.16 2023/04/15 12:39:44 mlelstv Exp $"); #endif @@ -287,6 +287,8 @@ wav_prepare_header(struct track_info *ti break; case 16: break; + case 24: + break; case 32: break; default: Index: src/usr.bin/audio/play/play.c diff -u src/usr.bin/audio/play/play.c:1.61 src/usr.bin/audio/play/play.c:1.62 --- src/usr.bin/audio/play/play.c:1.61 Sun May 15 02:16:06 2022 +++ src/usr.bin/audio/play/play.c Sat Apr 15 12:39:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: play.c,v 1.61 2022/05/15 02:16:06 mrg Exp $ */ +/* $NetBSD: play.c,v 1.62 2023/04/15 12:39:44 mlelstv Exp $ */ /* * Copyright (c) 1999, 2000, 2001, 2002, 2010, 2015, 2019, 2021 Matthew R. Green @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: play.c,v 1.61 2022/05/15 02:16:06 mrg Exp $"); +__RCSID("$NetBSD: play.c,v 1.62 2023/04/15 12:39:44 mlelstv Exp $"); #endif #include @@ -65,6 +65,7 @@ static int volume; static int balance; static int port; static int fflag; +static int lflag; static int qflag; int verbose; static int sample_rate; @@ -87,7 +88,7 @@ main(int argc, char *argv[]) const char *defdevice = _PATH_SOUND; const char *device = NULL; - while ((ch = getopt(argc, argv, "b:B:C:c:d:e:fhip:P:qs:Vv:")) != -1) { + while ((ch = getopt(argc, argv, "b:B:C:c:d:e:fhilp:P:qs:Vv:")) != -1) { switch (ch) { case 'b': decode_int(optarg, ); @@ -118,6 +119,9 @@ main(int argc, char *argv[]) case 'i': iflag++; break; + case 'l': + lflag++; + break; case 'q': qflag++; break; @@ -297,6 +301,57 @@ audio_write(int fd, void *buf, size_t le return write(fd, convert_buffer, len); } +/* + * print audio output offset + */ +static void +print_offset(off_t written, int ratelimit) +{ + static time_t last; + time_t now; + static off_t base = 0; + static off_t played = 0; + off_t bps; + audio_offset_t aoff; + u_int blocksize; + + if (!lflag) + return; + + if (ioctl(audiofd, AUDIO_GETOOFFS, )) + return; + + bps = info.play.sample_rate + * info.play.channels + * info.play.precision / NBBY; + blocksize = info.blocksize > 0 ? info.blocksize : 1; + + /*
CVS commit: src/usr.bin/audio
Module Name:src Committed By: mlelstv Date: Sat Apr 15 12:39:44 UTC 2023 Modified Files: src/usr.bin/audio/common: auconv.h wav.c src/usr.bin/audio/play: play.c src/usr.bin/audio/record: record.c Log Message: Add support for recording 24bit wav files. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/audio/common/auconv.h cvs rdiff -u -r1.15 -r1.16 src/usr.bin/audio/common/wav.c cvs rdiff -u -r1.61 -r1.62 src/usr.bin/audio/play/play.c cvs rdiff -u -r1.56 -r1.57 src/usr.bin/audio/record/record.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Rationale for some rules in style guide
jo...@bec.de (Joerg Sonnenberger) writes: >Which compiler from this century doesn't allocate stack space >independent from the source order? gcc with -O0 and -O1 allocates variables in source order. With our notoriously broken gdb, that can be helpful.
Re: CVS commit: src/sys/dev/dkwedge
On Wed, Apr 12, 2023 at 01:10:40AM +0700, Robert Elz wrote: > > | In that state then decrementing dk_rawopens beyond zero will make > | dklastclose do the right thing: nothing. > > Except that if that happens, dk_rawopens will be left == ~0 and the next > open attempt will then increment it, back to 0 again, which is almost > certainly not what was wanted. > > dklastclose() used to have code in it like > > if (...->dk_rawopens > 0) { > if (--...->dk_rawopens == 0) Indeed, that part was simplified away. -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: CVS commit: src/sys/dev/dkwedge
On Tue, Apr 11, 2023 at 09:07:49AM +, Taylor R Campbell wrote: > > (a) how we can legitimately enter a state where the assertions are > violated, and dklastclose is called when the close operation ends in no more openers. There is nothing that guarantees that any open was successful before with the effect that dk_rawopens is > 0 and dk_rawvp is not NULL. In that state then decrementing dk_rawopens beyond zero will make dklastclose do the right thing: nothing. When you want to check for overflows of dk_rawopens (which is difficult to overflow as you had to create 2^32 wedges) you need to watch it being incremented (also temporarily). Crashing after the fact with an assertion in dklastclose doesn't help. -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:27:51 UTC 2023 Modified Files: src/sys/dev/usb: uvideo.c Log Message: Reduce excessive settle delay. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/dev/usb/uvideo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:27:51 UTC 2023 Modified Files: src/sys/dev/usb: uvideo.c Log Message: Reduce excessive settle delay. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/dev/usb/uvideo.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/uvideo.c diff -u src/sys/dev/usb/uvideo.c:1.84 src/sys/dev/usb/uvideo.c:1.85 --- src/sys/dev/usb/uvideo.c:1.84 Mon Apr 10 15:26:56 2023 +++ src/sys/dev/usb/uvideo.c Mon Apr 10 15:27:51 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvideo.c,v 1.84 2023/04/10 15:26:56 mlelstv Exp $ */ +/* $NetBSD: uvideo.c,v 1.85 2023/04/10 15:27:51 mlelstv Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.84 2023/04/10 15:26:56 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.85 2023/04/10 15:27:51 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1811,7 +1811,7 @@ uvideo_stream_stop_xfer(struct uvideo_st } /* Give it some time to settle */ - usbd_delay_ms(vs->vs_parent->sc_udev, 1000); + usbd_delay_ms(vs->vs_parent->sc_udev, 20); /* Set to zero bandwidth alternate interface zero */ err = usbd_set_interface(vs->vs_iface, 0);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:26:57 UTC 2023 Modified Files: src/sys/dev/usb: uvideo.c uvideoreg.h Log Message: Better descriptor parsing. Add sanity check if no default format is found. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/uvideo.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/uvideoreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:26:57 UTC 2023 Modified Files: src/sys/dev/usb: uvideo.c uvideoreg.h Log Message: Better descriptor parsing. Add sanity check if no default format is found. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/uvideo.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/uvideoreg.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/dev/usb/uvideo.c diff -u src/sys/dev/usb/uvideo.c:1.83 src/sys/dev/usb/uvideo.c:1.84 --- src/sys/dev/usb/uvideo.c:1.83 Fri Jul 1 01:06:51 2022 +++ src/sys/dev/usb/uvideo.c Mon Apr 10 15:26:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvideo.c,v 1.83 2022/07/01 01:06:51 riastradh Exp $ */ +/* $NetBSD: uvideo.c,v 1.84 2023/04/10 15:26:56 mlelstv Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.83 2022/07/01 01:06:51 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.84 2023/04/10 15:26:56 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -442,12 +442,8 @@ static void print_vs_format_dv_descripto const uvideo_vs_format_dv_descriptor_t *); #endif /* !UVIDEO_DEBUG */ -#define GET(type, descp, field) \ - (KASSERT((descp)->bLength >= sizeof(type)), \ - ((const type *)(descp))->field) -#define GETP(type, descp, field) \ - (KASSERT((descp)->bLength >= sizeof(type)), \ - &(((const type *)(descp))->field)) +#define GET(type, descp, field) (((const type *)(descp))->field) +#define GETP(type, descp, field) (&(((const type *)(descp))->field)) /* * Given a format descriptor and frame descriptor, copy values common @@ -1312,6 +1308,13 @@ uvideo_stream_free(struct uvideo_stream kmem_free(vs, sizeof(*vs)); } +#define framedesc_size(T, d) ( \ + offsetof(T, uFrameInterval) + \ + ((T *)(d))->bFrameIntervalType \ + ? ((T *)(d))->bFrameIntervalType \ + * sizeof(((T *)(d))->uFrameInterval.discrete) \ + : sizeof(((T *)(d))->uFrameInterval.continuous) \ +) static usbd_status uvideo_stream_init_frame_based_format(struct uvideo_stream *vs, @@ -1342,7 +1345,6 @@ uvideo_stream_init_frame_based_format(st return USBD_INVAL; } subtype = UDESC_VS_FRAME_UNCOMPRESSED; - subtypelen = sizeof(uvideo_vs_frame_uncompressed_descriptor_t); default_index = GET(uvideo_vs_format_uncompressed_descriptor_t, format_desc, bDefaultFrameIndex); @@ -1372,7 +1374,6 @@ uvideo_stream_init_frame_based_format(st return USBD_INVAL; } subtype = UDESC_VS_FRAME_FRAME_BASED; - subtypelen = sizeof(uvideo_frame_frame_based_descriptor_t); default_index = GET(uvideo_format_frame_based_descriptor_t, format_desc, bDefaultFrameIndex); @@ -1386,7 +1387,6 @@ uvideo_stream_init_frame_based_format(st return USBD_INVAL; } subtype = UDESC_VS_FRAME_MJPEG; - subtypelen = sizeof(uvideo_vs_frame_mjpeg_descriptor_t); default_index = GET(uvideo_vs_format_mjpeg_descriptor_t, format_desc, bDefaultFrameIndex); @@ -1398,8 +1398,6 @@ uvideo_stream_init_frame_based_format(st return USBD_INVAL; } - KASSERT(subtypelen >= sizeof(*uvdesc)); - pformat = NULL; SIMPLEQ_FOREACH(pfiter, >vs_pixel_formats, entries) { if (pfiter->pixel_format == pixel_format) { @@ -1432,6 +1430,29 @@ uvideo_stream_init_frame_based_format(st uvdesc = (const uvideo_descriptor_t *)desc; if (uvdesc->bDescriptorSubtype != subtype) break; + + switch (format_desc->bDescriptorSubtype) { + case UDESC_VS_FORMAT_UNCOMPRESSED: + subtypelen = framedesc_size( + const uvideo_vs_frame_uncompressed_descriptor_t, + uvdesc); + break; + case UDESC_VS_FORMAT_MJPEG: + subtypelen = framedesc_size( + const uvideo_vs_frame_mjpeg_descriptor_t, + uvdesc); + break; + case UDESC_VS_FORMAT_FRAME_BASED: + subtypelen = framedesc_size( + const uvideo_frame_frame_based_descriptor_t, + uvdesc); + break; + default: + /* will bail out below */ + subtypelen = uvdesc->bLength; + break; + } + if (uvdesc->bLength < subtypelen) { DPRINTF(("uvideo:" " truncated CS subtype-0x%x descriptor," @@ -1985,7 +2006,10 @@ uvideo_open(void *addr, int flags) return EIO; /* XXX select default format */ + if (vs->vs_default_format == NULL) + return EINVAL; fmt = *vs->vs_default_format; + return uvideo_set_format(addr, ); } Index: src/sys/dev/usb/uvideoreg.h diff -u src/sys/dev/usb/uvideoreg.h:1.7 src/sys/dev/usb/uvideoreg.h:1.8 --- src/sys/dev/usb/uvideoreg.h:1.7 Sat May 14 15:28:59 2022 +++ src/sys/dev/usb/uvideoreg.h Mon Apr 10 15:26:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvideoreg.h,v 1.7 2022/05/14 15:28:59 riastradh Exp $ */ +/* $NetBSD: uvideoreg.h,v 1.8 2023/04/10 15:26:56 mlelstv Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -435,8 +435,9 @@ typedef struct {
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:14:51 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c uaudioreg.h Log Message: Handle more UAC2 descriptors and add debug output. Fix handling of clock sources (mix.wIndex wasn't set). UAC2 can use separate clock sources (and thus sample rates) for each terminal. That doesn't match the audio(4) model where sample rates are part of an audio format and global. For now, try to match clocks for input and output terminals separately. To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/sys/dev/usb/uaudio.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/uaudioreg.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/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.177 src/sys/dev/usb/uaudio.c:1.178 --- src/sys/dev/usb/uaudio.c:1.177 Mon Apr 3 16:00:17 2023 +++ src/sys/dev/usb/uaudio.c Mon Apr 10 15:14:50 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.177 2023/04/03 16:00:17 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.178 2023/04/10 15:14:50 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.177 2023/04/03 16:00:17 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.178 2023/04/10 15:14:50 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -222,6 +222,7 @@ struct uaudio_softc { device_t sc_audiodev; int sc_nratectls; /* V2 sample rates */ int sc_ratectls[AUFMT_MAX_FREQUENCIES]; + int sc_ratemode[AUFMT_MAX_FREQUENCIES]; struct audio_format *sc_formats; int sc_nformats; u_int sc_channel_config; @@ -239,8 +240,8 @@ struct terminal_list { struct io_terminal { union { const uaudio_cs_descriptor_t *desc; - const struct usb_audio_input_terminal *it; - const struct usb_audio_output_terminal *ot; + const union usb_audio_input_terminal *it; + const union usb_audio_output_terminal *ot; const struct usb_audio_mixer_unit *mu; const struct usb_audio_selector_unit *su; const struct usb_audio_feature_unit *fu; @@ -287,10 +288,11 @@ Static void uaudio_mixer_add_ctl(struct Static char *uaudio_id_name (struct uaudio_softc *, const struct io_terminal *, int); #ifdef UAUDIO_DEBUG -Static void uaudio_dump_cluster(const struct usb_audio_cluster *); +Static void uaudio_dump_cluster + (struct uaudio_softc *, const union usb_audio_cluster *); #endif -Static struct usb_audio_cluster uaudio_get_cluster - (int, const struct io_terminal *); +Static union usb_audio_cluster uaudio_get_cluster + (struct uaudio_softc *, int, const struct io_terminal *); Static void uaudio_add_input (struct uaudio_softc *, const struct io_terminal *, int); Static void uaudio_add_output @@ -323,11 +325,11 @@ Static void uaudio_add_clksel Static struct terminal_list *uaudio_merge_terminal_list (const struct io_terminal *); Static struct terminal_list *uaudio_io_terminaltype - (int, struct io_terminal *, int); + (struct uaudio_softc *, int, struct io_terminal *, int); Static usbd_status uaudio_identify (struct uaudio_softc *, const usb_config_descriptor_t *); Static u_int uaudio_get_rates - (struct uaudio_softc *, u_int *, u_int); + (struct uaudio_softc *, int, u_int *, u_int); Static void uaudio_build_formats (struct uaudio_softc *); @@ -643,7 +645,6 @@ uaudio_mixer_add_ctl(struct uaudio_softc DPRINTF("adding %s\n", mc->ctlname); } len = sizeof(*mc) * (sc->sc_nctls + 1); -KASSERT(len > 0); nmc = kmem_alloc(len, KM_SLEEP); /* Copy old data, if there was any */ if (sc->sc_nctls != 0) { @@ -697,8 +698,14 @@ KASSERT(len > 0); mc->mul = r->maxval - r->minval; res = r->resval; } else { /* UAUDIO_VERSION2 */ - count = (uint16_t)uaudio_get(sc, V2_RANGES, UT_READ_CLASS_INTERFACE, - mc->wValue[0], mc->wIndex, 2); + count = (uint16_t)uaudio_get(sc, V2_RANGES, + UT_READ_CLASS_INTERFACE, + mc->wValue[0], mc->wIndex, 2); + + if (count == 0 || count == (uint16_t)-1) { + DPRINTF("invalid range count %zu\n", count); + return; + } if (count > 1) { r = kmem_alloc(sizeof(struct range) * count, @@ -814,19 +821,47 @@ uaudio_id_name(struct uaudio_softc *sc, #ifdef UAUDIO_DEBUG Static void -uaudio_dump_cluster(const struct usb_audio_cluster *cl) +uaudio_dump_cluster(struct uaudio_softc *sc, const union usb_audio_cluster *cl) { - static const char *channel_names[16] = { + static const char *channel_v1_names[16] = { "LEFT", "RIGHT", "CENTER", "LFE", "LEFT_SURROUND", "RIGHT_SURROUND", "LEFT_CENTER", "RIGHT_CENTER", "SURROUND", "LEFT_SIDE", "RIGHT_SIDE", "TOP", "RESERVED12", "RESERVED13", "RESERVED14", "RESERVED15", }; - int cc, i, first; + static const char *channel_v2_names[32] = { + "LEFT", "RIGHT", "CENTER", "LFE", + "BACK_LEFT", "BACK_RIGHT", "FLC", "FRC", + "BACK_CENTER", "SIDE_LEFT", "SIDE_RIGHT", "TOP CENTER", + "TFL", "TFC", "TFR",
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:14:51 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c uaudioreg.h Log Message: Handle more UAC2 descriptors and add debug output. Fix handling of clock sources (mix.wIndex wasn't set). UAC2 can use separate clock sources (and thus sample rates) for each terminal. That doesn't match the audio(4) model where sample rates are part of an audio format and global. For now, try to match clocks for input and output terminals separately. To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/sys/dev/usb/uaudio.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/uaudioreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pad
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:04:49 UTC 2023 Modified Files: src/sys/dev/pad: pad.c Log Message: Write slinear_le 16bit samples, independent from platform and AUDIO_INTERNAL_BITS. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pad/pad.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/pad/pad.c diff -u src/sys/dev/pad/pad.c:1.79 src/sys/dev/pad/pad.c:1.80 --- src/sys/dev/pad/pad.c:1.79 Tue Jan 24 08:17:11 2023 +++ src/sys/dev/pad/pad.c Mon Apr 10 15:04:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pad.c,v 1.79 2023/01/24 08:17:11 mlelstv Exp $ */ +/* $NetBSD: pad.c,v 1.80 2023/04/10 15:04:49 mlelstv Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.79 2023/01/24 08:17:11 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.80 2023/04/10 15:04:49 mlelstv Exp $"); #include #include @@ -745,7 +745,7 @@ pad_swvol_codec(audio_filter_arg_t *arg) { struct pad_softc *sc = arg->context; const aint_t *src; - aint_t *dst; + uint8_t *dst; u_int sample_count; u_int i; @@ -755,7 +755,30 @@ pad_swvol_codec(audio_filter_arg_t *arg) for (i = 0; i < sample_count; i++) { aint2_t v = (aint2_t)(*src++); v = v * sc->sc_swvol / 255; - *dst++ = (aint_t)v; + + CTASSERT(PADPREC <= AUDIO_INTERNAL_BITS * 2); +#if PADPREC > AUDIO_INTERNAL_BITS + v = v << (PADPREC - AUDIO_INTERNAL_BITS); +#elif PADPREC < AUDIO_INTERNAL_BITS + v = v >> (AUDIO_INTERNAL_BITS - PADPREC); +#endif + + /* AUDIO_ENCODING_SLINEAR_LE */ +#if PADPREC > 0 + *dst++ = v; +#endif +#if PADPREC > 8 + v >>= 8; + *dst++ = v; +#endif +#if PADPREC > 16 + v >>= 8; + *dst++ = v; +#endif +#if PADPREC > 24 + v >>= 8; + *dst++ = v; +#endif } }
CVS commit: src/sys/dev/pad
Module Name:src Committed By: mlelstv Date: Mon Apr 10 15:04:49 UTC 2023 Modified Files: src/sys/dev/pad: pad.c Log Message: Write slinear_le 16bit samples, independent from platform and AUDIO_INTERNAL_BITS. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pad/pad.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Fri Apr 7 06:44:08 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Select virtual address as sender if backing interface is anonymous. Use correct scope for IPv6. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/netinet/ip_carp.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/ip_carp.c diff -u src/sys/netinet/ip_carp.c:1.118 src/sys/netinet/ip_carp.c:1.119 --- src/sys/netinet/ip_carp.c:1.118 Sun Mar 26 10:32:38 2023 +++ src/sys/netinet/ip_carp.c Fri Apr 7 06:44:08 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $ */ +/* $NetBSD: ip_carp.c,v 1.119 2023/04/07 06:44:08 mlelstv Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.119 2023/04/07 06:44:08 mlelstv Exp $"); /* * TODO: @@ -1091,6 +1091,8 @@ carp_send_ad(void *v) _s = pserialize_read_enter(); ifa = ifaof_ifpforaddr(, sc->sc_carpdev); if (ifa == NULL) + ifa = ifaof_ifpforaddr(, >sc_if); + if (ifa == NULL) ip->ip_src.s_addr = 0; else ip->ip_src.s_addr = @@ -1142,6 +1144,7 @@ carp_send_ad(void *v) if (sc->sc_naddrs6) { struct ip6_hdr *ip6; struct ifaddr *ifa; + struct ifnet *ifp; int _s; MGETHDR(m, M_DONTWAIT, MT_HEADER); @@ -1168,7 +1171,12 @@ carp_send_ad(void *v) memset(, 0, sizeof(sa)); sa.sa_family = AF_INET6; _s = pserialize_read_enter(); - ifa = ifaof_ifpforaddr(, sc->sc_carpdev); + ifp = sc->sc_carpdev; + ifa = ifaof_ifpforaddr(, ifp); + if (ifa == NULL) { /* This should never happen with IPv6 */ + ifp = >sc_if; + ifa = ifaof_ifpforaddr(, ifp); + } if (ifa == NULL) /* This should never happen with IPv6 */ memset(>ip6_src, 0, sizeof(struct in6_addr)); else @@ -1179,7 +1187,7 @@ carp_send_ad(void *v) ip6->ip6_dst.s6_addr16[0] = htons(0xff02); ip6->ip6_dst.s6_addr8[15] = 0x12; - if (in6_setscope(>ip6_dst, >sc_if, NULL) != 0) { + if (in6_setscope(>ip6_dst, ifp, NULL) != 0) { if_statinc(>sc_if, if_oerrors); m_freem(m); CARP_LOG(sc, ("in6_setscope failed"));
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Fri Apr 7 06:44:08 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Select virtual address as sender if backing interface is anonymous. Use correct scope for IPv6. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/netinet/ip_carp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Raspberry Pi 3 aarch64 -current fails to find root fs label and boot.
On Wed, Apr 05, 2023 at 05:16:17PM +0200, Bartek Krawczyk wrote: > I see both get root=NAME=netbsd-root and -current also detects this dk1 > wedge with the same "netbsd-root" name. > I got the same issue 2-3 weeks ago but disregarded it thinking "oh well, > -current" but seems something is not right. Does this qualify for a PR or am > I doing something wrong? Something surely goes wrong. -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: Raspberry Pi 3 aarch64 -current fails to find root fs label and boot.
bbartlomiej.m...@gmail.com (Bartek Krawczyk) writes: >My /boot/cmdline.txt has only: >root=NAME=netbsd-root You can use'ofctl /chosen' to find out what bootargs are passed to the kernel.
Re: Raspberry Pi 3 aarch64 -current fails to find root fs label and boot.
bbartlomiej.m...@gmail.com (Bartek Krawczyk) writes: >[ 1.4967611] ld0: 117 GB, 15371 cyl, 255 head, 63 sec, 512 bytes/sect >x 246947840 sectors >[ 1.5157040] dk0 at ld0: "EFI", 163840 blocks at 32768, type: msdos >[ 1.5157040] dk1 at ld0: "netbsd-root", 246743040 blocks at 196608, >[ 3.2258697] boot device: ld0 >[ 3.2369263] root on ld0a dumps on ld0b >[ 3.2369263] vfs_mountroot: can't open root device >[ 3.2369263] cannot mount root, error = 16 >[ 3.2497924] root device (default ld0a): >[ 4.1352268] dump device (default ld0b): The bootloader (EFI?) tells the kernel to use ld0a and ld0b. No idea why, maybe it doesn't support GPT? The kernel produces wedges, and access to ld0 is forbidden (error = 16 == EBUSY), but you can select a wedge as dkN (or by name). To find the problem, you'd need to analyse your image and bootloader version.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 3 16:00:17 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Remove unconditional UAUDIO_DEBUG again. To generate a diff of this commit: cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 3 16:00:17 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Remove unconditional UAUDIO_DEBUG again. To generate a diff of this commit: cvs rdiff -u -r1.176 -r1.177 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.176 src/sys/dev/usb/uaudio.c:1.177 --- src/sys/dev/usb/uaudio.c:1.176 Mon Apr 3 14:19:09 2023 +++ src/sys/dev/usb/uaudio.c Mon Apr 3 16:00:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.176 2023/04/03 14:19:09 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.177 2023/04/03 16:00:17 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.176 2023/04/03 14:19:09 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.177 2023/04/03 16:00:17 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -74,7 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1 #include /* #define UAUDIO_DEBUG */ -#define UAUDIO_DEBUG #define UAUDIO_MULTIPLE_ENDPOINTS #ifdef UAUDIO_DEBUG #define DPRINTF(x,y...) do { \
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 3 14:19:09 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Fix UAUDIO_DEBUG build. To generate a diff of this commit: cvs rdiff -u -r1.175 -r1.176 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.175 src/sys/dev/usb/uaudio.c:1.176 --- src/sys/dev/usb/uaudio.c:1.175 Sun Apr 2 14:42:55 2023 +++ src/sys/dev/usb/uaudio.c Mon Apr 3 14:19:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.175 2023/04/02 14:42:55 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.176 2023/04/03 14:19:09 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.175 2023/04/02 14:42:55 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.176 2023/04/03 14:19:09 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1 #include /* #define UAUDIO_DEBUG */ +#define UAUDIO_DEBUG #define UAUDIO_MULTIPLE_ENDPOINTS #ifdef UAUDIO_DEBUG #define DPRINTF(x,y...) do { \ @@ -1493,9 +1494,8 @@ uaudio_add_clksrc(struct uaudio_softc *s struct mixerctl mix; d = iot[id].d.cu; - DPRINTFN(2,"bUnitId=%d bNrInPins=%d\n", - d->bUnitId, d->bNrInPins); - mix.wIndex = MAKE(d->bClockId, sc->sc_ac_iface); + DPRINTFN(2,"bClockId=%d bmAttributes=%d bmControls=%d iClockSource=%d\n", + d->bClockId, d->bmAttributes, d->bmControls, d->iClockSource); uaudio_determine_class([id], ); mix.nchan = 1; mix.wValue[0] = MAKE(V2_CUR_CLKFREQ, 0); @@ -1517,8 +1517,8 @@ uaudio_add_clksel(struct uaudio_softc *s d = iot[id].d.lu; sel = ((const uByte *)>baCSourceId[d->bNrInPins])[2]; /* iClockSelector */ - DPRINTFN(2,"bUnitId=%d bNrInPins=%d\n", - d->bUnitId, d->bNrInPins); + DPRINTFN(2,"bClockId=%d bNrInPins=%d iClockSelector=%d\n", + d->bClockId, d->bNrInPins, sel); mix.wIndex = MAKE(d->bClockId, sc->sc_ac_iface); uaudio_determine_class([id], ); mix.nchan = 1; @@ -1796,9 +1796,9 @@ uaudio_process_as(struct uaudio_softc *s if (asid != NULL) goto ignore; asid = (const union usb_audio_streaming_interface_descriptor *) desc; -DPRINTF("asid: bTerminalLink=%d wFormatTag=%d bmFormats bLength=%d\n", +DPRINTF("asid: bTerminalLink=%d wFormatTag=%d bmFormats=0x%x bLength=%d\n", asid->v1.bTerminalLink, UGETW(asid->v1.wFormatTag), - UGETWD(asid->v1.bmFormats), asid->v1.bLength); + UGETDW(asid->v2.bmFormats), asid->v1.bLength); break; case FORMAT_TYPE: if (asf1d != NULL) @@ -2049,19 +2049,23 @@ leave: return USBD_NORMAL_COMPLETION; } #ifdef UAUDIO_DEBUG -/* XXXV2 */ - aprint_debug_dev(sc->sc_dev, "%s: %dch, %d/%dbit, %s,", - dir == UE_DIR_IN ? "recording" : "playback", - chan, prec, asf1d->v1.bSubFrameSize * 8, format_str); - if (asf1d->bSamFreqType == UA_SAMP_CONTINUOUS) { - aprint_debug(" %d-%dHz\n", UA_SAMP_LO(>v1), - UA_SAMP_HI(>v1)); - } else { - int r; - aprint_debug(" %d", UA_GETSAMP(>v1, 0)); - for (r = 1; r < asf1d->bSamFreqType; r++) - aprint_debug(",%d", UA_GETSAMP(>v1, r)); - aprint_debug("Hz\n"); + switch (sc->sc_version) { + case UAUDIO_VERSION1: + aprint_debug_dev(sc->sc_dev, "%s: %dch, %d/%dbit, %s,", + dir == UE_DIR_IN ? "recording" : "playback", + chan, prec, asf1d->v1.bSubFrameSize * 8, format_str); + if (asf1d->v1.bSamFreqType == UA_SAMP_CONTINUOUS) { + aprint_debug(" %d-%dHz\n", UA_SAMP_LO(>v1), + UA_SAMP_HI(>v1)); + } else { + int r; + aprint_debug(" %d", UA_GETSAMP(>v1, 0)); + for (r = 1; r < asf1d->v1.bSamFreqType; r++) +aprint_debug(",%d", UA_GETSAMP(>v1, r)); + aprint_debug("Hz\n"); + } + break; + /* XXX V2 */ } #endif ai.alt = id->bAlternateSetting; @@ -2417,12 +2421,12 @@ uaudio_identify_ac(struct uaudio_softc * printf("\n"); break; case UDESCSUB_AC_CLKSRC: - printf("AC_CLKSRC src=%d\n", iot[i].d.cu->bCSourceId); + printf("AC_CLKSRC src=%d\n", iot[i].d.cu->iClockSource); break; case UDESCSUB_AC_CLKSEL: printf("AC_CLKSEL src="); for (j = 0; j < iot[i].d.su->bNrInPins; j++) -printf("%d ", iot[i].d.su->baCSourceId[j]); +printf("%d ", iot[i].d.su->baSourceId[j]); printf("\n"); break; case UDESCSUB_AC_CLKMULT:
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Mon Apr 3 14:19:09 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Fix UAUDIO_DEBUG build. To generate a diff of this commit: cvs rdiff -u -r1.175 -r1.176 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 2 14:43:35 UTC 2023 Modified Files: src/sys/dev/usb: uaudioreg.h Log Message: Add support for USB Audio Class 2.0. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/uaudioreg.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/dev/usb/uaudioreg.h diff -u src/sys/dev/usb/uaudioreg.h:1.16 src/sys/dev/usb/uaudioreg.h:1.17 --- src/sys/dev/usb/uaudioreg.h:1.16 Fri May 18 07:52:54 2012 +++ src/sys/dev/usb/uaudioreg.h Sun Apr 2 14:43:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudioreg.h,v 1.16 2012/05/18 07:52:54 jdc Exp $ */ +/* $NetBSD: uaudioreg.h,v 1.17 2023/04/02 14:43:35 mlelstv Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define UAUDIO_VERSION 0x100 +#define UAUDIO_VERSION1 0x100 +#define UAUDIO_VERSION2 0x200 #define UDESC_CS_CONFIG 0x22 #define UDESC_CS_STRING 0x23 @@ -43,8 +44,13 @@ #define UDESCSUB_AC_MIXER 4 #define UDESCSUB_AC_SELECTOR 5 #define UDESCSUB_AC_FEATURE 6 -#define UDESCSUB_AC_PROCESSING 7 -#define UDESCSUB_AC_EXTENSION 8 +#define UDESCSUB_AC_EFFECT 7 +#define UDESCSUB_AC_PROCESSING 8 +#define UDESCSUB_AC_EXTENSION 9 +#define UDESCSUB_AC_CLKSRC 10 +#define UDESCSUB_AC_CLKSEL 11 +#define UDESCSUB_AC_CLKMULT 12 +#define UDESCSUB_AC_RATECONV13 /* The first fields are identical to usb_endpoint_descriptor_t */ typedef struct { @@ -82,7 +88,7 @@ struct usb_audio_control_descriptor { uByte baInterfaceNr[1]; } UPACKED; -struct usb_audio_streaming_interface_descriptor { +struct usb_audio_streaming_interface_v1_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; @@ -91,6 +97,24 @@ struct usb_audio_streaming_interface_des uWord wFormatTag; } UPACKED; +struct usb_audio_streaming_interface_v2_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bTerminalLink; + uByte bmControls; + uByte bFormatType; + uDWord bmFormats; + uByte bNrChannels; + uDWord bmChannelConfig; + uByte iChannelNames; +} UPACKED; + +union usb_audio_streaming_interface_descriptor { + struct usb_audio_streaming_interface_v1_descriptor v1; + struct usb_audio_streaming_interface_v2_descriptor v2; +}; + struct usb_audio_streaming_endpoint_descriptor { uByte bLength; uByte bDescriptorType; @@ -103,7 +127,7 @@ struct usb_audio_streaming_endpoint_desc uWord wLockDelay; } UPACKED; -struct usb_audio_streaming_type1_descriptor { +struct usb_audio_streaming_type1_v1_descriptor { uByte bLength; uByte bDescriptorType; uByte bDescriptorSubtype; @@ -112,13 +136,27 @@ struct usb_audio_streaming_type1_descrip uByte bSubFrameSize; uByte bBitResolution; uByte bSamFreqType; -#define UA_SAMP_CONTNUOUS 0 +#define UA_SAMP_CONTINUOUS 0 uByte tSamFreq[3*AUFMT_MAX_FREQUENCIES]; #define UA_GETSAMP(p, n) ((p)->tSamFreq[(n)*3+0] | ((p)->tSamFreq[(n)*3+1] << 8) | ((p)->tSamFreq[(n)*3+2] << 16)) #define UA_SAMP_LO(p) UA_GETSAMP(p, 0) #define UA_SAMP_HI(p) UA_GETSAMP(p, 1) } UPACKED; +struct usb_audio_streaming_type1_v2_descriptor { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bFormatType; + uByte bSubslotSize; + uByte bBitResolution; +} UPACKED; + +union usb_audio_streaming_type1_descriptor { + struct usb_audio_streaming_type1_v1_descriptor v1; + struct usb_audio_streaming_type1_v2_descriptor v2; +}; + struct usb_audio_cluster { uByte bNrChannels; uWord wChannelConfig; @@ -260,6 +298,41 @@ struct usb_audio_extension_unit_1 { /*uByte iExtension;*/ } UPACKED; +/* UDESCSUB_AC_CLKSRC */ +struct usb_audio_clksrc_unit { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bClockId; + uByte bmAttributes; + uByte bmControls; + uByte bAssocTerminal; + uByte iClockSource; +} UPACKED; + +/* UDESCSUB_AC_CLKSEL */ +struct usb_audio_clksel_unit { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bClockId; + uByte bNrInPins; + uByte baCSourceId[255]; + /*uByte bmControls;*/ + /*uByte iClockSelector;*/ +} UPACKED; + +/* UDESCSUB_AC_CLKMULT */ +struct usb_audio_clkmult_unit { + uByte bLength; + uByte bDescriptorType; + uByte bDescriptorSubtype; + uByte bClockId; + uByte bCSourceId; + uByte bmControls; + uByte iClockMultiplier; +} UPACKED; + /* USB terminal types */ #define UAT_UNDEFINED 0x0100 #define UAT_STREAM 0x0101 @@ -336,6 +409,12 @@ struct usb_audio_extension_unit_1 { #define SET_MEM 0x05 #define GET_MEM 0x85 #define GET_STAT 0xff +#define V2_CUR0x01 +#define V2_RANGES 0x02 + +#define V2_CUR_CLKFREQ 0x01 +#define V2_CUR_CLKSEL 0x01 + #define MUTE_CONTROL 0x01 #define VOLUME_CONTROL 0x02 @@ -347,6 +426,9 @@ struct usb_audio_extension_unit_1 { #define DELAY_CONTROL 0x08 #define
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 2 14:43:35 UTC 2023 Modified Files: src/sys/dev/usb: uaudioreg.h Log Message: Add support for USB Audio Class 2.0. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/uaudioreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 2 14:42:55 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Add code for USB Audio Class 2.0. This is only half of the game as UAC2 devices tend to use 24bit or 32bit samples. This requires more support in audio(4). To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.174 src/sys/dev/usb/uaudio.c:1.175 --- src/sys/dev/usb/uaudio.c:1.174 Tue Jun 28 05:22:13 2022 +++ src/sys/dev/usb/uaudio.c Sun Apr 2 14:42:55 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.174 2022/06/28 05:22:13 skrll Exp $ */ +/* $NetBSD: uaudio.c,v 1.175 2023/04/02 14:42:55 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.174 2022/06/28 05:22:13 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.175 2023/04/02 14:42:55 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1 #include /* #define UAUDIO_DEBUG */ -/* #define UAUDIO_MULTIPLE_ENDPOINTS */ +#define UAUDIO_MULTIPLE_ENDPOINTS #ifdef UAUDIO_DEBUG #define DPRINTF(x,y...) do { \ if (uaudiodebug) { \ @@ -104,21 +104,36 @@ int uaudiodebug = 0; #define MIX_MAX_CHAN 8 +struct range { + int minval, maxval, resval; +}; + struct mixerctl { uint16_t wValue[MIX_MAX_CHAN]; /* using nchan */ uint16_t wIndex; uint8_t nchan; uint8_t type; -#define MIX_ON_OFF 1 -#define MIX_SIGNED_16 2 -#define MIX_UNSIGNED_16 3 -#define MIX_SIGNED_8 4 -#define MIX_SELECTOR 5 -#define MIX_SIZE(n) ((n) == MIX_SIGNED_16 || (n) == MIX_UNSIGNED_16 ? 2 : 1) -#define MIX_UNSIGNED(n) ((n) == MIX_UNSIGNED_16) - int minval, maxval; +#define MIX_ON_OFF 0x01 +#define MIX_SELECTOR 0x02 +#define MIX_SIGNED_8 0x10 +#define MIX_UNSIGNED_8 0x18 +#define MIX_SIGNED_16 0x20 +#define MIX_UNSIGNED_16 0x28 +#define MIX_SIGNED_32 0x40 +#define MIX_UNSIGNED_32 0x48 +#define MIX_SIZE(n) ( \ + ((n) == MIX_UNSIGNED_32 || (n) == MIX_SIGNED_32) ? 4 : \ + ((n) == MIX_SIGNED_16 || (n) == MIX_UNSIGNED_16) ? 2 : 1 ) +#define MIX_UNSIGNED(n) ( \ + (n) == MIX_UNSIGNED_8 || \ + (n) == MIX_UNSIGNED_16 || \ + (n) == MIX_UNSIGNED_32 ) + struct range range0; + struct range *ranges; + u_int nranges; u_int delta; u_int mul; + u_int high; uint8_t class; char ctlname[MAX_AUDIO_DEV_LEN]; const char *ctlunit; @@ -128,6 +143,7 @@ struct mixerctl { struct as_info { uint8_t alt; uint8_t encoding; + uint8_t nchan; uint8_t attributes; /* Copy of bmAttributes of * usb_audio_streaming_endpoint_descriptor */ @@ -135,7 +151,7 @@ struct as_info { const usb_interface_descriptor_t *idesc; const usb_endpoint_descriptor_audio_t *edesc; const usb_endpoint_descriptor_audio_t *edesc1; - const struct usb_audio_streaming_type1_descriptor *asf1desc; + const union usb_audio_streaming_type1_descriptor *asf1desc; struct audio_format *aformat; int sc_busy; /* currently used */ }; @@ -182,6 +198,7 @@ struct uaudio_softc { kmutex_t sc_lock; kmutex_t sc_intr_lock; struct usbd_device *sc_udev; /* USB device */ + int sc_version; int sc_ac_iface; /* Audio Control interface */ struct usbd_interface * sc_ac_ifaceh; struct chan sc_playchan; /* play channel */ @@ -198,10 +215,13 @@ struct uaudio_softc { #define HAS_MULAW 0x10 #define UA_NOFRAC 0x20 /* don't do sample rate adjustment */ #define HAS_24 0x40 +#define HAS_32 0x80 int sc_mode; /* play/record capability */ struct mixerctl *sc_ctls; /* mixer controls */ int sc_nctls; /* # of mixer controls */ device_t sc_audiodev; + int sc_nratectls; /* V2 sample rates */ + int sc_ratectls[AUFMT_MAX_FREQUENCIES]; struct audio_format *sc_formats; int sc_nformats; u_int sc_channel_config; @@ -226,6 +246,8 @@ struct io_terminal { const struct usb_audio_feature_unit *fu; const struct usb_audio_processing_unit *pu; const struct usb_audio_extension_unit *eu; + const struct usb_audio_clksrc_unit *cu; + const struct usb_audio_clksel_unit *lu; } d; int inputs_size; struct terminal_list **inputs; /* list of source input terminals */ @@ -240,7 +262,7 @@ struct io_terminal { #define UAC_NCLASSES 4 #ifdef UAUDIO_DEBUG Static const char *uac_names[] = { - AudioCoutputs, AudioCinputs, AudioCequalization, AudioCrecord, + AudioCoutputs, AudioCinputs, AudioCequalization, AudioCrecord }; #endif @@ -290,19 +312,33 @@ Static void uaudio_add_processing_updown (struct uaudio_softc *, const struct io_terminal *, int); Static void uaudio_add_processing (struct uaudio_softc *, const struct io_terminal *, int); +Static void uaudio_add_effect + (struct uaudio_softc *, const struct io_terminal *, int); Static void
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Apr 2 14:42:55 UTC 2023 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Add code for USB Audio Class 2.0. This is only half of the game as UAC2 devices tend to use 24bit or 32bit samples. This requires more support in audio(4). To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/audiocfg
Module Name:src Committed By: mlelstv Date: Sat Apr 1 12:41:02 UTC 2023 Modified Files: src/usr.bin/audiocfg: main.c Log Message: Also report precision from hwinfo. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/audiocfg/main.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/audiocfg/main.c diff -u src/usr.bin/audiocfg/main.c:1.16 src/usr.bin/audiocfg/main.c:1.17 --- src/usr.bin/audiocfg/main.c:1.16 Sat Aug 24 07:39:42 2019 +++ src/usr.bin/audiocfg/main.c Sat Apr 1 12:41:02 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.16 2019/08/24 07:39:42 isaki Exp $ */ +/* $NetBSD: main.c,v 1.17 2023/04/01 12:41:02 mlelstv Exp $ */ /* * Copyright (c) 2010 Jared D. McNeill @@ -91,7 +91,8 @@ print_audiodev(struct audiodev *adev, in printf("\n"); printf(" playback: "); if ((adev->hwinfo.mode & AUMODE_PLAY)) { - printf("%uch, %uHz\n", + printf("%u, %uch, %uHz\n", + adev->hwinfo.play.precision, adev->hwinfo.play.channels, adev->hwinfo.play.sample_rate); } else { @@ -99,7 +100,8 @@ print_audiodev(struct audiodev *adev, in } printf(" record: "); if ((adev->hwinfo.mode & AUMODE_RECORD)) { - printf("%uch, %uHz\n", + printf("%u, %uch, %uHz\n", + adev->hwinfo.record.precision, adev->hwinfo.record.channels, adev->hwinfo.record.sample_rate); } else {
CVS commit: src/usr.bin/audiocfg
Module Name:src Committed By: mlelstv Date: Sat Apr 1 12:41:02 UTC 2023 Modified Files: src/usr.bin/audiocfg: main.c Log Message: Also report precision from hwinfo. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/audiocfg/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: LLONG_MAX not available from c++
mar...@duskware.de (Martin Husemann) writes: > > c++ -dM -E - < /dev/null | fgrep __STDC_VERSION__ >#define __STDC_VERSION__ 201710L > > c++ -dM -E - < /dev/null | fgrep __ISO There is magic involved. % touch c.c % ls -l c.c -rw-r--r-- 1 mlelstv staff 0 Mar 31 17:28 c.c % c++ -dM -E - < c.c | grep STDC #define __STDC_HOSTED__ 1 #define __STDC_UTF_16__ 1 #define __STDC_VERSION__ 201710L #define __GNUC_STDC_INLINE__ 1 #define __STDC_UTF_32__ 1 #define __STDC__ 1 % c++ -dM -E c.c | grep STDC #define __STDC_HOSTED__ 1 #define __STDC_UTF_16__ 1 #define __GNUC_STDC_INLINE__ 1 #define __STDC_UTF_32__ 1 #define __STDC__ 1
Re: LLONG_MAX not available from c++
w...@netbsd.org (Thomas Klausner) writes: >> Make sure c++ with using at least -std=c++11? >Same error, also with c++17 and gnu++17. Probably lua does something >weird. lua defines _XOPEN_SOURCE in lprefix.h: #if !defined(_XOPEN_SOURCE) #define _XOPEN_SOURCE 600 #elif _XOPEN_SOURCE == 0 #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ #endif That's why it's no longer _NETBSD_SOURCE (featuretest). c++ also doesn't define __STDC_VERSION__ nor _ISOC99_SOURCE. And so limits.h doesn't define LLONG_MAX. >From what I found LLONG_MAX should also be defined for C++11 and later, then limits.h should also check for __cplusplus >= 201100L.
Re: Raspberry Pi 3 and NetBSD 10.0_BETA - WiFi stops working after few hours and wonky USB keyboard
bbartlomiej.m...@gmail.com (Bartek Krawczyk) writes: >> Perhaps the device is going into power saving mode and your connection >> terminates? >There's "powersave off" in the ifconfig output and I've issued the >ifconfig bwfm0 -powersave command explicitly as well. No change. The default in netbsd-10 and -current is to have powersave disabled. With powersave you often see latencies of ~100ms. >> Another thing, change the channel of the router, perhaps there's >> interference from others around you? >It's not the interference - other devices near it work just fine. And >have been working fine for years. RPI has a weak antenna, so "other devices" may not be a good reference. >I'll be raising a wpa_supplicant bug >then. Since it's working after wpa_supplicant restart and it's rekeying >periodically. Interference would impact it intermittently, not >completely after few hours. Thanks for suggestion, though. I'd suspect a firmware bug. I should reactivate my RPI3 for a test. N.B. I don't see issues with a RPI0w, a RPI4 and a BPI M2 Zero which comes with a bwfm compatible chip.
Re: CARP misbehaving on RPi2+ / RPI3
rela...@gmail.com (Greywolf) writes: >Greetings; I have a couple RPi that I will refer to here as 'thing1' >and 'thing2'. Both are running evbarm-earmv7h, NetBSD 10-BETA. The carp driver sent advertising packets through the carp interface which sets the source MAC address to the CARP virtual MAC address (computed from the vhid value). A normal ethernet switch will then learn that this MAC address exists on multiple ports and change its forwarding table all the time, resulting in lots of packet drops. The CARP election protocol then doesn't work. I have comitted a change to send advertisments through the backing 'carpdev' interface instead. This uses its own distinct MAC address, and the switch stays happy. With the consumer switches here, it still takes up to 20 seconds to notice when CARP moves the virtual MAC address to the other machine.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Mar 26 10:32:38 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Use backing device to send advertisements. Otherwise the packets originate from the virtual MAC address, which confuses switches. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/netinet/ip_carp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Mar 26 10:32:38 UTC 2023 Modified Files: src/sys/netinet: ip_carp.c Log Message: Use backing device to send advertisements. Otherwise the packets originate from the virtual MAC address, which confuses switches. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/netinet/ip_carp.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/ip_carp.c diff -u src/sys/netinet/ip_carp.c:1.117 src/sys/netinet/ip_carp.c:1.118 --- src/sys/netinet/ip_carp.c:1.117 Fri Sep 2 23:48:11 2022 +++ src/sys/netinet/ip_carp.c Sun Mar 26 10:32:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.117 2022/09/02 23:48:11 thorpej Exp $ */ +/* $NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.117 2022/09/02 23:48:11 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.118 2023/03/26 10:32:38 mlelstv Exp $"); /* * TODO: @@ -1876,6 +1876,9 @@ carp_join_multicast(struct carp_softc *s struct ip_moptions *imo = >sc_imo, tmpimo; struct in_addr addr; + if (sc->sc_carpdev == NULL) + return (ENETDOWN); + memset(, 0, sizeof(tmpimo)); addr.s_addr = INADDR_CARP_GROUP; if ((tmpimo.imo_membership[0] = @@ -1885,7 +1888,7 @@ carp_join_multicast(struct carp_softc *s imo->imo_membership[0] = tmpimo.imo_membership[0]; imo->imo_num_memberships = 1; - imo->imo_multicast_if_index = sc->sc_if.if_index; + imo->imo_multicast_if_index = sc->sc_carpdev->if_index; imo->imo_multicast_ttl = CARP_DFLTTL; imo->imo_multicast_loop = 0; return (0); @@ -1970,6 +1973,9 @@ carp_join_multicast6(struct carp_softc * struct sockaddr_in6 addr6; int error; + if (sc->sc_carpdev == NULL) + return (ENETDOWN); + /* Join IPv6 CARP multicast group */ memset(, 0, sizeof(addr6)); addr6.sin6_family = AF_INET6; @@ -1996,7 +2002,7 @@ carp_join_multicast6(struct carp_softc * } /* apply v6 multicast membership */ - im6o->im6o_multicast_if_index = sc->sc_if.if_index; + im6o->im6o_multicast_if_index = sc->sc_carpdev->if_index; if (imm) LIST_INSERT_HEAD(>im6o_memberships, imm, i6mm_chain);
CVS commit: src/sbin/ifconfig
Module Name:src Committed By: mlelstv Date: Sun Mar 26 01:04:16 UTC 2023 Modified Files: src/sbin/ifconfig: carp.c ifconfig.8 Log Message: Fix parser for carp state. The state values are uppercase words INIT, BACKUP and MASTER. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sbin/ifconfig/carp.c cvs rdiff -u -r1.124 -r1.125 src/sbin/ifconfig/ifconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/ifconfig/carp.c diff -u src/sbin/ifconfig/carp.c:1.14 src/sbin/ifconfig/carp.c:1.15 --- src/sbin/ifconfig/carp.c:1.14 Sun Jun 7 06:02:58 2020 +++ src/sbin/ifconfig/carp.c Sun Mar 26 01:04:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: carp.c,v 1.14 2020/06/07 06:02:58 thorpej Exp $ */ +/* $NetBSD: carp.c,v 1.15 2023/03/26 01:04:16 mlelstv Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: carp.c,v 1.14 2020/06/07 06:02:58 thorpej Exp $"); +__RCSID("$NetBSD: carp.c,v 1.15 2023/03/26 01:04:16 mlelstv Exp $"); #endif /* not lint */ #include @@ -67,10 +67,16 @@ static int setcarpdev(prop_dictionary_t, static const char *carp_states[] = { CARP_STATES }; +/* from if_carp.c */ +enum carpstateval { INIT = 0, BACKUP, MASTER }; + struct kwinst carpstatekw[] = { - {.k_word = "INIT", .k_nextparser = _root.pb_parser} - , {.k_word = "BACKUP", .k_nextparser = _root.pb_parser} - , {.k_word = "MASTER", .k_nextparser = _root.pb_parser} + {.k_word = "INIT", .k_type = KW_T_INT, .k_int = INIT, + .k_nextparser = _root.pb_parser} + , {.k_word = "BACKUP", .k_type = KW_T_INT, .k_int = BACKUP, + .k_nextparser = _root.pb_parser} + , {.k_word = "MASTER", .k_type = KW_T_INT, .k_int = MASTER, + .k_nextparser = _root.pb_parser} }; struct pinteger parse_advbase = PINTEGER_INITIALIZER1(_advbase, "advbase", Index: src/sbin/ifconfig/ifconfig.8 diff -u src/sbin/ifconfig/ifconfig.8:1.124 src/sbin/ifconfig/ifconfig.8:1.125 --- src/sbin/ifconfig/ifconfig.8:1.124 Fri Nov 25 08:41:05 2022 +++ src/sbin/ifconfig/ifconfig.8 Sun Mar 26 01:04:16 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: ifconfig.8,v 1.124 2022/11/25 08:41:05 knakahara Exp $ +.\" $NetBSD: ifconfig.8,v 1.125 2023/03/26 01:04:16 mlelstv Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -315,10 +315,10 @@ Explicitly force the .Xr carp 4 pseudo-device to enter this state. Valid states are -.Ar init , -.Ar backup , +.Ar INIT , +.Ar BACKUP , and -.Ar master . +.Ar MASTER . .It Cm frag Ar threshold .Pq IEEE 802.11 devices only Configure the fragmentation threshold for IEEE 802.11-based wireless
CVS commit: src/sbin/ifconfig
Module Name:src Committed By: mlelstv Date: Sun Mar 26 01:04:16 UTC 2023 Modified Files: src/sbin/ifconfig: carp.c ifconfig.8 Log Message: Fix parser for carp state. The state values are uppercase words INIT, BACKUP and MASTER. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sbin/ifconfig/carp.c cvs rdiff -u -r1.124 -r1.125 src/sbin/ifconfig/ifconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 11:04:34 UTC 2023 Modified Files: src/sys/dev/pci: viomb.c viornd.c vioscsi.c Log Message: Mark as MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/viomb.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/viornd.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/vioscsi.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/pci/viomb.c diff -u src/sys/dev/pci/viomb.c:1.16 src/sys/dev/pci/viomb.c:1.17 --- src/sys/dev/pci/viomb.c:1.16 Sat Mar 25 11:00:35 2023 +++ src/sys/dev/pci/viomb.c Sat Mar 25 11:04:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: viomb.c,v 1.16 2023/03/25 11:00:35 mlelstv Exp $ */ +/* $NetBSD: viomb.c,v 1.17 2023/03/25 11:04:34 mlelstv Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.16 2023/03/25 11:00:35 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.17 2023/03/25 11:04:34 mlelstv Exp $"); #include #include @@ -192,7 +192,7 @@ viomb_attach(device_t parent, device_t s } if (virtio_child_attach_finish(vsc, sc->sc_vq, __arraycount(sc->sc_vq), - viomb_config_change, 0) != 0) + viomb_config_change, VIRTIO_F_INTR_MPSAFE) != 0) goto err_out; if (kthread_create(PRI_IDLE, KTHREAD_MPSAFE, NULL, Index: src/sys/dev/pci/viornd.c diff -u src/sys/dev/pci/viornd.c:1.20 src/sys/dev/pci/viornd.c:1.21 --- src/sys/dev/pci/viornd.c:1.20 Thu Mar 23 03:55:11 2023 +++ src/sys/dev/pci/viornd.c Sat Mar 25 11:04:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: viornd.c,v 1.20 2023/03/23 03:55:11 yamaguchi Exp $ */ +/* $NetBSD: viornd.c,v 1.21 2023/03/25 11:04:34 mlelstv Exp $ */ /* $OpenBSD: viornd.c,v 1.1 2014/01/21 21:14:58 sf Exp $ */ /* @@ -191,7 +191,7 @@ viornd_attach(device_t parent, device_t sc->sc_vq.vq_done = viornd_vq_done; error = virtio_child_attach_finish(vsc, >sc_vq, 1, - NULL, 0); + NULL, VIRTIO_F_INTR_MPSAFE); if (error) { virtio_free_vq(vsc, >sc_vq); goto vio_failed; Index: src/sys/dev/pci/vioscsi.c diff -u src/sys/dev/pci/vioscsi.c:1.35 src/sys/dev/pci/vioscsi.c:1.36 --- src/sys/dev/pci/vioscsi.c:1.35 Sat Mar 25 09:03:47 2023 +++ src/sys/dev/pci/vioscsi.c Sat Mar 25 11:04:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vioscsi.c,v 1.35 2023/03/25 09:03:47 mlelstv Exp $ */ +/* $NetBSD: vioscsi.c,v 1.36 2023/03/25 11:04:34 mlelstv Exp $ */ /* $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.35 2023/03/25 09:03:47 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.36 2023/03/25 11:04:34 mlelstv Exp $"); #include #include @@ -173,7 +173,8 @@ vioscsi_attach(device_t parent, device_t cmd_per_lun, qsize, seg_max, max_target, max_lun); if (virtio_child_attach_finish(vsc, sc->sc_vqs, - __arraycount(sc->sc_vqs), NULL, VIRTIO_F_INTR_MSIX) != 0) + __arraycount(sc->sc_vqs), NULL, + VIRTIO_F_INTR_MSIX | VIRTIO_F_INTR_MPSAFE) != 0) goto err; /* @@ -186,6 +187,7 @@ vioscsi_attach(device_t parent, device_t adapt->adapt_max_periph = adapt->adapt_openings; adapt->adapt_request = vioscsi_scsipi_request; adapt->adapt_minphys = minphys; + adapt->adapt_flags = SCSIPI_ADAPT_MPSAFE; /* * Fill in the scsipi_channel.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 11:04:34 UTC 2023 Modified Files: src/sys/dev/pci: viomb.c viornd.c vioscsi.c Log Message: Mark as MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/viomb.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/viornd.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/vioscsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 11:00:35 UTC 2023 Modified Files: src/sys/dev/pci: viomb.c Log Message: Fix 32bit overflow when calculating balloon size. Don't make uvm_pglistalloc wait, it will wait forever. Instead rely on the retries by this driver. This also allows to cancel the request. Increase inflate speed by factor 10 (same as deflate). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/viomb.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/pci/viomb.c diff -u src/sys/dev/pci/viomb.c:1.15 src/sys/dev/pci/viomb.c:1.16 --- src/sys/dev/pci/viomb.c:1.15 Thu Mar 23 03:55:11 2023 +++ src/sys/dev/pci/viomb.c Sat Mar 25 11:00:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: viomb.c,v 1.15 2023/03/23 03:55:11 yamaguchi Exp $ */ +/* $NetBSD: viomb.c,v 1.16 2023/03/25 11:00:35 mlelstv Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.15 2023/03/23 03:55:11 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viomb.c,v 1.16 2023/03/25 11:00:35 mlelstv Exp $"); #include #include @@ -286,8 +286,8 @@ inflate(struct viomb_softc *sc) nhpages = nvpages * VIRTIO_PAGE_SIZE / PAGE_SIZE; b = >sc_req; - if (uvm_pglistalloc(nhpages*PAGE_SIZE, 0, UINT32_MAX*PAGE_SIZE, - 0, 0, >bl_pglist, nhpages, 1)) { + if (uvm_pglistalloc(nhpages*PAGE_SIZE, 0, UINT32_MAX*(paddr_t)PAGE_SIZE, + 0, 0, >bl_pglist, nhpages, 0)) { printf("%s: %" PRIu64 " pages of physical memory " "could not be allocated, retrying...\n", device_xname(sc->sc_dev), nhpages); @@ -507,9 +507,9 @@ viomb_thread(void *arg) if (r != 0) sleeptime = 1; else - sleeptime = 1000; + sleeptime = 100; } else -sleeptime = 100; +sleeptime = 20; } else if (sc->sc_npages < sc->sc_actual + sc->sc_inflight) { if (sc->sc_inflight == 0) r = deflate(sc);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 11:00:35 UTC 2023 Modified Files: src/sys/dev/pci: viomb.c Log Message: Fix 32bit overflow when calculating balloon size. Don't make uvm_pglistalloc wait, it will wait forever. Instead rely on the retries by this driver. This also allows to cancel the request. Increase inflate speed by factor 10 (same as deflate). To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/viomb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 09:03:47 UTC 2023 Modified Files: src/sys/dev/pci: vioscsi.c Log Message: A single SCSI request may require multiple slots in the virtio queue but the queue isn't sized for the theoretical maximum. So just use XS_BUSY to pace the scsipi layer. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/vioscsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 09:03:47 UTC 2023 Modified Files: src/sys/dev/pci: vioscsi.c Log Message: A single SCSI request may require multiple slots in the virtio queue but the queue isn't sized for the theoretical maximum. So just use XS_BUSY to pace the scsipi layer. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/vioscsi.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/pci/vioscsi.c diff -u src/sys/dev/pci/vioscsi.c:1.34 src/sys/dev/pci/vioscsi.c:1.35 --- src/sys/dev/pci/vioscsi.c:1.34 Sat Mar 25 08:14:00 2023 +++ src/sys/dev/pci/vioscsi.c Sat Mar 25 09:03:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vioscsi.c,v 1.34 2023/03/25 08:14:00 mlelstv Exp $ */ +/* $NetBSD: vioscsi.c,v 1.35 2023/03/25 09:03:47 mlelstv Exp $ */ /* $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.34 2023/03/25 08:14:00 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.35 2023/03/25 09:03:47 mlelstv Exp $"); #include #include @@ -300,7 +300,7 @@ vioscsi_scsipi_request(struct scsipi_cha */ vr = vioscsi_req_get(sc); if (vr == NULL) { - xs->error = XS_RESOURCE_SHORTAGE; + xs->error = XS_BUSY; scsipi_done(xs); return; } @@ -387,11 +387,9 @@ stuffup: error = virtio_enqueue_reserve(vsc, vq, slot, nsegs); if (error) { - aprint_error_dev(sc->sc_dev, "error reserving %d (nsegs %d)\n", - error, nsegs); bus_dmamap_unload(virtio_dmat(vsc), vr->vr_data); /* slot already freed by virtio_enqueue_reserve() */ - xs->error = XS_RESOURCE_SHORTAGE; + xs->error = XS_BUSY; scsipi_done(xs); return; }
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 08:14:00 UTC 2023 Modified Files: src/sys/dev/pci: vioscsi.c Log Message: restore fetch of qsize. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/vioscsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sat Mar 25 08:14:00 UTC 2023 Modified Files: src/sys/dev/pci: vioscsi.c Log Message: restore fetch of qsize. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/vioscsi.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/pci/vioscsi.c diff -u src/sys/dev/pci/vioscsi.c:1.33 src/sys/dev/pci/vioscsi.c:1.34 --- src/sys/dev/pci/vioscsi.c:1.33 Fri Mar 24 13:32:19 2023 +++ src/sys/dev/pci/vioscsi.c Sat Mar 25 08:14:00 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: vioscsi.c,v 1.33 2023/03/24 13:32:19 yamaguchi Exp $ */ +/* $NetBSD: vioscsi.c,v 1.34 2023/03/25 08:14:00 mlelstv Exp $ */ /* $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.33 2023/03/24 13:32:19 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.34 2023/03/25 08:14:00 mlelstv Exp $"); #include #include @@ -163,6 +163,7 @@ vioscsi_attach(device_t parent, device_t sc->sc_vqs[i].vq_done = vioscsi_vq_done; } + qsize = sc->sc_vqs[VIOSCSI_VQ_REQUEST].vq_num; if (vioscsi_alloc_reqs(sc, vsc, qsize)) goto err;
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Wed Mar 22 13:00:54 UTC 2023 Modified Files: src/sys/dev: ipmi.c Log Message: Ignore non-recoverable and critical limits smaller than the warning limits. These are usually invalid. Name the limit flags to make code more readable. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ipmi.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/ipmi.c diff -u src/sys/dev/ipmi.c:1.9 src/sys/dev/ipmi.c:1.10 --- src/sys/dev/ipmi.c:1.9 Tue Jun 15 00:20:33 2021 +++ src/sys/dev/ipmi.c Wed Mar 22 13:00:54 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ipmi.c,v 1.9 2021/06/15 00:20:33 riastradh Exp $ */ +/* $NetBSD: ipmi.c,v 1.10 2023/03/22 13:00:54 mlelstv Exp $ */ /* * Copyright (c) 2019 Michael van Elst @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.9 2021/06/15 00:20:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.10 2023/03/22 13:00:54 mlelstv Exp $"); #include #include @@ -1533,6 +1533,14 @@ ipmi_get_limits(struct sysmon_envsys *sm return; } +/* valid bits for (upper,lower) x (non-recoverable, critical, warn) */ +#define UN 0x20 +#define UC 0x10 +#define UW 0x08 +#define LN 0x04 +#define LC 0x02 +#define LW 0x01 + static void ipmi_get_sensor_limits(struct ipmi_softc *sc, struct ipmi_sensor *psensor, sysmon_envsys_lim_t *limits, uint32_t *props) @@ -1540,7 +1548,7 @@ ipmi_get_sensor_limits(struct ipmi_softc struct sdrtype1 *s1 = (struct sdrtype1 *)psensor->i_sdr; bool failure; int rxlen; - uint8_t data[32]; + uint8_t data[32], valid; uint32_t prop_critmax, prop_warnmax, prop_critmin, prop_warnmin; int32_t *pcritmax, *pwarnmax, *pcritmin, *pwarnmin; @@ -1582,27 +1590,43 @@ ipmi_get_sensor_limits(struct ipmi_softc break; } - if (data[0] & 0x20 && data[6] != 0xff) { + valid = data[0]; + + /* if upper non-recoverable < warning, ignore it */ + if ((valid & (UN|UW)) == (UN|UW) && data[6] < data[4]) + valid ^= UN; + /* if upper critical < warning, ignore it */ + if ((valid & (UC|UW)) == (UC|UW) && data[5] < data[4]) + valid ^= UC; + + /* if lower non-recoverable > warning, ignore it */ + if ((data[0] & (LN|LW)) == (LN|LW) && data[3] > data[1]) + valid ^= LN; + /* if lower critical > warning, ignore it */ + if ((data[0] & (LC|LW)) == (LC|LW) && data[2] > data[1]) + valid ^= LC; + + if (valid & UN && data[6] != 0xff) { *pcritmax = ipmi_convert_sensor([6], psensor); *props |= prop_critmax; } - if (data[0] & 0x10 && data[5] != 0xff) { + if (valid & UC && data[5] != 0xff) { *pcritmax = ipmi_convert_sensor([5], psensor); *props |= prop_critmax; } - if (data[0] & 0x08 && data[4] != 0xff) { + if (valid & UW && data[4] != 0xff) { *pwarnmax = ipmi_convert_sensor([4], psensor); *props |= prop_warnmax; } - if (data[0] & 0x04 && data[3] != 0x00) { + if (valid & LN && data[3] != 0x00) { *pcritmin = ipmi_convert_sensor([3], psensor); *props |= prop_critmin; } - if (data[0] & 0x02 && data[2] != 0x00) { + if (valid & LC && data[2] != 0x00) { *pcritmin = ipmi_convert_sensor([2], psensor); *props |= prop_critmin; } - if (data[0] & 0x01 && data[1] != 0x00) { + if (valid & LW && data[1] != 0x00) { *pwarnmin = ipmi_convert_sensor([1], psensor); *props |= prop_warnmin; }
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Wed Mar 22 13:00:54 UTC 2023 Modified Files: src/sys/dev: ipmi.c Log Message: Ignore non-recoverable and critical limits smaller than the warning limits. These are usually invalid. Name the limit flags to make code more readable. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ipmi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: ipmi0: incorrect critical max
net...@precedence.co.uk (Stephen Borrill) writes: > Current CritMax WarnMax WarnMin CritMin Unit >[ipmi0] >11-LOM-CORE:59.2530.000 110.471degC >Seen on 9.3_STABLE, but also in 10 BETA. >I suppose one simple fix would be to ensure that if CritMax is lower >than WarnMax, it should be set to the value of WarnMax. IPMI reports 3 upper and 3 lower limits (each as an unsigned byte) and a bitmask to show which value is valid. lower non-recoverable threshold -> configures CritMin lower critical threshold -> configures CritMin lower non-critical threshold -> configures WarnMin lower limits of 0 are ignored, because you cannot exceed them. upper non-recoverable threshold -> configures CritMax upper critical threshold -> configures CritMax upper non-critical threshold -> configures WarnMax upper limits of 255 are ignored, because you cannot exceed them. Apparently your system says that the upper critical or the non-recoverable threshold exist but returns a value of zero. The code could do some more sanity checking and then just skip the invalid limits. Something like: @@ -1582,6 +1684,16 @@ ipmi_get_sensor_limits(struct ipmi_softc break; } + if ((data[0] & 0x28) == 0x28 && data[6] < data[4]) + data[0] ^= 0x20; + if ((data[0] & 0x18) == 0x18 && data[5] < data[4]) + data[0] ^= 0x10; + + if ((data[0] & 0x0a) == 0x0a && data[3] > data[1]) + data[0] ^= 0x08; + if ((data[0] & 0x06) == 0x06 && data[2] > data[1]) + data[0] ^= 0x04; + if (data[0] & 0x20 && data[6] != 0xff) { *pcritmax = ipmi_convert_sensor([6], psensor); *props |= prop_critmax; As an alternative you could also override the limit in /etc/envsys.conf.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Mar 18 11:36:23 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Can't use disklabel to find the real size of a disk since a fake disklabel read from disk is trusted. Revert to use drvctl again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/resize_disklabel diff -u src/distrib/utils/embedded/files/resize_disklabel:1.4 src/distrib/utils/embedded/files/resize_disklabel:1.5 --- src/distrib/utils/embedded/files/resize_disklabel:1.4 Sat Feb 18 07:58:34 2023 +++ src/distrib/utils/embedded/files/resize_disklabel Sat Mar 18 11:36:23 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_disklabel,v 1.4 2023/02/18 07:58:34 mlelstv Exp $ +# $NetBSD: resize_disklabel,v 1.5 2023/03/18 11:36:23 mlelstv Exp $ # # PROVIDE: resize_disklabel @@ -27,8 +27,7 @@ get_total_sectors() local disk disk=$1 - /sbin/disklabel -t "$disk" \ - | sed -ne 's/.*:su#\([0-9]*\):.*/\1/p' + /sbin/drvctl -p "$disk" disk-info/geometry/sectors-per-unit } get_rawpart_sectors()
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Mar 18 11:36:23 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Can't use disklabel to find the real size of a disk since a fake disklabel read from disk is trusted. Revert to use drvctl again. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/nfs
Module Name:src Committed By: mlelstv Date: Fri Mar 17 00:46:35 UTC 2023 Modified Files: src/sys/nfs: nfs_vfsops.c Log Message: Avoid overflow of nfs_commitsize on machines with > 32GB RAM. To generate a diff of this commit: cvs rdiff -u -r1.243 -r1.244 src/sys/nfs/nfs_vfsops.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/nfs/nfs_vfsops.c diff -u src/sys/nfs/nfs_vfsops.c:1.243 src/sys/nfs/nfs_vfsops.c:1.244 --- src/sys/nfs/nfs_vfsops.c:1.243 Sun Jun 13 10:25:11 2021 +++ src/sys/nfs/nfs_vfsops.c Fri Mar 17 00:46:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $ */ +/* $NetBSD: nfs_vfsops.c,v 1.244 2023/03/17 00:46:35 mlelstv Exp $ */ /* * Copyright (c) 1989, 1993, 1995 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.244 2023/03/17 00:46:35 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_nfs.h" @@ -1135,6 +1135,7 @@ nfs_start(struct mount *mp, int flags) void nfs_vfs_init(void) { + unsigned scale; /* Initialize NFS server / client shared data. */ nfs_init(); @@ -1145,7 +1146,8 @@ nfs_vfs_init(void) /* Initialize the iod structures */ nfs_iodinit(); - nfs_commitsize = uvmexp.npages << (PAGE_SHIFT - 4); + scale = PAGE_SHIFT - 4; + nfs_commitsize = uimin(uvmexp.npages, INT_MAX >> scale) << scale; } void
CVS commit: src/sys/nfs
Module Name:src Committed By: mlelstv Date: Fri Mar 17 00:46:35 UTC 2023 Modified Files: src/sys/nfs: nfs_vfsops.c Log Message: Avoid overflow of nfs_commitsize on machines with > 32GB RAM. To generate a diff of this commit: cvs rdiff -u -r1.243 -r1.244 src/sys/nfs/nfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: mlelstv Date: Sun Mar 5 22:04:54 UTC 2023 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: Locate wedges as boot device and also match a partition GUID. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/evbarm/fdt/fdt_machdep.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/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.100 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.101 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.100 Sun Feb 5 22:42:39 2023 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Sun Mar 5 22:04:54 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.100 2023/02/05 22:42:39 mrg Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.101 2023/03/05 22:04:54 mlelstv Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.100 2023/02/05 22:42:39 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.101 2023/03/05 22:04:54 mlelstv Exp $"); #include "opt_arm_debug.h" #include "opt_bootconfig.h" @@ -743,9 +743,6 @@ fdt_detect_root_device(device_t dev) { int error, len; - if (booted_device) - return; - const int chosen = OF_finddevice("/chosen"); if (chosen < 0) return; @@ -801,8 +798,15 @@ fdt_detect_root_device(device_t dev) const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", ); - if (guid != NULL && len == 16) - booted_device = dev; + if (guid == NULL || len != 16) + return; + + char guidstr[UUID_STR_LEN]; + uuid_snprintf(guidstr, sizeof(guidstr), guid); + + device_t dv = dkwedge_find_by_wname(guidstr); + if (dv != NULL) + booted_device = dv; return; } @@ -895,8 +899,7 @@ fdt_cpu_rootconf(void) if (device_class(dev) != DV_DISK) continue; - if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd")) - fdt_detect_root_device(dev); + fdt_detect_root_device(dev); if (booted_device != NULL) break;
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: mlelstv Date: Sun Mar 5 22:04:54 UTC 2023 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: Locate wedges as boot device and also match a partition GUID. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/evbarm/fdt/fdt_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: GENERIC64 aarch64 failure to autoboot
On Sun, Mar 05, 2023 at 10:56:31PM +0100, Michael van Elst wrote: > On Mon, Mar 06, 2023 at 07:44:20AM +1030, Brett Lymn wrote: > > On Sun, Mar 05, 2023 at 03:01:02PM -, Michael van Elst wrote: > > > > > > - if (guid != NULL && len == 16) > > > + if (guid == NULL || len == 16) > > > + > > > > Shouldn't that be "len != 16"? > > Yes, and another error. The wedge device is 'dv' not 'dev'. > > Here is a patch that works for me: The first hunk was another local change. Please ignore. Here is without: Index: sys/arch/evbarm/fdt/fdt_machdep.c === RCS file: /cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v retrieving revision 1.100 diff -p -u -r1.100 fdt_machdep.c --- sys/arch/evbarm/fdt/fdt_machdep.c 5 Feb 2023 22:42:39 - 1.100 +++ sys/arch/evbarm/fdt/fdt_machdep.c 5 Mar 2023 21:59:49 - @@ -743,9 +743,6 @@ fdt_detect_root_device(device_t dev) { int error, len; - if (booted_device) - return; - const int chosen = OF_finddevice("/chosen"); if (chosen < 0) return; @@ -801,8 +798,15 @@ fdt_detect_root_device(device_t dev) const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", ); - if (guid != NULL && len == 16) - booted_device = dev; + if (guid == NULL || len != 16) + return; + + char guidstr[UUID_STR_LEN]; + uuid_snprintf(guidstr, sizeof(guidstr), guid); + + device_t dv = dkwedge_find_by_wname(guidstr); + if (dv != NULL) + booted_device = dv; return; } @@ -895,8 +899,7 @@ fdt_cpu_rootconf(void) if (device_class(dev) != DV_DISK) continue; - if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd")) - fdt_detect_root_device(dev); + fdt_detect_root_device(dev); if (booted_device != NULL) break;
Re: GENERIC64 aarch64 failure to autoboot
On Mon, Mar 06, 2023 at 07:44:20AM +1030, Brett Lymn wrote: > On Sun, Mar 05, 2023 at 03:01:02PM -0000, Michael van Elst wrote: > > > > - if (guid != NULL && len == 16) > > + if (guid == NULL || len == 16) > > + > > Shouldn't that be "len != 16"? Yes, and another error. The wedge device is 'dv' not 'dev'. Here is a patch that works for me: Index: sys/arch/evbarm/fdt/fdt_machdep.c === RCS file: /cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v retrieving revision 1.100 diff -p -u -r1.100 fdt_machdep.c --- sys/arch/evbarm/fdt/fdt_machdep.c 5 Feb 2023 22:42:39 - 1.100 +++ sys/arch/evbarm/fdt/fdt_machdep.c 5 Mar 2023 21:54:09 - @@ -209,6 +209,15 @@ fdt_add_boot_physmem(const struct fdt_me bp->bp_pages = atop(eaddr) - bp->bp_start; bp->bp_freelist = VM_FREELIST_DEFAULT; +#ifdef VM_FREELIST_4GB + if (eaddr < (paddr_t)4 * 1024 * 1024 * 1024) + bp->bp_freelist = VM_FREELIST_4GB; +#endif +#ifdef VM_FREELIST_1GB + if (eaddr < (paddr_t)1 * 1024 * 1024 * 1024) + bp->bp_freelist = VM_FREELIST_1GB; +#endif + #ifdef PMAP_NEED_ALLOC_POOLPAGE const uint64_t memory_size = *(uint64_t *)arg; if (atop(memory_size) > bp->bp_pages) { @@ -743,9 +752,6 @@ fdt_detect_root_device(device_t dev) { int error, len; - if (booted_device) - return; - const int chosen = OF_finddevice("/chosen"); if (chosen < 0) return; @@ -801,8 +807,15 @@ fdt_detect_root_device(device_t dev) const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", ); - if (guid != NULL && len == 16) - booted_device = dev; + if (guid == NULL || len != 16) + return; + + char guidstr[UUID_STR_LEN]; + uuid_snprintf(guidstr, sizeof(guidstr), guid); + + device_t dv = dkwedge_find_by_wname(guidstr); + if (dv != NULL) + booted_device = dv; return; } @@ -895,8 +908,7 @@ fdt_cpu_rootconf(void) if (device_class(dev) != DV_DISK) continue; - if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd")) - fdt_detect_root_device(dev); + fdt_detect_root_device(dev); if (booted_device != NULL) break; -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: GENERIC64 aarch64 failure to autoboot
mlel...@serpens.de (Michael van Elst) writes: >On Sun, Mar 05, 2023 at 12:56:29PM +, Chavdar Ivanov wrote: >[ 1.3797015] dk0 at sd0: "EFI system", 262144 blocks at 2048, type: >msdos >[ 1.3897890] dk1 at sd0: "cc8f4a89-edc0-48d1-b9ce-b40d227a4a07", >> netbsd,gpt-guid 894a8fcc c0edd148 b9ceb40d 227a4a07 >> .J.H"zJ. >Means, the bootloader passes dk1 as the boot device. >But the code only checks "ld", "sd" and "wd" devices: This might help (compile tested only): Index: sys/arch/evbarm/fdt/fdt_machdep.c === RCS file: /cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v retrieving revision 1.100 diff -p -u -r1.100 fdt_machdep.c --- sys/arch/evbarm/fdt/fdt_machdep.c 5 Feb 2023 22:42:39 - 1.100 +++ sys/arch/evbarm/fdt/fdt_machdep.c 5 Mar 2023 14:55:41 - @@ -743,9 +743,6 @@ fdt_detect_root_device(device_t dev) { int error, len; - if (booted_device) - return; - const int chosen = OF_finddevice("/chosen"); if (chosen < 0) return; @@ -801,7 +798,14 @@ fdt_detect_root_device(device_t dev) const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", ); - if (guid != NULL && len == 16) + if (guid == NULL || len == 16) + return; + + char guidstr[UUID_STR_LEN]; + uuid_snprintf(guidstr, sizeof(guidstr), guid); + + device_t dv = dkwedge_find_by_wname(guidstr); + if (dv != NULL) booted_device = dev; return; @@ -895,8 +899,7 @@ fdt_cpu_rootconf(void) if (device_class(dev) != DV_DISK) continue; - if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd")) - fdt_detect_root_device(dev); + fdt_detect_root_device(dev); if (booted_device != NULL) break;
Re: GENERIC64 aarch64 failure to autoboot
On Sun, Mar 05, 2023 at 12:56:29PM +, Chavdar Ivanov wrote: [ 1.3797015] dk0 at sd0: "EFI system", 262144 blocks at 2048, type: msdos [ 1.3897890] dk1 at sd0: "cc8f4a89-edc0-48d1-b9ce-b40d227a4a07", > netbsd,gpt-guid 894a8fcc c0edd148 b9ceb40d 227a4a07 .J.H"zJ. Means, the bootloader passes dk1 as the boot device. But the code only checks "ld", "sd" and "wd" devices: if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd")) fdt_detect_root_device(dev); wedges are skipped, but even if a "dk" device would be checked, then: if (of_hasprop(chosen, "netbsd,gpt-guid")) { const struct uuid *guid = fdtbus_get_prop(chosen, "netbsd,gpt-guid", ); if (guid != NULL && len == 16) booted_device = dev; return; } this matches anything. In this case, the first "ld", "sd" or "wd" device matches as soon as a netbsd,gpt-guid is passed by the bootloader. Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: GENERIC64 aarch64 failure to autoboot
ci4...@gmail.com (Chavdar Ivanov) writes: >Since my last aarch64 build yesterday, 03/03/2023, my machine no >longer boots automatically, sys/arch/evbarm/fdt/fdt_machdep.c 1.100 changed how the boot disk is determined. Apparently it now fails for you.
Re: Prob with my speakers
tgru...@gmail.com (Todd Gruhn) writes: >Speakers where cracking a lot. I noticed that when I reboot >NetBSD I saw some info printed. >How to I catch this and send it in? Is it in a log I can view? The early messages should be in /var/run/dmesg.boot. Output from starting services is logged in /var/run/rc.log. /var/run is tmpfs, so the data is lost after a reboot. Some, but not all of the dmesg output is also logged in /var/log/messages.
Re: NFS issue with 10.0_BETA
m...@ecs.vuw.ac.nz (Mark Davies) writes: linux->netbsd10 >18 -> V3 SETATTR Call (Reply in 19), FH: 0xf9f94117 >19 <- V3 SETATTR Reply (Call In 18) Error: NFS3ERR_ACCESS linux->netbsd9 >16 -> V3 SETATTR Call (Reply in 17), FH: 0xfe8a620f >17 <- V3 SETATTR Reply (Call In 16) netbsd10->netbsd10 >11 -> V3 SETATTR Call (Reply in 12), FH: 0xf9f94117 >12 <- V3 SETATTR Reply (Call In 11) That's the truncate operation where things fail. Somewhere the NFS call must be different. Please dump the full RPC call and reply.
CVS commit: src/usr.bin/ftp
Module Name:src Committed By: mlelstv Date: Sat Feb 25 12:07:25 UTC 2023 Modified Files: src/usr.bin/ftp: cmdtab.c extern.h fetch.c ftp.1 main.c ssl.c util.c version.h Log Message: Add option sslnoverify to control validation of SSL certificates. Add netrc processing to fetch-mode (URL on command line) to enable options and autologin via netrc. Fix SSL cleanup in some error paths. Certificate validation is now enabled by default. Set FTPSSLNOVERIFY=1 in environment or configure a corresponding init macro via netrc to not validate certs (required if you haven't installed a required CA certificate for OpenSSL). Discussed with lukem@ on icb. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.bin/ftp/cmdtab.c cvs rdiff -u -r1.82 -r1.83 src/usr.bin/ftp/extern.h cvs rdiff -u -r1.235 -r1.236 src/usr.bin/ftp/fetch.c cvs rdiff -u -r1.147 -r1.148 src/usr.bin/ftp/ftp.1 cvs rdiff -u -r1.128 -r1.129 src/usr.bin/ftp/main.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/ftp/ssl.c cvs rdiff -u -r1.165 -r1.166 src/usr.bin/ftp/util.c cvs rdiff -u -r1.95 -r1.96 src/usr.bin/ftp/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/ftp
nue; } + if (ruserpass("", , , ) < 0) { + close(s); + s = -1; + continue; + } + + if (autologin) { + if (fuser != NULL && auth->user == NULL) +auth->user = ftp_strdup(fuser); + if (pass != NULL && auth->pass == NULL) +auth->pass = ftp_strdup(pass); + } + + for (n = 0; n < macnum; ++n) { + if (!strcmp("init", macros[n].mac_name)) { +(void)strlcpy(line, "$init", sizeof(line)); +makeargv(); +domacro(margc, margv); +break; + } + } + #ifdef WITH_SSL if (ssl) { if ((*ssl = fetch_start_ssl(s, host)) == NULL) { @@ -699,6 +723,15 @@ ftp_socket(const struct urlinfo *ui, voi #endif break; } + + FREEPTR(fuser); + if (pass != NULL) + memset(pass, 0, strlen(pass)); + FREEPTR(pass); + if (facct != NULL) + memset(facct, 0, strlen(facct)); + FREEPTR(facct); + if (res0) freeaddrinfo(res0); return s; @@ -1484,6 +1517,10 @@ fetch_url(const char *url, const char *p } } else {/* ftp:// or http:// URLs */ int hasleading; + static char hostnamebuf[MAXHOSTNAMELEN]; + + (void)strlcpy(hostnamebuf, ui.host, sizeof(hostnamebuf)); + hostname = hostnamebuf; if (penv == NULL) { #ifdef WITH_SSL @@ -1517,7 +1554,7 @@ fetch_url(const char *url, const char *p } } /* ! EMPTYSTRING(penv) */ - s = ftp_socket(, ); + s = ftp_socket(, , ); if (s < 0) { warnx("Can't connect to `%s:%s'", ui.host, ui.port); goto cleanup_fetch_url; Index: src/usr.bin/ftp/ftp.1 diff -u src/usr.bin/ftp/ftp.1:1.147 src/usr.bin/ftp/ftp.1:1.148 --- src/usr.bin/ftp/ftp.1:1.147 Tue Aug 30 08:51:28 2022 +++ src/usr.bin/ftp/ftp.1 Sat Feb 25 12:07:25 2023 @@ -1,6 +1,6 @@ -.\" $NetBSD: ftp.1,v 1.147 2022/08/30 08:51:28 christos Exp $ +.\" $NetBSD: ftp.1,v 1.148 2023/02/25 12:07:25 mlelstv Exp $ .\" -.\" Copyright (c) 1996-2021 The NetBSD Foundation, Inc. +.\" Copyright (c) 1996-2023 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation @@ -57,7 +57,7 @@ .\" .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94 .\" -.Dd August 29, 2022 +.Dd February 25, 2023 .Dt FTP 1 .Os .Sh NAME @@ -1382,7 +1382,7 @@ and .Ar value are not given, display all of the options and their values. The currently supported options are: -.Bl -tag -width "https_proxy" -offset indent +.Bl -tag -width "sslnoverify" -offset indent .It Cm anonpass Defaults to .Ev $FTPANONPASS @@ -1407,6 +1407,9 @@ Defaults to .It Cm rprompt Defaults to .Ev $FTPRPROMPT . +.It Cm sslnoverify +Defaults to +.Ev $FTPSSLNOVERIFY . .El .It Ic site Op Ar arg ... The arguments specified are sent, verbatim, to the remote @@ -2312,6 +2315,8 @@ The value to send for the .Tn HTTP User-Agent header. +.It Ev FTPSSLNOVERIFY +Set to 1 to not verify SSL certificates. .It Ev HOME For default location of a .Pa .netrc @@ -2320,8 +2325,6 @@ file, if one exists. An alternate location of the .Pa .netrc file. -.It Ev NO_CERT_VERIFY -Don't verify SSL certificates. .It Ev PAGER Used by various commands to display files. Defaults to Index: src/usr.bin/ftp/main.c diff -u src/usr.bin/ftp/main.c:1.128 src/usr.bin/ftp/main.c:1.129 --- src/usr.bin/ftp/main.c:1.128 Sat Oct 9 09:07:20 2021 +++ src/usr.bin/ftp/main.c Sat Feb 25 12:07:25 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: main.c,v 1.128 2021/10/09 09:07:20 lukem Exp $ */ +/* $NetBSD: main.c,v 1.129 2023/02/25 12:07:25 mlelstv Exp $ */ /*- - * Copyright (c) 1996-2015 The NetBSD Foundation, Inc. + * Copyright (c) 1996-2023 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -98,7 +98,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19 #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; #else -__RCSID("$NetBSD: main.c,v 1.128 2021/10/09 09:07:20 lukem Exp $"); +__RCSID("$NetBSD: main.c,v 1.129 2023/02/25 12:07:25 mlelstv Exp $"); #endif #endif /* not lint */ @@ -512,6 +512,7 @@ main(int volatile argc, char **volatile setupoption("pager", getenv("PAGER"), DEFAULTPAGER); setupoption("prompt", getenv("FTPPROMPT"), DEFAULTPROMPT); setupoption("rprompt", getenv("FTPRPROMPT"), DEFAULTRPROMPT); + setupoption("sslnoverify", getenv("FTPSSLNOVERIFY"), ""); free(anonpass); Index: src/usr.bin/ftp/ssl.c diff -u src/usr.bin/ftp/ssl.c:1.12 src/usr.bin/ftp/ssl.c:1.13 --- src/usr.bin/ftp/ssl.c:1.12 Mon Sep 12 15:10:31 2022 +++ src/usr.bin/ftp/ssl.c Sat Feb 25 12:07:25 2023 @@ -1,9 +1,10 @@ -/* $NetBSD: ssl.c,v 1.12 2022/09/12 15:10:31 christos Exp $ */ +/* $NetBSD: ssl.c,v 1.13 2023/02/25 12:07:25 mlelstv Exp $ */ /*- * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav * Copyright (c) 2008, 2010 Joerg Sonnenberger * Copyright
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: mlelstv Date: Sun Feb 19 10:48:06 UTC 2023 Modified Files: src/sys/arch/mips/mips: db_interface.c Log Message: Only copyin/copyout from and to user addresses. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/mips/mips/db_interface.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: mlelstv Date: Sun Feb 19 10:48:06 UTC 2023 Modified Files: src/sys/arch/mips/mips: db_interface.c Log Message: Only copyin/copyout from and to user addresses. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/mips/mips/db_interface.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/mips/mips/db_interface.c diff -u src/sys/arch/mips/mips/db_interface.c:1.97 src/sys/arch/mips/mips/db_interface.c:1.98 --- src/sys/arch/mips/mips/db_interface.c:1.97 Wed Oct 26 23:38:08 2022 +++ src/sys/arch/mips/mips/db_interface.c Sun Feb 19 10:48:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.97 2022/10/26 23:38:08 riastradh Exp $ */ +/* $NetBSD: db_interface.c,v 1.98 2023/02/19 10:48:06 mlelstv Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.97 2022/10/26 23:38:08 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.98 2023/02/19 10:48:06 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_multiprocessor.h" @@ -190,7 +190,7 @@ db_read_bytes(vaddr_t addr, size_t size, * Note that MIPS_KSEG0_START is the proper address for * both 32-bit and 64-bit kernels. */ - if (addr < (vaddr_t)MIPS_KSEG0_START) { + if (addr < VM_MAXUSER_ADDRESS) { err = copyin(src, data, size); if (err) { #ifdef DDB @@ -228,7 +228,7 @@ db_write_bytes(vaddr_t addr, size_t size int err; /* If asked to fetch from userspace, do it safely */ - if (addr < (vaddr_t)MIPS_KSEG0_START) { + if (addr < VM_MAXUSER_ADDRESS) { err = copyout(data, p, size); if (err) { #ifdef DDB
Re: bta2dpd plays too fast
nathanialsl...@yahoo.com.au (Nat Sloss) writes: >The solution is to use bta2dpd with the pad(4) device which is throttled >sending only the required amount of audio data in the right time. In current or in netbsd-9 ?
CVS commit: src/sys/dev/wsfont
Module Name:src Committed By: mlelstv Date: Sun Feb 19 05:35:35 UTC 2023 Modified Files: src/sys/dev/wsfont: wsfont.c Log Message: Add missing "latin small letter sharp s" (U+00DF) to ibm437 map. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/wsfont/wsfont.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/wsfont/wsfont.c diff -u src/sys/dev/wsfont/wsfont.c:1.79 src/sys/dev/wsfont/wsfont.c:1.80 --- src/sys/dev/wsfont/wsfont.c:1.79 Mon Oct 31 13:24:58 2022 +++ src/sys/dev/wsfont/wsfont.c Sun Feb 19 05:35:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: wsfont.c,v 1.79 2022/10/31 13:24:58 macallan Exp $ */ +/* $NetBSD: wsfont.c,v 1.80 2023/02/19 05:35:35 mlelstv Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.79 2022/10/31 13:24:58 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.80 2023/02/19 05:35:35 mlelstv Exp $"); #include "opt_wsfont.h" @@ -858,7 +858,7 @@ static const u_int8_t ibm437_chars_0[] = 255,173,155,156, 0, 157, 0, 0, 0, 0, 166,174,170, 0, 0, 0, 0, 241,253, 0, 0, 0, 0, 249, 0, 0, 167,175,172,171, 0, 168, 0, 0, 0, 0, 142,143,146,128, 0, 144, 0, 0, 0, 0, 0, 0, - 0, 165, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 154, 0, 0, 0, + 0, 165, 0, 0, 0, 0, 153, 0, 0, 0, 0, 0, 154, 0, 0, 225, 133,160,131, 0, 132,134,145,135,138,130,136,137,141,161,140,139, 0, 164,149,162,147, 0, 148,246, 0, 151,163,150,129, 0, 0, 152 };
CVS commit: src/sys/dev/wsfont
Module Name:src Committed By: mlelstv Date: Sun Feb 19 05:35:35 UTC 2023 Modified Files: src/sys/dev/wsfont: wsfont.c Log Message: Add missing "latin small letter sharp s" (U+00DF) to ibm437 map. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/wsfont/wsfont.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Feb 18 07:58:35 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Handle arbitrary raw partitions. Fetch geometry from disklabel to be consistent. Use disktab format instead of the normal human-readable output for parsing the disklabel. Avoid overflows in size computation. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/utils/embedded/files/resize_disklabel diff -u src/distrib/utils/embedded/files/resize_disklabel:1.3 src/distrib/utils/embedded/files/resize_disklabel:1.4 --- src/distrib/utils/embedded/files/resize_disklabel:1.3 Sat Oct 6 09:58:55 2018 +++ src/distrib/utils/embedded/files/resize_disklabel Sat Feb 18 07:58:34 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_disklabel,v 1.3 2018/10/06 09:58:55 jmcneill Exp $ +# $NetBSD: resize_disklabel,v 1.4 2023/02/18 07:58:34 mlelstv Exp $ # # PROVIDE: resize_disklabel @@ -16,25 +16,35 @@ stop_cmd=":" get_rawpart() { + local partno + partno=$(/sbin/sysctl -n kern.rawpartition) - test $partno = 2 && echo c || echo d + printf "$(printf %o $((partno + 97)))" } get_total_sectors() { + local disk + disk=$1 - /sbin/drvctl -p $disk disk-info/geometry/sectors-per-unit + /sbin/disklabel -t "$disk" \ + | sed -ne 's/.*:su#\([0-9]*\):.*/\1/p' } get_rawpart_sectors() { + local disk rawpart + disk=$1 rawpart=$2 - /sbin/disklabel $disk | grep "^ $rawpart:" | awk '{ print $2; }' + /sbin/disklabel -t "$disk" \ + | sed -ne 's/.*:p'"$rawpart"'#\([0-9]*\):.*/\1/p' } grow_mbrpart() { + local disk rawpart ts rs oldsize newsize + disk=$1 rawpart=$(get_rawpart) @@ -44,21 +54,23 @@ grow_mbrpart() return fi - ts=$(($(get_total_sectors $disk) - ${PART1START})) + ts=$((${DLSIZE} - ${PART1START})) rs=${PART1SIZE} if [ "$ts" = "$rs" ]; then return fi - oldsize=$(($rs * 512 / 1024 / 1024)) - newsize=$(($ts * 512 / 1024 / 1024)) + oldsize=$(($rs / 2048)) + newsize=$(($ts / 2048)) echo "Growing $disk MBR partition #1 (${oldsize}MB -> ${newsize}MB)" /sbin/fdisk -f -u -1 -s 169/${PART1START}/${ts} ${disk} } grow_disklabel() { + local disk part rawpart ts rs oldsize newsize + disk=$1 part=$2 rawpart=$(get_rawpart) @@ -70,8 +82,8 @@ grow_disklabel() return fi - oldsize=$(($rs * 512 / 1024 / 1024)) - newsize=$(($ts * 512 / 1024 / 1024)) + oldsize=$(($rs / 2048)) + newsize=$(($ts / 2048)) echo "Growing $disk disklabel (${oldsize}MB -> ${newsize}MB)" printf "A\ny\n$part\n\n\n\$\nc\n\n\n\$\nd\n\n\n\$\nW\ny\nQ\n" | \ disklabel -i $disk >/dev/null
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: mlelstv Date: Sat Feb 18 07:58:35 UTC 2023 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Handle arbitrary raw partitions. Fetch geometry from disklabel to be consistent. Use disktab format instead of the normal human-readable output for parsing the disklabel. Avoid overflows in size computation. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/resize_disklabel Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc/rc.d
Module Name:src Committed By: mlelstv Date: Sat Feb 18 07:51:52 UTC 2023 Modified Files: src/etc/rc.d: iscsid_volumes Log Message: Handle missing auth file. Skip empty lines. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/iscsid_volumes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc/rc.d
Module Name:src Committed By: mlelstv Date: Sat Feb 18 07:51:52 UTC 2023 Modified Files: src/etc/rc.d: iscsid_volumes Log Message: Handle missing auth file. Skip empty lines. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/iscsid_volumes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/iscsid_volumes diff -u src/etc/rc.d/iscsid_volumes:1.2 src/etc/rc.d/iscsid_volumes:1.3 --- src/etc/rc.d/iscsid_volumes:1.2 Mon Feb 6 11:53:03 2023 +++ src/etc/rc.d/iscsid_volumes Sat Feb 18 07:51:52 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: iscsid_volumes,v 1.2 2023/02/06 11:53:03 martin Exp $ +# $NetBSD: iscsid_volumes,v 1.3 2023/02/18 07:51:52 mlelstv Exp $ # # PROVIDE: iscsid_volumes @@ -20,7 +20,7 @@ iscsid_volumes_start() while read host target digest auth user alias; do case $host in - \#*) ;; + \#*|"") ;; *) topts='' case $digest in @@ -33,13 +33,15 @@ iscsid_volumes_start() pass="-" mpass="-" - while read entry dummy; do -case $entry in -\#*) ;; -"$user":*) pass=${entry#*:} ;; -"$target":*) mpass=${entry#*:} ;; -esac - done < /etc/iscsi/auths + if [ -f /etc/iscsi/auths ]; then +while read entry dummy; do + case $entry in + \#*|"") ;; + "$user":*) pass=${entry#*:} ;; + "$target":*) mpass=${entry#*:} ;; + esac +done < /etc/iscsi/auths + fi case $host in *:*) @@ -82,7 +84,7 @@ iscsid_volumes_stop() while read host target digest auth user alias; do case $host in - \#*) ;; + \#*|"") ;; *) echo "Remove target ${alias:-$target}"
CVS commit: src/sys/arch
Module Name:src Committed By: mlelstv Date: Sat Feb 11 22:42:21 UTC 2023 Modified Files: src/sys/arch/cats/conf: ldscript.elf src/sys/arch/epoc32/conf: ldscript.epoc32 src/sys/arch/zaurus/conf: ldscript.zaurus Log Message: Apply ldscript fixes for binutils-2.39. See PR 57223. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/cats/conf/ldscript.elf cvs rdiff -u -r1.7 -r1.8 src/sys/arch/epoc32/conf/ldscript.epoc32 cvs rdiff -u -r1.12 -r1.13 src/sys/arch/zaurus/conf/ldscript.zaurus Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: mlelstv Date: Sat Feb 11 22:42:21 UTC 2023 Modified Files: src/sys/arch/cats/conf: ldscript.elf src/sys/arch/epoc32/conf: ldscript.epoc32 src/sys/arch/zaurus/conf: ldscript.zaurus Log Message: Apply ldscript fixes for binutils-2.39. See PR 57223. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/cats/conf/ldscript.elf cvs rdiff -u -r1.7 -r1.8 src/sys/arch/epoc32/conf/ldscript.epoc32 cvs rdiff -u -r1.12 -r1.13 src/sys/arch/zaurus/conf/ldscript.zaurus 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/cats/conf/ldscript.elf diff -u src/sys/arch/cats/conf/ldscript.elf:1.6 src/sys/arch/cats/conf/ldscript.elf:1.7 --- src/sys/arch/cats/conf/ldscript.elf:1.6 Sun Aug 23 08:57:25 2015 +++ src/sys/arch/cats/conf/ldscript.elf Sat Feb 11 22:42:20 2023 @@ -1,16 +1,20 @@ -/* $NetBSD: ldscript.elf,v 1.6 2015/08/23 08:57:25 uebayasi Exp $ */ +/* $NetBSD: ldscript.elf,v 1.7 2023/02/11 22:42:20 mlelstv Exp $ */ ENTRY(KERNEL_BASE_phys) SECTIONS { + KERNEL_BASE_phys = 0xF000; + KERNEL_BASE_virt = 0xF000; + /* Kernel start: */ - .start : + .start (KERNEL_BASE_phys) : { *(.start) } /* Read-only sections, merged into text segment: */ - .text : + .text (KERNEL_BASE_virt + SIZEOF(.start)) : + AT (LOADADDR(.start) + SIZEOF(.start)) { *(.text) *(.text.*) @@ -66,19 +70,3 @@ SECTIONS _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; PROVIDE (end = .); } -SECTIONS -{ - KERNEL_BASE_phys = 0xF000; - KERNEL_BASE_virt = 0xF000; - - .start (KERNEL_BASE_phys) : - { -*(.start) - } =0 - - .text (KERNEL_BASE_virt + SIZEOF(.start)) : - AT (LOADADDR(.start) + SIZEOF(.start)) - { -*(.text) - } =0 -} Index: src/sys/arch/epoc32/conf/ldscript.epoc32 diff -u src/sys/arch/epoc32/conf/ldscript.epoc32:1.7 src/sys/arch/epoc32/conf/ldscript.epoc32:1.8 --- src/sys/arch/epoc32/conf/ldscript.epoc32:1.7 Sun Aug 23 08:57:25 2015 +++ src/sys/arch/epoc32/conf/ldscript.epoc32 Sat Feb 11 22:42:20 2023 @@ -1,16 +1,20 @@ -/* $NetBSD: ldscript.epoc32,v 1.7 2015/08/23 08:57:25 uebayasi Exp $ */ +/* $NetBSD: ldscript.epoc32,v 1.8 2023/02/11 22:42:20 mlelstv Exp $ */ ENTRY(KERNEL_BASE_phys) SECTIONS { + KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; + KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; + /* Kernel start: */ - .start : + .start (KERNEL_BASE_phys) : { *(.start) } /* Read-only sections, merged into text segment: */ - .text : + .text (KERNEL_BASE_virt + SIZEOF(.start)) : + AT (LOADADDR(.start) + SIZEOF(.start)) { *(.text) *(.text.*) @@ -70,19 +74,3 @@ SECTIONS KEEP(*(.note.netbsd.ident)); } } -SECTIONS -{ - KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; - KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; - - .start (KERNEL_BASE_phys) : - { -*(.start) - } =0 - - .text (KERNEL_BASE_virt + SIZEOF(.start)) : - AT (LOADADDR(.start) + SIZEOF(.start)) - { -*(.text) - } =0 -} Index: src/sys/arch/zaurus/conf/ldscript.zaurus diff -u src/sys/arch/zaurus/conf/ldscript.zaurus:1.12 src/sys/arch/zaurus/conf/ldscript.zaurus:1.13 --- src/sys/arch/zaurus/conf/ldscript.zaurus:1.12 Fri Jan 3 10:01:07 2020 +++ src/sys/arch/zaurus/conf/ldscript.zaurus Sat Feb 11 22:42:20 2023 @@ -1,16 +1,20 @@ -/* $NetBSD: ldscript.zaurus,v 1.12 2020/01/03 10:01:07 martin Exp $ */ +/* $NetBSD: ldscript.zaurus,v 1.13 2023/02/11 22:42:20 mlelstv Exp $ */ ENTRY(KERNEL_BASE_phys) SECTIONS { + KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; + KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; + /* Kernel start: */ - .start : + .start (KERNEL_BASE_phys) : { *(.start) } /* Read-only sections, merged into text segment: */ - .text : + .text (KERNEL_BASE_virt + SIZEOF(.start)) : + AT (LOADADDR(.start) + SIZEOF(.start)) { *(.text) *(.text.*) @@ -75,19 +79,3 @@ SECTIONS *(.SUNW_ctf) } } -SECTIONS -{ - KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; - KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; - - .start (KERNEL_BASE_phys) : - { -*(.start) - } =0 - - .text (KERNEL_BASE_virt + SIZEOF(.start)) : - AT (LOADADDR(.start) + SIZEOF(.start)) - { -*(.text) - } =0 -}
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: mlelstv Date: Sat Feb 11 19:09:57 UTC 2023 Modified Files: src/sys/arch/evbarm/conf: ldscript.evbarm Log Message: Merge both SECTIONS declarations into one. Fixes PR 57223. cats, epoc32 and zaurus need a similar fix. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/ldscript.evbarm Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: mlelstv Date: Sat Feb 11 19:09:57 UTC 2023 Modified Files: src/sys/arch/evbarm/conf: ldscript.evbarm Log Message: Merge both SECTIONS declarations into one. Fixes PR 57223. cats, epoc32 and zaurus need a similar fix. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/conf/ldscript.evbarm 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/evbarm/conf/ldscript.evbarm diff -u src/sys/arch/evbarm/conf/ldscript.evbarm:1.14 src/sys/arch/evbarm/conf/ldscript.evbarm:1.15 --- src/sys/arch/evbarm/conf/ldscript.evbarm:1.14 Fri Jul 10 12:25:10 2020 +++ src/sys/arch/evbarm/conf/ldscript.evbarm Sat Feb 11 19:09:57 2023 @@ -1,16 +1,20 @@ -/* $NetBSD: ldscript.evbarm,v 1.14 2020/07/10 12:25:10 skrll Exp $ */ +/* $NetBSD: ldscript.evbarm,v 1.15 2023/02/11 19:09:57 mlelstv Exp $ */ ENTRY(KERNEL_BASE_phys) SECTIONS { + KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; + KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; + /* Kernel start: */ - .start : + .start (KERNEL_BASE_phys) : { *(.start) } /* Read-only sections, merged into text segment: */ - .text : + .text (KERNEL_BASE_virt + ALIGN(SIZEOF(.start), ALIGNOF(.text))) : + AT (LOADADDR(.start) + ALIGN(SIZEOF(.start), ALIGNOF(.text))) { *(.text) *(.text.*) @@ -80,19 +84,3 @@ SECTIONS _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; PROVIDE (end = .); } -SECTIONS -{ - KERNEL_BASE_phys = @KERNEL_BASE_PHYS@; - KERNEL_BASE_virt = @KERNEL_BASE_VIRT@; - - .start (KERNEL_BASE_phys) : - { -*(.start) - } =0 - - .text (KERNEL_BASE_virt + ALIGN(SIZEOF(.start), ALIGNOF(.text))) : - AT (LOADADDR(.start) + ALIGN(SIZEOF(.start), ALIGNOF(.text))) - { -*(.text) - } =0 -}
CVS commit: src/usr.sbin/btattach
Module Name:src Committed By: mlelstv Date: Tue Feb 7 20:45:44 UTC 2023 Modified Files: src/usr.sbin/btattach: btattach.c btattach.h init_bcm43xx.c Log Message: - Reconfigure port speed only when initial speed was different. - Time out HCI commands instead of hanging forever. - When bcm43xx reset fails, assume that firmware is already running and start line discipline. This allows to re-attach bcm43xx without reboot. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/btattach/btattach.c cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/btattach/btattach.h cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/btattach/init_bcm43xx.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.sbin/btattach/btattach.c diff -u src/usr.sbin/btattach/btattach.c:1.15 src/usr.sbin/btattach/btattach.c:1.16 --- src/usr.sbin/btattach/btattach.c:1.15 Fri Aug 11 11:54:08 2017 +++ src/usr.sbin/btattach/btattach.c Tue Feb 7 20:45:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: btattach.c,v 1.15 2017/08/11 11:54:08 jmcneill Exp $ */ +/* $NetBSD: btattach.c,v 1.16 2023/02/07 20:45:44 mlelstv Exp $ */ /*- * Copyright (c) 2008 Iain Hibbert @@ -27,7 +27,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008 Iain Hibbert. All rights reserved."); -__RCSID("$NetBSD: btattach.c,v 1.15 2017/08/11 11:54:08 jmcneill Exp $"); +__RCSID("$NetBSD: btattach.c,v 1.16 2023/02/07 20:45:44 mlelstv Exp $"); #include #include @@ -40,6 +40,7 @@ __RCSID("$NetBSD: btattach.c,v 1.15 2017 #include #include #include +#include #include #include #include @@ -275,9 +276,11 @@ main(int argc, char *argv[]) if (type->init != NULL) (*type->init)(fd, speed); - if (cfsetspeed(, speed) < 0 - || tcsetattr(fd, TCSADRAIN, ) < 0) - err(EXIT_FAILURE, "tty setup failed"); + if (speed != init_speed) { + if (cfsetspeed(, speed) < 0 + || tcsetattr(fd, TCSANOW, ) < 0) + err(EXIT_FAILURE, "tty setup failed"); + } /* start line discipline */ if (ioctl(fd, TIOCSLINED, type->line) < 0) @@ -343,6 +346,12 @@ sighandler(int s) } static void +timeout(int s) +{ + +} + +static void hexdump(uint8_t *ptr, size_t len) { @@ -353,11 +362,13 @@ hexdump(uint8_t *ptr, size_t len) /* * send HCI comamnd */ -void +int uart_send_cmd(int fd, uint16_t opcode, void *buf, size_t len) { struct iovec iov[2]; hci_cmd_hdr_t hdr; + int r; + struct sigaction oaction, taction; hdr.type = HCI_CMD_PKT; hdr.opcode = htole16(opcode); @@ -379,7 +390,17 @@ uart_send_cmd(int fd, uint16_t opcode, v if (writev(fd, iov, __arraycount(iov)) < 0) err(EXIT_FAILURE, "writev"); - tcdrain(fd); + taction.sa_handler = timeout, + sigemptyset(_mask); + taction.sa_flags = 0, + + sigaction(SIGALRM, , ); + alarm(1); + r = tcdrain(fd); + alarm(0); + sigaction(SIGALRM, , NULL); + + return r; } /* Index: src/usr.sbin/btattach/btattach.h diff -u src/usr.sbin/btattach/btattach.h:1.4 src/usr.sbin/btattach/btattach.h:1.5 --- src/usr.sbin/btattach/btattach.h:1.4 Thu Aug 10 13:34:29 2017 +++ src/usr.sbin/btattach/btattach.h Tue Feb 7 20:45:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: btattach.h,v 1.4 2017/08/10 13:34:29 nat Exp $ */ +/* $NetBSD: btattach.h,v 1.5 2023/02/07 20:45:44 mlelstv Exp $ */ /*- * Copyright (c) 2008 Iain Hibbert @@ -50,6 +50,6 @@ devinit_t init_stlc2500; devinit_t init_swave; devinit_t init_unistone; -void uart_send_cmd(int, uint16_t, void *, size_t); +int uart_send_cmd(int, uint16_t, void *, size_t); size_t uart_recv_ev(int, uint8_t, void *, size_t); size_t uart_recv_cc(int, uint16_t, void *, size_t); Index: src/usr.sbin/btattach/init_bcm43xx.c diff -u src/usr.sbin/btattach/init_bcm43xx.c:1.5 src/usr.sbin/btattach/init_bcm43xx.c:1.6 --- src/usr.sbin/btattach/init_bcm43xx.c:1.5 Sun Sep 3 22:54:12 2017 +++ src/usr.sbin/btattach/init_bcm43xx.c Tue Feb 7 20:45:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: init_bcm43xx.c,v 1.5 2017/09/03 22:54:12 nat Exp $ */ +/* $NetBSD: init_bcm43xx.c,v 1.6 2023/02/07 20:45:44 mlelstv Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss @@ -34,7 +34,7 @@ */ #include -__RCSID("$NetBSD: init_bcm43xx.c,v 1.5 2017/09/03 22:54:12 nat Exp $"); +__RCSID("$NetBSD: init_bcm43xx.c,v 1.6 2023/02/07 20:45:44 mlelstv Exp $"); #include @@ -102,7 +102,8 @@ init_bcm43xx(int fd, unsigned int speed) memset(rate, 0, sizeof(rate)); memset(local_name, 0, sizeof(local_name)); - uart_send_cmd(fd, HCI_CMD_RESET, NULL, 0); + if (uart_send_cmd(fd, HCI_CMD_RESET, NULL, 0)) + return; uart_recv_cc(fd, HCI_CMD_RESET, , sizeof(resp)); /* assume it succeeded? */
CVS commit: src/usr.sbin/btattach
Module Name:src Committed By: mlelstv Date: Tue Feb 7 20:45:44 UTC 2023 Modified Files: src/usr.sbin/btattach: btattach.c btattach.h init_bcm43xx.c Log Message: - Reconfigure port speed only when initial speed was different. - Time out HCI commands instead of hanging forever. - When bcm43xx reset fails, assume that firmware is already running and start line discipline. This allows to re-attach bcm43xx without reboot. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/btattach/btattach.c cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/btattach/btattach.h cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/btattach/init_bcm43xx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/wsmoused
Module Name:src Committed By: mlelstv Date: Tue Feb 7 20:37:48 UTC 2023 Modified Files: src/usr.sbin/wsmoused: selection.c Log Message: Really compute selection coordinates from buffer offset, don't assume that row=0 col=offset is equivalent. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/wsmoused/selection.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/wsmoused
Module Name:src Committed By: mlelstv Date: Tue Feb 7 20:37:48 UTC 2023 Modified Files: src/usr.sbin/wsmoused: selection.c Log Message: Really compute selection coordinates from buffer offset, don't assume that row=0 col=offset is equivalent. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/wsmoused/selection.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.sbin/wsmoused/selection.c diff -u src/usr.sbin/wsmoused/selection.c:1.11 src/usr.sbin/wsmoused/selection.c:1.12 --- src/usr.sbin/wsmoused/selection.c:1.11 Wed Nov 24 14:34:51 2021 +++ src/usr.sbin/wsmoused/selection.c Tue Feb 7 20:37:48 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: selection.c,v 1.11 2021/11/24 14:34:51 uwe Exp $ */ +/* $NetBSD: selection.c,v 1.12 2023/02/07 20:37:48 mlelstv Exp $ */ /* * Copyright (c) 2002, 2003, 2004, 2007 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: selection.c,v 1.11 2021/11/24 14:34:51 uwe Exp $"); +__RCSID("$NetBSD: selection.c,v 1.12 2023/02/07 20:37:48 mlelstv Exp $"); #endif /* not lint */ #include @@ -144,6 +144,7 @@ static void selarea_copy_text(void); static void selarea_start(void); static void selarea_end(void); static void selarea_calculate(void); +static void selarea_getrowcol(size_t, size_t *, size_t *); static void selarea_hide(void); static void selarea_show(void); static void selarea_paste(void); @@ -648,14 +649,29 @@ selarea_calculate(void) /* -- */ +/* Turns selection absolute position in the screen buffer back into + row, col co-ordinates */ +static void +selarea_getrowcol(size_t pos, size_t* row, size_t* col) +{ + size_t xres = Selmouse.sm_max_x + 1; + + *row = pos / xres; + *col = pos - (*row * xres); +} + +/* -- */ + /* Hides the highlighted region, returning it to normal colors. */ static void selarea_hide(void) { - size_t i; + size_t i, row, col; - for (i = Selarea.sa_startoff; i <= Selarea.sa_endoff; i++) - char_invert(0, i); + for (i = Selarea.sa_startoff; i <= Selarea.sa_endoff; i++) { + selarea_getrowcol(i, , ); + char_invert(row, col); + } } /* -- */ @@ -664,11 +680,13 @@ selarea_hide(void) static void selarea_show(void) { - size_t i; + size_t i, row, col; selarea_calculate(); - for (i = Selarea.sa_startoff; i <= Selarea.sa_endoff; i++) - char_invert(0, i); + for (i = Selarea.sa_startoff; i <= Selarea.sa_endoff; i++) { + selarea_getrowcol(i, , ); + char_invert(row, col); + } } /* -- */
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Sun Feb 5 21:20:15 UTC 2023 Modified Files: src/etc/iscsi: Makefile Log Message: With MKISCSI we need all files. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/etc/iscsi/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Sun Feb 5 21:20:15 UTC 2023 Modified Files: src/etc/iscsi: Makefile Log Message: With MKISCSI we need all files. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/etc/iscsi/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/iscsi/Makefile diff -u src/etc/iscsi/Makefile:1.6 src/etc/iscsi/Makefile:1.7 --- src/etc/iscsi/Makefile:1.6 Sun Feb 5 13:39:42 2023 +++ src/etc/iscsi/Makefile Sun Feb 5 21:20:14 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2023/02/05 13:39:42 mlelstv Exp $ +# $NetBSD: Makefile,v 1.7 2023/02/05 21:20:14 mlelstv Exp $ .include @@ -10,7 +10,7 @@ FILESMODE_volumes= 0644 # userland iSCSI initiator and target .if ${MKISCSI} != "no" -CONFIGFILES= auths targets +CONFIGFILES+= auths targets FILESMODE_auths= 0600 FILESMODE_targets= 0644
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Sun Feb 5 13:39:42 UTC 2023 Modified Files: src/etc/iscsi: Makefile Log Message: Fix build without MKISCSI To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/etc/iscsi/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Sun Feb 5 13:39:42 UTC 2023 Modified Files: src/etc/iscsi: Makefile Log Message: Fix build without MKISCSI To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/etc/iscsi/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/iscsi/Makefile diff -u src/etc/iscsi/Makefile:1.5 src/etc/iscsi/Makefile:1.6 --- src/etc/iscsi/Makefile:1.5 Fri Feb 3 15:59:04 2023 +++ src/etc/iscsi/Makefile Sun Feb 5 13:39:42 2023 @@ -1,15 +1,21 @@ -# $NetBSD: Makefile,v 1.5 2023/02/03 15:59:04 mlelstv Exp $ +# $NetBSD: Makefile,v 1.6 2023/02/05 13:39:42 mlelstv Exp $ .include +# kernel iSCSI initiator +CONFIGFILES= volumes +FILESDIR= /etc/iscsi +FILESMODE_volumes= 0644 + +# userland iSCSI initiator and target .if ${MKISCSI} != "no" -CONFIGFILES= auths targets volumes -FILESDIR= /etc/iscsi +CONFIGFILES= auths targets FILESMODE_auths= 0600 FILESMODE_targets= 0644 .endif + .include .include
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Fri Feb 3 20:16:03 UTC 2023 Added Files: src/etc/iscsi: volumes Log Message: Add missing template file for iscsid_volumes. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/etc/iscsi/volumes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Fri Feb 3 20:16:03 UTC 2023 Added Files: src/etc/iscsi: volumes Log Message: Add missing template file for iscsid_volumes. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/etc/iscsi/volumes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/etc/iscsi/volumes diff -u /dev/null src/etc/iscsi/volumes:1.1 --- /dev/null Fri Feb 3 20:16:03 2023 +++ src/etc/iscsi/volumes Fri Feb 3 20:16:03 2023 @@ -0,0 +1,17 @@ +# $NetBSD: volumes,v 1.1 2023/02/03 20:16:03 mlelstv Exp $ +# +# Each line has 5 or 6 fields separated by white space +# Comment lines start with # +# +# Host - the iSCSI server name, optionally followed by :port number +# Target - the iSCSI IQN target name +# Digest - '-' (none), 'd' (data CRC), 'h' (header CRC), 'dh' (both) +# Auth - '-' (none), 'c' (CHAP), 'C' (mutual CHAP) +# User - name of user from /etc/iscsi/auths +# Alias - optional, another name for the target +# +# for mutual CHAP, the target name is used to lookup the secret from +# /etc/iscsi/auths +# +# +# Host Target Digest Auth User Alias
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Fri Feb 3 15:59:04 UTC 2023 Modified Files: src/etc/iscsi: Makefile Log Message: missed commit for iscsid_volumes To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/etc/iscsi/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/iscsi/Makefile diff -u src/etc/iscsi/Makefile:1.4 src/etc/iscsi/Makefile:1.5 --- src/etc/iscsi/Makefile:1.4 Tue Aug 30 13:40:37 2022 +++ src/etc/iscsi/Makefile Fri Feb 3 15:59:04 2023 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.4 2022/08/30 13:40:37 riastradh Exp $ +# $NetBSD: Makefile,v 1.5 2023/02/03 15:59:04 mlelstv Exp $ .include .if ${MKISCSI} != "no" -CONFIGFILES= auths targets +CONFIGFILES= auths targets volumes FILESDIR= /etc/iscsi FILESMODE_auths= 0600 FILESMODE_targets= 0644
CVS commit: src/etc/iscsi
Module Name:src Committed By: mlelstv Date: Fri Feb 3 15:59:04 UTC 2023 Modified Files: src/etc/iscsi: Makefile Log Message: missed commit for iscsid_volumes To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/etc/iscsi/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: mlelstv Date: Fri Feb 3 13:53:40 UTC 2023 Modified Files: src/distrib/sets/lists/etc: mi src/etc/defaults: rc.conf src/etc/rc.d: Makefile Added Files: src/etc/rc.d: iscsid_volumes Log Message: Add start script to attach iscsi volumes at boot. The default is to execute the script (iscsid_volumes=YES), so if you have any volumes defined, you should also start iscsid (iscsid=YES) to avoid error messages. To generate a diff of this commit: cvs rdiff -u -r1.270 -r1.271 src/distrib/sets/lists/etc/mi cvs rdiff -u -r1.162 -r1.163 src/etc/defaults/rc.conf cvs rdiff -u -r1.116 -r1.117 src/etc/rc.d/Makefile cvs rdiff -u -r0 -r1.1 src/etc/rc.d/iscsid_volumes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.