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