pci_machdep.h revision 1.4
11.4Ssommerfe/*	$NetBSD: pci_machdep.h,v 1.4 2000/12/28 22:59:10 sommerfeld 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.4Ssommerfe * Forward declarations.
391.4Ssommerfe */
401.4Ssommerfestruct pci_attach_args;
411.4Ssommerfe
421.4Ssommerfe/*
431.1Snonaka * be-specific PCI structure and type definitions.
441.1Snonaka * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
451.1Snonaka *
461.1Snonaka * Configuration tag; created from a {bus,device,function} triplet by
471.1Snonaka * pci_make_tag(), and passed to pci_conf_read() and pci_conf_write().
481.1Snonaka * We could instead always pass the {bus,device,function} triplet to
491.1Snonaka * the read and write routines, but this would cause extra overhead.
501.1Snonaka */
511.1Snonaka
521.1Snonaka/*
531.1Snonaka * Types provided to machine-independent PCI code
541.1Snonaka */
551.1Snonakatypedef void *pci_chipset_tag_t;
561.1Snonakatypedef int pcitag_t;
571.1Snonakatypedef int pci_intr_handle_t;
581.1Snonaka
591.1Snonakaextern struct prep_bus_dma_tag pci_bus_dma_tag;
601.1Snonaka
611.1Snonaka/*
621.1Snonaka * Functions provided to machine-independent PCI code.
631.1Snonaka */
641.2Scgdvoid		pci_attach_hook(struct device *, struct device *,
651.2Scgd		    struct pcibus_attach_args *);
661.2Scgdint		pci_bus_maxdevs(pci_chipset_tag_t, int);
671.2Scgdpcitag_t	pci_make_tag(pci_chipset_tag_t, int, int, int);
681.2Scgdvoid		pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
691.2Scgd		    int *, int *, int *);
701.2Scgdpcireg_t	pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
711.2Scgdvoid		pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
721.4Ssommerfeint		pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
731.2Scgdconst char	*pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
741.3Scgdconst struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
751.2Scgdvoid		*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
761.2Scgd		    int, int (*)(void *), void *);
771.2Scgdvoid		pci_intr_disestablish(pci_chipset_tag_t, void *);
78