patch-2.4.19 linux-2.4.19/drivers/ieee1394/sbp2.h
Next file: linux-2.4.19/drivers/ieee1394/video1394.c
Previous file: linux-2.4.19/drivers/ieee1394/sbp2.c
Back to the patch index
Back to the overall index
- Lines: 264
- Date:
Fri Aug 2 17:39:44 2002
- Orig file:
linux-2.4.18/drivers/ieee1394/sbp2.h
- Orig date:
Fri Dec 21 09:41:54 2001
diff -urN linux-2.4.18/drivers/ieee1394/sbp2.h linux-2.4.19/drivers/ieee1394/sbp2.h
@@ -22,6 +22,15 @@
#ifndef SBP2_H
#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
@@ -36,6 +45,7 @@
#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_NODE_ID(value) ((value & 0xffff) << 16)
@@ -185,10 +195,28 @@
* Miscellaneous SBP2 related config rom defines
*/
-#define SBP2_STATUS_FIFO_ADDRESS 0xfffe00000000ULL /* for write posting! */
+/*
+ * The status fifo address definition below is used as a status base, with a chunk
+ * separately assigned for each sbp2 device detected. For example, 0xfffe00000000ULL
+ * is used for the first sbp2 device detected, 0xfffe00000020ULL for the next sbp2
+ * device, and so on.
+ *
+ * Note: We could use a single status fifo address for all sbp2 devices, and figure
+ * out which sbp2 device the status belongs to by looking at the source node id of
+ * the status write... but, using separate addresses for each sbp2 device allows for
+ * better code and the ability to support multiple luns within a single 1394 node.
+ *
+ * Also note that we choose the address range below as it is a region specified for
+ * write posting, where the ohci controller will automatically send an ack_complete
+ * when the status is written by the sbp2 device... saving a split transaction. =)
+ */
+#define SBP2_STATUS_FIFO_ADDRESS 0xfffe00000000ULL
#define SBP2_STATUS_FIFO_ADDRESS_HI 0xfffe
#define SBP2_STATUS_FIFO_ADDRESS_LO 0x0
+#define SBP2_STATUS_FIFO_ENTRY_TO_OFFSET(entry) ((entry) << 5)
+#define SBP2_STATUS_FIFO_OFFSET_TO_ENTRY(offset) ((offset) >> 5)
+
#define SBP2_UNIT_DIRECTORY_OFFSET_KEY 0xd1
#define SBP2_CSR_OFFSET_KEY 0x54
#define SBP2_UNIT_SPEC_ID_KEY 0x12
@@ -199,6 +227,9 @@
#define SBP2_DEVICE_TYPE_AND_LUN_KEY 0x14
#define SBP2_FIRMWARE_REVISION_KEY 0x3c
+#define SBP2_DEVICE_TYPE(q) (((q) >> 16) & 0x1f)
+#define SBP2_DEVICE_LUN(q) ((q) & 0xffff)
+
#define SBP2_AGENT_STATE_OFFSET 0x00ULL
#define SBP2_AGENT_RESET_OFFSET 0x04ULL
#define SBP2_ORB_POINTER_OFFSET 0x08ULL
@@ -219,18 +250,13 @@
#define SBP2_SW_VERSION_ENTRY 0x00010483
/*
- * Miscellaneous general config rom related defines
+ * Other misc defines
*/
-
-#define CONFIG_ROM_INITIAL_MEMORY_SPACE 0xfffff0000000ULL
-
-#define CONFIG_ROM_BASE_ADDRESS 0xfffff0000400ULL
-#define CONFIG_ROM_ROOT_DIR_BASE 0xfffff0000414ULL
-#define CONFIG_ROM_UNIT_DIRECTORY_OFFSET 0xfffff0000424ULL
-
#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
*/
@@ -243,16 +269,18 @@
#define SBP2_MAX_SG_ELEMENTS SG_ALL
#define SBP2_CLUSTERING ENABLE_CLUSTERING
#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000
-#define SBP2SCSI_MAX_SCSI_IDS 8
+#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 4 /* Max outstanding sbp2 commands per device - tune as needed */
+#define SBP2SCSI_MAX_CMDS_PER_LUN 1 /* Max outstanding sbp2 commands per device - tune as needed */
+#define SBP2_MAX_SECTORS 255 /* Max sectors supported */
#ifndef TYPE_SDAD
#define TYPE_SDAD 0x0e /* simplified direct access device */
#endif
/*
- * SCSI direction table... since the scsi stack doesn't specify direction... =(
+ * SCSI direction table...
+ * (now used as a back-up in case the direction passed down from above is "unknown")
*
* DIN = IN data direction
* DOU = OUT data direction
@@ -286,13 +314,8 @@
DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN
};
-
-/*
- * Number of request packets available for actual sbp2 I/O requests (these are used
- * for sending command and agent reset packets).
- */
-#define SBP2_MAX_REQUEST_PACKETS SBP2SCSI_MAX_OUTSTANDING_CMDS /* Per host adapter instance */
-#define SBP2_MAX_COMMAND_ORBS SBP2SCSI_MAX_CMDS_PER_LUN * 2 /* Per sbp2 device instance */
+#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)
@@ -306,21 +329,26 @@
};
+
+/* 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
+
/*
* Encapsulates all the info necessary for an outstanding command.
*/
struct sbp2_command_info {
struct list_head list;
- struct sbp2_command_orb command_orb;
- dma_addr_t command_orb_dma;
+ struct sbp2_command_orb command_orb ____cacheline_aligned;
+ dma_addr_t command_orb_dma ____cacheline_aligned;
Scsi_Cmnd *Current_SCpnt;
void (*Current_done)(Scsi_Cmnd *);
- unsigned int linked;
/* Also need s/g structure for each sbp2 command */
- struct sbp2_unrestricted_page_table scatter_gather_element[SBP2_MAX_SG_ELEMENTS];
- dma_addr_t sge_dma;
+ struct sbp2_unrestricted_page_table scatter_gather_element[SBP2_MAX_SG_ELEMENTS] ____cacheline_aligned;
+ dma_addr_t sge_dma ____cacheline_aligned;
void *sge_buffer;
dma_addr_t cmd_dma;
int dma_type;
@@ -329,6 +357,10 @@
};
+/* A list of flags for detected oddities and brokeness. */
+#define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1
+#define SBP2_BREAKAGE_INQUIRY_HACK 0x2
+
/*
* Information needed on a per scsi id basis (one for each sbp2 device)
*/
@@ -340,6 +372,7 @@
* Various sbp2 specific structures
*/
struct sbp2_command_orb *last_orb;
+ dma_addr_t last_orb_dma;
struct sbp2_login_orb *login_orb;
dma_addr_t login_orb_dma;
struct sbp2_login_response *login_response;
@@ -369,9 +402,9 @@
u32 sbp2_firmware_revision;
/*
- * Wait queue used for logins, reconnects, logouts
+ * Variable used for logins, reconnects, logouts
*/
- wait_queue_head_t sbp2_login_wait;
+ atomic_t sbp2_login_complete;
/*
* Pool of command orbs, so we can have more than overlapped command per id
@@ -383,6 +416,9 @@
/* Node entry, as retrieved from NodeMgr entries */
struct node_entry *ne;
+
+ /* Device specific workarounds/brokeness */
+ u32 workarounds;
};
/*
@@ -422,7 +458,7 @@
* 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[SBP2_MAX_REQUEST_PACKETS];
+ struct sbp2_request_packet *request_packet;
/*
* SCSI ID instance data (one for each sbp2 device instance possible)
@@ -441,7 +477,7 @@
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,
- nodeid_t node, u64 addr,
+ 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);
@@ -472,6 +508,13 @@
static void sbp2_remove_device(struct sbp2scsi_host_info *hi,
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);
+static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_t *data,
+ u64 addr, unsigned int length);
+#endif
+
/*
* SBP-2 protocol related prototypes
*/
@@ -487,17 +530,15 @@
unchar *scsi_cmd,
unsigned int scsi_use_sg,
unsigned int scsi_request_bufflen,
- void *scsi_request_buffer, int dma_dir);
+ 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,
struct sbp2_command_info *command);
static int sbp2_send_command(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
-static int sbp2_send_split_command(struct sbp2scsi_host_info *hi, 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(unchar *cmd);
-static void sbp2_check_sbp2_response(struct sbp2scsi_host_info *hi, struct scsi_id_instance_data *scsi_id,
- Scsi_Cmnd *SCpnt);
+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);
@@ -506,10 +547,11 @@
* 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);
static int sbp2scsi_biosparam (Scsi_Disk *disk, kdev_t dev, int geom[]);
static int sbp2scsi_abort (Scsi_Cmnd *SCpnt);
-static int sbp2scsi_reset (Scsi_Cmnd *SCpnt, unsigned int reset_flags);
+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);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)