aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/arch-pxa/pxa27x_keyboard.h13
-rw-r--r--include/asm-arm/arch-pxa/pxa27x_keypad.h56
-rw-r--r--include/asm-arm/arch-pxa/tosa.h30
-rw-r--r--include/linux/enclosure.h129
-rw-r--r--include/linux/hrtimer.h5
-rw-r--r--include/linux/input.h7
-rw-r--r--include/linux/ktime.h3
-rw-r--r--include/scsi/iscsi_proto.h4
-rw-r--r--include/scsi/libiscsi.h30
-rw-r--r--include/scsi/scsi.h14
-rw-r--r--include/scsi/scsi_host.h44
-rw-r--r--include/scsi/scsi_transport_iscsi.h43
12 files changed, 315 insertions, 63 deletions
diff --git a/include/asm-arm/arch-pxa/pxa27x_keyboard.h b/include/asm-arm/arch-pxa/pxa27x_keyboard.h
deleted file mode 100644
index 3aaff923b2ca..000000000000
--- a/include/asm-arm/arch-pxa/pxa27x_keyboard.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#define PXAKBD_MAXROW 8
2#define PXAKBD_MAXCOL 8
3
4struct pxa27x_keyboard_platform_data {
5 int nr_rows, nr_cols;
6 int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL];
7 int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL];
8
9#ifdef CONFIG_PM
10 u32 reg_kpc;
11 u32 reg_kprec;
12#endif
13};
diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h
new file mode 100644
index 000000000000..644f7609b523
--- /dev/null
+++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h
@@ -0,0 +1,56 @@
1#ifndef __ASM_ARCH_PXA27x_KEYPAD_H
2#define __ASM_ARCH_PXA27x_KEYPAD_H
3
4#include <linux/input.h>
5
6#define MAX_MATRIX_KEY_ROWS (8)
7#define MAX_MATRIX_KEY_COLS (8)
8
9/* pxa3xx keypad platform specific parameters
10 *
11 * NOTE:
12 * 1. direct_key_num indicates the number of keys in the direct keypad
13 * _plus_ the number of rotary-encoder sensor inputs, this can be
14 * left as 0 if only rotary encoders are enabled, the driver will
15 * automatically calculate this
16 *
17 * 2. direct_key_map is the key code map for the direct keys, if rotary
18 * encoder(s) are enabled, direct key 0/1(2/3) will be ignored
19 *
20 * 3. rotary can be either interpreted as a relative input event (e.g.
21 * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
22 *
23 * 4. matrix key and direct key will use the same debounce_interval by
24 * default, which should be sufficient in most cases
25 */
26struct pxa27x_keypad_platform_data {
27
28 /* code map for the matrix keys */
29 unsigned int matrix_key_rows;
30 unsigned int matrix_key_cols;
31 unsigned int *matrix_key_map;
32 int matrix_key_map_size;
33
34 /* direct keys */
35 int direct_key_num;
36 unsigned int direct_key_map[8];
37
38 /* rotary encoders 0 */
39 int enable_rotary0;
40 int rotary0_rel_code;
41 int rotary0_up_key;
42 int rotary0_down_key;
43
44 /* rotary encoders 1 */
45 int enable_rotary1;
46 int rotary1_rel_code;
47 int rotary1_up_key;
48 int rotary1_down_key;
49
50 /* key debounce interval */
51 unsigned int debounce_interval;
52};
53
54#define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val))
55
56#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h
index c3364a2c4758..c05e4faf85a6 100644
--- a/include/asm-arm/arch-pxa/tosa.h
+++ b/include/asm-arm/arch-pxa/tosa.h
@@ -163,4 +163,34 @@
163 163
164extern struct platform_device tosascoop_jc_device; 164extern struct platform_device tosascoop_jc_device;
165extern struct platform_device tosascoop_device; 165extern struct platform_device tosascoop_device;
166
167#define TOSA_KEY_SYNC KEY_102ND /* ??? */
168
169
170#ifndef CONFIG_KEYBOARD_TOSA_USE_EXT_KEYCODES
171#define TOSA_KEY_RECORD KEY_YEN
172#define TOSA_KEY_ADDRESSBOOK KEY_KATAKANA
173#define TOSA_KEY_CANCEL KEY_ESC
174#define TOSA_KEY_CENTER KEY_HIRAGANA
175#define TOSA_KEY_OK KEY_HENKAN
176#define TOSA_KEY_CALENDAR KEY_KATAKANAHIRAGANA
177#define TOSA_KEY_HOMEPAGE KEY_HANGEUL
178#define TOSA_KEY_LIGHT KEY_MUHENKAN
179#define TOSA_KEY_MENU KEY_HANJA
180#define TOSA_KEY_FN KEY_RIGHTALT
181#define TOSA_KEY_MAIL KEY_ZENKAKUHANKAKU
182#else
183#define TOSA_KEY_RECORD KEY_RECORD
184#define TOSA_KEY_ADDRESSBOOK KEY_ADDRESSBOOK
185#define TOSA_KEY_CANCEL KEY_CANCEL
186#define TOSA_KEY_CENTER KEY_SELECT /* ??? */
187#define TOSA_KEY_OK KEY_OK
188#define TOSA_KEY_CALENDAR KEY_CALENDAR
189#define TOSA_KEY_HOMEPAGE KEY_HOMEPAGE
190#define TOSA_KEY_LIGHT KEY_KBDILLUMTOGGLE
191#define TOSA_KEY_MENU KEY_MENU
192#define TOSA_KEY_FN KEY_FN
193#define TOSA_KEY_MAIL KEY_MAIL
194#endif
195
166#endif /* _ASM_ARCH_TOSA_H_ */ 196#endif /* _ASM_ARCH_TOSA_H_ */
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
new file mode 100644
index 000000000000..a5978f18ca40
--- /dev/null
+++ b/include/linux/enclosure.h
@@ -0,0 +1,129 @@
1/*
2 * Enclosure Services
3 *
4 * Copyright (C) 2008 James Bottomley <James.Bottomley@HansenPartnership.com>
5 *
6**-----------------------------------------------------------------------------
7**
8** This program is free software; you can redistribute it and/or
9** modify it under the terms of the GNU General Public License
10** version 2 as published by the Free Software Foundation.
11**
12** This program is distributed in the hope that it will be useful,
13** but WITHOUT ANY WARRANTY; without even the implied warranty of
14** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15** GNU General Public License for more details.
16**
17** You should have received a copy of the GNU General Public License
18** along with this program; if not, write to the Free Software
19** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20**
21**-----------------------------------------------------------------------------
22*/
23#ifndef _LINUX_ENCLOSURE_H_
24#define _LINUX_ENCLOSURE_H_
25
26#include <linux/device.h>
27#include <linux/list.h>
28
29/* A few generic types ... taken from ses-2 */
30enum enclosure_component_type {
31 ENCLOSURE_COMPONENT_DEVICE = 0x01,
32 ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17,
33};
34
35/* ses-2 common element status */
36enum enclosure_status {
37 ENCLOSURE_STATUS_UNSUPPORTED = 0,
38 ENCLOSURE_STATUS_OK,
39 ENCLOSURE_STATUS_CRITICAL,
40 ENCLOSURE_STATUS_NON_CRITICAL,
41 ENCLOSURE_STATUS_UNRECOVERABLE,
42 ENCLOSURE_STATUS_NOT_INSTALLED,
43 ENCLOSURE_STATUS_UNKNOWN,
44 ENCLOSURE_STATUS_UNAVAILABLE,
45};
46
47/* SFF-8485 activity light settings */
48enum enclosure_component_setting {
49 ENCLOSURE_SETTING_DISABLED = 0,
50 ENCLOSURE_SETTING_ENABLED = 1,
51 ENCLOSURE_SETTING_BLINK_A_ON_OFF = 2,
52 ENCLOSURE_SETTING_BLINK_A_OFF_ON = 3,
53 ENCLOSURE_SETTING_BLINK_B_ON_OFF = 6,
54 ENCLOSURE_SETTING_BLINK_B_OFF_ON = 7,
55};
56
57struct enclosure_device;
58struct enclosure_component;
59struct enclosure_component_callbacks {
60 void (*get_status)(struct enclosure_device *,
61 struct enclosure_component *);
62 int (*set_status)(struct enclosure_device *,
63 struct enclosure_component *,
64 enum enclosure_status);
65 void (*get_fault)(struct enclosure_device *,
66 struct enclosure_component *);
67 int (*set_fault)(struct enclosure_device *,
68 struct enclosure_component *,
69 enum enclosure_component_setting);
70 void (*get_active)(struct enclosure_device *,
71 struct enclosure_component *);
72 int (*set_active)(struct enclosure_device *,
73 struct enclosure_component *,
74 enum enclosure_component_setting);
75 void (*get_locate)(struct enclosure_device *,
76 struct enclosure_component *);
77 int (*set_locate)(struct enclosure_device *,
78 struct enclosure_component *,
79 enum enclosure_component_setting);
80};
81
82
83struct enclosure_component {
84 void *scratch;
85 struct class_device cdev;
86 enum enclosure_component_type type;
87 int number;
88 int fault;
89 int active;
90 int locate;
91 enum enclosure_status status;
92};
93
94struct enclosure_device {
95 void *scratch;
96 struct list_head node;
97 struct class_device cdev;
98 struct enclosure_component_callbacks *cb;
99 int components;
100 struct enclosure_component component[0];
101};
102
103static inline struct enclosure_device *
104to_enclosure_device(struct class_device *dev)
105{
106 return container_of(dev, struct enclosure_device, cdev);
107}
108
109static inline struct enclosure_component *
110to_enclosure_component(struct class_device *dev)
111{
112 return container_of(dev, struct enclosure_component, cdev);
113}
114
115struct enclosure_device *
116enclosure_register(struct device *, const char *, int,
117 struct enclosure_component_callbacks *);
118void enclosure_unregister(struct enclosure_device *);
119struct enclosure_component *
120enclosure_component_register(struct enclosure_device *, unsigned int,
121 enum enclosure_component_type, const char *);
122int enclosure_add_device(struct enclosure_device *enclosure, int component,
123 struct device *dev);
124int enclosure_remove_device(struct enclosure_device *enclosure, int component);
125struct enclosure_device *enclosure_find(struct device *dev);
126int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *),
127 void *data);
128
129#endif /* _LINUX_ENCLOSURE_H_ */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 8371b664b41f..203591e23210 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -225,11 +225,14 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
225 * idea of the (in)accuracy of timers. Timer values are rounded up to 225 * idea of the (in)accuracy of timers. Timer values are rounded up to
226 * this resolution values. 226 * this resolution values.
227 */ 227 */
228# define KTIME_HIGH_RES (ktime_t) { .tv64 = 1 } 228# define HIGH_RES_NSEC 1
229# define KTIME_HIGH_RES (ktime_t) { .tv64 = HIGH_RES_NSEC }
230# define MONOTONIC_RES_NSEC HIGH_RES_NSEC
229# define KTIME_MONOTONIC_RES KTIME_HIGH_RES 231# define KTIME_MONOTONIC_RES KTIME_HIGH_RES
230 232
231#else 233#else
232 234
235# define MONOTONIC_RES_NSEC LOW_RES_NSEC
233# define KTIME_MONOTONIC_RES KTIME_LOW_RES 236# define KTIME_MONOTONIC_RES KTIME_LOW_RES
234 237
235/* 238/*
diff --git a/include/linux/input.h b/include/linux/input.h
index 056a17a4f34f..1bdc39a8c76c 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1020,7 +1020,6 @@ struct ff_effect {
1020 * @going_away: marks devices that are in a middle of unregistering and 1020 * @going_away: marks devices that are in a middle of unregistering and
1021 * causes input_open_device*() fail with -ENODEV. 1021 * causes input_open_device*() fail with -ENODEV.
1022 * @dev: driver model's view of this device 1022 * @dev: driver model's view of this device
1023 * @cdev: union for struct device pointer
1024 * @h_list: list of input handles associated with the device. When 1023 * @h_list: list of input handles associated with the device. When
1025 * accessing the list dev->mutex must be held 1024 * accessing the list dev->mutex must be held
1026 * @node: used to place the device onto input_dev_list 1025 * @node: used to place the device onto input_dev_list
@@ -1085,9 +1084,6 @@ struct input_dev {
1085 int going_away; 1084 int going_away;
1086 1085
1087 struct device dev; 1086 struct device dev;
1088 union { /* temporarily so while we switching to struct device */
1089 struct device *dev;
1090 } cdev;
1091 1087
1092 struct list_head h_list; 1088 struct list_head h_list;
1093 struct list_head node; 1089 struct list_head node;
@@ -1311,6 +1307,9 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1311 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1307 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
1312} 1308}
1313 1309
1310int input_get_keycode(struct input_dev *dev, int scancode, int *keycode);
1311int input_set_keycode(struct input_dev *dev, int scancode, int keycode);
1312
1314extern struct class input_class; 1313extern struct class input_class;
1315 1314
1316/** 1315/**
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index a6ddec141f96..36c542b70c6d 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -316,7 +316,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
316 * idea of the (in)accuracy of timers. Timer values are rounded up to 316 * idea of the (in)accuracy of timers. Timer values are rounded up to
317 * this resolution values. 317 * this resolution values.
318 */ 318 */
319#define KTIME_LOW_RES (ktime_t){ .tv64 = TICK_NSEC } 319#define LOW_RES_NSEC TICK_NSEC
320#define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC }
320 321
321/* Get the monotonic time in timespec format: */ 322/* Get the monotonic time in timespec format: */
322extern void ktime_get_ts(struct timespec *ts); 323extern void ktime_get_ts(struct timespec *ts);
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 318a909e7ae1..5ffec8ad6964 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -45,8 +45,8 @@
45/* initiator tags; opaque for target */ 45/* initiator tags; opaque for target */
46typedef uint32_t __bitwise__ itt_t; 46typedef uint32_t __bitwise__ itt_t;
47/* below makes sense only for initiator that created this tag */ 47/* below makes sense only for initiator that created this tag */
48#define build_itt(itt, id, age) ((__force itt_t)\ 48#define build_itt(itt, age) ((__force itt_t)\
49 ((itt) | ((id) << ISCSI_CID_SHIFT) | ((age) << ISCSI_AGE_SHIFT))) 49 ((itt) | ((age) << ISCSI_AGE_SHIFT)))
50#define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK) 50#define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK)
51#define RESERVED_ITT ((__force itt_t)0xffffffff) 51#define RESERVED_ITT ((__force itt_t)0xffffffff)
52 52
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 889f51fabab9..7b90b63fb5c7 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -70,8 +70,6 @@ enum {
70#define ISCSI_SUSPEND_BIT 1 70#define ISCSI_SUSPEND_BIT 1
71 71
72#define ISCSI_ITT_MASK (0xfff) 72#define ISCSI_ITT_MASK (0xfff)
73#define ISCSI_CID_SHIFT 12
74#define ISCSI_CID_MASK (0xffff << ISCSI_CID_SHIFT)
75#define ISCSI_AGE_SHIFT 28 73#define ISCSI_AGE_SHIFT 28
76#define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT) 74#define ISCSI_AGE_MASK (0xf << ISCSI_AGE_SHIFT)
77 75
@@ -135,6 +133,14 @@ static inline void* iscsi_next_hdr(struct iscsi_cmd_task *ctask)
135 return (void*)ctask->hdr + ctask->hdr_len; 133 return (void*)ctask->hdr + ctask->hdr_len;
136} 134}
137 135
136/* Connection's states */
137enum {
138 ISCSI_CONN_INITIAL_STAGE,
139 ISCSI_CONN_STARTED,
140 ISCSI_CONN_STOPPED,
141 ISCSI_CONN_CLEANUP_WAIT,
142};
143
138struct iscsi_conn { 144struct iscsi_conn {
139 struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ 145 struct iscsi_cls_conn *cls_conn; /* ptr to class connection */
140 void *dd_data; /* iscsi_transport data */ 146 void *dd_data; /* iscsi_transport data */
@@ -227,6 +233,17 @@ struct iscsi_pool {
227 int max; /* Max number of elements */ 233 int max; /* Max number of elements */
228}; 234};
229 235
236/* Session's states */
237enum {
238 ISCSI_STATE_FREE = 1,
239 ISCSI_STATE_LOGGED_IN,
240 ISCSI_STATE_FAILED,
241 ISCSI_STATE_TERMINATE,
242 ISCSI_STATE_IN_RECOVERY,
243 ISCSI_STATE_RECOVERY_FAILED,
244 ISCSI_STATE_LOGGING_OUT,
245};
246
230struct iscsi_session { 247struct iscsi_session {
231 /* 248 /*
232 * Syncs up the scsi eh thread with the iscsi eh thread when sending 249 * Syncs up the scsi eh thread with the iscsi eh thread when sending
@@ -325,6 +342,10 @@ extern int iscsi_session_get_param(struct iscsi_cls_session *cls_session,
325#define session_to_cls(_sess) \ 342#define session_to_cls(_sess) \
326 hostdata_session(_sess->host->hostdata) 343 hostdata_session(_sess->host->hostdata)
327 344
345#define iscsi_session_printk(prefix, _sess, fmt, a...) \
346 iscsi_cls_session_printk(prefix, \
347 (struct iscsi_cls_session *)session_to_cls(_sess), fmt, ##a)
348
328/* 349/*
329 * connection management 350 * connection management
330 */ 351 */
@@ -339,6 +360,9 @@ extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
339extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 360extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
340 enum iscsi_param param, char *buf); 361 enum iscsi_param param, char *buf);
341 362
363#define iscsi_conn_printk(prefix, _c, fmt, a...) \
364 iscsi_cls_conn_printk(prefix, _c->cls_conn, fmt, ##a)
365
342/* 366/*
343 * pdu and task processing 367 * pdu and task processing
344 */ 368 */
@@ -349,8 +373,6 @@ extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
349 char *, uint32_t); 373 char *, uint32_t);
350extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, 374extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
351 char *, int); 375 char *, int);
352extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
353 char *, int);
354extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *, 376extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *,
355 uint32_t *); 377 uint32_t *);
356extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); 378extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 82251575a9b4..1f74bcd603fe 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -235,6 +235,20 @@ static inline int scsi_status_is_good(int status)
235#define TYPE_RBC 0x0e 235#define TYPE_RBC 0x0e
236#define TYPE_NO_LUN 0x7f 236#define TYPE_NO_LUN 0x7f
237 237
238/* SCSI protocols; these are taken from SPC-3 section 7.5 */
239enum scsi_protocol {
240 SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
241 SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
242 SCSI_PROTOCOL_SSA = 2, /* Serial Storage Architecture - Obsolete */
243 SCSI_PROTOCOL_SBP = 3, /* firewire */
244 SCSI_PROTOCOL_SRP = 4, /* Infiniband RDMA */
245 SCSI_PROTOCOL_ISCSI = 5,
246 SCSI_PROTOCOL_SAS = 6,
247 SCSI_PROTOCOL_ADT = 7, /* Media Changers */
248 SCSI_PROTOCOL_ATA = 8,
249 SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
250};
251
238/* Returns a human-readable name for the device */ 252/* Returns a human-readable name for the device */
239extern const char * scsi_device_type(unsigned type); 253extern const char * scsi_device_type(unsigned type);
240 254
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 5c58d594126a..d1299e999723 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -280,39 +280,45 @@ struct scsi_host_template {
280 * If the host wants to be called before the scan starts, but 280 * If the host wants to be called before the scan starts, but
281 * after the midlayer has set up ready for the scan, it can fill 281 * after the midlayer has set up ready for the scan, it can fill
282 * in this function. 282 * in this function.
283 *
284 * Status: OPTIONAL
283 */ 285 */
284 void (* scan_start)(struct Scsi_Host *); 286 void (* scan_start)(struct Scsi_Host *);
285 287
286 /* 288 /*
287 * fill in this function to allow the queue depth of this host 289 * Fill in this function to allow the queue depth of this host
288 * to be changeable (on a per device basis). returns either 290 * to be changeable (on a per device basis). Returns either
289 * the current queue depth setting (may be different from what 291 * the current queue depth setting (may be different from what
290 * was passed in) or an error. An error should only be 292 * was passed in) or an error. An error should only be
291 * returned if the requested depth is legal but the driver was 293 * returned if the requested depth is legal but the driver was
292 * unable to set it. If the requested depth is illegal, the 294 * unable to set it. If the requested depth is illegal, the
293 * driver should set and return the closest legal queue depth. 295 * driver should set and return the closest legal queue depth.
294 * 296 *
297 * Status: OPTIONAL
295 */ 298 */
296 int (* change_queue_depth)(struct scsi_device *, int); 299 int (* change_queue_depth)(struct scsi_device *, int);
297 300
298 /* 301 /*
299 * fill in this function to allow the changing of tag types 302 * Fill in this function to allow the changing of tag types
300 * (this also allows the enabling/disabling of tag command 303 * (this also allows the enabling/disabling of tag command
301 * queueing). An error should only be returned if something 304 * queueing). An error should only be returned if something
302 * went wrong in the driver while trying to set the tag type. 305 * went wrong in the driver while trying to set the tag type.
303 * If the driver doesn't support the requested tag type, then 306 * If the driver doesn't support the requested tag type, then
304 * it should set the closest type it does support without 307 * it should set the closest type it does support without
305 * returning an error. Returns the actual tag type set. 308 * returning an error. Returns the actual tag type set.
309 *
310 * Status: OPTIONAL
306 */ 311 */
307 int (* change_queue_type)(struct scsi_device *, int); 312 int (* change_queue_type)(struct scsi_device *, int);
308 313
309 /* 314 /*
310 * This function determines the bios parameters for a given 315 * This function determines the BIOS parameters for a given
311 * harddisk. These tend to be numbers that are made up by 316 * harddisk. These tend to be numbers that are made up by
312 * the host adapter. Parameters: 317 * the host adapter. Parameters:
313 * size, device, list (heads, sectors, cylinders) 318 * size, device, list (heads, sectors, cylinders)
314 * 319 *
315 * Status: OPTIONAL */ 320 * Status: OPTIONAL
321 */
316 int (* bios_param)(struct scsi_device *, struct block_device *, 322 int (* bios_param)(struct scsi_device *, struct block_device *,
317 sector_t, int []); 323 sector_t, int []);
318 324
@@ -351,7 +357,7 @@ struct scsi_host_template {
351 357
352 /* 358 /*
353 * This determines if we will use a non-interrupt driven 359 * This determines if we will use a non-interrupt driven
354 * or an interrupt driven scheme, It is set to the maximum number 360 * or an interrupt driven scheme. It is set to the maximum number
355 * of simultaneous commands a given host adapter will accept. 361 * of simultaneous commands a given host adapter will accept.
356 */ 362 */
357 int can_queue; 363 int can_queue;
@@ -372,12 +378,12 @@ struct scsi_host_template {
372 unsigned short sg_tablesize; 378 unsigned short sg_tablesize;
373 379
374 /* 380 /*
375 * If the host adapter has limitations beside segment count 381 * Set this if the host adapter has limitations beside segment count.
376 */ 382 */
377 unsigned short max_sectors; 383 unsigned short max_sectors;
378 384
379 /* 385 /*
380 * dma scatter gather segment boundary limit. a segment crossing this 386 * DMA scatter gather segment boundary limit. A segment crossing this
381 * boundary will be split in two. 387 * boundary will be split in two.
382 */ 388 */
383 unsigned long dma_boundary; 389 unsigned long dma_boundary;
@@ -386,7 +392,7 @@ struct scsi_host_template {
386 * This specifies "machine infinity" for host templates which don't 392 * This specifies "machine infinity" for host templates which don't
387 * limit the transfer size. Note this limit represents an absolute 393 * limit the transfer size. Note this limit represents an absolute
388 * maximum, and may be over the transfer limits allowed for 394 * maximum, and may be over the transfer limits allowed for
389 * individual devices (e.g. 256 for SCSI-1) 395 * individual devices (e.g. 256 for SCSI-1).
390 */ 396 */
391#define SCSI_DEFAULT_MAX_SECTORS 1024 397#define SCSI_DEFAULT_MAX_SECTORS 1024
392 398
@@ -413,12 +419,12 @@ struct scsi_host_template {
413 unsigned supported_mode:2; 419 unsigned supported_mode:2;
414 420
415 /* 421 /*
416 * true if this host adapter uses unchecked DMA onto an ISA bus. 422 * True if this host adapter uses unchecked DMA onto an ISA bus.
417 */ 423 */
418 unsigned unchecked_isa_dma:1; 424 unsigned unchecked_isa_dma:1;
419 425
420 /* 426 /*
421 * true if this host adapter can make good use of clustering. 427 * True if this host adapter can make good use of clustering.
422 * I originally thought that if the tablesize was large that it 428 * I originally thought that if the tablesize was large that it
423 * was a waste of CPU cycles to prepare a cluster list, but 429 * was a waste of CPU cycles to prepare a cluster list, but
424 * it works out that the Buslogic is faster if you use a smaller 430 * it works out that the Buslogic is faster if you use a smaller
@@ -428,7 +434,7 @@ struct scsi_host_template {
428 unsigned use_clustering:1; 434 unsigned use_clustering:1;
429 435
430 /* 436 /*
431 * True for emulated SCSI host adapters (e.g. ATAPI) 437 * True for emulated SCSI host adapters (e.g. ATAPI).
432 */ 438 */
433 unsigned emulated:1; 439 unsigned emulated:1;
434 440
@@ -438,12 +444,12 @@ struct scsi_host_template {
438 unsigned skip_settle_delay:1; 444 unsigned skip_settle_delay:1;
439 445
440 /* 446 /*
441 * ordered write support 447 * True if we are using ordered write support.
442 */ 448 */
443 unsigned ordered_tag:1; 449 unsigned ordered_tag:1;
444 450
445 /* 451 /*
446 * Countdown for host blocking with no commands outstanding 452 * Countdown for host blocking with no commands outstanding.
447 */ 453 */
448 unsigned int max_host_blocked; 454 unsigned int max_host_blocked;
449 455
@@ -522,8 +528,8 @@ struct Scsi_Host {
522 struct scsi_transport_template *transportt; 528 struct scsi_transport_template *transportt;
523 529
524 /* 530 /*
525 * area to keep a shared tag map (if needed, will be 531 * Area to keep a shared tag map (if needed, will be
526 * NULL if not) 532 * NULL if not).
527 */ 533 */
528 struct blk_queue_tag *bqt; 534 struct blk_queue_tag *bqt;
529 535
@@ -596,16 +602,16 @@ struct Scsi_Host {
596 /* 602 /*
597 * Host uses correct SCSI ordering not PC ordering. The bit is 603 * Host uses correct SCSI ordering not PC ordering. The bit is
598 * set for the minority of drivers whose authors actually read 604 * set for the minority of drivers whose authors actually read
599 * the spec ;) 605 * the spec ;).
600 */ 606 */
601 unsigned reverse_ordering:1; 607 unsigned reverse_ordering:1;
602 608
603 /* 609 /*
604 * ordered write support 610 * Ordered write support
605 */ 611 */
606 unsigned ordered_tag:1; 612 unsigned ordered_tag:1;
607 613
608 /* task mgmt function in progress */ 614 /* Task mgmt function in progress */
609 unsigned tmf_in_progress:1; 615 unsigned tmf_in_progress:1;
610 616
611 /* Asynchronous scan in progress */ 617 /* Asynchronous scan in progress */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 404f11d331d6..dbc96ef4cc72 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -149,13 +149,6 @@ extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error);
149extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 149extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
150 char *data, uint32_t data_size); 150 char *data, uint32_t data_size);
151 151
152
153/* Connection's states */
154#define ISCSI_CONN_INITIAL_STAGE 0
155#define ISCSI_CONN_STARTED 1
156#define ISCSI_CONN_STOPPED 2
157#define ISCSI_CONN_CLEANUP_WAIT 3
158
159struct iscsi_cls_conn { 152struct iscsi_cls_conn {
160 struct list_head conn_list; /* item in connlist */ 153 struct list_head conn_list; /* item in connlist */
161 void *dd_data; /* LLD private data */ 154 void *dd_data; /* LLD private data */
@@ -169,27 +162,31 @@ struct iscsi_cls_conn {
169#define iscsi_dev_to_conn(_dev) \ 162#define iscsi_dev_to_conn(_dev) \
170 container_of(_dev, struct iscsi_cls_conn, dev) 163 container_of(_dev, struct iscsi_cls_conn, dev)
171 164
172/* Session's states */ 165#define iscsi_conn_to_session(_conn) \
173#define ISCSI_STATE_FREE 1 166 iscsi_dev_to_session(_conn->dev.parent)
174#define ISCSI_STATE_LOGGED_IN 2 167
175#define ISCSI_STATE_FAILED 3 168/* iscsi class session state */
176#define ISCSI_STATE_TERMINATE 4 169enum {
177#define ISCSI_STATE_IN_RECOVERY 5 170 ISCSI_SESSION_LOGGED_IN,
178#define ISCSI_STATE_RECOVERY_FAILED 6 171 ISCSI_SESSION_FAILED,
179#define ISCSI_STATE_LOGGING_OUT 7 172 ISCSI_SESSION_FREE,
173};
180 174
181struct iscsi_cls_session { 175struct iscsi_cls_session {
182 struct list_head sess_list; /* item in session_list */ 176 struct list_head sess_list; /* item in session_list */
183 struct list_head host_list; 177 struct list_head host_list;
184 struct iscsi_transport *transport; 178 struct iscsi_transport *transport;
179 spinlock_t lock;
180 struct work_struct scan_work;
181 struct work_struct unbind_work;
185 182
186 /* recovery fields */ 183 /* recovery fields */
187 int recovery_tmo; 184 int recovery_tmo;
188 struct delayed_work recovery_work; 185 struct delayed_work recovery_work;
189 struct work_struct unbind_work;
190 186
191 int target_id; 187 int target_id;
192 188
189 int state;
193 int sid; /* session id */ 190 int sid; /* session id */
194 void *dd_data; /* LLD private data */ 191 void *dd_data; /* LLD private data */
195 struct device dev; /* sysfs transport/container device */ 192 struct device dev; /* sysfs transport/container device */
@@ -206,14 +203,22 @@ struct iscsi_cls_session {
206 203
207struct iscsi_host { 204struct iscsi_host {
208 struct list_head sessions; 205 struct list_head sessions;
206 atomic_t nr_scans;
209 struct mutex mutex; 207 struct mutex mutex;
210 struct workqueue_struct *unbind_workq; 208 struct workqueue_struct *scan_workq;
211 char unbind_workq_name[KOBJ_NAME_LEN]; 209 char scan_workq_name[KOBJ_NAME_LEN];
212}; 210};
213 211
214/* 212/*
215 * session and connection functions that can be used by HW iSCSI LLDs 213 * session and connection functions that can be used by HW iSCSI LLDs
216 */ 214 */
215#define iscsi_cls_session_printk(prefix, _cls_session, fmt, a...) \
216 dev_printk(prefix, &(_cls_session)->dev, fmt, ##a)
217
218#define iscsi_cls_conn_printk(prefix, _cls_conn, fmt, a...) \
219 dev_printk(prefix, &(_cls_conn)->dev, fmt, ##a)
220
221extern int iscsi_session_chkready(struct iscsi_cls_session *session);
217extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost, 222extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost,
218 struct iscsi_transport *transport); 223 struct iscsi_transport *transport);
219extern int iscsi_add_session(struct iscsi_cls_session *session, 224extern int iscsi_add_session(struct iscsi_cls_session *session,
@@ -231,6 +236,6 @@ extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
231extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); 236extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
232extern void iscsi_unblock_session(struct iscsi_cls_session *session); 237extern void iscsi_unblock_session(struct iscsi_cls_session *session);
233extern void iscsi_block_session(struct iscsi_cls_session *session); 238extern void iscsi_block_session(struct iscsi_cls_session *session);
234 239extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time);
235 240
236#endif 241#endif