aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/csr1212.h
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-11 17:49:34 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-04-29 18:00:28 -0400
commit982610bd0d8e64baff36099f6dc456ea52d22257 (patch)
tree23e74575c2e8cb11b84de9e2f685e87d4f28dbe8 /drivers/ieee1394/csr1212.h
parent7fb9addba8ebd67306099e7fa629ff76c1be2105 (diff)
ieee1394: csr1212: rename some types
Use u8, u32 etc. instead of u_int8_t, csr1212_quad_t etc. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394/csr1212.h')
-rw-r--r--drivers/ieee1394/csr1212.h62
1 files changed, 29 insertions, 33 deletions
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
index f42e12e58ae7..aa9e924fd189 100644
--- a/drivers/ieee1394/csr1212.h
+++ b/drivers/ieee1394/csr1212.h
@@ -114,19 +114,17 @@
114 114
115/* Config ROM image structures */ 115/* Config ROM image structures */
116struct csr1212_bus_info_block_img { 116struct csr1212_bus_info_block_img {
117 u_int8_t length; 117 u8 length;
118 u_int8_t crc_length; 118 u8 crc_length;
119 u_int16_t crc; 119 u16 crc;
120 120
121 /* Must be last */ 121 /* Must be last */
122 u_int32_t data[0]; /* older gcc can't handle [] which is standard */ 122 u32 data[0]; /* older gcc can't handle [] which is standard */
123}; 123};
124 124
125typedef u_int32_t csr1212_quad_t;
126
127struct csr1212_leaf { 125struct csr1212_leaf {
128 int len; 126 int len;
129 u_int32_t *data; 127 u32 *data;
130}; 128};
131 129
132struct csr1212_dentry { 130struct csr1212_dentry {
@@ -141,12 +139,12 @@ struct csr1212_directory {
141 139
142struct csr1212_keyval { 140struct csr1212_keyval {
143 struct { 141 struct {
144 u_int8_t type; 142 u8 type;
145 u_int8_t id; 143 u8 id;
146 } key; 144 } key;
147 union { 145 union {
148 u_int32_t immediate; 146 u32 immediate;
149 u_int32_t csr_offset; 147 u32 csr_offset;
150 struct csr1212_leaf leaf; 148 struct csr1212_leaf leaf;
151 struct csr1212_directory directory; 149 struct csr1212_directory directory;
152 } value; 150 } value;
@@ -155,15 +153,15 @@ struct csr1212_keyval {
155 153
156 /* used in generating and/or parsing CSR image */ 154 /* used in generating and/or parsing CSR image */
157 struct csr1212_keyval *next, *prev; /* flat list of CSR elements */ 155 struct csr1212_keyval *next, *prev; /* flat list of CSR elements */
158 u_int32_t offset; /* position in CSR from 0xffff f000 0000 */ 156 u32 offset; /* position in CSR from 0xffff f000 0000 */
159 u_int8_t valid; /* flag indicating keyval has valid data*/ 157 u8 valid; /* flag indicating keyval has valid data*/
160}; 158};
161 159
162 160
163struct csr1212_cache_region { 161struct csr1212_cache_region {
164 struct csr1212_cache_region *next, *prev; 162 struct csr1212_cache_region *next, *prev;
165 u_int32_t offset_start; /* inclusive */ 163 u32 offset_start; /* inclusive */
166 u_int32_t offset_end; /* exclusive */ 164 u32 offset_end; /* exclusive */
167}; 165};
168 166
169struct csr1212_csr_rom_cache { 167struct csr1212_csr_rom_cache {
@@ -171,18 +169,18 @@ struct csr1212_csr_rom_cache {
171 struct csr1212_cache_region *filled_head, *filled_tail; 169 struct csr1212_cache_region *filled_head, *filled_tail;
172 struct csr1212_keyval *layout_head, *layout_tail; 170 struct csr1212_keyval *layout_head, *layout_tail;
173 size_t size; 171 size_t size;
174 u_int32_t offset; 172 u32 offset;
175 struct csr1212_keyval *ext_rom; 173 struct csr1212_keyval *ext_rom;
176 size_t len; 174 size_t len;
177 175
178 /* Must be last */ 176 /* Must be last */
179 u_int32_t data[0]; /* older gcc can't handle [] which is standard */ 177 u32 data[0]; /* older gcc can't handle [] which is standard */
180}; 178};
181 179
182struct csr1212_csr { 180struct csr1212_csr {
183 size_t bus_info_len; /* bus info block length in bytes */ 181 size_t bus_info_len; /* bus info block length in bytes */
184 size_t crc_len; /* crc length in bytes */ 182 size_t crc_len; /* crc length in bytes */
185 u_int32_t *bus_info_data; /* bus info data incl bus name and EUI */ 183 u32 *bus_info_data; /* bus info data incl bus name and EUI */
186 184
187 void *private; /* private, bus specific data */ 185 void *private; /* private, bus specific data */
188 struct csr1212_bus_ops *ops; 186 struct csr1212_bus_ops *ops;
@@ -200,32 +198,30 @@ struct csr1212_bus_ops {
200 * from remote nodes when parsing a Config ROM (i.e., read Config ROM 198 * from remote nodes when parsing a Config ROM (i.e., read Config ROM
201 * entries located in the Units Space. Must return 0 on success 199 * entries located in the Units Space. Must return 0 on success
202 * anything else indicates an error. */ 200 * anything else indicates an error. */
203 int (*bus_read) (struct csr1212_csr *csr, u_int64_t addr, 201 int (*bus_read) (struct csr1212_csr *csr, u64 addr,
204 u_int16_t length, void *buffer, void *private); 202 u16 length, void *buffer, void *private);
205 203
206 /* This function is used by csr1212 to allocate a region in units space 204 /* This function is used by csr1212 to allocate a region in units space
207 * in the event that Config ROM entries don't all fit in the predefined 205 * in the event that Config ROM entries don't all fit in the predefined
208 * 1K region. The void *private parameter is private member of struct 206 * 1K region. The void *private parameter is private member of struct
209 * csr1212_csr. */ 207 * csr1212_csr. */
210 u_int64_t (*allocate_addr_range) (u_int64_t size, u_int32_t alignment, 208 u64 (*allocate_addr_range) (u64 size, u32 alignment, void *private);
211 void *private);
212
213 209
214 /* This function is used by csr1212 to release a region in units space 210 /* This function is used by csr1212 to release a region in units space
215 * that is no longer needed. */ 211 * that is no longer needed. */
216 void (*release_addr) (u_int64_t addr, void *private); 212 void (*release_addr) (u64 addr, void *private);
217 213
218 /* This function is used by csr1212 to determine the max read request 214 /* This function is used by csr1212 to determine the max read request
219 * supported by a remote node when reading the ConfigROM space. Must 215 * supported by a remote node when reading the ConfigROM space. Must
220 * return 0, 1, or 2 per IEEE 1212. */ 216 * return 0, 1, or 2 per IEEE 1212. */
221 int (*get_max_rom) (u_int32_t *bus_info, void *private); 217 int (*get_max_rom) (u32 *bus_info, void *private);
222}; 218};
223 219
224 220
225/* Descriptor Leaf manipulation macros */ 221/* Descriptor Leaf manipulation macros */
226#define CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT 24 222#define CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT 24
227#define CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK 0xffffff 223#define CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK 0xffffff
228#define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t)) 224#define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u32))
229 225
230#define CSR1212_DESCRIPTOR_LEAF_TYPE(kv) \ 226#define CSR1212_DESCRIPTOR_LEAF_TYPE(kv) \
231 (be32_to_cpu((kv)->value.leaf.data[0]) >> CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT) 227 (be32_to_cpu((kv)->value.leaf.data[0]) >> CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT)
@@ -240,7 +236,7 @@ struct csr1212_bus_ops {
240#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT 16 236#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_SHIFT 16
241#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK 0xfff /* after shift */ 237#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET_MASK 0xfff /* after shift */
242#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK 0xffff 238#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK 0xffff
243#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u_int32_t)) 239#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u32))
244 240
245#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) \ 241#define CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) \
246 (be32_to_cpu((kv)->value.leaf.data[1]) >> \ 242 (be32_to_cpu((kv)->value.leaf.data[1]) >> \
@@ -264,7 +260,7 @@ extern struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops,
264 size_t bus_info_size, 260 size_t bus_info_size,
265 void *private); 261 void *private);
266extern void csr1212_init_local_csr(struct csr1212_csr *csr, 262extern void csr1212_init_local_csr(struct csr1212_csr *csr,
267 const u_int32_t *bus_info_data, int max_rom); 263 const u32 *bus_info_data, int max_rom);
268 264
269 265
270/* Destroy a Configuration ROM tree and release all memory taken by the tree. */ 266/* Destroy a Configuration ROM tree and release all memory taken by the tree. */
@@ -275,8 +271,8 @@ extern void csr1212_destroy_csr(struct csr1212_csr *csr);
275 * a Configuration ROM tree. Code that creates new keyvals with these functions 271 * a Configuration ROM tree. Code that creates new keyvals with these functions
276 * must release those keyvals with csr1212_release_keyval() when they are no 272 * must release those keyvals with csr1212_release_keyval() when they are no
277 * longer needed. */ 273 * longer needed. */
278extern struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value); 274extern struct csr1212_keyval *csr1212_new_immediate(u8 key, u32 value);
279extern struct csr1212_keyval *csr1212_new_directory(u_int8_t key); 275extern struct csr1212_keyval *csr1212_new_directory(u8 key);
280extern struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s); 276extern struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s);
281 277
282 278
@@ -306,8 +302,8 @@ extern int csr1212_generate_csr_image(struct csr1212_csr *csr);
306 302
307/* This is a convience function for reading a block of data out of one of the 303/* This is a convience function for reading a block of data out of one of the
308 * caches in the csr->cache_head list. */ 304 * caches in the csr->cache_head list. */
309extern int csr1212_read(struct csr1212_csr *csr, u_int32_t offset, void *buffer, 305extern int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer,
310 u_int32_t len); 306 u32 len);
311 307
312 308
313/* The following functions are in place for parsing Configuration ROM images. 309/* The following functions are in place for parsing Configuration ROM images.
@@ -324,7 +320,7 @@ extern void _csr1212_destroy_keyval(struct csr1212_keyval *kv);
324 320
325/* This function allocates a new cache which may be used for either parsing or 321/* This function allocates a new cache which may be used for either parsing or
326 * generating sub-sets of Configuration ROM images. */ 322 * generating sub-sets of Configuration ROM images. */
327static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u_int32_t offset, 323static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u32 offset,
328 size_t size) 324 size_t size)
329{ 325{
330 struct csr1212_csr_rom_cache *cache; 326 struct csr1212_csr_rom_cache *cache;