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