1139749Simp/*- 263457Sgibbs * Instruction formats for the sequencer program downloaded to 363457Sgibbs * Aic7xxx SCSI host adapters 463457Sgibbs * 563457Sgibbs * Copyright (c) 1997, 1998, 2000 Justin T. Gibbs. 663457Sgibbs * All rights reserved. 763457Sgibbs * 863457Sgibbs * Redistribution and use in source and binary forms, with or without 963457Sgibbs * modification, are permitted provided that the following conditions 1063457Sgibbs * are met: 1163457Sgibbs * 1. Redistributions of source code must retain the above copyright 1263457Sgibbs * notice, this list of conditions, and the following disclaimer, 1363457Sgibbs * without modification. 1495376Sgibbs * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1595376Sgibbs * substantially similar to the "NO WARRANTY" disclaimer below 1695376Sgibbs * ("Disclaimer") and any redistribution must be conditioned upon 1795376Sgibbs * including a substantially similar Disclaimer requirement for further 1895376Sgibbs * binary redistribution. 1995376Sgibbs * 3. Neither the names of the above-listed copyright holders nor the names 2095376Sgibbs * of any contributors may be used to endorse or promote products derived 2195376Sgibbs * from this software without specific prior written permission. 2263457Sgibbs * 2363457Sgibbs * Alternatively, this software may be distributed under the terms of the 2495376Sgibbs * GNU General Public License ("GPL") version 2 as published by the Free 2595376Sgibbs * Software Foundation. 2663457Sgibbs * 2795376Sgibbs * NO WARRANTY 2895376Sgibbs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2995376Sgibbs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3095376Sgibbs * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3195376Sgibbs * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3295376Sgibbs * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3363457Sgibbs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3463457Sgibbs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3595376Sgibbs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3695376Sgibbs * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 3795376Sgibbs * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3895376Sgibbs * POSSIBILITY OF SUCH DAMAGES. 3963457Sgibbs * 40107303Sscottl * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_insformat.h#11 $ 4165943Sgibbs * 4263457Sgibbs * $FreeBSD: releng/10.3/sys/dev/aic7xxx/aicasm/aicasm_insformat.h 139749 2005-01-06 01:43:34Z imp $ 4363457Sgibbs */ 4463457Sgibbs 4563457Sgibbsstruct ins_format1 { 4663457Sgibbs#if BYTE_ORDER == LITTLE_ENDIAN 4763457Sgibbs uint32_t immediate : 8, 4863457Sgibbs source : 9, 4963457Sgibbs destination : 9, 5063457Sgibbs ret : 1, 5163457Sgibbs opcode : 4, 5263457Sgibbs parity : 1; 5363457Sgibbs#else 5463457Sgibbs uint32_t parity : 1, 5563457Sgibbs opcode : 4, 5663457Sgibbs ret : 1, 5763457Sgibbs destination : 9, 5863457Sgibbs source : 9, 5963457Sgibbs immediate : 8; 6063457Sgibbs#endif 6163457Sgibbs}; 6263457Sgibbs 6363457Sgibbsstruct ins_format2 { 6463457Sgibbs#if BYTE_ORDER == LITTLE_ENDIAN 6563457Sgibbs uint32_t shift_control : 8, 6663457Sgibbs source : 9, 6763457Sgibbs destination : 9, 6863457Sgibbs ret : 1, 6963457Sgibbs opcode : 4, 7063457Sgibbs parity : 1; 7163457Sgibbs#else 7263457Sgibbs uint32_t parity : 1, 7363457Sgibbs opcode : 4, 7463457Sgibbs ret : 1, 7563457Sgibbs destination : 9, 7663457Sgibbs source : 9, 7763457Sgibbs shift_control : 8; 7863457Sgibbs#endif 7963457Sgibbs}; 8063457Sgibbs 8163457Sgibbsstruct ins_format3 { 8263457Sgibbs#if BYTE_ORDER == LITTLE_ENDIAN 8363457Sgibbs uint32_t immediate : 8, 8463457Sgibbs source : 9, 8563457Sgibbs address : 10, 8663457Sgibbs opcode : 4, 8763457Sgibbs parity : 1; 8863457Sgibbs#else 8963457Sgibbs uint32_t parity : 1, 9063457Sgibbs opcode : 4, 9163457Sgibbs address : 10, 9263457Sgibbs source : 9, 9363457Sgibbs immediate : 8; 9463457Sgibbs#endif 9563457Sgibbs}; 9663457Sgibbs 9763457Sgibbsunion ins_formats { 9863457Sgibbs struct ins_format1 format1; 9963457Sgibbs struct ins_format2 format2; 10063457Sgibbs struct ins_format3 format3; 10165943Sgibbs uint8_t bytes[4]; 10263457Sgibbs uint32_t integer; 10363457Sgibbs}; 10463457Sgibbsstruct instruction { 10563457Sgibbs union ins_formats format; 10663457Sgibbs u_int srcline; 10763457Sgibbs struct symbol *patch_label; 10863457Sgibbs STAILQ_ENTRY(instruction) links; 10963457Sgibbs}; 11063457Sgibbs 11163457Sgibbs#define AIC_OP_OR 0x0 11263457Sgibbs#define AIC_OP_AND 0x1 11363457Sgibbs#define AIC_OP_XOR 0x2 11463457Sgibbs#define AIC_OP_ADD 0x3 11563457Sgibbs#define AIC_OP_ADC 0x4 11663457Sgibbs#define AIC_OP_ROL 0x5 11763457Sgibbs#define AIC_OP_BMOV 0x6 11863457Sgibbs 11963457Sgibbs#define AIC_OP_JMP 0x8 12063457Sgibbs#define AIC_OP_JC 0x9 12163457Sgibbs#define AIC_OP_JNC 0xa 12263457Sgibbs#define AIC_OP_CALL 0xb 12363457Sgibbs#define AIC_OP_JNE 0xc 12463457Sgibbs#define AIC_OP_JNZ 0xd 12563457Sgibbs#define AIC_OP_JE 0xe 12663457Sgibbs#define AIC_OP_JZ 0xf 12763457Sgibbs 12863457Sgibbs/* Pseudo Ops */ 12963457Sgibbs#define AIC_OP_SHL 0x10 13063457Sgibbs#define AIC_OP_SHR 0x20 13163457Sgibbs#define AIC_OP_ROR 0x30 132