Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/microcode/siop Script assembler for the NCR 53c7xx/8...



details:   https://anonhg.NetBSD.org/src/rev/ccacf3932696
branches:  trunk
changeset: 485189:ccacf3932696
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Apr 21 17:50:07 2000 +0000

description:
Script assembler for the NCR 53c7xx/8xx scsi controller. Initial work
done by Michael L. Hitch, support for the 8xx and some improvements
by me.

diffstat:

 sys/dev/microcode/siop/ncr53cxxx.c |  1369 ++++++++++++++++++++++++++++++++++++
 1 files changed, 1369 insertions(+), 0 deletions(-)

diffs (truncated from 1373 to 300 lines):

diff -r 5bc8fdbb04a8 -r ccacf3932696 sys/dev/microcode/siop/ncr53cxxx.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/microcode/siop/ncr53cxxx.c        Fri Apr 21 17:50:07 2000 +0000
@@ -0,0 +1,1369 @@
+/*     $NetBSD: ncr53cxxx.c,v 1.1 2000/04/21 17:50:07 bouyer Exp $     */
+
+/*
+ * Copyright (c) 1995,1999 Michael L. Hitch
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Michael L. Hitch.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*     ncr53cxxx.c     - SCSI SCRIPTS Assembler                */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifndef AMIGA
+#define strcmpi        strcasecmp
+#endif
+
+#define        MAXTOKENS       16
+#define        MAXINST         1024
+#define        MAXSYMBOLS      128
+
+struct {
+       int     type;
+       char    *name;
+} tokens[MAXTOKENS];
+int    ntokens;
+int    tokenix;
+
+void   f_proc (void);
+void   f_pass (void);
+void   f_list (void);          /* ENTRY, EXTERNAL label list */
+void   f_define (void);        /* ABSOLUTE, RELATIVE label list */
+void   f_move (void);
+void   f_jump (void);
+void   f_call (void);
+void   f_return (void);
+void   f_int (void);
+void   f_select (void);
+void   f_reselect (void);
+void   f_wait (void);
+void   f_disconnect (void);
+void   f_set (void);
+void   f_clear (void);
+void   f_load (void);
+void   f_store (void);
+void   f_arch (void);
+
+struct {
+       char    *name;
+       void    (*func)(void);
+} directives[] = {
+       {"PROC",        f_proc},
+       {"PASS",        f_pass},
+       {"ENTRY",       f_list},
+       {"ABSOLUTE",    f_define},
+       {"EXTERN",      f_list},
+       {"EXTERNAL",    f_list},
+       {"RELATIVE",    f_define},
+       {"MOVE",        f_move},
+       {"JUMP",        f_jump},
+       {"CALL",        f_call},
+       {"RETURN",      f_return},
+       {"INT",         f_int},
+       {"SELECT",      f_select},
+       {"RESELECT",    f_reselect},
+       {"WAIT",        f_wait},
+       {"DISCONNECT",  f_disconnect},
+       {"SET",         f_set},
+       {"CLEAR",       f_clear},
+       {"LOAD",        f_load},
+       {"STORE",       f_store},
+       {"ARCH",        f_arch},
+       {NULL, NULL}};
+
+u_int32_t script[MAXINST];
+int    dsps;
+char   *script_name = "SCRIPT";
+u_int32_t inst0, inst1, inst2;
+unsigned int   ninsts;
+unsigned int   npatches;
+
+struct patchlist {
+       struct patchlist *next;
+       unsigned        offset;
+};
+
+#define        S_LABEL         0x0000
+#define        S_ABSOLUTE      0x0001
+#define        S_RELATIVE      0x0002
+#define        S_EXTERNAL      0x0003
+#define        F_DEFINED       0x0001
+#define        F_ENTRY         0x0002
+struct {
+       short   type;
+       short   flags;
+       u_int32_t value;
+       struct patchlist *patchlist;
+       char    *name;
+} symbols[MAXSYMBOLS];
+int nsymbols;
+
+char   *stypes[] = {"Label", "Absolute", "Relative", "External"};
+
+char   *phases[] = {
+       "data_out", "data_in", "cmd", "status",
+       "res4", "res5", "msg_out", "msg_in"
+};
+
+struct ncrregs {
+       char *name;
+       int addr[4];
+};
+#define ARCH710 1
+#define ARCH720 2
+#define ARCH810 3
+#define ARCH825 4
+
+struct ncrregs         regs[] = {
+       {"scntl0",      {0x00, 0x00, 0x00, 0x00}},
+       {"scntl1",      {0x01, 0x01, 0x01, 0x01}},
+       {"scntl2",      {-1,   0x02, 0x02, 0x02}},
+       {"scntl3",      {-1,   0x03, 0x03, 0x03}},
+       {"scid",        {-1,   0x04, 0x04, 0x04}},
+       {"sdid",        {0x02,   -1,   -1,   -1}},
+       {"sien",        {0x03,   -1,   -1,   -1}},
+       {"scid",        {0x04,   -1,   -1,   -1}},
+       {"sxfer",       {0x05, 0x05, 0x05, 0x05}},
+       {"sdid",        {-1,   0x06, 0x06, 0x06}},
+       {"gpreg",       {-1,   0x07, 0x07, 0x07}},
+       {"sodl",        {0x06,   -1,   -1,   -1}},
+       {"socl",        {0x07,   -1,   -1,   -1}},
+       {"sfbr",        {0x08, 0x08, 0x08, 0x08}},
+       {"socl",        {-1,   0x09, 0x09, 0x09}},
+       {"ssid",        {-1,   0x0a, 0x0a, 0x0a}},
+       {"sidl",        {0x09,   -1,   -1,   -1}},
+       {"sbdl",        {0x0a,   -1,   -1,   -1}},
+       {"sbcl",        {0x0b, 0x0b, 0x0b, 0x0b}}, 
+       {"dstat",       {0x0c, 0x0c, 0x0c, 0x0c}},
+       {"sstat0",      {0x0d, 0x0d, 0x0d, 0x0d}},
+       {"sstat1",      {0x0e, 0x0e, 0x0e, 0x0e}},
+       {"sstat2",      {0x0f, 0x0f, 0x0f, 0x0f}},
+       {"dsa0",        {0x10, 0x10, 0x10, 0x10}},
+       {"dsa1",        {0x11, 0x11, 0x11, 0x11}},
+       {"dsa2",        {0x12, 0x12, 0x12, 0x12}},
+       {"dsa3",        {0x13, 0x13, 0x13, 0x13}},
+       {"istat",       {-1,   0x14, 0x14, 0x14}},
+       {"ctest0",      {0x14, 0x18, 0x18, 0x18}},
+       {"ctest1",      {0x15, 0x19, 0x19, 0x19}},
+       {"ctest2",      {0x16, 0x1a, 0x1a, 0x1a}},
+       {"ctest3",      {0x17, 0x1b, 0x1b, 0x1b}},
+       {"temp0",       {-1,   0x1c, 0x1c, 0x1c}},
+       {"temp1",       {-1,   0x1d, 0x1d, 0x1d}},
+       {"temp2",       {-1,   0x1e, 0x1e, 0x1e}},
+       {"temp3",       {-1,   0x1f, 0x1f, 0x1f}},
+       {"dfifo",       {-1,   0x20, 0x20, 0x20}},
+       {"ctest4",      {0x18, 0x21, 0x21, 0x21}},
+       {"ctest5",      {0x19, 0x22, 0x22, 0x22}},
+       {"ctest6",      {0x20, 0x23, 0x23, 0x23}},
+       {"ctest7",      {0x21,   -1,   -1,   -1}},
+       {"temp0",       {0x22,   -1,   -1,   -1}},
+       {"temp1",       {0x23,   -1,   -1,   -1}},
+       {"temp2",       {0x24,   -1,   -1,   -1}},
+       {"temp3",       {0x25,   -1,   -1,   -1}},
+       {"dfifo",       {0x26,   -1,   -1,   -1}},
+       {"istat",       {0x27,   -1,   -1,   -1}},
+       {"ctest8",      {0x28,   -1,   -1,   -1}},
+       {"lcrc",        {0x29,   -1,   -1,   -1}},
+       {"dbc0",        {0x2a, 0x24, 0x24, 0x24}},
+       {"dbc1",        {0x2b, 0x25, 0x25, 0x25}},
+       {"dbc2",        {0x2c, 0x26, 0x26, 0x26}},
+       {"dcmd",        {0x2d, 0x27, 0x27, 0x27}},
+       {"dnad0",       {0x2e, 0x28, 0x28, 0x28}},
+       {"dnad1",       {0x2f, 0x29, 0x29, 0x29}},
+       {"dnad2",       {0x30, 0x2a, 0x2a, 0x2a}},
+       {"dnad3",       {0x31, 0x2b, 0x2b, 0x2b}},
+       {"dsp0",        {0x32, 0x2c, 0x2c, 0x2c}},
+       {"dsp1",        {0x33, 0x2d, 0x2d, 0x2d}},
+       {"dsp2",        {0x34, 0x2e, 0x2e, 0x2e}},
+       {"dsp3",        {0x35, 0x2f, 0x2f, 0x2f}},
+       {"dsps0",       {0x36, 0x30, 0x30, 0x30}},
+       {"dsps1",       {0x37, 0x31, 0x31, 0x31}},
+       {"dsps2",       {0x38, 0x32, 0x32, 0x32}},
+       {"dsps3",       {0x39, 0x33, 0x33, 0x33}},
+       {"scratch0",    {0x40,   -1,   -1,   -1}},
+       {"scratch1",    {0x41,   -1,   -1,   -1}},
+       {"scratch2",    {0x42,   -1,   -1,   -1}},
+       {"scratch3",    {0x43,   -1,   -1,   -1}},
+       {"scratcha0",   {  -1, 0x34, 0x34, 0x34}},
+       {"scratcha1",   {  -1, 0x35, 0x35, 0x35}},
+       {"scratcha2",   {  -1, 0x36, 0x36, 0x36}},
+       {"scratcha3",   {  -1, 0x37, 0x37, 0x37}},
+       {"dmode",       {0x44, 0x38, 0x38, 0x38}},
+       {"dien",        {0x45, 0x39, 0x39, 0x39}},
+       {"dwt",         {0x46, 0x3a,   -1,   -1}},
+       {"sbr",         {  -1,   -1, 0x3a, 0x3a}},
+       {"dcntl",       {0x47, 0x3b, 0x3b, 0x3b}},
+       {"addr0",       {0x48, 0x3c, 0x3c, 0x3c}},
+       {"addr1",       {0x49, 0x3d, 0x3d, 0x3d}},
+       {"addr2",       {0x4A, 0x3e, 0x3e, 0x3e}},
+       {"addr3",       {0x4B, 0x3f, 0x3f, 0x3f}},
+       {"sien0",       {  -1, 0x40, 0x40, 0x40}},
+       {"sien1",       {  -1, 0x41, 0x41, 0x41}},
+       {"sist0",       {  -1, 0x42, 0x42, 0x42}},
+       {"sist1",       {  -1, 0x43, 0x43, 0x43}},
+       {"slpar",       {  -1, 0x44, 0x44, 0x44}},
+       {"swide",       {  -1, 0x45,   -1, 0x45}},
+       {"macntl",      {  -1, 0x46, 0x46, 0x46}},
+       {"gpcntl",      {  -1, 0x47, 0x47, 0x47}},
+       {"stime0",      {  -1, 0x48, 0x48, 0x48}},
+       {"stime1",      {  -1, 0x49, 0x49, 0x49}},
+       {"respid0",     {  -1, 0x4a, 0x4a, 0x4a}},
+       {"respid1",     {  -1, 0x4b,   -1, 0x4b}},
+       {"stest0",      {  -1, 0x4c, 0x4c, 0x4c}},
+       {"stest1",      {  -1, 0x4d, 0x4d, 0x4d}},
+       {"stest2",      {  -1, 0x4e, 0x4e, 0x4e}},
+       {"stest3",      {  -1, 0x4f, 0x4f, 0x4f}},
+       {"sidl0",       {  -1, 0x50, 0x50, 0x50}},
+       {"sidl1",       {  -1, 0x51,   -1, 0x51}},
+       {"sodl0",       {  -1, 0x54, 0x54, 0x54}},
+       {"sodl1",       {  -1, 0x55,   -1, 0x55}},
+       {"sbdl0",       {  -1, 0x58, 0x58, 0x58}},
+       {"sbdl1",       {  -1, 0x59,   -1, 0x59}},
+       {"scratchb0",   {  -1, 0x5c, 0x5c, 0x5c}},
+       {"scratchb1",   {  -1, 0x5d, 0x5d, 0x5d}},
+       {"scratchb2",   {  -1, 0x5e, 0x5e, 0x5e}},
+       {"scratchb3",   {  -1, 0x5f, 0x5f, 0x5f}},
+       {"scratchc0",   {  -1,   -1,   -1, 0x60}},
+       {"scratchc1",   {  -1,   -1,   -1, 0x61}},
+       {"scratchc2",   {  -1,   -1,   -1, 0x62}},
+       {"scratchc3",   {  -1,   -1,   -1, 0x63}},
+       {"scratchd0",   {  -1,   -1,   -1, 0x64}},
+       {"scratchd1",   {  -1,   -1,   -1, 0x65}},
+       {"scratchd2",   {  -1,   -1,   -1, 0x5e}},
+       {"scratchd3",   {  -1,   -1,   -1, 0x67}},
+       {"scratche0",   {  -1,   -1,   -1, 0x68}},
+       {"scratche1",   {  -1,   -1,   -1, 0x69}},
+       {"scratche2",   {  -1,   -1,   -1, 0x6a}},
+       {"scratche3",   {  -1,   -1,   -1, 0x6b}},
+       {"scratchf0",   {  -1,   -1,   -1, 0x6c}},
+       {"scratchf1",   {  -1,   -1,   -1, 0x6d}},
+       {"scratchf2",   {  -1,   -1,   -1, 0x6e}},
+       {"scratchf3",   {  -1,   -1,   -1, 0x6f}},
+       {"scratchg0",   {  -1,   -1,   -1, 0x70}},
+       {"scratchg1",   {  -1,   -1,   -1, 0x71}},
+       {"scratchg2",   {  -1,   -1,   -1, 0x72}},
+       {"scratchg3",   {  -1,   -1,   -1, 0x73}},
+       {"scratchh0",   {  -1,   -1,   -1, 0x74}},
+       {"scratchh1",   {  -1,   -1,   -1, 0x75}},
+       {"scratchh2",   {  -1,   -1,   -1, 0x7e}},
+       {"scratchh3",   {  -1,   -1,   -1, 0x77}},
+       {"scratchi0",   {  -1,   -1,   -1, 0x78}},
+       {"scratchi1",   {  -1,   -1,   -1, 0x79}},
+       {"scratchi2",   {  -1,   -1,   -1, 0x7a}},
+       {"scratchi3",   {  -1,   -1,   -1, 0x7b}},
+       {"scratchj0",   {  -1,   -1,   -1, 0x7c}},
+       {"scratchj1",   {  -1,   -1,   -1, 0x7d}},
+       {"scratchj2",   {  -1,   -1,   -1, 0x7e}},
+       {"scratchj3",   {  -1,   -1,   -1, 0x7f}},
+};
+
+int    lineno;
+int    err_listed;
+int    arch;
+int    partial_flag;
+
+char   inbuf[128];
+
+char   *sourcefile;
+char   *outputfile;
+char   *listfile;



Home | Main Index | Thread Index | Old Index