pci_machdep.h revision 1.2
11.2Scgd/*	$NetBSD: pci_machdep.h,v 1.2 2000/06/01 00:04:54 cgd 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.1Snonaka
331.1Snonaka/*
341.1Snonaka * Machine-specific definitions for PCI autoconfiguration.
351.1Snonaka */
361.1Snonaka
371.1Snonaka/*
381.1Snonaka * be-specific PCI structure and type definitions.
391.1Snonaka * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
401.1Snonaka *
411.1Snonaka * Configuration tag; created from a {bus,device,function} triplet by
421.1Snonaka * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write().
431.1Snonaka * We could instead always pass the {bus,device,function} triplet to
441.1Snonaka * the read and write routines, but this would cause extra overhead.
451.1Snonaka */
461.1Snonaka
471.1Snonaka/*
481.1Snonaka * Types provided to machine-independent PCI code
491.1Snonaka */
501.1Snonakatypedef void *pci_chipset_tag_t;
511.1Snonakatypedef int pcitag_t;
521.1Snonakatypedef int pci_intr_handle_t;
531.1Snonaka
541.1Snonakaextern struct prep_bus_dma_tag pci_bus_dma_tag;
551.1Snonaka
561.1Snonaka/*
571.1Snonaka * Functions provided to machine-independent PCI code.
581.1Snonaka */
591.2Scgdvoid		pci_attach_hook(struct device *, struct device *,
601.2Scgd		    struct pcibus_attach_args *);
611.2Scgdint		pci_bus_maxdevs(pci_chipset_tag_t, int);
621.2Scgdpcitag_t	pci_make_tag(pci_chipset_tag_t, int, int, int);
631.2Scgdvoid		pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
641.2Scgd		    int *, int *, int *);
651.2Scgdpcireg_t	pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
661.2Scgdvoid		pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
671.2Scgdint		pci_intr_map(pci_chipset_tag_t, pcitag_t, int, int,
681.2Scgd		    pci_intr_handle_t *);
691.2Scgdconst char	*pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
701.2Scgdvoid		*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
711.2Scgd		    int, int (*)(void *), void *);
721.2Scgdvoid		pci_intr_disestablish(pci_chipset_tag_t, void *);
73