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