aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/cgroup.h5
-rw-r--r--include/linux/cpumask.h14
-rw-r--r--include/linux/cred.h2
-rw-r--r--include/linux/device.h17
-rw-r--r--include/linux/elf.h5
-rw-r--r--include/linux/fdtable.h11
-rw-r--r--include/linux/hid.h5
-rw-r--r--include/linux/highmem.h6
-rw-r--r--include/linux/input.h42
-rw-r--r--include/linux/ioport.h7
-rw-r--r--include/linux/lmb.h1
-rw-r--r--include/linux/lockdep.h4
-rw-r--r--include/linux/mtd/sh_flctl.h3
-rw-r--r--include/linux/of.h62
-rw-r--r--include/linux/of_fdt.h75
-rw-r--r--include/linux/padata.h88
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/pci.h109
-rw-r--r--include/linux/pci_hotplug.h41
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pfkeyv2.h1
-rw-r--r--include/linux/plist.h4
-rw-r--r--include/linux/pm.h6
-rw-r--r--include/linux/pm_runtime.h4
-rw-r--r--include/linux/raid_class.h1
-rw-r--r--include/linux/rculist.h14
-rw-r--r--include/linux/rculist_nulls.h4
-rw-r--r--include/linux/rcupdate.h165
-rw-r--r--include/linux/rcutiny.h16
-rw-r--r--include/linux/rcutree.h4
-rw-r--r--include/linux/resume-trace.h7
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/sh_intc.h33
-rw-r--r--include/linux/spi/dw_spi.h5
-rw-r--r--include/linux/srcu.h95
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/linux/virtio.h4
-rw-r--r--include/linux/virtio_balloon.h15
-rw-r--r--include/linux/virtio_blk.h13
-rw-r--r--include/linux/virtio_console.h30
41 files changed, 770 insertions, 164 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 0008dee66514..c9bbcb2a75ae 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -28,6 +28,7 @@ struct css_id;
28extern int cgroup_init_early(void); 28extern int cgroup_init_early(void);
29extern int cgroup_init(void); 29extern int cgroup_init(void);
30extern void cgroup_lock(void); 30extern void cgroup_lock(void);
31extern int cgroup_lock_is_held(void);
31extern bool cgroup_lock_live_group(struct cgroup *cgrp); 32extern bool cgroup_lock_live_group(struct cgroup *cgrp);
32extern void cgroup_unlock(void); 33extern void cgroup_unlock(void);
33extern void cgroup_fork(struct task_struct *p); 34extern void cgroup_fork(struct task_struct *p);
@@ -486,7 +487,9 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
486static inline struct cgroup_subsys_state *task_subsys_state( 487static inline struct cgroup_subsys_state *task_subsys_state(
487 struct task_struct *task, int subsys_id) 488 struct task_struct *task, int subsys_id)
488{ 489{
489 return rcu_dereference(task->cgroups->subsys[subsys_id]); 490 return rcu_dereference_check(task->cgroups->subsys[subsys_id],
491 rcu_read_lock_held() ||
492 cgroup_lock_is_held());
490} 493}
491 494
492static inline struct cgroup* task_cgroup(struct task_struct *task, 495static inline struct cgroup* task_cgroup(struct task_struct *task,
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d77b54733c5b..dbcee7647d9a 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -143,6 +143,8 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,
143 143
144#define for_each_cpu(cpu, mask) \ 144#define for_each_cpu(cpu, mask) \
145 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 145 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
146#define for_each_cpu_not(cpu, mask) \
147 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
146#define for_each_cpu_and(cpu, mask, and) \ 148#define for_each_cpu_and(cpu, mask, and) \
147 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and) 149 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and)
148#else 150#else
@@ -203,6 +205,18 @@ int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
203 (cpu) < nr_cpu_ids;) 205 (cpu) < nr_cpu_ids;)
204 206
205/** 207/**
208 * for_each_cpu_not - iterate over every cpu in a complemented mask
209 * @cpu: the (optionally unsigned) integer iterator
210 * @mask: the cpumask pointer
211 *
212 * After the loop, cpu is >= nr_cpu_ids.
213 */
214#define for_each_cpu_not(cpu, mask) \
215 for ((cpu) = -1; \
216 (cpu) = cpumask_next_zero((cpu), (mask)), \
217 (cpu) < nr_cpu_ids;)
218
219/**
206 * for_each_cpu_and - iterate over every cpu in both masks 220 * for_each_cpu_and - iterate over every cpu in both masks
207 * @cpu: the (optionally unsigned) integer iterator 221 * @cpu: the (optionally unsigned) integer iterator
208 * @mask: the first cpumask pointer 222 * @mask: the first cpumask pointer
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4e3387a89cb9..4db09f89b637 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -280,7 +280,7 @@ static inline void put_cred(const struct cred *_cred)
280 * task or by holding tasklist_lock to prevent it from being unlinked. 280 * task or by holding tasklist_lock to prevent it from being unlinked.
281 */ 281 */
282#define __task_cred(task) \ 282#define __task_cred(task) \
283 ((const struct cred *)(rcu_dereference((task)->real_cred))) 283 ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_is_held(&tasklist_lock))))
284 284
285/** 285/**
286 * get_task_cred - Get another task's objective credentials 286 * get_task_cred - Get another task's objective credentials
diff --git a/include/linux/device.h b/include/linux/device.h
index a62799f2ab00..b30527db3ac0 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -472,6 +472,23 @@ static inline int device_is_registered(struct device *dev)
472 return dev->kobj.state_in_sysfs; 472 return dev->kobj.state_in_sysfs;
473} 473}
474 474
475static inline void device_enable_async_suspend(struct device *dev)
476{
477 if (dev->power.status == DPM_ON)
478 dev->power.async_suspend = true;
479}
480
481static inline void device_disable_async_suspend(struct device *dev)
482{
483 if (dev->power.status == DPM_ON)
484 dev->power.async_suspend = false;
485}
486
487static inline bool device_async_suspend_enabled(struct device *dev)
488{
489 return !!dev->power.async_suspend;
490}
491
475void driver_init(void); 492void driver_init(void);
476 493
477/* 494/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 0cc4d55151b7..39ad4b230a4a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -362,6 +362,11 @@ typedef struct elf64_shdr {
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
364#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ 364#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
365#define NT_S390_TIMER 0x301 /* s390 timer register */
366#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
367#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
368#define NT_S390_CTRS 0x304 /* s390 control registers */
369#define NT_S390_PREFIX 0x305 /* s390 prefix register */
365 370
366 371
367/* Note header in a PT_NOTE section */ 372/* Note header in a PT_NOTE section */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index a2ec74bc4812..013dc529e95f 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -57,7 +57,14 @@ struct files_struct {
57 struct file * fd_array[NR_OPEN_DEFAULT]; 57 struct file * fd_array[NR_OPEN_DEFAULT];
58}; 58};
59 59
60#define files_fdtable(files) (rcu_dereference((files)->fdt)) 60#define rcu_dereference_check_fdtable(files, fdtfd) \
61 (rcu_dereference_check((fdtfd), \
62 rcu_read_lock_held() || \
63 lockdep_is_held(&(files)->file_lock) || \
64 atomic_read(&(files)->count) == 1))
65
66#define files_fdtable(files) \
67 (rcu_dereference_check_fdtable((files), (files)->fdt))
61 68
62struct file_operations; 69struct file_operations;
63struct vfsmount; 70struct vfsmount;
@@ -78,7 +85,7 @@ static inline struct file * fcheck_files(struct files_struct *files, unsigned in
78 struct fdtable *fdt = files_fdtable(files); 85 struct fdtable *fdt = files_fdtable(files);
79 86
80 if (fd < fdt->max_fds) 87 if (fd < fdt->max_fds)
81 file = rcu_dereference(fdt->fd[fd]); 88 file = rcu_dereference_check_fdtable(files, fdt->fd[fd]);
82 return file; 89 return file;
83} 90}
84 91
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 87093652dda8..b1344ec4b7fc 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -501,7 +501,7 @@ struct hid_device { /* device report descriptor */
501 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 501 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
502 502
503 /* handler for raw output data, used by hidraw */ 503 /* handler for raw output data, used by hidraw */
504 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 504 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
505 505
506 /* debugging support via debugfs */ 506 /* debugging support via debugfs */
507 unsigned short debug; 507 unsigned short debug;
@@ -663,7 +663,7 @@ struct hid_ll_driver {
663 663
664/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 664/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
665/* We ignore a few input applications that are not widely used */ 665/* We ignore a few input applications that are not widely used */
666#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 666#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
667 667
668/* HID core API */ 668/* HID core API */
669 669
@@ -690,6 +690,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int);
690int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 690int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
691void hid_output_report(struct hid_report *report, __u8 *data); 691void hid_output_report(struct hid_report *report, __u8 *data);
692struct hid_device *hid_allocate_device(void); 692struct hid_device *hid_allocate_device(void);
693struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
693int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 694int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
694int hid_check_keys_pressed(struct hid_device *hid); 695int hid_check_keys_pressed(struct hid_device *hid);
695int hid_connect(struct hid_device *hid, unsigned int connect_mask); 696int hid_connect(struct hid_device *hid, unsigned int connect_mask);
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index ab2cc20e21a5..74152c08ad07 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -17,6 +17,12 @@ static inline void flush_anon_page(struct vm_area_struct *vma, struct page *page
17static inline void flush_kernel_dcache_page(struct page *page) 17static inline void flush_kernel_dcache_page(struct page *page)
18{ 18{
19} 19}
20static inline void flush_kernel_vmap_range(void *vaddr, int size)
21{
22}
23static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
24{
25}
20#endif 26#endif
21 27
22#include <asm/kmap_types.h> 28#include <asm/kmap_types.h>
diff --git a/include/linux/input.h b/include/linux/input.h
index 663208afb64c..f44ee9114401 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -598,6 +598,48 @@ struct input_absinfo {
598 598
599#define KEY_CAMERA_FOCUS 0x210 599#define KEY_CAMERA_FOCUS 0x210
600 600
601#define BTN_TRIGGER_HAPPY 0x2c0
602#define BTN_TRIGGER_HAPPY1 0x2c0
603#define BTN_TRIGGER_HAPPY2 0x2c1
604#define BTN_TRIGGER_HAPPY3 0x2c2
605#define BTN_TRIGGER_HAPPY4 0x2c3
606#define BTN_TRIGGER_HAPPY5 0x2c4
607#define BTN_TRIGGER_HAPPY6 0x2c5
608#define BTN_TRIGGER_HAPPY7 0x2c6
609#define BTN_TRIGGER_HAPPY8 0x2c7
610#define BTN_TRIGGER_HAPPY9 0x2c8
611#define BTN_TRIGGER_HAPPY10 0x2c9
612#define BTN_TRIGGER_HAPPY11 0x2ca
613#define BTN_TRIGGER_HAPPY12 0x2cb
614#define BTN_TRIGGER_HAPPY13 0x2cc
615#define BTN_TRIGGER_HAPPY14 0x2cd
616#define BTN_TRIGGER_HAPPY15 0x2ce
617#define BTN_TRIGGER_HAPPY16 0x2cf
618#define BTN_TRIGGER_HAPPY17 0x2d0
619#define BTN_TRIGGER_HAPPY18 0x2d1
620#define BTN_TRIGGER_HAPPY19 0x2d2
621#define BTN_TRIGGER_HAPPY20 0x2d3
622#define BTN_TRIGGER_HAPPY21 0x2d4
623#define BTN_TRIGGER_HAPPY22 0x2d5
624#define BTN_TRIGGER_HAPPY23 0x2d6
625#define BTN_TRIGGER_HAPPY24 0x2d7
626#define BTN_TRIGGER_HAPPY25 0x2d8
627#define BTN_TRIGGER_HAPPY26 0x2d9
628#define BTN_TRIGGER_HAPPY27 0x2da
629#define BTN_TRIGGER_HAPPY28 0x2db
630#define BTN_TRIGGER_HAPPY29 0x2dc
631#define BTN_TRIGGER_HAPPY30 0x2dd
632#define BTN_TRIGGER_HAPPY31 0x2de
633#define BTN_TRIGGER_HAPPY32 0x2df
634#define BTN_TRIGGER_HAPPY33 0x2e0
635#define BTN_TRIGGER_HAPPY34 0x2e1
636#define BTN_TRIGGER_HAPPY35 0x2e2
637#define BTN_TRIGGER_HAPPY36 0x2e3
638#define BTN_TRIGGER_HAPPY37 0x2e4
639#define BTN_TRIGGER_HAPPY38 0x2e5
640#define BTN_TRIGGER_HAPPY39 0x2e6
641#define BTN_TRIGGER_HAPPY40 0x2e7
642
601/* We avoid low common keys in module aliases so they don't get huge. */ 643/* We avoid low common keys in module aliases so they don't get huge. */
602#define KEY_MIN_INTERESTING KEY_MUTE 644#define KEY_MIN_INTERESTING KEY_MUTE
603#define KEY_MAX 0x2ff 645#define KEY_MAX 0x2ff
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 7129504e053d..dda98410d588 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -112,6 +112,7 @@ extern struct resource iomem_resource;
112 112
113extern int request_resource(struct resource *root, struct resource *new); 113extern int request_resource(struct resource *root, struct resource *new);
114extern int release_resource(struct resource *new); 114extern int release_resource(struct resource *new);
115void release_child_resources(struct resource *new);
115extern void reserve_region_with_split(struct resource *root, 116extern void reserve_region_with_split(struct resource *root,
116 resource_size_t start, resource_size_t end, 117 resource_size_t start, resource_size_t end,
117 const char *name); 118 const char *name);
@@ -120,8 +121,10 @@ extern void insert_resource_expand_to_fit(struct resource *root, struct resource
120extern int allocate_resource(struct resource *root, struct resource *new, 121extern int allocate_resource(struct resource *root, struct resource *new,
121 resource_size_t size, resource_size_t min, 122 resource_size_t size, resource_size_t min,
122 resource_size_t max, resource_size_t align, 123 resource_size_t max, resource_size_t align,
123 void (*alignf)(void *, struct resource *, 124 resource_size_t (*alignf)(void *,
124 resource_size_t, resource_size_t), 125 const struct resource *,
126 resource_size_t,
127 resource_size_t),
125 void *alignf_data); 128 void *alignf_data);
126int adjust_resource(struct resource *res, resource_size_t start, 129int adjust_resource(struct resource *res, resource_size_t start,
127 resource_size_t size); 130 resource_size_t size);
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index ef82b8fcbddb..f3d14333ebed 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -42,6 +42,7 @@ extern void __init lmb_init(void);
42extern void __init lmb_analyze(void); 42extern void __init lmb_analyze(void);
43extern long lmb_add(u64 base, u64 size); 43extern long lmb_add(u64 base, u64 size);
44extern long lmb_remove(u64 base, u64 size); 44extern long lmb_remove(u64 base, u64 size);
45extern long __init lmb_free(u64 base, u64 size);
45extern long __init lmb_reserve(u64 base, u64 size); 46extern long __init lmb_reserve(u64 base, u64 size);
46extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, 47extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
47 u64 (*nid_range)(u64, u64, int *)); 48 u64 (*nid_range)(u64, u64, int *));
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 9ccf0e286b2a..10206a87da19 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -534,4 +534,8 @@ do { \
534# define might_lock_read(lock) do { } while (0) 534# define might_lock_read(lock) do { } while (0)
535#endif 535#endif
536 536
537#ifdef CONFIG_PROVE_RCU
538extern void lockdep_rcu_dereference(const char *file, const int line);
539#endif
540
537#endif /* __LINUX_LOCKDEP_H */ 541#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index e77c1cea404d..ab77609ec337 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -51,6 +51,8 @@
51#define _4ECCCNTEN (0x1 << 24) 51#define _4ECCCNTEN (0x1 << 24)
52#define _4ECCEN (0x1 << 23) 52#define _4ECCEN (0x1 << 23)
53#define _4ECCCORRECT (0x1 << 22) 53#define _4ECCCORRECT (0x1 << 22)
54#define SHBUSSEL (0x1 << 20)
55#define SEL_16BIT (0x1 << 19)
54#define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ 56#define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/
55#define QTSEL_E (0x1 << 17) 57#define QTSEL_E (0x1 << 17)
56#define ENDIAN (0x1 << 16) /* 1 = little endian */ 58#define ENDIAN (0x1 << 16) /* 1 = little endian */
@@ -96,6 +98,7 @@
96struct sh_flctl { 98struct sh_flctl {
97 struct mtd_info mtd; 99 struct mtd_info mtd;
98 struct nand_chip chip; 100 struct nand_chip chip;
101 struct platform_device *pdev;
99 void __iomem *reg; 102 void __iomem *reg;
100 103
101 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ 104 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
diff --git a/include/linux/of.h b/include/linux/of.h
index e7facd8fbce8..f6d9cbc39c9c 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -19,6 +19,11 @@
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/kref.h> 20#include <linux/kref.h>
21#include <linux/mod_devicetable.h> 21#include <linux/mod_devicetable.h>
22#include <linux/spinlock.h>
23
24#include <asm/byteorder.h>
25
26#ifdef CONFIG_OF
22 27
23typedef u32 phandle; 28typedef u32 phandle;
24typedef u32 ihandle; 29typedef u32 ihandle;
@@ -39,10 +44,7 @@ struct of_irq_controller;
39struct device_node { 44struct device_node {
40 const char *name; 45 const char *name;
41 const char *type; 46 const char *type;
42 phandle node; 47 phandle phandle;
43#if !defined(CONFIG_SPARC)
44 phandle linux_phandle;
45#endif
46 char *full_name; 48 char *full_name;
47 49
48 struct property *properties; 50 struct property *properties;
@@ -63,6 +65,11 @@ struct device_node {
63#endif 65#endif
64}; 66};
65 67
68/* Pointer for first entry in chain of all nodes. */
69extern struct device_node *allnodes;
70extern struct device_node *of_chosen;
71extern rwlock_t devtree_lock;
72
66static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 73static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
67{ 74{
68 return test_bit(flag, &n->_flags); 75 return test_bit(flag, &n->_flags);
@@ -73,12 +80,6 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
73 set_bit(flag, &n->_flags); 80 set_bit(flag, &n->_flags);
74} 81}
75 82
76static inline void
77set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
78{
79 dn->pde = de;
80}
81
82extern struct device_node *of_find_all_nodes(struct device_node *prev); 83extern struct device_node *of_find_all_nodes(struct device_node *prev);
83 84
84#if defined(CONFIG_SPARC) 85#if defined(CONFIG_SPARC)
@@ -101,26 +102,36 @@ extern void of_node_put(struct device_node *node);
101 */ 102 */
102 103
103/* Helper to read a big number; size is in cells (not bytes) */ 104/* Helper to read a big number; size is in cells (not bytes) */
104static inline u64 of_read_number(const u32 *cell, int size) 105static inline u64 of_read_number(const __be32 *cell, int size)
105{ 106{
106 u64 r = 0; 107 u64 r = 0;
107 while (size--) 108 while (size--)
108 r = (r << 32) | *(cell++); 109 r = (r << 32) | be32_to_cpu(*(cell++));
109 return r; 110 return r;
110} 111}
111 112
112/* Like of_read_number, but we want an unsigned long result */ 113/* Like of_read_number, but we want an unsigned long result */
113#ifdef CONFIG_PPC32 114static inline unsigned long of_read_ulong(const __be32 *cell, int size)
114static inline unsigned long of_read_ulong(const u32 *cell, int size)
115{ 115{
116 return cell[size-1]; 116 /* toss away upper bits if unsigned long is smaller than u64 */
117 return of_read_number(cell, size);
117} 118}
118#else
119#define of_read_ulong(cell, size) of_read_number(cell, size)
120#endif
121 119
122#include <asm/prom.h> 120#include <asm/prom.h>
123 121
122/* Default #address and #size cells. Allow arch asm/prom.h to override */
123#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
124#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
125#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
126#endif
127
128/* Default string compare functions, Allow arch asm/prom.h to override */
129#if !defined(of_compat_cmp)
130#define of_compat_cmp(s1, s2, l) strncasecmp((s1), (s2), (l))
131#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
132#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
133#endif
134
124/* flag descriptions */ 135/* flag descriptions */
125#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 136#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
126#define OF_DETACHED 2 /* node has been detached from the device tree */ 137#define OF_DETACHED 2 /* node has been detached from the device tree */
@@ -187,4 +198,19 @@ extern int of_parse_phandles_with_args(struct device_node *np,
187 const char *list_name, const char *cells_name, int index, 198 const char *list_name, const char *cells_name, int index,
188 struct device_node **out_node, const void **out_args); 199 struct device_node **out_node, const void **out_args);
189 200
201extern int of_machine_is_compatible(const char *compat);
202
203extern int prom_add_property(struct device_node* np, struct property* prop);
204extern int prom_remove_property(struct device_node *np, struct property *prop);
205extern int prom_update_property(struct device_node *np,
206 struct property *newprop,
207 struct property *oldprop);
208
209#if defined(CONFIG_OF_DYNAMIC)
210/* For updating the device tree at runtime */
211extern void of_attach_node(struct device_node *);
212extern void of_detach_node(struct device_node *);
213#endif
214
215#endif /* CONFIG_OF */
190#endif /* _LINUX_OF_H */ 216#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 41d432b13553..a1ca92ccb0ff 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -42,45 +42,62 @@
42 * ends when size is 0 42 * ends when size is 0
43 */ 43 */
44struct boot_param_header { 44struct boot_param_header {
45 u32 magic; /* magic word OF_DT_HEADER */ 45 __be32 magic; /* magic word OF_DT_HEADER */
46 u32 totalsize; /* total size of DT block */ 46 __be32 totalsize; /* total size of DT block */
47 u32 off_dt_struct; /* offset to structure */ 47 __be32 off_dt_struct; /* offset to structure */
48 u32 off_dt_strings; /* offset to strings */ 48 __be32 off_dt_strings; /* offset to strings */
49 u32 off_mem_rsvmap; /* offset to memory reserve map */ 49 __be32 off_mem_rsvmap; /* offset to memory reserve map */
50 u32 version; /* format version */ 50 __be32 version; /* format version */
51 u32 last_comp_version; /* last compatible version */ 51 __be32 last_comp_version; /* last compatible version */
52 /* version 2 fields below */ 52 /* version 2 fields below */
53 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ 53 __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
54 /* version 3 fields below */ 54 /* version 3 fields below */
55 u32 dt_strings_size; /* size of the DT strings block */ 55 __be32 dt_strings_size; /* size of the DT strings block */
56 /* version 17 fields below */ 56 /* version 17 fields below */
57 u32 dt_struct_size; /* size of the DT structure block */ 57 __be32 dt_struct_size; /* size of the DT structure block */
58}; 58};
59 59
60/* TBD: Temporary export of fdt globals - remove when code fully merged */
61extern int __initdata dt_root_addr_cells;
62extern int __initdata dt_root_size_cells;
63extern struct boot_param_header *initial_boot_params;
64
60/* For scanning the flat device-tree at boot time */ 65/* For scanning the flat device-tree at boot time */
61extern int __init of_scan_flat_dt(int (*it)(unsigned long node, 66extern char *find_flat_dt_string(u32 offset);
62 const char *uname, int depth, 67extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
63 void *data), 68 int depth, void *data),
64 void *data); 69 void *data);
65extern void __init *of_get_flat_dt_prop(unsigned long node, const char *name, 70extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
66 unsigned long *size); 71 unsigned long *size);
67extern int __init of_flat_dt_is_compatible(unsigned long node, 72extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
68 const char *name); 73extern unsigned long of_get_flat_dt_root(void);
69extern unsigned long __init of_get_flat_dt_root(void); 74extern void early_init_dt_scan_chosen_arch(unsigned long node);
75extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
76 int depth, void *data);
77extern void early_init_dt_check_for_initrd(unsigned long node);
78extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
79 int depth, void *data);
80extern void early_init_dt_add_memory_arch(u64 base, u64 size);
81extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align);
82extern u64 dt_mem_next_cell(int s, __be32 **cellp);
83
84/*
85 * If BLK_DEV_INITRD, the fdt early init code will call this function,
86 * to be provided by the arch code. start and end are specified as
87 * physical addresses.
88 */
89#ifdef CONFIG_BLK_DEV_INITRD
90extern void early_init_dt_setup_initrd_arch(unsigned long start,
91 unsigned long end);
92#endif
93
94/* Early flat tree scan hooks */
95extern int early_init_dt_scan_root(unsigned long node, const char *uname,
96 int depth, void *data);
70 97
71/* Other Prototypes */ 98/* Other Prototypes */
72extern void finish_device_tree(void);
73extern void unflatten_device_tree(void); 99extern void unflatten_device_tree(void);
74extern void early_init_devtree(void *); 100extern void early_init_devtree(void *);
75extern int machine_is_compatible(const char *compat);
76extern void print_properties(struct device_node *node);
77extern int prom_n_intr_cells(struct device_node* np);
78extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
79extern int prom_add_property(struct device_node* np, struct property* prop);
80extern int prom_remove_property(struct device_node *np, struct property *prop);
81extern int prom_update_property(struct device_node *np,
82 struct property *newprop,
83 struct property *oldprop);
84 101
85#endif /* __ASSEMBLY__ */ 102#endif /* __ASSEMBLY__ */
86#endif /* _LINUX_OF_FDT_H */ 103#endif /* _LINUX_OF_FDT_H */
diff --git a/include/linux/padata.h b/include/linux/padata.h
new file mode 100644
index 000000000000..51611da9c498
--- /dev/null
+++ b/include/linux/padata.h
@@ -0,0 +1,88 @@
1/*
2 * padata.h - header for the padata parallelization interface
3 *
4 * Copyright (C) 2008, 2009 secunet Security Networks AG
5 * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef PADATA_H
22#define PADATA_H
23
24#include <linux/workqueue.h>
25#include <linux/spinlock.h>
26#include <linux/list.h>
27
28struct padata_priv {
29 struct list_head list;
30 struct parallel_data *pd;
31 int cb_cpu;
32 int seq_nr;
33 int info;
34 void (*parallel)(struct padata_priv *padata);
35 void (*serial)(struct padata_priv *padata);
36};
37
38struct padata_list {
39 struct list_head list;
40 spinlock_t lock;
41};
42
43struct padata_queue {
44 struct padata_list parallel;
45 struct padata_list reorder;
46 struct padata_list serial;
47 struct work_struct pwork;
48 struct work_struct swork;
49 struct parallel_data *pd;
50 atomic_t num_obj;
51 int cpu_index;
52};
53
54struct parallel_data {
55 struct padata_instance *pinst;
56 struct padata_queue *queue;
57 atomic_t seq_nr;
58 atomic_t reorder_objects;
59 atomic_t refcnt;
60 unsigned int max_seq_nr;
61 cpumask_var_t cpumask;
62 spinlock_t lock;
63};
64
65struct padata_instance {
66 struct notifier_block cpu_notifier;
67 struct workqueue_struct *wq;
68 struct parallel_data *pd;
69 cpumask_var_t cpumask;
70 struct mutex lock;
71 u8 flags;
72#define PADATA_INIT 1
73#define PADATA_RESET 2
74};
75
76extern struct padata_instance *padata_alloc(const struct cpumask *cpumask,
77 struct workqueue_struct *wq);
78extern void padata_free(struct padata_instance *pinst);
79extern int padata_do_parallel(struct padata_instance *pinst,
80 struct padata_priv *padata, int cb_cpu);
81extern void padata_do_serial(struct padata_priv *padata);
82extern int padata_set_cpumask(struct padata_instance *pinst,
83 cpumask_var_t cpumask);
84extern int padata_add_cpu(struct padata_instance *pinst, int cpu);
85extern int padata_remove_cpu(struct padata_instance *pinst, int cpu);
86extern void padata_start(struct padata_instance *pinst);
87extern void padata_stop(struct padata_instance *pinst);
88#endif
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 93a7c08f869d..c8b6473c5f42 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -11,6 +11,13 @@
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
14extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev,
15 struct pci_bus *pci_bus);
16extern acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev);
17extern acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
18 struct pci_dev *pci_dev);
19extern acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev);
20
14static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 21static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
15{ 22{
16 struct pci_bus *pbus = pdev->bus; 23 struct pci_bus *pbus = pdev->bus;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c1968f464c38..e19a69613d8f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -187,6 +187,33 @@ enum pci_bus_flags {
187 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, 187 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
188}; 188};
189 189
190/* Based on the PCI Hotplug Spec, but some values are made up by us */
191enum pci_bus_speed {
192 PCI_SPEED_33MHz = 0x00,
193 PCI_SPEED_66MHz = 0x01,
194 PCI_SPEED_66MHz_PCIX = 0x02,
195 PCI_SPEED_100MHz_PCIX = 0x03,
196 PCI_SPEED_133MHz_PCIX = 0x04,
197 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
198 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
199 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
200 PCI_SPEED_66MHz_PCIX_266 = 0x09,
201 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
202 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
203 AGP_UNKNOWN = 0x0c,
204 AGP_1X = 0x0d,
205 AGP_2X = 0x0e,
206 AGP_4X = 0x0f,
207 AGP_8X = 0x10,
208 PCI_SPEED_66MHz_PCIX_533 = 0x11,
209 PCI_SPEED_100MHz_PCIX_533 = 0x12,
210 PCI_SPEED_133MHz_PCIX_533 = 0x13,
211 PCIE_SPEED_2_5GT = 0x14,
212 PCIE_SPEED_5_0GT = 0x15,
213 PCIE_SPEED_8_0GT = 0x16,
214 PCI_SPEED_UNKNOWN = 0xff,
215};
216
190struct pci_cap_saved_state { 217struct pci_cap_saved_state {
191 struct hlist_node next; 218 struct hlist_node next;
192 char cap_nr; 219 char cap_nr;
@@ -239,6 +266,7 @@ struct pci_dev {
239 configuration space */ 266 configuration space */
240 unsigned int pme_support:5; /* Bitmask of states from which PME# 267 unsigned int pme_support:5; /* Bitmask of states from which PME#
241 can be generated */ 268 can be generated */
269 unsigned int pme_interrupt:1;
242 unsigned int d1_support:1; /* Low power state D1 is supported */ 270 unsigned int d1_support:1; /* Low power state D1 is supported */
243 unsigned int d2_support:1; /* Low power state D2 is supported */ 271 unsigned int d2_support:1; /* Low power state D2 is supported */
244 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 272 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
@@ -275,7 +303,8 @@ struct pci_dev {
275 unsigned int msix_enabled:1; 303 unsigned int msix_enabled:1;
276 unsigned int ari_enabled:1; /* ARI forwarding */ 304 unsigned int ari_enabled:1; /* ARI forwarding */
277 unsigned int is_managed:1; 305 unsigned int is_managed:1;
278 unsigned int is_pcie:1; 306 unsigned int is_pcie:1; /* Obsolete. Will be removed.
307 Use pci_is_pcie() instead */
279 unsigned int needs_freset:1; /* Dev requires fundamental reset */ 308 unsigned int needs_freset:1; /* Dev requires fundamental reset */
280 unsigned int state_saved:1; 309 unsigned int state_saved:1;
281 unsigned int is_physfn:1; 310 unsigned int is_physfn:1;
@@ -335,9 +364,26 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
335 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 364 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
336} 365}
337 366
338#ifndef PCI_BUS_NUM_RESOURCES 367/*
339#define PCI_BUS_NUM_RESOURCES 16 368 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
340#endif 369 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
370 * buses below host bridges or subtractive decode bridges) go in the list.
371 * Use pci_bus_for_each_resource() to iterate through all the resources.
372 */
373
374/*
375 * PCI_SUBTRACTIVE_DECODE means the bridge forwards the window implicitly
376 * and there's no way to program the bridge with the details of the window.
377 * This does not apply to ACPI _CRS windows, even with the _DEC subtractive-
378 * decode bit set, because they are explicit and can be programmed with _SRS.
379 */
380#define PCI_SUBTRACTIVE_DECODE 0x1
381
382struct pci_bus_resource {
383 struct list_head list;
384 struct resource *res;
385 unsigned int flags;
386};
341 387
342#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */ 388#define PCI_REGION_FLAG_MASK 0x0fU /* These bits of resource flags tell us the PCI region flags */
343 389
@@ -348,8 +394,8 @@ struct pci_bus {
348 struct list_head devices; /* list of devices on this bus */ 394 struct list_head devices; /* list of devices on this bus */
349 struct pci_dev *self; /* bridge device as seen by parent */ 395 struct pci_dev *self; /* bridge device as seen by parent */
350 struct list_head slots; /* list of slots on this bus */ 396 struct list_head slots; /* list of slots on this bus */
351 struct resource *resource[PCI_BUS_NUM_RESOURCES]; 397 struct resource *resource[PCI_BRIDGE_RESOURCE_NUM];
352 /* address space routed to this bus */ 398 struct list_head resources; /* address space routed to this bus */
353 399
354 struct pci_ops *ops; /* configuration access functions */ 400 struct pci_ops *ops; /* configuration access functions */
355 void *sysdata; /* hook for sys-specific extension */ 401 void *sysdata; /* hook for sys-specific extension */
@@ -359,6 +405,8 @@ struct pci_bus {
359 unsigned char primary; /* number of primary bridge */ 405 unsigned char primary; /* number of primary bridge */
360 unsigned char secondary; /* number of secondary bridge */ 406 unsigned char secondary; /* number of secondary bridge */
361 unsigned char subordinate; /* max number of subordinate buses */ 407 unsigned char subordinate; /* max number of subordinate buses */
408 unsigned char max_bus_speed; /* enum pci_bus_speed */
409 unsigned char cur_bus_speed; /* enum pci_bus_speed */
362 410
363 char name[48]; 411 char name[48];
364 412
@@ -563,7 +611,8 @@ int __must_check pcibios_enable_device(struct pci_dev *, int mask);
563char *pcibios_setup(char *str); 611char *pcibios_setup(char *str);
564 612
565/* Used only when drivers/pci/setup.c is used */ 613/* Used only when drivers/pci/setup.c is used */
566void pcibios_align_resource(void *, struct resource *, resource_size_t, 614resource_size_t pcibios_align_resource(void *, const struct resource *,
615 resource_size_t,
567 resource_size_t); 616 resource_size_t);
568void pcibios_update_irq(struct pci_dev *, int irq); 617void pcibios_update_irq(struct pci_dev *, int irq);
569 618
@@ -589,6 +638,7 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
589 struct pci_ops *ops, void *sysdata); 638 struct pci_ops *ops, void *sysdata);
590struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 639struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
591 int busnr); 640 int busnr);
641void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
592struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 642struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
593 const char *name, 643 const char *name,
594 struct hotplug_slot *hotplug); 644 struct hotplug_slot *hotplug);
@@ -615,12 +665,6 @@ extern void pci_sort_breadthfirst(void);
615 665
616/* Generic PCI functions exported to card drivers */ 666/* Generic PCI functions exported to card drivers */
617 667
618#ifdef CONFIG_PCI_LEGACY
619struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
620 unsigned int device,
621 struct pci_dev *from);
622#endif /* CONFIG_PCI_LEGACY */
623
624enum pci_lost_interrupt_reason { 668enum pci_lost_interrupt_reason {
625 PCI_LOST_IRQ_NO_INFORMATION = 0, 669 PCI_LOST_IRQ_NO_INFORMATION = 0,
626 PCI_LOST_IRQ_DISABLE_MSI, 670 PCI_LOST_IRQ_DISABLE_MSI,
@@ -750,11 +794,19 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
750pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 794pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
751bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 795bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
752void pci_pme_active(struct pci_dev *dev, bool enable); 796void pci_pme_active(struct pci_dev *dev, bool enable);
753int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable); 797int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
798 bool runtime, bool enable);
754int pci_wake_from_d3(struct pci_dev *dev, bool enable); 799int pci_wake_from_d3(struct pci_dev *dev, bool enable);
755pci_power_t pci_target_state(struct pci_dev *dev); 800pci_power_t pci_target_state(struct pci_dev *dev);
756int pci_prepare_to_sleep(struct pci_dev *dev); 801int pci_prepare_to_sleep(struct pci_dev *dev);
757int pci_back_from_sleep(struct pci_dev *dev); 802int pci_back_from_sleep(struct pci_dev *dev);
803bool pci_dev_run_wake(struct pci_dev *dev);
804
805static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
806 bool enable)
807{
808 return __pci_enable_wake(dev, state, false, enable);
809}
758 810
759/* For use by arch with custom probe code */ 811/* For use by arch with custom probe code */
760void set_pcie_port_type(struct pci_dev *pdev); 812void set_pcie_port_type(struct pci_dev *pdev);
@@ -776,6 +828,7 @@ void pci_bus_assign_resources(const struct pci_bus *bus);
776void pci_bus_size_bridges(struct pci_bus *bus); 828void pci_bus_size_bridges(struct pci_bus *bus);
777int pci_claim_resource(struct pci_dev *, int); 829int pci_claim_resource(struct pci_dev *, int);
778void pci_assign_unassigned_resources(void); 830void pci_assign_unassigned_resources(void);
831void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
779void pdev_enable_device(struct pci_dev *); 832void pdev_enable_device(struct pci_dev *);
780void pdev_sort_resources(struct pci_dev *, struct resource_list *); 833void pdev_sort_resources(struct pci_dev *, struct resource_list *);
781int pci_enable_resources(struct pci_dev *, int mask); 834int pci_enable_resources(struct pci_dev *, int mask);
@@ -793,12 +846,23 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
793void pci_release_selected_regions(struct pci_dev *, int); 846void pci_release_selected_regions(struct pci_dev *, int);
794 847
795/* drivers/pci/bus.c */ 848/* drivers/pci/bus.c */
849void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
850struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
851void pci_bus_remove_resources(struct pci_bus *bus);
852
853#define pci_bus_for_each_resource(bus, res, i) \
854 for (i = 0; \
855 (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \
856 i++)
857
796int __must_check pci_bus_alloc_resource(struct pci_bus *bus, 858int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
797 struct resource *res, resource_size_t size, 859 struct resource *res, resource_size_t size,
798 resource_size_t align, resource_size_t min, 860 resource_size_t align, resource_size_t min,
799 unsigned int type_mask, 861 unsigned int type_mask,
800 void (*alignf)(void *, struct resource *, 862 resource_size_t (*alignf)(void *,
801 resource_size_t, resource_size_t), 863 const struct resource *,
864 resource_size_t,
865 resource_size_t),
802 void *alignf_data); 866 void *alignf_data);
803void pci_enable_bridges(struct pci_bus *bus); 867void pci_enable_bridges(struct pci_bus *bus);
804 868
@@ -977,13 +1041,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
977_PCI_NOP_ALL(read, *) 1041_PCI_NOP_ALL(read, *)
978_PCI_NOP_ALL(write,) 1042_PCI_NOP_ALL(write,)
979 1043
980static inline struct pci_dev *pci_find_device(unsigned int vendor,
981 unsigned int device,
982 struct pci_dev *from)
983{
984 return NULL;
985}
986
987static inline struct pci_dev *pci_get_device(unsigned int vendor, 1044static inline struct pci_dev *pci_get_device(unsigned int vendor,
988 unsigned int device, 1045 unsigned int device,
989 struct pci_dev *from) 1046 struct pci_dev *from)
@@ -1241,8 +1298,12 @@ enum pci_fixup_pass {
1241 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1298 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1242 suspend##vendor##device##hook, vendor, device, hook) 1299 suspend##vendor##device##hook, vendor, device, hook)
1243 1300
1244 1301#ifdef CONFIG_PCI_QUIRKS
1245void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1302void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1303#else
1304static inline void pci_fixup_device(enum pci_fixup_pass pass,
1305 struct pci_dev *dev) {}
1306#endif
1246 1307
1247void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1308void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
1248void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1309void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 652ba797696d..5d09cbafa7db 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -28,26 +28,6 @@
28#ifndef _PCI_HOTPLUG_H 28#ifndef _PCI_HOTPLUG_H
29#define _PCI_HOTPLUG_H 29#define _PCI_HOTPLUG_H
30 30
31
32/* These values come from the PCI Hotplug Spec */
33enum pci_bus_speed {
34 PCI_SPEED_33MHz = 0x00,
35 PCI_SPEED_66MHz = 0x01,
36 PCI_SPEED_66MHz_PCIX = 0x02,
37 PCI_SPEED_100MHz_PCIX = 0x03,
38 PCI_SPEED_133MHz_PCIX = 0x04,
39 PCI_SPEED_66MHz_PCIX_ECC = 0x05,
40 PCI_SPEED_100MHz_PCIX_ECC = 0x06,
41 PCI_SPEED_133MHz_PCIX_ECC = 0x07,
42 PCI_SPEED_66MHz_PCIX_266 = 0x09,
43 PCI_SPEED_100MHz_PCIX_266 = 0x0a,
44 PCI_SPEED_133MHz_PCIX_266 = 0x0b,
45 PCI_SPEED_66MHz_PCIX_533 = 0x11,
46 PCI_SPEED_100MHz_PCIX_533 = 0x12,
47 PCI_SPEED_133MHz_PCIX_533 = 0x13,
48 PCI_SPEED_UNKNOWN = 0xff,
49};
50
51/* These values come from the PCI Express Spec */ 31/* These values come from the PCI Express Spec */
52enum pcie_link_width { 32enum pcie_link_width {
53 PCIE_LNK_WIDTH_RESRV = 0x00, 33 PCIE_LNK_WIDTH_RESRV = 0x00,
@@ -61,12 +41,6 @@ enum pcie_link_width {
61 PCIE_LNK_WIDTH_UNKNOWN = 0xFF, 41 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
62}; 42};
63 43
64enum pcie_link_speed {
65 PCIE_2_5GB = 0x14,
66 PCIE_5_0GB = 0x15,
67 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
68};
69
70/** 44/**
71 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use 45 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
72 * @owner: The module owner of this structure 46 * @owner: The module owner of this structure
@@ -89,12 +63,6 @@ enum pcie_link_speed {
89 * @get_adapter_status: Called to get see if an adapter is present in the slot or not. 63 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
90 * If this field is NULL, the value passed in the struct hotplug_slot_info 64 * If this field is NULL, the value passed in the struct hotplug_slot_info
91 * will be used when this value is requested by a user. 65 * will be used when this value is requested by a user.
92 * @get_max_bus_speed: Called to get the max bus speed for a slot.
93 * If this field is NULL, the value passed in the struct hotplug_slot_info
94 * will be used when this value is requested by a user.
95 * @get_cur_bus_speed: Called to get the current bus speed for a slot.
96 * If this field is NULL, the value passed in the struct hotplug_slot_info
97 * will be used when this value is requested by a user.
98 * 66 *
99 * The table of function pointers that is passed to the hotplug pci core by a 67 * The table of function pointers that is passed to the hotplug pci core by a
100 * hotplug pci driver. These functions are called by the hotplug pci core when 68 * hotplug pci driver. These functions are called by the hotplug pci core when
@@ -112,17 +80,14 @@ struct hotplug_slot_ops {
112 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); 80 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
113 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); 81 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
114 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); 82 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
115 int (*get_max_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
116 int (*get_cur_bus_speed) (struct hotplug_slot *slot, enum pci_bus_speed *value);
117}; 83};
118 84
119/** 85/**
120 * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot 86 * struct hotplug_slot_info - used to notify the hotplug pci core of the state of the slot
121 * @power: if power is enabled or not (1/0) 87 * @power_status: if power is enabled or not (1/0)
122 * @attention_status: if the attention light is enabled or not (1/0) 88 * @attention_status: if the attention light is enabled or not (1/0)
123 * @latch_status: if the latch (if any) is open or closed (1/0) 89 * @latch_status: if the latch (if any) is open or closed (1/0)
124 * @adapter_present: if there is a pci board present in the slot or not (1/0) 90 * @adapter_status: if there is a pci board present in the slot or not (1/0)
125 * @address: (domain << 16 | bus << 8 | dev)
126 * 91 *
127 * Used to notify the hotplug pci core of the status of a specific slot. 92 * Used to notify the hotplug pci core of the status of a specific slot.
128 */ 93 */
@@ -131,8 +96,6 @@ struct hotplug_slot_info {
131 u8 attention_status; 96 u8 attention_status;
132 u8 latch_status; 97 u8 latch_status;
133 u8 adapter_status; 98 u8 adapter_status;
134 enum pci_bus_speed max_bus_speed;
135 enum pci_bus_speed cur_bus_speed;
136}; 99};
137 100
138/** 101/**
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index cca8a044e2b6..0be824320580 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2417,6 +2417,9 @@
2417#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 2417#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21
2418#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2418#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2419#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 2419#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2420#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22
2421#define PCI_DEVICE_ID_INTEL_CPT_LPC1 0x1c42
2422#define PCI_DEVICE_ID_INTEL_CPT_LPC2 0x1c43
2420#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2423#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2421#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2424#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2422#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2425#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 228b0b6306b0..0b80c806631f 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -315,6 +315,7 @@ struct sadb_x_kmaddress {
315#define SADB_X_EALG_AES_GCM_ICV12 19 315#define SADB_X_EALG_AES_GCM_ICV12 19
316#define SADB_X_EALG_AES_GCM_ICV16 20 316#define SADB_X_EALG_AES_GCM_ICV16 20
317#define SADB_X_EALG_CAMELLIACBC 22 317#define SADB_X_EALG_CAMELLIACBC 22
318#define SADB_X_EALG_NULL_AES_GMAC 23
318#define SADB_EALG_MAX 253 /* last EALG */ 319#define SADB_EALG_MAX 253 /* last EALG */
319/* private allocations should use 249-255 (RFC2407) */ 320/* private allocations should use 249-255 (RFC2407) */
320#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ 321#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 8227f717c70f..6898985e7b38 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -45,7 +45,7 @@
45 * the insertion of new nodes. There are no nodes with duplicate 45 * the insertion of new nodes. There are no nodes with duplicate
46 * priorites on the list. 46 * priorites on the list.
47 * 47 *
48 * The nodes on the node_list is ordered by priority and can contain 48 * The nodes on the node_list are ordered by priority and can contain
49 * entries which have the same priority. Those entries are ordered 49 * entries which have the same priority. Those entries are ordered
50 * FIFO 50 * FIFO
51 * 51 *
@@ -265,7 +265,7 @@ static inline int plist_node_empty(const struct plist_node *node)
265 * 265 *
266 * Assumes the plist is _not_ empty. 266 * Assumes the plist is _not_ empty.
267 */ 267 */
268static inline struct plist_node* plist_first(const struct plist_head *head) 268static inline struct plist_node *plist_first(const struct plist_head *head)
269{ 269{
270 return list_entry(head->node_list.next, 270 return list_entry(head->node_list.next,
271 struct plist_node, plist.node_list); 271 struct plist_node, plist.node_list);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 198b8f9fe05e..e80df06ad22a 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -26,6 +26,7 @@
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/timer.h> 28#include <linux/timer.h>
29#include <linux/completion.h>
29 30
30/* 31/*
31 * Callbacks for platform drivers to implement. 32 * Callbacks for platform drivers to implement.
@@ -412,9 +413,11 @@ struct dev_pm_info {
412 pm_message_t power_state; 413 pm_message_t power_state;
413 unsigned int can_wakeup:1; 414 unsigned int can_wakeup:1;
414 unsigned int should_wakeup:1; 415 unsigned int should_wakeup:1;
416 unsigned async_suspend:1;
415 enum dpm_state status; /* Owned by the PM core */ 417 enum dpm_state status; /* Owned by the PM core */
416#ifdef CONFIG_PM_SLEEP 418#ifdef CONFIG_PM_SLEEP
417 struct list_head entry; 419 struct list_head entry;
420 struct completion completion;
418#endif 421#endif
419#ifdef CONFIG_PM_RUNTIME 422#ifdef CONFIG_PM_RUNTIME
420 struct timer_list suspend_timer; 423 struct timer_list suspend_timer;
@@ -430,6 +433,7 @@ struct dev_pm_info {
430 unsigned int request_pending:1; 433 unsigned int request_pending:1;
431 unsigned int deferred_resume:1; 434 unsigned int deferred_resume:1;
432 unsigned int run_wake:1; 435 unsigned int run_wake:1;
436 unsigned int runtime_auto:1;
433 enum rpm_request request; 437 enum rpm_request request;
434 enum rpm_status runtime_status; 438 enum rpm_status runtime_status;
435 int runtime_error; 439 int runtime_error;
@@ -508,6 +512,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
508 __suspend_report_result(__func__, fn, ret); \ 512 __suspend_report_result(__func__, fn, ret); \
509 } while (0) 513 } while (0)
510 514
515extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
511#else /* !CONFIG_PM_SLEEP */ 516#else /* !CONFIG_PM_SLEEP */
512 517
513#define device_pm_lock() do {} while (0) 518#define device_pm_lock() do {} while (0)
@@ -520,6 +525,7 @@ static inline int dpm_suspend_start(pm_message_t state)
520 525
521#define suspend_report_result(fn, ret) do {} while (0) 526#define suspend_report_result(fn, ret) do {} while (0)
522 527
528static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
523#endif /* !CONFIG_PM_SLEEP */ 529#endif /* !CONFIG_PM_SLEEP */
524 530
525/* How to reorder dpm_list after device_move() */ 531/* How to reorder dpm_list after device_move() */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 370ce0a6fe4a..7d773aac5314 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -28,6 +28,8 @@ extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
28extern int pm_runtime_barrier(struct device *dev); 28extern int pm_runtime_barrier(struct device *dev);
29extern void pm_runtime_enable(struct device *dev); 29extern void pm_runtime_enable(struct device *dev);
30extern void __pm_runtime_disable(struct device *dev, bool check_resume); 30extern void __pm_runtime_disable(struct device *dev, bool check_resume);
31extern void pm_runtime_allow(struct device *dev);
32extern void pm_runtime_forbid(struct device *dev);
31 33
32static inline bool pm_children_suspended(struct device *dev) 34static inline bool pm_children_suspended(struct device *dev)
33{ 35{
@@ -78,6 +80,8 @@ static inline int __pm_runtime_set_status(struct device *dev,
78static inline int pm_runtime_barrier(struct device *dev) { return 0; } 80static inline int pm_runtime_barrier(struct device *dev) { return 0; }
79static inline void pm_runtime_enable(struct device *dev) {} 81static inline void pm_runtime_enable(struct device *dev) {}
80static inline void __pm_runtime_disable(struct device *dev, bool c) {} 82static inline void __pm_runtime_disable(struct device *dev, bool c) {}
83static inline void pm_runtime_allow(struct device *dev) {}
84static inline void pm_runtime_forbid(struct device *dev) {}
81 85
82static inline bool pm_children_suspended(struct device *dev) { return false; } 86static inline bool pm_children_suspended(struct device *dev) { return false; }
83static inline void pm_suspend_ignore_children(struct device *dev, bool en) {} 87static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index 6b537f1ac96c..31e1ff69efc8 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -32,6 +32,7 @@ enum raid_level {
32 RAID_LEVEL_0, 32 RAID_LEVEL_0,
33 RAID_LEVEL_1, 33 RAID_LEVEL_1,
34 RAID_LEVEL_10, 34 RAID_LEVEL_10,
35 RAID_LEVEL_1E,
35 RAID_LEVEL_3, 36 RAID_LEVEL_3,
36 RAID_LEVEL_4, 37 RAID_LEVEL_4,
37 RAID_LEVEL_5, 38 RAID_LEVEL_5,
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 1bf0f708c4fc..779d70749beb 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -208,7 +208,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
208 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 208 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
209 */ 209 */
210#define list_entry_rcu(ptr, type, member) \ 210#define list_entry_rcu(ptr, type, member) \
211 container_of(rcu_dereference(ptr), type, member) 211 container_of(rcu_dereference_raw(ptr), type, member)
212 212
213/** 213/**
214 * list_first_entry_rcu - get the first element from a list 214 * list_first_entry_rcu - get the first element from a list
@@ -225,9 +225,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
225 list_entry_rcu((ptr)->next, type, member) 225 list_entry_rcu((ptr)->next, type, member)
226 226
227#define __list_for_each_rcu(pos, head) \ 227#define __list_for_each_rcu(pos, head) \
228 for (pos = rcu_dereference((head)->next); \ 228 for (pos = rcu_dereference_raw((head)->next); \
229 pos != (head); \ 229 pos != (head); \
230 pos = rcu_dereference(pos->next)) 230 pos = rcu_dereference_raw(pos->next))
231 231
232/** 232/**
233 * list_for_each_entry_rcu - iterate over rcu list of given type 233 * list_for_each_entry_rcu - iterate over rcu list of given type
@@ -257,9 +257,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
257 * as long as the traversal is guarded by rcu_read_lock(). 257 * as long as the traversal is guarded by rcu_read_lock().
258 */ 258 */
259#define list_for_each_continue_rcu(pos, head) \ 259#define list_for_each_continue_rcu(pos, head) \
260 for ((pos) = rcu_dereference((pos)->next); \ 260 for ((pos) = rcu_dereference_raw((pos)->next); \
261 prefetch((pos)->next), (pos) != (head); \ 261 prefetch((pos)->next), (pos) != (head); \
262 (pos) = rcu_dereference((pos)->next)) 262 (pos) = rcu_dereference_raw((pos)->next))
263 263
264/** 264/**
265 * list_for_each_entry_continue_rcu - continue iteration over list of given type 265 * list_for_each_entry_continue_rcu - continue iteration over list of given type
@@ -418,10 +418,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
418 * as long as the traversal is guarded by rcu_read_lock(). 418 * as long as the traversal is guarded by rcu_read_lock().
419 */ 419 */
420#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 420#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
421 for (pos = rcu_dereference((head)->first); \ 421 for (pos = rcu_dereference_raw((head)->first); \
422 pos && ({ prefetch(pos->next); 1; }) && \ 422 pos && ({ prefetch(pos->next); 1; }) && \
423 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 423 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
424 pos = rcu_dereference(pos->next)) 424 pos = rcu_dereference_raw(pos->next))
425 425
426#endif /* __KERNEL__ */ 426#endif /* __KERNEL__ */
427#endif 427#endif
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index 589a40919f01..b70ffe53cb9f 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -101,10 +101,10 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
101 * 101 *
102 */ 102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ 103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \ 104 for (pos = rcu_dereference_raw((head)->first); \
105 (!is_a_nulls(pos)) && \ 105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ 106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next)) 107 pos = rcu_dereference_raw(pos->next))
108 108
109#endif 109#endif
110#endif 110#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 24440f4bf476..c84373626336 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -62,6 +62,8 @@ extern int sched_expedited_torture_stats(char *page);
62 62
63/* Internal to kernel */ 63/* Internal to kernel */
64extern void rcu_init(void); 64extern void rcu_init(void);
65extern int rcu_scheduler_active;
66extern void rcu_scheduler_starting(void);
65 67
66#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 68#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
67#include <linux/rcutree.h> 69#include <linux/rcutree.h>
@@ -78,14 +80,120 @@ extern void rcu_init(void);
78} while (0) 80} while (0)
79 81
80#ifdef CONFIG_DEBUG_LOCK_ALLOC 82#ifdef CONFIG_DEBUG_LOCK_ALLOC
83
81extern struct lockdep_map rcu_lock_map; 84extern struct lockdep_map rcu_lock_map;
82# define rcu_read_acquire() \ 85# define rcu_read_acquire() \
83 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) 86 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
84# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 87# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
85#else 88
86# define rcu_read_acquire() do { } while (0) 89extern struct lockdep_map rcu_bh_lock_map;
87# define rcu_read_release() do { } while (0) 90# define rcu_read_acquire_bh() \
88#endif 91 lock_acquire(&rcu_bh_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
92# define rcu_read_release_bh() lock_release(&rcu_bh_lock_map, 1, _THIS_IP_)
93
94extern struct lockdep_map rcu_sched_lock_map;
95# define rcu_read_acquire_sched() \
96 lock_acquire(&rcu_sched_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
97# define rcu_read_release_sched() \
98 lock_release(&rcu_sched_lock_map, 1, _THIS_IP_)
99
100/**
101 * rcu_read_lock_held - might we be in RCU read-side critical section?
102 *
103 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
104 * an RCU read-side critical section. In absence of CONFIG_PROVE_LOCKING,
105 * this assumes we are in an RCU read-side critical section unless it can
106 * prove otherwise.
107 */
108static inline int rcu_read_lock_held(void)
109{
110 if (debug_locks)
111 return lock_is_held(&rcu_lock_map);
112 return 1;
113}
114
115/**
116 * rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section?
117 *
118 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
119 * an RCU-bh read-side critical section. In absence of CONFIG_PROVE_LOCKING,
120 * this assumes we are in an RCU-bh read-side critical section unless it can
121 * prove otherwise.
122 */
123static inline int rcu_read_lock_bh_held(void)
124{
125 if (debug_locks)
126 return lock_is_held(&rcu_bh_lock_map);
127 return 1;
128}
129
130/**
131 * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
132 *
133 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an
134 * RCU-sched read-side critical section. In absence of CONFIG_PROVE_LOCKING,
135 * this assumes we are in an RCU-sched read-side critical section unless it
136 * can prove otherwise. Note that disabling of preemption (including
137 * disabling irqs) counts as an RCU-sched read-side critical section.
138 */
139static inline int rcu_read_lock_sched_held(void)
140{
141 int lockdep_opinion = 0;
142
143 if (debug_locks)
144 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
145 return lockdep_opinion || preempt_count() != 0 || !rcu_scheduler_active;
146}
147
148#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
149
150# define rcu_read_acquire() do { } while (0)
151# define rcu_read_release() do { } while (0)
152# define rcu_read_acquire_bh() do { } while (0)
153# define rcu_read_release_bh() do { } while (0)
154# define rcu_read_acquire_sched() do { } while (0)
155# define rcu_read_release_sched() do { } while (0)
156
157static inline int rcu_read_lock_held(void)
158{
159 return 1;
160}
161
162static inline int rcu_read_lock_bh_held(void)
163{
164 return 1;
165}
166
167static inline int rcu_read_lock_sched_held(void)
168{
169 return preempt_count() != 0 || !rcu_scheduler_active;
170}
171
172#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
173
174#ifdef CONFIG_PROVE_RCU
175
176/**
177 * rcu_dereference_check - rcu_dereference with debug checking
178 *
179 * Do an rcu_dereference(), but check that the context is correct.
180 * For example, rcu_dereference_check(gp, rcu_read_lock_held()) to
181 * ensure that the rcu_dereference_check() executes within an RCU
182 * read-side critical section. It is also possible to check for
183 * locks being held, for example, by using lockdep_is_held().
184 */
185#define rcu_dereference_check(p, c) \
186 ({ \
187 if (debug_locks && !(c)) \
188 lockdep_rcu_dereference(__FILE__, __LINE__); \
189 rcu_dereference_raw(p); \
190 })
191
192#else /* #ifdef CONFIG_PROVE_RCU */
193
194#define rcu_dereference_check(p, c) rcu_dereference_raw(p)
195
196#endif /* #else #ifdef CONFIG_PROVE_RCU */
89 197
90/** 198/**
91 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 199 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
@@ -160,7 +268,7 @@ static inline void rcu_read_lock_bh(void)
160{ 268{
161 __rcu_read_lock_bh(); 269 __rcu_read_lock_bh();
162 __acquire(RCU_BH); 270 __acquire(RCU_BH);
163 rcu_read_acquire(); 271 rcu_read_acquire_bh();
164} 272}
165 273
166/* 274/*
@@ -170,7 +278,7 @@ static inline void rcu_read_lock_bh(void)
170 */ 278 */
171static inline void rcu_read_unlock_bh(void) 279static inline void rcu_read_unlock_bh(void)
172{ 280{
173 rcu_read_release(); 281 rcu_read_release_bh();
174 __release(RCU_BH); 282 __release(RCU_BH);
175 __rcu_read_unlock_bh(); 283 __rcu_read_unlock_bh();
176} 284}
@@ -188,7 +296,7 @@ static inline void rcu_read_lock_sched(void)
188{ 296{
189 preempt_disable(); 297 preempt_disable();
190 __acquire(RCU_SCHED); 298 __acquire(RCU_SCHED);
191 rcu_read_acquire(); 299 rcu_read_acquire_sched();
192} 300}
193 301
194/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 302/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -205,7 +313,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
205 */ 313 */
206static inline void rcu_read_unlock_sched(void) 314static inline void rcu_read_unlock_sched(void)
207{ 315{
208 rcu_read_release(); 316 rcu_read_release_sched();
209 __release(RCU_SCHED); 317 __release(RCU_SCHED);
210 preempt_enable(); 318 preempt_enable();
211} 319}
@@ -219,22 +327,49 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
219 327
220 328
221/** 329/**
222 * rcu_dereference - fetch an RCU-protected pointer in an 330 * rcu_dereference_raw - fetch an RCU-protected pointer
223 * RCU read-side critical section. This pointer may later 331 *
224 * be safely dereferenced. 332 * The caller must be within some flavor of RCU read-side critical
333 * section, or must be otherwise preventing the pointer from changing,
334 * for example, by holding an appropriate lock. This pointer may later
335 * be safely dereferenced. It is the caller's responsibility to have
336 * done the right thing, as this primitive does no checking of any kind.
225 * 337 *
226 * Inserts memory barriers on architectures that require them 338 * Inserts memory barriers on architectures that require them
227 * (currently only the Alpha), and, more importantly, documents 339 * (currently only the Alpha), and, more importantly, documents
228 * exactly which pointers are protected by RCU. 340 * exactly which pointers are protected by RCU.
229 */ 341 */
230 342#define rcu_dereference_raw(p) ({ \
231#define rcu_dereference(p) ({ \
232 typeof(p) _________p1 = ACCESS_ONCE(p); \ 343 typeof(p) _________p1 = ACCESS_ONCE(p); \
233 smp_read_barrier_depends(); \ 344 smp_read_barrier_depends(); \
234 (_________p1); \ 345 (_________p1); \
235 }) 346 })
236 347
237/** 348/**
349 * rcu_dereference - fetch an RCU-protected pointer, checking for RCU
350 *
351 * Makes rcu_dereference_check() do the dirty work.
352 */
353#define rcu_dereference(p) \
354 rcu_dereference_check(p, rcu_read_lock_held())
355
356/**
357 * rcu_dereference_bh - fetch an RCU-protected pointer, checking for RCU-bh
358 *
359 * Makes rcu_dereference_check() do the dirty work.
360 */
361#define rcu_dereference_bh(p) \
362 rcu_dereference_check(p, rcu_read_lock_bh_held())
363
364/**
365 * rcu_dereference_sched - fetch RCU-protected pointer, checking for RCU-sched
366 *
367 * Makes rcu_dereference_check() do the dirty work.
368 */
369#define rcu_dereference_sched(p) \
370 rcu_dereference_check(p, rcu_read_lock_sched_held())
371
372/**
238 * rcu_assign_pointer - assign (publicize) a pointer to a newly 373 * rcu_assign_pointer - assign (publicize) a pointer to a newly
239 * initialized structure that will be dereferenced by RCU read-side 374 * initialized structure that will be dereferenced by RCU read-side
240 * critical sections. Returns the value assigned. 375 * critical sections. Returns the value assigned.
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 96cc307ed9f4..a5195875480a 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -62,6 +62,18 @@ static inline long rcu_batches_completed_bh(void)
62 62
63extern int rcu_expedited_torture_stats(char *page); 63extern int rcu_expedited_torture_stats(char *page);
64 64
65static inline void rcu_force_quiescent_state(void)
66{
67}
68
69static inline void rcu_bh_force_quiescent_state(void)
70{
71}
72
73static inline void rcu_sched_force_quiescent_state(void)
74{
75}
76
65#define synchronize_rcu synchronize_sched 77#define synchronize_rcu synchronize_sched
66 78
67static inline void synchronize_rcu_expedited(void) 79static inline void synchronize_rcu_expedited(void)
@@ -93,10 +105,6 @@ static inline void rcu_exit_nohz(void)
93 105
94#endif /* #else #ifdef CONFIG_NO_HZ */ 106#endif /* #else #ifdef CONFIG_NO_HZ */
95 107
96static inline void rcu_scheduler_starting(void)
97{
98}
99
100static inline void exit_rcu(void) 108static inline void exit_rcu(void)
101{ 109{
102} 110}
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 8044b1b94333..42cc3a04779e 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -35,7 +35,6 @@ struct notifier_block;
35extern void rcu_sched_qs(int cpu); 35extern void rcu_sched_qs(int cpu);
36extern void rcu_bh_qs(int cpu); 36extern void rcu_bh_qs(int cpu);
37extern int rcu_needs_cpu(int cpu); 37extern int rcu_needs_cpu(int cpu);
38extern void rcu_scheduler_starting(void);
39extern int rcu_expedited_torture_stats(char *page); 38extern int rcu_expedited_torture_stats(char *page);
40 39
41#ifdef CONFIG_TREE_PREEMPT_RCU 40#ifdef CONFIG_TREE_PREEMPT_RCU
@@ -99,6 +98,9 @@ extern void rcu_check_callbacks(int cpu, int user);
99extern long rcu_batches_completed(void); 98extern long rcu_batches_completed(void);
100extern long rcu_batches_completed_bh(void); 99extern long rcu_batches_completed_bh(void);
101extern long rcu_batches_completed_sched(void); 100extern long rcu_batches_completed_sched(void);
101extern void rcu_force_quiescent_state(void);
102extern void rcu_bh_force_quiescent_state(void);
103extern void rcu_sched_force_quiescent_state(void);
102 104
103#ifdef CONFIG_NO_HZ 105#ifdef CONFIG_NO_HZ
104void rcu_enter_nohz(void); 106void rcu_enter_nohz(void);
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index c9ba2fdf807d..bc8c3881c729 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -6,6 +6,11 @@
6 6
7extern int pm_trace_enabled; 7extern int pm_trace_enabled;
8 8
9static inline int pm_trace_is_enabled(void)
10{
11 return pm_trace_enabled;
12}
13
9struct device; 14struct device;
10extern void set_trace_device(struct device *); 15extern void set_trace_device(struct device *);
11extern void generate_resume_trace(const void *tracedata, unsigned int user); 16extern void generate_resume_trace(const void *tracedata, unsigned int user);
@@ -17,6 +22,8 @@ extern void generate_resume_trace(const void *tracedata, unsigned int user);
17 22
18#else 23#else
19 24
25static inline int pm_trace_is_enabled(void) { return 0; }
26
20#define TRACE_DEVICE(dev) do { } while (0) 27#define TRACE_DEVICE(dev) do { } while (0)
21#define TRACE_RESUME(dev) do { } while (0) 28#define TRACE_RESUME(dev) do { } while (0)
22 29
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 05330fc5b436..5c52fa43785c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -735,6 +735,9 @@ extern void rtnl_lock(void);
735extern void rtnl_unlock(void); 735extern void rtnl_unlock(void);
736extern int rtnl_trylock(void); 736extern int rtnl_trylock(void);
737extern int rtnl_is_locked(void); 737extern int rtnl_is_locked(void);
738#ifdef CONFIG_PROVE_LOCKING
739extern int lockdep_rtnl_is_held(void);
740#endif /* #ifdef CONFIG_PROVE_LOCKING */
738 741
739extern void rtnetlink_init(void); 742extern void rtnetlink_init(void);
740extern void __rtnl_unlock(void); 743extern void __rtnl_unlock(void);
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 4ef246f14654..51d288d8ac88 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -45,7 +45,7 @@ struct intc_sense_reg {
45#define INTC_SMP(stride, nr) 45#define INTC_SMP(stride, nr)
46#endif 46#endif
47 47
48struct intc_desc { 48struct intc_hw_desc {
49 struct intc_vect *vectors; 49 struct intc_vect *vectors;
50 unsigned int nr_vectors; 50 unsigned int nr_vectors;
51 struct intc_group *groups; 51 struct intc_group *groups;
@@ -56,29 +56,40 @@ struct intc_desc {
56 unsigned int nr_prio_regs; 56 unsigned int nr_prio_regs;
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;
60 struct intc_mask_reg *ack_regs; 59 struct intc_mask_reg *ack_regs;
61 unsigned int nr_ack_regs; 60 unsigned int nr_ack_regs;
62}; 61};
63 62
64#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) 63#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
64#define INTC_HW_DESC(vectors, groups, mask_regs, \
65 prio_regs, sense_regs, ack_regs) \
66{ \
67 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
68 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
69 _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \
70}
71
72struct intc_desc {
73 char *name;
74 intc_enum force_enable;
75 intc_enum force_disable;
76 struct intc_hw_desc hw;
77};
78
65#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \ 79#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
66 mask_regs, prio_regs, sense_regs) \ 80 mask_regs, prio_regs, sense_regs) \
67struct intc_desc symbol __initdata = { \ 81struct intc_desc symbol __initdata = { \
68 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ 82 .name = chipname, \
69 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ 83 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
70 _INTC_ARRAY(sense_regs), \ 84 prio_regs, sense_regs, NULL), \
71 chipname, \
72} 85}
73 86
74#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ 87#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
75 mask_regs, prio_regs, sense_regs, ack_regs) \ 88 mask_regs, prio_regs, sense_regs, ack_regs) \
76struct intc_desc symbol __initdata = { \ 89struct intc_desc symbol __initdata = { \
77 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ 90 .name = chipname, \
78 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ 91 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
79 _INTC_ARRAY(sense_regs), \ 92 prio_regs, sense_regs, ack_regs), \
80 chipname, \
81 _INTC_ARRAY(ack_regs), \
82} 93}
83 94
84void __init register_intc_controller(struct intc_desc *desc); 95void __init register_intc_controller(struct intc_desc *desc);
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h
index 51b3e771a9a3..cc813f95a2f2 100644
--- a/include/linux/spi/dw_spi.h
+++ b/include/linux/spi/dw_spi.h
@@ -90,6 +90,7 @@ struct dw_spi {
90 unsigned long paddr; 90 unsigned long paddr;
91 u32 iolen; 91 u32 iolen;
92 int irq; 92 int irq;
93 u32 fifo_len; /* depth of the FIFO buffer */
93 u32 max_freq; /* max bus freq supported */ 94 u32 max_freq; /* max bus freq supported */
94 95
95 u16 bus_num; 96 u16 bus_num;
@@ -171,6 +172,10 @@ static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
171{ 172{
172 if (cs > dws->num_cs) 173 if (cs > dws->num_cs)
173 return; 174 return;
175
176 if (dws->cs_control)
177 dws->cs_control(1);
178
174 dw_writel(dws, ser, 1 << cs); 179 dw_writel(dws, ser, 1 << cs);
175} 180}
176 181
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 4765d97dcafb..3084f80909cd 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -35,6 +35,9 @@ struct srcu_struct {
35 int completed; 35 int completed;
36 struct srcu_struct_array *per_cpu_ref; 36 struct srcu_struct_array *per_cpu_ref;
37 struct mutex mutex; 37 struct mutex mutex;
38#ifdef CONFIG_DEBUG_LOCK_ALLOC
39 struct lockdep_map dep_map;
40#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
38}; 41};
39 42
40#ifndef CONFIG_PREEMPT 43#ifndef CONFIG_PREEMPT
@@ -43,12 +46,100 @@ struct srcu_struct {
43#define srcu_barrier() 46#define srcu_barrier()
44#endif /* #else #ifndef CONFIG_PREEMPT */ 47#endif /* #else #ifndef CONFIG_PREEMPT */
45 48
49#ifdef CONFIG_DEBUG_LOCK_ALLOC
50
51int __init_srcu_struct(struct srcu_struct *sp, const char *name,
52 struct lock_class_key *key);
53
54#define init_srcu_struct(sp) \
55({ \
56 static struct lock_class_key __srcu_key; \
57 \
58 __init_srcu_struct((sp), #sp, &__srcu_key); \
59})
60
61# define srcu_read_acquire(sp) \
62 lock_acquire(&(sp)->dep_map, 0, 0, 2, 1, NULL, _THIS_IP_)
63# define srcu_read_release(sp) \
64 lock_release(&(sp)->dep_map, 1, _THIS_IP_)
65
66#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
67
46int init_srcu_struct(struct srcu_struct *sp); 68int init_srcu_struct(struct srcu_struct *sp);
69
70# define srcu_read_acquire(sp) do { } while (0)
71# define srcu_read_release(sp) do { } while (0)
72
73#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
74
47void cleanup_srcu_struct(struct srcu_struct *sp); 75void cleanup_srcu_struct(struct srcu_struct *sp);
48int srcu_read_lock(struct srcu_struct *sp) __acquires(sp); 76int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
49void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); 77void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
50void synchronize_srcu(struct srcu_struct *sp); 78void synchronize_srcu(struct srcu_struct *sp);
51void synchronize_srcu_expedited(struct srcu_struct *sp); 79void synchronize_srcu_expedited(struct srcu_struct *sp);
52long srcu_batches_completed(struct srcu_struct *sp); 80long srcu_batches_completed(struct srcu_struct *sp);
53 81
82#ifdef CONFIG_DEBUG_LOCK_ALLOC
83
84/**
85 * srcu_read_lock_held - might we be in SRCU read-side critical section?
86 *
87 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in
88 * an SRCU read-side critical section. In absence of CONFIG_PROVE_LOCKING,
89 * this assumes we are in an SRCU read-side critical section unless it can
90 * prove otherwise.
91 */
92static inline int srcu_read_lock_held(struct srcu_struct *sp)
93{
94 if (debug_locks)
95 return lock_is_held(&sp->dep_map);
96 return 1;
97}
98
99#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
100
101static inline int srcu_read_lock_held(struct srcu_struct *sp)
102{
103 return 1;
104}
105
106#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
107
108/**
109 * srcu_dereference - fetch SRCU-protected pointer with checking
110 *
111 * Makes rcu_dereference_check() do the dirty work.
112 */
113#define srcu_dereference(p, sp) \
114 rcu_dereference_check(p, srcu_read_lock_held(sp))
115
116/**
117 * srcu_read_lock - register a new reader for an SRCU-protected structure.
118 * @sp: srcu_struct in which to register the new reader.
119 *
120 * Enter an SRCU read-side critical section. Note that SRCU read-side
121 * critical sections may be nested.
122 */
123static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
124{
125 int retval = __srcu_read_lock(sp);
126
127 srcu_read_acquire(sp);
128 return retval;
129}
130
131/**
132 * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
133 * @sp: srcu_struct in which to unregister the old reader.
134 * @idx: return value from corresponding srcu_read_lock().
135 *
136 * Exit an SRCU read-side critical section.
137 */
138static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
139 __releases(sp)
140{
141 srcu_read_release(sp);
142 __srcu_read_unlock(sp, idx);
143}
144
54#endif 145#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d7ace1b80f09..332eaea61021 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -339,6 +339,7 @@ struct usb_bus {
339 339
340 struct usb_devmap devmap; /* device address allocation map */ 340 struct usb_devmap devmap; /* device address allocation map */
341 struct usb_device *root_hub; /* Root hub */ 341 struct usb_device *root_hub; /* Root hub */
342 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */
342 struct list_head bus_list; /* list of busses */ 343 struct list_head bus_list; /* list of busses */
343 344
344 int bandwidth_allocated; /* on this bus: how much of the time 345 int bandwidth_allocated; /* on this bus: how much of the time
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index d4962a782b8a..3793d168b44d 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -350,6 +350,7 @@ struct v4l2_pix_format {
350#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ 350#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
351 351
352/* Vendor-specific formats */ 352/* Vendor-specific formats */
353#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
353#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ 354#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
354#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ 355#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
355#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ 356#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
@@ -362,6 +363,7 @@ struct v4l2_pix_format {
362#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ 363#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
363#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ 364#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
364#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 365#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
366#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
365#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 367#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
366#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 368#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
367#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 369#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 057a2e010758..f508c651e53d 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -51,6 +51,9 @@ struct virtqueue {
51 * This re-enables callbacks; it returns "false" if there are pending 51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver 52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks. 53 * checking for more work, and enabling callbacks.
54 * @detach_unused_buf: detach first unused buffer
55 * vq: the struct virtqueue we're talking about.
56 * Returns NULL or the "data" token handed to add_buf
54 * 57 *
55 * Locking rules are straightforward: the driver is responsible for 58 * Locking rules are straightforward: the driver is responsible for
56 * locking. No two operations may be invoked simultaneously, with the exception 59 * locking. No two operations may be invoked simultaneously, with the exception
@@ -71,6 +74,7 @@ struct virtqueue_ops {
71 74
72 void (*disable_cb)(struct virtqueue *vq); 75 void (*disable_cb)(struct virtqueue *vq);
73 bool (*enable_cb)(struct virtqueue *vq); 76 bool (*enable_cb)(struct virtqueue *vq);
77 void *(*detach_unused_buf)(struct virtqueue *vq);
74}; 78};
75 79
76/** 80/**
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 1418f048cb34..a50ecd1b81a2 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -7,6 +7,7 @@
7 7
8/* The feature bitmap for virtio balloon */ 8/* The feature bitmap for virtio balloon */
9#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ 9#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
10#define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */
10 11
11/* Size of a PFN in the balloon interface. */ 12/* Size of a PFN in the balloon interface. */
12#define VIRTIO_BALLOON_PFN_SHIFT 12 13#define VIRTIO_BALLOON_PFN_SHIFT 12
@@ -18,4 +19,18 @@ struct virtio_balloon_config
18 /* Number of pages we've actually got in balloon. */ 19 /* Number of pages we've actually got in balloon. */
19 __le32 actual; 20 __le32 actual;
20}; 21};
22
23#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */
24#define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */
25#define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */
26#define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */
27#define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */
28#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */
29#define VIRTIO_BALLOON_S_NR 6
30
31struct virtio_balloon_stat {
32 u16 tag;
33 u64 val;
34} __attribute__((packed));
35
21#endif /* _LINUX_VIRTIO_BALLOON_H */ 36#endif /* _LINUX_VIRTIO_BALLOON_H */
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index fd294c56d571..e52029e98919 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -15,6 +15,7 @@
15#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 15#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
18#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
18 19
19struct virtio_blk_config { 20struct virtio_blk_config {
20 /* The capacity (in 512-byte sectors). */ 21 /* The capacity (in 512-byte sectors). */
@@ -29,8 +30,20 @@ struct virtio_blk_config {
29 __u8 heads; 30 __u8 heads;
30 __u8 sectors; 31 __u8 sectors;
31 } geometry; 32 } geometry;
33
32 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ 34 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
33 __u32 blk_size; 35 __u32 blk_size;
36
37 /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */
38 /* exponent for physical block per logical block. */
39 __u8 physical_block_exp;
40 /* alignment offset in logical blocks. */
41 __u8 alignment_offset;
42 /* minimum I/O size without performance penalty in logical blocks. */
43 __u16 min_io_size;
44 /* optimal sustained I/O size in logical blocks. */
45 __u32 opt_io_size;
46
34} __attribute__((packed)); 47} __attribute__((packed));
35 48
36/* 49/*
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index fe885174cc1f..ae4f039515b4 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -3,19 +3,45 @@
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/virtio_ids.h> 4#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
6/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 6/*
7 * anyone can use the definitions to implement compatible drivers/servers. */ 7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
8 * anyone can use the definitions to implement compatible drivers/servers.
9 *
10 * Copyright (C) Red Hat, Inc., 2009, 2010
11 */
8 12
9/* Feature bits */ 13/* Feature bits */
10#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 14#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
15#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
11 16
12struct virtio_console_config { 17struct virtio_console_config {
13 /* colums of the screens */ 18 /* colums of the screens */
14 __u16 cols; 19 __u16 cols;
15 /* rows of the screens */ 20 /* rows of the screens */
16 __u16 rows; 21 __u16 rows;
22 /* max. number of ports this device can hold */
23 __u32 max_nr_ports;
24 /* number of ports added so far */
25 __u32 nr_ports;
17} __attribute__((packed)); 26} __attribute__((packed));
18 27
28/*
29 * A message that's passed between the Host and the Guest for a
30 * particular port.
31 */
32struct virtio_console_control {
33 __u32 id; /* Port number */
34 __u16 event; /* The kind of control event (see below) */
35 __u16 value; /* Extra information for the key */
36};
37
38/* Some events for control messages */
39#define VIRTIO_CONSOLE_PORT_READY 0
40#define VIRTIO_CONSOLE_CONSOLE_PORT 1
41#define VIRTIO_CONSOLE_RESIZE 2
42#define VIRTIO_CONSOLE_PORT_OPEN 3
43#define VIRTIO_CONSOLE_PORT_NAME 4
44#define VIRTIO_CONSOLE_PORT_REMOVE 5
19 45
20#ifdef __KERNEL__ 46#ifdef __KERNEL__
21int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 47int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));