pci_machdep.h revision 1.1 1 1.1 thorpej /* $NetBSD: pci_machdep.h,v 1.1 2001/01/31 18:38:26 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2001 Marcus Comstedt
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Redistribution and use in source and binary forms, with or without
8 1.1 thorpej * modification, are permitted provided that the following conditions
9 1.1 thorpej * are met:
10 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
11 1.1 thorpej * notice, this list of conditions and the following disclaimer.
12 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
14 1.1 thorpej * documentation and/or other materials provided with the distribution.
15 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
16 1.1 thorpej * must display the following acknowledgement:
17 1.1 thorpej * This product includes software developed by Marcus Comstedt.
18 1.1 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
19 1.1 thorpej * contributors may be used to endorse or promote products derived
20 1.1 thorpej * from this software without specific prior written permission.
21 1.1 thorpej *
22 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
33 1.1 thorpej */
34 1.1 thorpej
35 1.1 thorpej /*
36 1.1 thorpej * Machine-specific definitions for PCI autoconfiguration.
37 1.1 thorpej */
38 1.1 thorpej
39 1.1 thorpej /*
40 1.1 thorpej * Types provided to machine-independent PCI code
41 1.1 thorpej */
42 1.1 thorpej typedef struct dreamcast_pci_chipset *pci_chipset_tag_t;
43 1.1 thorpej typedef u_long pcitag_t;
44 1.1 thorpej typedef u_long pci_intr_handle_t;
45 1.1 thorpej
46 1.1 thorpej /*
47 1.1 thorpej * Forward declarations.
48 1.1 thorpej */
49 1.1 thorpej struct pci_attach_args;
50 1.1 thorpej
51 1.1 thorpej /*
52 1.1 thorpej * dreamcast-specific PCI structure and type definitions.
53 1.1 thorpej * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
54 1.1 thorpej */
55 1.1 thorpej struct dreamcast_pci_chipset {
56 1.1 thorpej void *pc_conf_v;
57 1.1 thorpej void (*pc_attach_hook)(struct device *,
58 1.1 thorpej struct device *, struct pcibus_attach_args *);
59 1.1 thorpej int (*pc_bus_maxdevs)(void *, int);
60 1.1 thorpej pcitag_t (*pc_make_tag)(void *, int, int, int);
61 1.1 thorpej pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
62 1.1 thorpej void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
63 1.1 thorpej
64 1.1 thorpej void *pc_intr_v;
65 1.1 thorpej
66 1.1 thorpej int (*pc_intr_map)(struct pci_attach_args *,
67 1.1 thorpej pci_intr_handle_t *);
68 1.1 thorpej const char *(*pc_intr_string)(void *, pci_intr_handle_t);
69 1.1 thorpej void *(*pc_intr_establish)(void *, pci_intr_handle_t,
70 1.1 thorpej int, int (*)(void *), void *);
71 1.1 thorpej void (*pc_intr_disestablish)(void *, void *);
72 1.1 thorpej };
73 1.1 thorpej
74 1.1 thorpej #define pci_attach_hook(p, s, pba) \
75 1.1 thorpej (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
76 1.1 thorpej #define pci_bus_maxdevs(c, b) \
77 1.1 thorpej (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
78 1.1 thorpej #define pci_make_tag(c, b, d, f) \
79 1.1 thorpej (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
80 1.1 thorpej #define pci_conf_read(c, t, r) \
81 1.1 thorpej (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
82 1.1 thorpej #define pci_conf_write(c, t, r, v) \
83 1.1 thorpej (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
84 1.1 thorpej
85 1.1 thorpej #define pci_intr_map(pa, ihp) \
86 1.1 thorpej (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
87 1.1 thorpej #define pci_intr_string(c, ih) \
88 1.1 thorpej (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
89 1.1 thorpej #define pci_intr_establish(c, ih, l, h, a) \
90 1.1 thorpej (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
91 1.1 thorpej #define pci_intr_disestablish(c, ih) \
92 1.1 thorpej (*(c)->pc_intr_disestablish)((v)->pc_intr_v, (ih))
93