1 /* $NetBSD: pci_machdep.h,v 1.5 2008/03/17 09:20:23 kiyohara Exp $ */
4 * Modified for arm32 by Mark Brinicombe
6 * from: sys/arch/alpha/pci/pci_machdep.h
8 * Copyright (c) 1996 Carnegie-Mellon University.
11 * Author: Chris G. Demetriou
13 * Permission to use, copy, modify and distribute this software and
14 * its documentation is hereby granted, provided that both the copyright
15 * notice and this permission notice appear in all copies of the
16 * software, derivative works or modified versions, and any portions
17 * thereof, and that both notices appear in supporting documentation.
19 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
20 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
21 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
23 * Carnegie Mellon requests users of this software to return to
25 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
26 * School of Computer Science
27 * Carnegie Mellon University
28 * Pittsburgh PA 15213-3890
30 * any improvements or extensions that they make and grant Carnegie the
31 * rights to redistribute these changes.
34 #ifndef _ARM_PCI_MACHDEP_H_
35 #define _ARM_PCI_MACHDEP_H_
37 * Machine-specific definitions for PCI autoconfiguration.
41 * Types provided to machine-independent PCI code
43 typedef struct arm32_pci_chipset
*pci_chipset_tag_t
;
44 typedef u_long pcitag_t
;
45 typedef u_long pci_intr_handle_t
;
48 * Forward declarations.
50 struct pci_attach_args
;
53 * arm32-specific PCI structure and type definitions.
54 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
56 struct arm32_pci_chipset
{
58 void (*pc_attach_hook
)(struct device
*,
59 struct device
*, struct pcibus_attach_args
*);
60 int (*pc_bus_maxdevs
)(void *, int);
61 pcitag_t (*pc_make_tag
)(void *, int, int, int);
62 void (*pc_decompose_tag
)(void *, pcitag_t
, int *,
64 pcireg_t (*pc_conf_read
)(void *, pcitag_t
, int);
65 void (*pc_conf_write
)(void *, pcitag_t
, int, pcireg_t
);
68 int (*pc_intr_map
)(struct pci_attach_args
*,
70 const char *(*pc_intr_string
)(void *, pci_intr_handle_t
);
71 const struct evcnt
*(*pc_intr_evcnt
)(void *, pci_intr_handle_t
);
72 void *(*pc_intr_establish
)(void *, pci_intr_handle_t
,
73 int, int (*)(void *), void *);
74 void (*pc_intr_disestablish
)(void *, void *);
76 #ifdef __HAVE_PCI_CONF_HOOK
77 int (*pc_conf_hook
)(pci_chipset_tag_t
, int, int, int,
85 * Functions provided to machine-independent PCI code.
87 #define pci_attach_hook(p, s, pba) \
88 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
89 #define pci_bus_maxdevs(c, b) \
90 (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
91 #define pci_make_tag(c, b, d, f) \
92 (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
93 #define pci_decompose_tag(c, t, bp, dp, fp) \
94 (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
95 #define pci_conf_read(c, t, r) \
96 (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
97 #define pci_conf_write(c, t, r, v) \
98 (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
99 #define pci_intr_map(pa, ihp) \
100 (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
101 #define pci_intr_string(c, ih) \
102 (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
103 #define pci_intr_evcnt(c, ih) \
104 (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
105 #define pci_intr_establish(c, ih, l, h, a) \
106 (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
107 #define pci_intr_disestablish(c, iv) \
108 (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
109 #ifdef __HAVE_PCI_CONF_HOOK
110 #define pci_conf_hook(c, b, d, f, id) \
111 (*(c)->pc_conf_hook)((c), (b), (d), (f), (id))
114 #endif /* _ARM_PCI_MACHDEP_H_ */