|
36 | 36 | #ifndef _UFS_H
|
37 | 37 | #define _UFS_H
|
38 | 38 |
|
| 39 | +#include <linux/mutex.h> |
| 40 | +#include <linux/types.h> |
| 41 | + |
39 | 42 | #define MAX_CDB_SIZE 16
|
40 | 43 |
|
41 | 44 | #define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
|
42 |
| - ((byte3 << 24) | (byte2 << 16) |\ |
| 45 | + cpu_to_be32((byte3 << 24) | (byte2 << 16) |\ |
43 | 46 | (byte1 << 8) | (byte0))
|
44 | 47 |
|
45 | 48 | /*
|
|
73 | 76 | UPIU_TRANSACTION_TASK_RSP = 0x24,
|
74 | 77 | UPIU_TRANSACTION_READY_XFER = 0x31,
|
75 | 78 | UPIU_TRANSACTION_QUERY_RSP = 0x36,
|
| 79 | + UPIU_TRANSACTION_REJECT_UPIU = 0x3F, |
76 | 80 | };
|
77 | 81 |
|
78 | 82 | /* UPIU Read/Write flags */
|
@@ -110,6 +114,12 @@ enum {
|
110 | 114 | UPIU_COMMAND_SET_TYPE_QUERY = 0x2,
|
111 | 115 | };
|
112 | 116 |
|
| 117 | +/* UTP Transfer Request Command Offset */ |
| 118 | +#define UPIU_COMMAND_TYPE_OFFSET 28 |
| 119 | + |
| 120 | +/* Offset of the response code in the UPIU header */ |
| 121 | +#define UPIU_RSP_CODE_OFFSET 8 |
| 122 | + |
113 | 123 | enum {
|
114 | 124 | MASK_SCSI_STATUS = 0xFF,
|
115 | 125 | MASK_TASK_RESPONSE = 0xFF00,
|
@@ -138,32 +148,48 @@ struct utp_upiu_header {
|
138 | 148 |
|
139 | 149 | /**
|
140 | 150 | * struct utp_upiu_cmd - Command UPIU structure
|
141 |
| - * @header: UPIU header structure DW-0 to DW-2 |
142 | 151 | * @data_transfer_len: Data Transfer Length DW-3
|
143 | 152 | * @cdb: Command Descriptor Block CDB DW-4 to DW-7
|
144 | 153 | */
|
145 | 154 | struct utp_upiu_cmd {
|
146 |
| - struct utp_upiu_header header; |
147 | 155 | u32 exp_data_transfer_len;
|
148 | 156 | u8 cdb[MAX_CDB_SIZE];
|
149 | 157 | };
|
150 | 158 |
|
151 | 159 | /**
|
152 |
| - * struct utp_upiu_rsp - Response UPIU structure |
153 |
| - * @header: UPIU header DW-0 to DW-2 |
| 160 | + * struct utp_upiu_req - general upiu request structure |
| 161 | + * @header:UPIU header structure DW-0 to DW-2 |
| 162 | + * @sc: fields structure for scsi command DW-3 to DW-7 |
| 163 | + */ |
| 164 | +struct utp_upiu_req { |
| 165 | + struct utp_upiu_header header; |
| 166 | + struct utp_upiu_cmd sc; |
| 167 | +}; |
| 168 | + |
| 169 | +/** |
| 170 | + * struct utp_cmd_rsp - Response UPIU structure |
154 | 171 | * @residual_transfer_count: Residual transfer count DW-3
|
155 | 172 | * @reserved: Reserved double words DW-4 to DW-7
|
156 | 173 | * @sense_data_len: Sense data length DW-8 U16
|
157 | 174 | * @sense_data: Sense data field DW-8 to DW-12
|
158 | 175 | */
|
159 |
| -struct utp_upiu_rsp { |
160 |
| - struct utp_upiu_header header; |
| 176 | +struct utp_cmd_rsp { |
161 | 177 | u32 residual_transfer_count;
|
162 | 178 | u32 reserved[4];
|
163 | 179 | u16 sense_data_len;
|
164 | 180 | u8 sense_data[18];
|
165 | 181 | };
|
166 | 182 |
|
| 183 | +/** |
| 184 | + * struct utp_upiu_rsp - general upiu response structure |
| 185 | + * @header: UPIU header structure DW-0 to DW-2 |
| 186 | + * @sr: fields structure for scsi command DW-3 to DW-12 |
| 187 | + */ |
| 188 | +struct utp_upiu_rsp { |
| 189 | + struct utp_upiu_header header; |
| 190 | + struct utp_cmd_rsp sr; |
| 191 | +}; |
| 192 | + |
167 | 193 | /**
|
168 | 194 | * struct utp_upiu_task_req - Task request UPIU structure
|
169 | 195 | * @header - UPIU header structure DW0 to DW-2
|
|
0 commit comments