1 /* $NetBSD: pci_machdep.h,v 1.7 2005/12/11 12:16:39 christos Exp $ */
2 /* NetBSD: pci_machdep.h,v 1.3 1999/03/19 03:40:46 cgd Exp */
5 * Copyright (c) 1996 Carnegie-Mellon University.
8 * Author: Chris G. Demetriou
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.
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.
20 * Carnegie Mellon requests users of this software to return to
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
27 * any improvements or extensions that they make and grant Carnegie the
28 * rights to redistribute these changes.
32 * Machine-specific definitions for PCI autoconfiguration.
34 #define __HAVE_PCI_CONF_HOOK
37 * Forward declarations.
39 struct pci_attach_args
;
42 * Types provided to machine-independent PCI code
44 typedef struct arc_pci_chipset
*pci_chipset_tag_t
;
45 typedef u_long pcitag_t
;
46 typedef u_long pci_intr_handle_t
;
49 * arc-specific PCI structure and type definitions.
50 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
52 struct arc_pci_chipset
{
53 void (*pc_attach_hook
)(struct device
*,
54 struct device
*, struct pcibus_attach_args
*);
55 int (*pc_bus_maxdevs
)(pci_chipset_tag_t
, int);
56 pcitag_t (*pc_make_tag
)(pci_chipset_tag_t
, int, int, int);
57 void (*pc_decompose_tag
)(pci_chipset_tag_t
, pcitag_t
,
59 pcireg_t (*pc_conf_read
)(pci_chipset_tag_t
, pcitag_t
, int);
60 void (*pc_conf_write
)(pci_chipset_tag_t
, pcitag_t
, int,
62 int (*pc_intr_map
)(struct pci_attach_args
*,
64 const char *(*pc_intr_string
)(pci_chipset_tag_t
,
66 void *(*pc_intr_establish
)(pci_chipset_tag_t
,
67 pci_intr_handle_t
, int, int (*)(void *), void *);
68 void (*pc_intr_disestablish
)(pci_chipset_tag_t
, void *);
69 void (*pc_conf_interrupt
)(pci_chipset_tag_t
, int, int, int,
71 int (*pc_conf_hook
)(pci_chipset_tag_t
, int, int, int,
74 struct extent
*pc_memext
;
75 struct extent
*pc_ioext
;
79 * Functions provided to machine-independent PCI code.
81 #define pci_attach_hook(p, s, pba) \
82 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
83 #define pci_bus_maxdevs(c, b) \
84 (*(c)->pc_bus_maxdevs)((c), (b))
85 #define pci_make_tag(c, b, d, f) \
86 (*(c)->pc_make_tag)((c), (b), (d), (f))
87 #define pci_decompose_tag(c, t, bp, dp, fp) \
88 (*(c)->pc_decompose_tag)((c), (t), (bp), (dp), (fp))
89 #define pci_conf_read(c, t, r) \
90 (*(c)->pc_conf_read)((c), (t), (r))
91 #define pci_conf_write(c, t, r, v) \
92 (*(c)->pc_conf_write)((c), (t), (r), (v))
93 #define pci_intr_map(pa, ihp) \
94 (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
95 #define pci_intr_string(c, ih) \
96 (*(c)->pc_intr_string)((c), (ih))
97 #define pci_intr_establish(c, ih, l, h, a) \
98 (*(c)->pc_intr_establish)((c), (ih), (l), (h), (a))
99 #define pci_intr_disestablish(c, iv) \
100 (*(c)->pc_intr_disestablish)((c), (iv))
101 #define pci_conf_interrupt(c, b, d, f, s, i) \
102 (*(c)->pc_conf_interrupt)((c), (b), (d), (f), (s), (i))
103 #define pci_conf_hook(c, b, d, f, i) \
104 (*(c)->pc_conf_hook)((c), (b), (d), (f), (i))