162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Workbit NinjaSCSI-32Bi/UDE PCI/CardBus SCSI Host Bus Adapter driver 462306a36Sopenharmony_ci * Basic data header 562306a36Sopenharmony_ci*/ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _NSP32_H 862306a36Sopenharmony_ci#define _NSP32_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci//#define NSP32_DEBUG 9 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/* 1362306a36Sopenharmony_ci * VENDOR/DEVICE ID 1462306a36Sopenharmony_ci */ 1562306a36Sopenharmony_ci#define PCI_VENDOR_ID_IODATA 0x10fc 1662306a36Sopenharmony_ci#define PCI_VENDOR_ID_WORKBIT 0x1145 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32BI_CBSC_II 0x0005 1962306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32BI_KME 0xf007 2062306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32BI_WBT 0x8007 2162306a36Sopenharmony_ci#define PCI_DEVICE_ID_WORKBIT_STANDARD 0xf010 2262306a36Sopenharmony_ci#define PCI_DEVICE_ID_WORKBIT_DUALEDGE 0xf011 2362306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32BI_LOGITEC 0xf012 2462306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32BIB_LOGITEC 0xf013 2562306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32UDE_MELCO 0xf015 2662306a36Sopenharmony_ci#define PCI_DEVICE_ID_NINJASCSI_32UDE_MELCO_II 0x8009 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* 2962306a36Sopenharmony_ci * MODEL 3062306a36Sopenharmony_ci */ 3162306a36Sopenharmony_cienum { 3262306a36Sopenharmony_ci MODEL_IODATA = 0, 3362306a36Sopenharmony_ci MODEL_KME = 1, 3462306a36Sopenharmony_ci MODEL_WORKBIT = 2, 3562306a36Sopenharmony_ci MODEL_LOGITEC = 3, 3662306a36Sopenharmony_ci MODEL_PCI_WORKBIT = 4, 3762306a36Sopenharmony_ci MODEL_PCI_LOGITEC = 5, 3862306a36Sopenharmony_ci MODEL_PCI_MELCO = 6, 3962306a36Sopenharmony_ci}; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_cistatic char * nsp32_model[] = { 4262306a36Sopenharmony_ci "I-O DATA CBSC-II CardBus card", 4362306a36Sopenharmony_ci "KME SCSI CardBus card", 4462306a36Sopenharmony_ci "Workbit duo SCSI CardBus card", 4562306a36Sopenharmony_ci "Logitec CardBus card with external ROM", 4662306a36Sopenharmony_ci "Workbit / I-O DATA PCI card", 4762306a36Sopenharmony_ci "Logitec PCI card with external ROM", 4862306a36Sopenharmony_ci "Melco CardBus/PCI card with external ROM", 4962306a36Sopenharmony_ci}; 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* 5362306a36Sopenharmony_ci * SCSI Generic Definitions 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci#define EXTENDED_SDTR_LEN 0x03 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/* Little Endian */ 5862306a36Sopenharmony_citypedef u32 u32_le; 5962306a36Sopenharmony_citypedef u16 u16_le; 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* 6262306a36Sopenharmony_ci * BASIC Definitions 6362306a36Sopenharmony_ci */ 6462306a36Sopenharmony_ci#ifndef TRUE 6562306a36Sopenharmony_ci# define TRUE 1 6662306a36Sopenharmony_ci#endif 6762306a36Sopenharmony_ci#ifndef FALSE 6862306a36Sopenharmony_ci# define FALSE 0 6962306a36Sopenharmony_ci#endif 7062306a36Sopenharmony_ci#define ASSERT 1 7162306a36Sopenharmony_ci#define NEGATE 0 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/*******************/ 7562306a36Sopenharmony_ci/* normal register */ 7662306a36Sopenharmony_ci/*******************/ 7762306a36Sopenharmony_ci/* 7862306a36Sopenharmony_ci * Don't access below register with Double Word: 7962306a36Sopenharmony_ci * +00, +04, +08, +0c, +64, +80, +84, +88, +90, +c4, +c8, +cc, +d0. 8062306a36Sopenharmony_ci */ 8162306a36Sopenharmony_ci#define IRQ_CONTROL 0x00 /* BASE+00, W, W */ 8262306a36Sopenharmony_ci#define IRQ_STATUS 0x00 /* BASE+00, W, R */ 8362306a36Sopenharmony_ci# define IRQSTATUS_LATCHED_MSG BIT(0) 8462306a36Sopenharmony_ci# define IRQSTATUS_LATCHED_IO BIT(1) 8562306a36Sopenharmony_ci# define IRQSTATUS_LATCHED_CD BIT(2) 8662306a36Sopenharmony_ci# define IRQSTATUS_LATCHED_BUS_FREE BIT(3) 8762306a36Sopenharmony_ci# define IRQSTATUS_RESELECT_OCCUER BIT(4) 8862306a36Sopenharmony_ci# define IRQSTATUS_PHASE_CHANGE_IRQ BIT(5) 8962306a36Sopenharmony_ci# define IRQSTATUS_SCSIRESET_IRQ BIT(6) 9062306a36Sopenharmony_ci# define IRQSTATUS_TIMER_IRQ BIT(7) 9162306a36Sopenharmony_ci# define IRQSTATUS_FIFO_SHLD_IRQ BIT(8) 9262306a36Sopenharmony_ci# define IRQSTATUS_PCI_IRQ BIT(9) 9362306a36Sopenharmony_ci# define IRQSTATUS_BMCNTERR_IRQ BIT(10) 9462306a36Sopenharmony_ci# define IRQSTATUS_AUTOSCSI_IRQ BIT(11) 9562306a36Sopenharmony_ci# define PCI_IRQ_MASK BIT(12) 9662306a36Sopenharmony_ci# define TIMER_IRQ_MASK BIT(13) 9762306a36Sopenharmony_ci# define FIFO_IRQ_MASK BIT(14) 9862306a36Sopenharmony_ci# define SCSI_IRQ_MASK BIT(15) 9962306a36Sopenharmony_ci# define IRQ_CONTROL_ALL_IRQ_MASK (PCI_IRQ_MASK | \ 10062306a36Sopenharmony_ci TIMER_IRQ_MASK | \ 10162306a36Sopenharmony_ci FIFO_IRQ_MASK | \ 10262306a36Sopenharmony_ci SCSI_IRQ_MASK ) 10362306a36Sopenharmony_ci# define IRQSTATUS_ANY_IRQ (IRQSTATUS_RESELECT_OCCUER | \ 10462306a36Sopenharmony_ci IRQSTATUS_PHASE_CHANGE_IRQ | \ 10562306a36Sopenharmony_ci IRQSTATUS_SCSIRESET_IRQ | \ 10662306a36Sopenharmony_ci IRQSTATUS_TIMER_IRQ | \ 10762306a36Sopenharmony_ci IRQSTATUS_FIFO_SHLD_IRQ | \ 10862306a36Sopenharmony_ci IRQSTATUS_PCI_IRQ | \ 10962306a36Sopenharmony_ci IRQSTATUS_BMCNTERR_IRQ | \ 11062306a36Sopenharmony_ci IRQSTATUS_AUTOSCSI_IRQ ) 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci#define TRANSFER_CONTROL 0x02 /* BASE+02, W, W */ 11362306a36Sopenharmony_ci#define TRANSFER_STATUS 0x02 /* BASE+02, W, R */ 11462306a36Sopenharmony_ci# define CB_MMIO_MODE BIT(0) 11562306a36Sopenharmony_ci# define CB_IO_MODE BIT(1) 11662306a36Sopenharmony_ci# define BM_TEST BIT(2) 11762306a36Sopenharmony_ci# define BM_TEST_DIR BIT(3) 11862306a36Sopenharmony_ci# define DUAL_EDGE_ENABLE BIT(4) 11962306a36Sopenharmony_ci# define NO_TRANSFER_TO_HOST BIT(5) 12062306a36Sopenharmony_ci# define TRANSFER_GO BIT(7) 12162306a36Sopenharmony_ci# define BLIEND_MODE BIT(8) 12262306a36Sopenharmony_ci# define BM_START BIT(9) 12362306a36Sopenharmony_ci# define ADVANCED_BM_WRITE BIT(10) 12462306a36Sopenharmony_ci# define BM_SINGLE_MODE BIT(11) 12562306a36Sopenharmony_ci# define FIFO_TRUE_FULL BIT(12) 12662306a36Sopenharmony_ci# define FIFO_TRUE_EMPTY BIT(13) 12762306a36Sopenharmony_ci# define ALL_COUNTER_CLR BIT(14) 12862306a36Sopenharmony_ci# define FIFOTEST BIT(15) 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#define INDEX_REG 0x04 /* BASE+04, Byte(R/W), Word(R) */ 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define TIMER_SET 0x06 /* BASE+06, W, R/W */ 13362306a36Sopenharmony_ci# define TIMER_CNT_MASK (0xff) 13462306a36Sopenharmony_ci# define TIMER_STOP BIT(8) 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#define DATA_REG_LOW 0x08 /* BASE+08, LowW, R/W */ 13762306a36Sopenharmony_ci#define DATA_REG_HI 0x0a /* BASE+0a, Hi-W, R/W */ 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci#define FIFO_REST_CNT 0x0c /* BASE+0c, W, R/W */ 14062306a36Sopenharmony_ci# define FIFO_REST_MASK 0x1ff 14162306a36Sopenharmony_ci# define FIFO_EMPTY_SHLD_FLAG BIT(14) 14262306a36Sopenharmony_ci# define FIFO_FULL_SHLD_FLAG BIT(15) 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci#define SREQ_SMPL_RATE 0x0f /* BASE+0f, B, R/W */ 14562306a36Sopenharmony_ci# define SREQSMPLRATE_RATE0 BIT(0) 14662306a36Sopenharmony_ci# define SREQSMPLRATE_RATE1 BIT(1) 14762306a36Sopenharmony_ci# define SAMPLING_ENABLE BIT(2) 14862306a36Sopenharmony_ci# define SMPL_40M (0) /* 40MHz: 0-100ns/period */ 14962306a36Sopenharmony_ci# define SMPL_20M (SREQSMPLRATE_RATE0) /* 20MHz: 100-200ns/period */ 15062306a36Sopenharmony_ci# define SMPL_10M (SREQSMPLRATE_RATE1) /* 10Mhz: 200- ns/period */ 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci#define SCSI_BUS_CONTROL 0x10 /* BASE+10, B, R/W */ 15362306a36Sopenharmony_ci# define BUSCTL_SEL BIT(0) 15462306a36Sopenharmony_ci# define BUSCTL_RST BIT(1) 15562306a36Sopenharmony_ci# define BUSCTL_DATAOUT_ENB BIT(2) 15662306a36Sopenharmony_ci# define BUSCTL_ATN BIT(3) 15762306a36Sopenharmony_ci# define BUSCTL_ACK BIT(4) 15862306a36Sopenharmony_ci# define BUSCTL_BSY BIT(5) 15962306a36Sopenharmony_ci# define AUTODIRECTION BIT(6) 16062306a36Sopenharmony_ci# define ACKENB BIT(7) 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci#define CLR_COUNTER 0x12 /* BASE+12, B, W */ 16362306a36Sopenharmony_ci# define ACK_COUNTER_CLR BIT(0) 16462306a36Sopenharmony_ci# define SREQ_COUNTER_CLR BIT(1) 16562306a36Sopenharmony_ci# define FIFO_HOST_POINTER_CLR BIT(2) 16662306a36Sopenharmony_ci# define FIFO_REST_COUNT_CLR BIT(3) 16762306a36Sopenharmony_ci# define BM_COUNTER_CLR BIT(4) 16862306a36Sopenharmony_ci# define SAVED_ACK_CLR BIT(5) 16962306a36Sopenharmony_ci# define CLRCOUNTER_ALLMASK (ACK_COUNTER_CLR | \ 17062306a36Sopenharmony_ci SREQ_COUNTER_CLR | \ 17162306a36Sopenharmony_ci FIFO_HOST_POINTER_CLR | \ 17262306a36Sopenharmony_ci FIFO_REST_COUNT_CLR | \ 17362306a36Sopenharmony_ci BM_COUNTER_CLR | \ 17462306a36Sopenharmony_ci SAVED_ACK_CLR ) 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define SCSI_BUS_MONITOR 0x12 /* BASE+12, B, R */ 17762306a36Sopenharmony_ci# define BUSMON_MSG BIT(0) 17862306a36Sopenharmony_ci# define BUSMON_IO BIT(1) 17962306a36Sopenharmony_ci# define BUSMON_CD BIT(2) 18062306a36Sopenharmony_ci# define BUSMON_BSY BIT(3) 18162306a36Sopenharmony_ci# define BUSMON_ACK BIT(4) 18262306a36Sopenharmony_ci# define BUSMON_REQ BIT(5) 18362306a36Sopenharmony_ci# define BUSMON_SEL BIT(6) 18462306a36Sopenharmony_ci# define BUSMON_ATN BIT(7) 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci#define COMMAND_DATA 0x14 /* BASE+14, B, R/W */ 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci#define PARITY_CONTROL 0x16 /* BASE+16, B, W */ 18962306a36Sopenharmony_ci# define PARITY_CHECK_ENABLE BIT(0) 19062306a36Sopenharmony_ci# define PARITY_ERROR_CLEAR BIT(1) 19162306a36Sopenharmony_ci#define PARITY_STATUS 0x16 /* BASE+16, B, R */ 19262306a36Sopenharmony_ci//# define PARITY_CHECK_ENABLE BIT(0) 19362306a36Sopenharmony_ci# define PARITY_ERROR_NORMAL BIT(1) 19462306a36Sopenharmony_ci# define PARITY_ERROR_LSB BIT(1) 19562306a36Sopenharmony_ci# define PARITY_ERROR_MSB BIT(2) 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci#define RESELECT_ID 0x18 /* BASE+18, B, R */ 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci#define COMMAND_CONTROL 0x18 /* BASE+18, W, W */ 20062306a36Sopenharmony_ci# define CLEAR_CDB_FIFO_POINTER BIT(0) 20162306a36Sopenharmony_ci# define AUTO_COMMAND_PHASE BIT(1) 20262306a36Sopenharmony_ci# define AUTOSCSI_START BIT(2) 20362306a36Sopenharmony_ci# define AUTOSCSI_RESTART BIT(3) 20462306a36Sopenharmony_ci# define AUTO_PARAMETER BIT(4) 20562306a36Sopenharmony_ci# define AUTO_ATN BIT(5) 20662306a36Sopenharmony_ci# define AUTO_MSGIN_00_OR_04 BIT(6) 20762306a36Sopenharmony_ci# define AUTO_MSGIN_02 BIT(7) 20862306a36Sopenharmony_ci# define AUTO_MSGIN_03 BIT(8) 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci#define SET_ARBIT 0x1a /* BASE+1a, B, W */ 21162306a36Sopenharmony_ci# define ARBIT_GO BIT(0) 21262306a36Sopenharmony_ci# define ARBIT_CLEAR BIT(1) 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci#define ARBIT_STATUS 0x1a /* BASE+1a, B, R */ 21562306a36Sopenharmony_ci//# define ARBIT_GO BIT(0) 21662306a36Sopenharmony_ci# define ARBIT_WIN BIT(1) 21762306a36Sopenharmony_ci# define ARBIT_FAIL BIT(2) 21862306a36Sopenharmony_ci# define AUTO_PARAMETER_VALID BIT(3) 21962306a36Sopenharmony_ci# define SGT_VALID BIT(4) 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci#define SYNC_REG 0x1c /* BASE+1c, B, R/W */ 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ci#define ACK_WIDTH 0x1d /* BASE+1d, B, R/W */ 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci#define SCSI_DATA_WITH_ACK 0x20 /* BASE+20, B, R/W */ 22662306a36Sopenharmony_ci#define SCSI_OUT_LATCH_TARGET_ID 0x22 /* BASE+22, B, W */ 22762306a36Sopenharmony_ci#define SCSI_DATA_IN 0x22 /* BASE+22, B, R */ 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci#define SCAM_CONTROL 0x24 /* BASE+24, B, W */ 23062306a36Sopenharmony_ci#define SCAM_STATUS 0x24 /* BASE+24, B, R */ 23162306a36Sopenharmony_ci# define SCAM_MSG BIT(0) 23262306a36Sopenharmony_ci# define SCAM_IO BIT(1) 23362306a36Sopenharmony_ci# define SCAM_CD BIT(2) 23462306a36Sopenharmony_ci# define SCAM_BSY BIT(3) 23562306a36Sopenharmony_ci# define SCAM_SEL BIT(4) 23662306a36Sopenharmony_ci# define SCAM_XFEROK BIT(5) 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci#define SCAM_DATA 0x26 /* BASE+26, B, R/W */ 23962306a36Sopenharmony_ci# define SD0 BIT(0) 24062306a36Sopenharmony_ci# define SD1 BIT(1) 24162306a36Sopenharmony_ci# define SD2 BIT(2) 24262306a36Sopenharmony_ci# define SD3 BIT(3) 24362306a36Sopenharmony_ci# define SD4 BIT(4) 24462306a36Sopenharmony_ci# define SD5 BIT(5) 24562306a36Sopenharmony_ci# define SD6 BIT(6) 24662306a36Sopenharmony_ci# define SD7 BIT(7) 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci#define SACK_CNT 0x28 /* BASE+28, DW, R/W */ 24962306a36Sopenharmony_ci#define SREQ_CNT 0x2c /* BASE+2c, DW, R/W */ 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci#define FIFO_DATA_LOW 0x30 /* BASE+30, B/W/DW, R/W */ 25262306a36Sopenharmony_ci#define FIFO_DATA_HIGH 0x32 /* BASE+32, B/W, R/W */ 25362306a36Sopenharmony_ci#define BM_START_ADR 0x34 /* BASE+34, DW, R/W */ 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci#define BM_CNT 0x38 /* BASE+38, DW, R/W */ 25662306a36Sopenharmony_ci# define BM_COUNT_MASK 0x0001ffffUL 25762306a36Sopenharmony_ci# define SGTEND BIT(31) /* Last SGT marker */ 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci#define SGT_ADR 0x3c /* BASE+3c, DW, R/W */ 26062306a36Sopenharmony_ci#define WAIT_REG 0x40 /* Bi only */ 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci#define SCSI_EXECUTE_PHASE 0x40 /* BASE+40, W, R */ 26362306a36Sopenharmony_ci# define COMMAND_PHASE BIT(0) 26462306a36Sopenharmony_ci# define DATA_IN_PHASE BIT(1) 26562306a36Sopenharmony_ci# define DATA_OUT_PHASE BIT(2) 26662306a36Sopenharmony_ci# define MSGOUT_PHASE BIT(3) 26762306a36Sopenharmony_ci# define STATUS_PHASE BIT(4) 26862306a36Sopenharmony_ci# define ILLEGAL_PHASE BIT(5) 26962306a36Sopenharmony_ci# define BUS_FREE_OCCUER BIT(6) 27062306a36Sopenharmony_ci# define MSG_IN_OCCUER BIT(7) 27162306a36Sopenharmony_ci# define MSG_OUT_OCCUER BIT(8) 27262306a36Sopenharmony_ci# define SELECTION_TIMEOUT BIT(9) 27362306a36Sopenharmony_ci# define MSGIN_00_VALID BIT(10) 27462306a36Sopenharmony_ci# define MSGIN_02_VALID BIT(11) 27562306a36Sopenharmony_ci# define MSGIN_03_VALID BIT(12) 27662306a36Sopenharmony_ci# define MSGIN_04_VALID BIT(13) 27762306a36Sopenharmony_ci# define AUTOSCSI_BUSY BIT(15) 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci#define SCSI_CSB_IN 0x42 /* BASE+42, B, R */ 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci#define SCSI_MSG_OUT 0x44 /* BASE+44, DW, R/W */ 28262306a36Sopenharmony_ci# define MSGOUT_COUNT_MASK (BIT(0)|BIT(1)) 28362306a36Sopenharmony_ci# define MV_VALID BIT(7) 28462306a36Sopenharmony_ci 28562306a36Sopenharmony_ci#define SEL_TIME_OUT 0x48 /* BASE+48, W, R/W */ 28662306a36Sopenharmony_ci#define SAVED_SACK_CNT 0x4c /* BASE+4c, DW, R */ 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci#define HTOSDATADELAY 0x50 /* BASE+50, B, R/W */ 28962306a36Sopenharmony_ci#define STOHDATADELAY 0x54 /* BASE+54, B, R/W */ 29062306a36Sopenharmony_ci#define ACKSUMCHECKRD 0x58 /* BASE+58, W, R */ 29162306a36Sopenharmony_ci#define REQSUMCHECKRD 0x5c /* BASE+5c, W, R */ 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci/********************/ 29562306a36Sopenharmony_ci/* indexed register */ 29662306a36Sopenharmony_ci/********************/ 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci#define CLOCK_DIV 0x00 /* BASE+08, IDX+00, B, R/W */ 29962306a36Sopenharmony_ci# define CLOCK_2 BIT(0) /* MCLK/2 */ 30062306a36Sopenharmony_ci# define CLOCK_4 BIT(1) /* MCLK/4 */ 30162306a36Sopenharmony_ci# define PCICLK BIT(7) /* PCICLK (33MHz) */ 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci#define TERM_PWR_CONTROL 0x01 /* BASE+08, IDX+01, B, R/W */ 30462306a36Sopenharmony_ci# define BPWR BIT(0) 30562306a36Sopenharmony_ci# define SENSE BIT(1) /* Read Only */ 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci#define EXT_PORT_DDR 0x02 /* BASE+08, IDX+02, B, R/W */ 30862306a36Sopenharmony_ci#define EXT_PORT 0x03 /* BASE+08, IDX+03, B, R/W */ 30962306a36Sopenharmony_ci# define LED_ON (0) 31062306a36Sopenharmony_ci# define LED_OFF BIT(0) 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci#define IRQ_SELECT 0x04 /* BASE+08, IDX+04, W, R/W */ 31362306a36Sopenharmony_ci# define IRQSELECT_RESELECT_IRQ BIT(0) 31462306a36Sopenharmony_ci# define IRQSELECT_PHASE_CHANGE_IRQ BIT(1) 31562306a36Sopenharmony_ci# define IRQSELECT_SCSIRESET_IRQ BIT(2) 31662306a36Sopenharmony_ci# define IRQSELECT_TIMER_IRQ BIT(3) 31762306a36Sopenharmony_ci# define IRQSELECT_FIFO_SHLD_IRQ BIT(4) 31862306a36Sopenharmony_ci# define IRQSELECT_TARGET_ABORT_IRQ BIT(5) 31962306a36Sopenharmony_ci# define IRQSELECT_MASTER_ABORT_IRQ BIT(6) 32062306a36Sopenharmony_ci# define IRQSELECT_SERR_IRQ BIT(7) 32162306a36Sopenharmony_ci# define IRQSELECT_PERR_IRQ BIT(8) 32262306a36Sopenharmony_ci# define IRQSELECT_BMCNTERR_IRQ BIT(9) 32362306a36Sopenharmony_ci# define IRQSELECT_AUTO_SCSI_SEQ_IRQ BIT(10) 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci#define OLD_SCSI_PHASE 0x05 /* BASE+08, IDX+05, B, R */ 32662306a36Sopenharmony_ci# define OLD_MSG BIT(0) 32762306a36Sopenharmony_ci# define OLD_IO BIT(1) 32862306a36Sopenharmony_ci# define OLD_CD BIT(2) 32962306a36Sopenharmony_ci# define OLD_BUSY BIT(3) 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci#define FIFO_FULL_SHLD_COUNT 0x06 /* BASE+08, IDX+06, B, R/W */ 33262306a36Sopenharmony_ci#define FIFO_EMPTY_SHLD_COUNT 0x07 /* BASE+08, IDX+07, B, R/W */ 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci#define EXP_ROM_CONTROL 0x08 /* BASE+08, IDX+08, B, R/W */ /* external ROM control */ 33562306a36Sopenharmony_ci# define ROM_WRITE_ENB BIT(0) 33662306a36Sopenharmony_ci# define IO_ACCESS_ENB BIT(1) 33762306a36Sopenharmony_ci# define ROM_ADR_CLEAR BIT(2) 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci#define EXP_ROM_ADR 0x09 /* BASE+08, IDX+09, W, R/W */ 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_ci#define EXP_ROM_DATA 0x0a /* BASE+08, IDX+0a, B, R/W */ 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci#define CHIP_MODE 0x0b /* BASE+08, IDX+0b, B, R */ /* NinjaSCSI-32Bi only */ 34462306a36Sopenharmony_ci# define OEM0 BIT(1) /* OEM select */ /* 00=I-O DATA, 01=KME, 10=Workbit, 11=Ext ROM */ 34562306a36Sopenharmony_ci# define OEM1 BIT(2) /* OEM select */ 34662306a36Sopenharmony_ci# define OPTB BIT(3) /* KME mode select */ 34762306a36Sopenharmony_ci# define OPTC BIT(4) /* KME mode select */ 34862306a36Sopenharmony_ci# define OPTD BIT(5) /* KME mode select */ 34962306a36Sopenharmony_ci# define OPTE BIT(6) /* KME mode select */ 35062306a36Sopenharmony_ci# define OPTF BIT(7) /* Power management */ 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci#define MISC_WR 0x0c /* BASE+08, IDX+0c, W, R/W */ 35362306a36Sopenharmony_ci#define MISC_RD 0x0c 35462306a36Sopenharmony_ci# define SCSI_DIRECTION_DETECTOR_SELECT BIT(0) 35562306a36Sopenharmony_ci# define SCSI2_HOST_DIRECTION_VALID BIT(1) /* Read only */ 35662306a36Sopenharmony_ci# define HOST2_SCSI_DIRECTION_VALID BIT(2) /* Read only */ 35762306a36Sopenharmony_ci# define DELAYED_BMSTART BIT(3) 35862306a36Sopenharmony_ci# define MASTER_TERMINATION_SELECT BIT(4) 35962306a36Sopenharmony_ci# define BMREQ_NEGATE_TIMING_SEL BIT(5) 36062306a36Sopenharmony_ci# define AUTOSEL_TIMING_SEL BIT(6) 36162306a36Sopenharmony_ci# define MISC_MABORT_MASK BIT(7) 36262306a36Sopenharmony_ci# define BMSTOP_CHANGE2_NONDATA_PHASE BIT(8) 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_ci#define BM_CYCLE 0x0d /* BASE+08, IDX+0d, B, R/W */ 36562306a36Sopenharmony_ci# define BM_CYCLE0 BIT(0) 36662306a36Sopenharmony_ci# define BM_CYCLE1 BIT(1) 36762306a36Sopenharmony_ci# define BM_FRAME_ASSERT_TIMING BIT(2) 36862306a36Sopenharmony_ci# define BM_IRDY_ASSERT_TIMING BIT(3) 36962306a36Sopenharmony_ci# define BM_SINGLE_BUS_MASTER BIT(4) 37062306a36Sopenharmony_ci# define MEMRD_CMD0 BIT(5) 37162306a36Sopenharmony_ci# define SGT_AUTO_PARA_MEMED_CMD BIT(6) 37262306a36Sopenharmony_ci# define MEMRD_CMD1 BIT(7) 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci#define SREQ_EDGH 0x0e /* BASE+08, IDX+0e, B, W */ 37662306a36Sopenharmony_ci# define SREQ_EDGH_SELECT BIT(0) 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci#define UP_CNT 0x0f /* BASE+08, IDX+0f, B, W */ 37962306a36Sopenharmony_ci# define REQCNT_UP BIT(0) 38062306a36Sopenharmony_ci# define ACKCNT_UP BIT(1) 38162306a36Sopenharmony_ci# define BMADR_UP BIT(4) 38262306a36Sopenharmony_ci# define BMCNT_UP BIT(5) 38362306a36Sopenharmony_ci# define SGT_CNT_UP BIT(7) 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci#define CFG_CMD_STR 0x10 /* BASE+08, IDX+10, W, R */ 38662306a36Sopenharmony_ci#define CFG_LATE_CACHE 0x11 /* BASE+08, IDX+11, W, R/W */ 38762306a36Sopenharmony_ci#define CFG_BASE_ADR_1 0x12 /* BASE+08, IDX+12, W, R */ 38862306a36Sopenharmony_ci#define CFG_BASE_ADR_2 0x13 /* BASE+08, IDX+13, W, R */ 38962306a36Sopenharmony_ci#define CFG_INLINE 0x14 /* BASE+08, IDX+14, W, R */ 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ci#define SERIAL_ROM_CTL 0x15 /* BASE+08, IDX+15, B, R */ 39262306a36Sopenharmony_ci# define SCL BIT(0) 39362306a36Sopenharmony_ci# define ENA BIT(1) 39462306a36Sopenharmony_ci# define SDA BIT(2) 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_ci#define FIFO_HST_POINTER 0x16 /* BASE+08, IDX+16, B, R/W */ 39762306a36Sopenharmony_ci#define SREQ_DELAY 0x17 /* BASE+08, IDX+17, B, R/W */ 39862306a36Sopenharmony_ci#define SACK_DELAY 0x18 /* BASE+08, IDX+18, B, R/W */ 39962306a36Sopenharmony_ci#define SREQ_NOISE_CANCEL 0x19 /* BASE+08, IDX+19, B, R/W */ 40062306a36Sopenharmony_ci#define SDP_NOISE_CANCEL 0x1a /* BASE+08, IDX+1a, B, R/W */ 40162306a36Sopenharmony_ci#define DELAY_TEST 0x1b /* BASE+08, IDX+1b, B, R/W */ 40262306a36Sopenharmony_ci#define SD0_NOISE_CANCEL 0x20 /* BASE+08, IDX+20, B, R/W */ 40362306a36Sopenharmony_ci#define SD1_NOISE_CANCEL 0x21 /* BASE+08, IDX+21, B, R/W */ 40462306a36Sopenharmony_ci#define SD2_NOISE_CANCEL 0x22 /* BASE+08, IDX+22, B, R/W */ 40562306a36Sopenharmony_ci#define SD3_NOISE_CANCEL 0x23 /* BASE+08, IDX+23, B, R/W */ 40662306a36Sopenharmony_ci#define SD4_NOISE_CANCEL 0x24 /* BASE+08, IDX+24, B, R/W */ 40762306a36Sopenharmony_ci#define SD5_NOISE_CANCEL 0x25 /* BASE+08, IDX+25, B, R/W */ 40862306a36Sopenharmony_ci#define SD6_NOISE_CANCEL 0x26 /* BASE+08, IDX+26, B, R/W */ 40962306a36Sopenharmony_ci#define SD7_NOISE_CANCEL 0x27 /* BASE+08, IDX+27, B, R/W */ 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci 41262306a36Sopenharmony_ci/* 41362306a36Sopenharmony_ci * Useful Bus Monitor status combinations. 41462306a36Sopenharmony_ci */ 41562306a36Sopenharmony_ci#define BUSMON_BUS_FREE 0 41662306a36Sopenharmony_ci#define BUSMON_COMMAND ( BUSMON_BSY | BUSMON_CD | BUSMON_REQ ) 41762306a36Sopenharmony_ci#define BUSMON_MESSAGE_IN ( BUSMON_BSY | BUSMON_MSG | BUSMON_IO | BUSMON_CD | BUSMON_REQ ) 41862306a36Sopenharmony_ci#define BUSMON_MESSAGE_OUT ( BUSMON_BSY | BUSMON_MSG | BUSMON_CD | BUSMON_REQ ) 41962306a36Sopenharmony_ci#define BUSMON_DATA_IN ( BUSMON_BSY | BUSMON_IO | BUSMON_REQ ) 42062306a36Sopenharmony_ci#define BUSMON_DATA_OUT ( BUSMON_BSY | BUSMON_REQ ) 42162306a36Sopenharmony_ci#define BUSMON_STATUS ( BUSMON_BSY | BUSMON_IO | BUSMON_CD | BUSMON_REQ ) 42262306a36Sopenharmony_ci#define BUSMON_RESELECT ( BUSMON_IO | BUSMON_SEL) 42362306a36Sopenharmony_ci#define BUSMON_PHASE_MASK ( BUSMON_MSG | BUSMON_IO | BUSMON_CD | BUSMON_SEL) 42462306a36Sopenharmony_ci 42562306a36Sopenharmony_ci#define BUSPHASE_COMMAND ( BUSMON_COMMAND & BUSMON_PHASE_MASK ) 42662306a36Sopenharmony_ci#define BUSPHASE_MESSAGE_IN ( BUSMON_MESSAGE_IN & BUSMON_PHASE_MASK ) 42762306a36Sopenharmony_ci#define BUSPHASE_MESSAGE_OUT ( BUSMON_MESSAGE_OUT & BUSMON_PHASE_MASK ) 42862306a36Sopenharmony_ci#define BUSPHASE_DATA_IN ( BUSMON_DATA_IN & BUSMON_PHASE_MASK ) 42962306a36Sopenharmony_ci#define BUSPHASE_DATA_OUT ( BUSMON_DATA_OUT & BUSMON_PHASE_MASK ) 43062306a36Sopenharmony_ci#define BUSPHASE_STATUS ( BUSMON_STATUS & BUSMON_PHASE_MASK ) 43162306a36Sopenharmony_ci#define BUSPHASE_SELECT ( BUSMON_SEL | BUSMON_IO ) 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci/************************************************************************ 43562306a36Sopenharmony_ci * structure for DMA/Scatter Gather list 43662306a36Sopenharmony_ci */ 43762306a36Sopenharmony_ci#define NSP32_SG_SIZE SG_ALL 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_citypedef struct _nsp32_sgtable { 44062306a36Sopenharmony_ci /* values must be little endian */ 44162306a36Sopenharmony_ci u32_le addr; /* transfer address */ 44262306a36Sopenharmony_ci u32_le len; /* transfer length. BIT(31) is for SGT_END mark */ 44362306a36Sopenharmony_ci} __attribute__ ((packed)) nsp32_sgtable; 44462306a36Sopenharmony_ci 44562306a36Sopenharmony_citypedef struct _nsp32_sglun { 44662306a36Sopenharmony_ci nsp32_sgtable sgt[NSP32_SG_SIZE+1]; /* SG table */ 44762306a36Sopenharmony_ci} __attribute__ ((packed)) nsp32_sglun; 44862306a36Sopenharmony_ci#define NSP32_SG_TABLE_SIZE (sizeof(nsp32_sgtable) * NSP32_SG_SIZE * MAX_TARGET * MAX_LUN) 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_ci/* Auto parameter mode memory map. */ 45162306a36Sopenharmony_ci/* All values must be little endian. */ 45262306a36Sopenharmony_citypedef struct _nsp32_autoparam { 45362306a36Sopenharmony_ci u8 cdb[4 * 0x10]; /* SCSI Command */ 45462306a36Sopenharmony_ci u32_le msgout; /* outgoing messages */ 45562306a36Sopenharmony_ci u8 syncreg; /* sync register value */ 45662306a36Sopenharmony_ci u8 ackwidth; /* ack width register value */ 45762306a36Sopenharmony_ci u8 target_id; /* target/host device id */ 45862306a36Sopenharmony_ci u8 sample_reg; /* hazard killer sampling rate */ 45962306a36Sopenharmony_ci u16_le command_control; /* command control register */ 46062306a36Sopenharmony_ci u16_le transfer_control; /* transfer control register */ 46162306a36Sopenharmony_ci u32_le sgt_pointer; /* SG table physical address for DMA */ 46262306a36Sopenharmony_ci u32_le dummy[2]; 46362306a36Sopenharmony_ci} __attribute__ ((packed)) nsp32_autoparam; /* must be packed struct */ 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci/* 46662306a36Sopenharmony_ci * host data structure 46762306a36Sopenharmony_ci */ 46862306a36Sopenharmony_ci/* message in/out buffer */ 46962306a36Sopenharmony_ci#define MSGOUTBUF_MAX 20 47062306a36Sopenharmony_ci#define MSGINBUF_MAX 20 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ci/* flag for trans_method */ 47362306a36Sopenharmony_ci#define NSP32_TRANSFER_BUSMASTER BIT(0) 47462306a36Sopenharmony_ci#define NSP32_TRANSFER_MMIO BIT(1) /* Not supported yet */ 47562306a36Sopenharmony_ci#define NSP32_TRANSFER_PIO BIT(2) /* Not supported yet */ 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci/* 47962306a36Sopenharmony_ci * structure for connected LUN dynamic data 48062306a36Sopenharmony_ci * 48162306a36Sopenharmony_ci * Note: Currently tagged queuing is disabled, each nsp32_lunt holds 48262306a36Sopenharmony_ci * one SCSI command and one state. 48362306a36Sopenharmony_ci */ 48462306a36Sopenharmony_ci#define DISCPRIV_OK BIT(0) /* DISCPRIV Enable mode */ 48562306a36Sopenharmony_ci#define MSGIN03 BIT(1) /* Auto Msg In 03 Flag */ 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_citypedef struct _nsp32_lunt { 48862306a36Sopenharmony_ci struct scsi_cmnd *SCpnt; /* Current Handling struct scsi_cmnd */ 48962306a36Sopenharmony_ci unsigned long save_datp; /* Save Data Pointer - saved position from initial address */ 49062306a36Sopenharmony_ci int msgin03; /* auto msg in 03 flag */ 49162306a36Sopenharmony_ci unsigned int sg_num; /* Total number of SG entries */ 49262306a36Sopenharmony_ci int cur_entry; /* Current SG entry number */ 49362306a36Sopenharmony_ci nsp32_sglun *sglun; /* sg table per lun */ 49462306a36Sopenharmony_ci dma_addr_t sglun_paddr; /* sglun physical address */ 49562306a36Sopenharmony_ci} nsp32_lunt; 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ci/* 49962306a36Sopenharmony_ci * SCSI TARGET/LUN definition 50062306a36Sopenharmony_ci */ 50162306a36Sopenharmony_ci#define NSP32_HOST_SCSIID 7 /* SCSI initiator is every time defined as 7 */ 50262306a36Sopenharmony_ci#define MAX_TARGET 8 50362306a36Sopenharmony_ci#define MAX_LUN 8 /* XXX: In SPI3, max number of LUN is 64. */ 50462306a36Sopenharmony_ci 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_citypedef struct _nsp32_sync_table { 50762306a36Sopenharmony_ci unsigned char period_num; /* period number */ 50862306a36Sopenharmony_ci unsigned char ackwidth; /* ack width designated by period */ 50962306a36Sopenharmony_ci unsigned char start_period; /* search range - start period */ 51062306a36Sopenharmony_ci unsigned char end_period; /* search range - end period */ 51162306a36Sopenharmony_ci unsigned char sample_rate; /* hazard killer parameter */ 51262306a36Sopenharmony_ci} nsp32_sync_table; 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci 51562306a36Sopenharmony_ci/* 51662306a36Sopenharmony_ci * structure for target device static data 51762306a36Sopenharmony_ci */ 51862306a36Sopenharmony_ci/* flag for nsp32_target.sync_flag */ 51962306a36Sopenharmony_ci#define SDTR_INITIATOR BIT(0) /* sending SDTR from initiator */ 52062306a36Sopenharmony_ci#define SDTR_TARGET BIT(1) /* sending SDTR from target */ 52162306a36Sopenharmony_ci#define SDTR_DONE BIT(2) /* exchanging SDTR has been processed */ 52262306a36Sopenharmony_ci 52362306a36Sopenharmony_ci/* syncronous period value for nsp32_target.config_max */ 52462306a36Sopenharmony_ci#define FAST5M 0x32 52562306a36Sopenharmony_ci#define FAST10M 0x19 52662306a36Sopenharmony_ci#define ULTRA20M 0x0c 52762306a36Sopenharmony_ci 52862306a36Sopenharmony_ci/* flag for nsp32_target.{sync_offset}, period */ 52962306a36Sopenharmony_ci#define ASYNC_OFFSET 0 /* asynchronous transfer */ 53062306a36Sopenharmony_ci#define SYNC_OFFSET 0xf /* synchronous transfer max offset */ 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci/* syncreg: 53362306a36Sopenharmony_ci bit:07 06 05 04 03 02 01 00 53462306a36Sopenharmony_ci ---PERIOD-- ---OFFSET-- */ 53562306a36Sopenharmony_ci#define TO_SYNCREG(period, offset) (((period) & 0x0f) << 4 | ((offset) & 0x0f)) 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_cistruct nsp32_cmd_priv { 53862306a36Sopenharmony_ci enum sam_status status; 53962306a36Sopenharmony_ci}; 54062306a36Sopenharmony_ci 54162306a36Sopenharmony_cistatic inline struct nsp32_cmd_priv *nsp32_priv(struct scsi_cmnd *cmd) 54262306a36Sopenharmony_ci{ 54362306a36Sopenharmony_ci return scsi_cmd_priv(cmd); 54462306a36Sopenharmony_ci} 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_citypedef struct _nsp32_target { 54762306a36Sopenharmony_ci unsigned char syncreg; /* value for SYNCREG */ 54862306a36Sopenharmony_ci unsigned char ackwidth; /* value for ACKWIDTH */ 54962306a36Sopenharmony_ci unsigned char period; /* sync period (0-255) */ 55062306a36Sopenharmony_ci unsigned char offset; /* sync offset (0-15) */ 55162306a36Sopenharmony_ci int sync_flag; /* SDTR_*, 0 */ 55262306a36Sopenharmony_ci int limit_entry; /* max speed limit entry designated 55362306a36Sopenharmony_ci by EEPROM configuration */ 55462306a36Sopenharmony_ci unsigned char sample_reg; /* SREQ hazard killer register */ 55562306a36Sopenharmony_ci} nsp32_target; 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_citypedef struct _nsp32_hw_data { 55862306a36Sopenharmony_ci int IrqNumber; 55962306a36Sopenharmony_ci int BaseAddress; 56062306a36Sopenharmony_ci int NumAddress; 56162306a36Sopenharmony_ci void __iomem *MmioAddress; 56262306a36Sopenharmony_ci#define NSP32_MMIO_OFFSET 0x0800 56362306a36Sopenharmony_ci unsigned long MmioLength; 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_ci struct scsi_cmnd *CurrentSC; 56662306a36Sopenharmony_ci 56762306a36Sopenharmony_ci struct pci_dev *Pci; 56862306a36Sopenharmony_ci const struct pci_device_id *pci_devid; 56962306a36Sopenharmony_ci struct Scsi_Host *Host; 57062306a36Sopenharmony_ci spinlock_t Lock; 57162306a36Sopenharmony_ci 57262306a36Sopenharmony_ci char info_str[100]; 57362306a36Sopenharmony_ci 57462306a36Sopenharmony_ci /* allocated memory region */ 57562306a36Sopenharmony_ci nsp32_sglun *sg_list; /* sglist virtuxal address */ 57662306a36Sopenharmony_ci dma_addr_t sg_paddr; /* physical address of hw_sg_table */ 57762306a36Sopenharmony_ci nsp32_autoparam *autoparam; /* auto parameter transfer region */ 57862306a36Sopenharmony_ci dma_addr_t auto_paddr; /* physical address of autoparam */ 57962306a36Sopenharmony_ci int cur_entry; /* current sgt entry */ 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci /* target/LUN */ 58262306a36Sopenharmony_ci nsp32_lunt *cur_lunt; /* Current connected LUN table */ 58362306a36Sopenharmony_ci nsp32_lunt lunt[MAX_TARGET][MAX_LUN]; /* All LUN table */ 58462306a36Sopenharmony_ci 58562306a36Sopenharmony_ci nsp32_target *cur_target; /* Current connected SCSI ID */ 58662306a36Sopenharmony_ci nsp32_target target[MAX_TARGET]; /* SCSI ID */ 58762306a36Sopenharmony_ci int cur_id; /* Current connected target ID */ 58862306a36Sopenharmony_ci int cur_lun; /* Current connected target LUN */ 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci /* behavior setting parameters */ 59162306a36Sopenharmony_ci int trans_method; /* transfer method flag */ 59262306a36Sopenharmony_ci int resettime; /* Reset time */ 59362306a36Sopenharmony_ci int clock; /* clock dividing flag */ 59462306a36Sopenharmony_ci nsp32_sync_table *synct; /* sync_table determined by clock */ 59562306a36Sopenharmony_ci int syncnum; /* the max number of synct element */ 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci /* message buffer */ 59862306a36Sopenharmony_ci unsigned char msgoutbuf[MSGOUTBUF_MAX]; /* msgout buffer */ 59962306a36Sopenharmony_ci char msgout_len; /* msgoutbuf length */ 60062306a36Sopenharmony_ci unsigned char msginbuf [MSGINBUF_MAX]; /* megin buffer */ 60162306a36Sopenharmony_ci char msgin_len; /* msginbuf length */ 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_ci} nsp32_hw_data; 60462306a36Sopenharmony_ci 60562306a36Sopenharmony_ci/* 60662306a36Sopenharmony_ci * TIME definition 60762306a36Sopenharmony_ci */ 60862306a36Sopenharmony_ci#define RESET_HOLD_TIME 10000 /* reset time in us (SCSI-2 says the 60962306a36Sopenharmony_ci minimum is 25us) */ 61062306a36Sopenharmony_ci#define SEL_TIMEOUT_TIME 10000 /* 250ms defined in SCSI specification 61162306a36Sopenharmony_ci (25.6us/1unit) */ 61262306a36Sopenharmony_ci#define ARBIT_TIMEOUT_TIME 100 /* 100us */ 61362306a36Sopenharmony_ci#define REQSACK_TIMEOUT_TIME 10000 /* max wait time for REQ/SACK assertion 61462306a36Sopenharmony_ci or negation, 10000us == 10ms */ 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_ci#endif /* _NSP32_H */ 61762306a36Sopenharmony_ci/* end */ 618