LSI/MPT target driver added

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@49 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2006-12-13 11:42:59 +00:00
parent 097d281f04
commit 58c3c9893a
11 changed files with 6527 additions and 0 deletions

View File

@@ -21,28 +21,34 @@
SCST_DIR=scst
QLA_INI_DIR=qla2x00t
QLA_DIR=qla2x00t/qla2x00-target
LSI_DIR=mpt
all:
cd $(SCST_DIR) && $(MAKE) $@
@if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi
@if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi
install:
cd $(SCST_DIR) && $(MAKE) $@
@if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi
@if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi
uninstall:
cd $(SCST_DIR) && $(MAKE) $@
@if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi
@if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi
clean:
cd $(SCST_DIR) && $(MAKE) $@
@if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi
@if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi
@if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi
extraclean:
cd $(SCST_DIR) && $(MAKE) $@
@if [ -d $(QLA_INI_DIR) ]; then cd $(QLA_INI_DIR) && $(MAKE) $@; fi
@if [ -d $(QLA_DIR) ]; then cd $(QLA_DIR) && $(MAKE) $@; fi
@if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi
scst:
cd $(SCST_DIR) && $(MAKE)
@@ -76,6 +82,21 @@ qla_extraclean:
cd $(QLA_INI_DIR)/.. && $(MAKE) extraclean
cd $(QLA_DIR) && $(MAKE) extraclean
lsi:
cd $(LSI_DIR) && $(MAKE)
lsi_install:
cd $(LSI_DIR) && $(MAKE) install
lsi_uninstall:
cd $(LSI_DIR) && $(MAKE) uninstall
lsi_clean:
cd $(LSI_DIR) && $(MAKE) clean
lsi_extraclean:
cd $(LSI_DIR) && $(MAKE) extraclean
help:
@echo " all (the default) : make all"
@echo " clean : clean files"
@@ -94,9 +115,16 @@ help:
@echo " qla_extraclean : 2.6 qla target: clean + clean dependencies"
@echo " qla_install : 2.6 qla target: install"
@echo " qla_uninstall : 2.6 qla target: uninstall"
@echo ""
@echo " lsi : make lsi target"
@echo " lsi_clean : lsi target: clean "
@echo " lsi_extraclean : lsi target: clean + clean dependencies"
@echo " lsi_install : lsi target: install"
@echo " lsi_uninstall : lsi target: uninstall"
@echo " Notes :"
@echo " - install and uninstall must be made as root"
.PHONY: all install uninstall clean extraclean help \
qla qla_install qla_uninstall qla_clean qla_extraclean \
lsi lsi_install lsi_uninstall lsi_clean lsi_extraclean \
scst scst_install scst_uninstall scst_clean scst_extraclean

10
mpt/Kconfig Normal file
View File

@@ -0,0 +1,10 @@
config FUSION_SCST
tristate "Fusion MPT SCST driver"
depends on FUSION
---help---
This module enables target mode for use by the SCST middle
level drivers. You will also need the SCST middle level
drivers from http://scst.sf.net/.
If unsure whether you really want or need this, say N.

90
mpt/Makefile Normal file
View File

@@ -0,0 +1,90 @@
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Main targets:
# all (the default) : make all
# clean : clean files
# extraclean : clean + clean dependencies
# install : install
# uninstall : uninstall
#
# Notes :
# - install and uninstall must be made as root
#
#SCST_INC_DIR := /usr/local/include/scst
#SCST_DIR := $(SCST_INC_DIR)
SCST_INC_DIR := $(SUBDIRS)/../scst/include
SCST_DIR := $(shell pwd)/../scst/src
EXTRA_CFLAGS += -I$(SCST_INC_DIR)
EXTRA_CFLAGS += -DEXTRACHECKS
#EXTRA_CFLAGS += -DTRACING
#EXTRA_CFLAGS += -DDEBUG
#EXTRA_CFLAGS += -DDEBUG_WORK_IN_THREAD
ifeq ($(KVER),)
ifeq ($(KDIR),)
KDIR := /lib/modules/$(shell uname -r)/build
endif
else
KDIR := /lib/modules/$(KVER)/build
endif
LSI_INC_DIR := $(KDIR)/drivers/message/fusion
EXTRA_CFLAGS += -I$(LSI_INC_DIR)
ifneq ($(KERNELRELEASE),)
obj-m := mpt_scst.o
else
all: Modules.symvers Module.symvers
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m
tgt: Modules.symvers Module.symvers
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=n
install: all
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \
modules_install
-depmod -a
SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null)
ifneq ($(SCST_MOD_VERS),)
Modules.symvers: $(SCST_DIR)/Modules.symvers
cp $(SCST_DIR)/Modules.symvers .
else
.PHONY: Modules.symvers
endif
# It's renamed in 2.6.18
SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Module.symvers 2>/dev/null)
ifneq ($(SCST_MOD_VERS),)
Module.symvers: $(SCST_DIR)/Module.symvers
cp $(SCST_DIR)/Module.symvers .
else
.PHONY: Module.symvers
endif
uninstall:
rm -f $(INSTALL_DIR)/mpt_scst.ko
-/sbin/depmod -a
endif
clean:
rm -f *.o *.ko .*.cmd *.mod.c .*.d .depend *~ Modules.symvers Module.symvers
rm -rf .tmp_versions
extraclean: clean
.PHONY: all tgt install uninstall clean extraclean

12
mpt/README Normal file
View File

@@ -0,0 +1,12 @@
Target driver for LSI/MPT XXX cards
===================================
Version X.X.X, XX XXX 200X
--------------------------
This driver was originally developed by Hu Gang and then is developed by
Erik Habbinga <erikhabbinga@inphase-tech.com>. It is on the early stage
of development.
The current maintainer of this driver is Erik. Please send him all
question related to it (CC: scst-devel@lists.sourceforge.net).

10
mpt/in-tree/Kconfig.diff Normal file
View File

@@ -0,0 +1,10 @@
--- Kconfig_orig 2006-03-05 22:07:54.000000000 +0300
+++ Kconfig 2006-12-13 13:00:41.000000000 +0300
@@ -100,4 +100,7 @@
If unsure whether you really want or need this, say N.
+config FUSION_SCST
+ source "drivers/message/fusion/mpt_scst/Kconfig"
+
endmenu

