aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-12-14 03:16:49 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-14 03:16:49 -0500
commitcc0104e877fff32865a67b256d3a9ce52ff15790 (patch)
tree18779442274e81607822ecb0905c55ac4ce6a163 /include
parent16620e0f1990fa6d896a639449c4b3d678458464 (diff)
parentf40542532e96dda5506eb76badea322f2ae4731c (diff)
Merge branch 'linus' into tracing/urgent
Conflicts: kernel/trace/trace_kprobe.c Merge reason: resolve the conflict. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_hest.h12
-rw-r--r--include/acpi/acpixf.h5
-rw-r--r--include/acpi/processor.h6
-rw-r--r--include/asm-generic/fcntl.h25
-rw-r--r--include/asm-generic/gpio.h3
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/unistd.h12
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drm.h65
-rw-r--r--include/drm/drmP.h87
-rw-r--r--include/drm/drm_crtc.h47
-rw-r--r--include/drm/drm_dp_helper.h180
-rw-r--r--include/drm/drm_edid.h8
-rw-r--r--include/drm/drm_mm.h35
-rw-r--r--include/drm/drm_mode.h80
-rw-r--r--include/drm/drm_os_linux.h2
-rw-r--r--include/drm/i2c/ch7006.h86
-rw-r--r--include/drm/i915_drm.h78
-rw-r--r--include/drm/mga_drm.h2
-rw-r--r--include/drm/nouveau_drm.h220
-rw-r--r--include/drm/radeon_drm.h2
-rw-r--r--include/drm/ttm/ttm_bo_api.h115
-rw-r--r--include/drm/ttm/ttm_bo_driver.h37
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h107
-rw-r--r--include/drm/ttm/ttm_lock.h247
-rw-r--r--include/drm/ttm/ttm_memory.h1
-rw-r--r--include/drm/ttm/ttm_object.h267
-rw-r--r--include/drm/via_drm.h2
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/cciss_ioctl.h2
-rw-r--r--include/linux/chio.h2
-rw-r--r--include/linux/cpu.h15
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/cpumask.h2
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/dm-log-userspace.h2
-rw-r--r--include/linux/ext2_fs.h16
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fb.h1
-rw-r--r--include/linux/firmware.h5
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/fsl_devices.h11
-rw-r--r--include/linux/gigaset_dev.h22
-rw-r--r--include/linux/hayesesp.h114
-rw-r--r--include/linux/hid.h1
-rw-r--r--include/linux/hrtimer.h56
-rw-r--r--include/linux/hw_breakpoint.h40
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/if_ether.h2
-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/isicom.h1
-rw-r--r--include/linux/kvm.h1
-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/namei.h1
-rw-r--r--include/linux/nilfs2_fs.h24
-rw-r--r--include/linux/omapfb.h251
-rw-r--r--include/linux/pci.h42
-rw-r--r--include/linux/pci_ids.h16
-rw-r--r--include/linux/pci_regs.h18
-rw-r--r--include/linux/pcieport_if.h16
-rw-r--r--include/linux/perf_event.h41
-rw-r--r--include/linux/pktcdvd.h2
-rw-r--r--include/linux/platform_device.h20
-rw-r--r--include/linux/quota.h6
-rw-r--r--include/linux/reiserfs_fs.h71
-rw-r--r--include/linux/reiserfs_fs_sb.h20
-rw-r--r--include/linux/sched.h23
-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/mpc52xx_spi.h10
-rw-r--r--include/linux/spi/spi_bitbang.h2
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysctl.h10
-rw-r--r--include/linux/tty.h25
-rw-r--r--include/linux/ucb1400.h4
-rw-r--r--include/linux/usb.h33
-rw-r--r--include/linux/usb/composite.h1
-rw-r--r--include/linux/usb/otg.h68
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/usb/ulpi.h7
-rw-r--r--include/linux/usb/wusb.h2
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/usbdevice_fs.h26
-rw-r--r--include/linux/videodev2.h9
-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/compat.h2
-rw-r--r--include/net/inet6_hashtables.h2
-rw-r--r--include/net/inet_hashtables.h8
-rw-r--r--include/net/inet_timewait_sock.h3
-rw-r--r--include/net/sctp/structs.h2
-rw-r--r--include/net/tcp.h23
-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/trace/events/timer.h8
-rw-r--r--include/video/sgivw.h11
-rw-r--r--include/xen/xen.h32
144 files changed, 3749 insertions, 1239 deletions
diff --git a/include/acpi/acpi_hest.h b/include/acpi/acpi_hest.h
new file mode 100644
index 000000000000..63194d03cb2d
--- /dev/null
+++ b/include/acpi/acpi_hest.h
@@ -0,0 +1,12 @@
1#ifndef __ACPI_HEST_H
2#define __ACPI_HEST_H
3
4#include <linux/pci.h>
5
6#ifdef CONFIG_ACPI
7extern int acpi_hest_firmware_first_pci(struct pci_dev *pci);
8#else
9static inline int acpi_hest_firmware_first_pci(struct pci_dev *pci) { return 0; }
10#endif
11
12#endif
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/acpi/processor.h b/include/acpi/processor.h
index 740ac3ad8fd0..8b668ead6d6e 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -295,6 +295,7 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
295void acpi_processor_ppc_init(void); 295void acpi_processor_ppc_init(void);
296void acpi_processor_ppc_exit(void); 296void acpi_processor_ppc_exit(void);
297int acpi_processor_ppc_has_changed(struct acpi_processor *pr); 297int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
298extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit);
298#else 299#else
299static inline void acpi_processor_ppc_init(void) 300static inline void acpi_processor_ppc_init(void)
300{ 301{
@@ -316,6 +317,11 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
316 } 317 }
317 return 0; 318 return 0;
318} 319}
320static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
321{
322 return -ENODEV;
323}
324
319#endif /* CONFIG_CPU_FREQ */ 325#endif /* CONFIG_CPU_FREQ */
320 326
321/* in processor_throttling.c */ 327/* in processor_throttling.c */
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index 495dc8af4044..681ddf3e844c 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -3,8 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
7 located on an ext2 file system */
8#define O_ACCMODE 00000003 6#define O_ACCMODE 00000003
9#define O_RDONLY 00000000 7#define O_RDONLY 00000000
10#define O_WRONLY 00000001 8#define O_WRONLY 00000001
@@ -27,8 +25,8 @@
27#ifndef O_NONBLOCK 25#ifndef O_NONBLOCK
28#define O_NONBLOCK 00004000 26#define O_NONBLOCK 00004000
29#endif 27#endif
30#ifndef O_SYNC 28#ifndef O_DSYNC
31#define O_SYNC 00010000 29#define O_DSYNC 00010000 /* used to be O_SYNC, see below */
32#endif 30#endif
33#ifndef FASYNC 31#ifndef FASYNC
34#define FASYNC 00020000 /* fcntl, for BSD compatibility */ 32#define FASYNC 00020000 /* fcntl, for BSD compatibility */
@@ -51,6 +49,25 @@
51#ifndef O_CLOEXEC 49#ifndef O_CLOEXEC
52#define O_CLOEXEC 02000000 /* set close_on_exec */ 50#define O_CLOEXEC 02000000 /* set close_on_exec */
53#endif 51#endif
52
53/*
54 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
55 * the O_SYNC flag. We continue to use the existing numerical value
56 * for O_DSYNC semantics now, but using the correct symbolic name for it.
57 * This new value is used to request true Posix O_SYNC semantics. It is
58 * defined in this strange way to make sure applications compiled against
59 * new headers get at least O_DSYNC semantics on older kernels.
60 *
61 * This has the nice side-effect that we can simply test for O_DSYNC
62 * wherever we do not care if O_DSYNC or O_SYNC is used.
63 *
64 * Note: __O_SYNC must never be used directly.
65 */
66#ifndef O_SYNC
67#define __O_SYNC 04000000
68#define O_SYNC (__O_SYNC|O_DSYNC)
69#endif
70
54#ifndef O_NDELAY 71#ifndef O_NDELAY
55#define O_NDELAY O_NONBLOCK 72#define O_NDELAY O_NONBLOCK
56#endif 73#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 66d6106a2067..204bed37e82d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number)
28 return ((unsigned)number) < ARCH_NR_GPIOS; 28 return ((unsigned)number) < ARCH_NR_GPIOS;
29} 29}
30 30
31struct device;
31struct seq_file; 32struct seq_file;
32struct module; 33struct module;
33 34
@@ -181,6 +182,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
181 182
182#ifndef CONFIG_GPIO_SYSFS 183#ifndef CONFIG_GPIO_SYSFS
183 184
185struct device;
186
184/* sysfs support is only available with gpiolib, where it's optional */ 187/* sysfs support is only available with gpiolib, where it's optional */
185 188
186static inline int gpio_export(unsigned gpio, bool direction_may_change) 189static inline int gpio_export(unsigned gpio, bool direction_may_change)
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..6a0b30f78a62 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -622,16 +622,20 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
622__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) 622__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
623#define __NR_perf_event_open 241 623#define __NR_perf_event_open 241
624__SYSCALL(__NR_perf_event_open, sys_perf_event_open) 624__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
625#define __NR_accept4 242
626__SYSCALL(__NR_accept4, sys_accept4)
627#define __NR_recvmmsg 243
628__SYSCALL(__NR_recvmmsg, sys_recvmmsg)
625 629
626#undef __NR_syscalls 630#undef __NR_syscalls
627#define __NR_syscalls 242 631#define __NR_syscalls 244
628 632
629/* 633/*
630 * All syscalls below here should go away really, 634 * All syscalls below here should go away really,
631 * these are provided for both review and as a porting 635 * these are provided for both review and as a porting
632 * help for the C library version. 636 * help for the C library version.
633* 637*
634 * Last chance: are any of these important enought to 638 * Last chance: are any of these important enough to
635 * enable by default? 639 * enable by default?
636 */ 640 */
637#ifdef __ARCH_WANT_SYSCALL_NO_AT 641#ifdef __ARCH_WANT_SYSCALL_NO_AT
@@ -802,7 +806,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
802#define __NR_statfs __NR3264_statfs 806#define __NR_statfs __NR3264_statfs
803#define __NR_fstatfs __NR3264_fstatfs 807#define __NR_fstatfs __NR3264_fstatfs
804#define __NR_truncate __NR3264_truncate 808#define __NR_truncate __NR3264_truncate
805#define __NR_ftruncate __NR3264_truncate 809#define __NR_ftruncate __NR3264_ftruncate
806#define __NR_lseek __NR3264_lseek 810#define __NR_lseek __NR3264_lseek
807#define __NR_sendfile __NR3264_sendfile 811#define __NR_sendfile __NR3264_sendfile
808#define __NR_newfstatat __NR3264_fstatat 812#define __NR_newfstatat __NR3264_fstatat
@@ -818,7 +822,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
818#define __NR_statfs64 __NR3264_statfs 822#define __NR_statfs64 __NR3264_statfs
819#define __NR_fstatfs64 __NR3264_fstatfs 823#define __NR_fstatfs64 __NR3264_fstatfs
820#define __NR_truncate64 __NR3264_truncate 824#define __NR_truncate64 __NR3264_truncate
821#define __NR_ftruncate64 __NR3264_truncate 825#define __NR_ftruncate64 __NR3264_ftruncate
822#define __NR_llseek __NR3264_lseek 826#define __NR_llseek __NR3264_lseek
823#define __NR_sendfile64 __NR3264_sendfile 827#define __NR_sendfile64 __NR3264_sendfile
824#define __NR_fstatat64 __NR3264_fstatat 828#define __NR_fstatat64 __NR3264_fstatat
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index b940fdfa3b25..cfa6af43c9ea 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -8,3 +8,4 @@ unifdef-y += radeon_drm.h
8unifdef-y += sis_drm.h 8unifdef-y += sis_drm.h
9unifdef-y += savage_drm.h 9unifdef-y += savage_drm.h
10unifdef-y += via_drm.h 10unifdef-y += via_drm.h
11unifdef-y += nouveau_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 7cb50bdde46d..e3f46e0cb7dc 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -36,17 +36,27 @@
36#ifndef _DRM_H_ 36#ifndef _DRM_H_
37#define _DRM_H_ 37#define _DRM_H_
38 38
39#if defined(__linux__)
40
39#include <linux/types.h> 41#include <linux/types.h>
40#include <asm/ioctl.h> /* For _IO* macros */ 42#include <asm/ioctl.h>
41#define DRM_IOCTL_NR(n) _IOC_NR(n) 43typedef unsigned int drm_handle_t;
42#define DRM_IOC_VOID _IOC_NONE
43#define DRM_IOC_READ _IOC_READ
44#define DRM_IOC_WRITE _IOC_WRITE
45#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
46#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
47 44
48#define DRM_MAJOR 226 45#else /* One of the BSDs */
49#define DRM_MAX_MINOR 15 46
47#include <sys/ioccom.h>
48#include <sys/types.h>
49typedef int8_t __s8;
50typedef uint8_t __u8;
51typedef int16_t __s16;
52typedef uint16_t __u16;
53typedef int32_t __s32;
54typedef uint32_t __u32;
55typedef int64_t __s64;
56typedef uint64_t __u64;
57typedef unsigned long drm_handle_t;
58
59#endif
50 60
51#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ 61#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
52#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ 62#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
@@ -59,7 +69,6 @@
59#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) 69#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)
60#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) 70#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
61 71
62typedef unsigned int drm_handle_t;
63typedef unsigned int drm_context_t; 72typedef unsigned int drm_context_t;
64typedef unsigned int drm_drawable_t; 73typedef unsigned int drm_drawable_t;
65typedef unsigned int drm_magic_t; 74typedef unsigned int drm_magic_t;
@@ -454,6 +463,7 @@ struct drm_irq_busid {
454enum drm_vblank_seq_type { 463enum drm_vblank_seq_type {
455 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
456 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
466 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */
457 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 467 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
458 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 468 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
459 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 469 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
@@ -461,8 +471,8 @@ enum drm_vblank_seq_type {
461}; 471};
462 472
463#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 473#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
464#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ 474#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
465 _DRM_VBLANK_NEXTONMISS) 475 _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
466 476
467struct drm_wait_vblank_request { 477struct drm_wait_vblank_request {
468 enum drm_vblank_seq_type type; 478 enum drm_vblank_seq_type type;
@@ -686,6 +696,8 @@ struct drm_gem_open {
686#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 696#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
687#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 697#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
688#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 698#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
699#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
700#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
689 701
690/** 702/**
691 * Device specific ioctls should only be in their respective headers 703 * Device specific ioctls should only be in their respective headers
@@ -698,6 +710,35 @@ struct drm_gem_open {
698#define DRM_COMMAND_BASE 0x40 710#define DRM_COMMAND_BASE 0x40
699#define DRM_COMMAND_END 0xA0 711#define DRM_COMMAND_END 0xA0
700 712
713/**
714 * Header for events written back to userspace on the drm fd. The
715 * type defines the type of event, the length specifies the total
716 * length of the event (including the header), and user_data is
717 * typically a 64 bit value passed with the ioctl that triggered the
718 * event. A read on the drm fd will always only return complete
719 * events, that is, if for example the read buffer is 100 bytes, and
720 * there are two 64 byte events pending, only one will be returned.
721 *
722 * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
723 * up are chipset specific.
724 */
725struct drm_event {
726 __u32 type;
727 __u32 length;
728};
729
730#define DRM_EVENT_VBLANK 0x01
731#define DRM_EVENT_FLIP_COMPLETE 0x02
732
733struct drm_event_vblank {
734 struct drm_event base;
735 __u64 user_data;
736 __u32 tv_sec;
737 __u32 tv_usec;
738 __u32 sequence;
739 __u32 reserved;
740};
741
701/* typedef area */ 742/* typedef area */
702#ifndef __KERNEL__ 743#ifndef __KERNEL__
703typedef struct drm_clip_rect drm_clip_rect_t; 744typedef struct drm_clip_rect drm_clip_rect_t;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index c8e64bbadbcf..19ef8ebdc662 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -245,16 +245,6 @@ extern void drm_ut_debug_printk(unsigned int request_level,
245 245
246#endif 246#endif
247 247
248#define DRM_PROC_LIMIT (PAGE_SIZE-80)
249
250#define DRM_PROC_PRINT(fmt, arg...) \
251 len += sprintf(&buf[len], fmt , ##arg); \
252 if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; }
253
254#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \
255 len += sprintf(&buf[len], fmt , ##arg); \
256 if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; }
257
258/*@}*/ 248/*@}*/
259 249
260/***********************************************************************/ 250/***********************************************************************/
@@ -265,19 +255,8 @@ extern void drm_ut_debug_printk(unsigned int request_level,
265 255
266#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) 256#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1))
267#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) 257#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
268#define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
269 258
270#define DRM_IF_VERSION(maj, min) (maj << 16 | min) 259#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
271/**
272 * Get the private SAREA mapping.
273 *
274 * \param _dev DRM device.
275 * \param _ctx context number.
276 * \param _map output mapping.
277 */
278#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \
279 (_map) = (_dev)->context_sareas[_ctx]; \
280} while(0)
281 260
282/** 261/**
283 * Test that the hardware lock is held by the caller, returning otherwise. 262 * Test that the hardware lock is held by the caller, returning otherwise.
@@ -297,18 +276,6 @@ do { \
297} while (0) 276} while (0)
298 277
299/** 278/**
300 * Copy and IOCTL return string to user space
301 */
302#define DRM_COPY( name, value ) \
303 len = strlen( value ); \
304 if ( len > name##_len ) len = name##_len; \
305 name##_len = strlen( value ); \
306 if ( len && name ) { \
307 if ( copy_to_user( name, value, len ) ) \
308 return -EFAULT; \
309 }
310
311/**
312 * Ioctl function type. 279 * Ioctl function type.
313 * 280 *
314 * \param inode device inode. 281 * \param inode device inode.
@@ -322,6 +289,9 @@ typedef int drm_ioctl_t(struct drm_device *dev, void *data,
322typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, 289typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
323 unsigned long arg); 290 unsigned long arg);
324 291
292#define DRM_IOCTL_NR(n) _IOC_NR(n)
293#define DRM_MAJOR 226
294
325#define DRM_AUTH 0x1 295#define DRM_AUTH 0x1
326#define DRM_MASTER 0x2 296#define DRM_MASTER 0x2
327#define DRM_ROOT_ONLY 0x4 297#define DRM_ROOT_ONLY 0x4
@@ -426,6 +396,14 @@ struct drm_buf_entry {
426 struct drm_freelist freelist; 396 struct drm_freelist freelist;
427}; 397};
428 398
399/* Event queued up for userspace to read */
400struct drm_pending_event {
401 struct drm_event *event;
402 struct list_head link;
403 struct drm_file *file_priv;
404 void (*destroy)(struct drm_pending_event *event);
405};
406
429/** File private data */ 407/** File private data */
430struct drm_file { 408struct drm_file {
431 int authenticated; 409 int authenticated;
@@ -449,6 +427,10 @@ struct drm_file {
449 struct drm_master *master; /* master this node is currently associated with 427 struct drm_master *master; /* master this node is currently associated with
450 N.B. not always minor->master */ 428 N.B. not always minor->master */
451 struct list_head fbs; 429 struct list_head fbs;
430
431 wait_queue_head_t event_wait;
432 struct list_head event_list;
433 int event_space;
452}; 434};
453 435
454/** Wait queue */ 436/** Wait queue */
@@ -795,6 +777,15 @@ struct drm_driver {
795 /* Master routines */ 777 /* Master routines */
796 int (*master_create)(struct drm_device *dev, struct drm_master *master); 778 int (*master_create)(struct drm_device *dev, struct drm_master *master);
797 void (*master_destroy)(struct drm_device *dev, struct drm_master *master); 779 void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
780 /**
781 * master_set is called whenever the minor master is set.
782 * master_drop is called whenever the minor master is dropped.
783 */
784
785 int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
786 bool from_open);
787 void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv,
788 bool from_release);
798 789
799 int (*proc_init)(struct drm_minor *minor); 790 int (*proc_init)(struct drm_minor *minor);
800 void (*proc_cleanup)(struct drm_minor *minor); 791 void (*proc_cleanup)(struct drm_minor *minor);
@@ -900,6 +891,12 @@ struct drm_minor {
900 struct drm_mode_group mode_group; 891 struct drm_mode_group mode_group;
901}; 892};
902 893
894struct drm_pending_vblank_event {
895 struct drm_pending_event base;
896 int pipe;
897 struct drm_event_vblank event;
898};
899
903/** 900/**
904 * DRM device structure. This structure represent a complete card that 901 * DRM device structure. This structure represent a complete card that
905 * may contain multiple heads. 902 * may contain multiple heads.
@@ -999,6 +996,12 @@ struct drm_device {
999 996
1000 u32 max_vblank_count; /**< size of vblank counter register */ 997 u32 max_vblank_count; /**< size of vblank counter register */
1001 998
999 /**
1000 * List of events
1001 */
1002 struct list_head vblank_event_list;
1003 spinlock_t event_lock;
1004
1002 /*@} */ 1005 /*@} */
1003 cycles_t ctx_start; 1006 cycles_t ctx_start;
1004 cycles_t lck_start; 1007 cycles_t lck_start;
@@ -1135,6 +1138,8 @@ extern int drm_lastclose(struct drm_device *dev);
1135extern int drm_open(struct inode *inode, struct file *filp); 1138extern int drm_open(struct inode *inode, struct file *filp);
1136extern int drm_stub_open(struct inode *inode, struct file *filp); 1139extern int drm_stub_open(struct inode *inode, struct file *filp);
1137extern int drm_fasync(int fd, struct file *filp, int on); 1140extern int drm_fasync(int fd, struct file *filp, int on);
1141extern ssize_t drm_read(struct file *filp, char __user *buffer,
1142 size_t count, loff_t *offset);
1138extern int drm_release(struct inode *inode, struct file *filp); 1143extern int drm_release(struct inode *inode, struct file *filp);
1139 1144
1140 /* Mapping support (drm_vm.h) */ 1145 /* Mapping support (drm_vm.h) */
@@ -1295,6 +1300,7 @@ extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1295extern void drm_handle_vblank(struct drm_device *dev, int crtc); 1300extern void drm_handle_vblank(struct drm_device *dev, int crtc);
1296extern int drm_vblank_get(struct drm_device *dev, int crtc); 1301extern int drm_vblank_get(struct drm_device *dev, int crtc);
1297extern void drm_vblank_put(struct drm_device *dev, int crtc); 1302extern void drm_vblank_put(struct drm_device *dev, int crtc);
1303extern void drm_vblank_off(struct drm_device *dev, int crtc);
1298extern void drm_vblank_cleanup(struct drm_device *dev); 1304extern void drm_vblank_cleanup(struct drm_device *dev);
1299/* Modesetting support */ 1305/* Modesetting support */
1300extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 1306extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
@@ -1519,14 +1525,27 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1519 1525
1520static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) 1526static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1521{ 1527{
1528 if (size != 0 && nmemb > ULONG_MAX / size)
1529 return NULL;
1530
1522 if (size * nmemb <= PAGE_SIZE) 1531 if (size * nmemb <= PAGE_SIZE)
1523 return kcalloc(nmemb, size, GFP_KERNEL); 1532 return kcalloc(nmemb, size, GFP_KERNEL);
1524 1533
1534 return __vmalloc(size * nmemb,
1535 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
1536}
1537
1538/* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */
1539static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
1540{
1525 if (size != 0 && nmemb > ULONG_MAX / size) 1541 if (size != 0 && nmemb > ULONG_MAX / size)
1526 return NULL; 1542 return NULL;
1527 1543
1544 if (size * nmemb <= PAGE_SIZE)
1545 return kmalloc(nmemb * size, GFP_KERNEL);
1546
1528 return __vmalloc(size * nmemb, 1547 return __vmalloc(size * nmemb,
1529 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL); 1548 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
1530} 1549}
1531 1550
1532static __inline void drm_free_large(void *ptr) 1551static __inline void drm_free_large(void *ptr)
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b69347b8904f..fdf43abc36db 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -123,7 +123,7 @@ struct drm_display_mode {
123 int type; 123 int type;
124 124
125 /* Proposed mode values */ 125 /* Proposed mode values */
126 int clock; 126 int clock; /* in kHz */
127 int hdisplay; 127 int hdisplay;
128 int hsync_start; 128 int hsync_start;
129 int hsync_end; 129 int hsync_end;
@@ -164,8 +164,8 @@ struct drm_display_mode {
164 int *private; 164 int *private;
165 int private_flags; 165 int private_flags;
166 166
167 int vrefresh; 167 int vrefresh; /* in Hz */
168 float hsync; 168 int hsync; /* in kHz */
169}; 169};
170 170
171enum drm_connector_status { 171enum drm_connector_status {
@@ -242,6 +242,21 @@ struct drm_framebuffer_funcs {
242 int (*create_handle)(struct drm_framebuffer *fb, 242 int (*create_handle)(struct drm_framebuffer *fb,
243 struct drm_file *file_priv, 243 struct drm_file *file_priv,
244 unsigned int *handle); 244 unsigned int *handle);
245 /**
246 * Optinal callback for the dirty fb ioctl.
247 *
248 * Userspace can notify the driver via this callback
249 * that a area of the framebuffer has changed and should
250 * be flushed to the display hardware.
251 *
252 * See documentation in drm_mode.h for the struct
253 * drm_mode_fb_dirty_cmd for more information as all
254 * the semantics and arguments have a one to one mapping
255 * on this function.
256 */
257 int (*dirty)(struct drm_framebuffer *framebuffer, unsigned flags,
258 unsigned color, struct drm_clip_rect *clips,
259 unsigned num_clips);
245}; 260};
246 261
247struct drm_framebuffer { 262struct drm_framebuffer {
@@ -256,7 +271,7 @@ struct drm_framebuffer {
256 unsigned int depth; 271 unsigned int depth;
257 int bits_per_pixel; 272 int bits_per_pixel;
258 int flags; 273 int flags;
259 void *fbdev; 274 struct fb_info *fbdev;
260 u32 pseudo_palette[17]; 275 u32 pseudo_palette[17];
261 struct list_head filp_head; 276 struct list_head filp_head;
262 /* if you are using the helper */ 277 /* if you are using the helper */
@@ -290,6 +305,7 @@ struct drm_property {
290struct drm_crtc; 305struct drm_crtc;
291struct drm_connector; 306struct drm_connector;
292struct drm_encoder; 307struct drm_encoder;
308struct drm_pending_vblank_event;
293 309
294/** 310/**
295 * drm_crtc_funcs - control CRTCs for a given device 311 * drm_crtc_funcs - control CRTCs for a given device
@@ -333,6 +349,19 @@ struct drm_crtc_funcs {
333 void (*destroy)(struct drm_crtc *crtc); 349 void (*destroy)(struct drm_crtc *crtc);
334 350
335 int (*set_config)(struct drm_mode_set *set); 351 int (*set_config)(struct drm_mode_set *set);
352
353 /*
354 * Flip to the given framebuffer. This implements the page
355 * flip ioctl descibed in drm_mode.h, specifically, the
356 * implementation must return immediately and block all
357 * rendering to the current fb until the flip has completed.
358 * If userspace set the event flag in the ioctl, the event
359 * argument will point to an event to send back when the flip
360 * completes, otherwise it will be NULL.
361 */
362 int (*page_flip)(struct drm_crtc *crtc,
363 struct drm_framebuffer *fb,
364 struct drm_pending_vblank_event *event);
336}; 365};
337 366
338/** 367/**
@@ -596,6 +625,7 @@ struct drm_mode_config {
596 /* Optional properties */ 625 /* Optional properties */
597 struct drm_property *scaling_mode_property; 626 struct drm_property *scaling_mode_property;
598 struct drm_property *dithering_mode_property; 627 struct drm_property *dithering_mode_property;
628 struct drm_property *dirty_info_property;
599}; 629};
600 630
601#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 631#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
@@ -667,6 +697,7 @@ extern void drm_mode_validate_size(struct drm_device *dev,
667extern void drm_mode_prune_invalid(struct drm_device *dev, 697extern void drm_mode_prune_invalid(struct drm_device *dev,
668 struct list_head *mode_list, bool verbose); 698 struct list_head *mode_list, bool verbose);
669extern void drm_mode_sort(struct list_head *mode_list); 699extern void drm_mode_sort(struct list_head *mode_list);
700extern int drm_mode_hsync(struct drm_display_mode *mode);
670extern int drm_mode_vrefresh(struct drm_display_mode *mode); 701extern int drm_mode_vrefresh(struct drm_display_mode *mode);
671extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, 702extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
672 int adjust_flags); 703 int adjust_flags);
@@ -703,6 +734,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats
703 char *formats[]); 734 char *formats[]);
704extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 735extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
705extern int drm_mode_create_dithering_property(struct drm_device *dev); 736extern int drm_mode_create_dithering_property(struct drm_device *dev);
737extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
706extern char *drm_get_encoder_name(struct drm_encoder *encoder); 738extern char *drm_get_encoder_name(struct drm_encoder *encoder);
707 739
708extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 740extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
@@ -711,7 +743,8 @@ extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
711 struct drm_encoder *encoder); 743 struct drm_encoder *encoder);
712extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, 744extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
713 int gamma_size); 745 int gamma_size);
714extern void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type); 746extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
747 uint32_t id, uint32_t type);
715/* IOCTLs */ 748/* IOCTLs */
716extern int drm_mode_getresources(struct drm_device *dev, 749extern int drm_mode_getresources(struct drm_device *dev,
717 void *data, struct drm_file *file_priv); 750 void *data, struct drm_file *file_priv);
@@ -730,6 +763,8 @@ extern int drm_mode_rmfb(struct drm_device *dev,
730 void *data, struct drm_file *file_priv); 763 void *data, struct drm_file *file_priv);
731extern int drm_mode_getfb(struct drm_device *dev, 764extern int drm_mode_getfb(struct drm_device *dev,
732 void *data, struct drm_file *file_priv); 765 void *data, struct drm_file *file_priv);
766extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
767 void *data, struct drm_file *file_priv);
733extern int drm_mode_addmode_ioctl(struct drm_device *dev, 768extern int drm_mode_addmode_ioctl(struct drm_device *dev,
734 void *data, struct drm_file *file_priv); 769 void *data, struct drm_file *file_priv);
735extern int drm_mode_rmmode_ioctl(struct drm_device *dev, 770extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
@@ -756,6 +791,8 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
756extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 791extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
757 void *data, struct drm_file *file_priv); 792 void *data, struct drm_file *file_priv);
758extern bool drm_detect_hdmi_monitor(struct edid *edid); 793extern bool drm_detect_hdmi_monitor(struct edid *edid);
794extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
795 void *data, struct drm_file *file_priv);
759extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, 796extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
760 int hdisplay, int vdisplay, int vrefresh, 797 int hdisplay, int vdisplay, int vrefresh,
761 bool reduced, bool interlaced, bool margins); 798 bool reduced, bool interlaced, bool margins);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
new file mode 100644
index 000000000000..a49e791db0b0
--- /dev/null
+++ b/include/drm/drm_dp_helper.h
@@ -0,0 +1,180 @@
1/*
2 * Copyright © 2008 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef _DRM_DP_HELPER_H_
24#define _DRM_DP_HELPER_H_
25
26/* From the VESA DisplayPort spec */
27
28#define AUX_NATIVE_WRITE 0x8
29#define AUX_NATIVE_READ 0x9
30#define AUX_I2C_WRITE 0x0
31#define AUX_I2C_READ 0x1
32#define AUX_I2C_STATUS 0x2
33#define AUX_I2C_MOT 0x4
34
35#define AUX_NATIVE_REPLY_ACK (0x0 << 4)
36#define AUX_NATIVE_REPLY_NACK (0x1 << 4)
37#define AUX_NATIVE_REPLY_DEFER (0x2 << 4)
38#define AUX_NATIVE_REPLY_MASK (0x3 << 4)
39
40#define AUX_I2C_REPLY_ACK (0x0 << 6)
41#define AUX_I2C_REPLY_NACK (0x1 << 6)
42#define AUX_I2C_REPLY_DEFER (0x2 << 6)
43#define AUX_I2C_REPLY_MASK (0x3 << 6)
44
45/* AUX CH addresses */
46/* DPCD */
47#define DP_DPCD_REV 0x000
48
49#define DP_MAX_LINK_RATE 0x001
50
51#define DP_MAX_LANE_COUNT 0x002
52# define DP_MAX_LANE_COUNT_MASK 0x1f
53# define DP_ENHANCED_FRAME_CAP (1 << 7)
54
55#define DP_MAX_DOWNSPREAD 0x003
56# define DP_NO_AUX_HANDSHAKE_LINK_TRAINING (1 << 6)
57
58#define DP_NORP 0x004
59
60#define DP_DOWNSTREAMPORT_PRESENT 0x005
61# define DP_DWN_STRM_PORT_PRESENT (1 << 0)
62# define DP_DWN_STRM_PORT_TYPE_MASK 0x06
63/* 00b = DisplayPort */
64/* 01b = Analog */
65/* 10b = TMDS or HDMI */
66/* 11b = Other */
67# define DP_FORMAT_CONVERSION (1 << 3)
68
69#define DP_MAIN_LINK_CHANNEL_CODING 0x006
70
71/* link configuration */
72#define DP_LINK_BW_SET 0x100
73# define DP_LINK_BW_1_62 0x06
74# define DP_LINK_BW_2_7 0x0a
75
76#define DP_LANE_COUNT_SET 0x101
77# define DP_LANE_COUNT_MASK 0x0f
78# define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7)
79
80#define DP_TRAINING_PATTERN_SET 0x102
81# define DP_TRAINING_PATTERN_DISABLE 0
82# define DP_TRAINING_PATTERN_1 1
83# define DP_TRAINING_PATTERN_2 2
84# define DP_TRAINING_PATTERN_MASK 0x3
85
86# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2)
87# define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2)
88# define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2)
89# define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2)
90# define DP_LINK_QUAL_PATTERN_MASK (3 << 2)
91
92# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4)
93# define DP_LINK_SCRAMBLING_DISABLE (1 << 5)
94
95# define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6)
96# define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6)
97# define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6)
98# define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6)
99
100#define DP_TRAINING_LANE0_SET 0x103
101#define DP_TRAINING_LANE1_SET 0x104
102#define DP_TRAINING_LANE2_SET 0x105
103#define DP_TRAINING_LANE3_SET 0x106
104
105# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3
106# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0
107# define DP_TRAIN_MAX_SWING_REACHED (1 << 2)
108# define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0)
109# define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0)
110# define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0)
111# define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0)
112
113# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3)
114# define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3)
115# define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3)
116# define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3)
117# define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3)
118
119# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3
120# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5)
121
122#define DP_DOWNSPREAD_CTRL 0x107
123# define DP_SPREAD_AMP_0_5 (1 << 4)
124
125#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108
126# define DP_SET_ANSI_8B10B (1 << 0)
127
128#define DP_LANE0_1_STATUS 0x202
129#define DP_LANE2_3_STATUS 0x203
130# define DP_LANE_CR_DONE (1 << 0)
131# define DP_LANE_CHANNEL_EQ_DONE (1 << 1)
132# define DP_LANE_SYMBOL_LOCKED (1 << 2)
133
134#define DP_CHANNEL_EQ_BITS (DP_LANE_CR_DONE | \
135 DP_LANE_CHANNEL_EQ_DONE | \
136 DP_LANE_SYMBOL_LOCKED)
137
138#define DP_LANE_ALIGN_STATUS_UPDATED 0x204
139
140#define DP_INTERLANE_ALIGN_DONE (1 << 0)
141#define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6)
142#define DP_LINK_STATUS_UPDATED (1 << 7)
143
144#define DP_SINK_STATUS 0x205
145
146#define DP_RECEIVE_PORT_0_STATUS (1 << 0)
147#define DP_RECEIVE_PORT_1_STATUS (1 << 1)
148
149#define DP_ADJUST_REQUEST_LANE0_1 0x206
150#define DP_ADJUST_REQUEST_LANE2_3 0x207
151# define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03
152# define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0
153# define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c
154# define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2
155# define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30
156# define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4
157# define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0
158# define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6
159
160#define DP_SET_POWER 0x600
161# define DP_SET_POWER_D0 0x1
162# define DP_SET_POWER_D3 0x2
163
164#define MODE_I2C_START 1
165#define MODE_I2C_WRITE 2
166#define MODE_I2C_READ 4
167#define MODE_I2C_STOP 8
168
169struct i2c_algo_dp_aux_data {
170 bool running;
171 u16 address;
172 int (*aux_ch) (struct i2c_adapter *adapter,
173 int mode, uint8_t write_byte,
174 uint8_t *read_byte);
175};
176
177int
178i2c_dp_aux_add_bus(struct i2c_adapter *adapter);
179
180#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 7d6c9a2dfcbb..d33c3e038606 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -106,6 +106,10 @@ struct detailed_data_color_point {
106 u8 wpindex2[3]; 106 u8 wpindex2[3];
107} __attribute__((packed)); 107} __attribute__((packed));
108 108
109struct cvt_timing {
110 u8 code[3];
111} __attribute__((packed));
112
109struct detailed_non_pixel { 113struct detailed_non_pixel {
110 u8 pad1; 114 u8 pad1;
111 u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name 115 u8 type; /* ff=serial, fe=string, fd=monitor range, fc=monitor name
@@ -117,9 +121,13 @@ struct detailed_non_pixel {
117 struct detailed_data_monitor_range range; 121 struct detailed_data_monitor_range range;
118 struct detailed_data_wpindex color; 122 struct detailed_data_wpindex color;
119 struct std_timing timings[5]; 123 struct std_timing timings[5];
124 struct cvt_timing cvt[4];
120 } data; 125 } data;
121} __attribute__((packed)); 126} __attribute__((packed));
122 127
128#define EDID_DETAIL_EST_TIMINGS 0xf7
129#define EDID_DETAIL_CVT_3BYTE 0xf8
130#define EDID_DETAIL_COLOR_MGMT_DATA 0xf9
123#define EDID_DETAIL_STD_MODES 0xfa 131#define EDID_DETAIL_STD_MODES 0xfa
124#define EDID_DETAIL_MONITOR_CPDATA 0xfb 132#define EDID_DETAIL_MONITOR_CPDATA 0xfb
125#define EDID_DETAIL_MONITOR_NAME 0xfc 133#define EDID_DETAIL_MONITOR_NAME 0xfc
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 62329f9a42cb..4c10be39a43b 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -66,6 +66,13 @@ extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node,
66 unsigned long size, 66 unsigned long size,
67 unsigned alignment, 67 unsigned alignment,
68 int atomic); 68 int atomic);
69extern struct drm_mm_node *drm_mm_get_block_range_generic(
70 struct drm_mm_node *node,
71 unsigned long size,
72 unsigned alignment,
73 unsigned long start,
74 unsigned long end,
75 int atomic);
69static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent, 76static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent,
70 unsigned long size, 77 unsigned long size,
71 unsigned alignment) 78 unsigned alignment)
@@ -78,11 +85,38 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic(struct drm_mm_node *pa
78{ 85{
79 return drm_mm_get_block_generic(parent, size, alignment, 1); 86 return drm_mm_get_block_generic(parent, size, alignment, 1);
80} 87}
88static inline struct drm_mm_node *drm_mm_get_block_range(
89 struct drm_mm_node *parent,
90 unsigned long size,
91 unsigned alignment,
92 unsigned long start,
93 unsigned long end)
94{
95 return drm_mm_get_block_range_generic(parent, size, alignment,
96 start, end, 0);
97}
98static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
99 struct drm_mm_node *parent,
100 unsigned long size,
101 unsigned alignment,
102 unsigned long start,
103 unsigned long end)
104{
105 return drm_mm_get_block_range_generic(parent, size, alignment,
106 start, end, 1);
107}
81extern void drm_mm_put_block(struct drm_mm_node *cur); 108extern void drm_mm_put_block(struct drm_mm_node *cur);
82extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, 109extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
83 unsigned long size, 110 unsigned long size,
84 unsigned alignment, 111 unsigned alignment,
85 int best_match); 112 int best_match);
113extern struct drm_mm_node *drm_mm_search_free_in_range(
114 const struct drm_mm *mm,
115 unsigned long size,
116 unsigned alignment,
117 unsigned long start,
118 unsigned long end,
119 int best_match);
86extern int drm_mm_init(struct drm_mm *mm, unsigned long start, 120extern int drm_mm_init(struct drm_mm *mm, unsigned long start,
87 unsigned long size); 121 unsigned long size);
88extern void drm_mm_takedown(struct drm_mm *mm); 122extern void drm_mm_takedown(struct drm_mm *mm);
@@ -99,6 +133,7 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
99 return block->mm; 133 return block->mm;
100} 134}
101 135
136extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix);
102#ifdef CONFIG_DEBUG_FS 137#ifdef CONFIG_DEBUG_FS
103int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); 138int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
104#endif 139#endif
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 1f908416aedb..43009bc2e757 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,9 +27,6 @@
27#ifndef _DRM_MODE_H 27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H 28#define _DRM_MODE_H
29 29
30#include <linux/kernel.h>
31#include <linux/types.h>
32
33#define DRM_DISPLAY_INFO_LEN 32 30#define DRM_DISPLAY_INFO_LEN 32
34#define DRM_CONNECTOR_NAME_LEN 32 31#define DRM_CONNECTOR_NAME_LEN 32
35#define DRM_DISPLAY_MODE_LEN 32 32#define DRM_DISPLAY_MODE_LEN 32
@@ -78,6 +75,11 @@
78#define DRM_MODE_DITHERING_OFF 0 75#define DRM_MODE_DITHERING_OFF 0
79#define DRM_MODE_DITHERING_ON 1 76#define DRM_MODE_DITHERING_ON 1
80 77
78/* Dirty info options */
79#define DRM_MODE_DIRTY_OFF 0
80#define DRM_MODE_DIRTY_ON 1
81#define DRM_MODE_DIRTY_ANNOTATE 2
82
81struct drm_mode_modeinfo { 83struct drm_mode_modeinfo {
82 __u32 clock; 84 __u32 clock;
83 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; 85 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
@@ -225,6 +227,45 @@ struct drm_mode_fb_cmd {
225 __u32 handle; 227 __u32 handle;
226}; 228};
227 229
230#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
231#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
232#define DRM_MODE_FB_DIRTY_FLAGS 0x03
233
234/*
235 * Mark a region of a framebuffer as dirty.
236 *
237 * Some hardware does not automatically update display contents
238 * as a hardware or software draw to a framebuffer. This ioctl
239 * allows userspace to tell the kernel and the hardware what
240 * regions of the framebuffer have changed.
241 *
242 * The kernel or hardware is free to update more then just the
243 * region specified by the clip rects. The kernel or hardware
244 * may also delay and/or coalesce several calls to dirty into a
245 * single update.
246 *
247 * Userspace may annotate the updates, the annotates are a
248 * promise made by the caller that the change is either a copy
249 * of pixels or a fill of a single color in the region specified.
250 *
251 * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
252 * the number of updated regions are half of num_clips given,
253 * where the clip rects are paired in src and dst. The width and
254 * height of each one of the pairs must match.
255 *
256 * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
257 * promises that the region specified of the clip rects is filled
258 * completely with a single color as given in the color argument.
259 */
260
261struct drm_mode_fb_dirty_cmd {
262 __u32 fb_id;
263 __u32 flags;
264 __u32 color;
265 __u32 num_clips;
266 __u64 clips_ptr;
267};
268
228struct drm_mode_mode_cmd { 269struct drm_mode_mode_cmd {
229 __u32 connector_id; 270 __u32 connector_id;
230 struct drm_mode_modeinfo mode; 271 struct drm_mode_modeinfo mode;
@@ -268,4 +309,37 @@ struct drm_mode_crtc_lut {
268 __u64 blue; 309 __u64 blue;
269}; 310};
270 311
312#define DRM_MODE_PAGE_FLIP_EVENT 0x01
313#define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT
314
315/*
316 * Request a page flip on the specified crtc.
317 *
318 * This ioctl will ask KMS to schedule a page flip for the specified
319 * crtc. Once any pending rendering targeting the specified fb (as of
320 * ioctl time) has completed, the crtc will be reprogrammed to display
321 * that fb after the next vertical refresh. The ioctl returns
322 * immediately, but subsequent rendering to the current fb will block
323 * in the execbuffer ioctl until the page flip happens. If a page
324 * flip is already pending as the ioctl is called, EBUSY will be
325 * returned.
326 *
327 * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will
328 * request that drm sends back a vblank event (see drm.h: struct
329 * drm_event_vblank) when the page flip is done. The user_data field
330 * passed in with this ioctl will be returned as the user_data field
331 * in the vblank event struct.
332 *
333 * The reserved field must be zero until we figure out something
334 * clever to use it for.
335 */
336
337struct drm_mode_crtc_page_flip {
338 __u32 crtc_id;
339 __u32 fb_id;
340 __u32 flags;
341 __u32 reserved;
342 __u64 user_data;
343};
344
271#endif 345#endif
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 26641e95e0a4..393369147a2d 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -123,5 +123,5 @@ do { \
123 remove_wait_queue(&(queue), &entry); \ 123 remove_wait_queue(&(queue), &entry); \
124} while (0) 124} while (0)
125 125
126#define DRM_WAKEUP( queue ) wake_up_interruptible( queue ) 126#define DRM_WAKEUP( queue ) wake_up( queue )
127#define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) 127#define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue )
diff --git a/include/drm/i2c/ch7006.h b/include/drm/i2c/ch7006.h
new file mode 100644
index 000000000000..8390b437a1f8
--- /dev/null
+++ b/include/drm/i2c/ch7006.h
@@ -0,0 +1,86 @@
1/*
2 * Copyright (C) 2009 Francisco Jerez.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef __DRM_I2C_CH7006_H__
28#define __DRM_I2C_CH7006_H__
29
30/**
31 * struct ch7006_encoder_params
32 *
33 * Describes how the ch7006 is wired up with the GPU. It should be
34 * used as the @params parameter of its @set_config method.
35 *
36 * See "http://www.chrontel.com/pdf/7006.pdf" for their precise
37 * meaning.
38 */
39struct ch7006_encoder_params {
40 enum {
41 CH7006_FORMAT_RGB16 = 0,
42 CH7006_FORMAT_YCrCb24m16,
43 CH7006_FORMAT_RGB24m16,
44 CH7006_FORMAT_RGB15,
45 CH7006_FORMAT_RGB24m12C,
46 CH7006_FORMAT_RGB24m12I,
47 CH7006_FORMAT_RGB24m8,
48 CH7006_FORMAT_RGB16m8,
49 CH7006_FORMAT_RGB15m8,
50 CH7006_FORMAT_YCrCb24m8,
51 } input_format;
52
53 enum {
54 CH7006_CLOCK_SLAVE = 0,
55 CH7006_CLOCK_MASTER,
56 } clock_mode;
57
58 enum {
59 CH7006_CLOCK_EDGE_NEG = 0,
60 CH7006_CLOCK_EDGE_POS,
61 } clock_edge;
62
63 int xcm, pcm;
64
65 enum {
66 CH7006_SYNC_SLAVE = 0,
67 CH7006_SYNC_MASTER,
68 } sync_direction;
69
70 enum {
71 CH7006_SYNC_SEPARATED = 0,
72 CH7006_SYNC_EMBEDDED,
73 } sync_encoding;
74
75 enum {
76 CH7006_POUT_1_8V = 0,
77 CH7006_POUT_3_3V,
78 } pout_level;
79
80 enum {
81 CH7006_ACTIVE_HSYNC = 0,
82 CH7006_ACTIVE_DSTART,
83 } active_detect;
84};
85
86#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 7e0cb1da92e6..ec3f5e80a5df 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -27,11 +27,11 @@
27#ifndef _I915_DRM_H_ 27#ifndef _I915_DRM_H_
28#define _I915_DRM_H_ 28#define _I915_DRM_H_
29 29
30#include "drm.h"
31
30/* Please note that modifications to all structs defined here are 32/* Please note that modifications to all structs defined here are
31 * subject to backwards-compatibility constraints. 33 * subject to backwards-compatibility constraints.
32 */ 34 */
33#include <linux/types.h>
34#include "drm.h"
35 35
36/* Each region is a minimum of 16k, and there are at most 255 of them. 36/* Each region is a minimum of 16k, and there are at most 255 of them.
37 */ 37 */
@@ -186,6 +186,8 @@ typedef struct _drm_i915_sarea {
186#define DRM_I915_GEM_MMAP_GTT 0x24 186#define DRM_I915_GEM_MMAP_GTT 0x24
187#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 187#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
188#define DRM_I915_GEM_MADVISE 0x26 188#define DRM_I915_GEM_MADVISE 0x26
189#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
190#define DRM_I915_OVERLAY_ATTRS 0x28
189 191
190#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 192#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
191#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 193#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -221,8 +223,10 @@ typedef struct _drm_i915_sarea {
221#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 223#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
222#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 224#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
223#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 225#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
224#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id) 226#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
225#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 227#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
228#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_IOCTL_I915_OVERLAY_ATTRS, struct drm_intel_overlay_put_image)
229#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
226 230
227/* Allow drivers to submit batchbuffers directly to hardware, relying 231/* Allow drivers to submit batchbuffers directly to hardware, relying
228 * on the security mechanisms provided by hardware. 232 * on the security mechanisms provided by hardware.
@@ -266,6 +270,8 @@ typedef struct drm_i915_irq_wait {
266#define I915_PARAM_CHIPSET_ID 4 270#define I915_PARAM_CHIPSET_ID 4
267#define I915_PARAM_HAS_GEM 5 271#define I915_PARAM_HAS_GEM 5
268#define I915_PARAM_NUM_FENCES_AVAIL 6 272#define I915_PARAM_NUM_FENCES_AVAIL 6
273#define I915_PARAM_HAS_OVERLAY 7
274#define I915_PARAM_HAS_PAGEFLIPPING 8
269 275
270typedef struct drm_i915_getparam { 276typedef struct drm_i915_getparam {
271 int param; 277 int param;
@@ -686,4 +692,70 @@ struct drm_i915_gem_madvise {
686 __u32 retained; 692 __u32 retained;
687}; 693};
688 694
695/* flags */
696#define I915_OVERLAY_TYPE_MASK 0xff
697#define I915_OVERLAY_YUV_PLANAR 0x01
698#define I915_OVERLAY_YUV_PACKED 0x02
699#define I915_OVERLAY_RGB 0x03
700
701#define I915_OVERLAY_DEPTH_MASK 0xff00
702#define I915_OVERLAY_RGB24 0x1000
703#define I915_OVERLAY_RGB16 0x2000
704#define I915_OVERLAY_RGB15 0x3000
705#define I915_OVERLAY_YUV422 0x0100
706#define I915_OVERLAY_YUV411 0x0200
707#define I915_OVERLAY_YUV420 0x0300
708#define I915_OVERLAY_YUV410 0x0400
709
710#define I915_OVERLAY_SWAP_MASK 0xff0000
711#define I915_OVERLAY_NO_SWAP 0x000000
712#define I915_OVERLAY_UV_SWAP 0x010000
713#define I915_OVERLAY_Y_SWAP 0x020000
714#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
715
716#define I915_OVERLAY_FLAGS_MASK 0xff000000
717#define I915_OVERLAY_ENABLE 0x01000000
718
719struct drm_intel_overlay_put_image {
720 /* various flags and src format description */
721 __u32 flags;
722 /* source picture description */
723 __u32 bo_handle;
724 /* stride values and offsets are in bytes, buffer relative */
725 __u16 stride_Y; /* stride for packed formats */
726 __u16 stride_UV;
727 __u32 offset_Y; /* offset for packet formats */
728 __u32 offset_U;
729 __u32 offset_V;
730 /* in pixels */
731 __u16 src_width;
732 __u16 src_height;
733 /* to compensate the scaling factors for partially covered surfaces */
734 __u16 src_scan_width;
735 __u16 src_scan_height;
736 /* output crtc description */
737 __u32 crtc_id;
738 __u16 dst_x;
739 __u16 dst_y;
740 __u16 dst_width;
741 __u16 dst_height;
742};
743
744/* flags */
745#define I915_OVERLAY_UPDATE_ATTRS (1<<0)
746#define I915_OVERLAY_UPDATE_GAMMA (1<<1)
747struct drm_intel_overlay_attrs {
748 __u32 flags;
749 __u32 color_key;
750 __s32 brightness;
751 __u32 contrast;
752 __u32 saturation;
753 __u32 gamma0;
754 __u32 gamma1;
755 __u32 gamma2;
756 __u32 gamma3;
757 __u32 gamma4;
758 __u32 gamma5;
759};
760
689#endif /* _I915_DRM_H_ */ 761#endif /* _I915_DRM_H_ */
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index 325fd6fb4a42..3ffbc4798afa 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -35,7 +35,7 @@
35#ifndef __MGA_DRM_H__ 35#ifndef __MGA_DRM_H__
36#define __MGA_DRM_H__ 36#define __MGA_DRM_H__
37 37
38#include <linux/types.h> 38#include "drm.h"
39 39
40/* WARNING: If you change any of these defines, make sure to change the 40/* WARNING: If you change any of these defines, make sure to change the
41 * defines in the Xserver file (mga_sarea.h) 41 * defines in the Xserver file (mga_sarea.h)
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
new file mode 100644
index 000000000000..1e67c441ea82
--- /dev/null
+++ b/include/drm/nouveau_drm.h
@@ -0,0 +1,220 @@
1/*
2 * Copyright 2005 Stephane Marchesin.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef __NOUVEAU_DRM_H__
26#define __NOUVEAU_DRM_H__
27
28#define NOUVEAU_DRM_HEADER_PATCHLEVEL 15
29
30struct drm_nouveau_channel_alloc {
31 uint32_t fb_ctxdma_handle;
32 uint32_t tt_ctxdma_handle;
33
34 int channel;
35
36 /* Notifier memory */
37 uint32_t notifier_handle;
38
39 /* DRM-enforced subchannel assignments */
40 struct {
41 uint32_t handle;
42 uint32_t grclass;
43 } subchan[8];
44 uint32_t nr_subchan;
45};
46
47struct drm_nouveau_channel_free {
48 int channel;
49};
50
51struct drm_nouveau_grobj_alloc {
52 int channel;
53 uint32_t handle;
54 int class;
55};
56
57struct drm_nouveau_notifierobj_alloc {
58 uint32_t channel;
59 uint32_t handle;
60 uint32_t size;
61 uint32_t offset;
62};
63
64struct drm_nouveau_gpuobj_free {
65 int channel;
66 uint32_t handle;
67};
68
69/* FIXME : maybe unify {GET,SET}PARAMs */
70#define NOUVEAU_GETPARAM_PCI_VENDOR 3
71#define NOUVEAU_GETPARAM_PCI_DEVICE 4
72#define NOUVEAU_GETPARAM_BUS_TYPE 5
73#define NOUVEAU_GETPARAM_FB_PHYSICAL 6
74#define NOUVEAU_GETPARAM_AGP_PHYSICAL 7
75#define NOUVEAU_GETPARAM_FB_SIZE 8
76#define NOUVEAU_GETPARAM_AGP_SIZE 9
77#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10
78#define NOUVEAU_GETPARAM_CHIPSET_ID 11
79#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
80struct drm_nouveau_getparam {
81 uint64_t param;
82 uint64_t value;
83};
84
85struct drm_nouveau_setparam {
86 uint64_t param;
87 uint64_t value;
88};
89
90#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
91#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
92#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
93#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
94
95struct drm_nouveau_gem_info {
96 uint32_t handle;
97 uint32_t domain;
98 uint64_t size;
99 uint64_t offset;
100 uint64_t map_handle;
101 uint32_t tile_mode;
102 uint32_t tile_flags;
103};
104
105struct drm_nouveau_gem_new {
106 struct drm_nouveau_gem_info info;
107 uint32_t channel_hint;
108 uint32_t align;
109};
110
111struct drm_nouveau_gem_pushbuf_bo {
112 uint64_t user_priv;
113 uint32_t handle;
114 uint32_t read_domains;
115 uint32_t write_domains;
116 uint32_t valid_domains;
117 uint32_t presumed_ok;
118 uint32_t presumed_domain;
119 uint64_t presumed_offset;
120};
121
122#define NOUVEAU_GEM_RELOC_LOW (1 << 0)
123#define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
124#define NOUVEAU_GEM_RELOC_OR (1 << 2)
125struct drm_nouveau_gem_pushbuf_reloc {
126 uint32_t bo_index;
127 uint32_t reloc_index;
128 uint32_t flags;
129 uint32_t data;
130 uint32_t vor;
131 uint32_t tor;
132};
133
134#define NOUVEAU_GEM_MAX_BUFFERS 1024
135#define NOUVEAU_GEM_MAX_RELOCS 1024
136
137struct drm_nouveau_gem_pushbuf {
138 uint32_t channel;
139 uint32_t nr_dwords;
140 uint32_t nr_buffers;
141 uint32_t nr_relocs;
142 uint64_t dwords;
143 uint64_t buffers;
144 uint64_t relocs;
145};
146
147struct drm_nouveau_gem_pushbuf_call {
148 uint32_t channel;
149 uint32_t handle;
150 uint32_t offset;
151 uint32_t nr_buffers;
152 uint32_t nr_relocs;
153 uint32_t nr_dwords;
154 uint64_t buffers;
155 uint64_t relocs;
156 uint32_t suffix0;
157 uint32_t suffix1;
158 /* below only accessed for CALL2 */
159 uint64_t vram_available;
160 uint64_t gart_available;
161};
162
163struct drm_nouveau_gem_pin {
164 uint32_t handle;
165 uint32_t domain;
166 uint64_t offset;
167};
168
169struct drm_nouveau_gem_unpin {
170 uint32_t handle;
171};
172
173#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
174#define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002
175#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
176struct drm_nouveau_gem_cpu_prep {
177 uint32_t handle;
178 uint32_t flags;
179};
180
181struct drm_nouveau_gem_cpu_fini {
182 uint32_t handle;
183};
184
185struct drm_nouveau_gem_tile {
186 uint32_t handle;
187 uint32_t offset;
188 uint32_t size;
189 uint32_t tile_mode;
190 uint32_t tile_flags;
191};
192
193enum nouveau_bus_type {
194 NV_AGP = 0,
195 NV_PCI = 1,
196 NV_PCIE = 2,
197};
198
199struct drm_nouveau_sarea {
200};
201
202#define DRM_NOUVEAU_CARD_INIT 0x00
203#define DRM_NOUVEAU_GETPARAM 0x01
204#define DRM_NOUVEAU_SETPARAM 0x02
205#define DRM_NOUVEAU_CHANNEL_ALLOC 0x03
206#define DRM_NOUVEAU_CHANNEL_FREE 0x04
207#define DRM_NOUVEAU_GROBJ_ALLOC 0x05
208#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x06
209#define DRM_NOUVEAU_GPUOBJ_FREE 0x07
210#define DRM_NOUVEAU_GEM_NEW 0x40
211#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
212#define DRM_NOUVEAU_GEM_PUSHBUF_CALL 0x42
213#define DRM_NOUVEAU_GEM_PIN 0x43 /* !KMS only */
214#define DRM_NOUVEAU_GEM_UNPIN 0x44 /* !KMS only */
215#define DRM_NOUVEAU_GEM_CPU_PREP 0x45
216#define DRM_NOUVEAU_GEM_CPU_FINI 0x46
217#define DRM_NOUVEAU_GEM_INFO 0x47
218#define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48
219
220#endif /* __NOUVEAU_DRM_H__ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 3b9932ab1756..39537f3cf98a 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -33,7 +33,7 @@
33#ifndef __RADEON_DRM_H__ 33#ifndef __RADEON_DRM_H__
34#define __RADEON_DRM_H__ 34#define __RADEON_DRM_H__
35 35
36#include <linux/types.h> 36#include "drm.h"
37 37
38/* WARNING: If you change any of these defines, make sure to change the 38/* WARNING: If you change any of these defines, make sure to change the
39 * defines in the X server file (radeon_sarea.h) 39 * defines in the X server file (radeon_sarea.h)
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 491146170522..81eb9f45883c 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -44,6 +44,29 @@ struct ttm_bo_device;
44 44
45struct drm_mm_node; 45struct drm_mm_node;
46 46
47
48/**
49 * struct ttm_placement
50 *
51 * @fpfn: first valid page frame number to put the object
52 * @lpfn: last valid page frame number to put the object
53 * @num_placement: number of prefered placements
54 * @placement: prefered placements
55 * @num_busy_placement: number of prefered placements when need to evict buffer
56 * @busy_placement: prefered placements when need to evict buffer
57 *
58 * Structure indicating the placement you request for an object.
59 */
60struct ttm_placement {
61 unsigned fpfn;
62 unsigned lpfn;
63 unsigned num_placement;
64 const uint32_t *placement;
65 unsigned num_busy_placement;
66 const uint32_t *busy_placement;
67};
68
69
47/** 70/**
48 * struct ttm_mem_reg 71 * struct ttm_mem_reg
49 * 72 *
@@ -109,10 +132,6 @@ struct ttm_tt;
109 * the object is destroyed. 132 * the object is destroyed.
110 * @event_queue: Queue for processes waiting on buffer object status change. 133 * @event_queue: Queue for processes waiting on buffer object status change.
111 * @lock: spinlock protecting mostly synchronization members. 134 * @lock: spinlock protecting mostly synchronization members.
112 * @proposed_placement: Proposed placement for the buffer. Changed only by the
113 * creator prior to validation as opposed to bo->mem.proposed_flags which is
114 * changed by the implementation prior to a buffer move if it wants to outsmart
115 * the buffer creator / user. This latter happens, for example, at eviction.
116 * @mem: structure describing current placement. 135 * @mem: structure describing current placement.
117 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 136 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
118 * pinned in physical memory. If this behaviour is not desired, this member 137 * pinned in physical memory. If this behaviour is not desired, this member
@@ -177,7 +196,6 @@ struct ttm_buffer_object {
177 * Members protected by the bo::reserved lock. 196 * Members protected by the bo::reserved lock.
178 */ 197 */
179 198
180 uint32_t proposed_placement;
181 struct ttm_mem_reg mem; 199 struct ttm_mem_reg mem;
182 struct file *persistant_swap_storage; 200 struct file *persistant_swap_storage;
183 struct ttm_tt *ttm; 201 struct ttm_tt *ttm;
@@ -285,29 +303,30 @@ ttm_bo_reference(struct ttm_buffer_object *bo)
285 * Note: It might be necessary to block validations before the 303 * Note: It might be necessary to block validations before the
286 * wait by reserving the buffer. 304 * wait by reserving the buffer.
287 * Returns -EBUSY if no_wait is true and the buffer is busy. 305 * Returns -EBUSY if no_wait is true and the buffer is busy.
288 * Returns -ERESTART if interrupted by a signal. 306 * Returns -ERESTARTSYS if interrupted by a signal.
289 */ 307 */
290extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, 308extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
291 bool interruptible, bool no_wait); 309 bool interruptible, bool no_wait);
292/** 310/**
293 * ttm_buffer_object_validate 311 * ttm_bo_validate
294 * 312 *
295 * @bo: The buffer object. 313 * @bo: The buffer object.
296 * @proposed_placement: Proposed_placement for the buffer object. 314 * @placement: Proposed placement for the buffer object.
297 * @interruptible: Sleep interruptible if sleeping. 315 * @interruptible: Sleep interruptible if sleeping.
298 * @no_wait: Return immediately if the buffer is busy. 316 * @no_wait: Return immediately if the buffer is busy.
299 * 317 *
300 * Changes placement and caching policy of the buffer object 318 * Changes placement and caching policy of the buffer object
301 * according to bo::proposed_flags. 319 * according proposed placement.
302 * Returns 320 * Returns
303 * -EINVAL on invalid proposed_flags. 321 * -EINVAL on invalid proposed placement.
304 * -ENOMEM on out-of-memory condition. 322 * -ENOMEM on out-of-memory condition.
305 * -EBUSY if no_wait is true and buffer busy. 323 * -EBUSY if no_wait is true and buffer busy.
306 * -ERESTART if interrupted by a signal. 324 * -ERESTARTSYS if interrupted by a signal.
307 */ 325 */
308extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, 326extern int ttm_bo_validate(struct ttm_buffer_object *bo,
309 uint32_t proposed_placement, 327 struct ttm_placement *placement,
310 bool interruptible, bool no_wait); 328 bool interruptible, bool no_wait);
329
311/** 330/**
312 * ttm_bo_unref 331 * ttm_bo_unref
313 * 332 *
@@ -328,7 +347,7 @@ extern void ttm_bo_unref(struct ttm_buffer_object **bo);
328 * waiting for buffer idle. This lock is recursive. 347 * waiting for buffer idle. This lock is recursive.
329 * Returns 348 * Returns
330 * -EBUSY if the buffer is busy and no_wait is true. 349 * -EBUSY if the buffer is busy and no_wait is true.
331 * -ERESTART if interrupted by a signal. 350 * -ERESTARTSYS if interrupted by a signal.
332 */ 351 */
333 352
334extern int 353extern int
@@ -343,7 +362,7 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
343extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); 362extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
344 363
345/** 364/**
346 * ttm_buffer_object_init 365 * ttm_bo_init
347 * 366 *
348 * @bdev: Pointer to a ttm_bo_device struct. 367 * @bdev: Pointer to a ttm_bo_device struct.
349 * @bo: Pointer to a ttm_buffer_object to be initialized. 368 * @bo: Pointer to a ttm_buffer_object to be initialized.
@@ -371,20 +390,20 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
371 * Returns 390 * Returns
372 * -ENOMEM: Out of memory. 391 * -ENOMEM: Out of memory.
373 * -EINVAL: Invalid placement flags. 392 * -EINVAL: Invalid placement flags.
374 * -ERESTART: Interrupted by signal while sleeping waiting for resources. 393 * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.
375 */ 394 */
376 395
377extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, 396extern int ttm_bo_init(struct ttm_bo_device *bdev,
378 struct ttm_buffer_object *bo, 397 struct ttm_buffer_object *bo,
379 unsigned long size, 398 unsigned long size,
380 enum ttm_bo_type type, 399 enum ttm_bo_type type,
381 uint32_t flags, 400 struct ttm_placement *placement,
382 uint32_t page_alignment, 401 uint32_t page_alignment,
383 unsigned long buffer_start, 402 unsigned long buffer_start,
384 bool interrubtible, 403 bool interrubtible,
385 struct file *persistant_swap_storage, 404 struct file *persistant_swap_storage,
386 size_t acc_size, 405 size_t acc_size,
387 void (*destroy) (struct ttm_buffer_object *)); 406 void (*destroy) (struct ttm_buffer_object *));
388/** 407/**
389 * ttm_bo_synccpu_object_init 408 * ttm_bo_synccpu_object_init
390 * 409 *
@@ -405,47 +424,43 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
405 * GEM user interface. 424 * GEM user interface.
406 * @p_bo: On successful completion *p_bo points to the created object. 425 * @p_bo: On successful completion *p_bo points to the created object.
407 * 426 *
408 * This function allocates a ttm_buffer_object, and then calls 427 * This function allocates a ttm_buffer_object, and then calls ttm_bo_init
409 * ttm_buffer_object_init on that object. 428 * on that object. The destroy function is set to kfree().
410 * The destroy function is set to kfree().
411 * Returns 429 * Returns
412 * -ENOMEM: Out of memory. 430 * -ENOMEM: Out of memory.
413 * -EINVAL: Invalid placement flags. 431 * -EINVAL: Invalid placement flags.
414 * -ERESTART: Interrupted by signal while waiting for resources. 432 * -ERESTARTSYS: Interrupted by signal while waiting for resources.
415 */ 433 */
416 434
417extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, 435extern int ttm_bo_create(struct ttm_bo_device *bdev,
418 unsigned long size, 436 unsigned long size,
419 enum ttm_bo_type type, 437 enum ttm_bo_type type,
420 uint32_t flags, 438 struct ttm_placement *placement,
421 uint32_t page_alignment, 439 uint32_t page_alignment,
422 unsigned long buffer_start, 440 unsigned long buffer_start,
423 bool interruptible, 441 bool interruptible,
424 struct file *persistant_swap_storage, 442 struct file *persistant_swap_storage,
425 struct ttm_buffer_object **p_bo); 443 struct ttm_buffer_object **p_bo);
426 444
427/** 445/**
428 * ttm_bo_check_placement 446 * ttm_bo_check_placement
429 * 447 *
430 * @bo: the buffer object. 448 * @bo: the buffer object.
431 * @set_flags: placement flags to set. 449 * @placement: placements
432 * @clr_flags: placement flags to clear.
433 * 450 *
434 * Performs minimal validity checking on an intended change of 451 * Performs minimal validity checking on an intended change of
435 * placement flags. 452 * placement flags.
436 * Returns 453 * Returns
437 * -EINVAL: Intended change is invalid or not allowed. 454 * -EINVAL: Intended change is invalid or not allowed.
438 */ 455 */
439
440extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, 456extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
441 uint32_t set_flags, uint32_t clr_flags); 457 struct ttm_placement *placement);
442 458
443/** 459/**
444 * ttm_bo_init_mm 460 * ttm_bo_init_mm
445 * 461 *
446 * @bdev: Pointer to a ttm_bo_device struct. 462 * @bdev: Pointer to a ttm_bo_device struct.
447 * @mem_type: The memory type. 463 * @mem_type: The memory type.
448 * @p_offset: offset for managed area in pages.
449 * @p_size: size managed area in pages. 464 * @p_size: size managed area in pages.
450 * 465 *
451 * Initialize a manager for a given memory type. 466 * Initialize a manager for a given memory type.
@@ -458,7 +473,7 @@ extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
458 */ 473 */
459 474
460extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, 475extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
461 unsigned long p_offset, unsigned long p_size); 476 unsigned long p_size);
462/** 477/**
463 * ttm_bo_clean_mm 478 * ttm_bo_clean_mm
464 * 479 *
@@ -503,7 +518,7 @@ extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type);
503 * 518 *
504 * Returns: 519 * Returns:
505 * -EINVAL: Invalid or uninitialized memory type. 520 * -EINVAL: Invalid or uninitialized memory type.
506 * -ERESTART: The call was interrupted by a signal while waiting to 521 * -ERESTARTSYS: The call was interrupted by a signal while waiting to
507 * evict a buffer. 522 * evict a buffer.
508 */ 523 */
509 524
@@ -606,7 +621,7 @@ extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
606 * be called from the fops::read and fops::write method. 621 * be called from the fops::read and fops::write method.
607 * Returns: 622 * Returns:
608 * See man (2) write, man(2) read. In particular, 623 * See man (2) write, man(2) read. In particular,
609 * the function may return -EINTR if 624 * the function may return -ERESTARTSYS if
610 * interrupted by a signal. 625 * interrupted by a signal.
611 */ 626 */
612 627
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index e8cd6d20aed2..ff7664e0c3cd 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -242,12 +242,6 @@ struct ttm_mem_type_manager {
242/** 242/**
243 * struct ttm_bo_driver 243 * struct ttm_bo_driver
244 * 244 *
245 * @mem_type_prio: Priority array of memory types to place a buffer object in
246 * if it fits without evicting buffers from any of these memory types.
247 * @mem_busy_prio: Priority array of memory types to place a buffer object in
248 * if it needs to evict buffers to make room.
249 * @num_mem_type_prio: Number of elements in the @mem_type_prio array.
250 * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array.
251 * @create_ttm_backend_entry: Callback to create a struct ttm_backend. 245 * @create_ttm_backend_entry: Callback to create a struct ttm_backend.
252 * @invalidate_caches: Callback to invalidate read caches when a buffer object 246 * @invalidate_caches: Callback to invalidate read caches when a buffer object
253 * has been evicted. 247 * has been evicted.
@@ -265,11 +259,6 @@ struct ttm_mem_type_manager {
265 */ 259 */
266 260
267struct ttm_bo_driver { 261struct ttm_bo_driver {
268 const uint32_t *mem_type_prio;
269 const uint32_t *mem_busy_prio;
270 uint32_t num_mem_type_prio;
271 uint32_t num_mem_busy_prio;
272
273 /** 262 /**
274 * struct ttm_bo_driver member create_ttm_backend_entry 263 * struct ttm_bo_driver member create_ttm_backend_entry
275 * 264 *
@@ -306,7 +295,8 @@ struct ttm_bo_driver {
306 * finished, they'll end up in bo->mem.flags 295 * finished, they'll end up in bo->mem.flags
307 */ 296 */
308 297
309 uint32_t(*evict_flags) (struct ttm_buffer_object *bo); 298 void(*evict_flags) (struct ttm_buffer_object *bo,
299 struct ttm_placement *placement);
310 /** 300 /**
311 * struct ttm_bo_driver member move: 301 * struct ttm_bo_driver member move:
312 * 302 *
@@ -545,6 +535,15 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm,
545extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); 535extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
546 536
547/** 537/**
538 * ttm_tt_populate:
539 *
540 * @ttm: The struct ttm_tt to contain the backing pages.
541 *
542 * Add backing pages to all of @ttm
543 */
544extern int ttm_tt_populate(struct ttm_tt *ttm);
545
546/**
548 * ttm_ttm_destroy: 547 * ttm_ttm_destroy:
549 * 548 *
550 * @ttm: The struct ttm_tt. 549 * @ttm: The struct ttm_tt.
@@ -639,12 +638,12 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
639 * -EBUSY: No space available (only if no_wait == 1). 638 * -EBUSY: No space available (only if no_wait == 1).
640 * -ENOMEM: Could not allocate memory for the buffer object, either due to 639 * -ENOMEM: Could not allocate memory for the buffer object, either due to
641 * fragmentation or concurrent allocators. 640 * fragmentation or concurrent allocators.
642 * -ERESTART: An interruptible sleep was interrupted by a signal. 641 * -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
643 */ 642 */
644extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, 643extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
645 uint32_t proposed_placement, 644 struct ttm_placement *placement,
646 struct ttm_mem_reg *mem, 645 struct ttm_mem_reg *mem,
647 bool interruptible, bool no_wait); 646 bool interruptible, bool no_wait);
648/** 647/**
649 * ttm_bo_wait_for_cpu 648 * ttm_bo_wait_for_cpu
650 * 649 *
@@ -654,7 +653,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
654 * Wait until a buffer object is no longer sync'ed for CPU access. 653 * Wait until a buffer object is no longer sync'ed for CPU access.
655 * Returns: 654 * Returns:
656 * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). 655 * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
657 * -ERESTART: An interruptible sleep was interrupted by a signal. 656 * -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
658 */ 657 */
659 658
660extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); 659extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
@@ -758,7 +757,7 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo);
758 * -EAGAIN: The reservation may cause a deadlock. 757 * -EAGAIN: The reservation may cause a deadlock.
759 * Release all buffer reservations, wait for @bo to become unreserved and 758 * Release all buffer reservations, wait for @bo to become unreserved and
760 * try again. (only if use_sequence == 1). 759 * try again. (only if use_sequence == 1).
761 * -ERESTART: A wait for the buffer to become unreserved was interrupted by 760 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
762 * a signal. Release all buffer reservations and return to user-space. 761 * a signal. Release all buffer reservations and return to user-space.
763 */ 762 */
764extern int ttm_bo_reserve(struct ttm_buffer_object *bo, 763extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
@@ -799,7 +798,7 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
799 * 798 *
800 * Returns: 799 * Returns:
801 * -EBUSY: If no_wait == 1 and the buffer is already reserved. 800 * -EBUSY: If no_wait == 1 and the buffer is already reserved.
802 * -ERESTART: If interruptible == 1 and the process received a signal 801 * -ERESTARTSYS: If interruptible == 1 and the process received a signal
803 * while sleeping. 802 * while sleeping.
804 */ 803 */
805extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, 804extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
new file mode 100644
index 000000000000..cd2c475da9ea
--- /dev/null
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -0,0 +1,107 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_EXECBUF_UTIL_H_
32#define _TTM_EXECBUF_UTIL_H_
33
34#include "ttm/ttm_bo_api.h"
35#include <linux/list.h>
36
37/**
38 * struct ttm_validate_buffer
39 *
40 * @head: list head for thread-private list.
41 * @bo: refcounted buffer object pointer.
42 * @new_sync_obj_arg: New sync_obj_arg for @bo, to be used once
43 * adding a new sync object.
44 * @reservied: Indicates whether @bo has been reserved for validation.
45 */
46
47struct ttm_validate_buffer {
48 struct list_head head;
49 struct ttm_buffer_object *bo;
50 void *new_sync_obj_arg;
51 bool reserved;
52};
53
54/**
55 * function ttm_eu_backoff_reservation
56 *
57 * @list: thread private list of ttm_validate_buffer structs.
58 *
59 * Undoes all buffer validation reservations for bos pointed to by
60 * the list entries.
61 */
62
63extern void ttm_eu_backoff_reservation(struct list_head *list);
64
65/**
66 * function ttm_eu_reserve_buffers
67 *
68 * @list: thread private list of ttm_validate_buffer structs.
69 * @val_seq: A unique sequence number.
70 *
71 * Tries to reserve bos pointed to by the list entries for validation.
72 * If the function returns 0, all buffers are marked as "unfenced",
73 * taken off the lru lists and are not synced for write CPU usage.
74 *
75 * If the function detects a deadlock due to multiple threads trying to
76 * reserve the same buffers in reverse order, all threads except one will
77 * back off and retry. This function may sleep while waiting for
78 * CPU write reservations to be cleared, and for other threads to
79 * unreserve their buffers.
80 *
81 * This function may return -ERESTART or -EAGAIN if the calling process
82 * receives a signal while waiting. In that case, no buffers on the list
83 * will be reserved upon return.
84 *
85 * Buffers reserved by this function should be unreserved by
86 * a call to either ttm_eu_backoff_reservation() or
87 * ttm_eu_fence_buffer_objects() when command submission is complete or
88 * has failed.
89 */
90
91extern int ttm_eu_reserve_buffers(struct list_head *list, uint32_t val_seq);
92
93/**
94 * function ttm_eu_fence_buffer_objects.
95 *
96 * @list: thread private list of ttm_validate_buffer structs.
97 * @sync_obj: The new sync object for the buffers.
98 *
99 * This function should be called when command submission is complete, and
100 * it will add a new sync object to bos pointed to by entries on @list.
101 * It also unreserves all buffers, putting them on lru lists.
102 *
103 */
104
105extern void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj);
106
107#endif
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h
new file mode 100644
index 000000000000..81ba0b0b891a
--- /dev/null
+++ b/include/drm/ttm/ttm_lock.h
@@ -0,0 +1,247 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31/** @file ttm_lock.h
32 * This file implements a simple replacement for the buffer manager use
33 * of the DRM heavyweight hardware lock.
34 * The lock is a read-write lock. Taking it in read mode and write mode
35 * is relatively fast, and intended for in-kernel use only.
36 *
37 * The vt mode is used only when there is a need to block all
38 * user-space processes from validating buffers.
39 * It's allowed to leave kernel space with the vt lock held.
40 * If a user-space process dies while having the vt-lock,
41 * it will be released during the file descriptor release. The vt lock
42 * excludes write lock and read lock.
43 *
44 * The suspend mode is used to lock out all TTM users when preparing for
45 * and executing suspend operations.
46 *
47 */
48
49#ifndef _TTM_LOCK_H_
50#define _TTM_LOCK_H_
51
52#include "ttm/ttm_object.h"
53#include <linux/wait.h>
54#include <asm/atomic.h>
55
56/**
57 * struct ttm_lock
58 *
59 * @base: ttm base object used solely to release the lock if the client
60 * holding the lock dies.
61 * @queue: Queue for processes waiting for lock change-of-status.
62 * @lock: Spinlock protecting some lock members.
63 * @rw: Read-write lock counter. Protected by @lock.
64 * @flags: Lock state. Protected by @lock.
65 * @kill_takers: Boolean whether to kill takers of the lock.
66 * @signal: Signal to send when kill_takers is true.
67 */
68
69struct ttm_lock {
70 struct ttm_base_object base;
71 wait_queue_head_t queue;
72 spinlock_t lock;
73 int32_t rw;
74 uint32_t flags;
75 bool kill_takers;
76 int signal;
77 struct ttm_object_file *vt_holder;
78};
79
80
81/**
82 * ttm_lock_init
83 *
84 * @lock: Pointer to a struct ttm_lock
85 * Initializes the lock.
86 */
87extern void ttm_lock_init(struct ttm_lock *lock);
88
89/**
90 * ttm_read_unlock
91 *
92 * @lock: Pointer to a struct ttm_lock
93 *
94 * Releases a read lock.
95 */
96extern void ttm_read_unlock(struct ttm_lock *lock);
97
98/**
99 * ttm_read_lock
100 *
101 * @lock: Pointer to a struct ttm_lock
102 * @interruptible: Interruptible sleeping while waiting for a lock.
103 *
104 * Takes the lock in read mode.
105 * Returns:
106 * -ERESTARTSYS If interrupted by a signal and interruptible is true.
107 */
108extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible);
109
110/**
111 * ttm_read_trylock
112 *
113 * @lock: Pointer to a struct ttm_lock
114 * @interruptible: Interruptible sleeping while waiting for a lock.
115 *
116 * Tries to take the lock in read mode. If the lock is already held
117 * in write mode, the function will return -EBUSY. If the lock is held
118 * in vt or suspend mode, the function will sleep until these modes
119 * are unlocked.
120 *
121 * Returns:
122 * -EBUSY The lock was already held in write mode.
123 * -ERESTARTSYS If interrupted by a signal and interruptible is true.
124 */
125extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible);
126
127/**
128 * ttm_write_unlock
129 *
130 * @lock: Pointer to a struct ttm_lock
131 *
132 * Releases a write lock.
133 */
134extern void ttm_write_unlock(struct ttm_lock *lock);
135
136/**
137 * ttm_write_lock
138 *
139 * @lock: Pointer to a struct ttm_lock
140 * @interruptible: Interruptible sleeping while waiting for a lock.
141 *
142 * Takes the lock in write mode.
143 * Returns:
144 * -ERESTARTSYS If interrupted by a signal and interruptible is true.
145 */
146extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible);
147
148/**
149 * ttm_lock_downgrade
150 *
151 * @lock: Pointer to a struct ttm_lock
152 *
153 * Downgrades a write lock to a read lock.
154 */
155extern void ttm_lock_downgrade(struct ttm_lock *lock);
156
157/**
158 * ttm_suspend_lock
159 *
160 * @lock: Pointer to a struct ttm_lock
161 *
162 * Takes the lock in suspend mode. Excludes read and write mode.
163 */
164extern void ttm_suspend_lock(struct ttm_lock *lock);
165
166/**
167 * ttm_suspend_unlock
168 *
169 * @lock: Pointer to a struct ttm_lock
170 *
171 * Releases a suspend lock
172 */
173extern void ttm_suspend_unlock(struct ttm_lock *lock);
174
175/**
176 * ttm_vt_lock
177 *
178 * @lock: Pointer to a struct ttm_lock
179 * @interruptible: Interruptible sleeping while waiting for a lock.
180 * @tfile: Pointer to a struct ttm_object_file to register the lock with.
181 *
182 * Takes the lock in vt mode.
183 * Returns:
184 * -ERESTARTSYS If interrupted by a signal and interruptible is true.
185 * -ENOMEM: Out of memory when locking.
186 */
187extern int ttm_vt_lock(struct ttm_lock *lock, bool interruptible,
188 struct ttm_object_file *tfile);
189
190/**
191 * ttm_vt_unlock
192 *
193 * @lock: Pointer to a struct ttm_lock
194 *
195 * Releases a vt lock.
196 * Returns:
197 * -EINVAL If the lock was not held.
198 */
199extern int ttm_vt_unlock(struct ttm_lock *lock);
200
201/**
202 * ttm_write_unlock
203 *
204 * @lock: Pointer to a struct ttm_lock
205 *
206 * Releases a write lock.
207 */
208extern void ttm_write_unlock(struct ttm_lock *lock);
209
210/**
211 * ttm_write_lock
212 *
213 * @lock: Pointer to a struct ttm_lock
214 * @interruptible: Interruptible sleeping while waiting for a lock.
215 *
216 * Takes the lock in write mode.
217 * Returns:
218 * -ERESTARTSYS If interrupted by a signal and interruptible is true.
219 */
220extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible);
221
222/**
223 * ttm_lock_set_kill
224 *
225 * @lock: Pointer to a struct ttm_lock
226 * @val: Boolean whether to kill processes taking the lock.
227 * @signal: Signal to send to the process taking the lock.
228 *
229 * The kill-when-taking-lock functionality is used to kill processes that keep
230 * on using the TTM functionality when its resources has been taken down, for
231 * example when the X server exits. A typical sequence would look like this:
232 * - X server takes lock in write mode.
233 * - ttm_lock_set_kill() is called with @val set to true.
234 * - As part of X server exit, TTM resources are taken down.
235 * - X server releases the lock on file release.
236 * - Another dri client wants to render, takes the lock and is killed.
237 *
238 */
239static inline void ttm_lock_set_kill(struct ttm_lock *lock, bool val,
240 int signal)
241{
242 lock->kill_takers = val;
243 if (val)
244 lock->signal = signal;
245}
246
247#endif
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index 6983a7cf4da4..b199170b3c2c 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -33,6 +33,7 @@
33#include <linux/wait.h> 33#include <linux/wait.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/kobject.h> 35#include <linux/kobject.h>
36#include <linux/mm.h>
36 37
37/** 38/**
38 * struct ttm_mem_shrink - callback to shrink TTM memory usage. 39 * struct ttm_mem_shrink - callback to shrink TTM memory usage.
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
new file mode 100644
index 000000000000..703ca4db0a29
--- /dev/null
+++ b/include/drm/ttm/ttm_object.h
@@ -0,0 +1,267 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30/** @file ttm_object.h
31 *
32 * Base- and reference object implementation for the various
33 * ttm objects. Implements reference counting, minimal security checks
34 * and release on file close.
35 */
36
37#ifndef _TTM_OBJECT_H_
38#define _TTM_OBJECT_H_
39
40#include <linux/list.h>
41#include "drm_hashtab.h"
42#include <linux/kref.h>
43#include <ttm/ttm_memory.h>
44
45/**
46 * enum ttm_ref_type
47 *
48 * Describes what type of reference a ref object holds.
49 *
50 * TTM_REF_USAGE is a simple refcount on a base object.
51 *
52 * TTM_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a
53 * buffer object.
54 *
55 * TTM_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a
56 * buffer object.
57 *
58 */
59
60enum ttm_ref_type {
61 TTM_REF_USAGE,
62 TTM_REF_SYNCCPU_READ,
63 TTM_REF_SYNCCPU_WRITE,
64 TTM_REF_NUM
65};
66
67/**
68 * enum ttm_object_type
69 *
70 * One entry per ttm object type.
71 * Device-specific types should use the
72 * ttm_driver_typex types.
73 */
74
75enum ttm_object_type {
76 ttm_fence_type,
77 ttm_buffer_type,
78 ttm_lock_type,
79 ttm_driver_type0 = 256,
80 ttm_driver_type1
81};
82
83struct ttm_object_file;
84struct ttm_object_device;
85
86/**
87 * struct ttm_base_object
88 *
89 * @hash: hash entry for the per-device object hash.
90 * @type: derived type this object is base class for.
91 * @shareable: Other ttm_object_files can access this object.
92 *
93 * @tfile: Pointer to ttm_object_file of the creator.
94 * NULL if the object was not created by a user request.
95 * (kernel object).
96 *
97 * @refcount: Number of references to this object, not
98 * including the hash entry. A reference to a base object can
99 * only be held by a ref object.
100 *
101 * @refcount_release: A function to be called when there are
102 * no more references to this object. This function should
103 * destroy the object (or make sure destruction eventually happens),
104 * and when it is called, the object has
105 * already been taken out of the per-device hash. The parameter
106 * "base" should be set to NULL by the function.
107 *
108 * @ref_obj_release: A function to be called when a reference object
109 * with another ttm_ref_type than TTM_REF_USAGE is deleted.
110 * this function may, for example, release a lock held by a user-space
111 * process.
112 *
113 * This struct is intended to be used as a base struct for objects that
114 * are visible to user-space. It provides a global name, race-safe
115 * access and refcounting, minimal access contol and hooks for unref actions.
116 */
117
118struct ttm_base_object {
119 struct drm_hash_item hash;
120 enum ttm_object_type object_type;
121 bool shareable;
122 struct ttm_object_file *tfile;
123 struct kref refcount;
124 void (*refcount_release) (struct ttm_base_object **base);
125 void (*ref_obj_release) (struct ttm_base_object *base,
126 enum ttm_ref_type ref_type);
127};
128
129/**
130 * ttm_base_object_init
131 *
132 * @tfile: Pointer to a struct ttm_object_file.
133 * @base: The struct ttm_base_object to initialize.
134 * @shareable: This object is shareable with other applcations.
135 * (different @tfile pointers.)
136 * @type: The object type.
137 * @refcount_release: See the struct ttm_base_object description.
138 * @ref_obj_release: See the struct ttm_base_object description.
139 *
140 * Initializes a struct ttm_base_object.
141 */
142
143extern int ttm_base_object_init(struct ttm_object_file *tfile,
144 struct ttm_base_object *base,
145 bool shareable,
146 enum ttm_object_type type,
147 void (*refcount_release) (struct ttm_base_object
148 **),
149 void (*ref_obj_release) (struct ttm_base_object
150 *,
151 enum ttm_ref_type
152 ref_type));
153
154/**
155 * ttm_base_object_lookup
156 *
157 * @tfile: Pointer to a struct ttm_object_file.
158 * @key: Hash key
159 *
160 * Looks up a struct ttm_base_object with the key @key.
161 * Also verifies that the object is visible to the application, by
162 * comparing the @tfile argument and checking the object shareable flag.
163 */
164
165extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file
166 *tfile, uint32_t key);
167
168/**
169 * ttm_base_object_unref
170 *
171 * @p_base: Pointer to a pointer referncing a struct ttm_base_object.
172 *
173 * Decrements the base object refcount and clears the pointer pointed to by
174 * p_base.
175 */
176
177extern void ttm_base_object_unref(struct ttm_base_object **p_base);
178
179/**
180 * ttm_ref_object_add.
181 *
182 * @tfile: A struct ttm_object_file representing the application owning the
183 * ref_object.
184 * @base: The base object to reference.
185 * @ref_type: The type of reference.
186 * @existed: Upon completion, indicates that an identical reference object
187 * already existed, and the refcount was upped on that object instead.
188 *
189 * Adding a ref object to a base object is basically like referencing the
190 * base object, but a user-space application holds the reference. When the
191 * file corresponding to @tfile is closed, all its reference objects are
192 * deleted. A reference object can have different types depending on what
193 * it's intended for. It can be refcounting to prevent object destruction,
194 * When user-space takes a lock, it can add a ref object to that lock to
195 * make sure the lock is released if the application dies. A ref object
196 * will hold a single reference on a base object.
197 */
198extern int ttm_ref_object_add(struct ttm_object_file *tfile,
199 struct ttm_base_object *base,
200 enum ttm_ref_type ref_type, bool *existed);
201/**
202 * ttm_ref_object_base_unref
203 *
204 * @key: Key representing the base object.
205 * @ref_type: Ref type of the ref object to be dereferenced.
206 *
207 * Unreference a ref object with type @ref_type
208 * on the base object identified by @key. If there are no duplicate
209 * references, the ref object will be destroyed and the base object
210 * will be unreferenced.
211 */
212extern int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
213 unsigned long key,
214 enum ttm_ref_type ref_type);
215
216/**
217 * ttm_object_file_init - initialize a struct ttm_object file
218 *
219 * @tdev: A struct ttm_object device this file is initialized on.
220 * @hash_order: Order of the hash table used to hold the reference objects.
221 *
222 * This is typically called by the file_ops::open function.
223 */
224
225extern struct ttm_object_file *ttm_object_file_init(struct ttm_object_device
226 *tdev,
227 unsigned int hash_order);
228
229/**
230 * ttm_object_file_release - release data held by a ttm_object_file
231 *
232 * @p_tfile: Pointer to pointer to the ttm_object_file object to release.
233 * *p_tfile will be set to NULL by this function.
234 *
235 * Releases all data associated by a ttm_object_file.
236 * Typically called from file_ops::release. The caller must
237 * ensure that there are no concurrent users of tfile.
238 */
239
240extern void ttm_object_file_release(struct ttm_object_file **p_tfile);
241
242/**
243 * ttm_object device init - initialize a struct ttm_object_device
244 *
245 * @hash_order: Order of hash table used to hash the base objects.
246 *
247 * This function is typically called on device initialization to prepare
248 * data structures needed for ttm base and ref objects.
249 */
250
251extern struct ttm_object_device *ttm_object_device_init
252 (struct ttm_mem_global *mem_glob, unsigned int hash_order);
253
254/**
255 * ttm_object_device_release - release data held by a ttm_object_device
256 *
257 * @p_tdev: Pointer to pointer to the ttm_object_device object to release.
258 * *p_tdev will be set to NULL by this function.
259 *
260 * Releases all data associated by a ttm_object_device.
261 * Typically called from driver::unload before the destruction of the
262 * device private data structure.
263 */
264
265extern void ttm_object_device_release(struct ttm_object_device **p_tdev);
266
267#endif
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index 170786e5c2ff..fd11a5bd892d 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -24,7 +24,7 @@
24#ifndef _VIA_DRM_H_ 24#ifndef _VIA_DRM_H_
25#define _VIA_DRM_H_ 25#define _VIA_DRM_H_
26 26
27#include <linux/types.h> 27#include "drm.h"
28 28
29/* WARNING: These defines must be the same as what the Xserver uses. 29/* WARNING: These defines must be the same as what the Xserver uses.
30 * if you change them, you must change the defines in the Xserver. 30 * if you change them, you must change the defines in the Xserver.
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 5a5385749e16..f72914db2a11 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -214,7 +214,6 @@ unifdef-y += futex.h
214unifdef-y += fs.h 214unifdef-y += fs.h
215unifdef-y += gameport.h 215unifdef-y += gameport.h
216unifdef-y += generic_serial.h 216unifdef-y += generic_serial.h
217unifdef-y += hayesesp.h
218unifdef-y += hdlcdrv.h 217unifdef-y += hdlcdrv.h
219unifdef-y += hdlc.h 218unifdef-y += hdlc.h
220unifdef-y += hdreg.h 219unifdef-y += hdreg.h
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/cpu.h b/include/linux/cpu.h
index 47536197ffdd..e287863ac053 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -43,6 +43,8 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
43 43
44#ifdef CONFIG_HOTPLUG_CPU 44#ifdef CONFIG_HOTPLUG_CPU
45extern void unregister_cpu(struct cpu *cpu); 45extern void unregister_cpu(struct cpu *cpu);
46extern ssize_t arch_cpu_probe(const char *, size_t);
47extern ssize_t arch_cpu_release(const char *, size_t);
46#endif 48#endif
47struct notifier_block; 49struct notifier_block;
48 50
@@ -115,6 +117,19 @@ extern void put_online_cpus(void);
115#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 117#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
116int cpu_down(unsigned int cpu); 118int cpu_down(unsigned int cpu);
117 119
120#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
121extern void cpu_hotplug_driver_lock(void);
122extern void cpu_hotplug_driver_unlock(void);
123#else
124static inline void cpu_hotplug_driver_lock(void)
125{
126}
127
128static inline void cpu_hotplug_driver_unlock(void)
129{
130}
131#endif
132
118#else /* CONFIG_HOTPLUG_CPU */ 133#else /* CONFIG_HOTPLUG_CPU */
119 134
120#define get_online_cpus() do { } while (0) 135#define get_online_cpus() do { } while (0)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 79a2340d83cd..4de02b10007f 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -232,6 +232,7 @@ struct cpufreq_driver {
232 /* optional */ 232 /* optional */
233 unsigned int (*getavg) (struct cpufreq_policy *policy, 233 unsigned int (*getavg) (struct cpufreq_policy *policy,
234 unsigned int cpu); 234 unsigned int cpu);
235 int (*bios_limit) (int cpu, unsigned int *limit);
235 236
236 int (*exit) (struct cpufreq_policy *policy); 237 int (*exit) (struct cpufreq_policy *policy);
237 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 238 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 789cf5f920ce..d77b54733c5b 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -84,6 +84,7 @@ extern const struct cpumask *const cpu_active_mask;
84#define num_online_cpus() cpumask_weight(cpu_online_mask) 84#define num_online_cpus() cpumask_weight(cpu_online_mask)
85#define num_possible_cpus() cpumask_weight(cpu_possible_mask) 85#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
86#define num_present_cpus() cpumask_weight(cpu_present_mask) 86#define num_present_cpus() cpumask_weight(cpu_present_mask)
87#define num_active_cpus() cpumask_weight(cpu_active_mask)
87#define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) 88#define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask)
88#define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) 89#define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask)
89#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) 90#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
@@ -92,6 +93,7 @@ extern const struct cpumask *const cpu_active_mask;
92#define num_online_cpus() 1 93#define num_online_cpus() 1
93#define num_possible_cpus() 1 94#define num_possible_cpus() 1
94#define num_present_cpus() 1 95#define num_present_cpus() 1
96#define num_active_cpus() 1
95#define cpu_online(cpu) ((cpu) == 0) 97#define cpu_online(cpu) ((cpu) == 0)
96#define cpu_possible(cpu) ((cpu) == 0) 98#define cpu_possible(cpu) ((cpu) == 0)
97#define cpu_present(cpu) ((cpu) == 0) 99#define cpu_present(cpu) ((cpu) == 0)
diff --git a/include/linux/device.h b/include/linux/device.h
index 2ea3e4921812..2a73d9bcbc9c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -558,7 +558,7 @@ extern void wait_for_device_probe(void);
558#ifdef CONFIG_DEVTMPFS 558#ifdef CONFIG_DEVTMPFS
559extern int devtmpfs_create_node(struct device *dev); 559extern int devtmpfs_create_node(struct device *dev);
560extern int devtmpfs_delete_node(struct device *dev); 560extern int devtmpfs_delete_node(struct device *dev);
561extern int devtmpfs_mount(const char *mountpoint); 561extern int devtmpfs_mount(const char *mntdir);
562#else 562#else
563static inline int devtmpfs_create_node(struct device *dev) { return 0; } 563static inline int devtmpfs_create_node(struct device *dev) { return 0; }
564static inline int devtmpfs_delete_node(struct device *dev) { return 0; } 564static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
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/ext2_fs.h b/include/linux/ext2_fs.h
index 121720d74e15..2dfa7076e8b6 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -565,14 +565,14 @@ struct ext2_dir_entry_2 {
565 * other bits are reserved for now. 565 * other bits are reserved for now.
566 */ 566 */
567enum { 567enum {
568 EXT2_FT_UNKNOWN, 568 EXT2_FT_UNKNOWN = 0,
569 EXT2_FT_REG_FILE, 569 EXT2_FT_REG_FILE = 1,
570 EXT2_FT_DIR, 570 EXT2_FT_DIR = 2,
571 EXT2_FT_CHRDEV, 571 EXT2_FT_CHRDEV = 3,
572 EXT2_FT_BLKDEV, 572 EXT2_FT_BLKDEV = 4,
573 EXT2_FT_FIFO, 573 EXT2_FT_FIFO = 5,
574 EXT2_FT_SOCK, 574 EXT2_FT_SOCK = 6,
575 EXT2_FT_SYMLINK, 575 EXT2_FT_SYMLINK = 7,
576 EXT2_FT_MAX 576 EXT2_FT_MAX
577}; 577};
578 578
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 7499b3667798..6b049030fbe6 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -918,6 +918,8 @@ extern void ext3_abort (struct super_block *, const char *, const char *, ...)
918 __attribute__ ((format (printf, 3, 4))); 918 __attribute__ ((format (printf, 3, 4)));
919extern void ext3_warning (struct super_block *, const char *, const char *, ...) 919extern void ext3_warning (struct super_block *, const char *, const char *, ...)
920 __attribute__ ((format (printf, 3, 4))); 920 __attribute__ ((format (printf, 3, 4)));
921extern void ext3_msg(struct super_block *, const char *, const char *, ...)
922 __attribute__ ((format (printf, 3, 4)));
921extern void ext3_update_dynamic_rev (struct super_block *sb); 923extern void ext3_update_dynamic_rev (struct super_block *sb);
922 924
923#define ext3_std_error(sb, errno) \ 925#define ext3_std_error(sb, errno) \
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/firmware.h b/include/linux/firmware.h
index d31544628436..043811f0d277 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -4,6 +4,7 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <linux/gfp.h>
7 8
8#define FW_ACTION_NOHOTPLUG 0 9#define FW_ACTION_NOHOTPLUG 0
9#define FW_ACTION_HOTPLUG 1 10#define FW_ACTION_HOTPLUG 1
@@ -38,7 +39,7 @@ int request_firmware(const struct firmware **fw, const char *name,
38 struct device *device); 39 struct device *device);
39int request_firmware_nowait( 40int request_firmware_nowait(
40 struct module *module, int uevent, 41 struct module *module, int uevent,
41 const char *name, struct device *device, void *context, 42 const char *name, struct device *device, gfp_t gfp, void *context,
42 void (*cont)(const struct firmware *fw, void *context)); 43 void (*cont)(const struct firmware *fw, void *context));
43 44
44void release_firmware(const struct firmware *fw); 45void release_firmware(const struct firmware *fw);
@@ -51,7 +52,7 @@ static inline int request_firmware(const struct firmware **fw,
51} 52}
52static inline int request_firmware_nowait( 53static inline int request_firmware_nowait(
53 struct module *module, int uevent, 54 struct module *module, int uevent,
54 const char *name, struct device *device, void *context, 55 const char *name, struct device *device, gfp_t gfp, void *context,
55 void (*cont)(const struct firmware *fw, void *context)) 56 void (*cont)(const struct firmware *fw, void *context))
56{ 57{
57 return -EINVAL; 58 return -EINVAL;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 891f7d642e5c..a057f48eb156 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2091,8 +2091,6 @@ extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,
2091extern int filemap_write_and_wait(struct address_space *mapping); 2091extern int filemap_write_and_wait(struct address_space *mapping);
2092extern int filemap_write_and_wait_range(struct address_space *mapping, 2092extern int filemap_write_and_wait_range(struct address_space *mapping,
2093 loff_t lstart, loff_t lend); 2093 loff_t lstart, loff_t lend);
2094extern int wait_on_page_writeback_range(struct address_space *mapping,
2095 pgoff_t start, pgoff_t end);
2096extern int __filemap_fdatawrite_range(struct address_space *mapping, 2094extern int __filemap_fdatawrite_range(struct address_space *mapping,
2097 loff_t start, loff_t end, int sync_mode); 2095 loff_t start, loff_t end, int sync_mode);
2098extern int filemap_fdatawrite_range(struct address_space *mapping, 2096extern int filemap_fdatawrite_range(struct address_space *mapping,
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 43fc95d822d5..28e33fea5107 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -74,7 +74,12 @@ struct spi_device;
74struct fsl_spi_platform_data { 74struct fsl_spi_platform_data {
75 u32 initial_spmode; /* initial SPMODE value */ 75 u32 initial_spmode; /* initial SPMODE value */
76 s16 bus_num; 76 s16 bus_num;
77 bool qe_mode; 77 unsigned int flags;
78#define SPI_QE_CPU_MODE (1 << 0) /* QE CPU ("PIO") mode */
79#define SPI_CPM_MODE (1 << 1) /* CPM/QE ("DMA") mode */
80#define SPI_CPM1 (1 << 2) /* SPI unit is in CPM1 block */
81#define SPI_CPM2 (1 << 3) /* SPI unit is in CPM2 block */
82#define SPI_QE (1 << 4) /* SPI unit is in QE block */
78 /* board specific information */ 83 /* board specific information */
79 u16 max_chipselect; 84 u16 max_chipselect;
80 void (*cs_control)(struct spi_device *spi, bool on); 85 void (*cs_control)(struct spi_device *spi, bool on);
@@ -90,6 +95,10 @@ struct mpc8xx_pcmcia_ops {
90 * lead to a deep sleep (i.e. power removed from the core, 95 * lead to a deep sleep (i.e. power removed from the core,
91 * instead of just the clock). 96 * instead of just the clock).
92 */ 97 */
98#if defined(CONFIG_PPC_83xx) && defined(CONFIG_SUSPEND)
93int fsl_deep_sleep(void); 99int fsl_deep_sleep(void);
100#else
101static inline int fsl_deep_sleep(void) { return 0; }
102#endif
94 103
95#endif /* _FSL_DEVICE_H_ */ 104#endif /* _FSL_DEVICE_H_ */
diff --git a/include/linux/gigaset_dev.h b/include/linux/gigaset_dev.h
index 5dc4a316ca37..258ba82937e7 100644
--- a/include/linux/gigaset_dev.h
+++ b/include/linux/gigaset_dev.h
@@ -16,15 +16,23 @@
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18 18
19/* The magic IOCTL value for this interface. */
19#define GIGASET_IOCTL 0x47 20#define GIGASET_IOCTL 0x47
20 21
21#define GIGVER_DRIVER 0 22/* enable/disable device control via character device (lock out ISDN subsys) */
22#define GIGVER_COMPAT 1 23#define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int)
23#define GIGVER_FWBASE 2
24 24
25#define GIGASET_REDIR _IOWR (GIGASET_IOCTL, 0, int) 25/* enable adapter configuration mode (M10x only) */
26#define GIGASET_CONFIG _IOWR (GIGASET_IOCTL, 1, int) 26#define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int)
27#define GIGASET_BRKCHARS _IOW (GIGASET_IOCTL, 2, unsigned char[6]) //FIXME [6] okay? 27
28#define GIGASET_VERSION _IOWR (GIGASET_IOCTL, 3, unsigned[4]) 28/* set break characters (M105 only) */
29#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6])
30
31/* get version information selected by arg[0] */
32#define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4])
33/* values for GIGASET_VERSION arg[0] */
34#define GIGVER_DRIVER 0 /* get driver version */
35#define GIGVER_COMPAT 1 /* get interface compatibility version */
36#define GIGVER_FWBASE 2 /* get base station firmware version */
29 37
30#endif 38#endif
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
deleted file mode 100644
index 92b08cfe4a75..000000000000
--- a/include/linux/hayesesp.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef HAYESESP_H
2#define HAYESESP_H
3
4struct hayes_esp_config {
5 short flow_on;
6 short flow_off;
7 short rx_trigger;
8 short tx_trigger;
9 short pio_threshold;
10 unsigned char rx_timeout;
11 char dma_channel;
12};
13
14#ifdef __KERNEL__
15
16#define ESP_DMA_CHANNEL 0
17#define ESP_RX_TRIGGER 768
18#define ESP_TX_TRIGGER 768
19#define ESP_FLOW_OFF 1016
20#define ESP_FLOW_ON 944
21#define ESP_RX_TMOUT 128
22#define ESP_PIO_THRESHOLD 32
23
24#define ESP_IN_MAJOR 57 /* major dev # for dial in */
25#define ESP_OUT_MAJOR 58 /* major dev # for dial out */
26#define ESPC_SCALE 3
27#define UART_ESI_BASE 0x00
28#define UART_ESI_SID 0x01
29#define UART_ESI_RX 0x02
30#define UART_ESI_TX 0x02
31#define UART_ESI_CMD1 0x04
32#define UART_ESI_CMD2 0x05
33#define UART_ESI_STAT1 0x04
34#define UART_ESI_STAT2 0x05
35#define UART_ESI_RWS 0x07
36
37#define UART_IER_DMA_TMOUT 0x80
38#define UART_IER_DMA_TC 0x08
39
40#define ESI_SET_IRQ 0x04
41#define ESI_SET_DMA_TMOUT 0x05
42#define ESI_SET_SRV_MASK 0x06
43#define ESI_SET_ERR_MASK 0x07
44#define ESI_SET_FLOW_CNTL 0x08
45#define ESI_SET_FLOW_CHARS 0x09
46#define ESI_SET_FLOW_LVL 0x0a
47#define ESI_SET_TRIGGER 0x0b
48#define ESI_SET_RX_TIMEOUT 0x0c
49#define ESI_SET_FLOW_TMOUT 0x0d
50#define ESI_WRITE_UART 0x0e
51#define ESI_READ_UART 0x0f
52#define ESI_SET_MODE 0x10
53#define ESI_GET_ERR_STAT 0x12
54#define ESI_GET_UART_STAT 0x13
55#define ESI_GET_RX_AVAIL 0x14
56#define ESI_GET_TX_AVAIL 0x15
57#define ESI_START_DMA_RX 0x16
58#define ESI_START_DMA_TX 0x17
59#define ESI_ISSUE_BREAK 0x1a
60#define ESI_FLUSH_RX 0x1b
61#define ESI_FLUSH_TX 0x1c
62#define ESI_SET_BAUD 0x1d
63#define ESI_SET_ENH_IRQ 0x1f
64#define ESI_SET_REINTR 0x20
65#define ESI_SET_PRESCALAR 0x23
66#define ESI_NO_COMMAND 0xff
67
68#define ESP_STAT_RX_TIMEOUT 0x01
69#define ESP_STAT_DMA_RX 0x02
70#define ESP_STAT_DMA_TX 0x04
71#define ESP_STAT_NEVER_DMA 0x08
72#define ESP_STAT_USE_PIO 0x10
73
74#define ESP_MAGIC 0x53ee
75#define ESP_XMIT_SIZE 4096
76
77struct esp_struct {
78 int magic;
79 struct tty_port port;
80 spinlock_t lock;
81 int io_port;
82 int irq;
83 int read_status_mask;
84 int ignore_status_mask;
85 int timeout;
86 int stat_flags;
87 int custom_divisor;
88 int close_delay;
89 unsigned short closing_wait;
90 unsigned short closing_wait2;
91 int IER; /* Interrupt Enable Register */
92 int MCR; /* Modem control register */
93 unsigned long last_active;
94 int line;
95 unsigned char *xmit_buf;
96 int xmit_head;
97 int xmit_tail;
98 int xmit_cnt;
99 wait_queue_head_t break_wait;
100 struct async_icount icount; /* kernel counters for the 4 input interrupts */
101 struct hayes_esp_config config; /* port configuration */
102 struct esp_struct *next_port; /* For the linked list */
103};
104
105struct esp_pio_buffer {
106 unsigned char data[1024];
107 struct esp_pio_buffer *next;
108};
109
110#endif /* __KERNEL__ */
111
112
113#endif /* ESP_H */
114
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/hrtimer.h b/include/linux/hrtimer.h
index 9bace4b9f4fe..af634e95871d 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -162,10 +162,11 @@ struct hrtimer_clock_base {
162 * @expires_next: absolute time of the next event which was scheduled 162 * @expires_next: absolute time of the next event which was scheduled
163 * via clock_set_next_event() 163 * via clock_set_next_event()
164 * @hres_active: State of high resolution mode 164 * @hres_active: State of high resolution mode
165 * @check_clocks: Indictator, when set evaluate time source and clock 165 * @hang_detected: The last hrtimer interrupt detected a hang
166 * event devices whether high resolution mode can be 166 * @nr_events: Total number of hrtimer interrupt events
167 * activated. 167 * @nr_retries: Total number of hrtimer interrupt retries
168 * @nr_events: Total number of timer interrupt events 168 * @nr_hangs: Total number of hrtimer interrupt hangs
169 * @max_hang_time: Maximum time spent in hrtimer_interrupt
169 */ 170 */
170struct hrtimer_cpu_base { 171struct hrtimer_cpu_base {
171 spinlock_t lock; 172 spinlock_t lock;
@@ -173,7 +174,11 @@ struct hrtimer_cpu_base {
173#ifdef CONFIG_HIGH_RES_TIMERS 174#ifdef CONFIG_HIGH_RES_TIMERS
174 ktime_t expires_next; 175 ktime_t expires_next;
175 int hres_active; 176 int hres_active;
177 int hang_detected;
176 unsigned long nr_events; 178 unsigned long nr_events;
179 unsigned long nr_retries;
180 unsigned long nr_hangs;
181 ktime_t max_hang_time;
177#endif 182#endif
178}; 183};
179 184
@@ -435,47 +440,4 @@ extern u64 ktime_divns(const ktime_t kt, s64 div);
435/* Show pending timers: */ 440/* Show pending timers: */
436extern void sysrq_timer_list_show(void); 441extern void sysrq_timer_list_show(void);
437 442
438/*
439 * Timer-statistics info:
440 */
441#ifdef CONFIG_TIMER_STATS
442
443extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
444 void *timerf, char *comm,
445 unsigned int timer_flag);
446
447static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
448{
449 if (likely(!timer_stats_active))
450 return;
451 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
452 timer->function, timer->start_comm, 0);
453}
454
455extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
456 void *addr);
457
458static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
459{
460 __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
461}
462
463static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
464{
465 timer->start_site = NULL;
466}
467#else
468static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
469{
470}
471
472static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
473{
474}
475
476static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
477{
478}
479#endif
480
481#endif 443#endif
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index a03daed08c59..69f07a9f1277 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -20,19 +20,18 @@ enum {
20 20
21#ifdef CONFIG_HAVE_HW_BREAKPOINT 21#ifdef CONFIG_HAVE_HW_BREAKPOINT
22 22
23/* As it's for in-kernel or ptrace use, we want it to be pinned */
24#define DEFINE_BREAKPOINT_ATTR(name) \
25struct perf_event_attr name = { \
26 .type = PERF_TYPE_BREAKPOINT, \
27 .size = sizeof(name), \
28 .pinned = 1, \
29};
30
31static inline void hw_breakpoint_init(struct perf_event_attr *attr) 23static inline void hw_breakpoint_init(struct perf_event_attr *attr)
32{ 24{
25 memset(attr, 0, sizeof(*attr));
26
33 attr->type = PERF_TYPE_BREAKPOINT; 27 attr->type = PERF_TYPE_BREAKPOINT;
34 attr->size = sizeof(*attr); 28 attr->size = sizeof(*attr);
29 /*
30 * As it's for in-kernel or ptrace use, we want it to be pinned
31 * and to call its callback every hits.
32 */
35 attr->pinned = 1; 33 attr->pinned = 1;
34 attr->sample_period = 1;
36} 35}
37 36
38static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) 37static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
@@ -52,27 +51,24 @@ static inline int hw_breakpoint_len(struct perf_event *bp)
52 51
53extern struct perf_event * 52extern struct perf_event *
54register_user_hw_breakpoint(struct perf_event_attr *attr, 53register_user_hw_breakpoint(struct perf_event_attr *attr,
55 perf_callback_t triggered, 54 perf_overflow_handler_t triggered,
56 struct task_struct *tsk); 55 struct task_struct *tsk);
57 56
58/* FIXME: only change from the attr, and don't unregister */ 57/* FIXME: only change from the attr, and don't unregister */
59extern struct perf_event * 58extern int
60modify_user_hw_breakpoint(struct perf_event *bp, 59modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr);
61 struct perf_event_attr *attr,
62 perf_callback_t triggered,
63 struct task_struct *tsk);
64 60
65/* 61/*
66 * Kernel breakpoints are not associated with any particular thread. 62 * Kernel breakpoints are not associated with any particular thread.
67 */ 63 */
68extern struct perf_event * 64extern struct perf_event *
69register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 65register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
70 perf_callback_t triggered, 66 perf_overflow_handler_t triggered,
71 int cpu); 67 int cpu);
72 68
73extern struct perf_event ** 69extern struct perf_event **
74register_wide_hw_breakpoint(struct perf_event_attr *attr, 70register_wide_hw_breakpoint(struct perf_event_attr *attr,
75 perf_callback_t triggered); 71 perf_overflow_handler_t triggered);
76 72
77extern int register_perf_hw_breakpoint(struct perf_event *bp); 73extern int register_perf_hw_breakpoint(struct perf_event *bp);
78extern int __register_perf_hw_breakpoint(struct perf_event *bp); 74extern int __register_perf_hw_breakpoint(struct perf_event *bp);
@@ -93,20 +89,18 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
93 89
94static inline struct perf_event * 90static inline struct perf_event *
95register_user_hw_breakpoint(struct perf_event_attr *attr, 91register_user_hw_breakpoint(struct perf_event_attr *attr,
96 perf_callback_t triggered, 92 perf_overflow_handler_t triggered,
97 struct task_struct *tsk) { return NULL; } 93 struct task_struct *tsk) { return NULL; }
98static inline struct perf_event * 94static inline int
99modify_user_hw_breakpoint(struct perf_event *bp, 95modify_user_hw_breakpoint(struct perf_event *bp,
100 struct perf_event_attr *attr, 96 struct perf_event_attr *attr) { return NULL; }
101 perf_callback_t triggered,
102 struct task_struct *tsk) { return NULL; }
103static inline struct perf_event * 97static inline struct perf_event *
104register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 98register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
105 perf_callback_t triggered, 99 perf_overflow_handler_t triggered,
106 int cpu) { return NULL; } 100 int cpu) { return NULL; }
107static inline struct perf_event ** 101static inline struct perf_event **
108register_wide_hw_breakpoint(struct perf_event_attr *attr, 102register_wide_hw_breakpoint(struct perf_event_attr *attr,
109 perf_callback_t triggered) { return NULL; } 103 perf_overflow_handler_t triggered) { return NULL; }
110static inline int 104static inline int
111register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } 105register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
112static inline int 106static inline int
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/if_ether.h b/include/linux/if_ether.h
index 005e1525ab86..299b4121f914 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -137,8 +137,6 @@ extern struct ctl_table ether_table[];
137extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 137extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
138 138
139#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" 139#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
140#define MAC_BUF_SIZE 18
141#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE]
142 140
143#endif 141#endif
144 142
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/isicom.h b/include/linux/isicom.h
index bbd42197298f..b92e05650639 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -67,6 +67,7 @@
67 67
68#define FIRMWARE_LOADED 0x0001 68#define FIRMWARE_LOADED 0x0001
69#define BOARD_ACTIVE 0x0002 69#define BOARD_ACTIVE 0x0002
70#define BOARD_INIT 0x0004
70 71
71 /* isi_port status bitmap */ 72 /* isi_port status bitmap */
72 73
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 2d241da07236..a24de0b1858e 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -496,6 +496,7 @@ struct kvm_ioeventfd {
496#define KVM_CAP_VCPU_EVENTS 41 496#define KVM_CAP_VCPU_EVENTS 41
497#endif 497#endif
498#define KVM_CAP_S390_PSW 42 498#define KVM_CAP_S390_PSW 42
499#define KVM_CAP_PPC_SEGSTATE 43
499 500
500#ifdef KVM_CAP_IRQ_ROUTING 501#ifdef KVM_CAP_IRQ_ROUTING
501 502
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/namei.h b/include/linux/namei.h
index ec0f607b364a..028946750289 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -76,7 +76,6 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
76extern void release_open_intent(struct nameidata *); 76extern void release_open_intent(struct nameidata *);
77 77
78extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 78extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
79extern struct dentry *lookup_one_noperm(const char *, struct dentry *);
80 79
81extern int follow_down(struct path *); 80extern int follow_down(struct path *);
82extern int follow_up(struct path *); 81extern int follow_up(struct path *);
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index ce520402e840..3fe02cf8b65a 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -151,6 +151,8 @@ struct nilfs_super_root {
151#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */ 151#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */
152#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order 152#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order
153 semantics also for data */ 153 semantics also for data */
154#define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during
155 mount-time recovery */
154 156
155 157
156/** 158/**
@@ -403,6 +405,28 @@ struct nilfs_segment_summary {
403#define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */ 405#define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */
404 406
405/** 407/**
408 * struct nilfs_btree_node - B-tree node
409 * @bn_flags: flags
410 * @bn_level: level
411 * @bn_nchildren: number of children
412 * @bn_pad: padding
413 */
414struct nilfs_btree_node {
415 __u8 bn_flags;
416 __u8 bn_level;
417 __le16 bn_nchildren;
418 __le32 bn_pad;
419};
420
421/* flags */
422#define NILFS_BTREE_NODE_ROOT 0x01
423
424/* level */
425#define NILFS_BTREE_LEVEL_DATA 0
426#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
427#define NILFS_BTREE_LEVEL_MAX 14
428
429/**
406 * struct nilfs_palloc_group_desc - block group descriptor 430 * struct nilfs_palloc_group_desc - block group descriptor
407 * @pg_nfrees: number of free entries in block group 431 * @pg_nfrees: number of free entries in block group
408 */ 432 */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
new file mode 100644
index 000000000000..f46c40ac6d45
--- /dev/null
+++ b/include/linux/omapfb.h
@@ -0,0 +1,251 @@
1/*
2 * File: include/linux/omapfb.h
3 *
4 * Framebuffer driver for TI OMAP boards
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __LINUX_OMAPFB_H__
25#define __LINUX_OMAPFB_H__
26
27#include <linux/fb.h>
28#include <linux/ioctl.h>
29#include <linux/types.h>
30
31/* IOCTL commands. */
32
33#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
34#define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
35#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
36#define OMAP_IO(num) _IO('O', num)
37
38#define OMAPFB_MIRROR OMAP_IOW(31, int)
39#define OMAPFB_SYNC_GFX OMAP_IO(37)
40#define OMAPFB_VSYNC OMAP_IO(38)
41#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
42#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
43#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
44#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
45#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
46#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
47#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
48#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
49#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
50#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
51#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
52#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
53#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
54#define OMAPFB_WAITFORVSYNC OMAP_IO(57)
55#define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read)
56#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
57#define OMAPFB_WAITFORGO OMAP_IO(60)
58#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info)
59#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info)
60
61#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
62#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
63#define OMAPFB_CAPS_PANEL_MASK 0xff000000
64
65#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
66#define OMAPFB_CAPS_TEARSYNC 0x00002000
67#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
68#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
69#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
70#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
71#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
72#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000
73#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
74
75/* Values from DSP must map to lower 16-bits */
76#define OMAPFB_FORMAT_MASK 0x00ff
77#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
78#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
79#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
80#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
81#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
82
83#define OMAPFB_MEMTYPE_SDRAM 0
84#define OMAPFB_MEMTYPE_SRAM 1
85#define OMAPFB_MEMTYPE_MAX 1
86
87enum omapfb_color_format {
88 OMAPFB_COLOR_RGB565 = 0,
89 OMAPFB_COLOR_YUV422,
90 OMAPFB_COLOR_YUV420,
91 OMAPFB_COLOR_CLUT_8BPP,
92 OMAPFB_COLOR_CLUT_4BPP,
93 OMAPFB_COLOR_CLUT_2BPP,
94 OMAPFB_COLOR_CLUT_1BPP,
95 OMAPFB_COLOR_RGB444,
96 OMAPFB_COLOR_YUY422,
97
98 OMAPFB_COLOR_ARGB16,
99 OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */
100 OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */
101 OMAPFB_COLOR_ARGB32,
102 OMAPFB_COLOR_RGBA32,
103 OMAPFB_COLOR_RGBX32,
104};
105
106struct omapfb_update_window {
107 __u32 x, y;
108 __u32 width, height;
109 __u32 format;
110 __u32 out_x, out_y;
111 __u32 out_width, out_height;
112 __u32 reserved[8];
113};
114
115struct omapfb_update_window_old {
116 __u32 x, y;
117 __u32 width, height;
118 __u32 format;
119};
120
121enum omapfb_plane {
122 OMAPFB_PLANE_GFX = 0,
123 OMAPFB_PLANE_VID1,
124 OMAPFB_PLANE_VID2,
125};
126
127enum omapfb_channel_out {
128 OMAPFB_CHANNEL_OUT_LCD = 0,
129 OMAPFB_CHANNEL_OUT_DIGIT,
130};
131
132struct omapfb_plane_info {
133 __u32 pos_x;
134 __u32 pos_y;
135 __u8 enabled;
136 __u8 channel_out;
137 __u8 mirror;
138 __u8 reserved1;
139 __u32 out_width;
140 __u32 out_height;
141 __u32 reserved2[12];
142};
143
144struct omapfb_mem_info {
145 __u32 size;
146 __u8 type;
147 __u8 reserved[3];
148};
149
150struct omapfb_caps {
151 __u32 ctrl;
152 __u32 plane_color;
153 __u32 wnd_color;
154};
155
156enum omapfb_color_key_type {
157 OMAPFB_COLOR_KEY_DISABLED = 0,
158 OMAPFB_COLOR_KEY_GFX_DST,
159 OMAPFB_COLOR_KEY_VID_SRC,
160};
161
162struct omapfb_color_key {
163 __u8 channel_out;
164 __u32 background;
165 __u32 trans_key;
166 __u8 key_type;
167};
168
169enum omapfb_update_mode {
170 OMAPFB_UPDATE_DISABLED = 0,
171 OMAPFB_AUTO_UPDATE,
172 OMAPFB_MANUAL_UPDATE
173};
174
175struct omapfb_memory_read {
176 __u16 x;
177 __u16 y;
178 __u16 w;
179 __u16 h;
180 size_t buffer_size;
181 void __user *buffer;
182};
183
184struct omapfb_ovl_colormode {
185 __u8 overlay_idx;
186 __u8 mode_idx;
187 __u32 bits_per_pixel;
188 __u32 nonstd;
189 struct fb_bitfield red;
190 struct fb_bitfield green;
191 struct fb_bitfield blue;
192 struct fb_bitfield transp;
193};
194
195struct omapfb_vram_info {
196 __u32 total;
197 __u32 free;
198 __u32 largest_free_block;
199 __u32 reserved[5];
200};
201
202struct omapfb_tearsync_info {
203 __u8 enabled;
204 __u8 reserved1[3];
205 __u16 line;
206 __u16 reserved2;
207};
208
209#ifdef __KERNEL__
210
211#include <plat/board.h>
212
213#ifdef CONFIG_ARCH_OMAP1
214#define OMAPFB_PLANE_NUM 1
215#else
216#define OMAPFB_PLANE_NUM 3
217#endif
218
219struct omapfb_mem_region {
220 u32 paddr;
221 void __iomem *vaddr;
222 unsigned long size;
223 u8 type; /* OMAPFB_PLANE_MEM_* */
224 enum omapfb_color_format format;/* OMAPFB_COLOR_* */
225 unsigned format_used:1; /* Must be set when format is set.
226 * Needed b/c of the badly chosen 0
227 * base for OMAPFB_COLOR_* values
228 */
229 unsigned alloc:1; /* allocated by the driver */
230 unsigned map:1; /* kernel mapped by the driver */
231};
232
233struct omapfb_mem_desc {
234 int region_cnt;
235 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
236};
237
238struct omapfb_platform_data {
239 struct omap_lcd_config lcd;
240 struct omapfb_mem_desc mem_desc;
241 void *ctrl_platform_data;
242};
243
244/* in arch/arm/plat-omap/fb.c */
245extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
246extern void omapfb_set_ctrl_platform_data(void *pdata);
247extern void omapfb_reserve_sdram(void);
248
249#endif
250
251#endif /* __OMAPFB_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f5c7cd343e56..04771b9c3316 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -218,6 +218,7 @@ struct pci_dev {
218 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 218 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
219 u8 revision; /* PCI revision, low byte of class word */ 219 u8 revision; /* PCI revision, low byte of class word */
220 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 220 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
221 u8 pcie_cap; /* PCI-E capability offset */
221 u8 pcie_type; /* PCI-E device/port type */ 222 u8 pcie_type; /* PCI-E device/port type */
222 u8 rom_base_reg; /* which config register controls the ROM */ 223 u8 rom_base_reg; /* which config register controls the ROM */
223 u8 pin; /* which interrupt pin this device uses */ 224 u8 pin; /* which interrupt pin this device uses */
@@ -280,6 +281,7 @@ struct pci_dev {
280 unsigned int is_virtfn:1; 281 unsigned int is_virtfn:1;
281 unsigned int reset_fn:1; 282 unsigned int reset_fn:1;
282 unsigned int is_hotplug_bridge:1; 283 unsigned int is_hotplug_bridge:1;
284 unsigned int aer_firmware_first:1;
283 pci_dev_flags_t dev_flags; 285 pci_dev_flags_t dev_flags;
284 atomic_t enable_cnt; /* pci_enable_device has been called */ 286 atomic_t enable_cnt; /* pci_enable_device has been called */
285 287
@@ -635,7 +637,13 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
635 unsigned int ss_vendor, unsigned int ss_device, 637 unsigned int ss_vendor, unsigned int ss_device,
636 struct pci_dev *from); 638 struct pci_dev *from);
637struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 639struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
638struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 640struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
641 unsigned int devfn);
642static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
643 unsigned int devfn)
644{
645 return pci_get_domain_bus_and_slot(0, bus, devfn);
646}
639struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 647struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
640int pci_dev_present(const struct pci_device_id *ids); 648int pci_dev_present(const struct pci_device_id *ids);
641 649
@@ -701,6 +709,7 @@ void pci_disable_device(struct pci_dev *dev);
701void pci_set_master(struct pci_dev *dev); 709void pci_set_master(struct pci_dev *dev);
702void pci_clear_master(struct pci_dev *dev); 710void pci_clear_master(struct pci_dev *dev);
703int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 711int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
712int pci_set_cacheline_size(struct pci_dev *dev);
704#define HAVE_PCI_SET_MWI 713#define HAVE_PCI_SET_MWI
705int __must_check pci_set_mwi(struct pci_dev *dev); 714int __must_check pci_set_mwi(struct pci_dev *dev);
706int pci_try_set_mwi(struct pci_dev *dev); 715int pci_try_set_mwi(struct pci_dev *dev);
@@ -1246,6 +1255,8 @@ extern int pci_pci_problems;
1246 1255
1247extern unsigned long pci_cardbus_io_size; 1256extern unsigned long pci_cardbus_io_size;
1248extern unsigned long pci_cardbus_mem_size; 1257extern unsigned long pci_cardbus_mem_size;
1258extern u8 pci_dfl_cache_line_size;
1259extern u8 pci_cache_line_size;
1249 1260
1250extern unsigned long pci_hotplug_io_size; 1261extern unsigned long pci_hotplug_io_size;
1251extern unsigned long pci_hotplug_mem_size; 1262extern unsigned long pci_hotplug_mem_size;
@@ -1290,5 +1301,34 @@ extern void pci_hp_create_module_link(struct pci_slot *pci_slot);
1290extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); 1301extern void pci_hp_remove_module_link(struct pci_slot *pci_slot);
1291#endif 1302#endif
1292 1303
1304/**
1305 * pci_pcie_cap - get the saved PCIe capability offset
1306 * @dev: PCI device
1307 *
1308 * PCIe capability offset is calculated at PCI device initialization
1309 * time and saved in the data structure. This function returns saved
1310 * PCIe capability offset. Using this instead of pci_find_capability()
1311 * reduces unnecessary search in the PCI configuration space. If you
1312 * need to calculate PCIe capability offset from raw device for some
1313 * reasons, please use pci_find_capability() instead.
1314 */
1315static inline int pci_pcie_cap(struct pci_dev *dev)
1316{
1317 return dev->pcie_cap;
1318}
1319
1320/**
1321 * pci_is_pcie - check if the PCI device is PCI Express capable
1322 * @dev: PCI device
1323 *
1324 * Retrun true if the PCI device is PCI Express capable, false otherwise.
1325 */
1326static inline bool pci_is_pcie(struct pci_dev *dev)
1327{
1328 return !!pci_pcie_cap(dev);
1329}
1330
1331void pci_request_acs(void);
1332
1293#endif /* __KERNEL__ */ 1333#endif /* __KERNEL__ */
1294#endif /* LINUX_PCI_H */ 1334#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cabf074b4324..cca8a044e2b6 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
@@ -2293,6 +2295,20 @@
2293#define PCI_DEVICE_ID_MPC8536 0x0051 2295#define PCI_DEVICE_ID_MPC8536 0x0051
2294#define PCI_DEVICE_ID_P2020E 0x0070 2296#define PCI_DEVICE_ID_P2020E 0x0070
2295#define PCI_DEVICE_ID_P2020 0x0071 2297#define PCI_DEVICE_ID_P2020 0x0071
2298#define PCI_DEVICE_ID_P2010E 0x0078
2299#define PCI_DEVICE_ID_P2010 0x0079
2300#define PCI_DEVICE_ID_P1020E 0x0100
2301#define PCI_DEVICE_ID_P1020 0x0101
2302#define PCI_DEVICE_ID_P1011E 0x0108
2303#define PCI_DEVICE_ID_P1011 0x0109
2304#define PCI_DEVICE_ID_P1022E 0x0110
2305#define PCI_DEVICE_ID_P1022 0x0111
2306#define PCI_DEVICE_ID_P1013E 0x0118
2307#define PCI_DEVICE_ID_P1013 0x0119
2308#define PCI_DEVICE_ID_P4080E 0x0400
2309#define PCI_DEVICE_ID_P4080 0x0401
2310#define PCI_DEVICE_ID_P4040E 0x0408
2311#define PCI_DEVICE_ID_P4040 0x0409
2296#define PCI_DEVICE_ID_MPC8641 0x7010 2312#define PCI_DEVICE_ID_MPC8641 0x7010
2297#define PCI_DEVICE_ID_MPC8641D 0x7011 2313#define PCI_DEVICE_ID_MPC8641D 0x7011
2298#define PCI_DEVICE_ID_MPC8610 0x7018 2314#define PCI_DEVICE_ID_MPC8610 0x7018
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index dd0bed4f1cf0..9f2ad0aa3c39 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -365,6 +365,11 @@
365#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ 365#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
366#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ 366#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
367 367
368/* PCI Bridge Subsystem ID registers */
369
370#define PCI_SSVID_VENDOR_ID 4 /* PCI-Bridge subsystem vendor id register */
371#define PCI_SSVID_DEVICE_ID 6 /* PCI-Bridge subsystem device id register */
372
368/* PCI Express capability registers */ 373/* PCI Express capability registers */
369 374
370#define PCI_EXP_FLAGS 2 /* Capabilities register */ 375#define PCI_EXP_FLAGS 2 /* Capabilities register */
@@ -502,6 +507,7 @@
502#define PCI_EXT_CAP_ID_VC 2 507#define PCI_EXT_CAP_ID_VC 2
503#define PCI_EXT_CAP_ID_DSN 3 508#define PCI_EXT_CAP_ID_DSN 3
504#define PCI_EXT_CAP_ID_PWR 4 509#define PCI_EXT_CAP_ID_PWR 4
510#define PCI_EXT_CAP_ID_ACS 13
505#define PCI_EXT_CAP_ID_ARI 14 511#define PCI_EXT_CAP_ID_ARI 14
506#define PCI_EXT_CAP_ID_ATS 15 512#define PCI_EXT_CAP_ID_ATS 15
507#define PCI_EXT_CAP_ID_SRIOV 16 513#define PCI_EXT_CAP_ID_SRIOV 16
@@ -662,4 +668,16 @@
662#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ 668#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */
663#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ 669#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
664 670
671/* Access Control Service */
672#define PCI_ACS_CAP 0x04 /* ACS Capability Register */
673#define PCI_ACS_SV 0x01 /* Source Validation */
674#define PCI_ACS_TB 0x02 /* Translation Blocking */
675#define PCI_ACS_RR 0x04 /* P2P Request Redirect */
676#define PCI_ACS_CR 0x08 /* P2P Completion Redirect */
677#define PCI_ACS_UF 0x10 /* Upstream Forwarding */
678#define PCI_ACS_EC 0x20 /* P2P Egress Control */
679#define PCI_ACS_DT 0x40 /* Direct Translated P2P */
680#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
681#define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */
682
665#endif /* LINUX_PCI_REGS_H */ 683#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index b4c79545330b..6775532b92a9 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -10,10 +10,7 @@
10#define _PCIEPORT_IF_H_ 10#define _PCIEPORT_IF_H_
11 11
12/* Port Type */ 12/* Port Type */
13#define PCIE_RC_PORT 4 /* Root port of RC */ 13#define PCIE_ANY_PORT (~0)
14#define PCIE_SW_UPSTREAM_PORT 5 /* Upstream port of Switch */
15#define PCIE_SW_DOWNSTREAM_PORT 6 /* Downstream port of Switch */
16#define PCIE_ANY_PORT 7
17 14
18/* Service Type */ 15/* Service Type */
19#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */ 16#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
@@ -25,17 +22,6 @@
25#define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */ 22#define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */
26#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT) 23#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
27 24
28/* Root/Upstream/Downstream Port's Interrupt Mode */
29#define PCIE_PORT_NO_IRQ (-1)
30#define PCIE_PORT_INTx_MODE 0
31#define PCIE_PORT_MSI_MODE 1
32#define PCIE_PORT_MSIX_MODE 2
33
34struct pcie_port_data {
35 int port_type; /* Type of the port */
36 int port_irq_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */
37};
38
39struct pcie_device { 25struct pcie_device {
40 int irq; /* Service IRQ/MSI/MSI-X Vector */ 26 int irq; /* Service IRQ/MSI/MSI-X Vector */
41 struct pci_dev *port; /* Root/Upstream/Downstream Port */ 27 struct pci_dev *port; /* Root/Upstream/Downstream Port */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 43adbd7f0010..64a53f74c9a9 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -18,10 +18,6 @@
18#include <linux/ioctl.h> 18#include <linux/ioctl.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
20 20
21#ifdef CONFIG_HAVE_HW_BREAKPOINT
22#include <asm/hw_breakpoint.h>
23#endif
24
25/* 21/*
26 * User-space ABI bits: 22 * User-space ABI bits:
27 */ 23 */
@@ -215,12 +211,12 @@ struct perf_event_attr {
215 __u32 wakeup_watermark; /* bytes before wakeup */ 211 __u32 wakeup_watermark; /* bytes before wakeup */
216 }; 212 };
217 213
218 union { 214 struct { /* Hardware breakpoint info */
219 struct { /* Hardware breakpoint info */ 215 __u64 bp_addr;
220 __u64 bp_addr; 216 __u32 bp_type;
221 __u32 bp_type; 217 __u32 bp_len;
222 __u32 bp_len; 218 __u64 __bp_reserved_1;
223 }; 219 __u64 __bp_reserved_2;
224 }; 220 };
225 221
226 __u32 __reserved_2; 222 __u32 __reserved_2;
@@ -451,6 +447,10 @@ enum perf_callchain_context {
451# include <asm/perf_event.h> 447# include <asm/perf_event.h>
452#endif 448#endif
453 449
450#ifdef CONFIG_HAVE_HW_BREAKPOINT
451#include <asm/hw_breakpoint.h>
452#endif
453
454#include <linux/list.h> 454#include <linux/list.h>
455#include <linux/mutex.h> 455#include <linux/mutex.h>
456#include <linux/rculist.h> 456#include <linux/rculist.h>
@@ -565,10 +565,12 @@ struct perf_pending_entry {
565 void (*func)(struct perf_pending_entry *); 565 void (*func)(struct perf_pending_entry *);
566}; 566};
567 567
568typedef void (*perf_callback_t)(struct perf_event *, void *);
569
570struct perf_sample_data; 568struct perf_sample_data;
571 569
570typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
571 struct perf_sample_data *,
572 struct pt_regs *regs);
573
572/** 574/**
573 * struct perf_event - performance event kernel representation: 575 * struct perf_event - performance event kernel representation:
574 */ 576 */
@@ -660,18 +662,12 @@ struct perf_event {
660 struct pid_namespace *ns; 662 struct pid_namespace *ns;
661 u64 id; 663 u64 id;
662 664
663 void (*overflow_handler)(struct perf_event *event, 665 perf_overflow_handler_t overflow_handler;
664 int nmi, struct perf_sample_data *data,
665 struct pt_regs *regs);
666 666
667#ifdef CONFIG_EVENT_PROFILE 667#ifdef CONFIG_EVENT_PROFILE
668 struct event_filter *filter; 668 struct event_filter *filter;
669#endif 669#endif
670 670
671 perf_callback_t callback;
672
673 perf_callback_t event_callback;
674
675#endif /* CONFIG_PERF_EVENTS */ 671#endif /* CONFIG_PERF_EVENTS */
676}; 672};
677 673
@@ -781,7 +777,7 @@ extern struct perf_event *
781perf_event_create_kernel_counter(struct perf_event_attr *attr, 777perf_event_create_kernel_counter(struct perf_event_attr *attr,
782 int cpu, 778 int cpu,
783 pid_t pid, 779 pid_t pid,
784 perf_callback_t callback); 780 perf_overflow_handler_t callback);
785extern u64 perf_event_read_value(struct perf_event *event, 781extern u64 perf_event_read_value(struct perf_event *event,
786 u64 *enabled, u64 *running); 782 u64 *enabled, u64 *running);
787 783
@@ -876,6 +872,8 @@ extern void perf_output_copy(struct perf_output_handle *handle,
876 const void *buf, unsigned int len); 872 const void *buf, unsigned int len);
877extern int perf_swevent_get_recursion_context(void); 873extern int perf_swevent_get_recursion_context(void);
878extern void perf_swevent_put_recursion_context(int rctx); 874extern void perf_swevent_put_recursion_context(int rctx);
875extern void perf_event_enable(struct perf_event *event);
876extern void perf_event_disable(struct perf_event *event);
879#else 877#else
880static inline void 878static inline void
881perf_event_task_sched_in(struct task_struct *task, int cpu) { } 879perf_event_task_sched_in(struct task_struct *task, int cpu) { }
@@ -906,7 +904,8 @@ static inline void perf_event_fork(struct task_struct *tsk) { }
906static inline void perf_event_init(void) { } 904static inline void perf_event_init(void) { }
907static inline int perf_swevent_get_recursion_context(void) { return -1; } 905static inline int perf_swevent_get_recursion_context(void) { return -1; }
908static inline void perf_swevent_put_recursion_context(int rctx) { } 906static inline void perf_swevent_put_recursion_context(int rctx) { }
909 907static inline void perf_event_enable(struct perf_event *event) { }
908static inline void perf_event_disable(struct perf_event *event) { }
910#endif 909#endif
911 910
912#define perf_output_put(handle, x) \ 911#define perf_output_put(handle, x) \
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/platform_device.h b/include/linux/platform_device.h
index 3c6675c2444b..71ff887ca44e 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -83,6 +83,8 @@ struct early_platform_driver {
83 struct platform_driver *pdrv; 83 struct platform_driver *pdrv;
84 struct list_head list; 84 struct list_head list;
85 int requested_id; 85 int requested_id;
86 char *buffer;
87 int bufsize;
86}; 88};
87 89
88#define EARLY_PLATFORM_ID_UNSET -2 90#define EARLY_PLATFORM_ID_UNSET -2
@@ -102,21 +104,29 @@ extern int early_platform_driver_probe(char *class_str,
102 int nr_probe, int user_only); 104 int nr_probe, int user_only);
103extern void early_platform_cleanup(void); 105extern void early_platform_cleanup(void);
104 106
107#define early_platform_init(class_string, platdrv) \
108 early_platform_init_buffer(class_string, platdrv, NULL, 0)
105 109
106#ifndef MODULE 110#ifndef MODULE
107#define early_platform_init(class_string, platform_driver) \ 111#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
108static __initdata struct early_platform_driver early_driver = { \ 112static __initdata struct early_platform_driver early_driver = { \
109 .class_str = class_string, \ 113 .class_str = class_string, \
110 .pdrv = platform_driver, \ 114 .buffer = buf, \
115 .bufsize = bufsiz, \
116 .pdrv = platdrv, \
111 .requested_id = EARLY_PLATFORM_ID_UNSET, \ 117 .requested_id = EARLY_PLATFORM_ID_UNSET, \
112}; \ 118}; \
113static int __init early_platform_driver_setup_func(char *buf) \ 119static int __init early_platform_driver_setup_func(char *buffer) \
114{ \ 120{ \
115 return early_platform_driver_register(&early_driver, buf); \ 121 return early_platform_driver_register(&early_driver, buffer); \
116} \ 122} \
117early_param(class_string, early_platform_driver_setup_func) 123early_param(class_string, early_platform_driver_setup_func)
118#else /* MODULE */ 124#else /* MODULE */
119#define early_platform_init(class_string, platform_driver) 125#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
126static inline char *early_platform_driver_setup_func(void) \
127{ \
128 return bufsiz ? buf : NULL; \
129}
120#endif /* MODULE */ 130#endif /* MODULE */
121 131
122#endif /* _PLATFORM_DEVICE_H_ */ 132#endif /* _PLATFORM_DEVICE_H_ */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index ce9a9b2e5cd4..e70e62194243 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -73,6 +73,8 @@
73/* Quota format type IDs */ 73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1 74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2 75#define QFMT_VFS_V0 2
76#define QFMT_OCFS2 3
77#define QFMT_VFS_V1 4
76 78
77/* Size of block in which space limits are passed through the quota 79/* Size of block in which space limits are passed through the quota
78 * interface */ 80 * interface */
@@ -334,7 +336,7 @@ struct quotactl_ops {
334 336
335struct quota_format_type { 337struct quota_format_type {
336 int qf_fmt_id; /* Quota format id */ 338 int qf_fmt_id; /* Quota format id */
337 struct quota_format_ops *qf_ops; /* Operations of format */ 339 const struct quota_format_ops *qf_ops; /* Operations of format */
338 struct module *qf_owner; /* Module implementing quota format */ 340 struct module *qf_owner; /* Module implementing quota format */
339 struct quota_format_type *qf_next; 341 struct quota_format_type *qf_next;
340}; 342};
@@ -394,7 +396,7 @@ struct quota_info {
394 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ 396 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
395 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 397 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
396 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 398 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
397 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 399 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
398}; 400};
399 401
400int register_quota_format(struct quota_format_type *fmt); 402int register_quota_format(struct quota_format_type *fmt);
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/sched.h b/include/linux/sched.h
index 89115ec7d43f..294eb2f80144 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1102,7 +1102,7 @@ struct sched_class {
1102 1102
1103 void (*set_curr_task) (struct rq *rq); 1103 void (*set_curr_task) (struct rq *rq);
1104 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); 1104 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
1105 void (*task_new) (struct rq *rq, struct task_struct *p); 1105 void (*task_fork) (struct task_struct *p);
1106 1106
1107 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 1107 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
1108 int running); 1108 int running);
@@ -1111,7 +1111,8 @@ struct sched_class {
1111 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1111 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1112 int oldprio, int running); 1112 int oldprio, int running);
1113 1113
1114 unsigned int (*get_rr_interval) (struct task_struct *task); 1114 unsigned int (*get_rr_interval) (struct rq *rq,
1115 struct task_struct *task);
1115 1116
1116#ifdef CONFIG_FAIR_GROUP_SCHED 1117#ifdef CONFIG_FAIR_GROUP_SCHED
1117 void (*moved_group) (struct task_struct *p); 1118 void (*moved_group) (struct task_struct *p);
@@ -1151,8 +1152,6 @@ struct sched_entity {
1151 u64 start_runtime; 1152 u64 start_runtime;
1152 u64 avg_wakeup; 1153 u64 avg_wakeup;
1153 1154
1154 u64 avg_running;
1155
1156#ifdef CONFIG_SCHEDSTATS 1155#ifdef CONFIG_SCHEDSTATS
1157 u64 wait_start; 1156 u64 wait_start;
1158 u64 wait_max; 1157 u64 wait_max;
@@ -1175,7 +1174,6 @@ struct sched_entity {
1175 u64 nr_failed_migrations_running; 1174 u64 nr_failed_migrations_running;
1176 u64 nr_failed_migrations_hot; 1175 u64 nr_failed_migrations_hot;
1177 u64 nr_forced_migrations; 1176 u64 nr_forced_migrations;
1178 u64 nr_forced2_migrations;
1179 1177
1180 u64 nr_wakeups; 1178 u64 nr_wakeups;
1181 u64 nr_wakeups_sync; 1179 u64 nr_wakeups_sync;
@@ -1840,7 +1838,8 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1840extern int sched_clock_stable; 1838extern int sched_clock_stable;
1841#endif 1839#endif
1842 1840
1843extern unsigned long long sched_clock(void); 1841/* ftrace calls sched_clock() directly */
1842extern unsigned long long notrace sched_clock(void);
1844 1843
1845extern void sched_clock_init(void); 1844extern void sched_clock_init(void);
1846extern u64 sched_clock_cpu(int cpu); 1845extern u64 sched_clock_cpu(int cpu);
@@ -1903,14 +1902,22 @@ extern unsigned int sysctl_sched_wakeup_granularity;
1903extern unsigned int sysctl_sched_shares_ratelimit; 1902extern unsigned int sysctl_sched_shares_ratelimit;
1904extern unsigned int sysctl_sched_shares_thresh; 1903extern unsigned int sysctl_sched_shares_thresh;
1905extern unsigned int sysctl_sched_child_runs_first; 1904extern unsigned int sysctl_sched_child_runs_first;
1905
1906enum sched_tunable_scaling {
1907 SCHED_TUNABLESCALING_NONE,
1908 SCHED_TUNABLESCALING_LOG,
1909 SCHED_TUNABLESCALING_LINEAR,
1910 SCHED_TUNABLESCALING_END,
1911};
1912extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
1913
1906#ifdef CONFIG_SCHED_DEBUG 1914#ifdef CONFIG_SCHED_DEBUG
1907extern unsigned int sysctl_sched_features;
1908extern unsigned int sysctl_sched_migration_cost; 1915extern unsigned int sysctl_sched_migration_cost;
1909extern unsigned int sysctl_sched_nr_migrate; 1916extern unsigned int sysctl_sched_nr_migrate;
1910extern unsigned int sysctl_sched_time_avg; 1917extern unsigned int sysctl_sched_time_avg;
1911extern unsigned int sysctl_timer_migration; 1918extern unsigned int sysctl_timer_migration;
1912 1919
1913int sched_nr_latency_handler(struct ctl_table *table, int write, 1920int sched_proc_update_handler(struct ctl_table *table, int write,
1914 void __user *buffer, size_t *length, 1921 void __user *buffer, size_t *length,
1915 loff_t *ppos); 1922 loff_t *ppos);
1916#endif 1923#endif
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/mpc52xx_spi.h b/include/linux/spi/mpc52xx_spi.h
new file mode 100644
index 000000000000..d1004cf09241
--- /dev/null
+++ b/include/linux/spi/mpc52xx_spi.h
@@ -0,0 +1,10 @@
1
2#ifndef INCLUDE_MPC5200_SPI_H
3#define INCLUDE_MPC5200_SPI_H
4
5extern void mpc52xx_spi_set_premessage_hook(struct spi_master *master,
6 void (*hook)(struct spi_message *m,
7 void *context),
8 void *hook_context);
9
10#endif
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/syscalls.h b/include/linux/syscalls.h
index 72d69860d901..65793e90d6f6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -832,4 +832,8 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
832asmlinkage long sys_perf_event_open( 832asmlinkage long sys_perf_event_open(
833 struct perf_event_attr __user *attr_uptr, 833 struct perf_event_attr __user *attr_uptr,
834 pid_t pid, int cpu, int group_fd, unsigned long flags); 834 pid_t pid, int cpu, int group_fd, unsigned long flags);
835
836asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
837 unsigned long prot, unsigned long flags,
838 unsigned long fd, unsigned long pgoff);
835#endif 839#endif
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/tty.h b/include/linux/tty.h
index f0f43d08d8b8..405a9035fe40 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -190,9 +190,17 @@ struct tty_port_operations {
190 /* Control the DTR line */ 190 /* Control the DTR line */
191 void (*dtr_rts)(struct tty_port *port, int raise); 191 void (*dtr_rts)(struct tty_port *port, int raise);
192 /* Called when the last close completes or a hangup finishes 192 /* Called when the last close completes or a hangup finishes
193 IFF the port was initialized. Do not use to free resources */ 193 IFF the port was initialized. Do not use to free resources. Called
194 under the port mutex to serialize against activate/shutdowns */
194 void (*shutdown)(struct tty_port *port); 195 void (*shutdown)(struct tty_port *port);
195 void (*drop)(struct tty_port *port); 196 void (*drop)(struct tty_port *port);
197 /* Called under the port mutex from tty_port_open, serialized using
198 the port mutex */
199 /* FIXME: long term getting the tty argument *out* of this would be
200 good for consoles */
201 int (*activate)(struct tty_port *port, struct tty_struct *tty);
202 /* Called on the final put of a port */
203 void (*destruct)(struct tty_port *port);
196}; 204};
197 205
198struct tty_port { 206struct tty_port {
@@ -206,12 +214,14 @@ struct tty_port {
206 wait_queue_head_t delta_msr_wait; /* Modem status change */ 214 wait_queue_head_t delta_msr_wait; /* Modem status change */
207 unsigned long flags; /* TTY flags ASY_*/ 215 unsigned long flags; /* TTY flags ASY_*/
208 struct mutex mutex; /* Locking */ 216 struct mutex mutex; /* Locking */
217 struct mutex buf_mutex; /* Buffer alloc lock */
209 unsigned char *xmit_buf; /* Optional buffer */ 218 unsigned char *xmit_buf; /* Optional buffer */
210 unsigned int close_delay; /* Close port delay */ 219 unsigned int close_delay; /* Close port delay */
211 unsigned int closing_wait; /* Delay for output */ 220 unsigned int closing_wait; /* Delay for output */
212 int drain_delay; /* Set to zero if no pure time 221 int drain_delay; /* Set to zero if no pure time
213 based drain is needed else 222 based drain is needed else
214 set to size of fifo */ 223 set to size of fifo */
224 struct kref kref; /* Ref counter */
215}; 225};
216 226
217/* 227/*
@@ -439,7 +449,7 @@ extern void initialize_tty_struct(struct tty_struct *tty,
439 struct tty_driver *driver, int idx); 449 struct tty_driver *driver, int idx);
440extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, 450extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
441 int first_ok); 451 int first_ok);
442extern void tty_release_dev(struct file *filp); 452extern int tty_release(struct inode *inode, struct file *filp);
443extern int tty_init_termios(struct tty_struct *tty); 453extern int tty_init_termios(struct tty_struct *tty);
444 454
445extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); 455extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
@@ -454,6 +464,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);
454extern void tty_port_init(struct tty_port *port); 464extern void tty_port_init(struct tty_port *port);
455extern int tty_port_alloc_xmit_buf(struct tty_port *port); 465extern int tty_port_alloc_xmit_buf(struct tty_port *port);
456extern void tty_port_free_xmit_buf(struct tty_port *port); 466extern void tty_port_free_xmit_buf(struct tty_port *port);
467extern void tty_port_put(struct tty_port *port);
468
469extern inline struct tty_port *tty_port_get(struct tty_port *port)
470{
471 if (port)
472 kref_get(&port->kref);
473 return port;
474}
475
457extern struct tty_struct *tty_port_tty_get(struct tty_port *port); 476extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
458extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); 477extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
459extern int tty_port_carrier_raised(struct tty_port *port); 478extern int tty_port_carrier_raised(struct tty_port *port);
@@ -467,6 +486,8 @@ extern int tty_port_close_start(struct tty_port *port,
467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 486extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
468extern void tty_port_close(struct tty_port *port, 487extern void tty_port_close(struct tty_port *port,
469 struct tty_struct *tty, struct file *filp); 488 struct tty_struct *tty, struct file *filp);
489extern int tty_port_open(struct tty_port *port,
490 struct tty_struct *tty, struct file *filp);
470extern inline int tty_port_users(struct tty_port *port) 491extern inline int tty_port_users(struct tty_port *port)
471{ 492{
472 return port->count + port->blocked_open; 493 return port->count + port->blocked_open;
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.h b/include/linux/usb.h
index a34fa89f1474..e101a2d04d75 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -331,6 +331,7 @@ struct usb_bus {
331 u8 otg_port; /* 0, or number of OTG/HNP port */ 331 u8 otg_port; /* 0, or number of OTG/HNP port */
332 unsigned is_b_host:1; /* true during some HNP roleswitches */ 332 unsigned is_b_host:1; /* true during some HNP roleswitches */
333 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 333 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
334 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
334 335
335 int devnum_next; /* Next open device number in 336 int devnum_next; /* Next open device number in
336 * round-robin allocation */ 337 * round-robin allocation */
@@ -428,11 +429,9 @@ struct usb_tt;
428 * @last_busy: time of last use 429 * @last_busy: time of last use
429 * @autosuspend_delay: in jiffies 430 * @autosuspend_delay: in jiffies
430 * @connect_time: time device was first connected 431 * @connect_time: time device was first connected
431 * @auto_pm: autosuspend/resume in progress
432 * @do_remote_wakeup: remote wakeup should be enabled 432 * @do_remote_wakeup: remote wakeup should be enabled
433 * @reset_resume: needs reset instead of resume 433 * @reset_resume: needs reset instead of resume
434 * @autosuspend_disabled: autosuspend disabled by the user 434 * @autosuspend_disabled: autosuspend disabled by the user
435 * @autoresume_disabled: autoresume disabled by the user
436 * @skip_sys_resume: skip the next system resume 435 * @skip_sys_resume: skip the next system resume
437 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 436 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
438 * specific data for the device. 437 * specific data for the device.
@@ -513,11 +512,9 @@ struct usb_device {
513 int autosuspend_delay; 512 int autosuspend_delay;
514 unsigned long connect_time; 513 unsigned long connect_time;
515 514
516 unsigned auto_pm:1;
517 unsigned do_remote_wakeup:1; 515 unsigned do_remote_wakeup:1;
518 unsigned reset_resume:1; 516 unsigned reset_resume:1;
519 unsigned autosuspend_disabled:1; 517 unsigned autosuspend_disabled:1;
520 unsigned autoresume_disabled:1;
521 unsigned skip_sys_resume:1; 518 unsigned skip_sys_resume:1;
522#endif 519#endif
523 struct wusb_dev *wusb_dev; 520 struct wusb_dev *wusb_dev;
@@ -543,22 +540,20 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
543 540
544/* USB autosuspend and autoresume */ 541/* USB autosuspend and autoresume */
545#ifdef CONFIG_USB_SUSPEND 542#ifdef CONFIG_USB_SUSPEND
546extern int usb_autopm_set_interface(struct usb_interface *intf);
547extern int usb_autopm_get_interface(struct usb_interface *intf); 543extern int usb_autopm_get_interface(struct usb_interface *intf);
548extern void usb_autopm_put_interface(struct usb_interface *intf); 544extern void usb_autopm_put_interface(struct usb_interface *intf);
549extern int usb_autopm_get_interface_async(struct usb_interface *intf); 545extern int usb_autopm_get_interface_async(struct usb_interface *intf);
550extern void usb_autopm_put_interface_async(struct usb_interface *intf); 546extern void usb_autopm_put_interface_async(struct usb_interface *intf);
551 547
552static inline void usb_autopm_enable(struct usb_interface *intf) 548static inline void usb_autopm_get_interface_no_resume(
549 struct usb_interface *intf)
553{ 550{
554 atomic_set(&intf->pm_usage_cnt, 0); 551 atomic_inc(&intf->pm_usage_cnt);
555 usb_autopm_set_interface(intf);
556} 552}
557 553static inline void usb_autopm_put_interface_no_suspend(
558static inline void usb_autopm_disable(struct usb_interface *intf) 554 struct usb_interface *intf)
559{ 555{
560 atomic_set(&intf->pm_usage_cnt, 1); 556 atomic_dec(&intf->pm_usage_cnt);
561 usb_autopm_set_interface(intf);
562} 557}
563 558
564static inline void usb_mark_last_busy(struct usb_device *udev) 559static inline void usb_mark_last_busy(struct usb_device *udev)
@@ -568,12 +563,8 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
568 563
569#else 564#else
570 565
571static inline int usb_autopm_set_interface(struct usb_interface *intf)
572{ return 0; }
573
574static inline int usb_autopm_get_interface(struct usb_interface *intf) 566static inline int usb_autopm_get_interface(struct usb_interface *intf)
575{ return 0; } 567{ return 0; }
576
577static inline int usb_autopm_get_interface_async(struct usb_interface *intf) 568static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
578{ return 0; } 569{ return 0; }
579 570
@@ -581,9 +572,11 @@ static inline void usb_autopm_put_interface(struct usb_interface *intf)
581{ } 572{ }
582static inline void usb_autopm_put_interface_async(struct usb_interface *intf) 573static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
583{ } 574{ }
584static inline void usb_autopm_enable(struct usb_interface *intf) 575static inline void usb_autopm_get_interface_no_resume(
576 struct usb_interface *intf)
585{ } 577{ }
586static inline void usb_autopm_disable(struct usb_interface *intf) 578static inline void usb_autopm_put_interface_no_suspend(
579 struct usb_interface *intf)
587{ } 580{ }
588static inline void usb_mark_last_busy(struct usb_device *udev) 581static inline void usb_mark_last_busy(struct usb_device *udev)
589{ } 582{ }
@@ -626,6 +619,10 @@ extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
626 unsigned ifnum); 619 unsigned ifnum);
627extern struct usb_host_interface *usb_altnum_to_altsetting( 620extern struct usb_host_interface *usb_altnum_to_altsetting(
628 const struct usb_interface *intf, unsigned int altnum); 621 const struct usb_interface *intf, unsigned int altnum);
622extern struct usb_host_interface *usb_find_alt_setting(
623 struct usb_host_config *config,
624 unsigned int iface_num,
625 unsigned int alt_num);
629 626
630 627
631/** 628/**
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4f6bb3d2160e..738ea1a691cb 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -127,6 +127,7 @@ struct usb_function {
127 /* private: */ 127 /* private: */
128 /* internals */ 128 /* internals */
129 struct list_head list; 129 struct list_head list;
130 DECLARE_BITMAP(endpoints, 32);
130}; 131};
131 132
132int usb_add_function(struct usb_configuration *, struct usb_function *); 133int usb_add_function(struct usb_configuration *, struct usb_function *);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 2443c0e7a80c..52bb917641f0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -33,6 +33,23 @@ enum usb_otg_state {
33 OTG_STATE_A_VBUS_ERR, 33 OTG_STATE_A_VBUS_ERR,
34}; 34};
35 35
36#define USB_OTG_PULLUP_ID (1 << 0)
37#define USB_OTG_PULLDOWN_DP (1 << 1)
38#define USB_OTG_PULLDOWN_DM (1 << 2)
39#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
40#define USB_OTG_DRV_VBUS (1 << 4)
41#define USB_OTG_DRV_VBUS_EXT (1 << 5)
42
43struct otg_transceiver;
44
45/* for transceivers connected thru an ULPI interface, the user must
46 * provide access ops
47 */
48struct otg_io_access_ops {
49 int (*read)(struct otg_transceiver *otg, u32 reg);
50 int (*write)(struct otg_transceiver *otg, u32 val, u32 reg);
51};
52
36/* 53/*
37 * the otg driver needs to interact with both device side and host side 54 * the otg driver needs to interact with both device side and host side
38 * usb controllers. it decides which controller is active at a given 55 * usb controllers. it decides which controller is active at a given
@@ -42,6 +59,7 @@ enum usb_otg_state {
42struct otg_transceiver { 59struct otg_transceiver {
43 struct device *dev; 60 struct device *dev;
44 const char *label; 61 const char *label;
62 unsigned int flags;
45 63
46 u8 default_a; 64 u8 default_a;
47 enum usb_otg_state state; 65 enum usb_otg_state state;
@@ -49,10 +67,17 @@ struct otg_transceiver {
49 struct usb_bus *host; 67 struct usb_bus *host;
50 struct usb_gadget *gadget; 68 struct usb_gadget *gadget;
51 69
70 struct otg_io_access_ops *io_ops;
71 void __iomem *io_priv;
72
52 /* to pass extra port status to the root hub */ 73 /* to pass extra port status to the root hub */
53 u16 port_status; 74 u16 port_status;
54 u16 port_change; 75 u16 port_change;
55 76
77 /* initialize/shutdown the OTG controller */
78 int (*init)(struct otg_transceiver *otg);
79 void (*shutdown)(struct otg_transceiver *otg);
80
56 /* bind/unbind the host controller */ 81 /* bind/unbind the host controller */
57 int (*set_host)(struct otg_transceiver *otg, 82 int (*set_host)(struct otg_transceiver *otg,
58 struct usb_bus *host); 83 struct usb_bus *host);
@@ -65,6 +90,10 @@ struct otg_transceiver {
65 int (*set_power)(struct otg_transceiver *otg, 90 int (*set_power)(struct otg_transceiver *otg,
66 unsigned mA); 91 unsigned mA);
67 92
93 /* effective for A-peripheral, ignored for B devices */
94 int (*set_vbus)(struct otg_transceiver *otg,
95 bool enabled);
96
68 /* for non-OTG B devices: set transceiver into suspend mode */ 97 /* for non-OTG B devices: set transceiver into suspend mode */
69 int (*set_suspend)(struct otg_transceiver *otg, 98 int (*set_suspend)(struct otg_transceiver *otg,
70 int suspend); 99 int suspend);
@@ -85,6 +114,38 @@ extern int otg_set_transceiver(struct otg_transceiver *);
85extern void usb_nop_xceiv_register(void); 114extern void usb_nop_xceiv_register(void);
86extern void usb_nop_xceiv_unregister(void); 115extern void usb_nop_xceiv_unregister(void);
87 116
117/* helpers for direct access thru low-level io interface */
118static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
119{
120 if (otg->io_ops && otg->io_ops->read)
121 return otg->io_ops->read(otg, reg);
122
123 return -EINVAL;
124}
125
126static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val)
127{
128 if (otg->io_ops && otg->io_ops->write)
129 return otg->io_ops->write(otg, reg, val);
130
131 return -EINVAL;
132}
133
134static inline int
135otg_init(struct otg_transceiver *otg)
136{
137 if (otg->init)
138 return otg->init(otg);
139
140 return 0;
141}
142
143static inline void
144otg_shutdown(struct otg_transceiver *otg)
145{
146 if (otg->shutdown)
147 otg->shutdown(otg);
148}
88 149
89/* for usb host and peripheral controller drivers */ 150/* for usb host and peripheral controller drivers */
90extern struct otg_transceiver *otg_get_transceiver(void); 151extern struct otg_transceiver *otg_get_transceiver(void);
@@ -97,6 +158,12 @@ otg_start_hnp(struct otg_transceiver *otg)
97 return otg->start_hnp(otg); 158 return otg->start_hnp(otg);
98} 159}
99 160
161/* Context: can sleep */
162static inline int
163otg_set_vbus(struct otg_transceiver *otg, bool enabled)
164{
165 return otg->set_vbus(otg, enabled);
166}
100 167
101/* for HCDs */ 168/* for HCDs */
102static inline int 169static inline int
@@ -105,7 +172,6 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
105 return otg->set_host(otg, host); 172 return otg->set_host(otg, host);
106} 173}
107 174
108
109/* for usb peripheral controller drivers */ 175/* for usb peripheral controller drivers */
110 176
111/* Context: can sleep */ 177/* Context: can sleep */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index ce911ebf91e8..acf6e457c04b 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -39,8 +39,6 @@ enum port_dev_state {
39 * @serial: pointer back to the struct usb_serial owner of this port. 39 * @serial: pointer back to the struct usb_serial owner of this port.
40 * @port: pointer to the corresponding tty_port for this port. 40 * @port: pointer to the corresponding tty_port for this port.
41 * @lock: spinlock to grab when updating portions of this structure. 41 * @lock: spinlock to grab when updating portions of this structure.
42 * @mutex: mutex used to synchronize serial_open() and serial_close()
43 * access for this port.
44 * @number: the number of the port (the minor number). 42 * @number: the number of the port (the minor number).
45 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 43 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
46 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. 44 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
@@ -77,7 +75,6 @@ struct usb_serial_port {
77 struct usb_serial *serial; 75 struct usb_serial *serial;
78 struct tty_port port; 76 struct tty_port port;
79 spinlock_t lock; 77 spinlock_t lock;
80 struct mutex mutex;
81 unsigned char number; 78 unsigned char number;
82 79
83 unsigned char *interrupt_in_buffer; 80 unsigned char *interrupt_in_buffer;
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
new file mode 100644
index 000000000000..20675c6ebc4d
--- /dev/null
+++ b/include/linux/usb/ulpi.h
@@ -0,0 +1,7 @@
1#ifndef __LINUX_USB_ULPI_H
2#define __LINUX_USB_ULPI_H
3
4struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
5 unsigned int flags);
6
7#endif /* __LINUX_USB_ULPI_H */
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/usb_usual.h b/include/linux/usb_usual.h
index 3d15fb9bc116..a4b947e470a5 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -56,7 +56,9 @@
56 US_FLAG(SANE_SENSE, 0x00008000) \ 56 US_FLAG(SANE_SENSE, 0x00008000) \
57 /* Sane Sense (> 18 bytes) */ \ 57 /* Sane Sense (> 18 bytes) */ \
58 US_FLAG(CAPACITY_OK, 0x00010000) \ 58 US_FLAG(CAPACITY_OK, 0x00010000) \
59 /* READ CAPACITY response is correct */ 59 /* READ CAPACITY response is correct */ \
60 US_FLAG(BAD_SENSE, 0x00020000) \
61 /* Bad Sense (never more than 18 bytes) */
60 62
61#define US_FLAG(name, value) US_FL_##name = value , 63#define US_FLAG(name, value) US_FL_##name = value ,
62enum { US_DO_ALL_FLAGS }; 64enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index b2a7d8ba6ee3..15591d2ea400 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -128,6 +128,29 @@ struct usbdevfs_hub_portinfo {
128#ifdef __KERNEL__ 128#ifdef __KERNEL__
129#ifdef CONFIG_COMPAT 129#ifdef CONFIG_COMPAT
130#include <linux/compat.h> 130#include <linux/compat.h>
131
132struct usbdevfs_ctrltransfer32 {
133 u8 bRequestType;
134 u8 bRequest;
135 u16 wValue;
136 u16 wIndex;
137 u16 wLength;
138 u32 timeout; /* in milliseconds */
139 compat_caddr_t data;
140};
141
142struct usbdevfs_bulktransfer32 {
143 compat_uint_t ep;
144 compat_uint_t len;
145 compat_uint_t timeout; /* in milliseconds */
146 compat_caddr_t data;
147};
148
149struct usbdevfs_disconnectsignal32 {
150 compat_int_t signr;
151 compat_caddr_t context;
152};
153
131struct usbdevfs_urb32 { 154struct usbdevfs_urb32 {
132 unsigned char type; 155 unsigned char type;
133 unsigned char endpoint; 156 unsigned char endpoint;
@@ -153,7 +176,9 @@ struct usbdevfs_ioctl32 {
153#endif /* __KERNEL__ */ 176#endif /* __KERNEL__ */
154 177
155#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) 178#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
179#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
156#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) 180#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
181#define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
157#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) 182#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
158#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) 183#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
159#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) 184#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
@@ -166,6 +191,7 @@ struct usbdevfs_ioctl32 {
166#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) 191#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
167#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32) 192#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
168#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) 193#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
194#define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
169#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) 195#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
170#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) 196#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
171#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) 197#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
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/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/compat.h b/include/net/compat.h
index 3c7d4e38fa1d..28d5428ec6a2 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -46,7 +46,7 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi
46extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); 46extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
47extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, 47extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
48 unsigned, unsigned, 48 unsigned, unsigned,
49 struct timespec __user *); 49 struct compat_timespec __user *);
50extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 50extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
51extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 51extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
52 52
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 92838d3a1ab7..e46674d5daea 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -53,7 +53,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
53 return inet6_ehashfn(net, laddr, lport, faddr, fport); 53 return inet6_ehashfn(net, laddr, lport, faddr, fport);
54} 54}
55 55
56extern void __inet6_hash(struct sock *sk); 56extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
57 57
58/* 58/*
59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 41cbddd25b70..74358d1b3f43 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -251,7 +251,7 @@ extern void inet_put_port(struct sock *sk);
251 251
252void inet_hashinfo_init(struct inet_hashinfo *h); 252void inet_hashinfo_init(struct inet_hashinfo *h);
253 253
254extern void __inet_hash_nolisten(struct sock *sk); 254extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
255extern void inet_hash(struct sock *sk); 255extern void inet_hash(struct sock *sk);
256extern void inet_unhash(struct sock *sk); 256extern void inet_unhash(struct sock *sk);
257 257
@@ -391,10 +391,12 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
391} 391}
392 392
393extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 393extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
394 struct sock *sk, u32 port_offset, 394 struct sock *sk,
395 u32 port_offset,
395 int (*check_established)(struct inet_timewait_death_row *, 396 int (*check_established)(struct inet_timewait_death_row *,
396 struct sock *, __u16, struct inet_timewait_sock **), 397 struct sock *, __u16, struct inet_timewait_sock **),
397 void (*hash)(struct sock *sk)); 398 int (*hash)(struct sock *sk, struct inet_timewait_sock *twp));
399
398extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 400extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
399 struct sock *sk); 401 struct sock *sk);
400#endif /* _INET_HASHTABLES_H */ 402#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index b801ade2295e..79f67eae8a7e 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -201,6 +201,9 @@ extern void inet_twsk_put(struct inet_timewait_sock *tw);
201 201
202extern int inet_twsk_unhash(struct inet_timewait_sock *tw); 202extern int inet_twsk_unhash(struct inet_timewait_sock *tw);
203 203
204extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
205 struct inet_hashinfo *hashinfo);
206
204extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 207extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
205 const int state); 208 const int state);
206 209
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..1b6f7d348cee 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1261,29 +1261,6 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1261#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1261#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
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
1265 * TCP connection after "boundary" unsucessful, exponentially backed-off
1266 * retransmissions with an initial RTO of TCP_RTO_MIN.
1267 */
1268static inline bool retransmits_timed_out(const struct sock *sk,
1269 unsigned int boundary)
1270{
1271 unsigned int timeout, linear_backoff_thresh;
1272
1273 if (!inet_csk(sk)->icsk_retransmits)
1274 return false;
1275
1276 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1277
1278 if (boundary <= linear_backoff_thresh)
1279 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
1280 else
1281 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
1282 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
1283
1284 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
1285}
1286
1287static inline struct sk_buff *tcp_send_head(struct sock *sk) 1264static inline struct sk_buff *tcp_send_head(struct sock *sk)
1288{ 1265{
1289 return sk->sk_send_head; 1266 return sk->sk_send_head;
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/trace/events/timer.h b/include/trace/events/timer.h
index e5ce87a0498d..9496b965d62a 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -301,8 +301,8 @@ TRACE_EVENT(itimer_state,
301 __entry->interval_usec = value->it_interval.tv_usec; 301 __entry->interval_usec = value->it_interval.tv_usec;
302 ), 302 ),
303 303
304 TP_printk("which=%d expires=%lu it_value=%lu.%lu it_interval=%lu.%lu", 304 TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld",
305 __entry->which, __entry->expires, 305 __entry->which, (unsigned long long)__entry->expires,
306 __entry->value_sec, __entry->value_usec, 306 __entry->value_sec, __entry->value_usec,
307 __entry->interval_sec, __entry->interval_usec) 307 __entry->interval_sec, __entry->interval_usec)
308); 308);
@@ -331,8 +331,8 @@ TRACE_EVENT(itimer_expire,
331 __entry->pid = pid_nr(pid); 331 __entry->pid = pid_nr(pid);
332 ), 332 ),
333 333
334 TP_printk("which=%d pid=%d now=%lu", __entry->which, 334 TP_printk("which=%d pid=%d now=%llu", __entry->which,
335 (int) __entry->pid, __entry->now) 335 (int) __entry->pid, (unsigned long long)__entry->now)
336); 336);
337 337
338#endif /* _TRACE_TIMER_H */ 338#endif /* _TRACE_TIMER_H */
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__
diff --git a/include/xen/xen.h b/include/xen/xen.h
new file mode 100644
index 000000000000..a16402418d31
--- /dev/null
+++ b/include/xen/xen.h
@@ -0,0 +1,32 @@
1#ifndef _XEN_XEN_H
2#define _XEN_XEN_H
3
4enum xen_domain_type {
5 XEN_NATIVE, /* running on bare hardware */
6 XEN_PV_DOMAIN, /* running in a PV domain */
7 XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
8};
9
10#ifdef CONFIG_XEN
11extern enum xen_domain_type xen_domain_type;
12#else
13#define xen_domain_type XEN_NATIVE
14#endif
15
16#define xen_domain() (xen_domain_type != XEN_NATIVE)
17#define xen_pv_domain() (xen_domain() && \
18 xen_domain_type == XEN_PV_DOMAIN)
19#define xen_hvm_domain() (xen_domain() && \
20 xen_domain_type == XEN_HVM_DOMAIN)
21
22#ifdef CONFIG_XEN_DOM0
23#include <xen/interface/xen.h>
24#include <asm/xen/hypervisor.h>
25
26#define xen_initial_domain() (xen_pv_domain() && \
27 xen_start_info->flags & SIF_INITDOMAIN)
28#else /* !CONFIG_XEN_DOM0 */
29#define xen_initial_domain() (0)
30#endif /* CONFIG_XEN_DOM0 */
31
32#endif /* _XEN_XEN_H */