pci_machdep.h revision 1.1 1 /* $NetBSD: pci_machdep.h,v 1.1 2000/06/09 05:33:04 soda 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 * Types provided to machine-independent PCI code
37 */
38 typedef struct arc_pci_chipset *pci_chipset_tag_t;
39 typedef u_long pcitag_t;
40 typedef u_long pci_intr_handle_t;
41
42 /*
43 * arc-specific PCI structure and type definitions.
44 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
45 */
46 struct arc_pci_chipset {
47 void (*pc_attach_hook) __P((struct device *,
48 struct device *, struct pcibus_attach_args *));
49 int (*pc_bus_maxdevs) __P((pci_chipset_tag_t, int));
50 pcitag_t (*pc_make_tag) __P((pci_chipset_tag_t, int, int, int));
51 pcireg_t (*pc_conf_read) __P((pci_chipset_tag_t, pcitag_t,
52 int));
53 void (*pc_conf_write) __P((pci_chipset_tag_t, pcitag_t, int,
54 pcireg_t));
55 int (*pc_intr_map) __P((pci_chipset_tag_t, pcitag_t, int,
56 int, pci_intr_handle_t *));
57 const char *(*pc_intr_string) __P((pci_chipset_tag_t,
58 pci_intr_handle_t));
59 void *(*pc_intr_establish) __P((pci_chipset_tag_t,
60 pci_intr_handle_t, int, int (*)(void *), void *));
61 void (*pc_intr_disestablish) __P((pci_chipset_tag_t,
62 void *));
63 };
64
65 /*
66 * Functions provided to machine-independent PCI code.
67 */
68 #define pci_attach_hook(p, s, pba) \
69 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
70 #define pci_bus_maxdevs(c, b) \
71 (*(c)->pc_bus_maxdevs)((c), (b))
72 #define pci_make_tag(c, b, d, f) \
73 (*(c)->pc_make_tag)((c), (b), (d), (f))
74 #define pci_conf_read(c, t, r) \
75 (*(c)->pc_conf_read)((c), (t), (r))
76 #define pci_conf_write(c, t, r, v) \
77 (*(c)->pc_conf_write)((c), (t), (r), (v))
78 #define pci_intr_map(c, it, ip, il, ihp) \
79 (*(c)->pc_intr_map)((c), (it), (ip), (il), (ihp))
80 #define pci_intr_string(c, ih) \
81 (*(c)->pc_intr_string)((c), (ih))
82 #define pci_intr_establish(c, ih, l, h, a) \
83 (*(c)->pc_intr_establish)((c), (ih), (l), (h), (a))
84 #define pci_intr_disestablish(c, iv) \
85 (*(c)->pc_intr_disestablish)((c), (iv))
86