aboutsummaryrefslogtreecommitdiff
path: root/include/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 08:19:33 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 08:19:33 -0700
commitdf3d80f5a5c74168be42788364d13cf6c83c7b9c (patch)
tree892a964c2fd28d028f2fb7471e8543d3f4006a58 /include/scsi
parent3d06f7a5f74a813cee817c4b30b5e6f0398da0be (diff)
parentc8e91b0a8fc8493e3bf3efcb3c8f866e9453cf1c (diff)
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: (207 commits) [SCSI] gdth: fix CONFIG_ISA build failure [SCSI] esp_scsi: remove __dev{init,exit} [SCSI] gdth: !use_sg cleanup and use of scsi accessors [SCSI] gdth: Move members from SCp to gdth_cmndinfo, stage 2 [SCSI] gdth: Setup proper per-command private data [SCSI] gdth: Remove gdth_ctr_tab[] [SCSI] gdth: switch to modern scsi host registration [SCSI] gdth: gdth_interrupt() gdth_get_status() & gdth_wait() fixes [SCSI] gdth: clean up host private data [SCSI] gdth: Remove virt hosts [SCSI] gdth: Reorder scsi_host_template intitializers [SCSI] gdth: kill gdth_{read,write}[bwl] wrappers [SCSI] gdth: Remove 2.4.x support, in-kernel changelog [SCSI] gdth: split out pci probing [SCSI] gdth: split out eisa probing [SCSI] gdth: split out isa probing gdth: Make one abuse of scsi_cmnd less obvious [SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation [SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution [SCSI] scsi_error: Refactoring scsi_error to facilitate in synchronous REQUEST_SENSE ...
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libsrp.h2
-rw-r--r--include/scsi/scsi_cmnd.h13
-rw-r--r--include/scsi/scsi_dbg.h2
-rw-r--r--include/scsi/scsi_driver.h10
-rw-r--r--include/scsi/scsi_eh.h23
-rw-r--r--include/scsi/scsi_host.h14
-rw-r--r--include/scsi/scsi_tgt.h8
-rw-r--r--include/scsi/scsi_tgt_if.h35
-rw-r--r--include/scsi/scsi_transport.h12
-rw-r--r--include/scsi/scsi_transport_fc.h6
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
-rw-r--r--include/scsi/scsi_transport_srp.h39
-rw-r--r--include/scsi/sd.h14
13 files changed, 139 insertions, 41 deletions
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h
index d143171896a..ba615e4c1d7 100644
--- a/include/scsi/libsrp.h
+++ b/include/scsi/libsrp.h
@@ -59,7 +59,7 @@ extern void srp_target_free(struct srp_target *);
extern struct iu_entry *srp_iu_get(struct srp_target *);
extern void srp_iu_put(struct iu_entry *);
-extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64);
+extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64, u64);
extern int srp_transfer_data(struct scsi_cmnd *, struct srp_cmd *,
srp_rdma_t, int, int);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 53e170586c2..65ab5145a09 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -33,20 +33,17 @@ struct scsi_cmnd {
struct list_head list; /* scsi_cmnd participates in queue lists */
struct list_head eh_entry; /* entry for the host eh_cmd_q */
int eh_eflags; /* Used by error handlr */
- void (*done) (struct scsi_cmnd *); /* Mid-level done function */
/*
* A SCSI Command is assigned a nonzero serial_number before passed
* to the driver's queue command function. The serial_number is
* cleared when scsi_done is entered indicating that the command
- * has been completed. It currently doesn't have much use other
- * than printk's. Some lldd's use this number for other purposes.
- * It's almost certain that such usages are either incorrect or
- * meaningless. Please kill all usages other than printk's. Also,
- * as this number is always identical to ->pid, please convert
- * printk's to use ->pid, so that we can kill this field.
+ * has been completed. It is a bug for LLDDs to use this number
+ * for purposes other than printk (and even that is only useful
+ * for debugging).
*/
unsigned long serial_number;
+
/*
* This is set to jiffies as it was when the command was first
* allocated. It is used to time how long the command has
@@ -116,7 +113,6 @@ struct scsi_cmnd {
int result; /* Status code from lower level driver */
unsigned char tag; /* SCSI-II queued command tag */
- unsigned long pid; /* Process ID, starts at 0. Unique per host. */
};
extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
@@ -124,7 +120,6 @@ extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
extern void scsi_put_command(struct scsi_cmnd *);
extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *,
struct device *);
-extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
extern void scsi_finish_command(struct scsi_cmnd *cmd);
extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 5a43a4cd96c..e89844cc2cd 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -9,6 +9,8 @@ extern void __scsi_print_command(unsigned char *);
extern void scsi_show_extd_sense(unsigned char, unsigned char);
extern void scsi_show_sense_hdr(struct scsi_sense_hdr *);
extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
+extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *,
+ struct scsi_sense_hdr *);
extern void scsi_print_sense(char *, struct scsi_cmnd *);
extern void __scsi_print_sense(const char *name,
const unsigned char *sense_buffer,
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 3465f31a21c..1f5ca7f6211 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -5,14 +5,17 @@
struct module;
struct scsi_cmnd;
+struct scsi_device;
+struct request;
+struct request_queue;
struct scsi_driver {
struct module *owner;
struct device_driver gendrv;
- int (*init_command)(struct scsi_cmnd *);
void (*rescan)(struct device *);
+ int (*done)(struct scsi_cmnd *);
};
#define to_scsi_driver(drv) \
container_of((drv), struct scsi_driver, gendrv)
@@ -25,4 +28,9 @@ extern int scsi_register_interface(struct class_interface *);
#define scsi_unregister_interface(intf) \
class_interface_unregister(intf)
+int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req);
+int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req);
+int scsi_prep_state_check(struct scsi_device *sdev, struct request *req);
+int scsi_prep_return(struct request_queue *q, struct request *req, int ret);
+
#endif /* _SCSI_SCSI_DRIVER_H */
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index c5c0f6762a0..44224ba4dd9 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -1,7 +1,7 @@
#ifndef _SCSI_SCSI_EH_H
#define _SCSI_SCSI_EH_H
-struct scsi_cmnd;
+#include <scsi/scsi_cmnd.h>
struct scsi_device;
struct Scsi_Host;
@@ -65,4 +65,25 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
extern int scsi_reset_provider(struct scsi_device *, int);
+struct scsi_eh_save {
+ int result;
+ enum dma_data_direction data_direction;
+ unsigned char cmd_len;
+ unsigned char cmnd[MAX_COMMAND_SIZE];
+
+ void *buffer;
+ unsigned bufflen;
+ unsigned short use_sg;
+ int resid;
+
+ struct scatterlist sense_sgl;
+};
+
+extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
+ struct scsi_eh_save *ses, unsigned char *cmnd,
+ int cmnd_size, unsigned sense_bytes);
+
+extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
+ struct scsi_eh_save *ses);
+
#endif /* _SCSI_SCSI_EH_H */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 3b8a6a85c2f..7d210cd6c38 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -32,6 +32,9 @@ struct blk_queue_tags;
#define SG_NONE 0
#define SG_ALL 0xff
+#define MODE_UNKNOWN 0x00
+#define MODE_INITIATOR 0x01
+#define MODE_TARGET 0x02
#define DISABLE_CLUSTERING 0
#define ENABLE_CLUSTERING 1
@@ -145,9 +148,6 @@ struct scsi_host_template {
int (* transfer_response)(struct scsi_cmnd *,
void (*done)(struct scsi_cmnd *));
- /* Used as callback for the completion of task management request. */
- int (* tsk_mgmt_response)(u64 mid, int result);
-
/*
* This is an error handling strategy routine. You don't need to
* define one of these if you don't want to - there is a default
@@ -408,6 +408,11 @@ struct scsi_host_template {
unsigned char present;
/*
+ * This specifies the mode that a LLD supports.
+ */
+ unsigned supported_mode:2;
+
+ /*
* true if this host adapter uses unchecked DMA onto an ISA bus.
*/
unsigned unchecked_isa_dma:1;
@@ -575,8 +580,9 @@ struct Scsi_Host {
* Used to assign serial numbers to the cmds.
* Protected by the host lock.
*/
- unsigned long cmd_serial_number, cmd_pid;
+ unsigned long cmd_serial_number;
+ unsigned active_mode:2;
unsigned unchecked_isa_dma:1;
unsigned use_clustering:1;
unsigned use_blk_tcq:1;
diff --git a/include/scsi/scsi_tgt.h b/include/scsi/scsi_tgt.h
index 4f4427937af..d0fefb96158 100644
--- a/include/scsi/scsi_tgt.h
+++ b/include/scsi/scsi_tgt.h
@@ -11,9 +11,11 @@ struct scsi_lun;
extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *);
extern int scsi_tgt_alloc_queue(struct Scsi_Host *);
extern void scsi_tgt_free_queue(struct Scsi_Host *);
-extern int scsi_tgt_queue_command(struct scsi_cmnd *, struct scsi_lun *, u64);
-extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, int, u64, struct scsi_lun *,
- void *);
+extern int scsi_tgt_queue_command(struct scsi_cmnd *, u64, struct scsi_lun *, u64);
+extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, u64, int, u64,
+ struct scsi_lun *, void *);
extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *,
enum dma_data_direction, gfp_t);
extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *);
+extern int scsi_tgt_it_nexus_create(struct Scsi_Host *, u64, char *);
+extern int scsi_tgt_it_nexus_destroy(struct Scsi_Host *, u64);
diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h
index 4cf9dff29a2..f2ee7c238a4 100644
--- a/include/scsi/scsi_tgt_if.h
+++ b/include/scsi/scsi_tgt_if.h
@@ -23,13 +23,15 @@
#define __SCSI_TARGET_IF_H
/* user -> kernel */
-#define TGT_UEVENT_CMD_RSP 0x0001
-#define TGT_UEVENT_TSK_MGMT_RSP 0x0002
+#define TGT_UEVENT_CMD_RSP 0x0001
+#define TGT_UEVENT_IT_NEXUS_RSP 0x0002
+#define TGT_UEVENT_TSK_MGMT_RSP 0x0003
/* kernel -> user */
-#define TGT_KEVENT_CMD_REQ 0x1001
-#define TGT_KEVENT_CMD_DONE 0x1002
-#define TGT_KEVENT_TSK_MGMT_REQ 0x1003
+#define TGT_KEVENT_CMD_REQ 0x1001
+#define TGT_KEVENT_CMD_DONE 0x1002
+#define TGT_KEVENT_IT_NEXUS_REQ 0x1003
+#define TGT_KEVENT_TSK_MGMT_REQ 0x1004
struct tgt_event_hdr {
uint16_t version;
@@ -46,6 +48,7 @@ struct tgt_event {
struct {
int host_no;
int result;
+ aligned_u64 itn_id;
aligned_u64 tag;
aligned_u64 uaddr;
aligned_u64 sense_uaddr;
@@ -55,15 +58,22 @@ struct tgt_event {
} cmd_rsp;
struct {
int host_no;
- aligned_u64 mid;
int result;
+ aligned_u64 itn_id;
+ aligned_u64 mid;
} tsk_mgmt_rsp;
-
+ struct {
+ __s32 host_no;
+ __s32 result;
+ aligned_u64 itn_id;
+ __u32 function;
+ } it_nexus_rsp;
/* kernel -> user */
struct {
int host_no;
uint32_t data_len;
+ aligned_u64 itn_id;
uint8_t scb[16];
uint8_t lun[8];
int attribute;
@@ -71,16 +81,25 @@ struct tgt_event {
} cmd_req;
struct {
int host_no;
- aligned_u64 tag;
int result;
+ aligned_u64 itn_id;
+ aligned_u64 tag;
} cmd_done;
struct {
int host_no;
int function;
+ aligned_u64 itn_id;
aligned_u64 tag;
uint8_t lun[8];
aligned_u64 mid;
} tsk_mgmt_req;
+ struct {
+ __s32 host_no;
+ __u32 function;
+ aligned_u64 itn_id;
+ __u32 max_cmds;
+ __u8 initiator_id[16];
+ } it_nexus_req;
} p;
} __attribute__ ((aligned (sizeof(uint64_t))));
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 3c18baa65a7..0dfef752f0e 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -65,6 +65,18 @@ struct scsi_transport_template {
* EH_NOT_HANDLED Begin normal error recovery
*/
enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
+
+ /*
+ * Used as callback for the completion of i_t_nexus request
+ * for target drivers.
+ */
+ int (* it_nexus_response)(struct Scsi_Host *, u64, int);
+
+ /*
+ * Used as callback for the completion of task management
+ * request for target drivers.
+ */
+ int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
};
#define transport_class_to_shost(tc) \
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index a0d80bcaa93..e466d886e19 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -589,6 +589,10 @@ struct fc_function_template {
int (*vport_disable)(struct fc_vport *, bool);
int (*vport_delete)(struct fc_vport *);
+ /* target-mode drivers' functions */
+ int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
+ int (* it_nexus_response)(struct Scsi_Host *, u64, int);
+
/* allocation lengths for host-specific data */
u32 dd_fcrport_size;
u32 dd_fcvport_size;
@@ -632,6 +636,8 @@ struct fc_function_template {
unsigned long show_host_fabric_name:1;
unsigned long show_host_symbolic_name:1;
unsigned long show_host_system_hostname:1;
+
+ unsigned long disable_target_scan:1;
};
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 706c0cd36c1..7ff6199cbd5 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -24,6 +24,8 @@
#define SCSI_TRANSPORT_ISCSI_H
#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/mutex.h>
#include <scsi/iscsi_if.h>
struct scsi_transport_template;
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
new file mode 100644
index 00000000000..9c60ca1c08c
--- /dev/null
+++ b/include/scsi/scsi_transport_srp.h
@@ -0,0 +1,39 @@
+#ifndef SCSI_TRANSPORT_SRP_H
+#define SCSI_TRANSPORT_SRP_H
+
+#include <linux/transport_class.h>
+#include <linux/types.h>
+#include <linux/mutex.h>
+
+#define SRP_RPORT_ROLE_INITIATOR 0
+#define SRP_RPORT_ROLE_TARGET 1
+
+struct srp_rport_identifiers {
+ u8 port_id[16];
+ u8 roles;
+};
+
+struct srp_rport {
+ struct device dev;
+
+ u8 port_id[16];
+ u8 roles;
+};
+
+struct srp_function_template {
+ /* for target drivers */
+ int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
+ int (* it_nexus_response)(struct Scsi_Host *, u64, int);
+};
+
+extern struct scsi_transport_template *
+srp_attach_transport(struct srp_function_template *);
+extern void srp_release_transport(struct scsi_transport_template *);
+
+extern struct srp_rport *srp_rport_add(struct Scsi_Host *,
+ struct srp_rport_identifiers *);
+extern void srp_rport_del(struct srp_rport *);
+
+extern void srp_remove_host(struct Scsi_Host *);
+
+#endif
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
index ce02ad1f518..f7513313ef0 100644
--- a/include/scsi/sd.h
+++ b/include/scsi/sd.h
@@ -47,20 +47,6 @@ struct scsi_disk {
};
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
-static int sd_revalidate_disk(struct gendisk *disk);
-static void sd_rw_intr(struct scsi_cmnd * SCpnt);
-static int sd_probe(struct device *);
-static int sd_remove(struct device *);
-static void sd_shutdown(struct device *dev);
-static int sd_suspend(struct device *dev, pm_message_t state);
-static int sd_resume(struct device *dev);
-static void sd_rescan(struct device *);
-static int sd_init_command(struct scsi_cmnd *);
-static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
-static void scsi_disk_release(struct class_device *cdev);
-static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
-static void sd_print_result(struct scsi_disk *, int);
-
#define sd_printk(prefix, sdsk, fmt, a...) \
(sdsk)->disk ? \
sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \