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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * hci1394_q.c
31 * This code decouples some of the OpenHCI async descriptor logic/structures
32 * from the async processing. The goal was to combine as much of the
33 * duplicate code as possible for the different type of async transfers
34 * without going too overboard.
35 *
36 * There are two parts to the Q, the descriptor buffer and the data buffer.
37 * For the most part, data to be transmitted and data which is received go
38 * in the data buffers. The information of where to get the data and put
39 * the data reside in the descriptor buffers. There are exceptions to this.
40 */
41
42
43 #include <sys/types.h>
44 #include <sys/conf.h>
45 #include <sys/ddi.h>
46 #include <sys/modctl.h>
47 #include <sys/stat.h>
48 #include <sys/sunddi.h>
60 static void hci1394_q_reset(hci1394_q_handle_t q_handle);
61 static void hci1394_q_next_buf(hci1394_q_buf_t *qbuf);
62
63 static void hci1394_q_at_write_OLI(hci1394_q_handle_t q_handle,
64 hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd, hci1394_basic_pkt_t *hdr,
65 uint_t hdrsize);
66 static void hci1394_q_at_write_OMI(hci1394_q_handle_t q_handle,
67 hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd, hci1394_basic_pkt_t *hdr,
68 uint_t hdrsize);
69 static void hci1394_q_at_write_OL(hci1394_q_handle_t q_handle,
70 hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd, uint32_t io_addr,
71 uint_t datasize);
72 static void hci1394_q_at_rep_put8(hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd,
73 uint8_t *data, uint_t datasize);
74 static void hci1394_q_at_copy_from_mblk(hci1394_q_buf_t *qbuf,
75 hci1394_q_cmd_t *cmd, h1394_mblk_t *mblk);
76
77 static void hci1394_q_ar_write_IM(hci1394_q_handle_t q_handle,
78 hci1394_q_buf_t *qbuf, uint32_t io_addr, uint_t datasize);
79
80 _NOTE(SCHEME_PROTECTS_DATA("unique", msgb))
81
82 /*
83 * hci1394_q_init()
84 * Initialize a Q. A Q consists of a descriptor buffer and a data buffer and
85 * can be either an AT or AR Q. hci1394_q_init() returns a handle which
86 * should be used for the reset of the hci1394_q_* calls.
87 */
88 int
89 hci1394_q_init(hci1394_drvinfo_t *drvinfo,
90 hci1394_ohci_handle_t ohci_handle, hci1394_q_info_t *qinfo,
91 hci1394_q_handle_t *q_handle)
92 {
93 hci1394_q_buf_t *desc;
94 hci1394_q_buf_t *data;
95 hci1394_buf_parms_t parms;
96 hci1394_q_t *q;
97 int status;
98 int index;
99
100
101 ASSERT(drvinfo != 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 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * hci1394_q.c
29 * This code decouples some of the OpenHCI async descriptor logic/structures
30 * from the async processing. The goal was to combine as much of the
31 * duplicate code as possible for the different type of async transfers
32 * without going too overboard.
33 *
34 * There are two parts to the Q, the descriptor buffer and the data buffer.
35 * For the most part, data to be transmitted and data which is received go
36 * in the data buffers. The information of where to get the data and put
37 * the data reside in the descriptor buffers. There are exceptions to this.
38 */
39
40
41 #include <sys/types.h>
42 #include <sys/conf.h>
43 #include <sys/ddi.h>
44 #include <sys/modctl.h>
45 #include <sys/stat.h>
46 #include <sys/sunddi.h>
58 static void hci1394_q_reset(hci1394_q_handle_t q_handle);
59 static void hci1394_q_next_buf(hci1394_q_buf_t *qbuf);
60
61 static void hci1394_q_at_write_OLI(hci1394_q_handle_t q_handle,
62 hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd, hci1394_basic_pkt_t *hdr,
63 uint_t hdrsize);
64 static void hci1394_q_at_write_OMI(hci1394_q_handle_t q_handle,
65 hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd, hci1394_basic_pkt_t *hdr,
66 uint_t hdrsize);
67 static void hci1394_q_at_write_OL(hci1394_q_handle_t q_handle,
68 hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd, uint32_t io_addr,
69 uint_t datasize);
70 static void hci1394_q_at_rep_put8(hci1394_q_buf_t *qbuf, hci1394_q_cmd_t *cmd,
71 uint8_t *data, uint_t datasize);
72 static void hci1394_q_at_copy_from_mblk(hci1394_q_buf_t *qbuf,
73 hci1394_q_cmd_t *cmd, h1394_mblk_t *mblk);
74
75 static void hci1394_q_ar_write_IM(hci1394_q_handle_t q_handle,
76 hci1394_q_buf_t *qbuf, uint32_t io_addr, uint_t datasize);
77
78 /*
79 * hci1394_q_init()
80 * Initialize a Q. A Q consists of a descriptor buffer and a data buffer and
81 * can be either an AT or AR Q. hci1394_q_init() returns a handle which
82 * should be used for the reset of the hci1394_q_* calls.
83 */
84 int
85 hci1394_q_init(hci1394_drvinfo_t *drvinfo,
86 hci1394_ohci_handle_t ohci_handle, hci1394_q_info_t *qinfo,
87 hci1394_q_handle_t *q_handle)
88 {
89 hci1394_q_buf_t *desc;
90 hci1394_q_buf_t *data;
91 hci1394_buf_parms_t parms;
92 hci1394_q_t *q;
93 int status;
94 int index;
95
96
97 ASSERT(drvinfo != NULL);
|