diff options
author | Justin T. Gibbs <gibbs@FreeBSD.org> | 1997-09-27 19:37:31 +0000 |
---|---|---|
committer | Justin T. Gibbs <gibbs@FreeBSD.org> | 1997-09-27 19:37:31 +0000 |
commit | 37507c1bd221fb20e635a1301f7a55c7aa008d21 (patch) | |
tree | eb5d9813a8327e6725fe7e3ac42c1fe3dc509f08 /sys/dev/aic7xxx/aicasm/aicasm_gram.y | |
parent | f0d4fed251afdd6bd6174984308076273944edfb (diff) |
Add support to aicasm for "downloaded constants". These are immediate
operands that are set during seqeuncer program download instead of at
assembly time.
Convert the sequencer code to use" downloaded constants" for four run time
constants that vary depending on the board type. This frees up 4 bytes
of sequencer scratch ram space where these constants used to be stored and
also removes the additional instructions required to load their values
into the accumulator prior to using them.
Remove the REJBYTE sram variable. The host driver can just as easly
read the accumulator to get this value.
The scratch ram savings is important as the old code used to clober the
SCSICONF register on 274X cards which sits near the top of scratch ram
space. The SCSICONF register controls bus termination, and clobbering
it is not a good thing. Now we have 4 bytes to spare.
This should fix the reported problems with cards that don't have devices
attached to them failing with a stream of "Somone reset bus X" messages.
Doug Ledford determined the cause of the problem, fixes by me.
Notes
Notes:
svn path=/head/; revision=29897
Diffstat (limited to 'sys/dev/aic7xxx/aicasm/aicasm_gram.y')
-rw-r--r-- | sys/dev/aic7xxx/aicasm/aicasm_gram.y | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/sys/dev/aic7xxx/aicasm/aicasm_gram.y b/sys/dev/aic7xxx/aicasm/aicasm_gram.y index 24f8cc9b31f2..fa657c02f0c8 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_gram.y +++ b/sys/dev/aic7xxx/aicasm/aicasm_gram.y @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aicasm_gram.y,v 1.2 1997/06/27 19:38:49 gibbs Exp $ + * $Id: aicasm_gram.y,v 1.3 1997/09/03 03:44:40 gibbs Exp $ */ #include <stdio.h> @@ -55,6 +55,7 @@ static symbol_ref_t none; static symbol_ref_t sindex; static int instruction_ptr; static int sram_or_scb_offset; +static int download_constant_count; static patch_t *cur_patch; static void process_bitmask __P((int mask_type, symbol_t *sym, int mask)); @@ -74,6 +75,7 @@ static void type_check __P((symbol_t *symbol, expression_t *expression, int and_op)); static void make_expression __P((expression_t *immed, int value)); static void add_conditional __P((symbol_t *symbol)); +static int is_download_const __P((expression_t *immed)); #define YYDEBUG 1 #define SRAM_SYMNAME "SRAM_BASE" @@ -92,6 +94,8 @@ static void add_conditional __P((symbol_t *symbol)); %token <value> T_CONST +%token T_DOWNLOAD + %token T_SCB %token T_SRAM @@ -154,6 +158,8 @@ static void add_conditional __P((symbol_t *symbol)); %type <value> ret f1_opcode f2_opcode jmp_jc_jnc_call jz_jnz je_jne +%type <value> numerical_value + %left '|' %left '&' %left '+' '-' @@ -422,6 +428,7 @@ expression: case BIT: $$.value = symbol->info.minfo->mask; break; + case DOWNLOAD_CONST: case CONST: $$.value = symbol->info.cinfo->value; break; @@ -444,10 +451,10 @@ expression: ; constant: - T_CONST T_SYMBOL T_NUMBER + T_CONST T_SYMBOL numerical_value { if ($2->type != UNINITIALIZED) { - stop("Re-definition of constant variable", + stop("Re-definition of symbol as a constant", EX_DATAERR); /* NOTREACHED */ } @@ -456,6 +463,34 @@ constant: $2->info.cinfo->value = $3; $2->info.cinfo->define = $1; } +| T_CONST T_SYMBOL T_DOWNLOAD + { + if ($1) { + stop("Invalid downloaded constant declaration", + EX_DATAERR); + /* NOTREACHED */ + } + if ($2->type != UNINITIALIZED) { + stop("Re-definition of symbol as a downloaded constant", + EX_DATAERR); + /* NOTREACHED */ + } + $2->type = DOWNLOAD_CONST; + initialize_symbol($2); + $2->info.cinfo->value = download_constant_count++; + $2->info.cinfo->define = FALSE; + } +; + +numerical_value: + T_NUMBER + { + $$ = $1; + } +| '-' T_NUMBER + { + $$ = -$2; + } ; scratch_ram: @@ -997,6 +1032,7 @@ initialize_symbol(symbol) SLIST_INIT(&(symbol->info.minfo->symrefs)); break; case CONST: + case DOWNLOAD_CONST: symbol->info.cinfo = (struct const_info *)malloc(sizeof(struct const_info)); if (symbol->info.cinfo == NULL) { @@ -1088,6 +1124,10 @@ format_1_instr(opcode, dest, immed, src, ret) f1_instr->source = src->symbol->info.rinfo->address + src->offset; f1_instr->immediate = immed->value; + + if (is_download_const(immed)) + f1_instr->opcode_ret |= DOWNLOAD_CONST_IMMEDIATE; + symlist_free(&immed->referenced_syms); instruction_ptr++; } @@ -1191,6 +1231,10 @@ format_3_instr(opcode, src, immed, address) f3_instr->source = src->symbol->info.rinfo->address + src->offset; f3_instr->immediate = immed->value; + + if (is_download_const(immed)) + f3_instr->opcode_addr |= DOWNLOAD_CONST_IMMEDIATE; + symlist_free(&immed->referenced_syms); instruction_ptr++; } @@ -1230,6 +1274,7 @@ type_check(symbol, expression, opcode) and_op = FALSE; if (opcode == AIC_OP_AND || opcode == AIC_OP_JNZ || AIC_OP_JZ) and_op = TRUE; + /* * Make sure that we aren't attempting to write something * that hasn't been defined. If this is an and operation, @@ -1302,3 +1347,14 @@ yyerror(string) { stop(string, EX_DATAERR); } + +static int +is_download_const(immed) + expression_t *immed; +{ + if ((immed->referenced_syms.slh_first != NULL) + && (immed->referenced_syms.slh_first->symbol->type == DOWNLOAD_CONST)) + return (TRUE); + + return (FALSE); +} |