pci_machdep.h revision 1.7.4.2 1 1.7.4.2 nathanw /* $NetBSD: pci_machdep.h,v 1.7.4.2 2002/06/20 03:37:38 nathanw Exp $ */
2 1.7.4.2 nathanw
3 1.7.4.2 nathanw /*
4 1.7.4.2 nathanw * Copyright (c) 1996 Carnegie-Mellon University.
5 1.7.4.2 nathanw * All rights reserved.
6 1.7.4.2 nathanw *
7 1.7.4.2 nathanw * Author: Chris G. Demetriou
8 1.7.4.2 nathanw *
9 1.7.4.2 nathanw * Permission to use, copy, modify and distribute this software and
10 1.7.4.2 nathanw * its documentation is hereby granted, provided that both the copyright
11 1.7.4.2 nathanw * notice and this permission notice appear in all copies of the
12 1.7.4.2 nathanw * software, derivative works or modified versions, and any portions
13 1.7.4.2 nathanw * thereof, and that both notices appear in supporting documentation.
14 1.7.4.2 nathanw *
15 1.7.4.2 nathanw * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.7.4.2 nathanw * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.7.4.2 nathanw * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.7.4.2 nathanw *
19 1.7.4.2 nathanw * Carnegie Mellon requests users of this software to return to
20 1.7.4.2 nathanw *
21 1.7.4.2 nathanw * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.7.4.2 nathanw * School of Computer Science
23 1.7.4.2 nathanw * Carnegie Mellon University
24 1.7.4.2 nathanw * Pittsburgh PA 15213-3890
25 1.7.4.2 nathanw *
26 1.7.4.2 nathanw * any improvements or extensions that they make and grant Carnegie the
27 1.7.4.2 nathanw * rights to redistribute these changes.
28 1.7.4.2 nathanw */
29 1.7.4.2 nathanw
30 1.7.4.2 nathanw /*
31 1.7.4.2 nathanw * Machine-specific definitions for PCI autoconfiguration.
32 1.7.4.2 nathanw */
33 1.7.4.2 nathanw #define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
34 1.7.4.2 nathanw
35 1.7.4.2 nathanw /*
36 1.7.4.2 nathanw * Types provided to machine-independent PCI code
37 1.7.4.2 nathanw */
38 1.7.4.2 nathanw typedef struct alpha_pci_chipset *pci_chipset_tag_t;
39 1.7.4.2 nathanw typedef u_long pcitag_t;
40 1.7.4.2 nathanw typedef u_long pci_intr_handle_t;
41 1.7.4.2 nathanw
42 1.7.4.2 nathanw /*
43 1.7.4.2 nathanw * Forward declarations.
44 1.7.4.2 nathanw */
45 1.7.4.2 nathanw struct pci_attach_args;
46 1.7.4.2 nathanw
47 1.7.4.2 nathanw /*
48 1.7.4.2 nathanw * alpha-specific PCI structure and type definitions.
49 1.7.4.2 nathanw * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
50 1.7.4.2 nathanw */
51 1.7.4.2 nathanw struct alpha_pci_chipset {
52 1.7.4.2 nathanw void *pc_conf_v;
53 1.7.4.2 nathanw void (*pc_attach_hook)(struct device *,
54 1.7.4.2 nathanw struct device *, struct pcibus_attach_args *);
55 1.7.4.2 nathanw int (*pc_bus_maxdevs)(void *, int);
56 1.7.4.2 nathanw pcitag_t (*pc_make_tag)(void *, int, int, int);
57 1.7.4.2 nathanw void (*pc_decompose_tag)(void *, pcitag_t, int *,
58 1.7.4.2 nathanw int *, int *);
59 1.7.4.2 nathanw pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
60 1.7.4.2 nathanw void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
61 1.7.4.2 nathanw
62 1.7.4.2 nathanw void *pc_intr_v;
63 1.7.4.2 nathanw int (*pc_intr_map)(struct pci_attach_args *,
64 1.7.4.2 nathanw pci_intr_handle_t *);
65 1.7.4.2 nathanw const char *(*pc_intr_string)(void *, pci_intr_handle_t);
66 1.7.4.2 nathanw const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
67 1.7.4.2 nathanw void *(*pc_intr_establish)(void *, pci_intr_handle_t,
68 1.7.4.2 nathanw int, int (*)(void *), void *);
69 1.7.4.2 nathanw void (*pc_intr_disestablish)(void *, void *);
70 1.7.4.2 nathanw
71 1.7.4.2 nathanw void *(*pc_pciide_compat_intr_establish)(void *,
72 1.7.4.2 nathanw struct device *, struct pci_attach_args *, int,
73 1.7.4.2 nathanw int (*)(void *), void *);
74 1.7.4.2 nathanw };
75 1.7.4.2 nathanw
76 1.7.4.2 nathanw /*
77 1.7.4.2 nathanw * Functions provided to machine-independent PCI code.
78 1.7.4.2 nathanw */
79 1.7.4.2 nathanw #define pci_attach_hook(p, s, pba) \
80 1.7.4.2 nathanw (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
81 1.7.4.2 nathanw #define pci_bus_maxdevs(c, b) \
82 1.7.4.2 nathanw (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
83 1.7.4.2 nathanw #define pci_make_tag(c, b, d, f) \
84 1.7.4.2 nathanw (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
85 1.7.4.2 nathanw #define pci_decompose_tag(c, t, bp, dp, fp) \
86 1.7.4.2 nathanw (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
87 1.7.4.2 nathanw #define pci_conf_read(c, t, r) \
88 1.7.4.2 nathanw (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
89 1.7.4.2 nathanw #define pci_conf_write(c, t, r, v) \
90 1.7.4.2 nathanw (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
91 1.7.4.2 nathanw #define pci_intr_map(pa, ihp) \
92 1.7.4.2 nathanw (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
93 1.7.4.2 nathanw #define pci_intr_string(c, ih) \
94 1.7.4.2 nathanw (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
95 1.7.4.2 nathanw #define pci_intr_evcnt(c, ih) \
96 1.7.4.2 nathanw (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
97 1.7.4.2 nathanw #define pci_intr_establish(c, ih, l, h, a) \
98 1.7.4.2 nathanw (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
99 1.7.4.2 nathanw #define pci_intr_disestablish(c, iv) \
100 1.7.4.2 nathanw (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
101 1.7.4.2 nathanw
102 1.7.4.2 nathanw #define pci_enumerate_bus(sc, m, p) \
103 1.7.4.2 nathanw pci_enumerate_bus_generic((sc), (m), (p))
104 1.7.4.2 nathanw
105 1.7.4.2 nathanw /*
106 1.7.4.2 nathanw * alpha-specific PCI functions.
107 1.7.4.2 nathanw * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
108 1.7.4.2 nathanw */
109 1.7.4.2 nathanw void pci_display_console(bus_space_tag_t, bus_space_tag_t,
110 1.7.4.2 nathanw pci_chipset_tag_t, int, int, int);
111 1.7.4.2 nathanw #define alpha_pciide_compat_intr_establish(c, d, p, ch, f, a) \
112 1.7.4.2 nathanw ((c)->pc_pciide_compat_intr_establish == NULL ? NULL : \
113 1.7.4.2 nathanw (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \
114 1.7.4.2 nathanw (ch), (f), (a)))
115