aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/mtip32xx/mtip32xx.h
diff options
context:
space:
mode:
authorAsai Thambi S P <asamymuthupa@micron.com>2011-11-23 02:29:24 -0500
committerJens Axboe <axboe@kernel.dk>2011-11-23 02:29:24 -0500
commit60ec0eecfa8968d0f1188e3730979196ac28b9de (patch)
tree59c1f3df77df31dc9d851f41ed658952150998b1 /drivers/block/mtip32xx/mtip32xx.h
parenta71f483d7957c74368a76a3a88ae54d524fa3b49 (diff)
mtip32xx: updates based on feedback
* queue ncq commands when a non-ncq is in progress or error handling is active * merge variables 'internal_cmd_in_progress' and 'eh_active' into new variable 'flags' * get rid of read/write semaphore 'internal_sem' * new service thread to issue queued commands * use macros from ata.h for command codes * return ENOTTY for BLKFLSBUF ioctl * style changes Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com> Signed-off-by: Sam Bradshaw <sbradshaw@micron.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/mtip32xx/mtip32xx.h')
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 17be4f444e7d..933192abe178 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -47,11 +47,11 @@
47 47
48/* ftl rebuild */ 48/* ftl rebuild */
49#define MTIP_FTL_REBUILD_OFFSET 142 49#define MTIP_FTL_REBUILD_OFFSET 142
50#define MTIP_FTL_REBUILD_MAGIC 0xed51 50#define MTIP_FTL_REBUILD_MAGIC 0xED51
51#define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000 51#define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000
52 52
53/* Macro to extract the tag bit number from a tag value. */ 53/* Macro to extract the tag bit number from a tag value. */
54#define MTIP_TAG_BIT(tag) (tag & 0x1f) 54#define MTIP_TAG_BIT(tag) (tag & 0x1F)
55 55
56/* 56/*
57 * Macro to extract the tag index from a tag value. The index 57 * Macro to extract the tag index from a tag value. The index
@@ -81,7 +81,7 @@
81 81
82/* Driver name and version strings */ 82/* Driver name and version strings */
83#define MTIP_DRV_NAME "mtip32xx" 83#define MTIP_DRV_NAME "mtip32xx"
84#define MTIP_DRV_VERSION "1.2.6os2" 84#define MTIP_DRV_VERSION "1.2.6os3"
85 85
86/* Maximum number of minor device numbers per device. */ 86/* Maximum number of minor device numbers per device. */
87#define MTIP_MAX_MINORS 16 87#define MTIP_MAX_MINORS 16
@@ -114,6 +114,15 @@
114 #define dbg_printk(format, arg...) 114 #define dbg_printk(format, arg...)
115#endif 115#endif
116 116
117#define __force_bit2int (unsigned int __force)
118
119/* below are bit numbers in 'flags' defined in mtip_port */
120#define MTIP_FLAG_IC_ACTIVE_BIT 0
121#define MTIP_FLAG_EH_ACTIVE_BIT 1
122#define MTIP_FLAG_SVC_THD_ACTIVE_BIT 2
123#define MTIP_FLAG_ISSUE_CMDS_BIT 4
124#define MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT 8
125
117/* Register Frame Information Structure (FIS), host to device. */ 126/* Register Frame Information Structure (FIS), host to device. */
118struct host_to_dev_fis { 127struct host_to_dev_fis {
119 /* 128 /*
@@ -262,7 +271,7 @@ struct mtip_cmd {
262 271
263 unsigned long comp_time; /* command completion time, in jiffies */ 272 unsigned long comp_time; /* command completion time, in jiffies */
264 273
265 atomic_t active; /* declares if this command sent to the drive. */ 274 atomic_t active; /* declares if this command sent to the drive. */
266}; 275};
267 276
268/* Structure used to describe a port. */ 277/* Structure used to describe a port. */
@@ -278,7 +287,7 @@ struct mtip_port {
278 void __iomem *mmio; 287 void __iomem *mmio;
279 /* Array of pointers to the memory mapped s_active registers. */ 288 /* Array of pointers to the memory mapped s_active registers. */
280 void __iomem *s_active[MTIP_MAX_SLOT_GROUPS]; 289 void __iomem *s_active[MTIP_MAX_SLOT_GROUPS];
281 /* Array of pointers to the memory mapped completed registers. */ 290 /* Array of pointers to the memory mapped completed registers. */
282 void __iomem *completed[MTIP_MAX_SLOT_GROUPS]; 291 void __iomem *completed[MTIP_MAX_SLOT_GROUPS];
283 /* Array of pointers to the memory mapped Command Issue registers. */ 292 /* Array of pointers to the memory mapped Command Issue registers. */
284 void __iomem *cmd_issue[MTIP_MAX_SLOT_GROUPS]; 293 void __iomem *cmd_issue[MTIP_MAX_SLOT_GROUPS];
@@ -340,13 +349,23 @@ struct mtip_port {
340 */ 349 */
341 unsigned long allocated[SLOTBITS_IN_LONGS]; 350 unsigned long allocated[SLOTBITS_IN_LONGS];
342 /* 351 /*
352 * used to queue commands when an internal command is in progress
353 * or error handling is active
354 */
355 unsigned long cmds_to_issue[SLOTBITS_IN_LONGS];
356 /*
343 * Array of command slots. Structure includes pointers to the 357 * Array of command slots. Structure includes pointers to the
344 * command header and command table, and completion function and data 358 * command header and command table, and completion function and data
345 * pointers. 359 * pointers.
346 */ 360 */
347 struct mtip_cmd commands[MTIP_MAX_COMMAND_SLOTS]; 361 struct mtip_cmd commands[MTIP_MAX_COMMAND_SLOTS];
348 /* Non-zero if an internal command is in progress. */ 362 /* Used by mtip_service_thread to wait for an event */
349 int internal_cmd_in_progress; 363 wait_queue_head_t svc_wait;
364 /*
365 * indicates the state of the port. Also, helps the service thread
366 * to determine its action on wake up.
367 */
368 unsigned long flags;
350 /* 369 /*
351 * Timer used to complete commands that have been active for too long. 370 * Timer used to complete commands that have been active for too long.
352 */ 371 */
@@ -372,18 +391,11 @@ struct driver_data {
372 391
373 int instance; /* Instance number. First device probed is 0, ... */ 392 int instance; /* Instance number. First device probed is 0, ... */
374 393
375 int protocol; /* FIXME: Protocol ops array index. */
376
377 struct gendisk *disk; /* Pointer to our gendisk structure. */ 394 struct gendisk *disk; /* Pointer to our gendisk structure. */
378 395
379 struct pci_dev *pdev; /* Pointer to the PCI device structure. */ 396 struct pci_dev *pdev; /* Pointer to the PCI device structure. */
380 397
381 struct request_queue *queue; /* Our request queue. */ 398 struct request_queue *queue; /* Our request queue. */
382 /*
383 * Semaphore used to lock out read/write commands during the
384 * execution of an internal command.
385 */
386 struct rw_semaphore internal_sem;
387 399
388 struct mtip_port *port; /* Pointer to the port data structure. */ 400 struct mtip_port *port; /* Pointer to the port data structure. */
389 401
@@ -403,6 +415,8 @@ struct driver_data {
403 atomic_t resumeflag; /* Atomic variable to track suspend/resume */ 415 atomic_t resumeflag; /* Atomic variable to track suspend/resume */
404 416
405 atomic_t eh_active; /* Flag for error handling tracking */ 417 atomic_t eh_active; /* Flag for error handling tracking */
418
419 struct task_struct *mtip_svc_handler; /* task_struct of svc thd */
406}; 420};
407 421
408#endif 422#endif