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