patch-2.4.21 linux-2.4.21/drivers/ieee1394/sbp2.h
Next file: linux-2.4.21/drivers/ieee1394/video1394.c
Previous file: linux-2.4.21/drivers/ieee1394/sbp2.c
Back to the patch index
Back to the overall index
- Lines: 365
- Date:
2003-06-13 07:51:34.000000000 -0700
- Orig file:
linux-2.4.20/drivers/ieee1394/sbp2.h
- Orig date:
2002-11-28 15:53:13.000000000 -0800
diff -urN linux-2.4.20/drivers/ieee1394/sbp2.h linux-2.4.21/drivers/ieee1394/sbp2.h
@@ -23,42 +23,23 @@
#define SBP2_H
/* Some compatibility code */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define SCSI_REGISTER_HOST(tmpl) scsi_register_module(MODULE_SCSI_HA, tmpl)
#define SCSI_UNREGISTER_HOST(tmpl) scsi_unregister_module(MODULE_SCSI_HA, tmpl)
-#else
-#define SCSI_REGISTER_HOST(tmpl) scsi_register_host(tmpl)
-#define SCSI_UNREGISTER_HOST(tmpl) scsi_unregister_host(tmpl)
-#endif
#define SBP2_DEVICE_NAME "sbp2"
-#define SBP2_DEVICE_NAME_SIZE 4
/*
* SBP2 specific structures and defines
*/
-#define ORB_FMT_CMD 0x0
-#define ORB_FMT_DUMMY 0x3
-
#define ORB_DIRECTION_WRITE_TO_MEDIA 0x0
#define ORB_DIRECTION_READ_FROM_MEDIA 0x1
#define ORB_DIRECTION_NO_DATA_TRANSFER 0x2
#define ORB_SET_NULL_PTR(value) ((value & 0x1) << 31)
#define ORB_SET_NOTIFY(value) ((value & 0x1) << 31)
-#define ORB_SET_RQ_FMT(value) ((value & 0x3) << 29)
+#define ORB_SET_RQ_FMT(value) ((value & 0x3) << 29) /* unused ? */
#define ORB_SET_NODE_ID(value) ((value & 0xffff) << 16)
-
-struct sbp2_dummy_orb {
- volatile u32 next_ORB_hi;
- volatile u32 next_ORB_lo;
- u32 reserved1;
- u32 reserved2;
- u32 notify_rq_fmt;
- u8 command_block[12];
-};
-
#define ORB_SET_DATA_SIZE(value) (value & 0xffff)
#define ORB_SET_PAGE_SIZE(value) ((value & 0x7) << 16)
#define ORB_SET_PAGE_TABLE_PRESENT(value) ((value & 0x1) << 19)
@@ -116,6 +97,29 @@
#define ORB_SET_LOGIN_ID(value) (value & 0xffff)
+#define ORB_SET_QUERY_LOGINS_RESP_LENGTH(value) (value & 0xffff)
+
+struct sbp2_query_logins_orb {
+ u32 reserved1;
+ u32 reserved2;
+ u32 query_response_hi;
+ u32 query_response_lo;
+ u32 lun_misc;
+ u32 reserved_resp_length;
+ u32 status_FIFO_hi;
+ u32 status_FIFO_lo;
+};
+
+#define RESPONSE_GET_MAX_LOGINS(value) (value & 0xffff)
+#define RESPONSE_GET_ACTIVE_LOGINS(value) ((RESPONSE_GET_LENGTH(value) - 4) / 12)
+
+struct sbp2_query_logins_response {
+ u32 length_max_logins;
+ u32 misc_IDs;
+ u32 initiator_misc_hi;
+ u32 initiator_misc_lo;
+};
+
struct sbp2_reconnect_orb {
u32 reserved1;
u32 reserved2;
@@ -253,25 +257,15 @@
* Other misc defines
*/
#define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800
-#define SBP2_BROKEN_FIRMWARE_MAX_TRANSFER 0x20000
#define SBP2_DEVICE_TYPE_LUN_UNINITIALIZED 0xffffffff
/*
- * Flags for SBP-2 functions
- */
-#define SBP2_SEND_NO_WAIT 0x00000001
-
-/*
* SCSI specific stuff
*/
-#define SBP2_MAX_SG_ELEMENTS SG_ALL
-#define SBP2_CLUSTERING ENABLE_CLUSTERING
#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000
-#define SBP2SCSI_MAX_SCSI_IDS 16 /* Max sbp2 device instances supported */
-#define SBP2SCSI_MAX_OUTSTANDING_CMDS 8 /* Max total outstanding sbp2 commands allowed at a time! */
-#define SBP2SCSI_MAX_CMDS_PER_LUN 1 /* Max outstanding sbp2 commands per device - tune as needed */
+#define SBP2SCSI_MAX_SCSI_IDS 32 /* Max sbp2 device instances supported */
#define SBP2_MAX_SECTORS 255 /* Max sectors supported */
#ifndef TYPE_SDAD
@@ -314,26 +308,18 @@
DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN
};
-#define SBP2_MAX_REQUEST_PACKETS (sbp2_max_outstanding_cmds * 2)
-#define SBP2_MAX_COMMAND_ORBS (sbp2_max_cmds_per_lun * 2)
-
-/*
- * Request packets structure (used for sending command and agent reset packets)
- */
-struct sbp2_request_packet {
-
- struct list_head list;
- struct hpsb_packet *packet;
- struct tq_struct tq;
- void *hi_context;
-
-};
-
+/* This should be safe. If there's more than one LUN per node, we could
+ * saturate the tlabel's though. */
+#define SBP2_MAX_CMDS_PER_LUN 8
+#define SBP2_MAX_SCSI_QUEUE (SBP2_MAX_CMDS_PER_LUN * SBP2SCSI_MAX_SCSI_IDS)
+#define SBP2_MAX_COMMAND_ORBS SBP2_MAX_SCSI_QUEUE
/* This is the two dma types we use for cmd_dma below */
-#define CMD_DMA_NONE 0x0
-#define CMD_DMA_PAGE 0x1
-#define CMD_DMA_SINGLE 0x2
+enum cmd_dma_types {
+ CMD_DMA_NONE,
+ CMD_DMA_PAGE,
+ CMD_DMA_SINGLE
+};
/*
* Encapsulates all the info necessary for an outstanding command.
@@ -347,11 +333,11 @@
void (*Current_done)(Scsi_Cmnd *);
/* Also need s/g structure for each sbp2 command */
- struct sbp2_unrestricted_page_table scatter_gather_element[SBP2_MAX_SG_ELEMENTS] ____cacheline_aligned;
+ struct sbp2_unrestricted_page_table scatter_gather_element[SG_ALL] ____cacheline_aligned;
dma_addr_t sge_dma ____cacheline_aligned;
void *sge_buffer;
dma_addr_t cmd_dma;
- int dma_type;
+ enum cmd_dma_types dma_type;
unsigned long dma_size;
int dma_dir;
@@ -361,6 +347,10 @@
#define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1
#define SBP2_BREAKAGE_INQUIRY_HACK 0x2
+
+struct sbp2scsi_host_info;
+
+
/*
* Information needed on a per scsi id basis (one for each sbp2 device)
*/
@@ -377,6 +367,10 @@
dma_addr_t login_orb_dma;
struct sbp2_login_response *login_response;
dma_addr_t login_response_dma;
+ struct sbp2_query_logins_orb *query_logins_orb;
+ dma_addr_t query_logins_orb_dma;
+ struct sbp2_query_logins_response *query_logins_response;
+ dma_addr_t query_logins_response_dma;
struct sbp2_reconnect_orb *reconnect_orb;
dma_addr_t reconnect_orb_dma;
struct sbp2_logout_orb *logout_orb;
@@ -402,7 +396,7 @@
u32 sbp2_firmware_revision;
/*
- * Variable used for logins, reconnects, logouts
+ * Variable used for logins, reconnects, logouts, query logins
*/
atomic_t sbp2_login_complete;
@@ -412,11 +406,13 @@
spinlock_t sbp2_command_orb_lock;
struct list_head sbp2_command_orb_inuse;
struct list_head sbp2_command_orb_completed;
- u32 sbp2_total_command_orbs;
/* Node entry, as retrieved from NodeMgr entries */
struct node_entry *ne;
+ /* A backlink to our host_info */
+ struct sbp2scsi_host_info *hi;
+
/* Device specific workarounds/brokeness */
u32 workarounds;
};
@@ -425,46 +421,24 @@
* Sbp2 host data structure (one per sbp2 host)
*/
struct sbp2scsi_host_info {
-
- /*
- * For use in keeping track of hosts
- */
- struct list_head list;
struct hpsb_host *host;
- /*
- * Spin locks for command processing and packet pool management
- */
+ /* Spin locks for command processing */
spinlock_t sbp2_command_lock;
- spinlock_t sbp2_request_packet_lock;
- /*
- * This is the scsi host we register with the scsi mid level.
- * We keep a reference to it here, so we can unregister it
- * when the hpsb_host is removed.
- */
+ /* This is the scsi host we register with the scsi mid level. */
struct Scsi_Host *scsi_host;
- /*
- * Lists keeping track of inuse/free sbp2_request_packets. These structures are
- * used for sending out sbp2 command and agent reset packets. We initially create
- * a pool of request packets so that we don't have to do any kmallocs while in critical
- * I/O paths.
- */
- struct list_head sbp2_req_inuse;
- struct list_head sbp2_req_free;
+ /* Our allocated scsi_host_template */
+ Scsi_Host_Template sht;
- /*
- * Here is the pool of request packets. All the hpsb packets (for 1394 bus transactions)
- * are allocated at init and simply re-initialized when needed.
- */
- struct sbp2_request_packet *request_packet;
+ /* The proc_name used with the above sht */
+ char proc_name[32];
- /*
- * SCSI ID instance data (one for each sbp2 device instance possible)
- */
- struct scsi_id_instance_data *scsi_id[SBP2SCSI_MAX_SCSI_IDS];
+ struct hpsb_highlevel *hl;
+ /* SCSI ID instance data (one for each sbp2 device instance possible) */
+ struct scsi_id_instance_data *scsi_id[SBP2SCSI_MAX_SCSI_IDS];
};
/*
@@ -474,21 +448,13 @@
/*
* Various utility prototypes
*/
-static int sbp2util_create_request_packet_pool(struct sbp2scsi_host_info *hi);
-static void sbp2util_remove_request_packet_pool(struct sbp2scsi_host_info *hi);
-static struct sbp2_request_packet *sbp2util_allocate_write_request_packet(struct sbp2scsi_host_info *hi,
- struct node_entry *ne, u64 addr,
- size_t data_size,
- quadlet_t data);
-static void sbp2util_free_request_packet(struct sbp2_request_packet *request_packet);
-static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_id, struct sbp2scsi_host_info *hi);
-static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_id, struct sbp2scsi_host_info *hi);
+static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_id);
+static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_id);
static struct sbp2_command_info *sbp2util_find_command_for_orb(struct scsi_id_instance_data *scsi_id, dma_addr_t orb);
static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt);
static struct sbp2_command_info *sbp2util_allocate_command_orb(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *Current_SCpnt,
- void (*Current_done)(Scsi_Cmnd *),
- struct sbp2scsi_host_info *hi);
+ void (*Current_done)(Scsi_Cmnd *));
static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command);
@@ -496,70 +462,48 @@
* IEEE-1394 core driver related prototypes
*/
static void sbp2_add_host(struct hpsb_host *host);
-static struct sbp2scsi_host_info *sbp2_find_host_info(struct hpsb_host *host);
static void sbp2_remove_host(struct hpsb_host *host);
-int sbp2_init(void);
-void sbp2_cleanup(void);
static int sbp2_probe(struct unit_directory *ud);
static void sbp2_disconnect(struct unit_directory *ud);
static void sbp2_update(struct unit_directory *ud);
+
static int sbp2_start_device(struct sbp2scsi_host_info *hi,
struct unit_directory *ud);
-static void sbp2_remove_device(struct sbp2scsi_host_info *hi,
- struct scsi_id_instance_data *scsi_id);
+static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id);
#ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA
static int sbp2_handle_physdma_write(struct hpsb_host *host, int nodeid, int destid, quadlet_t *data,
- u64 addr, unsigned int length);
+ u64 addr, unsigned int length, u16 flags);
static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_t *data,
- u64 addr, unsigned int length);
+ u64 addr, unsigned int length, u16 flags);
#endif
/*
* SBP-2 protocol related prototypes
*/
-static int sbp2_login_device(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id);
-static int sbp2_reconnect_device(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id);
-static int sbp2_logout_device(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id);
+static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id);
+static int sbp2_login_device(struct scsi_id_instance_data *scsi_id);
+static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id);
+static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id);
static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int destid,
- quadlet_t *data, u64 addr, unsigned int length);
-static int sbp2_agent_reset(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id, u32 flags);
-static int sbp2_create_command_orb(struct sbp2scsi_host_info *hi,
- struct scsi_id_instance_data *scsi_id,
+ quadlet_t *data, u64 addr, unsigned int length, u16 flags);
+static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait);
+static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command,
unchar *scsi_cmd,
unsigned int scsi_use_sg,
unsigned int scsi_request_bufflen,
void *scsi_request_buffer,
unsigned char scsi_dir);
-static int sbp2_link_orb_command(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id,
+static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command);
-static int sbp2_send_command(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id,
+static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data);
static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd);
static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, Scsi_Cmnd *SCpnt);
static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id);
-static int sbp2_set_busy_timeout(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id);
-static int sbp2_max_speed_and_size(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id);
-
-/*
- * Scsi interface related prototypes
- */
-static int sbp2scsi_detect (Scsi_Host_Template *tpnt);
-static const char *sbp2scsi_info (struct Scsi_Host *host);
-void sbp2scsi_setup(char *str, int *ints);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28)
-static int sbp2scsi_biosparam (Scsi_Disk *disk, kdev_t dev, int geom[]);
-#else
-static int sbp2scsi_biosparam (Scsi_Disk *disk, struct block_device *dev, int geom[]);
-#endif
-static int sbp2scsi_abort (Scsi_Cmnd *SCpnt);
-static int sbp2scsi_reset (Scsi_Cmnd *SCpnt);
-static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
-static void sbp2scsi_complete_all_commands(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id,
- u32 status);
-static void sbp2scsi_complete_command(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id,
- u32 scsi_status, Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
+static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id);
+static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id);
#endif /* SBP2_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)