Re: CVS commit: src/sys/dev
Hi isaki@, I'm currently making in kernel mixing optional depending on a sysctl variable to benefit slower/older platforms and as a default if audio auto config fails, it will work as audio did before in kernel mixing. This commit was an intermediate works as I may have to inject audio into the mixring directly and as such it would be more usefull as a virtual channel. If possible I will use the hardware ring directly in this case I will restore the record/play ringbuffers and reduce the memory consumption of this commit. Best regards, Nat On Mon, 25 Sep 2017 22:58:56 Tetsuya Isaki wrote > At Sun, 24 Sep 2017 23:40:41 +, > > > Module Name:src > > Committed By: nat > > Date: Sun Sep 24 23:40:41 UTC 2017 > > > > Modified Files: > > src/sys/dev: audio.c audiovar.h > > > > Log Message: > > Move play/rec mix ring buffers into a virtual channel sc_mixring. NFCI. > > > > > > To generate a diff of this commit: > > cvs rdiff -u -r1.406 -r1.407 src/sys/dev/audio.c > > cvs rdiff -u -r1.64 -r1.65 src/sys/dev/audiovar.h > > Is struct virtual_channel too large (sparse) to only have > two ring buffers? sizeof(struct virtual_channel) is 1244 bytes > and one sizeof(struct audio_ringbuffer) is 92 bytes on recent i386. > And I also think mixring is not (a part of) virtual channel. > > However, I agree the name of sc->sc_pr/sc_rr is not easy to > understand if you are focusing on the name. > > Thanks, > --- > Tetsuya Isaki
CVS commit: src/sys/dev
Module Name:src Committed By: nat Date: Tue Sep 26 04:34:59 UTC 2017 Modified Files: src/sys/dev: audio.c Log Message: Call audio_mix for a third time - thus ensuring there is a block of data in the mix ring before the audio interrupt occurs. This addresses the instability seen in the audio atf tests. To generate a diff of this commit: cvs rdiff -u -r1.407 -r1.408 src/sys/dev/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.c diff -u src/sys/dev/audio.c:1.407 src/sys/dev/audio.c:1.408 --- src/sys/dev/audio.c:1.407 Sun Sep 24 23:40:41 2017 +++ src/sys/dev/audio.c Tue Sep 26 04:34:59 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.407 2017/09/24 23:40:41 nat Exp $ */ +/* $NetBSD: audio.c,v 1.408 2017/09/26 04:34:59 nat Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss@@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.407 2017/09/24 23:40:41 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.408 2017/09/26 04:34:59 nat Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -3466,6 +3466,7 @@ audiostartp(struct audio_softc *sc, stru if (sc->sc_trigger_started == false) { audio_mix(sc); audio_mix(sc); + audio_mix(sc); mutex_enter(sc->sc_intr_lock); error = mix_write(sc); if (error)
CVS commit: src/sys/dev
Module Name:src Committed By: nat Date: Tue Sep 26 04:34:59 UTC 2017 Modified Files: src/sys/dev: audio.c Log Message: Call audio_mix for a third time - thus ensuring there is a block of data in the mix ring before the audio interrupt occurs. This addresses the instability seen in the audio atf tests. To generate a diff of this commit: cvs rdiff -u -r1.407 -r1.408 src/sys/dev/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: christos Date: Mon Sep 25 23:19:31 UTC 2017 Modified Files: src/doc: 3RDPARTY Log Message: belatedly update ACPICA To generate a diff of this commit: cvs rdiff -u -r1.1472 -r1.1473 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: christos Date: Mon Sep 25 23:19:31 UTC 2017 Modified Files: src/doc: 3RDPARTY Log Message: belatedly update ACPICA To generate a diff of this commit: cvs rdiff -u -r1.1472 -r1.1473 src/doc/3RDPARTY Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1472 src/doc/3RDPARTY:1.1473 --- src/doc/3RDPARTY:1.1472 Tue Sep 19 15:20:43 2017 +++ src/doc/3RDPARTY Mon Sep 25 19:19:31 2017 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1472 2017/09/19 19:20:43 roy Exp $ +# $NetBSD: 3RDPARTY,v 1.1473 2017/09/25 23:19:31 christos Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -40,8 +40,8 @@ # Package: acpica -Version: 20170303 -Current Vers: 20170303 +Version: 20170831 +Current Vers: 20170831 Maintainer: Intel Archive Site: http://www.acpica.org/downloads/ Home Page: http://www.acpica.org/
CVS commit: [jdolecek-ncq] src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Mon Sep 25 22:50:20 UTC 2017 Modified Files: src/sys/dev/ic [jdolecek-ncq]: mvsata.c Log Message: move mvsata_quetag_get() to the start routines, so that it always matches the active list of ata queue; important during error recovery, fixes panics when calling in mvsata_edma_handle() ignore events for non-active xfers fix some missing ata_channel_unlock() on error path in mvsata_bio_intr() and mvsata_atapi_intr(), fixes 'locking against myself' with LOCKDEBUG with this, mvsata(4) finally survives full fio run with wdcdebug_wd_cnt == 200 To generate a diff of this commit: cvs rdiff -u -r1.35.6.28 -r1.35.6.29 src/sys/dev/ic/mvsata.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/ic/mvsata.c diff -u src/sys/dev/ic/mvsata.c:1.35.6.28 src/sys/dev/ic/mvsata.c:1.35.6.29 --- src/sys/dev/ic/mvsata.c:1.35.6.28 Fri Sep 22 20:19:08 2017 +++ src/sys/dev/ic/mvsata.c Mon Sep 25 22:50:20 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata.c,v 1.35.6.28 2017/09/22 20:19:08 jdolecek Exp $ */ +/* $NetBSD: mvsata.c,v 1.35.6.29 2017/09/25 22:50:20 jdolecek Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.28 2017/09/22 20:19:08 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.29 2017/09/25 22:50:20 jdolecek Exp $"); #include "opt_mvsata.h" @@ -1086,7 +1086,6 @@ static int mvsata_bio(struct ata_drive_datas *drvp, struct ata_xfer *xfer) { struct ata_channel *chp = drvp->chnl_softc; - struct mvsata_port *mvport = (struct mvsata_port *)chp; struct atac_softc *atac = chp->ch_atac; struct ata_bio *ata_bio = >c_bio; @@ -1095,8 +1094,6 @@ mvsata_bio(struct ata_drive_datas *drvp, ", bcount=%ld\n", device_xname(atac->atac_dev), chp->ch_channel, drvp->drive, ata_bio->blkno, ata_bio->bcount)); - mvsata_quetag_get(mvport, xfer->c_slot); - if (atac->atac_cap & ATAC_CAP_NOIRQ) ata_bio->flags |= ATA_POLL; if (ata_bio->flags & ATA_POLL) @@ -1135,6 +1132,8 @@ mvsata_bio_start(struct ata_channel *chp ata_channel_lock_owned(chp); + mvsata_quetag_get(mvport, xfer->c_slot); + if (xfer->c_flags & C_DMA) if (drvp->n_xfers <= NXFER) drvp->n_xfers++; @@ -1410,8 +1409,10 @@ mvsata_bio_intr(struct ata_channel *chp, if (!(xfer->c_flags & C_DMA) && (wdc_wait_for_unbusy(chp, (irq == 0) ? ATA_DELAY : 0, AT_POLL, ) == WDCWAIT_TOUT)) { - if (irq && (xfer->c_flags & C_TIMEOU) == 0) + if (irq && (xfer->c_flags & C_TIMEOU) == 0) { + ata_channel_unlock(chp); return 0; /* IRQ was not for us */ + } aprint_error_dev(atac->atac_dev, "channel %d: drive %d timeout, c_bcount=%d, c_skip%d\n", chp->ch_channel, xfer->c_drive, xfer->c_bcount, @@ -1570,6 +1571,8 @@ mvsata_bio_ready(struct mvsata_port *mvp flags |= AT_POLL; /* XXX */ + ata_channel_lock_owned(chp); + /* * disable interrupts, all commands here should be quick * enough to be able to poll, and we don't go here that often @@ -1682,8 +1685,6 @@ mvsata_exec_command(struct ata_drive_dat drvp->drive, ata_c->bcount, ata_c->r_lba, ata_c->r_count, ata_c->r_features, ata_c->r_device, ata_c->r_command)); - mvsata_quetag_get(mvport, xfer->c_slot); - if (ata_c->flags & AT_POLL) xfer->c_flags |= C_POLL; if (ata_c->flags & AT_WAIT) @@ -1736,6 +1737,8 @@ mvsata_wdc_cmd_start(struct ata_channel ata_channel_lock_owned(chp); + mvsata_quetag_get(mvport, xfer->c_slot); + /* First, EDMA disable, if enabled this channel. */ KASSERT((chp->ch_flags & ATACH_NCQ) == 0); if (mvport->port_edmamode_curr != nodma) @@ -2050,7 +2053,6 @@ mvsata_atapi_scsipi_request(struct scsip struct atac_softc *atac = >sc_wdcdev.sc_atac; struct ata_channel *chp = atac->atac_channels[chan->chan_channel]; struct ata_xfer *xfer; - struct mvsata_port *mvport = (struct mvsata_port *)chp; int drive, s; switch (req) { @@ -2071,8 +2073,6 @@ mvsata_atapi_scsipi_request(struct scsip return; } - mvsata_quetag_get(mvport, xfer->c_slot); - if (sc_xfer->xs_control & XS_CTL_POLL) xfer->c_flags |= C_POLL; xfer->c_drive = drive; @@ -2122,6 +2122,8 @@ mvsata_atapi_start(struct ata_channel *c ata_channel_lock_owned(chp); + mvsata_quetag_get(mvport, xfer->c_slot); + KASSERT((chp->ch_flags & ATACH_NCQ) == 0); if (mvport->port_edmamode_curr != nodma) mvsata_edma_disable(mvport, 10 /* ms */, wait_flags); @@ -2426,6 +2428,7 @@ again: if (xfer->c_flags & C_DMA) ata_dmaerr(drvp, (xfer->c_flags & C_POLL) ? AT_POLL : 0); + ata_channel_unlock(chp); sc_xfer->error = XS_TIMEOUT; mvsata_atapi_reset(chp, xfer); return 1; @@ -2883,8 +2886,15 @@ mvsata_edma_handle(struct mvsata_port *m mvsata_print_crpb(mvport, erpqop); #endif crpb = mvport->port_crpb + erpqop; +
CVS commit: [jdolecek-ncq] src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Mon Sep 25 22:50:20 UTC 2017 Modified Files: src/sys/dev/ic [jdolecek-ncq]: mvsata.c Log Message: move mvsata_quetag_get() to the start routines, so that it always matches the active list of ata queue; important during error recovery, fixes panics when calling in mvsata_edma_handle() ignore events for non-active xfers fix some missing ata_channel_unlock() on error path in mvsata_bio_intr() and mvsata_atapi_intr(), fixes 'locking against myself' with LOCKDEBUG with this, mvsata(4) finally survives full fio run with wdcdebug_wd_cnt == 200 To generate a diff of this commit: cvs rdiff -u -r1.35.6.28 -r1.35.6.29 src/sys/dev/ic/mvsata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [jdolecek-ncq] src/sys/dev/ata
Module Name:src Committed By: jdolecek Date: Mon Sep 25 22:43:46 UTC 2017 Modified Files: src/sys/dev/ata [jdolecek-ncq]: ata.c Log Message: put recovery command on head of active xfers queue, so that drivers using ata_queue_get_active_xfer() like mvsata(4) will find it and not random other NCQ xfer never return NCQ xfer from ata_queue_get_active_xfer(), if the first xfer is NCQ simply return NULL adjust ata_timo_xfer_check() to not check the expiring flag in C_WAITTIMO branch, if we get there we ought to get the timeout handler aborted To generate a diff of this commit: cvs rdiff -u -r1.132.8.36 -r1.132.8.37 src/sys/dev/ata/ata.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/ata/ata.c diff -u src/sys/dev/ata/ata.c:1.132.8.36 src/sys/dev/ata/ata.c:1.132.8.37 --- src/sys/dev/ata/ata.c:1.132.8.36 Sat Sep 23 14:53:26 2017 +++ src/sys/dev/ata/ata.c Mon Sep 25 22:43:46 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.132.8.36 2017/09/23 14:53:26 jdolecek Exp $ */ +/* $NetBSD: ata.c,v 1.132.8.37 2017/09/25 22:43:46 jdolecek Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.36 2017/09/23 14:53:26 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.37 2017/09/25 22:43:46 jdolecek Exp $"); #include "opt_ata.h" @@ -208,7 +208,8 @@ ata_queue_hwslot_to_xfer(struct ata_chan KASSERTMSG(hwslot < chq->queue_openings, "hwslot %d > openings %d", hwslot, chq->queue_openings); - KASSERT((chq->active_xfers_used & __BIT(hwslot)) != 0); + KASSERTMSG((chq->active_xfers_used & __BIT(hwslot)) != 0, + "hwslot %d not active", hwslot); /* Usually the first entry will be the one */ TAILQ_FOREACH(xfer, >active_xfers, c_activechain) { @@ -228,8 +229,17 @@ ata_queue_hwslot_to_xfer(struct ata_chan static struct ata_xfer * ata_queue_get_active_xfer_locked(struct ata_channel *chp) { + struct ata_xfer *xfer; + KASSERT(mutex_owned(>ch_lock)); - return TAILQ_FIRST(>ch_queue->active_xfers); + xfer = TAILQ_FIRST(>ch_queue->active_xfers); + + if (xfer && ISSET(xfer->c_flags, C_NCQ)) { + /* Spurious call, never return NCQ xfer from this interface */ + xfer = NULL; + } + + return xfer; } /* @@ -1543,7 +1553,16 @@ ata_activate_xfer_locked(struct ata_chan KASSERT((chq->active_xfers_used & __BIT(xfer->c_slot)) == 0); TAILQ_REMOVE(>queue_xfer, xfer, c_xferchain); - TAILQ_INSERT_TAIL(>active_xfers, xfer, c_activechain); + if ((xfer->c_flags & C_RECOVERY) == 0) + TAILQ_INSERT_TAIL(>active_xfers, xfer, c_activechain); + else { + /* + * Must go to head, so that ata_queue_get_active_xfer() + * returns the recovery command, and not some other + * random active transfer. + */ + TAILQ_INSERT_HEAD(>active_xfers, xfer, c_activechain); + } chq->active_xfers_used |= __BIT(xfer->c_slot); chq->queue_active++; } @@ -1632,15 +1651,13 @@ ata_timo_xfer_check(struct ata_xfer *xfe return true; } - /* Handle race vs. callout_stop() in ata_deactivate_xfer() */ - if (!callout_expired(>c_timo_callout)) { - ata_channel_unlock(chp); + /* Race vs. callout_stop() in ata_deactivate_xfer() */ + ata_channel_unlock(chp); - aprint_normal_dev(drvp->drv_softc, - "xfer %d deactivated while invoking timeout\n", - xfer->c_slot); - return true; - } + aprint_normal_dev(drvp->drv_softc, + "xfer %d deactivated while invoking timeout\n", + xfer->c_slot); + return true; } ata_channel_unlock(chp);
CVS commit: [jdolecek-ncq] src/sys/dev/ata
Module Name:src Committed By: jdolecek Date: Mon Sep 25 22:43:46 UTC 2017 Modified Files: src/sys/dev/ata [jdolecek-ncq]: ata.c Log Message: put recovery command on head of active xfers queue, so that drivers using ata_queue_get_active_xfer() like mvsata(4) will find it and not random other NCQ xfer never return NCQ xfer from ata_queue_get_active_xfer(), if the first xfer is NCQ simply return NULL adjust ata_timo_xfer_check() to not check the expiring flag in C_WAITTIMO branch, if we get there we ought to get the timeout handler aborted To generate a diff of this commit: cvs rdiff -u -r1.132.8.36 -r1.132.8.37 src/sys/dev/ata/ata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/lib/libsa
On Mon, Sep 25, 2017 at 08:39:21PM +, Maxime Villard wrote: > Module Name: src > Committed By: maxv > Date: Mon Sep 25 20:39:21 UTC 2017 > > Modified Files: > src/sys/lib/libsa: loadfile_elf32.c > > Log Message: > Clean up and split loadfile, reduces a patch I have. I dislike this splitting. The existing function is already bad because it requires seeking around. Now there are even more places that need to be changed for fixing that. Joerg
CVS commit: src/sys/lib/libsa
Module Name:src Committed By: maxv Date: Mon Sep 25 20:39:21 UTC 2017 Modified Files: src/sys/lib/libsa: loadfile_elf32.c Log Message: Clean up and split loadfile, reduces a patch I have. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/lib/libsa/loadfile_elf32.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/lib/libsa/loadfile_elf32.c diff -u src/sys/lib/libsa/loadfile_elf32.c:1.40 src/sys/lib/libsa/loadfile_elf32.c:1.41 --- src/sys/lib/libsa/loadfile_elf32.c:1.40 Tue Apr 18 07:44:20 2017 +++ src/sys/lib/libsa/loadfile_elf32.c Mon Sep 25 20:39:21 2017 @@ -1,12 +1,12 @@ -/* $NetBSD: loadfile_elf32.c,v 1.40 2017/04/18 07:44:20 uwe Exp $ */ +/* $NetBSD: loadfile_elf32.c,v 1.41 2017/09/25 20:39:21 maxv Exp $ */ /* - * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. + * Copyright (c) 1997, 2008, 2017 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center and by Christos Zoulas. + * NASA Ames Research Center, by Christos Zoulas, and by Maxime Villard. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -259,8 +259,220 @@ externalize_shdr(Elf_Byte bo, Elf_Shdr * #define IS_DATA(p) (p.p_flags & PF_W) #define IS_BSS(p) (p.p_filesz < p.p_memsz) +#ifndef MD_LOADSEG /* Allow processor ABI specific segment loads */ +#define MD_LOADSEG(a) /*CONSTCOND*/0 +#endif + +/* -- */ + /* - * Load the ELF binary into memory. Layout of the memory: + * See comment below. This function is in charge of loading the SECTION HEADERS. + */ +static int +ELFNAMEEND(loadsym)(int fd, Elf_Ehdr *elf, Elf_Addr maxp, Elf_Addr elfp, +u_long *marks, int flags, Elf_Addr *nmaxp) +{ + int boot_load_ctf = 1; + Elf_Shdr *shp; + Elf_Addr shpp; + char *shstr = NULL; + ssize_t nr, sz; + size_t i, j, shstrsz = 0; + u_long offset = marks[MARK_START]; + struct __packed { + Elf_Nhdr nh; + uint8_t name[ELF_NOTE_NETBSD_NAMESZ + 1]; + uint8_t desc[ELF_NOTE_NETBSD_DESCSZ]; + } note; + int first; + + /* some ports dont use the offset */ + (void) + + if (lseek(fd, elf->e_shoff, SEEK_SET) == -1) { + WARN(("lseek section headers")); + return -1; + } + sz = elf->e_shnum * sizeof(Elf_Shdr); + shp = ALLOC(sz); + + nr = read(fd, shp, sz); + if (nr == -1) { + WARN(("read section headers")); + goto out; + } + if (nr != sz) { + errno = EIO; + WARN(("read section headers")); + goto out; + } + + shpp = maxp; + maxp += roundup(sz, ELFROUND); + +#ifndef _STANDALONE + for (i = 0; i < elf->e_shnum; i++) + internalize_shdr(elf->e_ident[EI_DATA], [i]); +#endif + + /* + * First load the section names section. Only useful for CTF. + */ + if (boot_load_ctf && (elf->e_shstrndx != SHN_UNDEF)) { + Elf_Off shstroff = shp[elf->e_shstrndx].sh_offset; + shstrsz = shp[elf->e_shstrndx].sh_size; + if (flags & LOAD_SYM) { + if (lseek(fd, shstroff, SEEK_SET) == -1) { +WARN(("lseek symbols")); +goto out; + } + nr = READ(fd, maxp, shstrsz); + if (nr == -1) { +WARN(("read symbols")); +goto out; + } + if (nr != (ssize_t)shstrsz) { +errno = EIO; +WARN(("read symbols")); +goto out; + } + } + + /* Create a local copy */ + shstr = ALLOC(shstrsz); + if (lseek(fd, shstroff, SEEK_SET) == -1) { + WARN(("lseek symbols")); + goto out; + } + nr = read(fd, shstr, shstrsz); + if (nr == -1) { + WARN(("read symbols")); + goto out; + } + shp[elf->e_shstrndx].sh_offset = maxp - elfp; + maxp += roundup(shstrsz, ELFROUND); + } + + /* + * Now load the symbol sections themselves. Make sure the sections are + * ELFROUND-aligned. Update sh_offset to be relative to elfp. Set it to + * zero when we don't want the sections to be taken care of, the kernel + * will properly skip them. + */ + first = 1; + for (i = 1; i < elf->e_shnum; i++) { + if (i == elf->e_shstrndx) { + /* already loaded this section */ + continue; + } + + switch (shp[i].sh_type) { + case SHT_PROGBITS: + if (boot_load_ctf && shstr) { +/* got a CTF section? */ +if (strncmp([shp[i].sh_name], + ".SUNW_ctf", 10) == 0) { + goto havesym; +} + } + + shp[i].sh_offset = 0; + break; + case SHT_STRTAB: + for (j = 1; j < elf->e_shnum; j++) +if (shp[j].sh_type == SHT_SYMTAB && +shp[j].sh_link == (unsigned int)i) + goto havesym; + /* + * Don't bother with any string table that isn't + * referenced by a symbol table. + */ + shp[i].sh_offset = 0; + break; +havesym: + case SHT_SYMTAB: + if (flags & LOAD_SYM) { +PROGRESS(("%s%ld", first ? " [" : "+", +(u_long)shp[i].sh_size)); +if (lseek(fd,
CVS commit: src/sys/lib/libsa
Module Name:src Committed By: maxv Date: Mon Sep 25 20:39:21 UTC 2017 Modified Files: src/sys/lib/libsa: loadfile_elf32.c Log Message: Clean up and split loadfile, reduces a patch I have. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/lib/libsa/loadfile_elf32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/dev
Hi nat@, At Sun, 24 Sep 2017 23:40:41 +, > Module Name: src > Committed By: nat > Date: Sun Sep 24 23:40:41 UTC 2017 > > Modified Files: > src/sys/dev: audio.c audiovar.h > > Log Message: > Move play/rec mix ring buffers into a virtual channel sc_mixring. NFCI. > > > To generate a diff of this commit: > cvs rdiff -u -r1.406 -r1.407 src/sys/dev/audio.c > cvs rdiff -u -r1.64 -r1.65 src/sys/dev/audiovar.h Is struct virtual_channel too large (sparse) to only have two ring buffers? sizeof(struct virtual_channel) is 1244 bytes and one sizeof(struct audio_ringbuffer) is 92 bytes on recent i386. And I also think mixring is not (a part of) virtual channel. However, I agree the name of sc->sc_pr/sc_rr is not easy to understand if you are focusing on the name. Thanks, --- Tetsuya Isaki
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Mon Sep 25 08:55:27 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra_pcie.c Log Message: Enable pcie on tegra210 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/nvidia/tegra_pcie.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/nvidia/tegra_pcie.c diff -u src/sys/arch/arm/nvidia/tegra_pcie.c:1.19 src/sys/arch/arm/nvidia/tegra_pcie.c:1.20 --- src/sys/arch/arm/nvidia/tegra_pcie.c:1.19 Thu Jul 20 01:45:38 2017 +++ src/sys/arch/arm/nvidia/tegra_pcie.c Mon Sep 25 08:55:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_pcie.c,v 1.19 2017/07/20 01:45:38 jmcneill Exp $ */ +/* $NetBSD: tegra_pcie.c,v 1.20 2017/09/25 08:55:27 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.19 2017/07/20 01:45:38 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.20 2017/09/25 08:55:27 jmcneill Exp $"); #include #include @@ -92,6 +92,7 @@ struct tegra_pcie_softc { static int tegra_pcie_intr(void *); static void tegra_pcie_init(pci_chipset_tag_t, void *); static void tegra_pcie_enable(struct tegra_pcie_softc *); +static void tegra_pcie_enable_clocks(struct tegra_pcie_softc *); static void tegra_pcie_setup(struct tegra_pcie_softc * const); static void tegra_pcie_conf_frag_map(struct tegra_pcie_softc * const, uint, uint); @@ -126,9 +127,7 @@ static int tegra_pcie_match(device_t parent, cfdata_t cf, void *aux) { const char * const compatible[] = { -#if notyet "nvidia,tegra210-pcie", -#endif "nvidia,tegra124-pcie", NULL }; @@ -188,6 +187,8 @@ tegra_pcie_attach(device_t parent, devic aprint_naive("\n"); aprint_normal(": PCIE\n"); + tegra_pcie_enable_clocks(sc); + if (!fdtbus_intr_str(faa->faa_phandle, 0, intrstr, sizeof(intrstr))) { aprint_error_dev(self, "failed to decode interrupt\n"); return; @@ -313,6 +314,30 @@ tegra_pcie_intr(void *priv) } static void +tegra_pcie_enable_clocks(struct tegra_pcie_softc * const sc) +{ + const char *clock_names[] = { "pex", "afi", "pll_e", "cml" }; + const char *reset_names[] = { "pex", "afi", "pcie_x" }; + struct fdtbus_reset *rst; + struct clk *clk; + int n; + + for (n = 0; n < __arraycount(clock_names); n++) { + clk = fdtbus_clock_get(sc->sc_phandle, clock_names[n]); + if (clk == NULL || clk_enable(clk) != 0) + aprint_error_dev(sc->sc_dev, "couldn't enable clock %s\n", + clock_names[n]); + } + + for (n = 0; n < __arraycount(reset_names); n++) { + rst = fdtbus_reset_get(sc->sc_phandle, reset_names[n]); + if (rst == NULL || fdtbus_reset_deassert(rst) != 0) + aprint_error_dev(sc->sc_dev, "couldn't de-assert reset %s\n", + reset_names[n]); + } +} + +static void tegra_pcie_setup(struct tegra_pcie_softc * const sc) { size_t i;
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Mon Sep 25 08:55:27 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra_pcie.c Log Message: Enable pcie on tegra210 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/nvidia/tegra_pcie.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/arm/nvidia
Module Name:src Committed By: jmcneill Date: Mon Sep 25 08:55:07 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra210_car.c tegra210_carreg.h Log Message: Add clocks used by pcie To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra210_car.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/nvidia/tegra210_carreg.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/arch/arm/nvidia/tegra210_car.c diff -u src/sys/arch/arm/nvidia/tegra210_car.c:1.12 src/sys/arch/arm/nvidia/tegra210_car.c:1.13 --- src/sys/arch/arm/nvidia/tegra210_car.c:1.12 Mon Sep 25 00:12:21 2017 +++ src/sys/arch/arm/nvidia/tegra210_car.c Mon Sep 25 08:55:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra210_car.c,v 1.12 2017/09/25 00:12:21 jmcneill Exp $ */ +/* $NetBSD: tegra210_car.c,v 1.13 2017/09/25 08:55:07 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.12 2017/09/25 00:12:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.13 2017/09/25 08:55:07 jmcneill Exp $"); #include #include @@ -436,6 +436,10 @@ static const char *mux_xusb_ss_p[] = { "CLK_M", "PLL_REF", "CLK_32K", "PLL_U_480M", NULL, NULL, NULL, NULL }; +static const char *mux_mselect_p[] = + { "PLL_P", "PLL_C2", "PLL_C", "PLL_C4_OUT2", + "PLL_C4_OUT1", "CLK_S", "CLK_M", "PLL_C4_OUT0" }; + static struct tegra_clk tegra210_car_clocks[] = { CLK_FIXED("CLK_M", TEGRA210_REF_FREQ), @@ -497,6 +501,10 @@ static struct tegra_clk tegra210_car_clo CAR_CLKSRC_XUSB_FS_REG, CAR_CLKSRC_XUSB_FS_SRC, mux_xusb_fs_p), + CLK_MUX("MUX_MSELECT", + CAR_CLKSRC_MSELECT_REG, CAR_CLKSRC_MSELECT_SRC, + mux_mselect_p), + CLK_DIV("DIV_UARTA", "MUX_UARTA", CAR_CLKSRC_UARTA_REG, CAR_CLKSRC_UART_DIV), CLK_DIV("DIV_UARTB", "MUX_UARTB", @@ -543,11 +551,19 @@ static struct tegra_clk tegra210_car_clo CLK_DIV("DIV_PLL_U_OUT2", "PLL_U", CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT2_RATIO), + CLK_DIV("DIV_MSELECT", "MUX_MSELECT", + CAR_CLKSRC_MSELECT_REG, CAR_CLKSRC_MSELECT_DIV), + CLK_GATE("PLL_U_OUT1", "DIV_PLL_U_OUT1", CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT1_CLKEN), CLK_GATE("PLL_U_OUT2", "DIV_PLL_U_OUT2", CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_REG, CAR_PLLU_OUTA_OUT2_CLKEN), + CLK_GATE("CML0", "PLL_E", + CAR_PLLE_AUX_REG, CAR_PLLE_AUX_REG, CAR_PLLE_AUX_CML0_OEN), + CLK_GATE("CML1", "PLL_E", + CAR_PLLE_AUX_REG, CAR_PLLE_AUX_REG, CAR_PLLE_AUX_CML1_OEN), + CLK_GATE_L("UARTA", "DIV_UARTA", CAR_DEV_L_UARTA), CLK_GATE_L("UARTB", "DIV_UARTB", CAR_DEV_L_UARTB), CLK_GATE_H("UARTC", "DIV_UARTC", CAR_DEV_H_UARTC), @@ -571,6 +587,9 @@ static struct tegra_clk tegra210_car_clo CLK_GATE_H("APBDMA", "CLK_M", CAR_DEV_H_APBDMA), CLK_GATE_L("USBD", "PLL_U_480M", CAR_DEV_L_USBD), CLK_GATE_H("USB2", "PLL_U_480M", CAR_DEV_H_USB2), + CLK_GATE_V("MSELECT", "DIV_MSELECT", CAR_DEV_V_MSELECT), + CLK_GATE_U("PCIE", "CLK_M", CAR_DEV_U_PCIE), + CLK_GATE_U("AFI", "MSELECT", CAR_DEV_U_AFI), }; struct tegra210_init_parent { Index: src/sys/arch/arm/nvidia/tegra210_carreg.h diff -u src/sys/arch/arm/nvidia/tegra210_carreg.h:1.7 src/sys/arch/arm/nvidia/tegra210_carreg.h:1.8 --- src/sys/arch/arm/nvidia/tegra210_carreg.h:1.7 Sun Sep 24 20:09:53 2017 +++ src/sys/arch/arm/nvidia/tegra210_carreg.h Mon Sep 25 08:55:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra210_carreg.h,v 1.7 2017/09/24 20:09:53 jmcneill Exp $ */ +/* $NetBSD: tegra210_carreg.h,v 1.8 2017/09/25 08:55:07 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -482,6 +482,10 @@ #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM 0 #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ 8 +#define CAR_CLKSRC_MSELECT_REG 0x3b4 +#define CAR_CLKSRC_MSELECT_SRC __BITS(31,29) +#define CAR_CLKSRC_MSELECT_DIV __BITS(7,0) + #define CAR_CLKSRC_TSENSOR_REG 0x3b8 #define CAR_CLKSRC_TSENSOR_SRC __BITS(31,29) #define CAR_CLKSRC_TSENSOR_SRC_CLK_M 4
CVS commit: src/sys/arch/arm/nvidia
Module Name:src Committed By: jmcneill Date: Mon Sep 25 08:55:07 UTC 2017 Modified Files: src/sys/arch/arm/nvidia: tegra210_car.c tegra210_carreg.h Log Message: Add clocks used by pcie To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra210_car.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/nvidia/tegra210_carreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/cron/dist
Module Name:src Committed By: christos Date: Mon Sep 25 08:30:46 UTC 2017 Modified Files: src/external/bsd/cron/dist: do_command.c Log Message: Factor out the read and write data code from the huge child_process function. When we create a pipe to read data, restore the sigchld signal handler since pclose expects to wait for the child (to avoid spurious error reporting later). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/cron/dist/do_command.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/cron/dist/do_command.c diff -u src/external/bsd/cron/dist/do_command.c:1.9 src/external/bsd/cron/dist/do_command.c:1.10 --- src/external/bsd/cron/dist/do_command.c:1.9 Thu Aug 17 04:53:00 2017 +++ src/external/bsd/cron/dist/do_command.c Mon Sep 25 04:30:46 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: do_command.c,v 1.9 2017/08/17 08:53:00 christos Exp $ */ +/* $NetBSD: do_command.c,v 1.10 2017/09/25 08:30:46 christos Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -25,7 +25,7 @@ #if 0 static char rcsid[] = "Id: do_command.c,v 1.9 2004/01/23 18:56:42 vixie Exp"; #else -__RCSID("$NetBSD: do_command.c,v 1.9 2017/08/17 08:53:00 christos Exp $"); +__RCSID("$NetBSD: do_command.c,v 1.10 2017/09/25 08:30:46 christos Exp $"); #endif #endif @@ -87,6 +87,190 @@ sigchld_handler(int signo) { } } +static void +write_data(char *volatile input_data, int *stdin_pipe, int *stdout_pipe) +{ + FILE *out = fdopen(stdin_pipe[WRITE_PIPE], "w"); + int need_newline = FALSE; + int escaped = FALSE; + int ch; + + Debug(DPROC, ("[%ld] child2 sending data to grandchild\n", + (long)getpid())); + +#ifdef USE_PAM + cron_pam_child_close(); +#else + log_close(); +#endif + + /* close the pipe we don't use, since we inherited it and + * are part of its reference count now. + */ + (void)close(stdout_pipe[READ_PIPE]); + + /* translation: + * \% -> % + * % -> \n + * \x -> \x for all x != % + */ + while ((ch = *input_data++) != '\0') { + if (escaped) { + if (ch != '%') +(void)putc('\\', out); + } else { + if (ch == '%') +ch = '\n'; + } + + if (!(escaped = (ch == '\\'))) { + (void)putc(ch, out); + need_newline = (ch != '\n'); + } + } + if (escaped) + (void)putc('\\', out); + if (need_newline) + (void)putc('\n', out); + + /* close the pipe, causing an EOF condition. fclose causes + * stdin_pipe[WRITE_PIPE] to be closed, too. + */ + (void)fclose(out); + + Debug(DPROC, ("[%ld] child2 done sending to grandchild\n", + (long)getpid())); +} + +static int +read_data(entry *e, const char *mailto, const char *usernm, char **envp, +int *stdout_pipe) +{ + FILE *in = fdopen(stdout_pipe[READ_PIPE], "r"); + FILE *mail = NULL; + int bytes = 1; + int status = 0; + int ch = getc(in); + int retval = 0; + sig_t oldchld = NULL; + + if (ch == EOF) + goto out; + + Debug(DPROC|DEXT, ("[%ld] got data (%x:%c) from grandchild\n", + (long)getpid(), ch, ch)); + + /* get name of recipient. this is MAILTO if set to a + * valid local username; USER otherwise. + */ + if (mailto) { + /* MAILTO was present in the environment + */ + if (!*mailto) { + /* ... but it's empty. set to NULL + */ + mailto = NULL; + } + } else { + /* MAILTO not present, set to USER. + */ + mailto = usernm; + } + + /* + * Unsafe, disable mailing. + */ + if (!safe_p(usernm, mailto)) + mailto = NULL; + + /* if we are supposed to be mailing, MAILTO will + * be non-NULL. only in this case should we set + * up the mail command and subjects and stuff... + */ + + if (mailto) { + char **env; + char mailcmd[MAX_COMMAND]; + char hostname[MAXHOSTNAMELEN + 1]; + + (void)gethostname(hostname, MAXHOSTNAMELEN); + if (strlens(MAILFMT, MAILARG, NULL) + 1 >= sizeof mailcmd) { + log_it(usernm, getpid(), "MAIL", "mailcmd too long"); + retval = ERROR_EXIT; + goto out; + } + (void)snprintf(mailcmd, sizeof(mailcmd), MAILFMT, MAILARG); + oldchld = signal(SIGCHLD, SIG_DFL); + if (!(mail = cron_popen(mailcmd, "w", e->pwd))) { + log_itx(usernm, getpid(), "MAIL", + "cannot run `%s'", mailcmd); + (void) signal(SIGCHLD, oldchld); + retval = ERROR_EXIT; + goto out; + } + log_itx(usernm, getpid(), "MAIL", "opened pipe `%s'", mailcmd); + (void)fprintf(mail, "From: root (Cron Daemon)\n"); + (void)fprintf(mail, "To: %s\n", mailto); + (void)fprintf(mail, "Subject: Cron <%s@%s> %s\n", + usernm, hostname, e->cmd); + (void)fprintf(mail, "Auto-Submitted: auto-generated\n"); +#ifdef MAIL_DATE + (void)fprintf(mail, "Date: %s\n", arpadate()); +#endif /*MAIL_DATE*/ + for (env = envp; *env; env++) + (void)fprintf(mail, "X-Cron-Env: <%s>\n", *env); + (void)fprintf(mail, "\n"); + + /* this was the first char from the pipe + */ + (void)putc(ch, mail); + } + + /* we have to read the input pipe no matter whether + * we mail or not, but
CVS commit: src/external/bsd/cron/dist
Module Name:src Committed By: christos Date: Mon Sep 25 08:30:46 UTC 2017 Modified Files: src/external/bsd/cron/dist: do_command.c Log Message: Factor out the read and write data code from the huge child_process function. When we create a pipe to read data, restore the sigchld signal handler since pclose expects to wait for the child (to avoid spurious error reporting later). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/cron/dist/do_command.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.