hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/block/mtip32xx/mtip32xx.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * mtip32xx.h - Header file for the P320 SSD Block Driver
34 * Copyright (C) 2011 Micron Technology, Inc.
....@@ -5,17 +6,6 @@
56 * Portions of this code were derived from works subjected to the
67 * following copyright:
78 * Copyright (C) 2009 Integrated Device Technology, Inc.
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
199 */
2010
2111 #ifndef __MTIP32XX_H__
....@@ -126,8 +116,6 @@
126116
127117 #define MTIP_DFS_MAX_BUF_SIZE 1024
128118
129
-#define __force_bit2int (unsigned int __force)
130
-
131119 enum {
132120 /* below are bit numbers in 'flags' defined in mtip_port */
133121 MTIP_PF_IC_ACTIVE_BIT = 0, /* pio/ioctl */
....@@ -174,10 +162,10 @@
174162
175163 struct smart_attr {
176164 u8 attr_id;
177
- u16 flags;
165
+ __le16 flags;
178166 u8 cur;
179167 u8 worst;
180
- u32 data;
168
+ __le32 data;
181169 u8 res[3];
182170 } __packed;
183171
....@@ -194,21 +182,6 @@
194182 struct mtip_work *w = (struct mtip_work *) work; \
195183 mtip_workq_sdbfx(w->port, group, w->completed); \
196184 }
197
-
198
-#define MTIP_TRIM_TIMEOUT_MS 240000
199
-#define MTIP_MAX_TRIM_ENTRIES 8
200
-#define MTIP_MAX_TRIM_ENTRY_LEN 0xfff8
201
-
202
-struct mtip_trim_entry {
203
- u32 lba; /* starting lba of region */
204
- u16 rsvd; /* unused */
205
- u16 range; /* # of 512b blocks to trim */
206
-} __packed;
207
-
208
-struct mtip_trim {
209
- /* Array of regions to trim */
210
- struct mtip_trim_entry entry[MTIP_MAX_TRIM_ENTRIES];
211
-} __packed;
212185
213186 /* Register Frame Information Structure (FIS), host to device. */
214187 struct host_to_dev_fis {
....@@ -278,24 +251,24 @@
278251 * - Bit 5 Unused in this implementation.
279252 * - Bits 4:0 Length of the command FIS in DWords (DWord = 4 bytes).
280253 */
281
- unsigned int opts;
254
+ __le32 opts;
282255 /* This field is unsed when using NCQ. */
283256 union {
284
- unsigned int byte_count;
285
- unsigned int status;
257
+ __le32 byte_count;
258
+ __le32 status;
286259 };
287260 /*
288261 * Lower 32 bits of the command table address associated with this
289262 * header. The command table addresses must be 128 byte aligned.
290263 */
291
- unsigned int ctba;
264
+ __le32 ctba;
292265 /*
293266 * If 64 bit addressing is used this field is the upper 32 bits
294267 * of the command table address associated with this command.
295268 */
296
- unsigned int ctbau;
269
+ __le32 ctbau;
297270 /* Reserved and unused. */
298
- unsigned int res[4];
271
+ u32 res[4];
299272 };
300273
301274 /* Command scatter gather structure (PRD). */
....@@ -305,31 +278,28 @@
305278 * address must be 8 byte aligned signified by bits 2:0 being
306279 * set to 0.
307280 */
308
- unsigned int dba;
281
+ __le32 dba;
309282 /*
310283 * When 64 bit addressing is used this field is the upper
311284 * 32 bits of the data buffer address.
312285 */
313
- unsigned int dba_upper;
286
+ __le32 dba_upper;
314287 /* Unused. */
315
- unsigned int reserved;
288
+ __le32 reserved;
316289 /*
317290 * Bit 31: interrupt when this data block has been transferred.
318291 * Bits 30..22: reserved
319292 * Bits 21..0: byte count (minus 1). For P320 the byte count must be
320293 * 8 byte aligned signified by bits 2:0 being set to 1.
321294 */
322
- unsigned int info;
295
+ __le32 info;
323296 };
324297 struct mtip_port;
325298
299
+struct mtip_int_cmd;
300
+
326301 /* Structure used to describe a command. */
327302 struct mtip_cmd {
328
-
329
- struct mtip_cmd_hdr *command_header; /* ptr to command header entry */
330
-
331
- dma_addr_t command_header_dma; /* corresponding physical address */
332
-
333303 void *command; /* ptr to command table entry */
334304
335305 dma_addr_t command_dma; /* corresponding physical address */
....@@ -338,7 +308,10 @@
338308
339309 int unaligned; /* command is unaligned on 4k boundary */
340310
341
- struct scatterlist sg[MTIP_MAX_SG]; /* Scatter list entries */
311
+ union {
312
+ struct scatterlist sg[MTIP_MAX_SG]; /* Scatter list entries */
313
+ struct mtip_int_cmd *icmd;
314
+ };
342315
343316 int retries; /* The number of retries left for this command. */
344317
....@@ -435,8 +408,8 @@
435408 */
436409 unsigned long ic_pause_timer;
437410
438
- /* Semaphore to control queue depth of unaligned IOs */
439
- struct semaphore cmd_slot_unal;
411
+ /* Counter to control queue depth of unaligned IOs */
412
+ atomic_t cmd_slot_unal;
440413
441414 /* Spinlock for working around command-issue bug. */
442415 spinlock_t cmd_issue_lock[MTIP_MAX_SLOT_GROUPS];
....@@ -475,8 +448,6 @@
475448 struct task_struct *mtip_svc_handler; /* task_struct of svc thd */
476449
477450 struct dentry *dfs_node;
478
-
479
- bool trim_supp; /* flag indicating trim support */
480451
481452 bool sr;
482453