30
mpt/in-tree/Makefile.diff Normal file
View File

@@ -0,0 +1,30 @@
--- Makefile_orig 2006-03-05 22:07:54.000000000 +0300
+++ Makefile 2006-12-13 14:11:52.000000000 +0300
@@ -8,7 +8,6 @@
#EXTRA_CFLAGS += -DMPT_DEBUG_EXIT
#EXTRA_CFLAGS += -DMPT_DEBUG_FAIL
-
#
# driver/module specifics...
#
@@ -30,9 +29,19 @@
#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
#
+SCST_INC_DIR := /usr/local/include/scst
+SCST_DIR := $(SCST_INC_DIR)
+
+CFLAGS_mpt_scst.o += -I$(SCST_INC_DIR) -I$(src)
+CFLAGS_mpt_scst.o += -DEXTRACHECKS
+#CFLAGS_mpt_scst.o += -DTRACING
+#CFLAGS_mpt_scst.o += -DDEBUG
+#CFLAGS_mpt_scst.o += -DDEBUG_WORK_IN_THREAD
+
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
obj-$(CONFIG_FUSION_SPI) += mptbase.o mptscsih.o mptspi.o
+obj-$(CONFIG_FUSION_SCST) += mpt_scst/mpt_scst.o
obj-$(CONFIG_FUSION_FC) += mptbase.o mptscsih.o mptfc.o
obj-$(CONFIG_FUSION_SAS) += mptbase.o mptscsih.o mptsas.o
obj-$(CONFIG_FUSION_CTL) += mptctl.o

5241
mpt/mpt_scst.c Normal file

File diff suppressed because it is too large Load Diff

366
mpt/mpt_scst.h Normal file
View File

