pci_machdep.h revision 1.22 1 /* $NetBSD: pci_machdep.h,v 1.22 2021/05/27 22:11:31 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 1996 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 *
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.
14 *
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.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
28 */
29
30 #ifndef _ALPHA_PCI_MACHDEP_H_
31 #define _ALPHA_PCI_MACHDEP_H_
32
33 #include <sys/errno.h>
34
35 /*
36 * Machine-specific definitions for PCI autoconfiguration.
37 */
38 #define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
39 #define _PCI_HAVE_DMA64
40
41 /*
42 * Types provided to machine-independent PCI code
43 */
44 typedef struct alpha_pci_chipset *pci_chipset_tag_t;
45 typedef u_long pcitag_t;
46 typedef struct {
47 u_long value;
48 } pci_intr_handle_t;
49
50 /*
51 * Forward declarations.
52 */
53 struct pci_attach_args;
54 struct alpha_shared_intr;
55
56 /*
57 * alpha-specific PCI structure and type definitions.
58 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
59 */
60 struct alpha_pci_chipset {
61 void *pc_conf_v;
62 void (*pc_attach_hook)(device_t, device_t,
63 struct pcibus_attach_args *);
64 int (*pc_bus_maxdevs)(void *, int);
65 pcitag_t (*pc_make_tag)(void *, int, int, int);
66 void (*pc_decompose_tag)(void *, pcitag_t, int *,
67 int *, int *);
68 pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
69 void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
70
71 void *pc_intr_v;
72 int (*pc_intr_map)(const struct pci_attach_args *,
73 pci_intr_handle_t *);
74 const char *(*pc_intr_string)(pci_chipset_tag_t,
75 pci_intr_handle_t, char *, size_t);
76 const struct evcnt *(*pc_intr_evcnt)(pci_chipset_tag_t,
77 pci_intr_handle_t);
78 void *(*pc_intr_establish)(pci_chipset_tag_t,
79 pci_intr_handle_t, int, int (*)(void *), void *);
80 void (*pc_intr_disestablish)(pci_chipset_tag_t, void *);
81
82 void *(*pc_pciide_compat_intr_establish)(device_t,
83 const struct pci_attach_args *, int,
84 int (*)(void *), void *);
85
86 struct alpha_shared_intr *pc_shared_intrs;
87 const char *pc_intr_desc;
88 u_long pc_vecbase;
89 u_int pc_nirq;
90
91 u_long pc_eligible_cpus;
92
93 void (*pc_intr_enable)(pci_chipset_tag_t, int);
94 void (*pc_intr_disable)(pci_chipset_tag_t, int);
95 void (*pc_intr_set_affinity)(pci_chipset_tag_t, int,
96 struct cpu_info *);
97 };
98
99 /*
100 * Functions provided to machine-independent PCI code.
101 */
102 void pci_attach_hook(device_t, device_t, struct pcibus_attach_args *);
103 int pci_bus_maxdevs(pci_chipset_tag_t, int);
104 pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
105 void pci_decompose_tag(pci_chipset_tag_t, pcitag_t, int *, int *, int *);
106 pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
107 void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
108
109 int pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
110 const char *pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
111 char *, size_t);
112 const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
113 void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t, int,
114 int (*)(void *), void *);
115 void pci_intr_disestablish(pci_chipset_tag_t, void *);
116
117 /*
118 * alpha-specific PCI functions.
119 * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
120 */
121 void pci_display_console(bus_space_tag_t, bus_space_tag_t,
122 pci_chipset_tag_t, int, int, int);
123 void device_pci_register(device_t, void *);
124
125 int alpha_pci_generic_intr_map(const struct pci_attach_args *,
126 pci_intr_handle_t *);
127 const char *alpha_pci_generic_intr_string(pci_chipset_tag_t,
128 pci_intr_handle_t, char *, size_t);
129 const struct evcnt *alpha_pci_generic_intr_evcnt(pci_chipset_tag_t,
130 pci_intr_handle_t);
131 void *alpha_pci_generic_intr_establish(pci_chipset_tag_t,
132 pci_intr_handle_t, int, int (*)(void *), void *);
133 void alpha_pci_generic_intr_disestablish(pci_chipset_tag_t, void *);
134 void alpha_pci_generic_iointr(void *, unsigned long);
135
136 void alpha_pci_generic_intr_redistribute(pci_chipset_tag_t);
137
138 void alpha_pci_intr_handle_init(pci_intr_handle_t *, u_int, u_int);
139 void alpha_pci_intr_handle_set_irq(pci_intr_handle_t *, u_int);
140 u_int alpha_pci_intr_handle_get_irq(const pci_intr_handle_t *);
141 void alpha_pci_intr_handle_set_flags(pci_intr_handle_t *, u_int);
142 u_int alpha_pci_intr_handle_get_flags(const pci_intr_handle_t *);
143
144 #endif /* _ALPHA_PCI_MACHDEP_H_ */
145