diff options
| author | Justin T. Gibbs <gibbs@FreeBSD.org> | 1997-09-27 19:47:12 +0000 |
|---|---|---|
| committer | Justin T. Gibbs <gibbs@FreeBSD.org> | 1997-09-27 19:47:12 +0000 |
| commit | fb67aa37496802246c3c849b063048fbfb5c2859 (patch) | |
| tree | bd25c68d609b8a5bba74ffc561e2673f2b5c7af8 /sys/dev | |
| parent | a0bda0f5bb686c1d116ebee5b7ca0f8c7454747e (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/aic7xxx/Makefile | 9 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/aic7xxx.reg | 53 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/aic7xxx.seq | 15 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/aicasm_gram.y | 62 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/aicasm_scan.l | 3 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/aicasm_symbol.c | 24 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/aicasm_symbol.h | 3 | ||||
| -rw-r--r-- | sys/dev/aic7xxx/sequencer.h | 3 |
8 files changed, 117 insertions, 55 deletions
diff --git a/sys/dev/aic7xxx/Makefile b/sys/dev/aic7xxx/Makefile index 6e130fd57a80..7a38db79ec78 100644 --- a/sys/dev/aic7xxx/Makefile +++ b/sys/dev/aic7xxx/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1.2.1 1997/04/04 04:35:28 gibbs Exp $ +# $Id: Makefile,v 1.1.2.2 1997/09/03 04:25:04 gibbs Exp $ PROG= aicasm @@ -21,4 +21,11 @@ DEPENDFILE= CFLAGS+= -I. NOMAN= noman + +.ifdef DEBUG +CFLAGS+= -DDEBUG -g +YFLAGS+= -t +LFLAGS+= -d +.endif + .include <bsd.prog.mk> diff --git a/sys/dev/aic7xxx/aic7xxx.reg b/sys/dev/aic7xxx/aic7xxx.reg index 5279eb65462b..792799a0c1d4 100644 --- a/sys/dev/aic7xxx/aic7xxx.reg +++ b/sys/dev/aic7xxx/aic7xxx.reg @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aic7xxx.reg,v 1.1.2.2 1997/04/24 16:52:48 gibbs Exp $ + * $Id: aic7xxx.reg,v 1.1.2.3 1997/08/13 18:56:44 gibbs Exp $ */ /* @@ -949,28 +949,6 @@ scratch_ram { bit FIFOFLUSH 0x02 bit FIFORESET 0x01 } - /* - * Number of SCBs supported by - * this card. - */ - SCBCOUNT { - size 1 - } - /* - * Two's complement of SCBCOUNT - */ - COMP_SCBCOUNT { - size 1 - } - /* - * Mask of bits to test against - * when looking at the Queue Count - * registers. Works around a bug - * on aic7850 chips. - */ - QCNTMASK { - size 1 - } SEQ_FLAGS { size 1 bit RESELECTED 0x80 @@ -1010,13 +988,6 @@ scratch_ram { size 1 } /* - * The sequencer will stick the frist byte of any rejected message here - * so we can see what is getting thrown away. - */ - REJBYTE { - size 1 - } - /* * The last bus phase as seen by the sequencer. */ LASTPHASE { @@ -1080,13 +1051,6 @@ scratch_ram { CMDOUTCNT { size 1 } - /* - * Maximum number of entries allowed in - * the QOUT/INFIFO. - */ - FIFODEPTH { - size 1 - } ARG_1 { size 1 mask SEND_MSG 0x80 @@ -1126,3 +1090,18 @@ const BUS_16_BIT 0x01 const BUS_32_BIT 0x02 const MAX_OFFSET_8BIT 0x0f const MAX_OFFSET_16BIT 0x08 + +/* + * Downloaded (kernel inserted) constants + */ +const SCBCOUNT download /* The number of SCBs on this card */ +const COMP_SCBCOUNT download /* Two's complement of max SCBID */ +/* + * The maximum number of entries allowed in the QIN/OUTFIFO. + */ +const FIFODEPTH download /* Two's complement of SCBCOUNT */ +/* + * Mask of bits to test against when looking at the Queue Count + * registers. Works around a bug on aic7850 chips. + */ +const QCNTMASK download diff --git a/sys/dev/aic7xxx/aic7xxx.seq b/sys/dev/aic7xxx/aic7xxx.seq index 46b67f1226f9..0c225f96a974 100644 --- a/sys/dev/aic7xxx/aic7xxx.seq +++ b/sys/dev/aic7xxx/aic7xxx.seq @@ -37,7 +37,7 @@ *OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *SUCH DAMAGE. * - * $Id: aic7xxx.seq,v 1.46.2.19 1997/04/24 16:52:49 gibbs Exp $ + * $Id: aic7xxx.seq,v 1.46.2.20 1997/08/13 18:56:45 gibbs Exp $ * *-M************************************************************************/ @@ -91,8 +91,7 @@ poll_for_work: cmp WAITING_SCBH,SCB_LIST_NULL jne start_waiting; test_queue: /* Has the driver posted any work for us? */ - mov A, QCNTMASK; - test QINCNT,A jz poll_for_work; + test QINCNT,QCNTMASK jz poll_for_work; /* * We have at least one queued SCB now and we don't have any @@ -570,7 +569,6 @@ p_mesgout_done: */ p_mesgin: mvi ACCUM call inb_first; /* read the 1st message byte */ - mov REJBYTE,A; /* save it for the driver */ test A,MSG_IDENTIFYFLAG jnz mesgin_identify; cmp A,MSG_DISCONNECT je mesgin_disconnect; @@ -651,8 +649,7 @@ complete: * Spin loop until there is space * in the QOUTFIFO. */ - mov A, FIFODEPTH; - cmp CMDOUTCNT, A je .; + cmp CMDOUTCNT, FIFODEPTH je .; inc CMDOUTCNT; .endif mov QOUTFIFO,SCB_TAG; @@ -805,8 +802,7 @@ get_tag: * the complement of SCBCOUNT to the incomming tag and there is * no carry. */ - mov A,COMP_SCBCOUNT; - add SINDEX,A,ARG_1; + add SINDEX,COMP_SCBCOUNT,ARG_1; jc not_found; .if ! ( SCB_PAGING ) @@ -979,8 +975,7 @@ findSCB: test SCB_CONTROL,DISCONNECTED jnz foundSCB;/*should be disconnected*/ findSCB_loop: inc SINDEX; - mov A,SCBCOUNT; - cmp SINDEX,A jne findSCB; + cmp SINDEX,SCBCOUNT jne findSCB; /* * We didn't find it. If we're paging, pull an SCB and DMA down the * one we want. If we aren't paging or the SCB we dma down has the diff --git a/sys/dev/aic7xxx/aicasm_gram.y b/sys/dev/aic7xxx/aicasm_gram.y index a5e1510481b4..46936eb71a42 100644 --- a/sys/dev/aic7xxx/aicasm_gram.y +++ b/sys/dev/aic7xxx/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.1 1997/03/16 07:08:16 gibbs Exp $ + * $Id: aicasm_gram.y,v 1.1.2.1 1997/09/03 04:25:14 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); +} diff --git a/sys/dev/aic7xxx/aicasm_scan.l b/sys/dev/aic7xxx/aicasm_scan.l index 441f43f79af8..1445dcdf27df 100644 --- a/sys/dev/aic7xxx/aicasm_scan.l +++ b/sys/dev/aic7xxx/aicasm_scan.l @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aicasm_scan.l,v 1.1.2.1 1997/03/16 19:01:28 gibbs Exp $ + * $Id: aicasm_scan.l,v 1.1.2.2 1997/09/03 04:25:18 gibbs Exp $ */ #include <limits.h> @@ -65,6 +65,7 @@ SPACE [ \t]+ /* Register/SCB/SRAM definition keywords */ register { return T_REGISTER; } const { yylval.value = FALSE; return T_CONST; } +download { return T_DOWNLOAD; } address { return T_ADDRESS; } access_mode { return T_ACCESS_MODE; } RW|RO|WO { diff --git a/sys/dev/aic7xxx/aicasm_symbol.c b/sys/dev/aic7xxx/aicasm_symbol.c index 719556b52f19..a553c45b6f5d 100644 --- a/sys/dev/aic7xxx/aicasm_symbol.c +++ b/sys/dev/aic7xxx/aicasm_symbol.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aicasm_symbol.c,v 1.1 1997/03/16 07:08:18 gibbs Exp $ + * $Id: aicasm_symbol.c,v 1.1.2.1 1997/09/03 04:25:20 gibbs Exp $ */ @@ -92,6 +92,7 @@ symbol_delete(symbol) free(symbol->info.minfo); } break; + case DOWNLOAD_CONST: case CONST: if (symbol->info.cinfo != NULL) free(symbol->info.cinfo); @@ -312,11 +313,13 @@ symtable_dump(ofile) symlist_t registers; symlist_t masks; symlist_t constants; + symlist_t download_constants; symlist_t aliases; SLIST_INIT(®isters); SLIST_INIT(&masks); SLIST_INIT(&constants); + SLIST_INIT(&download_constants); SLIST_INIT(&aliases); if (symtable != NULL) { @@ -344,9 +347,14 @@ symtable_dump(ofile) SYMLIST_INSERT_HEAD); } break; + case DOWNLOAD_CONST: + symlist_add(&download_constants, cursym, + SYMLIST_INSERT_HEAD); + break; case ALIAS: symlist_add(&aliases, cursym, SYMLIST_INSERT_HEAD); + break; default: break; } @@ -446,6 +454,20 @@ symtable_dump(ofile) curnode->symbol->info.cinfo->value); free(curnode); } + + + fprintf(ofile, "\n\n/* Downloaded Constant Definitions */\n"); + + while (download_constants.slh_first != NULL) { + symbol_node_t *curnode; + + curnode = download_constants.slh_first; + SLIST_REMOVE_HEAD(&download_constants, links); + fprintf(ofile, "#define\t%-8s\t0x%02x\n", + curnode->symbol->name, + curnode->symbol->info.cinfo->value); + free(curnode); + } } } diff --git a/sys/dev/aic7xxx/aicasm_symbol.h b/sys/dev/aic7xxx/aicasm_symbol.h index cf8fa0071225..1742ea206c82 100644 --- a/sys/dev/aic7xxx/aicasm_symbol.h +++ b/sys/dev/aic7xxx/aicasm_symbol.h @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: aicasm_symbol.h,v 1.1 1997/03/16 07:08:19 gibbs Exp $ */ #include <sys/queue.h> @@ -42,6 +42,7 @@ typedef enum { MASK, BIT, CONST, + DOWNLOAD_CONST, LABEL, CONDITIONAL }symtype; diff --git a/sys/dev/aic7xxx/sequencer.h b/sys/dev/aic7xxx/sequencer.h index ed227158f5d1..62c94dc05a36 100644 --- a/sys/dev/aic7xxx/sequencer.h +++ b/sys/dev/aic7xxx/sequencer.h @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: sequencer.h,v 1.1 1997/03/16 07:08:18 gibbs Exp $ */ struct ins_format1 { @@ -37,6 +37,7 @@ struct ins_format1 { u_int8_t source; u_int8_t destination; u_int8_t opcode_ret; +#define DOWNLOAD_CONST_IMMEDIATE 0x80 }; struct ins_format2 { |
