root/dev/microcode/aic7xxx/aicasm_insformat.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: aicasm_insformat.h,v 1.4 2003/12/24 23:27:55 krw Exp $        */
    2 /*      $NetBSD: aicasm_insformat.h,v 1.1 2003/04/19 19:26:11 fvdl Exp $        */
    3 
    4 /*
    5  * Instruction formats for the sequencer program downloaded to
    6  * Aic7xxx SCSI host adapters
    7  *
    8  * Copyright (c) 1997, 1998, 2000 Justin T. Gibbs.
    9  * All rights reserved.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions, and the following disclaimer,
   16  *    without modification.
   17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
   18  *    substantially similar to the "NO WARRANTY" disclaimer below
   19  *    ("Disclaimer") and any redistribution must be conditioned upon
   20  *    including a substantially similar Disclaimer requirement for further
   21  *    binary redistribution.
   22  * 3. Neither the names of the above-listed copyright holders nor the names
   23  *    of any contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * Alternatively, this software may be distributed under the terms of the
   27  * GNU General Public License ("GPL") version 2 as published by the Free
   28  * Software Foundation.
   29  *
   30  * NO WARRANTY
   31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
   34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   41  * POSSIBILITY OF SUCH DAMAGES.
   42  *
   43  * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_insformat.h,v 1.8 2002/11/27 07:06:43 scottl Exp $
   44  */
   45 
   46 struct ins_format1 {
   47 #if BYTE_ORDER == LITTLE_ENDIAN
   48         uint32_t        immediate       : 8,
   49                         source          : 9,
   50                         destination     : 9,
   51                         ret             : 1,
   52                         opcode          : 4,
   53                         parity          : 1;
   54 #else
   55         uint32_t        parity          : 1,
   56                         opcode          : 4,
   57                         ret             : 1,
   58                         destination     : 9,
   59                         source          : 9,
   60                         immediate       : 8;
   61 #endif
   62 };
   63 
   64 struct ins_format2 {
   65 #if BYTE_ORDER == LITTLE_ENDIAN
   66         uint32_t        shift_control   : 8,
   67                         source          : 9,
   68                         destination     : 9,
   69                         ret             : 1,
   70                         opcode          : 4,
   71                         parity          : 1;
   72 #else
   73         uint32_t        parity          : 1,
   74                         opcode          : 4,
   75                         ret             : 1,
   76                         destination     : 9,
   77                         source          : 9,
   78                         shift_control   : 8;
   79 #endif
   80 };
   81 
   82 struct ins_format3 {
   83 #if BYTE_ORDER == LITTLE_ENDIAN
   84         uint32_t        immediate       : 8,
   85                         source          : 9,
   86                         address         : 10,
   87                         opcode          : 4,
   88                         parity          : 1;
   89 #else
   90         uint32_t        parity          : 1,
   91                         opcode          : 4,
   92                         address         : 10,
   93                         source          : 9,
   94                         immediate       : 8;
   95 #endif
   96 };
   97 
   98 union ins_formats {
   99                 struct ins_format1 format1;
  100                 struct ins_format2 format2;
  101                 struct ins_format3 format3;
  102                 uint8_t            bytes[4];
  103                 uint32_t           integer;
  104 };
  105 struct instruction {
  106         union   ins_formats format;
  107         u_int   srcline;
  108         struct symbol *patch_label;
  109         TAILQ_ENTRY(instruction) links;
  110 };
  111 
  112 #define AIC_OP_OR       0x0
  113 #define AIC_OP_AND      0x1
  114 #define AIC_OP_XOR      0x2
  115 #define AIC_OP_ADD      0x3
  116 #define AIC_OP_ADC      0x4
  117 #define AIC_OP_ROL      0x5
  118 #define AIC_OP_BMOV     0x6
  119 
  120 #define AIC_OP_JMP      0x8
  121 #define AIC_OP_JC       0x9
  122 #define AIC_OP_JNC      0xa
  123 #define AIC_OP_CALL     0xb
  124 #define AIC_OP_JNE      0xc
  125 #define AIC_OP_JNZ      0xd
  126 #define AIC_OP_JE       0xe
  127 #define AIC_OP_JZ       0xf
  128 
  129 /* Pseudo Ops */
  130 #define AIC_OP_SHL      0x10
  131 #define AIC_OP_SHR      0x20
  132 #define AIC_OP_ROR      0x30

/* [<][>][^][v][top][bottom][index][help] */