Commit 1212663f authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (39 commits)
  [SCSI] qla2xxx: Update version number to 8.02.00-k5.
  [SCSI] qla2xxx: Correct display of ISP serial-number.
  [SCSI] qla2xxx: Correct residual-count handling discrepancies during UNDERRUN handling.
  [SCSI] qla2xxx: Make driver (mostly) legacy I/O port free.
  [SCSI] qla2xxx: Fix issue where final flash-segment updates were falling into the slow-path write handler.
  [SCSI] qla2xxx: Handle unaligned sector writes during NVRAM/VPD updates.
  [SCSI] qla2xxx: Defer explicit interrupt-polling processing to init-time scenarios.
  [SCSI] qla2xxx: Resync with latest HBA SSID specification -- 2.2u.
  [SCSI] sym53c8xx: Remove sym_xpt_async_sent_bdr
  [SCSI] sym53c8xx: Remove pci_dev pointer from sym_shcb
  [SCSI] sym53c8xx: Make interrupt handler capable of returning IRQ_NONE
  [SCSI] sym53c8xx: Get rid of IRQ_FMT and IRQ_PRM
  [SCSI] sym53c8xx: Use scmd_printk where appropriate
  [SCSI] sym53c8xx: Simplify DAC DMA handling
  [SCSI] sym53c8xx: Remove tag_ctrl module parameter
  [SCSI] sym53c8xx: Remove io_ws, mmio_ws and ram_ws elements
  [SCSI] sym53c8xx: Remove ->device_id
  [SCSI] sym53c8xx: Use pdev->revision
  [SCSI] sym53c8xx: PCI Error Recovery support
  [SCSI] sym53c8xx: Stop overriding scsi_done
  ...