@@ -0,0 +1,366 @@
#ifndef __MPT_SCST_H
#define __MPT_SCST_H
#if defined(MODULE) && !defined(__GENKSYMS__)
#include <linux/config.h>
#include <linux/module.h>
#endif
#ifdef __linux__
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/miscdevice.h>
#include <linux/proc_fs.h>
#include <linux/smp_lock.h>
#include <linux/highmem.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/div64.h>
#endif
#define _HS_SLEEP ,0
#define _IOC_ID ioc
#define _HANDLE_IOC_ID ioc
#ifndef MPT_STM_64_BIT_DMA /* determines the size of DMA addresses */
#define MPT_STM_64_BIT_DMA 1
#endif
#include "linux_compat.h"
#include "mptbase.h"
#ifndef MPI_IOCLOGINFO_FC_LINK_ALREADY_INITIALIZED
#define MPI_IOCLOGINFO_FC_LINK_ALREADY_INITIALIZED 0x24000002
#endif
#define MF_TO_INDEX(mf) le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx)
#include "scsi3.h"
/*****************************************************************************/
#ifdef MPI_STM_IO_DEBUG
#define dioprintk printk
#else
#define dioprintk printk
#endif
typedef MPI_TARGET_FCP_CMD_BUFFER FCP_CMD;
typedef MPI_TARGET_SCSI_SPI_CMD_BUFFER SCSI_CMD;
#define SSP_CMD_FRAME 0x06
#define SSP_TASK_FRAME 0x16
typedef MPI_TARGET_SSP_CMD_BUFFER SSP_CMD;
typedef MPI_TARGET_SSP_TASK_BUFFER SSP_TASK;
#define FCP_REQUEST_CONFIRM (1<<4)
#define FCP_RESID_UNDER (1<<3)
#define FCP_RESID_OVER (1<<2)
#define FCP_SENSE_LEN_VALID (1<<1)
#define FCP_RSP_LEN_VALID (1<<0)
typedef struct _FCP_RSP /* this struct is wrong in rev 1.02.04 of mpi_targ.h */
{
U8 Reserved0[8]; /* 00h */
U8 Reserved1[2]; /* 08h */
U8 FcpFlags; /* 0Ah */
U8 FcpStatus; /* 0Bh */
U32 FcpResid; /* 0Ch */
U32 FcpSenseLength; /* 10h */
U32 FcpResponseLength; /* 14h */
U8 FcpResponseData[8]; /* 18h */
U8 FcpSenseData[32]; /* Pad to 64 bytes */ /* 20h */
} FCP_RSP;
#define SCSI_SENSE_LEN_VALID (1<<1)
#define SCSI_RSP_LEN_VALID (1<<0)
typedef MPI_TARGET_SCSI_SPI_STATUS_IU SCSI_RSP;
#define SSP_SENSE_LEN_VALID (1<<1)
#define SSP_RSP_LEN_VALID (1<<0)
typedef MPI_TARGET_SSP_RSP_IU SSP_RSP;
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* Fusion MPT STM private structures
*/
#define IsFc(priv) \
(priv->ioc->pfacts[0].PortType == MPI_PORTFACTS_PORTTYPE_FC)
#define IsScsi(priv) \
(priv->ioc->pfacts[0].PortType == MPI_PORTFACTS_PORTTYPE_SCSI)
#define IsSas(priv) \
(priv->ioc->pfacts[0].PortType == MPI_PORTFACTS_PORTTYPE_SAS)
#define ABORT_ALL (-1)
#define NUM_CMD_BUFFERS 128
#define NUM_ELS_BUFFERS 64
#define NUM_ALIASES 0 /* 0 to 125, hardware restriction */
#define ELS 0x22
#define FC4LS 0x32
#define ABTS 0x81
#define BA_ACC 0x84
#define LS_RJT 0x01
#define LS_ACC 0x02
#define PLOGI 0x03
#define LOGO 0x05
#define SRR 0x14
#define PRLI 0x20
#define PRLO 0x21
#define ADISC 0x52
#define RSCN 0x61
typedef struct _MPT_SGE
{
u32 length;
#if MPT_STM_64_BIT_DMA
u64 address;
#else
u32 address;
#endif
} MPT_SGE;
#define NUM_SGES 64
#define NUM_CHAINS (NUM_SGES/8) /* one chain for every 8 SGEs */
typedef struct _CMD {
u8 cmd[64];
u8 rsp[64];
MPT_SGE chain_sge[NUM_SGES+NUM_CHAINS];
u32 reply_word;
int alias;
int lun;
int tag;
} CMD;
typedef struct _FC_ELS {
u32 fc_els[32];
} FC_ELS;
typedef struct _MPT_STM_HW {
CMD cmd_buf[NUM_CMD_BUFFERS];
FC_ELS fc_link_serv_buf[NUM_ELS_BUFFERS];
u32 config_buf[256];
u32 ctsend_buf[256];
u32 exlink_buf[32];
} MPT_STM_HW;
typedef struct _MPT_SGL
{
u32 num_sges;
MPT_SGE sge[NUM_SGES];
} MPT_SGL;
typedef struct _MPT_STM_PRIV
{
MPT_ADAPTER *ioc;
int enable_target_mode;
int fcp2_capable;
int num_sge_chain;
int num_sge_target_assist;
int num_cmd_buffers;
int num_els_buffers;
int num_aliases;
MPT_STM_HW *hw;
dma_addr_t hw_dma;
U64 wwnn;
U64 wwpn;
int port_id;
int protocol;
volatile int port_flags;
volatile int port_speed;
volatile int port_state;
volatile int device_changed;
int port_enable_loginfo;
volatile int port_enable_pending;
volatile int target_mode_abort_pending;
volatile int link_serv_abort_pending;
volatile int fc_primitive_send_pending;
volatile int ex_link_service_send_pending;
volatile int config_pending;
volatile int in_reset;
volatile int poll_enabled;
volatile int exiting;
MPT_FRAME_HDR *config_mf;
ConfigReply_t config_rep;
volatile int io_state[NUM_CMD_BUFFERS];
volatile int els_state[NUM_ELS_BUFFERS];
MPT_FRAME_HDR *current_mf[NUM_CMD_BUFFERS];
MPT_FRAME_HDR *status_deferred_mf[NUM_CMD_BUFFERS];
MPT_SGL sgl;
SCSIPortPage0_t SCSIPortPage0;
SCSIPortPage1_t SCSIPortPage1;
SCSIPortPage2_t SCSIPortPage2;
#define NUM_SCSI_DEVICES 16
SCSIDevicePage1_t SCSIDevicePage1[NUM_SCSI_DEVICES];
struct mpt_tgt *tgt;
struct scst_cmd *scst_cmd[NUM_CMD_BUFFERS];
} MPT_STM_PRIV;
#define IO_STATE_POSTED 0x1
#define IO_STATE_DATA_SENT 0x2
#define IO_STATE_STATUS_SENT 0x4
#define IO_STATE_STATUS_DEFERRED 0x8
#define IO_STATE_INCOMPLETE 0x10
#define IO_STATE_AUTO_REPOST 0x20
#define IO_STATE_ABORTED 0x40
#define IO_STATE_HIGH_PRIORITY 0x80
#define IO_STATE_REQUEST_ABORTED 0x100
#define IO_STATE_REISSUE_REQUEST 0x200
#define IO_STATE_ADJUST_OFFSET 0x400
#define IO_STATE_CONVERT_TA_TO_TSS 0x800
#define IO_STATE_REDO_COMMAND 0x1000
#define get2bytes(x, y) ((x[y] << 8) + x[y+1])
#define get3bytes(x, y) ((x[y] << 16) + (x[y+1] << 8) + x[y+2])
#define get4bytes(x, y) ((x[y] << 24) + (x[y+1] << 16) + (x[y+2] << 8) + x[y+3])
#define get8bytes(x, y) (((u64)get4bytes(x, y) << 32) + get4bytes(x, y+4))
#define InitiatorIndex_0100 Reserved_0100_InitiatorIndex
#define FWVersion_0101 Reserved_0101_FWVersion
#define EventDataSasPhyLinkStatus_t MpiEventDataSasPhyLinkStatus_t
#ifndef MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS
#define MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS (0x02000000)
#endif
#ifndef PRIORITY_REASON_TARGET_BUSY
#define PRIORITY_REASON_TARGET_BUSY (0x09)
#endif
#if MPT_STM_64_BIT_DMA
#define MPT_STM_SIMPLE SGESimple64_t
#define MPT_STM_CHAIN SGEChain64_t
#define MPI_SGE_FLAGS_MPT_STM_ADDRESSING MPI_SGE_FLAGS_64_BIT_ADDRESSING
#define stm_get_dma_addr(x, y) \
x = le32_to_cpu(y.Low); \
if (sizeof(dma_addr_t) == sizeof(u64)) \
x |= (u64)le32_to_cpu(y.High)<<32;
#define stm_set_dma_addr(x, y) \
x.Low = cpu_to_le32(y); \
if (sizeof(dma_addr_t) == sizeof(u64)) \
x.High = cpu_to_le32((u64)y>>32); \
else \
x.High = 0;
#else
#define MPT_STM_SIMPLE SGESimple32_t
#define MPT_STM_CHAIN SGEChain32_t
#define MPI_SGE_FLAGS_MPT_STM_ADDRESSING MPI_SGE_FLAGS_32_BIT_ADDRESSING
#define stm_get_dma_addr(x, y) \
x = le32_to_cpu(y);
#define stm_set_dma_addr(x, y) \
x = cpu_to_le32(y);
#endif
#ifndef MPT_MAX_ADAPTERS
#define MPT_MAX_ADAPTERS 18
#endif
#ifndef MPI_MANUFACTPAGE_DEVICEID_FC949X
#define MPI_MANUFACTPAGE_DEVICEID_FC949X 0x640
#endif
#ifndef MPI_MANUFACTPAGE_DEVICEID_FC939X
#define MPI_MANUFACTPAGE_DEVICEID_FC939X 0x642
#endif
#ifndef MPI_IOCSTATUS_EEDP_GUARD_ERROR
#define MPI_IOCSTATUS_EEDP_GUARD_ERROR 0x4d
#endif
#ifndef MPI_IOCSTATUS_EEDP_REF_TAG_ERROR
#define MPI_IOCSTATUS_EEDP_REF_TAG_ERROR 0x4e
#endif
#ifndef MPI_IOCSTATUS_EEDP_APP_TAG_ERROR
#define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR 0x4f
#endif
#define MPT_MAX_CDB_LEN 16
#define MPT_TIMEOUT 30
/* Immediate notify status constants */
#define IMM_NTFY_LIP_RESET MPI_EVENT_LOOP_STATE_CHANGE
#define IMM_NTFY_IOCB_OVERFLOW 0x0016
#define IMM_NTFY_ABORT_TASK 0x0020
#define IMM_NTFY_PORT_LOGOUT MPI_EVENT_LOGOUT
#define IMM_NTFY_PORT_CONFIG MPI_EVENT_LINK_STATUS_CHANGE
#define IMM_NTFY_GLBL_TPRLO MPI_EVENT_LINK_STATUS_CHANGE
#define IMM_NTFY_GLBL_LOGO MPI_EVENT_LINK_STATUS_CHANGE
#define IMM_NTFY_RESOURCE 0x0034
#define IMM_NTFY_MSG_RX 0x0036
/* Immediate notify task flags */
#define IMM_NTFY_ABORT_TS 0x01
#define IMM_NTFY_CLEAR_TS 0x04
#define IMM_NTFY_LUN_RESET1 0x08
#define IMM_NTFY_LUN_RESET2 0x10
#define IMM_NTFY_TARGET_RESET 0x20
#define IMM_NTFY_CLEAR_ACA 0x40
/* Command's states */
#define MPT_STATE_NEW 1 /* New command and SCST processes it */
#define MPT_STATE_NEED_DATA 2 /* SCST needs data to process */
#define MPT_STATE_DATA_IN 3 /* Data arrived and SCST processes it */
#define MPT_STATE_DATA_OUT 4
#define MPT_STATE_PROCESSED 5 /* SCST done processing */
/* Target's flags */
#define MPT_TGT_SHUTDOWN 0 /* The driver is being released */
#define MPT_TGT_ENABLE_64BIT_ADDR 1 /* 64-bits PCI addressing anables */
/* Session's flags */
#define MPT_SESS_INITING 0 /* The session is being unregistered */
#define MPT_SESS_SHUTDOWN 1 /* The session is being unregistered */
struct mpt_cmd
{
struct mpt_sess *sess;
struct scst_cmd *scst_cmd;
MPT_STM_PRIV *priv;
CMD *CMD;
u32 reply_word;
struct list_head delayed_cmds_entry;
int state;
dma_addr_t dma_handle;
};
struct mpt_sess
{
struct scst_session *scst_sess;
struct mpt_tgt *tgt;
int init_index;
unsigned long sess_flags;
struct list_head delayed_cmds;
};
struct mpt_tgt
{
struct scst_tgt *scst_tgt;
MPT_STM_PRIV *priv;
int datasegs_per_cmd, datasegs_per_cont;
unsigned long tgt_flags;
atomic_t sess_count;
wait_queue_head_t waitQ;
struct mpt_sess *sess[256];
int target_enable;
int target_id;
};
struct mpt_mgmt_cmd
{
struct mpt_sess *sess;
int task_mgmt;
};
#endif

