CVS commit: [netbsd-8] src/sys/dev/isa
Module Name:src Committed By: martin Date: Thu Jun 7 19:39:54 UTC 2018 Modified Files: src/sys/dev/isa [netbsd-8]: isadma.c isadmareg.h isareg.h Log Message: Pull up following revision(s) (requested by jdolecek in ticket #841): sys/dev/isa/isadmareg.h: revision 1.9 sys/dev/isa/isareg.h: revision 1.10 sys/dev/isa/isadma.c: revision 1.67 fix off-by-one in the mapping of the ISA DMA page registers, they actually start at 0x81; the code used bus_space_map() starting from 0x80 but used +1 offset for actual I/O, now it maps starting 0x81 and does I/O without offset the reads and writes work exactly the same as before, but this frees 0x80 for being mapped independantly patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec and also FreeBSD sys/x86/isa/isa_dma.c To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.66.52.1 src/sys/dev/isa/isadma.c cvs rdiff -u -r1.8 -r1.8.80.1 src/sys/dev/isa/isadmareg.h cvs rdiff -u -r1.9 -r1.9.156.1 src/sys/dev/isa/isareg.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/isa/isadma.c diff -u src/sys/dev/isa/isadma.c:1.66 src/sys/dev/isa/isadma.c:1.66.52.1 --- src/sys/dev/isa/isadma.c:1.66 Sat Nov 13 13:52:03 2010 +++ src/sys/dev/isa/isadma.c Thu Jun 7 19:39:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isadma.c,v 1.66 2010/11/13 13:52:03 uebayasi Exp $ */ +/* $NetBSD: isadma.c,v 1.66.52.1 2018/06/07 19:39:54 martin Exp $ */ /*- * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.66 2010/11/13 13:52:03 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1.66.52.1 2018/06/07 19:39:54 martin Exp $"); #include #include @@ -53,15 +53,19 @@ __KERNEL_RCSID(0, "$NetBSD: isadma.c,v 1 struct isa_mem *isa_mem_head; /* - * High byte of DMA address is stored in this DMAPG register for - * the Nth DMA channel. + * DMA Channel to Address Page Register offset mapping + * + * Offset from IO_DMAPG is stored in this 2D array -- first dimension is + * the DMA controller, second dimension is the DMA channel. + * + * e.g. dmapageport[0][1] gives us the offset for DMA ch 1 on DMA1 */ -static int dmapageport[2][4] = { - {0x7, 0x3, 0x1, 0x2}, - {0xf, 0xb, 0x9, 0xa} +static const int dmapageport[2][4] = { + {0x6, 0x2, 0x0, 0x1}, + {0xe, 0xa, 0x8, 0x9} }; -static u_int8_t dmamode[] = { +static const u_int8_t dmamode[] = { /* write to device/read from device */ DMA37MD_READ | DMA37MD_SINGLE, DMA37MD_WRITE | DMA37MD_SINGLE, @@ -169,7 +173,7 @@ _isa_dmainit(struct isa_dma_state *ids, if (bus_space_map(ids->ids_bst, IO_DMA2, DMA2_IOSIZE, 0, >ids_dma2h)) panic("_isa_dmainit: unable to map DMA controller #2"); - if (bus_space_map(ids->ids_bst, IO_DMAPG, 0xf, 0, + if (bus_space_map(ids->ids_bst, IO_DMAPG, DMAPG_IOSIZE, 0, >ids_dmapgh)) panic("_isa_dmainit: unable to map DMA page registers"); @@ -211,7 +215,7 @@ _isa_dmadestroy(struct isa_dma_state *id /* * Unmap the registers used by the ISA DMA controller. */ - bus_space_unmap(ids->ids_bst, ids->ids_dmapgh, 0xf); + bus_space_unmap(ids->ids_bst, ids->ids_dmapgh, DMAPG_IOSIZE); bus_space_unmap(ids->ids_bst, ids->ids_dma2h, DMA2_IOSIZE); bus_space_unmap(ids->ids_bst, ids->ids_dma1h, DMA1_IOSIZE); Index: src/sys/dev/isa/isadmareg.h diff -u src/sys/dev/isa/isadmareg.h:1.8 src/sys/dev/isa/isadmareg.h:1.8.80.1 --- src/sys/dev/isa/isadmareg.h:1.8 Mon Apr 28 20:23:52 2008 +++ src/sys/dev/isa/isadmareg.h Thu Jun 7 19:39:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isadmareg.h,v 1.8 2008/04/28 20:23:52 martin Exp $ */ +/* $NetBSD: isadmareg.h,v 1.8.80.1 2018/06/07 19:39:54 martin Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -47,6 +47,9 @@ #define ISA_DMA_MAXSIZE_DEFAULT(chan) \ (((chan) & 4) ? ISA_DMA_MAXSIZE_16BIT : ISA_DMA_MAXSIZE_8BIT) +/* DMA Page Address Registers size */ +#define DMAPG_IOSIZE (1*15) + /* * Register definitions for DMA controller 1 (channels 0..3): */ Index: src/sys/dev/isa/isareg.h diff -u src/sys/dev/isa/isareg.h:1.9 src/sys/dev/isa/isareg.h:1.9.156.1 --- src/sys/dev/isa/isareg.h:1.9 Sun Dec 11 12:22:02 2005 +++ src/sys/dev/isa/isareg.h Thu Jun 7 19:39:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isareg.h,v 1.9 2005/12/11 12:22:02 christos Exp $ */ +/* $NetBSD: isareg.h,v 1.9.156.1 2018/06/07 19:39:54 martin Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -55,7 +55,7 @@ #define IO_PPI 0x061 /* Programmable Peripheral Interface */ #define IO_RTC 0x070 /* RTC */ #define IO_NMI IO_RTC /* NMI Control */ -#define IO_DMAPG 0x080 /* DMA Page Registers */ +#define IO_DMAPG 0x081 /* DMA Page Registers */ #define IO_ICU2 0x0A0 /* 8259A Interrupt Controller #2 */ #define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */ #define IO_NPX 0x0F0 /*
CVS commit: [netbsd-8] src/sys/dev/isa
Module Name:src Committed By: martin Date: Sat May 5 15:08:15 UTC 2018 Modified Files: src/sys/dev/isa [netbsd-8]: wbsio.c Log Message: Pull up following revision(s) (requested by yamaguchi in ticket #789): sys/dev/isa/wbsio.c: revision 1.24 Use spin mutex to fix a panic The GPIO part of wbsio(4) has a lock to keep the register access order. In addition to the lock, gpio(4) has a look to prevent multiple control through gpio_pin_ctl(). Those locks hold at once when gpio_pin_ctl() is called, and the lock of gpio(4) hold before that of wbsio(4). Therefore, the wbsio(4) has to use spin lock if gpio(4) uses spin lock. To generate a diff of this commit: cvs rdiff -u -r1.10.10.3 -r1.10.10.4 src/sys/dev/isa/wbsio.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/isa/wbsio.c diff -u src/sys/dev/isa/wbsio.c:1.10.10.3 src/sys/dev/isa/wbsio.c:1.10.10.4 --- src/sys/dev/isa/wbsio.c:1.10.10.3 Mon Apr 16 14:28:23 2018 +++ src/sys/dev/isa/wbsio.c Sat May 5 15:08:14 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wbsio.c,v 1.10.10.3 2018/04/16 14:28:23 martin Exp $ */ +/* $NetBSD: wbsio.c,v 1.10.10.4 2018/05/05 15:08:14 martin Exp $ */ /* $OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $ */ /* * Copyright (c) 2008 Mark Kettenis@@ -546,7 +546,7 @@ wbsio_gpio_rt_init(struct wbsio_softc *s aprint_normal_dev(sc->sc_dev, "GPIO: port 0x%x-0x%x\n", iobase, iobase + WBSIO_GPIO_IOSIZE); - mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(>sc_gpio_lock, MUTEX_DEFAULT, IPL_VM); return 0; }
CVS commit: [netbsd-8] src/sys/dev/isa
Module Name:src Committed By: martin Date: Mon Apr 16 14:28:24 UTC 2018 Modified Files: src/sys/dev/isa [netbsd-8]: wbsio.c Log Message: Pull up following revision(s) (requested by yamaguchi in ticket #765): sys/dev/isa/wbsio.c: revision 1.22 Handle watchdog attachment in the wbsio_rescan() function, where we take care of other children. ok knakahara@ and yamaguchi@ To generate a diff of this commit: cvs rdiff -u -r1.10.10.2 -r1.10.10.3 src/sys/dev/isa/wbsio.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/isa/wbsio.c diff -u src/sys/dev/isa/wbsio.c:1.10.10.2 src/sys/dev/isa/wbsio.c:1.10.10.3 --- src/sys/dev/isa/wbsio.c:1.10.10.2 Mon Feb 19 18:50:35 2018 +++ src/sys/dev/isa/wbsio.c Mon Apr 16 14:28:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wbsio.c,v 1.10.10.2 2018/02/19 18:50:35 snj Exp $ */ +/* $NetBSD: wbsio.c,v 1.10.10.3 2018/04/16 14:28:23 martin Exp $ */ /* $OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $ */ /* * Copyright (c) 2008 Mark Kettenis@@ -284,8 +284,7 @@ wbsio_attach(device_t parent, device_t s if (!pmf_device_register(self, wbsio_suspend, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); - wbsio_wdog_attach(self); - + sc->sc_smw_valid = false; wbsio_rescan(self, "wbsio", NULL); #if NGPIO > 0 @@ -336,6 +335,8 @@ wbsio_rescan(device_t self, const char * #endif config_search_loc(wbsio_search, self, ifattr, locators, NULL); + wbsio_wdog_attach(self); + return 0; } @@ -799,7 +800,8 @@ wbsio_wdog_attach(device_t self) uint16_t devid; uint8_t rev; - sc->sc_smw_valid = false; + if (sc->sc_smw_valid) + return; /* watchdog already attached */ wbsio_conf_enable(>sc_conf_lock, sc->sc_iot, sc->sc_ioh); devid = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_ID);
CVS commit: [netbsd-8] src/sys/dev/isa
Module Name:src Committed By: martin Date: Mon Apr 16 14:16:53 UTC 2018 Modified Files: src/sys/dev/isa [netbsd-8]: sbdsp.c Log Message: Pull up following revision(s) (requested by nat in ticket #761): sys/dev/isa/sbdsp.c: revision 1.137 Add AUDIO_ENCODING_SLINEAR to supported encodings. This allows sb, sbpro & sb16 to configure with 8-bit precision. Tested in games/mame with a 486DX emulation. To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.136.10.1 src/sys/dev/isa/sbdsp.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/isa/sbdsp.c diff -u src/sys/dev/isa/sbdsp.c:1.136 src/sys/dev/isa/sbdsp.c:1.136.10.1 --- src/sys/dev/isa/sbdsp.c:1.136 Mon Jul 11 11:31:50 2016 +++ src/sys/dev/isa/sbdsp.c Mon Apr 16 14:16:53 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sbdsp.c,v 1.136 2016/07/11 11:31:50 msaitoh Exp $ */ +/* $NetBSD: sbdsp.c,v 1.136.10.1 2018/04/16 14:16:53 martin Exp $ */ /*- * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.136 2016/07/11 11:31:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.136.10.1 2018/04/16 14:16:53 martin Exp $"); #include "midi.h" #include "mpu.h" @@ -640,6 +640,7 @@ sbdsp_set_params( swcode = swap_bytes; } /* fall into */ + case AUDIO_ENCODING_SLINEAR: case AUDIO_ENCODING_SLINEAR_LE: bmode = SB_BMODE_SIGNED; break; @@ -682,6 +683,7 @@ sbdsp_set_params( bmode |= SB_BMODE_STEREO; } else if (m->model == SB_JAZZ && m->precision == 16) { switch (p->encoding) { + case AUDIO_ENCODING_SLINEAR: case AUDIO_ENCODING_SLINEAR_LE: break; case AUDIO_ENCODING_ULINEAR_LE: @@ -716,6 +718,7 @@ sbdsp_set_params( switch (p->encoding) { case AUDIO_ENCODING_SLINEAR_BE: case AUDIO_ENCODING_SLINEAR_LE: + case AUDIO_ENCODING_SLINEAR: hw.encoding = AUDIO_ENCODING_ULINEAR_LE; swcode = change_sign8; break;
CVS commit: [netbsd-8] src/sys/dev/isa
Module Name:src Committed By: martin Date: Mon Apr 16 14:15:03 UTC 2018 Modified Files: src/sys/dev/isa [netbsd-8]: gus.c Log Message: Pull up following revision(s) (requested by nat in ticket #760): sys/dev/isa/gus.c: revision 1.112 Add padding to gus.c so fields match up when it ts cast to a ad1848_isa softc for the allocation of hw ring buffers. Locking fixes as gus KASSERTS / uses the codec locks. Ok christos@. To generate a diff of this commit: cvs rdiff -u -r1.111 -r1.111.6.1 src/sys/dev/isa/gus.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/isa/gus.c diff -u src/sys/dev/isa/gus.c:1.111 src/sys/dev/isa/gus.c:1.111.6.1 --- src/sys/dev/isa/gus.c:1.111 Wed Feb 1 19:10:33 2017 +++ src/sys/dev/isa/gus.c Mon Apr 16 14:15:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $ */ +/* $NetBSD: gus.c,v 1.111.6.1 2018/04/16 14:15:03 martin Exp $ */ /*- * Copyright (c) 1996, 1999, 2008 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.111 2017/02/01 19:10:33 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.111.6.1 2018/04/16 14:15:03 martin Exp $"); #include #include @@ -175,15 +175,16 @@ struct gus_softc { kmutex_t sc_intr_lock; void *sc_ih; /* interrupt vector */ bus_space_tag_t sc_iot; /* tag */ - isa_chipset_tag_t sc_ic; /* ISA chipset info */ bus_space_handle_t sc_ioh1; /* handle */ bus_space_handle_t sc_ioh2; /* handle */ bus_space_handle_t sc_ioh3; /* ICS2101 handle */ bus_space_handle_t sc_ioh4; /* MIDI handle */ + char padding[20]; callout_t sc_dmaout_ch; - int sc_iobase; /* I/O base address */ + isa_chipset_tag_t sc_ic; /* ISA chipset info */ + char padding1[4]; int sc_irq; /* IRQ used */ int sc_playdrq; /* DMA channel for play */ bus_size_t sc_play_maxsize; /* DMA size for play */ @@ -257,6 +258,7 @@ struct gus_softc { struct ics2101_softc sc_mixer_u; struct ad1848_isa_softc sc_codec_u; } u; + int sc_iobase; /* I/O base address */ #define sc_mixer u.sc_mixer_u #define sc_codec u.sc_codec_u }; @@ -818,9 +820,12 @@ gusattach(device_t parent, device_t self const struct audio_hw_if *hwif; sc = device_private(self); + sc->sc_dev = self; ia = aux; callout_init(>sc_dmaout_ch, CALLOUT_MPSAFE); ad1848_init_locks(>sc_codec.sc_ad1848, IPL_AUDIO); + sc->sc_lock = sc->sc_codec.sc_ad1848.sc_lock; + sc->sc_intr_lock = sc->sc_codec.sc_ad1848.sc_intr_lock; sc->sc_iot = iot = ia->ia_iot; sc->sc_ic = ia->ia_ic; @@ -859,7 +864,7 @@ gusattach(device_t parent, device_t self delay(500); - mutex_spin_enter(>sc_intr_lock); + mutex_spin_enter(>sc_codec.sc_ad1848.sc_intr_lock); c = bus_space_read_1(iot, ioh3, GUS_BOARD_REV); if (c != 0xff) @@ -872,7 +877,7 @@ gusattach(device_t parent, device_t self gusreset(sc, GUS_MAX_VOICES); /* initialize all voices */ gusreset(sc, GUS_MIN_VOICES); /* then set to just the ones we use */ - mutex_spin_exit(>sc_intr_lock); + mutex_spin_exit(>sc_codec.sc_ad1848.sc_intr_lock); /* * Setup the IRQ and DRQ lines in software, using values from @@ -2311,7 +2316,7 @@ gus_set_params(void *addr,int setmode, i return EINVAL; } - mutex_spin_enter(>sc_intr_lock); + mutex_spin_enter(>sc_codec.sc_ad1848.sc_intr_lock); if (p->precision == 8) { sc->sc_voc[GUS_VOICE_LEFT].voccntl &= ~GUSMASK_DATA_SIZE16; @@ -2332,7 +2337,7 @@ gus_set_params(void *addr,int setmode, i if (setmode & AUMODE_PLAY) sc->sc_orate = p->sample_rate; - mutex_spin_exit(>sc_intr_lock); + mutex_spin_exit(>sc_codec.sc_ad1848.sc_intr_lock); hw = *p; /* clear req_size before setting a filter to avoid confliction
CVS commit: [netbsd-8] src/sys/dev/isa
Module Name:src Committed By: martin Date: Thu Nov 23 11:39:42 UTC 2017 Modified Files: src/sys/dev/isa [netbsd-8]: itesio_isa.c itesio_isavar.h Log Message: Pull up following revision(s) (requested by msaitoh in ticket #373): sys/dev/isa/itesio_isavar.h: revision 1.10 sys/dev/isa/itesio_isavar.h: revision 1.11 sys/dev/isa/itesio_isa.c: revision 1.26 sys/dev/isa/itesio_isa.c: revision 1.27 Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board. XXX These IT suoer IO chips appear to be all fairly alike. Maybe add a comprehensive list of IDs to recognize them, then deal with the fallout? Add IT8728F and IT877[12]E. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.25.10.1 src/sys/dev/isa/itesio_isa.c cvs rdiff -u -r1.9 -r1.9.30.1 src/sys/dev/isa/itesio_isavar.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/isa/itesio_isa.c diff -u src/sys/dev/isa/itesio_isa.c:1.25 src/sys/dev/isa/itesio_isa.c:1.25.10.1 --- src/sys/dev/isa/itesio_isa.c:1.25 Thu Apr 23 23:23:00 2015 +++ src/sys/dev/isa/itesio_isa.c Thu Nov 23 11:39:42 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: itesio_isa.c,v 1.25 2015/04/23 23:23:00 pgoyette Exp $ */ +/* $NetBSD: itesio_isa.c,v 1.25.10.1 2017/11/23 11:39:42 martin Exp $ */ /* Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $ */ /* @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.25 2015/04/23 23:23:00 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.25.10.1 2017/11/23 11:39:42 martin Exp $"); #include #include @@ -136,6 +136,7 @@ itesio_isa_match(device_t parent, cfdata bus_space_unmap(ia->ia_iot, ioh, 2); switch (cr) { + case ITESIO_ID8628: case ITESIO_ID8705: case ITESIO_ID8712: case ITESIO_ID8716: @@ -143,6 +144,9 @@ itesio_isa_match(device_t parent, cfdata case ITESIO_ID8720: case ITESIO_ID8721: case ITESIO_ID8726: + case ITESIO_ID8728: + case ITESIO_ID8771: + case ITESIO_ID8772: ia->ia_nio = 1; ia->ia_io[0].ir_size = 2; ia->ia_niomem = 0; Index: src/sys/dev/isa/itesio_isavar.h diff -u src/sys/dev/isa/itesio_isavar.h:1.9 src/sys/dev/isa/itesio_isavar.h:1.9.30.1 --- src/sys/dev/isa/itesio_isavar.h:1.9 Thu Nov 15 04:45:01 2012 +++ src/sys/dev/isa/itesio_isavar.h Thu Nov 23 11:39:42 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: itesio_isavar.h,v 1.9 2012/11/15 04:45:01 msaitoh Exp $ */ +/* $NetBSD: itesio_isavar.h,v 1.9.30.1 2017/11/23 11:39:42 martin Exp $ */ /* $OpenBSD: itvar.h,v 1.2 2003/11/05 20:57:10 grange Exp $ */ /* @@ -57,6 +57,7 @@ #define ITESIO_CHIPID2 0x21 /* Chip ID 2 */ #define ITESIO_DEVREV 0x22 /* Device Revision */ +#define ITESIO_ID8628 0x8628 #define ITESIO_ID8705 0x8705 #define ITESIO_ID8712 0x8712 #define ITESIO_ID8716 0x8716 @@ -64,6 +65,9 @@ #define ITESIO_ID8720 0x8720 #define ITESIO_ID8721 0x8721 #define ITESIO_ID8726 0x8726 +#define ITESIO_ID8728 0x8728 +#define ITESIO_ID8771 0x8771 +#define ITESIO_ID8772 0x8772 /* * Control registers for the Environmental Controller, relative