summaryrefslogtreecommitdiff
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libfcoe.h4
-rw-r--r--include/scsi/libsas.h72
-rw-r--r--include/scsi/osd_attributes.h398
-rw-r--r--include/scsi/osd_initiator.h511
-rw-r--r--include/scsi/osd_ore.h201
-rw-r--r--include/scsi/osd_protocol.h676
-rw-r--r--include/scsi/osd_sec.h45
-rw-r--r--include/scsi/osd_sense.h263
-rw-r--r--include/scsi/osd_types.h45
-rw-r--r--include/scsi/scsi.h6
-rw-r--r--include/scsi/scsi_cmnd.h40
-rw-r--r--include/scsi/scsi_dh.h2
-rw-r--r--include/scsi/scsi_driver.h3
-rw-r--r--include/scsi/scsi_eh.h1
-rw-r--r--include/scsi/scsi_host.h64
-rw-r--r--include/scsi/scsi_tcq.h14
-rw-r--r--include/scsi/scsi_transport_fc.h18
-rw-r--r--include/scsi/srp.h26
18 files changed, 110 insertions, 2279 deletions
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index cb8a273732cf..bb8092fa1e36 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -79,7 +79,7 @@ enum fip_state {
* It must not change after fcoe_ctlr_init() sets it.
*/
enum fip_mode {
- FIP_MODE_AUTO = FIP_ST_AUTO,
+ FIP_MODE_AUTO,
FIP_MODE_NON_FIP,
FIP_MODE_FABRIC,
FIP_MODE_VN2VN,
@@ -250,7 +250,7 @@ struct fcoe_rport {
};
/* FIP API functions */
-void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state);
+void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_mode);
void fcoe_ctlr_destroy(struct fcoe_ctlr *);
void fcoe_ctlr_link_up(struct fcoe_ctlr *);
int fcoe_ctlr_link_down(struct fcoe_ctlr *);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 3de3b10da19a..b08febec7895 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -52,8 +52,8 @@ enum sas_phy_role {
};
enum sas_phy_type {
- PHY_TYPE_PHYSICAL,
- PHY_TYPE_VIRTUAL
+ PHY_TYPE_PHYSICAL,
+ PHY_TYPE_VIRTUAL
};
/* The events are mnemonically described in sas_dump.c
@@ -91,7 +91,7 @@ enum discover_event {
#define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj)
#define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\
- attr)
+ attr)
enum routing_attribute {
DIRECT_ROUTING,
@@ -184,37 +184,37 @@ struct domain_device {
spinlock_t done_lock;
enum sas_device_type dev_type;
- enum sas_linkrate linkrate;
- enum sas_linkrate min_linkrate;
- enum sas_linkrate max_linkrate;
+ enum sas_linkrate linkrate;
+ enum sas_linkrate min_linkrate;
+ enum sas_linkrate max_linkrate;
- int pathways;
+ int pathways;
- struct domain_device *parent;
- struct list_head siblings; /* devices on the same level */
- struct asd_sas_port *port; /* shortcut to root of the tree */
+ struct domain_device *parent;
+ struct list_head siblings; /* devices on the same level */
+ struct asd_sas_port *port; /* shortcut to root of the tree */
struct sas_phy *phy;
- struct list_head dev_list_node;
+ struct list_head dev_list_node;
struct list_head disco_list_node; /* awaiting probe or destruct */
- enum sas_protocol iproto;
- enum sas_protocol tproto;
+ enum sas_protocol iproto;
+ enum sas_protocol tproto;
- struct sas_rphy *rphy;
+ struct sas_rphy *rphy;
- u8 sas_addr[SAS_ADDR_SIZE];
- u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
+ u8 sas_addr[SAS_ADDR_SIZE];
+ u8 hashed_sas_addr[HASHED_SAS_ADDR_SIZE];
- u8 frame_rcvd[32];
+ u8 frame_rcvd[32];
- union {
- struct expander_device ex_dev;
- struct sata_device sata_dev; /* STP & directly attached */
+ union {
+ struct expander_device ex_dev;
+ struct sata_device sata_dev; /* STP & directly attached */
struct ssp_device ssp_dev;
- };
+ };
- void *lldd_dev;
+ void *lldd_dev;
unsigned long state;
struct kref kref;
};
@@ -224,6 +224,13 @@ struct sas_work {
struct work_struct work;
};
+/* Lots of code duplicates this in the SCSI tree, which can be factored out */
+static inline bool sas_dev_type_is_expander(enum sas_device_type type)
+{
+ return type == SAS_EDGE_EXPANDER_DEVICE ||
+ type == SAS_FANOUT_EXPANDER_DEVICE;
+}
+
static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *))
{
INIT_WORK(&sw->work, fn);
@@ -245,9 +252,9 @@ static inline struct sas_discovery_event *to_sas_discovery_event(struct work_str
struct sas_discovery {
struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
unsigned long pending;
- u8 fanout_sas_addr[8];
- u8 eeds_a[8];
- u8 eeds_b[8];
+ u8 fanout_sas_addr[SAS_ADDR_SIZE];
+ u8 eeds_a[SAS_ADDR_SIZE];
+ u8 eeds_b[SAS_ADDR_SIZE];
int max_level;
};
@@ -512,10 +519,10 @@ enum exec_status {
/* When a task finishes with a response, the LLDD examines the
* response:
- * - For an ATA task task_status_struct::stat is set to
+ * - For an ATA task task_status_struct::stat is set to
* SAS_PROTO_RESPONSE, and the task_status_struct::buf is set to the
* contents of struct ata_task_resp.
- * - For SSP tasks, if no data is present or status/TMF response
+ * - For SSP tasks, if no data is present or status/TMF response
* is valid, task_status_struct::stat is set. If data is present
* (SENSE data), the LLDD copies up to SAS_STATUS_BUF_SIZE, sets
* task_status_struct::buf_valid_size, and task_status_struct::stat is
@@ -671,15 +678,13 @@ extern void sas_prep_resume_ha(struct sas_ha_struct *sas_ha);
extern void sas_resume_ha(struct sas_ha_struct *sas_ha);
extern void sas_suspend_ha(struct sas_ha_struct *sas_ha);
-int sas_set_phy_speed(struct sas_phy *phy,
- struct sas_phy_linkrates *rates);
+int sas_set_phy_speed(struct sas_phy *phy, struct sas_phy_linkrates *rates);
int sas_phy_reset(struct sas_phy *phy, int hard_reset);
-extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
+extern int sas_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
extern int sas_target_alloc(struct scsi_target *);
extern int sas_slave_configure(struct scsi_device *);
extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
-extern int sas_bios_param(struct scsi_device *,
- struct block_device *,
+extern int sas_bios_param(struct scsi_device *, struct block_device *,
sector_t capacity, int *hsc);
extern struct scsi_transport_template *
sas_domain_attach_transport(struct sas_domain_function_template *);
@@ -709,7 +714,8 @@ int sas_eh_target_reset_handler(struct scsi_cmnd *cmd);
extern void sas_target_destroy(struct scsi_target *);
extern int sas_slave_alloc(struct scsi_device *);
-extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg);
+extern int sas_ioctl(struct scsi_device *sdev, unsigned int cmd,
+ void __user *arg);
extern int sas_drain_work(struct sas_ha_struct *ha);
extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
deleted file mode 100644
index 8a6acd054e4e..000000000000
--- a/include/scsi/osd_attributes.h
+++ /dev/null
@@ -1,398 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __OSD_ATTRIBUTES_H__
-#define __OSD_ATTRIBUTES_H__
-
-#include <scsi/osd_protocol.h>
-
-/*
- * Contains types and constants that define attribute pages and attribute
- * numbers and their data types.
- */
-
-#define ATTR_SET(pg, id, l, ptr) \
- { .attr_page = pg, .attr_id = id, .len = l, .val_ptr = ptr }
-
-#define ATTR_DEF(pg, id, l) ATTR_SET(pg, id, l, NULL)
-
-/* osd-r10 4.7.3 Attributes pages */
-enum {
- OSD_APAGE_OBJECT_FIRST = 0x0,
- OSD_APAGE_OBJECT_DIRECTORY = 0,
- OSD_APAGE_OBJECT_INFORMATION = 1,
- OSD_APAGE_OBJECT_QUOTAS = 2,
- OSD_APAGE_OBJECT_TIMESTAMP = 3,
- OSD_APAGE_OBJECT_COLLECTIONS = 4,
- OSD_APAGE_OBJECT_SECURITY = 5,
- OSD_APAGE_OBJECT_LAST = 0x2fffffff,
-
- OSD_APAGE_PARTITION_FIRST = 0x30000000,
- OSD_APAGE_PARTITION_DIRECTORY = OSD_APAGE_PARTITION_FIRST + 0,
- OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1,
- OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2,
- OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3,
- OSD_APAGE_PARTITION_ATTR_ACCESS = OSD_APAGE_PARTITION_FIRST + 4,
- OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5,
- OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF,
-
- OSD_APAGE_COLLECTION_FIRST = 0x60000000,
- OSD_APAGE_COLLECTION_DIRECTORY = OSD_APAGE_COLLECTION_FIRST + 0,
- OSD_APAGE_COLLECTION_INFORMATION = OSD_APAGE_COLLECTION_FIRST + 1,
- OSD_APAGE_COLLECTION_TIMESTAMP = OSD_APAGE_COLLECTION_FIRST + 3,
- OSD_APAGE_COLLECTION_SECURITY = OSD_APAGE_COLLECTION_FIRST + 5,
- OSD_APAGE_COLLECTION_LAST = 0x8FFFFFFF,
-
- OSD_APAGE_ROOT_FIRST = 0x90000000,
- OSD_APAGE_ROOT_DIRECTORY = OSD_APAGE_ROOT_FIRST + 0,
- OSD_APAGE_ROOT_INFORMATION = OSD_APAGE_ROOT_FIRST + 1,
- OSD_APAGE_ROOT_QUOTAS = OSD_APAGE_ROOT_FIRST + 2,
- OSD_APAGE_ROOT_TIMESTAMP = OSD_APAGE_ROOT_FIRST + 3,
- OSD_APAGE_ROOT_SECURITY = OSD_APAGE_ROOT_FIRST + 5,
- OSD_APAGE_ROOT_LAST = 0xBFFFFFFF,
-
- OSD_APAGE_RESERVED_TYPE_FIRST = 0xC0000000,
- OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF,
-
- OSD_APAGE_COMMON_FIRST = 0xF0000000,
- OSD_APAGE_COMMON_LAST = 0xFFFFFFFD,
-
- OSD_APAGE_CURRENT_COMMAND = 0xFFFFFFFE,
-
- OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF,
-};
-
-/* subcategories of attr pages within each range above */
-enum {
- OSD_APAGE_STD_FIRST = 0x0,
- OSD_APAGE_STD_DIRECTORY = 0,
- OSD_APAGE_STD_INFORMATION = 1,
- OSD_APAGE_STD_QUOTAS = 2,
- OSD_APAGE_STD_TIMESTAMP = 3,
- OSD_APAGE_STD_COLLECTIONS = 4,
- OSD_APAGE_STD_POLICY_SECURITY = 5,
- OSD_APAGE_STD_LAST = 0x0000007F,
-
- OSD_APAGE_RESERVED_FIRST = 0x00000080,
- OSD_APAGE_RESERVED_LAST = 0x00007FFF,
-
- OSD_APAGE_OTHER_STD_FIRST = 0x00008000,
- OSD_APAGE_OTHER_STD_LAST = 0x0000EFFF,
-
- OSD_APAGE_PUBLIC_FIRST = 0x0000F000,
- OSD_APAGE_PUBLIC_LAST = 0x0000FFFF,
-
- OSD_APAGE_APP_DEFINED_FIRST = 0x00010000,
- OSD_APAGE_APP_DEFINED_LAST = 0x1FFFFFFF,
-
- OSD_APAGE_VENDOR_SPECIFIC_FIRST = 0x20000000,
- OSD_APAGE_VENDOR_SPECIFIC_LAST = 0x2FFFFFFF,
-};
-
-enum {
- OSD_ATTR_PAGE_IDENTIFICATION = 0, /* in all pages 40 bytes */
-};
-
-struct page_identification {
- u8 vendor_identification[8];
- u8 page_identification[32];
-} __packed;
-
-struct osd_attr_page_header {
- __be32 page_number;
- __be32 page_length;
-} __packed;
-
-/* 7.1.2.8 Root Information attributes page (OSD_APAGE_ROOT_INFORMATION) */
-enum {
- OSD_ATTR_RI_OSD_SYSTEM_ID = 0x3, /* 20 */
- OSD_ATTR_RI_VENDOR_IDENTIFICATION = 0x4, /* 8 */
- OSD_ATTR_RI_PRODUCT_IDENTIFICATION = 0x5, /* 16 */
- OSD_ATTR_RI_PRODUCT_MODEL = 0x6, /* 32 */
- OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */
- OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */
- OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */
- OSD_ATTR_RI_MAX_CDB_CONTINUATION_LEN = 0xA, /* 4 */
- OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */
- OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */
- OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */
- OSD_ATTR_RI_CLOCK = 0x100, /* 6 */
- OARI_DEFAULT_ISOLATION_METHOD = 0X110, /* 1 */
- OARI_SUPPORTED_ISOLATION_METHODS = 0X111, /* 32 */
-
- OARI_DATA_ATOMICITY_GUARANTEE = 0X120, /* 8 */
- OARI_DATA_ATOMICITY_ALIGNMENT = 0X121, /* 8 */
- OARI_ATTRIBUTES_ATOMICITY_GUARANTEE = 0X122, /* 8 */
- OARI_DATA_ATTRIBUTES_ATOMICITY_MULTIPLIER = 0X123, /* 1 */
-
- OARI_MAXIMUM_SNAPSHOTS_COUNT = 0X1C1, /* 0 or 4 */
- OARI_MAXIMUM_CLONES_COUNT = 0X1C2, /* 0 or 4 */
- OARI_MAXIMUM_BRANCH_DEPTH = 0X1CC, /* 0 or 4 */
- OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_FIRST = 0X200, /* 0 or 4 */
- OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_LAST = 0X2ff, /* 0 or 4 */
- OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_FIRST = 0X300, /* 0 or 4 */
- OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_LAST = 0X30F, /* 0 or 4 */
- OARI_SUPPORT_FOR_DUPLICATED_OBJECT_FREEZING = 0X310, /* 0 or 4 */
- OARI_SUPPORT_FOR_SNAPSHOT_REFRESHING = 0X311, /* 0 or 1 */
- OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_FIRST = 0X7000001,/* 0 or 4 */
- OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_LAST = 0X700FFFF,/* 0 or 4 */
-};
-/* Root_Information_attributes_page does not have a get_page structure */
-
-/* 7.1.2.9 Partition Information attributes page
- * (OSD_APAGE_PARTITION_INFORMATION)
- */
-enum {
- OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */
- OSD_ATTR_PI_USERNAME = 0x9, /* variable */
- OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */
- OSD_ATTR_PI_USED_CAPACITY_INCREMENT = 0x84, /* 0 or 8 */
- OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */
-
- OSD_ATTR_PI_ACTUAL_DATA_SPACE = 0xD1, /* 0 or 8 */
- OSD_ATTR_PI_RESERVED_DATA_SPACE = 0xD2, /* 0 or 8 */
- OSD_ATTR_PI_DEFAULT_SNAPSHOT_DUPLICATION_METHOD = 0x200,/* 0 or 4 */
- OSD_ATTR_PI_DEFAULT_CLONE_DUPLICATION_METHOD = 0x201,/* 0 or 4 */
- OSD_ATTR_PI_DEFAULT_SP_TIME_OF_DUPLICATION = 0x300,/* 0 or 4 */
- OSD_ATTR_PI_DEFAULT_CLONE_TIME_OF_DUPLICATION = 0x301,/* 0 or 4 */
-};
-/* Partition Information attributes page does not have a get_page structure */
-
-/* 7.1.2.10 Collection Information attributes page
- * (OSD_APAGE_COLLECTION_INFORMATION)
- */
-enum {
- OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */
- OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */
- OSD_ATTR_CI_USERNAME = 0x9, /* variable */
- OSD_ATTR_CI_COLLECTION_TYPE = 0xA, /* 1 */
- OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */
-};
-/* Collection Information attributes page does not have a get_page structure */
-
-/* 7.1.2.11 User Object Information attributes page
- * (OSD_APAGE_OBJECT_INFORMATION)
- */
-enum {
- OSD_ATTR_OI_PARTITION_ID = 0x1, /* 8 */
- OSD_ATTR_OI_OBJECT_ID = 0x2, /* 8 */
- OSD_ATTR_OI_USERNAME = 0x9, /* variable */
- OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */
- OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */
- SD_ATTR_OI_ACTUAL_DATA_SPACE = 0XD1, /* 0 OR 8 */
- SD_ATTR_OI_RESERVED_DATA_SPACE = 0XD2, /* 0 OR 8 */
-};
-/* Object Information attributes page does not have a get_page structure */
-
-/* 7.1.2.12 Root Quotas attributes page (OSD_APAGE_ROOT_QUOTAS) */
-enum {
- OSD_ATTR_RQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
- OSD_ATTR_RQ_PARTITION_CAPACITY_QUOTA = 0x10001, /* 8 */
- OSD_ATTR_RQ_PARTITION_OBJECT_COUNT = 0x10002, /* 8 */
- OSD_ATTR_RQ_PARTITION_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
- OSD_ATTR_RQ_PARTITION_COUNT = 0x20002, /* 8 */
-};
-
-struct Root_Quotas_attributes_page {
- struct osd_attr_page_header hdr; /* id=R+2, size=0x24 */
- __be64 default_maximum_user_object_length;
- __be64 partition_capacity_quota;
- __be64 partition_object_count;
- __be64 partition_collections_per_user_object;
- __be64 partition_count;
-} __packed;
-
-/* 7.1.2.13 Partition Quotas attributes page (OSD_APAGE_PARTITION_QUOTAS)*/
-enum {
- OSD_ATTR_PQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
- OSD_ATTR_PQ_CAPACITY_QUOTA = 0x10001, /* 8 */
- OSD_ATTR_PQ_OBJECT_COUNT = 0x10002, /* 8 */
- OSD_ATTR_PQ_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
-};
-
-struct Partition_Quotas_attributes_page {
- struct osd_attr_page_header hdr; /* id=P+2, size=0x1C */
- __be64 default_maximum_user_object_length;
- __be64 capacity_quota;
- __be64 object_count;
- __be64 collections_per_user_object;
-} __packed;
-
-/* 7.1.2.14 User Object Quotas attributes page (OSD_APAGE_OBJECT_QUOTAS) */
-enum {
- OSD_ATTR_OQ_MAXIMUM_LENGTH = 0x1, /* 8 */
-};
-
-struct Object_Quotas_attributes_page {
- struct osd_attr_page_header hdr; /* id=U+2, size=0x8 */
- __be64 maximum_length;
-} __packed;
-
-/* 7.1.2.15 Root Timestamps attributes page (OSD_APAGE_ROOT_TIMESTAMP) */
-enum {
- OSD_ATTR_RT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
- OSD_ATTR_RT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
- OSD_ATTR_RT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
-};
-
-struct root_timestamps_attributes_page {
- struct osd_attr_page_header hdr; /* id=R+3, size=0xD */
- struct osd_timestamp attributes_accessed_time;
- struct osd_timestamp attributes_modified_time;
- u8 timestamp_bypass;
-} __packed;
-
-/* 7.1.2.16 Partition Timestamps attributes page
- * (OSD_APAGE_PARTITION_TIMESTAMP)
- */
-enum {
- OSD_ATTR_PT_CREATED_TIME = 0x1, /* 6 */
- OSD_ATTR_PT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
- OSD_ATTR_PT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
- OSD_ATTR_PT_DATA_ACCESSED_TIME = 0x4, /* 6 */
- OSD_ATTR_PT_DATA_MODIFIED_TIME = 0x5, /* 6 */
- OSD_ATTR_PT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
-};
-
-struct partition_timestamps_attributes_page {
- struct osd_attr_page_header hdr; /* id=P+3, size=0x1F */
- struct osd_timestamp created_time;
- struct osd_timestamp attributes_accessed_time;
- struct osd_timestamp attributes_modified_time;
- struct osd_timestamp data_accessed_time;
- struct osd_timestamp data_modified_time;
- u8 timestamp_bypass;
-} __packed;
-
-/* 7.1.2.17/18 Collection/Object Timestamps attributes page
- * (OSD_APAGE_COLLECTION_TIMESTAMP/OSD_APAGE_OBJECT_TIMESTAMP)
- */
-enum {
- OSD_ATTR_OT_CREATED_TIME = 0x1, /* 6 */
- OSD_ATTR_OT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
- OSD_ATTR_OT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
- OSD_ATTR_OT_DATA_ACCESSED_TIME = 0x4, /* 6 */
- OSD_ATTR_OT_DATA_MODIFIED_TIME = 0x5, /* 6 */
-};
-
-/* same for collection */
-struct object_timestamps_attributes_page {
- struct osd_attr_page_header hdr; /* id=C+3/3, size=0x1E */
- struct osd_timestamp created_time;
- struct osd_timestamp attributes_accessed_time;
- struct osd_timestamp attributes_modified_time;
- struct osd_timestamp data_accessed_time;
- struct osd_timestamp data_modified_time;
-} __packed;
-
-/* OSD2r05: 7.1.3.19 Attributes Access attributes page
- * (OSD_APAGE_PARTITION_ATTR_ACCESS)
- *
- * each attribute is of the form below. Total array length is deduced
- * from the attribute's length
- * (See allowed_attributes_access of the struct osd_cap_object_descriptor)
- */
-struct attributes_access_attr {
- struct osd_attributes_list_attrid attr_list[0];
-} __packed;
-
-/* OSD2r05: 7.1.2.21 Collections attributes page */
-/* TBD */
-
-/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */
-enum {
- OSD_ATTR_RS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
- OSD_ATTR_RS_OLDEST_VALID_NONCE_LIMIT = 0x2, /* 6 */
- OSD_ATTR_RS_NEWEST_VALID_NONCE_LIMIT = 0x3, /* 6 */
- OSD_ATTR_RS_PARTITION_DEFAULT_SECURITY_METHOD = 0x6, /* 1 */
- OSD_ATTR_RS_SUPPORTED_SECURITY_METHODS = 0x7, /* 2 */
- OSD_ATTR_RS_ADJUSTABLE_CLOCK = 0x9, /* 6 */
- OSD_ATTR_RS_MASTER_KEY_IDENTIFIER = 0x7FFD, /* 0 or 7 */
- OSD_ATTR_RS_ROOT_KEY_IDENTIFIER = 0x7FFE, /* 0 or 7 */
- OSD_ATTR_RS_SUPPORTED_INTEGRITY_ALGORITHM_0 = 0x80000000,/* 1,(x16)*/
- OSD_ATTR_RS_SUPPORTED_DH_GROUP_0 = 0x80000010,/* 1,(x16)*/
-};
-
-struct root_security_attributes_page {
- struct osd_attr_page_header hdr; /* id=R+5, size=0x3F */
- u8 default_security_method;
- u8 partition_default_security_method;
- __be16 supported_security_methods;
- u8 mki_valid_rki_valid;
- struct osd_timestamp oldest_valid_nonce_limit;
- struct osd_timestamp newest_valid_nonce_limit;
- struct osd_timestamp adjustable_clock;
- u8 master_key_identifier[32-25];
- u8 root_key_identifier[39-32];
- u8 supported_integrity_algorithm[16];
- u8 supported_dh_group[16];
-} __packed;
-
-/* 7.1.2.21 Partition Policy/Security attributes page
- * (OSD_APAGE_PARTITION_SECURITY)
- */
-enum {
- OSD_ATTR_PS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
- OSD_ATTR_PS_OLDEST_VALID_NONCE = 0x2, /* 6 */
- OSD_ATTR_PS_NEWEST_VALID_NONCE = 0x3, /* 6 */
- OSD_ATTR_PS_REQUEST_NONCE_LIST_DEPTH = 0x4, /* 2 */
- OSD_ATTR_PS_FROZEN_WORKING_KEY_BIT_MASK = 0x5, /* 2 */
- OSD_ATTR_PS_PARTITION_KEY_IDENTIFIER = 0x7FFF, /* 0 or 7 */
- OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_FIRST = 0x8000, /* 0 or 7 */
- OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_LAST = 0x800F, /* 0 or 7 */
- OSD_ATTR_PS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
- OSD_ATTR_PS_USER_OBJECT_POLICY_ACCESS_TAG = 0x40000002, /* 4 */
-};
-
-struct partition_security_attributes_page {
- struct osd_attr_page_header hdr; /* id=p+5, size=0x8f */
- u8 reserved[3];
- u8 default_security_method;
- struct osd_timestamp oldest_valid_nonce;
- struct osd_timestamp newest_valid_nonce;
- __be16 request_nonce_list_depth;
- __be16 frozen_working_key_bit_mask;
- __be32 policy_access_tag;
- __be32 user_object_policy_access_tag;
- u8 pki_valid;
- __be16 wki_00_0f_vld;
- struct osd_key_identifier partition_key_identifier;
- struct osd_key_identifier working_key_identifiers[16];
-} __packed;
-
-/* 7.1.2.22/23 Collection/Object Policy-Security attributes page
- * (OSD_APAGE_COLLECTION_SECURITY/OSD_APAGE_OBJECT_SECURITY)
- */
-enum {
- OSD_ATTR_OS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
-};
-
-struct object_security_attributes_page {
- struct osd_attr_page_header hdr; /* id=C+5/5, size=4 */
- __be32 policy_access_tag;
-} __packed;
-
-/* OSD2r05: 7.1.3.31 Current Command attributes page
- * (OSD_APAGE_CURRENT_COMMAND)
- */
-enum {
- OSD_ATTR_CC_RESPONSE_INTEGRITY_CHECK_VALUE = 0x1, /* 32 */
- OSD_ATTR_CC_OBJECT_TYPE = 0x2, /* 1 */
- OSD_ATTR_CC_PARTITION_ID = 0x3, /* 8 */
- OSD_ATTR_CC_OBJECT_ID = 0x4, /* 8 */
- OSD_ATTR_CC_STARTING_BYTE_ADDRESS_OF_APPEND = 0x5, /* 8 */
- OSD_ATTR_CC_CHANGE_IN_USED_CAPACITY = 0x6, /* 8 */
-};
-
-/*TBD: osdv1_current_command_attributes_page */
-
-struct osdv2_current_command_attributes_page {
- struct osd_attr_page_header hdr; /* id=0xFFFFFFFE, size=0x44 */
- u8 response_integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
- u8 object_type;
- u8 reserved[3];
- __be64 partition_id;
- __be64 object_id;
- __be64 starting_byte_address_of_append;
- __be64 change_in_used_capacity;
-};
-
-#endif /*ndef __OSD_ATTRIBUTES_H__*/
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
deleted file mode 100644
index 86a569d008b2..000000000000
--- a/include/scsi/osd_initiator.h
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * osd_initiator.h - OSD initiator API definition
- *
- * Copyright (C) 2008 Panasas Inc. All rights reserved.
- *
- * Authors:
- * Boaz Harrosh <ooo@electrozaur.com>
- * Benny Halevy <bhalevy@panasas.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- *
- */
-#ifndef __OSD_INITIATOR_H__
-#define __OSD_INITIATOR_H__
-
-#include <scsi/osd_protocol.h>
-#include <scsi/osd_types.h>
-
-#include <linux/blkdev.h>
-#include <scsi/scsi_device.h>
-
-/* Note: "NI" in comments below means "Not Implemented yet" */
-
-/* Configure of code:
- * #undef if you *don't* want OSD v1 support in runtime.
- * If #defined the initiator will dynamically configure to encode OSD v1
- * CDB's if the target is detected to be OSD v1 only.
- * OSD v2 only commands, options, and attributes will be ignored if target
- * is v1 only.
- * If #defined will result in bigger/slower code (OK Slower maybe not)
- * Q: Should this be CONFIG_SCSI_OSD_VER1_SUPPORT and set from Kconfig?
- */
-#define OSD_VER1_SUPPORT y
-
-enum osd_std_version {
- OSD_VER_NONE = 0,
- OSD_VER1 = 1,
- OSD_VER2 = 2,
-};
-
-/*
- * Object-based Storage Device.
- * This object represents an OSD device.
- * It is not a full linux device in any way. It is only
- * a place to hang resources associated with a Linux
- * request Q and some default properties.
- */
-struct osd_dev {
- struct scsi_device *scsi_device;
- unsigned def_timeout;
-
-#ifdef OSD_VER1_SUPPORT
- enum osd_std_version version;
-#endif
-};
-
-/* Unique Identification of an OSD device */
-struct osd_dev_info {
- unsigned systemid_len;
- u8 systemid[OSD_SYSTEMID_LEN];
- unsigned osdname_len;
- u8 *osdname;
-};
-
-/* Retrieve/return osd_dev(s) for use by Kernel clients
- * Use IS_ERR/ERR_PTR on returned "osd_dev *".
- */
-struct osd_dev *osduld_path_lookup(const char *dev_name);
-struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi);
-void osduld_put_device(struct osd_dev *od);
-
-const struct osd_dev_info *osduld_device_info(struct osd_dev *od);
-bool osduld_device_same(struct osd_dev *od, const struct osd_dev_info *odi);
-
-/* Add/remove test ioctls from external modules */
-typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg);
-int osduld_register_test(unsigned ioctl, do_test_fn *do_test);
-void osduld_unregister_test(unsigned ioctl);
-
-/* These are called by uld at probe time */
-void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device);
-void osd_dev_fini(struct osd_dev *od);
-
-/**
- * osd_auto_detect_ver - Detect the OSD version, return Unique Identification
- *
- * @od: OSD target lun handle
- * @caps: Capabilities authorizing OSD root read attributes access
- * @odi: Retrieved information uniquely identifying the osd target lun
- * Note: odi->osdname must be kfreed by caller.
- *
- * Auto detects the OSD version of the OSD target and sets the @od
- * accordingly. Meanwhile also returns the "system id" and "osd name" root
- * attributes which uniquely identify the OSD target. This member is usually
- * called by the ULD. ULD users should call osduld_device_info().
- * This rutine allocates osd requests and memory at GFP_KERNEL level and might
- * sleep.
- */
-int osd_auto_detect_ver(struct osd_dev *od,
- void *caps, struct osd_dev_info *odi);
-
-static inline struct request_queue *osd_request_queue(struct osd_dev *od)
-{
- return od->scsi_device->request_queue;
-}
-
-/* we might want to use function vector in the future */
-static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
-{
-#ifdef OSD_VER1_SUPPORT
- od->version = v;
-#endif
-}
-
-static inline bool osd_dev_is_ver1(struct osd_dev *od)
-{
-#ifdef OSD_VER1_SUPPORT
- return od->version == OSD_VER1;
-#else
- return false;
-#endif
-}
-
-struct osd_request;
-typedef void (osd_req_done_fn)(struct osd_request *or, void *private);
-
-struct osd_request {
- struct osd_cdb cdb;
- struct osd_data_out_integrity_info out_data_integ;
- struct osd_data_in_integrity_info in_data_integ;
-
- struct osd_dev *osd_dev;
- struct request *request;
-
- struct _osd_req_data_segment {
- void *buff;
- unsigned alloc_size; /* 0 here means: don't call kfree */
- unsigned total_bytes;
- } cdb_cont, set_attr, enc_get_attr, get_attr;
-
- struct _osd_io_info {
- struct bio *bio;
- u64 total_bytes;
- u64 residual;
- struct request *req;
- struct _osd_req_data_segment *last_seg;
- u8 *pad_buff;
- } out, in;
-
- unsigned timeout;
- unsigned retries;
- unsigned sense_len;
- u8 sense[OSD_MAX_SENSE_LEN];
- enum osd_attributes_mode attributes_mode;
-
- osd_req_done_fn *async_done;
- void *async_private;
- blk_status_t async_error;
- int req_errors;
-};
-
-static inline bool osd_req_is_ver1(struct osd_request *or)
-{
- return osd_dev_is_ver1(or->osd_dev);
-}
-
-/*
- * How to use the osd library:
- *
- * osd_start_request
- * Allocates a request.
- *
- * osd_req_*
- * Call one of, to encode the desired operation.
- *
- * osd_add_{get,set}_attr
- * Optionally add attributes to the CDB, list or page mode.
- *
- * osd_finalize_request
- * Computes final data out/in offsets and signs the request,
- * making it ready for execution.
- *
- * osd_execute_request
- * May be called to execute it through the block layer. Other wise submit
- * the associated block request in some other way.
- *
- * After execution:
- * osd_req_decode_sense
- * Decodes sense information to verify execution results.
- *
- * osd_req_decode_get_attr
- * Retrieve osd_add_get_attr_list() values if used.
- *
- * osd_end_request
- * Must be called to deallocate the request.
- */
-
-/**
- * osd_start_request - Allocate and initialize an osd_request
- *
- * @osd_dev: OSD device that holds the scsi-device and default values
- * that the request is associated with.
- *
- * Allocate osd_request and initialize all members to the
- * default/initial state.
- */
-struct osd_request *osd_start_request(struct osd_dev *od);
-
-enum osd_req_options {
- OSD_REQ_FUA = 0x08, /* Force Unit Access */
- OSD_REQ_DPO = 0x10, /* Disable Page Out */
-
- OSD_REQ_BYPASS_TIMESTAMPS = 0x80,
-};
-
-/**
- * osd_finalize_request - Sign request and prepare request for execution
- *
- * @or: osd_request to prepare
- * @options: combination of osd_req_options bit flags or 0.
- * @cap: A Pointer to an OSD_CAP_LEN bytes buffer that is received from
- * The security manager as capabilities for this cdb.
- * @cap_key: The cryptographic key used to sign the cdb/data. Can be null
- * if NOSEC is used.
- *
- * The actual request and bios are only allocated here, so are the get_attr
- * buffers that will receive the returned attributes. Copy's @cap to cdb.
- * Sign the cdb/data with @cap_key.
- */
-int osd_finalize_request(struct osd_request *or,
- u8 options, const void *cap, const u8 *cap_key);
-
-/**
- * osd_execute_request - Execute the request synchronously through block-layer
- *
- * @or: osd_request to Executed
- *
- * Calls blk_execute_rq to q the command and waits for completion.
- */
-int osd_execute_request(struct osd_request *or);
-
-/**
- * osd_execute_request_async - Execute the request without waitting.
- *
- * @or: - osd_request to Executed
- * @done: (Optional) - Called at end of execution
- * @private: - Will be passed to @done function
- *
- * Calls blk_execute_rq_nowait to queue the command. When execution is done
- * optionally calls @done with @private as parameter. @or->async_error will
- * have the return code
- */
-int osd_execute_request_async(struct osd_request *or,
- osd_req_done_fn *done, void *private);
-
-/**
- * osd_req_decode_sense_full - Decode sense information after execution.
- *
- * @or: - osd_request to examine
- * @osi - Receives a more detailed error report information (optional).
- * @silent - Do not print to dmsg (Even if enabled)
- * @bad_obj_list - Some commands act on multiple objects. Failed objects will
- * be received here (optional)
- * @max_obj - Size of @bad_obj_list.
- * @bad_attr_list - List of failing attributes (optional)
- * @max_attr - Size of @bad_attr_list.
- *
- * After execution, osd_request results are analyzed using this function. The
- * return code is the final disposition on the error. So it is possible that a
- * CHECK_CONDITION was returned from target but this will return NO_ERROR, for
- * example on recovered errors. All parameters are optional if caller does
- * not need any returned information.
- * Note: This function will also dump the error to dmsg according to settings
- * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the
- * command would routinely fail, to not spam the dmsg file.
- */
-
-/**
- * osd_err_priority - osd categorized return codes in ascending severity.
- *
- * The categories are borrowed from the pnfs_osd_errno enum.
- * See comments for translated Linux codes returned by osd_req_decode_sense.
- */
-enum osd_err_priority {
- OSD_ERR_PRI_NO_ERROR = 0,
- /* Recoverable, caller should clear_highpage() all pages */
- OSD_ERR_PRI_CLEAR_PAGES = 1, /* -EFAULT */
- OSD_ERR_PRI_RESOURCE = 2, /* -ENOMEM */
- OSD_ERR_PRI_BAD_CRED = 3, /* -EINVAL */
- OSD_ERR_PRI_NO_ACCESS = 4, /* -EACCES */
- OSD_ERR_PRI_UNREACHABLE = 5, /* any other */
- OSD_ERR_PRI_NOT_FOUND = 6, /* -ENOENT */
- OSD_ERR_PRI_NO_SPACE = 7, /* -ENOSPC */
- OSD_ERR_PRI_EIO = 8, /* -EIO */
-};
-
-struct osd_sense_info {
- enum osd_err_priority osd_err_pri;
-
- int key; /* one of enum scsi_sense_keys */
- int additional_code ; /* enum osd_additional_sense_codes */
- union { /* Sense specific information */
- u16 sense_info;
- u16 cdb_field_offset; /* scsi_invalid_field_in_cdb */
- };
- union { /* Command specific information */
- u64 command_info;
- };
-
- u32 not_initiated_command_functions; /* osd_command_functions_bits */
- u32 completed_command_functions; /* osd_command_functions_bits */
- struct osd_obj_id obj;
- struct osd_attr attr;
-};
-
-int osd_req_decode_sense_full(struct osd_request *or,
- struct osd_sense_info *osi, bool silent,
- struct osd_obj_id *bad_obj_list, int max_obj,
- struct osd_attr *bad_attr_list, int max_attr);
-
-static inline int osd_req_decode_sense(struct osd_request *or,
- struct osd_sense_info *osi)
-{
- return osd_req_decode_sense_full(or, osi, false, NULL, 0, NULL, 0);
-}
-
-/**
- * osd_end_request - return osd_request to free store
- *
- * @or: osd_request to free
- *
- * Deallocate all osd_request resources (struct req's, BIOs, buffers, etc.)
- */
-void osd_end_request(struct osd_request *or);
-
-/*
- * CDB Encoding
- *
- * Note: call only one of the following methods.
- */
-
-/*
- * Device commands
- */
-void osd_req_set_master_seed_xchg(struct osd_request *or, ...);/* NI */
-void osd_req_set_master_key(struct osd_request *or, ...);/* NI */
-
-void osd_req_format(struct osd_request *or, u64 tot_capacity);
-
-/* list all partitions
- * @list header must be initialized to zero on first run.
- *
- * Call osd_is_obj_list_done() to find if we got the complete list.
- */
-int osd_req_list_dev_partitions(struct osd_request *or,
- osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem);
-
-void osd_req_flush_obsd(struct osd_request *or,
- enum osd_options_flush_scope_values);
-
-void osd_req_perform_scsi_command(struct osd_request *or,
- const u8 *cdb, ...);/* NI */
-void osd_req_task_management(struct osd_request *or, ...);/* NI */
-
-/*
- * Partition commands
- */
-void osd_req_create_partition(struct osd_request *or, osd_id partition);
-void osd_req_remove_partition(struct osd_request *or, osd_id partition);
-
-void osd_req_set_partition_key(struct osd_request *or,
- osd_id partition, u8 new_key_id[OSD_CRYPTO_KEYID_SIZE],
- u8 seed[OSD_CRYPTO_SEED_SIZE]);/* NI */
-
-/* list all collections in the partition
- * @list header must be init to zero on first run.
- *
- * Call osd_is_obj_list_done() to find if we got the complete list.
- */
-int osd_req_list_partition_collections(struct osd_request *or,
- osd_id partition, osd_id initial_id, struct osd_obj_id_list *list,
- unsigned nelem);
-
-/* list all objects in the partition
- * @list header must be init to zero on first run.
- *
- * Call osd_is_obj_list_done() to find if we got the complete list.
- */
-int osd_req_list_partition_objects(struct osd_request *or,
- osd_id partition, osd_id initial_id, struct osd_obj_id_list *list,
- unsigned nelem);
-
-void osd_req_flush_partition(struct osd_request *or,
- osd_id partition, enum osd_options_flush_scope_values);
-
-/*
- * Collection commands
- */
-void osd_req_create_collection(struct osd_request *or,
- const struct osd_obj_id *);/* NI */
-void osd_req_remove_collection(struct osd_request *or,
- const struct osd_obj_id *);/* NI */
-
-/* list all objects in the collection */
-int osd_req_list_collection_objects(struct osd_request *or,
- const struct osd_obj_id *, osd_id initial_id,
- struct osd_obj_id_list *list, unsigned nelem);
-
-/* V2 only filtered list of objects in the collection */
-void osd_req_query(struct osd_request *or, ...);/* NI */
-
-void osd_req_flush_collection(struct osd_request *or,
- const struct osd_obj_id *, enum osd_options_flush_scope_values);
-
-void osd_req_get_member_attrs(struct osd_request *or, ...);/* V2-only NI */
-void osd_req_set_member_attrs(struct osd_request *or, ...);/* V2-only NI */
-
-/*
- * Object commands
- */
-void osd_req_create_object(struct osd_request *or, struct osd_obj_id *);
-void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *);
-
-void osd_req_write(struct osd_request *or,
- const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len);
-int osd_req_write_kern(struct osd_request *or,
- const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
-void osd_req_append(struct osd_request *or,
- const struct osd_obj_id *, struct bio *data_out);/* NI */
-void osd_req_create_write(struct osd_request *or,
- const struct osd_obj_id *, struct bio *data_out, u64 offset);/* NI */
-void osd_req_clear(struct osd_request *or,
- const struct osd_obj_id *, u64 offset, u64 len);/* NI */
-void osd_req_punch(struct osd_request *or,
- const struct osd_obj_id *, u64 offset, u64 len);/* V2-only NI */
-
-void osd_req_flush_object(struct osd_request *or,
- const struct osd_obj_id *, enum osd_options_flush_scope_values,
- /*V2*/ u64 offset, /*V2*/ u64 len);
-
-void osd_req_read(struct osd_request *or,
- const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len);
-int osd_req_read_kern(struct osd_request *or,
- const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
-
-/* Scatter/Gather write/read commands */
-int osd_req_write_sg(struct osd_request *or,
- const struct osd_obj_id *obj, struct bio *bio,
- const struct osd_sg_entry *sglist, unsigned numentries);
-int osd_req_read_sg(struct osd_request *or,
- const struct osd_obj_id *obj, struct bio *bio,
- const struct osd_sg_entry *sglist, unsigned numentries);
-int osd_req_write_sg_kern(struct osd_request *or,
- const struct osd_obj_id *obj, void **buff,
- const struct osd_sg_entry *sglist, unsigned numentries);
-int osd_req_read_sg_kern(struct osd_request *or,
- const struct osd_obj_id *obj, void **buff,
- const struct osd_sg_entry *sglist, unsigned numentries);
-
-/*
- * Root/Partition/Collection/Object Attributes commands
- */
-
-/* get before set */
-void osd_req_get_attributes(struct osd_request *or, const struct osd_obj_id *);
-
-/* set before get */
-void osd_req_set_attributes(struct osd_request *or, const struct osd_obj_id *);
-
-/*
- * Attributes appended to most commands
- */
-
-/* Attributes List mode (or V2 CDB) */
- /*
- * TODO: In ver2 if at finalize time only one attr was set and no gets,
- * then the Attributes CDB mode is used automatically to save IO.
- */
-
-/* set a list of attributes. */
-int osd_req_add_set_attr_list(struct osd_request *or,
- const struct osd_attr *, unsigned nelem);
-
-/* get a list of attributes */
-int osd_req_add_get_attr_list(struct osd_request *or,
- const struct osd_attr *, unsigned nelem);
-
-/*
- * Attributes list decoding
- * Must be called after osd_request.request was executed
- * It is called in a loop to decode the returned get_attr
- * (see osd_add_get_attr)
- */
-int osd_req_decode_get_attr_list(struct osd_request *or,
- struct osd_attr *, int *nelem, void **iterator);
-
-/* Attributes Page mode */
-
-/*
- * Read an attribute page and optionally set one attribute
- *
- * Retrieves the attribute page directly to a user buffer.
- * @attr_page_data shall stay valid until end of execution.
- * See osd_attributes.h for common page structures
- */
-int osd_req_add_get_attr_page(struct osd_request *or,
- u32 page_id, void *attr_page_data, unsigned max_page_len,
- const struct osd_attr *set_one);
-
-#endif /* __OSD_LIB_H__ */
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
deleted file mode 100644
index 7a8d2cd30328..000000000000
--- a/include/scsi/osd_ore.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2011
- * Boaz Harrosh <ooo@electrozaur.com>
- *
- * Public Declarations of the ORE API
- *
- * This file is part of the ORE (Object Raid Engine) library.
- *
- * ORE is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation. (GPL v2)
- *
- * ORE is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with the ORE; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef __ORE_H__
-#define __ORE_H__
-
-#include <scsi/osd_initiator.h>
-#include <scsi/osd_attributes.h>
-#include <scsi/osd_sec.h>
-#include <linux/pnfs_osd_xdr.h>
-#include <linux/bug.h>
-
-struct ore_comp {
- struct osd_obj_id obj;
- u8 cred[OSD_CAP_LEN];
-};
-
-struct ore_layout {
- /* Our way of looking at the data_map */
- enum pnfs_osd_raid_algorithm4
- raid_algorithm;
- unsigned stripe_unit;
- unsigned mirrors_p1;
-
- unsigned group_width;
- unsigned parity;
- u64 group_depth;
- unsigned group_count;
-
- /* Cached often needed calculations filled in by
- * ore_verify_layout
- */
- unsigned long max_io_length; /* Max length that should be passed to
- * ore_get_rw_state
- */
-};
-
-struct ore_dev {
- struct osd_dev *od;
-};
-
-struct ore_components {
- unsigned first_dev; /* First logical device no */
- unsigned numdevs; /* Num of devices in array */
- /* If @single_comp == EC_SINGLE_COMP, @comps points to a single
- * component. else there are @numdevs components
- */
- enum EC_COMP_USAGE {
- EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
- } single_comp;
- struct ore_comp *comps;
-
- /* Array of pointers to ore_dev-* . User will usually have these pointed
- * too a bigger struct which contain an "ore_dev ored" member and use
- * container_of(oc->ods[i], struct foo_dev, ored) to access the bigger
- * structure.
- */
- struct ore_dev **ods;
-};
-
-/* ore_comp_dev Recievies a logical device index */
-static inline struct osd_dev *ore_comp_dev(
- const struct ore_components *oc, unsigned i)
-{
- BUG_ON((i < oc->first_dev) || (oc->first_dev + oc->numdevs <= i));
- return oc->ods[i - oc->first_dev]->od;
-}
-
-static inline void ore_comp_set_dev(
- struct ore_components *oc, unsigned i, struct osd_dev *od)
-{
- oc->ods[i - oc->first_dev]->od = od;
-}
-
-struct ore_striping_info {
- u64 offset;
- u64 obj_offset;
- u64 length;
- u64 first_stripe_start; /* only used in raid writes */
- u64 M; /* for truncate */
- unsigned bytes_in_stripe;
- unsigned dev;
- unsigned par_dev;
- unsigned unit_off;
- unsigned cur_pg;
- unsigned cur_comp;
- unsigned maxdevUnits;
-};
-
-struct ore_io_state;
-typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private);
-struct _ore_r4w_op {
- /* @Priv given here is passed ios->private */
- struct page * (*get_page)(void *priv, u64 page_index, bool *uptodate);
- void (*put_page)(void *priv, struct page *page);
-};
-
-struct ore_io_state {
- struct kref kref;
- struct ore_striping_info si;
-
- void *private;
- ore_io_done_fn done;
-
- struct ore_layout *layout;
- struct ore_components *oc;
-
- /* Global read/write IO*/
- loff_t offset;
- unsigned long length;
- void *kern_buff;
-
- struct page **pages;
- unsigned nr_pages;
- unsigned pgbase;
- unsigned pages_consumed;
-
- /* Attributes */
- unsigned in_attr_len;
- struct osd_attr *in_attr;
- unsigned out_attr_len;
- struct osd_attr *out_attr;
-
- bool reading;
-
- /* House keeping of Parity pages */
- bool extra_part_alloc;
- struct page **parity_pages;
- unsigned max_par_pages;
- unsigned cur_par_page;
- unsigned sgs_per_dev;
- struct __stripe_pages_2d *sp2d;
- struct ore_io_state *ios_read_4_write;
- const struct _ore_r4w_op *r4w;
-
- /* Variable array of size numdevs */
- unsigned numdevs;
- struct ore_per_dev_state {
- struct osd_request *or;
- struct bio *bio;
- loff_t offset;
- unsigned length;
- unsigned last_sgs_total;
- unsigned dev;
- struct osd_sg_entry *sglist;
- unsigned cur_sg;
- } per_dev[];
-};
-
-static inline unsigned ore_io_state_size(unsigned numdevs)
-{
- return sizeof(struct ore_io_state) +
- sizeof(struct ore_per_dev_state) * numdevs;
-}
-
-/* ore.c */
-int ore_verify_layout(unsigned total_comps, struct ore_layout *layout);
-void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset,
- u64 length, struct ore_striping_info *si);
-int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
- bool is_reading, u64 offset, u64 length,
- struct ore_io_state **ios);
-int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
- struct ore_io_state **ios);
-void ore_put_io_state(struct ore_io_state *ios);
-
-typedef void (*ore_on_dev_error)(struct ore_io_state *ios, struct ore_dev *od,
- unsigned dev_index, enum osd_err_priority oep,
- u64 dev_offset, u64 dev_len);
-int ore_check_io(struct ore_io_state *ios, ore_on_dev_error rep);
-
-int ore_create(struct ore_io_state *ios);
-int ore_remove(struct ore_io_state *ios);
-int ore_write(struct ore_io_state *ios);
-int ore_read(struct ore_io_state *ios);
-int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
- u64 size);
-
-int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr);
-
-extern const struct osd_attr g_attr_logical_length;
-
-#endif
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
deleted file mode 100644
index e0ca835e7bf7..000000000000
--- a/include/scsi/osd_protocol.h
+++ /dev/null
@@ -1,676 +0,0 @@
-/*
- * osd_protocol.h - OSD T10 standard C definitions.
- *
- * Copyright (C) 2008 Panasas Inc. All rights reserved.
- *
- * Authors:
- * Boaz Harrosh <ooo@electrozaur.com>
- * Benny Halevy <bhalevy@panasas.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- *
- * This file contains types and constants that are defined by the protocol
- * Note: All names and symbols are taken from the OSD standard's text.
- */
-#ifndef __OSD_PROTOCOL_H__
-#define __OSD_PROTOCOL_H__
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <asm/unaligned.h>
-#include <scsi/scsi.h>
-
-enum {
- OSDv1_ADDITIONAL_CDB_LENGTH = 192,
- OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
- OSDv1_CAP_LEN = 80,
-
- /* Latest supported version */
- OSDv2_ADDITIONAL_CDB_LENGTH = 228,
- OSD_ADDITIONAL_CDB_LENGTH =
- OSDv2_ADDITIONAL_CDB_LENGTH,
- OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
- OSD_CAP_LEN = 104,
-
- OSD_SYSTEMID_LEN = 20,
- OSDv1_CRYPTO_KEYID_SIZE = 20,
- OSDv2_CRYPTO_KEYID_SIZE = 32,
- OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
- OSD_CRYPTO_SEED_SIZE = 4,
- OSD_CRYPTO_NONCE_SIZE = 12,
- OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
-
- OSD_PARTITION_FIRST_ID = 0x10000,
- OSD_OBJECT_FIRST_ID = 0x10000,
-};
-
-/* (osd-r10 5.2.4)
- * osd2r03: 5.2.3 Caching control bits
- */
-enum osd_options_byte {
- OSD_CDB_FUA = 0x08, /* Force Unit Access */
- OSD_CDB_DPO = 0x10, /* Disable Page Out */
-};
-
-/*
- * osd2r03: 5.2.5 Isolation.
- * First 3 bits, V2-only.
- * Also for attr 110h "default isolation method" at Root Information page
- */
-enum osd_options_byte_isolation {
- OSD_ISOLATION_DEFAULT = 0,
- OSD_ISOLATION_NONE = 1,
- OSD_ISOLATION_STRICT = 2,
- OSD_ISOLATION_RANGE = 4,
- OSD_ISOLATION_FUNCTIONAL = 5,
- OSD_ISOLATION_VENDOR = 7,
-};
-
-/* (osd-r10: 6.7)
- * osd2r03: 6.8 FLUSH, FLUSH COLLECTION, FLUSH OSD, FLUSH PARTITION
- */
-enum osd_options_flush_scope_values {
- OSD_CDB_FLUSH_ALL = 0,
- OSD_CDB_FLUSH_ATTR_ONLY = 1,
-
- OSD_CDB_FLUSH_ALL_RECURSIVE = 2,
- /* V2-only */
- OSD_CDB_FLUSH_ALL_RANGE = 2,
-};
-
-/* osd2r03: 5.2.10 Timestamps control */
-enum {
- OSD_CDB_NORMAL_TIMESTAMPS = 0,
- OSD_CDB_BYPASS_TIMESTAMPS = 0x7f,
-};
-
-/* (osd-r10: 5.2.2.1)
- * osd2r03: 5.2.4.1 Get and set attributes CDB format selection
- * 2 bits at second nibble of command_specific_options byte
- */
-enum osd_attributes_mode {
- /* V2-only */
- OSD_CDB_SET_ONE_ATTR = 0x10,
-
- OSD_CDB_GET_ATTR_PAGE_SET_ONE = 0x20,
- OSD_CDB_GET_SET_ATTR_LISTS = 0x30,
-
- OSD_CDB_GET_SET_ATTR_MASK = 0x30,
-};
-
-/* (osd-r10: 4.12.5)
- * osd2r03: 4.14.5 Data-In and Data-Out buffer offsets
- * byte offset = mantissa * (2^(exponent+8))
- * struct {
- * unsigned mantissa: 28;
- * int exponent: 04;
- * }
- */
-typedef __be32 osd_cdb_offset;
-
-enum {
- OSD_OFFSET_UNUSED = 0xFFFFFFFF,
- OSD_OFFSET_MAX_BITS = 28,
-
- OSDv1_OFFSET_MIN_SHIFT = 8,
- OSD_OFFSET_MIN_SHIFT = 3,
- OSD_OFFSET_MAX_SHIFT = 16,
-};
-
-/* Return the smallest allowed encoded offset that contains @offset.
- *
- * The actual encoded offset returned is @offset + *padding.
- * (up to max_shift, non-inclusive)
- */
-osd_cdb_offset __osd_encode_offset(u64 offset, unsigned *padding,
- int min_shift, int max_shift);
-
-/* Minimum alignment is 256 bytes
- * Note: Seems from std v1 that exponent can be from 0+8 to 0xE+8 (inclusive)
- * which is 8 to 23 but IBM code restricts it to 16, so be it.
- */
-static inline osd_cdb_offset osd_encode_offset_v1(u64 offset, unsigned *padding)
-{
- return __osd_encode_offset(offset, padding,
- OSDv1_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
-}
-
-/* Minimum 8 bytes alignment
- * Same as v1 but since exponent can be signed than a less than
- * 256 alignment can be reached with small offsets (<2GB)
- */
-static inline osd_cdb_offset osd_encode_offset_v2(u64 offset, unsigned *padding)
-{
- return __osd_encode_offset(offset, padding,
- OSD_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
-}
-
-/* osd2r03: 5.2.1 Overview */
-struct osd_cdb_head {
- struct scsi_varlen_cdb_hdr varlen_cdb;
-/*10*/ u8 options;
- u8 command_specific_options;
- u8 timestamp_control;
-/*13*/ u8 reserved1[3];
-/*16*/ __be64 partition;
-/*24*/ __be64 object;
-/*32*/ union { /* V1 vs V2 alignment differences */
- struct __osdv1_cdb_addr_len {
-/*32*/ __be32 list_identifier;/* Rarely used */
-/*36*/ __be64 length;
-/*44*/ __be64 start_address;
- } __packed v1;
-
- struct __osdv2_cdb_addr_len {
- /* called allocation_length in some commands */
-/*32*/ __be64 length;
-/*40*/ __be64 start_address;
- union {
-/*48*/ __be32 list_identifier;/* Rarely used */
- /* OSD2r05 5.2.5 CDB continuation length */
-/*48*/ __be32 cdb_continuation_length;
- };
- } __packed v2;
- };
-/*52*/ union { /* selected attributes mode Page/List/Single */
- struct osd_attributes_page_mode {
-/*52*/ __be32 get_attr_page;
-/*56*/ __be32 get_attr_alloc_length;
-/*60*/ osd_cdb_offset get_attr_offset;
-
-/*64*/ __be32 set_attr_page;
-/*68*/ __be32 set_attr_id;
-/*72*/ __be32 set_attr_length;
-/*76*/ osd_cdb_offset set_attr_offset;
-/*80*/ } __packed attrs_page;
-
- struct osd_attributes_list_mode {
-/*52*/ __be32 get_attr_desc_bytes;
-/*56*/ osd_cdb_offset get_attr_desc_offset;
-
-/*60*/ __be32 get_attr_alloc_length;
-/*64*/ osd_cdb_offset get_attr_offset;
-
-/*68*/ __be32 set_attr_bytes;
-/*72*/ osd_cdb_offset set_attr_offset;
- __be32 not_used;
-/*80*/ } __packed attrs_list;
-
- /* osd2r03:5.2.4.2 Set one attribute value using CDB fields */
- struct osd_attributes_cdb_mode {
-/*52*/ __be32 set_attr_page;
-/*56*/ __be32 set_attr_id;
-/*60*/ __be16 set_attr_len;
-/*62*/ u8 set_attr_val[18];
-/*80*/ } __packed attrs_cdb;
-/*52*/ u8 get_set_attributes_parameters[28];
- };
-} __packed;
-/*80*/
-
-/*160 v1*/
-struct osdv1_security_parameters {
-/*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE];
-/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
-/*192*/osd_cdb_offset data_in_integrity_check_offset;
-/*196*/osd_cdb_offset data_out_integrity_check_offset;
-} __packed;
-/*200 v1*/
-
-/*184 v2*/
-struct osdv2_security_parameters {
-/*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE];
-/*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
-/*228*/osd_cdb_offset data_in_integrity_check_offset;
-/*232*/osd_cdb_offset data_out_integrity_check_offset;
-} __packed;
-/*236 v2*/
-
-struct osd_security_parameters {
- union {
- struct osdv1_security_parameters v1;
- struct osdv2_security_parameters v2;
- };
-};
-
-struct osdv1_cdb {
- struct osd_cdb_head h;
- u8 caps[OSDv1_CAP_LEN];
- struct osdv1_security_parameters sec_params;
-} __packed;
-
-struct osdv2_cdb {
- struct osd_cdb_head h;
- u8 caps[OSD_CAP_LEN];
- struct osdv2_security_parameters sec_params;
-} __packed;
-
-struct osd_cdb {
- union {
- struct osdv1_cdb v1;
- struct osdv2_cdb v2;
- u8 buff[OSD_TOTAL_CDB_LEN];
- };
-} __packed;
-
-static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
-{
- return (struct osd_cdb_head *)ocdb->buff;
-}
-
-/* define both version actions
- * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
- */
-#define OSD_ACT___(Name, Num) \
- OSD_ACT_##Name = cpu_to_be16(0x8880 + Num), \
- OSDv1_ACT_##Name = cpu_to_be16(0x8800 + Num),
-
-/* V2 only actions */
-#define OSD_ACT_V2(Name, Num) \
- OSD_ACT_##Name = cpu_to_be16(0x8880 + Num),
-
-#define OSD_ACT_V1_V2(Name, Num1, Num2) \
- OSD_ACT_##Name = cpu_to_be16(Num2), \
- OSDv1_ACT_##Name = cpu_to_be16(Num1),
-
-enum osd_service_actions {
- OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
- OSD_ACT___(FORMAT_OSD, 0x01)
- OSD_ACT___(CREATE, 0x02)
- OSD_ACT___(LIST, 0x03)
- OSD_ACT_V2(PUNCH, 0x04)
- OSD_ACT___(READ, 0x05)
- OSD_ACT___(WRITE, 0x06)
- OSD_ACT___(APPEND, 0x07)
- OSD_ACT___(FLUSH, 0x08)
- OSD_ACT_V2(CLEAR, 0x09)
- OSD_ACT___(REMOVE, 0x0A)
- OSD_ACT___(CREATE_PARTITION, 0x0B)
- OSD_ACT___(REMOVE_PARTITION, 0x0C)
- OSD_ACT___(GET_ATTRIBUTES, 0x0E)
- OSD_ACT___(SET_ATTRIBUTES, 0x0F)
- OSD_ACT___(CREATE_AND_WRITE, 0x12)
- OSD_ACT___(CREATE_COLLECTION, 0x15)
- OSD_ACT___(REMOVE_COLLECTION, 0x16)
- OSD_ACT___(LIST_COLLECTION, 0x17)
- OSD_ACT___(SET_KEY, 0x18)
- OSD_ACT___(SET_MASTER_KEY, 0x19)
- OSD_ACT___(FLUSH_COLLECTION, 0x1A)
- OSD_ACT___(FLUSH_PARTITION, 0x1B)
- OSD_ACT___(FLUSH_OSD, 0x1C)
-
- OSD_ACT_V2(QUERY, 0x20)
- OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
- OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
- OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
-
- OSD_ACT_V2(CREATE_CLONE, 0x28)
- OSD_ACT_V2(CREATE_SNAPSHOT, 0x29)
- OSD_ACT_V2(DETACH_CLONE, 0x2A)
- OSD_ACT_V2(REFRESH_SNAPSHOT_CLONE, 0x2B)
- OSD_ACT_V2(RESTORE_PARTITION_FROM_SNAPSHOT, 0x2C)
-
- OSD_ACT_V2(READ_MAP, 0x31)
- OSD_ACT_V2(READ_MAPS_COMPARE, 0x32)
-
- OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
- OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
- /* 0x8F80 to 0x8FFF are Vendor specific */
-};
-
-/* osd2r03: 7.1.3.2 List entry format for retrieving attributes */
-struct osd_attributes_list_attrid {
- __be32 attr_page;
- __be32 attr_id;
-} __packed;
-
-/*
- * NOTE: v1: is not aligned.
- */
-struct osdv1_attributes_list_element {
- __be32 attr_page;
- __be32 attr_id;
- __be16 attr_bytes; /* valid bytes at attr_val without padding */
- u8 attr_val[0];
-} __packed;
-
-/*
- * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
- * for setting attributes
- * NOTE: v2 is 8-bytes aligned
- */
-struct osdv2_attributes_list_element {
- __be32 attr_page;
- __be32 attr_id;
- u8 reserved[6];
- __be16 attr_bytes; /* valid bytes at attr_val without padding */
- u8 attr_val[0];
-} __packed;
-
-enum {
- OSDv1_ATTRIBUTES_ELEM_ALIGN = 1,
- OSD_ATTRIBUTES_ELEM_ALIGN = 8,
-};
-
-enum {
- OSD_ATTR_LIST_ALL_PAGES = 0xFFFFFFFF,
- OSD_ATTR_LIST_ALL_IN_PAGE = 0xFFFFFFFF,
-};
-
-static inline unsigned osdv1_attr_list_elem_size(unsigned len)
-{
- return ALIGN(len + sizeof(struct osdv1_attributes_list_element),
- OSDv1_ATTRIBUTES_ELEM_ALIGN);
-}
-
-static inline unsigned osdv2_attr_list_elem_size(unsigned len)
-{
- return ALIGN(len + sizeof(struct osdv2_attributes_list_element),
- OSD_ATTRIBUTES_ELEM_ALIGN);
-}
-
-/*
- * osd2r03: 7.1.3 OSD attributes lists (Table 184) — List type values
- */
-enum osd_attr_list_types {
- OSD_ATTR_LIST_GET = 0x1, /* descriptors only */
- OSD_ATTR_LIST_SET_RETRIEVE = 0x9, /*descriptors/values variable-length*/
- OSD_V2_ATTR_LIST_MULTIPLE = 0xE, /* ver2, Multiple Objects lists*/
- OSD_V1_ATTR_LIST_CREATE_MULTIPLE = 0xF,/*ver1, used by create_multple*/
-};
-
-/* osd2r03: 7.1.3.4 Multi-object retrieved attributes format */
-struct osd_attributes_list_multi_header {
- __be64 object_id;
- u8 object_type; /* object_type enum below */
- u8 reserved[5];
- __be16 list_bytes;
- /* followed by struct osd_attributes_list_element's */
-};
-
-struct osdv1_attributes_list_header {
- u8 type; /* low 4-bit only */
- u8 pad;
- __be16 list_bytes; /* Initiator shall set to Zero. Only set by target */
- /*
- * type=9 followed by struct osd_attributes_list_element's
- * type=E followed by struct osd_attributes_list_multi_header's
- */
-} __packed;
-
-static inline unsigned osdv1_list_size(struct osdv1_attributes_list_header *h)
-{
- return be16_to_cpu(h->list_bytes);
-}
-
-struct osdv2_attributes_list_header {
- u8 type; /* lower 4-bits only */
- u8 pad[3];
-/*4*/ __be32 list_bytes; /* Initiator shall set to zero. Only set by target */
- /*
- * type=9 followed by struct osd_attributes_list_element's
- * type=E followed by struct osd_attributes_list_multi_header's
- */
-} __packed;
-
-static inline unsigned osdv2_list_size(struct osdv2_attributes_list_header *h)
-{
- return be32_to_cpu(h->list_bytes);
-}
-
-/* (osd-r10 6.13)
- * osd2r03: 6.15 LIST (Table 79) LIST command parameter data.
- * for root_lstchg below
- */
-enum {
- OSD_OBJ_ID_LIST_PAR = 0x1, /* V1-only. Not used in V2 */
- OSD_OBJ_ID_LIST_LSTCHG = 0x2,
-};
-
-/*
- * osd2r03: 6.15.2 LIST command parameter data
- * (Also for LIST COLLECTION)
- */
-struct osd_obj_id_list {
- __be64 list_bytes; /* bytes in list excluding list_bytes (-8) */
- __be64 continuation_id;
- __be32 list_identifier;
- u8 pad[3];
- u8 root_lstchg;
- __be64 object_ids[0];
-} __packed;
-
-static inline bool osd_is_obj_list_done(struct osd_obj_id_list *list,
- bool *is_changed)
-{
- *is_changed = (0 != (list->root_lstchg & OSD_OBJ_ID_LIST_LSTCHG));
- return 0 != list->continuation_id;
-}
-
-/*
- * osd2r03: 4.12.4.5 The ALLDATA security method
- */
-struct osd_data_out_integrity_info {
- __be64 data_bytes;
- __be64 set_attributes_bytes;
- __be64 get_attributes_bytes;
- __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
-} __packed;
-
-/* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference
- * Is the sizeof the structure since in OSD1 the last array is smaller. Use
- * below for version independent handling of this structure
- */
-static inline int osd_data_out_integrity_info_sizeof(bool is_ver1)
-{
- return sizeof(struct osd_data_out_integrity_info) -
- (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
-}
-
-struct osd_data_in_integrity_info {
- __be64 data_bytes;
- __be64 retrieved_attributes_bytes;
- __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
-} __packed;
-
-/* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference
- * Is the sizeof the structure since in OSD1 the last array is smaller. Use
- * below for version independent handling of this structure
- */
-static inline int osd_data_in_integrity_info_sizeof(bool is_ver1)
-{
- return sizeof(struct osd_data_in_integrity_info) -
- (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
-}
-
-struct osd_timestamp {
- u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
-} __packed;
-/* FIXME: define helper functions to convert to/from osd time format */
-
-/*
- * Capability & Security definitions
- * osd2r03: 4.11.2.2 Capability format
- * osd2r03: 5.2.8 Security parameters
- */
-
-struct osd_key_identifier {
- u8 id[7]; /* if you know why 7 please email ooo@electrozaur.com */
-} __packed;
-
-/* for osd_capability.format */
-enum {
- OSD_SEC_CAP_FORMAT_NO_CAPS = 0,
- OSD_SEC_CAP_FORMAT_VER1 = 1,
- OSD_SEC_CAP_FORMAT_VER2 = 2,
-};
-
-/* security_method */
-enum {
- OSD_SEC_NOSEC = 0,
- OSD_SEC_CAPKEY = 1,
- OSD_SEC_CMDRSP = 2,
- OSD_SEC_ALLDATA = 3,
-};
-
-enum object_type {
- OSD_SEC_OBJ_ROOT = 0x1,
- OSD_SEC_OBJ_PARTITION = 0x2,
- OSD_SEC_OBJ_COLLECTION = 0x40,
- OSD_SEC_OBJ_USER = 0x80,
-};
-
-enum osd_capability_bit_masks {
- OSD_SEC_CAP_APPEND = BIT(0),
- OSD_SEC_CAP_OBJ_MGMT = BIT(1),
- OSD_SEC_CAP_REMOVE = BIT(2),
- OSD_SEC_CAP_CREATE = BIT(3),
- OSD_SEC_CAP_SET_ATTR = BIT(4),
- OSD_SEC_CAP_GET_ATTR = BIT(5),
- OSD_SEC_CAP_WRITE = BIT(6),
- OSD_SEC_CAP_READ = BIT(7),
-
- OSD_SEC_CAP_NONE1 = BIT(8),
- OSD_SEC_CAP_NONE2 = BIT(9),
- OSD_SEC_GBL_REM = BIT(10), /*v2 only*/
- OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
- OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
- OSD_SEC_CAP_POL_SEC = BIT(13),
- OSD_SEC_CAP_GLOBAL = BIT(14),
- OSD_SEC_CAP_DEV_MGMT = BIT(15),
-};
-
-/* for object_descriptor_type (hi nibble used) */
-enum {
- OSD_SEC_OBJ_DESC_NONE = 0, /* Not allowed */
- OSD_SEC_OBJ_DESC_OBJ = 1 << 4, /* v1: also collection */
- OSD_SEC_OBJ_DESC_PAR = 2 << 4, /* also root */
- OSD_SEC_OBJ_DESC_COL = 3 << 4, /* v2 only */
-};
-
-/* (osd-r10:4.9.2.2)
- * osd2r03:4.11.2.2 Capability format
- */
-struct osd_capability_head {
- u8 format; /* low nibble */
- u8 integrity_algorithm__key_version; /* MAKE_BYTE(integ_alg, key_ver) */
- u8 security_method;
- u8 reserved1;
-/*04*/ struct osd_timestamp expiration_time;
-/*10*/ u8 audit[20];
-/*30*/ u8 discriminator[12];
-/*42*/ struct osd_timestamp object_created_time;
-/*48*/ u8 object_type;
-/*49*/ u8 permissions_bit_mask[5];
-/*54*/ u8 reserved2;
-/*55*/ u8 object_descriptor_type; /* high nibble */
-} __packed;
-
-/*56 v1*/
-struct osdv1_cap_object_descriptor {
- union {
- struct {
-/*56*/ __be32 policy_access_tag;
-/*60*/ __be64 allowed_partition_id;
-/*68*/ __be64 allowed_object_id;
-/*76*/ __be32 reserved;
- } __packed obj_desc;
-
-/*56*/ u8 object_descriptor[24];
- };
-} __packed;
-/*80 v1*/
-
-/*56 v2*/
-struct osd_cap_object_descriptor {
- union {
- struct {
-/*56*/ __be32 allowed_attributes_access;
-/*60*/ __be32 policy_access_tag;
-/*64*/ __be16 boot_epoch;
-/*66*/ u8 reserved[6];
-/*72*/ __be64 allowed_partition_id;
-/*80*/ __be64 allowed_object_id;
-/*88*/ __be64 allowed_range_length;
-/*96*/ __be64 allowed_range_start;
- } __packed obj_desc;
-
-/*56*/ u8 object_descriptor[48];
- };
-} __packed;
-/*104 v2*/
-
-struct osdv1_capability {
- struct osd_capability_head h;
- struct osdv1_cap_object_descriptor od;
-} __packed;
-
-struct osd_capability {
- struct osd_capability_head h;
- struct osd_cap_object_descriptor od;
-} __packed;
-
-/**
- * osd_sec_set_caps - set cap-bits into the capabilities header
- *
- * @cap: The osd_capability_head to set cap bits to.
- * @bit_mask: Use an ORed list of enum osd_capability_bit_masks values
- *
- * permissions_bit_mask is unaligned use below to set into caps
- * in a version independent way
- */
-static inline void osd_sec_set_caps(struct osd_capability_head *cap,
- u16 bit_mask)
-{
- /*
- *Note: The bits above are defined LE order this is because this way
- * they can grow in the future to more then 16, and still retain
- * there constant values.
- */
- put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
-}
-
-/* osd2r05a sec 5.3: CDB continuation segment formats */
-enum osd_continuation_segment_format {
- CDB_CONTINUATION_FORMAT_V2 = 0x01,
-};
-
-struct osd_continuation_segment_header {
- u8 format;
- u8 reserved1;
- __be16 service_action;
- __be32 reserved2;
- u8 integrity_check[OSDv2_CRYPTO_KEYID_SIZE];
-} __packed;
-
-/* osd2r05a sec 5.4.1: CDB continuation descriptors */
-enum osd_continuation_descriptor_type {
- NO_MORE_DESCRIPTORS = 0x0000,
- SCATTER_GATHER_LIST = 0x0001,
- QUERY_LIST = 0x0002,
- USER_OBJECT = 0x0003,
- COPY_USER_OBJECT_SOURCE = 0x0101,
- EXTENSION_CAPABILITIES = 0xFFEE
-};
-
-struct osd_continuation_descriptor_header {
- __be16 type;
- u8 reserved;
- u8 pad_length;
- __be32 length;
-} __packed;
-
-
-/* osd2r05a sec 5.4.2: Scatter/gather list */
-struct osd_sg_list_entry {
- __be64 offset;
- __be64 len;
-};
-
-struct osd_sg_continuation_descriptor {
- struct osd_continuation_descriptor_header hdr;
- struct osd_sg_list_entry entries[];
-};
-
-#endif /* ndef __OSD_PROTOCOL_H__ */
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
deleted file mode 100644
index 7abeb0f0db30..000000000000
--- a/include/scsi/osd_sec.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * osd_sec.h - OSD security manager API
- *
- * Copyright (C) 2008 Panasas Inc. All rights reserved.
- *
- * Authors:
- * Boaz Harrosh <ooo@electrozaur.com>
- * Benny Halevy <bhalevy@panasas.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- *
- */
-#ifndef __OSD_SEC_H__
-#define __OSD_SEC_H__
-
-#include <scsi/osd_protocol.h>
-#include <scsi/osd_types.h>
-
-/*
- * Contains types and constants of osd capabilities and security
- * encoding/decoding.
- * API is trying to keep security abstract so initiator of an object
- * based pNFS client knows as little as possible about security and
- * capabilities. It is the Server's osd-initiator place to know more.
- * Also can be used by osd-target.
- */
-void osd_sec_encode_caps(void *caps, ...);/* NI */
-void osd_sec_init_nosec_doall_caps(void *caps,
- const struct osd_obj_id *obj, bool is_collection, const bool is_v1);
-
-bool osd_is_sec_alldata(struct osd_security_parameters *sec_params);
-
-/* Conditionally sign the CDB according to security setting in ocdb
- * with cap_key */
-void osd_sec_sign_cdb(struct osd_cdb *ocdb, const u8 *cap_key);
-
-/* Unconditionally sign the BIO data with cap_key.
- * Check for osd_is_sec_alldata() was done prior to calling this. */
-void osd_sec_sign_data(void *data_integ, struct bio *bio, const u8 *cap_key);
-
-/* Version independent copy of caps into the cdb */
-void osd_set_caps(struct osd_cdb *cdb, const void *caps);
-
-#endif /* ndef __OSD_SEC_H__ */
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h
deleted file mode 100644
index d52aa93a0b2d..000000000000
--- a/include/scsi/osd_sense.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * osd_sense.h - OSD Related sense handling definitions.
- *
- * Copyright (C) 2008 Panasas Inc. All rights reserved.
- *
- * Authors:
- * Boaz Harrosh <ooo@electrozaur.com>
- * Benny Halevy <bhalevy@panasas.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- *
- * This file contains types and constants that are defined by the protocol
- * Note: All names and symbols are taken from the OSD standard's text.
- */
-#ifndef __OSD_SENSE_H__
-#define __OSD_SENSE_H__
-
-#include <scsi/osd_protocol.h>
-
-/* SPC3r23 4.5.6 Sense key and sense code definitions table 27 */
-enum scsi_sense_keys {
- scsi_sk_no_sense = 0x0,
- scsi_sk_recovered_error = 0x1,
- scsi_sk_not_ready = 0x2,
- scsi_sk_medium_error = 0x3,
- scsi_sk_hardware_error = 0x4,
- scsi_sk_illegal_request = 0x5,
- scsi_sk_unit_attention = 0x6,
- scsi_sk_data_protect = 0x7,
- scsi_sk_blank_check = 0x8,
- scsi_sk_vendor_specific = 0x9,
- scsi_sk_copy_aborted = 0xa,
- scsi_sk_aborted_command = 0xb,
- scsi_sk_volume_overflow = 0xd,
- scsi_sk_miscompare = 0xe,
- scsi_sk_reserved = 0xf,
-};
-
-/* SPC3r23 4.5.6 Sense key and sense code definitions table 28 */
-/* Note: only those which can be returned by an OSD target. Most of
- * these errors are taken care of by the generic scsi layer.
- */
-enum osd_additional_sense_codes {
- scsi_no_additional_sense_information = 0x0000,
- scsi_operation_in_progress = 0x0016,
- scsi_cleaning_requested = 0x0017,
- scsi_lunr_cause_not_reportable = 0x0400,
- scsi_logical_unit_is_in_process_of_becoming_ready = 0x0401,
- scsi_lunr_initializing_command_required = 0x0402,
- scsi_lunr_manual_intervention_required = 0x0403,
- scsi_lunr_operation_in_progress = 0x0407,
- scsi_lunr_selftest_in_progress = 0x0409,
- scsi_luna_asymmetric_access_state_transition = 0x040a,
- scsi_luna_target_port_in_standby_state = 0x040b,
- scsi_luna_target_port_in_unavailable_state = 0x040c,
- scsi_lunr_notify_enable_spinup_required = 0x0411,
- scsi_logical_unit_does_not_respond_to_selection = 0x0500,
- scsi_logical_unit_communication_failure = 0x0800,
- scsi_logical_unit_communication_timeout = 0x0801,
- scsi_logical_unit_communication_parity_error = 0x0802,
- scsi_error_log_overflow = 0x0a00,
- scsi_warning = 0x0b00,
- scsi_warning_specified_temperature_exceeded = 0x0b01,
- scsi_warning_enclosure_degraded = 0x0b02,
- scsi_write_error_unexpected_unsolicited_data = 0x0c0c,
- scsi_write_error_not_enough_unsolicited_data = 0x0c0d,
- scsi_invalid_information_unit = 0x0e00,
- scsi_invalid_field_in_command_information_unit = 0x0e03,
- scsi_read_error_failed_retransmission_request = 0x1113,
- scsi_parameter_list_length_error = 0x1a00,
- scsi_invalid_command_operation_code = 0x2000,
- scsi_invalid_field_in_cdb = 0x2400,
- osd_security_audit_value_frozen = 0x2404,
- osd_security_working_key_frozen = 0x2405,
- osd_nonce_not_unique = 0x2406,
- osd_nonce_timestamp_out_of_range = 0x2407,
- scsi_logical_unit_not_supported = 0x2500,
- scsi_invalid_field_in_parameter_list = 0x2600,
- scsi_parameter_not_supported = 0x2601,
- scsi_parameter_value_invalid = 0x2602,
- scsi_invalid_release_of_persistent_reservation = 0x2604,
- osd_invalid_dataout_buffer_integrity_check_value = 0x260f,
- scsi_not_ready_to_ready_change_medium_may_have_changed = 0x2800,
- scsi_power_on_reset_or_bus_device_reset_occurred = 0x2900,
- scsi_power_on_occurred = 0x2901,
- scsi_scsi_bus_reset_occurred = 0x2902,
- scsi_bus_device_reset_function_occurred = 0x2903,
- scsi_device_internal_reset = 0x2904,
- scsi_transceiver_mode_changed_to_single_ended = 0x2905,
- scsi_transceiver_mode_changed_to_lvd = 0x2906,
- scsi_i_t_nexus_loss_occurred = 0x2907,
- scsi_parameters_changed = 0x2a00,
- scsi_mode_parameters_changed = 0x2a01,
- scsi_asymmetric_access_state_changed = 0x2a06,
- scsi_priority_changed = 0x2a08,
- scsi_command_sequence_error = 0x2c00,
- scsi_previous_busy_status = 0x2c07,
- scsi_previous_task_set_full_status = 0x2c08,
- scsi_previous_reservation_conflict_status = 0x2c09,
- osd_partition_or_collection_contains_user_objects = 0x2c0a,
- scsi_commands_cleared_by_another_initiator = 0x2f00,
- scsi_cleaning_failure = 0x3007,
- scsi_enclosure_failure = 0x3400,
- scsi_enclosure_services_failure = 0x3500,
- scsi_unsupported_enclosure_function = 0x3501,
- scsi_enclosure_services_unavailable = 0x3502,
- scsi_enclosure_services_transfer_failure = 0x3503,
- scsi_enclosure_services_transfer_refused = 0x3504,
- scsi_enclosure_services_checksum_error = 0x3505,
- scsi_rounded_parameter = 0x3700,
- osd_read_past_end_of_user_object = 0x3b17,
- scsi_logical_unit_has_not_self_configured_yet = 0x3e00,
- scsi_logical_unit_failure = 0x3e01,
- scsi_timeout_on_logical_unit = 0x3e02,
- scsi_logical_unit_failed_selftest = 0x3e03,
- scsi_logical_unit_unable_to_update_selftest_log = 0x3e04,
- scsi_target_operating_conditions_have_changed = 0x3f00,
- scsi_microcode_has_been_changed = 0x3f01,
- scsi_inquiry_data_has_changed = 0x3f03,
- scsi_echo_buffer_overwritten = 0x3f0f,
- scsi_diagnostic_failure_on_component_nn_first = 0x4080,
- scsi_diagnostic_failure_on_component_nn_last = 0x40ff,
- scsi_message_error = 0x4300,
- scsi_internal_target_failure = 0x4400,
- scsi_select_or_reselect_failure = 0x4500,
- scsi_scsi_parity_error = 0x4700,
- scsi_data_phase_crc_error_detected = 0x4701,
- scsi_scsi_parity_error_detected_during_st_data_phase = 0x4702,
- scsi_asynchronous_information_protection_error_detected = 0x4704,
- scsi_protocol_service_crc_error = 0x4705,
- scsi_phy_test_function_in_progress = 0x4706,
- scsi_invalid_message_error = 0x4900,
- scsi_command_phase_error = 0x4a00,
- scsi_data_phase_error = 0x4b00,
- scsi_logical_unit_failed_self_configuration = 0x4c00,
- scsi_overlapped_commands_attempted = 0x4e00,
- osd_quota_error = 0x5507,
- scsi_failure_prediction_threshold_exceeded = 0x5d00,
- scsi_failure_prediction_threshold_exceeded_false = 0x5dff,
- scsi_voltage_fault = 0x6500,
-};
-
-enum scsi_descriptor_types {
- scsi_sense_information = 0x0,
- scsi_sense_command_specific_information = 0x1,
- scsi_sense_key_specific = 0x2,
- scsi_sense_field_replaceable_unit = 0x3,
- scsi_sense_stream_commands = 0x4,
- scsi_sense_block_commands = 0x5,
- osd_sense_object_identification = 0x6,
- osd_sense_response_integrity_check = 0x7,
- osd_sense_attribute_identification = 0x8,
- scsi_sense_ata_return = 0x9,
-
- scsi_sense_Reserved_first = 0x0A,
- scsi_sense_Reserved_last = 0x7F,
- scsi_sense_Vendor_specific_first = 0x80,
- scsi_sense_Vendor_specific_last = 0xFF,
-};
-
-struct scsi_sense_descriptor { /* for picking into desc type */
- u8 descriptor_type; /* one of enum scsi_descriptor_types */
- u8 additional_length; /* n - 1 */
- u8 data[];
-} __packed;
-
-/* OSD deploys only scsi descriptor_based sense buffers */
-struct scsi_sense_descriptor_based {
-/*0*/ u8 response_code; /* 0x72 or 0x73 */
-/*1*/ u8 sense_key; /* one of enum scsi_sense_keys (4 lower bits) */
-/*2*/ __be16 additional_sense_code; /* enum osd_additional_sense_codes */
-/*4*/ u8 Reserved[3];
-/*7*/ u8 additional_sense_length; /* n - 7 */
-/*8*/ struct scsi_sense_descriptor ssd[0]; /* variable length, 1 or more */
-} __packed;
-
-/* some descriptors deployed by OSD */
-
-/* SPC3r23 4.5.2.3 Command-specific information sense data descriptor */
-/* Note: this is the same for descriptor_type=00 but with type=00 the
- * Reserved[0] == 0x80 (ie. bit-7 set)
- */
-struct scsi_sense_command_specific_data_descriptor {
-/*0*/ u8 descriptor_type; /* (00h/01h) */
-/*1*/ u8 additional_length; /* (0Ah) */
-/*2*/ u8 Reserved[2];
-/*4*/ __be64 information;
-} __packed;
-/*12*/
-
-struct scsi_sense_key_specific_data_descriptor {
-/*0*/ u8 descriptor_type; /* (02h) */
-/*1*/ u8 additional_length; /* (06h) */
-/*2*/ u8 Reserved[2];
-/* SKSV, C/D, Reserved (2), BPV, BIT POINTER (3) */
-/*4*/ u8 sksv_cd_bpv_bp;
-/*5*/ __be16 value; /* field-pointer/progress-value/retry-count/... */
-/*7*/ u8 Reserved2;
-} __packed;
-/*8*/
-
-/* 4.16.2.1 OSD error identification sense data descriptor - table 52 */
-/* Note: these bits are defined LE order for easy definition, this way the BIT()
- * number is the same as in the documentation. Below members at
- * osd_sense_identification_data_descriptor are therefore defined __le32.
- */
-enum osd_command_functions_bits {
- OSD_CFB_COMMAND = BIT(4),
- OSD_CFB_CMD_CAP_VERIFIED = BIT(5),
- OSD_CFB_VALIDATION = BIT(7),
- OSD_CFB_IMP_ST_ATT = BIT(12),
- OSD_CFB_SET_ATT = BIT(20),
- OSD_CFB_SA_CAP_VERIFIED = BIT(21),
- OSD_CFB_GET_ATT = BIT(28),
- OSD_CFB_GA_CAP_VERIFIED = BIT(29),
-};
-
-struct osd_sense_identification_data_descriptor {
-/*0*/ u8 descriptor_type; /* (06h) */
-/*1*/ u8 additional_length; /* (1Eh) */
-/*2*/ u8 Reserved[6];
-/*8*/ __le32 not_initiated_functions; /*osd_command_functions_bits*/
-/*12*/ __le32 completed_functions; /*osd_command_functions_bits*/
-/*16*/ __be64 partition_id;
-/*24*/ __be64 object_id;
-} __packed;
-/*32*/
-
-struct osd_sense_response_integrity_check_descriptor {
-/*0*/ u8 descriptor_type; /* (07h) */
-/*1*/ u8 additional_length; /* (20h) */
-/*2*/ u8 integrity_check_value[32]; /*FIXME: OSDv2_CRYPTO_KEYID_SIZE*/
-} __packed;
-/*34*/
-
-struct osd_sense_attributes_data_descriptor {
-/*0*/ u8 descriptor_type; /* (08h) */
-/*1*/ u8 additional_length; /* (n-2) */
-/*2*/ u8 Reserved[6];
- struct osd_sense_attr {
-/*8*/ __be32 attr_page;
-/*12*/ __be32 attr_id;
-/*16*/ } sense_attrs[0]; /* 1 or more */
-} __packed;
-/*variable*/
-
-/* Dig into scsi_sk_illegal_request/scsi_invalid_field_in_cdb errors */
-
-/*FIXME: Support also field in CAPS*/
-#define OSD_CDB_OFFSET(F) offsetof(struct osd_cdb_head, F)
-
-enum osdv2_cdb_field_offset {
- OSDv1_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v1.start_address),
- OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address),
- OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition),
- OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object),
- OSD_CFO_PERMISSIONS = sizeof(struct osd_cdb_head) +
- offsetof(struct osd_capability_head,
- permissions_bit_mask),
-};
-
-#endif /* ndef __OSD_SENSE_H__ */
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
deleted file mode 100644
index 48e8a165e136..000000000000
--- a/include/scsi/osd_types.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * osd_types.h - Types and constants which are not part of the protocol.
- *
- * Copyright (C) 2008 Panasas Inc. All rights reserved.
- *
- * Authors:
- * Boaz Harrosh <ooo@electrozaur.com>
- * Benny Halevy <bhalevy@panasas.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- *
- * Contains types and constants that are implementation specific and are
- * used by more than one part of the osd library.
- * (Eg initiator/target/security_manager/...)
- */
-#ifndef __OSD_TYPES_H__
-#define __OSD_TYPES_H__
-
-struct osd_systemid {
- u8 data[OSD_SYSTEMID_LEN];
-};
-
-typedef u64 __bitwise osd_id;
-
-struct osd_obj_id {
- osd_id partition;
- osd_id id;
-};
-
-static const struct __weak osd_obj_id osd_root_object = {0, 0};
-
-struct osd_attr {
- u32 attr_page;
- u32 attr_id;
- u16 len; /* byte count of operand */
- void *val_ptr; /* in network order */
-};
-
-struct osd_sg_entry {
- u64 offset;
- u64 len;
-};
-
-#endif /* ndef __OSD_TYPES_H__ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index eb7853c1a23b..5339baadc082 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -274,10 +274,4 @@ static inline int scsi_is_wlun(u64 lun)
/* Used to obtain the PCI location of a device */
#define SCSI_IOCTL_GET_PCI 0x5387
-/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
-static inline __u32 scsi_to_u32(__u8 *ptr)
-{
- return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
-}
-
#endif /* _SCSI_SCSI_H */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index c891ada3c5c2..76ed5e4acd38 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -35,7 +35,6 @@ struct scsi_driver;
struct scsi_data_buffer {
struct sg_table table;
unsigned length;
- int resid;
};
/* embedded in scsi_cmnd */
@@ -61,6 +60,9 @@ struct scsi_pointer {
/* flags preserved across unprep / reprep */
#define SCMD_PRESERVED_FLAGS (SCMD_UNCHECKED_ISA_DMA | SCMD_INITIALIZED)
+/* for scmd->state */
+#define SCMD_STATE_COMPLETE 0
+
struct scsi_cmnd {
struct scsi_request req;
struct scsi_device *device;
@@ -73,16 +75,6 @@ struct scsi_cmnd {
int eh_eflags; /* Used by error handlr */
/*
- * 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 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
* been outstanding
@@ -145,6 +137,7 @@ struct scsi_cmnd {
int result; /* Status code from lower level driver */
int flags; /* Command flags */
+ unsigned long state; /* Command completion state */
unsigned char tag; /* SCSI-II queued command tag */
};
@@ -171,7 +164,7 @@ extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
size_t *offset, size_t *len);
extern void scsi_kunmap_atomic_sg(void *virt);
-extern int scsi_init_io(struct scsi_cmnd *cmd);
+extern blk_status_t scsi_init_io(struct scsi_cmnd *cmd);
#ifdef CONFIG_SCSI_DMA
extern int scsi_dma_map(struct scsi_cmnd *cmd);
@@ -198,34 +191,17 @@ static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd)
static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
{
- cmd->sdb.resid = resid;
+ cmd->req.resid_len = resid;
}
static inline int scsi_get_resid(struct scsi_cmnd *cmd)
{
- return cmd->sdb.resid;
+ return cmd->req.resid_len;
}
#define scsi_for_each_sg(cmd, sg, nseg, __i) \
for_each_sg(scsi_sglist(cmd), sg, nseg, __i)
-static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
-{
- return blk_bidi_rq(cmd->request) &&
- (cmd->request->next_rq->special != NULL);
-}
-
-static inline struct scsi_data_buffer *scsi_in(struct scsi_cmnd *cmd)
-{
- return scsi_bidi_cmnd(cmd) ?
- cmd->request->next_rq->special : &cmd->sdb;
-}
-
-static inline struct scsi_data_buffer *scsi_out(struct scsi_cmnd *cmd)
-{
- return &cmd->sdb;
-}
-
static inline int scsi_sg_copy_from_buffer(struct scsi_cmnd *cmd,
void *buf, int buflen)
{
@@ -347,7 +323,7 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
{
- unsigned int xfer_len = scsi_out(scmd)->length;
+ unsigned int xfer_len = scmd->sdb.length;
unsigned int prot_interval = scsi_prot_interval(scmd);
if (scmd->prot_flags & SCSI_PROT_TRANSFER_PI)
diff --git a/include/scsi/scsi_dh.h b/include/scsi/scsi_dh.h
index c7bba2b24849..a862dc23c68d 100644
--- a/include/scsi/scsi_dh.h
+++ b/include/scsi/scsi_dh.h
@@ -69,7 +69,7 @@ struct scsi_device_handler {
int (*attach)(struct scsi_device *);
void (*detach)(struct scsi_device *);
int (*activate)(struct scsi_device *, activate_complete, void *);
- int (*prep_fn)(struct scsi_device *, struct request *);
+ blk_status_t (*prep_fn)(struct scsi_device *, struct request *);
int (*set_params)(struct scsi_device *, const char *);
void (*rescan)(struct scsi_device *);
};
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index fae8b465233e..6dffa8555a39 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -2,6 +2,7 @@
#ifndef _SCSI_SCSI_DRIVER_H
#define _SCSI_SCSI_DRIVER_H
+#include <linux/blk_types.h>
#include <linux/device.h>
struct module;
@@ -13,7 +14,7 @@ struct scsi_driver {
struct device_driver gendrv;
void (*rescan)(struct device *);
- int (*init_command)(struct scsi_cmnd *);
+ blk_status_t (*init_command)(struct scsi_cmnd *);
void (*uninit_command)(struct scsi_cmnd *);
int (*done)(struct scsi_cmnd *);
int (*eh_action)(struct scsi_cmnd *, int);
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 2b7e227960e1..3810b340551c 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -39,7 +39,6 @@ struct scsi_eh_save {
unsigned char prot_op;
unsigned char *cmnd;
struct scsi_data_buffer sdb;
- struct request *next_rq;
/* new command support */
unsigned char eh_cmnd[BLK_MAX_CDB];
struct scatterlist sense_sgl;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 5ea06d310a25..a5fcdad4a03e 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -11,7 +11,6 @@
#include <linux/blk-mq.h>
#include <scsi/scsi.h>
-struct request_queue;
struct block_device;
struct completion;
struct module;
@@ -22,7 +21,6 @@ struct scsi_target;
struct Scsi_Host;
struct scsi_host_cmd_pool;
struct scsi_transport_template;
-struct blk_queue_tags;
/*
@@ -44,9 +42,6 @@ struct blk_queue_tags;
#define MODE_INITIATOR 0x01
#define MODE_TARGET 0x02
-#define DISABLE_CLUSTERING 0
-#define ENABLE_CLUSTERING 1
-
struct scsi_host_template {
struct module *module;
const char *name;
@@ -65,7 +60,8 @@ struct scsi_host_template {
*
* Status: OPTIONAL
*/
- int (* ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+ int (*ioctl)(struct scsi_device *dev, unsigned int cmd,
+ void __user *arg);
#ifdef CONFIG_COMPAT
@@ -75,7 +71,8 @@ struct scsi_host_template {
*
* Status: OPTIONAL
*/
- int (* compat_ioctl)(struct scsi_device *dev, int cmd, void __user *arg);
+ int (*compat_ioctl)(struct scsi_device *dev, unsigned int cmd,
+ void __user *arg);
#endif
/*
@@ -303,11 +300,7 @@ struct scsi_host_template {
/*
* This is an optional routine that allows the transport to become
* involved when a scsi io timer fires. The return value tells the
- * timer routine how to finish the io timeout handling:
- * EH_HANDLED: I fixed the error, please complete the command
- * EH_RESET_TIMER: I need more time, reset the timer and
- * begin counting again
- * EH_DONE: Begin normal error recovery
+ * timer routine how to finish the io timeout handling.
*
* Status: OPTIONAL
*/
@@ -366,6 +359,11 @@ struct scsi_host_template {
unsigned int max_sectors;
/*
+ * Maximum size in bytes of a single segment.
+ */
+ unsigned int max_segment_size;
+
+ /*
* DMA scatter gather segment boundary limit. A segment crossing this
* boundary will be split in two.
*/
@@ -415,16 +413,6 @@ struct scsi_host_template {
unsigned unchecked_isa_dma:1;
/*
- * True if this host adapter can make good use of clustering.
- * I originally thought that if the tablesize was large that it
- * was a waste of CPU cycles to prepare a cluster list, but
- * it works out that the Buslogic is faster if you use a smaller
- * number of segments (i.e. use clustering). I guess it is
- * inefficient.
- */
- unsigned use_clustering:1;
-
- /*
* True for emulated SCSI host adapters (e.g. ATAPI).
*/
unsigned emulated:1;
@@ -498,7 +486,6 @@ struct scsi_host_template {
unsigned long irq_flags; \
int rc; \
spin_lock_irqsave(shost->host_lock, irq_flags); \
- scsi_cmd_get_serial(shost, cmd); \
rc = func_name##_lck (cmd, cmd->scsi_done); \
spin_unlock_irqrestore(shost->host_lock, irq_flags); \
return rc; \
@@ -547,14 +534,8 @@ struct Scsi_Host {
struct scsi_host_template *hostt;
struct scsi_transport_template *transportt;
- /*
- * Area to keep a shared tag map (if needed, will be
- * NULL if not).
- */
- union {
- struct blk_queue_tag *bqt;
- struct blk_mq_tag_set tag_set;
- };
+ /* Area to keep a shared tag map */
+ struct blk_mq_tag_set tag_set;
atomic_t host_busy; /* commands actually active on low-level */
atomic_t host_blocked;
@@ -604,6 +585,7 @@ struct Scsi_Host {
short unsigned int sg_tablesize;
short unsigned int sg_prot_tablesize;
unsigned int max_sectors;
+ unsigned int max_segment_size;
unsigned long dma_boundary;
/*
* In scsi-mq mode, the number of hardware queues supported by the LLD.
@@ -613,15 +595,8 @@ struct Scsi_Host {
* is nr_hw_queues * can_queue.
*/
unsigned nr_hw_queues;
- /*
- * Used to assign serial numbers to the cmds.
- * Protected by the host lock.
- */
- unsigned long cmd_serial_number;
-
unsigned active_mode:2;
unsigned unchecked_isa_dma:1;
- unsigned use_clustering:1;
/*
* Host has requested that no further requests come through for the
@@ -648,12 +623,14 @@ struct Scsi_Host {
/* The controller does not support WRITE SAME */
unsigned no_write_same:1;
- unsigned use_blk_mq:1;
unsigned use_cmd_list:1;
/* Host responded with short (<36 bytes) INQUIRY result */
unsigned short_inquiry:1;
+ /* The transport requires the LUN bits NOT to be stored in CDB[1] */
+ unsigned no_scsi2_lun_in_cdb:1;
+
/*
* Optional work queue to be utilized by the transport
*/
@@ -665,9 +642,6 @@ struct Scsi_Host {
*/
struct workqueue_struct *tmf_work_q;
- /* The transport requires the LUN bits NOT to be stored in CDB[1] */
- unsigned no_scsi2_lun_in_cdb:1;
-
/*
* Value host_blocked counts down from
*/
@@ -742,11 +716,6 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
shost->tmf_in_progress;
}
-static inline bool shost_use_blk_mq(struct Scsi_Host *shost)
-{
- return shost->use_blk_mq;
-}
-
extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
extern void scsi_flush_work(struct Scsi_Host *);
@@ -762,7 +731,6 @@ extern int scsi_host_busy(struct Scsi_Host *shost);
extern void scsi_host_put(struct Scsi_Host *t);
extern struct Scsi_Host *scsi_host_lookup(unsigned short);
extern const char *scsi_host_state_name(enum scsi_host_state);
-extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);
static inline int __must_check scsi_add_host(struct Scsi_Host *host,
struct device *dev)
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index e192a0caa850..6053d46e794e 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -23,19 +23,15 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
int tag)
{
struct request *req = NULL;
+ u16 hwq;
if (tag == SCSI_NO_TAG)
return NULL;
- if (shost_use_blk_mq(shost)) {
- u16 hwq = blk_mq_unique_tag_to_hwq(tag);
-
- if (hwq < shost->tag_set.nr_hw_queues) {
- req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
- blk_mq_unique_tag_to_tag(tag));
- }
- } else {
- req = blk_map_queue_find_tag(shost->bqt, tag);
+ hwq = blk_mq_unique_tag_to_hwq(tag);
+ if (hwq < shost->tag_set.nr_hw_queues) {
+ req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
+ blk_mq_unique_tag_to_tag(tag));
}
if (!req)
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 15da45dc2a5d..b375c3303fe2 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -165,6 +165,9 @@ enum fc_tgtid_binding_type {
#define FC_PORT_ROLE_FCP_INITIATOR 0x02
#define FC_PORT_ROLE_IP_PORT 0x04
#define FC_PORT_ROLE_FCP_DUMMY_INITIATOR 0x08
+#define FC_PORT_ROLE_NVME_INITIATOR 0x10
+#define FC_PORT_ROLE_NVME_TARGET 0x20
+#define FC_PORT_ROLE_NVME_DISCOVERY 0x40
/* The following are for compatibility */
#define FC_RPORT_ROLE_UNKNOWN FC_PORT_ROLE_UNKNOWN
@@ -473,6 +476,7 @@ enum fc_host_event_code {
FCH_EVT_PORT_ONLINE = 0x202,
FCH_EVT_PORT_FABRIC = 0x204,
FCH_EVT_LINK_UNKNOWN = 0x500,
+ FCH_EVT_LINK_FPIN = 0x501,
FCH_EVT_VENDOR_UNIQUE = 0xffff,
};
@@ -755,7 +759,7 @@ fc_remote_port_chkready(struct fc_rport *rport)
return result;
}
-static inline u64 wwn_to_u64(u8 *wwn)
+static inline u64 wwn_to_u64(const u8 *wwn)
{
return get_unaligned_be64(wwn);
}
@@ -798,11 +802,17 @@ u32 fc_get_event_number(void);
void fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
enum fc_host_event_code event_code, u32 event_data);
void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
- u32 data_len, char * data_buf, u64 vendor_id);
+ u32 data_len, char *data_buf, u64 vendor_id);
+void fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,
+ enum fc_host_event_code event_code,
+ u32 data_len, char *data_buf, u64 vendor_id);
/* Note: when specifying vendor_id to fc_host_post_vendor_event()
- * be sure to read the Vendor Type and ID formatting requirements
- * specified in scsi_netlink.h
+ * or fc_host_post_fc_event(), be sure to read the Vendor Type
+ * and ID formatting requirements specified in scsi_netlink.h
+ * Note: when calling fc_host_post_fc_event(), vendor_id may be
+ * specified as 0.
*/
+void fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf);
struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
struct fc_vport_identifiers *);
int fc_vport_terminate(struct fc_vport *vport);
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
index c16a3c9a4d9b..9220758d5087 100644
--- a/include/scsi/srp.h
+++ b/include/scsi/srp.h
@@ -67,7 +67,8 @@ enum {
enum {
SRP_NO_DATA_DESC = 0,
SRP_DATA_DESC_DIRECT = 1,
- SRP_DATA_DESC_INDIRECT = 2
+ SRP_DATA_DESC_INDIRECT = 2,
+ SRP_DATA_DESC_IMM = 3, /* new in SRP2 */
};
enum {
@@ -111,9 +112,16 @@ struct srp_indirect_buf {
struct srp_direct_buf desc_list[0];
} __attribute__((packed));
+/* Immediate data buffer descriptor as defined in SRP2. */
+struct srp_imm_buf {
+ __be32 len;
+};
+
+/* srp_login_req.flags */
enum {
SRP_MULTICHAN_SINGLE = 0,
- SRP_MULTICHAN_MULTI = 1
+ SRP_MULTICHAN_MULTI = 1,
+ SRP_IMMED_REQUESTED = 0x80, /* new in SRP2 */
};
struct srp_login_req {
@@ -124,7 +132,9 @@ struct srp_login_req {
u8 reserved2[4];
__be16 req_buf_fmt;
u8 req_flags;
- u8 reserved3[5];
+ u8 reserved3[1];
+ __be16 imm_data_offset; /* new in SRP2 */
+ u8 reserved4[2];
u8 initiator_port_id[16];
u8 target_port_id[16];
};
@@ -144,6 +154,16 @@ struct srp_login_req_rdma {
__be32 req_it_iu_len;
u8 initiator_port_id[16];
u8 target_port_id[16];
+ __be16 imm_data_offset;
+ u8 reserved[6];
+};
+
+/* srp_login_rsp.rsp_flags */
+enum {
+ SRP_LOGIN_RSP_MULTICHAN_NO_CHAN = 0x0,
+ SRP_LOGIN_RSP_MULTICHAN_TERMINATED = 0x1,
+ SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,
+ SRP_LOGIN_RSP_IMMED_SUPP = 0x80, /* new in SRP2 */
};
/*