scsi: ufs: add ioctl interface for query request
Subsystems (3)
PATCH v5 1/1 scsi: ufs: add ioctl interface for query request
This patch exposes the ioctl interface for UFS driver via SCSI device ioctl interface. As of now UFS driver would provide the ioctl for query interface to connected UFS device.
Reviewed-by Subhash Jadavani <[email protected]>
Signed-off-by Dolev Raviv <[email protected]>
Signed-off-by Gilad Broner <[email protected]>
Signed-off-by Yaniv Gardi <[email protected]>
--- drivers/scsi/ufs/ufs.h | 53 +++-------- drivers/scsi/ufs/ufshcd.c | 208 +++++++++++++++++++++++++++++++++++++++++- include/uapi/scsi/Kbuild | 1 + include/uapi/scsi/ufs/Kbuild | 3 + include/uapi/scsi/ufs/ioctl.h | 58 ++++++++++++ include/uapi/scsi/ufs/ufs.h | 67 ++++++++++++++ 6 files changed, 347 insertions(+), 43 deletions(-) create mode 100644 include/uapi/scsi/ufs/Kbuild create mode 100644 include/uapi/scsi/ufs/ioctl.h create mode 100644 include/uapi/scsi/ufs/ufs.h
drivers/scsi/ufs/ufs.h +11 -42
@@ -38,6 +38,7 @@#include <linux/mutex.h> #include <linux/types.h> +#include <scsi/ufs/ufs.h> #define MAX_CDB_SIZE 16#define GENERAL_UPIU_REQUEST_SIZE 32
@@ -72,6 +73,16 @@ enum { UFS_UPIU_RPMB_WLUN = 0xC4, }; +/** +* ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor +* @lun: LU number to check +* @return: true if the lun has a matching unit descriptor, false otherwise +*/ +static inline bool ufs_is_valid_unit_desc_lun (u8 lun) +{ +return lun ==UFS_UPIU_RPMB_WLUN || (lun <UFS_UPIU_MAX_GENERAL_LUN ); +} +/* * UFS Protocol Information Unit related definitions */
@@ -127,35 +138,6 @@ enum { UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST = 0x81, }; -/* Flag idn for Query Requests*/ -enum flag_idn { -QUERY_FLAG_IDN_FDEVICEINIT =0x01 , -QUERY_FLAG_IDN_PWR_ON_WPE =0x03 , -QUERY_FLAG_IDN_BKOPS_EN =0x04 , -}; - -/* Attribute idn for Query requests */ -enum attr_idn { -QUERY_ATTR_IDN_ACTIVE_ICC_LVL =0x03 , -QUERY_ATTR_IDN_BKOPS_STATUS =0x05 , -QUERY_ATTR_IDN_EE_CONTROL =0x0D , -QUERY_ATTR_IDN_EE_STATUS =0x0E , -}; - -/* Descriptor idn for Query requests */ -enum desc_idn { -QUERY_DESC_IDN_DEVICE =0x0 , -QUERY_DESC_IDN_CONFIGURAION =0x1 , -QUERY_DESC_IDN_UNIT =0x2 , -QUERY_DESC_IDN_RFU_0 =0x3 , -QUERY_DESC_IDN_INTERCONNECT =0x4 , -QUERY_DESC_IDN_STRING =0x5 , -QUERY_DESC_IDN_RFU_1 =0x6 , -QUERY_DESC_IDN_GEOMETRY =0x7 , -QUERY_DESC_IDN_POWER =0x8 , -QUERY_DESC_IDN_MAX , -}; -enum desc_header_offset {QUERY_DESC_LENGTH_OFFSET =0x00 ,QUERY_DESC_DESC_TYPE_OFFSET =0x01 ,
@@ -279,19 +261,6 @@ enum bkops_status { BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL, }; -/* UTP QUERY Transaction Specific Fields OpCode */ -enum query_opcode { -UPIU_QUERY_OPCODE_NOP =0x0 , -UPIU_QUERY_OPCODE_READ_DESC =0x1 , -UPIU_QUERY_OPCODE_WRITE_DESC =0x2 , -UPIU_QUERY_OPCODE_READ_ATTR =0x3 , -UPIU_QUERY_OPCODE_WRITE_ATTR =0x4 , -UPIU_QUERY_OPCODE_READ_FLAG =0x5 , -UPIU_QUERY_OPCODE_SET_FLAG =0x6 , -UPIU_QUERY_OPCODE_CLEAR_FLAG =0x7 , -UPIU_QUERY_OPCODE_TOGGLE_FLAG =0x8 , -}; -/* Query response result code */ enum {QUERY_RESULT_SUCCESS =0x00 ,
drivers/scsi/ufs/ufshcd.c +207 -1
232 lines not on this page · raw message
include/uapi/scsi/Kbuild +1 -0
@@ -1,5 +1,6 @@ # UAPI Header export list header-y += fc/ +header-y += ufs/ header-y += scsi_bsg_fc.h header-y += scsi_netlink.h header-y += scsi_netlink_fc.h
include/uapi/scsi/ufs/Kbuild new file +3 -0
@@ -0,0 +1,3 @@ +# UAPI Header export list +header-y += ioctl.h +header-y += ufs.h
include/uapi/scsi/ufs/ioctl.h new file +58 -0
58 lines not on this page · raw message
include/uapi/scsi/ufs/ufs.h new file +67 -0
67 lines not on this page · raw message
Signature · 4 lines
1.8.5.2 -- QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation