No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / algor / include / pci_machdep.h
blob0be90fb90a605ad2ae66e7f2cf6eaa05fb0abde4
1 /* $NetBSD: pci_machdep.h,v 1.6 2005/12/11 12:16:08 christos Exp $ */
3 /*
4 * Copyright (c) 1996 Carnegie-Mellon University.
5 * All rights reserved.
7 * Author: Chris G. Demetriou
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
31 * Machine-specific definitions for PCI autoconfiguration.
33 #define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
36 * Types provided to machine-independent PCI code
38 typedef struct algor_pci_chipset *pci_chipset_tag_t;
39 typedef u_long pcitag_t;
40 typedef u_long pci_intr_handle_t;
43 * Forward declarations.
45 struct pci_attach_args;
48 * algor-specific PCI structure and type definitions.
49 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
51 struct algor_pci_chipset {
52 void *pc_conf_v;
53 void (*pc_attach_hook)(struct device *,
54 struct device *, struct pcibus_attach_args *);
55 int (*pc_bus_maxdevs)(void *, int);
56 pcitag_t (*pc_make_tag)(void *, int, int, int);
57 void (*pc_decompose_tag)(void *, pcitag_t, int *,
58 int *, int *);
59 pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
60 void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
62 void *pc_intr_v;
63 int (*pc_intr_map)(struct pci_attach_args *,
64 pci_intr_handle_t *);
65 const char *(*pc_intr_string)(void *, pci_intr_handle_t);
66 const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
67 void *(*pc_intr_establish)(void *, pci_intr_handle_t,
68 int, int (*)(void *), void *);
69 void (*pc_intr_disestablish)(void *, void *);
71 void (*pc_conf_interrupt)(void *, int, int, int,
72 int, int *);
74 /* algor-specific */
75 void *(*pc_pciide_compat_intr_establish)(void *,
76 struct device *, struct pci_attach_args *, int,
77 int (*)(void *), void *);
81 * Functions provided to machine-independent PCI code.
83 #define pci_attach_hook(p, s, pba) \
84 (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
85 #define pci_bus_maxdevs(c, b) \
86 (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
87 #define pci_make_tag(c, b, d, f) \
88 (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
89 #define pci_decompose_tag(c, t, bp, dp, fp) \
90 (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
91 #define pci_conf_read(c, t, r) \
92 (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
93 #define pci_conf_write(c, t, r, v) \
94 (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
95 #define pci_intr_map(pa, ihp) \
96 (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
97 #define pci_intr_string(c, ih) \
98 (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
99 #define pci_intr_evcnt(c, ih) \
100 (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
101 #define pci_intr_establish(c, ih, l, h, a) \
102 (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
103 #define pci_intr_disestablish(c, iv) \
104 (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
105 #define pci_conf_interrupt(c, b, d, p, s, lp) \
106 (*(c)->pc_conf_interrupt)((c)->pc_intr_v, (b), (d), (p), (s), (lp))
109 * algor-specific PCI functions.
110 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
112 #define algor_pciide_compat_intr_establish(c, d, p, ch, f, a) \
113 ((c)->pc_pciide_compat_intr_establish == NULL ? NULL : \
114 (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \
115 (ch), (f), (a)))