718
mpt/scsi3.h Normal file
View File

@@ -0,0 +1,718 @@
/*
* linux/drivers/message/fusion/scsi3.h
* SCSI-3 definitions and macros.
* (Ultimately) SCSI-3 definitions; for now, inheriting
* SCSI-2 definitions.
*
* Copyright (c) 1996-2004 Steven J. Ralston
* Written By: Steven J. Ralston (19960517)
* (mailto:sjralston1@netscape.net)
* (mailto:mpt_linux_developer@lsil.com)
*
* $Id: scst-0.9.5-lsi-2.6.15.patch,v 1.1 2006/12/02 23:40:42 ehabbinga Exp $
*/
#ifndef SCSI3_H_INCLUDED
#define SCSI3_H_INCLUDED
/***************************************************************************/
/****************************************************************************
*
* Includes
*/
#ifdef __KERNEL__
#include <linux/types.h>
#else
#ifndef U_STUFF_DEFINED
#define U_STUFF_DEFINED
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#endif
#endif
/****************************************************************************
*
* Defines
*/
/*
* SCSI Commands
*/
#define CMD_TestUnitReady 0x00
#define CMD_RezeroUnit 0x01 /* direct-access devices */
#define CMD_Rewind 0x01 /* sequential-access devices */
#define CMD_RequestSense 0x03
#define CMD_FormatUnit 0x04
#define CMD_ReassignBlock 0x07
#define CMD_Read6 0x08
#define CMD_Write6 0x0A
#define CMD_WriteFilemark 0x10
#define CMD_Space 0x11
#define CMD_Inquiry 0x12
#define CMD_ModeSelect6 0x15
#define CMD_ModeSense6 0x1A
#define CMD_Reserve6 0x16
#define CMD_Release6 0x17
#define CMD_Erase 0x19
#define CMD_StartStopUnit 0x1B /* direct-access devices */
#define CMD_LoadUnload 0x1B /* sequential-access devices */
#define CMD_ReceiveDiagnostic 0x1C
#define CMD_SendDiagnostic 0x1D
#define CMD_ReadCapacity 0x25
#define CMD_Read10 0x28
#define CMD_Write10 0x2A
#define CMD_WriteVerify 0x2E
#define CMD_Verify 0x2F
#define CMD_SynchronizeCache 0x35
#define CMD_ReadDefectData 0x37
#define CMD_WriteBuffer 0x3B
#define CMD_ReadBuffer 0x3C
#define CMD_ReadLong 0x3E
#define CMD_WriteLong 0x3F
#define CMD_WriteSame 0x41
#define CMD_LogSelect 0x4C
#define CMD_LogSense 0x4D
#define CMD_ModeSelect10 0x55
#define CMD_Reserve10 0x56
#define CMD_Release10 0x57
#define CMD_ModeSense10 0x5A
#define CMD_PersistReserveIn 0x5E
#define CMD_PersistReserveOut 0x5F
#define CMD_Read16 0x88
#define CMD_Write16 0x8A
#define CMD_WriteVerify16 0x8E
#define CMD_WriteSame16 0x93
#define CMD_ServiceActionIn 0x9E
#define CMD_ServiceActionOut 0x9F
#define CMD_ReportLuns 0xA0
#define CMD_Read12 0xA8
#define CMD_Write12 0xAA
#define CMD_WriteVerify12 0xAE
/*
* Control byte field
*/
#define CONTROL_BYTE_NACA_BIT 0x04
#define CONTROL_BYTE_Flag_BIT 0x02
#define CONTROL_BYTE_Link_BIT 0x01
/*
* SCSI Messages
*/
#define MSG_COMPLETE 0x00
#define MSG_EXTENDED 0x01
#define MSG_SAVE_POINTERS 0x02
#define MSG_RESTORE_POINTERS 0x03
#define MSG_DISCONNECT 0x04
#define MSG_IDERROR 0x05
#define MSG_ABORT 0x06
#define MSG_REJECT 0x07
#define MSG_NOP 0x08
#define MSG_PARITY_ERROR 0x09
#define MSG_LINKED_CMD_COMPLETE 0x0a
#define MSG_LCMD_COMPLETE_W_FLG 0x0b
#define MSG_BUS_DEVICE_RESET 0x0c
#define MSG_ABORT_TAG 0x0d
#define MSG_CLEAR_QUEUE 0x0e
#define MSG_INITIATE_RECOVERY 0x0f
#define MSG_RELEASE_RECOVRY 0x10
#define MSG_TERMINATE_IO 0x11
#define MSG_SIMPLE_QUEUE 0x20
#define MSG_HEAD_OF_QUEUE 0x21
#define MSG_ORDERED_QUEUE 0x22
#define MSG_IGNORE_WIDE_RESIDUE 0x23
#define MSG_IDENTIFY 0x80
#define MSG_IDENTIFY_W_DISC 0xc0
/*
* SCSI Phases
*/
#define PHS_DATA_OUT 0x00
#define PHS_DATA_IN 0x01
#define PHS_COMMAND 0x02
#define PHS_STATUS 0x03
#define PHS_MSG_OUT 0x06
#define PHS_MSG_IN 0x07
/*
* Statuses
*/
#define STS_GOOD 0x00
#define STS_CHECK_CONDITION 0x02
#define STS_CONDITION_MET 0x04
#define STS_BUSY 0x08
#define STS_INTERMEDIATE 0x10
#define STS_INTERMEDIATE_CONDITION_MET 0x14
#define STS_RESERVATION_CONFLICT 0x18
#define STS_COMMAND_TERMINATED 0x22
#define STS_TASK_SET_FULL 0x28
#define STS_QUEUE_FULL 0x28
#define STS_ACA_ACTIVE 0x30
#define STS_VALID_MASK 0x3e
#define SCSI_STATUS(x) ((x) & STS_VALID_MASK)
/*
* SCSI QTag Types
*/
#define QTAG_SIMPLE 0x20
#define QTAG_HEAD_OF_Q 0x21
#define QTAG_ORDERED 0x22
/*
* SCSI Sense Key Definitons
*/
#define SK_NO_SENSE 0x00
#define SK_RECOVERED_ERROR 0x01
#define SK_NOT_READY 0x02
#define SK_MEDIUM_ERROR 0x03
#define SK_HARDWARE_ERROR 0x04
#define SK_ILLEGAL_REQUEST 0x05
#define SK_UNIT_ATTENTION 0x06
#define SK_DATA_PROTECT 0x07
#define SK_BLANK_CHECK 0x08
#define SK_VENDOR_SPECIFIC 0x09
#define SK_COPY_ABORTED 0x0a
#define SK_ABORTED_COMMAND 0x0b
#define SK_EQUAL 0x0c
#define SK_VOLUME_OVERFLOW 0x0d
#define SK_MISCOMPARE 0x0e
#define SK_RESERVED 0x0f
#define SCSI_MAX_INQUIRY_BYTES 96
#define SCSI_STD_INQUIRY_BYTES 36
#undef USE_SCSI_COMPLETE_INQDATA
/*
* Structure definition for SCSI Inquiry Data
*
* NOTE: The following structure is 96 bytes in size
* iff USE_SCSI_COMPLETE_INQDATA IS defined above (i.e. w/ "#define").
* If USE_SCSI_COMPLETE_INQDATA is NOT defined above (i.e. w/ "#undef")
* then the following structure is only 36 bytes in size.
* THE CHOICE IS YOURS!
*/
typedef struct SCSI_Inquiry_Data
{
#ifdef USE_SCSI_COMPLETE_INQDATA
u8 InqByte[SCSI_MAX_INQUIRY_BYTES];
#else
u8 InqByte[SCSI_STD_INQUIRY_BYTES];
#endif
/*
* the following structure works only for little-endian (Intel,
* LSB first (1234) byte order) systems with 4-byte ints.
*
u32 Periph_Device_Type : 5,
Periph_Qualifier : 3,
Device_Type_Modifier : 7,
Removable_Media : 1,
ANSI_Version : 3,
ECMA_Version : 3,
ISO_Version : 2,
Response_Data_Format : 4,
reserved_0 : 3,
AERC : 1 ;
u32 Additional_Length : 8,
reserved_1 :16,
SftReset : 1,
CmdQue : 1,
reserved_2 : 1,
Linked : 1,
Sync : 1,
WBus16 : 1,
WBus32 : 1,
RelAdr : 1 ;
u8 Vendor_ID[8];
u8 Product_ID[16];
u8 Revision_Level [4];
#ifdef USE_SCSI_COMPLETE_INQDATA
u8 Vendor_Specific[20];
u8 reserved_3[40];
#endif
*
*/
} SCSI_Inquiry_Data_t;
#define INQ_PERIPHINFO_BYTE 0
#define INQ_Periph_Qualifier_MASK 0xe0
#define INQ_Periph_Device_Type_MASK 0x1f
#define INQ_Peripheral_Qualifier(inqp) \
(int)((*((u8*)(inqp)+INQ_PERIPHINFO_BYTE) & INQ_Periph_Qualifier_MASK) >> 5)
#define INQ_Peripheral_Device_Type(inqp) \
(int)(*((u8*)(inqp)+INQ_PERIPHINFO_BYTE) & INQ_Periph_Device_Type_MASK)
#define INQ_DEVTYPEMOD_BYTE 1
#define INQ_RMB_BIT 0x80
#define INQ_Device_Type_Modifier_MASK 0x7f
#define INQ_Removable_Medium(inqp) \
(int)(*((u8*)(inqp)+INQ_DEVTYPEMOD_BYTE) & INQ_RMB_BIT)
#define INQ_Device_Type_Modifier(inqp) \
(int)(*((u8*)(inqp)+INQ_DEVTYPEMOD_BYTE) & INQ_Device_Type_Modifier_MASK)
#define INQ_VERSIONINFO_BYTE 2
#define INQ_ISO_Version_MASK 0xc0
#define INQ_ECMA_Version_MASK 0x38
#define INQ_ANSI_Version_MASK 0x07
#define INQ_ISO_Version(inqp) \
(int)(*((u8*)(inqp)+INQ_VERSIONINFO_BYTE) & INQ_ISO_Version_MASK)
#define INQ_ECMA_Version(inqp) \
(int)(*((u8*)(inqp)+INQ_VERSIONINFO_BYTE) & INQ_ECMA_Version_MASK)
#define INQ_ANSI_Version(inqp) \
(int)(*((u8*)(inqp)+INQ_VERSIONINFO_BYTE) & INQ_ANSI_Version_MASK)
#define INQ_BYTE3 3
#define INQ_AERC_BIT 0x80
#define INQ_TrmTsk_BIT 0x40
#define INQ_NormACA_BIT 0x20
#define INQ_RDF_MASK 0x0F
#define INQ_AER_Capable(inqp) \
(int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_AERC_BIT)
#define INQ_TrmTsk(inqp) \
(int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_TrmTsk_BIT)
#define INQ_NormACA(inqp) \
(int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_NormACA_BIT)
#define INQ_Response_Data_Format(inqp) \
(int)(*((u8*)(inqp)+INQ_BYTE3) & INQ_RDF_MASK)
#define INQ_CAPABILITY_BYTE 7
#define INQ_RelAdr_BIT 0x80
#define INQ_WBus32_BIT 0x40
#define INQ_WBus16_BIT 0x20
#define INQ_Sync_BIT 0x10
#define INQ_Linked_BIT 0x08
/* INQ_Reserved BIT 0x40 */
#define INQ_CmdQue_BIT 0x02
#define INQ_SftRe_BIT 0x01
#define IS_RelAdr_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_RelAdr_BIT)
#define IS_WBus32_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_WBus32_BIT)
#define IS_WBus16_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_WBus16_BIT)
#define IS_Sync_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_Sync_BIT)
#define IS_Linked_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_Linked_BIT)
#define IS_CmdQue_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_CmdQue_BIT)
#define IS_SftRe_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_SftRe_BIT)
#define INQ_Width_BITS \
(INQ_WBus32_BIT | INQ_WBus16_BIT)
#define IS_Wide_DEV(inqp) \
(int)(*((u8*)(inqp)+INQ_CAPABILITY_BYTE) & INQ_Width_BITS)
/*
* SCSI peripheral device types
*/
#define SCSI_TYPE_DAD 0x00 /* Direct Access Device */
#define SCSI_TYPE_SAD 0x01 /* Sequential Access Device */
#define SCSI_TYPE_TAPE SCSI_TYPE_SAD
#define SCSI_TYPE_PRT 0x02 /* Printer */
#define SCSI_TYPE_PROC 0x03 /* Processor */
#define SCSI_TYPE_WORM 0x04
#define SCSI_TYPE_CDROM 0x05
#define SCSI_TYPE_SCAN 0x06 /* Scanner */
#define SCSI_TYPE_OPTICAL 0x07 /* Magneto/Optical */
#define SCSI_TYPE_CHANGER 0x08
#define SCSI_TYPE_COMM 0x09 /* Communications device */
#define SCSI_TYPE_UNKNOWN 0x1f
#define SCSI_TYPE_UNCONFIGURED_LUN 0x7f
#define SCSI_TYPE_MAX_KNOWN SCSI_TYPE_COMM
/*
* Peripheral Qualifiers
*/
#define DEVICE_PRESENT 0x00
#define LUN_NOT_PRESENT 0x01
#define LUN_NOT_SUPPORTED 0x03
/*
* ANSI Versions
*/
#ifndef SCSI_1
#define SCSI_1 0x01
#endif
#ifndef SCSI_2
#define SCSI_2 0x02
#endif
#ifndef SCSI_3
#define SCSI_3 0x03
#endif
#define SCSI_MAX_SENSE_BYTES 255
#define SCSI_STD_SENSE_BYTES 18
#define SCSI_PAD_SENSE_BYTES (SCSI_MAX_SENSE_BYTES - SCSI_STD_SENSE_BYTES)
#undef USE_SCSI_COMPLETE_SENSE
/*
* Structure definition for SCSI Sense Data
*
* NOTE: The following structure is 255 bytes in size
* iiff USE_SCSI_COMPLETE_SENSE IS defined above (i.e. w/ "#define").
* If USE_SCSI_COMPLETE_SENSE is NOT defined above (i.e. w/ "#undef")
* then the following structure is only 19 bytes in size.
* THE CHOICE IS YOURS!
*
*/
typedef struct SCSI_Sense_Data
{
#ifdef USE_SCSI_COMPLETE_SENSE
u8 SenseByte[SCSI_MAX_SENSE_BYTES];
#else
u8 SenseByte[SCSI_STD_SENSE_BYTES];
#endif
/*
* the following structure works only for little-endian (Intel,
* LSB first (1234) byte order) systems with 4-byte ints.
*
u8 Error_Code :4, // 0x00
Error_Class :3,
Valid :1
;
u8 Segment_Number // 0x01
;
u8 Sense_Key :4, // 0x02
Reserved :1,
Incorrect_Length_Indicator:1,
End_Of_Media :1,
Filemark :1
;
u8 Information_MSB; // 0x03
u8 Information_Byte2; // 0x04
u8 Information_Byte1; // 0x05
u8 Information_LSB; // 0x06
u8 Additional_Length; // 0x07
u32 Command_Specific_Information; // 0x08 - 0x0b
u8 Additional_Sense_Code; // 0x0c
u8 Additional_Sense_Code_Qualifier; // 0x0d
u8 Field_Replaceable_Unit_Code; // 0x0e
u8 Illegal_Req_Bit_Pointer :3, // 0x0f
Illegal_Req_Bit_Valid :1,
Illegal_Req_Reserved :2,
Illegal_Req_Cmd_Data :1,
Sense_Key_Specific_Valid :1
;
u16 Sense_Key_Specific_Data; // 0x10 - 0x11
#ifdef USE_SCSI_COMPLETE_SENSE
u8 Additional_Sense_Data[SCSI_PAD_SENSE_BYTES];
#else
u8 Additional_Sense_Data[1];
#endif
*
*/
} SCSI_Sense_Data_t;
#define SD_ERRCODE_BYTE 0
#define SD_Valid_BIT 0x80
#define SD_Error_Code_MASK 0x7f
#define SD_Valid(sdp) \
(int)(*((u8*)(sdp)+SD_ERRCODE_BYTE) & SD_Valid_BIT)
#define SD_Error_Code(sdp) \
(int)(*((u8*)(sdp)+SD_ERRCODE_BYTE) & SD_Error_Code_MASK)
#define SD_SEGNUM_BYTE 1
#define SD_Segment_Number(sdp) (int)(*((u8*)(sdp)+SD_SEGNUM_BYTE))
#define SD_SENSEKEY_BYTE 2
#define SD_Filemark_BIT 0x80
#define SD_EOM_BIT 0x40
#define SD_ILI_BIT 0x20
#define SD_Sense_Key_MASK 0x0f
#define SD_Filemark(sdp) \
(int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_Filemark_BIT)
#define SD_EOM(sdp) \
(int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_EOM_BIT)
#define SD_ILI(sdp) \
(int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_ILI_BIT)
#define SD_Sense_Key(sdp) \
(int)(*((u8*)(sdp)+SD_SENSEKEY_BYTE) & SD_Sense_Key_MASK)
#define SD_INFO3_BYTE 3
#define SD_INFO2_BYTE 4
#define SD_INFO1_BYTE 5
#define SD_INFO0_BYTE 6
#define SD_Information3(sdp) (int)(*((u8*)(sdp)+SD_INFO3_BYTE))
#define SD_Information2(sdp) (int)(*((u8*)(sdp)+SD_INFO2_BYTE))
#define SD_Information1(sdp) (int)(*((u8*)(sdp)+SD_INFO1_BYTE))
#define SD_Information0(sdp) (int)(*((u8*)(sdp)+SD_INFO0_BYTE))
#define SD_ADDL_LEN_BYTE 7
#define SD_Additional_Sense_Length(sdp) \
(int)(*((u8*)(sdp)+SD_ADDL_LEN_BYTE))
#define SD_Addl_Sense_Len SD_Additional_Sense_Length
#define SD_CMD_SPECIFIC3_BYTE 8
#define SD_CMD_SPECIFIC2_BYTE 9
#define SD_CMD_SPECIFIC1_BYTE 10
#define SD_CMD_SPECIFIC0_BYTE 11
#define SD_Cmd_Specific_Info3(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC3_BYTE))
#define SD_Cmd_Specific_Info2(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC2_BYTE))
#define SD_Cmd_Specific_Info1(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC1_BYTE))
#define SD_Cmd_Specific_Info0(sdp) (int)(*((u8*)(sdp)+SD_CMD_SPECIFIC0_BYTE))
#define SD_ADDL_SENSE_CODE_BYTE 12
#define SD_Additional_Sense_Code(sdp) \
(int)(*((u8*)(sdp)+SD_ADDL_SENSE_CODE_BYTE))
#define SD_Addl_Sense_Code SD_Additional_Sense_Code
#define SD_ASC SD_Additional_Sense_Code
#define SD_ADDL_SENSE_CODE_QUAL_BYTE 13
#define SD_Additional_Sense_Code_Qualifier(sdp) \
(int)(*((u8*)(sdp)+SD_ADDL_SENSE_CODE_QUAL_BYTE))
#define SD_Addl_Sense_Code_Qual SD_Additional_Sense_Code_Qualifier
#define SD_ASCQ SD_Additional_Sense_Code_Qualifier
#define SD_FIELD_REPL_UNIT_CODE_BYTE 14
#define SD_Field_Replaceable_Unit_Code(sdp) \
(int)(*((u8*)(sdp)+SD_FIELD_REPL_UNIT_CODE_BYTE))
#define SD_Field_Repl_Unit_Code SD_Field_Replaceable_Unit_Code
#define SD_FRUC SD_Field_Replaceable_Unit_Code
#define SD_FRU SD_Field_Replaceable_Unit_Code
/*
* Sense-Key Specific offsets and macros.
*/
#define SD_SKS2_BYTE 15
#define SD_SKS_Valid_BIT 0x80
#define SD_SKS_Cmd_Data_BIT 0x40
#define SD_SKS_Bit_Ptr_Valid_BIT 0x08
#define SD_SKS_Bit_Ptr_MASK 0x07
#define SD_SKS1_BYTE 16
#define SD_SKS0_BYTE 17
#define SD_Sense_Key_Specific_Valid(sdp) \
(int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Valid_BIT)
#define SD_SKS_Valid SD_Sense_Key_Specific_Valid
#define SD_SKS_CDB_Error(sdp) \
(int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Cmd_Data_BIT)
#define SD_Was_Illegal_Request SD_SKS_CDB_Error
#define SD_SKS_Bit_Pointer_Valid(sdp) \
(int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Bit_Ptr_Valid_BIT)
#define SD_SKS_Bit_Pointer(sdp) \
(int)(*((u8*)(sdp)+SD_SKS2_BYTE) & SD_SKS_Bit_Ptr_MASK)
#define SD_Field_Pointer(sdp) \
(int)( ((u16)(*((u8*)(sdp)+SD_SKS1_BYTE)) << 8) \
+ *((u8*)(sdp)+SD_SKS0_BYTE) )
#define SD_Bad_Byte SD_Field_Pointer
#define SD_Actual_Retry_Count SD_Field_Pointer
#define SD_Progress_Indication SD_Field_Pointer
/*
* Mode Sense Write Protect Mask
*/
#define WRITE_PROTECT_MASK 0X80
/*
* Medium Type Codes
*/
#define OPTICAL_DEFAULT 0x00
#define OPTICAL_READ_ONLY_MEDIUM 0x01
#define OPTICAL_WRITE_ONCE_MEDIUM 0x02
#define OPTICAL_READ_WRITABLE_MEDIUM 0x03
#define OPTICAL_RO_OR_WO_MEDIUM 0x04
#define OPTICAL_RO_OR_RW_MEDIUM 0x05
#define OPTICAL_WO_OR_RW_MEDIUM 0x06
/*
* Structure definition for READ6, WRITE6 (6-byte CDB)
*/
typedef struct SCSI_RW6_CDB
{
u32 OpCode :8,
LBA_HI :5, /* 5 MSBit's of the LBA */
Lun :3,
LBA_MID :8, /* NOTE: total of 21 bits in LBA */
LBA_LO :8 ; /* Max LBA = 0x001fffff */
u8 BlockCount;
u8 Control;
} SCSI_RW6_t;
#define MAX_RW6_LBA ((u32)0x001fffff)
/*
* Structure definition for READ10, WRITE10 (10-byte CDB)
*
* NOTE: ParityCheck bit is applicable only for VERIFY and WRITE VERIFY for
* the ADP-92 DAC only. In the SCSI2 spec. this same bit is defined as a
* FUA (forced unit access) bit for READs and WRITEs. Since this driver
* does not use the FUA, this bit is defined as it is used by the ADP-92.
* Also, for READ CAPACITY, only the OpCode field is used.
*/
typedef struct SCSI_RW10_CDB
{
u8 OpCode;
u8 Reserved1;
u32 LBA;
u8 Reserved2;
u16 BlockCount;
u8 Control;
} SCSI_RW10_t;
#define PARITY_CHECK 0x08 /* parity check bit - byte[1], bit 3 */
/*
* Structure definition for data returned by READ CAPACITY cmd;
* READ CAPACITY data
*/
typedef struct READ_CAP_DATA
{
u32 MaxLBA;
u32 BlockBytes;
} SCSI_READ_CAP_DATA_t, *pSCSI_READ_CAP_DATA_t;
/*
* Structure definition for FORMAT UNIT CDB (6-byte CDB)
*/
typedef struct _SCSI_FORMAT_UNIT
{
u8 OpCode;
u8 Reserved1;
u8 VendorSpecific;
u16 Interleave;
u8 Control;
} SCSI_FORMAT_UNIT_t;
/*
* Structure definition for REQUEST SENSE (6-byte CDB)
*/
typedef struct _SCSI_REQUEST_SENSE
{
u8 OpCode;
u8 Reserved1;
u8 Reserved2;
u8 Reserved3;
u8 AllocLength;
u8 Control;
} SCSI_REQ_SENSE_t;
/*
* Structure definition for REPORT LUNS (12-byte CDB)
*/
typedef struct _SCSI_REPORT_LUNS
{
u8 OpCode;
u8 Reserved1[5];
u32 AllocationLength;
u8 Reserved2;
u8 Control;
} SCSI_REPORT_LUNS_t, *pSCSI_REPORT_LUNS_t;
/*
* (per-level) LUN information bytes
*/
/*
* Following doesn't work on ARMCC compiler
* [apparently] because it pads every struct
* to be multiple of 4 bytes!
* So SCSI_LUN_LEVELS_t winds up being 16
* bytes instead of 8!
*
typedef struct LUN_INFO
{
u8 AddrMethod_plus_LunOrBusNumber;
u8 LunOrTarget;
} SCSI_LUN_INFO_t, *pSCSI_LUN_INFO_t;
typedef struct LUN_LEVELS
{
SCSI_LUN_INFO_t LUN_0;
SCSI_LUN_INFO_t LUN_1;
SCSI_LUN_INFO_t LUN_2;
SCSI_LUN_INFO_t LUN_3;
} SCSI_LUN_LEVELS_t, *pSCSI_LUN_LEVELS_t;
*/
/*
* All 4 levels (8 bytes) of LUN information
*/
typedef struct LUN_LEVELS
{
u8 LVL1_AddrMethod_plus_LunOrBusNumber;
u8 LVL1_LunOrTarget;
u8 LVL2_AddrMethod_plus_LunOrBusNumber;
u8 LVL2_LunOrTarget;
u8 LVL3_AddrMethod_plus_LunOrBusNumber;
u8 LVL3_LunOrTarget;
u8 LVL4_AddrMethod_plus_LunOrBusNumber;
u8 LVL4_LunOrTarget;
} SCSI_LUN_LEVELS_t, *pSCSI_LUN_LEVELS_t;
/*
* Structure definition for data returned by REPORT LUNS cmd;
* LUN reporting parameter list format
*/
typedef struct LUN_REPORT
{
u32 LunListLength;
u32 Reserved;
SCSI_LUN_LEVELS_t LunInfo[1];
} SCSI_LUN_REPORT_t, *pSCSI_LUN_REPORT_t;
/****************************************************************************
*
* Externals
*/
/****************************************************************************
*
* Public Typedefs & Related Defines
*/
/****************************************************************************
*
* Macros (embedded, above)
*/
/****************************************************************************
*
* Public Variables
*/
/****************************************************************************
*
* Public Prototypes (module entry points)
*/
/***************************************************************************/
#endif

