diff options
Diffstat (limited to 'drivers/scsi/aic7xxx/aicasm')
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm.c | 6 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm_gram.y | 12 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm_scan.l | 1 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c | 25 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h | 1 |
5 files changed, 36 insertions, 9 deletions
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c index 924102720b14..e4a778720301 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm.c +++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c | |||
@@ -362,7 +362,7 @@ output_code() | |||
362 | " *\n" | 362 | " *\n" |
363 | "%s */\n", versions); | 363 | "%s */\n", versions); |
364 | 364 | ||
365 | fprintf(ofile, "static uint8_t seqprog[] = {\n"); | 365 | fprintf(ofile, "static const uint8_t seqprog[] = {\n"); |
366 | for (cur_instr = STAILQ_FIRST(&seq_program); | 366 | for (cur_instr = STAILQ_FIRST(&seq_program); |
367 | cur_instr != NULL; | 367 | cur_instr != NULL; |
368 | cur_instr = STAILQ_NEXT(cur_instr, links)) { | 368 | cur_instr = STAILQ_NEXT(cur_instr, links)) { |
@@ -415,7 +415,7 @@ output_code() | |||
415 | } | 415 | } |
416 | 416 | ||
417 | fprintf(ofile, | 417 | fprintf(ofile, |
418 | "static struct patch {\n" | 418 | "static const struct patch {\n" |
419 | " %spatch_func_t *patch_func;\n" | 419 | " %spatch_func_t *patch_func;\n" |
420 | " uint32_t begin :10,\n" | 420 | " uint32_t begin :10,\n" |
421 | " skip_instr :10,\n" | 421 | " skip_instr :10,\n" |
@@ -435,7 +435,7 @@ output_code() | |||
435 | fprintf(ofile, "\n};\n\n"); | 435 | fprintf(ofile, "\n};\n\n"); |
436 | 436 | ||
437 | fprintf(ofile, | 437 | fprintf(ofile, |
438 | "static struct cs {\n" | 438 | "static const struct cs {\n" |
439 | " uint16_t begin;\n" | 439 | " uint16_t begin;\n" |
440 | " uint16_t end;\n" | 440 | " uint16_t end;\n" |
441 | "} critical_sections[] = {\n"); | 441 | "} critical_sections[] = {\n"); |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y index e1079dd3cc28..81be6a261cc8 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y | |||
@@ -143,6 +143,8 @@ void yyerror(const char *string); | |||
143 | 143 | ||
144 | %token <value> T_ADDRESS | 144 | %token <value> T_ADDRESS |
145 | 145 | ||
146 | %token T_COUNT | ||
147 | |||
146 | %token T_ACCESS_MODE | 148 | %token T_ACCESS_MODE |
147 | 149 | ||
148 | %token T_MODES | 150 | %token T_MODES |
@@ -353,6 +355,7 @@ reg_attribute_list: | |||
353 | reg_attribute: | 355 | reg_attribute: |
354 | reg_address | 356 | reg_address |
355 | | size | 357 | | size |
358 | | count | ||
356 | | access_mode | 359 | | access_mode |
357 | | modes | 360 | | modes |
358 | | field_defn | 361 | | field_defn |
@@ -393,6 +396,13 @@ size: | |||
393 | } | 396 | } |
394 | ; | 397 | ; |
395 | 398 | ||
399 | count: | ||
400 | T_COUNT T_NUMBER | ||
401 | { | ||
402 | cur_symbol->count += $2; | ||
403 | } | ||
404 | ; | ||
405 | |||
396 | access_mode: | 406 | access_mode: |
397 | T_ACCESS_MODE T_MODE | 407 | T_ACCESS_MODE T_MODE |
398 | { | 408 | { |
@@ -801,6 +811,7 @@ scratch_ram: | |||
801 | cur_symtype = SRAMLOC; | 811 | cur_symtype = SRAMLOC; |
802 | cur_symbol->type = SRAMLOC; | 812 | cur_symbol->type = SRAMLOC; |
803 | initialize_symbol(cur_symbol); | 813 | initialize_symbol(cur_symbol); |
814 | cur_symbol->count += 1; | ||
804 | } | 815 | } |
805 | reg_address | 816 | reg_address |
806 | { | 817 | { |
@@ -832,6 +843,7 @@ scb: | |||
832 | initialize_symbol(cur_symbol); | 843 | initialize_symbol(cur_symbol); |
833 | /* 64 bytes of SCB space */ | 844 | /* 64 bytes of SCB space */ |
834 | cur_symbol->info.rinfo->size = 64; | 845 | cur_symbol->info.rinfo->size = 64; |
846 | cur_symbol->count += 1; | ||
835 | } | 847 | } |
836 | reg_address | 848 | reg_address |
837 | { | 849 | { |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l index 62b6c1bc82c6..2c7f02daf88d 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l | |||
@@ -162,6 +162,7 @@ register { return T_REGISTER; } | |||
162 | const { yylval.value = FALSE; return T_CONST; } | 162 | const { yylval.value = FALSE; return T_CONST; } |
163 | download { return T_DOWNLOAD; } | 163 | download { return T_DOWNLOAD; } |
164 | address { return T_ADDRESS; } | 164 | address { return T_ADDRESS; } |
165 | count { return T_COUNT; } | ||
165 | access_mode { return T_ACCESS_MODE; } | 166 | access_mode { return T_ACCESS_MODE; } |
166 | modes { return T_MODES; } | 167 | modes { return T_MODES; } |
167 | RW|RO|WO { | 168 | RW|RO|WO { |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c index f1f448dff569..fcd357872b43 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c | |||
@@ -77,6 +77,7 @@ symbol_create(char *name) | |||
77 | if (new_symbol->name == NULL) | 77 | if (new_symbol->name == NULL) |
78 | stop("Unable to strdup symbol name", EX_SOFTWARE); | 78 | stop("Unable to strdup symbol name", EX_SOFTWARE); |
79 | new_symbol->type = UNINITIALIZED; | 79 | new_symbol->type = UNINITIALIZED; |
80 | new_symbol->count = 1; | ||
80 | return (new_symbol); | 81 | return (new_symbol); |
81 | } | 82 | } |
82 | 83 | ||
@@ -198,6 +199,12 @@ symtable_get(char *name) | |||
198 | } | 199 | } |
199 | } | 200 | } |
200 | memcpy(&stored_ptr, data.data, sizeof(stored_ptr)); | 201 | memcpy(&stored_ptr, data.data, sizeof(stored_ptr)); |
202 | stored_ptr->count++; | ||
203 | data.data = &stored_ptr; | ||
204 | if (symtable->put(symtable, &key, &data, /*flags*/0) !=0) { | ||
205 | perror("Symtable put failed"); | ||
206 | exit(EX_SOFTWARE); | ||
207 | } | ||
201 | return (stored_ptr); | 208 | return (stored_ptr); |
202 | } | 209 | } |
203 | 210 | ||
@@ -256,7 +263,7 @@ symlist_add(symlist_t *symlist, symbol_t *symbol, int how) | |||
256 | && (curnode->symbol->info.finfo->value > | 263 | && (curnode->symbol->info.finfo->value > |
257 | newnode->symbol->info.finfo->value)))) | 264 | newnode->symbol->info.finfo->value)))) |
258 | || (!field && (curnode->symbol->info.rinfo->address > | 265 | || (!field && (curnode->symbol->info.rinfo->address > |
259 | newnode->symbol->info.rinfo->address))) { | 266 | newnode->symbol->info.rinfo->address))) { |
260 | SLIST_INSERT_HEAD(symlist, newnode, links); | 267 | SLIST_INSERT_HEAD(symlist, newnode, links); |
261 | return; | 268 | return; |
262 | } | 269 | } |
@@ -271,7 +278,7 @@ symlist_add(symlist_t *symlist, symbol_t *symbol, int how) | |||
271 | 278 | ||
272 | cursymbol = SLIST_NEXT(curnode, links)->symbol; | 279 | cursymbol = SLIST_NEXT(curnode, links)->symbol; |
273 | if ((field | 280 | if ((field |
274 | && (cursymbol->type > symbol->type | 281 | && (cursymbol->type > symbol->type |
275 | || (cursymbol->type == symbol->type | 282 | || (cursymbol->type == symbol->type |
276 | && (cursymbol->info.finfo->value > | 283 | && (cursymbol->info.finfo->value > |
277 | symbol->info.finfo->value)))) | 284 | symbol->info.finfo->value)))) |
@@ -351,7 +358,7 @@ aic_print_reg_dump_types(FILE *ofile) | |||
351 | { | 358 | { |
352 | if (ofile == NULL) | 359 | if (ofile == NULL) |
353 | return; | 360 | return; |
354 | 361 | ||
355 | fprintf(ofile, | 362 | fprintf(ofile, |
356 | "typedef int (%sreg_print_t)(u_int, u_int *, u_int);\n" | 363 | "typedef int (%sreg_print_t)(u_int, u_int *, u_int);\n" |
357 | "typedef struct %sreg_parse_entry {\n" | 364 | "typedef struct %sreg_parse_entry {\n" |
@@ -370,7 +377,7 @@ aic_print_reg_dump_start(FILE *dfile, symbol_node_t *regnode) | |||
370 | return; | 377 | return; |
371 | 378 | ||
372 | fprintf(dfile, | 379 | fprintf(dfile, |
373 | "static %sreg_parse_entry_t %s_parse_table[] = {\n", | 380 | "static const %sreg_parse_entry_t %s_parse_table[] = {\n", |
374 | prefix, | 381 | prefix, |
375 | regnode->symbol->name); | 382 | regnode->symbol->name); |
376 | } | 383 | } |
@@ -385,7 +392,7 @@ aic_print_reg_dump_end(FILE *ofile, FILE *dfile, | |||
385 | lower_name = strdup(regnode->symbol->name); | 392 | lower_name = strdup(regnode->symbol->name); |
386 | if (lower_name == NULL) | 393 | if (lower_name == NULL) |
387 | stop("Unable to strdup symbol name", EX_SOFTWARE); | 394 | stop("Unable to strdup symbol name", EX_SOFTWARE); |
388 | 395 | ||
389 | for (letter = lower_name; *letter != '\0'; letter++) | 396 | for (letter = lower_name; *letter != '\0'; letter++) |
390 | *letter = tolower(*letter); | 397 | *letter = tolower(*letter); |
391 | 398 | ||
@@ -472,6 +479,7 @@ symtable_dump(FILE *ofile, FILE *dfile) | |||
472 | DBT key; | 479 | DBT key; |
473 | DBT data; | 480 | DBT data; |
474 | int flag; | 481 | int flag; |
482 | int reg_count = 0, reg_used = 0; | ||
475 | u_int i; | 483 | u_int i; |
476 | 484 | ||
477 | if (symtable == NULL) | 485 | if (symtable == NULL) |
@@ -541,6 +549,9 @@ symtable_dump(FILE *ofile, FILE *dfile) | |||
541 | int num_entries; | 549 | int num_entries; |
542 | 550 | ||
543 | num_entries = 0; | 551 | num_entries = 0; |
552 | reg_count++; | ||
553 | if (curnode->symbol->count == 1) | ||
554 | break; | ||
544 | fields = &curnode->symbol->info.rinfo->fields; | 555 | fields = &curnode->symbol->info.rinfo->fields; |
545 | SLIST_FOREACH(fieldnode, fields, links) { | 556 | SLIST_FOREACH(fieldnode, fields, links) { |
546 | if (num_entries == 0) | 557 | if (num_entries == 0) |
@@ -553,11 +564,14 @@ symtable_dump(FILE *ofile, FILE *dfile) | |||
553 | } | 564 | } |
554 | aic_print_reg_dump_end(ofile, dfile, | 565 | aic_print_reg_dump_end(ofile, dfile, |
555 | curnode, num_entries); | 566 | curnode, num_entries); |
567 | reg_used++; | ||
556 | } | 568 | } |
557 | default: | 569 | default: |
558 | break; | 570 | break; |
559 | } | 571 | } |
560 | } | 572 | } |
573 | fprintf(stderr, "%s: %d of %d register definitions used\n", appname, | ||
574 | reg_used, reg_count); | ||
561 | 575 | ||
562 | /* Fold in the masks and bits */ | 576 | /* Fold in the masks and bits */ |
563 | while (SLIST_FIRST(&masks) != NULL) { | 577 | while (SLIST_FIRST(&masks) != NULL) { |
@@ -646,7 +660,6 @@ symtable_dump(FILE *ofile, FILE *dfile) | |||
646 | free(curnode); | 660 | free(curnode); |
647 | } | 661 | } |
648 | 662 | ||
649 | |||
650 | fprintf(ofile, "\n\n/* Downloaded Constant Definitions */\n"); | 663 | fprintf(ofile, "\n\n/* Downloaded Constant Definitions */\n"); |
651 | 664 | ||
652 | for (i = 0; SLIST_FIRST(&download_constants) != NULL; i++) { | 665 | for (i = 0; SLIST_FIRST(&download_constants) != NULL; i++) { |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h index afc22e8b4903..05190c1a2fb7 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h | |||
@@ -128,6 +128,7 @@ typedef struct expression_info { | |||
128 | typedef struct symbol { | 128 | typedef struct symbol { |
129 | char *name; | 129 | char *name; |
130 | symtype type; | 130 | symtype type; |
131 | int count; | ||
131 | union { | 132 | union { |
132 | struct reg_info *rinfo; | 133 | struct reg_info *rinfo; |
133 | struct field_info *finfo; | 134 | struct field_info *finfo; |