1 /* $NetBSD: ieee1212reg.h,v 1.10 2005/12/11 12:23:56 christos Exp $ */
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _DEV_STD_IEEE1212REG_H_
33 #define _DEV_STD_IEEE1212REG_H_
35 /* This file contains definitions from ISO/IEC 1312 or ANSI/IEEE Std 1212
36 * Informaton techonology
37 * Microprocessor systes
38 * Control and Status Registers (CSR)
39 * Architecture for microcomputer buses
40 * First edition 1994-10-05
43 /* Lock transaction codes (Table 5)
45 #define P1212_XTCODE_RESERVED_0 0
46 #define P1212_XTCODE_MASK_SWAP 1
47 #define P1212_XTCODE_COMPARE_SWAP 2
48 #define P1212_XTCODE_FETCH_ADD 3
49 #define P1212_XTCODE_LITTLE_ADD 4
50 #define P1212_XTCODE_BOUNDED_ADD 5
51 #define P1212_XTCODE_WRAP_ADD 6
52 #define P1212_XTCODE_VENDOR_DEPENDENT 7
54 /* Header: Rom Format (1 Quadlet)
55 * Bus Info Block: <info-length> Quadlets
59 * Vendor Dependent Information
62 * 0x00-0x000000 Initializing
63 * 0x01-0xzzyyxx Minimal (zz-yy-xx is an OUI)
64 * 0xii-0xcc-0xllll General (ii is info-length,
65 * cc is crc-length, llll is length)
68 #define P1212_ROMFMT_INIT 0x00
69 #define P1212_ROMFMT_MINIMAL 0x01
71 /* uint32_t P1212_ROMFMT_MK_INIT(void)
73 #define P1212_ROMFMT_MK_INIT() 0x00000000
75 /* uint32_t P1212_ROMFMT_MK_MINIMAL(const uint8_t *oui);
77 #define P1212_ROMFMT_MK_MINIMAL(oui) \
78 ((P1212_ROMFMT_MINIMAL << 24) \
83 /* uint32_t P1212_ROMFMT_MK_GENERAL(size_t info_len, size_t crc_len,
86 #define P1212_ROMFMT_MK_GENERAL(info_len, crc_len, crc_value) \
91 /* unsigned P1212_ROMFMT_GET_FMT(uint32_t);
93 #define P1212_ROMFMT_GET_FMT(quadlet) (((quadlet) >> 24) & 0xff)
95 /* void P1212_ROMFMT_GET_OUI(uint32_t quadlet, uint8_t *oui);
97 #define P1212_ROMTFMT_GET_OUI(quadlet, oui) do { \
98 (oui)[0] = ((quadlet) >> 16) & 0xff; \
99 (oui)[1] = ((quadlet) >> 8) & 0xff; \
100 (oui)[2] = ((quadlet) >> 0) & 0xff; \
103 /* size_t P1212_ROMGET_GET_INFOLEN(uint32_t quadlet);
105 #define P1212_ROMFMT_GET_INFOLEN(quadlet) (((quadlet) >> 24) & 0xff)
107 /* size_t P1212_ROMGET_GET_CRCLEN(uint32_t quadlet);
109 #define P1212_ROMFMT_GET_CRCLEN(quadlet) (((quadlet) >> 16) & 0xff)
111 /* size_t P1212_ROMGET_GET_CRC(uint32_t quadlet);
113 #define P1212_ROMFMT_GET_CRC(quadlet) ((uint16_t)(quadlet))
115 /* uint8_t P1212_DIRENT_GET_KEY(uint32_t quadlet);
117 #define P1212_DIRENT_GET_KEY(quadlet) (((quadlet) >> 24) & 0xff)
119 /* unsigned int P1212_DIRENT_GET_KEYTYPE(uint32_t quadlet);
121 #define P1212_DIRENT_GET_KEYTYPE(quadlet) (((quadlet) >> 30) & 0x03)
123 /* unsigned int P1212_DIRENT_GET_KEYVALUE(uint32_t quadlet);
125 #define P1212_DIRENT_GET_KEYVALUE(quadlet) (((quadlet) >> 24) & 0x3f)
127 /* unsigned int P1212_DIRENT_GET_OFFSET(uint32_t quadlet);
129 #define P1212_DIRENT_GET_OFFSET(quadlet) ((quadlet) & 0xffffff)
131 /* unsigned int P1212_DIRENT_GET_VALUE(uint32_t quadlet);
133 #define P1212_DIRENT_GET_VALUE(quadlet) ((quadlet) & 0xffffff)
135 /* u_int16_t P1212_DIRENT_GET_LEN(quadlet);
137 #define P1212_DIRENT_GET_LEN(quadlet) (((quadlet) >> 16) & 0xffff)
139 /* u_int16_t P1212_DIRENT_GET_CRC(quadlet);
141 #define P1212_DIRENT_GET_CRC(quadlet) ((uint16_t)(quadlet))
143 /* Key Types are stored in bits 31-30 of a directory entry.
146 #define P1212_KEYTYPE_Immediate 0x00
147 #define P1212_KEYTYPE_Offset 0x01
148 #define P1212_KEYTYPE_Leaf 0x02
149 #define P1212_KEYTYPE_Directory 0x03
151 /* Key Values are stored in bits 29-24 of a directory entry.
153 #define P1212_KEYVALUE_Textual_Descriptor 0x01 /* leaf | directory */
154 #define P1212_KEYVALUE_Bus_Dependent_Info 0x02 /* leaf | directory */
155 #define P1212_KEYVALUE_Module_Vendor_Id 0x03 /* immediate */
156 #define P1212_KEYVALUE_Module_Hw_Version 0x04 /* immediate */
157 #define P1212_KEYVALUE_Module_Spec_Id 0x05 /* immediate */
158 #define P1212_KEYVALUE_Module_Sw_Version 0x06 /* immediate */
159 #define P1212_KEYVALUE_Module_Dependent_Info 0x07 /* leaf | directory */
160 #define P1212_KEYVALUE_Node_Vendor_Id 0x08 /* immediate */
161 #define P1212_KEYVALUE_Node_Hw_Version 0x09 /* immediate */
162 #define P1212_KEYVALUE_Node_Spec_Id 0x0a /* immediate */
163 #define P1212_KEYVALUE_Node_Sw_Version 0x0b /* immediate */
164 #define P1212_KEYVALUE_Node_Capabilities 0x0c /* immediate */
165 #define P1212_KEYVALUE_Node_Unique_Id 0x0d /* leaf */
166 #define P1212_KEYVALUE_Node_Units_Extent 0x0e /* immediate | offset */
167 #define P1212_KEYVALUE_Node_Memory_Extent 0x0f /* immediate | offset */
168 #define P1212_KEYVALUE_Node_Dependent_Info 0x10 /* leaf | directory */
169 #define P1212_KEYVALUE_Unit_Directory 0x11 /* directory */
170 #define P1212_KEYVALUE_Unit_Spec_Id 0x12 /* immediate */
171 #define P1212_KEYVALUE_Unit_Sw_Version 0x13 /* immediate */
172 #define P1212_KEYVALUE_Unit_Dependent_Info 0x14 /* leaf | directory */
173 #define P1212_KEYVALUE_Unit_Location 0x15 /* leaf */
174 #define P1212_KEYVALUE_Unit_Poll_Mask 0x16 /* immediate */
177 * Items not in original p1212 standard but are in proposed drafts and in use
178 * already in some roms.
181 #define P1212_KEYVALUE_Model 0x17 /* immediate */
182 #define P1212_KEYVALUR_Instance_Directory 0x18 /* directory */
183 #define P1212_KEYVALUE_Keyword 0x19 /* leaf */
184 #define P1212_KEYVALUE_Feature_Directory 0x1A /* directory */
185 #define P1212_KEYVALUE_Extended_ROM 0x1B /* leaf */
186 #define P1212_KEYVALUE_Extended_Key_Spec_Id 0x1C /* immediate */
187 #define P1212_KEYVALUE_Extended_Key 0x1D /* immediate */
188 #define P1212_KEYVALUE_Extended_Data 0x1E /* imm|leaf|dir|offset */
189 #define P1212_KEYVALUE_Modifiable_Descriptor 0x1F /* leaf */
190 #define P1212_KEYVALUE_Directory_Id 0x20 /* immediate */
192 #define P1212_KEYTYPE_STRINGS { "Immediate", "Offset", "Leaf", "Directory" }
194 #define P1212_KEYVALUE_STRINGS { "Root-Directory", \
195 "Textual-Descriptor", "Bus-Dependent-Info", "Module-Vendor-Id", \
196 "Module-Hw-Version", "Module-Spec-Id", "Module-Sw-Version", \
197 "Module-Dependent-Info", "Node-Vendor-Id", "Node-Hw_Version", \
198 "Node-Spec-Id", "Node-Sw-Verson", "Node-Capabilities", \
199 "Node-Unique-Id", "Node-Units-Extent", "Node-Memory-Extent", \
200 "Node-Dependent-Info", "Unit-Directory", "Unit-Spec-Id", \
201 "Unit-Sw-Version", "Unit-Dependent-Info", "Unit-Location", \
202 "Unit-Poll-Mask", "Model", "Instance-Directory", "Keyword", \
203 "Feature-Directory", "Extended-ROM", "Extended-Key-Spec-Id", \
204 "Extended-Key", "Extended-Data", "Modifiable-Descriptor", \
207 /* Leaf nodes look like:
209 * [0] 0xnnnn-0xcccc length, crc16
212 * Text leaves look like:
213 * [0] 0xnnnn-0xcccc length, crc16
214 * [1] 0xtt-0xiiiiii specifier type, specifier id
215 * [2] 0xllllllll language id
218 #define P1212_TEXT_Min_Leaf_Length 0x3
219 #define P1212_TEXT_GET_Spec_Type(quadlet) (((quadlet) & 0xff000000) >> 24)
220 #define P1212_TEXT_GET_Spec_Id(quadlet) ((quadlet) & 0xffffff)
223 * Directory nodes look like:
224 * [0] 0xnnnn-0xcccc length, crc16
229 /* Some definitions for the p1212_find routines. */
231 #define P1212_FIND_SEARCHALL 0x1
232 #define P1212_FIND_RETURNALL 0x2
234 /* Mask definitions for overriding the p1212 standard checks. */
237 * XXX: Note that some of these go away if full p1212r support is done as
238 * a lot of the restrictions were lifted there in what can go where.
242 /* Normally dependent info can only be leaf or directory. Allow offsets also */
243 #define P1212_ALLOW_DEPENDENT_INFO_OFFSET_TYPE 0x1
245 /* Same thing applies for immediate types. */
246 #define P1212_ALLOW_DEPENDENT_INFO_IMMED_TYPE 0x2
247 #define P1212_ALLOW_VENDOR_DIRECTORY_TYPE 0x4
249 #endif /* _DEV_STD_IEEE1212REG_H_ */