Import Upstream version 0.4.5
This commit is contained in:
155
schily/scg/aspi-dos.h
Normal file
155
schily/scg/aspi-dos.h
Normal file
@@ -0,0 +1,155 @@
|
||||
#ifndef __ASPI16_H_
|
||||
#define __ASPI16_H_
|
||||
|
||||
#define PACKED __attribute__((packed))
|
||||
#define FAR
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
//*****************************************************************************
|
||||
// %%% SCSI MISCELLANEOUS EQUATES %%%
|
||||
//*****************************************************************************
|
||||
|
||||
#define SENSE_LEN 14 // Default sense buffer length
|
||||
#define SRB_DIR_SCSI 0x00 // Direction determined by SCSI
|
||||
#define SRB_POSTING 0x01 // Enable ASPI posting
|
||||
#define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting
|
||||
#define SRB_DIR_IN 0x08 // Transfer from SCSI target to host
|
||||
#define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target
|
||||
|
||||
//*****************************************************************************
|
||||
// %%% ASPI Command Definitions %%%
|
||||
//*****************************************************************************
|
||||
|
||||
#define SC_HA_INQUIRY 0x00 // Host adapter inquiry
|
||||
#define SC_GET_DEV_TYPE 0x01 // Get device type
|
||||
#define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command
|
||||
#define SC_ABORT_SRB 0x03 // Abort an SRB
|
||||
#define SC_RESET_DEV 0x04 // SCSI bus device reset
|
||||
#define SC_SET_HA_PARMS 0x05 // Set HA parameters
|
||||
#define SC_GET_DISK_INFO 0x06 // Get Disk information
|
||||
|
||||
//*****************************************************************************
|
||||
// %%% SRB Status %%%
|
||||
//*****************************************************************************
|
||||
|
||||
#define SS_PENDING 0x00 // SRB being processed
|
||||
#define SS_COMP 0x01 // SRB completed without error
|
||||
#define SS_ABORTED 0x02 // SRB aborted
|
||||
#define SS_ABORT_FAIL 0x03 // Unable to abort SRB
|
||||
#define SS_ERR 0x04 // SRB completed with error
|
||||
|
||||
#define SS_INVALID_CMD 0x80 // Invalid ASPI command
|
||||
#define SS_INVALID_HA 0x81 // Invalid host adapter number
|
||||
#define SS_NO_DEVICE 0x82 // SCSI device not installed
|
||||
|
||||
//*****************************************************************************
|
||||
// %%% Host Adapter Status %%%
|
||||
//*****************************************************************************
|
||||
|
||||
#define HASTAT_OK 0x00 // Host adapter did not detect an // error
|
||||
#define HASTAT_SEL_TO 0x11 // Selection Timeout
|
||||
#define HASTAT_DO_DU 0x12 // Data overrun data underrun
|
||||
#define HASTAT_BUS_FREE 0x13 // Unexpected bus free
|
||||
#define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure
|
||||
#define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed.
|
||||
#define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB.
|
||||
#define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE
|
||||
#define HASTAT_BUS_RESET 0x0E // A bus reset was detected.
|
||||
#define HASTAT_PARITY_ERROR 0x0F // A parity error was detected.
|
||||
#define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing
|
||||
|
||||
typedef struct {
|
||||
|
||||
BYTE Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD
|
||||
BYTE Status; // 01/001 ASPI command status byte
|
||||
BYTE HaId; // 02/002 ASPI host adapter number
|
||||
BYTE Flags; // 03/003 ASPI request flags
|
||||
DWORD Hdr_Rsvd; // 04/004 Reserved, MUST = 0
|
||||
|
||||
union {
|
||||
|
||||
struct {
|
||||
|
||||
BYTE Count; // 08/008 Number of host adapters present
|
||||
BYTE SCSI_ID; // 09/009 SCSI ID of host adapter
|
||||
BYTE ManagerId[16]; // 0A/010 String describing the manager
|
||||
BYTE Identifier[16]; // 1A/026 String describing the host adapter
|
||||
BYTE Unique[16]; // 2A/042 Host Adapter Unique parameters
|
||||
BYTE ExtBuffer[8]; // 3A/058 Extended inquiry data
|
||||
|
||||
} PACKED HAInquiry;
|
||||
|
||||
struct {
|
||||
|
||||
BYTE Target; // 08/008 Target's SCSI ID
|
||||
BYTE Lun; // 09/009 Target's LUN number
|
||||
BYTE DeviceType; // 0A/010 Target's peripheral device type
|
||||
|
||||
} PACKED GetDeviceType;
|
||||
|
||||
struct {
|
||||
|
||||
BYTE Target; // 08/008 Target's SCSI ID
|
||||
BYTE Lun; // 09/009 Target's LUN number
|
||||
DWORD BufLen; // 0A/010 Data Allocation Length
|
||||
BYTE SenseLen; // 0E/014 Sense Allocation Length
|
||||
BYTE FAR *BufPointer; // 0F/015 Data Buffer Pointer
|
||||
DWORD Rsvd1; // 13/019 Reserved, MUST = 0
|
||||
BYTE CDBLen; // 17/023 CDB Length = 6/10/12
|
||||
BYTE HaStat; // 18/024 Host Adapter Status
|
||||
BYTE TargStat; // 19/025 Target Status
|
||||
VOID FAR *PostProc; // 1A/026 Post routine
|
||||
BYTE Rsvd2[34]; // 1E/030 Reserved, MUST = 0
|
||||
|
||||
union {
|
||||
|
||||
struct {
|
||||
|
||||
BYTE CDBByte[6]; // 40/064 SCSI CDB
|
||||
BYTE SenseArea[SENSE_LEN+2]; // 46/070 Request Sense buffer
|
||||
|
||||
} PACKED _6;
|
||||
|
||||
struct {
|
||||
|
||||
BYTE CDBByte[10]; // 40/064 SCSI CDB
|
||||
BYTE SenseArea[SENSE_LEN+2]; // 4A/074 Request Sense buffer
|
||||
|
||||
} PACKED _10;
|
||||
|
||||
struct {
|
||||
|
||||
BYTE CDBByte[12]; // 40/064 SCSI CDB
|
||||
BYTE SenseArea[SENSE_LEN+2]; // 4C/076 Request Sense buffer
|
||||
|
||||
} PACKED _12;
|
||||
|
||||
} PACKED CmdLen;
|
||||
|
||||
} PACKED ExecSCSICmd;
|
||||
|
||||
struct {
|
||||
|
||||
VOID FAR *SRBToAbort; // 08/008 Pointer to SRB to abort
|
||||
|
||||
} PACKED Abort;
|
||||
|
||||
struct {
|
||||
|
||||
BYTE Target; // 08/008 Target's SCSI ID
|
||||
BYTE Lun; // 09/009 Target's LUN number
|
||||
BYTE ResetRsvd1[14]; // 0A/010 Reserved, MUST = 0
|
||||
BYTE HaStat; // 18/024 Host Adapter Status
|
||||
BYTE TargStat; // 19/025 Target Status
|
||||
VOID FAR *PostProc; // 1A/026 Post routine
|
||||
BYTE ResetRsvd2[34]; // 1E/030 Reserved, MUST = 0
|
||||
|
||||
} Reset;
|
||||
|
||||
} PACKED Type;
|
||||
|
||||
} PACKED SRB;
|
||||
|
||||
#endif //__ASPI16_H_
|
||||
196
schily/scg/aspi-win32.h
Normal file
196
schily/scg/aspi-win32.h
Normal file
@@ -0,0 +1,196 @@
|
||||
#ifndef __ASPI_WIN32_H_
|
||||
#define __ASPI_WIN32_H_
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
/***************************************************************************
|
||||
** SCSI MISCELLANEOUS EQUATES
|
||||
***************************************************************************/
|
||||
#define SENSE_LEN 14 /* Default sense buffer length */
|
||||
#define SRB_DIR_SCSI 0x00 /* Direction determined by SCSI */
|
||||
#define SRB_POSTING 0x01 /* Enable ASPI posting */
|
||||
#define SRB_ENABLE_RESIDUAL_COUNT 0x04 /* Enable residual byte count */
|
||||
/* reporting */
|
||||
#define SRB_DIR_IN 0x08 /* Transfer from SCSI target to */
|
||||
/* host */
|
||||
#define SRB_DIR_OUT 0x10 /* Transfer from host to SCSI */
|
||||
/* target */
|
||||
#define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
|
||||
#define RESIDUAL_COUNT_SUPPORTED 0x02 /* Extended buffer flag */
|
||||
#define MAX_SRB_TIMEOUT 1080001u /* 30 hour maximum timeout in sec */
|
||||
#define DEFAULT_SRB_TIMEOUT 1080001u /* use max.timeout by default */
|
||||
|
||||
/***************************************************************************
|
||||
** ASPI command definitions
|
||||
***************************************************************************/
|
||||
#define SC_HA_INQUIRY 0x00 /* Host adapter inquiry */
|
||||
#define SC_GET_DEV_TYPE 0x01 /* Get device type */
|
||||
#define SC_EXEC_SCSI_CMD 0x02 /* Execute SCSI command */
|
||||
#define SC_ABORT_SRB 0x03 /* Abort an SRB */
|
||||
#define SC_RESET_DEV 0x04 /* SCSI bus device reset */
|
||||
#define SC_SET_HA_PARMS 0x05 /* Set HA parameters */
|
||||
#define SC_GET_DISK_INFO 0x06 /* Get Disk */
|
||||
#define SC_RESCAN_SCSI_BUS 0x07 /* Rebuild SCSI device map */
|
||||
#define SC_GETSET_TIMEOUTS 0x08 /* Get/Set target timeouts */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
** SRB Status
|
||||
***************************************************************************/
|
||||
#define SS_PENDING 0x00 /* SRB being processed */
|
||||
#define SS_COMP 0x01 /* SRB completed without error */
|
||||
#define SS_ABORTED 0x02 /* SRB aborted */
|
||||
#define SS_ABORT_FAIL 0x03 /* Unable to abort SRB */
|
||||
#define SS_ERR 0x04 /* SRB completed with error */
|
||||
#define SS_INVALID_CMD 0x80 /* Invalid ASPI command */
|
||||
#define SS_INVALID_HA 0x81 /* Invalid host adapter number */
|
||||
#define SS_NO_DEVICE 0x82 /* SCSI device not installed */
|
||||
#define SS_INVALID_SRB 0xE0 /* Invalid parameter set in SRB */
|
||||
#define SS_OLD_MANAGER 0xE1 /* ASPI manager doesn't support */
|
||||
/* windows */
|
||||
#define SS_BUFFER_ALIGN 0xE1 /* Buffer not aligned (replaces */
|
||||
/* SS_OLD_MANAGER in Win32) */
|
||||
#define SS_ILLEGAL_MODE 0xE2 /* Unsupported Windows mode */
|
||||
#define SS_NO_ASPI 0xE3 /* No ASPI managers */
|
||||
#define SS_FAILED_INIT 0xE4 /* ASPI for windows failed init */
|
||||
#define SS_ASPI_IS_BUSY 0xE5 /* No resources available to */
|
||||
/* execute command */
|
||||
#define SS_BUFFER_TO_BIG 0xE6 /* Buffer size too big to handle */
|
||||
#define SS_BUFFER_TOO_BIG 0xE6 /* Correct spelling of 'too' */
|
||||
#define SS_MISMATCHED_COMPONENTS 0xE7 /* The DLLs/EXEs of ASPI don't */
|
||||
/* version check */
|
||||
#define SS_NO_ADAPTERS 0xE8 /* No host adapters to manager */
|
||||
#define SS_INSUFFICIENT_RESOURCES 0xE9 /* Couldn't allocate resources */
|
||||
/* needed to init */
|
||||
#define SS_ASPI_IS_SHUTDOWN 0xEA /* Call came to ASPI after */
|
||||
/* PROCESS_DETACH */
|
||||
#define SS_BAD_INSTALL 0xEB /* The DLL or other components */
|
||||
/* are installed wrong */
|
||||
|
||||
/***************************************************************************
|
||||
** Host Adapter Status
|
||||
***************************************************************************/
|
||||
#define HASTAT_OK 0x00 /* No error detected by HA */
|
||||
#define HASTAT_SEL_TO 0x11 /* Selection Timeout */
|
||||
#define HASTAT_DO_DU 0x12 /* Data overrun/data underrun */
|
||||
#define HASTAT_BUS_FREE 0x13 /* Unexpected bus free */
|
||||
#define HASTAT_PHASE_ERR 0x14 /* Target bus phase sequence */
|
||||
#define HASTAT_TIMEOUT 0x09 /* Timed out while SRB was */
|
||||
/* waiting to be processed */
|
||||
#define HASTAT_COMMAND_TIMEOUT 0x0B /* Adapter timed out while */
|
||||
/* processing SRB */
|
||||
#define HASTAT_MESSAGE_REJECT 0x0D /* While processing the SRB, the */
|
||||
/* adapter received a MESSAGE */
|
||||
#define HASTAT_BUS_RESET 0x0E /* A bus reset was detected */
|
||||
#define HASTAT_PARITY_ERROR 0x0F /* A parity error was detected */
|
||||
#define HASTAT_REQUEST_SENSE_FAILED 0x10 /* The adapter failed in issuing */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
** SRB - HOST ADAPTER INQUIRIY - SC_HA_INQUIRY (0)
|
||||
***************************************************************************/
|
||||
typedef struct {
|
||||
BYTE SRB_Cmd; /* 00/000 ASPI command code == SC_HA_INQUIRY */
|
||||
BYTE SRB_Status; /* 01/001 ASPI command status byte */
|
||||
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
|
||||
BYTE SRB_Flags; /* 03/003 ASPI request flags */
|
||||
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
|
||||
BYTE HA_Count; /* 08/008 Number of host adapters present */
|
||||
BYTE HA_SCSI_ID; /* 09/009 SCSI ID of host adapter */
|
||||
BYTE HA_ManagerId[16]; /* 0a/010 String describing the manager */
|
||||
BYTE HA_Identifier[16]; /* 1a/026 String describing the host adapter */
|
||||
BYTE HA_Unique[16]; /* 2a/042 Host Adapter Unique parameters */
|
||||
WORD HA_Rsvd1; /* 3a/058 Reserved, must = 0 */
|
||||
} PACKED SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
** SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1)
|
||||
***************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */
|
||||
BYTE SRB_Status; /* 01/001 ASPI command status byte */
|
||||
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
|
||||
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
|
||||
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
|
||||
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
|
||||
BYTE SRB_Lun; /* 09/009 Target's LUN number */
|
||||
BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */
|
||||
BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */
|
||||
} PACKED SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
** SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2)
|
||||
***************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_EXEC_SCSI_CMD */
|
||||
BYTE SRB_Status; /* 01/001 ASPI command status byte */
|
||||
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
|
||||
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
|
||||
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
|
||||
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
|
||||
BYTE SRB_Lun; /* 09/009 Target's LUN */
|
||||
WORD SRB_Rsvd1; /* 0a/010 Reserved for alignment */
|
||||
DWORD SRB_BufLen; /* 0c/012 Data Allocation Length */
|
||||
BYTE FAR *SRB_BufPointer; /* 10/016 Data Buffer Pointer */
|
||||
BYTE SRB_SenseLen; /* 14/020 Sense Allocation Length */
|
||||
BYTE SRB_CDBLen; /* 15/021 CDB Length */
|
||||
BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
|
||||
BYTE SRB_TargStat; /* 17/023 Target Status */
|
||||
VOID FAR *SRB_PostProc; /* 18/024 Post routine */
|
||||
BYTE SRB_Rsvd2[20]; /* 1c/028 Reserved, must = 0 */
|
||||
BYTE CDBByte[16]; /* 30/048 SCSI CDB */
|
||||
BYTE SenseArea[SENSE_LEN+2]; /* 40/064 Request Sense buffer */
|
||||
} PACKED SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_ABORT_SRB */
|
||||
BYTE SRB_Status; /* 01/001 ASPI command status byte */
|
||||
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
|
||||
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
|
||||
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
|
||||
void *SRB_ToAbort; /* 08/008 Pointer to SRB to abort */
|
||||
} PACKED SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
** SRB - BUS DEVICE RESET - SC_RESET_DEV (4)
|
||||
***************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_RESET_DEV */
|
||||
BYTE SRB_Status; /* 01/001 ASPI command status byte */
|
||||
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
|
||||
DWORD SRB_Flags; /* 04/004 Reserved */
|
||||
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
|
||||
BYTE SRB_Lun; /* 09/009 Target's LUN number */
|
||||
BYTE SRB_Rsvd1[12]; /* 0A/010 Reserved for alignment */
|
||||
BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
|
||||
BYTE SRB_TargStat; /* 17/023 Target Status */
|
||||
VOID FAR *SRB_PostProc; /* 18/024 Post routine */
|
||||
BYTE SRB_Rsvd2[36]; /* 1C/028 Reserved, must = 0 */
|
||||
} SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset;
|
||||
|
||||
typedef struct tag_ASPI32BUFF
|
||||
{
|
||||
PBYTE AB_BufPointer;
|
||||
DWORD AB_BufLen;
|
||||
DWORD AB_ZeroFill;
|
||||
DWORD AB_Reserved;
|
||||
} PACKED ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE SRB_Cmd;
|
||||
BYTE SRB_Status;
|
||||
BYTE SRB_HaId;
|
||||
BYTE SRB_Flags;
|
||||
DWORD SRB_Hdr_Rsvd;
|
||||
} SRB, *PSRB, FAR *LPSRB;
|
||||
|
||||
#endif
|
||||
200
schily/scg/scgcmd.h
Normal file
200
schily/scg/scgcmd.h
Normal file
@@ -0,0 +1,200 @@
|
||||
/* @(#)scgcmd.h 2.22 04/09/04 Copyright 1986 J. Schilling */
|
||||
/*
|
||||
* Definitions for the SCSI 'scg_cmd' structure that has been created
|
||||
* for the SCSI general driver 'scg' for SunOS and Solaris but
|
||||
* now is used for wrapping general libscg SCSI transport requests.
|
||||
*
|
||||
* Copyright (c) 1986 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* 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; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; see the file COPYING. If not, write to the Free Software
|
||||
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SCG_SCGCMD_H
|
||||
#define _SCG_SCGCMD_H
|
||||
|
||||
#include <utypes.h>
|
||||
#include <btorder.h>
|
||||
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
#else
|
||||
# if defined(_BIT_FIELDS_HTOL) /* Motorola byteorder */
|
||||
# else
|
||||
/*
|
||||
* #error will not work for all compilers (e.g. sunos4)
|
||||
* The following line will abort compilation on all compilers
|
||||
* if none of the above is defines. And that's what we want.
|
||||
*/
|
||||
error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <scg/scsisense.h>
|
||||
#include <scg/scsicdb.h>
|
||||
#include <intcvt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Leave these definitions here if possible to avoid the need to
|
||||
* include scsireg.h which makes problems on some OS because these
|
||||
* OS define the same types as in scsireg.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* SCSI status bits.
|
||||
*/
|
||||
#define ST_VU_00 0x01 /* Vendor unique */
|
||||
#define ST_CHK_COND 0x02 /* Check condition */
|
||||
#define ST_COND_MET 0x04 /* Condition met */
|
||||
#define ST_BUSY 0x08 /* Busy */
|
||||
#define ST_IS_SEND 0x10 /* Intermediate status send */
|
||||
#define ST_VU_05 0x20 /* Vendor unique */
|
||||
#define ST_VU_06 0x40 /* Vendor unique */
|
||||
#define ST_RSVD_07 0x80 /* Reserved */
|
||||
|
||||
/*
|
||||
* Sense key values for extended sense.
|
||||
*/
|
||||
#define SC_NO_SENSE 0x00
|
||||
#define SC_RECOVERABLE_ERROR 0x01
|
||||
#define SC_NOT_READY 0x02
|
||||
#define SC_MEDIUM_ERROR 0x03
|
||||
#define SC_HARDWARE_ERROR 0x04
|
||||
#define SC_ILLEGAL_REQUEST 0x05
|
||||
#define SC_UNIT_ATTENTION 0x06
|
||||
#define SC_WRITE_PROTECT 0x07
|
||||
#define SC_BLANK_CHECK 0x08
|
||||
#define SC_VENDOR_UNIQUE 0x09
|
||||
#define SC_COPY_ABORTED 0x0A
|
||||
#define SC_ABORTED_COMMAND 0x0B
|
||||
#define SC_EQUAL 0x0C
|
||||
#define SC_VOLUME_OVERFLOW 0x0D
|
||||
#define SC_MISCOMPARE 0x0E
|
||||
#define SC_RESERVED 0x0F
|
||||
|
||||
/*
|
||||
* Messages that SCSI can send.
|
||||
*/
|
||||
#define SC_COMMAND_COMPLETE 0x00
|
||||
#define SC_SYNCHRONOUS 0x01
|
||||
#define SC_SAVE_DATA_PTR 0x02
|
||||
#define SC_RESTORE_PTRS 0x03
|
||||
#define SC_DISCONNECT 0x04
|
||||
#define SC_ABORT 0x06
|
||||
#define SC_MSG_REJECT 0x07
|
||||
#define SC_NO_OP 0x08
|
||||
#define SC_PARITY 0x09
|
||||
#define SC_IDENTIFY 0x80
|
||||
#define SC_DR_IDENTIFY 0xc0
|
||||
#define SC_DEVICE_RESET 0x0c
|
||||
|
||||
#define SC_G0_CDBLEN 6 /* Len of Group 0 commands */
|
||||
#define SC_G1_CDBLEN 10 /* Len of Group 1 commands */
|
||||
#define SC_G5_CDBLEN 12 /* Len of Group 5 commands */
|
||||
|
||||
#define SCG_MAX_CMD 24 /* 24 bytes max. size is supported */
|
||||
#define SCG_MAX_STATUS 3 /* XXX (sollte 4 allign.) Mamimum Status Len */
|
||||
#define SCG_MAX_SENSE 32 /* Mamimum Sense Len for auto Req. Sense */
|
||||
|
||||
#define DEF_SENSE_LEN 16 /* Default Sense Len */
|
||||
#define CCS_SENSE_LEN 18 /* Sense Len for CCS compatible devices */
|
||||
|
||||
struct scg_cmd {
|
||||
caddr_t addr; /* Address of data in user space */
|
||||
int size; /* DMA count for data transfer */
|
||||
int flags; /* see below for definition */
|
||||
int cdb_len; /* Size of SCSI command in bytes */
|
||||
/* NOTE: rel 4 uses this field only */
|
||||
/* with commands not in group 1 or 2*/
|
||||
int sense_len; /* for intr() if -1 don't get sense */
|
||||
int timeout; /* timeout in seconds */
|
||||
/* NOTE: actual resolution depends */
|
||||
/* on driver implementation */
|
||||
int kdebug; /* driver kernel debug level */
|
||||
int resid; /* Bytes not transfered */
|
||||
int error; /* Error code from scgintr() */
|
||||
int ux_errno; /* UNIX error code */
|
||||
#ifdef comment
|
||||
XXX struct scsi_status scb; ??? /* Status returnd by command */
|
||||
#endif
|
||||
union {
|
||||
struct scsi_status Scb; /* Status returnd by command */
|
||||
Uchar cmd_scb[SCG_MAX_STATUS];
|
||||
} u_scb;
|
||||
#define scb u_scb.Scb
|
||||
#ifdef comment
|
||||
XXX struct scsi_sense sense; ??? /* Sense bytes from command */
|
||||
#endif
|
||||
union {
|
||||
struct scsi_sense Sense; /* Sense bytes from command */
|
||||
Uchar cmd_sense[SCG_MAX_SENSE];
|
||||
} u_sense;
|
||||
#define sense u_sense.Sense
|
||||
int sense_count; /* Number of bytes valid in sense */
|
||||
int target; /* SCSI target id */
|
||||
/* NOTE: The SCSI target id field */
|
||||
/* does not need to be filled unless */
|
||||
/* the low level transport is a real */
|
||||
/* scg driver. In this case the low */
|
||||
/* level transport routine of libscg */
|
||||
/* will fill in the needed value */
|
||||
union { /* SCSI command descriptor block */
|
||||
struct scsi_g0cdb g0_cdb;
|
||||
struct scsi_g1cdb g1_cdb;
|
||||
struct scsi_g5cdb g5_cdb;
|
||||
Uchar cmd_cdb[SCG_MAX_CMD];
|
||||
} cdb; /* 24 bytes max. size is supported */
|
||||
};
|
||||
|
||||
#define dma_read flags /* 1 if DMA to Sun, 0 otherwise */
|
||||
|
||||
/*
|
||||
* definition for flags field in scg_cmd struct
|
||||
*/
|
||||
#define SCG_RECV_DATA 0x0001 /* DMA direction to Sun */
|
||||
#define SCG_DISRE_ENA 0x0002 /* enable disconnect/reconnect */
|
||||
#define SCG_SILENT 0x0004 /* be silent on errors */
|
||||
#define SCG_CMD_RETRY 0x0008 /* enable retries */
|
||||
#define SCG_NOPARITY 0x0010 /* disable parity for this command */
|
||||
|
||||
/*
|
||||
* definition for error field in scg_cmd struct
|
||||
*
|
||||
* The codes refer to SCSI general errors, not to device
|
||||
* specific errors. Device specific errors are discovered
|
||||
* by checking the sense data.
|
||||
* The distinction between retryable and fatal is somewhat ad hoc.
|
||||
*/
|
||||
#define SCG_NO_ERROR 0 /* cdb transported without error */
|
||||
/* SCG_NO_ERROR incudes all commands */
|
||||
/* where the SCSI status is valid */
|
||||
|
||||
#define SCG_RETRYABLE 1 /* any other case e.g. SCSI bus busy */
|
||||
/* SCSI cdb could not be send, */
|
||||
/* includes DMA errors other than */
|
||||
/* DMA underrun */
|
||||
|
||||
#define SCG_FATAL 2 /* could not select target */
|
||||
#define SCG_TIMEOUT 3 /* driver timed out */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCGCMD_H */
|
||||
68
schily/scg/scgio.h
Normal file
68
schily/scg/scgio.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* @(#)scgio.h 2.16 00/11/07 Copyright 1986 J. Schilling */
|
||||
/*
|
||||
* Definitions for the SCSI general driver 'scg'
|
||||
*
|
||||
* Copyright (c) 1986 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* 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; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SCG_SCGIO_H
|
||||
#define _SCG_SCGIO_H
|
||||
|
||||
#ifndef _SCG_SCGCMD_H
|
||||
#include <scg/scgcmd.h>
|
||||
#endif
|
||||
|
||||
#if defined(SVR4)
|
||||
#include <sys/ioccom.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__) || defined(SVR4)
|
||||
#define SCGIOCMD _IOWR('G', 1, struct scg_cmd) /* do a SCSI cmd */
|
||||
#define SCGIORESET _IO('G', 2) /* reset SCSI bus */
|
||||
#define SCGIOGDISRE _IOR('G', 4, int) /* get sc disre Val*/
|
||||
#define SCGIOSDISRE _IOW('G', 5, int) /* set sc disre Val*/
|
||||
#define SCGIOIDBG _IO('G', 100) /* Inc Debug Val */
|
||||
#define SCGIODDBG _IO('G', 101) /* Dec Debug Val */
|
||||
#define SCGIOGDBG _IOR('G', 102, int) /* get Debug Val */
|
||||
#define SCGIOSDBG _IOW('G', 103, int) /* set Debug Val */
|
||||
#define SCIOGDBG _IOR('G', 104, int) /* get sc Debug Val*/
|
||||
#define SCIOSDBG _IOW('G', 105, int) /* set sc Debug Val*/
|
||||
#else
|
||||
#define SCGIOCMD _IOWR(G, 1, struct scg_cmd) /* do a SCSI cmd */
|
||||
#define SCGIORESET _IO(G, 2) /* reset SCSI bus */
|
||||
#define SCGIOGDISRE _IOR(G, 4, int) /* get sc disre Val*/
|
||||
#define SCGIOSDISRE _IOW(G, 5, int) /* set sc disre Val*/
|
||||
#define SCGIOIDBG _IO(G, 100) /* Inc Debug Val */
|
||||
#define SCGIODDBG _IO(G, 101) /* Dec Debug Val */
|
||||
#define SCGIOGDBG _IOR(G, 102, int) /* get Debug Val */
|
||||
#define SCGIOSDBG _IOW(G, 103, int) /* set Debug Val */
|
||||
#define SCIOGDBG _IOR(G, 104, int) /* get sc Debug Val*/
|
||||
#define SCIOSDBG _IOW(G, 105, int) /* set sc Debug Val*/
|
||||
#endif
|
||||
|
||||
#define SCGIO_CMD SCGIOCMD /* backward ccompatibility */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCGIO_H */
|
||||
69
schily/scg/scgops.h
Normal file
69
schily/scg/scgops.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* @(#)scgops.h 1.5 02/10/19 Copyright 2000 J. Schilling */
|
||||
/*
|
||||
* Copyright (c) 2000 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* 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; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SCG_SCGOPS_H
|
||||
#define _SCG_SCGOPS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct scg_ops {
|
||||
int (*scgo_send) __PR((SCSI *scgp));
|
||||
|
||||
char * (*scgo_version) __PR((SCSI *scgp, int what));
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
int (*scgo_help) __PR((SCSI *scgp, FILE *f));
|
||||
#else
|
||||
int (*scgo_help) __PR((SCSI *scgp, void *f));
|
||||
#endif
|
||||
int (*scgo_open) __PR((SCSI *scgp, char *device));
|
||||
int (*scgo_close) __PR((SCSI *scgp));
|
||||
long (*scgo_maxdma) __PR((SCSI *scgp, long amt));
|
||||
void * (*scgo_getbuf) __PR((SCSI *scgp, long amt));
|
||||
void (*scgo_freebuf) __PR((SCSI *scgp));
|
||||
|
||||
|
||||
BOOL (*scgo_havebus) __PR((SCSI *scgp, int busno));
|
||||
int (*scgo_fileno) __PR((SCSI *scgp, int busno, int tgt, int tlun));
|
||||
int (*scgo_initiator_id) __PR((SCSI *scgp));
|
||||
int (*scgo_isatapi) __PR((SCSI *scgp));
|
||||
int (*scgo_reset) __PR((SCSI *scgp, int what));
|
||||
} scg_ops_t;
|
||||
|
||||
#define SCGO_SEND(scgp) (*(scgp)->ops->scgo_send)(scgp)
|
||||
#define SCGO_VERSION(scgp, what) (*(scgp)->ops->scgo_version)(scgp, what)
|
||||
#define SCGO_HELP(scgp, f) (*(scgp)->ops->scgo_help)(scgp, f)
|
||||
#define SCGO_OPEN(scgp, device) (*(scgp)->ops->scgo_open)(scgp, device)
|
||||
#define SCGO_CLOSE(scgp) (*(scgp)->ops->scgo_close)(scgp)
|
||||
#define SCGO_MAXDMA(scgp, amt) (*(scgp)->ops->scgo_maxdma)(scgp, amt)
|
||||
#define SCGO_GETBUF(scgp, amt) (*(scgp)->ops->scgo_getbuf)(scgp, amt)
|
||||
#define SCGO_FREEBUF(scgp) (*(scgp)->ops->scgo_freebuf)(scgp)
|
||||
#define SCGO_HAVEBUS(scgp, busno) (*(scgp)->ops->scgo_havebus)(scgp, busno)
|
||||
#define SCGO_FILENO(scgp, busno, tgt, tlun) (*(scgp)->ops->scgo_fileno)(scgp, busno, tgt, tlun)
|
||||
#define SCGO_INITIATOR_ID(scgp) (*(scgp)->ops->scgo_initiator_id)(scgp)
|
||||
#define SCGO_ISATAPI(scgp) (*(scgp)->ops->scgo_isatapi)(scgp)
|
||||
#define SCGO_RESET(scgp, what) (*(scgp)->ops->scgo_reset)(scgp, what)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCGOPS_H */
|
||||
249
schily/scg/scsicdb.h
Normal file
249
schily/scg/scsicdb.h
Normal file
@@ -0,0 +1,249 @@
|
||||
/* @(#)scsicdb.h 2.19 04/09/04 Copyright 1986 J. Schilling */
|
||||
/*
|
||||
* Definitions for the SCSI Command Descriptor Block
|
||||
*
|
||||
* Copyright (c) 1986 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* 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; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; see the file COPYING. If not, write to the Free Software
|
||||
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SCG_SCSICDB_H
|
||||
#define _SCG_SCSICDB_H
|
||||
|
||||
#ifndef _UTYPES_H
|
||||
#include <utypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* SCSI Operation codes.
|
||||
*/
|
||||
#define SC_TEST_UNIT_READY 0x00
|
||||
#define SC_REZERO_UNIT 0x01
|
||||
#define SC_REQUEST_SENSE 0x03
|
||||
#define SC_FORMAT 0x04
|
||||
#define SC_FORMAT_TRACK 0x06
|
||||
#define SC_REASSIGN_BLOCK 0x07 /* CCS only */
|
||||
#define SC_SEEK 0x0b
|
||||
#define SC_TRANSLATE 0x0f /* ACB4000 only */
|
||||
#define SC_INQUIRY 0x12 /* CCS only */
|
||||
#define SC_MODE_SELECT 0x15
|
||||
#define SC_RESERVE 0x16
|
||||
#define SC_RELEASE 0x17
|
||||
#define SC_MODE_SENSE 0x1a
|
||||
#define SC_START 0x1b
|
||||
#define SC_READ_DEFECT_LIST 0x37 /* CCS only, group 1 */
|
||||
#define SC_READ_BUFFER 0x3c /* CCS only, group 1 */
|
||||
/*
|
||||
* Note, these two commands use identical command blocks for all
|
||||
* controllers except the Adaptec ACB 4000 which sets bit 1 of byte 1.
|
||||
*/
|
||||
#define SC_READ 0x08
|
||||
#define SC_WRITE 0x0a
|
||||
#define SC_EREAD 0x28 /* 10 byte read */
|
||||
#define SC_EWRITE 0x2a /* 10 byte write */
|
||||
#define SC_WRITE_VERIFY 0x2e /* 10 byte write+verify */
|
||||
#define SC_WRITE_FILE_MARK 0x10
|
||||
#define SC_UNKNOWN 0xff /* cmd list terminator */
|
||||
|
||||
|
||||
/*
|
||||
* Standard SCSI control blocks.
|
||||
* These go in or out over the SCSI bus.
|
||||
*/
|
||||
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
|
||||
struct scsi_g0cdb { /* scsi group 0 command description block */
|
||||
Uchar cmd; /* command code */
|
||||
Ucbit high_addr : 5; /* high part of block address */
|
||||
Ucbit lun : 3; /* logical unit number */
|
||||
Uchar mid_addr; /* middle part of block address */
|
||||
Uchar low_addr; /* low part of block address */
|
||||
Uchar count; /* transfer length */
|
||||
Ucbit link : 1; /* link (another command follows) */
|
||||
Ucbit fr : 1; /* flag request (interrupt at completion) */
|
||||
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
|
||||
Ucbit rsvd : 3; /* reserved */
|
||||
Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */
|
||||
Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */
|
||||
};
|
||||
|
||||
#else /* Motorola byteorder */
|
||||
|
||||
struct scsi_g0cdb { /* scsi group 0 command description block */
|
||||
Uchar cmd; /* command code */
|
||||
Ucbit lun : 3; /* logical unit number */
|
||||
Ucbit high_addr : 5; /* high part of block address */
|
||||
Uchar mid_addr; /* middle part of block address */
|
||||
Uchar low_addr; /* low part of block address */
|
||||
Uchar count; /* transfer length */
|
||||
Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */
|
||||
Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */
|
||||
Ucbit rsvd : 3; /* reserved */
|
||||
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
|
||||
Ucbit fr : 1; /* flag request (interrupt at completion) */
|
||||
Ucbit link : 1; /* link (another command follows) */
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
|
||||
struct scsi_g1cdb { /* scsi group 1 command description block */
|
||||
Uchar cmd; /* command code */
|
||||
Ucbit reladr : 1; /* address is relative */
|
||||
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
|
||||
Ucbit lun : 3; /* logical unit number */
|
||||
Uchar addr[4]; /* logical block address */
|
||||
Uchar res6; /* reserved byte 6 */
|
||||
Uchar count[2]; /* transfer length */
|
||||
Ucbit link : 1; /* link (another command follows) */
|
||||
Ucbit fr : 1; /* flag request (interrupt at completion) */
|
||||
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
|
||||
Ucbit rsvd : 3; /* reserved */
|
||||
Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */
|
||||
Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */
|
||||
};
|
||||
|
||||
#else /* Motorola byteorder */
|
||||
|
||||
struct scsi_g1cdb { /* scsi group 1 command description block */
|
||||
Uchar cmd; /* command code */
|
||||
Ucbit lun : 3; /* logical unit number */
|
||||
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
|
||||
Ucbit reladr : 1; /* address is relative */
|
||||
Uchar addr[4]; /* logical block address */
|
||||
Uchar res6; /* reserved byte 6 */
|
||||
Uchar count[2]; /* transfer length */
|
||||
Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */
|
||||
Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */
|
||||
Ucbit rsvd : 3; /* reserved */
|
||||
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
|
||||
Ucbit fr : 1; /* flag request (interrupt at completion) */
|
||||
Ucbit link : 1; /* link (another command follows) */
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
|
||||
struct scsi_g5cdb { /* scsi group 5 command description block */
|
||||
Uchar cmd; /* command code */
|
||||
Ucbit reladr : 1; /* address is relative */
|
||||
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
|
||||
Ucbit lun : 3; /* logical unit number */
|
||||
Uchar addr[4]; /* logical block address */
|
||||
Uchar count[4]; /* transfer length */
|
||||
Uchar res10; /* reserved byte 10 */
|
||||
Ucbit link : 1; /* link (another command follows) */
|
||||
Ucbit fr : 1; /* flag request (interrupt at completion) */
|
||||
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
|
||||
Ucbit rsvd : 3; /* reserved */
|
||||
Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */
|
||||
Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */
|
||||
};
|
||||
|
||||
#else /* Motorola byteorder */
|
||||
|
||||
struct scsi_g5cdb { /* scsi group 5 command description block */
|
||||
Uchar cmd; /* command code */
|
||||
Ucbit lun : 3; /* logical unit number */
|
||||
Ucbit res : 4; /* reserved bits 1-4 of byte 1 */
|
||||
Ucbit reladr : 1; /* address is relative */
|
||||
Uchar addr[4]; /* logical block address */
|
||||
Uchar count[4]; /* transfer length */
|
||||
Uchar res10; /* reserved byte 10 */
|
||||
Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */
|
||||
Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */
|
||||
Ucbit rsvd : 3; /* reserved */
|
||||
Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */
|
||||
Ucbit fr : 1; /* flag request (interrupt at completion) */
|
||||
Ucbit link : 1; /* link (another command follows) */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define g0_cdbaddr(cdb, a) ((cdb)->high_addr = (a) >> 16,\
|
||||
(cdb)->mid_addr = ((a) >> 8) & 0xFF,\
|
||||
(cdb)->low_addr = (a) & 0xFF)
|
||||
|
||||
#define g1_cdbaddr(cdb, a) ((cdb)->addr[0] = (a) >> 24,\
|
||||
(cdb)->addr[1] = ((a) >> 16)& 0xFF,\
|
||||
(cdb)->addr[2] = ((a) >> 8) & 0xFF,\
|
||||
(cdb)->addr[3] = (a) & 0xFF)
|
||||
|
||||
#define g5_cdbaddr(cdb, a) g1_cdbaddr(cdb, a)
|
||||
|
||||
|
||||
#define g0_cdblen(cdb, len) ((cdb)->count = (len))
|
||||
|
||||
#define g1_cdblen(cdb, len) ((cdb)->count[0] = ((len) >> 8) & 0xFF,\
|
||||
(cdb)->count[1] = (len) & 0xFF)
|
||||
|
||||
#define g5_cdblen(cdb, len) ((cdb)->count[0] = (len) >> 24L,\
|
||||
(cdb)->count[1] = ((len) >> 16L)& 0xFF,\
|
||||
(cdb)->count[2] = ((len) >> 8L) & 0xFF,\
|
||||
(cdb)->count[3] = (len) & 0xFF)
|
||||
|
||||
/*#define XXXXX*/
|
||||
#ifdef XXXXX
|
||||
#define i_to_long(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\
|
||||
((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\
|
||||
((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\
|
||||
((Uchar *)(a))[3] = (i) & 0xFF)
|
||||
|
||||
#define i_to_3_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 16)& 0xFF,\
|
||||
((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\
|
||||
((Uchar *)(a))[2] = (i) & 0xFF)
|
||||
|
||||
#define i_to_4_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\
|
||||
((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\
|
||||
((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\
|
||||
((Uchar *)(a))[3] = (i) & 0xFF)
|
||||
|
||||
#define i_to_short(a, i) (((Uchar *)(a))[0] = ((i) >> 8) & 0xFF,\
|
||||
((Uchar *)(a))[1] = (i) & 0xFF)
|
||||
|
||||
#define a_to_u_short(a) ((unsigned short) \
|
||||
((((Uchar*) a)[1] & 0xFF) | \
|
||||
(((Uchar*) a)[0] << 8 & 0xFF00)))
|
||||
|
||||
#define a_to_3_byte(a) ((Ulong) \
|
||||
((((Uchar*) a)[2] & 0xFF) | \
|
||||
(((Uchar*) a)[1] << 8 & 0xFF00) | \
|
||||
(((Uchar*) a)[0] << 16 & 0xFF0000)))
|
||||
|
||||
#ifdef __STDC__
|
||||
#define a_to_u_long(a) ((Ulong) \
|
||||
((((Uchar*) a)[3] & 0xFF) | \
|
||||
(((Uchar*) a)[2] << 8 & 0xFF00) | \
|
||||
(((Uchar*) a)[1] << 16 & 0xFF0000) | \
|
||||
(((Uchar*) a)[0] << 24 & 0xFF000000UL)))
|
||||
#else
|
||||
#define a_to_u_long(a) ((Ulong) \
|
||||
((((Uchar*) a)[3] & 0xFF) | \
|
||||
(((Uchar*) a)[2] << 8 & 0xFF00) | \
|
||||
(((Uchar*) a)[1] << 16 & 0xFF0000) | \
|
||||
(((Uchar*) a)[0] << 24 & 0xFF000000)))
|
||||
#endif
|
||||
#endif /* XXXX */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCSICDB_H */
|
||||
111
schily/scg/scsidefs.h
Normal file
111
schily/scg/scsidefs.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/* @(#)scsidefs.h 1.28 04/09/04 Copyright 1988 J. Schilling */
|
||||
/*
|
||||
* Definitions for SCSI devices i.e. for error strings in scsierrs.c
|
||||
*
|
||||
* Copyright (c) 1988 J. Schilling
|
||||
*/
|
||||
/*@@C@@*/
|
||||
|
||||
#ifndef _SCG_SCSIDEFS_H
|
||||
#define _SCG_SCSIDEFS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Disks
|
||||
*/
|
||||
#ifdef DEV_UNKNOWN
|
||||
/*
|
||||
* True64 defines DEV_UNKNOWN in /usr/include/sys/devio.h as "UNKNOWN"
|
||||
*/
|
||||
#undef DEV_UNKNOWN
|
||||
#endif
|
||||
#define DEV_UNKNOWN 0
|
||||
#define DEV_ACB40X0 1
|
||||
#define DEV_ACB4000 2
|
||||
#define DEV_ACB4010 3
|
||||
#define DEV_ACB4070 4
|
||||
#define DEV_ACB5500 5
|
||||
#define DEV_ACB4520A 6
|
||||
#define DEV_ACB4525 7
|
||||
#define DEV_MD21 8
|
||||
#define DEV_MD23 9
|
||||
#define DEV_NON_CCS_DSK 10
|
||||
#define DEV_CCS_GENDISK 11
|
||||
|
||||
/*
|
||||
* Tapes
|
||||
*/
|
||||
#define DEV_MT02 100
|
||||
#define DEV_SC4000 101
|
||||
|
||||
/*
|
||||
* Printer
|
||||
*/
|
||||
#define DEV_PRT 200
|
||||
|
||||
/*
|
||||
* Processors
|
||||
*/
|
||||
#define DEV_PROC 300
|
||||
|
||||
/*
|
||||
* Worm
|
||||
*/
|
||||
#define DEV_WORM 400
|
||||
#define DEV_RXT800S 401
|
||||
|
||||
/*
|
||||
* CD-ROM
|
||||
*/
|
||||
#define DEV_CDROM 500
|
||||
#define DEV_MMC_CDROM 501
|
||||
#define DEV_MMC_CDR 502
|
||||
#define DEV_MMC_CDRW 503
|
||||
#define DEV_MMC_DVD 504
|
||||
#define DEV_MMC_DVD_WR 505
|
||||
|
||||
#define DEV_CDD_521_OLD 510
|
||||
#define DEV_CDD_521 511
|
||||
#define DEV_CDD_522 512
|
||||
#define DEV_PCD_600 513
|
||||
#define DEV_CDD_2000 514
|
||||
#define DEV_CDD_2600 515
|
||||
#define DEV_TYUDEN_EW50 516
|
||||
#define DEV_YAMAHA_CDR_100 520
|
||||
#define DEV_YAMAHA_CDR_400 521
|
||||
#define DEV_PLASMON_RF_4100 530
|
||||
#define DEV_SONY_CDU_924 540
|
||||
#define DEV_RICOH_RO_1420C 550
|
||||
#define DEV_RICOH_RO_1060C 551
|
||||
#define DEV_TEAC_CD_R50S 560
|
||||
#define DEV_MATSUSHITA_7501 570
|
||||
#define DEV_MATSUSHITA_7502 571
|
||||
#define DEV_PIONEER_DW_S114X 580
|
||||
#define DEV_PIONEER_DVDR_S101 581
|
||||
|
||||
/*
|
||||
* Scanners
|
||||
*/
|
||||
#define DEV_HRSCAN 600
|
||||
#define DEV_MS300A 601
|
||||
|
||||
/*
|
||||
* Optical memory
|
||||
*/
|
||||
#define DEV_SONY_SMO 700
|
||||
|
||||
|
||||
#define old_acb(d) (((d) == DEV_ACB40X0) || \
|
||||
((d) == DEV_ACB4000) || ((d) == DEV_ACB4010) || \
|
||||
((d) == DEV_ACB4070) || ((d) == DEV_ACB5500))
|
||||
|
||||
#define is_ccs(d) (!old_acb(d))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCSIDEFS_H */
|
||||
1229
schily/scg/scsireg.h
Normal file
1229
schily/scg/scsireg.h
Normal file
File diff suppressed because it is too large
Load Diff
191
schily/scg/scsisense.h
Normal file
191
schily/scg/scsisense.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/* @(#)scsisense.h 2.18 04/09/04 Copyright 1986 J. Schilling */
|
||||
/*
|
||||
* Definitions for the SCSI status code and sense structure
|
||||
*
|
||||
* Copyright (c) 1986 J. Schilling
|
||||
*/
|
||||
/*@@C@@*/
|
||||
|
||||
#ifndef _SCG_SCSISENSE_H
|
||||
#define _SCG_SCSISENSE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SCSI status completion block.
|
||||
*/
|
||||
#define SCSI_EXTENDED_STATUS
|
||||
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
|
||||
struct scsi_status {
|
||||
Ucbit vu_00 : 1; /* vendor unique */
|
||||
Ucbit chk : 1; /* check condition: sense data available */
|
||||
Ucbit cm : 1; /* condition met */
|
||||
Ucbit busy : 1; /* device busy or reserved */
|
||||
Ucbit is : 1; /* intermediate status sent */
|
||||
Ucbit vu_05 : 1; /* vendor unique */
|
||||
#define st_scsi2 vu_05 /* SCSI-2 modifier bit */
|
||||
Ucbit vu_06 : 1; /* vendor unique */
|
||||
Ucbit st_rsvd : 1; /* reserved */
|
||||
|
||||
#ifdef SCSI_EXTENDED_STATUS
|
||||
#define ext_st1 st_rsvd /* extended status (next byte valid) */
|
||||
/* byte 1 */
|
||||
Ucbit ha_er : 1; /* host adapter detected error */
|
||||
Ucbit reserved: 6; /* reserved */
|
||||
Ucbit ext_st2 : 1; /* extended status (next byte valid) */
|
||||
/* byte 2 */
|
||||
Uchar byte2; /* third byte */
|
||||
#endif /* SCSI_EXTENDED_STATUS */
|
||||
};
|
||||
|
||||
#else /* Motorola byteorder */
|
||||
|
||||
struct scsi_status {
|
||||
Ucbit st_rsvd : 1; /* reserved */
|
||||
Ucbit vu_06 : 1; /* vendor unique */
|
||||
Ucbit vu_05 : 1; /* vendor unique */
|
||||
#define st_scsi2 vu_05 /* SCSI-2 modifier bit */
|
||||
Ucbit is : 1; /* intermediate status sent */
|
||||
Ucbit busy : 1; /* device busy or reserved */
|
||||
Ucbit cm : 1; /* condition met */
|
||||
Ucbit chk : 1; /* check condition: sense data available */
|
||||
Ucbit vu_00 : 1; /* vendor unique */
|
||||
#ifdef SCSI_EXTENDED_STATUS
|
||||
#define ext_st1 st_rsvd /* extended status (next byte valid) */
|
||||
/* byte 1 */
|
||||
Ucbit ext_st2 : 1; /* extended status (next byte valid) */
|
||||
Ucbit reserved: 6; /* reserved */
|
||||
Ucbit ha_er : 1; /* host adapter detected error */
|
||||
/* byte 2 */
|
||||
Uchar byte2; /* third byte */
|
||||
#endif /* SCSI_EXTENDED_STATUS */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OLD Standard (Non Extended) SCSI Sense. Used mainly by the
|
||||
* Adaptec ACB 4000 which is the only controller that
|
||||
* does not support the Extended sense format.
|
||||
*/
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
|
||||
struct scsi_sense { /* scsi sense for error classes 0-6 */
|
||||
Ucbit code : 7; /* error class/code */
|
||||
Ucbit adr_val : 1; /* sense data is valid */
|
||||
#ifdef comment
|
||||
Ucbit high_addr:5; /* high byte of block addr */
|
||||
Ucbit rsvd : 3;
|
||||
#else
|
||||
Uchar high_addr; /* high byte of block addr */
|
||||
#endif
|
||||
Uchar mid_addr; /* middle byte of block addr */
|
||||
Uchar low_addr; /* low byte of block addr */
|
||||
};
|
||||
|
||||
#else /* Motorola byteorder */
|
||||
|
||||
struct scsi_sense { /* scsi sense for error classes 0-6 */
|
||||
Ucbit adr_val : 1; /* sense data is valid */
|
||||
Ucbit code : 7; /* error class/code */
|
||||
#ifdef comment
|
||||
Ucbit rsvd : 3;
|
||||
Ucbit high_addr:5; /* high byte of block addr */
|
||||
#else
|
||||
Uchar high_addr; /* high byte of block addr */
|
||||
#endif
|
||||
Uchar mid_addr; /* middle byte of block addr */
|
||||
Uchar low_addr; /* low byte of block addr */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SCSI extended sense parameter block.
|
||||
*/
|
||||
#ifdef comment
|
||||
#define SC_CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */
|
||||
#endif
|
||||
|
||||
#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */
|
||||
|
||||
struct scsi_ext_sense { /* scsi extended sense for error class 7 */
|
||||
/* byte 0 */
|
||||
Ucbit type : 7; /* fixed at 0x70 */
|
||||
Ucbit adr_val : 1; /* sense data is valid */
|
||||
/* byte 1 */
|
||||
Uchar seg_num; /* segment number, applies to copy cmd only */
|
||||
/* byte 2 */
|
||||
Ucbit key : 4; /* sense key, see below */
|
||||
Ucbit : 1; /* reserved */
|
||||
Ucbit ili : 1; /* incorrect length indicator */
|
||||
Ucbit eom : 1; /* end of media */
|
||||
Ucbit fil_mk : 1; /* file mark on device */
|
||||
/* bytes 3 through 7 */
|
||||
Uchar info_1; /* information byte 1 */
|
||||
Uchar info_2; /* information byte 2 */
|
||||
Uchar info_3; /* information byte 3 */
|
||||
Uchar info_4; /* information byte 4 */
|
||||
Uchar add_len; /* number of additional bytes */
|
||||
/* bytes 8 through 13, CCS additions */
|
||||
Uchar optional_8; /* CCS search and copy only */
|
||||
Uchar optional_9; /* CCS search and copy only */
|
||||
Uchar optional_10; /* CCS search and copy only */
|
||||
Uchar optional_11; /* CCS search and copy only */
|
||||
Uchar sense_code; /* sense code */
|
||||
Uchar qual_code; /* sense code qualifier */
|
||||
Uchar fru_code; /* Field replacable unit code */
|
||||
Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
|
||||
Ucbit bpv : 1; /* bit pointer is valid */
|
||||
Ucbit : 2;
|
||||
Ucbit cd : 1; /* pointers refer to command not data */
|
||||
Ucbit sksv : 1; /* sense key specific valid */
|
||||
Uchar field_ptr[2]; /* field pointer for failure */
|
||||
Uchar add_info[2]; /* round up to 20 bytes */
|
||||
};
|
||||
|
||||
#else /* Motorola byteorder */
|
||||
|
||||
struct scsi_ext_sense { /* scsi extended sense for error class 7 */
|
||||
/* byte 0 */
|
||||
Ucbit adr_val : 1; /* sense data is valid */
|
||||
Ucbit type : 7; /* fixed at 0x70 */
|
||||
/* byte 1 */
|
||||
Uchar seg_num; /* segment number, applies to copy cmd only */
|
||||
/* byte 2 */
|
||||
Ucbit fil_mk : 1; /* file mark on device */
|
||||
Ucbit eom : 1; /* end of media */
|
||||
Ucbit ili : 1; /* incorrect length indicator */
|
||||
Ucbit : 1; /* reserved */
|
||||
Ucbit key : 4; /* sense key, see below */
|
||||
/* bytes 3 through 7 */
|
||||
Uchar info_1; /* information byte 1 */
|
||||
Uchar info_2; /* information byte 2 */
|
||||
Uchar info_3; /* information byte 3 */
|
||||
Uchar info_4; /* information byte 4 */
|
||||
Uchar add_len; /* number of additional bytes */
|
||||
/* bytes 8 through 13, CCS additions */
|
||||
Uchar optional_8; /* CCS search and copy only */
|
||||
Uchar optional_9; /* CCS search and copy only */
|
||||
Uchar optional_10; /* CCS search and copy only */
|
||||
Uchar optional_11; /* CCS search and copy only */
|
||||
Uchar sense_code; /* sense code */
|
||||
Uchar qual_code; /* sense code qualifier */
|
||||
Uchar fru_code; /* Field replacable unit code */
|
||||
Ucbit sksv : 1; /* sense key specific valid */
|
||||
Ucbit cd : 1; /* pointers refer to command not data */
|
||||
Ucbit : 2;
|
||||
Ucbit bpv : 1; /* bit pointer is valid */
|
||||
Ucbit bptr : 3; /* bit pointer for failure (if bpv) */
|
||||
Uchar field_ptr[2]; /* field pointer for failure */
|
||||
Uchar add_info[2]; /* round up to 20 bytes */
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCSISENSE_H */
|
||||
257
schily/scg/scsitransp.h
Normal file
257
schily/scg/scsitransp.h
Normal file
@@ -0,0 +1,257 @@
|
||||
/* @(#)scsitransp.h 1.54 03/05/03 Copyright 1995 J. Schilling */
|
||||
/*
|
||||
* Definitions for commands that use functions from scsitransp.c
|
||||
*
|
||||
* Copyright (c) 1995 J. Schilling
|
||||
*/
|
||||
/*
|
||||
* 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; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; see the file COPYING. If not, write to the Free Software
|
||||
* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SCG_SCSITRANSP_H
|
||||
#define _SCG_SCSITRANSP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct scg_scsi SCSI;
|
||||
|
||||
typedef struct {
|
||||
int scsibus; /* SCSI bus # for next I/O */
|
||||
int target; /* SCSI target # for next I/O */
|
||||
int lun; /* SCSI lun # for next I/O */
|
||||
} scg_addr_t;
|
||||
|
||||
#ifndef _SCG_SCGOPS_H
|
||||
#include <scg/scgops.h>
|
||||
#endif
|
||||
|
||||
typedef int (*scg_cb_t) __PR((void *));
|
||||
|
||||
struct scg_scsi {
|
||||
scg_ops_t *ops; /* Ptr to low level SCSI transport ops */
|
||||
int fd; /* File descriptor for next I/O */
|
||||
scg_addr_t addr; /* SCSI address for next I/O */
|
||||
int flags; /* Libscg flags (see below) */
|
||||
int dflags; /* Drive specific flags (see below) */
|
||||
int kdebug; /* Kernel debug value for next I/O */
|
||||
int debug; /* Debug value for SCSI library */
|
||||
int silent; /* Be silent if value > 0 */
|
||||
int verbose; /* Be verbose if value > 0 */
|
||||
int overbose; /* Be verbose in open() if value > 0 */
|
||||
int disre_disable;
|
||||
int deftimeout;
|
||||
int noparity; /* Do not use SCSI parity fo next I/O */
|
||||
int dev; /* from scsi_cdr.c */
|
||||
struct scg_cmd *scmd;
|
||||
char *cmdname;
|
||||
char *curcmdname;
|
||||
BOOL running;
|
||||
int error; /* libscg error number */
|
||||
|
||||
long maxdma; /* Max DMA limit for this open instance */
|
||||
long maxbuf; /* Cur DMA buffer limit for this inst. */
|
||||
/* This is the size behind bufptr */
|
||||
struct timeval *cmdstart;
|
||||
struct timeval *cmdstop;
|
||||
const char **nonstderrs;
|
||||
void *local; /* Local data from the low level code */
|
||||
void *bufbase; /* needed for scsi_freebuf() */
|
||||
void *bufptr; /* DMA buffer pointer for appl. use */
|
||||
char *errstr; /* Error string for scsi_open/sendmcd */
|
||||
char *errbeg; /* Pointer to begin of not flushed data */
|
||||
char *errptr; /* Actual write pointer into errstr */
|
||||
void *errfile; /* FILE to write errors to. NULL for not*/
|
||||
/* writing and leaving errs in errstr */
|
||||
scg_cb_t cb_fun;
|
||||
void *cb_arg;
|
||||
|
||||
struct scsi_inquiry *inq;
|
||||
struct scsi_capacity *cap;
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for accessing members of the scg address structure.
|
||||
* scg_settarget() is the only function that is allowed to modify
|
||||
* the values of the SCSI address.
|
||||
*/
|
||||
#define scg_scsibus(scgp) (scgp)->addr.scsibus
|
||||
#define scg_target(scgp) (scgp)->addr.target
|
||||
#define scg_lun(scgp) (scgp)->addr.lun
|
||||
|
||||
/*
|
||||
* Flags for struct SCSI:
|
||||
*/
|
||||
/* NONE yet */
|
||||
|
||||
/*
|
||||
* Drive specific flags for struct SCSI:
|
||||
*/
|
||||
#define DRF_MODE_DMA_OVR 0x0001 /* Drive gives DMA overrun */
|
||||
/* on mode sense */
|
||||
|
||||
#define SCSI_ERRSTR_SIZE 4096
|
||||
|
||||
/*
|
||||
* Libscg error codes:
|
||||
*/
|
||||
#define SCG_ERRBASE 1000000
|
||||
#define SCG_NOMEM 1000001
|
||||
|
||||
/*
|
||||
* Function codes for scg_version():
|
||||
*/
|
||||
#define SCG_VERSION 0 /* libscg or transport version */
|
||||
#define SCG_AUTHOR 1 /* Author of above */
|
||||
#define SCG_SCCS_ID 2 /* SCCS id of above */
|
||||
#define SCG_RVERSION 10 /* Remote transport version */
|
||||
#define SCG_RAUTHOR 11 /* Remote transport author */
|
||||
#define SCG_RSCCS_ID 12 /* Remote transport SCCS ID */
|
||||
#define SCG_KVERSION 20 /* Kernel transport version */
|
||||
|
||||
/*
|
||||
* Function codes for scg_reset():
|
||||
*/
|
||||
#define SCG_RESET_NOP 0 /* Test if reset is supported */
|
||||
#define SCG_RESET_TGT 1 /* Reset Target only */
|
||||
#define SCG_RESET_BUS 2 /* Reset complete SCSI Bus */
|
||||
|
||||
/*
|
||||
* Helpers for the error buffer in SCSI*
|
||||
*/
|
||||
#define scg_errsize(scgp) ((scgp)->errptr - (scgp)->errstr)
|
||||
#define scg_errrsize(scgp) (SCSI_ERRSTR_SIZE - scg_errsize(scgp))
|
||||
|
||||
/*
|
||||
* From scsitransp.c:
|
||||
*/
|
||||
extern char *scg_version __PR((SCSI *scgp, int what));
|
||||
extern int scg__open __PR((SCSI *scgp, char *device));
|
||||
extern int scg__close __PR((SCSI *scgp));
|
||||
extern BOOL scg_havebus __PR((SCSI *scgp, int));
|
||||
extern int scg_initiator_id __PR((SCSI *scgp));
|
||||
extern int scg_isatapi __PR((SCSI *scgp));
|
||||
extern int scg_reset __PR((SCSI *scgp, int what));
|
||||
extern void *scg_getbuf __PR((SCSI *scgp, long));
|
||||
extern void scg_freebuf __PR((SCSI *scgp));
|
||||
extern long scg_bufsize __PR((SCSI *scgp, long));
|
||||
extern void scg_setnonstderrs __PR((SCSI *scgp, const char **));
|
||||
extern BOOL scg_yes __PR((char *));
|
||||
extern int scg_cmd __PR((SCSI *scgp));
|
||||
extern void scg_vhead __PR((SCSI *scgp));
|
||||
extern int scg_svhead __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern int scg_vtail __PR((SCSI *scgp));
|
||||
extern int scg_svtail __PR((SCSI *scgp, int *retp, char *buf, int maxcnt));
|
||||
extern void scg_vsetup __PR((SCSI *scgp));
|
||||
extern int scg_getresid __PR((SCSI *scgp));
|
||||
extern int scg_getdmacnt __PR((SCSI *scgp));
|
||||
extern BOOL scg_cmd_err __PR((SCSI *scgp));
|
||||
extern void scg_printerr __PR((SCSI *scgp));
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern void scg_fprinterr __PR((SCSI *scgp, FILE *f));
|
||||
#endif
|
||||
extern int scg_sprinterr __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern int scg__sprinterr __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern void scg_printcdb __PR((SCSI *scgp));
|
||||
extern int scg_sprintcdb __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern void scg_printwdata __PR((SCSI *scgp));
|
||||
extern int scg_sprintwdata __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern void scg_printrdata __PR((SCSI *scgp));
|
||||
extern int scg_sprintrdata __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern void scg_printresult __PR((SCSI *scgp));
|
||||
extern int scg_sprintresult __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
extern void scg_printstatus __PR((SCSI *scgp));
|
||||
extern int scg_sprintstatus __PR((SCSI *scgp, char *buf, int maxcnt));
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern void scg_fprbytes __PR((FILE *, char *, unsigned char *, int));
|
||||
extern void scg_fprascii __PR((FILE *, char *, unsigned char *, int));
|
||||
#endif
|
||||
extern void scg_prbytes __PR((char *, unsigned char *, int));
|
||||
extern void scg_prascii __PR((char *, unsigned char *, int));
|
||||
extern int scg_sprbytes __PR((char *buf, int maxcnt, char *, unsigned char *, int));
|
||||
extern int scg_sprascii __PR((char *buf, int maxcnt, char *, unsigned char *, int));
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern void scg_fprsense __PR((FILE *f, unsigned char *, int));
|
||||
#endif
|
||||
extern void scg_prsense __PR((unsigned char *, int));
|
||||
extern int scg_sprsense __PR((char *buf, int maxcnt, unsigned char *, int));
|
||||
extern int scg_cmd_status __PR((SCSI *scgp));
|
||||
extern int scg_sense_key __PR((SCSI *scgp));
|
||||
extern int scg_sense_code __PR((SCSI *scgp));
|
||||
extern int scg_sense_qual __PR((SCSI *scgp));
|
||||
#ifdef _SCG_SCSIREG_H
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern void scg_fprintdev __PR((FILE *, struct scsi_inquiry *));
|
||||
#endif
|
||||
extern void scg_printdev __PR((struct scsi_inquiry *));
|
||||
#endif
|
||||
extern int scg_printf __PR((SCSI *scgp, const char *form, ...));
|
||||
extern int scg_errflush __PR((SCSI *scgp));
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern int scg_errfflush __PR((SCSI *scgp, FILE *f));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* From scsierrmsg.c:
|
||||
*/
|
||||
extern const char *scg_sensemsg __PR((int, int, int,
|
||||
const char **, char *, int maxcnt));
|
||||
#ifdef _SCG_SCSISENSE_H
|
||||
extern int scg__errmsg __PR((SCSI *scgp, char *obuf, int maxcnt,
|
||||
struct scsi_sense *,
|
||||
struct scsi_status *,
|
||||
int));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* From scsiopen.c:
|
||||
*/
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern int scg_help __PR((FILE *f));
|
||||
#endif
|
||||
extern SCSI *scg_open __PR((char *scsidev, char *errs, int slen, int odebug, int be_verbose));
|
||||
extern int scg_close __PR((SCSI * scgp));
|
||||
extern void scg_settimeout __PR((SCSI * scgp, int timeout));
|
||||
extern SCSI *scg_smalloc __PR((void));
|
||||
extern void scg_sfree __PR((SCSI *scgp));
|
||||
|
||||
/*
|
||||
* From scgsettarget.c:
|
||||
*/
|
||||
extern int scg_settarget __PR((SCSI *scgp, int scsibus, int target, int lun));
|
||||
|
||||
/*
|
||||
* From scsi-remote.c:
|
||||
*/
|
||||
extern scg_ops_t *scg_remote __PR((void));
|
||||
|
||||
/*
|
||||
* From scsihelp.c:
|
||||
*/
|
||||
#ifdef EOF /* stdio.h has been included */
|
||||
extern void __scg_help __PR((FILE *f, char *name, char *tcomment,
|
||||
char *tind,
|
||||
char *tspec,
|
||||
char *texample,
|
||||
BOOL mayscan,
|
||||
BOOL bydev));
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCG_SCSITRANSP_H */
|
||||
131
schily/scg/spti-wnt.h
Normal file
131
schily/scg/spti-wnt.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* distilled information from various header files from Microsoft's
|
||||
* DDK for Windows NT 4.0
|
||||
*/
|
||||
#ifndef _SCSIPT_H_INC
|
||||
#define _SCSIPT_H_INC
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct {
|
||||
USHORT Length;
|
||||
UCHAR ScsiStatus;
|
||||
UCHAR PathId;
|
||||
UCHAR TargetId;
|
||||
UCHAR Lun;
|
||||
UCHAR CdbLength;
|
||||
UCHAR SenseInfoLength;
|
||||
UCHAR DataIn;
|
||||
ULONG DataTransferLength;
|
||||
ULONG TimeOutValue;
|
||||
ULONG DataBufferOffset;
|
||||
ULONG SenseInfoOffset;
|
||||
UCHAR Cdb[16];
|
||||
} SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
|
||||
|
||||
|
||||
typedef struct {
|
||||
USHORT Length;
|
||||
UCHAR ScsiStatus;
|
||||
UCHAR PathId;
|
||||
UCHAR TargetId;
|
||||
UCHAR Lun;
|
||||
UCHAR CdbLength;
|
||||
UCHAR SenseInfoLength;
|
||||
UCHAR DataIn;
|
||||
ULONG DataTransferLength;
|
||||
ULONG TimeOutValue;
|
||||
PVOID DataBuffer;
|
||||
ULONG SenseInfoOffset;
|
||||
UCHAR Cdb[16];
|
||||
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
|
||||
|
||||
|
||||
typedef struct {
|
||||
SCSI_PASS_THROUGH spt;
|
||||
ULONG Filler;
|
||||
UCHAR ucSenseBuf[32];
|
||||
UCHAR ucDataBuf[512];
|
||||
} SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS;
|
||||
|
||||
|
||||
typedef struct {
|
||||
SCSI_PASS_THROUGH_DIRECT spt;
|
||||
ULONG Filler;
|
||||
UCHAR ucSenseBuf[32];
|
||||
} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
UCHAR NumberOfLogicalUnits;
|
||||
UCHAR InitiatorBusId;
|
||||
ULONG InquiryDataOffset;
|
||||
} SCSI_BUS_DATA, *PSCSI_BUS_DATA;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UCHAR NumberOfBusses;
|
||||
SCSI_BUS_DATA BusData[1];
|
||||
} SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UCHAR PathId;
|
||||
UCHAR TargetId;
|
||||
UCHAR Lun;
|
||||
BOOLEAN DeviceClaimed;
|
||||
ULONG InquiryDataLength;
|
||||
ULONG NextInquiryDataOffset;
|
||||
UCHAR InquiryData[1];
|
||||
} SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ULONG Length;
|
||||
UCHAR PortNumber;
|
||||
UCHAR PathId;
|
||||
UCHAR TargetId;
|
||||
UCHAR Lun;
|
||||
} SCSI_ADDRESS, *PSCSI_ADDRESS;
|
||||
|
||||
|
||||
/*
|
||||
* method codes
|
||||
*/
|
||||
#define METHOD_BUFFERED 0
|
||||
#define METHOD_IN_DIRECT 1
|
||||
#define METHOD_OUT_DIRECT 2
|
||||
#define METHOD_NEITHER 3
|
||||
|
||||
/*
|
||||
* file access values
|
||||
*/
|
||||
#define FILE_ANY_ACCESS 0
|
||||
#define FILE_READ_ACCESS 0x0001
|
||||
#define FILE_WRITE_ACCESS 0x0002
|
||||
|
||||
|
||||
#define IOCTL_SCSI_BASE 0x00000004
|
||||
|
||||
/*
|
||||
* constants for DataIn member of SCSI_PASS_THROUGH* structures
|
||||
*/
|
||||
#define SCSI_IOCTL_DATA_OUT 0
|
||||
#define SCSI_IOCTL_DATA_IN 1
|
||||
#define SCSI_IOCTL_DATA_UNSPECIFIED 2
|
||||
|
||||
/*
|
||||
* Standard IOCTL define
|
||||
*/
|
||||
#define CTL_CODE(DevType, Function, Method, Access) \
|
||||
(((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
|
||||
|
||||
#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||
#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||
#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
||||
#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
||||
#endif
|
||||
169
schily/scg/srb_os2.h
Normal file
169
schily/scg/srb_os2.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/* @(#)srb_os2.h 1.0 98/10/28 Copyright 1998 D. Dorau, C. Wohlgemuth */
|
||||
/*
|
||||
* Definitions for ASPI-Router (ASPIROUT.SYS).
|
||||
*
|
||||
* Copyright (c) 1998 D. Dorau, C. Wohlgemuth
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* 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; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* SRB command */
|
||||
#define SRB_Inquiry 0x00
|
||||
#define SRB_Device 0x01
|
||||
#define SRB_Command 0x02
|
||||
#define SRB_Abort 0x03
|
||||
#define SRB_Reset 0x04
|
||||
#define SRB_Param 0x05
|
||||
|
||||
/* SRB status */
|
||||
#define SRB_Busy 0x00 /* SCSI request in progress */
|
||||
#define SRB_Done 0x01 /* SCSI request completed without error */
|
||||
#define SRB_Aborted 0x02 /* SCSI aborted by host */
|
||||
#define SRB_BadAbort 0x03 /* Unable to abort SCSI request */
|
||||
#define SRB_Error 0x04 /* SCSI request completed with error */
|
||||
#define SRB_BusyPost 0x10 /* SCSI request in progress with POST - Nokia */
|
||||
#define SRB_InvalidCmd 0x80 /* Invalid SCSI request */
|
||||
#define SRB_InvalidHA 0x81 /* Invalid Hhost adapter number */
|
||||
#define SRB_BadDevice 0x82 /* SCSI device not installed */
|
||||
|
||||
/* SRB flags */
|
||||
#define SRB_Post 0x01 /* Post vector valid */
|
||||
#define SRB_Link 0x02 /* Link vector valid */
|
||||
#define SRB_SG 0x04 /* Nokia: scatter/gather */
|
||||
/* S/G: n * (4 bytes length, 4 bytes addr) */
|
||||
/* No of s/g items not limited by HA spec. */
|
||||
#define SRB_NoCheck 0x00 /* determined by command, not checked */
|
||||
#define SRB_Read 0x08 /* target to host, length checked */
|
||||
#define SRB_Write 0x10 /* host to target, length checked */
|
||||
#define SRB_NoTransfer 0x18 /* no data transfer */
|
||||
#define SRB_DirMask 0x18 /* bit mask */
|
||||
|
||||
/* SRB host adapter status */
|
||||
#define SRB_NoError 0x00 /* No host adapter detected error */
|
||||
#define SRB_Timeout 0x11 /* Selection timeout */
|
||||
#define SRB_DataLength 0x12 /* Data over/underrun */
|
||||
#define SRB_BusFree 0x13 /* Unexpected bus free */
|
||||
#define SRB_BusSequence 0x14 /* Target bus sequence failure */
|
||||
|
||||
/* SRB target status field */
|
||||
#define SRB_NoStatus 0x00 /* No target status */
|
||||
#define SRB_CheckStatus 0x02 /* Check status (sense data valid) */
|
||||
#define SRB_LUN_Busy 0x08 /* Specified LUN is busy */
|
||||
#define SRB_Reserved 0x18 /* Reservation conflict */
|
||||
|
||||
#define MaxCDBStatus 64 /* max size of CDB + status */
|
||||
|
||||
|
||||
typedef struct SRb {
|
||||
unsigned char cmd, /* 00 */
|
||||
status, /* 01 */
|
||||
ha_num, /* 02 */
|
||||
flags; /* 03 */
|
||||
unsigned long res_04_07; /* 04..07 */
|
||||
union { /* 08 */
|
||||
|
||||
/* SRB_Inquiry */
|
||||
struct {
|
||||
unsigned char num_ha, /* 08 */
|
||||
ha_target, /* 09 */
|
||||
aspimgr_id[16], /* 0A..19 */
|
||||
host_id[16], /* 1A..29 */
|
||||
unique_id[16]; /* 2A..39 */
|
||||
} inq;
|
||||
|
||||
/* SRB_Device */
|
||||
struct {
|
||||
unsigned char target, /* 08 */
|
||||
lun, /* 09 */
|
||||
devtype; /* 0A */
|
||||
} dev;
|
||||
|
||||
/* SRB_Command */
|
||||
struct {
|
||||
unsigned char target, /* 08 */
|
||||
lun; /* 09 */
|
||||
unsigned long data_len; /* 0A..0D */
|
||||
unsigned char sense_len; /* 0E */
|
||||
unsigned long data_ptr; /* 0F..12 */
|
||||
unsigned long link_ptr; /* 13..16 */
|
||||
// void * _Seg16 data_ptr; /* 0F..12 */
|
||||
// void * _Seg16 link_ptr; /* 13..16 */
|
||||
unsigned char cdb_len, /* 17 */
|
||||
ha_status, /* 18 */
|
||||
target_status; /* 19 */
|
||||
unsigned char _Seg16postSRB[4];
|
||||
// void (* _Seg16 post) (SRB *); /* 1A..1D */
|
||||
unsigned char res_1E_29[12]; /* 1E..29 */
|
||||
unsigned char res_2A_3F[22]; /* 2A..3F */
|
||||
unsigned char cdb_st[64]; /* 40..7F CDB+status */
|
||||
unsigned char res_80_BF[64]; /* 80..BF */
|
||||
} cmd;
|
||||
|
||||
/* SRB_Abort */
|
||||
struct {
|
||||
unsigned char _Seg16srb[4];
|
||||
// void * _Seg16 srb; /* 08..0B */
|
||||
} abt;
|
||||
|
||||
/* SRB_Reset */
|
||||
struct {
|
||||
unsigned char target, /* 08 */
|
||||
lun, /* 09 */
|
||||
res_0A_17[14], /* 0A..17 */
|
||||
ha_status, /* 18 */
|
||||
target_status; /* 19 */
|
||||
} res;
|
||||
|
||||
/* SRB_Param - unused by ASPI4OS2 */
|
||||
struct {
|
||||
unsigned char unique[16]; /* 08..17 */
|
||||
} par;
|
||||
|
||||
} u;
|
||||
} SRB;
|
||||
|
||||
|
||||
// SCSI sense codes
|
||||
// Note! This list may not be complete. I did this compilation for use with tape drives.
|
||||
|
||||
#define Sense_Current 0x70; // Current Error
|
||||
#define Sense_Deferred 0x71; // Deferred Error
|
||||
#define Sense_Filemark 0x80; // Filemark detected
|
||||
#define Sense_EOM 0x40; // End of medium detected
|
||||
#define Sense_ILI 0x20; // Incorrect length indicator
|
||||
|
||||
// Sense Keys
|
||||
|
||||
#define SK_NoSense 0x00; // No Sense
|
||||
#define SK_RcvrdErr 0x01; // Recovered Error
|
||||
#define SK_NotReady 0x02; // Not ready
|
||||
#define SK_MedErr 0x03; // Medium Error
|
||||
#define SK_HWErr 0x04; // Hardware Error
|
||||
#define SK_IllReq 0x05; // Illegal Request
|
||||
#define SK_UnitAtt 0x06; // Unit attention
|
||||
#define SK_DataProt 0x07: // Data Protect
|
||||
#define SK_BlankChk 0x08: // Blank Check
|
||||
#define SK_VndSpec 0x09; // Vendor Specific
|
||||
#define SK_CopyAbort 0x0A; // Copy Aborted
|
||||
#define SK_AbtdCmd 0x0B; // Aborted Command
|
||||
#define SK_Equal 0x0C; // Equal
|
||||
#define SK_VolOvfl 0x0D; // Volume Overflow
|
||||
#define SK_MisComp 0x0E; // Miscompare
|
||||
#define SK_Reserved 0x0F; // Reserved
|
||||
Reference in New Issue
Block a user