#define PCI_VENDOR_BUSLOGIC 0x104b
#define PCI_DEVICE_MULTIMASTER 0x1040
#define BL_CONTROL_REG (bl->iobase)
#define BL_CONTROL_RHARD 0x80
#define BL_CONTROL_RSOFT 0x40
#define BL_CONTROL_RINT 0x20
#define BL_CONTROL_RSBUS 0x10
#define BL_STATUS_REG (bl->iobase)
#define BL_STATUS_DACT 0x80
#define BL_STATUS_DFAIL 0x40
#define BL_STATUS_INREQ 0x20
#define BL_STATUS_HARDY 0x10
#define BL_STATUS_CPRBSY 0x08
#define BL_STATUS_DIRRDY 0x04
#define BL_STATUS_CMDINV 0x01
#define BL_COMMAND_REG (bl->iobase + 1)
#define BL_DATA_REG (bl->iobase + 1)
#define BL_INT_REG (bl->iobase + 2)
#define BL_INT_INTV 0x80
#define BL_INT_RSTS 0x08
#define BL_INT_CMDC 0x04
#define BL_INT_MBOR 0x02
#define BL_INT_IMBL 0x01
#define MAX_SCATTER 130
typedef struct _bl_ccb32
{
uchar opcode;
uchar direction;
uchar length_cdb;
uchar length_sense;
uint32 length_data;
uint32 data;
uchar _reserved1;
uchar _reserved2;
uchar btstat;
uchar sdstat;
uchar target_id;
uchar lun_tag;
uchar cdb[12];
uchar ccb_control;
uchar link_id;
uint32 link;
uint32 sense;
sem_id done;
int completion_code;
struct _bl_ccb32 *next;
uint _reserved[3];
} BL_CCB32;
typedef struct
{
uchar sensedata[256];
struct {
uint length;
uint phys;
} sg[MAX_SCATTER];
} BL_PRIV;
#define BL_CCB_TAG_SIMPLE 0x20
#define BL_CCB_TAG_HEAD 0x60
#define BL_CCB_TAG_ORDERED 0xA0
#define BL_CCB_OP_INITIATE 0x00
#define BL_CCB_OP_INITIATE_SG 0x02
#define BL_CCB_OP_INITIATE_RETLEN 0x03
#define BL_CCB_OP_INITIATE_RETLEN_SG 0x04
#define BL_CCB_OP_SCSI_BUS_RESET 0x81
#define BL_CCB_DIR_DEFAULT 0x00
#define BL_CCB_DIR_INBOUND 0x08
#define BL_CCB_DIR_OUTBOUND 0x10
#define BL_CCB_DIR_NO_XFER 0x18
typedef struct
{
uint32 ccb_phys;
uchar _reserved1;
uchar _reserved2;
uchar _reserved3;
uchar action_code;
} BL_Out_Mailbox32;
#define BL_ActionCode_NotInUse 0x00
#define BL_ActionCode_Start 0x01
#define BL_ActionCode_Abort 0x02
typedef struct
{
uint32 ccb_phys;
uchar btstat;
uchar sdstat;
uchar _reserved1;
uchar completion_code;
} BL_In_Mailbox32;
#define BL_CompletionCode_NotInUse 0x00
#define BL_CompletionCode_NoError 0x01
#define BL_CompletionCode_HostAbort 0x02
#define BL_CompletionCode_NotFound 0x03
#define BL_CompletionCode_Error 0x04
#define MAX_CCB_COUNT 32
typedef struct
{
int id;
int done;
int irq;
int iobase;
int scsi_id;
int wide;
long reqid;
char productname[16];
uint32 phys_to_virt;
uint32 virt_to_phys;
uint32 phys_mailboxes;
sem_id hw_lock;
sem_id ccb_lock;
sem_id ccb_count;
int box_count;
int out_nextbox;
int in_nextbox;
BL_Out_Mailbox32 *out_boxes;
BL_In_Mailbox32 *in_boxes;
BL_CCB32 *ccb;
BL_CCB32 *first_ccb;
} BusLogic;