xref: /titanic_41/usr/src/uts/common/sys/1394/adapters/hci1394_vendor.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
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 #ifndef	_SYS_1394_ADAPTERS_HCI1394_VERSION_H
28 #define	_SYS_1394_ADAPTERS_HCI1394_VERSION_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * hci1394_vendor.h
34  *   These routines provide initialization, cleanup, and general
35  *   access to vendor specific features on the OpenHCI adapter.
36  */
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #include <sys/types.h>
43 #include <sys/conf.h>
44 #include <sys/ddi.h>
45 #include <sys/sunddi.h>
46 
47 
48 /* Vendor Id's */
49 #define	VENDOR_VID_SUN_MICROSYSTEMS		0x108E
50 
51 
52 /* Sun Microsystems Device Id's */
53 #define	VENDOR_DID_RIO_1394			0x1102
54 
55 /*
56  * we will support up to a maximum of 6 different Vendor Specific register
57  * mappings.  I would be surprised to see more than 1, but it is possible.
58  */
59 #define	VENDOR_MAX_REGSETS		6
60 
61 
62 /* Opaque handle */
63 typedef struct hci1394_vendor_s	*hci1394_vendor_handle_t;
64 
65 
66 /*
67  * Vendor Specific Info
68  *    vendor_id - VendorID from PCI config space (0x0-0x1)
69  *    device_id - DeviceID from PCI config space (0x2-0x3)
70  *    revision_id - RevisionID from PCI config space (0x8)
71  *    ohci_version - 1394 OpenHCI Version Register (0x0)
72  *    ohci_vendor_id - 1394 OpenHCI Vendor ID Register (0x40)
73  */
74 typedef struct hci1394_vendor_info_s {
75 	uint_t		vendor_id;
76 	uint_t		device_id;
77 	uint_t		revision_id;
78 	uint32_t	ohci_version;
79 	uint32_t	ohci_vendor_id;
80 	uint_t		vendor_reg_count;
81 } hci1394_vendor_info_t;
82 
83 
84 /*
85  * structure to store vendor specific register address and handle. We will have
86  * one of these for each Vendor Specific register mapping.
87  */
88 typedef struct hci1394_vendor_reg_s {
89 	caddr_t			vr_reg_addr;
90 	ddi_acc_handle_t	vr_reg_handle;
91 } hci1394_vendor_reg_t;
92 
93 
94 /*
95  * structure to track all of the vendor specific register mappings.
96  * ve_reg_count is the number of different register mappings. ve_reg_array is
97  * an array of these registers. If ve_reg_count = 2, ve_reg_array[0] will have
98  * the first register mapping and ve_reg_array[1] will have the second register
99  * mapping.
100  */
101 typedef struct hci1394_vendor_s {
102 	hci1394_ohci_handle_t	ve_ohci;
103 	uint_t			ve_reg_count;
104 	hci1394_vendor_reg_t	*ve_reg_array[VENDOR_MAX_REGSETS];
105 	hci1394_drvinfo_t	*ve_drvinfo;
106 	hci1394_vendor_info_t	ve_info;
107 } hci1394_vendor_t;
108 
109 
110 
111 int hci1394_vendor_init(hci1394_drvinfo_t *drvinfo, hci1394_ohci_handle_t ohci,
112     hci1394_vendor_info_t *vendor_info, hci1394_vendor_handle_t *vendor_handle);
113 void hci1394_vendor_fini(hci1394_vendor_handle_t *vendor_handle);
114 int hci1394_vendor_resume(hci1394_vendor_handle_t vendor_handle);
115 
116 int hci1394_vendor_reg_write(hci1394_vendor_handle_t vendor_handle,
117     uint_t reg_set, uint_t offset, uint32_t data);
118 int hci1394_vendor_reg_read(hci1394_vendor_handle_t vendor_handle,
119     uint_t reg_set, uint_t offset, uint32_t *data);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif	/* _SYS_1394_ADAPTERS_HCI1394_VERSION_H */
126