blob: cf8873cbca3f23bedfbda5797734edef23eba96e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Block OSM structures/API
3 *
4 * Copyright (C) 1999-2002 Red Hat Software
5 *
6 * Written by Alan Cox, Building Number Three Ltd
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * For the purpose of avoiding doubt the preferred form of the work
19 * for making modifications shall be a standards compliant form such
20 * gzipped tar and not one requiring a proprietary or patent encumbered
21 * tool to unpack.
22 *
23 * Fixes/additions:
24 * Steve Ralston:
25 * Multiple device handling error fixes,
26 * Added a queue depth.
27 * Alan Cox:
28 * FC920 has an rmw bug. Dont or in the end marker.
29 * Removed queue walk, fixed for 64bitness.
30 * Rewrote much of the code over time
31 * Added indirect block lists
32 * Handle 64K limits on many controllers
33 * Don't use indirects on the Promise (breaks)
34 * Heavily chop down the queue depths
35 * Deepak Saxena:
36 * Independent queues per IOP
37 * Support for dynamic device creation/deletion
38 * Code cleanup
39 * Support for larger I/Os through merge* functions
40 * (taken from DAC960 driver)
41 * Boji T Kannanthanam:
42 * Set the I2O Block devices to be detected in increasing
43 * order of TIDs during boot.
44 * Search and set the I2O block device that we boot off
45 * from as the first device to be claimed (as /dev/i2o/hda)
46 * Properly attach/detach I2O gendisk structure from the
47 * system gendisk list. The I2O block devices now appear in
48 * /proc/partitions.
49 * Markus Lidel <Markus.Lidel@shadowconnect.com>:
50 * Minor bugfixes for 2.6.
51 */
52
53#ifndef I2O_BLOCK_OSM_H
54#define I2O_BLOCK_OSM_H
55
56#define I2O_BLOCK_RETRY_TIME HZ/4
57#define I2O_BLOCK_MAX_OPEN_REQUESTS 50
58
Markus Lidelb2aaee32005-06-23 22:02:19 -070059/* request queue sizes */
60#define I2O_BLOCK_REQ_MEMPOOL_SIZE 32
61
62#define KERNEL_SECTOR_SHIFT 9
63#define KERNEL_SECTOR_SIZE (1 << KERNEL_SECTOR_SHIFT)
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065/* I2O Block OSM mempool struct */
66struct i2o_block_mempool {
Christoph Lametere18b8902006-12-06 20:33:20 -080067 struct kmem_cache *slab;
Markus Lidelf33213e2005-06-23 22:02:23 -070068 mempool_t *pool;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069};
70
71/* I2O Block device descriptor */
72struct i2o_block_device {
73 struct i2o_device *i2o_dev; /* pointer to I2O device */
74 struct gendisk *gd;
Markus Lidelf33213e2005-06-23 22:02:23 -070075 spinlock_t lock; /* queue lock */
Lucas De Marchi25985ed2011-03-30 22:57:33 -030076 struct list_head open_queue; /* list of transferred, but unfinished
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 requests */
78 unsigned int open_queue_depth; /* number of requests in the queue */
79
Markus Lidelf33213e2005-06-23 22:02:23 -070080 int rcache; /* read cache flags */
81 int wcache; /* write cache flags */
Linus Torvalds1da177e2005-04-16 15:20:36 -070082 int flags;
Markus Lidelf33213e2005-06-23 22:02:23 -070083 u16 power; /* power state */
84 int media_change_flag; /* media changed flag */
Linus Torvalds1da177e2005-04-16 15:20:36 -070085};
86
87/* I2O Block device request */
Markus Lidelf33213e2005-06-23 22:02:23 -070088struct i2o_block_request {
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 struct list_head queue;
Markus Lidelf33213e2005-06-23 22:02:23 -070090 struct request *req; /* corresponding request */
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 struct i2o_block_device *i2o_blk_dev; /* I2O block device */
Markus Lidelf33213e2005-06-23 22:02:23 -070092 struct device *dev; /* device used for DMA */
93 int sg_nents; /* number of SG elements */
94 struct scatterlist sg_table[I2O_MAX_PHYS_SEGMENTS]; /* SG table */
Linus Torvalds1da177e2005-04-16 15:20:36 -070095};
96
97/* I2O Block device delayed request */
Markus Lidelf33213e2005-06-23 22:02:23 -070098struct i2o_block_delayed_request {
David Howellsc4028952006-11-22 14:57:56 +000099 struct delayed_work work;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 struct request_queue *queue;
101};
102
103#endif