1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * UFS Transport SGIO v4 BSG Message Support
5 * Copyright (C) 2011-2013 Samsung India Software Operations
6 * Copyright (C) 2018 Western Digital Corporation
11 #include <linux/types.h>
13 * This file intended to be included by both kernel and user space
16 #define UFS_CDB_SIZE 16
17 #define UPIU_TRANSACTION_UIC_CMD 0x1F
18 /* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */
19 #define UIC_CMD_SIZE (sizeof(__u32) * 4)
22 * struct utp_upiu_header - UPIU header structure
23 * @dword_0: UPIU header DW-0
24 * @dword_1: UPIU header DW-1
25 * @dword_2: UPIU header DW-2
27 struct utp_upiu_header
{
34 * struct utp_upiu_query - upiu request buffer structure for
36 * @opcode: command to perform B-0
37 * @idn: a value that indicates the particular type of data B-1
38 * @index: Index to further identify data B-2
39 * @selector: Index to further identify data B-3
40 * @reserved_osf: spec reserved field B-4,5
41 * @length: number of descriptor bytes to read/write B-6,7
42 * @value: Attribute value to be written DW-5
43 * @reserved: spec reserved DW-6,7
45 struct utp_upiu_query
{
57 * struct utp_upiu_cmd - Command UPIU structure
58 * @data_transfer_len: Data Transfer Length DW-3
59 * @cdb: Command Descriptor Block CDB DW-4 to DW-7
62 __be32 exp_data_transfer_len
;
63 __u8 cdb
[UFS_CDB_SIZE
];
67 * struct utp_upiu_req - general upiu request structure
68 * @header:UPIU header structure DW-0 to DW-2
69 * @sc: fields structure for scsi command DW-3 to DW-7
70 * @qr: fields structure for query request DW-3 to DW-7
71 * @uc: use utp_upiu_query to host the 4 dwords of uic command
74 struct utp_upiu_header header
;
76 struct utp_upiu_cmd sc
;
77 struct utp_upiu_query qr
;
78 struct utp_upiu_query uc
;
82 /* request (CDB) structure of the sg_io_v4 */
83 struct ufs_bsg_request
{
85 struct utp_upiu_req upiu_req
;
88 /* response (request sense data) structure of the sg_io_v4 */
89 struct ufs_bsg_reply
{
91 * The completion result. Result exists in two forms:
92 * if negative, it is an -Exxx system errno value. There will
93 * be no further reply information supplied.
94 * else, it's the 4-byte scsi error result, with driver, host,
95 * msg and status fields. The per-msgcode reply structure
96 * will contain valid data.
100 /* If there was reply_payload, how much was received? */
101 __u32 reply_payload_rcv_len
;
103 struct utp_upiu_req upiu_rsp
;
105 #endif /* UFS_BSG_H */