#include <linux/blkdev.h>
#include <linux/bug.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/stringify.h>
#include <linux/workqueue.h>
#include <asm/byteorder.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
static bool sbp2_param_exclusive_login = …;
module_param_named(exclusive_login, sbp2_param_exclusive_login, bool, 0644);
MODULE_PARM_DESC(…) …;
#define SBP2_WORKAROUND_128K_MAX_TRANS …
#define SBP2_WORKAROUND_INQUIRY_36 …
#define SBP2_WORKAROUND_MODE_SENSE_8 …
#define SBP2_WORKAROUND_FIX_CAPACITY …
#define SBP2_WORKAROUND_DELAY_INQUIRY …
#define SBP2_INQUIRY_DELAY …
#define SBP2_WORKAROUND_POWER_CONDITION …
#define SBP2_WORKAROUND_OVERRIDE …
static int sbp2_param_workarounds;
module_param_named(workarounds, sbp2_param_workarounds, int, 0644);
MODULE_PARM_DESC(…) …;
struct sbp2_logical_unit { … };
static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
{ … }
struct sbp2_target { … };
static struct fw_device *target_parent_device(struct sbp2_target *tgt)
{ … }
static const struct device *tgt_dev(const struct sbp2_target *tgt)
{ … }
static const struct device *lu_dev(const struct sbp2_logical_unit *lu)
{ … }
#define INVALID_LOGIN_ID …
#define SBP2_ORB_TIMEOUT …
#define SBP2_ORB_NULL …
#define SBP2_RETRY_LIMIT …
#define SBP2_CYCLE_LIMIT …
#define SBP2_MAX_CDB_SIZE …
#define SBP2_MAX_SEG_SIZE …
#define SBP2_CSR_UNIT_CHARACTERISTICS …
#define SBP2_CSR_FIRMWARE_REVISION …
#define SBP2_CSR_LOGICAL_UNIT_NUMBER …
#define SBP2_CSR_UNIT_UNIQUE_ID …
#define SBP2_CSR_LOGICAL_UNIT_DIRECTORY …
#define SBP2_LOGIN_REQUEST …
#define SBP2_QUERY_LOGINS_REQUEST …
#define SBP2_RECONNECT_REQUEST …
#define SBP2_SET_PASSWORD_REQUEST …
#define SBP2_LOGOUT_REQUEST …
#define SBP2_ABORT_TASK_REQUEST …
#define SBP2_ABORT_TASK_SET …
#define SBP2_LOGICAL_UNIT_RESET …
#define SBP2_TARGET_RESET_REQUEST …
#define SBP2_AGENT_STATE …
#define SBP2_AGENT_RESET …
#define SBP2_ORB_POINTER …
#define SBP2_DOORBELL …
#define SBP2_UNSOLICITED_STATUS_ENABLE …
#define SBP2_STATUS_REQUEST_COMPLETE …
#define SBP2_STATUS_TRANSPORT_FAILURE …
#define SBP2_STATUS_ILLEGAL_REQUEST …
#define SBP2_STATUS_VENDOR_DEPENDENT …
#define STATUS_GET_ORB_HIGH(v) …
#define STATUS_GET_SBP_STATUS(v) …
#define STATUS_GET_LEN(v) …
#define STATUS_GET_DEAD(v) …
#define STATUS_GET_RESPONSE(v) …
#define STATUS_GET_SOURCE(v) …
#define STATUS_GET_ORB_LOW(v) …
#define STATUS_GET_DATA(v) …
struct sbp2_status { … };
struct sbp2_pointer { … };
struct sbp2_orb { … };
#define MANAGEMENT_ORB_LUN(v) …
#define MANAGEMENT_ORB_FUNCTION(v) …
#define MANAGEMENT_ORB_RECONNECT(v) …
#define MANAGEMENT_ORB_EXCLUSIVE(v) …
#define MANAGEMENT_ORB_REQUEST_FORMAT(v) …
#define MANAGEMENT_ORB_NOTIFY …
#define MANAGEMENT_ORB_RESPONSE_LENGTH(v) …
#define MANAGEMENT_ORB_PASSWORD_LENGTH(v) …
struct sbp2_management_orb { … };
struct sbp2_login_response { … };
#define COMMAND_ORB_DATA_SIZE(v) …
#define COMMAND_ORB_PAGE_SIZE(v) …
#define COMMAND_ORB_PAGE_TABLE_PRESENT …
#define COMMAND_ORB_MAX_PAYLOAD(v) …
#define COMMAND_ORB_SPEED(v) …
#define COMMAND_ORB_DIRECTION …
#define COMMAND_ORB_REQUEST_FORMAT(v) …
#define COMMAND_ORB_NOTIFY …
struct sbp2_command_orb { … };
#define SBP2_ROM_VALUE_WILDCARD …
#define SBP2_ROM_VALUE_MISSING …
static const struct { … } sbp2_workarounds_table[] = …;
static void free_orb(struct kref *kref)
{ … }
static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
int tcode, int destination, int source,
int generation, unsigned long long offset,
void *payload, size_t length, void *callback_data)
{ … }
static void complete_transaction(struct fw_card *card, int rcode,
void *payload, size_t length, void *data)
{ … }
static void sbp2_send_orb(struct sbp2_orb *orb, struct sbp2_logical_unit *lu,
int node_id, int generation, u64 offset)
{ … }
static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
{ … }
static void complete_management_orb(struct sbp2_orb *base_orb,
struct sbp2_status *status)
{ … }
static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
int generation, int function,
int lun_or_login_id, void *response)
{ … }
static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
{ … }
static void complete_agent_reset_write_no_wait(struct fw_card *card,
int rcode, void *payload, size_t length, void *data)
{ … }
static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
{ … }
static inline void sbp2_allow_block(struct sbp2_target *tgt)
{ … }
static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
{ … }
static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
{ … }
static void sbp2_unblock(struct sbp2_target *tgt)
{ … }
static int sbp2_lun2int(u16 lun)
{ … }
static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
{ … }
static void sbp2_reconnect(struct work_struct *work);
static void sbp2_login(struct work_struct *work)
{ … }
static void sbp2_reconnect(struct work_struct *work)
{ … }
static void sbp2_lu_workfn(struct work_struct *work)
{ … }
static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
{ … }
static void sbp2_get_unit_unique_id(struct sbp2_target *tgt,
const u32 *leaf)
{ … }
static int sbp2_scan_logical_unit_dir(struct sbp2_target *tgt,
const u32 *directory)
{ … }
static int sbp2_scan_unit_dir(struct sbp2_target *tgt, const u32 *directory,
u32 *model, u32 *firmware_revision)
{ … }
static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt)
{ … }
static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
u32 firmware_revision)
{ … }
static const struct scsi_host_template scsi_driver_template;
static void sbp2_remove(struct fw_unit *unit);
static int sbp2_probe(struct fw_unit *unit, const struct ieee1394_device_id *id)
{ … }
static void sbp2_update(struct fw_unit *unit)
{ … }
static void sbp2_remove(struct fw_unit *unit)
{ … }
#define SBP2_UNIT_SPEC_ID_ENTRY …
#define SBP2_SW_VERSION_ENTRY …
static const struct ieee1394_device_id sbp2_id_table[] = …;
static struct fw_driver sbp2_driver = …;
static void sbp2_unmap_scatterlist(struct device *card_device,
struct sbp2_command_orb *orb)
{ … }
static unsigned int sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
{ … }
static void complete_command_orb(struct sbp2_orb *base_orb,
struct sbp2_status *status)
{ … }
static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
struct fw_device *device, struct sbp2_logical_unit *lu)
{ … }
static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
struct scsi_cmnd *cmd)
{ … }
static int sbp2_scsi_slave_alloc(struct scsi_device *sdev)
{ … }
static int sbp2_scsi_device_configure(struct scsi_device *sdev,
struct queue_limits *lim)
{ … }
static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
{ … }
static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(ieee1394_id, S_IRUGO, sbp2_sysfs_ieee1394_id_show, NULL);
static struct attribute *sbp2_scsi_sysfs_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct scsi_host_template scsi_driver_template = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_DEVICE_TABLE(ieee1394, sbp2_id_table);
MODULE_ALIAS(…) …;
static int __init sbp2_init(void)
{ … }
static void __exit sbp2_cleanup(void)
{ … }
module_init(…) …;
module_exit(sbp2_cleanup);