diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hp300/conf/GENERIC | 6 | ||||
-rw-r--r-- | sys/arch/hp300/conf/files.hp300 | 6 | ||||
-rw-r--r-- | sys/arch/hp300/dev/arcofi_dio.c | 105 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/conf.c | 5 | ||||
-rw-r--r-- | sys/arch/hppa/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/hppa/conf/files.hppa | 7 | ||||
-rw-r--r-- | sys/arch/hppa/gsc/arcofi_gsc.c | 87 |
7 files changed, 211 insertions, 9 deletions
diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC index a9ab106a3ab..2457542053a 100644 --- a/sys/arch/hp300/conf/GENERIC +++ b/sys/arch/hp300/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.54 2011/08/18 20:03:38 miod Exp $ +# $OpenBSD: GENERIC,v 1.55 2011/12/21 23:12:03 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -133,6 +133,10 @@ safte* at scsibus? # SCSI AF-TE ses* at scsibus? # SCSI enclosure services uk* at scsibus? # unknown SCSI devices +# 425e digital audio +arcofi* at dio? +audio* at arcofi? + # ISA devices #isa* at isabr? diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300 index de89cc0fec4..be350469270 100644 --- a/sys/arch/hp300/conf/files.hp300 +++ b/sys/arch/hp300/conf/files.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: files.hp300,v 1.34 2011/08/18 20:02:57 miod Exp $ +# $OpenBSD: files.hp300,v 1.35 2011/12/21 23:12:03 miod Exp $ # $NetBSD: files.hp300,v 1.28 1997/05/12 08:23:28 thorpej Exp $ # # hp300-specific configuration info @@ -125,6 +125,10 @@ file arch/hp300/dev/dcm.c dcm needs-flag attach le at dio file arch/hp300/dev/if_le.c le +# 425e digital audio +attach arcofi at dio with arcofi_dio +file arch/hp300/dev/arcofi_dio.c arcofi_dio + # HP-IB interfaces define hpibdev {} diff --git a/sys/arch/hp300/dev/arcofi_dio.c b/sys/arch/hp300/dev/arcofi_dio.c new file mode 100644 index 00000000000..56b07af0137 --- /dev/null +++ b/sys/arch/hp300/dev/arcofi_dio.c @@ -0,0 +1,105 @@ +/* $OpenBSD: arcofi_dio.c,v 1.1 2011/12/21 23:12:03 miod Exp $ */ + +/* + * Copyright (c) 2011 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/device.h> + +#include <machine/autoconf.h> +#include <machine/bus.h> +#include <machine/intr.h> + +#include <sys/audioio.h> +#include <dev/audio_if.h> +#include <dev/ic/arcofivar.h> + +#include <hp300/dev/dioreg.h> +#include <hp300/dev/diovar.h> + +#include <hp300/dev/diodevs.h> + +void arcofi_dio_attach(struct device *, struct device *, void *); +int arcofi_dio_match(struct device *, void *, void *); + +struct arcofi_dio_softc { + struct arcofi_softc sc_arcofi; + + struct isr sc_isr; +}; + +const struct cfattach arcofi_dio_ca = { + sizeof(struct arcofi_dio_softc), + arcofi_dio_match, + arcofi_dio_attach +}; + +extern struct hp300_bus_space_tag hp300_mem_tag; /* XXX */ + +int +arcofi_dio_match(struct device *parent, void *match, void *vaa) +{ + struct dio_attach_args *da = vaa; + + if (da->da_id != DIO_DEVICE_ID_AUDIO) + return 0; + + return 1; +} + +void +arcofi_dio_attach(struct device *parent, struct device *self, void *vaa) +{ + struct arcofi_dio_softc *adsc = (struct arcofi_dio_softc *)self; + struct arcofi_softc *sc = &adsc->sc_arcofi; + struct dio_attach_args *da = vaa; + bus_addr_t base; + unsigned int u; + int ipl; + + for (u = 0; u < ARCOFI_NREGS; u++) + sc->sc_reg[u] = (u << 1) | 0x01; + + base = (bus_addr_t)dio_scodetopa(da->da_scode); + sc->sc_iot = &hp300_mem_tag; + /* + * XXX We request BUS_SPACE_MAP_LINEAR only to be able to use DIO_IPL + * XXX below; this ought to be provided in the attach_args + */ + if (bus_space_map(sc->sc_iot, base, DIOII_SIZEOFF, BUS_SPACE_MAP_LINEAR, + &sc->sc_ioh) != 0) { + printf(": can't map registers\n"); + return; + } + ipl = DIO_IPL(bus_space_vaddr(sc->sc_iot, sc->sc_ioh)); + + sc->sc_sih = softintr_establish(IPL_SOFT, &arcofi_swintr, sc); + if (sc->sc_sih == NULL) { + printf(": can't register soft interrupt\n"); + return; + } + adsc->sc_isr.isr_func = arcofi_hwintr; + adsc->sc_isr.isr_arg = sc; + adsc->sc_isr.isr_ipl = ipl; + adsc->sc_isr.isr_priority = IPL_AUDIO; + dio_intr_establish(&adsc->sc_isr, self->dv_xname); + + printf(" ipl %d\n", ipl); + + arcofi_attach(sc, "dio"); +} diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c index 396fe62449a..bcac959c17c 100644 --- a/sys/arch/hp300/hp300/conf.c +++ b/sys/arch/hp300/hp300/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.52 2011/10/06 20:49:27 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.53 2011/12/21 23:12:03 miod Exp $ */ /* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej Exp $ */ /*- @@ -81,6 +81,7 @@ int nblkdev = nitems(bdevsw); dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \ 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev } +#include "audio.h" #include "bio.h" #define mmread mmrw #define mmwrite mmrw @@ -161,7 +162,7 @@ struct cdevsw cdevsw[] = cdev_mouse_init(NWSKBD,wskbd), /* 41: keyboards */ cdev_mouse_init(NWSMOUSE,wsmouse), /* 42: mice */ cdev_mouse_init(NWSMUX,wsmux), /* 43: ws multiplexor */ - cdev_notdef(), /* 44 */ + cdev_audio_init(NAUDIO,audio), /* 44: audio */ cdev_notdef(), /* 45 */ cdev_notdef(), /* 46 */ cdev_notdef(), /* 47 */ diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC index bbca786f7df..12279cb93bb 100644 --- a/sys/arch/hppa/conf/GENERIC +++ b/sys/arch/hppa/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.145 2011/07/07 23:41:09 tedu Exp $ +# $OpenBSD: GENERIC,v 1.146 2011/12/21 23:12:03 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -234,6 +234,8 @@ ie0 at gsc0 irq 8 # 82C596DX/CA ether osiop* at gsc? irq 9 # NCR 53C710 (Narrow SE) #osiop* at eisa? oosiop* at gsc? irq 9 # NCR 53C700 (Narrow SE) +arcofi* at gsc? disable irq 18 # Audio Type 1 (PSB2160) +audio* at arcofi? harmony* at gsc? irq 13 # Audio Type 2 (CS4215/AD1849) audio* at harmony? gsckbc* at gsc? irq 26 diff --git a/sys/arch/hppa/conf/files.hppa b/sys/arch/hppa/conf/files.hppa index 821c30707ef..fd6ae5237a5 100644 --- a/sys/arch/hppa/conf/files.hppa +++ b/sys/arch/hppa/conf/files.hppa @@ -1,4 +1,4 @@ -# $OpenBSD: files.hppa,v 1.89 2011/10/06 20:49:28 deraadt Exp $ +# $OpenBSD: files.hppa,v 1.90 2011/12/21 23:12:03 miod Exp $ # # hppa-specific configuration info @@ -254,9 +254,8 @@ attach hil at gsc with hil_gsc file arch/hppa/gsc/hil_gsc.c hil_gsc # PSB 2160-N based 8bit mono audio (705, 710, 745i/*, 747i/*) -device aone: audio, mulaw, auconv -attach aone at gsc -file arch/hppa/gsc/aone.c aone +attach arcofi at gsc with arcofi_gsc +file arch/hppa/gsc/arcofi_gsc.c arcofi_gsc # CS4215/AD1849 based 16bit mono/stereo audio iface (most of others not w/ aone) # a.k.a. Audio Type 2 (optional beeper) diff --git a/sys/arch/hppa/gsc/arcofi_gsc.c b/sys/arch/hppa/gsc/arcofi_gsc.c new file mode 100644 index 00000000000..c9c0bea233c --- /dev/null +++ b/sys/arch/hppa/gsc/arcofi_gsc.c @@ -0,0 +1,87 @@ +/* $OpenBSD: arcofi_gsc.c,v 1.1 2011/12/21 23:12:03 miod Exp $ */ + +/* + * Copyright (c) 2011 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> + +#include <machine/autoconf.h> +#include <machine/bus.h> +#include <machine/cpu.h> +#include <machine/intr.h> +#include <machine/iomod.h> + +#include <sys/audioio.h> +#include <dev/audio_if.h> +#include <dev/ic/arcofivar.h> + +#include <hppa/dev/cpudevs.h> +#include <hppa/gsc/gscbusvar.h> + +int arcofi_gsc_match(struct device *, void *, void *); +void arcofi_gsc_attach(struct device *, struct device *, void *); + +const struct cfattach arcofi_gsc_ca = { + sizeof(struct arcofi_softc), + arcofi_gsc_match, + arcofi_gsc_attach +}; + +int +arcofi_gsc_match(struct device *parent, void *match, void *vaa) +{ + struct gsc_attach_args *ga = vaa; + + if (ga->ga_type.iodc_type == HPPA_TYPE_FIO && + (ga->ga_type.iodc_sv_model == HPPA_FIO_A1 || + ga->ga_type.iodc_sv_model == HPPA_FIO_A1NB)) + return 1; + + return 0; +} + +void +arcofi_gsc_attach(struct device *parent, struct device *self, void *vaa) +{ + struct arcofi_softc *sc = (struct arcofi_softc *)self; + struct gsc_attach_args *ga = vaa; + unsigned int u; + + for (u = 0; u < ARCOFI_NREGS; u++) + sc->sc_reg[u] = (u << 2) | 0x01; + + sc->sc_iot = ga->ga_iot; + if (bus_space_map(sc->sc_iot, ga->ga_hpa, ARCOFI_NREGS << 2, 0, + &sc->sc_ioh) != 0) { + printf(": can't map registers\n"); + return; + } + + /* XXX no generic IPL_SOFT level available */ + sc->sc_sih = softintr_establish(IPL_SOFTTTY, &arcofi_swintr, sc); + if (sc->sc_sih == NULL) { + printf(": can't register soft interrupt\n"); + return; + } + gsc_intr_establish((struct gsc_softc *)parent, ga->ga_irq, + IPL_AUDIO, arcofi_hwintr, sc, sc->sc_dev.dv_xname); + + printf("\n"); + + arcofi_attach(sc, "gsc"); +} |