pci_machdep.h revision 1.7 1 1.7 martin /* $NetBSD: pci_machdep.h,v 1.7 2022/10/31 15:57:52 martin Exp $ */
2 1.1 uwe
3 1.1 uwe /*
4 1.1 uwe * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
5 1.1 uwe * Copyright (c) 1994 Charles M. Hannum. All rights reserved.
6 1.1 uwe *
7 1.1 uwe * Redistribution and use in source and binary forms, with or without
8 1.1 uwe * modification, are permitted provided that the following conditions
9 1.1 uwe * are met:
10 1.1 uwe * 1. Redistributions of source code must retain the above copyright
11 1.1 uwe * notice, this list of conditions and the following disclaimer.
12 1.1 uwe * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 uwe * notice, this list of conditions and the following disclaimer in the
14 1.1 uwe * documentation and/or other materials provided with the distribution.
15 1.1 uwe * 3. All advertising materials mentioning features or use of this software
16 1.1 uwe * must display the following acknowledgement:
17 1.1 uwe * This product includes software developed by Charles M. Hannum.
18 1.1 uwe * 4. The name of the author may not be used to endorse or promote products
19 1.1 uwe * derived from this software without specific prior written permission.
20 1.1 uwe *
21 1.1 uwe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.1 uwe * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.1 uwe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.1 uwe * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.1 uwe * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.1 uwe * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.1 uwe * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.1 uwe * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.1 uwe * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.1 uwe * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.1 uwe */
32 1.1 uwe
33 1.1 uwe #ifndef _LANDISK_PCI_MACHDEP_H
34 1.1 uwe #define _LANDISK_PCI_MACHDEP_H
35 1.1 uwe
36 1.1 uwe /*
37 1.1 uwe * Machine-specific definitions for PCI autoconfiguration.
38 1.1 uwe */
39 1.1 uwe #define __HAVE_PCI_CONF_HOOK
40 1.1 uwe
41 1.1 uwe /*
42 1.1 uwe * Types provided to machine-independent PCI code
43 1.1 uwe */
44 1.1 uwe typedef void *pci_chipset_tag_t;
45 1.1 uwe typedef int pcitag_t;
46 1.1 uwe typedef int pci_intr_handle_t;
47 1.1 uwe
48 1.1 uwe #include <sh3/dev/shpcicvar.h>
49 1.1 uwe
50 1.1 uwe /*
51 1.1 uwe * Forward declarations.
52 1.1 uwe */
53 1.1 uwe struct pci_attach_args;
54 1.1 uwe
55 1.1 uwe /*
56 1.1 uwe * Functions provided to machine-independent PCI code.
57 1.1 uwe */
58 1.3 chs void landisk_pci_attach_hook(device_t, device_t,
59 1.1 uwe struct pcibus_attach_args *);
60 1.2 dyoung int landisk_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
61 1.5 joerg const char *landisk_pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
62 1.4 christos char *, size_t);
63 1.1 uwe const struct evcnt *landisk_pci_intr_evcnt(pci_chipset_tag_t,pci_intr_handle_t);
64 1.1 uwe void *landisk_pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
65 1.1 uwe int (*)(void *), void *);
66 1.1 uwe void landisk_pci_intr_disestablish(pci_chipset_tag_t, void *);
67 1.1 uwe void landisk_pci_conf_interrupt(void *v, int bus, int dev, int pin,
68 1.1 uwe int swiz, int *iline);
69 1.1 uwe int landisk_pci_conf_hook(void *, int, int, int, pcireg_t);
70 1.1 uwe
71 1.1 uwe #define pci_bus_maxdevs(v, busno) \
72 1.1 uwe shpcic_bus_maxdevs(v, busno)
73 1.1 uwe #define pci_make_tag(v, bus, dev, func) \
74 1.1 uwe shpcic_make_tag(v, bus, dev, func)
75 1.1 uwe #define pci_decompose_tag(v, tag, bp, dp, fp) \
76 1.1 uwe shpcic_decompose_tag(v, tag, bp, dp, fp)
77 1.1 uwe #define pci_conf_read(v, tag, reg) \
78 1.1 uwe shpcic_conf_read(v, tag, reg)
79 1.1 uwe #define pci_conf_write(v, tag, reg, data) \
80 1.1 uwe shpcic_conf_write(v, tag, reg, data)
81 1.1 uwe
82 1.1 uwe #define pci_attach_hook(pa, self, pba) \
83 1.1 uwe landisk_pci_attach_hook(pa, self, pba)
84 1.1 uwe #define pci_intr_map(pa, ihp) \
85 1.1 uwe landisk_pci_intr_map(pa, ihp)
86 1.6 riastrad #define pci_intr_setattr(pa, ihp, attr, data) \
87 1.6 riastrad landisk_pci_intr_setattr(pa, ihp, attr, data)
88 1.4 christos #define pci_intr_string(v, ih, buf, len) \
89 1.4 christos landisk_pci_intr_string(v, ih, buf, len)
90 1.1 uwe #define pci_intr_evcnt(v, ih) \
91 1.1 uwe landisk_pci_intr_evcnt(v, ih)
92 1.1 uwe #define pci_intr_establish(v, ih, level, ih_fun, ih_arg) \
93 1.1 uwe landisk_pci_intr_establish(v, ih, level, ih_fun, ih_arg)
94 1.1 uwe #define pci_intr_disestablish(v, cookie) \
95 1.1 uwe landisk_pci_intr_disestablish(v, cookie)
96 1.1 uwe #define pci_conf_interrupt(v, bus, dev, pin, swiz, iline) \
97 1.1 uwe landisk_pci_conf_interrupt(v, bus, dev, pin, swiz, iline)
98 1.1 uwe #define pci_conf_hook(v, bus, dev, func, id) \
99 1.1 uwe landisk_pci_conf_hook(v, bus, dev, func, id)
100 1.1 uwe
101 1.1 uwe #ifdef _KERNEL
102 1.1 uwe /*
103 1.1 uwe * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED
104 1.1 uwe * BY PORTABLE CODE.
105 1.1 uwe */
106 1.1 uwe #endif
107 1.1 uwe
108 1.1 uwe #endif /* _LANDISK_PCI_MACHDEP_H */
109