Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / include / uapi / scsi / scsi_bsg_ufs.h
blobd55f2176dfd470527b694fbb42a011fa4a518278
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3 * UFS Transport SGIO v4 BSG Message Support
5 * Copyright (C) 2011-2013 Samsung India Software Operations
6 * Copyright (C) 2018 Western Digital Corporation
7 */
8 #ifndef SCSI_BSG_UFS_H
9 #define SCSI_BSG_UFS_H
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)
21 /**
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 {
28 __be32 dword_0;
29 __be32 dword_1;
30 __be32 dword_2;
33 /**
34 * struct utp_upiu_query - upiu request buffer structure for
35 * query request.
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 {
46 __u8 opcode;
47 __u8 idn;
48 __u8 index;
49 __u8 selector;
50 __be16 reserved_osf;
51 __be16 length;
52 __be32 value;
53 __be32 reserved[2];
56 /**
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
61 struct utp_upiu_cmd {
62 __be32 exp_data_transfer_len;
63 __u8 cdb[UFS_CDB_SIZE];
66 /**
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
73 struct utp_upiu_req {
74 struct utp_upiu_header header;
75 union {
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 {
84 __u32 msgcode;
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.
98 __u32 result;
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 */