diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-11 17:49:34 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-04-29 18:00:28 -0400 |
commit | 982610bd0d8e64baff36099f6dc456ea52d22257 (patch) | |
tree | 23e74575c2e8cb11b84de9e2f685e87d4f28dbe8 | |
parent | 7fb9addba8ebd67306099e7fa629ff76c1be2105 (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>
-rw-r--r-- | drivers/ieee1394/csr1212.c | 93 | ||||
-rw-r--r-- | drivers/ieee1394/csr1212.h | 62 |
2 files changed, 74 insertions, 81 deletions
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index f5867236255b..65be507f4ee3 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #define __C (1 << CSR1212_KV_TYPE_CSR_OFFSET) | 45 | #define __C (1 << CSR1212_KV_TYPE_CSR_OFFSET) |
46 | #define __D (1 << CSR1212_KV_TYPE_DIRECTORY) | 46 | #define __D (1 << CSR1212_KV_TYPE_DIRECTORY) |
47 | #define __L (1 << CSR1212_KV_TYPE_LEAF) | 47 | #define __L (1 << CSR1212_KV_TYPE_LEAF) |
48 | static const u_int8_t csr1212_key_id_type_map[0x30] = { | 48 | static const u8 csr1212_key_id_type_map[0x30] = { |
49 | __C, /* used by Apple iSight */ | 49 | __C, /* used by Apple iSight */ |
50 | __D | __L, /* Descriptor */ | 50 | __D | __L, /* Descriptor */ |
51 | __I | __D | __L, /* Bus_Dependent_Info */ | 51 | __I | __D | __L, /* Bus_Dependent_Info */ |
@@ -81,8 +81,8 @@ static const u_int8_t csr1212_key_id_type_map[0x30] = { | |||
81 | #undef __L | 81 | #undef __L |
82 | 82 | ||
83 | 83 | ||
84 | #define quads_to_bytes(_q) ((_q) * sizeof(u_int32_t)) | 84 | #define quads_to_bytes(_q) ((_q) * sizeof(u32)) |
85 | #define bytes_to_quads(_b) (((_b) + sizeof(u_int32_t) - 1) / sizeof(u_int32_t)) | 85 | #define bytes_to_quads(_b) (((_b) + sizeof(u32) - 1) / sizeof(u32)) |
86 | 86 | ||
87 | static void free_keyval(struct csr1212_keyval *kv) | 87 | static void free_keyval(struct csr1212_keyval *kv) |
88 | { | 88 | { |
@@ -93,11 +93,11 @@ static void free_keyval(struct csr1212_keyval *kv) | |||
93 | CSR1212_FREE(kv); | 93 | CSR1212_FREE(kv); |
94 | } | 94 | } |
95 | 95 | ||
96 | static u_int16_t csr1212_crc16(const u_int32_t *buffer, size_t length) | 96 | static u16 csr1212_crc16(const u32 *buffer, size_t length) |
97 | { | 97 | { |
98 | int shift; | 98 | int shift; |
99 | u_int32_t data; | 99 | u32 data; |
100 | u_int16_t sum, crc = 0; | 100 | u16 sum, crc = 0; |
101 | 101 | ||
102 | for (; length; length--) { | 102 | for (; length; length--) { |
103 | data = be32_to_cpu(*buffer); | 103 | data = be32_to_cpu(*buffer); |
@@ -116,11 +116,11 @@ static u_int16_t csr1212_crc16(const u_int32_t *buffer, size_t length) | |||
116 | /* Microsoft computes the CRC with the bytes in reverse order. Therefore we | 116 | /* Microsoft computes the CRC with the bytes in reverse order. Therefore we |
117 | * have a special version of the CRC algorithm to account for their buggy | 117 | * have a special version of the CRC algorithm to account for their buggy |
118 | * software. */ | 118 | * software. */ |
119 | static u_int16_t csr1212_msft_crc16(const u_int32_t *buffer, size_t length) | 119 | static u16 csr1212_msft_crc16(const u32 *buffer, size_t length) |
120 | { | 120 | { |
121 | int shift; | 121 | int shift; |
122 | u_int32_t data; | 122 | u32 data; |
123 | u_int16_t sum, crc = 0; | 123 | u16 sum, crc = 0; |
124 | 124 | ||
125 | for (; length; length--) { | 125 | for (; length; length--) { |
126 | data = le32_to_cpu(*buffer); | 126 | data = le32_to_cpu(*buffer); |
@@ -150,7 +150,7 @@ csr1212_find_keyval(struct csr1212_keyval *dir, struct csr1212_keyval *kv) | |||
150 | } | 150 | } |
151 | 151 | ||
152 | static struct csr1212_keyval * | 152 | static struct csr1212_keyval * |
153 | csr1212_find_keyval_offset(struct csr1212_keyval *kv_list, u_int32_t offset) | 153 | csr1212_find_keyval_offset(struct csr1212_keyval *kv_list, u32 offset) |
154 | { | 154 | { |
155 | struct csr1212_keyval *kv; | 155 | struct csr1212_keyval *kv; |
156 | 156 | ||
@@ -202,7 +202,7 @@ struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops, | |||
202 | } | 202 | } |
203 | 203 | ||
204 | void csr1212_init_local_csr(struct csr1212_csr *csr, | 204 | void csr1212_init_local_csr(struct csr1212_csr *csr, |
205 | const u_int32_t *bus_info_data, int max_rom) | 205 | const u32 *bus_info_data, int max_rom) |
206 | { | 206 | { |
207 | static const int mr_map[] = { 4, 64, 1024, 0 }; | 207 | static const int mr_map[] = { 4, 64, 1024, 0 }; |
208 | 208 | ||
@@ -211,7 +211,7 @@ void csr1212_init_local_csr(struct csr1212_csr *csr, | |||
211 | memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len); | 211 | memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len); |
212 | } | 212 | } |
213 | 213 | ||
214 | static struct csr1212_keyval *csr1212_new_keyval(u_int8_t type, u_int8_t key) | 214 | static struct csr1212_keyval *csr1212_new_keyval(u8 type, u8 key) |
215 | { | 215 | { |
216 | struct csr1212_keyval *kv; | 216 | struct csr1212_keyval *kv; |
217 | 217 | ||
@@ -235,7 +235,7 @@ static struct csr1212_keyval *csr1212_new_keyval(u_int8_t type, u_int8_t key) | |||
235 | return kv; | 235 | return kv; |
236 | } | 236 | } |
237 | 237 | ||
238 | struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value) | 238 | struct csr1212_keyval *csr1212_new_immediate(u8 key, u32 value) |
239 | { | 239 | { |
240 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_IMMEDIATE, key); | 240 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_IMMEDIATE, key); |
241 | 241 | ||
@@ -248,7 +248,7 @@ struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value) | |||
248 | } | 248 | } |
249 | 249 | ||
250 | static struct csr1212_keyval * | 250 | static struct csr1212_keyval * |
251 | csr1212_new_leaf(u_int8_t key, const void *data, size_t data_len) | 251 | csr1212_new_leaf(u8 key, const void *data, size_t data_len) |
252 | { | 252 | { |
253 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_LEAF, key); | 253 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_LEAF, key); |
254 | 254 | ||
@@ -276,7 +276,7 @@ csr1212_new_leaf(u_int8_t key, const void *data, size_t data_len) | |||
276 | } | 276 | } |
277 | 277 | ||
278 | static struct csr1212_keyval * | 278 | static struct csr1212_keyval * |
279 | csr1212_new_csr_offset(u_int8_t key, u_int32_t csr_offset) | 279 | csr1212_new_csr_offset(u8 key, u32 csr_offset) |
280 | { | 280 | { |
281 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_CSR_OFFSET, key); | 281 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_CSR_OFFSET, key); |
282 | 282 | ||
@@ -290,7 +290,7 @@ csr1212_new_csr_offset(u_int8_t key, u_int32_t csr_offset) | |||
290 | return kv; | 290 | return kv; |
291 | } | 291 | } |
292 | 292 | ||
293 | struct csr1212_keyval *csr1212_new_directory(u_int8_t key) | 293 | struct csr1212_keyval *csr1212_new_directory(u8 key) |
294 | { | 294 | { |
295 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_DIRECTORY, key); | 295 | struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_DIRECTORY, key); |
296 | 296 | ||
@@ -387,7 +387,7 @@ int csr1212_attach_keyval_to_directory(struct csr1212_keyval *dir, | |||
387 | ((spec_id) & CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK))) | 387 | ((spec_id) & CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK))) |
388 | 388 | ||
389 | static struct csr1212_keyval * | 389 | static struct csr1212_keyval * |
390 | csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id, | 390 | csr1212_new_descriptor_leaf(u8 dtype, u32 specifier_id, |
391 | const void *data, size_t data_len) | 391 | const void *data, size_t data_len) |
392 | { | 392 | { |
393 | struct csr1212_keyval *kv; | 393 | struct csr1212_keyval *kv; |
@@ -432,9 +432,8 @@ csr1212_new_descriptor_leaf(u_int8_t dtype, u_int32_t specifier_id, | |||
432 | CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK))) | 432 | CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE_MASK))) |
433 | 433 | ||
434 | static struct csr1212_keyval * | 434 | static struct csr1212_keyval * |
435 | csr1212_new_textual_descriptor_leaf(u_int8_t cwidth, u_int16_t cset, | 435 | csr1212_new_textual_descriptor_leaf(u8 cwidth, u16 cset, u16 language, |
436 | u_int16_t language, const void *data, | 436 | const void *data, size_t data_len) |
437 | size_t data_len) | ||
438 | { | 437 | { |
439 | struct csr1212_keyval *kv; | 438 | struct csr1212_keyval *kv; |
440 | char *lstr; | 439 | char *lstr; |
@@ -451,7 +450,7 @@ csr1212_new_textual_descriptor_leaf(u_int8_t cwidth, u_int16_t cset, | |||
451 | lstr = (char*)CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(kv); | 450 | lstr = (char*)CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA(kv); |
452 | 451 | ||
453 | /* make sure last quadlet is zeroed out */ | 452 | /* make sure last quadlet is zeroed out */ |
454 | *((u_int32_t*)&(lstr[(data_len - 1) & ~0x3])) = 0; | 453 | *((u32*)&(lstr[(data_len - 1) & ~0x3])) = 0; |
455 | 454 | ||
456 | /* don't copy the NUL terminator */ | 455 | /* don't copy the NUL terminator */ |
457 | memcpy(lstr, data, data_len); | 456 | memcpy(lstr, data, data_len); |
@@ -610,7 +609,7 @@ void csr1212_destroy_csr(struct csr1212_csr *csr) | |||
610 | static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize) | 609 | static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize) |
611 | { | 610 | { |
612 | struct csr1212_csr_rom_cache *cache; | 611 | struct csr1212_csr_rom_cache *cache; |
613 | u_int64_t csr_addr; | 612 | u64 csr_addr; |
614 | 613 | ||
615 | if (!csr || !csr->ops || !csr->ops->allocate_addr_range || | 614 | if (!csr || !csr->ops || !csr->ops->allocate_addr_range || |
616 | !csr->ops->release_addr || csr->max_rom < 1) | 615 | !csr->ops->release_addr || csr->max_rom < 1) |
@@ -824,7 +823,7 @@ csr1212_generate_positions(struct csr1212_csr_rom_cache *cache, | |||
824 | #define CSR1212_KV_KEY_TYPE_MASK 0x3 /* after shift */ | 823 | #define CSR1212_KV_KEY_TYPE_MASK 0x3 /* after shift */ |
825 | 824 | ||
826 | static void | 825 | static void |
827 | csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer) | 826 | csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u32 *data_buffer) |
828 | { | 827 | { |
829 | struct csr1212_dentry *dentry; | 828 | struct csr1212_dentry *dentry; |
830 | struct csr1212_keyval *last_extkey_spec = NULL; | 829 | struct csr1212_keyval *last_extkey_spec = NULL; |
@@ -835,7 +834,7 @@ csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer) | |||
835 | struct csr1212_keyval *a; | 834 | struct csr1212_keyval *a; |
836 | 835 | ||
837 | for (a = dentry->kv; a; a = a->associate) { | 836 | for (a = dentry->kv; a; a = a->associate) { |
838 | u_int32_t value = 0; | 837 | u32 value = 0; |
839 | 838 | ||
840 | /* Special Case: Extended Key Specifier_ID */ | 839 | /* Special Case: Extended Key Specifier_ID */ |
841 | if (a->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) { | 840 | if (a->key.id == CSR1212_KV_ID_EXTENDED_KEY_SPECIFIER_ID) { |
@@ -889,11 +888,11 @@ csr1212_generate_tree_subdir(struct csr1212_keyval *dir, u_int32_t *data_buffer) | |||
889 | } | 888 | } |
890 | 889 | ||
891 | struct csr1212_keyval_img { | 890 | struct csr1212_keyval_img { |
892 | u_int16_t length; | 891 | u16 length; |
893 | u_int16_t crc; | 892 | u16 crc; |
894 | 893 | ||
895 | /* Must be last */ | 894 | /* Must be last */ |
896 | csr1212_quad_t data[0]; /* older gcc can't handle [] which is standard */ | 895 | u32 data[0]; /* older gcc can't handle [] which is standard */ |
897 | }; | 896 | }; |
898 | 897 | ||
899 | static void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache) | 898 | static void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache) |
@@ -940,7 +939,7 @@ static void csr1212_fill_cache(struct csr1212_csr_rom_cache *cache) | |||
940 | } | 939 | } |
941 | } | 940 | } |
942 | 941 | ||
943 | #define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u_int32_t)) | 942 | #define CSR1212_EXTENDED_ROM_SIZE (0x10000 * sizeof(u32)) |
944 | 943 | ||
945 | int csr1212_generate_csr_image(struct csr1212_csr *csr) | 944 | int csr1212_generate_csr_image(struct csr1212_csr *csr) |
946 | { | 945 | { |
@@ -975,7 +974,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) | |||
975 | * regions needed (it assumes that the cache holding | 974 | * regions needed (it assumes that the cache holding |
976 | * the first 1K Config ROM space always exists). */ | 975 | * the first 1K Config ROM space always exists). */ |
977 | int est_c = agg_size / (CSR1212_EXTENDED_ROM_SIZE - | 976 | int est_c = agg_size / (CSR1212_EXTENDED_ROM_SIZE - |
978 | (2 * sizeof(u_int32_t))) + 1; | 977 | (2 * sizeof(u32))) + 1; |
979 | 978 | ||
980 | /* Add additional cache regions, extras will be | 979 | /* Add additional cache regions, extras will be |
981 | * removed later */ | 980 | * removed later */ |
@@ -992,7 +991,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) | |||
992 | } | 991 | } |
993 | kv = csr1212_generate_positions(cache, kv, init_offset); | 992 | kv = csr1212_generate_positions(cache, kv, init_offset); |
994 | agg_size -= cache->len; | 993 | agg_size -= cache->len; |
995 | init_offset = sizeof(u_int32_t); | 994 | init_offset = sizeof(u32); |
996 | } | 995 | } |
997 | 996 | ||
998 | /* Remove unused, excess cache regions */ | 997 | /* Remove unused, excess cache regions */ |
@@ -1022,7 +1021,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) | |||
1022 | leaf_size - cache->len); | 1021 | leaf_size - cache->len); |
1023 | 1022 | ||
1024 | /* Subtract leaf header */ | 1023 | /* Subtract leaf header */ |
1025 | leaf_size -= sizeof(u_int32_t); | 1024 | leaf_size -= sizeof(u32); |
1026 | 1025 | ||
1027 | /* Update the Extended ROM leaf length */ | 1026 | /* Update the Extended ROM leaf length */ |
1028 | cache->ext_rom->value.leaf.len = | 1027 | cache->ext_rom->value.leaf.len = |
@@ -1040,7 +1039,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) | |||
1040 | /* Set the length and CRC of the extended ROM. */ | 1039 | /* Set the length and CRC of the extended ROM. */ |
1041 | struct csr1212_keyval_img *kvi = | 1040 | struct csr1212_keyval_img *kvi = |
1042 | (struct csr1212_keyval_img*)cache->data; | 1041 | (struct csr1212_keyval_img*)cache->data; |
1043 | u_int16_t len = bytes_to_quads(cache->len) - 1; | 1042 | u16 len = bytes_to_quads(cache->len) - 1; |
1044 | 1043 | ||
1045 | kvi->length = cpu_to_be16(len); | 1044 | kvi->length = cpu_to_be16(len); |
1046 | kvi->crc = csr1212_crc16(kvi->data, len); | 1045 | kvi->crc = csr1212_crc16(kvi->data, len); |
@@ -1050,7 +1049,7 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) | |||
1050 | return CSR1212_SUCCESS; | 1049 | return CSR1212_SUCCESS; |
1051 | } | 1050 | } |
1052 | 1051 | ||
1053 | int csr1212_read(struct csr1212_csr *csr, u_int32_t offset, void *buffer, u_int32_t len) | 1052 | int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer, u32 len) |
1054 | { | 1053 | { |
1055 | struct csr1212_csr_rom_cache *cache; | 1054 | struct csr1212_csr_rom_cache *cache; |
1056 | 1055 | ||
@@ -1081,9 +1080,9 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1081 | * Unfortunately, many IEEE 1394 devices do not abide by that, so the | 1080 | * Unfortunately, many IEEE 1394 devices do not abide by that, so the |
1082 | * bus info block will be read 1 quadlet at a time. The rest of the | 1081 | * bus info block will be read 1 quadlet at a time. The rest of the |
1083 | * ConfigROM will be read according to the max_rom field. */ | 1082 | * ConfigROM will be read according to the max_rom field. */ |
1084 | for (i = 0; i < csr->bus_info_len; i += sizeof(csr1212_quad_t)) { | 1083 | for (i = 0; i < csr->bus_info_len; i += sizeof(u32)) { |
1085 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, | 1084 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, |
1086 | sizeof(csr1212_quad_t), | 1085 | sizeof(u32), |
1087 | &csr->cache_head->data[bytes_to_quads(i)], | 1086 | &csr->cache_head->data[bytes_to_quads(i)], |
1088 | csr->private); | 1087 | csr->private); |
1089 | if (ret != CSR1212_SUCCESS) | 1088 | if (ret != CSR1212_SUCCESS) |
@@ -1101,9 +1100,9 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1101 | 1100 | ||
1102 | /* IEEE 1212 recommends that crc_len be equal to bus_info_len, but that is not | 1101 | /* IEEE 1212 recommends that crc_len be equal to bus_info_len, but that is not |
1103 | * always the case, so read the rest of the crc area 1 quadlet at a time. */ | 1102 | * always the case, so read the rest of the crc area 1 quadlet at a time. */ |
1104 | for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(csr1212_quad_t)) { | 1103 | for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(u32)) { |
1105 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, | 1104 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, |
1106 | sizeof(csr1212_quad_t), | 1105 | sizeof(u32), |
1107 | &csr->cache_head->data[bytes_to_quads(i)], | 1106 | &csr->cache_head->data[bytes_to_quads(i)], |
1108 | csr->private); | 1107 | csr->private); |
1109 | if (ret != CSR1212_SUCCESS) | 1108 | if (ret != CSR1212_SUCCESS) |
@@ -1140,12 +1139,11 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1140 | #define CSR1212_KV_VAL(q) (be32_to_cpu(q) & CSR1212_KV_VAL_MASK) | 1139 | #define CSR1212_KV_VAL(q) (be32_to_cpu(q) & CSR1212_KV_VAL_MASK) |
1141 | 1140 | ||
1142 | static int csr1212_parse_dir_entry(struct csr1212_keyval *dir, | 1141 | static int csr1212_parse_dir_entry(struct csr1212_keyval *dir, |
1143 | csr1212_quad_t ki, | 1142 | u32 ki, u32 kv_pos) |
1144 | u_int32_t kv_pos) | ||
1145 | { | 1143 | { |
1146 | int ret = CSR1212_SUCCESS; | 1144 | int ret = CSR1212_SUCCESS; |
1147 | struct csr1212_keyval *k = NULL; | 1145 | struct csr1212_keyval *k = NULL; |
1148 | u_int32_t offset; | 1146 | u32 offset; |
1149 | 1147 | ||
1150 | switch(CSR1212_KV_KEY_TYPE(ki)) { | 1148 | switch(CSR1212_KV_KEY_TYPE(ki)) { |
1151 | case CSR1212_KV_TYPE_IMMEDIATE: | 1149 | case CSR1212_KV_TYPE_IMMEDIATE: |
@@ -1236,7 +1234,7 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv, | |||
1236 | switch(kv->key.type) { | 1234 | switch(kv->key.type) { |
1237 | case CSR1212_KV_TYPE_DIRECTORY: | 1235 | case CSR1212_KV_TYPE_DIRECTORY: |
1238 | for (i = 0; i < kvi_len; i++) { | 1236 | for (i = 0; i < kvi_len; i++) { |
1239 | csr1212_quad_t ki = kvi->data[i]; | 1237 | u32 ki = kvi->data[i]; |
1240 | 1238 | ||
1241 | /* Some devices put null entries in their unit | 1239 | /* Some devices put null entries in their unit |
1242 | * directories. If we come across such an entry, | 1240 | * directories. If we come across such an entry, |
@@ -1276,9 +1274,9 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1276 | struct csr1212_keyval_img *kvi = NULL; | 1274 | struct csr1212_keyval_img *kvi = NULL; |
1277 | struct csr1212_csr_rom_cache *cache; | 1275 | struct csr1212_csr_rom_cache *cache; |
1278 | int cache_index; | 1276 | int cache_index; |
1279 | u_int64_t addr; | 1277 | u64 addr; |
1280 | u_int32_t *cache_ptr; | 1278 | u32 *cache_ptr; |
1281 | u_int16_t kv_len = 0; | 1279 | u16 kv_len = 0; |
1282 | 1280 | ||
1283 | if (!csr || !kv || csr->max_rom < 1) | 1281 | if (!csr || !kv || csr->max_rom < 1) |
1284 | return -EINVAL; | 1282 | return -EINVAL; |
@@ -1292,8 +1290,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1292 | } | 1290 | } |
1293 | 1291 | ||
1294 | if (!cache) { | 1292 | if (!cache) { |
1295 | csr1212_quad_t q; | 1293 | u32 q, cache_size; |
1296 | u_int32_t cache_size; | ||
1297 | 1294 | ||
1298 | /* Only create a new cache for Extended ROM leaves. */ | 1295 | /* Only create a new cache for Extended ROM leaves. */ |
1299 | if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) | 1296 | if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) |
@@ -1301,7 +1298,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1301 | 1298 | ||
1302 | if (csr->ops->bus_read(csr, | 1299 | if (csr->ops->bus_read(csr, |
1303 | CSR1212_REGISTER_SPACE_BASE + kv->offset, | 1300 | CSR1212_REGISTER_SPACE_BASE + kv->offset, |
1304 | sizeof(csr1212_quad_t), &q, csr->private)) { | 1301 | sizeof(u32), &q, csr->private)) { |
1305 | return -EIO; | 1302 | return -EIO; |
1306 | } | 1303 | } |
1307 | 1304 | ||
@@ -1326,7 +1323,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1326 | } | 1323 | } |
1327 | 1324 | ||
1328 | cache->filled_head->offset_start = 0; | 1325 | cache->filled_head->offset_start = 0; |
1329 | cache->filled_head->offset_end = sizeof(csr1212_quad_t); | 1326 | cache->filled_head->offset_end = sizeof(u32); |
1330 | cache->filled_tail = cache->filled_head; | 1327 | cache->filled_tail = cache->filled_head; |
1331 | cache->filled_head->next = NULL; | 1328 | cache->filled_head->next = NULL; |
1332 | cache->filled_head->prev = NULL; | 1329 | cache->filled_head->prev = NULL; |
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 */ |
116 | struct csr1212_bus_info_block_img { | 116 | struct 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 | ||
125 | typedef u_int32_t csr1212_quad_t; | ||
126 | |||
127 | struct csr1212_leaf { | 125 | struct csr1212_leaf { |
128 | int len; | 126 | int len; |
129 | u_int32_t *data; | 127 | u32 *data; |
130 | }; | 128 | }; |
131 | 129 | ||
132 | struct csr1212_dentry { | 130 | struct csr1212_dentry { |
@@ -141,12 +139,12 @@ struct csr1212_directory { | |||
141 | 139 | ||
142 | struct csr1212_keyval { | 140 | struct 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 | ||
163 | struct csr1212_cache_region { | 161 | struct 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 | ||
169 | struct csr1212_csr_rom_cache { | 167 | struct 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 | ||
182 | struct csr1212_csr { | 180 | struct 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); |
266 | extern void csr1212_init_local_csr(struct csr1212_csr *csr, | 262 | extern 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. */ |
278 | extern struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value); | 274 | extern struct csr1212_keyval *csr1212_new_immediate(u8 key, u32 value); |
279 | extern struct csr1212_keyval *csr1212_new_directory(u_int8_t key); | 275 | extern struct csr1212_keyval *csr1212_new_directory(u8 key); |
280 | extern struct csr1212_keyval *csr1212_new_string_descriptor_leaf(const char *s); | 276 | extern 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. */ |
309 | extern int csr1212_read(struct csr1212_csr *csr, u_int32_t offset, void *buffer, | 305 | extern 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. */ |
327 | static inline struct csr1212_csr_rom_cache *csr1212_rom_cache_malloc(u_int32_t offset, | 323 | static 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; |