View File

@@ -0,0 +1,10 @@
--- Makefile.orig 2006-12-11 14:29:39.000000000 -0700
+++ Makefile 2006-12-11 14:29:52.000000000 -0700
@@ -81,6 +81,7 @@
obj-$(CONFIG_SCSI_QLOGIC_FC) += qlogicfc.o
obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
obj-$(CONFIG_SCSI_QLA2XXX) += qla2xxx/
+obj-$(CONFIG_SCSI_TARGET) += scsi_tgt/
obj-$(CONFIG_SCSI_LPFC) += lpfc/
obj-$(CONFIG_SCSI_PAS16) += pas16.o
obj-$(CONFIG_SCSI_SEAGATE) += seagate.o

View File

@@ -49,6 +49,10 @@ all:
scst:
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_DEV=n
MODS_VERS := $(shell ls Modules.symvers 2>/dev/null)
# It's renamed in 2.6.18
MOD_VERS := $(shell ls Module.symvers 2>/dev/null)
install: all
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_DEV=m \
modules_install
@@ -56,6 +60,14 @@ install: all
install -m 644 ../include/scsi_tgt.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_debug.h $(INSTALL_DIR_H)
install -m 644 ../include/scst_debug.c $(INSTALL_DIR_H)
ifneq ($(MODS_VERS),)
rm -f $(INSTALL_DIR_H)/Module.symvers
install -m 644 Modules.symvers $(INSTALL_DIR_H)
endif
ifneq ($(MOD_VERS),)
rm -f $(INSTALL_DIR_H)/Modules.symvers
install -m 644 Module.symvers $(INSTALL_DIR_H)
endif
-depmod -a
uninstall: