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