xref: /netbsd-src/sys/arch/atari/include/pci_machdep.h (revision e58a356cba5da26ec5dfa3e7b91db913ffb59130)
1*e58a356cSchristos /*	$NetBSD: pci_machdep.h,v 1.16 2014/03/29 19:28:26 christos Exp $	*/
2bd032fb4Scgd 
3bd032fb4Scgd /*
4bd032fb4Scgd  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
5bd032fb4Scgd  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
6bd032fb4Scgd  * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
7bd032fb4Scgd  *
8bd032fb4Scgd  * Redistribution and use in source and binary forms, with or without
9bd032fb4Scgd  * modification, are permitted provided that the following conditions
10bd032fb4Scgd  * are met:
11bd032fb4Scgd  * 1. Redistributions of source code must retain the above copyright
12bd032fb4Scgd  *    notice, this list of conditions and the following disclaimer.
13bd032fb4Scgd  * 2. Redistributions in binary form must reproduce the above copyright
14bd032fb4Scgd  *    notice, this list of conditions and the following disclaimer in the
15bd032fb4Scgd  *    documentation and/or other materials provided with the distribution.
16bd032fb4Scgd  * 3. All advertising materials mentioning features or use of this software
17bd032fb4Scgd  *    must display the following acknowledgement:
18bd032fb4Scgd  *	This product includes software developed by Charles M. Hannum.
19bd032fb4Scgd  * 4. The name of the author may not be used to endorse or promote products
20bd032fb4Scgd  *    derived from this software without specific prior written permission.
21bd032fb4Scgd  *
22bd032fb4Scgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23bd032fb4Scgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24bd032fb4Scgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25bd032fb4Scgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26bd032fb4Scgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27bd032fb4Scgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28bd032fb4Scgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29bd032fb4Scgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30bd032fb4Scgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31bd032fb4Scgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32bd032fb4Scgd  */
33bd032fb4Scgd 
34bd032fb4Scgd #ifndef _ATARI_PCI_MACHDEP_H_
35bd032fb4Scgd #define _ATARI_PCI_MACHDEP_H_
36bd032fb4Scgd 
370a36a9abStsutsui #include <machine/intr.h>
38851de295Ssommerfeld 
39851de295Ssommerfeld /*
40e5bd00e4Ssimonb  * Machine-specific definitions for PCI autoconfiguration.
41e5bd00e4Ssimonb  */
42e5bd00e4Ssimonb #define	__HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
43e5bd00e4Ssimonb 
44e5bd00e4Ssimonb /*
45851de295Ssommerfeld  * Forward declarations.
46851de295Ssommerfeld  */
47851de295Ssommerfeld struct pci_attach_args;
48851de295Ssommerfeld 
49bd032fb4Scgd /*
50bd032fb4Scgd  * Types provided to machine-independent PCI code
51bd032fb4Scgd  */
52bd032fb4Scgd typedef void	*pci_chipset_tag_t;
53bd032fb4Scgd 
54bd032fb4Scgd typedef u_long	pcitag_t;
55bd032fb4Scgd typedef int	pci_intr_handle_t;
56bd032fb4Scgd 
57bd032fb4Scgd typedef struct	{
58bd032fb4Scgd 	int		ipl;	/* ipl requested			*/
59bd032fb4Scgd 	int		imask;	/* bitmask for MFP-register		*/
6047449a63Scgd 	int		(*ifunc)(void *);	/* function to call	*/
61bd032fb4Scgd 	void		*iarg;	/* argument for 'ifunc'			*/
62bd032fb4Scgd 	struct intrhand	*ihand;	/* save this for disestablishing	*/
63bd032fb4Scgd } pci_intr_info_t;
64bd032fb4Scgd 
65bd032fb4Scgd /*
66bd032fb4Scgd  * Functions provided to machine-independent PCI code.
67bd032fb4Scgd  */
68cbab9cadSchs void		pci_attach_hook(device_t, device_t,
6947449a63Scgd 			struct pcibus_attach_args *);
7047449a63Scgd int		pci_bus_maxdevs(pci_chipset_tag_t, int);
7147449a63Scgd pcitag_t	pci_make_tag(pci_chipset_tag_t, int, int, int);
724fba4084Sthorpej void		pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *,
734fba4084Sthorpej 		    int *);
7447449a63Scgd pcireg_t	pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
7547449a63Scgd void		pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
76a184f1f4Sdyoung int		pci_intr_map(const struct pci_attach_args *,
77a184f1f4Sdyoung 		    pci_intr_handle_t *);
78*e58a356cSchristos const char	*pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t, char *, size_t);
79cffb5808Scgd const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
8047449a63Scgd void		*pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
8147449a63Scgd 			int, int (*)(void *), void *);
8247449a63Scgd void		pci_intr_disestablish(pci_chipset_tag_t, void *);
83bd032fb4Scgd 
84bd032fb4Scgd #endif /* _ATARI_PCI_MACHDEP_H_ */
85