1283625Sdim/*	$NetBSD: pci_machdep.h,v 1.13 2009/07/08 12:23:10 tsutsui Exp $	*/
2283625Sdim
3283625Sdim/*
4283625Sdim * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
5283625Sdim * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
6283625Sdim * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
7283625Sdim *
8283625Sdim * Redistribution and use in source and binary forms, with or without
9283625Sdim * modification, are permitted provided that the following conditions
10283625Sdim * are met:
11283625Sdim * 1. Redistributions of source code must retain the above copyright
12283625Sdim *    notice, this list of conditions and the following disclaimer.
13283625Sdim * 2. Redistributions in binary form must reproduce the above copyright
14283625Sdim *    notice, this list of conditions and the following disclaimer in the
15283625Sdim *    documentation and/or other materials provided with the distribution.
16283625Sdim * 3. All advertising materials mentioning features or use of this software
17283625Sdim *    must display the following acknowledgement:
18283625Sdim *	This product includes software developed by Charles M. Hannum.
19283625Sdim * 4. The name of the author may not be used to endorse or promote products
20283625Sdim *    derived from this software without specific prior written permission.
21283625Sdim *
22283625Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23283625Sdim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24283625Sdim * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25283625Sdim * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26283625Sdim * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27283625Sdim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28283625Sdim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29283625Sdim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30283625Sdim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31283625Sdim * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32283625Sdim */
33283625Sdim
34283625Sdim#ifndef _ATARI_PCI_MACHDEP_H_
35283625Sdim#define _ATARI_PCI_MACHDEP_H_
36283625Sdim
37283625Sdim#include <machine/intr.h>
38283625Sdim
39283625Sdim/*
40283625Sdim * Machine-specific definitions for PCI autoconfiguration.
41283625Sdim */
42283625Sdim#define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
43283625Sdim
44283625Sdim/*
45283625Sdim * Forward declarations.
46283625Sdim */
47283625Sdimstruct pci_attach_args;
48283625Sdim
49283625Sdim/*
50283625Sdim * Types provided to machine-independent PCI code
51283625Sdim */
52283625Sdimtypedef void	*pci_chipset_tag_t;
53283625Sdim
54283625Sdimtypedef u_long	pcitag_t;
55283625Sdimtypedef int	pci_intr_handle_t;
56283625Sdim
57283625Sdimtypedef struct	{
58283625Sdim	int		ipl;	/* ipl requested			*/
59283625Sdim	int		imask;	/* bitmask for MFP-register		*/
60283625Sdim	int		(*ifunc)(void *);	/* function to call	*/
61283625Sdim	void		*iarg;	/* argument for 'ifunc'			*/
62283625Sdim	struct intrhand	*ihand;	/* save this for disestablishing	*/
63283625Sdim} pci_intr_info_t;
64283625Sdim
65283625Sdim/*
66283625Sdim * Functions provided to machine-independent PCI code.
67283625Sdim */
68283625Sdimvoid		pci_attach_hook(struct device *, struct device *,
69283625Sdim			struct pcibus_attach_args *);
70283625Sdimint		pci_bus_maxdevs(pci_chipset_tag_t, int);
71283625Sdimpcitag_t	pci_make_tag(pci_chipset_tag_t, int, int, int);
72283625Sdimvoid		pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *,
73283625Sdim		    int *);
74296417Sdimpcireg_t	pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
75296417Sdimvoid		pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
76283625Sdimint		pci_intr_map(const struct pci_attach_args *,
77283625Sdim		    pci_intr_handle_t *);
78283625Sdimconst char	*pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
79285181Sdimconst struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
80283625Sdimvoid		*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
81283625Sdim			int, int (*)(void *), void *);
82283625Sdimvoid		pci_intr_disestablish(pci_chipset_tag_t, void *);
83285181Sdim
84283625Sdim#endif /* _ATARI_PCI_MACHDEP_H_ */
85283625Sdim