parents af76bbab af2709fd
......@@ -449,25 +449,14 @@ options as above.
cmd_per_lun=#tags (#tags > 1) tagged command queuing enabled
#tags will be truncated to the max queued commands configuration parameter.
10.2.2 Detailed control of tagged commands
This option allows you to specify a command queue depth for each device
that supports tagged command queueing.
Example:
tag_ctrl=10/t2t3q16-t5q24/t1u2q32
will set devices queue depth as follow:
- controller #0 target #2 and target #3 -> 16 commands,
- controller #0 target #5 -> 24 commands,
- controller #1 target #1 logical unit #2 -> 32 commands,
- all other logical units (all targets, all controllers) -> 10 commands.
10.2.3 Burst max
10.2.2 Burst max
burst=0 burst disabled
burst=255 get burst length from initial IO register settings.
burst=#x burst enabled (1<<#x burst transfers max)
#x is an integer value which is log base 2 of the burst transfers max.
By default the driver uses the maximum value supported by the chip.
10.2.4 LED support
10.2.3 LED support
led=1 enable LED support
led=0 disable LED support
Do not enable LED support if your scsi board does not use SDMS BIOS.
......@@ -560,9 +549,9 @@ Previously, the sym2 driver accepted arguments of the form
sym53c8xx=tags:4,sync:10,debug:0x200
As a result of the new module parameters, this is no longer available.
Most of the options have remained the same, but tags has split into
cmd_per_lun and tag_ctrl for its two different purposes. The sample above
would be specified as:
Most of the options have remained the same, but tags has become
cmd_per_lun to reflect its different purposes. The sample above would
be specified as:
modprobe sym53c8xx cmd_per_lun=4 sync=10 debug=0x200
or on the kernel boot line as:
......
......@@ -325,6 +325,12 @@ M: Juergen Fischer <fischer@norbit.de>
L: linux-scsi@vger.kernel.org
S: Maintained
AIC7XXX / AIC79XX SCSI DRIVER
P: Hannes Reinecke
M: hare@suse.de
L: linux-scsi@vger.kernel.org
S: Maintained
ALCATEL SPEEDTOUCH USB DRIVER
P: Duncan Sands
M: duncan.sands@free.fr
......
......@@ -460,8 +460,6 @@ source "drivers/Kconfig"
source "drivers/sbus/char/Kconfig"
source "drivers/fc4/Kconfig"
source "fs/Kconfig"
source "kernel/Kconfig.instrumentation"
......
......@@ -34,7 +34,6 @@ obj-$(CONFIG_NUBUS) += nubus/
obj-$(CONFIG_ATM) += atm/
obj-y += macintosh/
obj-$(CONFIG_IDE) += ide/
obj-$(CONFIG_FC4) += fc4/
obj-$(CONFIG_SCSI) += scsi/
obj-$(CONFIG_ATA) += ata/
obj-$(CONFIG_FUSION) += message/
......
#
# FC4 device configuration
#
menu "Fibre Channel support"
config FC4
tristate "Fibre Channel and FC4 SCSI support"
---help---
Fibre Channel is a high speed serial protocol mainly used to
connect large storage devices to the computer; it is compatible with
and intended to replace SCSI.
This is an experimental support for storage arrays connected to your
computer using optical fibre cables and the "X3.269-199X Fibre
Channel Protocol for SCSI" specification. If you want to use this,
you need to say Y here and to "SCSI support" as well as to the
drivers for the storage array itself and for the interface adapter
such as SOC or SOC+. This subsystem could even serve for IP
networking, with some code extensions.
If unsure, say N.
comment "FC4 drivers"
depends on FC4
config FC4_SOC
tristate "Sun SOC/Sbus"
depends on FC4!=n && SPARC
help
Serial Optical Channel is an interface card with one or two Fibre
Optic ports, each of which can be connected to a disk array. Note
that if you have older firmware in the card, you'll need the
microcode from the Solaris driver to make it work.
To compile this support as a module, choose M here: the module will
be called soc.
config FC4_SOCAL
tristate "Sun SOC+ (aka SOCAL)"
depends on FC4!=n && SPARC
---help---
Serial Optical Channel Plus is an interface card with up to two
Fibre Optic ports. This card supports FC Arbitrated Loop (usually
A5000 or internal FC disks in E[3-6]000 machines through the
Interface Board). You'll probably need the microcode from the
Solaris driver to make it work.
To compile this support as a module, choose M here: the module will
be called socal.
comment "FC4 targets"
depends on FC4
config SCSI_PLUTO
tristate "SparcSTORAGE Array 100 and 200 series"
depends on FC4!=n && SCSI
help
If you never bought a disk array made by Sun, go with N.
To compile this support as a module, choose M here: the module will
be called pluto.
config SCSI_FCAL
tristate "Sun Enterprise Network Array (A5000 and EX500)" if SPARC
depends on FC4!=n && SCSI
help
This driver drives FC-AL disks connected through a Fibre Channel
card using the drivers/fc4 layer (currently only SOCAL). The most
common is either A5000 array or internal disks in E[3-6]000
machines.
To compile this support as a module, choose M here: the module will
be called fcal.
config SCSI_FCAL
prompt "Generic FC-AL disk driver"
depends on FC4!=n && SCSI && !SPARC
endmenu
#
# Makefile for the Linux Fibre Channel device drivers.
#
fc4-objs := fc.o fc_syms.o
obj-$(CONFIG_FC4) += fc4.o
obj-$(CONFIG_FC4_SOC) += soc.o
obj-$(CONFIG_FC4_SOCAL) += socal.o
/* fc-al.h: Definitions for Fibre Channel Arbitrated Loop topology.
*
* Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*
* Sources:
* Fibre Channel Arbitrated Loop (FC-AL), ANSI, Rev. 4.5, 1995
*/
#ifndef __FC_AL_H
#define __FC_AL_H
/* Loop initialization payloads */
#define FC_AL_LISM 0x11010000 /* Select Master, 12B payload */
#define FC_AL_LIFA 0x11020000 /* Fabric Assign AL_PA bitmap, 20B payload */
#define FC_AL_LIPA 0x11030000 /* Previously Acquired AL_PA bitmap, 20B payload */
#define FC_AL_LIHA 0x11040000 /* Hard Assigned AL_PA bitmap, 20B payload */
#define FC_AL_LISA 0x11050000 /* Soft Assigned AL_PA bitmap, 20B payload */
#define FC_AL_LIRP 0x11060000 /* Report AL_PA position map, 132B payload */
#define FC_AL_LILP 0x11070000 /* Loop AL_PA position map, 132B payload */
typedef struct {
u32 magic;
u8 len;
u8 alpa[127];
} fc_al_posmap;
#endif /* !(__FC_H) */
This diff is collapsed.
/* fc.h: Definitions for Fibre Channel Physical and Signaling Interface.
*
* Copyright (C) 1996-1997,1999 Jakub Jelinek (jj@ultra.linux.cz)
*
* Sources:
* Fibre Channel Physical & Signaling Interface (FC-PH), dpANS, 1994
* dpANS Fibre Channel Protocol for SCSI (X3.269-199X), Rev. 012, 1995
*/
#ifndef __FC_H
#define __FC_H
/* World Wide Name */
#define NAAID_IEEE 1
#define NAAID_IEEE_EXT 2
#define NAAID_LOCAL 3
#define NAAID_IP 4
#define NAAID_IEEE_REG 5
#define NAAID_IEEE_REG_EXT 6
#define NAAID_CCITT 12
#define NAAID_CCITT_GRP 14
/* This is NAAID_IEEE_EXT scheme */
typedef struct {
u32 naaid:4;
u32 nportid:12;
u32 hi:16;
u32 lo;
} fc_wwn;
/* Frame header for FC-PH frames */
/* r_ctl field */
#define R_CTL_DEVICE_DATA 0x00 /* FC4 Device_Data frame */
#define R_CTL_EXTENDED_SVC 0x20 /* Extended Link_Data frame */
#define R_CTL_FC4_SVC 0x30 /* FC4 Link_Data frame */
#define R_CTL_VIDEO 0x40 /* Video_Data frame */
#define R_CTL_BASIC_SVC 0x80 /* Basic Link_Data frame */
#define R_CTL_LINK_CTL 0xc0 /* Link_Control frame */
/* FC4 Device_Data frames */
#define R_CTL_UNCATEGORIZED 0x00
#define R_CTL_SOLICITED_DATA 0x01
#define R_CTL_UNSOL_CONTROL 0x02
#define R_CTL_SOLICITED_CONTROL 0x03
#define R_CTL_UNSOL_DATA 0x04
#define R_CTL_XFER_RDY 0x05
#define R_CTL_COMMAND 0x06
#define R_CTL_STATUS 0x07
/* Basic Link_Data frames */
#define R_CTL_LS_NOP 0x80
#define R_CTL_LS_ABTS 0x81
#define R_CTL_LS_RMC 0x82
#define R_CTL_LS_BA_ACC 0x84
#define R_CTL_LS_BA_RJT 0x85
/* Extended Link_Data frames */
#define R_CTL_ELS_REQ 0x22
#define R_CTL_ELS_RSP 0x23
/* Link_Control frames */
#define R_CTL_ACK_1 0xc0
#define R_CTL_ACK_N 0xc1
#define R_CTL_P_RJT 0xc2
#define R_CTL_F_RJT 0xc3
#define R_CTL_P_BSY 0xc4
#define R_CTL_F_BSY_DF 0xc5
#define R_CTL_F_BSY_LC 0xc6
#define R_CTL_LCR 0xc7
/* type field */
#define TYPE_BASIC_LS 0x00
#define TYPE_EXTENDED_LS 0x01
#define TYPE_IS8802 0x04
#define TYPE_IS8802_SNAP 0x05
#define TYPE_SCSI_FCP 0x08
#define TYPE_SCSI_GPP 0x09
#define TYPE_HIPP_FP 0x0a
#define TYPE_IPI3_MASTER 0x11
#define TYPE_IPI3_SLAVE 0x12
#define TYPE_IPI3_PEER 0x13
/* f_ctl field */
#define F_CTL_FILL_BYTES 0x000003
#define F_CTL_XCHG_REASSEMBLE 0x000004
#define F_CTL_RO_PRESENT 0x000008
#define F_CTL_ABORT_SEQ 0x000030
#define F_CTL_CONTINUE_SEQ 0x0000c0
#define F_CTL_INVALIDATE_XID 0x004000
#define F_CTL_XID_REASSIGNED 0x008000
#define F_CTL_SEQ_INITIATIVE 0x010000
#define F_CTL_CHAINED_SEQ 0x020000
#define F_CTL_END_CONNECT 0x040000
#define F_CTL_END_SEQ 0x080000
#define F_CTL_LAST_SEQ 0x100000
#define F_CTL_FIRST_SEQ 0x200000
#define F_CTL_SEQ_CONTEXT 0x400000
#define F_CTL_XCHG_CONTEXT 0x800000
typedef struct {
u32 r_ctl:8, did:24;
u32 xxx1:8, sid:24;
u32 type:8, f_ctl:24;
u32 seq_id:8, df_ctl:8, seq_cnt:16;
u16 ox_id, rx_id;
u32 param;
} fc_hdr;
/* The following are ugly macros to make setup of this structure faster */
#define FILL_FCHDR_RCTL_DID(fch, r_ctl, did) *(u32 *)(fch) = ((r_ctl) << 24) | (did);
#define FILL_FCHDR_SID(fch, sid) *((u32 *)(fch)+1) = (sid);
#define FILL_FCHDR_TYPE_FCTL(fch, type, f_ctl) *((u32 *)(fch)+2) = ((type) << 24) | (f_ctl);
#define FILL_FCHDR_SEQ_DF_SEQ(fch, seq_id, df_ctl, seq_cnt) *((u32 *)(fch)+3) = ((seq_id) << 24) | ((df_ctl) << 16) | (seq_cnt);
#define FILL_FCHDR_OXRX(fch, ox_id, rx_id) *((u32 *)(fch)+4) = ((ox_id) << 16) | (rx_id);
/* Well known addresses */
#define FS_GENERAL_MULTICAST 0xfffff7
#define FS_WELL_KNOWN_MULTICAST 0xfffff8
#define FS_HUNT_GROUP 0xfffff9
#define FS_MANAGEMENT_SERVER 0xfffffa
#define FS_TIME_SERVER 0xfffffb
#define FS_NAME_SERVER 0xfffffc
#define FS_FABRIC_CONTROLLER 0xfffffd
#define FS_FABRIC_F_PORT 0xfffffe
#define FS_BROADCAST 0xffffff
/* Reject frames */
/* The param field should be cast to this structure */
typedef struct {
u8 action;
u8 reason;
u8 xxx;
u8 vendor_unique;
} rjt_param;
/* Reject action codes */
#define RJT_RETRY 0x01
#define RJT_NONRETRY 0x02
/* Reject reason codes */
#define RJT_INVALID_DID 0x01
#define RJT_INVALID_SID 0x02
#define RJT_NPORT_NOT_AVAIL_TEMP 0x03
#define RJT_NPORT_NOT_AVAIL_PERM 0x04
#define RJT_CLASS_NOT_SUPPORTED 0x05
#define RJT_DELIMITER_ERROR 0x06
#define RJT_TYPE_NOT_SUPPORTED 0x07
#define RJT_INVALID_LINK_CONTROL 0x08
#define RJT_INVALID_R_CTL 0x09
#define RJT_INVALID_F_CTL 0x0a
#define RJT_INVALID_OX_ID 0x0b
#define RJT_INVALID_RX_ID 0x0c
#define RJT_INVALID_SEQ_ID 0x0d
#define RJT_INVALID_DF_CTL 0x0e
#define RJT_INVALID_SEQ_CNT 0x0f
#define RJT_INVALID_PARAMETER 0x10
#define RJT_EXCHANGE_ERROR 0x11
#define RJT_PROTOCOL_ERROR 0x12
#define RJT_INCORRECT_LENGTH 0x13
#define RJT_UNEXPECTED_ACK 0x14
#define RJT_UNEXPECTED_LINK_RESP 0x15
#define RJT_LOGIN_REQUIRED 0x16
#define RJT_EXCESSIVE_SEQUENCES 0x17
#define RJT_CANT_ESTABLISH_EXCHANGE 0x18
#define RJT_SECURITY_NOT_SUPPORTED 0x19
#define RJT_FABRIC_NA 0x1a
#define RJT_VENDOR_UNIQUE 0xff
#define SP_F_PORT_LOGIN 0x10
/* Extended SVC commands */
#define LS_RJT 0x01000000
#define LS_ACC 0x02000000
#define LS_PRLI_ACC 0x02100014
#define LS_PLOGI 0x03000000
#define LS_FLOGI 0x04000000
#define LS_LOGO 0x05000000
#define LS_ABTX 0x06000000
#define LS_RCS 0x07000000
#define LS_RES 0x08000000
#define LS_RSS 0x09000000
#define LS_RSI 0x0a000000
#define LS_ESTS 0x0b000000
#define LS_ESTC 0x0c000000
#define LS_ADVC 0x0d000000
#define LS_RTV 0x0e000000
#define LS_RLS 0x0f000000
#define LS_ECHO 0x10000000
#define LS_TEST 0x11000000
#define LS_RRQ 0x12000000
#define LS_IDENT 0x20000000
#define LS_PRLI 0x20100014
#define LS_DISPLAY 0x21000000
#define LS_PRLO 0x21100014
#define LS_PDISC 0x50000000
#define LS_ADISC 0x52000000
typedef struct {
u8 fcph_hi, fcph_lo;
u16 buf2buf_credit;
u8 common_features;
u8 xxx1;
u16 buf2buf_size;
u8 xxx2;
u8 total_concurrent;
u16 off_by_info;
u32 e_d_tov;
} common_svc_parm;
typedef struct {
u16 serv_opts;
u16 initiator_ctl;
u16 rcpt_ctl;
u16 recv_size;
u8 xxx1;
u8 concurrent_seqs;
u16 end2end_credit;
u16 open_seqs_per_xchg;
u16 xxx2;
} svc_parm;
/* Login */
typedef struct {
u32 code;
common_svc_parm common;
fc_wwn nport_wwn;
fc_wwn node_wwn;
svc_parm class1;
svc_parm class2;
svc_parm class3;
} logi;
#endif /* !(__FC_H) */
/*
* We should not even be trying to compile this if we are not doing
* a module.
*/
#include <linux/module.h>
#ifdef CONFIG_MODULES
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include "fcp_impl.h"
EXPORT_SYMBOL(fcp_init);
EXPORT_SYMBOL(fcp_release);
EXPORT_SYMBOL(fcp_queue_empty);
EXPORT_SYMBOL(fcp_receive_solicited);
EXPORT_SYMBOL(fc_channels);
EXPORT_SYMBOL(fcp_state_change);
EXPORT_SYMBOL(fc_do_plogi);
EXPORT_SYMBOL(fc_do_prli);
/* SCSI stuff */
EXPORT_SYMBOL(fcp_scsi_queuecommand);
EXPORT_SYMBOL(fcp_scsi_abort);
EXPORT_SYMBOL(fcp_scsi_dev_reset);
EXPORT_SYMBOL(fcp_scsi_host_reset);
#endif /* CONFIG_MODULES */
/* fcp.h: Definitions for Fibre Channel Protocol.
*
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*
*/
#ifndef __FCP_H
#define __FCP_H
/* FCP addressing is hierarchical with up to 4 layers, MS first.
Exact meaning of the addresses is up to the vendor */
/* fcp_cntl field */
#define FCP_CNTL_WRITE 0x00000001 /* Initiator write */
#define FCP_CNTL_READ 0x00000002 /* Initiator read */
#define FCP_CNTL_ABORT_TSK 0x00000200 /* Abort task set */
#define FCP_CNTL_CLR_TASK 0x00000400 /* Clear task set */
#define FCP_CNTL_RESET 0x00002000 /* Reset */
#define FCP_CNTL_CLR_ACA 0x00004000 /* Clear ACA */
#define FCP_CNTL_KILL_TASK 0x00008000 /* Terminate task */
#define FCP_CNTL_QTYPE_MASK 0x00070000 /* Tagged queueing type */
#define FCP_CNTL_QTYPE_SIMPLE 0x00000000
#define FCP_CNTL_QTYPE_HEAD_OF_Q 0x00010000
#define FCP_CNTL_QTYPE_ORDERED 0x00020000
#define FCP_CNTL_QTYPE_ACA_Q_TAG 0x00040000
#define FCP_CNTL_QTYPE_UNTAGGED 0x00050000
typedef struct {
u16 fcp_addr[4];
u32 fcp_cntl;
u8 fcp_cdb[16];
u32 fcp_data_len;
} fcp_cmd;
/* fcp_status field */
#define FCP_STATUS_MASK 0x000000ff /* scsi status of command */
#define FCP_STATUS_RSP_LEN 0x00000100 /* response_len != 0 */
#define FCP_STATUS_SENSE_LEN 0x00000200 /* sense_len != 0 */
#define FCP_STATUS_RESID 0x00000400 /* resid != 0 */
typedef struct {
u32 xxx[2];
u32 fcp_status;
u32 fcp_resid;
u32 fcp_sense_len;
u32 fcp_response_len;
/* u8 fcp_sense[fcp_sense_len]; */
/* u8 fcp_response[fcp_response_len]; */
} fcp_rsp;
/* fcp errors */
/* rsp_info_type field */
#define FCP_RSP_SCSI_BUS_ERR 0x01
#define FCP_RSP_SCSI_PORT_ERR 0x02
#define FCP_RSP_CARD_ERR 0x03
/* isp_status field */
#define FCP_RSP_CMD_COMPLETE 0x0000
#define FCP_RSP_CMD_INCOMPLETE 0x0001
#define FCP_RSP_CMD_DMA_ERR 0x0002
#define FCP_RSP_CMD_TRAN_ERR 0x0003
#define FCP_RSP_CMD_RESET 0x0004
#define FCP_RSP_CMD_ABORTED 0x0005
#define FCP_RSP_CMD_TIMEOUT 0x0006
#define FCP_RSP_CMD_OVERRUN 0x0007
/* isp_state_flags field */
#define FCP_RSP_ST_GOT_BUS 0x0100
#define FCP_RSP_ST_GOT_TARGET 0x0200
#define FCP_RSP_ST_SENT_CMD 0x0400
#define FCP_RSP_ST_XFRD_DATA 0x0800
#define FCP_RSP_ST_GOT_STATUS 0x1000
#define FCP_RSP_ST_GOT_SENSE 0x2000
/* isp_stat_flags field */
#define FCP_RSP_STAT_DISC 0x0001
#define FCP_RSP_STAT_SYNC 0x0002
#define FCP_RSP_STAT_PERR 0x0004
#define FCP_RSP_STAT_BUS_RESET 0x0008
#define FCP_RSP_STAT_DEV_RESET 0x0010
#define FCP_RSP_STAT_ABORTED 0x0020
#define FCP_RSP_STAT_TIMEOUT 0x0040
#define FCP_RSP_STAT_NEGOTIATE 0x0080
typedef struct {
u8 rsp_info_type;
u8 xxx;
u16 isp_status;
u16 isp_state_flags;
u16 isp_stat_flags;
} fcp_scsi_err;
#endif /* !(__FCP_H) */
/* fcp_impl.h: Generic SCSI on top of FC4 - our interface defines.
*
* Copyright (C) 1997-1999 Jakub Jelinek (jj@ultra.linux.cz)
* Copyright (C) 1998 Jirka Hanika (geo@ff.cuni.cz)
*/
#ifndef _FCP_SCSI_H
#define _FCP_SCSI_H
#include <linux/types.h>
#include "../scsi/scsi.h"
#include "fc.h"
#include "fcp.h"
#include "fc-al.h"
#include <asm/io.h>
#ifdef __sparc__
#include <asm/sbus.h>
#endif
/* 0 or 1 */
#define FCP_SCSI_USE_NEW_EH_CODE 0
#define FC_CLASS_OUTBOUND 0x01
#define FC_CLASS_INBOUND 0x02
#define FC_CLASS_SIMPLE 0x03
#define FC_CLASS_IO_WRITE 0x04
#define FC_CLASS_IO_READ 0x05
#define FC_CLASS_UNSOLICITED 0x06
#define FC_CLASS_OFFLINE 0x08
#define PROTO_OFFLINE 0x02
#define PROTO_REPORT_AL_MAP 0x03
#define PROTO_FORCE_LIP 0x06
struct _fc_channel;
typedef struct fcp_cmnd {
struct fcp_cmnd *next;
struct fcp_cmnd *prev;
void (*done)(struct scsi_cmnd *);
unsigned short proto;
unsigned short token;
unsigned int did;
/* FCP SCSI stuff */
dma_addr_t data;
/* From now on this cannot be touched for proto == TYPE_SCSI_FCP */
fc_hdr fch;
dma_addr_t cmd;
dma_addr_t rsp;
int cmdlen;
int rsplen;
int class;
int datalen;
/* This is just used as a verification during login */
struct _fc_channel *fc;
void *ls;
} fcp_cmnd;
typedef struct {
unsigned int len;
unsigned char list[0];
} fcp_posmap;
typedef struct _fc_channel {
struct _fc_channel *next;
int irq;
int state;
int sid;
int did;
char name[16];
void (*fcp_register)(struct _fc_channel *, u8, int);
void (*reset)(struct _fc_channel *);
int (*hw_enque)(struct _fc_channel *, fcp_cmnd *);
fc_wwn wwn_node;
fc_wwn wwn_nport;
fc_wwn wwn_dest;
common_svc_parm *common_svc;
svc_parm *class_svcs;
#ifdef __sparc__
struct sbus_dev *dev;
#else
struct pci_dev *dev;
#endif
struct module *module;
/* FCP SCSI stuff */
short can_queue;
short abort_count;
int rsp_size;
fcp_cmd *scsi_cmd_pool;
char *scsi_rsp_pool;
dma_addr_t dma_scsi_cmd, dma_scsi_rsp;
unsigned long *scsi_bitmap;
long scsi_bitmap_end;
int scsi_free;
int (*encode_addr)(struct scsi_cmnd *, u16 *, struct _fc_channel *, fcp_cmnd *);
fcp_cmnd *scsi_que;
char scsi_name[4];
fcp_cmnd **cmd_slots;
int channels;
int targets;
long *ages;
struct scsi_cmnd *rst_pkt;
fcp_posmap *posmap;
/* LOGIN stuff */
fcp_cmnd *login;
void *ls;
} fc_channel;
extern fc_channel *fc_channels;
#define FC_STATE_UNINITED 0
#define FC_STATE_ONLINE 1
#define FC_STATE_OFFLINE 2
#define FC_STATE_RESETING 3
#define FC_STATE_FPORT_OK 4
#define FC_STATE_MAYBEOFFLINE 5
#define FC_STATUS_OK 0
#define FC_STATUS_P_RJT 2
#define FC_STATUS_F_RJT 3
#define FC_STATUS_P_BSY 4
#define FC_STATUS_F_BSY 5
#define FC_STATUS_ERR_OFFLINE 0x11
#define FC_STATUS_TIMEOUT 0x12
#define FC_STATUS_ERR_OVERRUN 0x13
#define FC_STATUS_POINTTOPOINT 0x15
#define FC_STATUS_AL 0x16
#define FC_STATUS_UNKNOWN_CQ_TYPE 0x20
#define FC_STATUS_BAD_SEG_CNT 0x21
#define FC_STATUS_MAX_XCHG_EXCEEDED 0x22
#define FC_STATUS_BAD_XID 0x23
#define FC_STATUS_XCHG_BUSY 0x24
#define FC_STATUS_BAD_POOL_ID 0x25
#define FC_STATUS_INSUFFICIENT_CQES 0x26
#define FC_STATUS_ALLOC_FAIL 0x27
#define FC_STATUS_BAD_SID 0x28
#define FC_STATUS_NO_SEQ_INIT 0x29
#define FC_STATUS_TIMED_OUT -1
#define FC_STATUS_BAD_RSP -2
void fcp_queue_empty(fc_channel *);
int fcp_init(fc_channel *);
void fcp_release(fc_channel *fc_chain, int count);
void fcp_receive_solicited(fc_channel *, int, int, int, fc_hdr *);
void fcp_state_change(fc_channel *, int);
int fc_do_plogi(fc_channel *, unsigned char, fc_wwn *, fc_wwn *);
int fc_do_prli(fc_channel *, unsigned char);
#define for_each_fc_channel(fc) \
for (fc = fc_channels; fc; fc = fc->next)
#define for_each_online_fc_channel(fc) \
for_each_fc_channel(fc) \
if (fc->state == FC_STATE_ONLINE)
int fcp_scsi_queuecommand(struct scsi_cmnd *,
void (* done) (struct scsi_cmnd *));
int fcp_scsi_abort(struct scsi_cmnd *);
int fcp_scsi_dev_reset(struct scsi_cmnd *);
int fcp_scsi_host_reset(struct scsi_cmnd *);
#endif /* !(_FCP_SCSI_H) */
This diff is collapsed.
/* soc.h: Definitions for Sparc SUNW,soc Fibre Channel Sbus driver.
*
* Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*/
#ifndef __SOC_H
#define __SOC_H
#include "fc.h"
#include "fcp.h"
#include "fcp_impl.h"
/* Hardware register offsets and constants first {{{ */
#define CFG 0x00UL /* Config Register */
#define SAE 0x04UL /* Slave Access Error Register */
#define CMD 0x08UL /* Command and Status Register */
#define IMASK 0x0cUL /* Interrupt Mask Register */
/* Config Register */
#define SOC_CFG_EXT_RAM_BANK_MASK 0x07000000
#define SOC_CFG_EEPROM_BANK_MASK 0x00030000
#define SOC_CFG_BURST64_MASK 0x00000700
#define SOC_CFG_SBUS_PARITY_TEST 0x00000020
#define SOC_CFG_SBUS_PARITY_CHECK 0x00000010
#define SOC_CFG_SBUS_ENHANCED 0x00000008
#define SOC_CFG_BURST_MASK 0x00000007
/* Bursts */
#define SOC_CFG_BURST_4 0x00000000
#define SOC_CFG_BURST_16 0x00000004
#define SOC_CFG_BURST_32 0x00000005
#define SOC_CFG_BURST_64 0x00000006
/* Slave Access Error Register */
#define SOC_SAE_ALIGNMENT 0x00000004
#define SOC_SAE_UNSUPPORTED 0x00000002
#define SOC_SAE_PARITY 0x00000001
/* Command & Status Register */
#define SOC_CMD_RSP_QALL 0x000f0000
#define SOC_CMD_RSP_Q0 0x00010000
#define SOC_CMD_RSP_Q1 0x00020000
#define SOC_CMD_RSP_Q2 0x00040000
#define SOC_CMD_RSP_Q3 0x00080000
#define SOC_CMD_REQ_QALL 0x00000f00
#define SOC_CMD_REQ_Q0 0x00000100
#define SOC_CMD_REQ_Q1 0x00000200
#define SOC_CMD_REQ_Q2 0x00000400
#define SOC_CMD_REQ_Q3 0x00000800
#define SOC_CMD_SAE 0x00000080
#define SOC_CMD_INTR_PENDING 0x00000008
#define SOC_CMD_NON_QUEUED 0x00000004
#define SOC_CMD_IDLE 0x00000002
#define SOC_CMD_SOFT_RESET 0x00000001
/* Interrupt Mask Register */
#define SOC_IMASK_RSP_QALL 0x000f0000
#define SOC_IMASK_RSP_Q0 0x00010000
#define SOC_IMASK_RSP_Q1 0x00020000
#define SOC_IMASK_RSP_Q2 0x00040000
#define SOC_IMASK_RSP_Q3 0x00080000
#define SOC_IMASK_REQ_QALL 0x00000f00
#define SOC_IMASK_REQ_Q0 0x00000100
#define SOC_IMASK_REQ_Q1 0x00000200
#define SOC_IMASK_REQ_Q2 0x00000400
#define SOC_IMASK_REQ_Q3 0x00000800
#define SOC_IMASK_SAE 0x00000080
#define SOC_IMASK_NON_QUEUED 0x00000004
#define SOC_INTR(s, cmd) \
(((cmd & SOC_CMD_RSP_QALL) | ((~cmd) & SOC_CMD_REQ_QALL)) \
& s->imask)
#define SOC_SETIMASK(s, i) \
do { (s)->imask = (i); \
sbus_writel((i), (s)->regs + IMASK); \
} while(0)
/* XRAM
*
* This is a 64KB register area. It accepts only halfword access.
* That's why here are the following inline functions...
*/
typedef void __iomem *xram_p;
/* Get 32bit number from XRAM */
static inline u32 xram_get_32(xram_p x)
{
return ((sbus_readw(x + 0x00UL) << 16) |
(sbus_readw(x + 0x02UL)));
}
/* Like the above, but when we don't care about the high 16 bits */
static inline u32 xram_get_32low(xram_p x)
{
return (u32) sbus_readw(x + 0x02UL);
}
static inline u16 xram_get_16(xram_p x)
{
return sbus_readw(x);
}
static inline u8 xram_get_8(xram_p x)
{
if ((unsigned long)x & 0x1UL) {
x = x - 1;
return (u8) sbus_readw(x);
} else {
return (u8) (sbus_readw(x) >> 8);
}
}
static inline void xram_copy_from(void *p, xram_p x, int len)
{
for (len >>= 2; len > 0; len--, x += sizeof(u32)) {
u32 val, *p32 = p;
val = ((sbus_readw(x + 0x00UL) << 16) |
(sbus_readw(x + 0x02UL)));
*p32++ = val;
p = p32;
}
}
static inline void xram_copy_to(xram_p x, void *p, int len)
{
for (len >>= 2; len > 0; len--, x += sizeof(u32)) {
u32 tmp, *p32 = p;
tmp = *p32++;
p = p32;
sbus_writew(tmp >> 16, x + 0x00UL);
sbus_writew(tmp, x + 0x02UL);
}
}
static inline void xram_bzero(xram_p x, int len)
{
for (len >>= 1; len > 0; len--, x += sizeof(u16))
sbus_writew(0, x);
}
/* Circular Queue */
#define SOC_CQ_REQ_OFFSET (0x100 * sizeof(u16))
#define SOC_CQ_RSP_OFFSET (0x110 * sizeof(u16))
typedef struct {
u32 address;
u8 in;
u8 out;
u8 last;
u8 seqno;
} soc_hw_cq;
#define SOC_PORT_A 0x0000 /* From/To Port A */
#define SOC_PORT_B 0x0001 /* From/To Port A */
#define SOC_FC_HDR 0x0002 /* Contains FC Header */
#define SOC_NORSP 0x0004 /* Don't generate response nor interrupt */
#define SOC_NOINT 0x0008 /* Generate response but not interrupt */
#define SOC_XFERRDY 0x0010 /* Generate XFERRDY */
#define SOC_IGNOREPARAM 0x0020 /* Ignore PARAM field in the FC header */
#define SOC_COMPLETE 0x0040 /* Command completed */
#define SOC_UNSOLICITED 0x0080 /* For request this is the packet to establish unsolicited pools, */
/* for rsp this is unsolicited packet */
#define SOC_STATUS 0x0100 /* State change (on/off line) */
typedef struct {
u32 token;
u16 flags;
u8 class;
u8 segcnt;
u32 bytecnt;
} soc_hdr;
typedef struct {
u32 base;
u32 count;
} soc_data;
#define SOC_CQTYPE_OUTBOUND 0x01
#define SOC_CQTYPE_INBOUND 0x02
#define SOC_CQTYPE_SIMPLE 0x03
#define SOC_CQTYPE_IO_WRITE 0x04
#define SOC_CQTYPE_IO_READ 0x05
#define SOC_CQTYPE_UNSOLICITED 0x06
#define SOC_CQTYPE_DIAG 0x07
#define SOC_CQTYPE_OFFLINE 0x08
#define SOC_CQTYPE_RESPONSE 0x10
#define SOC_CQTYPE_INLINE 0x20
#define SOC_CQFLAGS_CONT 0x01
#define SOC_CQFLAGS_FULL 0x02
#define SOC_CQFLAGS_BADHDR 0x04
#define SOC_CQFLAGS_BADPKT 0x08
typedef struct {
soc_hdr shdr;
soc_data data[3];
fc_hdr fchdr;
u8 count;
u8 type;
u8 flags;
u8 seqno;
} soc_req;
#define SOC_OK 0
#define SOC_P_RJT 2
#define SOC_F_RJT 3
#define SOC_P_BSY 4
#define SOC_F_BSY 5
#define SOC_ONLINE 0x10
#define SOC_OFFLINE 0x11
#define SOC_TIMEOUT 0x12
#define SOC_OVERRUN 0x13
#define SOC_UNKOWN_CQ_TYPE 0x20
#define SOC_BAD_SEG_CNT 0x21
#define SOC_MAX_XCHG_EXCEEDED 0x22
#define SOC_BAD_XID 0x23
#define SOC_XCHG_BUSY 0x24
#define SOC_BAD_POOL_ID 0x25
#define SOC_INSUFFICIENT_CQES 0x26
#define SOC_ALLOC_FAIL 0x27
#define SOC_BAD_SID 0x28
#define SOC_NO_SEG_INIT 0x29
typedef struct {
soc_hdr shdr;
u32 status;
soc_data data;
u8 xxx1[12];
fc_hdr fchdr;
u8 count;
u8 type;
u8 flags;
u8 seqno;
} soc_rsp;
/* }}} */
/* Now our software structures and constants we use to drive the beast {{{ */
#define SOC_CQ_REQ0_SIZE 4
#define SOC_CQ_REQ1_SIZE 64
#define SOC_CQ_RSP0_SIZE 8
#define SOC_CQ_RSP1_SIZE 4
#define SOC_SOLICITED_RSP_Q 0
#define SOC_UNSOLICITED_RSP_Q 1
struct soc;
typedef struct {
/* This must come first */
fc_channel fc;
struct soc *s;
u16 flags;
u16 mask;
} soc_port;
typedef struct {
soc_hw_cq __iomem *hw_cq; /* Related XRAM cq */
soc_req __iomem *pool;
u8 in;
u8 out;
u8 last;
u8 seqno;
} soc_cq_rsp;
typedef struct {
soc_hw_cq __iomem *hw_cq; /* Related XRAM cq */
soc_req *pool;
u8 in;
u8 out;
u8 last;
u8 seqno;
} soc_cq_req;
struct soc {
spinlock_t lock;
soc_port port[2]; /* Every SOC has one or two FC ports */
soc_cq_req req[2]; /* Request CQs */
soc_cq_rsp rsp[2]; /* Response CQs */
int soc_no;
void __iomem *regs;
xram_p xram;
fc_wwn wwn;
u32 imask; /* Our copy of regs->imask */
u32 cfg; /* Our copy of regs->cfg */
char serv_params[80];
struct soc *next;
int curr_port; /* Which port will have priority to fcp_queue_empty */
soc_req *req_cpu;
u32 req_dvma;
};
/* }}} */
#endif /* !(__SOC_H) */
This diff is collapsed.
/* socal.h: Definitions for Sparc SUNW,socal (SOC+) Fibre Channel Sbus driver.
*
* Copyright (C) 1998,1999 Jakub Jelinek (jj@ultra.linux.cz)
*/
#ifndef __SOCAL_H
#define __SOCAL_H
#include "fc.h"
#include "fcp.h"
#include "fcp_impl.h"
/* Hardware register offsets and constants first {{{ */
#define CFG 0x00UL
#define SAE 0x04UL
#define CMD 0x08UL
#define IMASK 0x0cUL
#define REQP 0x10UL
#define RESP 0x14UL
/* Config Register */
#define SOCAL_CFG_EXT_RAM_BANK_MASK 0x07000000
#define SOCAL_CFG_EEPROM_BANK_MASK 0x00030000
#define SOCAL_CFG_BURST64_MASK 0x00000700
#define SOCAL_CFG_SBUS_PARITY_TEST 0x00000020
#define SOCAL_CFG_SBUS_PARITY_CHECK 0x00000010
#define SOCAL_CFG_SBUS_ENHANCED 0x00000008
#define SOCAL_CFG_BURST_MASK 0x00000007
/* Bursts */
#define SOCAL_CFG_BURST_4 0x00000000
#define SOCAL_CFG_BURST_8 0x00000003
#define SOCAL_CFG_BURST_16 0x00000004
#define SOCAL_CFG_BURST_32 0x00000005
#define SOCAL_CFG_BURST_64 0x00000006
#define SOCAL_CFG_BURST_128 0x00000007
/* Slave Access Error Register */
#define SOCAL_SAE_ALIGNMENT 0x00000004
#define SOCAL_SAE_UNSUPPORTED 0x00000002
#define SOCAL_SAE_PARITY 0x00000001
/* Command & Status Register */
#define SOCAL_CMD_RSP_QALL 0x000f0000
#define SOCAL_CMD_RSP_Q0 0x00010000
#define SOCAL_CMD_RSP_Q1 0x00020000
#define SOCAL_CMD_RSP_Q2 0x00040000
#define SOCAL_CMD_RSP_Q3 0x00080000
#define SOCAL_CMD_REQ_QALL 0x00000f00
#define SOCAL_CMD_REQ_Q0 0x00000100
#define SOCAL_CMD_REQ_Q1 0x00000200
#define SOCAL_CMD_REQ_Q2 0x00000400
#define SOCAL_CMD_REQ_Q3 0x00000800
#define SOCAL_CMD_SAE 0x00000080
#define SOCAL_CMD_INTR_PENDING 0x00000008
#define SOCAL_CMD_NON_QUEUED 0x00000004
#define SOCAL_CMD_IDLE 0x00000002
#define SOCAL_CMD_SOFT_RESET 0x00000001
/* Interrupt Mask Register */
#define SOCAL_IMASK_RSP_QALL 0x000f0000
#define SOCAL_IMASK_RSP_Q0 0x00010000
#define SOCAL_IMASK_RSP_Q1 0x00020000
#define SOCAL_IMASK_RSP_Q2 0x00040000
#define SOCAL_IMASK_RSP_Q3 0x00080000
#define SOCAL_IMASK_REQ_QALL 0x00000f00
#define SOCAL_IMASK_REQ_Q0 0x00000100
#define SOCAL_IMASK_REQ_Q1 0x00000200
#define SOCAL_IMASK_REQ_Q2 0x00000400
#define SOCAL_IMASK_REQ_Q3 0x00000800
#define SOCAL_IMASK_SAE 0x00000080
#define SOCAL_IMASK_NON_QUEUED 0x00000004
#define SOCAL_INTR(s, cmd) \
(((cmd & SOCAL_CMD_RSP_QALL) | ((~cmd) & SOCAL_CMD_REQ_QALL)) \
& s->imask)
#define SOCAL_SETIMASK(s, i) \
do { (s)->imask = (i); \
sbus_writel((i), (s)->regs + IMASK); \
} while (0)
#define SOCAL_MAX_EXCHANGES 1024
/* XRAM
*
* This is a 64KB register area.
* From the documentation, it seems like it is finally able to cope
* at least with 1,2,4 byte accesses for read and 2,4 byte accesses for write.
*/
/* Circular Queue */
#define SOCAL_CQ_REQ_OFFSET 0x200
#define SOCAL_CQ_RSP_OFFSET 0x220
typedef struct {
u32 address;
u8 in;
u8 out;
u8 last;
u8 seqno;
} socal_hw_cq;
#define SOCAL_PORT_A 0x0000 /* From/To Port A */
#define SOCAL_PORT_B 0x0001 /* From/To Port A */
#define SOCAL_FC_HDR 0x0002 /* Contains FC Header */
#define SOCAL_NORSP 0x0004 /* Don't generate response nor interrupt */
#define SOCAL_NOINT 0x0008 /* Generate response but not interrupt */
#define SOCAL_XFERRDY 0x0010 /* Generate XFERRDY */
#define SOCAL_IGNOREPARAM 0x0020 /* Ignore PARAM field in the FC header */
#define SOCAL_COMPLETE 0x0040 /* Command completed */
#define SOCAL_UNSOLICITED 0x0080 /* For request this is the packet to establish unsolicited pools, */
/* for rsp this is unsolicited packet */
#define SOCAL_STATUS 0x0100 /* State change (on/off line) */
#define SOCAL_RSP_HDR 0x0200 /* Return frame header in any case */
typedef struct {
u32 token;
u16 flags;
u8 class;
u8 segcnt;
u32 bytecnt;
} socal_hdr;
typedef struct {
u32 base;
u32 count;
} socal_data;
#define SOCAL_CQTYPE_NOP 0x00
#define SOCAL_CQTYPE_OUTBOUND 0x01
#define SOCAL_CQTYPE_INBOUND 0x02
#define SOCAL_CQTYPE_SIMPLE 0x03
#define SOCAL_CQTYPE_IO_WRITE 0x04
#define SOCAL_CQTYPE_IO_READ 0x05
#define SOCAL_CQTYPE_UNSOLICITED 0x06
#define SOCAL_CQTYPE_BYPASS_DEV 0x06
#define SOCAL_CQTYPE_DIAG 0x07
#define SOCAL_CQTYPE_OFFLINE 0x08
#define SOCAL_CQTYPE_ADD_POOL 0x09
#define SOCAL_CQTYPE_DELETE_POOL 0x0a
#define SOCAL_CQTYPE_ADD_BUFFER 0x0b
#define SOCAL_CQTYPE_ADD_POOL_BUFFER 0x0c
#define SOCAL_CQTYPE_REQUEST_ABORT 0x0d
#define SOCAL_CQTYPE_REQUEST_LIP 0x0e
#define SOCAL_CQTYPE_REPORT_MAP 0x0f
#define SOCAL_CQTYPE_RESPONSE 0x10
#define SOCAL_CQTYPE_INLINE 0x20
#define SOCAL_CQFLAGS_CONT 0x01
#define SOCAL_CQFLAGS_FULL 0x02
#define SOCAL_CQFLAGS_BADHDR 0x04
#define SOCAL_CQFLAGS_BADPKT 0x08
typedef struct {
socal_hdr shdr;
socal_data data[3];
fc_hdr fchdr;
u8 count;
u8 type;
u8 flags;
u8 seqno;
} socal_req;
#define SOCAL_OK 0
#define SOCAL_P_RJT 2
#define SOCAL_F_RJT 3
#define SOCAL_P_BSY 4
#define SOCAL_F_BSY 5
#define SOCAL_ONLINE 0x10
#define SOCAL_OFFLINE 0x11
#define SOCAL_TIMEOUT 0x12
#define SOCAL_OVERRUN 0x13
#define SOCAL_ONLINE_LOOP 0x14
#define SOCAL_OLD_PORT 0x15
#define SOCAL_AL_PORT 0x16
#define SOCAL_UNKOWN_CQ_TYPE 0x20
#define SOCAL_BAD_SEG_CNT 0x21
#define SOCAL_MAX_XCHG_EXCEEDED 0x22
#define SOCAL_BAD_XID 0x23
#define SOCAL_XCHG_BUSY 0x24
#define SOCAL_BAD_POOL_ID 0x25
#define SOCAL_INSUFFICIENT_CQES 0x26
#define SOCAL_ALLOC_FAIL 0x27
#define SOCAL_BAD_SID 0x28
#define SOCAL_NO_SEG_INIT 0x29
#define SOCAL_BAD_DID 0x2a
#define SOCAL_ABORTED 0x30
#define SOCAL_ABORT_FAILED 0x31
typedef struct {
socal_hdr shdr;
u32 status;
socal_data data;
u8 xxx1[10];
u16 ncmds;
fc_hdr fchdr;
u8 count;
u8 type;
u8 flags;
u8 seqno;
} socal_rsp;
typedef struct {
socal_hdr shdr;
u8 xxx1[48];
u8 count;
u8 type;
u8 flags;
u8 seqno;
} socal_cmdonly;
#define SOCAL_DIAG_NOP 0x00
#define SOCAL_DIAG_INT_LOOP 0x01
#define SOCAL_DIAG_EXT_LOOP 0x02
#define SOCAL_DIAG_REM_LOOP 0x03
#define SOCAL_DIAG_XRAM_TEST 0x04
#define SOCAL_DIAG_SOC_TEST 0x05
#define SOCAL_DIAG_HCB_TEST 0x06
#define SOCAL_DIAG_SOCLB_TEST 0x07
#define SOCAL_DIAG_SRDSLB_TEST 0x08
#define SOCAL_DIAG_EXTOE_TEST 0x09
typedef struct {
socal_hdr shdr;
u32 cmd;
u8 xxx1[44];
u8 count;
u8 type;
u8 flags;
u8 seqno;
} socal_diag_req;
#define SOCAL_POOL_MASK_RCTL 0x800000
#define SOCAL_POOL_MASK_DID 0x700000
#define SOCAL_POOL_MASK_SID 0x070000
#define SOCAL_POOL_MASK_TYPE 0x008000
#define SOCAL_POOL_MASK_F_CTL 0x007000
#define SOCAL_POOL_MASK_SEQ_ID 0x000800
#define SOCAL_POOL_MASK_D_CTL 0x000400
#define SOCAL_POOL_MASK_SEQ_CNT 0x000300
#define SOCAL_POOL_MASK_OX_ID 0x0000f0
#define SOCAL_POOL_MASK_PARAM 0x00000f
typedef struct {
socal_hdr shdr;
u32 pool_id;
u32 header_mask;
u32 buf_size;
u32 entries;
u8 xxx1[8];
fc_hdr fchdr;
u8 count;
u8 type;
u8 flags;
u8 seqno;
} socal_pool_req;
/* }}} */
/* Now our software structures and constants we use to drive the beast {{{ */
#define SOCAL_CQ_REQ0_SIZE 4
#define SOCAL_CQ_REQ1_SIZE 256
#define SOCAL_CQ_RSP0_SIZE 8
#define SOCAL_CQ_RSP1_SIZE 4
#define SOCAL_CQ_RSP2_SIZE 4
#define SOCAL_SOLICITED_RSP_Q 0
#define SOCAL_SOLICITED_BAD_RSP_Q 1
#define SOCAL_UNSOLICITED_RSP_Q 2
struct socal;
typedef struct {
/* This must come first */
fc_channel fc;
struct socal *s;
u16 flags;
u16 mask;
} socal_port;
typedef struct {
socal_hw_cq __iomem *hw_cq; /* Related XRAM cq */
socal_req *pool;
u8 in;
u8 out;
u8 last;
u8 seqno;
} socal_cq;
struct socal {
spinlock_t lock;
socal_port port[2]; /* Every SOCAL has one or two FC ports */
socal_cq req[4]; /* Request CQs */
socal_cq rsp[4]; /* Response CQs */
int socal_no;
void __iomem *regs;
void __iomem *xram;
void __iomem *eeprom;
fc_wwn wwn;
u32 imask; /* Our copy of regs->imask */
u32 cfg; /* Our copy of regs->cfg */
char serv_params[80];
struct socal *next;
int curr_port; /* Which port will have priority to fcp_queue_empty */
socal_req * req_cpu;
u32 req_dvma;
};
/* }}} */
#endif /* !(__SOCAL_H) */
......@@ -115,7 +115,6 @@ obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o
obj-$(CONFIG_BLK_DEV_IDESCSI) += ide-scsi.o
obj-$(CONFIG_SCSI_MESH) += mesh.o
obj-$(CONFIG_SCSI_MAC53C94) += mac53c94.o
obj-$(CONFIG_SCSI_PLUTO) += pluto.o
obj-$(CONFIG_SCSI_DECNCR) += NCR53C9x.o dec_esp.o
obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o
obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o
......@@ -123,7 +122,6 @@ obj-$(CONFIG_SCSI_PPA) += ppa.o
obj-$(CONFIG_SCSI_IMM) += imm.o
obj-$(CONFIG_JAZZ_ESP) += esp_scsi.o jazz_esp.o
obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o
obj-$(CONFIG_SCSI_FCAL) += fcal.o
obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o
obj-$(CONFIG_SCSI_SNI_53C710) += 53c700.o sni_53c710.o
obj-$(CONFIG_SCSI_NSP32) += nsp32.o
......
......@@ -60,8 +60,6 @@
#define ID_OLV_274xD 0x04907783 /* Olivetti OEM (Differential) */
static int aic7770_chip_init(struct ahc_softc *ahc);
static int aic7770_suspend(struct ahc_softc *ahc);
static int aic7770_resume(struct ahc_softc *ahc);
static int aha2840_load_seeprom(struct ahc_softc *ahc);
static ahc_device_setup_t ahc_aic7770_VL_setup;
static ahc_device_setup_t ahc_aic7770_EISA_setup;
......@@ -155,8 +153,6 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
return (error);
ahc->bus_chip_init = aic7770_chip_init;
ahc->bus_suspend = aic7770_suspend;
ahc->bus_resume = aic7770_resume;
error = ahc_reset(ahc, /*reinit*/FALSE);
if (error != 0)
......@@ -272,18 +268,6 @@ aic7770_chip_init(struct ahc_softc *ahc)
return (ahc_chip_init(ahc));
}
static int
aic7770_suspend(struct ahc_softc *ahc)
{
return (ahc_suspend(ahc));
}
static int
aic7770_resume(struct ahc_softc *ahc)
{
return (ahc_resume(ahc));
}
/*
* Read the 284x SEEPROM.
*/
......
......@@ -1003,8 +1003,15 @@ struct ahd_suspend_channel_state {
uint8_t seqctl;
};
struct ahd_suspend_pci_state {
uint32_t devconfig;
uint8_t command;
uint8_t csize_lattime;
};
struct ahd_suspend_state {
struct ahd_suspend_channel_state channel[2];
struct ahd_suspend_pci_state pci_state;
uint8_t optionmode;
uint8_t dscommand0;
uint8_t dspcistatus;
......@@ -1333,6 +1340,8 @@ struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
int ahd_pci_config(struct ahd_softc *,
struct ahd_pci_identity *);
int ahd_pci_test_register_access(struct ahd_softc *);
void ahd_pci_suspend(struct ahd_softc *);
void ahd_pci_resume(struct ahd_softc *);
/************************** SCB and SCB queue management **********************/
void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd,
......@@ -1343,6 +1352,8 @@ struct ahd_softc *ahd_alloc(void *platform_arg, char *name);
int ahd_softc_init(struct ahd_softc *);
void ahd_controller_info(struct ahd_softc *ahd, char *buf);
int ahd_init(struct ahd_softc *ahd);
int ahd_suspend(struct ahd_softc *ahd);
void ahd_resume(struct ahd_softc *ahd);
int ahd_default_config(struct ahd_softc *ahd);
int ahd_parse_vpddata(struct ahd_softc *ahd,
struct vpd_config *vpd);
......
......@@ -7175,7 +7175,6 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd)
ahd->flags &= ~AHD_ALL_INTERRUPTS;
}
#if 0
int
ahd_suspend(struct ahd_softc *ahd)
{
......@@ -7189,19 +7188,15 @@ ahd_suspend(struct ahd_softc *ahd)
ahd_shutdown(ahd);
return (0);
}
#endif /* 0 */
#if 0
int
void
ahd_resume(struct ahd_softc *ahd)
{
ahd_reset(ahd, /*reinit*/TRUE);
ahd_intr_enable(ahd, TRUE);
ahd_restart(ahd);
return (0);
}
#endif /* 0 */
/************************** Busy Target Table *********************************/
/*
......
......@@ -315,8 +315,8 @@ uint32_t aic79xx_slowcrc;
*/
static char *aic79xx = NULL;
MODULE_AUTHOR("Maintainer: Justin T. Gibbs <gibbs@scsiguy.com>");
MODULE_DESCRIPTION("Adaptec Aic790X U320 SCSI Host Bus Adapter driver");
MODULE_AUTHOR("Maintainer: Hannes Reinecke <hare@suse.de>");
MODULE_DESCRIPTION("Adaptec AIC790X U320 SCSI Host Bus Adapter driver");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION(AIC79XX_DRIVER_VERSION);
module_param(aic79xx, charp, 0444);
......
......@@ -50,6 +50,8 @@ static int ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd,
static int ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd,
u_long *bus_addr,
uint8_t __iomem **maddr);
static int ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg);
static int ahd_linux_pci_dev_resume(struct pci_dev *pdev);
static void ahd_linux_pci_dev_remove(struct pci_dev *pdev);
/* Define the macro locally since it's different for different class of chips.
......@@ -86,10 +88,58 @@ MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table);
static struct pci_driver aic79xx_pci_driver = {
.name = "aic79xx",
.probe = ahd_linux_pci_dev_probe,
#ifdef CONFIG_PM
.suspend = ahd_linux_pci_dev_suspend,
.resume = ahd_linux_pci_dev_resume,
#endif
.remove = ahd_linux_pci_dev_remove,
.id_table = ahd_linux_pci_id_table
};
static int
ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg)
{
struct ahd_softc *ahd = pci_get_drvdata(pdev);
int rc;
if ((rc = ahd_suspend(ahd)))
return rc;
ahd_pci_suspend(ahd);
pci_save_state(pdev);
pci_disable_device(pdev);
if (mesg.event == PM_EVENT_SUSPEND)
pci_set_power_state(pdev, PCI_D3hot);
return rc;
}
static int
ahd_linux_pci_dev_resume(struct pci_dev *pdev)
{
struct ahd_softc *ahd = pci_get_drvdata(pdev);
int rc;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
if ((rc = pci_enable_device(pdev))) {
dev_printk(KERN_ERR, &pdev->dev,
"failed to enable device after resume (%d)\n", rc);
return rc;
}
pci_set_master(pdev);
ahd_pci_resume(ahd);
ahd_resume(ahd);
return rc;
}
static void
ahd_linux_pci_dev_remove(struct pci_dev *pdev)
{
......
......@@ -389,6 +389,33 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
return error;
}
void
ahd_pci_suspend(struct ahd_softc *ahd)
{
/*
* Save chip register configuration data for chip resets
* that occur during runtime and resume events.
*/
ahd->suspend_state.pci_state.devconfig =
ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4);
ahd->suspend_state.pci_state.command =
ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/1);
ahd->suspend_state.pci_state.csize_lattime =
ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, /*bytes*/1);
}
void
ahd_pci_resume(struct ahd_softc *ahd)
{
ahd_pci_write_config(ahd->dev_softc, DEVCONFIG,
ahd->suspend_state.pci_state.devconfig, /*bytes*/4);
ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND,
ahd->suspend_state.pci_state.command, /*bytes*/1);
ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME,
ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1);
}
/*
* Perform some simple tests that should catch situations where
* our registers are invalidly mapped.
......
......@@ -961,16 +961,6 @@ struct ahc_softc {
*/
ahc_bus_chip_init_t bus_chip_init;
/*
* Bus specific suspend routine.
*/
ahc_bus_suspend_t bus_suspend;
/*
* Bus specific resume routine.
*/
ahc_bus_resume_t bus_resume;
/*
* Target mode related state kept on a per enabled lun basis.
* Targets that are not enabled will have null entries.
......@@ -1153,6 +1143,7 @@ struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);
int ahc_pci_config(struct ahc_softc *,
struct ahc_pci_identity *);
int ahc_pci_test_register_access(struct ahc_softc *);
void ahc_pci_resume(struct ahc_softc *ahc);
/*************************** EISA/VL Front End ********************************/
struct aic7770_identity *aic7770_find_device(uint32_t);
......
......@@ -335,8 +335,8 @@ static uint32_t aic7xxx_periodic_otag;
*/
static char *aic7xxx = NULL;
MODULE_AUTHOR("Maintainer: Justin T. Gibbs <gibbs@scsiguy.com>");
MODULE_DESCRIPTION("Adaptec Aic77XX/78XX SCSI Host Bus Adapter driver");
MODULE_AUTHOR("Maintainer: Hannes Reinecke <hare@suse.de>");
MODULE_DESCRIPTION("Adaptec AIC77XX/78XX SCSI Host Bus Adapter driver");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_VERSION(AIC7XXX_DRIVER_VERSION);
module_param(aic7xxx, charp, 0444);
......
......@@ -49,6 +49,8 @@ static int ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc,
static int ahc_linux_pci_reserve_mem_region(struct ahc_softc *ahc,
u_long *bus_addr,
uint8_t __iomem **maddr);
static int ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg);
static int ahc_linux_pci_dev_resume(struct pci_dev *pdev);
static void ahc_linux_pci_dev_remove(struct pci_dev *pdev);
/* Define the macro locally since it's different for different class of chips.
......@@ -133,10 +135,54 @@ MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table);
static struct pci_driver aic7xxx_pci_driver = {
.name = "aic7xxx",
.probe = ahc_linux_pci_dev_probe,
#ifdef CONFIG_PM
.suspend = ahc_linux_pci_dev_suspend,
.resume = ahc_linux_pci_dev_resume,
#endif
.remove = ahc_linux_pci_dev_remove,
.id_table = ahc_linux_pci_id_table
};
static int
ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg)
{
struct ahc_softc *ahc = pci_get_drvdata(pdev);
int rc;
if ((rc = ahc_suspend(ahc)))
return rc;
pci_save_state(pdev);
pci_disable_device(pdev);
if (mesg.event == PM_EVENT_SUSPEND)
pci_set_power_state(pdev, PCI_D3hot);
return rc;
}
static int
ahc_linux_pci_dev_resume(struct pci_dev *pdev)
{
struct ahc_softc *ahc = pci_get_drvdata(pdev);
int rc;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
if ((rc = pci_enable_device(pdev))) {
dev_printk(KERN_ERR, &pdev->dev,
"failed to enable device after resume (%d)\n", rc);
return rc;
}
pci_set_master(pdev);
ahc_pci_resume(ahc);
return (ahc_resume(ahc));
}
static void
ahc_linux_pci_dev_remove(struct pci_dev *pdev)
{
......
......@@ -633,8 +633,6 @@ static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
static uint8_t read_brdctl(struct ahc_softc *ahc);
static void ahc_pci_intr(struct ahc_softc *ahc);
static int ahc_pci_chip_init(struct ahc_softc *ahc);
static int ahc_pci_suspend(struct ahc_softc *ahc);
static int ahc_pci_resume(struct ahc_softc *ahc);
static int
ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor,
......@@ -791,8 +789,6 @@ ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry)
ahc->bus_intr = ahc_pci_intr;
ahc->bus_chip_init = ahc_pci_chip_init;
ahc->bus_suspend = ahc_pci_suspend;
ahc->bus_resume = ahc_pci_resume;
/* Remeber how the card was setup in case there is no SEEPROM */
if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) {
......@@ -2024,18 +2020,9 @@ ahc_pci_chip_init(struct ahc_softc *ahc)
return (ahc_chip_init(ahc));
}
static int
ahc_pci_suspend(struct ahc_softc *ahc)
{
return (ahc_suspend(ahc));
}
static int
void
ahc_pci_resume(struct ahc_softc *ahc)
{
pci_set_power_state(ahc->dev_softc, AHC_POWER_STATE_D0);
/*
* We assume that the OS has restored our register
* mappings, etc. Just update the config space registers
......@@ -2063,7 +2050,6 @@ ahc_pci_resume(struct ahc_softc *ahc)
&sxfrctl1);
ahc_release_seeprom(&sd);
}
return (ahc_resume(ahc));
}
static int
......
......@@ -66,6 +66,7 @@ static char string_buf[MAX_STR_CONST];
static char *string_buf_ptr;
static int parren_count;
static char buf[255];
int mmlineno;
%}
WORD [A-Za-z_][-A-Za-z_0-9]*
......@@ -76,7 +77,7 @@ MCARG [^(), \t]+
%%
\n {
++yylineno;
++mmlineno;
}
\r ;
<ARGLIST>{SPACE} ;
......
......@@ -8417,7 +8417,7 @@ aic7xxx_alloc(struct scsi_host_template *sht, struct aic7xxx_host *temp)
p->host = host;
p->scb_data = kzalloc(sizeof(scb_data_type), GFP_ATOMIC);
if (!p->scb_data)
if (p->scb_data)
{
scbq_init (&p->scb_data->free_scbs);
}
......
/* fcal.c: Fibre Channel Arbitrated Loop SCSI host adapter driver.
*
* Copyright (C) 1998,1999 Jakub Jelinek (jj@ultra.linux.cz)
*
*/
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
#endif
#include <asm/irq.h>
#include "scsi.h"
#include <scsi/scsi_host.h>
#include "../fc4/fcp_impl.h"
#include "fcal.h"
#include <linux/module.h>
/* #define FCAL_DEBUG */
#define fcal_printk printk ("FCAL %s: ", fc->name); printk
#ifdef FCAL_DEBUG
#define FCALD(x) fcal_printk x;
#define FCALND(x) printk ("FCAL: "); printk x;
#else
#define FCALD(x)
#define FCALND(x)
#endif
static unsigned char alpa2target[] = {
0x7e, 0x7d, 0x7c, 0xff, 0x7b, 0xff, 0xff, 0xff, 0x7a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x79,
0x78, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x77, 0x76, 0xff, 0xff, 0x75, 0xff, 0x74, 0x73, 0x72,
0xff, 0xff, 0xff, 0x71, 0xff, 0x70, 0x6f, 0x6e, 0xff, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x68, 0xff,
0xff, 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0xff, 0xff, 0x61, 0x60, 0xff, 0x5f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x5e, 0xff, 0x5d, 0x5c, 0x5b, 0xff, 0x5a, 0x59, 0x58, 0x57, 0x56, 0x55, 0xff,
0xff, 0x54, 0x53, 0x52, 0x51, 0x50, 0x4f, 0xff, 0xff, 0x4e, 0x4d, 0xff, 0x4c, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x4b, 0xff, 0x4a, 0x49, 0x48, 0xff, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0xff,
0xff, 0x41, 0x40, 0x3f, 0x3e, 0x3d, 0x3c, 0xff, 0xff, 0x3b, 0x3a, 0xff, 0x39, 0xff, 0xff, 0xff,
0x38, 0x37, 0x36, 0xff, 0x35, 0xff, 0xff, 0xff, 0x34, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33,
0x32, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x30, 0xff, 0xff, 0x2f, 0xff, 0x2e, 0x2d, 0x2c,
0xff, 0xff, 0xff, 0x2b, 0xff, 0x2a, 0x29, 0x28, 0xff, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0xff,
0xff, 0x21, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0xff, 0xff, 0x1b, 0x1a, 0xff, 0x19, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0x18, 0xff, 0x17, 0x16, 0x15, 0xff, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0xff,
0xff, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0xff, 0xff, 0x08, 0x07, 0xff, 0x06, 0xff, 0xff, 0xff,
0x05, 0x04, 0x03, 0xff, 0x02, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
};
static unsigned char target2alpa[] = {
0xef, 0xe8, 0xe4, 0xe2, 0xe1, 0xe0, 0xdc, 0xda, 0xd9, 0xd6, 0xd5, 0xd4, 0xd3, 0xd2, 0xd1, 0xce,
0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc7, 0xc6, 0xc5, 0xc3, 0xbc, 0xba, 0xb9, 0xb6, 0xb5, 0xb4, 0xb3,
0xb2, 0xb1, 0xae, 0xad, 0xac, 0xab, 0xaa, 0xa9, 0xa7, 0xa6, 0xa5, 0xa3, 0x9f, 0x9e, 0x9d, 0x9b,
0x98, 0x97, 0x90, 0x8f, 0x88, 0x84, 0x82, 0x81, 0x80, 0x7c, 0x7a, 0x79, 0x76, 0x75, 0x74, 0x73,
0x72, 0x71, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x67, 0x66, 0x65, 0x63, 0x5c, 0x5a, 0x59, 0x56,
0x55, 0x54, 0x53, 0x52, 0x51, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x47, 0x46, 0x45, 0x43, 0x3c,
0x3a, 0x39, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x27, 0x26,
0x25, 0x23, 0x1f, 0x1e, 0x1d, 0x1b, 0x18, 0x17, 0x10, 0x0f, 0x08, 0x04, 0x02, 0x01, 0x00
};
static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
int fcal_slave_configure(struct scsi_device *device)
{
int depth_to_use;
if (device->tagged_supported)
depth_to_use = /* 254 */ 8;
else
depth_to_use = 2;
scsi_adjust_queue_depth(device,
(device->tagged_supported ?
MSG_SIMPLE_TAG : 0),
depth_to_use);
return 0;
}
/* Detect all FC Arbitrated Loops attached to the machine.
fc4 module has done all the work for us... */
int __init fcal_detect(struct scsi_host_template *tpnt)
{
int nfcals = 0;
fc_channel *fc;
int fcalcount;
int i;
tpnt->proc_name = "fcal";
fcalcount = 0;
for_each_online_fc_channel(fc)
if (fc->posmap)
fcalcount++;
FCALND(("%d channels online\n", fcalcount))
if (!fcalcount) {
#if defined(MODULE) && defined(CONFIG_FC4_SOCAL_MODULE) && defined(CONFIG_KMOD)
request_module("socal");
for_each_online_fc_channel(fc)
if (fc->posmap)
fcalcount++;
if (!fcalcount)
#endif
return 0;
}
for_each_online_fc_channel(fc) {
struct Scsi_Host *host;
long *ages;
struct fcal *fcal;
if (!fc->posmap) continue;
/* Strange, this is already registered to some other SCSI host, then it cannot be fcal */
if (fc->scsi_name[0]) continue;
memcpy (fc->scsi_name, "FCAL", 4);
fc->can_queue = FCAL_CAN_QUEUE;
fc->rsp_size = 64;
fc->encode_addr = fcal_encode_addr;
ages = kmalloc (128 * sizeof(long), GFP_KERNEL);
if (!ages) continue;
host = scsi_register (tpnt, sizeof (struct fcal));
if (!host)
{
kfree(ages);
continue;
}
if (!try_module_get(fc->module)) {
kfree(ages);
scsi_unregister(host);
continue;
}
nfcals++;
fcal = (struct fcal *)host->hostdata;
fc->fcp_register(fc, TYPE_SCSI_FCP, 0);
for (i = 0; i < fc->posmap->len; i++) {
int status, target, alpa;
alpa = fc->posmap->list[i];
FCALD(("Sending PLOGI to %02x\n", alpa))
target = alpa2target[alpa];
status = fc_do_plogi(fc, alpa, fcal->node_wwn + target,
fcal->nport_wwn + target);
FCALD(("PLOGI returned with status %d\n", status))
if (status != FC_STATUS_OK)
continue;
FCALD(("Sending PRLI to %02x\n", alpa))
status = fc_do_prli(fc, alpa);
FCALD(("PRLI returned with status %d\n", status))
if (status == FC_STATUS_OK)
fcal->map[target] = 1;
}
host->max_id = 127;
host->irq = fc->irq;
#ifdef __sparc_v9__
host->unchecked_isa_dma = 1;
#endif
fc->channels = 1;
fc->targets = 127;
fc->ages = ages;
memset (ages, 0, 128 * sizeof(long));
fcal->fc = fc;
FCALD(("Found FCAL\n"))
}
if (nfcals)
#ifdef __sparc__
printk ("FCAL: Total of %d Sun Enterprise Network Array (A5000 or EX500) channels found\n", nfcals);
#else
printk ("FCAL: Total of %d Fibre Channel Arbitrated Loops found\n", nfcals);
#endif
return nfcals;
}
int fcal_release(struct Scsi_Host *host)
{
struct fcal *fcal = (struct fcal *)host->hostdata;
fc_channel *fc = fcal->fc;
module_put(fc->module);
fc->fcp_register(fc, TYPE_SCSI_FCP, 1);
FCALND((" releasing fcal.\n"));
kfree (fc->ages);
FCALND(("released fcal!\n"));
return 0;
}
#undef SPRINTF
#define SPRINTF(args...) { if (pos < (buffer + length)) pos += sprintf (pos, ## args); }
int fcal_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout)
{
struct fcal *fcal;
fc_channel *fc;
char *pos = buffer;
int i, j;
if (inout) return length;
fcal = (struct fcal *)host->hostdata;
fc = fcal->fc;
#ifdef __sparc__
SPRINTF ("Sun Enterprise Network Array (A5000 or E?500) on %s PROM node %x\n", fc->name, fc->dev->prom_node);
#else
SPRINTF ("Fibre Channel Arbitrated Loop on %s\n", fc->name);
#endif
SPRINTF ("Initiator AL-PA: %02x\n", fc->sid);
SPRINTF ("\nAttached devices:\n");
for (i = 0; i < fc->posmap->len; i++) {
unsigned char alpa = fc->posmap->list[i];
unsigned char target;
u32 *u1, *u2;
target = alpa2target[alpa];
u1 = (u32 *)&fcal->nport_wwn[target];
u2 = (u32 *)&fcal->node_wwn[target];
if (!u1[0] && !u1[1]) {
SPRINTF (" [AL-PA: %02x] Not responded to PLOGI\n", alpa);
} else if (!fcal->map[target]) {
SPRINTF (" [AL-PA: %02x, Port WWN: %08x%08x, Node WWN: %08x%08x] Not responded to PRLI\n",
alpa, u1[0], u1[1], u2[0], u2[1]);
} else {
struct scsi_device *scd;
shost_for_each_device(scd, host)
if (scd->id == target) {
SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ",
alpa, target, u1[0], u1[1], u2[0], u2[1]);
SPRINTF ("%s ", scsi_device_type(scd->type));
for (j = 0; (j < 8) && (scd->vendor[j] >= 0x20); j++)
SPRINTF ("%c", scd->vendor[j]);
SPRINTF (" ");
for (j = 0; (j < 16) && (scd->model[j] >= 0x20); j++)
SPRINTF ("%c", scd->model[j]);
SPRINTF ("\n");
}
}
}
SPRINTF ("\n");
*start = buffer + offset;
if ((pos - buffer) < offset)
return 0;
else if (pos - buffer - offset < length)
return pos - buffer - offset;
else
return length;
}
/*
For FC-AL, we use a simple addressing: we have just one channel 0,
and all AL-PAs are mapped to targets 0..0x7e
*/
static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd)
{
struct fcal *f;
/* We don't support LUNs yet - I'm not sure if LUN should be in SCSI fcp_cdb, or in second byte of addr[0] */
if (SCpnt->cmnd[1] & 0xe0) return -EINVAL;
/* FC-PLDA tells us... */
memset(addr, 0, 8);
f = (struct fcal *)SCpnt->device->host->hostdata;
if (!f->map[SCpnt->device->id])
return -EINVAL;
/* Now, determine DID: It will be Native Identifier, so we zero upper
2 bytes of the 3 byte DID, lowest byte will be AL-PA */
fcmd->did = target2alpa[SCpnt->device->id];
FCALD(("trying DID %06x\n", fcmd->did))
return 0;
}
static struct scsi_host_template driver_template = {
.name = "Fibre Channel Arbitrated Loop",
.detect = fcal_detect,
.release = fcal_release,
.proc_info = fcal_proc_info,
.queuecommand = fcp_scsi_queuecommand,
.slave_configure = fcal_slave_configure,
.can_queue = FCAL_CAN_QUEUE,
.this_id = -1,
.sg_tablesize = 1,
.cmd_per_lun = 1,
.use_clustering = ENABLE_CLUSTERING,
.eh_abort_handler = fcp_scsi_abort,
.eh_device_reset_handler = fcp_scsi_dev_reset,
.eh_host_reset_handler = fcp_scsi_host_reset,
};
#include "scsi_module.c"
MODULE_LICENSE("GPL");
/* fcal.h: Generic Fibre Channel Arbitrated Loop SCSI host adapter driver definitions.
*
* Copyright (C) 1998,1999 Jakub Jelinek (jj@ultra.linux.cz)
*/
#ifndef _FCAL_H
#define _FCAL_H
#include "../fc4/fcp_impl.h"
struct fcal {
/* fc must be first */
fc_channel *fc;
unsigned char map[128];
fc_wwn nport_wwn[128];
fc_wwn node_wwn[128];
};
/* Arbitrary constant. Cannot be too large, as fc4 layer has limitations
for a particular channel */
#define FCAL_CAN_QUEUE 512
int fcal_detect(struct scsi_host_template *);
int fcal_release(struct Scsi_Host *);
int fcal_slave_configure(struct scsi_device *);
#endif /* !(_FCAL_H) */
......@@ -4734,7 +4734,7 @@ static struct scsi_host_template gdth_template = {
};
#ifdef CONFIG_ISA
static int gdth_isa_probe_one(ulong32 isa_bios)
static int __init gdth_isa_probe_one(ulong32 isa_bios)
{
struct Scsi_Host *shp;
gdth_ha_str *ha;
......@@ -4862,7 +4862,7 @@ static int gdth_isa_probe_one(ulong32 isa_bios)
#endif /* CONFIG_ISA */
#ifdef CONFIG_EISA
static int gdth_eisa_probe_one(ushort eisa_slot)
static int __init gdth_eisa_probe_one(ushort eisa_slot)
{
struct Scsi_Host *shp;
gdth_ha_str *ha;
......@@ -4991,7 +4991,7 @@ static int gdth_eisa_probe_one(ushort eisa_slot)
#endif /* CONFIG_EISA */
#ifdef CONFIG_PCI
static int gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
static int __init gdth_pci_probe_one(gdth_pci_str *pcistr, int ctr)
{
struct Scsi_Host *shp;
gdth_ha_str *ha;
......
......@@ -345,6 +345,12 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
shost->active_mode = sht->supported_mode;
shost->use_sg_chaining = sht->use_sg_chaining;
if (sht->supported_mode == MODE_UNKNOWN)
/* means we didn't set it ... default to INITIATOR */
shost->active_mode = MODE_INITIATOR;
else
shost->active_mode = sht->supported_mode;
if (sht->max_host_blocked)
shost->max_host_blocked = sht->max_host_blocked;
else
......
......@@ -375,8 +375,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 _tag)
scp->result = SAM_STAT_CHECK_CONDITION;
memset(&scp->sense_buffer,
0, sizeof(scp->sense_buffer));
memcpy(&scp->sense_buffer,
&req->sg_list, le32_to_cpu(req->dataxfer_length));
memcpy(&scp->sense_buffer, &req->sg_list,
min(sizeof(scp->sense_buffer),
le32_to_cpu(req->dataxfer_length)));
break;
default:
......
......@@ -665,7 +665,7 @@ static void initio_init(struct initio_host * host, u8 *bios_addr)
host->max_tags[i] = 0xFF;
} /* for */
printk("i91u: PCI Base=0x%04X, IRQ=%d, BIOS=0x%04X0, SCSI ID=%d\n",
host->addr, host->irq,
host->addr, host->pci_dev->irq,
host->bios_addr, host->scsi_id);
/* Reset SCSI Bus */
if (host->config & HCC_SCSI_RESET) {
......@@ -2891,6 +2891,8 @@ static int initio_probe_one(struct pci_dev *pdev,
goto out_release_region;
}
host->pci_dev = pdev;
host->num_scbs = num_scb;
host->scb = scb;
host->next_pending = scb;
......@@ -2905,6 +2907,7 @@ static int initio_probe_one(struct pci_dev *pdev,
host->scb_end = tmp;
host->first_avail = scb;
host->last_avail = prev;
spin_lock_init(&host->avail_lock);
initio_init(host, phys_to_virt(bios_seg << 4));
......@@ -2928,7 +2931,6 @@ static int initio_probe_one(struct pci_dev *pdev,
}
pci_set_drvdata(pdev, shost);
host->pci_dev = pdev;
error = scsi_add_host(shost, &pdev->dev);
if (error)
......
......@@ -901,7 +901,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
}
}
vport->disc_trc = kmzlloc(
vport->disc_trc = kzalloc(
(sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc),
GFP_KERNEL);
......
This diff is collapsed.
/* pluto.h: SparcSTORAGE Array SCSI host adapter driver definitions.
*
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*/
#ifndef _PLUTO_H
#define _PLUTO_H
#include "../fc4/fcp_impl.h"
struct pluto {
/* This must be first */
fc_channel *fc;
char rev_str[5];
char fw_rev_str[5];
char serial_str[13];
};
struct pluto_inquiry {
u8 dtype;
u8 removable:1, qualifier:7;
u8 iso:2, ecma:3, ansi:3;
u8 aenc:1, trmiop:1, :2, rdf:4;
u8 len;
u8 xxx1;
u8 xxx2;
u8 reladdr:1, wbus32:1, wbus16:1, sync:1, linked:1, :1, cmdque:1, softreset:1;
u8 vendor_id[8];
u8 product_id[16];
u8 revision[4];
u8 fw_revision[4];
u8 serial[12];
u8 xxx3[2];
u8 channels;
u8 targets;
};
/* This is the max number of outstanding SCSI commands per pluto */
#define PLUTO_CAN_QUEUE 254
int pluto_detect(struct scsi_host_template *);
int pluto_release(struct Scsi_Host *);
const char * pluto_info(struct Scsi_Host *);
int pluto_slave_configure(struct scsi_device *);
#endif /* !(_PLUTO_H) */
......@@ -4310,7 +4310,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
printk(KERN_WARNING "scsi(%li): Unable to set a "
"suitable DMA mask - aborting\n", ha->host_no);
error = -ENODEV;
goto error_free_irq;
goto error_put_host;
}
} else
dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n",
......@@ -4320,7 +4320,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
printk(KERN_WARNING "scsi(%li): Unable to set a "
"suitable DMA mask - aborting\n", ha->host_no);
error = -ENODEV;
goto error_free_irq;
goto error_put_host;
}
#endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment