mpu_cmpci.c revision 1.9
11.9Sthorpej/* $NetBSD: mpu_cmpci.c,v 1.9 2005/06/28 00:28:42 thorpej Exp $ */ 21.1Sitohy 31.1Sitohy/* 41.1Sitohy * Copyright (c) 1998 The NetBSD Foundation, Inc. 51.1Sitohy * All rights reserved. 61.1Sitohy * 71.1Sitohy * This code is derived from software contributed to The NetBSD Foundation 81.6Skeihan * by Lennart Augustsson (augustss@NetBSD.org). 91.1Sitohy * 101.1Sitohy * Redistribution and use in source and binary forms, with or without 111.1Sitohy * modification, are permitted provided that the following conditions 121.1Sitohy * are met: 131.1Sitohy * 1. Redistributions of source code must retain the above copyright 141.1Sitohy * notice, this list of conditions and the following disclaimer. 151.1Sitohy * 2. Redistributions in binary form must reproduce the above copyright 161.1Sitohy * notice, this list of conditions and the following disclaimer in the 171.1Sitohy * documentation and/or other materials provided with the distribution. 181.1Sitohy * 3. All advertising materials mentioning features or use of this software 191.1Sitohy * must display the following acknowledgement: 201.1Sitohy * This product includes software developed by the NetBSD 211.1Sitohy * Foundation, Inc. and its contributors. 221.1Sitohy * 4. Neither the name of The NetBSD Foundation nor the names of its 231.1Sitohy * contributors may be used to endorse or promote products derived 241.1Sitohy * from this software without specific prior written permission. 251.1Sitohy * 261.1Sitohy * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.1Sitohy * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.1Sitohy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.1Sitohy * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.1Sitohy * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.1Sitohy * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.1Sitohy * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.1Sitohy * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.1Sitohy * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.1Sitohy * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.1Sitohy * POSSIBILITY OF SUCH DAMAGE. 371.1Sitohy */ 381.2Slukem 391.2Slukem#include <sys/cdefs.h> 401.9Sthorpej__KERNEL_RCSID(0, "$NetBSD: mpu_cmpci.c,v 1.9 2005/06/28 00:28:42 thorpej Exp $"); 411.1Sitohy 421.1Sitohy#include <sys/param.h> 431.1Sitohy#include <sys/systm.h> 441.1Sitohy#include <sys/kernel.h> 451.1Sitohy#include <sys/errno.h> 461.1Sitohy#include <sys/device.h> 471.1Sitohy#include <sys/proc.h> 481.1Sitohy#include <sys/conf.h> 491.1Sitohy#include <sys/audioio.h> 501.1Sitohy#include <sys/midiio.h> 511.1Sitohy 521.1Sitohy#include <machine/bus.h> 531.1Sitohy 541.1Sitohy#include <dev/audio_if.h> 551.1Sitohy#include <dev/midi_if.h> 561.1Sitohy 571.1Sitohy#include <dev/pci/pcivar.h> 581.1Sitohy 591.1Sitohy#include <dev/ic/mpuvar.h> 601.1Sitohy#include <dev/pci/cmpcivar.h> 611.1Sitohy 621.1Sitohystatic int 631.9Sthorpejmpu_cmpci_match(struct device *parent, struct cfdata *match, void *aux) 641.1Sitohy{ 651.1Sitohy struct audio_attach_args *aa = (struct audio_attach_args *)aux; 661.1Sitohy struct cmpci_softc *ysc = (struct cmpci_softc *)parent; 671.1Sitohy struct mpu_softc sc; 681.1Sitohy 691.1Sitohy if (aa->type != AUDIODEV_TYPE_MPU) 701.1Sitohy return (0); 711.1Sitohy memset(&sc, 0, sizeof sc); 721.1Sitohy sc.iot = ysc->sc_iot; 731.1Sitohy sc.ioh = ysc->sc_mpu_ioh; 741.1Sitohy return (mpu_find(&sc)); 751.1Sitohy} 761.1Sitohy 771.1Sitohystatic void 781.9Sthorpejmpu_cmpci_attach(struct device *parent, struct device *self, void *aux) 791.1Sitohy{ 801.1Sitohy struct cmpci_softc *ysc = (struct cmpci_softc *)parent; 811.1Sitohy struct mpu_softc *sc = (struct mpu_softc *)self; 821.1Sitohy 831.7Sxtraeme printf("\n"); 841.7Sxtraeme 851.1Sitohy sc->iot = ysc->sc_iot; 861.1Sitohy sc->ioh = ysc->sc_mpu_ioh; 871.1Sitohy sc->model = "CMPCI MPU-401 MIDI UART"; 881.1Sitohy 891.1Sitohy mpu_attach(sc); 901.1Sitohy} 911.9Sthorpej 921.9SthorpejCFATTACH_DECL(mpu_cmpci, sizeof (struct mpu_softc), 931.9Sthorpej mpu_cmpci_match, mpu_cmpci_attach, NULL, NULL); 94