7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * hci1394_async.c
31 * These routines manipulate the 1394 asynchronous dma engines. This
32 * includes incoming and outgoing reads, writes, and locks and their
33 * associated responses.
34 */
35
36 #include <sys/conf.h>
37 #include <sys/ddi.h>
38 #include <sys/modctl.h>
39 #include <sys/stat.h>
40 #include <sys/sunddi.h>
41 #include <sys/cmn_err.h>
42 #include <sys/kmem.h>
43 #include <sys/types.h>
44 #include <sys/note.h>
45
46 #include <sys/1394/h1394.h>
47 #include <sys/1394/adapters/hci1394.h>
48
117 static void hci1394_async_arreq_start(void *async, uint32_t command_ptr);
118 static void hci1394_async_atresp_start(void *async, uint32_t command_ptr);
119
120 static void hci1394_async_atreq_wake(void *async);
121 static void hci1394_async_arresp_wake(void *async);
122 static void hci1394_async_arreq_wake(void *async);
123 static void hci1394_async_atresp_wake(void *async);
124
125 static void hci1394_async_atreq_flush(hci1394_async_handle_t async_handle);
126 static void hci1394_async_arresp_flush(hci1394_async_handle_t async_handle);
127 static void hci1394_async_arreq_flush(hci1394_async_handle_t async_handle);
128 static void hci1394_async_atresp_flush(hci1394_async_handle_t async_handle);
129 static void hci1394_async_pending_list_flush(hci1394_async_handle_t
130 async_handle);
131
132 static void hci1394_async_pending_timeout(hci1394_tlist_node_t *node,
133 void *arg);
134 static uint_t hci1394_async_timeout_calc(hci1394_async_handle_t async_handle,
135 uint_t current_time);
136
137 _NOTE(SCHEME_PROTECTS_DATA("unique", msgb))
138
139 /*
140 * hci1394_async_init()
141 * Initialize the async DMA engines and state. We init the tlabels; ATREQ
142 * pending Q; and ATREQ, ARRESP, ARREQ, and ATRESP Q's. init() returns a
143 * handle to be used in rest of the functions.
144 */
145 int
146 hci1394_async_init(hci1394_drvinfo_t *drvinfo,
147 hci1394_ohci_handle_t ohci_handle, hci1394_csr_handle_t csr_handle,
148 hci1394_async_handle_t *async_handle)
149 {
150 hci1394_tlist_timer_t timer_info;
151 hci1394_q_info_t qinfo;
152 hci1394_async_t *async;
153 int status;
154
155
156 ASSERT(drvinfo != NULL);
157 ASSERT(ohci_handle != NULL);
158 ASSERT(csr_handle != NULL);
|
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 /*
28 * hci1394_async.c
29 * These routines manipulate the 1394 asynchronous dma engines. This
30 * includes incoming and outgoing reads, writes, and locks and their
31 * associated responses.
32 */
33
34 #include <sys/conf.h>
35 #include <sys/ddi.h>
36 #include <sys/modctl.h>
37 #include <sys/stat.h>
38 #include <sys/sunddi.h>
39 #include <sys/cmn_err.h>
40 #include <sys/kmem.h>
41 #include <sys/types.h>
42 #include <sys/note.h>
43
44 #include <sys/1394/h1394.h>
45 #include <sys/1394/adapters/hci1394.h>
46
115 static void hci1394_async_arreq_start(void *async, uint32_t command_ptr);
116 static void hci1394_async_atresp_start(void *async, uint32_t command_ptr);
117
118 static void hci1394_async_atreq_wake(void *async);
119 static void hci1394_async_arresp_wake(void *async);
120 static void hci1394_async_arreq_wake(void *async);
121 static void hci1394_async_atresp_wake(void *async);
122
123 static void hci1394_async_atreq_flush(hci1394_async_handle_t async_handle);
124 static void hci1394_async_arresp_flush(hci1394_async_handle_t async_handle);
125 static void hci1394_async_arreq_flush(hci1394_async_handle_t async_handle);
126 static void hci1394_async_atresp_flush(hci1394_async_handle_t async_handle);
127 static void hci1394_async_pending_list_flush(hci1394_async_handle_t
128 async_handle);
129
130 static void hci1394_async_pending_timeout(hci1394_tlist_node_t *node,
131 void *arg);
132 static uint_t hci1394_async_timeout_calc(hci1394_async_handle_t async_handle,
133 uint_t current_time);
134
135 /*
136 * hci1394_async_init()
137 * Initialize the async DMA engines and state. We init the tlabels; ATREQ
138 * pending Q; and ATREQ, ARRESP, ARREQ, and ATRESP Q's. init() returns a
139 * handle to be used in rest of the functions.
140 */
141 int
142 hci1394_async_init(hci1394_drvinfo_t *drvinfo,
143 hci1394_ohci_handle_t ohci_handle, hci1394_csr_handle_t csr_handle,
144 hci1394_async_handle_t *async_handle)
145 {
146 hci1394_tlist_timer_t timer_info;
147 hci1394_q_info_t qinfo;
148 hci1394_async_t *async;
149 int status;
150
151
152 ASSERT(drvinfo != NULL);
153 ASSERT(ohci_handle != NULL);
154 ASSERT(csr_handle != NULL);
|