4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
39 typedef enum { NEW
= 0, ATTACHED
, RESUMED
, DETACHED
,
40 SUSPENDED
, PM_SUSPENDED
} driver_state_t
;
43 * The i86pc specific code fragments are to support the debug of "honeynut"
44 * and "multigrain" prototypes on i86pc platform. Most of the fragments
45 * deal with differences in the interrupt dispatching between the prototypes
46 * and the cheerio ebus. On the prototype boards, all interrupt lines are
47 * tied together. For this case, the nexus driver uses a common interrupt
48 * handler to poll all of its children.
51 #define MAX_EBUS_DEVS 6
54 * ebus device interrupt info;
64 struct ebus_intr_map
{
65 uint32_t ebus_phys_hi
;
66 uint32_t ebus_phys_low
;
68 uint32_t intr_ctlr_nodeid
;
72 struct ebus_intr_map_mask
{
73 uint32_t ebus_phys_hi
;
74 uint32_t ebus_phys_low
;
79 * driver soft state structure:
86 struct ebus_pci_rangespec
*rangep
;
90 ddi_iblock_cookie_t iblock
;
91 ddi_idevice_cookie_t idevice
;
92 ebus_intr_slot_t intr_slot
[MAX_EBUS_DEVS
];
95 /* Interrupt support */
97 struct ebus_intr_map
*intr_map
;
98 struct ebus_intr_map_mask
*intr_map_mask
;
103 * definition of ebus reg spec entry:
111 /* EBUS range entry */
112 struct ebus_pci_rangespec
{
113 uint32_t ebus_phys_hi
; /* Child hi range address */
114 uint32_t ebus_phys_low
; /* Child low range address */
115 uint32_t pci_phys_hi
; /* Parent hi rng addr */
116 uint32_t pci_phys_mid
; /* Parent mid rng addr */
117 uint32_t pci_phys_low
; /* Parent low rng addr */
118 uint32_t rng_size
; /* Range size */
122 * use macros for soft state and driver properties:
124 #define get_acebus_soft_state(i) \
125 ((ebus_devstate_t *)ddi_get_soft_state(per_acebus_state, (i)))
127 #define alloc_acebus_soft_state(i) \
128 ddi_soft_state_zalloc(per_acebus_state, (i))
130 #define free_acebus_soft_state(i) \
131 ddi_soft_state_free(per_acebus_state, (i))
134 #define getprop(dip, name, addr, intp) \
135 ddi_getlongprop(DDI_DEV_T_ANY, (dip), DDI_PROP_DONTPASS, \
136 (name), (caddr_t)(addr), (intp))
139 * register offsets and lengths:
141 #define TCR_OFFSET 0x710000
142 #define TCR_LENGTH 12
144 #define CSR_IO_RINDEX 2
145 #define CSR_SIZE 0x00800000
146 #define TCR1_OFF 0x00710000
147 #define TCR2_OFF 0x00710004
148 #define TCR3_OFF 0x00710008
149 #define PMD_AUX_OFF 0x00728000
150 #define FREQ_AUX_OFF 0x0072a000
151 #define DCSR1_OFF 0x00700000
152 #define DACR1_OFF 0x00700004
153 #define DBCR1_OFF 0x00700008
154 #define DCSR2_OFF 0x00702000
155 #define DACR2_OFF 0x00702004
156 #define DBCR2_OFF 0x00702008
157 #define DCSR3_OFF 0x00704000
158 #define DACR3_OFF 0x00704004
159 #define DBCR3_OFF 0x00704008
160 #define DCSR4_OFF 0x00706000
161 #define DACR4_OFF 0x00706004
162 #define DBCR4_OFF 0x00706008
165 * timing control register settings:
167 #define TCR1 0x08101008
168 #define TCR2 0x08100020
169 #define TCR3 0x00000020
170 #define TCR1_REGVAL 0xe3080808
171 #define TCR2_REGVAL 0x0808ff20
172 #define TCR3_REGVAL 0x91f3c420
177 #define D_IDENTIFY 0x00000001
178 #define D_ATTACH 0x00000002
179 #define D_DETACH 0x00000004
180 #define D_MAP 0x00000008
181 #define D_CTLOPS 0x00000010
182 #define D_INTR 0x00000100
184 #define DBG(flag, psp, fmt) \
185 acebus_debug(flag, psp, fmt, 0, 0, 0, 0, 0);
186 #define DBG1(flag, psp, fmt, a1) \
187 acebus_debug(flag, psp, fmt, (uintptr_t)(a1), 0, 0, 0, 0);
188 #define DBG2(flag, psp, fmt, a1, a2) \
189 acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), 0, 0, 0);
190 #define DBG3(flag, psp, fmt, a1, a2, a3) \
191 acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), \
192 (uintptr_t)(a3), 0, 0);
193 #define DBG4(flag, psp, fmt, a1, a2, a3, a4) \
194 acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), \
197 #define DBG5(flag, psp, fmt, a1, a2, a3, a4, a5) \
198 acebus_debug(flag, psp, fmt, (uintptr_t)(a1), (uintptr_t)(a2), \
200 (uintptr_t)(a4), (uintptr_t)(a5));
202 acebus_debug(uint_t
, ebus_devstate_t
*, char *, uintptr_t, uintptr_t, uintptr_t,
203 uintptr_t, uintptr_t);
205 #define DBG(flag, psp, fmt)
206 #define DBG1(flag, psp, fmt, a1)
207 #define DBG2(flag, psp, fmt, a1, a2)
208 #define DBG3(flag, psp, fmt, a1, a2, a3)
209 #define DBG4(flag, psp, fmt, a1, a2, a3, a4)
210 #define DBG5(flag, psp, fmt, a1, a2, a3, a4, a5)
217 #endif /* _SYS_ACEBUS_H */