pciide_machdep.c revision 1.5.6.1
11.5.6.1Sjruoho/* $NetBSD: pciide_machdep.c,v 1.5.6.1 2011/06/06 09:05:10 jruoho Exp $ */ 21.1Sleo 31.1Sleo/* 41.1Sleo * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved. 51.1Sleo * 61.1Sleo * Redistribution and use in source and binary forms, with or without 71.1Sleo * modification, are permitted provided that the following conditions 81.1Sleo * are met: 91.1Sleo * 1. Redistributions of source code must retain the above copyright 101.1Sleo * notice, this list of conditions and the following disclaimer. 111.1Sleo * 2. Redistributions in binary form must reproduce the above copyright 121.1Sleo * notice, this list of conditions and the following disclaimer in the 131.1Sleo * documentation and/or other materials provided with the distribution. 141.1Sleo * 3. All advertising materials mentioning features or use of this software 151.1Sleo * must display the following acknowledgement: 161.1Sleo * This product includes software developed by Christopher G. Demetriou 171.1Sleo * for the NetBSD Project. 181.1Sleo * 4. The name of the author may not be used to endorse or promote products 191.1Sleo * derived from this software without specific prior written permission 201.1Sleo * 211.1Sleo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 221.1Sleo * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 231.1Sleo * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 241.1Sleo * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 251.1Sleo * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 261.1Sleo * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 271.1Sleo * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 281.1Sleo * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 291.1Sleo * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 301.1Sleo * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 311.1Sleo */ 321.1Sleo 331.1Sleo/* 341.1Sleo * PCI IDE controller driver (i386 machine-dependent portion). 351.1Sleo * 361.1Sleo * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD 371.1Sleo * sys/dev/pci/ppb.c, revision 1.16). 381.1Sleo * 391.1Sleo * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" from the 401.1Sleo * PCI SIG. 411.1Sleo */ 421.2Slukem 431.2Slukem#include <sys/cdefs.h> 441.5.6.1Sjruoho__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.5.6.1 2011/06/06 09:05:10 jruoho Exp $"); 451.1Sleo 461.1Sleo#include <sys/param.h> 471.1Sleo#include <sys/systm.h> 481.1Sleo#include <sys/device.h> 491.1Sleo 501.1Sleo#include <dev/pci/pcireg.h> 511.1Sleo#include <dev/pci/pcivar.h> 521.1Sleo#include <dev/pci/pciidereg.h> 531.1Sleo#include <dev/pci/pciidevar.h> 541.1Sleo 551.1Sleo#include <dev/isa/isavar.h> 561.1Sleo 571.1Sleovoid * 581.5.6.1Sjruohopciide_machdep_compat_intr_establish(struct device *dev, 591.5.6.1Sjruoho const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) 601.1Sleo{ 611.1Sleo int irq; 621.1Sleo void *cookie; 631.1Sleo 641.1Sleo irq = PCIIDE_COMPAT_IRQ(chan); 651.1Sleo cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg); 661.1Sleo if (cookie == NULL) 671.1Sleo return (NULL); 681.1Sleo printf("%s: %s channel interrupting at irq %d\n", dev->dv_xname, 691.1Sleo PCIIDE_CHANNEL_NAME(chan), irq); 701.1Sleo return (cookie); 711.1Sleo} 72