1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_1394_ADAPTERS_HCI1394_VERSION_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_1394_ADAPTERS_HCI1394_VERSION_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * hci1394_vendor.h
32*7c478bd9Sstevel@tonic-gate  *   These routines provide initialization, cleanup, and general
33*7c478bd9Sstevel@tonic-gate  *   access to vendor specific features on the OpenHCI adapter.
34*7c478bd9Sstevel@tonic-gate  */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
37*7c478bd9Sstevel@tonic-gate extern "C" {
38*7c478bd9Sstevel@tonic-gate #endif
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/conf.h>
42*7c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
43*7c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate /* Vendor Id's */
47*7c478bd9Sstevel@tonic-gate #define	VENDOR_VID_SUN_MICROSYSTEMS		0x108E
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate /* Sun Microsystems Device Id's */
51*7c478bd9Sstevel@tonic-gate #define	VENDOR_DID_RIO_1394			0x1102
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate /*
54*7c478bd9Sstevel@tonic-gate  * we will support up to a maximum of 6 different Vendor Specific register
55*7c478bd9Sstevel@tonic-gate  * mappings.  I would be surprised to see more than 1, but it is possible.
56*7c478bd9Sstevel@tonic-gate  */
57*7c478bd9Sstevel@tonic-gate #define	VENDOR_MAX_REGSETS		6
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate /* Opaque handle */
61*7c478bd9Sstevel@tonic-gate typedef struct hci1394_vendor_s	*hci1394_vendor_handle_t;
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate /*
65*7c478bd9Sstevel@tonic-gate  * Vendor Specific Info
66*7c478bd9Sstevel@tonic-gate  *    vendor_id - VendorID from PCI config space (0x0-0x1)
67*7c478bd9Sstevel@tonic-gate  *    device_id - DeviceID from PCI config space (0x2-0x3)
68*7c478bd9Sstevel@tonic-gate  *    revision_id - RevisionID from PCI config space (0x8)
69*7c478bd9Sstevel@tonic-gate  *    ohci_version - 1394 OpenHCI Version Register (0x0)
70*7c478bd9Sstevel@tonic-gate  *    ohci_vendor_id - 1394 OpenHCI Vendor ID Register (0x40)
71*7c478bd9Sstevel@tonic-gate  */
72*7c478bd9Sstevel@tonic-gate typedef struct hci1394_vendor_info_s {
73*7c478bd9Sstevel@tonic-gate 	uint_t		vendor_id;
74*7c478bd9Sstevel@tonic-gate 	uint_t		device_id;
75*7c478bd9Sstevel@tonic-gate 	uint_t		revision_id;
76*7c478bd9Sstevel@tonic-gate 	uint32_t	ohci_version;
77*7c478bd9Sstevel@tonic-gate 	uint32_t	ohci_vendor_id;
78*7c478bd9Sstevel@tonic-gate 	uint_t		vendor_reg_count;
79*7c478bd9Sstevel@tonic-gate } hci1394_vendor_info_t;
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /*
83*7c478bd9Sstevel@tonic-gate  * structure to store vendor specific register address and handle. We will have
84*7c478bd9Sstevel@tonic-gate  * one of these for each Vendor Specific register mapping.
85*7c478bd9Sstevel@tonic-gate  */
86*7c478bd9Sstevel@tonic-gate typedef struct hci1394_vendor_reg_s {
87*7c478bd9Sstevel@tonic-gate 	caddr_t			vr_reg_addr;
88*7c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t	vr_reg_handle;
89*7c478bd9Sstevel@tonic-gate } hci1394_vendor_reg_t;
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /*
93*7c478bd9Sstevel@tonic-gate  * structure to track all of the vendor specific register mappings.
94*7c478bd9Sstevel@tonic-gate  * ve_reg_count is the number of different register mappings. ve_reg_array is
95*7c478bd9Sstevel@tonic-gate  * an array of these registers. If ve_reg_count = 2, ve_reg_array[0] will have
96*7c478bd9Sstevel@tonic-gate  * the first register mapping and ve_reg_array[1] will have the second register
97*7c478bd9Sstevel@tonic-gate  * mapping.
98*7c478bd9Sstevel@tonic-gate  */
99*7c478bd9Sstevel@tonic-gate typedef struct hci1394_vendor_s {
100*7c478bd9Sstevel@tonic-gate 	hci1394_ohci_handle_t	ve_ohci;
101*7c478bd9Sstevel@tonic-gate 	uint_t			ve_reg_count;
102*7c478bd9Sstevel@tonic-gate 	hci1394_vendor_reg_t	*ve_reg_array[VENDOR_MAX_REGSETS];
103*7c478bd9Sstevel@tonic-gate 	hci1394_drvinfo_t	*ve_drvinfo;
104*7c478bd9Sstevel@tonic-gate 	hci1394_vendor_info_t	ve_info;
105*7c478bd9Sstevel@tonic-gate } hci1394_vendor_t;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate int hci1394_vendor_init(hci1394_drvinfo_t *drvinfo, hci1394_ohci_handle_t ohci,
110*7c478bd9Sstevel@tonic-gate     hci1394_vendor_info_t *vendor_info, hci1394_vendor_handle_t *vendor_handle);
111*7c478bd9Sstevel@tonic-gate void hci1394_vendor_fini(hci1394_vendor_handle_t *vendor_handle);
112*7c478bd9Sstevel@tonic-gate int hci1394_vendor_resume(hci1394_vendor_handle_t vendor_handle);
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate int hci1394_vendor_reg_write(hci1394_vendor_handle_t vendor_handle,
115*7c478bd9Sstevel@tonic-gate     uint_t reg_set, uint_t offset, uint32_t data);
116*7c478bd9Sstevel@tonic-gate int hci1394_vendor_reg_read(hci1394_vendor_handle_t vendor_handle,
117*7c478bd9Sstevel@tonic-gate     uint_t reg_set, uint_t offset, uint32_t *data);
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
120*7c478bd9Sstevel@tonic-gate }
121*7c478bd9Sstevel@tonic-gate #endif
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_1394_ADAPTERS_HCI1394_VERSION_H */
124