diff options
Diffstat (limited to 'drivers/ieee1394/csr1212.c')
-rw-r--r-- | drivers/ieee1394/csr1212.c | 93 |
1 files changed, 45 insertions, 48 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; |