xref: /illumos-gate/usr/src/uts/common/sys/1394/ieee1212.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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_IEEE1212_H
28 #define	_SYS_1394_IEEE1212_H
29 
30 /*
31  * ieee1212.h
32  *     This file contains various defines for config rom entries
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	IEEE1212_NODE_CAP_QUAD			2	/* node capability */
40 #define	IEEE1212_ROOT_DIR_QUAD			5	/* root dir quad */
41 
42 #define	IEEE1212_DIR_LEN(data) 			(((data) >> 16) & 0xFFFF)
43 #define	IEEE1212_DIR_CRC(data)			((uint16_t)((data) & 0xFFFF))
44 
45 #define	CONFIG_ROM_GEN(rom_ptr) \
46 	(((rom_ptr)[IEEE1212_NODE_CAP_QUAD] & 0x000000F0) >> 4)
47 
48 #define	CFGROM_ROOT_DIR(cfgrom) 	(&(cfgrom)[IEEE1212_ROOT_DIR_QUAD])
49 #define	CFGROM_DIR_LEN(dirptr)		(((dirptr)[0] >> 16) & 0xFF)
50 #define	CFGROM_TYPE_KEY_VALUE(q, t, k, v) {				     \
51 	(t) = (((q) & IEEE1212_KEY_TYPE_MASK) >> IEEE1212_KEY_TYPE_SHIFT);   \
52 	(k) = (((q) & IEEE1212_KEY_VALUE_MASK) >> IEEE1212_KEY_VALUE_SHIFT); \
53 	(v) = (q) & IEEE1212_ENTRY_VALUE_MASK;				     \
54 }
55 
56 /* Key types */
57 #define	IEEE1212_IMMEDIATE_TYPE			0
58 #define	IEEE1212_CSR_OFFSET_TYPE		1
59 #define	IEEE1212_LEAF_TYPE			2
60 #define	IEEE1212_DIRECTORY_TYPE			3
61 
62 /* Key values */
63 #define	IEEE1212_TEXTUAL_DESCRIPTOR		0x01
64 #define	IEEE1212_BUS_DEPENDENT_INFO		0x02
65 #define	IEEE1212_MODULE_VENDOR_ID		0x03
66 #define	IEEE1212_MODULE_HW_VERSION		0x04
67 #define	IEEE1212_MODULE_SPEC_ID			0x05
68 #define	IEEE1212_MODULE_SW_VERSION		0x06
69 #define	IEEE1212_MODULE_DEPENDENT_INFO		0x07
70 #define	IEEE1212_NODE_VENDOR_ID			0x08
71 #define	IEEE1212_NODE_HW_VERSION		0x09
72 #define	IEEE1212_NODE_SPEC_ID			0x0A
73 #define	IEEE1212_NODE_SW_VERSION		0x0B
74 #define	IEEE1212_NODE_CAPABILITIES		0x0C
75 #define	IEEE1212_NODE_UNIQUE_ID			0x0D
76 #define	IEEE1212_NODE_UNITS_EXTENT		0x0E
77 #define	IEEE1212_NODE_MEMORY_EXTENT		0x0F
78 #define	IEEE1212_NODE_DEPENDENT_INFO		0x10
79 #define	IEEE1212_UNIT_DIRECTORY			0x11
80 #define	IEEE1212_UNIT_SPEC_ID			0x12
81 #define	IEEE1212_UNIT_SW_VERSION		0x13
82 #define	IEEE1212_UNIT_DEPENDENT_INFO		0x14
83 #define	IEEE1212_UNIT_LOCATION			0x15
84 #define	IEEE1212_UNIT_POLL_MASK			0x16
85 
86 #define	IEEE1212_KEY_TYPE_MASK			0xC0000000
87 #define	IEEE1212_KEY_TYPE_SHIFT			30
88 #define	IEEE1212_KEY_VALUE_MASK			0x3F000000
89 #define	IEEE1212_KEY_VALUE_SHIFT		24
90 #define	IEEE1212_ENTRY_VALUE_MASK		0x00FFFFFF
91 
92 #define	IEEE1212_NODE_CAPABILITIES_MASK		0x0000FFFF
93 
94 #ifdef	__cplusplus
95 }
96 #endif
97 
98 #endif	/* _SYS_1394_IEEE1212_H */
99