aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-12-11 04:26:12 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-11 04:26:12 -0500
commite3f4e1cbc341bc2020241d8119bd078db3ec3b85 (patch)
tree8b23624cc792f60d0bf86d787c3514cf0fb04418 /include
parentadfe67ddffbea51322b118896178bd71aaa4b4d8 (diff)
parentd71cb81af3817193bc605de061da0499934263a6 (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpixf.h5
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/unistd.h2
-rw-r--r--include/crypto/algapi.h1
-rw-r--r--include/crypto/cryptd.h1
-rw-r--r--include/linux/cciss_ioctl.h2
-rw-r--r--include/linux/chio.h2
-rw-r--r--include/linux/clockchips.h19
-rw-r--r--include/linux/clocksource.h18
-rw-r--r--include/linux/crypto.h27
-rw-r--r--include/linux/dm-log-userspace.h2
-rw-r--r--include/linux/dmar.h10
-rw-r--r--include/linux/fb.h1
-rw-r--r--include/linux/hid.h1
-rw-r--r--include/linux/hpet.h2
-rw-r--r--include/linux/hrtimer.h4
-rw-r--r--include/linux/hw_random.h7
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/input-polldev.h22
-rw-r--r--include/linux/input.h13
-rw-r--r--include/linux/input/matrix_keypad.h3
-rw-r--r--include/linux/input/sh_keysc.h14
-rw-r--r--include/linux/input/sparse-keymap.h62
-rw-r--r--include/linux/irq.h2
-rw-r--r--include/linux/libata.h2
-rw-r--r--include/linux/mfd/ezx-pcap.h4
-rw-r--r--include/linux/mfd/sh_mobile_sdhi.h8
-rw-r--r--include/linux/mtd/ubi.h2
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/pktcdvd.h2
-rw-r--r--include/linux/reiserfs_fs.h71
-rw-r--r--include/linux/reiserfs_fs_sb.h20
-rw-r--r--include/linux/screen_info.h5
-rw-r--r--include/linux/serial_reg.h8
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/sh_intc.h7
-rw-r--r--include/linux/sh_pfc.h96
-rw-r--r--include/linux/spi/spi_bitbang.h2
-rw-r--r--include/linux/sysctl.h10
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timex.h9
-rw-r--r--include/linux/ucb1400.h4
-rw-r--r--include/linux/usb/wusb.h2
-rw-r--r--include/linux/videodev2.h9
-rw-r--r--include/linux/vt_kern.h3
-rw-r--r--include/linux/workqueue.h38
-rw-r--r--include/media/cx25840.h1
-rw-r--r--include/media/davinci/vpfe_capture.h2
-rw-r--r--include/media/ir-common.h43
-rw-r--r--include/media/v4l2-chip-ident.h23
-rw-r--r--include/media/v4l2-subdev.h103
-rw-r--r--include/media/videobuf-core.h4
-rw-r--r--include/media/videobuf-dma-contig.h2
-rw-r--r--include/media/videobuf-dma-sg.h2
-rw-r--r--include/media/videobuf-dvb.h4
-rw-r--r--include/media/videobuf-vmalloc.h4
-rw-r--r--include/net/sctp/structs.h2
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/net/wimax.h2
-rw-r--r--include/scsi/Kbuild1
-rw-r--r--include/scsi/fc/Kbuild4
-rw-r--r--include/scsi/fc/fc_els.h6
-rw-r--r--include/scsi/fc/fc_fcoe.h12
-rw-r--r--include/scsi/fc/fc_fcp.h8
-rw-r--r--include/scsi/fc/fc_fip.h12
-rw-r--r--include/scsi/fc/fc_fs.h2
-rw-r--r--include/scsi/fc/fc_gs.h2
-rw-r--r--include/scsi/fc/fc_ns.h35
-rw-r--r--include/scsi/fc_encode.h68
-rw-r--r--include/scsi/fc_frame.h22
-rw-r--r--include/scsi/iscsi_if.h3
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/libfc.h1158
-rw-r--r--include/scsi/libfcoe.h93
-rw-r--r--include/scsi/libiscsi.h4
-rw-r--r--include/scsi/libsas.h3
-rw-r--r--include/scsi/osd_initiator.h81
-rw-r--r--include/scsi/osd_protocol.h1
-rw-r--r--include/scsi/osd_sense.h3
-rw-r--r--include/scsi/scsi.h4
-rw-r--r--include/scsi/scsi_device.h12
-rw-r--r--include/scsi/scsi_dh.h6
-rw-r--r--include/scsi/scsi_host.h24
-rw-r--r--include/scsi/scsi_transport_fc.h1
-rw-r--r--include/sound/ac97_codec.h2
-rw-r--r--include/sound/wm8993.h2
-rw-r--r--include/trace/events/ext4.h54
-rw-r--r--include/video/sgivw.h11
90 files changed, 1537 insertions, 832 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e723b0fd8e41..5e1ad3cd1bbd 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20090903 50#define ACPI_CA_VERSION 0x20091112
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -154,7 +154,8 @@ acpi_status
154acpi_walk_namespace(acpi_object_type type, 154acpi_walk_namespace(acpi_object_type type,
155 acpi_handle start_object, 155 acpi_handle start_object,
156 u32 max_depth, 156 u32 max_depth,
157 acpi_walk_callback user_function, 157 acpi_walk_callback pre_order_visit,
158 acpi_walk_callback post_order_visit,
158 void *context, void **return_value); 159 void *context, void **return_value);
159 160
160acpi_status 161acpi_status
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 4c8d0afae711..fb2d63f13f4c 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -47,7 +47,7 @@
47 47
48#elif defined(CONFIG_SPARSEMEM_VMEMMAP) 48#elif defined(CONFIG_SPARSEMEM_VMEMMAP)
49 49
50/* memmap is virtually contigious. */ 50/* memmap is virtually contiguous. */
51#define __pfn_to_page(pfn) (vmemmap + (pfn)) 51#define __pfn_to_page(pfn) (vmemmap + (pfn))
52#define __page_to_pfn(page) (unsigned long)((page) - vmemmap) 52#define __page_to_pfn(page) (unsigned long)((page) - vmemmap)
53 53
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index d76b66acea95..7c38c147e5e6 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -631,7 +631,7 @@ __SYSCALL(__NR_perf_event_open, sys_perf_event_open)
631 * these are provided for both review and as a porting 631 * these are provided for both review and as a porting
632 * help for the C library version. 632 * help for the C library version.
633* 633*
634 * Last chance: are any of these important enought to 634 * Last chance: are any of these important enough to
635 * enable by default? 635 * enable by default?
636 */ 636 */
637#ifdef __ARCH_WANT_SYSCALL_NO_AT 637#ifdef __ARCH_WANT_SYSCALL_NO_AT
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 1ffb53f74d37..fc0d575c71e0 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -106,7 +106,6 @@ struct blkcipher_walk {
106extern const struct crypto_type crypto_ablkcipher_type; 106extern const struct crypto_type crypto_ablkcipher_type;
107extern const struct crypto_type crypto_aead_type; 107extern const struct crypto_type crypto_aead_type;
108extern const struct crypto_type crypto_blkcipher_type; 108extern const struct crypto_type crypto_blkcipher_type;
109extern const struct crypto_type crypto_hash_type;
110 109
111void crypto_mod_put(struct crypto_alg *alg); 110void crypto_mod_put(struct crypto_alg *alg);
112 111
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h
index 2f65a6e8ea4d..1c96b255017c 100644
--- a/include/crypto/cryptd.h
+++ b/include/crypto/cryptd.h
@@ -39,6 +39,7 @@ static inline struct cryptd_ahash *__cryptd_ahash_cast(
39struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name, 39struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name,
40 u32 type, u32 mask); 40 u32 type, u32 mask);
41struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); 41struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm);
42struct shash_desc *cryptd_shash_desc(struct ahash_request *req);
42void cryptd_free_ahash(struct cryptd_ahash *tfm); 43void cryptd_free_ahash(struct cryptd_ahash *tfm);
43 44
44#endif 45#endif
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
index cb57c30081a8..eb130b4d8e72 100644
--- a/include/linux/cciss_ioctl.h
+++ b/include/linux/cciss_ioctl.h
@@ -39,7 +39,7 @@ typedef __u32 DriverVer_type;
39#ifndef CCISS_CMD_H 39#ifndef CCISS_CMD_H
40// This defines are duplicated in cciss_cmd.h in the driver directory 40// This defines are duplicated in cciss_cmd.h in the driver directory
41 41
42//general boundary defintions 42//general boundary definitions
43#define SENSEINFOBYTES 32//note that this value may vary between host implementations 43#define SENSEINFOBYTES 32//note that this value may vary between host implementations
44 44
45//Command Status value 45//Command Status value
diff --git a/include/linux/chio.h b/include/linux/chio.h
index 519248d8b2b6..d9bac7f97282 100644
--- a/include/linux/chio.h
+++ b/include/linux/chio.h
@@ -21,7 +21,7 @@
21 * query vendor-specific element types 21 * query vendor-specific element types
22 * 22 *
23 * accessing elements works by specifing type and unit of the element. 23 * accessing elements works by specifing type and unit of the element.
24 * for eample, storage elements are addressed with type = CHET_ST and 24 * for example, storage elements are addressed with type = CHET_ST and
25 * unit = 0 .. cp_nslots-1 25 * unit = 0 .. cp_nslots-1
26 * 26 *
27 */ 27 */
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 3a1dbba4d3ae..0cf725bdd2a1 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -77,10 +77,10 @@ enum clock_event_nofitiers {
77struct clock_event_device { 77struct clock_event_device {
78 const char *name; 78 const char *name;
79 unsigned int features; 79 unsigned int features;
80 unsigned long max_delta_ns; 80 u64 max_delta_ns;
81 unsigned long min_delta_ns; 81 u64 min_delta_ns;
82 unsigned long mult; 82 u32 mult;
83 int shift; 83 u32 shift;
84 int rating; 84 int rating;
85 int irq; 85 int irq;
86 const struct cpumask *cpumask; 86 const struct cpumask *cpumask;
@@ -116,8 +116,8 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
116} 116}
117 117
118/* Clock event layer functions */ 118/* Clock event layer functions */
119extern unsigned long clockevent_delta2ns(unsigned long latch, 119extern u64 clockevent_delta2ns(unsigned long latch,
120 struct clock_event_device *evt); 120 struct clock_event_device *evt);
121extern void clockevents_register_device(struct clock_event_device *dev); 121extern void clockevents_register_device(struct clock_event_device *dev);
122 122
123extern void clockevents_exchange_device(struct clock_event_device *old, 123extern void clockevents_exchange_device(struct clock_event_device *old,
@@ -130,6 +130,13 @@ extern int clockevents_program_event(struct clock_event_device *dev,
130 130
131extern void clockevents_handle_noop(struct clock_event_device *dev); 131extern void clockevents_handle_noop(struct clock_event_device *dev);
132 132
133static inline void
134clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
135{
136 return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC,
137 freq, minsec);
138}
139
133#ifdef CONFIG_GENERIC_CLOCKEVENTS 140#ifdef CONFIG_GENERIC_CLOCKEVENTS
134extern void clockevents_notify(unsigned long reason, void *arg); 141extern void clockevents_notify(unsigned long reason, void *arg);
135#else 142#else
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 83d2fbd81b93..8a4a130cc196 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -151,6 +151,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
151 * subtraction of non 64 bit counters 151 * subtraction of non 64 bit counters
152 * @mult: cycle to nanosecond multiplier 152 * @mult: cycle to nanosecond multiplier
153 * @shift: cycle to nanosecond divisor (power of two) 153 * @shift: cycle to nanosecond divisor (power of two)
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
154 * @flags: flags describing special properties 155 * @flags: flags describing special properties
155 * @vread: vsyscall based read 156 * @vread: vsyscall based read
156 * @resume: resume function for the clocksource, if necessary 157 * @resume: resume function for the clocksource, if necessary
@@ -168,6 +169,7 @@ struct clocksource {
168 cycle_t mask; 169 cycle_t mask;
169 u32 mult; 170 u32 mult;
170 u32 shift; 171 u32 shift;
172 u64 max_idle_ns;
171 unsigned long flags; 173 unsigned long flags;
172 cycle_t (*vread)(void); 174 cycle_t (*vread)(void);
173 void (*resume)(void); 175 void (*resume)(void);
@@ -279,11 +281,23 @@ extern void clocksource_resume(void);
279extern struct clocksource * __init __weak clocksource_default_clock(void); 281extern struct clocksource * __init __weak clocksource_default_clock(void);
280extern void clocksource_mark_unstable(struct clocksource *cs); 282extern void clocksource_mark_unstable(struct clocksource *cs);
281 283
284extern void
285clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
286
287static inline void
288clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
289{
290 return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
291 NSEC_PER_SEC, minsec);
292}
293
282#ifdef CONFIG_GENERIC_TIME_VSYSCALL 294#ifdef CONFIG_GENERIC_TIME_VSYSCALL
283extern void update_vsyscall(struct timespec *ts, struct clocksource *c); 295extern void
296update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult);
284extern void update_vsyscall_tz(void); 297extern void update_vsyscall_tz(void);
285#else 298#else
286static inline void update_vsyscall(struct timespec *ts, struct clocksource *c) 299static inline void
300update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult)
287{ 301{
288} 302}
289 303
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index fd929889e8dc..24d2e30f1b46 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -250,29 +250,6 @@ struct cipher_alg {
250 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 250 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
251}; 251};
252 252
253struct digest_alg {
254 unsigned int dia_digestsize;
255 void (*dia_init)(struct crypto_tfm *tfm);
256 void (*dia_update)(struct crypto_tfm *tfm, const u8 *data,
257 unsigned int len);
258 void (*dia_final)(struct crypto_tfm *tfm, u8 *out);
259 int (*dia_setkey)(struct crypto_tfm *tfm, const u8 *key,
260 unsigned int keylen);
261};
262
263struct hash_alg {
264 int (*init)(struct hash_desc *desc);
265 int (*update)(struct hash_desc *desc, struct scatterlist *sg,
266 unsigned int nbytes);
267 int (*final)(struct hash_desc *desc, u8 *out);
268 int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
269 unsigned int nbytes, u8 *out);
270 int (*setkey)(struct crypto_hash *tfm, const u8 *key,
271 unsigned int keylen);
272
273 unsigned int digestsize;
274};
275
276struct compress_alg { 253struct compress_alg {
277 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src, 254 int (*coa_compress)(struct crypto_tfm *tfm, const u8 *src,
278 unsigned int slen, u8 *dst, unsigned int *dlen); 255 unsigned int slen, u8 *dst, unsigned int *dlen);
@@ -293,8 +270,6 @@ struct rng_alg {
293#define cra_aead cra_u.aead 270#define cra_aead cra_u.aead
294#define cra_blkcipher cra_u.blkcipher 271#define cra_blkcipher cra_u.blkcipher
295#define cra_cipher cra_u.cipher 272#define cra_cipher cra_u.cipher
296#define cra_digest cra_u.digest
297#define cra_hash cra_u.hash
298#define cra_compress cra_u.compress 273#define cra_compress cra_u.compress
299#define cra_rng cra_u.rng 274#define cra_rng cra_u.rng
300 275
@@ -320,8 +295,6 @@ struct crypto_alg {
320 struct aead_alg aead; 295 struct aead_alg aead;
321 struct blkcipher_alg blkcipher; 296 struct blkcipher_alg blkcipher;
322 struct cipher_alg cipher; 297 struct cipher_alg cipher;
323 struct digest_alg digest;
324 struct hash_alg hash;
325 struct compress_alg compress; 298 struct compress_alg compress;
326 struct rng_alg rng; 299 struct rng_alg rng;
327 } cra_u; 300 } cra_u;
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h
index 8a1f972c0fe9..0c3c3a2110c4 100644
--- a/include/linux/dm-log-userspace.h
+++ b/include/linux/dm-log-userspace.h
@@ -363,7 +363,7 @@
363 * various request types above. The remaining 24-bits are currently 363 * various request types above. The remaining 24-bits are currently
364 * set to zero and are reserved for future use and compatibility concerns. 364 * set to zero and are reserved for future use and compatibility concerns.
365 * 365 *
366 * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the 366 * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the
367 * request type from the 'request_type' field to maintain forward compatibility. 367 * request type from the 'request_type' field to maintain forward compatibility.
368 */ 368 */
369#define DM_ULOG_REQUEST_MASK 0xFF 369#define DM_ULOG_REQUEST_MASK 0xFF
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 5de4c9e5856d..d7cecc90ed34 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -126,7 +126,9 @@ extern int free_irte(int irq);
126extern int irq_remapped(int irq); 126extern int irq_remapped(int irq);
127extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 127extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
128extern struct intel_iommu *map_ioapic_to_ir(int apic); 128extern struct intel_iommu *map_ioapic_to_ir(int apic);
129extern struct intel_iommu *map_hpet_to_ir(u8 id);
129extern int set_ioapic_sid(struct irte *irte, int apic); 130extern int set_ioapic_sid(struct irte *irte, int apic);
131extern int set_hpet_sid(struct irte *irte, u8 id);
130extern int set_msi_sid(struct irte *irte, struct pci_dev *dev); 132extern int set_msi_sid(struct irte *irte, struct pci_dev *dev);
131#else 133#else
132static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count) 134static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
@@ -158,10 +160,18 @@ static inline struct intel_iommu *map_ioapic_to_ir(int apic)
158{ 160{
159 return NULL; 161 return NULL;
160} 162}
163static inline struct intel_iommu *map_hpet_to_ir(unsigned int hpet_id)
164{
165 return NULL;
166}
161static inline int set_ioapic_sid(struct irte *irte, int apic) 167static inline int set_ioapic_sid(struct irte *irte, int apic)
162{ 168{
163 return 0; 169 return 0;
164} 170}
171static inline int set_hpet_sid(struct irte *irte, u8 id)
172{
173 return -1;
174}
165static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev) 175static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
166{ 176{
167 return 0; 177 return 0;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index de9c722e7b90..369767bd873e 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -763,6 +763,7 @@ struct fb_tile_ops {
763 * takes over; acceleration engine should be in a quiescent state */ 763 * takes over; acceleration engine should be in a quiescent state */
764 764
765/* hints */ 765/* hints */
766#define FBINFO_VIRTFB 0x0004 /* FB is System RAM, not device. */
766#define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ 767#define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */
767#define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ 768#define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */
768 769
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 10f628416740..87093652dda8 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -312,6 +312,7 @@ struct hid_item {
312#define HID_QUIRK_MULTI_INPUT 0x00000040 312#define HID_QUIRK_MULTI_INPUT 0x00000040
313#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 313#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
314#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 314#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
315#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
315 316
316/* 317/*
317 * This is the global environment of the parser. This information is 318 * This is the global environment of the parser. This information is
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 79f63a27bcef..219ca4f6bea6 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -126,4 +126,6 @@ struct hpet_info {
126#define HPET_DPI _IO('h', 0x05) /* disable periodic */ 126#define HPET_DPI _IO('h', 0x05) /* disable periodic */
127#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */ 127#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
128 128
129#define MAX_HPET_TBS 8 /* maximum hpet timer blocks */
130
129#endif /* !__HPET__ */ 131#endif /* !__HPET__ */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index ff037f0b1b4e..9bace4b9f4fe 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -446,7 +446,7 @@ extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
446 446
447static inline void timer_stats_account_hrtimer(struct hrtimer *timer) 447static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
448{ 448{
449 if (likely(!timer->start_site)) 449 if (likely(!timer_stats_active))
450 return; 450 return;
451 timer_stats_update_stats(timer, timer->start_pid, timer->start_site, 451 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
452 timer->function, timer->start_comm, 0); 452 timer->function, timer->start_comm, 0);
@@ -457,8 +457,6 @@ extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
457 457
458static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer) 458static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
459{ 459{
460 if (likely(!timer_stats_active))
461 return;
462 __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0)); 460 __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
463} 461}
464 462
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 7244456e7e65..9bede7633f74 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -22,10 +22,12 @@
22 * @cleanup: Cleanup callback (can be NULL). 22 * @cleanup: Cleanup callback (can be NULL).
23 * @data_present: Callback to determine if data is available 23 * @data_present: Callback to determine if data is available
24 * on the RNG. If NULL, it is assumed that 24 * on the RNG. If NULL, it is assumed that
25 * there is always data available. 25 * there is always data available. *OBSOLETE*
26 * @data_read: Read data from the RNG device. 26 * @data_read: Read data from the RNG device.
27 * Returns the number of lower random bytes in "data". 27 * Returns the number of lower random bytes in "data".
28 * Must not be NULL. 28 * Must not be NULL. *OSOLETE*
29 * @read: New API. drivers can fill up to max bytes of data
30 * into the buffer. The buffer is aligned for any type.
29 * @priv: Private data, for use by the RNG driver. 31 * @priv: Private data, for use by the RNG driver.
30 */ 32 */
31struct hwrng { 33struct hwrng {
@@ -34,6 +36,7 @@ struct hwrng {
34 void (*cleanup)(struct hwrng *rng); 36 void (*cleanup)(struct hwrng *rng);
35 int (*data_present)(struct hwrng *rng, int wait); 37 int (*data_present)(struct hwrng *rng, int wait);
36 int (*data_read)(struct hwrng *rng, u32 *data); 38 int (*data_read)(struct hwrng *rng, u32 *data);
39 int (*read)(struct hwrng *rng, void *data, size_t max, bool wait);
37 unsigned long priv; 40 unsigned long priv;
38 41
39 /* internal. */ 42 /* internal. */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e4135d6e0556..0ec612959042 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -125,8 +125,8 @@ struct ide_io_ports {
125 * Timeouts for various operations: 125 * Timeouts for various operations:
126 */ 126 */
127enum { 127enum {
128 /* spec allows up to 20ms */ 128 /* spec allows up to 20ms, but CF cards and SSD drives need more */
129 WAIT_DRQ = HZ / 10, /* 100ms */ 129 WAIT_DRQ = 1 * HZ, /* 1s */
130 /* some laptops are very slow */ 130 /* some laptops are very slow */
131 WAIT_READY = 5 * HZ, /* 5s */ 131 WAIT_READY = 5 * HZ, /* 5s */
132 /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ 132 /* should be less than 3ms (?), if all ATAPI CD is closed at boot */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index dfa29168e6ab..bd55c6e46b2e 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -110,7 +110,7 @@ struct in6_flowlabel_req {
110#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff 110#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff
111#define IPV6_FLOWINFO_PRIORITY 0x0ff00000 111#define IPV6_FLOWINFO_PRIORITY 0x0ff00000
112 112
113/* These defintions are obsolete */ 113/* These definitions are obsolete */
114#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 114#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000
115#define IPV6_PRIORITY_FILLER 0x0100 115#define IPV6_PRIORITY_FILLER 0x0100
116#define IPV6_PRIORITY_UNATTENDED 0x0200 116#define IPV6_PRIORITY_UNATTENDED 0x0200
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index 597a0077b3c5..5e3dddf8f562 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -14,12 +14,19 @@
14 14
15/** 15/**
16 * struct input_polled_dev - simple polled input device 16 * struct input_polled_dev - simple polled input device
17 * @private: private driver data 17 * @private: private driver data.
18 * @flush: driver-supplied method that flushes device's state upon 18 * @open: driver-supplied method that prepares device for polling
19 * opening (optional) 19 * (enabled the device and maybe flushes device state).
20 * @close: driver-supplied method that is called when device is no
21 * longer being polled. Used to put device into low power mode.
20 * @poll: driver-supplied method that polls the device and posts 22 * @poll: driver-supplied method that polls the device and posts
21 * input events (mandatory). 23 * input events (mandatory).
22 * @poll_interval: specifies how often the poll() method shoudl be called. 24 * @poll_interval: specifies how often the poll() method should be called.
25 * Defaults to 500 msec unless overriden when registering the device.
26 * @poll_interval_max: specifies upper bound for the poll interval.
27 * Defaults to the initial value of @poll_interval.
28 * @poll_interval_min: specifies lower bound for the poll interval.
29 * Defaults to 0.
23 * @input: input device structire associated with the polled device. 30 * @input: input device structire associated with the polled device.
24 * Must be properly initialized by the driver (id, name, phys, bits). 31 * Must be properly initialized by the driver (id, name, phys, bits).
25 * 32 *
@@ -30,11 +37,16 @@
30struct input_polled_dev { 37struct input_polled_dev {
31 void *private; 38 void *private;
32 39
33 void (*flush)(struct input_polled_dev *dev); 40 void (*open)(struct input_polled_dev *dev);
41 void (*close)(struct input_polled_dev *dev);
34 void (*poll)(struct input_polled_dev *dev); 42 void (*poll)(struct input_polled_dev *dev);
35 unsigned int poll_interval; /* msec */ 43 unsigned int poll_interval; /* msec */
44 unsigned int poll_interval_max; /* msec */
45 unsigned int poll_interval_min; /* msec */
36 46
37 struct input_dev *input; 47 struct input_dev *input;
48
49/* private: */
38 struct delayed_work work; 50 struct delayed_work work;
39}; 51};
40 52
diff --git a/include/linux/input.h b/include/linux/input.h
index 84b501ab0d8f..7be8a6537b57 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -895,7 +895,7 @@ struct ff_periodic_effect {
895 struct ff_envelope envelope; 895 struct ff_envelope envelope;
896 896
897 __u32 custom_len; 897 __u32 custom_len;
898 __s16 *custom_data; 898 __s16 __user *custom_data;
899}; 899};
900 900
901/** 901/**
@@ -1021,9 +1021,12 @@ struct ff_effect {
1021 * @keycodesize: size of elements in keycode table 1021 * @keycodesize: size of elements in keycode table
1022 * @keycode: map of scancodes to keycodes for this device 1022 * @keycode: map of scancodes to keycodes for this device
1023 * @setkeycode: optional method to alter current keymap, used to implement 1023 * @setkeycode: optional method to alter current keymap, used to implement
1024 * sparse keymaps. If not supplied default mechanism will be used 1024 * sparse keymaps. If not supplied default mechanism will be used.
1025 * The method is being called while holding event_lock and thus must
1026 * not sleep
1025 * @getkeycode: optional method to retrieve current keymap. If not supplied 1027 * @getkeycode: optional method to retrieve current keymap. If not supplied
1026 * default mechanism will be used 1028 * default mechanism will be used. The method is being called while
1029 * holding event_lock and thus must not sleep
1027 * @ff: force feedback structure associated with the device if device 1030 * @ff: force feedback structure associated with the device if device
1028 * supports force feedback effects 1031 * supports force feedback effects
1029 * @repeat_key: stores key code of the last key pressed; used to implement 1032 * @repeat_key: stores key code of the last key pressed; used to implement
@@ -1040,6 +1043,7 @@ struct ff_effect {
1040 * @absmin: minimum values for events coming from absolute axes 1043 * @absmin: minimum values for events coming from absolute axes
1041 * @absfuzz: describes noisiness for axes 1044 * @absfuzz: describes noisiness for axes
1042 * @absflat: size of the center flat position (used by joydev) 1045 * @absflat: size of the center flat position (used by joydev)
1046 * @absres: resolution used for events coming form absolute axes
1043 * @open: this method is called when the very first user calls 1047 * @open: this method is called when the very first user calls
1044 * input_open_device(). The driver must prepare the device 1048 * input_open_device(). The driver must prepare the device
1045 * to start generating events (start polling thread, 1049 * to start generating events (start polling thread,
@@ -1294,6 +1298,9 @@ void input_unregister_device(struct input_dev *);
1294int __must_check input_register_handler(struct input_handler *); 1298int __must_check input_register_handler(struct input_handler *);
1295void input_unregister_handler(struct input_handler *); 1299void input_unregister_handler(struct input_handler *);
1296 1300
1301int input_handler_for_each_handle(struct input_handler *, void *data,
1302 int (*fn)(struct input_handle *, void *));
1303
1297int input_register_handle(struct input_handle *); 1304int input_register_handle(struct input_handle *);
1298void input_unregister_handle(struct input_handle *); 1305void input_unregister_handle(struct input_handle *);
1299 1306
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index b3cd42d50e16..3bd018baae20 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -41,6 +41,9 @@ struct matrix_keymap_data {
41 * @col_scan_delay_us: delay, measured in microseconds, that is 41 * @col_scan_delay_us: delay, measured in microseconds, that is
42 * needed before we can keypad after activating column gpio 42 * needed before we can keypad after activating column gpio
43 * @debounce_ms: debounce interval in milliseconds 43 * @debounce_ms: debounce interval in milliseconds
44 * @active_low: gpio polarity
45 * @wakeup: controls whether the device should be set up as wakeup
46 * source
44 * 47 *
45 * This structure represents platform-specific data that use used by 48 * This structure represents platform-specific data that use used by
46 * matrix_keypad driver to perform proper initialization. 49 * matrix_keypad driver to perform proper initialization.
diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h
new file mode 100644
index 000000000000..c211b5cf08e6
--- /dev/null
+++ b/include/linux/input/sh_keysc.h
@@ -0,0 +1,14 @@
1#ifndef __SH_KEYSC_H__
2#define __SH_KEYSC_H__
3
4#define SH_KEYSC_MAXKEYS 30
5
6struct sh_keysc_info {
7 enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
8 int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
9 int delay;
10 int kycr2_delay;
11 int keycodes[SH_KEYSC_MAXKEYS];
12};
13
14#endif /* __SH_KEYSC_H__ */
diff --git a/include/linux/input/sparse-keymap.h b/include/linux/input/sparse-keymap.h
new file mode 100644
index 000000000000..52db62064c6e
--- /dev/null
+++ b/include/linux/input/sparse-keymap.h
@@ -0,0 +1,62 @@
1#ifndef _SPARSE_KEYMAP_H
2#define _SPARSE_KEYMAP_H
3
4/*
5 * Copyright (c) 2009 Dmitry Torokhov
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#define KE_END 0 /* Indicates end of keymap */
13#define KE_KEY 1 /* Ordinary key/button */
14#define KE_SW 2 /* Switch (predetermined value) */
15#define KE_VSW 3 /* Switch (value supplied at runtime) */
16#define KE_IGNORE 4 /* Known entry that should be ignored */
17#define KE_LAST KE_IGNORE
18
19/**
20 * struct key_entry - keymap entry for use in sparse keymap
21 * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END);
22 * drivers are allowed to extend the list with their own
23 * private definitions.
24 * @code: Device-specific data identifying the button/switch
25 * @keycode: KEY_* code assigned to a key/button
26 * @sw.code: SW_* code assigned to a switch
27 * @sw.value: Value that should be sent in an input even when KE_SW
28 * switch is toggled. KE_VSW switches ignore this field and
29 * expect driver to supply value for the event.
30 *
31 * This structure defines an entry in a sparse keymap used by some
32 * input devices for which traditional table-based approach is not
33 * suitable.
34 */
35struct key_entry {
36 int type; /* See KE_* above */
37 u32 code;
38 union {
39 u16 keycode; /* For KE_KEY */
40 struct { /* For KE_SW, KE_VSW */
41 u8 code;
42 u8 value; /* For KE_SW, ignored by KE_VSW */
43 } sw;
44 };
45};
46
47struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev,
48 unsigned int code);
49struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
50 unsigned int code);
51int sparse_keymap_setup(struct input_dev *dev,
52 const struct key_entry *keymap,
53 int (*setup)(struct input_dev *, struct key_entry *));
54void sparse_keymap_free(struct input_dev *dev);
55
56void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke,
57 unsigned int value, bool autorelease);
58
59bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
60 unsigned int value, bool autorelease);
61
62#endif /* _SPARSE_KEYMAP_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index ae9653dbcd78..a287cfc0b1a6 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -282,7 +282,7 @@ extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
282 282
283/* 283/*
284 * Built-in IRQ handlers for various IRQ types, 284 * Built-in IRQ handlers for various IRQ types,
285 * callable via desc->chip->handle_irq() 285 * callable via desc->handle_irq()
286 */ 286 */
287extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); 287extern void handle_level_irq(unsigned int irq, struct irq_desc *desc);
288extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); 288extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index a5b3dc71e819..6a9c4ddd3d95 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1024,7 +1024,7 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
1024extern int ata_scsi_slave_config(struct scsi_device *sdev); 1024extern int ata_scsi_slave_config(struct scsi_device *sdev);
1025extern void ata_scsi_slave_destroy(struct scsi_device *sdev); 1025extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
1026extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 1026extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
1027 int queue_depth); 1027 int queue_depth, int reason);
1028extern struct ata_device *ata_dev_pair(struct ata_device *adev); 1028extern struct ata_device *ata_dev_pair(struct ata_device *adev);
1029extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 1029extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
1030 1030
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index e5124ceea769..3402042ddc31 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -45,7 +45,7 @@ void pcap_set_ts_bits(struct pcap_chip *, u32);
45#define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff 45#define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff
46#define PCAP_MASK_ALL_INTERRUPT 0x01ffffff 46#define PCAP_MASK_ALL_INTERRUPT 0x01ffffff
47 47
48/* registers acessible by both pcap ports */ 48/* registers accessible by both pcap ports */
49#define PCAP_REG_ISR 0x0 /* Interrupt Status */ 49#define PCAP_REG_ISR 0x0 /* Interrupt Status */
50#define PCAP_REG_MSR 0x1 /* Interrupt Mask */ 50#define PCAP_REG_MSR 0x1 /* Interrupt Mask */
51#define PCAP_REG_PSTAT 0x2 /* Processor Status */ 51#define PCAP_REG_PSTAT 0x2 /* Processor Status */
@@ -67,7 +67,7 @@ void pcap_set_ts_bits(struct pcap_chip *, u32);
67#define PCAP_REG_VENDOR_TEST1 0x1e 67#define PCAP_REG_VENDOR_TEST1 0x1e
68#define PCAP_REG_VENDOR_TEST2 0x1f 68#define PCAP_REG_VENDOR_TEST2 0x1f
69 69
70/* registers acessible by pcap port 1 only (a1200, e2 & e6) */ 70/* registers accessible by pcap port 1 only (a1200, e2 & e6) */
71#define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */ 71#define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */
72#define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */ 72#define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */
73#define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */ 73#define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
new file mode 100644
index 000000000000..3bcd7163485c
--- /dev/null
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -0,0 +1,8 @@
1#ifndef __SH_MOBILE_SDHI_H__
2#define __SH_MOBILE_SDHI_H__
3
4struct sh_mobile_sdhi_info {
5 void (*set_pwr)(struct platform_device *pdev, int state);
6};
7
8#endif /* __SH_MOBILE_SDHI_H__ */
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index 6913b71d9ab2..b31bd9e9bca3 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -174,6 +174,8 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc,
174struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); 174struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
175struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, 175struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
176 int mode); 176 int mode);
177struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode);
178
177int ubi_register_volume_notifier(struct notifier_block *nb, 179int ubi_register_volume_notifier(struct notifier_block *nb,
178 int ignore_existing); 180 int ignore_existing);
179int ubi_unregister_volume_notifier(struct notifier_block *nb); 181int ubi_unregister_volume_notifier(struct notifier_block *nb);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cabf074b4324..eae1f864c934 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1587,6 +1587,8 @@
1587#define PCI_VENDOR_ID_COMPEX 0x11f6 1587#define PCI_VENDOR_ID_COMPEX 0x11f6
1588#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 1588#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112
1589 1589
1590#define PCI_VENDOR_ID_PMC_Sierra 0x11f8
1591
1590#define PCI_VENDOR_ID_RP 0x11fe 1592#define PCI_VENDOR_ID_RP 0x11fe
1591#define PCI_DEVICE_ID_RP32INTF 0x0001 1593#define PCI_DEVICE_ID_RP32INTF 0x0001
1592#define PCI_DEVICE_ID_RP8INTF 0x0002 1594#define PCI_DEVICE_ID_RP8INTF 0x0002
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index d745f5b6c7b0..76e5053e1fac 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -30,7 +30,7 @@
30 30
31/* 31/*
32 * use drive write caching -- we need deferred error handling to be 32 * use drive write caching -- we need deferred error handling to be
33 * able to sucessfully recover with this option (drive will return good 33 * able to successfully recover with this option (drive will return good
34 * status as soon as the cdb is validated). 34 * status as soon as the cdb is validated).
35 */ 35 */
36#if defined(CONFIG_CDROM_PKTCDVD_WCACHE) 36#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index dd31e7bae35c..a05b4a20768d 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -52,11 +52,63 @@
52#define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION 52#define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION
53#define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION 53#define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION
54 54
55/* Locking primitives */ 55/*
56/* Right now we are still falling back to (un)lock_kernel, but eventually that 56 * Locking primitives. The write lock is a per superblock
57 would evolve into real per-fs locks */ 57 * special mutex that has properties close to the Big Kernel Lock
58#define reiserfs_write_lock( sb ) lock_kernel() 58 * which was used in the previous locking scheme.
59#define reiserfs_write_unlock( sb ) unlock_kernel() 59 */
60void reiserfs_write_lock(struct super_block *s);
61void reiserfs_write_unlock(struct super_block *s);
62int reiserfs_write_lock_once(struct super_block *s);
63void reiserfs_write_unlock_once(struct super_block *s, int lock_depth);
64
65/*
66 * Several mutexes depend on the write lock.
67 * However sometimes we want to relax the write lock while we hold
68 * these mutexes, according to the release/reacquire on schedule()
69 * properties of the Bkl that were used.
70 * Reiserfs performances and locking were based on this scheme.
71 * Now that the write lock is a mutex and not the bkl anymore, doing so
72 * may result in a deadlock:
73 *
74 * A acquire write_lock
75 * A acquire j_commit_mutex
76 * A release write_lock and wait for something
77 * B acquire write_lock
78 * B can't acquire j_commit_mutex and sleep
79 * A can't acquire write lock anymore
80 * deadlock
81 *
82 * What we do here is avoiding such deadlock by playing the same game
83 * than the Bkl: if we can't acquire a mutex that depends on the write lock,
84 * we release the write lock, wait a bit and then retry.
85 *
86 * The mutexes concerned by this hack are:
87 * - The commit mutex of a journal list
88 * - The flush mutex
89 * - The journal lock
90 * - The inode mutex
91 */
92static inline void reiserfs_mutex_lock_safe(struct mutex *m,
93 struct super_block *s)
94{
95 reiserfs_write_unlock(s);
96 mutex_lock(m);
97 reiserfs_write_lock(s);
98}
99
100/*
101 * When we schedule, we usually want to also release the write lock,
102 * according to the previous bkl based locking scheme of reiserfs.
103 */
104static inline void reiserfs_cond_resched(struct super_block *s)
105{
106 if (need_resched()) {
107 reiserfs_write_unlock(s);
108 schedule();
109 reiserfs_write_lock(s);
110 }
111}
60 112
61struct fid; 113struct fid;
62 114
@@ -1329,7 +1381,11 @@ static inline loff_t max_reiserfs_offset(struct inode *inode)
1329#define get_generation(s) atomic_read (&fs_generation(s)) 1381#define get_generation(s) atomic_read (&fs_generation(s))
1330#define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) 1382#define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen)
1331#define __fs_changed(gen,s) (gen != get_generation (s)) 1383#define __fs_changed(gen,s) (gen != get_generation (s))
1332#define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) 1384#define fs_changed(gen,s) \
1385({ \
1386 reiserfs_cond_resched(s); \
1387 __fs_changed(gen, s); \
1388})
1333 1389
1334/***************************************************************************/ 1390/***************************************************************************/
1335/* FIXATE NODES */ 1391/* FIXATE NODES */
@@ -2258,8 +2314,7 @@ __u32 r5_hash(const signed char *msg, int len);
2258#define SPARE_SPACE 500 2314#define SPARE_SPACE 500
2259 2315
2260/* prototypes from ioctl.c */ 2316/* prototypes from ioctl.c */
2261int reiserfs_ioctl(struct inode *inode, struct file *filp, 2317long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
2262 unsigned int cmd, unsigned long arg);
2263long reiserfs_compat_ioctl(struct file *filp, 2318long reiserfs_compat_ioctl(struct file *filp,
2264 unsigned int cmd, unsigned long arg); 2319 unsigned int cmd, unsigned long arg);
2265int reiserfs_unpack(struct inode *inode, struct file *filp); 2320int reiserfs_unpack(struct inode *inode, struct file *filp);
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index dab68bbed675..52c83b6a758a 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -7,6 +7,8 @@
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8#include <linux/workqueue.h> 8#include <linux/workqueue.h>
9#include <linux/rwsem.h> 9#include <linux/rwsem.h>
10#include <linux/mutex.h>
11#include <linux/sched.h>
10#endif 12#endif
11 13
12typedef enum { 14typedef enum {
@@ -355,6 +357,13 @@ struct reiserfs_sb_info {
355 struct reiserfs_journal *s_journal; /* pointer to journal information */ 357 struct reiserfs_journal *s_journal; /* pointer to journal information */
356 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ 358 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */
357 359
360 /* Serialize writers access, replace the old bkl */
361 struct mutex lock;
362 /* Owner of the lock (can be recursive) */
363 struct task_struct *lock_owner;
364 /* Depth of the lock, start from -1 like the bkl */
365 int lock_depth;
366
358 /* Comment? -Hans */ 367 /* Comment? -Hans */
359 void (*end_io_handler) (struct buffer_head *, int); 368 void (*end_io_handler) (struct buffer_head *, int);
360 hashf_t s_hash_function; /* pointer to function which is used 369 hashf_t s_hash_function; /* pointer to function which is used
@@ -408,6 +417,17 @@ struct reiserfs_sb_info {
408 char *s_qf_names[MAXQUOTAS]; 417 char *s_qf_names[MAXQUOTAS];
409 int s_jquota_fmt; 418 int s_jquota_fmt;
410#endif 419#endif
420#ifdef CONFIG_REISERFS_CHECK
421
422 struct tree_balance *cur_tb; /*
423 * Detects whether more than one
424 * copy of tb exists per superblock
425 * as a means of checking whether
426 * do_balance is executing concurrently
427 * against another tree reader/writer
428 * on a same mount point.
429 */
430#endif
411}; 431};
412 432
413/* Definitions of reiserfs on-disk properties: */ 433/* Definitions of reiserfs on-disk properties: */
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 1ee2c05142f6..899fbb487c94 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -14,7 +14,8 @@ struct screen_info {
14 __u16 orig_video_page; /* 0x04 */ 14 __u16 orig_video_page; /* 0x04 */
15 __u8 orig_video_mode; /* 0x06 */ 15 __u8 orig_video_mode; /* 0x06 */
16 __u8 orig_video_cols; /* 0x07 */ 16 __u8 orig_video_cols; /* 0x07 */
17 __u16 unused2; /* 0x08 */ 17 __u8 flags; /* 0x08 */
18 __u8 unused2; /* 0x09 */
18 __u16 orig_video_ega_bx;/* 0x0a */ 19 __u16 orig_video_ega_bx;/* 0x0a */
19 __u16 unused3; /* 0x0c */ 20 __u16 unused3; /* 0x0c */
20 __u8 orig_video_lines; /* 0x0e */ 21 __u8 orig_video_lines; /* 0x0e */
@@ -65,6 +66,8 @@ struct screen_info {
65 66
66#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */ 67#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */
67 68
69#define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */
70
68#ifdef __KERNEL__ 71#ifdef __KERNEL__
69extern struct screen_info screen_info; 72extern struct screen_info screen_info;
70 73
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 850db2e80510..cf9327c051ad 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -216,10 +216,10 @@
216 216
217#define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */ 217#define UART_IIR_TOD 0x08 /* Character Timeout Indication Detected */
218 218
219#define UART_FCR_PXAR1 0x00 /* receive FIFO treshold = 1 */ 219#define UART_FCR_PXAR1 0x00 /* receive FIFO threshold = 1 */
220#define UART_FCR_PXAR8 0x40 /* receive FIFO treshold = 8 */ 220#define UART_FCR_PXAR8 0x40 /* receive FIFO threshold = 8 */
221#define UART_FCR_PXAR16 0x80 /* receive FIFO treshold = 16 */ 221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */
222#define UART_FCR_PXAR32 0xc0 /* receive FIFO treshold = 32 */ 222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */
223 223
224 224
225 225
diff --git a/include/linux/serio.h b/include/linux/serio.h
index a640bc2afe76..e2f3044d4a4a 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -215,5 +215,6 @@ static inline void serio_unpin_driver(struct serio *serio)
215#define SERIO_INEXIO 0x37 215#define SERIO_INEXIO 0x37
216#define SERIO_TOUCHIT213 0x38 216#define SERIO_TOUCHIT213 0x38
217#define SERIO_W8001 0x39 217#define SERIO_W8001 0x39
218#define SERIO_DYNAPRO 0x3a
218 219
219#endif 220#endif
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 68e212ff9dde..4ef246f14654 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -57,10 +57,8 @@ struct intc_desc {
57 struct intc_sense_reg *sense_regs; 57 struct intc_sense_reg *sense_regs;
58 unsigned int nr_sense_regs; 58 unsigned int nr_sense_regs;
59 char *name; 59 char *name;
60#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
61 struct intc_mask_reg *ack_regs; 60 struct intc_mask_reg *ack_regs;
62 unsigned int nr_ack_regs; 61 unsigned int nr_ack_regs;
63#endif
64}; 62};
65 63
66#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) 64#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
@@ -73,7 +71,6 @@ struct intc_desc symbol __initdata = { \
73 chipname, \ 71 chipname, \
74} 72}
75 73
76#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
77#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ 74#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
78 mask_regs, prio_regs, sense_regs, ack_regs) \ 75 mask_regs, prio_regs, sense_regs, ack_regs) \
79struct intc_desc symbol __initdata = { \ 76struct intc_desc symbol __initdata = { \
@@ -83,9 +80,11 @@ struct intc_desc symbol __initdata = { \
83 chipname, \ 80 chipname, \
84 _INTC_ARRAY(ack_regs), \ 81 _INTC_ARRAY(ack_regs), \
85} 82}
86#endif
87 83
88void __init register_intc_controller(struct intc_desc *desc); 84void __init register_intc_controller(struct intc_desc *desc);
89int intc_set_priority(unsigned int irq, unsigned int prio); 85int intc_set_priority(unsigned int irq, unsigned int prio);
90 86
87int reserve_irq_vector(unsigned int irq);
88void reserve_irq_legacy(void);
89
91#endif /* __SH_INTC_H */ 90#endif /* __SH_INTC_H */
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
new file mode 100644
index 000000000000..07c08af9f8f6
--- /dev/null
+++ b/include/linux/sh_pfc.h
@@ -0,0 +1,96 @@
1/*
2 * SuperH Pin Function Controller Support
3 *
4 * Copyright (c) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __SH_PFC_H
12#define __SH_PFC_H
13
14#include <asm-generic/gpio.h>
15
16typedef unsigned short pinmux_enum_t;
17typedef unsigned short pinmux_flag_t;
18
19#define PINMUX_TYPE_NONE 0
20#define PINMUX_TYPE_FUNCTION 1
21#define PINMUX_TYPE_GPIO 2
22#define PINMUX_TYPE_OUTPUT 3
23#define PINMUX_TYPE_INPUT 4
24#define PINMUX_TYPE_INPUT_PULLUP 5
25#define PINMUX_TYPE_INPUT_PULLDOWN 6
26
27#define PINMUX_FLAG_TYPE (0x7)
28#define PINMUX_FLAG_WANT_PULLUP (1 << 3)
29#define PINMUX_FLAG_WANT_PULLDOWN (1 << 4)
30
31#define PINMUX_FLAG_DBIT_SHIFT 5
32#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT)
33#define PINMUX_FLAG_DREG_SHIFT 10
34#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT)
35
36struct pinmux_gpio {
37 pinmux_enum_t enum_id;
38 pinmux_flag_t flags;
39};
40
41#define PINMUX_GPIO(gpio, data_or_mark) [gpio] = { data_or_mark }
42#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
43
44struct pinmux_cfg_reg {
45 unsigned long reg, reg_width, field_width;
46 unsigned long *cnt;
47 pinmux_enum_t *enum_ids;
48};
49
50#define PINMUX_CFG_REG(name, r, r_width, f_width) \
51 .reg = r, .reg_width = r_width, .field_width = f_width, \
52 .cnt = (unsigned long [r_width / f_width]) {}, \
53 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \
54
55struct pinmux_data_reg {
56 unsigned long reg, reg_width, reg_shadow;
57 pinmux_enum_t *enum_ids;
58};
59
60#define PINMUX_DATA_REG(name, r, r_width) \
61 .reg = r, .reg_width = r_width, \
62 .enum_ids = (pinmux_enum_t [r_width]) \
63
64struct pinmux_range {
65 pinmux_enum_t begin;
66 pinmux_enum_t end;
67 pinmux_enum_t force;
68};
69
70struct pinmux_info {
71 char *name;
72 pinmux_enum_t reserved_id;
73 struct pinmux_range data;
74 struct pinmux_range input;
75 struct pinmux_range input_pd;
76 struct pinmux_range input_pu;
77 struct pinmux_range output;
78 struct pinmux_range mark;
79 struct pinmux_range function;
80
81 unsigned first_gpio, last_gpio;
82
83 struct pinmux_gpio *gpios;
84 struct pinmux_cfg_reg *cfg_regs;
85 struct pinmux_data_reg *data_regs;
86
87 pinmux_enum_t *gpio_data;
88 unsigned int gpio_data_size;
89
90 unsigned long *gpio_in_use;
91 struct gpio_chip chip;
92};
93
94int register_pinmux(struct pinmux_info *pip);
95
96#endif /* __SH_PFC_H */
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index eed4254bd503..3274c507b8a9 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -15,7 +15,7 @@
15 * Some hardware works well with requests at spi_transfer scope: 15 * Some hardware works well with requests at spi_transfer scope:
16 * 16 *
17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half 17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
18 * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(), 18 * duplex (MicroWire) controllers. Provide chipselect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods. 19 * and custom setup()/cleanup() methods.
20 */ 20 */
21 21
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 56af3ca75e24..877ba039e6a4 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -89,8 +89,8 @@ enum
89 KERN_VERSION=4, /* string: compile time info */ 89 KERN_VERSION=4, /* string: compile time info */
90 KERN_SECUREMASK=5, /* struct: maximum rights mask */ 90 KERN_SECUREMASK=5, /* struct: maximum rights mask */
91 KERN_PROF=6, /* table: profiling information */ 91 KERN_PROF=6, /* table: profiling information */
92 KERN_NODENAME=7, 92 KERN_NODENAME=7, /* string: hostname */
93 KERN_DOMAINNAME=8, 93 KERN_DOMAINNAME=8, /* string: domainname */
94 94
95 KERN_PANIC=15, /* int: panic timeout */ 95 KERN_PANIC=15, /* int: panic timeout */
96 KERN_REALROOTDEV=16, /* real root device to mount after initrd */ 96 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
@@ -102,8 +102,8 @@ enum
102 KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */ 102 KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */
103 KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */ 103 KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */
104 KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */ 104 KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */
105 KERN_MODPROBE=28, 105 KERN_MODPROBE=28, /* string: modprobe path */
106 KERN_SG_BIG_BUFF=29, 106 KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */
107 KERN_ACCT=30, /* BSD process accounting parameters */ 107 KERN_ACCT=30, /* BSD process accounting parameters */
108 KERN_PPC_L2CR=31, /* l2cr register on PPC */ 108 KERN_PPC_L2CR=31, /* l2cr register on PPC */
109 109
@@ -150,7 +150,7 @@ enum
150 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */ 150 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
151 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ 151 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
152 KERN_COMPAT_LOG=73, /* int: print compat layer messages */ 152 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
153 KERN_MAX_LOCK_DEPTH=74, 153 KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */
154 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ 154 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
155 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ 155 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
156}; 156};
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 0482229c07db..d2ae79e21be3 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -43,6 +43,7 @@ enum tick_nohz_mode {
43 * @idle_exittime: Time when the idle state was left 43 * @idle_exittime: Time when the idle state was left
44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
45 * @sleep_length: Duration of the current idle sleep 45 * @sleep_length: Duration of the current idle sleep
46 * @do_timer_lst: CPU was the last one doing do_timer before going idle
46 */ 47 */
47struct tick_sched { 48struct tick_sched {
48 struct hrtimer sched_timer; 49 struct hrtimer sched_timer;
@@ -64,6 +65,7 @@ struct tick_sched {
64 unsigned long last_jiffies; 65 unsigned long last_jiffies;
65 unsigned long next_jiffies; 66 unsigned long next_jiffies;
66 ktime_t idle_expires; 67 ktime_t idle_expires;
68 int do_timer_last;
67}; 69};
68 70
69extern void __init tick_init(void); 71extern void __init tick_init(void);
@@ -98,6 +100,9 @@ extern int tick_check_oneshot_change(int allow_nohz);
98extern struct tick_sched *tick_get_tick_sched(int cpu); 100extern struct tick_sched *tick_get_tick_sched(int cpu);
99extern void tick_check_idle(int cpu); 101extern void tick_check_idle(int cpu);
100extern int tick_oneshot_mode_active(void); 102extern int tick_oneshot_mode_active(void);
103# ifndef arch_needs_cpu
104# define arch_needs_cpu(cpu) (0)
105# endif
101# else 106# else
102static inline void tick_clock_notify(void) { } 107static inline void tick_clock_notify(void) { }
103static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 108static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
diff --git a/include/linux/time.h b/include/linux/time.h
index fe04e5ef6a59..6e026e45a179 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -148,6 +148,7 @@ extern void monotonic_to_bootbased(struct timespec *ts);
148 148
149extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 149extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
150extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
151extern u64 timekeeping_max_deferment(void);
151extern void update_wall_time(void); 152extern void update_wall_time(void);
152extern void update_xtime_cache(u64 nsec); 153extern void update_xtime_cache(u64 nsec);
153extern void timekeeping_leap_insert(int leapsecond); 154extern void timekeeping_leap_insert(int leapsecond);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index e6967d10d9e5..94f8faecdcbc 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -115,13 +115,16 @@ struct timex {
115#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ 115#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
116#endif 116#endif
117 117
118/* xntp 3.4 compatibility names */ 118/* NTP userland likes the MOD_ prefix better */
119#define MOD_OFFSET ADJ_OFFSET 119#define MOD_OFFSET ADJ_OFFSET
120#define MOD_FREQUENCY ADJ_FREQUENCY 120#define MOD_FREQUENCY ADJ_FREQUENCY
121#define MOD_MAXERROR ADJ_MAXERROR 121#define MOD_MAXERROR ADJ_MAXERROR
122#define MOD_ESTERROR ADJ_ESTERROR 122#define MOD_ESTERROR ADJ_ESTERROR
123#define MOD_STATUS ADJ_STATUS 123#define MOD_STATUS ADJ_STATUS
124#define MOD_TIMECONST ADJ_TIMECONST 124#define MOD_TIMECONST ADJ_TIMECONST
125#define MOD_TAI ADJ_TAI
126#define MOD_MICRO ADJ_MICRO
127#define MOD_NANO ADJ_NANO
125 128
126 129
127/* 130/*
@@ -261,11 +264,7 @@ static inline int ntp_synced(void)
261 264
262#define NTP_SCALE_SHIFT 32 265#define NTP_SCALE_SHIFT 32
263 266
264#ifdef CONFIG_NO_HZ
265#define NTP_INTERVAL_FREQ (2)
266#else
267#define NTP_INTERVAL_FREQ (HZ) 267#define NTP_INTERVAL_FREQ (HZ)
268#endif
269#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 268#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
270 269
271/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ 270/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index adb44066680c..1b4790911052 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -110,6 +110,10 @@ struct ucb1400 {
110 struct platform_device *ucb1400_gpio; 110 struct platform_device *ucb1400_gpio;
111}; 111};
112 112
113struct ucb1400_pdata {
114 int irq;
115};
116
113static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) 117static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
114{ 118{
115 return ac97->bus->ops->read(ac97, reg); 119 return ac97->bus->ops->read(ac97, reg);
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 429c631d2aad..63ebdcc5dda6 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -74,7 +74,7 @@ enum {
74 * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of 74 * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of
75 * data. In order to avoid confusion and enforce types, we wrap it. 75 * data. In order to avoid confusion and enforce types, we wrap it.
76 * 76 *
77 * Make it packed, as we use it in some hw defintions. 77 * Make it packed, as we use it in some hw definitions.
78 */ 78 */
79struct wusb_ckhdid { 79struct wusb_ckhdid {
80 u8 data[16]; 80 u8 data[16];
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b59e78c57161..32b92298fd79 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -361,6 +361,7 @@ struct v4l2_pix_format {
361#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 361#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
362#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 362#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
363#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 363#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
364#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
364 365
365/* 366/*
366 * F O R M A T E N U M E R A T I O N 367 * F O R M A T E N U M E R A T I O N
@@ -490,7 +491,7 @@ struct v4l2_jpegcompression {
490 * you do, leave them untouched. 491 * you do, leave them untouched.
491 * Inluding less markers will make the 492 * Inluding less markers will make the
492 * resulting code smaller, but there will 493 * resulting code smaller, but there will
493 * be fewer aplications which can read it. 494 * be fewer applications which can read it.
494 * The presence of the APP and COM marker 495 * The presence of the APP and COM marker
495 * is influenced by APP_len and COM_len 496 * is influenced by APP_len and COM_len
496 * ONLY, not by this property! */ 497 * ONLY, not by this property! */
@@ -563,6 +564,7 @@ struct v4l2_framebuffer {
563#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 564#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
564#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 565#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
565#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 566#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
567#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080
566/* Flags for the 'flags' field. */ 568/* Flags for the 'flags' field. */
567#define V4L2_FBUF_FLAG_PRIMARY 0x0001 569#define V4L2_FBUF_FLAG_PRIMARY 0x0001
568#define V4L2_FBUF_FLAG_OVERLAY 0x0002 570#define V4L2_FBUF_FLAG_OVERLAY 0x0002
@@ -570,6 +572,7 @@ struct v4l2_framebuffer {
570#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 572#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
571#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 573#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
572#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 574#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
575#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
573 576
574struct v4l2_clip { 577struct v4l2_clip {
575 struct v4l2_rect c; 578 struct v4l2_rect c;
@@ -912,8 +915,10 @@ enum v4l2_colorfx {
912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 915#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
913#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 916#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
914 917
918#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
919#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
915/* last CID + 1 */ 920/* last CID + 1 */
916#define V4L2_CID_LASTP1 (V4L2_CID_BASE+34) 921#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36)
917 922
918/* MPEG-class control IDs defined by V4L2 */ 923/* MPEG-class control IDs defined by V4L2 */
919#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 924#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index c0c4e1103a73..7f56db4a79f0 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE];
110extern struct mutex con_buf_mtx; 110extern struct mutex con_buf_mtx;
111extern char vt_dont_switch; 111extern char vt_dont_switch;
112extern int default_utf8; 112extern int default_utf8;
113extern int global_cursor_default;
113 114
114struct vt_spawn_console { 115struct vt_spawn_console {
115 spinlock_t lock; 116 spinlock_t lock;
@@ -130,4 +131,6 @@ struct vt_notifier_param {
130extern int register_vt_notifier(struct notifier_block *nb); 131extern int register_vt_notifier(struct notifier_block *nb);
131extern int unregister_vt_notifier(struct notifier_block *nb); 132extern int unregister_vt_notifier(struct notifier_block *nb);
132 133
134extern void hide_boot_cursor(bool hide);
135
133#endif /* _VT_KERN_H */ 136#endif /* _VT_KERN_H */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index cf24c20de9e4..9466e860d8c2 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -25,6 +25,7 @@ typedef void (*work_func_t)(struct work_struct *work);
25struct work_struct { 25struct work_struct {
26 atomic_long_t data; 26 atomic_long_t data;
27#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */ 27#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
28#define WORK_STRUCT_STATIC 1 /* static initializer (debugobjects) */
28#define WORK_STRUCT_FLAG_MASK (3UL) 29#define WORK_STRUCT_FLAG_MASK (3UL)
29#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) 30#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
30 struct list_head entry; 31 struct list_head entry;
@@ -35,6 +36,7 @@ struct work_struct {
35}; 36};
36 37
37#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) 38#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0)
39#define WORK_DATA_STATIC_INIT() ATOMIC_LONG_INIT(2)
38 40
39struct delayed_work { 41struct delayed_work {
40 struct work_struct work; 42 struct work_struct work;
@@ -63,7 +65,7 @@ struct execute_work {
63#endif 65#endif
64 66
65#define __WORK_INITIALIZER(n, f) { \ 67#define __WORK_INITIALIZER(n, f) { \
66 .data = WORK_DATA_INIT(), \ 68 .data = WORK_DATA_STATIC_INIT(), \
67 .entry = { &(n).entry, &(n).entry }, \ 69 .entry = { &(n).entry, &(n).entry }, \
68 .func = (f), \ 70 .func = (f), \
69 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ 71 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \
@@ -91,6 +93,14 @@ struct execute_work {
91#define PREPARE_DELAYED_WORK(_work, _func) \ 93#define PREPARE_DELAYED_WORK(_work, _func) \
92 PREPARE_WORK(&(_work)->work, (_func)) 94 PREPARE_WORK(&(_work)->work, (_func))
93 95
96#ifdef CONFIG_DEBUG_OBJECTS_WORK
97extern void __init_work(struct work_struct *work, int onstack);
98extern void destroy_work_on_stack(struct work_struct *work);
99#else
100static inline void __init_work(struct work_struct *work, int onstack) { }
101static inline void destroy_work_on_stack(struct work_struct *work) { }
102#endif
103
94/* 104/*
95 * initialize all of a work item in one go 105 * initialize all of a work item in one go
96 * 106 *
@@ -99,24 +109,36 @@ struct execute_work {
99 * to generate better code. 109 * to generate better code.
100 */ 110 */
101#ifdef CONFIG_LOCKDEP 111#ifdef CONFIG_LOCKDEP
102#define INIT_WORK(_work, _func) \ 112#define __INIT_WORK(_work, _func, _onstack) \
103 do { \ 113 do { \
104 static struct lock_class_key __key; \ 114 static struct lock_class_key __key; \
105 \ 115 \
116 __init_work((_work), _onstack); \
106 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 117 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
107 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ 118 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\
108 INIT_LIST_HEAD(&(_work)->entry); \ 119 INIT_LIST_HEAD(&(_work)->entry); \
109 PREPARE_WORK((_work), (_func)); \ 120 PREPARE_WORK((_work), (_func)); \
110 } while (0) 121 } while (0)
111#else 122#else
112#define INIT_WORK(_work, _func) \ 123#define __INIT_WORK(_work, _func, _onstack) \
113 do { \ 124 do { \
125 __init_work((_work), _onstack); \
114 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 126 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
115 INIT_LIST_HEAD(&(_work)->entry); \ 127 INIT_LIST_HEAD(&(_work)->entry); \
116 PREPARE_WORK((_work), (_func)); \ 128 PREPARE_WORK((_work), (_func)); \
117 } while (0) 129 } while (0)
118#endif 130#endif
119 131
132#define INIT_WORK(_work, _func) \
133 do { \
134 __INIT_WORK((_work), (_func), 0); \
135 } while (0)
136
137#define INIT_WORK_ON_STACK(_work, _func) \
138 do { \
139 __INIT_WORK((_work), (_func), 1); \
140 } while (0)
141
120#define INIT_DELAYED_WORK(_work, _func) \ 142#define INIT_DELAYED_WORK(_work, _func) \
121 do { \ 143 do { \
122 INIT_WORK(&(_work)->work, (_func)); \ 144 INIT_WORK(&(_work)->work, (_func)); \
@@ -125,22 +147,16 @@ struct execute_work {
125 147
126#define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ 148#define INIT_DELAYED_WORK_ON_STACK(_work, _func) \
127 do { \ 149 do { \
128 INIT_WORK(&(_work)->work, (_func)); \ 150 INIT_WORK_ON_STACK(&(_work)->work, (_func)); \
129 init_timer_on_stack(&(_work)->timer); \ 151 init_timer_on_stack(&(_work)->timer); \
130 } while (0) 152 } while (0)
131 153
132#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ 154#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \
133 do { \ 155 do { \
134 INIT_WORK(&(_work)->work, (_func)); \ 156 INIT_WORK(&(_work)->work, (_func)); \
135 init_timer_deferrable(&(_work)->timer); \ 157 init_timer_deferrable(&(_work)->timer); \
136 } while (0) 158 } while (0)
137 159
138#define INIT_DELAYED_WORK_ON_STACK(_work, _func) \
139 do { \
140 INIT_WORK(&(_work)->work, (_func)); \
141 init_timer_on_stack(&(_work)->timer); \
142 } while (0)
143
144/** 160/**
145 * work_pending - Find out whether a work item is currently pending 161 * work_pending - Find out whether a work item is currently pending
146 * @work: The work item in question 162 * @work: The work item in question
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 2c3fbaa33f74..0b0cb1776796 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -84,6 +84,7 @@ enum cx25840_video_input {
84 CX25840_NONE0_CH3 = 0x80000080, 84 CX25840_NONE0_CH3 = 0x80000080,
85 CX25840_NONE1_CH3 = 0x800000c0, 85 CX25840_NONE1_CH3 = 0x800000c0,
86 CX25840_SVIDEO_ON = 0x80000100, 86 CX25840_SVIDEO_ON = 0x80000100,
87 CX25840_COMPONENT_ON = 0x80000200,
87}; 88};
88 89
89enum cx25840_audio_input { 90enum cx25840_audio_input {
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index 71d8982e13ff..d863e5e8426d 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -83,6 +83,8 @@ struct vpfe_subdev_info {
83struct vpfe_config { 83struct vpfe_config {
84 /* Number of sub devices connected to vpfe */ 84 /* Number of sub devices connected to vpfe */
85 int num_subdevs; 85 int num_subdevs;
86 /* i2c bus adapter no */
87 int i2c_adapter_id;
86 /* information about each subdev */ 88 /* information about each subdev */
87 struct vpfe_subdev_info *sub_devs; 89 struct vpfe_subdev_info *sub_devs;
88 /* evm card info */ 90 /* evm card info */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 29f0e53cff94..e41a99ee353e 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -26,14 +26,16 @@
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/spinlock.h>
30
31extern int media_ir_debug; /* media_ir_debug level (0,1,2) */
32#define IR_dprintk(level, fmt, arg...) if (media_ir_debug >= level) \
33 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
29 34
30#define IR_TYPE_RC5 1 35#define IR_TYPE_RC5 1
31#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ 36#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
32#define IR_TYPE_OTHER 99 37#define IR_TYPE_OTHER 99
33 38
34#define IR_KEYTAB_TYPE u32
35#define IR_KEYTAB_SIZE 128 /* enougth for rc5, probably need more some day */
36
37struct ir_scancode { 39struct ir_scancode {
38 u16 scancode; 40 u16 scancode;
39 u32 keycode; 41 u32 keycode;
@@ -42,11 +44,9 @@ struct ir_scancode {
42struct ir_scancode_table { 44struct ir_scancode_table {
43 struct ir_scancode *scan; 45 struct ir_scancode *scan;
44 int size; 46 int size;
47 spinlock_t lock;
45}; 48};
46 49
47#define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \
48 ? tab[code] : KEY_RESERVED)
49
50#define RC5_START(x) (((x)>>12)&3) 50#define RC5_START(x) (((x)>>12)&3)
51#define RC5_TOGGLE(x) (((x)>>11)&1) 51#define RC5_TOGGLE(x) (((x)>>11)&1)
52#define RC5_ADDR(x) (((x)>>6)&31) 52#define RC5_ADDR(x) (((x)>>6)&31)
@@ -55,11 +55,11 @@ struct ir_scancode_table {
55struct ir_input_state { 55struct ir_input_state {
56 /* configuration */ 56 /* configuration */
57 int ir_type; 57 int ir_type;
58 IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE]; 58
59 struct ir_scancode_table keytable;
59 60
60 /* key info */ 61 /* key info */
61 u32 ir_raw; /* raw data */ 62 u32 ir_key; /* ir scancode */
62 u32 ir_key; /* ir key code */
63 u32 keycode; /* linux key code */ 63 u32 keycode; /* linux key code */
64 int keypressed; /* current state */ 64 int keypressed; /* current state */
65}; 65};
@@ -102,20 +102,36 @@ struct card_ir {
102 struct tasklet_struct tlet; 102 struct tasklet_struct tlet;
103}; 103};
104 104
105void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 105/* Routines from ir-functions.c */
106
107int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
106 int ir_type, struct ir_scancode_table *ir_codes); 108 int ir_type, struct ir_scancode_table *ir_codes);
107void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 109void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
108void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 110void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
109 u32 ir_key, u32 ir_raw); 111 u32 ir_key);
110u32 ir_extract_bits(u32 data, u32 mask); 112u32 ir_extract_bits(u32 data, u32 mask);
111int ir_dump_samples(u32 *samples, int count); 113int ir_dump_samples(u32 *samples, int count);
112int ir_decode_biphase(u32 *samples, int count, int low, int high); 114int ir_decode_biphase(u32 *samples, int count, int low, int high);
113int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); 115int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
116u32 ir_rc5_decode(unsigned int code);
114 117
115void ir_rc5_timer_end(unsigned long data); 118void ir_rc5_timer_end(unsigned long data);
116void ir_rc5_timer_keyup(unsigned long data); 119void ir_rc5_timer_keyup(unsigned long data);
117 120
118/* Keymaps to be used by other modules */ 121/* Routines from ir-keytable.c */
122
123u32 ir_g_keycode_from_table(struct input_dev *input_dev,
124 u32 scancode);
125
126int ir_set_keycode_table(struct input_dev *input_dev,
127 struct ir_scancode_table *rc_tab);
128
129int ir_roundup_tablesize(int n_elems);
130int ir_copy_table(struct ir_scancode_table *destin,
131 const struct ir_scancode_table *origin);
132void ir_input_free(struct input_dev *input_dev);
133
134/* scancode->keycode map tables from ir-keymaps.c */
119 135
120extern struct ir_scancode_table ir_codes_empty_table; 136extern struct ir_scancode_table ir_codes_empty_table;
121extern struct ir_scancode_table ir_codes_avermedia_table; 137extern struct ir_scancode_table ir_codes_avermedia_table;
@@ -150,6 +166,7 @@ extern struct ir_scancode_table ir_codes_rc5_tv_table;
150extern struct ir_scancode_table ir_codes_winfast_table; 166extern struct ir_scancode_table ir_codes_winfast_table;
151extern struct ir_scancode_table ir_codes_pinnacle_color_table; 167extern struct ir_scancode_table ir_codes_pinnacle_color_table;
152extern struct ir_scancode_table ir_codes_hauppauge_new_table; 168extern struct ir_scancode_table ir_codes_hauppauge_new_table;
169extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table;
153extern struct ir_scancode_table ir_codes_npgtech_table; 170extern struct ir_scancode_table ir_codes_npgtech_table;
154extern struct ir_scancode_table ir_codes_norwood_table; 171extern struct ir_scancode_table ir_codes_norwood_table;
155extern struct ir_scancode_table ir_codes_proteus_2309_table; 172extern struct ir_scancode_table ir_codes_proteus_2309_table;
@@ -172,6 +189,8 @@ extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table;
172extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; 189extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table;
173extern struct ir_scancode_table ir_codes_kaiomy_table; 190extern struct ir_scancode_table ir_codes_kaiomy_table;
174extern struct ir_scancode_table ir_codes_dm1105_nec_table; 191extern struct ir_scancode_table ir_codes_dm1105_nec_table;
192extern struct ir_scancode_table ir_codes_tevii_nec_table;
193extern struct ir_scancode_table ir_codes_tbs_nec_table;
175extern struct ir_scancode_table ir_codes_evga_indtube_table; 194extern struct ir_scancode_table ir_codes_evga_indtube_table;
176extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; 195extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
177extern struct ir_scancode_table ir_codes_videomate_s350_table; 196extern struct ir_scancode_table ir_codes_videomate_s350_table;
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index cf16689adba7..91942dbe64e3 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -64,6 +64,7 @@ enum {
64 V4L2_IDENT_OV9650 = 254, 64 V4L2_IDENT_OV9650 = 254,
65 V4L2_IDENT_OV9655 = 255, 65 V4L2_IDENT_OV9655 = 255,
66 V4L2_IDENT_SOI968 = 256, 66 V4L2_IDENT_SOI968 = 256,
67 V4L2_IDENT_OV9640 = 257,
67 68
68 /* module saa7146: reserved range 300-309 */ 69 /* module saa7146: reserved range 300-309 */
69 V4L2_IDENT_SAA7146 = 300, 70 V4L2_IDENT_SAA7146 = 300,
@@ -72,6 +73,7 @@ enum {
72 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */ 73 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
73 V4L2_IDENT_CX23415 = 415, 74 V4L2_IDENT_CX23415 = 415,
74 V4L2_IDENT_CX23416 = 416, 75 V4L2_IDENT_CX23416 = 416,
76 V4L2_IDENT_CX23417 = 417,
75 V4L2_IDENT_CX23418 = 418, 77 V4L2_IDENT_CX23418 = 418,
76 78
77 /* module au0828 */ 79 /* module au0828 */
@@ -129,6 +131,9 @@ enum {
129 V4L2_IDENT_SAA6752HS = 6752, 131 V4L2_IDENT_SAA6752HS = 6752,
130 V4L2_IDENT_SAA6752HS_AC3 = 6753, 132 V4L2_IDENT_SAA6752HS_AC3 = 6753,
131 133
134 /* modules tef6862: just ident 6862 */
135 V4L2_IDENT_TEF6862 = 6862,
136
132 /* module adv7170: just ident 7170 */ 137 /* module adv7170: just ident 7170 */
133 V4L2_IDENT_ADV7170 = 7170, 138 V4L2_IDENT_ADV7170 = 7170,
134 139
@@ -165,12 +170,27 @@ enum {
165 /* module mt9v011, just ident 8243 */ 170 /* module mt9v011, just ident 8243 */
166 V4L2_IDENT_MT9V011 = 8243, 171 V4L2_IDENT_MT9V011 = 8243,
167 172
173 /* module cx23885 and cx25840 */
174 V4L2_IDENT_CX23885 = 8850,
175 V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */
176 V4L2_IDENT_CX23887 = 8870,
177 V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */
178 V4L2_IDENT_CX23888 = 8880,
179 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
180 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
181
168 /* module tw9910: just ident 9910 */ 182 /* module tw9910: just ident 9910 */
169 V4L2_IDENT_TW9910 = 9910, 183 V4L2_IDENT_TW9910 = 9910,
170 184
171 /* module sn9c20x: just ident 10000 */ 185 /* module sn9c20x: just ident 10000 */
172 V4L2_IDENT_SN9C20X = 10000, 186 V4L2_IDENT_SN9C20X = 10000,
173 187
188 /* module cx231xx and cx25840 */
189 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
190 V4L2_IDENT_CX23100 = 23100,
191 V4L2_IDENT_CX23101 = 23101,
192 V4L2_IDENT_CX23102 = 23102,
193
174 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 194 /* module msp3400: reserved range 34000-34999 and 44000-44999 */
175 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 195 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
176 use internally (tveeprom.c). */ 196 use internally (tveeprom.c). */
@@ -264,6 +284,9 @@ enum {
264 284
265 /* module m52790: just ident 52790 */ 285 /* module m52790: just ident 52790 */
266 V4L2_IDENT_M52790 = 52790, 286 V4L2_IDENT_M52790 = 52790,
287
288 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
289 V4L2_IDENT_RJ54N1CB0C = 51980,
267}; 290};
268 291
269#endif 292#endif
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d411345f244b..00bf17608453 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -23,6 +23,16 @@
23 23
24#include <media/v4l2-common.h> 24#include <media/v4l2-common.h>
25 25
26/* generic v4l2_device notify callback notification values */
27#define V4L2_SUBDEV_IR_RX_NOTIFY _IOW('v', 0, u32)
28#define V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ 0x00000001
29#define V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED 0x00000002
30#define V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN 0x00000004
31#define V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN 0x00000008
32
33#define V4L2_SUBDEV_IR_TX_NOTIFY _IOW('v', 1, u32)
34#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001
35
26struct v4l2_device; 36struct v4l2_device;
27struct v4l2_subdev; 37struct v4l2_subdev;
28struct tuner_setup; 38struct tuner_setup;
@@ -96,6 +106,9 @@ struct v4l2_decode_vbi_line {
96 106
97 s_gpio: set GPIO pins. Very simple right now, might need to be extended with 107 s_gpio: set GPIO pins. Very simple right now, might need to be extended with
98 a direction argument if needed. 108 a direction argument if needed.
109
110 s_power: puts subdevice in power saving mode (on == 0) or normal operation
111 mode (on == 1).
99 */ 112 */
100struct v4l2_subdev_core_ops { 113struct v4l2_subdev_core_ops {
101 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 114 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
@@ -118,6 +131,7 @@ struct v4l2_subdev_core_ops {
118 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 131 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
119 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 132 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
120#endif 133#endif
134 int (*s_power)(struct v4l2_subdev *sd, int on);
121}; 135};
122 136
123/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 137/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -127,8 +141,6 @@ struct v4l2_subdev_core_ops {
127 s_type_addr: sets tuner type and its I2C addr. 141 s_type_addr: sets tuner type and its I2C addr.
128 142
129 s_config: sets tda9887 specific stuff, like port1, port2 and qss 143 s_config: sets tda9887 specific stuff, like port1, port2 and qss
130
131 s_standby: puts tuner on powersaving state, disabling it, except for i2c.
132 */ 144 */
133struct v4l2_subdev_tuner_ops { 145struct v4l2_subdev_tuner_ops {
134 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); 146 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
@@ -141,7 +153,6 @@ struct v4l2_subdev_tuner_ops {
141 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 153 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
142 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 154 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
143 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 155 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
144 int (*s_standby)(struct v4l2_subdev *sd);
145}; 156};
146 157
147/* s_clock_freq: set the frequency (in Hz) of the audio clock output. 158/* s_clock_freq: set the frequency (in Hz) of the audio clock output.
@@ -231,11 +242,95 @@ struct v4l2_subdev_video_ops {
231 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 242 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
232}; 243};
233 244
245/*
246 interrupt_service_routine: Called by the bridge chip's interrupt service
247 handler, when an IR interrupt status has be raised due to this subdev,
248 so that this subdev can handle the details. It may schedule work to be
249 performed later. It must not sleep. *Called from an IRQ context*.
250
251 [rt]x_g_parameters: Get the current operating parameters and state of the
252 the IR receiver or transmitter.
253
254 [rt]x_s_parameters: Set the current operating parameters and state of the
255 the IR receiver or transmitter. It is recommended to call
256 [rt]x_g_parameters first to fill out the current state, and only change
257 the fields that need to be changed. Upon return, the actual device
258 operating parameters and state will be returned. Note that hardware
259 limitations may prevent the actual settings from matching the requested
260 settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
261 was requested. An exception is when the shutdown parameter is true.
262 The last used operational parameters will be returned, but the actual
263 state of the hardware be different to minimize power consumption and
264 processing when shutdown is true.
265
266 rx_read: Reads received codes or pulse width data.
267 The semantics are similar to a non-blocking read() call.
268
269 tx_write: Writes codes or pulse width data for transmission.
270 The semantics are similar to a non-blocking write() call.
271 */
272
273enum v4l2_subdev_ir_mode {
274 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */
275};
276
277/* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */
278#define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff
279#define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000
280#define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff
281
282struct v4l2_subdev_ir_parameters {
283 /* Either Rx or Tx */
284 unsigned int bytes_per_data_element; /* of data in read or write call */
285 enum v4l2_subdev_ir_mode mode;
286
287 bool enable;
288 bool interrupt_enable;
289 bool shutdown; /* true: set hardware to low/no power, false: normal */
290
291 bool modulation; /* true: uses carrier, false: baseband */
292 u32 max_pulse_width; /* ns, valid only for baseband signal */
293 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
294 unsigned int duty_cycle; /* percent, valid only for modulated signal*/
295 bool invert; /* logically invert sense of mark/space */
296
297 /* Rx only */
298 u32 noise_filter_min_width; /* ns, min time of a valid pulse */
299 unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */
300 unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */
301 u32 resolution; /* ns */
302};
303
304struct v4l2_subdev_ir_ops {
305 /* Common to receiver and transmitter */
306 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
307 u32 status, bool *handled);
308
309 /* Receiver */
310 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
311 ssize_t *num);
312
313 int (*rx_g_parameters)(struct v4l2_subdev *sd,
314 struct v4l2_subdev_ir_parameters *params);
315 int (*rx_s_parameters)(struct v4l2_subdev *sd,
316 struct v4l2_subdev_ir_parameters *params);
317
318 /* Transmitter */
319 int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
320 ssize_t *num);
321
322 int (*tx_g_parameters)(struct v4l2_subdev *sd,
323 struct v4l2_subdev_ir_parameters *params);
324 int (*tx_s_parameters)(struct v4l2_subdev *sd,
325 struct v4l2_subdev_ir_parameters *params);
326};
327
234struct v4l2_subdev_ops { 328struct v4l2_subdev_ops {
235 const struct v4l2_subdev_core_ops *core; 329 const struct v4l2_subdev_core_ops *core;
236 const struct v4l2_subdev_tuner_ops *tuner; 330 const struct v4l2_subdev_tuner_ops *tuner;
237 const struct v4l2_subdev_audio_ops *audio; 331 const struct v4l2_subdev_audio_ops *audio;
238 const struct v4l2_subdev_video_ops *video; 332 const struct v4l2_subdev_video_ops *video;
333 const struct v4l2_subdev_ir_ops *ir;
239}; 334};
240 335
241#define V4L2_SUBDEV_NAME_SIZE 32 336#define V4L2_SUBDEV_NAME_SIZE 32
@@ -290,7 +385,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
290 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); 385 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip);
291 */ 386 */
292#define v4l2_subdev_call(sd, o, f, args...) \ 387#define v4l2_subdev_call(sd, o, f, args...) \
293 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ 388 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
294 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) 389 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
295 390
296/* Send a notification to v4l2_device. */ 391/* Send a notification to v4l2_device. */
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 1c5946c44758..316fdccdcaa0 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -166,7 +166,7 @@ struct videobuf_queue {
166 enum v4l2_field field; 166 enum v4l2_field field;
167 enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ 167 enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */
168 struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; 168 struct videobuf_buffer *bufs[VIDEO_MAX_FRAME];
169 struct videobuf_queue_ops *ops; 169 const struct videobuf_queue_ops *ops;
170 struct videobuf_qtype_ops *int_ops; 170 struct videobuf_qtype_ops *int_ops;
171 171
172 unsigned int streaming:1; 172 unsigned int streaming:1;
@@ -195,7 +195,7 @@ void *videobuf_queue_to_vmalloc (struct videobuf_queue* q,
195 struct videobuf_buffer *buf); 195 struct videobuf_buffer *buf);
196 196
197void videobuf_queue_core_init(struct videobuf_queue *q, 197void videobuf_queue_core_init(struct videobuf_queue *q,
198 struct videobuf_queue_ops *ops, 198 const struct videobuf_queue_ops *ops,
199 struct device *dev, 199 struct device *dev,
200 spinlock_t *irqlock, 200 spinlock_t *irqlock,
201 enum v4l2_buf_type type, 201 enum v4l2_buf_type type,
diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h
index 549386681aab..ebaa9bc1ee8d 100644
--- a/include/media/videobuf-dma-contig.h
+++ b/include/media/videobuf-dma-contig.h
@@ -17,7 +17,7 @@
17#include <media/videobuf-core.h> 17#include <media/videobuf-core.h>
18 18
19void videobuf_queue_dma_contig_init(struct videobuf_queue *q, 19void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
20 struct videobuf_queue_ops *ops, 20 const struct videobuf_queue_ops *ops,
21 struct device *dev, 21 struct device *dev,
22 spinlock_t *irqlock, 22 spinlock_t *irqlock,
23 enum v4l2_buf_type type, 23 enum v4l2_buf_type type,
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index dda47f0082e9..53e72f787175 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -103,7 +103,7 @@ struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf);
103void *videobuf_sg_alloc(size_t size); 103void *videobuf_sg_alloc(size_t size);
104 104
105void videobuf_queue_sg_init(struct videobuf_queue* q, 105void videobuf_queue_sg_init(struct videobuf_queue* q,
106 struct videobuf_queue_ops *ops, 106 const struct videobuf_queue_ops *ops,
107 struct device *dev, 107 struct device *dev,
108 spinlock_t *irqlock, 108 spinlock_t *irqlock,
109 enum v4l2_buf_type type, 109 enum v4l2_buf_type type,
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h
index 6ba4f1271d23..07cf4b9d0a65 100644
--- a/include/media/videobuf-dvb.h
+++ b/include/media/videobuf-dvb.h
@@ -42,7 +42,9 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f,
42 void *adapter_priv, 42 void *adapter_priv,
43 struct device *device, 43 struct device *device,
44 short *adapter_nr, 44 short *adapter_nr,
45 int mfe_shared); 45 int mfe_shared,
46 int (*fe_ioctl_override)(struct dvb_frontend *,
47 unsigned int, void *, unsigned int));
46 48
47void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); 49void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f);
48 50
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index e87222c6a125..4b419a257a7d 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -30,8 +30,8 @@ struct videobuf_vmalloc_memory
30}; 30};
31 31
32void videobuf_queue_vmalloc_init(struct videobuf_queue* q, 32void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
33 struct videobuf_queue_ops *ops, 33 const struct videobuf_queue_ops *ops,
34 void *dev, 34 struct device *dev,
35 spinlock_t *irqlock, 35 spinlock_t *irqlock,
36 enum v4l2_buf_type type, 36 enum v4l2_buf_type type,
37 enum v4l2_field field, 37 enum v4l2_field field,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 7571e32723bf..ff3017744711 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -989,7 +989,7 @@ struct sctp_transport {
989 int init_sent_count; 989 int init_sent_count;
990 990
991 /* state : The current state of this destination, 991 /* state : The current state of this destination,
992 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN. 992 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKNOWN.
993 */ 993 */
994 int state; 994 int state;
995 995
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e2d2ca2509be..5740b85bc5a0 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1262,7 +1262,7 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1262 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1262 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1263 1263
1264/* This function calculates a "timeout" which is equivalent to the timeout of a 1264/* This function calculates a "timeout" which is equivalent to the timeout of a
1265 * TCP connection after "boundary" unsucessful, exponentially backed-off 1265 * TCP connection after "boundary" unsuccessful, exponentially backed-off
1266 * retransmissions with an initial RTO of TCP_RTO_MIN. 1266 * retransmissions with an initial RTO of TCP_RTO_MIN.
1267 */ 1267 */
1268static inline bool retransmits_timed_out(const struct sock *sk, 1268static inline bool retransmits_timed_out(const struct sock *sk,
diff --git a/include/net/wimax.h b/include/net/wimax.h
index d69c4a7a1267..3461aa1df1e0 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -79,7 +79,7 @@
79 * drivers have to only report state changes due to external 79 * drivers have to only report state changes due to external
80 * conditions. 80 * conditions.
81 * 81 *
82 * All API operations are 'atomic', serialized thorough a mutex in the 82 * All API operations are 'atomic', serialized through a mutex in the
83 * `struct wimax_dev`. 83 * `struct wimax_dev`.
84 * 84 *
85 * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK 85 * EXPORTING TO USER SPACE THROUGH GENERIC NETLINK
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
index 33b2750e9283..b3a0ee6b2f1c 100644
--- a/include/scsi/Kbuild
+++ b/include/scsi/Kbuild
@@ -2,3 +2,4 @@ header-y += scsi.h
2header-y += scsi_netlink.h 2header-y += scsi_netlink.h
3header-y += scsi_netlink_fc.h 3header-y += scsi_netlink_fc.h
4header-y += scsi_bsg_fc.h 4header-y += scsi_bsg_fc.h
5header-y += fc/
diff --git a/include/scsi/fc/Kbuild b/include/scsi/fc/Kbuild
new file mode 100644
index 000000000000..56603813c6cd
--- /dev/null
+++ b/include/scsi/fc/Kbuild
@@ -0,0 +1,4 @@
1header-y += fc_els.h
2header-y += fc_fs.h
3header-y += fc_gs.h
4header-y += fc_ns.h
diff --git a/include/scsi/fc/fc_els.h b/include/scsi/fc/fc_els.h
index 195ca014d3ce..f94328132a26 100644
--- a/include/scsi/fc/fc_els.h
+++ b/include/scsi/fc/fc_els.h
@@ -20,6 +20,8 @@
20#ifndef _FC_ELS_H_ 20#ifndef _FC_ELS_H_
21#define _FC_ELS_H_ 21#define _FC_ELS_H_
22 22
23#include <linux/types.h>
24
23/* 25/*
24 * Fibre Channel Switch - Enhanced Link Services definitions. 26 * Fibre Channel Switch - Enhanced Link Services definitions.
25 * From T11 FC-LS Rev 1.2 June 7, 2005. 27 * From T11 FC-LS Rev 1.2 June 7, 2005.
@@ -248,10 +250,12 @@ struct fc_els_csp {
248/* 250/*
249 * sp_features 251 * sp_features
250 */ 252 */
251#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel. off. */ 253#define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
254#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
252#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ 255#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
253#define FC_SP_FT_RAND 0x4000 /* random relative offset */ 256#define FC_SP_FT_RAND 0x4000 /* random relative offset */
254#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ 257#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
258#define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
255#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ 259#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
256#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ 260#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
257#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ 261#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index ccb3dbe90463..e6ad3d2ae475 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -86,6 +86,18 @@ struct fcoe_crc_eof {
86#define FCOE_MIN_FRAME 46 86#define FCOE_MIN_FRAME 46
87 87
88/* 88/*
89 * FCoE Link Error Status Block: T11 FC-BB-5 Rev2.0, Clause 7.10.
90 */
91struct fcoe_fc_els_lesb {
92 __be32 lesb_link_fail; /* link failure count */
93 __be32 lesb_vlink_fail; /* virtual link failure count */
94 __be32 lesb_miss_fka; /* missing FIP keep-alive count */
95 __be32 lesb_symb_err; /* symbol error during carrier count */
96 __be32 lesb_err_block; /* errored block count */
97 __be32 lesb_fcs_error; /* frame check sequence error count */
98};
99
100/*
89 * fc_fcoe_set_mac - Store OUI + DID into MAC address field. 101 * fc_fcoe_set_mac - Store OUI + DID into MAC address field.
90 * @mac: mac address to be set 102 * @mac: mac address to be set
91 * @did: fc dest id to use 103 * @did: fc dest id to use
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 5d38f1989f37..747e2c7d88d6 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -83,6 +83,8 @@ struct fcp_cmnd32 {
83 * fc_tm_flags - task management flags field. 83 * fc_tm_flags - task management flags field.
84 */ 84 */
85#define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ 85#define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */
86#define FCP_TMF_TGT_RESET 0x20 /* target reset task management,
87 deprecated as of FCP-3 */
86#define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ 88#define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */
87#define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ 89#define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */
88#define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ 90#define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */
@@ -196,4 +198,10 @@ struct fcp_srr {
196 __u8 srr_resvd2[3]; /* reserved */ 198 __u8 srr_resvd2[3]; /* reserved */
197}; 199};
198 200
201/*
202 * Feature bits in name server FC-4 Features object.
203 */
204#define FCP_FEAT_TARG (1 << 0) /* target function supported */
205#define FCP_FEAT_INIT (1 << 1) /* initiator function supported */
206
199#endif /* _FC_FCP_H_ */ 207#endif /* _FC_FCP_H_ */
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 3d138c1fcf8a..17baa19380f0 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -214,11 +214,21 @@ struct fip_vn_desc {
214 */ 214 */
215struct fip_fka_desc { 215struct fip_fka_desc {
216 struct fip_desc fd_desc; 216 struct fip_desc fd_desc;
217 __u8 fd_resvd[2]; 217 __u8 fd_resvd;
218 __u8 fd_flags; /* bit0 is fka disable flag */
218 __be32 fd_fka_period; /* adv./keep-alive period in mS */ 219 __be32 fd_fka_period; /* adv./keep-alive period in mS */
219} __attribute__((packed)); 220} __attribute__((packed));
220 221
221/* 222/*
223 * flags for fip_fka_desc.fd_flags
224 */
225enum fip_fka_flags {
226 FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */
227};
228
229/* FIP_DT_FKA flags */
230
231/*
222 * FIP_DT_VENDOR descriptor. 232 * FIP_DT_VENDOR descriptor.
223 */ 233 */
224struct fip_vendor_desc { 234struct fip_vendor_desc {
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h
index ac4cd38c860e..50f28b143451 100644
--- a/include/scsi/fc/fc_fs.h
+++ b/include/scsi/fc/fc_fs.h
@@ -20,6 +20,8 @@
20#ifndef _FC_FS_H_ 20#ifndef _FC_FS_H_
21#define _FC_FS_H_ 21#define _FC_FS_H_
22 22
23#include <linux/types.h>
24
23/* 25/*
24 * Fibre Channel Framing and Signalling definitions. 26 * Fibre Channel Framing and Signalling definitions.
25 * From T11 FC-FS-2 Rev 0.90 - 9 August 2005. 27 * From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
diff --git a/include/scsi/fc/fc_gs.h b/include/scsi/fc/fc_gs.h
index 324dd0e3c622..a37346d47eb1 100644
--- a/include/scsi/fc/fc_gs.h
+++ b/include/scsi/fc/fc_gs.h
@@ -20,6 +20,8 @@
20#ifndef _FC_GS_H_ 20#ifndef _FC_GS_H_
21#define _FC_GS_H_ 21#define _FC_GS_H_
22 22
23#include <linux/types.h>
24
23/* 25/*
24 * Fibre Channel Services - Common Transport. 26 * Fibre Channel Services - Common Transport.
25 * From T11.org FC-GS-2 Rev 5.3 November 1998. 27 * From T11.org FC-GS-2 Rev 5.3 November 1998.
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index 790d7b97d4bc..e7d3ac497d7d 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -20,6 +20,8 @@
20#ifndef _FC_NS_H_ 20#ifndef _FC_NS_H_
21#define _FC_NS_H_ 21#define _FC_NS_H_
22 22
23#include <linux/types.h>
24
23/* 25/*
24 * Fibre Channel Services - Name Service (dNS) 26 * Fibre Channel Services - Name Service (dNS)
25 * From T11.org FC-GS-2 Rev 5.3 November 1998. 27 * From T11.org FC-GS-2 Rev 5.3 November 1998.
@@ -44,9 +46,12 @@ enum fc_ns_req {
44 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ 46 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
45 FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ 47 FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
46 FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ 48 FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
47 FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
48 FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ 49 FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
49 FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ 50 FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
51 FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
52 FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
53 FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
54 FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
50}; 55};
51 56
52/* 57/*
@@ -156,4 +161,32 @@ struct fc_ns_rn_id {
156 __be64 fr_wwn; /* node name or port name */ 161 __be64 fr_wwn; /* node name or port name */
157} __attribute__((__packed__)); 162} __attribute__((__packed__));
158 163
164/*
165 * RSNN_NN request - register symbolic node name
166 */
167struct fc_ns_rsnn {
168 __be64 fr_wwn; /* node name */
169 __u8 fr_name_len;
170 char fr_name[];
171} __attribute__((__packed__));
172
173/*
174 * RSPN_ID request - register symbolic port name
175 */
176struct fc_ns_rspn {
177 struct fc_ns_fid fr_fid; /* port ID object */
178 __u8 fr_name_len;
179 char fr_name[];
180} __attribute__((__packed__));
181
182/*
183 * RFF_ID request - register FC-4 Features for ID.
184 */
185struct fc_ns_rff_id {
186 struct fc_ns_fid fr_fid; /* port ID object */
187 __u8 fr_resvd[2];
188 __u8 fr_feat; /* FC-4 Feature bits */
189 __u8 fr_type; /* FC-4 type */
190} __attribute__((__packed__));
191
159#endif /* _FC_NS_H_ */ 192#endif /* _FC_NS_H_ */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 27dad703824f..8eb0a0fc0a71 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -32,7 +32,10 @@ struct fc_ct_req {
32 struct fc_ns_gid_ft gid; 32 struct fc_ns_gid_ft gid;
33 struct fc_ns_rn_id rn; 33 struct fc_ns_rn_id rn;
34 struct fc_ns_rft rft; 34 struct fc_ns_rft rft;
35 struct fc_ns_rff_id rff;
35 struct fc_ns_fid fid; 36 struct fc_ns_fid fid;
37 struct fc_ns_rsnn snn;
38 struct fc_ns_rspn spn;
36 } payload; 39 } payload;
37}; 40};
38 41
@@ -109,6 +112,7 @@ static inline int fc_ct_fill(struct fc_lport *lport,
109 enum fc_fh_type *fh_type) 112 enum fc_fh_type *fh_type)
110{ 113{
111 struct fc_ct_req *ct; 114 struct fc_ct_req *ct;
115 size_t len;
112 116
113 switch (op) { 117 switch (op) {
114 case FC_NS_GPN_FT: 118 case FC_NS_GPN_FT:
@@ -128,12 +132,41 @@ static inline int fc_ct_fill(struct fc_lport *lport,
128 ct->payload.rft.fts = lport->fcts; 132 ct->payload.rft.fts = lport->fcts;
129 break; 133 break;
130 134
131 case FC_NS_RPN_ID: 135 case FC_NS_RFF_ID:
136 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
137 hton24(ct->payload.rff.fr_fid.fp_fid,
138 fc_host_port_id(lport->host));
139 ct->payload.rff.fr_type = FC_TYPE_FCP;
140 if (lport->service_params & FCP_SPPF_INIT_FCN)
141 ct->payload.rff.fr_feat = FCP_FEAT_INIT;
142 if (lport->service_params & FCP_SPPF_TARG_FCN)
143 ct->payload.rff.fr_feat |= FCP_FEAT_TARG;
144 break;
145
146 case FC_NS_RNN_ID:
132 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); 147 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
133 hton24(ct->payload.rn.fr_fid.fp_fid, 148 hton24(ct->payload.rn.fr_fid.fp_fid,
134 fc_host_port_id(lport->host)); 149 fc_host_port_id(lport->host));
135 ct->payload.rft.fts = lport->fcts; 150 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
136 put_unaligned_be64(lport->wwpn, &ct->payload.rn.fr_wwn); 151 break;
152
153 case FC_NS_RSPN_ID:
154 len = strnlen(fc_host_symbolic_name(lport->host), 255);
155 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
156 hton24(ct->payload.spn.fr_fid.fp_fid,
157 fc_host_port_id(lport->host));
158 strncpy(ct->payload.spn.fr_name,
159 fc_host_symbolic_name(lport->host), len);
160 ct->payload.spn.fr_name_len = len;
161 break;
162
163 case FC_NS_RSNN_NN:
164 len = strnlen(fc_host_symbolic_name(lport->host), 255);
165 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len);
166 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
167 strncpy(ct->payload.snn.fr_name,
168 fc_host_symbolic_name(lport->host), len);
169 ct->payload.snn.fr_name_len = len;
137 break; 170 break;
138 171
139 default: 172 default:
@@ -198,6 +231,31 @@ static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp)
198 sp->sp_bb_data = htons((u16) lport->mfs); 231 sp->sp_bb_data = htons((u16) lport->mfs);
199 cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */ 232 cp = &flogi->fl_cssp[3 - 1]; /* class 3 parameters */
200 cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); 233 cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
234 if (lport->does_npiv)
235 sp->sp_features = htons(FC_SP_FT_NPIV);
236}
237
238/**
239 * fc_fdisc_fill - Fill in a fdisc request frame.
240 */
241static inline void fc_fdisc_fill(struct fc_lport *lport, struct fc_frame *fp)
242{
243 struct fc_els_csp *sp;
244 struct fc_els_cssp *cp;
245 struct fc_els_flogi *fdisc;
246
247 fdisc = fc_frame_payload_get(fp, sizeof(*fdisc));
248 memset(fdisc, 0, sizeof(*fdisc));
249 fdisc->fl_cmd = (u8) ELS_FDISC;
250 put_unaligned_be64(lport->wwpn, &fdisc->fl_wwpn);
251 put_unaligned_be64(lport->wwnn, &fdisc->fl_wwnn);
252 sp = &fdisc->fl_csp;
253 sp->sp_hi_ver = 0x20;
254 sp->sp_lo_ver = 0x20;
255 sp->sp_bb_cred = htons(10); /* this gets set by gateway */
256 sp->sp_bb_data = htons((u16) lport->mfs);
257 cp = &fdisc->fl_cssp[3 - 1]; /* class 3 parameters */
258 cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ);
201} 259}
202 260
203/** 261/**
@@ -296,6 +354,10 @@ static inline int fc_els_fill(struct fc_lport *lport,
296 fc_flogi_fill(lport, fp); 354 fc_flogi_fill(lport, fp);
297 break; 355 break;
298 356
357 case ELS_FDISC:
358 fc_fdisc_fill(lport, fp);
359 break;
360
299 case ELS_LOGO: 361 case ELS_LOGO:
300 fc_logo_fill(lport, fp); 362 fc_logo_fill(lport, fp);
301 break; 363 break;
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index c35d2383cc26..4d3e9c7b7c57 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -28,6 +28,8 @@
28#include <scsi/fc/fc_fcp.h> 28#include <scsi/fc/fc_fcp.h>
29#include <scsi/fc/fc_encaps.h> 29#include <scsi/fc/fc_encaps.h>
30 30
31#include <linux/if_ether.h>
32
31/* 33/*
32 * The fc_frame interface is used to pass frame data between functions. 34 * The fc_frame interface is used to pass frame data between functions.
33 * The frame includes the data buffer, length, and SOF / EOF delimiter types. 35 * The frame includes the data buffer, length, and SOF / EOF delimiter types.
@@ -37,6 +39,9 @@
37#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ 39#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */
38#define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */ 40#define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */
39 41
42/* Max number of skb frags allowed, reserving one for fcoe_crc_eof page */
43#define FC_FRAME_SG_LEN (MAX_SKB_FRAGS - 1)
44
40#define fp_skb(fp) (&((fp)->skb)) 45#define fp_skb(fp) (&((fp)->skb))
41#define fr_hdr(fp) ((fp)->skb.data) 46#define fr_hdr(fp) ((fp)->skb.data)
42#define fr_len(fp) ((fp)->skb.len) 47#define fr_len(fp) ((fp)->skb.len)
@@ -64,6 +69,7 @@ struct fcoe_rcv_info {
64 enum fc_sof fr_sof; /* start of frame delimiter */ 69 enum fc_sof fr_sof; /* start of frame delimiter */
65 enum fc_eof fr_eof; /* end of frame delimiter */ 70 enum fc_eof fr_eof; /* end of frame delimiter */
66 u8 fr_flags; /* flags - see below */ 71 u8 fr_flags; /* flags - see below */
72 u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
67}; 73};
68 74
69 75
@@ -94,17 +100,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
94} 100}
95 101
96struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len); 102struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
97 103struct fc_frame *_fc_frame_alloc(size_t payload_len);
98struct fc_frame *__fc_frame_alloc(size_t payload_len);
99
100/*
101 * Get frame for sending via port.
102 */
103static inline struct fc_frame *_fc_frame_alloc(struct fc_lport *dev,
104 size_t payload_len)
105{
106 return __fc_frame_alloc(payload_len);
107}
108 104
109/* 105/*
110 * Allocate fc_frame structure and buffer. Set the initial length to 106 * Allocate fc_frame structure and buffer. Set the initial length to
@@ -118,10 +114,10 @@ static inline struct fc_frame *fc_frame_alloc(struct fc_lport *dev, size_t len)
118 * Note: Since len will often be a constant multiple of 4, 114 * Note: Since len will often be a constant multiple of 4,
119 * this check will usually be evaluated and eliminated at compile time. 115 * this check will usually be evaluated and eliminated at compile time.
120 */ 116 */
121 if ((len % 4) != 0) 117 if (len && len % 4)
122 fp = fc_frame_alloc_fill(dev, len); 118 fp = fc_frame_alloc_fill(dev, len);
123 else 119 else
124 fp = _fc_frame_alloc(dev, len); 120 fp = _fc_frame_alloc(len);
125 return fp; 121 return fp;
126} 122}
127 123
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index d67dda2b6aa0..66d377b9c72b 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -311,6 +311,8 @@ enum iscsi_param {
311 ISCSI_PARAM_IFACE_NAME, 311 ISCSI_PARAM_IFACE_NAME,
312 ISCSI_PARAM_ISID, 312 ISCSI_PARAM_ISID,
313 ISCSI_PARAM_INITIATOR_NAME, 313 ISCSI_PARAM_INITIATOR_NAME,
314
315 ISCSI_PARAM_TGT_RESET_TMO,
314 /* must always be last */ 316 /* must always be last */
315 ISCSI_PARAM_MAX, 317 ISCSI_PARAM_MAX,
316}; 318};
@@ -350,6 +352,7 @@ enum iscsi_param {
350#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME) 352#define ISCSI_IFACE_NAME (1ULL << ISCSI_PARAM_IFACE_NAME)
351#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID) 353#define ISCSI_ISID (1ULL << ISCSI_PARAM_ISID)
352#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME) 354#define ISCSI_INITIATOR_NAME (1ULL << ISCSI_PARAM_INITIATOR_NAME)
355#define ISCSI_TGT_RESET_TMO (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
353 356
354/* iSCSI HBA params */ 357/* iSCSI HBA params */
355enum iscsi_host_param { 358enum iscsi_host_param {
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index f2a2c1169486..dd0a52cea95a 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -279,6 +279,8 @@ struct iscsi_tm {
279#define ISCSI_TM_FUNC_TARGET_COLD_RESET 7 279#define ISCSI_TM_FUNC_TARGET_COLD_RESET 7
280#define ISCSI_TM_FUNC_TASK_REASSIGN 8 280#define ISCSI_TM_FUNC_TASK_REASSIGN 8
281 281
282#define ISCSI_TM_FUNC_VALUE(hdr) ((hdr)->flags & ISCSI_FLAG_TM_FUNC_MASK)
283
282/* SCSI Task Management Response Header */ 284/* SCSI Task Management Response Header */
283struct iscsi_tm_rsp { 285struct iscsi_tm_rsp {
284 uint8_t opcode; 286 uint8_t opcode;
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 65dc9aacbf70..4b912eee33e5 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -26,6 +26,7 @@
26 26
27#include <scsi/scsi_transport.h> 27#include <scsi/scsi_transport.h>
28#include <scsi/scsi_transport_fc.h> 28#include <scsi/scsi_transport_fc.h>
29#include <scsi/scsi_bsg_fc.h>
29 30
30#include <scsi/fc/fc_fcp.h> 31#include <scsi/fc/fc_fcp.h>
31#include <scsi/fc/fc_ns.h> 32#include <scsi/fc/fc_ns.h>
@@ -34,67 +35,6 @@
34 35
35#include <scsi/fc_frame.h> 36#include <scsi/fc_frame.h>
36 37
37#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */
38#define FC_LPORT_LOGGING 0x02 /* lport layer logging */
39#define FC_DISC_LOGGING 0x04 /* discovery layer logging */
40#define FC_RPORT_LOGGING 0x08 /* rport layer logging */
41#define FC_FCP_LOGGING 0x10 /* I/O path logging */
42#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */
43#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */
44#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */
45
46extern unsigned int fc_debug_logging;
47
48#define FC_CHECK_LOGGING(LEVEL, CMD) \
49do { \
50 if (unlikely(fc_debug_logging & LEVEL)) \
51 do { \
52 CMD; \
53 } while (0); \
54} while (0)
55
56#define FC_LIBFC_DBG(fmt, args...) \
57 FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
58 printk(KERN_INFO "libfc: " fmt, ##args))
59
60#define FC_LPORT_DBG(lport, fmt, args...) \
61 FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
62 printk(KERN_INFO "host%u: lport %6x: " fmt, \
63 (lport)->host->host_no, \
64 fc_host_port_id((lport)->host), ##args))
65
66#define FC_DISC_DBG(disc, fmt, args...) \
67 FC_CHECK_LOGGING(FC_DISC_LOGGING, \
68 printk(KERN_INFO "host%u: disc: " fmt, \
69 (disc)->lport->host->host_no, \
70 ##args))
71
72#define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \
73 FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
74 printk(KERN_INFO "host%u: rport %6x: " fmt, \
75 (lport)->host->host_no, \
76 (port_id), ##args))
77
78#define FC_RPORT_DBG(rdata, fmt, args...) \
79 FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args)
80
81#define FC_FCP_DBG(pkt, fmt, args...) \
82 FC_CHECK_LOGGING(FC_FCP_LOGGING, \
83 printk(KERN_INFO "host%u: fcp: %6x: " fmt, \
84 (pkt)->lp->host->host_no, \
85 pkt->rport->port_id, ##args))
86
87#define FC_EXCH_DBG(exch, fmt, args...) \
88 FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
89 printk(KERN_INFO "host%u: xid %4x: " fmt, \
90 (exch)->lp->host->host_no, \
91 exch->xid, ##args))
92
93#define FC_SCSI_DBG(lport, fmt, args...) \
94 FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
95 printk(KERN_INFO "host%u: scsi: " fmt, \
96 (lport)->host->host_no, ##args))
97
98/* 38/*
99 * libfc error codes 39 * libfc error codes
100 */ 40 */
@@ -115,15 +55,28 @@ do { \
115 p[2] = ((v) & 0xFF); \ 55 p[2] = ((v) & 0xFF); \
116 } while (0) 56 } while (0)
117 57
118/* 58/**
119 * FC HBA status 59 * enum fc_lport_state - Local port states
60 * @LPORT_ST_DISABLED: Disabled
61 * @LPORT_ST_FLOGI: Fabric login (FLOGI) sent
62 * @LPORT_ST_DNS: Waiting for name server remote port to become ready
63 * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent
64 * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent
65 * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent
66 * @LPORT_ST_SCR: State Change Register (SCR) sent
67 * @LPORT_ST_READY: Ready for use
68 * @LPORT_ST_LOGO: Local port logout (LOGO) sent
69 * @LPORT_ST_RESET: Local port reset
120 */ 70 */
121enum fc_lport_state { 71enum fc_lport_state {
122 LPORT_ST_DISABLED = 0, 72 LPORT_ST_DISABLED = 0,
123 LPORT_ST_FLOGI, 73 LPORT_ST_FLOGI,
124 LPORT_ST_DNS, 74 LPORT_ST_DNS,
125 LPORT_ST_RPN_ID, 75 LPORT_ST_RNN_ID,
76 LPORT_ST_RSNN_NN,
77 LPORT_ST_RSPN_ID,
126 LPORT_ST_RFT_ID, 78 LPORT_ST_RFT_ID,
79 LPORT_ST_RFF_ID,
127 LPORT_ST_SCR, 80 LPORT_ST_SCR,
128 LPORT_ST_READY, 81 LPORT_ST_READY,
129 LPORT_ST_LOGO, 82 LPORT_ST_LOGO,
@@ -136,15 +89,28 @@ enum fc_disc_event {
136 DISC_EV_FAILED 89 DISC_EV_FAILED
137}; 90};
138 91
92/**
93 * enum fc_rport_state - Remote port states
94 * @RPORT_ST_INIT: Initialized
95 * @RPORT_ST_PLOGI: Waiting for PLOGI completion
96 * @RPORT_ST_PRLI: Waiting for PRLI completion
97 * @RPORT_ST_RTV: Waiting for RTV completion
98 * @RPORT_ST_READY: Ready for use
99 * @RPORT_ST_LOGO: Remote port logout (LOGO) sent
100 * @RPORT_ST_ADISC: Discover Address sent
101 * @RPORT_ST_DELETE: Remote port being deleted
102 * @RPORT_ST_RESTART: Remote port being deleted and will restart
103*/
139enum fc_rport_state { 104enum fc_rport_state {
140 RPORT_ST_INIT, /* initialized */ 105 RPORT_ST_INIT,
141 RPORT_ST_PLOGI, /* waiting for PLOGI completion */ 106 RPORT_ST_PLOGI,
142 RPORT_ST_PRLI, /* waiting for PRLI completion */ 107 RPORT_ST_PRLI,
143 RPORT_ST_RTV, /* waiting for RTV completion */ 108 RPORT_ST_RTV,
144 RPORT_ST_READY, /* ready for use */ 109 RPORT_ST_READY,
145 RPORT_ST_LOGO, /* port logout sent */ 110 RPORT_ST_LOGO,
146 RPORT_ST_ADISC, /* Discover Address sent */ 111 RPORT_ST_ADISC,
147 RPORT_ST_DELETE, /* port being deleted */ 112 RPORT_ST_DELETE,
113 RPORT_ST_RESTART,
148}; 114};
149 115
150/** 116/**
@@ -155,12 +121,20 @@ enum fc_rport_state {
155 * @port_id: Port ID of the discovered port 121 * @port_id: Port ID of the discovered port
156 */ 122 */
157struct fc_disc_port { 123struct fc_disc_port {
158 struct fc_lport *lp; 124 struct fc_lport *lp;
159 struct list_head peers; 125 struct list_head peers;
160 struct work_struct rport_work; 126 struct work_struct rport_work;
161 u32 port_id; 127 u32 port_id;
162}; 128};
163 129
130/**
131 * enum fc_rport_event - Remote port events
132 * @RPORT_EV_NONE: No event
133 * @RPORT_EV_READY: Remote port is ready for use
134 * @RPORT_EV_FAILED: State machine failed, remote port is not ready
135 * @RPORT_EV_STOP: Remote port has been stopped
136 * @RPORT_EV_LOGO: Remote port logout (LOGO) sent
137 */
164enum fc_rport_event { 138enum fc_rport_event {
165 RPORT_EV_NONE = 0, 139 RPORT_EV_NONE = 0,
166 RPORT_EV_READY, 140 RPORT_EV_READY,
@@ -171,6 +145,10 @@ enum fc_rport_event {
171 145
172struct fc_rport_priv; 146struct fc_rport_priv;
173 147
148/**
149 * struct fc_rport_operations - Operations for a remote port
150 * @event_callback: Function to be called for remote port events
151 */
174struct fc_rport_operations { 152struct fc_rport_operations {
175 void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, 153 void (*event_callback)(struct fc_lport *, struct fc_rport_priv *,
176 enum fc_rport_event); 154 enum fc_rport_event);
@@ -178,11 +156,11 @@ struct fc_rport_operations {
178 156
179/** 157/**
180 * struct fc_rport_libfc_priv - libfc internal information about a remote port 158 * struct fc_rport_libfc_priv - libfc internal information about a remote port
181 * @local_port: Fibre Channel host port instance 159 * @local_port: The associated local port
182 * @rp_state: indicates READY for I/O or DELETE when blocked. 160 * @rp_state: Indicates READY for I/O or DELETE when blocked
183 * @flags: REC and RETRY supported flags 161 * @flags: REC and RETRY supported flags
184 * @e_d_tov: error detect timeout value (in msec) 162 * @e_d_tov: Error detect timeout value (in msec)
185 * @r_a_tov: resource allocation timeout value (in msec) 163 * @r_a_tov: Resource allocation timeout value (in msec)
186 */ 164 */
187struct fc_rport_libfc_priv { 165struct fc_rport_libfc_priv {
188 struct fc_lport *local_port; 166 struct fc_lport *local_port;
@@ -195,47 +173,66 @@ struct fc_rport_libfc_priv {
195}; 173};
196 174
197/** 175/**
198 * struct fc_rport_priv - libfc rport and discovery info about a remote port 176 * struct fc_rport_priv - libfc remote port and discovery info
199 * @local_port: Fibre Channel host port instance 177 * @local_port: The associated local port
200 * @rport: transport remote port 178 * @rport: The FC transport remote port
201 * @kref: reference counter 179 * @kref: Reference counter
202 * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges 180 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI,
203 * @ids: remote port identifiers and roles 181 * and RTV exchanges
204 * @flags: REC and RETRY supported flags 182 * @ids: The remote port identifiers and roles
205 * @max_seq: maximum number of concurrent sequences 183 * @flags: REC and RETRY supported flags
206 * @disc_id: discovery identifier 184 * @max_seq: Maximum number of concurrent sequences
207 * @maxframe_size: maximum frame size 185 * @disc_id: The discovery identifier
208 * @retries: retry count in current state 186 * @maxframe_size: The maximum frame size
209 * @e_d_tov: error detect timeout value (in msec) 187 * @retries: The retry count for the current state
210 * @r_a_tov: resource allocation timeout value (in msec) 188 * @e_d_tov: Error detect timeout value (in msec)
211 * @rp_mutex: mutex protects rport 189 * @r_a_tov: Resource allocation timeout value (in msec)
212 * @retry_work: 190 * @rp_mutex: The mutex that protects the remote port
213 * @event_callback: Callback for rport READY, FAILED or LOGO 191 * @retry_work: Handle for retries
192 * @event_callback: Callback when READY, FAILED or LOGO states complete
214 */ 193 */
215struct fc_rport_priv { 194struct fc_rport_priv {
216 struct fc_lport *local_port; 195 struct fc_lport *local_port;
217 struct fc_rport *rport; 196 struct fc_rport *rport;
218 struct kref kref; 197 struct kref kref;
219 enum fc_rport_state rp_state; 198 enum fc_rport_state rp_state;
220 struct fc_rport_identifiers ids; 199 struct fc_rport_identifiers ids;
221 u16 flags; 200 u16 flags;
222 u16 max_seq; 201 u16 max_seq;
223 u16 disc_id; 202 u16 disc_id;
224 u16 maxframe_size; 203 u16 maxframe_size;
225 unsigned int retries; 204 unsigned int retries;
226 unsigned int e_d_tov; 205 unsigned int e_d_tov;
227 unsigned int r_a_tov; 206 unsigned int r_a_tov;
228 struct mutex rp_mutex; 207 struct mutex rp_mutex;
229 struct delayed_work retry_work; 208 struct delayed_work retry_work;
230 enum fc_rport_event event; 209 enum fc_rport_event event;
231 struct fc_rport_operations *ops; 210 struct fc_rport_operations *ops;
232 struct list_head peers; 211 struct list_head peers;
233 struct work_struct event_work; 212 struct work_struct event_work;
234 u32 supported_classes; 213 u32 supported_classes;
235}; 214};
236 215
237/* 216/**
238 * fcoe stats structure 217 * struct fcoe_dev_stats - fcoe stats structure
218 * @SecondsSinceLastReset: Seconds since the last reset
219 * @TxFrames: Number of transmitted frames
220 * @TxWords: Number of transmitted words
221 * @RxFrames: Number of received frames
222 * @RxWords: Number of received words
223 * @ErrorFrames: Number of received error frames
224 * @DumpedFrames: Number of dumped frames
225 * @LinkFailureCount: Number of link failures
226 * @LossOfSignalCount: Number for signal losses
227 * @InvalidTxWordCount: Number of invalid transmitted words
228 * @InvalidCRCCount: Number of invalid CRCs
229 * @InputRequests: Number of input requests
230 * @OutputRequests: Number of output requests
231 * @ControlRequests: Number of control requests
232 * @InputMegabytes: Number of received megabytes
233 * @OutputMegabytes: Number of transmitted megabytes
234 * @VLinkFailureCount: Number of virtual link failures
235 * @MissDiscAdvCount: Number of missing FIP discovery advertisement
239 */ 236 */
240struct fcoe_dev_stats { 237struct fcoe_dev_stats {
241 u64 SecondsSinceLastReset; 238 u64 SecondsSinceLastReset;
@@ -254,12 +251,17 @@ struct fcoe_dev_stats {
254 u64 ControlRequests; 251 u64 ControlRequests;
255 u64 InputMegabytes; 252 u64 InputMegabytes;
256 u64 OutputMegabytes; 253 u64 OutputMegabytes;
254 u64 VLinkFailureCount;
255 u64 MissDiscAdvCount;
257}; 256};
258 257
259/* 258/**
260 * els data is used for passing ELS respone specific 259 * struct fc_seq_els_data - ELS data used for passing ELS specific responses
261 * data to send ELS response mainly using infomation 260 * @fp: The ELS frame
262 * in exchange and sequence in EM layer. 261 * @reason: The reason for rejection
262 * @explan: The explaination of the rejection
263 *
264 * Mainly used by the exchange manager layer.
263 */ 265 */
264struct fc_seq_els_data { 266struct fc_seq_els_data {
265 struct fc_frame *fp; 267 struct fc_frame *fp;
@@ -267,77 +269,87 @@ struct fc_seq_els_data {
267 enum fc_els_rjt_explan explan; 269 enum fc_els_rjt_explan explan;
268}; 270};
269 271
270/* 272/**
271 * FCP request structure, one for each scsi cmd request 273 * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request)
274 * @lp: The associated local port
275 * @state: The state of the I/O
276 * @tgt_flags: Target's flags
277 * @ref_cnt: Reference count
278 * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the
279 * host_lock if both are to be held at the same time)
280 * @cmd: The SCSI command (set and clear with the host_lock held)
281 * @list: Tracks queued commands (accessed with the host_lock held)
282 * @timer: The command timer
283 * @tm_done: Completion indicator
284 * @wait_for_comp: Indicator to wait for completion of the I/O (in jiffies)
285 * @start_time: Timestamp indicating the start of the I/O (in jiffies)
286 * @end_time: Timestamp indicating the end of the I/O (in jiffies)
287 * @last_pkt_time: Timestamp of the last frame received (in jiffies)
288 * @data_len: The length of the data
289 * @cdb_cmd: The CDB command
290 * @xfer_len: The transfer length
291 * @xfer_ddp: Indicates if this transfer used DDP (XID of the exchange
292 * will be set here if DDP was setup)
293 * @xfer_contig_end: The offset into the buffer if the buffer is contiguous
294 * (Tx and Rx)
295 * @max_payload: The maximum payload size (in bytes)
296 * @io_status: SCSI result (upper 24 bits)
297 * @cdb_status: CDB status
298 * @status_code: FCP I/O status
299 * @scsi_comp_flags: Completion flags (bit 3 Underrun bit 2: overrun)
300 * @req_flags: Request flags (bit 0: read bit:1 write)
301 * @scsi_resid: SCSI residule length
302 * @rport: The remote port that the SCSI command is targeted at
303 * @seq_ptr: The sequence that will carry the SCSI command
304 * @recov_retry: Number of recovery retries
305 * @recov_seq: The sequence for REC or SRR
272 */ 306 */
273struct fc_fcp_pkt { 307struct fc_fcp_pkt {
274 /* 308 /* Housekeeping information */
275 * housekeeping stuff 309 struct fc_lport *lp;
276 */ 310 u16 state;
277 struct fc_lport *lp; /* handle to hba struct */ 311 u16 tgt_flags;
278 u16 state; /* scsi_pkt state state */ 312 atomic_t ref_cnt;
279 u16 tgt_flags; /* target flags */ 313 spinlock_t scsi_pkt_lock;
280 atomic_t ref_cnt; /* fcp pkt ref count */ 314
281 spinlock_t scsi_pkt_lock; /* Must be taken before the host lock 315 /* SCSI I/O related information */
282 * if both are held at the same time */ 316 struct scsi_cmnd *cmd;
283 /* 317 struct list_head list;
284 * SCSI I/O related stuff 318
285 */ 319 /* Timeout related information */
286 struct scsi_cmnd *cmd; /* scsi command pointer. set/clear 320 struct timer_list timer;
287 * under host lock */
288 struct list_head list; /* tracks queued commands. access under
289 * host lock */
290 /*
291 * timeout related stuff
292 */
293 struct timer_list timer; /* command timer */
294 struct completion tm_done; 321 struct completion tm_done;
295 int wait_for_comp; 322 int wait_for_comp;
296 unsigned long start_time; /* start jiffie */ 323 unsigned long start_time;
297 unsigned long end_time; /* end jiffie */ 324 unsigned long end_time;
298 unsigned long last_pkt_time; /* jiffies of last frame received */ 325 unsigned long last_pkt_time;
299 326
300 /* 327 /* SCSI command and data transfer information */
301 * scsi cmd and data transfer information 328 u32 data_len;
302 */ 329
303 u32 data_len; 330 /* Transport related veriables */
304 /* 331 struct fcp_cmnd cdb_cmd;
305 * transport related veriables 332 size_t xfer_len;
306 */ 333 u16 xfer_ddp;
307 struct fcp_cmnd cdb_cmd; 334 u32 xfer_contig_end;
308 size_t xfer_len; 335 u16 max_payload;
309 u16 xfer_ddp; /* this xfer is ddped */ 336
310 u32 xfer_contig_end; /* offset of end of contiguous xfer */ 337 /* SCSI/FCP return status */
311 u16 max_payload; /* max payload size in bytes */ 338 u32 io_status;
312 339 u8 cdb_status;
313 /* 340 u8 status_code;
314 * scsi/fcp return status 341 u8 scsi_comp_flags;
315 */ 342 u32 req_flags;
316 u32 io_status; /* SCSI result upper 24 bits */ 343 u32 scsi_resid;
317 u8 cdb_status; 344
318 u8 status_code; /* FCP I/O status */ 345 /* Associated structures */
319 /* bit 3 Underrun bit 2: overrun */ 346 struct fc_rport *rport;
320 u8 scsi_comp_flags; 347 struct fc_seq *seq_ptr;
321 u32 req_flags; /* bit 0: read bit:1 write */ 348
322 u32 scsi_resid; /* residule length */ 349 /* Error Processing information */
323 350 u8 recov_retry;
324 struct fc_rport *rport; /* remote port pointer */ 351 struct fc_seq *recov_seq;
325 struct fc_seq *seq_ptr; /* current sequence pointer */
326 /*
327 * Error Processing
328 */
329 u8 recov_retry; /* count of recovery retries */
330 struct fc_seq *recov_seq; /* sequence for REC or SRR */
331}; 352};
332/*
333 * FC_FCP HELPER FUNCTIONS
334 *****************************/
335static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)
336{
337 if (fsp && fsp->cmd)
338 return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE;
339 return false;
340}
341 353
342/* 354/*
343 * Structure and function definitions for managing Fibre Channel Exchanges 355 * Structure and function definitions for managing Fibre Channel Exchanges
@@ -350,23 +362,51 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)
350 362
351struct fc_exch_mgr; 363struct fc_exch_mgr;
352struct fc_exch_mgr_anchor; 364struct fc_exch_mgr_anchor;
353extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ 365extern u16 fc_cpu_mask; /* cpu mask for possible cpus */
354 366
355/* 367/**
356 * Sequence. 368 * struct fc_seq - FC sequence
369 * @id: The sequence ID
370 * @ssb_stat: Status flags for the sequence status block (SSB)
371 * @cnt: Number of frames sent so far
372 * @rec_data: FC-4 value for REC
357 */ 373 */
358struct fc_seq { 374struct fc_seq {
359 u8 id; /* seq ID */ 375 u8 id;
360 u16 ssb_stat; /* status flags for sequence status block */ 376 u16 ssb_stat;
361 u16 cnt; /* frames sent so far on sequence */ 377 u16 cnt;
362 u32 rec_data; /* FC-4 value for REC */ 378 u32 rec_data;
363}; 379};
364 380
365#define FC_EX_DONE (1 << 0) /* ep is completed */ 381#define FC_EX_DONE (1 << 0) /* ep is completed */
366#define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ 382#define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */
367 383
368/* 384/**
369 * Exchange. 385 * struct fc_exch - Fibre Channel Exchange
386 * @em: Exchange manager
387 * @pool: Exchange pool
388 * @state: The exchange's state
389 * @xid: The exchange ID
390 * @ex_list: Handle used by the EM to track free exchanges
391 * @ex_lock: Lock that protects the exchange
392 * @ex_refcnt: Reference count
393 * @timeout_work: Handle for timeout handler
394 * @lp: The local port that this exchange is on
395 * @oxid: Originator's exchange ID
396 * @rxid: Responder's exchange ID
397 * @oid: Originator's FCID
398 * @sid: Source FCID
399 * @did: Destination FCID
400 * @esb_stat: ESB exchange status
401 * @r_a_tov: Resouce allocation time out value (in msecs)
402 * @seq_id: The next sequence ID to use
403 * @f_ctl: F_CTL flags for the sequence
404 * @fh_type: The frame type
405 * @class: The class of service
406 * @seq: The sequence in use on this exchange
407 * @resp: Callback for responses on this exchange
408 * @destructor: Called when destroying the exchange
409 * @arg: Passed as a void pointer to the resp() callback
370 * 410 *
371 * Locking notes: The ex_lock protects following items: 411 * Locking notes: The ex_lock protects following items:
372 * state, esb_stat, f_ctl, seq.ssb_stat 412 * state, esb_stat, f_ctl, seq.ssb_stat
@@ -374,76 +414,59 @@ struct fc_seq {
374 * sequence allocation 414 * sequence allocation
375 */ 415 */
376struct fc_exch { 416struct fc_exch {
377 struct fc_exch_mgr *em; /* exchange manager */ 417 struct fc_exch_mgr *em;
378 struct fc_exch_pool *pool; /* per cpu exches pool */ 418 struct fc_exch_pool *pool;
379 u32 state; /* internal driver state */ 419 u32 state;
380 u16 xid; /* our exchange ID */ 420 u16 xid;
381 struct list_head ex_list; /* free or busy list linkage */ 421 struct list_head ex_list;
382 spinlock_t ex_lock; /* lock covering exchange state */ 422 spinlock_t ex_lock;
383 atomic_t ex_refcnt; /* reference counter */ 423 atomic_t ex_refcnt;
384 struct delayed_work timeout_work; /* timer for upper level protocols */ 424 struct delayed_work timeout_work;
385 struct fc_lport *lp; /* fc device instance */ 425 struct fc_lport *lp;
386 u16 oxid; /* originator's exchange ID */ 426 u16 oxid;
387 u16 rxid; /* responder's exchange ID */ 427 u16 rxid;
388 u32 oid; /* originator's FCID */ 428 u32 oid;
389 u32 sid; /* source FCID */ 429 u32 sid;
390 u32 did; /* destination FCID */ 430 u32 did;
391 u32 esb_stat; /* exchange status for ESB */ 431 u32 esb_stat;
392 u32 r_a_tov; /* r_a_tov from rport (msec) */ 432 u32 r_a_tov;
393 u8 seq_id; /* next sequence ID to use */ 433 u8 seq_id;
394 u32 f_ctl; /* F_CTL flags for sequences */ 434 u32 f_ctl;
395 u8 fh_type; /* frame type */ 435 u8 fh_type;
396 enum fc_class class; /* class of service */ 436 enum fc_class class;
397 struct fc_seq seq; /* single sequence */ 437 struct fc_seq seq;
398 /* 438
399 * Handler for responses to this current exchange. 439 void (*resp)(struct fc_seq *, struct fc_frame *, void *);
400 */ 440 void *arg;
401 void (*resp)(struct fc_seq *, struct fc_frame *, void *); 441
402 void (*destructor)(struct fc_seq *, void *); 442 void (*destructor)(struct fc_seq *, void *);
403 /* 443
404 * arg is passed as void pointer to exchange
405 * resp and destructor handlers
406 */
407 void *arg;
408}; 444};
409#define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) 445#define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq)
410 446
411struct libfc_function_template {
412 447
448struct libfc_function_template {
413 /* 449 /*
414 * Interface to send a FC frame 450 * Interface to send a FC frame
415 * 451 *
416 * STATUS: REQUIRED 452 * STATUS: REQUIRED
417 */ 453 */
418 int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp); 454 int (*frame_send)(struct fc_lport *, struct fc_frame *);
419 455
420 /* 456 /*
421 * Interface to send ELS/CT frames 457 * Interface to send ELS/CT frames
422 * 458 *
423 * STATUS: OPTIONAL 459 * STATUS: OPTIONAL
424 */ 460 */
425 struct fc_seq *(*elsct_send)(struct fc_lport *lport, 461 struct fc_seq *(*elsct_send)(struct fc_lport *, u32 did,
426 u32 did, 462 struct fc_frame *, unsigned int op,
427 struct fc_frame *fp,
428 unsigned int op,
429 void (*resp)(struct fc_seq *, 463 void (*resp)(struct fc_seq *,
430 struct fc_frame *fp, 464 struct fc_frame *, void *arg),
431 void *arg),
432 void *arg, u32 timer_msec); 465 void *arg, u32 timer_msec);
433 466
434 /* 467 /*
435 * Send the FC frame payload using a new exchange and sequence. 468 * Send the FC frame payload using a new exchange and sequence.
436 * 469 *
437 * The frame pointer with some of the header's fields must be
438 * filled before calling exch_seq_send(), those fields are,
439 *
440 * - routing control
441 * - FC port did
442 * - FC port sid
443 * - FC header type
444 * - frame control
445 * - parameter or relative offset
446 *
447 * The exchange response handler is set in this routine to resp() 470 * The exchange response handler is set in this routine to resp()
448 * function pointer. It can be called in two scenarios: if a timeout 471 * function pointer. It can be called in two scenarios: if a timeout
449 * occurs or if a response frame is received for the exchange. The 472 * occurs or if a response frame is received for the exchange. The
@@ -464,14 +487,13 @@ struct libfc_function_template {
464 * 487 *
465 * STATUS: OPTIONAL 488 * STATUS: OPTIONAL
466 */ 489 */
467 struct fc_seq *(*exch_seq_send)(struct fc_lport *lp, 490 struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *,
468 struct fc_frame *fp, 491 void (*resp)(struct fc_seq *,
469 void (*resp)(struct fc_seq *sp, 492 struct fc_frame *,
470 struct fc_frame *fp, 493 void *),
471 void *arg), 494 void (*destructor)(struct fc_seq *,
472 void (*destructor)(struct fc_seq *sp, 495 void *),
473 void *arg), 496 void *, unsigned int timer_msec);
474 void *arg, unsigned int timer_msec);
475 497
476 /* 498 /*
477 * Sets up the DDP context for a given exchange id on the given 499 * Sets up the DDP context for a given exchange id on the given
@@ -479,22 +501,28 @@ struct libfc_function_template {
479 * 501 *
480 * STATUS: OPTIONAL 502 * STATUS: OPTIONAL
481 */ 503 */
482 int (*ddp_setup)(struct fc_lport *lp, u16 xid, 504 int (*ddp_setup)(struct fc_lport *, u16, struct scatterlist *,
483 struct scatterlist *sgl, unsigned int sgc); 505 unsigned int);
484 /* 506 /*
485 * Completes the DDP transfer and returns the length of data DDPed 507 * Completes the DDP transfer and returns the length of data DDPed
486 * for the given exchange id. 508 * for the given exchange id.
487 * 509 *
488 * STATUS: OPTIONAL 510 * STATUS: OPTIONAL
489 */ 511 */
490 int (*ddp_done)(struct fc_lport *lp, u16 xid); 512 int (*ddp_done)(struct fc_lport *, u16);
513 /*
514 * Allow LLD to fill its own Link Error Status Block
515 *
516 * STATUS: OPTIONAL
517 */
518 void (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb);
491 /* 519 /*
492 * Send a frame using an existing sequence and exchange. 520 * Send a frame using an existing sequence and exchange.
493 * 521 *
494 * STATUS: OPTIONAL 522 * STATUS: OPTIONAL
495 */ 523 */
496 int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp, 524 int (*seq_send)(struct fc_lport *, struct fc_seq *,
497 struct fc_frame *fp); 525 struct fc_frame *);
498 526
499 /* 527 /*
500 * Send an ELS response using infomation from a previous 528 * Send an ELS response using infomation from a previous
@@ -502,8 +530,8 @@ struct libfc_function_template {
502 * 530 *
503 * STATUS: OPTIONAL 531 * STATUS: OPTIONAL
504 */ 532 */
505 void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd, 533 void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd,
506 struct fc_seq_els_data *els_data); 534 struct fc_seq_els_data *);
507 535
508 /* 536 /*
509 * Abort an exchange and sequence. Generally called because of a 537 * Abort an exchange and sequence. Generally called because of a
@@ -515,7 +543,7 @@ struct libfc_function_template {
515 * 543 *
516 * STATUS: OPTIONAL 544 * STATUS: OPTIONAL
517 */ 545 */
518 int (*seq_exch_abort)(const struct fc_seq *req_sp, 546 int (*seq_exch_abort)(const struct fc_seq *,
519 unsigned int timer_msec); 547 unsigned int timer_msec);
520 548
521 /* 549 /*
@@ -524,14 +552,14 @@ struct libfc_function_template {
524 * 552 *
525 * STATUS: OPTIONAL 553 * STATUS: OPTIONAL
526 */ 554 */
527 void (*exch_done)(struct fc_seq *sp); 555 void (*exch_done)(struct fc_seq *);
528 556
529 /* 557 /*
530 * Start a new sequence on the same exchange/sequence tuple. 558 * Start a new sequence on the same exchange/sequence tuple.
531 * 559 *
532 * STATUS: OPTIONAL 560 * STATUS: OPTIONAL
533 */ 561 */
534 struct fc_seq *(*seq_start_next)(struct fc_seq *sp); 562 struct fc_seq *(*seq_start_next)(struct fc_seq *);
535 563
536 /* 564 /*
537 * Reset an exchange manager, completing all sequences and exchanges. 565 * Reset an exchange manager, completing all sequences and exchanges.
@@ -540,8 +568,7 @@ struct libfc_function_template {
540 * 568 *
541 * STATUS: OPTIONAL 569 * STATUS: OPTIONAL
542 */ 570 */
543 void (*exch_mgr_reset)(struct fc_lport *, 571 void (*exch_mgr_reset)(struct fc_lport *, u32 s_id, u32 d_id);
544 u32 s_id, u32 d_id);
545 572
546 /* 573 /*
547 * Flush the rport work queue. Generally used before shutdown. 574 * Flush the rport work queue. Generally used before shutdown.
@@ -555,8 +582,8 @@ struct libfc_function_template {
555 * 582 *
556 * STATUS: OPTIONAL 583 * STATUS: OPTIONAL
557 */ 584 */
558 void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp, 585 void (*lport_recv)(struct fc_lport *, struct fc_seq *,
559 struct fc_frame *fp); 586 struct fc_frame *);
560 587
561 /* 588 /*
562 * Reset the local port. 589 * Reset the local port.
@@ -566,6 +593,26 @@ struct libfc_function_template {
566 int (*lport_reset)(struct fc_lport *); 593 int (*lport_reset)(struct fc_lport *);
567 594
568 /* 595 /*
596 * Set the local port FC_ID.
597 *
598 * This may be provided by the LLD to allow it to be
599 * notified when the local port is assigned a FC-ID.
600 *
601 * The frame, if non-NULL, is the incoming frame with the
602 * FLOGI LS_ACC or FLOGI, and may contain the granted MAC
603 * address for the LLD. The frame pointer may be NULL if
604 * no MAC is associated with this assignment (LOGO or PLOGI).
605 *
606 * If FC_ID is non-zero, r_a_tov and e_d_tov must be valid.
607 *
608 * Note: this is called with the local port mutex held.
609 *
610 * STATUS: OPTIONAL
611 */
612 void (*lport_set_port_id)(struct fc_lport *, u32 port_id,
613 struct fc_frame *);
614
615 /*
569 * Create a remote port with a given port ID 616 * Create a remote port with a given port ID
570 * 617 *
571 * STATUS: OPTIONAL 618 * STATUS: OPTIONAL
@@ -622,31 +669,31 @@ struct libfc_function_template {
622 * 669 *
623 * STATUS: OPTIONAL 670 * STATUS: OPTIONAL
624 */ 671 */
625 int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp, 672 int (*fcp_cmd_send)(struct fc_lport *, struct fc_fcp_pkt *,
626 void (*resp)(struct fc_seq *, struct fc_frame *fp, 673 void (*resp)(struct fc_seq *, struct fc_frame *,
627 void *arg)); 674 void *));
628 675
629 /* 676 /*
630 * Cleanup the FCP layer, used durring link down and reset 677 * Cleanup the FCP layer, used durring link down and reset
631 * 678 *
632 * STATUS: OPTIONAL 679 * STATUS: OPTIONAL
633 */ 680 */
634 void (*fcp_cleanup)(struct fc_lport *lp); 681 void (*fcp_cleanup)(struct fc_lport *);
635 682
636 /* 683 /*
637 * Abort all I/O on a local port 684 * Abort all I/O on a local port
638 * 685 *
639 * STATUS: OPTIONAL 686 * STATUS: OPTIONAL
640 */ 687 */
641 void (*fcp_abort_io)(struct fc_lport *lp); 688 void (*fcp_abort_io)(struct fc_lport *);
642 689
643 /* 690 /*
644 * Receive a request for the discovery layer. 691 * Receive a request for the discovery layer.
645 * 692 *
646 * STATUS: OPTIONAL 693 * STATUS: OPTIONAL
647 */ 694 */
648 void (*disc_recv_req)(struct fc_seq *, 695 void (*disc_recv_req)(struct fc_seq *, struct fc_frame *,
649 struct fc_frame *, struct fc_lport *); 696 struct fc_lport *);
650 697
651 /* 698 /*
652 * Start discovery for a local port. 699 * Start discovery for a local port.
@@ -675,419 +722,340 @@ struct libfc_function_template {
675 void (*disc_stop_final) (struct fc_lport *); 722 void (*disc_stop_final) (struct fc_lport *);
676}; 723};
677 724
678/* information used by the discovery layer */ 725/**
726 * struct fc_disc - Discovery context
727 * @retry_count: Number of retries
728 * @pending: 1 if discovery is pending, 0 if not
729 * @requesting: 1 if discovery has been requested, 0 if not
730 * @seq_count: Number of sequences used for discovery
731 * @buf_len: Length of the discovery buffer
732 * @disc_id: Discovery ID
733 * @rports: List of discovered remote ports
734 * @lport: The local port that discovery is for
735 * @disc_mutex: Mutex that protects the discovery context
736 * @partial_buf: Partial name buffer (if names are returned
737 * in multiple frames)
738 * @disc_work: handle for delayed work context
739 * @disc_callback: Callback routine called when discovery completes
740 */
679struct fc_disc { 741struct fc_disc {
680 unsigned char retry_count; 742 unsigned char retry_count;
681 unsigned char pending; 743 unsigned char pending;
682 unsigned char requested; 744 unsigned char requested;
683 unsigned short seq_count; 745 unsigned short seq_count;
684 unsigned char buf_len; 746 unsigned char buf_len;
685 u16 disc_id; 747 u16 disc_id;
748
749 struct list_head rports;
750 struct fc_lport *lport;
751 struct mutex disc_mutex;
752 struct fc_gpn_ft_resp partial_buf;
753 struct delayed_work disc_work;
686 754
687 void (*disc_callback)(struct fc_lport *, 755 void (*disc_callback)(struct fc_lport *,
688 enum fc_disc_event); 756 enum fc_disc_event);
689
690 struct list_head rports;
691 struct fc_lport *lport;
692 struct mutex disc_mutex;
693 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */
694 struct delayed_work disc_work;
695}; 757};
696 758
759/**
760 * struct fc_lport - Local port
761 * @host: The SCSI host associated with a local port
762 * @ema_list: Exchange manager anchor list
763 * @dns_rdata: The directory server remote port
764 * @ptp_rdata: Point to point remote port
765 * @scsi_priv: FCP layer internal data
766 * @disc: Discovery context
767 * @vports: Child vports if N_Port
768 * @vport: Parent vport if VN_Port
769 * @tt: Libfc function template
770 * @link_up: Link state (1 = link up, 0 = link down)
771 * @qfull: Queue state (1 queue is full, 0 queue is not full)
772 * @state: Identifies the state
773 * @boot_time: Timestamp indicating when the local port came online
774 * @host_stats: SCSI host statistics
775 * @dev_stats: FCoE device stats (TODO: libfc should not be
776 * FCoE aware)
777 * @retry_count: Number of retries in the current state
778 * @wwpn: World Wide Port Name
779 * @wwnn: World Wide Node Name
780 * @service_params: Common service parameters
781 * @e_d_tov: Error detection timeout value
782 * @r_a_tov: Resouce allocation timeout value
783 * @rnid_gen: RNID information
784 * @sg_supp: Indicates if scatter gather is supported
785 * @seq_offload: Indicates if sequence offload is supported
786 * @crc_offload: Indicates if CRC offload is supported
787 * @lro_enabled: Indicates if large receive offload is supported
788 * @does_npiv: Supports multiple vports
789 * @npiv_enabled: Switch/fabric allows NPIV
790 * @mfs: The maximum Fibre Channel payload size
791 * @max_retry_count: The maximum retry attempts
792 * @max_rport_retry_count: The maximum remote port retry attempts
793 * @lro_xid: The maximum XID for LRO
794 * @lso_max: The maximum large offload send size
795 * @fcts: FC-4 type mask
796 * @lp_mutex: Mutex to protect the local port
797 * @list: Handle for list of local ports
798 * @retry_work: Handle to local port for delayed retry context
799 */
697struct fc_lport { 800struct fc_lport {
698 struct list_head list;
699
700 /* Associations */ 801 /* Associations */
701 struct Scsi_Host *host; 802 struct Scsi_Host *host;
702 struct list_head ema_list; 803 struct list_head ema_list;
703 struct fc_rport_priv *dns_rp; 804 struct fc_rport_priv *dns_rdata;
704 struct fc_rport_priv *ptp_rp; 805 struct fc_rport_priv *ptp_rdata;
705 void *scsi_priv; 806 void *scsi_priv;
706 struct fc_disc disc; 807 struct fc_disc disc;
808
809 /* Virtual port information */
810 struct list_head vports;
811 struct fc_vport *vport;
707 812
708 /* Operational Information */ 813 /* Operational Information */
709 struct libfc_function_template tt; 814 struct libfc_function_template tt;
710 u8 link_up; 815 u8 link_up;
711 u8 qfull; 816 u8 qfull;
712 enum fc_lport_state state; 817 enum fc_lport_state state;
713 unsigned long boot_time; 818 unsigned long boot_time;
714 819 struct fc_host_statistics host_stats;
715 struct fc_host_statistics host_stats; 820 struct fcoe_dev_stats *dev_stats;
716 struct fcoe_dev_stats *dev_stats; 821 u8 retry_count;
717 822
718 u64 wwpn; 823 /* Fabric information */
719 u64 wwnn; 824 u64 wwpn;
720 u8 retry_count; 825 u64 wwnn;
826 unsigned int service_params;
827 unsigned int e_d_tov;
828 unsigned int r_a_tov;
829 struct fc_els_rnid_gen rnid_gen;
721 830
722 /* Capabilities */ 831 /* Capabilities */
723 u32 sg_supp:1; /* scatter gather supported */ 832 u32 sg_supp:1;
724 u32 seq_offload:1; /* seq offload supported */ 833 u32 seq_offload:1;
725 u32 crc_offload:1; /* crc offload supported */ 834 u32 crc_offload:1;
726 u32 lro_enabled:1; /* large receive offload */ 835 u32 lro_enabled:1;
727 u32 mfs; /* max FC payload size */ 836 u32 does_npiv:1;
728 unsigned int service_params; 837 u32 npiv_enabled:1;
729 unsigned int e_d_tov; 838 u32 mfs;
730 unsigned int r_a_tov; 839 u8 max_retry_count;
731 u8 max_retry_count; 840 u8 max_rport_retry_count;
732 u8 max_rport_retry_count; 841 u16 link_speed;
733 u16 link_speed; 842 u16 link_supported_speeds;
734 u16 link_supported_speeds; 843 u16 lro_xid;
735 u16 lro_xid; /* max xid for fcoe lro */ 844 unsigned int lso_max;
736 unsigned int lso_max; /* max large send size */ 845 struct fc_ns_fts fcts;
737 struct fc_ns_fts fcts; /* FC-4 type masks */
738 struct fc_els_rnid_gen rnid_gen; /* RNID information */
739
740 /* Semaphores */
741 struct mutex lp_mutex;
742 846
743 /* Miscellaneous */ 847 /* Miscellaneous */
744 struct delayed_work retry_work; 848 struct mutex lp_mutex;
745 struct delayed_work disc_work; 849 struct list_head list;
850 struct delayed_work retry_work;
746}; 851};
747 852
748/* 853/*
749 * FC_LPORT HELPER FUNCTIONS 854 * FC_LPORT HELPER FUNCTIONS
750 *****************************/ 855 *****************************/
751static inline int fc_lport_test_ready(struct fc_lport *lp) 856
857/**
858 * fc_lport_test_ready() - Determine if a local port is in the READY state
859 * @lport: The local port to test
860 */
861static inline int fc_lport_test_ready(struct fc_lport *lport)
752{ 862{
753 return lp->state == LPORT_ST_READY; 863 return lport->state == LPORT_ST_READY;
754} 864}
755 865
756static inline void fc_set_wwnn(struct fc_lport *lp, u64 wwnn) 866/**
867 * fc_set_wwnn() - Set the World Wide Node Name of a local port
868 * @lport: The local port whose WWNN is to be set
869 * @wwnn: The new WWNN
870 */
871static inline void fc_set_wwnn(struct fc_lport *lport, u64 wwnn)
757{ 872{
758 lp->wwnn = wwnn; 873 lport->wwnn = wwnn;
759} 874}
760 875
761static inline void fc_set_wwpn(struct fc_lport *lp, u64 wwnn) 876/**
877 * fc_set_wwpn() - Set the World Wide Port Name of a local port
878 * @lport: The local port whose WWPN is to be set
879 * @wwnn: The new WWPN
880 */
881static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwnn)
762{ 882{
763 lp->wwpn = wwnn; 883 lport->wwpn = wwnn;
764} 884}
765 885
766static inline void fc_lport_state_enter(struct fc_lport *lp, 886/**
887 * fc_lport_state_enter() - Change a local port's state
888 * @lport: The local port whose state is to change
889 * @state: The new state
890 */
891static inline void fc_lport_state_enter(struct fc_lport *lport,
767 enum fc_lport_state state) 892 enum fc_lport_state state)
768{ 893{
769 if (state != lp->state) 894 if (state != lport->state)
770 lp->retry_count = 0; 895 lport->retry_count = 0;
771 lp->state = state; 896 lport->state = state;
772} 897}
773 898
774static inline int fc_lport_init_stats(struct fc_lport *lp) 899/**
900 * fc_lport_init_stats() - Allocate per-CPU statistics for a local port
901 * @lport: The local port whose statistics are to be initialized
902 */
903static inline int fc_lport_init_stats(struct fc_lport *lport)
775{ 904{
776 /* allocate per cpu stats block */ 905 lport->dev_stats = alloc_percpu(struct fcoe_dev_stats);
777 lp->dev_stats = alloc_percpu(struct fcoe_dev_stats); 906 if (!lport->dev_stats)
778 if (!lp->dev_stats)
779 return -ENOMEM; 907 return -ENOMEM;
780 return 0; 908 return 0;
781} 909}
782 910
783static inline void fc_lport_free_stats(struct fc_lport *lp) 911/**
912 * fc_lport_free_stats() - Free memory for a local port's statistics
913 * @lport: The local port whose statistics are to be freed
914 */
915static inline void fc_lport_free_stats(struct fc_lport *lport)
784{ 916{
785 free_percpu(lp->dev_stats); 917 free_percpu(lport->dev_stats);
786} 918}
787 919
788static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp) 920/**
921 * fc_lport_get_stats() - Get a local port's statistics
922 * @lport: The local port whose statistics are to be retreived
923 */
924static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport)
789{ 925{
790 return per_cpu_ptr(lp->dev_stats, smp_processor_id()); 926 return per_cpu_ptr(lport->dev_stats, smp_processor_id());
791} 927}
792 928
793static inline void *lport_priv(const struct fc_lport *lp) 929/**
930 * lport_priv() - Return the private data from a local port
931 * @lport: The local port whose private data is to be retreived
932 */
933static inline void *lport_priv(const struct fc_lport *lport)
794{ 934{
795 return (void *)(lp + 1); 935 return (void *)(lport + 1);
796} 936}
797 937
798/** 938/**
799 * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport 939 * libfc_host_alloc() - Allocate a Scsi_Host with room for a local port and
800 * @sht: ptr to the scsi host templ 940 * LLD private data
801 * @priv_size: size of private data after fc_lport 941 * @sht: The SCSI host template
942 * @priv_size: Size of private data
802 * 943 *
803 * Returns: ptr to Scsi_Host 944 * Returns: libfc lport
804 */ 945 */
805static inline struct Scsi_Host * 946static inline struct fc_lport *
806libfc_host_alloc(struct scsi_host_template *sht, int priv_size) 947libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
807{ 948{
808 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); 949 struct fc_lport *lport;
950 struct Scsi_Host *shost;
951
952 shost = scsi_host_alloc(sht, sizeof(*lport) + priv_size);
953 if (!shost)
954 return NULL;
955 lport = shost_priv(shost);
956 lport->host = shost;
957 INIT_LIST_HEAD(&lport->ema_list);
958 INIT_LIST_HEAD(&lport->vports);
959 return lport;
809} 960}
810 961
811/* 962/*
812 * LOCAL PORT LAYER 963 * FC_FCP HELPER FUNCTIONS
813 *****************************/ 964 *****************************/
814int fc_lport_init(struct fc_lport *lp); 965static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)
815 966{
816/* 967 if (fsp && fsp->cmd)
817 * Destroy the specified local port by finding and freeing all 968 return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE;
818 * fc_rports associated with it and then by freeing the fc_lport 969 return false;
819 * itself. 970}
820 */
821int fc_lport_destroy(struct fc_lport *lp);
822
823/*
824 * Logout the specified local port from the fabric
825 */
826int fc_fabric_logoff(struct fc_lport *lp);
827
828/*
829 * Initiate the LP state machine. This handler will use fc_host_attr
830 * to store the FLOGI service parameters, so fc_host_attr must be
831 * initialized before calling this handler.
832 */
833int fc_fabric_login(struct fc_lport *lp);
834 971
835/* 972/*
836 * The link is up for the given local port. 973 * LOCAL PORT LAYER
837 */ 974 *****************************/
975int fc_lport_init(struct fc_lport *);
976int fc_lport_destroy(struct fc_lport *);
977int fc_fabric_logoff(struct fc_lport *);
978int fc_fabric_login(struct fc_lport *);
979void __fc_linkup(struct fc_lport *);
838void fc_linkup(struct fc_lport *); 980void fc_linkup(struct fc_lport *);
839 981void __fc_linkdown(struct fc_lport *);
840/*
841 * Link is down for the given local port.
842 */
843void fc_linkdown(struct fc_lport *); 982void fc_linkdown(struct fc_lport *);
844 983void fc_vport_setlink(struct fc_lport *);
845/* 984void fc_vports_linkchange(struct fc_lport *);
846 * Configure the local port.
847 */
848int fc_lport_config(struct fc_lport *); 985int fc_lport_config(struct fc_lport *);
849
850/*
851 * Reset the local port.
852 */
853int fc_lport_reset(struct fc_lport *); 986int fc_lport_reset(struct fc_lport *);
854 987int fc_set_mfs(struct fc_lport *, u32 mfs);
855/* 988struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
856 * Set the mfs or reset 989struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
857 */ 990int fc_lport_bsg_request(struct fc_bsg_job *);
858int fc_set_mfs(struct fc_lport *lp, u32 mfs);
859
860 991
861/* 992/*
862 * REMOTE PORT LAYER 993 * REMOTE PORT LAYER
863 *****************************/ 994 *****************************/
864int fc_rport_init(struct fc_lport *lp); 995int fc_rport_init(struct fc_lport *);
865void fc_rport_terminate_io(struct fc_rport *rp); 996void fc_rport_terminate_io(struct fc_rport *);
866 997
867/* 998/*
868 * DISCOVERY LAYER 999 * DISCOVERY LAYER
869 *****************************/ 1000 *****************************/
870int fc_disc_init(struct fc_lport *lp); 1001int fc_disc_init(struct fc_lport *);
871
872 1002
873/* 1003/*
874 * SCSI LAYER 1004 * FCP LAYER
875 *****************************/ 1005 *****************************/
876/*
877 * Initialize the SCSI block of libfc
878 */
879int fc_fcp_init(struct fc_lport *); 1006int fc_fcp_init(struct fc_lport *);
880
881/*
882 * This section provides an API which allows direct interaction
883 * with the SCSI-ml. Each of these functions satisfies a function
884 * pointer defined in Scsi_Host and therefore is always called
885 * directly from the SCSI-ml.
886 */
887int fc_queuecommand(struct scsi_cmnd *sc_cmd,
888 void (*done)(struct scsi_cmnd *));
889
890/*
891 * complete processing of a fcp packet
892 *
893 * This function may sleep if a fsp timer is pending.
894 * The host lock must not be held by caller.
895 */
896void fc_fcp_complete(struct fc_fcp_pkt *fsp);
897
898/*
899 * Send an ABTS frame to the target device. The sc_cmd argument
900 * is a pointer to the SCSI command to be aborted.
901 */
902int fc_eh_abort(struct scsi_cmnd *sc_cmd);
903
904/*
905 * Reset a LUN by sending send the tm cmd to the target.
906 */
907int fc_eh_device_reset(struct scsi_cmnd *sc_cmd);
908
909/*
910 * Reset the host adapter.
911 */
912int fc_eh_host_reset(struct scsi_cmnd *sc_cmd);
913
914/*
915 * Check rport status.
916 */
917int fc_slave_alloc(struct scsi_device *sdev);
918
919/*
920 * Adjust the queue depth.
921 */
922int fc_change_queue_depth(struct scsi_device *sdev, int qdepth);
923
924/*
925 * Change the tag type.
926 */
927int fc_change_queue_type(struct scsi_device *sdev, int tag_type);
928
929/*
930 * Free memory pools used by the FCP layer.
931 */
932void fc_fcp_destroy(struct fc_lport *); 1007void fc_fcp_destroy(struct fc_lport *);
933 1008
934/* 1009/*
935 * Set up direct-data placement for this I/O request 1010 * SCSI INTERACTION LAYER
936 */ 1011 *****************************/
937void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid); 1012int fc_queuecommand(struct scsi_cmnd *,
1013 void (*done)(struct scsi_cmnd *));
1014int fc_eh_abort(struct scsi_cmnd *);
1015int fc_eh_device_reset(struct scsi_cmnd *);
1016int fc_eh_host_reset(struct scsi_cmnd *);
1017int fc_slave_alloc(struct scsi_device *);
1018int fc_change_queue_depth(struct scsi_device *, int qdepth, int reason);
1019int fc_change_queue_type(struct scsi_device *, int tag_type);
938 1020
939/* 1021/*
940 * ELS/CT interface 1022 * ELS/CT interface
941 *****************************/ 1023 *****************************/
942/* 1024int fc_elsct_init(struct fc_lport *);
943 * Initializes ELS/CT interface 1025struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did,
944 */ 1026 struct fc_frame *,
945int fc_elsct_init(struct fc_lport *lp); 1027 unsigned int op,
1028 void (*resp)(struct fc_seq *,
1029 struct fc_frame *,
1030 void *arg),
1031 void *arg, u32 timer_msec);
1032void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
1033void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
946 1034
947 1035
948/* 1036/*
949 * EXCHANGE MANAGER LAYER 1037 * EXCHANGE MANAGER LAYER
950 *****************************/ 1038 *****************************/
951/* 1039int fc_exch_init(struct fc_lport *);
952 * Initializes Exchange Manager related 1040struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *,
953 * function pointers in struct libfc_function_template. 1041 struct fc_exch_mgr *,
954 */
955int fc_exch_init(struct fc_lport *lp);
956
957/*
958 * Adds Exchange Manager (EM) mp to lport.
959 *
960 * Adds specified mp to lport using struct fc_exch_mgr_anchor,
961 * the struct fc_exch_mgr_anchor allows same EM sharing by
962 * more than one lport with their specified match function,
963 * the match function is used in allocating exchange from
964 * added mp.
965 */
966struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport,
967 struct fc_exch_mgr *mp,
968 bool (*match)(struct fc_frame *)); 1042 bool (*match)(struct fc_frame *));
969 1043void fc_exch_mgr_del(struct fc_exch_mgr_anchor *);
970/* 1044int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst);
971 * Deletes Exchange Manager (EM) from lport by removing 1045struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class,
972 * its anchor ema from lport. 1046 u16 min_xid, u16 max_xid,
973 *
974 * If removed anchor ema was the last user of its associated EM
975 * then also destroys associated EM.
976 */
977void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema);
978
979/*
980 * Allocates an Exchange Manager (EM).
981 *
982 * The EM manages exchanges for their allocation and
983 * free, also allows exchange lookup for received
984 * frame.
985 *
986 * The class is used for initializing FC class of
987 * allocated exchange from EM.
988 *
989 * The min_xid and max_xid will limit new
990 * exchange ID (XID) within this range for
991 * a new exchange.
992 * The LLD may choose to have multiple EMs,
993 * e.g. one EM instance per CPU receive thread in LLD.
994 *
995 * Specified match function is used in allocating exchanges
996 * from newly allocated EM.
997 */
998struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp,
999 enum fc_class class,
1000 u16 min_xid,
1001 u16 max_xid,
1002 bool (*match)(struct fc_frame *)); 1047 bool (*match)(struct fc_frame *));
1003 1048void fc_exch_mgr_free(struct fc_lport *);
1004/* 1049void fc_exch_recv(struct fc_lport *, struct fc_frame *);
1005 * Free all exchange managers of a lport.
1006 */
1007void fc_exch_mgr_free(struct fc_lport *lport);
1008
1009/*
1010 * Receive a frame on specified local port and exchange manager.
1011 */
1012void fc_exch_recv(struct fc_lport *lp, struct fc_frame *fp);
1013
1014/*
1015 * This function is for exch_seq_send function pointer in
1016 * struct libfc_function_template, see comment block on
1017 * exch_seq_send for description of this function.
1018 */
1019struct fc_seq *fc_exch_seq_send(struct fc_lport *lp,
1020 struct fc_frame *fp,
1021 void (*resp)(struct fc_seq *sp,
1022 struct fc_frame *fp,
1023 void *arg),
1024 void (*destructor)(struct fc_seq *sp,
1025 void *arg),
1026 void *arg, u32 timer_msec);
1027
1028/*
1029 * send a frame using existing sequence and exchange.
1030 */
1031int fc_seq_send(struct fc_lport *lp, struct fc_seq *sp, struct fc_frame *fp);
1032
1033/*
1034 * Send ELS response using mainly infomation
1035 * in exchange and sequence in EM layer.
1036 */
1037void fc_seq_els_rsp_send(struct fc_seq *sp, enum fc_els_cmd els_cmd,
1038 struct fc_seq_els_data *els_data);
1039
1040/*
1041 * This function is for seq_exch_abort function pointer in
1042 * struct libfc_function_template, see comment block on
1043 * seq_exch_abort for description of this function.
1044 */
1045int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec);
1046
1047/*
1048 * Indicate that an exchange/sequence tuple is complete and the memory
1049 * allocated for the related objects may be freed.
1050 */
1051void fc_exch_done(struct fc_seq *sp);
1052
1053/*
1054 * Allocate a new exchange and sequence pair.
1055 */
1056struct fc_exch *fc_exch_alloc(struct fc_lport *lport, struct fc_frame *fp);
1057/*
1058 * Start a new sequence on the same exchange as the supplied sequence.
1059 */
1060struct fc_seq *fc_seq_start_next(struct fc_seq *sp);
1061
1062
1063/*
1064 * Reset all EMs of a lport, releasing its all sequences and
1065 * exchanges. If sid is non-zero, then reset only exchanges
1066 * we sourced from that FID. If did is non-zero, reset only
1067 * exchanges destined to that FID.
1068 */
1069void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); 1050void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
1070 1051
1071/* 1052/*
1072 * Functions for fc_functions_template 1053 * Functions for fc_functions_template
1073 */ 1054 */
1074void fc_get_host_speed(struct Scsi_Host *shost); 1055void fc_get_host_speed(struct Scsi_Host *);
1075void fc_get_host_port_type(struct Scsi_Host *shost); 1056void fc_get_host_port_type(struct Scsi_Host *);
1076void fc_get_host_port_state(struct Scsi_Host *shost); 1057void fc_get_host_port_state(struct Scsi_Host *);
1077void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout); 1058void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout);
1078struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); 1059struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *);
1079 1060
1080/*
1081 * module setup functions.
1082 */
1083int fc_setup_exch_mgr(void);
1084void fc_destroy_exch_mgr(void);
1085int fc_setup_rport(void);
1086void fc_destroy_rport(void);
1087
1088/*
1089 * Internal libfc functions.
1090 */
1091const char *fc_els_resp_type(struct fc_frame *);
1092
1093#endif /* _LIBFC_H_ */ 1061#endif /* _LIBFC_H_ */
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index b2410605b740..c603f4a7e7fc 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -53,33 +53,36 @@ enum fip_state {
53}; 53};
54 54
55/** 55/**
56 * struct fcoe_ctlr - FCoE Controller and FIP state. 56 * struct fcoe_ctlr - FCoE Controller and FIP state
57 * @state: internal FIP state for network link and FIP or non-FIP mode. 57 * @state: internal FIP state for network link and FIP or non-FIP mode.
58 * @lp: &fc_lport: libfc local port. 58 * @mode: LLD-selected mode.
59 * @sel_fcf: currently selected FCF, or NULL. 59 * @lp: &fc_lport: libfc local port.
60 * @fcfs: list of discovered FCFs. 60 * @sel_fcf: currently selected FCF, or NULL.
61 * @fcf_count: number of discovered FCF entries. 61 * @fcfs: list of discovered FCFs.
62 * @sol_time: time when a multicast solicitation was last sent. 62 * @fcf_count: number of discovered FCF entries.
63 * @sel_time: time after which to select an FCF. 63 * @sol_time: time when a multicast solicitation was last sent.
64 * @port_ka_time: time of next port keep-alive. 64 * @sel_time: time after which to select an FCF.
65 * @ctlr_ka_time: time of next controller keep-alive. 65 * @port_ka_time: time of next port keep-alive.
66 * @timer: timer struct used for all delayed events. 66 * @ctlr_ka_time: time of next controller keep-alive.
67 * @link_work: &work_struct for doing FCF selection. 67 * @timer: timer struct used for all delayed events.
68 * @recv_work: &work_struct for receiving FIP frames. 68 * @link_work: &work_struct for doing FCF selection.
69 * @recv_work: &work_struct for receiving FIP frames.
69 * @fip_recv_list: list of received FIP frames. 70 * @fip_recv_list: list of received FIP frames.
70 * @user_mfs: configured maximum FC frame size, including FC header. 71 * @user_mfs: configured maximum FC frame size, including FC header.
71 * @flogi_oxid: exchange ID of most recent fabric login. 72 * @flogi_oxid: exchange ID of most recent fabric login.
72 * @flogi_count: number of FLOGI attempts in AUTO mode. 73 * @flogi_count: number of FLOGI attempts in AUTO mode.
73 * @link: current link status for libfc. 74 * @link: current link status for libfc.
74 * @last_link: last link state reported to libfc. 75 * @last_link: last link state reported to libfc.
75 * @map_dest: use the FC_MAP mode for destination MAC addresses. 76 * @map_dest: use the FC_MAP mode for destination MAC addresses.
76 * @spma: supports SPMA server-provided MACs mode 77 * @spma: supports SPMA server-provided MACs mode
77 * @dest_addr: MAC address of the selected FC forwarder. 78 * @send_ctlr_ka: need to send controller keep alive
78 * @ctl_src_addr: the native MAC address of our local port. 79 * @send_port_ka: need to send port keep alives
79 * @data_src_addr: the assigned MAC address for the local port after FLOGI. 80 * @dest_addr: MAC address of the selected FC forwarder.
80 * @send: LLD-supplied function to handle sending of FIP Ethernet frames. 81 * @ctl_src_addr: the native MAC address of our local port.
81 * @update_mac: LLD-supplied function to handle changes to MAC addresses. 82 * @send: LLD-supplied function to handle sending FIP Ethernet frames
82 * @lock: lock protecting this structure. 83 * @update_mac: LLD-supplied function to handle changes to MAC addresses.
84 * @get_src_addr: LLD-supplied function to supply a source MAC address.
85 * @lock: lock protecting this structure.
83 * 86 *
84 * This structure is used by all FCoE drivers. It contains information 87 * This structure is used by all FCoE drivers. It contains information
85 * needed by all FCoE low-level drivers (LLDs) as well as internal state 88 * needed by all FCoE low-level drivers (LLDs) as well as internal state
@@ -87,6 +90,7 @@ enum fip_state {
87 */ 90 */
88struct fcoe_ctlr { 91struct fcoe_ctlr {
89 enum fip_state state; 92 enum fip_state state;
93 enum fip_state mode;
90 struct fc_lport *lp; 94 struct fc_lport *lp;
91 struct fcoe_fcf *sel_fcf; 95 struct fcoe_fcf *sel_fcf;
92 struct list_head fcfs; 96 struct list_head fcfs;
@@ -104,29 +108,32 @@ struct fcoe_ctlr {
104 u8 flogi_count; 108 u8 flogi_count;
105 u8 link; 109 u8 link;
106 u8 last_link; 110 u8 last_link;
111 u8 reset_req;
107 u8 map_dest; 112 u8 map_dest;
108 u8 spma; 113 u8 spma;
114 u8 send_ctlr_ka;
115 u8 send_port_ka;
109 u8 dest_addr[ETH_ALEN]; 116 u8 dest_addr[ETH_ALEN];
110 u8 ctl_src_addr[ETH_ALEN]; 117 u8 ctl_src_addr[ETH_ALEN];
111 u8 data_src_addr[ETH_ALEN];
112 118
113 void (*send)(struct fcoe_ctlr *, struct sk_buff *); 119 void (*send)(struct fcoe_ctlr *, struct sk_buff *);
114 void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new); 120 void (*update_mac)(struct fc_lport *, u8 *addr);
121 u8 * (*get_src_addr)(struct fc_lport *);
115 spinlock_t lock; 122 spinlock_t lock;
116}; 123};
117 124
118/* 125/**
119 * struct fcoe_fcf - Fibre-Channel Forwarder. 126 * struct fcoe_fcf - Fibre-Channel Forwarder
120 * @list: list linkage. 127 * @list: list linkage
121 * @time: system time (jiffies) when an advertisement was last received. 128 * @time: system time (jiffies) when an advertisement was last received
122 * @switch_name: WWN of switch from advertisement. 129 * @switch_name: WWN of switch from advertisement
123 * @fabric_name: WWN of fabric from advertisement. 130 * @fabric_name: WWN of fabric from advertisement
124 * @fc_map: FC_MAP value from advertisement. 131 * @fc_map: FC_MAP value from advertisement
125 * @fcf_mac: Ethernet address of the FCF. 132 * @fcf_mac: Ethernet address of the FCF
126 * @vfid: virtual fabric ID. 133 * @vfid: virtual fabric ID
127 * @pri: seletion priority, smaller values are better. 134 * @pri: selection priority, smaller values are better
128 * @flags: flags received from advertisement. 135 * @flags: flags received from advertisement
129 * @fka_period: keep-alive period, in jiffies. 136 * @fka_period: keep-alive period, in jiffies
130 * 137 *
131 * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that 138 * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that
132 * passes FCoE frames on to an FC fabric. This structure represents 139 * passes FCoE frames on to an FC fabric. This structure represents
@@ -148,6 +155,7 @@ struct fcoe_fcf {
148 u8 pri; 155 u8 pri;
149 u16 flags; 156 u16 flags;
150 u32 fka_period; 157 u32 fka_period;
158 u8 fd_flags:1;
151}; 159};
152 160
153/* FIP API functions */ 161/* FIP API functions */
@@ -155,9 +163,10 @@ void fcoe_ctlr_init(struct fcoe_ctlr *);
155void fcoe_ctlr_destroy(struct fcoe_ctlr *); 163void fcoe_ctlr_destroy(struct fcoe_ctlr *);
156void fcoe_ctlr_link_up(struct fcoe_ctlr *); 164void fcoe_ctlr_link_up(struct fcoe_ctlr *);
157int fcoe_ctlr_link_down(struct fcoe_ctlr *); 165int fcoe_ctlr_link_down(struct fcoe_ctlr *);
158int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *); 166int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *);
159void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); 167void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
160int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa); 168int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
169 struct fc_frame *);
161 170
162/* libfcoe funcs */ 171/* libfcoe funcs */
163u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 172u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index a72edd4eceec..7394e3bc8f4b 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -267,6 +267,7 @@ struct iscsi_session {
267 /* configuration */ 267 /* configuration */
268 int abort_timeout; 268 int abort_timeout;
269 int lu_reset_timeout; 269 int lu_reset_timeout;
270 int tgt_reset_timeout;
270 int initial_r2t_en; 271 int initial_r2t_en;
271 unsigned max_r2t; 272 unsigned max_r2t;
272 int imm_data_en; 273 int imm_data_en;
@@ -333,7 +334,8 @@ struct iscsi_host {
333/* 334/*
334 * scsi host template 335 * scsi host template
335 */ 336 */
336extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); 337extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
338 int reason);
337extern int iscsi_eh_abort(struct scsi_cmnd *sc); 339extern int iscsi_eh_abort(struct scsi_cmnd *sc);
338extern int iscsi_eh_target_reset(struct scsi_cmnd *sc); 340extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
339extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 341extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index e78d3b62d8ec..9eaa3f05f954 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -634,7 +634,8 @@ extern int sas_target_alloc(struct scsi_target *);
634extern int sas_slave_alloc(struct scsi_device *); 634extern int sas_slave_alloc(struct scsi_device *);
635extern int sas_slave_configure(struct scsi_device *); 635extern int sas_slave_configure(struct scsi_device *);
636extern void sas_slave_destroy(struct scsi_device *); 636extern void sas_slave_destroy(struct scsi_device *);
637extern int sas_change_queue_depth(struct scsi_device *, int new_depth); 637extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
638 int reason);
638extern int sas_change_queue_type(struct scsi_device *, int qt); 639extern int sas_change_queue_type(struct scsi_device *, int qt);
639extern int sas_bios_param(struct scsi_device *, 640extern int sas_bios_param(struct scsi_device *,
640 struct block_device *, 641 struct block_device *,
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index 02bd9f716357..39d6d1097153 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -48,7 +48,6 @@ enum osd_std_version {
48 */ 48 */
49struct osd_dev { 49struct osd_dev {
50 struct scsi_device *scsi_device; 50 struct scsi_device *scsi_device;
51 struct file *file;
52 unsigned def_timeout; 51 unsigned def_timeout;
53 52
54#ifdef OSD_VER1_SUPPORT 53#ifdef OSD_VER1_SUPPORT
@@ -56,10 +55,24 @@ struct osd_dev {
56#endif 55#endif
57}; 56};
58 57
59/* Retrieve/return osd_dev(s) for use by Kernel clients */ 58/* Unique Identification of an OSD device */
60struct osd_dev *osduld_path_lookup(const char *dev_name); /*Use IS_ERR/ERR_PTR*/ 59struct osd_dev_info {
60 unsigned systemid_len;
61 u8 systemid[OSD_SYSTEMID_LEN];
62 unsigned osdname_len;
63 u8 *osdname;
64};
65
66/* Retrieve/return osd_dev(s) for use by Kernel clients
67 * Use IS_ERR/ERR_PTR on returned "osd_dev *".
68 */
69struct osd_dev *osduld_path_lookup(const char *dev_name);
70struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi);
61void osduld_put_device(struct osd_dev *od); 71void osduld_put_device(struct osd_dev *od);
62 72
73const struct osd_dev_info *osduld_device_info(struct osd_dev *od);
74bool osduld_device_same(struct osd_dev *od, const struct osd_dev_info *odi);
75
63/* Add/remove test ioctls from external modules */ 76/* Add/remove test ioctls from external modules */
64typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg); 77typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg);
65int osduld_register_test(unsigned ioctl, do_test_fn *do_test); 78int osduld_register_test(unsigned ioctl, do_test_fn *do_test);
@@ -69,8 +82,24 @@ void osduld_unregister_test(unsigned ioctl);
69void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device); 82void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device);
70void osd_dev_fini(struct osd_dev *od); 83void osd_dev_fini(struct osd_dev *od);
71 84
72/* some hi level device operations */ 85/**
73int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ 86 * osd_auto_detect_ver - Detect the OSD version, return Unique Identification
87 *
88 * @od: OSD target lun handle
89 * @caps: Capabilities authorizing OSD root read attributes access
90 * @odi: Retrieved information uniquely identifying the osd target lun
91 * Note: odi->osdname must be kfreed by caller.
92 *
93 * Auto detects the OSD version of the OSD target and sets the @od
94 * accordingly. Meanwhile also returns the "system id" and "osd name" root
95 * attributes which uniquely identify the OSD target. This member is usually
96 * called by the ULD. ULD users should call osduld_device_info().
97 * This rutine allocates osd requests and memory at GFP_KERNEL level and might
98 * sleep.
99 */
100int osd_auto_detect_ver(struct osd_dev *od,
101 void *caps, struct osd_dev_info *odi);
102
74static inline struct request_queue *osd_request_queue(struct osd_dev *od) 103static inline struct request_queue *osd_request_queue(struct osd_dev *od)
75{ 104{
76 return od->scsi_device->request_queue; 105 return od->scsi_device->request_queue;
@@ -84,6 +113,15 @@ static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
84#endif 113#endif
85} 114}
86 115
116static inline bool osd_dev_is_ver1(struct osd_dev *od)
117{
118#ifdef OSD_VER1_SUPPORT
119 return od->version == OSD_VER1;
120#else
121 return false;
122#endif
123}
124
87struct osd_request; 125struct osd_request;
88typedef void (osd_req_done_fn)(struct osd_request *or, void *private); 126typedef void (osd_req_done_fn)(struct osd_request *or, void *private);
89 127
@@ -120,14 +158,9 @@ struct osd_request {
120 int async_error; 158 int async_error;
121}; 159};
122 160
123/* OSD Version control */
124static inline bool osd_req_is_ver1(struct osd_request *or) 161static inline bool osd_req_is_ver1(struct osd_request *or)
125{ 162{
126#ifdef OSD_VER1_SUPPORT 163 return osd_dev_is_ver1(or->osd_dev);
127 return or->osd_dev->version == OSD_VER1;
128#else
129 return false;
130#endif
131} 164}
132 165
133/* 166/*
@@ -234,7 +267,7 @@ int osd_execute_request_async(struct osd_request *or,
234 * @bad_attr_list - List of failing attributes (optional) 267 * @bad_attr_list - List of failing attributes (optional)
235 * @max_attr - Size of @bad_attr_list. 268 * @max_attr - Size of @bad_attr_list.
236 * 269 *
237 * After execution, sense + return code can be analyzed using this function. The 270 * After execution, osd_request results are analyzed using this function. The
238 * return code is the final disposition on the error. So it is possible that a 271 * return code is the final disposition on the error. So it is possible that a
239 * CHECK_CONDITION was returned from target but this will return NO_ERROR, for 272 * CHECK_CONDITION was returned from target but this will return NO_ERROR, for
240 * example on recovered errors. All parameters are optional if caller does 273 * example on recovered errors. All parameters are optional if caller does
@@ -243,7 +276,31 @@ int osd_execute_request_async(struct osd_request *or,
243 * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the 276 * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the
244 * command would routinely fail, to not spam the dmsg file. 277 * command would routinely fail, to not spam the dmsg file.
245 */ 278 */
279
280/**
281 * osd_err_priority - osd categorized return codes in ascending severity.
282 *
283 * The categories are borrowed from the pnfs_osd_errno enum.
284 * See comments for translated Linux codes returned by osd_req_decode_sense.
285 */
286enum osd_err_priority {
287 OSD_ERR_PRI_NO_ERROR = 0,
288 /* Recoverable, caller should clear_highpage() all pages */
289 OSD_ERR_PRI_CLEAR_PAGES = 1, /* -EFAULT */
290 OSD_ERR_PRI_RESOURCE = 2, /* -ENOMEM */
291 OSD_ERR_PRI_BAD_CRED = 3, /* -EINVAL */
292 OSD_ERR_PRI_NO_ACCESS = 4, /* -EACCES */
293 OSD_ERR_PRI_UNREACHABLE = 5, /* any other */
294 OSD_ERR_PRI_NOT_FOUND = 6, /* -ENOENT */
295 OSD_ERR_PRI_NO_SPACE = 7, /* -ENOSPC */
296 OSD_ERR_PRI_EIO = 8, /* -EIO */
297};
298
246struct osd_sense_info { 299struct osd_sense_info {
300 u64 out_resid; /* Zero on success otherwise out residual */
301 u64 in_resid; /* Zero on success otherwise in residual */
302 enum osd_err_priority osd_err_pri;
303
247 int key; /* one of enum scsi_sense_keys */ 304 int key; /* one of enum scsi_sense_keys */
248 int additional_code ; /* enum osd_additional_sense_codes */ 305 int additional_code ; /* enum osd_additional_sense_codes */
249 union { /* Sense specific information */ 306 union { /* Sense specific information */
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 2cc8e8b1cc19..685661283540 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -17,6 +17,7 @@
17#define __OSD_PROTOCOL_H__ 17#define __OSD_PROTOCOL_H__
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/kernel.h>
20#include <asm/unaligned.h> 21#include <asm/unaligned.h>
21#include <scsi/scsi.h> 22#include <scsi/scsi.h>
22 23
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h
index ff9b33c773c7..91db543a5502 100644
--- a/include/scsi/osd_sense.h
+++ b/include/scsi/osd_sense.h
@@ -255,6 +255,9 @@ enum osdv2_cdb_field_offset {
255 OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address), 255 OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address),
256 OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition), 256 OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition),
257 OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object), 257 OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object),
258 OSD_CFO_PERMISSIONS = sizeof(struct osd_cdb_head) +
259 offsetof(struct osd_capability_head,
260 permissions_bit_mask),
258}; 261};
259 262
260#endif /* ndef __OSD_SENSE_H__ */ 263#endif /* ndef __OSD_SENSE_H__ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 34c46ab5c31b..8b4deca996ad 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -94,6 +94,7 @@ struct scsi_cmnd;
94#define WRITE_LONG 0x3f 94#define WRITE_LONG 0x3f
95#define CHANGE_DEFINITION 0x40 95#define CHANGE_DEFINITION 0x40
96#define WRITE_SAME 0x41 96#define WRITE_SAME 0x41
97#define UNMAP 0x42
97#define READ_TOC 0x43 98#define READ_TOC 0x43
98#define LOG_SELECT 0x4c 99#define LOG_SELECT 0x4c
99#define LOG_SENSE 0x4d 100#define LOG_SENSE 0x4d
@@ -122,9 +123,11 @@ struct scsi_cmnd;
122#define READ_16 0x88 123#define READ_16 0x88
123#define WRITE_16 0x8a 124#define WRITE_16 0x8a
124#define VERIFY_16 0x8f 125#define VERIFY_16 0x8f
126#define WRITE_SAME_16 0x93
125#define SERVICE_ACTION_IN 0x9e 127#define SERVICE_ACTION_IN 0x9e
126/* values for service action in */ 128/* values for service action in */
127#define SAI_READ_CAPACITY_16 0x10 129#define SAI_READ_CAPACITY_16 0x10
130#define SAI_GET_LBA_STATUS 0x12
128/* values for maintenance in */ 131/* values for maintenance in */
129#define MI_REPORT_TARGET_PGS 0x0a 132#define MI_REPORT_TARGET_PGS 0x0a
130/* values for maintenance out */ 133/* values for maintenance out */
@@ -132,6 +135,7 @@ struct scsi_cmnd;
132/* values for variable length command */ 135/* values for variable length command */
133#define READ_32 0x09 136#define READ_32 0x09
134#define WRITE_32 0x0b 137#define WRITE_32 0x0b
138#define WRITE_SAME_32 0x0d
135 139
136/* Values for T10/04-262r7 */ 140/* Values for T10/04-262r7 */
137#define ATA_16 0x85 /* 16-byte pass-thru */ 141#define ATA_16 0x85 /* 16-byte pass-thru */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index f097ae340bc1..7c4449900c24 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -81,11 +81,14 @@ struct scsi_device {
81 struct list_head starved_entry; 81 struct list_head starved_entry;
82 struct scsi_cmnd *current_cmnd; /* currently active command */ 82 struct scsi_cmnd *current_cmnd; /* currently active command */
83 unsigned short queue_depth; /* How deep of a queue we want */ 83 unsigned short queue_depth; /* How deep of a queue we want */
84 unsigned short max_queue_depth; /* max queue depth */
84 unsigned short last_queue_full_depth; /* These two are used by */ 85 unsigned short last_queue_full_depth; /* These two are used by */
85 unsigned short last_queue_full_count; /* scsi_track_queue_full() */ 86 unsigned short last_queue_full_count; /* scsi_track_queue_full() */
86 unsigned long last_queue_full_time;/* don't let QUEUE_FULLs on the same 87 unsigned long last_queue_full_time; /* last queue full time */
87 jiffie count on our counter, they 88 unsigned long queue_ramp_up_period; /* ramp up period in jiffies */
88 could all be from the same event. */ 89#define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ)
90
91 unsigned long last_queue_ramp_up; /* last queue ramp up time */
89 92
90 unsigned int id, lun, channel; 93 unsigned int id, lun, channel;
91 94
@@ -175,6 +178,7 @@ struct scsi_dh_devlist {
175 char *model; 178 char *model;
176}; 179};
177 180
181typedef void (*activate_complete)(void *, int);
178struct scsi_device_handler { 182struct scsi_device_handler {
179 /* Used by the infrastructure */ 183 /* Used by the infrastructure */
180 struct list_head list; /* list of scsi_device_handlers */ 184 struct list_head list; /* list of scsi_device_handlers */
@@ -186,7 +190,7 @@ struct scsi_device_handler {
186 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); 190 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *);
187 int (*attach)(struct scsi_device *); 191 int (*attach)(struct scsi_device *);
188 void (*detach)(struct scsi_device *); 192 void (*detach)(struct scsi_device *);
189 int (*activate)(struct scsi_device *); 193 int (*activate)(struct scsi_device *, activate_complete, void *);
190 int (*prep_fn)(struct scsi_device *, struct request *); 194 int (*prep_fn)(struct scsi_device *, struct request *);
191 int (*set_params)(struct scsi_device *, const char *); 195 int (*set_params)(struct scsi_device *, const char *);
192}; 196};
diff --git a/include/scsi/scsi_dh.h b/include/scsi/scsi_dh.h
index ff2407405b42..e3f2db212ddc 100644
--- a/include/scsi/scsi_dh.h
+++ b/include/scsi/scsi_dh.h
@@ -56,14 +56,16 @@ enum {
56 SCSI_DH_DRIVER_MAX, 56 SCSI_DH_DRIVER_MAX,
57}; 57};
58#if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE) 58#if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE)
59extern int scsi_dh_activate(struct request_queue *); 59extern int scsi_dh_activate(struct request_queue *, activate_complete, void *);
60extern int scsi_dh_handler_exist(const char *); 60extern int scsi_dh_handler_exist(const char *);
61extern int scsi_dh_attach(struct request_queue *, const char *); 61extern int scsi_dh_attach(struct request_queue *, const char *);
62extern void scsi_dh_detach(struct request_queue *); 62extern void scsi_dh_detach(struct request_queue *);
63extern int scsi_dh_set_params(struct request_queue *, const char *); 63extern int scsi_dh_set_params(struct request_queue *, const char *);
64#else 64#else
65static inline int scsi_dh_activate(struct request_queue *req) 65static inline int scsi_dh_activate(struct request_queue *req,
66 activate_complete fn, void *data)
66{ 67{
68 fn(data, 0);
67 return 0; 69 return 0;
68} 70}
69static inline int scsi_dh_handler_exist(const char *name) 71static inline int scsi_dh_handler_exist(const char *name)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 47941fc5aba7..c50a97fc76f9 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -43,6 +43,12 @@ struct blk_queue_tags;
43#define DISABLE_CLUSTERING 0 43#define DISABLE_CLUSTERING 0
44#define ENABLE_CLUSTERING 1 44#define ENABLE_CLUSTERING 1
45 45
46enum {
47 SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */
48 SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */
49 SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshhold event */
50};
51
46struct scsi_host_template { 52struct scsi_host_template {
47 struct module *module; 53 struct module *module;
48 const char *name; 54 const char *name;
@@ -294,7 +300,7 @@ struct scsi_host_template {
294 * 300 *
295 * Status: OPTIONAL 301 * Status: OPTIONAL
296 */ 302 */
297 int (* change_queue_depth)(struct scsi_device *, int); 303 int (* change_queue_depth)(struct scsi_device *, int, int);
298 304
299 /* 305 /*
300 * Fill in this function to allow the changing of tag types 306 * Fill in this function to allow the changing of tag types
@@ -677,6 +683,12 @@ struct Scsi_Host {
677 void *shost_data; 683 void *shost_data;
678 684
679 /* 685 /*
686 * Points to the physical bus device we'd use to do DMA
687 * Needed just in case we have virtual hosts.
688 */
689 struct device *dma_dev;
690
691 /*
680 * We should ensure that this is aligned, both for better performance 692 * We should ensure that this is aligned, both for better performance
681 * and also because some compilers (m68k) don't automatically force 693 * and also because some compilers (m68k) don't automatically force
682 * alignment to a long boundary. 694 * alignment to a long boundary.
@@ -720,7 +732,9 @@ extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
720extern void scsi_flush_work(struct Scsi_Host *); 732extern void scsi_flush_work(struct Scsi_Host *);
721 733
722extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); 734extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
723extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *); 735extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
736 struct device *,
737 struct device *);
724extern void scsi_scan_host(struct Scsi_Host *); 738extern void scsi_scan_host(struct Scsi_Host *);
725extern void scsi_rescan_device(struct device *); 739extern void scsi_rescan_device(struct device *);
726extern void scsi_remove_host(struct Scsi_Host *); 740extern void scsi_remove_host(struct Scsi_Host *);
@@ -731,6 +745,12 @@ extern const char *scsi_host_state_name(enum scsi_host_state);
731 745
732extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 746extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
733 747
748static inline int __must_check scsi_add_host(struct Scsi_Host *host,
749 struct device *dev)
750{
751 return scsi_add_host_with_dma(host, dev, dev);
752}
753
734static inline struct device *scsi_get_device(struct Scsi_Host *shost) 754static inline struct device *scsi_get_device(struct Scsi_Host *shost)
735{ 755{
736 return shost->shost_gendev.parent; 756 return shost->shost_gendev.parent;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index fc50bd64aa4e..8e86a94faf06 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -807,5 +807,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, 807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
808 struct fc_vport_identifiers *); 808 struct fc_vport_identifiers *);
809int fc_vport_terminate(struct fc_vport *vport); 809int fc_vport_terminate(struct fc_vport *vport);
810void fc_block_scsi_eh(struct scsi_cmnd *cmnd);
810 811
811#endif /* SCSI_TRANSPORT_FC_H */ 812#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 3dae3f799b9b..49400459b477 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -593,7 +593,7 @@ enum {
593 593
594struct ac97_quirk { 594struct ac97_quirk {
595 unsigned short subvendor; /* PCI subsystem vendor id */ 595 unsigned short subvendor; /* PCI subsystem vendor id */
596 unsigned short subdevice; /* PCI sybsystem device id */ 596 unsigned short subdevice; /* PCI subsystem device id */
597 unsigned short mask; /* device id bit mask, 0 = accept all */ 597 unsigned short mask; /* device id bit mask, 0 = accept all */
598 unsigned int codec_id; /* codec id (if any), 0 = accept all */ 598 unsigned int codec_id; /* codec id (if any), 0 = accept all */
599 const char *name; /* name shown as info */ 599 const char *name; /* name shown as info */
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h
index 9c661f2f8cda..eee19f63c0d8 100644
--- a/include/sound/wm8993.h
+++ b/include/sound/wm8993.h
@@ -36,7 +36,7 @@ struct wm8993_platform_data {
36 unsigned int micbias1_lvl:1; 36 unsigned int micbias1_lvl:1;
37 unsigned int micbias2_lvl:1; 37 unsigned int micbias2_lvl:1;
38 38
39 /* Jack detect threashold levels, see datasheet for values */ 39 /* Jack detect threshold levels, see datasheet for values */
40 unsigned int jd_scthr:2; 40 unsigned int jd_scthr:2;
41 unsigned int jd_thr:2; 41 unsigned int jd_thr:2;
42}; 42};
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 318f76535bd4..d0b6cd3afb2f 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -38,7 +38,7 @@ TRACE_EVENT(ext4_free_inode,
38 __entry->blocks = inode->i_blocks; 38 __entry->blocks = inode->i_blocks;
39 ), 39 ),
40 40
41 TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu", 41 TP_printk("dev %s ino %lu mode 0%o uid %u gid %u blocks %llu",
42 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, 42 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
43 __entry->mode, __entry->uid, __entry->gid, 43 __entry->mode, __entry->uid, __entry->gid,
44 (unsigned long long) __entry->blocks) 44 (unsigned long long) __entry->blocks)
@@ -61,7 +61,7 @@ TRACE_EVENT(ext4_request_inode,
61 __entry->mode = mode; 61 __entry->mode = mode;
62 ), 62 ),
63 63
64 TP_printk("dev %s dir %lu mode %d", 64 TP_printk("dev %s dir %lu mode 0%o",
65 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir, 65 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir,
66 __entry->mode) 66 __entry->mode)
67); 67);
@@ -85,7 +85,7 @@ TRACE_EVENT(ext4_allocate_inode,
85 __entry->mode = mode; 85 __entry->mode = mode;
86 ), 86 ),
87 87
88 TP_printk("dev %s ino %lu dir %lu mode %d", 88 TP_printk("dev %s ino %lu dir %lu mode 0%o",
89 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, 89 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
90 (unsigned long) __entry->dir, __entry->mode) 90 (unsigned long) __entry->dir, __entry->mode)
91); 91);
@@ -305,7 +305,6 @@ TRACE_EVENT(ext4_da_writepages_result,
305 __field( int, ret ) 305 __field( int, ret )
306 __field( int, pages_written ) 306 __field( int, pages_written )
307 __field( long, pages_skipped ) 307 __field( long, pages_skipped )
308 __field( char, encountered_congestion )
309 __field( char, more_io ) 308 __field( char, more_io )
310 __field( char, no_nrwrite_index_update ) 309 __field( char, no_nrwrite_index_update )
311 __field( pgoff_t, writeback_index ) 310 __field( pgoff_t, writeback_index )
@@ -317,17 +316,16 @@ TRACE_EVENT(ext4_da_writepages_result,
317 __entry->ret = ret; 316 __entry->ret = ret;
318 __entry->pages_written = pages_written; 317 __entry->pages_written = pages_written;
319 __entry->pages_skipped = wbc->pages_skipped; 318 __entry->pages_skipped = wbc->pages_skipped;
320 __entry->encountered_congestion = wbc->encountered_congestion;
321 __entry->more_io = wbc->more_io; 319 __entry->more_io = wbc->more_io;
322 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; 320 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
323 __entry->writeback_index = inode->i_mapping->writeback_index; 321 __entry->writeback_index = inode->i_mapping->writeback_index;
324 ), 322 ),
325 323
326 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d writeback_index %lu", 324 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu",
327 jbd2_dev_to_name(__entry->dev), 325 jbd2_dev_to_name(__entry->dev),
328 (unsigned long) __entry->ino, __entry->ret, 326 (unsigned long) __entry->ino, __entry->ret,
329 __entry->pages_written, __entry->pages_skipped, 327 __entry->pages_written, __entry->pages_skipped,
330 __entry->encountered_congestion, __entry->more_io, 328 __entry->more_io,
331 __entry->no_nrwrite_index_update, 329 __entry->no_nrwrite_index_update,
332 (unsigned long) __entry->writeback_index) 330 (unsigned long) __entry->writeback_index)
333); 331);
@@ -591,30 +589,32 @@ TRACE_EVENT(ext4_allocate_blocks,
591 589
592TRACE_EVENT(ext4_free_blocks, 590TRACE_EVENT(ext4_free_blocks,
593 TP_PROTO(struct inode *inode, __u64 block, unsigned long count, 591 TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
594 int metadata), 592 int flags),
595 593
596 TP_ARGS(inode, block, count, metadata), 594 TP_ARGS(inode, block, count, flags),
597 595
598 TP_STRUCT__entry( 596 TP_STRUCT__entry(
599 __field( dev_t, dev ) 597 __field( dev_t, dev )
600 __field( ino_t, ino ) 598 __field( ino_t, ino )
599 __field( umode_t, mode )
601 __field( __u64, block ) 600 __field( __u64, block )
602 __field( unsigned long, count ) 601 __field( unsigned long, count )
603 __field( int, metadata ) 602 __field( int, flags )
604
605 ), 603 ),
606 604
607 TP_fast_assign( 605 TP_fast_assign(
608 __entry->dev = inode->i_sb->s_dev; 606 __entry->dev = inode->i_sb->s_dev;
609 __entry->ino = inode->i_ino; 607 __entry->ino = inode->i_ino;
608 __entry->mode = inode->i_mode;
610 __entry->block = block; 609 __entry->block = block;
611 __entry->count = count; 610 __entry->count = count;
612 __entry->metadata = metadata; 611 __entry->flags = flags;
613 ), 612 ),
614 613
615 TP_printk("dev %s ino %lu block %llu count %lu metadata %d", 614 TP_printk("dev %s ino %lu mode 0%o block %llu count %lu flags %d",
616 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, 615 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
617 __entry->block, __entry->count, __entry->metadata) 616 __entry->mode, __entry->block, __entry->count,
617 __entry->flags)
618); 618);
619 619
620TRACE_EVENT(ext4_sync_file, 620TRACE_EVENT(ext4_sync_file,
@@ -848,6 +848,32 @@ TRACE_EVENT(ext4_mballoc_free,
848 __entry->result_len, __entry->result_logical) 848 __entry->result_len, __entry->result_logical)
849); 849);
850 850
851TRACE_EVENT(ext4_forget,
852 TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
853
854 TP_ARGS(inode, is_metadata, block),
855
856 TP_STRUCT__entry(
857 __field( dev_t, dev )
858 __field( ino_t, ino )
859 __field( umode_t, mode )
860 __field( int, is_metadata )
861 __field( __u64, block )
862 ),
863
864 TP_fast_assign(
865 __entry->dev = inode->i_sb->s_dev;
866 __entry->ino = inode->i_ino;
867 __entry->mode = inode->i_mode;
868 __entry->is_metadata = is_metadata;
869 __entry->block = block;
870 ),
871
872 TP_printk("dev %s ino %lu mode 0%o is_metadata %d block %llu",
873 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
874 __entry->mode, __entry->is_metadata, __entry->block)
875);
876
851#endif /* _TRACE_EXT4_H */ 877#endif /* _TRACE_EXT4_H */
852 878
853/* This part must be outside protection */ 879/* This part must be outside protection */
diff --git a/include/video/sgivw.h b/include/video/sgivw.h
index 55f2a7c024af..f6aa5692e74b 100644
--- a/include/video/sgivw.h
+++ b/include/video/sgivw.h
@@ -351,7 +351,7 @@ typedef enum {
351struct dbe_timing_info 351struct dbe_timing_info
352{ 352{
353 dbe_timing_t type; 353 dbe_timing_t type;
354 int flags; 354 int flags;
355 short width; /* Monitor resolution */ 355 short width; /* Monitor resolution */
356 short height; 356 short height;
357 int fields_sec; /* fields/sec (Hz -3 dec. places */ 357 int fields_sec; /* fields/sec (Hz -3 dec. places */
@@ -389,11 +389,11 @@ struct dbe_timing_info dbeVTimings[] = {
389 { 389 {
390 DBE_VT_640_480_60, 390 DBE_VT_640_480_60,
391 /* flags, width, height, fields_sec, cfreq */ 391 /* flags, width, height, fields_sec, cfreq */
392 0, 640, 480, 59940, 25175, 392 0, 640, 480, 59940, 25175,
393 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */ 393 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
394 800, 640, 800, 656, 752, 394 800, 640, 800, 656, 752,
395 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */ 395 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
396 525, 480, 525, 490, 492, 396 525, 480, 525, 490, 492,
397 /* pll_m, pll_n, pll_p */ 397 /* pll_m, pll_n, pll_p */
398 15, 2, 3 398 15, 2, 3
399 }, 399 },
@@ -650,7 +650,7 @@ struct dbe_timing_info dbeVTimings[] = {
650 /* pll_m, pll_n, pll_p */ 650 /* pll_m, pll_n, pll_p */
651 6, 1, 0 651 6, 1, 0
652 }, 652 },
653 653
654 { 654 {
655 DBE_VT_1920_1200_60, 655 DBE_VT_1920_1200_60,
656 /* flags, width, height, fields_sec, cfreq */ 656 /* flags, width, height, fields_sec, cfreq */
@@ -676,7 +676,6 @@ struct dbe_timing_info dbeVTimings[] = {
676 } 676 }
677}; 677};
678 678
679#define DBE_VT_SIZE (sizeof(dbeVTimings)/sizeof(dbeVTimings[0]))
680#endif // INCLUDE_TIMING_TABLE_DATA 679#endif // INCLUDE_TIMING_TABLE_DATA
681 680
682#endif // ! __SGIVWFB_H__ 681#endif // ! __SGIVWFB_H__