summaryrefslogtreecommitdiff
path: root/include/uapi/scsi/scsi_bsg_ufs.h
diff options
context:
space:
mode:
authorAvri Altman <avri.altman@wdc.com>2018-10-07 17:30:35 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-10-11 06:09:46 +0300
commitdf032bf27a414acf61c957ec2fad22a57d903b39 (patch)
tree7ad9122c3e8252b3358cacbf713f087509a94663 /include/uapi/scsi/scsi_bsg_ufs.h
parenta851b2bd363220feacbf36adb49616a49edc99fb (diff)
downloadlinux-df032bf27a414acf61c957ec2fad22a57d903b39.tar.xz
scsi: ufs: Add a bsg endpoint that supports UPIUs
For now, just provide an API to allocate and remove ufs-bsg node. We will use this framework to manage ufs devices by sending UPIU transactions. For the time being, implements an empty bsg_request() - will add some more functionality in coming patches. Nonetheless, we reveal here the protocol we are planning to use: UFS Transport Protocol Transactions. UFS transactions consist of packets called UFS Protocol Information Units (UPIU). There are UPIU’s defined for UFS SCSI commands, responses, data in and data out, task management, utility functions, vendor functions, transaction synchronization and control, and more. By using UPIUs, we get access to the most fine-grained internals of this protocol, and able to communicate with the device in ways, that are sometimes beyond the capacity of the ufs driver. Moreover and as a result, our core structure - ufs_bsg_node has a pretty lean structure: using upiu transactions that contains the outmost detailed info, so we don't really need complex constructs to support it. Signed-off-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/uapi/scsi/scsi_bsg_ufs.h')
-rw-r--r--include/uapi/scsi/scsi_bsg_ufs.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/uapi/scsi/scsi_bsg_ufs.h b/include/uapi/scsi/scsi_bsg_ufs.h
index 5e0b9d917b9b..e426204ec15c 100644
--- a/include/uapi/scsi/scsi_bsg_ufs.h
+++ b/include/uapi/scsi/scsi_bsg_ufs.h
@@ -3,6 +3,7 @@
* UFS Transport SGIO v4 BSG Message Support
*
* Copyright (C) 2011-2013 Samsung India Software Operations
+ * Copyright (C) 2018 Western Digital Corporation
*/
#ifndef SCSI_BSG_UFS_H
#define SCSI_BSG_UFS_H
@@ -69,6 +70,33 @@ struct utp_upiu_req {
union {
struct utp_upiu_cmd sc;
struct utp_upiu_query qr;
+ struct utp_upiu_query tr;
+ /* use utp_upiu_query to host the 4 dwords of uic command */
+ struct utp_upiu_query uc;
};
};
+
+/* request (CDB) structure of the sg_io_v4 */
+struct ufs_bsg_request {
+ uint32_t msgcode;
+ struct utp_upiu_req upiu_req;
+};
+
+/* response (request sense data) structure of the sg_io_v4 */
+struct ufs_bsg_reply {
+ /*
+ * The completion result. Result exists in two forms:
+ * if negative, it is an -Exxx system errno value. There will
+ * be no further reply information supplied.
+ * else, it's the 4-byte scsi error result, with driver, host,
+ * msg and status fields. The per-msgcode reply structure
+ * will contain valid data.
+ */
+ uint32_t result;
+
+ /* If there was reply_payload, how much was received? */
+ uint32_t reply_payload_rcv_len;
+
+ struct utp_upiu_req upiu_rsp;
+};
#endif /* UFS_BSG_H */