pci_machdep.h revision 1.6
11.6Smatt/* $NetBSD: pci_machdep.h,v 1.6 2001/08/26 02:47:34 matt Exp $ */ 21.1Snonaka 31.1Snonaka/* 41.1Snonaka * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 51.1Snonaka * Copyright (c) 1994 Charles M. Hannum. All rights reserved. 61.1Snonaka * 71.1Snonaka * Redistribution and use in source and binary forms, with or without 81.1Snonaka * modification, are permitted provided that the following conditions 91.1Snonaka * are met: 101.1Snonaka * 1. Redistributions of source code must retain the above copyright 111.1Snonaka * notice, this list of conditions and the following disclaimer. 121.1Snonaka * 2. Redistributions in binary form must reproduce the above copyright 131.1Snonaka * notice, this list of conditions and the following disclaimer in the 141.1Snonaka * documentation and/or other materials provided with the distribution. 151.1Snonaka * 3. All advertising materials mentioning features or use of this software 161.1Snonaka * must display the following acknowledgement: 171.1Snonaka * This product includes software developed by Charles M. Hannum. 181.1Snonaka * 4. The name of the author may not be used to endorse or promote products 191.1Snonaka * derived from this software without specific prior written permission. 201.1Snonaka * 211.1Snonaka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 221.1Snonaka * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 231.1Snonaka * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 241.1Snonaka * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 251.1Snonaka * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 261.1Snonaka * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 271.1Snonaka * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 281.1Snonaka * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 291.1Snonaka * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 301.1Snonaka * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 311.1Snonaka */ 321.6Smatt#ifndef _MACHINE_PCI_MACHDEP_H_ 331.6Smatt#define _MACHINE_PCI_MACHDEP_H_ 341.1Snonaka 351.1Snonaka/* 361.1Snonaka * Machine-specific definitions for PCI autoconfiguration. 371.1Snonaka */ 381.1Snonaka 391.1Snonaka/* 401.4Ssommerfe * Forward declarations. 411.4Ssommerfe */ 421.4Ssommerfestruct pci_attach_args; 431.4Ssommerfe 441.4Ssommerfe/* 451.1Snonaka * be-specific PCI structure and type definitions. 461.1Snonaka * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE. 471.1Snonaka * 481.1Snonaka * Configuration tag; created from a {bus,device,function} triplet by 491.1Snonaka * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write(). 501.1Snonaka * We could instead always pass the {bus,device,function} triplet to 511.1Snonaka * the read and write routines, but this would cause extra overhead. 521.1Snonaka */ 531.1Snonaka 541.1Snonaka/* 551.1Snonaka * Types provided to machine-independent PCI code 561.1Snonaka */ 571.1Snonakatypedef void *pci_chipset_tag_t; 581.1Snonakatypedef int pcitag_t; 591.1Snonakatypedef int pci_intr_handle_t; 601.1Snonaka 611.6Smatt#ifdef _KERNEL 621.5Snonakaextern struct powerpc_bus_dma_tag pci_bus_dma_tag; 631.1Snonaka 641.1Snonaka/* 651.1Snonaka * Functions provided to machine-independent PCI code. 661.1Snonaka */ 671.2Scgdvoid pci_attach_hook(struct device *, struct device *, 681.2Scgd struct pcibus_attach_args *); 691.2Scgdint pci_bus_maxdevs(pci_chipset_tag_t, int); 701.2Scgdpcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int); 711.2Scgdvoid pci_decompose_tag(pci_chipset_tag_t, pcitag_t, 721.2Scgd int *, int *, int *); 731.2Scgdpcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int); 741.2Scgdvoid pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t); 751.4Ssommerfeint pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); 761.2Scgdconst char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t); 771.3Scgdconst struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t); 781.2Scgdvoid *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, 791.2Scgd int, int (*)(void *), void *); 801.2Scgdvoid pci_intr_disestablish(pci_chipset_tag_t, void *); 811.6Smattvoid pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, 821.6Smatt int func, int swiz, int *iline); 831.6Smatt 841.6Smatt#endif /* _KERNEL */ 851.6Smatt 861.6Smatt#endif /* _MACHINE_PCI_MACHDEP_H_ */ 87