xref: /openbsd/sys/arch/landisk/include/pci_machdep.h (revision e5dd7070)
1 /*	$OpenBSD: pci_machdep.h,v 1.10 2016/05/04 14:30:01 kettenis Exp $	*/
2 /*	$NetBSD: pci_machdep.h,v 1.1 2006/09/01 21:26:18 uwe Exp $	*/
3 
4 /*
5  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
6  * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by Charles M. Hannum.
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * Types provided to machine-independent PCI code
36  */
37 typedef void *pci_chipset_tag_t;
38 typedef u_int pcitag_t;
39 typedef u_int pci_intr_handle_t;
40 
41 #include <sh/dev/shpcicvar.h>
42 
43 /*
44  * Forward declarations.
45  */
46 struct pci_attach_args;
47 
48 /*
49  * Functions provided to machine-independent PCI code.
50  */
51 void landisk_pci_attach_hook(struct device *, struct device *,
52     struct pcibus_attach_args *);
53 int landisk_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
54 const char *landisk_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t);
55 void *landisk_pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
56     int (*)(void *), void *, const char *);
57 void landisk_pci_intr_disestablish(pci_chipset_tag_t, void *);
58 void landisk_pci_conf_interrupt(void *v, int bus, int dev, int pin,
59     int swiz, int *iline);
60 
61 #define	pci_bus_maxdevs(v, busno) \
62 	shpcic_bus_maxdevs(v, busno)
63 #define	pci_make_tag(v, bus, dev, func) \
64 	shpcic_make_tag(v, bus, dev, func)
65 #define	pci_decompose_tag(v, tag, bp, dp, fp) \
66 	shpcic_decompose_tag(v, tag, bp, dp, fp)
67 #define	pci_conf_size(v, tag) \
68 	shpcic_conf_size(v, tag)
69 #define	pci_conf_read(v, tag, reg) \
70 	shpcic_conf_read(v, tag, reg)
71 #define	pci_conf_write(v, tag, reg, data) \
72 	shpcic_conf_write(v, tag, reg, data)
73 
74 #define	pci_attach_hook(pa, self, pba) \
75 	landisk_pci_attach_hook(pa, self, pba)
76 #define	pci_intr_map(pa, ihp) \
77 	landisk_pci_intr_map(pa, ihp)
78 #define	pci_intr_map_msi(pa, ihp)	(-1)
79 #define	pci_intr_map_msix(pa, vec, ihp)	(-1)
80 #define	pci_intr_string(v, ih) \
81 	landisk_pci_intr_string(v, ih)
82 #define	pci_intr_establish(v, ih, level, ih_fun, ih_arg, ih_name) \
83 	landisk_pci_intr_establish(v, ih, level, ih_fun, ih_arg, ih_name)
84 #define	pci_intr_disestablish(v, cookie) \
85 	landisk_pci_intr_disestablish(v, cookie)
86 #define	pci_probe_device_hook(c, a)	(0)
87 
88 #define	pci_min_powerstate(c, t)	(PCI_PMCSR_STATE_D3)
89 #define	pci_set_powerstate_md(c, t, s, p)
90 
91 #define	pci_dev_postattach(a, b)
92