Annotation of sys/arch/alpha/pci/pci_machdep.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: pci_machdep.h,v 1.20 2006/03/26 20:23:08 brad Exp $ */
2: /* $NetBSD: pci_machdep.h,v 1.6 1996/11/19 04:49:21 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@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 alpha_pci_chipset *pci_chipset_tag_t;
39: typedef u_long pcitag_t;
40: typedef u_long pci_intr_handle_t;
41:
42: /*
43: * Forward declarations.
44: */
45: struct pci_attach_args;
46:
47: /*
48: * alpha-specific PCI structure and type definitions.
49: * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
50: */
51: struct alpha_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);
61:
62: void *pc_intr_v;
63: int (*pc_intr_map)(void *, pcitag_t, int, int,
64: pci_intr_handle_t *);
65: const char *(*pc_intr_string)(void *, pci_intr_handle_t);
66: int (*pc_intr_line)(void *, pci_intr_handle_t);
67: void *(*pc_intr_establish)(void *, pci_intr_handle_t,
68: int, int (*)(void *), void *, char *);
69: void (*pc_intr_disestablish)(void *, void *);
70:
71: /* alpha-specific */
72: void *(*pc_pciide_compat_intr_establish)(void *,
73: struct device *, struct pci_attach_args *, int,
74: int (*)(void *), void *);
75: void (*pc_pciide_compat_intr_disestablish)(void *,
76: void *);
77: char *pc_name; /* PCI chipset name */
78: vaddr_t pc_mem; /* PCI memory address */
79: vaddr_t pc_dense; /* PCI dense memory address */
80: vaddr_t pc_ports; /* PCI port address */
81: long pc_hae_mask; /* PCI chipset mask for HAE register */
82: int pc_bwx; /* chipset supports BWX */
83: };
84:
85: extern struct alpha_pci_chipset *alpha_pci_chipset;
86: int alpha_sysctl_chipset(int *, u_int, char *, size_t *);
87:
88: /*
89: * Functions provided to machine-independent PCI code.
90: */
91: #define pci_attach_hook(p, s, pba) \
92: (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
93: #define pci_bus_maxdevs(c, b) \
94: (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
95: #define pci_make_tag(c, b, d, f) \
96: (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
97: #define pci_decompose_tag(c, t, bp, dp, fp) \
98: (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
99: #define pci_conf_read(c, t, r) \
100: (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
101: #define pci_conf_write(c, t, r, v) \
102: (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
103: #define pci_intr_map(pa, ihp) \
104: (*((pa)->pa_pc)->pc_intr_map)((pa)->pa_pc->pc_intr_v, \
105: (pa)->pa_intrtag, (pa)->pa_intrpin, (pa)->pa_intrline, (ihp))
106: #define pci_intr_string(c, ih) \
107: (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
108: #define pci_intr_line(c, ih) \
109: (*(c)->pc_intr_line)((c)->pc_intr_v, (ih))
110: #define pci_intr_establish(c, ih, l, h, a, nm) \
111: (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm))
112: #define pci_intr_disestablish(c, iv) \
113: (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
114:
115: /*
116: * alpha-specific PCI functions.
117: * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
118: */
119: void pci_display_console(bus_space_tag_t, bus_space_tag_t,
120: pci_chipset_tag_t, int, int, int);
121: #define alpha_pciide_compat_intr_establish(c, d, p, ch, f, a) \
122: ((c)->pc_pciide_compat_intr_establish == NULL ? NULL : \
123: (*(c)->pc_pciide_compat_intr_establish)((c)->pc_conf_v, (d), (p), \
124: (ch), (f), (a)))
125:
126: #define alpha_pciide_compat_intr_disestablish(c, cookie) \
127: do { if ((c)->pc_pciide_compat_intr_disestablish != NULL) \
128: ((c)->pc_pciide_compat_intr_disestablish)((c)->pc_conf_v, \
129: (cookie)); } while (0)
130:
131: #ifdef _KERNEL
132: void pci_display_console(bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t, int, int, int);
133: #endif /* _KERNEL */
CVSweb