diff options
Diffstat (limited to 'include/linux')
343 files changed, 9538 insertions, 4523 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index bcbdd7484e58..17b5b5967641 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -152,15 +152,6 @@ void acpi_penalize_isa_irq(int irq, int active); | |||
152 | 152 | ||
153 | void acpi_pci_irq_disable (struct pci_dev *dev); | 153 | void acpi_pci_irq_disable (struct pci_dev *dev); |
154 | 154 | ||
155 | struct acpi_pci_driver { | ||
156 | struct list_head node; | ||
157 | int (*add)(struct acpi_pci_root *root); | ||
158 | void (*remove)(struct acpi_pci_root *root); | ||
159 | }; | ||
160 | |||
161 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); | ||
162 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); | ||
163 | |||
164 | extern int ec_read(u8 addr, u8 *val); | 155 | extern int ec_read(u8 addr, u8 *val); |
165 | extern int ec_write(u8 addr, u8 val); | 156 | extern int ec_write(u8 addr, u8 val); |
166 | extern int ec_transaction(u8 command, | 157 | extern int ec_transaction(u8 command, |
@@ -204,7 +195,7 @@ extern bool wmi_has_guid(const char *guid); | |||
204 | #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) | 195 | #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) |
205 | 196 | ||
206 | extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); | 197 | extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); |
207 | extern long acpi_is_video_device(struct acpi_device *device); | 198 | extern long acpi_is_video_device(acpi_handle handle); |
208 | extern void acpi_video_dmi_promote_vendor(void); | 199 | extern void acpi_video_dmi_promote_vendor(void); |
209 | extern void acpi_video_dmi_demote_vendor(void); | 200 | extern void acpi_video_dmi_demote_vendor(void); |
210 | extern int acpi_video_backlight_support(void); | 201 | extern int acpi_video_backlight_support(void); |
@@ -217,7 +208,7 @@ static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle) | |||
217 | return 0; | 208 | return 0; |
218 | } | 209 | } |
219 | 210 | ||
220 | static inline long acpi_is_video_device(struct acpi_device *device) | 211 | static inline long acpi_is_video_device(acpi_handle handle) |
221 | { | 212 | { |
222 | return 0; | 213 | return 0; |
223 | } | 214 | } |
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h new file mode 100644 index 000000000000..d09deabc7bf6 --- /dev/null +++ b/include/linux/acpi_dma.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * ACPI helpers for DMA request / controller | ||
3 | * | ||
4 | * Based on of_dma.h | ||
5 | * | ||
6 | * Copyright (C) 2013, Intel Corporation | ||
7 | * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_ACPI_DMA_H | ||
15 | #define __LINUX_ACPI_DMA_H | ||
16 | |||
17 | #include <linux/list.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/dmaengine.h> | ||
20 | |||
21 | /** | ||
22 | * struct acpi_dma_spec - slave device DMA resources | ||
23 | * @chan_id: channel unique id | ||
24 | * @slave_id: request line unique id | ||
25 | * @dev: struct device of the DMA controller to be used in the filter | ||
26 | * function | ||
27 | */ | ||
28 | struct acpi_dma_spec { | ||
29 | int chan_id; | ||
30 | int slave_id; | ||
31 | struct device *dev; | ||
32 | }; | ||
33 | |||
34 | /** | ||
35 | * struct acpi_dma - representation of the registered DMAC | ||
36 | * @dma_controllers: linked list node | ||
37 | * @dev: struct device of this controller | ||
38 | * @acpi_dma_xlate: callback function to find a suitable channel | ||
39 | * @data: private data used by a callback function | ||
40 | */ | ||
41 | struct acpi_dma { | ||
42 | struct list_head dma_controllers; | ||
43 | struct device *dev; | ||
44 | struct dma_chan *(*acpi_dma_xlate) | ||
45 | (struct acpi_dma_spec *, struct acpi_dma *); | ||
46 | void *data; | ||
47 | }; | ||
48 | |||
49 | /* Used with acpi_dma_simple_xlate() */ | ||
50 | struct acpi_dma_filter_info { | ||
51 | dma_cap_mask_t dma_cap; | ||
52 | dma_filter_fn filter_fn; | ||
53 | }; | ||
54 | |||
55 | #ifdef CONFIG_DMA_ACPI | ||
56 | |||
57 | int acpi_dma_controller_register(struct device *dev, | ||
58 | struct dma_chan *(*acpi_dma_xlate) | ||
59 | (struct acpi_dma_spec *, struct acpi_dma *), | ||
60 | void *data); | ||
61 | int acpi_dma_controller_free(struct device *dev); | ||
62 | int devm_acpi_dma_controller_register(struct device *dev, | ||
63 | struct dma_chan *(*acpi_dma_xlate) | ||
64 | (struct acpi_dma_spec *, struct acpi_dma *), | ||
65 | void *data); | ||
66 | void devm_acpi_dma_controller_free(struct device *dev); | ||
67 | |||
68 | struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | ||
69 | size_t index); | ||
70 | struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev, | ||
71 | const char *name); | ||
72 | |||
73 | struct dma_chan *acpi_dma_simple_xlate(struct acpi_dma_spec *dma_spec, | ||
74 | struct acpi_dma *adma); | ||
75 | #else | ||
76 | |||
77 | static inline int acpi_dma_controller_register(struct device *dev, | ||
78 | struct dma_chan *(*acpi_dma_xlate) | ||
79 | (struct acpi_dma_spec *, struct acpi_dma *), | ||
80 | void *data) | ||
81 | { | ||
82 | return -ENODEV; | ||
83 | } | ||
84 | static inline int acpi_dma_controller_free(struct device *dev) | ||
85 | { | ||
86 | return -ENODEV; | ||
87 | } | ||
88 | static inline int devm_acpi_dma_controller_register(struct device *dev, | ||
89 | struct dma_chan *(*acpi_dma_xlate) | ||
90 | (struct acpi_dma_spec *, struct acpi_dma *), | ||
91 | void *data) | ||
92 | { | ||
93 | return -ENODEV; | ||
94 | } | ||
95 | static inline void devm_acpi_dma_controller_free(struct device *dev) | ||
96 | { | ||
97 | } | ||
98 | |||
99 | static inline struct dma_chan *acpi_dma_request_slave_chan_by_index( | ||
100 | struct device *dev, size_t index) | ||
101 | { | ||
102 | return NULL; | ||
103 | } | ||
104 | static inline struct dma_chan *acpi_dma_request_slave_chan_by_name( | ||
105 | struct device *dev, const char *name) | ||
106 | { | ||
107 | return NULL; | ||
108 | } | ||
109 | |||
110 | #define acpi_dma_simple_xlate NULL | ||
111 | |||
112 | #endif | ||
113 | |||
114 | #define acpi_dma_request_slave_channel acpi_dma_request_slave_chan_by_index | ||
115 | |||
116 | #endif /* __LINUX_ACPI_DMA_H */ | ||
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h index b76ebd08ff8e..4c120a1e0ca3 100644 --- a/include/linux/acpi_gpio.h +++ b/include/linux/acpi_gpio.h | |||
@@ -1,13 +1,25 @@ | |||
1 | #ifndef _LINUX_ACPI_GPIO_H_ | 1 | #ifndef _LINUX_ACPI_GPIO_H_ |
2 | #define _LINUX_ACPI_GPIO_H_ | 2 | #define _LINUX_ACPI_GPIO_H_ |
3 | 3 | ||
4 | #include <linux/device.h> | ||
4 | #include <linux/errno.h> | 5 | #include <linux/errno.h> |
5 | #include <linux/gpio.h> | 6 | #include <linux/gpio.h> |
6 | 7 | ||
8 | /** | ||
9 | * struct acpi_gpio_info - ACPI GPIO specific information | ||
10 | * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo | ||
11 | */ | ||
12 | struct acpi_gpio_info { | ||
13 | bool gpioint; | ||
14 | }; | ||
15 | |||
7 | #ifdef CONFIG_GPIO_ACPI | 16 | #ifdef CONFIG_GPIO_ACPI |
8 | 17 | ||
9 | int acpi_get_gpio(char *path, int pin); | 18 | int acpi_get_gpio(char *path, int pin); |
19 | int acpi_get_gpio_by_index(struct device *dev, int index, | ||
20 | struct acpi_gpio_info *info); | ||
10 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); | 21 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); |
22 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); | ||
11 | 23 | ||
12 | #else /* CONFIG_GPIO_ACPI */ | 24 | #else /* CONFIG_GPIO_ACPI */ |
13 | 25 | ||
@@ -16,7 +28,14 @@ static inline int acpi_get_gpio(char *path, int pin) | |||
16 | return -ENODEV; | 28 | return -ENODEV; |
17 | } | 29 | } |
18 | 30 | ||
31 | static inline int acpi_get_gpio_by_index(struct device *dev, int index, | ||
32 | struct acpi_gpio_info *info) | ||
33 | { | ||
34 | return -ENODEV; | ||
35 | } | ||
36 | |||
19 | static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } | 37 | static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { } |
38 | static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } | ||
20 | 39 | ||
21 | #endif /* CONFIG_GPIO_ACPI */ | 40 | #endif /* CONFIG_GPIO_ACPI */ |
22 | 41 | ||
diff --git a/include/linux/aio.h b/include/linux/aio.h index 31ff6dba4872..1bdf965339f9 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
@@ -9,91 +9,32 @@ | |||
9 | 9 | ||
10 | #include <linux/atomic.h> | 10 | #include <linux/atomic.h> |
11 | 11 | ||
12 | #define AIO_MAXSEGS 4 | ||
13 | #define AIO_KIOGRP_NR_ATOMIC 8 | ||
14 | |||
15 | struct kioctx; | 12 | struct kioctx; |
13 | struct kiocb; | ||
16 | 14 | ||
17 | /* Notes on cancelling a kiocb: | 15 | #define KIOCB_KEY 0 |
18 | * If a kiocb is cancelled, aio_complete may return 0 to indicate | ||
19 | * that cancel has not yet disposed of the kiocb. All cancel | ||
20 | * operations *must* call aio_put_req to dispose of the kiocb | ||
21 | * to guard against races with the completion code. | ||
22 | */ | ||
23 | #define KIOCB_C_CANCELLED 0x01 | ||
24 | #define KIOCB_C_COMPLETE 0x02 | ||
25 | |||
26 | #define KIOCB_SYNC_KEY (~0U) | ||
27 | 16 | ||
28 | /* ki_flags bits */ | ||
29 | /* | 17 | /* |
30 | * This may be used for cancel/retry serialization in the future, but | 18 | * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either |
31 | * for now it's unused and we probably don't want modules to even | 19 | * cancelled or completed (this makes a certain amount of sense because |
32 | * think they can use it. | 20 | * successful cancellation - io_cancel() - does deliver the completion to |
21 | * userspace). | ||
22 | * | ||
23 | * And since most things don't implement kiocb cancellation and we'd really like | ||
24 | * kiocb completion to be lockless when possible, we use ki_cancel to | ||
25 | * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED | ||
26 | * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel(). | ||
33 | */ | 27 | */ |
34 | /* #define KIF_LOCKED 0 */ | 28 | #define KIOCB_CANCELLED ((void *) (~0ULL)) |
35 | #define KIF_KICKED 1 | ||
36 | #define KIF_CANCELLED 2 | ||
37 | |||
38 | #define kiocbTryLock(iocb) test_and_set_bit(KIF_LOCKED, &(iocb)->ki_flags) | ||
39 | #define kiocbTryKick(iocb) test_and_set_bit(KIF_KICKED, &(iocb)->ki_flags) | ||
40 | 29 | ||
41 | #define kiocbSetLocked(iocb) set_bit(KIF_LOCKED, &(iocb)->ki_flags) | 30 | typedef int (kiocb_cancel_fn)(struct kiocb *, struct io_event *); |
42 | #define kiocbSetKicked(iocb) set_bit(KIF_KICKED, &(iocb)->ki_flags) | ||
43 | #define kiocbSetCancelled(iocb) set_bit(KIF_CANCELLED, &(iocb)->ki_flags) | ||
44 | 31 | ||
45 | #define kiocbClearLocked(iocb) clear_bit(KIF_LOCKED, &(iocb)->ki_flags) | ||
46 | #define kiocbClearKicked(iocb) clear_bit(KIF_KICKED, &(iocb)->ki_flags) | ||
47 | #define kiocbClearCancelled(iocb) clear_bit(KIF_CANCELLED, &(iocb)->ki_flags) | ||
48 | |||
49 | #define kiocbIsLocked(iocb) test_bit(KIF_LOCKED, &(iocb)->ki_flags) | ||
50 | #define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags) | ||
51 | #define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags) | ||
52 | |||
53 | /* is there a better place to document function pointer methods? */ | ||
54 | /** | ||
55 | * ki_retry - iocb forward progress callback | ||
56 | * @kiocb: The kiocb struct to advance by performing an operation. | ||
57 | * | ||
58 | * This callback is called when the AIO core wants a given AIO operation | ||
59 | * to make forward progress. The kiocb argument describes the operation | ||
60 | * that is to be performed. As the operation proceeds, perhaps partially, | ||
61 | * ki_retry is expected to update the kiocb with progress made. Typically | ||
62 | * ki_retry is set in the AIO core and it itself calls file_operations | ||
63 | * helpers. | ||
64 | * | ||
65 | * ki_retry's return value determines when the AIO operation is completed | ||
66 | * and an event is generated in the AIO event ring. Except the special | ||
67 | * return values described below, the value that is returned from ki_retry | ||
68 | * is transferred directly into the completion ring as the operation's | ||
69 | * resulting status. Once this has happened ki_retry *MUST NOT* reference | ||
70 | * the kiocb pointer again. | ||
71 | * | ||
72 | * If ki_retry returns -EIOCBQUEUED it has made a promise that aio_complete() | ||
73 | * will be called on the kiocb pointer in the future. The AIO core will | ||
74 | * not ask the method again -- ki_retry must ensure forward progress. | ||
75 | * aio_complete() must be called once and only once in the future, multiple | ||
76 | * calls may result in undefined behaviour. | ||
77 | * | ||
78 | * If ki_retry returns -EIOCBRETRY it has made a promise that kick_iocb() | ||
79 | * will be called on the kiocb pointer in the future. This may happen | ||
80 | * through generic helpers that associate kiocb->ki_wait with a wait | ||
81 | * queue head that ki_retry uses via current->io_wait. It can also happen | ||
82 | * with custom tracking and manual calls to kick_iocb(), though that is | ||
83 | * discouraged. In either case, kick_iocb() must be called once and only | ||
84 | * once. ki_retry must ensure forward progress, the AIO core will wait | ||
85 | * indefinitely for kick_iocb() to be called. | ||
86 | */ | ||
87 | struct kiocb { | 32 | struct kiocb { |
88 | struct list_head ki_run_list; | 33 | atomic_t ki_users; |
89 | unsigned long ki_flags; | ||
90 | int ki_users; | ||
91 | unsigned ki_key; /* id of this request */ | ||
92 | 34 | ||
93 | struct file *ki_filp; | 35 | struct file *ki_filp; |
94 | struct kioctx *ki_ctx; /* may be NULL for sync ops */ | 36 | struct kioctx *ki_ctx; /* NULL for sync ops */ |
95 | int (*ki_cancel)(struct kiocb *, struct io_event *); | 37 | kiocb_cancel_fn *ki_cancel; |
96 | ssize_t (*ki_retry)(struct kiocb *); | ||
97 | void (*ki_dtor)(struct kiocb *); | 38 | void (*ki_dtor)(struct kiocb *); |
98 | 39 | ||
99 | union { | 40 | union { |
@@ -117,7 +58,6 @@ struct kiocb { | |||
117 | 58 | ||
118 | struct list_head ki_list; /* the aio core uses this | 59 | struct list_head ki_list; /* the aio core uses this |
119 | * for cancellation */ | 60 | * for cancellation */ |
120 | struct list_head ki_batch; /* batch allocation */ | ||
121 | 61 | ||
122 | /* | 62 | /* |
123 | * If the aio_resfd field of the userspace iocb is not zero, | 63 | * If the aio_resfd field of the userspace iocb is not zero, |
@@ -128,106 +68,40 @@ struct kiocb { | |||
128 | 68 | ||
129 | static inline bool is_sync_kiocb(struct kiocb *kiocb) | 69 | static inline bool is_sync_kiocb(struct kiocb *kiocb) |
130 | { | 70 | { |
131 | return kiocb->ki_key == KIOCB_SYNC_KEY; | 71 | return kiocb->ki_ctx == NULL; |
132 | } | 72 | } |
133 | 73 | ||
134 | static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) | 74 | static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) |
135 | { | 75 | { |
136 | *kiocb = (struct kiocb) { | 76 | *kiocb = (struct kiocb) { |
137 | .ki_users = 1, | 77 | .ki_users = ATOMIC_INIT(1), |
138 | .ki_key = KIOCB_SYNC_KEY, | 78 | .ki_ctx = NULL, |
139 | .ki_filp = filp, | 79 | .ki_filp = filp, |
140 | .ki_obj.tsk = current, | 80 | .ki_obj.tsk = current, |
141 | }; | 81 | }; |
142 | } | 82 | } |
143 | 83 | ||
144 | #define AIO_RING_MAGIC 0xa10a10a1 | ||
145 | #define AIO_RING_COMPAT_FEATURES 1 | ||
146 | #define AIO_RING_INCOMPAT_FEATURES 0 | ||
147 | struct aio_ring { | ||
148 | unsigned id; /* kernel internal index number */ | ||
149 | unsigned nr; /* number of io_events */ | ||
150 | unsigned head; | ||
151 | unsigned tail; | ||
152 | |||
153 | unsigned magic; | ||
154 | unsigned compat_features; | ||
155 | unsigned incompat_features; | ||
156 | unsigned header_length; /* size of aio_ring */ | ||
157 | |||
158 | |||
159 | struct io_event io_events[0]; | ||
160 | }; /* 128 bytes + ring size */ | ||
161 | |||
162 | #define AIO_RING_PAGES 8 | ||
163 | struct aio_ring_info { | ||
164 | unsigned long mmap_base; | ||
165 | unsigned long mmap_size; | ||
166 | |||
167 | struct page **ring_pages; | ||
168 | spinlock_t ring_lock; | ||
169 | long nr_pages; | ||
170 | |||
171 | unsigned nr, tail; | ||
172 | |||
173 | struct page *internal_pages[AIO_RING_PAGES]; | ||
174 | }; | ||
175 | |||
176 | static inline unsigned aio_ring_avail(struct aio_ring_info *info, | ||
177 | struct aio_ring *ring) | ||
178 | { | ||
179 | return (ring->head + info->nr - 1 - ring->tail) % info->nr; | ||
180 | } | ||
181 | |||
182 | struct kioctx { | ||
183 | atomic_t users; | ||
184 | int dead; | ||
185 | struct mm_struct *mm; | ||
186 | |||
187 | /* This needs improving */ | ||
188 | unsigned long user_id; | ||
189 | struct hlist_node list; | ||
190 | |||
191 | wait_queue_head_t wait; | ||
192 | |||
193 | spinlock_t ctx_lock; | ||
194 | |||
195 | int reqs_active; | ||
196 | struct list_head active_reqs; /* used for cancellation */ | ||
197 | struct list_head run_list; /* used for kicked reqs */ | ||
198 | |||
199 | /* sys_io_setup currently limits this to an unsigned int */ | ||
200 | unsigned max_reqs; | ||
201 | |||
202 | struct aio_ring_info ring_info; | ||
203 | |||
204 | struct delayed_work wq; | ||
205 | |||
206 | struct rcu_head rcu_head; | ||
207 | }; | ||
208 | |||
209 | /* prototypes */ | 84 | /* prototypes */ |
210 | extern unsigned aio_max_size; | ||
211 | |||
212 | #ifdef CONFIG_AIO | 85 | #ifdef CONFIG_AIO |
213 | extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); | 86 | extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); |
214 | extern int aio_put_req(struct kiocb *iocb); | 87 | extern void aio_put_req(struct kiocb *iocb); |
215 | extern void kick_iocb(struct kiocb *iocb); | 88 | extern void aio_complete(struct kiocb *iocb, long res, long res2); |
216 | extern int aio_complete(struct kiocb *iocb, long res, long res2); | ||
217 | struct mm_struct; | 89 | struct mm_struct; |
218 | extern void exit_aio(struct mm_struct *mm); | 90 | extern void exit_aio(struct mm_struct *mm); |
219 | extern long do_io_submit(aio_context_t ctx_id, long nr, | 91 | extern long do_io_submit(aio_context_t ctx_id, long nr, |
220 | struct iocb __user *__user *iocbpp, bool compat); | 92 | struct iocb __user *__user *iocbpp, bool compat); |
93 | void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); | ||
221 | #else | 94 | #else |
222 | static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } | 95 | static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } |
223 | static inline int aio_put_req(struct kiocb *iocb) { return 0; } | 96 | static inline void aio_put_req(struct kiocb *iocb) { } |
224 | static inline void kick_iocb(struct kiocb *iocb) { } | 97 | static inline void aio_complete(struct kiocb *iocb, long res, long res2) { } |
225 | static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; } | ||
226 | struct mm_struct; | 98 | struct mm_struct; |
227 | static inline void exit_aio(struct mm_struct *mm) { } | 99 | static inline void exit_aio(struct mm_struct *mm) { } |
228 | static inline long do_io_submit(aio_context_t ctx_id, long nr, | 100 | static inline long do_io_submit(aio_context_t ctx_id, long nr, |
229 | struct iocb __user * __user *iocbpp, | 101 | struct iocb __user * __user *iocbpp, |
230 | bool compat) { return 0; } | 102 | bool compat) { return 0; } |
103 | static inline void kiocb_set_cancel_fn(struct kiocb *req, | ||
104 | kiocb_cancel_fn *cancel) { } | ||
231 | #endif /* CONFIG_AIO */ | 105 | #endif /* CONFIG_AIO */ |
232 | 106 | ||
233 | static inline struct kiocb *list_kiocb(struct list_head *h) | 107 | static inline struct kiocb *list_kiocb(struct list_head *h) |
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h index f612c783170f..62d9303c2837 100644 --- a/include/linux/amba/serial.h +++ b/include/linux/amba/serial.h | |||
@@ -203,6 +203,9 @@ struct amba_pl011_data { | |||
203 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); | 203 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); |
204 | void *dma_rx_param; | 204 | void *dma_rx_param; |
205 | void *dma_tx_param; | 205 | void *dma_tx_param; |
206 | bool dma_rx_poll_enable; | ||
207 | unsigned int dma_rx_poll_rate; | ||
208 | unsigned int dma_rx_poll_timeout; | ||
206 | void (*init) (void); | 209 | void (*init) (void); |
207 | void (*exit) (void); | 210 | void (*exit) (void); |
208 | }; | 211 | }; |
diff --git a/include/linux/async.h b/include/linux/async.h index a2e3f18b2ad6..6b0226bdaadc 100644 --- a/include/linux/async.h +++ b/include/linux/async.h | |||
@@ -16,9 +16,8 @@ | |||
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | 17 | ||
18 | typedef u64 async_cookie_t; | 18 | typedef u64 async_cookie_t; |
19 | typedef void (async_func_ptr) (void *data, async_cookie_t cookie); | 19 | typedef void (*async_func_t) (void *data, async_cookie_t cookie); |
20 | struct async_domain { | 20 | struct async_domain { |
21 | struct list_head node; | ||
22 | struct list_head pending; | 21 | struct list_head pending; |
23 | unsigned registered:1; | 22 | unsigned registered:1; |
24 | }; | 23 | }; |
@@ -27,8 +26,7 @@ struct async_domain { | |||
27 | * domain participates in global async_synchronize_full | 26 | * domain participates in global async_synchronize_full |
28 | */ | 27 | */ |
29 | #define ASYNC_DOMAIN(_name) \ | 28 | #define ASYNC_DOMAIN(_name) \ |
30 | struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ | 29 | struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \ |
31 | .pending = LIST_HEAD_INIT(_name.pending), \ | ||
32 | .registered = 1 } | 30 | .registered = 1 } |
33 | 31 | ||
34 | /* | 32 | /* |
@@ -36,12 +34,11 @@ struct async_domain { | |||
36 | * complete, this domain does not participate in async_synchronize_full | 34 | * complete, this domain does not participate in async_synchronize_full |
37 | */ | 35 | */ |
38 | #define ASYNC_DOMAIN_EXCLUSIVE(_name) \ | 36 | #define ASYNC_DOMAIN_EXCLUSIVE(_name) \ |
39 | struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ | 37 | struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \ |
40 | .pending = LIST_HEAD_INIT(_name.pending), \ | ||
41 | .registered = 0 } | 38 | .registered = 0 } |
42 | 39 | ||
43 | extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data); | 40 | extern async_cookie_t async_schedule(async_func_t func, void *data); |
44 | extern async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data, | 41 | extern async_cookie_t async_schedule_domain(async_func_t func, void *data, |
45 | struct async_domain *domain); | 42 | struct async_domain *domain); |
46 | void async_unregister_domain(struct async_domain *domain); | 43 | void async_unregister_domain(struct async_domain *domain); |
47 | extern void async_synchronize_full(void); | 44 | extern void async_synchronize_full(void); |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 5a6d718adf34..b20b03852f21 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -84,8 +84,13 @@ extern int audit_classify_arch(int arch); | |||
84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ | 84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ |
85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ | 85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ |
86 | 86 | ||
87 | /* maximized args number that audit_socketcall can process */ | ||
88 | #define AUDITSC_ARGS 6 | ||
89 | |||
87 | struct filename; | 90 | struct filename; |
88 | 91 | ||
92 | extern void audit_log_session_info(struct audit_buffer *ab); | ||
93 | |||
89 | #ifdef CONFIG_AUDITSYSCALL | 94 | #ifdef CONFIG_AUDITSYSCALL |
90 | /* These are defined in auditsc.c */ | 95 | /* These are defined in auditsc.c */ |
91 | /* Public API */ | 96 | /* Public API */ |
@@ -120,7 +125,7 @@ static inline void audit_syscall_entry(int arch, int major, unsigned long a0, | |||
120 | unsigned long a1, unsigned long a2, | 125 | unsigned long a1, unsigned long a2, |
121 | unsigned long a3) | 126 | unsigned long a3) |
122 | { | 127 | { |
123 | if (unlikely(!audit_dummy_context())) | 128 | if (unlikely(current->audit_context)) |
124 | __audit_syscall_entry(arch, major, a0, a1, a2, a3); | 129 | __audit_syscall_entry(arch, major, a0, a1, a2, a3); |
125 | } | 130 | } |
126 | static inline void audit_syscall_exit(void *pt_regs) | 131 | static inline void audit_syscall_exit(void *pt_regs) |
@@ -185,12 +190,10 @@ static inline int audit_get_sessionid(struct task_struct *tsk) | |||
185 | return tsk->sessionid; | 190 | return tsk->sessionid; |
186 | } | 191 | } |
187 | 192 | ||
188 | extern void audit_log_task_context(struct audit_buffer *ab); | ||
189 | extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk); | ||
190 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); | 193 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
191 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); | 194 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
192 | extern int __audit_bprm(struct linux_binprm *bprm); | 195 | extern int __audit_bprm(struct linux_binprm *bprm); |
193 | extern void __audit_socketcall(int nargs, unsigned long *args); | 196 | extern int __audit_socketcall(int nargs, unsigned long *args); |
194 | extern int __audit_sockaddr(int len, void *addr); | 197 | extern int __audit_sockaddr(int len, void *addr); |
195 | extern void __audit_fd_pair(int fd1, int fd2); | 198 | extern void __audit_fd_pair(int fd1, int fd2); |
196 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); | 199 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); |
@@ -224,10 +227,11 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
224 | return __audit_bprm(bprm); | 227 | return __audit_bprm(bprm); |
225 | return 0; | 228 | return 0; |
226 | } | 229 | } |
227 | static inline void audit_socketcall(int nargs, unsigned long *args) | 230 | static inline int audit_socketcall(int nargs, unsigned long *args) |
228 | { | 231 | { |
229 | if (unlikely(!audit_dummy_context())) | 232 | if (unlikely(!audit_dummy_context())) |
230 | __audit_socketcall(nargs, args); | 233 | return __audit_socketcall(nargs, args); |
234 | return 0; | ||
231 | } | 235 | } |
232 | static inline int audit_sockaddr(int len, void *addr) | 236 | static inline int audit_sockaddr(int len, void *addr) |
233 | { | 237 | { |
@@ -340,11 +344,6 @@ static inline int audit_get_sessionid(struct task_struct *tsk) | |||
340 | { | 344 | { |
341 | return -1; | 345 | return -1; |
342 | } | 346 | } |
343 | static inline void audit_log_task_context(struct audit_buffer *ab) | ||
344 | { } | ||
345 | static inline void audit_log_task_info(struct audit_buffer *ab, | ||
346 | struct task_struct *tsk) | ||
347 | { } | ||
348 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) | 347 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
349 | { } | 348 | { } |
350 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, | 349 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, |
@@ -354,8 +353,10 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
354 | { | 353 | { |
355 | return 0; | 354 | return 0; |
356 | } | 355 | } |
357 | static inline void audit_socketcall(int nargs, unsigned long *args) | 356 | static inline int audit_socketcall(int nargs, unsigned long *args) |
358 | { } | 357 | { |
358 | return 0; | ||
359 | } | ||
359 | static inline void audit_fd_pair(int fd1, int fd2) | 360 | static inline void audit_fd_pair(int fd1, int fd2) |
360 | { } | 361 | { } |
361 | static inline int audit_sockaddr(int len, void *addr) | 362 | static inline int audit_sockaddr(int len, void *addr) |
@@ -390,6 +391,11 @@ static inline void audit_ptrace(struct task_struct *t) | |||
390 | #define audit_signals 0 | 391 | #define audit_signals 0 |
391 | #endif /* CONFIG_AUDITSYSCALL */ | 392 | #endif /* CONFIG_AUDITSYSCALL */ |
392 | 393 | ||
394 | static inline bool audit_loginuid_set(struct task_struct *tsk) | ||
395 | { | ||
396 | return uid_valid(audit_get_loginuid(tsk)); | ||
397 | } | ||
398 | |||
393 | #ifdef CONFIG_AUDIT | 399 | #ifdef CONFIG_AUDIT |
394 | /* These are defined in audit.c */ | 400 | /* These are defined in audit.c */ |
395 | /* Public API */ | 401 | /* Public API */ |
@@ -429,14 +435,17 @@ static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | |||
429 | { } | 435 | { } |
430 | #endif | 436 | #endif |
431 | 437 | ||
438 | extern int audit_log_task_context(struct audit_buffer *ab); | ||
439 | extern void audit_log_task_info(struct audit_buffer *ab, | ||
440 | struct task_struct *tsk); | ||
441 | |||
432 | extern int audit_update_lsm_rules(void); | 442 | extern int audit_update_lsm_rules(void); |
433 | 443 | ||
434 | /* Private API (for audit.c only) */ | 444 | /* Private API (for audit.c only) */ |
435 | extern int audit_filter_user(void); | 445 | extern int audit_filter_user(int type); |
436 | extern int audit_filter_type(int type); | 446 | extern int audit_filter_type(int type); |
437 | extern int audit_receive_filter(int type, int pid, int seq, | 447 | extern int audit_receive_filter(int type, int pid, int seq, |
438 | void *data, size_t datasz, kuid_t loginuid, | 448 | void *data, size_t datasz); |
439 | u32 sessionid, u32 sid); | ||
440 | extern int audit_enabled; | 449 | extern int audit_enabled; |
441 | #else /* CONFIG_AUDIT */ | 450 | #else /* CONFIG_AUDIT */ |
442 | static inline __printf(4, 5) | 451 | static inline __printf(4, 5) |
@@ -476,6 +485,13 @@ static inline void audit_log_link_denied(const char *string, | |||
476 | { } | 485 | { } |
477 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | 486 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) |
478 | { } | 487 | { } |
488 | static inline int audit_log_task_context(struct audit_buffer *ab) | ||
489 | { | ||
490 | return 0; | ||
491 | } | ||
492 | static inline void audit_log_task_info(struct audit_buffer *ab, | ||
493 | struct task_struct *tsk) | ||
494 | { } | ||
479 | #define audit_enabled 0 | 495 | #define audit_enabled 0 |
480 | #endif /* CONFIG_AUDIT */ | 496 | #endif /* CONFIG_AUDIT */ |
481 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) | 497 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 350459910fe1..c3881553f7d1 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/writeback.h> | 18 | #include <linux/writeback.h> |
19 | #include <linux/atomic.h> | 19 | #include <linux/atomic.h> |
20 | #include <linux/sysctl.h> | 20 | #include <linux/sysctl.h> |
21 | #include <linux/workqueue.h> | ||
21 | 22 | ||
22 | struct page; | 23 | struct page; |
23 | struct device; | 24 | struct device; |
@@ -27,7 +28,6 @@ struct dentry; | |||
27 | * Bits in backing_dev_info.state | 28 | * Bits in backing_dev_info.state |
28 | */ | 29 | */ |
29 | enum bdi_state { | 30 | enum bdi_state { |
30 | BDI_pending, /* On its way to being activated */ | ||
31 | BDI_wb_alloc, /* Default embedded wb allocated */ | 31 | BDI_wb_alloc, /* Default embedded wb allocated */ |
32 | BDI_async_congested, /* The async (write) queue is getting full */ | 32 | BDI_async_congested, /* The async (write) queue is getting full */ |
33 | BDI_sync_congested, /* The sync queue is getting full */ | 33 | BDI_sync_congested, /* The sync queue is getting full */ |
@@ -53,10 +53,8 @@ struct bdi_writeback { | |||
53 | unsigned int nr; | 53 | unsigned int nr; |
54 | 54 | ||
55 | unsigned long last_old_flush; /* last old data flush */ | 55 | unsigned long last_old_flush; /* last old data flush */ |
56 | unsigned long last_active; /* last time bdi thread was active */ | ||
57 | 56 | ||
58 | struct task_struct *task; /* writeback thread */ | 57 | struct delayed_work dwork; /* work item used for writeback */ |
59 | struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */ | ||
60 | struct list_head b_dirty; /* dirty inodes */ | 58 | struct list_head b_dirty; /* dirty inodes */ |
61 | struct list_head b_io; /* parked for writeback */ | 59 | struct list_head b_io; /* parked for writeback */ |
62 | struct list_head b_more_io; /* parked for more writeback */ | 60 | struct list_head b_more_io; /* parked for more writeback */ |
@@ -123,14 +121,15 @@ int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | |||
123 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | 121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
124 | enum wb_reason reason); | 122 | enum wb_reason reason); |
125 | void bdi_start_background_writeback(struct backing_dev_info *bdi); | 123 | void bdi_start_background_writeback(struct backing_dev_info *bdi); |
126 | int bdi_writeback_thread(void *data); | 124 | void bdi_writeback_workfn(struct work_struct *work); |
127 | int bdi_has_dirty_io(struct backing_dev_info *bdi); | 125 | int bdi_has_dirty_io(struct backing_dev_info *bdi); |
128 | void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); | 126 | void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); |
129 | void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2); | 127 | void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2); |
130 | 128 | ||
131 | extern spinlock_t bdi_lock; | 129 | extern spinlock_t bdi_lock; |
132 | extern struct list_head bdi_list; | 130 | extern struct list_head bdi_list; |
133 | extern struct list_head bdi_pending_list; | 131 | |
132 | extern struct workqueue_struct *bdi_wq; | ||
134 | 133 | ||
135 | static inline int wb_has_dirty_io(struct bdi_writeback *wb) | 134 | static inline int wb_has_dirty_io(struct bdi_writeback *wb) |
136 | { | 135 | { |
@@ -336,11 +335,6 @@ static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi) | |||
336 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; | 335 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; |
337 | } | 336 | } |
338 | 337 | ||
339 | static inline bool bdi_cap_flush_forker(struct backing_dev_info *bdi) | ||
340 | { | ||
341 | return bdi == &default_backing_dev_info; | ||
342 | } | ||
343 | |||
344 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) | 338 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
345 | { | 339 | { |
346 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | 340 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); |
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h index 1c504ca5bdb3..d8a97ec0e2b8 100644 --- a/include/linux/basic_mmio_gpio.h +++ b/include/linux/basic_mmio_gpio.h | |||
@@ -72,5 +72,6 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev, | |||
72 | #define BGPIOF_BIG_ENDIAN BIT(0) | 72 | #define BGPIOF_BIG_ENDIAN BIT(0) |
73 | #define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */ | 73 | #define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */ |
74 | #define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ | 74 | #define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */ |
75 | #define BGPIOF_BIG_ENDIAN_BYTE_ORDER BIT(3) | ||
75 | 76 | ||
76 | #endif /* __BASIC_MMIO_GPIO_H */ | 77 | #endif /* __BASIC_MMIO_GPIO_H */ |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index e0ce311011c0..f14a98a79c9d 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -134,6 +134,7 @@ struct bcma_host_ops { | |||
134 | #define BCMA_CORE_I2S 0x834 | 134 | #define BCMA_CORE_I2S 0x834 |
135 | #define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */ | 135 | #define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */ |
136 | #define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */ | 136 | #define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */ |
137 | #define BCMA_CORE_ARM_CR4 0x83e | ||
137 | #define BCMA_CORE_DEFAULT 0xFFF | 138 | #define BCMA_CORE_DEFAULT 0xFFF |
138 | 139 | ||
139 | #define BCMA_MAX_NR_CORES 16 | 140 | #define BCMA_MAX_NR_CORES 16 |
@@ -173,6 +174,60 @@ struct bcma_host_ops { | |||
173 | #define BCMA_CHIP_ID_BCM53572 53572 | 174 | #define BCMA_CHIP_ID_BCM53572 53572 |
174 | #define BCMA_PKG_ID_BCM47188 9 | 175 | #define BCMA_PKG_ID_BCM47188 9 |
175 | 176 | ||
177 | /* Board types (on PCI usually equals to the subsystem dev id) */ | ||
178 | /* BCM4313 */ | ||
179 | #define BCMA_BOARD_TYPE_BCM94313BU 0X050F | ||
180 | #define BCMA_BOARD_TYPE_BCM94313HM 0X0510 | ||
181 | #define BCMA_BOARD_TYPE_BCM94313EPA 0X0511 | ||
182 | #define BCMA_BOARD_TYPE_BCM94313HMG 0X051C | ||
183 | /* BCM4716 */ | ||
184 | #define BCMA_BOARD_TYPE_BCM94716NR2 0X04CD | ||
185 | /* BCM43224 */ | ||
186 | #define BCMA_BOARD_TYPE_BCM943224X21 0X056E | ||
187 | #define BCMA_BOARD_TYPE_BCM943224X21_FCC 0X00D1 | ||
188 | #define BCMA_BOARD_TYPE_BCM943224X21B 0X00E9 | ||
189 | #define BCMA_BOARD_TYPE_BCM943224M93 0X008B | ||
190 | #define BCMA_BOARD_TYPE_BCM943224M93A 0X0090 | ||
191 | #define BCMA_BOARD_TYPE_BCM943224X16 0X0093 | ||
192 | #define BCMA_BOARD_TYPE_BCM94322X9 0X008D | ||
193 | #define BCMA_BOARD_TYPE_BCM94322M35E 0X008E | ||
194 | /* BCM43228 */ | ||
195 | #define BCMA_BOARD_TYPE_BCM943228BU8 0X0540 | ||
196 | #define BCMA_BOARD_TYPE_BCM943228BU9 0X0541 | ||
197 | #define BCMA_BOARD_TYPE_BCM943228BU 0X0542 | ||
198 | #define BCMA_BOARD_TYPE_BCM943227HM4L 0X0543 | ||
199 | #define BCMA_BOARD_TYPE_BCM943227HMB 0X0544 | ||
200 | #define BCMA_BOARD_TYPE_BCM943228HM4L 0X0545 | ||
201 | #define BCMA_BOARD_TYPE_BCM943228SD 0X0573 | ||
202 | /* BCM4331 */ | ||
203 | #define BCMA_BOARD_TYPE_BCM94331X19 0X00D6 | ||
204 | #define BCMA_BOARD_TYPE_BCM94331X28 0X00E4 | ||
205 | #define BCMA_BOARD_TYPE_BCM94331X28B 0X010E | ||
206 | #define BCMA_BOARD_TYPE_BCM94331PCIEBT3AX 0X00E4 | ||
207 | #define BCMA_BOARD_TYPE_BCM94331X12_2G 0X00EC | ||
208 | #define BCMA_BOARD_TYPE_BCM94331X12_5G 0X00ED | ||
209 | #define BCMA_BOARD_TYPE_BCM94331X29B 0X00EF | ||
210 | #define BCMA_BOARD_TYPE_BCM94331CSAX 0X00EF | ||
211 | #define BCMA_BOARD_TYPE_BCM94331X19C 0X00F5 | ||
212 | #define BCMA_BOARD_TYPE_BCM94331X33 0X00F4 | ||
213 | #define BCMA_BOARD_TYPE_BCM94331BU 0X0523 | ||
214 | #define BCMA_BOARD_TYPE_BCM94331S9BU 0X0524 | ||
215 | #define BCMA_BOARD_TYPE_BCM94331MC 0X0525 | ||
216 | #define BCMA_BOARD_TYPE_BCM94331MCI 0X0526 | ||
217 | #define BCMA_BOARD_TYPE_BCM94331PCIEBT4 0X0527 | ||
218 | #define BCMA_BOARD_TYPE_BCM94331HM 0X0574 | ||
219 | #define BCMA_BOARD_TYPE_BCM94331PCIEDUAL 0X059B | ||
220 | #define BCMA_BOARD_TYPE_BCM94331MCH5 0X05A9 | ||
221 | #define BCMA_BOARD_TYPE_BCM94331CS 0X05C6 | ||
222 | #define BCMA_BOARD_TYPE_BCM94331CD 0X05DA | ||
223 | /* BCM53572 */ | ||
224 | #define BCMA_BOARD_TYPE_BCM953572BU 0X058D | ||
225 | #define BCMA_BOARD_TYPE_BCM953572NR2 0X058E | ||
226 | #define BCMA_BOARD_TYPE_BCM947188NR2 0X058F | ||
227 | #define BCMA_BOARD_TYPE_BCM953572SDRNR2 0X0590 | ||
228 | /* BCM43142 */ | ||
229 | #define BCMA_BOARD_TYPE_BCM943142HM 0X05E0 | ||
230 | |||
176 | struct bcma_device { | 231 | struct bcma_device { |
177 | struct bcma_bus *bus; | 232 | struct bcma_bus *bus; |
178 | struct bcma_device_id id; | 233 | struct bcma_device_id id; |
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 8390c474f69a..b8b09eac60a4 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
@@ -104,6 +104,7 @@ | |||
104 | #define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ | 104 | #define BCMA_CC_CHIPST_4706_MIPS_BENDIAN BIT(3) /* 0: little, 1: big endian */ |
105 | #define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ | 105 | #define BCMA_CC_CHIPST_4706_PCIE1_DISABLE BIT(5) /* PCIE1 enable strap pin */ |
106 | #define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */ | 106 | #define BCMA_CC_CHIPST_5357_NAND_BOOT BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */ |
107 | #define BCMA_CC_CHIPST_4360_XTAL_40MZ 0x00000001 | ||
107 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ | 108 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ |
108 | #define BCMA_CC_JCMD_START 0x80000000 | 109 | #define BCMA_CC_JCMD_START 0x80000000 |
109 | #define BCMA_CC_JCMD_BUSY 0x80000000 | 110 | #define BCMA_CC_JCMD_BUSY 0x80000000 |
@@ -315,6 +316,9 @@ | |||
315 | #define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ | 316 | #define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ |
316 | #define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ | 317 | #define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ |
317 | #define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 | 318 | #define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 |
319 | #define BCMA_CC_PMU_CTL_RES 0x00006000 /* reset control mask */ | ||
320 | #define BCMA_CC_PMU_CTL_RES_SHIFT 13 | ||
321 | #define BCMA_CC_PMU_CTL_RES_RELOAD 0x2 /* reload POR values */ | ||
318 | #define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400 | 322 | #define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400 |
319 | #define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ | 323 | #define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ |
320 | #define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ | 324 | #define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ |
@@ -607,6 +611,8 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); | |||
607 | 611 | ||
608 | extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); | 612 | extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); |
609 | 613 | ||
614 | extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); | ||
615 | |||
610 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); | 616 | void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); |
611 | 617 | ||
612 | u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); | 618 | u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); |
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 7e8104bb7a7e..917dcd7965e7 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #define BCMA_IOST_BIST_DONE 0x8000 | 37 | #define BCMA_IOST_BIST_DONE 0x8000 |
38 | #define BCMA_RESET_CTL 0x0800 | 38 | #define BCMA_RESET_CTL 0x0800 |
39 | #define BCMA_RESET_CTL_RESET 0x0001 | 39 | #define BCMA_RESET_CTL_RESET 0x0001 |
40 | #define BCMA_RESET_ST 0x0804 | ||
40 | 41 | ||
41 | /* BCMA PCI config space registers. */ | 42 | /* BCMA PCI config space registers. */ |
42 | #define BCMA_PCI_PMCSR 0x44 | 43 | #define BCMA_PCI_PMCSR 0x44 |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index c3a09149f793..70cf138690e9 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -118,5 +118,6 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm); | |||
118 | extern void install_exec_creds(struct linux_binprm *bprm); | 118 | extern void install_exec_creds(struct linux_binprm *bprm); |
119 | extern void set_binfmt(struct linux_binfmt *new); | 119 | extern void set_binfmt(struct linux_binfmt *new); |
120 | extern void free_bprm(struct linux_binprm *); | 120 | extern void free_bprm(struct linux_binprm *); |
121 | extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); | ||
121 | 122 | ||
122 | #endif /* _LINUX_BINFMTS_H */ | 123 | #endif /* _LINUX_BINFMTS_H */ |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 820e7aaad4fd..ef24466d8f82 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #define bio_offset(bio) bio_iovec((bio))->bv_offset | 67 | #define bio_offset(bio) bio_iovec((bio))->bv_offset |
68 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) | 68 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) |
69 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 69 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
70 | #define bio_end_sector(bio) ((bio)->bi_sector + bio_sectors((bio))) | ||
70 | 71 | ||
71 | static inline unsigned int bio_cur_bytes(struct bio *bio) | 72 | static inline unsigned int bio_cur_bytes(struct bio *bio) |
72 | { | 73 | { |
@@ -84,11 +85,6 @@ static inline void *bio_data(struct bio *bio) | |||
84 | return NULL; | 85 | return NULL; |
85 | } | 86 | } |
86 | 87 | ||
87 | static inline int bio_has_allocated_vec(struct bio *bio) | ||
88 | { | ||
89 | return bio->bi_io_vec && bio->bi_io_vec != bio->bi_inline_vecs; | ||
90 | } | ||
91 | |||
92 | /* | 88 | /* |
93 | * will die | 89 | * will die |
94 | */ | 90 | */ |
@@ -136,16 +132,27 @@ static inline int bio_has_allocated_vec(struct bio *bio) | |||
136 | #define bio_io_error(bio) bio_endio((bio), -EIO) | 132 | #define bio_io_error(bio) bio_endio((bio), -EIO) |
137 | 133 | ||
138 | /* | 134 | /* |
139 | * drivers should not use the __ version unless they _really_ want to | 135 | * drivers should not use the __ version unless they _really_ know what |
140 | * run through the entire bio and not just pending pieces | 136 | * they're doing |
141 | */ | 137 | */ |
142 | #define __bio_for_each_segment(bvl, bio, i, start_idx) \ | 138 | #define __bio_for_each_segment(bvl, bio, i, start_idx) \ |
143 | for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \ | 139 | for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \ |
144 | i < (bio)->bi_vcnt; \ | 140 | i < (bio)->bi_vcnt; \ |
145 | bvl++, i++) | 141 | bvl++, i++) |
146 | 142 | ||
143 | /* | ||
144 | * drivers should _never_ use the all version - the bio may have been split | ||
145 | * before it got to the driver and the driver won't own all of it | ||
146 | */ | ||
147 | #define bio_for_each_segment_all(bvl, bio, i) \ | ||
148 | for (i = 0; \ | ||
149 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ | ||
150 | i++) | ||
151 | |||
147 | #define bio_for_each_segment(bvl, bio, i) \ | 152 | #define bio_for_each_segment(bvl, bio, i) \ |
148 | __bio_for_each_segment(bvl, bio, i, (bio)->bi_idx) | 153 | for (i = (bio)->bi_idx; \ |
154 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ | ||
155 | i++) | ||
149 | 156 | ||
150 | /* | 157 | /* |
151 | * get a reference to a bio, so it won't disappear. the intended use is | 158 | * get a reference to a bio, so it won't disappear. the intended use is |
@@ -180,9 +187,12 @@ struct bio_integrity_payload { | |||
180 | unsigned short bip_slab; /* slab the bip came from */ | 187 | unsigned short bip_slab; /* slab the bip came from */ |
181 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ | 188 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ |
182 | unsigned short bip_idx; /* current bip_vec index */ | 189 | unsigned short bip_idx; /* current bip_vec index */ |
190 | unsigned bip_owns_buf:1; /* should free bip_buf */ | ||
183 | 191 | ||
184 | struct work_struct bip_work; /* I/O completion */ | 192 | struct work_struct bip_work; /* I/O completion */ |
185 | struct bio_vec bip_vec[0]; /* embedded bvec array */ | 193 | |
194 | struct bio_vec *bip_vec; | ||
195 | struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ | ||
186 | }; | 196 | }; |
187 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 197 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
188 | 198 | ||
@@ -211,6 +221,7 @@ extern void bio_pair_release(struct bio_pair *dbio); | |||
211 | 221 | ||
212 | extern struct bio_set *bioset_create(unsigned int, unsigned int); | 222 | extern struct bio_set *bioset_create(unsigned int, unsigned int); |
213 | extern void bioset_free(struct bio_set *); | 223 | extern void bioset_free(struct bio_set *); |
224 | extern mempool_t *biovec_create_pool(struct bio_set *bs, int pool_entries); | ||
214 | 225 | ||
215 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 226 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
216 | extern void bio_put(struct bio *); | 227 | extern void bio_put(struct bio *); |
@@ -245,6 +256,9 @@ extern void bio_endio(struct bio *, int); | |||
245 | struct request_queue; | 256 | struct request_queue; |
246 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 257 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
247 | 258 | ||
259 | extern int submit_bio_wait(int rw, struct bio *bio); | ||
260 | extern void bio_advance(struct bio *, unsigned); | ||
261 | |||
248 | extern void bio_init(struct bio *); | 262 | extern void bio_init(struct bio *); |
249 | extern void bio_reset(struct bio *); | 263 | extern void bio_reset(struct bio *); |
250 | 264 | ||
@@ -279,6 +293,9 @@ static inline void bio_flush_dcache_pages(struct bio *bi) | |||
279 | } | 293 | } |
280 | #endif | 294 | #endif |
281 | 295 | ||
296 | extern void bio_copy_data(struct bio *dst, struct bio *src); | ||
297 | extern int bio_alloc_pages(struct bio *bio, gfp_t gfp); | ||
298 | |||
282 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, | 299 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, |
283 | unsigned long, unsigned int, int, gfp_t); | 300 | unsigned long, unsigned int, int, gfp_t); |
284 | extern struct bio *bio_copy_user_iov(struct request_queue *, | 301 | extern struct bio *bio_copy_user_iov(struct request_queue *, |
@@ -286,8 +303,8 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, | |||
286 | int, int, gfp_t); | 303 | int, int, gfp_t); |
287 | extern int bio_uncopy_user(struct bio *); | 304 | extern int bio_uncopy_user(struct bio *); |
288 | void zero_fill_bio(struct bio *bio); | 305 | void zero_fill_bio(struct bio *bio); |
289 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); | 306 | extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *); |
290 | extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int); | 307 | extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int); |
291 | extern unsigned int bvec_nr_vecs(unsigned short idx); | 308 | extern unsigned int bvec_nr_vecs(unsigned short idx); |
292 | 309 | ||
293 | #ifdef CONFIG_BLK_CGROUP | 310 | #ifdef CONFIG_BLK_CGROUP |
@@ -298,39 +315,6 @@ static inline int bio_associate_current(struct bio *bio) { return -ENOENT; } | |||
298 | static inline void bio_disassociate_task(struct bio *bio) { } | 315 | static inline void bio_disassociate_task(struct bio *bio) { } |
299 | #endif /* CONFIG_BLK_CGROUP */ | 316 | #endif /* CONFIG_BLK_CGROUP */ |
300 | 317 | ||
301 | /* | ||
302 | * bio_set is used to allow other portions of the IO system to | ||
303 | * allocate their own private memory pools for bio and iovec structures. | ||
304 | * These memory pools in turn all allocate from the bio_slab | ||
305 | * and the bvec_slabs[]. | ||
306 | */ | ||
307 | #define BIO_POOL_SIZE 2 | ||
308 | #define BIOVEC_NR_POOLS 6 | ||
309 | #define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1) | ||
310 | |||
311 | struct bio_set { | ||
312 | struct kmem_cache *bio_slab; | ||
313 | unsigned int front_pad; | ||
314 | |||
315 | mempool_t *bio_pool; | ||
316 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
317 | mempool_t *bio_integrity_pool; | ||
318 | #endif | ||
319 | mempool_t *bvec_pool; | ||
320 | }; | ||
321 | |||
322 | struct biovec_slab { | ||
323 | int nr_vecs; | ||
324 | char *name; | ||
325 | struct kmem_cache *slab; | ||
326 | }; | ||
327 | |||
328 | /* | ||
329 | * a small number of entries is fine, not going to be performance critical. | ||
330 | * basically we just need to survive | ||
331 | */ | ||
332 | #define BIO_SPLIT_ENTRIES 2 | ||
333 | |||
334 | #ifdef CONFIG_HIGHMEM | 318 | #ifdef CONFIG_HIGHMEM |
335 | /* | 319 | /* |
336 | * remember never ever reenable interrupts between a bvec_kmap_irq and | 320 | * remember never ever reenable interrupts between a bvec_kmap_irq and |
@@ -527,6 +511,49 @@ static inline struct bio *bio_list_get(struct bio_list *bl) | |||
527 | return bio; | 511 | return bio; |
528 | } | 512 | } |
529 | 513 | ||
514 | /* | ||
515 | * bio_set is used to allow other portions of the IO system to | ||
516 | * allocate their own private memory pools for bio and iovec structures. | ||
517 | * These memory pools in turn all allocate from the bio_slab | ||
518 | * and the bvec_slabs[]. | ||
519 | */ | ||
520 | #define BIO_POOL_SIZE 2 | ||
521 | #define BIOVEC_NR_POOLS 6 | ||
522 | #define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1) | ||
523 | |||
524 | struct bio_set { | ||
525 | struct kmem_cache *bio_slab; | ||
526 | unsigned int front_pad; | ||
527 | |||
528 | mempool_t *bio_pool; | ||
529 | mempool_t *bvec_pool; | ||
530 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
531 | mempool_t *bio_integrity_pool; | ||
532 | mempool_t *bvec_integrity_pool; | ||
533 | #endif | ||
534 | |||
535 | /* | ||
536 | * Deadlock avoidance for stacking block drivers: see comments in | ||
537 | * bio_alloc_bioset() for details | ||
538 | */ | ||
539 | spinlock_t rescue_lock; | ||
540 | struct bio_list rescue_list; | ||
541 | struct work_struct rescue_work; | ||
542 | struct workqueue_struct *rescue_workqueue; | ||
543 | }; | ||
544 | |||
545 | struct biovec_slab { | ||
546 | int nr_vecs; | ||
547 | char *name; | ||
548 | struct kmem_cache *slab; | ||
549 | }; | ||
550 | |||
551 | /* | ||
552 | * a small number of entries is fine, not going to be performance critical. | ||
553 | * basically we just need to survive | ||
554 | */ | ||
555 | #define BIO_SPLIT_ENTRIES 2 | ||
556 | |||
530 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 557 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
531 | 558 | ||
532 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) | 559 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index cdf11191e645..fa1abeb45b76 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
@@ -111,12 +111,14 @@ struct bio { | |||
111 | #define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ | 111 | #define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ |
112 | #define BIO_QUIET 10 /* Make BIO Quiet */ | 112 | #define BIO_QUIET 10 /* Make BIO Quiet */ |
113 | #define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */ | 113 | #define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */ |
114 | #define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */ | ||
114 | 115 | ||
115 | /* | 116 | /* |
116 | * Flags starting here get preserved by bio_reset() - this includes | 117 | * Flags starting here get preserved by bio_reset() - this includes |
117 | * BIO_POOL_IDX() | 118 | * BIO_POOL_IDX() |
118 | */ | 119 | */ |
119 | #define BIO_RESET_BITS 12 | 120 | #define BIO_RESET_BITS 13 |
121 | #define BIO_OWNS_VEC 13 /* bio_free() should free bvec */ | ||
120 | 122 | ||
121 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) | 123 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) |
122 | 124 | ||
@@ -175,6 +177,7 @@ enum rq_flag_bits { | |||
175 | __REQ_IO_STAT, /* account I/O stat */ | 177 | __REQ_IO_STAT, /* account I/O stat */ |
176 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ | 178 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ |
177 | __REQ_KERNEL, /* direct IO to kernel pages */ | 179 | __REQ_KERNEL, /* direct IO to kernel pages */ |
180 | __REQ_PM, /* runtime pm request */ | ||
178 | __REQ_NR_BITS, /* stops here */ | 181 | __REQ_NR_BITS, /* stops here */ |
179 | }; | 182 | }; |
180 | 183 | ||
@@ -197,6 +200,8 @@ enum rq_flag_bits { | |||
197 | REQ_SECURE) | 200 | REQ_SECURE) |
198 | #define REQ_CLONE_MASK REQ_COMMON_MASK | 201 | #define REQ_CLONE_MASK REQ_COMMON_MASK |
199 | 202 | ||
203 | #define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME) | ||
204 | |||
200 | /* This mask is used for both bio and request merge checking */ | 205 | /* This mask is used for both bio and request merge checking */ |
201 | #define REQ_NOMERGE_FLAGS \ | 206 | #define REQ_NOMERGE_FLAGS \ |
202 | (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA) | 207 | (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA) |
@@ -223,5 +228,6 @@ enum rq_flag_bits { | |||
223 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) | 228 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) |
224 | #define REQ_SECURE (1 << __REQ_SECURE) | 229 | #define REQ_SECURE (1 << __REQ_SECURE) |
225 | #define REQ_KERNEL (1 << __REQ_KERNEL) | 230 | #define REQ_KERNEL (1 << __REQ_KERNEL) |
231 | #define REQ_PM (1 << __REQ_PM) | ||
226 | 232 | ||
227 | #endif /* __LINUX_BLK_TYPES_H */ | 233 | #endif /* __LINUX_BLK_TYPES_H */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 78feda9bbae2..2fdb4a451b49 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -361,6 +361,12 @@ struct request_queue { | |||
361 | */ | 361 | */ |
362 | struct kobject kobj; | 362 | struct kobject kobj; |
363 | 363 | ||
364 | #ifdef CONFIG_PM_RUNTIME | ||
365 | struct device *dev; | ||
366 | int rpm_status; | ||
367 | unsigned int nr_pending; | ||
368 | #endif | ||
369 | |||
364 | /* | 370 | /* |
365 | * queue settings | 371 | * queue settings |
366 | */ | 372 | */ |
@@ -838,7 +844,7 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, | |||
838 | unsigned int cmd_flags) | 844 | unsigned int cmd_flags) |
839 | { | 845 | { |
840 | if (unlikely(cmd_flags & REQ_DISCARD)) | 846 | if (unlikely(cmd_flags & REQ_DISCARD)) |
841 | return q->limits.max_discard_sectors; | 847 | return min(q->limits.max_discard_sectors, UINT_MAX >> 9); |
842 | 848 | ||
843 | if (unlikely(cmd_flags & REQ_WRITE_SAME)) | 849 | if (unlikely(cmd_flags & REQ_WRITE_SAME)) |
844 | return q->limits.max_write_same_sectors; | 850 | return q->limits.max_write_same_sectors; |
@@ -961,6 +967,27 @@ struct request_queue *blk_alloc_queue_node(gfp_t, int); | |||
961 | extern void blk_put_queue(struct request_queue *); | 967 | extern void blk_put_queue(struct request_queue *); |
962 | 968 | ||
963 | /* | 969 | /* |
970 | * block layer runtime pm functions | ||
971 | */ | ||
972 | #ifdef CONFIG_PM_RUNTIME | ||
973 | extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev); | ||
974 | extern int blk_pre_runtime_suspend(struct request_queue *q); | ||
975 | extern void blk_post_runtime_suspend(struct request_queue *q, int err); | ||
976 | extern void blk_pre_runtime_resume(struct request_queue *q); | ||
977 | extern void blk_post_runtime_resume(struct request_queue *q, int err); | ||
978 | #else | ||
979 | static inline void blk_pm_runtime_init(struct request_queue *q, | ||
980 | struct device *dev) {} | ||
981 | static inline int blk_pre_runtime_suspend(struct request_queue *q) | ||
982 | { | ||
983 | return -ENOSYS; | ||
984 | } | ||
985 | static inline void blk_post_runtime_suspend(struct request_queue *q, int err) {} | ||
986 | static inline void blk_pre_runtime_resume(struct request_queue *q) {} | ||
987 | static inline void blk_post_runtime_resume(struct request_queue *q, int err) {} | ||
988 | #endif | ||
989 | |||
990 | /* | ||
964 | * blk_plug permits building a queue of related requests by holding the I/O | 991 | * blk_plug permits building a queue of related requests by holding the I/O |
965 | * fragments for a short period. This allows merging of sequential requests | 992 | * fragments for a short period. This allows merging of sequential requests |
966 | * into single larger request. As the requests are moved from a per-task list to | 993 | * into single larger request. As the requests are moved from a per-task list to |
@@ -1484,7 +1511,7 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g) | |||
1484 | 1511 | ||
1485 | struct block_device_operations { | 1512 | struct block_device_operations { |
1486 | int (*open) (struct block_device *, fmode_t); | 1513 | int (*open) (struct block_device *, fmode_t); |
1487 | int (*release) (struct gendisk *, fmode_t); | 1514 | void (*release) (struct gendisk *, fmode_t); |
1488 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1515 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1489 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1516 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1490 | int (*direct_access) (struct block_device *, sector_t, | 1517 | int (*direct_access) (struct block_device *, sector_t, |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index cdc3bab01832..5f0b0e1f7c08 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -44,7 +44,6 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat, | |||
44 | unsigned long endpfn); | 44 | unsigned long endpfn); |
45 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); | 45 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
46 | 46 | ||
47 | extern unsigned long free_low_memory_core_early(int nodeid); | ||
48 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | 47 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); |
49 | extern unsigned long free_all_bootmem(void); | 48 | extern unsigned long free_all_bootmem(void); |
50 | 49 | ||
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 5afc4f94d110..9e52b0626b39 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -34,6 +34,8 @@ enum bh_state_bits { | |||
34 | BH_Write_EIO, /* I/O error on write */ | 34 | BH_Write_EIO, /* I/O error on write */ |
35 | BH_Unwritten, /* Buffer is allocated on disk but not written */ | 35 | BH_Unwritten, /* Buffer is allocated on disk but not written */ |
36 | BH_Quiet, /* Buffer Error Prinks to be quiet */ | 36 | BH_Quiet, /* Buffer Error Prinks to be quiet */ |
37 | BH_Meta, /* Buffer contains metadata */ | ||
38 | BH_Prio, /* Buffer should be submitted with REQ_PRIO */ | ||
37 | 39 | ||
38 | BH_PrivateStart,/* not a state bit, but the first bit available | 40 | BH_PrivateStart,/* not a state bit, but the first bit available |
39 | * for private allocation by other entities | 41 | * for private allocation by other entities |
@@ -124,6 +126,8 @@ BUFFER_FNS(Delay, delay) | |||
124 | BUFFER_FNS(Boundary, boundary) | 126 | BUFFER_FNS(Boundary, boundary) |
125 | BUFFER_FNS(Write_EIO, write_io_error) | 127 | BUFFER_FNS(Write_EIO, write_io_error) |
126 | BUFFER_FNS(Unwritten, unwritten) | 128 | BUFFER_FNS(Unwritten, unwritten) |
129 | BUFFER_FNS(Meta, meta) | ||
130 | BUFFER_FNS(Prio, prio) | ||
127 | 131 | ||
128 | #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) | 132 | #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) |
129 | 133 | ||
@@ -181,6 +185,7 @@ void ll_rw_block(int, int, struct buffer_head * bh[]); | |||
181 | int sync_dirty_buffer(struct buffer_head *bh); | 185 | int sync_dirty_buffer(struct buffer_head *bh); |
182 | int __sync_dirty_buffer(struct buffer_head *bh, int rw); | 186 | int __sync_dirty_buffer(struct buffer_head *bh, int rw); |
183 | void write_dirty_buffer(struct buffer_head *bh, int rw); | 187 | void write_dirty_buffer(struct buffer_head *bh, int rw); |
188 | int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags); | ||
184 | int submit_bh(int, struct buffer_head *); | 189 | int submit_bh(int, struct buffer_head *); |
185 | void write_boundary_block(struct block_device *bdev, | 190 | void write_boundary_block(struct block_device *bdev, |
186 | sector_t bblock, unsigned blocksize); | 191 | sector_t bblock, unsigned blocksize); |
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h index d4080f309b56..5f3386844134 100644 --- a/include/linux/ceph/auth.h +++ b/include/linux/ceph/auth.h | |||
@@ -52,6 +52,9 @@ struct ceph_auth_client_ops { | |||
52 | */ | 52 | */ |
53 | int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type, | 53 | int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type, |
54 | struct ceph_auth_handshake *auth); | 54 | struct ceph_auth_handshake *auth); |
55 | /* ensure that an existing authorizer is up to date */ | ||
56 | int (*update_authorizer)(struct ceph_auth_client *ac, int peer_type, | ||
57 | struct ceph_auth_handshake *auth); | ||
55 | int (*verify_authorizer_reply)(struct ceph_auth_client *ac, | 58 | int (*verify_authorizer_reply)(struct ceph_auth_client *ac, |
56 | struct ceph_authorizer *a, size_t len); | 59 | struct ceph_authorizer *a, size_t len); |
57 | void (*destroy_authorizer)(struct ceph_auth_client *ac, | 60 | void (*destroy_authorizer)(struct ceph_auth_client *ac, |
@@ -75,6 +78,8 @@ struct ceph_auth_client { | |||
75 | u64 global_id; /* our unique id in system */ | 78 | u64 global_id; /* our unique id in system */ |
76 | const struct ceph_crypto_key *key; /* our secret key */ | 79 | const struct ceph_crypto_key *key; /* our secret key */ |
77 | unsigned want_keys; /* which services we want */ | 80 | unsigned want_keys; /* which services we want */ |
81 | |||
82 | struct mutex mutex; | ||
78 | }; | 83 | }; |
79 | 84 | ||
80 | extern struct ceph_auth_client *ceph_auth_init(const char *name, | 85 | extern struct ceph_auth_client *ceph_auth_init(const char *name, |
@@ -94,5 +99,18 @@ extern int ceph_build_auth(struct ceph_auth_client *ac, | |||
94 | void *msg_buf, size_t msg_len); | 99 | void *msg_buf, size_t msg_len); |
95 | 100 | ||
96 | extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac); | 101 | extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac); |
102 | extern int ceph_auth_create_authorizer(struct ceph_auth_client *ac, | ||
103 | int peer_type, | ||
104 | struct ceph_auth_handshake *auth); | ||
105 | extern void ceph_auth_destroy_authorizer(struct ceph_auth_client *ac, | ||
106 | struct ceph_authorizer *a); | ||
107 | extern int ceph_auth_update_authorizer(struct ceph_auth_client *ac, | ||
108 | int peer_type, | ||
109 | struct ceph_auth_handshake *a); | ||
110 | extern int ceph_auth_verify_authorizer_reply(struct ceph_auth_client *ac, | ||
111 | struct ceph_authorizer *a, | ||
112 | size_t len); | ||
113 | extern void ceph_auth_invalidate_authorizer(struct ceph_auth_client *ac, | ||
114 | int peer_type); | ||
97 | 115 | ||
98 | #endif | 116 | #endif |
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h index 76554cecaab2..4c42080347af 100644 --- a/include/linux/ceph/ceph_features.h +++ b/include/linux/ceph/ceph_features.h | |||
@@ -41,6 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | #define CEPH_FEATURES_SUPPORTED_DEFAULT \ | 42 | #define CEPH_FEATURES_SUPPORTED_DEFAULT \ |
43 | (CEPH_FEATURE_NOSRCADDR | \ | 43 | (CEPH_FEATURE_NOSRCADDR | \ |
44 | CEPH_FEATURE_RECONNECT_SEQ | \ | ||
44 | CEPH_FEATURE_PGID64 | \ | 45 | CEPH_FEATURE_PGID64 | \ |
45 | CEPH_FEATURE_PGPOOL3 | \ | 46 | CEPH_FEATURE_PGPOOL3 | \ |
46 | CEPH_FEATURE_OSDENC | \ | 47 | CEPH_FEATURE_OSDENC | \ |
@@ -51,6 +52,7 @@ | |||
51 | 52 | ||
52 | #define CEPH_FEATURES_REQUIRED_DEFAULT \ | 53 | #define CEPH_FEATURES_REQUIRED_DEFAULT \ |
53 | (CEPH_FEATURE_NOSRCADDR | \ | 54 | (CEPH_FEATURE_NOSRCADDR | \ |
55 | CEPH_FEATURE_RECONNECT_SEQ | \ | ||
54 | CEPH_FEATURE_PGID64 | \ | 56 | CEPH_FEATURE_PGID64 | \ |
55 | CEPH_FEATURE_PGPOOL3 | \ | 57 | CEPH_FEATURE_PGPOOL3 | \ |
56 | CEPH_FEATURE_OSDENC) | 58 | CEPH_FEATURE_OSDENC) |
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h index 360d9d08ca9e..379f71508995 100644 --- a/include/linux/ceph/decode.h +++ b/include/linux/ceph/decode.h | |||
@@ -8,6 +8,23 @@ | |||
8 | 8 | ||
9 | #include <linux/ceph/types.h> | 9 | #include <linux/ceph/types.h> |
10 | 10 | ||
11 | /* This seemed to be the easiest place to define these */ | ||
12 | |||
13 | #define U8_MAX ((u8)(~0U)) | ||
14 | #define U16_MAX ((u16)(~0U)) | ||
15 | #define U32_MAX ((u32)(~0U)) | ||
16 | #define U64_MAX ((u64)(~0ULL)) | ||
17 | |||
18 | #define S8_MAX ((s8)(U8_MAX >> 1)) | ||
19 | #define S16_MAX ((s16)(U16_MAX >> 1)) | ||
20 | #define S32_MAX ((s32)(U32_MAX >> 1)) | ||
21 | #define S64_MAX ((s64)(U64_MAX >> 1LL)) | ||
22 | |||
23 | #define S8_MIN ((s8)(-S8_MAX - 1)) | ||
24 | #define S16_MIN ((s16)(-S16_MAX - 1)) | ||
25 | #define S32_MIN ((s32)(-S32_MAX - 1)) | ||
26 | #define S64_MIN ((s64)(-S64_MAX - 1LL)) | ||
27 | |||
11 | /* | 28 | /* |
12 | * in all cases, | 29 | * in all cases, |
13 | * void **p pointer to position pointer | 30 | * void **p pointer to position pointer |
@@ -137,14 +154,19 @@ bad: | |||
137 | static inline void ceph_decode_timespec(struct timespec *ts, | 154 | static inline void ceph_decode_timespec(struct timespec *ts, |
138 | const struct ceph_timespec *tv) | 155 | const struct ceph_timespec *tv) |
139 | { | 156 | { |
140 | ts->tv_sec = le32_to_cpu(tv->tv_sec); | 157 | ts->tv_sec = (__kernel_time_t)le32_to_cpu(tv->tv_sec); |
141 | ts->tv_nsec = le32_to_cpu(tv->tv_nsec); | 158 | ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec); |
142 | } | 159 | } |
143 | static inline void ceph_encode_timespec(struct ceph_timespec *tv, | 160 | static inline void ceph_encode_timespec(struct ceph_timespec *tv, |
144 | const struct timespec *ts) | 161 | const struct timespec *ts) |
145 | { | 162 | { |
146 | tv->tv_sec = cpu_to_le32(ts->tv_sec); | 163 | BUG_ON(ts->tv_sec < 0); |
147 | tv->tv_nsec = cpu_to_le32(ts->tv_nsec); | 164 | BUG_ON(ts->tv_sec > (__kernel_time_t)U32_MAX); |
165 | BUG_ON(ts->tv_nsec < 0); | ||
166 | BUG_ON(ts->tv_nsec > (long)U32_MAX); | ||
167 | |||
168 | tv->tv_sec = cpu_to_le32((u32)ts->tv_sec); | ||
169 | tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec); | ||
148 | } | 170 | } |
149 | 171 | ||
150 | /* | 172 | /* |
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 29818fc3fa49..2e3024881a5e 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
@@ -66,6 +66,7 @@ struct ceph_options { | |||
66 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 | 66 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 |
67 | 67 | ||
68 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) | 68 | #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) |
69 | #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) | ||
69 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) | 70 | #define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) |
70 | 71 | ||
71 | #define CEPH_AUTH_NAME_DEFAULT "guest" | 72 | #define CEPH_AUTH_NAME_DEFAULT "guest" |
@@ -156,31 +157,11 @@ struct ceph_snap_context { | |||
156 | u64 snaps[]; | 157 | u64 snaps[]; |
157 | }; | 158 | }; |
158 | 159 | ||
159 | static inline struct ceph_snap_context * | 160 | extern struct ceph_snap_context *ceph_create_snap_context(u32 snap_count, |
160 | ceph_get_snap_context(struct ceph_snap_context *sc) | 161 | gfp_t gfp_flags); |
161 | { | 162 | extern struct ceph_snap_context *ceph_get_snap_context( |
162 | /* | 163 | struct ceph_snap_context *sc); |
163 | printk("get_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref), | 164 | extern void ceph_put_snap_context(struct ceph_snap_context *sc); |
164 | atomic_read(&sc->nref)+1); | ||
165 | */ | ||
166 | if (sc) | ||
167 | atomic_inc(&sc->nref); | ||
168 | return sc; | ||
169 | } | ||
170 | |||
171 | static inline void ceph_put_snap_context(struct ceph_snap_context *sc) | ||
172 | { | ||
173 | if (!sc) | ||
174 | return; | ||
175 | /* | ||
176 | printk("put_snap_context %p %d -> %d\n", sc, atomic_read(&sc->nref), | ||
177 | atomic_read(&sc->nref)-1); | ||
178 | */ | ||
179 | if (atomic_dec_and_test(&sc->nref)) { | ||
180 | /*printk(" deleting snap_context %p\n", sc);*/ | ||
181 | kfree(sc); | ||
182 | } | ||
183 | } | ||
184 | 165 | ||
185 | /* | 166 | /* |
186 | * calculate the number of pages a given length and offset map onto, | 167 | * calculate the number of pages a given length and offset map onto, |
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 60903e0f665c..7c1420bb1dce 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -64,6 +64,77 @@ struct ceph_messenger { | |||
64 | u32 required_features; | 64 | u32 required_features; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | enum ceph_msg_data_type { | ||
68 | CEPH_MSG_DATA_NONE, /* message contains no data payload */ | ||
69 | CEPH_MSG_DATA_PAGES, /* data source/destination is a page array */ | ||
70 | CEPH_MSG_DATA_PAGELIST, /* data source/destination is a pagelist */ | ||
71 | #ifdef CONFIG_BLOCK | ||
72 | CEPH_MSG_DATA_BIO, /* data source/destination is a bio list */ | ||
73 | #endif /* CONFIG_BLOCK */ | ||
74 | }; | ||
75 | |||
76 | static __inline__ bool ceph_msg_data_type_valid(enum ceph_msg_data_type type) | ||
77 | { | ||
78 | switch (type) { | ||
79 | case CEPH_MSG_DATA_NONE: | ||
80 | case CEPH_MSG_DATA_PAGES: | ||
81 | case CEPH_MSG_DATA_PAGELIST: | ||
82 | #ifdef CONFIG_BLOCK | ||
83 | case CEPH_MSG_DATA_BIO: | ||
84 | #endif /* CONFIG_BLOCK */ | ||
85 | return true; | ||
86 | default: | ||
87 | return false; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | struct ceph_msg_data { | ||
92 | struct list_head links; /* ceph_msg->data */ | ||
93 | enum ceph_msg_data_type type; | ||
94 | union { | ||
95 | #ifdef CONFIG_BLOCK | ||
96 | struct { | ||
97 | struct bio *bio; | ||
98 | size_t bio_length; | ||
99 | }; | ||
100 | #endif /* CONFIG_BLOCK */ | ||
101 | struct { | ||
102 | struct page **pages; /* NOT OWNER. */ | ||
103 | size_t length; /* total # bytes */ | ||
104 | unsigned int alignment; /* first page */ | ||
105 | }; | ||
106 | struct ceph_pagelist *pagelist; | ||
107 | }; | ||
108 | }; | ||
109 | |||
110 | struct ceph_msg_data_cursor { | ||
111 | size_t total_resid; /* across all data items */ | ||
112 | struct list_head *data_head; /* = &ceph_msg->data */ | ||
113 | |||
114 | struct ceph_msg_data *data; /* current data item */ | ||
115 | size_t resid; /* bytes not yet consumed */ | ||
116 | bool last_piece; /* current is last piece */ | ||
117 | bool need_crc; /* crc update needed */ | ||
118 | union { | ||
119 | #ifdef CONFIG_BLOCK | ||
120 | struct { /* bio */ | ||
121 | struct bio *bio; /* bio from list */ | ||
122 | unsigned int vector_index; /* vector from bio */ | ||
123 | unsigned int vector_offset; /* bytes from vector */ | ||
124 | }; | ||
125 | #endif /* CONFIG_BLOCK */ | ||
126 | struct { /* pages */ | ||
127 | unsigned int page_offset; /* offset in page */ | ||
128 | unsigned short page_index; /* index in array */ | ||
129 | unsigned short page_count; /* pages in array */ | ||
130 | }; | ||
131 | struct { /* pagelist */ | ||
132 | struct page *page; /* page from list */ | ||
133 | size_t offset; /* bytes from list */ | ||
134 | }; | ||
135 | }; | ||
136 | }; | ||
137 | |||
67 | /* | 138 | /* |
68 | * a single message. it contains a header (src, dest, message type, etc.), | 139 | * a single message. it contains a header (src, dest, message type, etc.), |
69 | * footer (crc values, mainly), a "front" message body, and possibly a | 140 | * footer (crc values, mainly), a "front" message body, and possibly a |
@@ -74,21 +145,15 @@ struct ceph_msg { | |||
74 | struct ceph_msg_footer footer; /* footer */ | 145 | struct ceph_msg_footer footer; /* footer */ |
75 | struct kvec front; /* unaligned blobs of message */ | 146 | struct kvec front; /* unaligned blobs of message */ |
76 | struct ceph_buffer *middle; | 147 | struct ceph_buffer *middle; |
77 | struct page **pages; /* data payload. NOT OWNER. */ | 148 | |
78 | unsigned nr_pages; /* size of page array */ | 149 | size_t data_length; |
79 | unsigned page_alignment; /* io offset in first page */ | 150 | struct list_head data; |
80 | struct ceph_pagelist *pagelist; /* instead of pages */ | 151 | struct ceph_msg_data_cursor cursor; |
81 | 152 | ||
82 | struct ceph_connection *con; | 153 | struct ceph_connection *con; |
83 | struct list_head list_head; | 154 | struct list_head list_head; /* links for connection lists */ |
84 | 155 | ||
85 | struct kref kref; | 156 | struct kref kref; |
86 | #ifdef CONFIG_BLOCK | ||
87 | struct bio *bio; /* instead of pages/pagelist */ | ||
88 | struct bio *bio_iter; /* bio iterator */ | ||
89 | int bio_seg; /* current bio segment */ | ||
90 | #endif /* CONFIG_BLOCK */ | ||
91 | struct ceph_pagelist *trail; /* the trailing part of the data */ | ||
92 | bool front_is_vmalloc; | 157 | bool front_is_vmalloc; |
93 | bool more_to_follow; | 158 | bool more_to_follow; |
94 | bool needs_out_seq; | 159 | bool needs_out_seq; |
@@ -98,12 +163,6 @@ struct ceph_msg { | |||
98 | struct ceph_msgpool *pool; | 163 | struct ceph_msgpool *pool; |
99 | }; | 164 | }; |
100 | 165 | ||
101 | struct ceph_msg_pos { | ||
102 | int page, page_pos; /* which page; offset in page */ | ||
103 | int data_pos; /* offset in data payload */ | ||
104 | bool did_page_crc; /* true if we've calculated crc for current page */ | ||
105 | }; | ||
106 | |||
107 | /* ceph connection fault delay defaults, for exponential backoff */ | 166 | /* ceph connection fault delay defaults, for exponential backoff */ |
108 | #define BASE_DELAY_INTERVAL (HZ/2) | 167 | #define BASE_DELAY_INTERVAL (HZ/2) |
109 | #define MAX_DELAY_INTERVAL (5 * 60 * HZ) | 168 | #define MAX_DELAY_INTERVAL (5 * 60 * HZ) |
@@ -161,7 +220,6 @@ struct ceph_connection { | |||
161 | struct ceph_msg *out_msg; /* sending message (== tail of | 220 | struct ceph_msg *out_msg; /* sending message (== tail of |
162 | out_sent) */ | 221 | out_sent) */ |
163 | bool out_msg_done; | 222 | bool out_msg_done; |
164 | struct ceph_msg_pos out_msg_pos; | ||
165 | 223 | ||
166 | struct kvec out_kvec[8], /* sending header/footer data */ | 224 | struct kvec out_kvec[8], /* sending header/footer data */ |
167 | *out_kvec_cur; | 225 | *out_kvec_cur; |
@@ -175,7 +233,6 @@ struct ceph_connection { | |||
175 | /* message in temps */ | 233 | /* message in temps */ |
176 | struct ceph_msg_header in_hdr; | 234 | struct ceph_msg_header in_hdr; |
177 | struct ceph_msg *in_msg; | 235 | struct ceph_msg *in_msg; |
178 | struct ceph_msg_pos in_msg_pos; | ||
179 | u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */ | 236 | u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */ |
180 | 237 | ||
181 | char in_tag; /* protocol control byte */ | 238 | char in_tag; /* protocol control byte */ |
@@ -218,6 +275,15 @@ extern void ceph_msg_revoke_incoming(struct ceph_msg *msg); | |||
218 | 275 | ||
219 | extern void ceph_con_keepalive(struct ceph_connection *con); | 276 | extern void ceph_con_keepalive(struct ceph_connection *con); |
220 | 277 | ||
278 | extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, | ||
279 | size_t length, size_t alignment); | ||
280 | extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg, | ||
281 | struct ceph_pagelist *pagelist); | ||
282 | #ifdef CONFIG_BLOCK | ||
283 | extern void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio, | ||
284 | size_t length); | ||
285 | #endif /* CONFIG_BLOCK */ | ||
286 | |||
221 | extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | 287 | extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, |
222 | bool can_fail); | 288 | bool can_fail); |
223 | extern void ceph_msg_kfree(struct ceph_msg *m); | 289 | extern void ceph_msg_kfree(struct ceph_msg *m); |
diff --git a/include/linux/ceph/msgr.h b/include/linux/ceph/msgr.h index 680d3d648cac..3d94a73b5f30 100644 --- a/include/linux/ceph/msgr.h +++ b/include/linux/ceph/msgr.h | |||
@@ -87,6 +87,7 @@ struct ceph_entity_inst { | |||
87 | #define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */ | 87 | #define CEPH_MSGR_TAG_BADPROTOVER 10 /* bad protocol version */ |
88 | #define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */ | 88 | #define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */ |
89 | #define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */ | 89 | #define CEPH_MSGR_TAG_FEATURES 12 /* insufficient features */ |
90 | #define CEPH_MSGR_TAG_SEQ 13 /* 64-bit int follows with seen seq number */ | ||
90 | 91 | ||
91 | 92 | ||
92 | /* | 93 | /* |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 1dd5d466b6f9..186db0bf4951 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -29,6 +29,7 @@ struct ceph_authorizer; | |||
29 | */ | 29 | */ |
30 | typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *, | 30 | typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *, |
31 | struct ceph_msg *); | 31 | struct ceph_msg *); |
32 | typedef void (*ceph_osdc_unsafe_callback_t)(struct ceph_osd_request *, bool); | ||
32 | 33 | ||
33 | /* a given osd we're communicating with */ | 34 | /* a given osd we're communicating with */ |
34 | struct ceph_osd { | 35 | struct ceph_osd { |
@@ -48,7 +49,67 @@ struct ceph_osd { | |||
48 | }; | 49 | }; |
49 | 50 | ||
50 | 51 | ||
51 | #define CEPH_OSD_MAX_OP 10 | 52 | #define CEPH_OSD_MAX_OP 2 |
53 | |||
54 | enum ceph_osd_data_type { | ||
55 | CEPH_OSD_DATA_TYPE_NONE = 0, | ||
56 | CEPH_OSD_DATA_TYPE_PAGES, | ||
57 | CEPH_OSD_DATA_TYPE_PAGELIST, | ||
58 | #ifdef CONFIG_BLOCK | ||
59 | CEPH_OSD_DATA_TYPE_BIO, | ||
60 | #endif /* CONFIG_BLOCK */ | ||
61 | }; | ||
62 | |||
63 | struct ceph_osd_data { | ||
64 | enum ceph_osd_data_type type; | ||
65 | union { | ||
66 | struct { | ||
67 | struct page **pages; | ||
68 | u64 length; | ||
69 | u32 alignment; | ||
70 | bool pages_from_pool; | ||
71 | bool own_pages; | ||
72 | }; | ||
73 | struct ceph_pagelist *pagelist; | ||
74 | #ifdef CONFIG_BLOCK | ||
75 | struct { | ||
76 | struct bio *bio; /* list of bios */ | ||
77 | size_t bio_length; /* total in list */ | ||
78 | }; | ||
79 | #endif /* CONFIG_BLOCK */ | ||
80 | }; | ||
81 | }; | ||
82 | |||
83 | struct ceph_osd_req_op { | ||
84 | u16 op; /* CEPH_OSD_OP_* */ | ||
85 | u32 payload_len; | ||
86 | union { | ||
87 | struct ceph_osd_data raw_data_in; | ||
88 | struct { | ||
89 | u64 offset, length; | ||
90 | u64 truncate_size; | ||
91 | u32 truncate_seq; | ||
92 | struct ceph_osd_data osd_data; | ||
93 | } extent; | ||
94 | struct { | ||
95 | const char *class_name; | ||
96 | const char *method_name; | ||
97 | struct ceph_osd_data request_info; | ||
98 | struct ceph_osd_data request_data; | ||
99 | struct ceph_osd_data response_data; | ||
100 | __u8 class_len; | ||
101 | __u8 method_len; | ||
102 | __u8 argc; | ||
103 | } cls; | ||
104 | struct { | ||
105 | u64 cookie; | ||
106 | u64 ver; | ||
107 | u32 prot_ver; | ||
108 | u32 timeout; | ||
109 | __u8 flag; | ||
110 | } watch; | ||
111 | }; | ||
112 | }; | ||
52 | 113 | ||
53 | /* an in-flight request */ | 114 | /* an in-flight request */ |
54 | struct ceph_osd_request { | 115 | struct ceph_osd_request { |
@@ -63,15 +124,14 @@ struct ceph_osd_request { | |||
63 | int r_pg_osds[CEPH_PG_MAX_SIZE]; | 124 | int r_pg_osds[CEPH_PG_MAX_SIZE]; |
64 | int r_num_pg_osds; | 125 | int r_num_pg_osds; |
65 | 126 | ||
66 | struct ceph_connection *r_con_filling_msg; | ||
67 | |||
68 | struct ceph_msg *r_request, *r_reply; | 127 | struct ceph_msg *r_request, *r_reply; |
69 | int r_flags; /* any additional flags for the osd */ | 128 | int r_flags; /* any additional flags for the osd */ |
70 | u32 r_sent; /* >0 if r_request is sending/sent */ | 129 | u32 r_sent; /* >0 if r_request is sending/sent */ |
71 | int r_num_ops; | ||
72 | 130 | ||
73 | /* encoded message content */ | 131 | /* request osd ops array */ |
74 | struct ceph_osd_op *r_request_ops; | 132 | unsigned int r_num_ops; |
133 | struct ceph_osd_req_op r_ops[CEPH_OSD_MAX_OP]; | ||
134 | |||
75 | /* these are updated on each send */ | 135 | /* these are updated on each send */ |
76 | __le32 *r_request_osdmap_epoch; | 136 | __le32 *r_request_osdmap_epoch; |
77 | __le32 *r_request_flags; | 137 | __le32 *r_request_flags; |
@@ -85,12 +145,14 @@ struct ceph_osd_request { | |||
85 | s32 r_reply_op_result[CEPH_OSD_MAX_OP]; | 145 | s32 r_reply_op_result[CEPH_OSD_MAX_OP]; |
86 | int r_got_reply; | 146 | int r_got_reply; |
87 | int r_linger; | 147 | int r_linger; |
148 | int r_completed; | ||
88 | 149 | ||
89 | struct ceph_osd_client *r_osdc; | 150 | struct ceph_osd_client *r_osdc; |
90 | struct kref r_kref; | 151 | struct kref r_kref; |
91 | bool r_mempool; | 152 | bool r_mempool; |
92 | struct completion r_completion, r_safe_completion; | 153 | struct completion r_completion, r_safe_completion; |
93 | ceph_osdc_callback_t r_callback, r_safe_callback; | 154 | ceph_osdc_callback_t r_callback; |
155 | ceph_osdc_unsafe_callback_t r_unsafe_callback; | ||
94 | struct ceph_eversion r_reassert_version; | 156 | struct ceph_eversion r_reassert_version; |
95 | struct list_head r_unsafe_item; | 157 | struct list_head r_unsafe_item; |
96 | 158 | ||
@@ -104,16 +166,6 @@ struct ceph_osd_request { | |||
104 | 166 | ||
105 | struct ceph_file_layout r_file_layout; | 167 | struct ceph_file_layout r_file_layout; |
106 | struct ceph_snap_context *r_snapc; /* snap context for writes */ | 168 | struct ceph_snap_context *r_snapc; /* snap context for writes */ |
107 | unsigned r_num_pages; /* size of page array (follows) */ | ||
108 | unsigned r_page_alignment; /* io offset in first page */ | ||
109 | struct page **r_pages; /* pages for data payload */ | ||
110 | int r_pages_from_pool; | ||
111 | int r_own_pages; /* if true, i own page list */ | ||
112 | #ifdef CONFIG_BLOCK | ||
113 | struct bio *r_bio; /* instead of pages */ | ||
114 | #endif | ||
115 | |||
116 | struct ceph_pagelist r_trail; /* trailing part of the data */ | ||
117 | }; | 169 | }; |
118 | 170 | ||
119 | struct ceph_osd_event { | 171 | struct ceph_osd_event { |
@@ -172,48 +224,8 @@ struct ceph_osd_client { | |||
172 | struct workqueue_struct *notify_wq; | 224 | struct workqueue_struct *notify_wq; |
173 | }; | 225 | }; |
174 | 226 | ||
175 | struct ceph_osd_req_op { | 227 | extern int ceph_osdc_setup(void); |
176 | u16 op; /* CEPH_OSD_OP_* */ | 228 | extern void ceph_osdc_cleanup(void); |
177 | u32 payload_len; | ||
178 | union { | ||
179 | struct { | ||
180 | u64 offset, length; | ||
181 | u64 truncate_size; | ||
182 | u32 truncate_seq; | ||
183 | } extent; | ||
184 | struct { | ||
185 | const char *name; | ||
186 | const char *val; | ||
187 | u32 name_len; | ||
188 | u32 value_len; | ||
189 | __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */ | ||
190 | __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ | ||
191 | } xattr; | ||
192 | struct { | ||
193 | const char *class_name; | ||
194 | const char *method_name; | ||
195 | const char *indata; | ||
196 | u32 indata_len; | ||
197 | __u8 class_len; | ||
198 | __u8 method_len; | ||
199 | __u8 argc; | ||
200 | } cls; | ||
201 | struct { | ||
202 | u64 cookie; | ||
203 | u64 count; | ||
204 | } pgls; | ||
205 | struct { | ||
206 | u64 snapid; | ||
207 | } snap; | ||
208 | struct { | ||
209 | u64 cookie; | ||
210 | u64 ver; | ||
211 | u32 prot_ver; | ||
212 | u32 timeout; | ||
213 | __u8 flag; | ||
214 | } watch; | ||
215 | }; | ||
216 | }; | ||
217 | 229 | ||
218 | extern int ceph_osdc_init(struct ceph_osd_client *osdc, | 230 | extern int ceph_osdc_init(struct ceph_osd_client *osdc, |
219 | struct ceph_client *client); | 231 | struct ceph_client *client); |
@@ -224,16 +236,71 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc, | |||
224 | extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, | 236 | extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, |
225 | struct ceph_msg *msg); | 237 | struct ceph_msg *msg); |
226 | 238 | ||
239 | extern void osd_req_op_init(struct ceph_osd_request *osd_req, | ||
240 | unsigned int which, u16 opcode); | ||
241 | |||
242 | extern void osd_req_op_raw_data_in_pages(struct ceph_osd_request *, | ||
243 | unsigned int which, | ||
244 | struct page **pages, u64 length, | ||
245 | u32 alignment, bool pages_from_pool, | ||
246 | bool own_pages); | ||
247 | |||
248 | extern void osd_req_op_extent_init(struct ceph_osd_request *osd_req, | ||
249 | unsigned int which, u16 opcode, | ||
250 | u64 offset, u64 length, | ||
251 | u64 truncate_size, u32 truncate_seq); | ||
252 | extern void osd_req_op_extent_update(struct ceph_osd_request *osd_req, | ||
253 | unsigned int which, u64 length); | ||
254 | |||
255 | extern struct ceph_osd_data *osd_req_op_extent_osd_data( | ||
256 | struct ceph_osd_request *osd_req, | ||
257 | unsigned int which); | ||
258 | extern struct ceph_osd_data *osd_req_op_cls_response_data( | ||
259 | struct ceph_osd_request *osd_req, | ||
260 | unsigned int which); | ||
261 | |||
262 | extern void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *, | ||
263 | unsigned int which, | ||
264 | struct page **pages, u64 length, | ||
265 | u32 alignment, bool pages_from_pool, | ||
266 | bool own_pages); | ||
267 | extern void osd_req_op_extent_osd_data_pagelist(struct ceph_osd_request *, | ||
268 | unsigned int which, | ||
269 | struct ceph_pagelist *pagelist); | ||
270 | #ifdef CONFIG_BLOCK | ||
271 | extern void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *, | ||
272 | unsigned int which, | ||
273 | struct bio *bio, size_t bio_length); | ||
274 | #endif /* CONFIG_BLOCK */ | ||
275 | |||
276 | extern void osd_req_op_cls_request_data_pagelist(struct ceph_osd_request *, | ||
277 | unsigned int which, | ||
278 | struct ceph_pagelist *pagelist); | ||
279 | extern void osd_req_op_cls_request_data_pages(struct ceph_osd_request *, | ||
280 | unsigned int which, | ||
281 | struct page **pages, u64 length, | ||
282 | u32 alignment, bool pages_from_pool, | ||
283 | bool own_pages); | ||
284 | extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *, | ||
285 | unsigned int which, | ||
286 | struct page **pages, u64 length, | ||
287 | u32 alignment, bool pages_from_pool, | ||
288 | bool own_pages); | ||
289 | |||
290 | extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req, | ||
291 | unsigned int which, u16 opcode, | ||
292 | const char *class, const char *method); | ||
293 | extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req, | ||
294 | unsigned int which, u16 opcode, | ||
295 | u64 cookie, u64 version, int flag); | ||
296 | |||
227 | extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, | 297 | extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, |
228 | struct ceph_snap_context *snapc, | 298 | struct ceph_snap_context *snapc, |
229 | unsigned int num_op, | 299 | unsigned int num_ops, |
230 | bool use_mempool, | 300 | bool use_mempool, |
231 | gfp_t gfp_flags); | 301 | gfp_t gfp_flags); |
232 | 302 | ||
233 | extern void ceph_osdc_build_request(struct ceph_osd_request *req, | 303 | extern void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, |
234 | u64 off, u64 len, | ||
235 | unsigned int num_op, | ||
236 | struct ceph_osd_req_op *src_ops, | ||
237 | struct ceph_snap_context *snapc, | 304 | struct ceph_snap_context *snapc, |
238 | u64 snap_id, | 305 | u64 snap_id, |
239 | struct timespec *mtime); | 306 | struct timespec *mtime); |
@@ -241,12 +308,11 @@ extern void ceph_osdc_build_request(struct ceph_osd_request *req, | |||
241 | extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, | 308 | extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, |
242 | struct ceph_file_layout *layout, | 309 | struct ceph_file_layout *layout, |
243 | struct ceph_vino vino, | 310 | struct ceph_vino vino, |
244 | u64 offset, u64 *len, int op, int flags, | 311 | u64 offset, u64 *len, |
312 | int num_ops, int opcode, int flags, | ||
245 | struct ceph_snap_context *snapc, | 313 | struct ceph_snap_context *snapc, |
246 | int do_sync, u32 truncate_seq, | 314 | u32 truncate_seq, u64 truncate_size, |
247 | u64 truncate_size, | 315 | bool use_mempool); |
248 | struct timespec *mtime, | ||
249 | bool use_mempool, int page_align); | ||
250 | 316 | ||
251 | extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, | 317 | extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, |
252 | struct ceph_osd_request *req); | 318 | struct ceph_osd_request *req); |
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index c819190d1642..d05cc4451af6 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/rbtree.h> | 4 | #include <linux/rbtree.h> |
5 | #include <linux/ceph/types.h> | 5 | #include <linux/ceph/types.h> |
6 | #include <linux/ceph/decode.h> | ||
6 | #include <linux/ceph/ceph_fs.h> | 7 | #include <linux/ceph/ceph_fs.h> |
7 | #include <linux/crush/crush.h> | 8 | #include <linux/crush/crush.h> |
8 | 9 | ||
@@ -119,6 +120,29 @@ static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map, | |||
119 | return &map->osd_addr[osd]; | 120 | return &map->osd_addr[osd]; |
120 | } | 121 | } |
121 | 122 | ||
123 | static inline int ceph_decode_pgid(void **p, void *end, struct ceph_pg *pgid) | ||
124 | { | ||
125 | __u8 version; | ||
126 | |||
127 | if (!ceph_has_room(p, end, 1 + 8 + 4 + 4)) { | ||
128 | pr_warning("incomplete pg encoding"); | ||
129 | |||
130 | return -EINVAL; | ||
131 | } | ||
132 | version = ceph_decode_8(p); | ||
133 | if (version > 1) { | ||
134 | pr_warning("do not understand pg encoding %d > 1", | ||
135 | (int)version); | ||
136 | return -EINVAL; | ||
137 | } | ||
138 | |||
139 | pgid->pool = ceph_decode_64(p); | ||
140 | pgid->seed = ceph_decode_32(p); | ||
141 | *p += 4; /* skip deprecated preferred value */ | ||
142 | |||
143 | return 0; | ||
144 | } | ||
145 | |||
122 | extern struct ceph_osdmap *osdmap_decode(void **p, void *end); | 146 | extern struct ceph_osdmap *osdmap_decode(void **p, void *end); |
123 | extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | 147 | extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, |
124 | struct ceph_osdmap *map, | 148 | struct ceph_osdmap *map, |
@@ -131,10 +155,8 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | |||
131 | u64 *bno, u64 *oxoff, u64 *oxlen); | 155 | u64 *bno, u64 *oxoff, u64 *oxlen); |
132 | 156 | ||
133 | /* calculate mapping of object to a placement group */ | 157 | /* calculate mapping of object to a placement group */ |
134 | extern int ceph_calc_object_layout(struct ceph_pg *pg, | 158 | extern int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid, |
135 | const char *oid, | 159 | struct ceph_osdmap *osdmap, uint64_t pool); |
136 | struct ceph_file_layout *fl, | ||
137 | struct ceph_osdmap *osdmap); | ||
138 | extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, | 160 | extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, |
139 | struct ceph_pg pgid, | 161 | struct ceph_pg pgid, |
140 | int *acting); | 162 | int *acting); |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 900af5964f55..5047355b9a0f 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/idr.h> | 19 | #include <linux/idr.h> |
20 | #include <linux/workqueue.h> | 20 | #include <linux/workqueue.h> |
21 | #include <linux/xattr.h> | 21 | #include <linux/xattr.h> |
22 | #include <linux/fs.h> | ||
22 | 23 | ||
23 | #ifdef CONFIG_CGROUPS | 24 | #ifdef CONFIG_CGROUPS |
24 | 25 | ||
@@ -27,13 +28,10 @@ struct cgroup_subsys; | |||
27 | struct inode; | 28 | struct inode; |
28 | struct cgroup; | 29 | struct cgroup; |
29 | struct css_id; | 30 | struct css_id; |
31 | struct eventfd_ctx; | ||
30 | 32 | ||
31 | extern int cgroup_init_early(void); | 33 | extern int cgroup_init_early(void); |
32 | extern int cgroup_init(void); | 34 | extern int cgroup_init(void); |
33 | extern void cgroup_lock(void); | ||
34 | extern int cgroup_lock_is_held(void); | ||
35 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); | ||
36 | extern void cgroup_unlock(void); | ||
37 | extern void cgroup_fork(struct task_struct *p); | 35 | extern void cgroup_fork(struct task_struct *p); |
38 | extern void cgroup_post_fork(struct task_struct *p); | 36 | extern void cgroup_post_fork(struct task_struct *p); |
39 | extern void cgroup_exit(struct task_struct *p, int run_callbacks); | 37 | extern void cgroup_exit(struct task_struct *p, int run_callbacks); |
@@ -42,16 +40,27 @@ extern int cgroupstats_build(struct cgroupstats *stats, | |||
42 | extern int cgroup_load_subsys(struct cgroup_subsys *ss); | 40 | extern int cgroup_load_subsys(struct cgroup_subsys *ss); |
43 | extern void cgroup_unload_subsys(struct cgroup_subsys *ss); | 41 | extern void cgroup_unload_subsys(struct cgroup_subsys *ss); |
44 | 42 | ||
45 | extern const struct file_operations proc_cgroup_operations; | 43 | extern int proc_cgroup_show(struct seq_file *, void *); |
46 | 44 | ||
47 | /* Define the enumeration of all builtin cgroup subsystems */ | 45 | /* |
46 | * Define the enumeration of all cgroup subsystems. | ||
47 | * | ||
48 | * We define ids for builtin subsystems and then modular ones. | ||
49 | */ | ||
48 | #define SUBSYS(_x) _x ## _subsys_id, | 50 | #define SUBSYS(_x) _x ## _subsys_id, |
49 | #define IS_SUBSYS_ENABLED(option) IS_ENABLED(option) | ||
50 | enum cgroup_subsys_id { | 51 | enum cgroup_subsys_id { |
52 | #define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option) | ||
51 | #include <linux/cgroup_subsys.h> | 53 | #include <linux/cgroup_subsys.h> |
54 | #undef IS_SUBSYS_ENABLED | ||
55 | CGROUP_BUILTIN_SUBSYS_COUNT, | ||
56 | |||
57 | __CGROUP_SUBSYS_TEMP_PLACEHOLDER = CGROUP_BUILTIN_SUBSYS_COUNT - 1, | ||
58 | |||
59 | #define IS_SUBSYS_ENABLED(option) IS_MODULE(option) | ||
60 | #include <linux/cgroup_subsys.h> | ||
61 | #undef IS_SUBSYS_ENABLED | ||
52 | CGROUP_SUBSYS_COUNT, | 62 | CGROUP_SUBSYS_COUNT, |
53 | }; | 63 | }; |
54 | #undef IS_SUBSYS_ENABLED | ||
55 | #undef SUBSYS | 64 | #undef SUBSYS |
56 | 65 | ||
57 | /* Per-subsystem/per-cgroup state maintained by the system. */ | 66 | /* Per-subsystem/per-cgroup state maintained by the system. */ |
@@ -148,6 +157,13 @@ enum { | |||
148 | * specified at mount time and thus is implemented here. | 157 | * specified at mount time and thus is implemented here. |
149 | */ | 158 | */ |
150 | CGRP_CPUSET_CLONE_CHILDREN, | 159 | CGRP_CPUSET_CLONE_CHILDREN, |
160 | /* see the comment above CGRP_ROOT_SANE_BEHAVIOR for details */ | ||
161 | CGRP_SANE_BEHAVIOR, | ||
162 | }; | ||
163 | |||
164 | struct cgroup_name { | ||
165 | struct rcu_head rcu_head; | ||
166 | char name[]; | ||
151 | }; | 167 | }; |
152 | 168 | ||
153 | struct cgroup { | 169 | struct cgroup { |
@@ -172,11 +188,23 @@ struct cgroup { | |||
172 | struct cgroup *parent; /* my parent */ | 188 | struct cgroup *parent; /* my parent */ |
173 | struct dentry *dentry; /* cgroup fs entry, RCU protected */ | 189 | struct dentry *dentry; /* cgroup fs entry, RCU protected */ |
174 | 190 | ||
191 | /* | ||
192 | * This is a copy of dentry->d_name, and it's needed because | ||
193 | * we can't use dentry->d_name in cgroup_path(). | ||
194 | * | ||
195 | * You must acquire rcu_read_lock() to access cgrp->name, and | ||
196 | * the only place that can change it is rename(), which is | ||
197 | * protected by parent dir's i_mutex. | ||
198 | * | ||
199 | * Normally you should use cgroup_name() wrapper rather than | ||
200 | * access it directly. | ||
201 | */ | ||
202 | struct cgroup_name __rcu *name; | ||
203 | |||
175 | /* Private pointers for each registered subsystem */ | 204 | /* Private pointers for each registered subsystem */ |
176 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; | 205 | struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; |
177 | 206 | ||
178 | struct cgroupfs_root *root; | 207 | struct cgroupfs_root *root; |
179 | struct cgroup *top_cgroup; | ||
180 | 208 | ||
181 | /* | 209 | /* |
182 | * List of cg_cgroup_links pointing at css_sets with | 210 | * List of cg_cgroup_links pointing at css_sets with |
@@ -213,6 +241,96 @@ struct cgroup { | |||
213 | struct simple_xattrs xattrs; | 241 | struct simple_xattrs xattrs; |
214 | }; | 242 | }; |
215 | 243 | ||
244 | #define MAX_CGROUP_ROOT_NAMELEN 64 | ||
245 | |||
246 | /* cgroupfs_root->flags */ | ||
247 | enum { | ||
248 | /* | ||
249 | * Unfortunately, cgroup core and various controllers are riddled | ||
250 | * with idiosyncrasies and pointless options. The following flag, | ||
251 | * when set, will force sane behavior - some options are forced on, | ||
252 | * others are disallowed, and some controllers will change their | ||
253 | * hierarchical or other behaviors. | ||
254 | * | ||
255 | * The set of behaviors affected by this flag are still being | ||
256 | * determined and developed and the mount option for this flag is | ||
257 | * prefixed with __DEVEL__. The prefix will be dropped once we | ||
258 | * reach the point where all behaviors are compatible with the | ||
259 | * planned unified hierarchy, which will automatically turn on this | ||
260 | * flag. | ||
261 | * | ||
262 | * The followings are the behaviors currently affected this flag. | ||
263 | * | ||
264 | * - Mount options "noprefix" and "clone_children" are disallowed. | ||
265 | * Also, cgroupfs file cgroup.clone_children is not created. | ||
266 | * | ||
267 | * - When mounting an existing superblock, mount options should | ||
268 | * match. | ||
269 | * | ||
270 | * - Remount is disallowed. | ||
271 | * | ||
272 | * - memcg: use_hierarchy is on by default and the cgroup file for | ||
273 | * the flag is not created. | ||
274 | * | ||
275 | * The followings are planned changes. | ||
276 | * | ||
277 | * - release_agent will be disallowed once replacement notification | ||
278 | * mechanism is implemented. | ||
279 | */ | ||
280 | CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), | ||
281 | |||
282 | CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ | ||
283 | CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ | ||
284 | }; | ||
285 | |||
286 | /* | ||
287 | * A cgroupfs_root represents the root of a cgroup hierarchy, and may be | ||
288 | * associated with a superblock to form an active hierarchy. This is | ||
289 | * internal to cgroup core. Don't access directly from controllers. | ||
290 | */ | ||
291 | struct cgroupfs_root { | ||
292 | struct super_block *sb; | ||
293 | |||
294 | /* | ||
295 | * The bitmask of subsystems intended to be attached to this | ||
296 | * hierarchy | ||
297 | */ | ||
298 | unsigned long subsys_mask; | ||
299 | |||
300 | /* Unique id for this hierarchy. */ | ||
301 | int hierarchy_id; | ||
302 | |||
303 | /* The bitmask of subsystems currently attached to this hierarchy */ | ||
304 | unsigned long actual_subsys_mask; | ||
305 | |||
306 | /* A list running through the attached subsystems */ | ||
307 | struct list_head subsys_list; | ||
308 | |||
309 | /* The root cgroup for this hierarchy */ | ||
310 | struct cgroup top_cgroup; | ||
311 | |||
312 | /* Tracks how many cgroups are currently defined in hierarchy.*/ | ||
313 | int number_of_cgroups; | ||
314 | |||
315 | /* A list running through the active hierarchies */ | ||
316 | struct list_head root_list; | ||
317 | |||
318 | /* All cgroups on this root, cgroup_mutex protected */ | ||
319 | struct list_head allcg_list; | ||
320 | |||
321 | /* Hierarchy-specific flags */ | ||
322 | unsigned long flags; | ||
323 | |||
324 | /* IDs for cgroups in this hierarchy */ | ||
325 | struct ida cgroup_ida; | ||
326 | |||
327 | /* The path to use for release notifications. */ | ||
328 | char release_agent_path[PATH_MAX]; | ||
329 | |||
330 | /* The name for this hierarchy - may be empty */ | ||
331 | char name[MAX_CGROUP_ROOT_NAMELEN]; | ||
332 | }; | ||
333 | |||
216 | /* | 334 | /* |
217 | * A css_set is a structure holding pointers to a set of | 335 | * A css_set is a structure holding pointers to a set of |
218 | * cgroup_subsys_state objects. This saves space in the task struct | 336 | * cgroup_subsys_state objects. This saves space in the task struct |
@@ -278,6 +396,7 @@ struct cgroup_map_cb { | |||
278 | /* cftype->flags */ | 396 | /* cftype->flags */ |
279 | #define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ | 397 | #define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ |
280 | #define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */ | 398 | #define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */ |
399 | #define CFTYPE_INSANE (1U << 2) /* don't create if sane_behavior */ | ||
281 | 400 | ||
282 | #define MAX_CFTYPE_NAME 64 | 401 | #define MAX_CFTYPE_NAME 64 |
283 | 402 | ||
@@ -304,9 +423,6 @@ struct cftype { | |||
304 | /* CFTYPE_* flags */ | 423 | /* CFTYPE_* flags */ |
305 | unsigned int flags; | 424 | unsigned int flags; |
306 | 425 | ||
307 | /* file xattrs */ | ||
308 | struct simple_xattrs xattrs; | ||
309 | |||
310 | int (*open)(struct inode *inode, struct file *file); | 426 | int (*open)(struct inode *inode, struct file *file); |
311 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, | 427 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, |
312 | struct file *file, | 428 | struct file *file, |
@@ -404,18 +520,31 @@ struct cgroup_scanner { | |||
404 | void *data; | 520 | void *data; |
405 | }; | 521 | }; |
406 | 522 | ||
523 | /* | ||
524 | * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This | ||
525 | * function can be called as long as @cgrp is accessible. | ||
526 | */ | ||
527 | static inline bool cgroup_sane_behavior(const struct cgroup *cgrp) | ||
528 | { | ||
529 | return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR; | ||
530 | } | ||
531 | |||
532 | /* Caller should hold rcu_read_lock() */ | ||
533 | static inline const char *cgroup_name(const struct cgroup *cgrp) | ||
534 | { | ||
535 | return rcu_dereference(cgrp->name)->name; | ||
536 | } | ||
537 | |||
407 | int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); | 538 | int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
408 | int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); | 539 | int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); |
409 | 540 | ||
410 | int cgroup_is_removed(const struct cgroup *cgrp); | 541 | int cgroup_is_removed(const struct cgroup *cgrp); |
542 | bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); | ||
411 | 543 | ||
412 | int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); | 544 | int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); |
413 | 545 | ||
414 | int cgroup_task_count(const struct cgroup *cgrp); | 546 | int cgroup_task_count(const struct cgroup *cgrp); |
415 | 547 | ||
416 | /* Return true if cgrp is a descendant of the task's cgroup */ | ||
417 | int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task); | ||
418 | |||
419 | /* | 548 | /* |
420 | * Control Group taskset, used to pass around set of tasks to cgroup_subsys | 549 | * Control Group taskset, used to pass around set of tasks to cgroup_subsys |
421 | * methods. | 550 | * methods. |
@@ -458,7 +587,6 @@ struct cgroup_subsys { | |||
458 | void (*bind)(struct cgroup *root); | 587 | void (*bind)(struct cgroup *root); |
459 | 588 | ||
460 | int subsys_id; | 589 | int subsys_id; |
461 | int active; | ||
462 | int disabled; | 590 | int disabled; |
463 | int early_init; | 591 | int early_init; |
464 | /* | 592 | /* |
@@ -523,10 +651,16 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state( | |||
523 | * rcu_dereference_check() conditions, such as locks used during the | 651 | * rcu_dereference_check() conditions, such as locks used during the |
524 | * cgroup_subsys::attach() methods. | 652 | * cgroup_subsys::attach() methods. |
525 | */ | 653 | */ |
654 | #ifdef CONFIG_PROVE_RCU | ||
655 | extern struct mutex cgroup_mutex; | ||
526 | #define task_subsys_state_check(task, subsys_id, __c) \ | 656 | #define task_subsys_state_check(task, subsys_id, __c) \ |
527 | rcu_dereference_check(task->cgroups->subsys[subsys_id], \ | 657 | rcu_dereference_check((task)->cgroups->subsys[(subsys_id)], \ |
528 | lockdep_is_held(&task->alloc_lock) || \ | 658 | lockdep_is_held(&(task)->alloc_lock) || \ |
529 | cgroup_lock_is_held() || (__c)) | 659 | lockdep_is_held(&cgroup_mutex) || (__c)) |
660 | #else | ||
661 | #define task_subsys_state_check(task, subsys_id, __c) \ | ||
662 | rcu_dereference((task)->cgroups->subsys[(subsys_id)]) | ||
663 | #endif | ||
530 | 664 | ||
531 | static inline struct cgroup_subsys_state * | 665 | static inline struct cgroup_subsys_state * |
532 | task_subsys_state(struct task_struct *task, int subsys_id) | 666 | task_subsys_state(struct task_struct *task, int subsys_id) |
@@ -661,8 +795,8 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp, | |||
661 | struct cgroup_iter *it); | 795 | struct cgroup_iter *it); |
662 | void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); | 796 | void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); |
663 | int cgroup_scan_tasks(struct cgroup_scanner *scan); | 797 | int cgroup_scan_tasks(struct cgroup_scanner *scan); |
664 | int cgroup_attach_task(struct cgroup *, struct task_struct *); | ||
665 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); | 798 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); |
799 | int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); | ||
666 | 800 | ||
667 | /* | 801 | /* |
668 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works | 802 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works |
@@ -687,13 +821,6 @@ void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css); | |||
687 | 821 | ||
688 | struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id); | 822 | struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id); |
689 | 823 | ||
690 | /* | ||
691 | * Get a cgroup whose id is greater than or equal to id under tree of root. | ||
692 | * Returning a cgroup_subsys_state or NULL. | ||
693 | */ | ||
694 | struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id, | ||
695 | struct cgroup_subsys_state *root, int *foundid); | ||
696 | |||
697 | /* Returns true if root is ancestor of cg */ | 824 | /* Returns true if root is ancestor of cg */ |
698 | bool css_is_ancestor(struct cgroup_subsys_state *cg, | 825 | bool css_is_ancestor(struct cgroup_subsys_state *cg, |
699 | const struct cgroup_subsys_state *root); | 826 | const struct cgroup_subsys_state *root); |
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index f204a7a9cf38..6e7ec64b69ab 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
@@ -78,3 +78,9 @@ SUBSYS(hugetlb) | |||
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | /* */ | 80 | /* */ |
81 | |||
82 | #ifdef CONFIG_CGROUP_BCACHE | ||
83 | SUBSYS(bcache) | ||
84 | #endif | ||
85 | |||
86 | /* */ | ||
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h index 42e55deee757..4ce9056b31a8 100644 --- a/include/linux/cleancache.h +++ b/include/linux/cleancache.h | |||
@@ -33,7 +33,7 @@ struct cleancache_ops { | |||
33 | void (*invalidate_fs)(int); | 33 | void (*invalidate_fs)(int); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | extern struct cleancache_ops | 36 | extern struct cleancache_ops * |
37 | cleancache_register_ops(struct cleancache_ops *ops); | 37 | cleancache_register_ops(struct cleancache_ops *ops); |
38 | extern void __cleancache_init_fs(struct super_block *); | 38 | extern void __cleancache_init_fs(struct super_block *); |
39 | extern void __cleancache_init_shared_fs(char *, struct super_block *); | 39 | extern void __cleancache_init_shared_fs(char *, struct super_block *); |
@@ -42,9 +42,9 @@ extern void __cleancache_put_page(struct page *); | |||
42 | extern void __cleancache_invalidate_page(struct address_space *, struct page *); | 42 | extern void __cleancache_invalidate_page(struct address_space *, struct page *); |
43 | extern void __cleancache_invalidate_inode(struct address_space *); | 43 | extern void __cleancache_invalidate_inode(struct address_space *); |
44 | extern void __cleancache_invalidate_fs(struct super_block *); | 44 | extern void __cleancache_invalidate_fs(struct super_block *); |
45 | extern int cleancache_enabled; | ||
46 | 45 | ||
47 | #ifdef CONFIG_CLEANCACHE | 46 | #ifdef CONFIG_CLEANCACHE |
47 | #define cleancache_enabled (1) | ||
48 | static inline bool cleancache_fs_enabled(struct page *page) | 48 | static inline bool cleancache_fs_enabled(struct page *page) |
49 | { | 49 | { |
50 | return page->mapping->host->i_sb->cleancache_poolid >= 0; | 50 | return page->mapping->host->i_sb->cleancache_poolid >= 0; |
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h index 9c7f5807824b..dd7adff76e81 100644 --- a/include/linux/clk-private.h +++ b/include/linux/clk-private.h | |||
@@ -152,7 +152,7 @@ struct clk { | |||
152 | }, \ | 152 | }, \ |
153 | .reg = _reg, \ | 153 | .reg = _reg, \ |
154 | .shift = _shift, \ | 154 | .shift = _shift, \ |
155 | .width = _width, \ | 155 | .mask = BIT(_width) - 1, \ |
156 | .flags = _mux_flags, \ | 156 | .flags = _mux_flags, \ |
157 | .lock = _lock, \ | 157 | .lock = _lock, \ |
158 | }; \ | 158 | }; \ |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7f197d7addb0..11860985fecb 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -45,6 +45,14 @@ struct clk_hw; | |||
45 | * undo any work done in the @prepare callback. Called with | 45 | * undo any work done in the @prepare callback. Called with |
46 | * prepare_lock held. | 46 | * prepare_lock held. |
47 | * | 47 | * |
48 | * @is_prepared: Queries the hardware to determine if the clock is prepared. | ||
49 | * This function is allowed to sleep. Optional, if this op is not | ||
50 | * set then the prepare count will be used. | ||
51 | * | ||
52 | * @unprepare_unused: Unprepare the clock atomically. Only called from | ||
53 | * clk_disable_unused for prepare clocks with special needs. | ||
54 | * Called with prepare mutex held. This function may sleep. | ||
55 | * | ||
48 | * @enable: Enable the clock atomically. This must not return until the | 56 | * @enable: Enable the clock atomically. This must not return until the |
49 | * clock is generating a valid clock signal, usable by consumer | 57 | * clock is generating a valid clock signal, usable by consumer |
50 | * devices. Called with enable_lock held. This function must not | 58 | * devices. Called with enable_lock held. This function must not |
@@ -108,6 +116,8 @@ struct clk_hw; | |||
108 | struct clk_ops { | 116 | struct clk_ops { |
109 | int (*prepare)(struct clk_hw *hw); | 117 | int (*prepare)(struct clk_hw *hw); |
110 | void (*unprepare)(struct clk_hw *hw); | 118 | void (*unprepare)(struct clk_hw *hw); |
119 | int (*is_prepared)(struct clk_hw *hw); | ||
120 | void (*unprepare_unused)(struct clk_hw *hw); | ||
111 | int (*enable)(struct clk_hw *hw); | 121 | int (*enable)(struct clk_hw *hw); |
112 | void (*disable)(struct clk_hw *hw); | 122 | void (*disable)(struct clk_hw *hw); |
113 | int (*is_enabled)(struct clk_hw *hw); | 123 | int (*is_enabled)(struct clk_hw *hw); |
@@ -239,9 +249,14 @@ struct clk_div_table { | |||
239 | * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the | 249 | * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the |
240 | * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is | 250 | * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is |
241 | * the raw value read from the register, with the value of zero considered | 251 | * the raw value read from the register, with the value of zero considered |
242 | * invalid | 252 | * invalid, unless CLK_DIVIDER_ALLOW_ZERO is set. |
243 | * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from | 253 | * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from |
244 | * the hardware register | 254 | * the hardware register |
255 | * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors. For dividers which have | ||
256 | * CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor. | ||
257 | * Some hardware implementations gracefully handle this case and allow a | ||
258 | * zero divisor by not modifying their input clock | ||
259 | * (divide by one / bypass). | ||
245 | */ | 260 | */ |
246 | struct clk_divider { | 261 | struct clk_divider { |
247 | struct clk_hw hw; | 262 | struct clk_hw hw; |
@@ -255,6 +270,7 @@ struct clk_divider { | |||
255 | 270 | ||
256 | #define CLK_DIVIDER_ONE_BASED BIT(0) | 271 | #define CLK_DIVIDER_ONE_BASED BIT(0) |
257 | #define CLK_DIVIDER_POWER_OF_TWO BIT(1) | 272 | #define CLK_DIVIDER_POWER_OF_TWO BIT(1) |
273 | #define CLK_DIVIDER_ALLOW_ZERO BIT(2) | ||
258 | 274 | ||
259 | extern const struct clk_ops clk_divider_ops; | 275 | extern const struct clk_ops clk_divider_ops; |
260 | struct clk *clk_register_divider(struct device *dev, const char *name, | 276 | struct clk *clk_register_divider(struct device *dev, const char *name, |
@@ -274,7 +290,7 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name, | |||
274 | * @reg: register controlling multiplexer | 290 | * @reg: register controlling multiplexer |
275 | * @shift: shift to multiplexer bit field | 291 | * @shift: shift to multiplexer bit field |
276 | * @width: width of mutliplexer bit field | 292 | * @width: width of mutliplexer bit field |
277 | * @num_clks: number of parent clocks | 293 | * @flags: hardware-specific flags |
278 | * @lock: register lock | 294 | * @lock: register lock |
279 | * | 295 | * |
280 | * Clock with multiple selectable parents. Implements .get_parent, .set_parent | 296 | * Clock with multiple selectable parents. Implements .get_parent, .set_parent |
@@ -287,8 +303,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name, | |||
287 | struct clk_mux { | 303 | struct clk_mux { |
288 | struct clk_hw hw; | 304 | struct clk_hw hw; |
289 | void __iomem *reg; | 305 | void __iomem *reg; |
306 | u32 *table; | ||
307 | u32 mask; | ||
290 | u8 shift; | 308 | u8 shift; |
291 | u8 width; | ||
292 | u8 flags; | 309 | u8 flags; |
293 | spinlock_t *lock; | 310 | spinlock_t *lock; |
294 | }; | 311 | }; |
@@ -297,11 +314,19 @@ struct clk_mux { | |||
297 | #define CLK_MUX_INDEX_BIT BIT(1) | 314 | #define CLK_MUX_INDEX_BIT BIT(1) |
298 | 315 | ||
299 | extern const struct clk_ops clk_mux_ops; | 316 | extern const struct clk_ops clk_mux_ops; |
317 | |||
300 | struct clk *clk_register_mux(struct device *dev, const char *name, | 318 | struct clk *clk_register_mux(struct device *dev, const char *name, |
301 | const char **parent_names, u8 num_parents, unsigned long flags, | 319 | const char **parent_names, u8 num_parents, unsigned long flags, |
302 | void __iomem *reg, u8 shift, u8 width, | 320 | void __iomem *reg, u8 shift, u8 width, |
303 | u8 clk_mux_flags, spinlock_t *lock); | 321 | u8 clk_mux_flags, spinlock_t *lock); |
304 | 322 | ||
323 | struct clk *clk_register_mux_table(struct device *dev, const char *name, | ||
324 | const char **parent_names, u8 num_parents, unsigned long flags, | ||
325 | void __iomem *reg, u8 shift, u32 mask, | ||
326 | u8 clk_mux_flags, u32 *table, spinlock_t *lock); | ||
327 | |||
328 | void of_fixed_factor_clk_setup(struct device_node *node); | ||
329 | |||
305 | /** | 330 | /** |
306 | * struct clk_fixed_factor - fixed multiplier and divider clock | 331 | * struct clk_fixed_factor - fixed multiplier and divider clock |
307 | * | 332 | * |
@@ -325,6 +350,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | |||
325 | const char *parent_name, unsigned long flags, | 350 | const char *parent_name, unsigned long flags, |
326 | unsigned int mult, unsigned int div); | 351 | unsigned int mult, unsigned int div); |
327 | 352 | ||
353 | /*** | ||
354 | * struct clk_composite - aggregate clock of mux, divider and gate clocks | ||
355 | * | ||
356 | * @hw: handle between common and hardware-specific interfaces | ||
357 | * @mux_hw: handle between composite and hardware-specific mux clock | ||
358 | * @rate_hw: handle between composite and hardware-specific rate clock | ||
359 | * @gate_hw: handle between composite and hardware-specific gate clock | ||
360 | * @mux_ops: clock ops for mux | ||
361 | * @rate_ops: clock ops for rate | ||
362 | * @gate_ops: clock ops for gate | ||
363 | */ | ||
364 | struct clk_composite { | ||
365 | struct clk_hw hw; | ||
366 | struct clk_ops ops; | ||
367 | |||
368 | struct clk_hw *mux_hw; | ||
369 | struct clk_hw *rate_hw; | ||
370 | struct clk_hw *gate_hw; | ||
371 | |||
372 | const struct clk_ops *mux_ops; | ||
373 | const struct clk_ops *rate_ops; | ||
374 | const struct clk_ops *gate_ops; | ||
375 | }; | ||
376 | |||
377 | struct clk *clk_register_composite(struct device *dev, const char *name, | ||
378 | const char **parent_names, int num_parents, | ||
379 | struct clk_hw *mux_hw, const struct clk_ops *mux_ops, | ||
380 | struct clk_hw *rate_hw, const struct clk_ops *rate_ops, | ||
381 | struct clk_hw *gate_hw, const struct clk_ops *gate_ops, | ||
382 | unsigned long flags); | ||
383 | |||
328 | /** | 384 | /** |
329 | * clk_register - allocate a new clock, register it and return an opaque cookie | 385 | * clk_register - allocate a new clock, register it and return an opaque cookie |
330 | * @dev: device that is registering this clock | 386 | * @dev: device that is registering this clock |
@@ -351,6 +407,7 @@ unsigned int __clk_get_enable_count(struct clk *clk); | |||
351 | unsigned int __clk_get_prepare_count(struct clk *clk); | 407 | unsigned int __clk_get_prepare_count(struct clk *clk); |
352 | unsigned long __clk_get_rate(struct clk *clk); | 408 | unsigned long __clk_get_rate(struct clk *clk); |
353 | unsigned long __clk_get_flags(struct clk *clk); | 409 | unsigned long __clk_get_flags(struct clk *clk); |
410 | bool __clk_is_prepared(struct clk *clk); | ||
354 | bool __clk_is_enabled(struct clk *clk); | 411 | bool __clk_is_enabled(struct clk *clk); |
355 | struct clk *__clk_lookup(const char *name); | 412 | struct clk *__clk_lookup(const char *name); |
356 | 413 | ||
diff --git a/include/linux/clk.h b/include/linux/clk.h index b3ac22d0fc1f..9a6d04524b1a 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -28,16 +28,16 @@ struct clk; | |||
28 | * PRE_RATE_CHANGE - called immediately before the clk rate is changed, | 28 | * PRE_RATE_CHANGE - called immediately before the clk rate is changed, |
29 | * to indicate that the rate change will proceed. Drivers must | 29 | * to indicate that the rate change will proceed. Drivers must |
30 | * immediately terminate any operations that will be affected by the | 30 | * immediately terminate any operations that will be affected by the |
31 | * rate change. Callbacks may either return NOTIFY_DONE or | 31 | * rate change. Callbacks may either return NOTIFY_DONE, NOTIFY_OK, |
32 | * NOTIFY_STOP. | 32 | * NOTIFY_STOP or NOTIFY_BAD. |
33 | * | 33 | * |
34 | * ABORT_RATE_CHANGE: called if the rate change failed for some reason | 34 | * ABORT_RATE_CHANGE: called if the rate change failed for some reason |
35 | * after PRE_RATE_CHANGE. In this case, all registered notifiers on | 35 | * after PRE_RATE_CHANGE. In this case, all registered notifiers on |
36 | * the clk will be called with ABORT_RATE_CHANGE. Callbacks must | 36 | * the clk will be called with ABORT_RATE_CHANGE. Callbacks must |
37 | * always return NOTIFY_DONE. | 37 | * always return NOTIFY_DONE or NOTIFY_OK. |
38 | * | 38 | * |
39 | * POST_RATE_CHANGE - called after the clk rate change has successfully | 39 | * POST_RATE_CHANGE - called after the clk rate change has successfully |
40 | * completed. Callbacks must always return NOTIFY_DONE. | 40 | * completed. Callbacks must always return NOTIFY_DONE or NOTIFY_OK. |
41 | * | 41 | * |
42 | */ | 42 | */ |
43 | #define PRE_RATE_CHANGE BIT(0) | 43 | #define PRE_RATE_CHANGE BIT(0) |
diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h new file mode 100644 index 000000000000..90c30dc3efc7 --- /dev/null +++ b/include/linux/clk/mxs.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_CLK_MXS_H | ||
10 | #define __LINUX_CLK_MXS_H | ||
11 | |||
12 | int mx23_clocks_init(void); | ||
13 | int mx28_clocks_init(void); | ||
14 | int mxs_saif_clkmux_select(unsigned int clkmux); | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/sunxi_timer.h b/include/linux/clk/sunxi.h index 18081787e5f3..e074fdd5a236 100644 --- a/include/linux/sunxi_timer.h +++ b/include/linux/clk/sunxi.h | |||
@@ -14,11 +14,9 @@ | |||
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef __SUNXI_TIMER_H | 17 | #ifndef __LINUX_CLK_SUNXI_H_ |
18 | #define __SUNXI_TIMER_H | 18 | #define __LINUX_CLK_SUNXI_H_ |
19 | 19 | ||
20 | #include <asm/mach/time.h> | 20 | void __init sunxi_init_clocks(void); |
21 | |||
22 | void sunxi_timer_init(void); | ||
23 | 21 | ||
24 | #endif | 22 | #endif |
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index 404d6f940872..642789baec74 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h | |||
@@ -123,5 +123,6 @@ static inline void tegra_cpu_clock_resume(void) | |||
123 | void tegra_periph_reset_deassert(struct clk *c); | 123 | void tegra_periph_reset_deassert(struct clk *c); |
124 | void tegra_periph_reset_assert(struct clk *c); | 124 | void tegra_periph_reset_assert(struct clk *c); |
125 | void tegra_clocks_init(void); | 125 | void tegra_clocks_init(void); |
126 | void tegra_clocks_apply_init_table(void); | ||
126 | 127 | ||
127 | #endif /* __LINUX_CLK_TEGRA_H_ */ | 128 | #endif /* __LINUX_CLK_TEGRA_H_ */ |
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 66346521cb65..963d71431388 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h | |||
@@ -8,6 +8,20 @@ | |||
8 | #ifndef _LINUX_CLOCKCHIPS_H | 8 | #ifndef _LINUX_CLOCKCHIPS_H |
9 | #define _LINUX_CLOCKCHIPS_H | 9 | #define _LINUX_CLOCKCHIPS_H |
10 | 10 | ||
11 | /* Clock event notification values */ | ||
12 | enum clock_event_nofitiers { | ||
13 | CLOCK_EVT_NOTIFY_ADD, | ||
14 | CLOCK_EVT_NOTIFY_BROADCAST_ON, | ||
15 | CLOCK_EVT_NOTIFY_BROADCAST_OFF, | ||
16 | CLOCK_EVT_NOTIFY_BROADCAST_FORCE, | ||
17 | CLOCK_EVT_NOTIFY_BROADCAST_ENTER, | ||
18 | CLOCK_EVT_NOTIFY_BROADCAST_EXIT, | ||
19 | CLOCK_EVT_NOTIFY_SUSPEND, | ||
20 | CLOCK_EVT_NOTIFY_RESUME, | ||
21 | CLOCK_EVT_NOTIFY_CPU_DYING, | ||
22 | CLOCK_EVT_NOTIFY_CPU_DEAD, | ||
23 | }; | ||
24 | |||
11 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD | 25 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD |
12 | 26 | ||
13 | #include <linux/clocksource.h> | 27 | #include <linux/clocksource.h> |
@@ -26,20 +40,6 @@ enum clock_event_mode { | |||
26 | CLOCK_EVT_MODE_RESUME, | 40 | CLOCK_EVT_MODE_RESUME, |
27 | }; | 41 | }; |
28 | 42 | ||
29 | /* Clock event notification values */ | ||
30 | enum clock_event_nofitiers { | ||
31 | CLOCK_EVT_NOTIFY_ADD, | ||
32 | CLOCK_EVT_NOTIFY_BROADCAST_ON, | ||
33 | CLOCK_EVT_NOTIFY_BROADCAST_OFF, | ||
34 | CLOCK_EVT_NOTIFY_BROADCAST_FORCE, | ||
35 | CLOCK_EVT_NOTIFY_BROADCAST_ENTER, | ||
36 | CLOCK_EVT_NOTIFY_BROADCAST_EXIT, | ||
37 | CLOCK_EVT_NOTIFY_SUSPEND, | ||
38 | CLOCK_EVT_NOTIFY_RESUME, | ||
39 | CLOCK_EVT_NOTIFY_CPU_DYING, | ||
40 | CLOCK_EVT_NOTIFY_CPU_DEAD, | ||
41 | }; | ||
42 | |||
43 | /* | 43 | /* |
44 | * Clock event features | 44 | * Clock event features |
45 | */ | 45 | */ |
@@ -55,6 +55,11 @@ enum clock_event_nofitiers { | |||
55 | #define CLOCK_EVT_FEAT_C3STOP 0x000008 | 55 | #define CLOCK_EVT_FEAT_C3STOP 0x000008 |
56 | #define CLOCK_EVT_FEAT_DUMMY 0x000010 | 56 | #define CLOCK_EVT_FEAT_DUMMY 0x000010 |
57 | 57 | ||
58 | /* | ||
59 | * Core shall set the interrupt affinity dynamically in broadcast mode | ||
60 | */ | ||
61 | #define CLOCK_EVT_FEAT_DYNIRQ 0x000020 | ||
62 | |||
58 | /** | 63 | /** |
59 | * struct clock_event_device - clock event device descriptor | 64 | * struct clock_event_device - clock event device descriptor |
60 | * @event_handler: Assigned by the framework to be called by the low | 65 | * @event_handler: Assigned by the framework to be called by the low |
@@ -170,10 +175,16 @@ extern void tick_broadcast(const struct cpumask *mask); | |||
170 | extern int tick_receive_broadcast(void); | 175 | extern int tick_receive_broadcast(void); |
171 | #endif | 176 | #endif |
172 | 177 | ||
178 | #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) | ||
179 | extern int tick_check_broadcast_expired(void); | ||
180 | #else | ||
181 | static inline int tick_check_broadcast_expired(void) { return 0; } | ||
182 | #endif | ||
183 | |||
173 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 184 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
174 | extern void clockevents_notify(unsigned long reason, void *arg); | 185 | extern void clockevents_notify(unsigned long reason, void *arg); |
175 | #else | 186 | #else |
176 | # define clockevents_notify(reason, arg) do { } while (0) | 187 | static inline void clockevents_notify(unsigned long reason, void *arg) {} |
177 | #endif | 188 | #endif |
178 | 189 | ||
179 | #else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ | 190 | #else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ |
@@ -181,7 +192,8 @@ extern void clockevents_notify(unsigned long reason, void *arg); | |||
181 | static inline void clockevents_suspend(void) {} | 192 | static inline void clockevents_suspend(void) {} |
182 | static inline void clockevents_resume(void) {} | 193 | static inline void clockevents_resume(void) {} |
183 | 194 | ||
184 | #define clockevents_notify(reason, arg) do { } while (0) | 195 | static inline void clockevents_notify(unsigned long reason, void *arg) {} |
196 | static inline int tick_check_broadcast_expired(void) { return 0; } | ||
185 | 197 | ||
186 | #endif | 198 | #endif |
187 | 199 | ||
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 27cfda427dd9..7279b94c01da 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -206,6 +206,7 @@ struct clocksource { | |||
206 | #define CLOCK_SOURCE_WATCHDOG 0x10 | 206 | #define CLOCK_SOURCE_WATCHDOG 0x10 |
207 | #define CLOCK_SOURCE_VALID_FOR_HRES 0x20 | 207 | #define CLOCK_SOURCE_VALID_FOR_HRES 0x20 |
208 | #define CLOCK_SOURCE_UNSTABLE 0x40 | 208 | #define CLOCK_SOURCE_UNSTABLE 0x40 |
209 | #define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 | ||
209 | 210 | ||
210 | /* simplify initialization of mask field */ | 211 | /* simplify initialization of mask field */ |
211 | #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) | 212 | #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) |
@@ -332,15 +333,23 @@ extern int clocksource_mmio_init(void __iomem *, const char *, | |||
332 | 333 | ||
333 | extern int clocksource_i8253_init(void); | 334 | extern int clocksource_i8253_init(void); |
334 | 335 | ||
336 | struct device_node; | ||
337 | typedef void(*clocksource_of_init_fn)(struct device_node *); | ||
335 | #ifdef CONFIG_CLKSRC_OF | 338 | #ifdef CONFIG_CLKSRC_OF |
336 | extern void clocksource_of_init(void); | 339 | extern void clocksource_of_init(void); |
337 | 340 | ||
338 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | 341 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ |
339 | static const struct of_device_id __clksrc_of_table_##name \ | 342 | static const struct of_device_id __clksrc_of_table_##name \ |
340 | __used __section(__clksrc_of_table) \ | 343 | __used __section(__clksrc_of_table) \ |
341 | = { .compatible = compat, .data = fn }; | 344 | = { .compatible = compat, \ |
345 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
342 | #else | 346 | #else |
343 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) | 347 | static inline void clocksource_of_init(void) {} |
348 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | ||
349 | static const struct of_device_id __clksrc_of_table_##name \ | ||
350 | __attribute__((unused)) \ | ||
351 | = { .compatible = compat, \ | ||
352 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
344 | #endif | 353 | #endif |
345 | 354 | ||
346 | #endif /* _LINUX_CLOCKSOURCE_H */ | 355 | #endif /* _LINUX_CLOCKSOURCE_H */ |
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h index 2c1bc1ea04ee..1d5b02a96c46 100644 --- a/include/linux/cn_proc.h +++ b/include/linux/cn_proc.h | |||
@@ -26,6 +26,7 @@ void proc_id_connector(struct task_struct *task, int which_id); | |||
26 | void proc_sid_connector(struct task_struct *task); | 26 | void proc_sid_connector(struct task_struct *task); |
27 | void proc_ptrace_connector(struct task_struct *task, int which_id); | 27 | void proc_ptrace_connector(struct task_struct *task, int which_id); |
28 | void proc_comm_connector(struct task_struct *task); | 28 | void proc_comm_connector(struct task_struct *task); |
29 | void proc_coredump_connector(struct task_struct *task); | ||
29 | void proc_exit_connector(struct task_struct *task); | 30 | void proc_exit_connector(struct task_struct *task); |
30 | #else | 31 | #else |
31 | static inline void proc_fork_connector(struct task_struct *task) | 32 | static inline void proc_fork_connector(struct task_struct *task) |
@@ -48,6 +49,9 @@ static inline void proc_ptrace_connector(struct task_struct *task, | |||
48 | int ptrace_id) | 49 | int ptrace_id) |
49 | {} | 50 | {} |
50 | 51 | ||
52 | static inline void proc_coredump_connector(struct task_struct *task) | ||
53 | {} | ||
54 | |||
51 | static inline void proc_exit_connector(struct task_struct *task) | 55 | static inline void proc_exit_connector(struct task_struct *task) |
52 | {} | 56 | {} |
53 | #endif /* CONFIG_PROC_EVENTS */ | 57 | #endif /* CONFIG_PROC_EVENTS */ |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 377cd8c3395e..7f0c1dd09079 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -27,12 +27,6 @@ | |||
27 | #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) | 27 | #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1) | ||
31 | #define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__) | ||
32 | #define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__) | ||
33 | #define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__) | ||
34 | #define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__) | ||
35 | #define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__) | ||
36 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ | 30 | #define COMPAT_SYSCALL_DEFINE1(name, ...) \ |
37 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | 31 | COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) |
38 | #define COMPAT_SYSCALL_DEFINE2(name, ...) \ | 32 | #define COMPAT_SYSCALL_DEFINE2(name, ...) \ |
@@ -46,24 +40,15 @@ | |||
46 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ | 40 | #define COMPAT_SYSCALL_DEFINE6(name, ...) \ |
47 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | 41 | COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) |
48 | 42 | ||
49 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
50 | |||
51 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | 43 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ |
52 | asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \ | 44 | asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ |
53 | static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ | 45 | static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ |
54 | asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \ | 46 | asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ |
55 | { \ | 47 | { \ |
56 | return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \ | 48 | return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ |
57 | } \ | 49 | } \ |
58 | SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ | 50 | SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \ |
59 | static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) | 51 | static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) |
60 | |||
61 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
62 | |||
63 | #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ | ||
64 | asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)) | ||
65 | |||
66 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
67 | 52 | ||
68 | #ifndef compat_user_stack_pointer | 53 | #ifndef compat_user_stack_pointer |
69 | #define compat_user_stack_pointer() current_user_stack_pointer() | 54 | #define compat_user_stack_pointer() current_user_stack_pointer() |
@@ -326,21 +311,13 @@ asmlinkage long | |||
326 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, | 311 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
327 | compat_size_t __user *len_ptr); | 312 | compat_size_t __user *len_ptr); |
328 | 313 | ||
329 | #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC | 314 | asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32); |
330 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); | 315 | asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); |
331 | long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); | 316 | asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg); |
332 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, | 317 | asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp, |
333 | int version, void __user *uptr); | ||
334 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, | ||
335 | void __user *uptr); | ||
336 | #else | ||
337 | long compat_sys_semctl(int semid, int semnum, int cmd, int arg); | ||
338 | long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, | ||
339 | compat_ssize_t msgsz, int msgflg); | 318 | compat_ssize_t msgsz, int msgflg); |
340 | long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, | 319 | asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp, |
341 | compat_ssize_t msgsz, long msgtyp, int msgflg); | 320 | compat_ssize_t msgsz, long msgtyp, int msgflg); |
342 | long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); | ||
343 | #endif | ||
344 | long compat_sys_msgctl(int first, int second, void __user *uptr); | 321 | long compat_sys_msgctl(int first, int second, void __user *uptr); |
345 | long compat_sys_shmctl(int first, int second, void __user *uptr); | 322 | long compat_sys_shmctl(int first, int second, void __user *uptr); |
346 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, | 323 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, |
@@ -444,13 +421,13 @@ extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
444 | asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, | 421 | asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, |
445 | compat_long_t addr, compat_long_t data); | 422 | compat_long_t addr, compat_long_t data); |
446 | 423 | ||
424 | asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t); | ||
447 | /* | 425 | /* |
448 | * epoll (fs/eventpoll.c) compat bits follow ... | 426 | * epoll (fs/eventpoll.c) compat bits follow ... |
449 | */ | 427 | */ |
450 | struct epoll_event; | 428 | struct epoll_event; /* fortunately, this one is fixed-layout */ |
451 | #define compat_epoll_event epoll_event | ||
452 | asmlinkage long compat_sys_epoll_pwait(int epfd, | 429 | asmlinkage long compat_sys_epoll_pwait(int epfd, |
453 | struct compat_epoll_event __user *events, | 430 | struct epoll_event __user *events, |
454 | int maxevents, int timeout, | 431 | int maxevents, int timeout, |
455 | const compat_sigset_t __user *sigmask, | 432 | const compat_sigset_t __user *sigmask, |
456 | compat_size_t sigsetsize); | 433 | compat_size_t sigsetsize); |
@@ -685,6 +662,8 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, | |||
685 | 662 | ||
686 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, | 663 | asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, |
687 | compat_off_t __user *offset, compat_size_t count); | 664 | compat_off_t __user *offset, compat_size_t count); |
665 | asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, | ||
666 | compat_loff_t __user *offset, compat_size_t count); | ||
688 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, | 667 | asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, |
689 | compat_stack_t __user *uoss_ptr); | 668 | compat_stack_t __user *uoss_ptr); |
690 | 669 | ||
@@ -694,6 +673,8 @@ int __compat_save_altstack(compat_stack_t __user *, unsigned long); | |||
694 | asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, | 673 | asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, |
695 | struct compat_timespec __user *interval); | 674 | struct compat_timespec __user *interval); |
696 | 675 | ||
676 | asmlinkage long compat_sys_fanotify_mark(int, unsigned int, __u32, __u32, | ||
677 | int, const char __user *); | ||
697 | #else | 678 | #else |
698 | 679 | ||
699 | #define is_compat_task() (0) | 680 | #define is_compat_task() (0) |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 68b162d92254..842de225055f 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #define __must_check __attribute__((warn_unused_result)) | 13 | #define __must_check __attribute__((warn_unused_result)) |
14 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) | 14 | #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) |
15 | 15 | ||
16 | #if GCC_VERSION >= 40100 | 16 | #if GCC_VERSION >= 40100 && GCC_VERSION < 40600 |
17 | # define __compiletime_object_size(obj) __builtin_object_size(obj, 0) | 17 | # define __compiletime_object_size(obj) __builtin_object_size(obj, 0) |
18 | #endif | 18 | #endif |
19 | 19 | ||
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 10b8f23fab0f..92669cd182a6 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -351,4 +351,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
351 | */ | 351 | */ |
352 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | 352 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
353 | 353 | ||
354 | /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ | ||
355 | #ifdef CONFIG_KPROBES | ||
356 | # define __kprobes __attribute__((__section__(".kprobes.text"))) | ||
357 | #else | ||
358 | # define __kprobes | ||
359 | #endif | ||
354 | #endif /* __LINUX_COMPILER_H */ | 360 | #endif /* __LINUX_COMPILER_H */ |
diff --git a/include/linux/console.h b/include/linux/console.h index 29680a8cda99..73bab0f58af5 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -141,6 +141,7 @@ struct console { | |||
141 | for (con = console_drivers; con != NULL; con = con->next) | 141 | for (con = console_drivers; con != NULL; con = con->next) |
142 | 142 | ||
143 | extern int console_set_on_cmdline; | 143 | extern int console_set_on_cmdline; |
144 | extern struct console *early_console; | ||
144 | 145 | ||
145 | extern int add_preferred_console(char *name, int idx, char *options); | 146 | extern int add_preferred_console(char *name, int idx, char *options); |
146 | extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); | 147 | extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); |
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index b28d161c1091..365f4a61bf04 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h | |||
@@ -1,9 +1,9 @@ | |||
1 | #ifndef _LINUX_CONTEXT_TRACKING_H | 1 | #ifndef _LINUX_CONTEXT_TRACKING_H |
2 | #define _LINUX_CONTEXT_TRACKING_H | 2 | #define _LINUX_CONTEXT_TRACKING_H |
3 | 3 | ||
4 | #ifdef CONFIG_CONTEXT_TRACKING | ||
5 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
6 | #include <linux/percpu.h> | 5 | #include <linux/percpu.h> |
6 | #include <asm/ptrace.h> | ||
7 | 7 | ||
8 | struct context_tracking { | 8 | struct context_tracking { |
9 | /* | 9 | /* |
@@ -13,12 +13,13 @@ struct context_tracking { | |||
13 | * may be further optimized using static keys. | 13 | * may be further optimized using static keys. |
14 | */ | 14 | */ |
15 | bool active; | 15 | bool active; |
16 | enum { | 16 | enum ctx_state { |
17 | IN_KERNEL = 0, | 17 | IN_KERNEL = 0, |
18 | IN_USER, | 18 | IN_USER, |
19 | } state; | 19 | } state; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | #ifdef CONFIG_CONTEXT_TRACKING | ||
22 | DECLARE_PER_CPU(struct context_tracking, context_tracking); | 23 | DECLARE_PER_CPU(struct context_tracking, context_tracking); |
23 | 24 | ||
24 | static inline bool context_tracking_in_user(void) | 25 | static inline bool context_tracking_in_user(void) |
@@ -33,12 +34,31 @@ static inline bool context_tracking_active(void) | |||
33 | 34 | ||
34 | extern void user_enter(void); | 35 | extern void user_enter(void); |
35 | extern void user_exit(void); | 36 | extern void user_exit(void); |
37 | |||
38 | static inline enum ctx_state exception_enter(void) | ||
39 | { | ||
40 | enum ctx_state prev_ctx; | ||
41 | |||
42 | prev_ctx = this_cpu_read(context_tracking.state); | ||
43 | user_exit(); | ||
44 | |||
45 | return prev_ctx; | ||
46 | } | ||
47 | |||
48 | static inline void exception_exit(enum ctx_state prev_ctx) | ||
49 | { | ||
50 | if (prev_ctx == IN_USER) | ||
51 | user_enter(); | ||
52 | } | ||
53 | |||
36 | extern void context_tracking_task_switch(struct task_struct *prev, | 54 | extern void context_tracking_task_switch(struct task_struct *prev, |
37 | struct task_struct *next); | 55 | struct task_struct *next); |
38 | #else | 56 | #else |
39 | static inline bool context_tracking_in_user(void) { return false; } | 57 | static inline bool context_tracking_in_user(void) { return false; } |
40 | static inline void user_enter(void) { } | 58 | static inline void user_enter(void) { } |
41 | static inline void user_exit(void) { } | 59 | static inline void user_exit(void) { } |
60 | static inline enum ctx_state exception_enter(void) { return 0; } | ||
61 | static inline void exception_exit(enum ctx_state prev_ctx) { } | ||
42 | static inline void context_tracking_task_switch(struct task_struct *prev, | 62 | static inline void context_tracking_task_switch(struct task_struct *prev, |
43 | struct task_struct *next) { } | 63 | struct task_struct *next) { } |
44 | #endif /* !CONFIG_CONTEXT_TRACKING */ | 64 | #endif /* !CONFIG_CONTEXT_TRACKING */ |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index ce7a074f2519..c6f6e0839b61 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -212,4 +212,20 @@ static inline int disable_nonboot_cpus(void) { return 0; } | |||
212 | static inline void enable_nonboot_cpus(void) {} | 212 | static inline void enable_nonboot_cpus(void) {} |
213 | #endif /* !CONFIG_PM_SLEEP_SMP */ | 213 | #endif /* !CONFIG_PM_SLEEP_SMP */ |
214 | 214 | ||
215 | enum cpuhp_state { | ||
216 | CPUHP_OFFLINE, | ||
217 | CPUHP_ONLINE, | ||
218 | }; | ||
219 | |||
220 | void cpu_startup_entry(enum cpuhp_state state); | ||
221 | void cpu_idle(void); | ||
222 | |||
223 | void cpu_idle_poll_ctrl(bool enable); | ||
224 | |||
225 | void arch_cpu_idle(void); | ||
226 | void arch_cpu_idle_prepare(void); | ||
227 | void arch_cpu_idle_enter(void); | ||
228 | void arch_cpu_idle_exit(void); | ||
229 | void arch_cpu_idle_dead(void); | ||
230 | |||
215 | #endif /* _LINUX_CPU_H_ */ | 231 | #endif /* _LINUX_CPU_H_ */ |
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index 40b4ef54cc7d..282e27028418 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h | |||
@@ -25,34 +25,39 @@ | |||
25 | #define __CPU_COOLING_H__ | 25 | #define __CPU_COOLING_H__ |
26 | 26 | ||
27 | #include <linux/thermal.h> | 27 | #include <linux/thermal.h> |
28 | #include <linux/cpumask.h> | ||
28 | 29 | ||
29 | #define CPUFREQ_COOLING_START 0 | 30 | #ifdef CONFIG_CPU_THERMAL |
30 | #define CPUFREQ_COOLING_STOP 1 | ||
31 | |||
32 | #if defined(CONFIG_CPU_THERMAL) || defined(CONFIG_CPU_THERMAL_MODULE) | ||
33 | /** | 31 | /** |
34 | * cpufreq_cooling_register - function to create cpufreq cooling device. | 32 | * cpufreq_cooling_register - function to create cpufreq cooling device. |
35 | * @clip_cpus: cpumask of cpus where the frequency constraints will happen | 33 | * @clip_cpus: cpumask of cpus where the frequency constraints will happen |
36 | */ | 34 | */ |
37 | struct thermal_cooling_device *cpufreq_cooling_register( | 35 | struct thermal_cooling_device * |
38 | const struct cpumask *clip_cpus); | 36 | cpufreq_cooling_register(const struct cpumask *clip_cpus); |
39 | 37 | ||
40 | /** | 38 | /** |
41 | * cpufreq_cooling_unregister - function to remove cpufreq cooling device. | 39 | * cpufreq_cooling_unregister - function to remove cpufreq cooling device. |
42 | * @cdev: thermal cooling device pointer. | 40 | * @cdev: thermal cooling device pointer. |
43 | */ | 41 | */ |
44 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); | 42 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); |
43 | |||
44 | unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); | ||
45 | #else /* !CONFIG_CPU_THERMAL */ | 45 | #else /* !CONFIG_CPU_THERMAL */ |
46 | static inline struct thermal_cooling_device *cpufreq_cooling_register( | 46 | static inline struct thermal_cooling_device * |
47 | const struct cpumask *clip_cpus) | 47 | cpufreq_cooling_register(const struct cpumask *clip_cpus) |
48 | { | 48 | { |
49 | return NULL; | 49 | return NULL; |
50 | } | 50 | } |
51 | static inline void cpufreq_cooling_unregister( | 51 | static inline |
52 | struct thermal_cooling_device *cdev) | 52 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) |
53 | { | 53 | { |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | static inline | ||
57 | unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int) | ||
58 | { | ||
59 | return THERMAL_CSTATE_INVALID; | ||
60 | } | ||
56 | #endif /* CONFIG_CPU_THERMAL */ | 61 | #endif /* CONFIG_CPU_THERMAL */ |
57 | 62 | ||
58 | #endif /* __CPU_COOLING_H__ */ | 63 | #endif /* __CPU_COOLING_H__ */ |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index a22944ca0526..037d36ae63e5 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -106,6 +106,7 @@ struct cpufreq_policy { | |||
106 | * governors are used */ | 106 | * governors are used */ |
107 | unsigned int policy; /* see above */ | 107 | unsigned int policy; /* see above */ |
108 | struct cpufreq_governor *governor; /* see below */ | 108 | struct cpufreq_governor *governor; /* see below */ |
109 | void *governor_data; | ||
109 | 110 | ||
110 | struct work_struct update; /* if update_policy() needs to be | 111 | struct work_struct update; /* if update_policy() needs to be |
111 | * called, but you're in IRQ context */ | 112 | * called, but you're in IRQ context */ |
@@ -178,9 +179,11 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu | |||
178 | * CPUFREQ GOVERNORS * | 179 | * CPUFREQ GOVERNORS * |
179 | *********************************************************************/ | 180 | *********************************************************************/ |
180 | 181 | ||
181 | #define CPUFREQ_GOV_START 1 | 182 | #define CPUFREQ_GOV_START 1 |
182 | #define CPUFREQ_GOV_STOP 2 | 183 | #define CPUFREQ_GOV_STOP 2 |
183 | #define CPUFREQ_GOV_LIMITS 3 | 184 | #define CPUFREQ_GOV_LIMITS 3 |
185 | #define CPUFREQ_GOV_POLICY_INIT 4 | ||
186 | #define CPUFREQ_GOV_POLICY_EXIT 5 | ||
184 | 187 | ||
185 | struct cpufreq_governor { | 188 | struct cpufreq_governor { |
186 | char name[CPUFREQ_NAME_LEN]; | 189 | char name[CPUFREQ_NAME_LEN]; |
@@ -229,6 +232,13 @@ struct cpufreq_driver { | |||
229 | struct module *owner; | 232 | struct module *owner; |
230 | char name[CPUFREQ_NAME_LEN]; | 233 | char name[CPUFREQ_NAME_LEN]; |
231 | u8 flags; | 234 | u8 flags; |
235 | /* | ||
236 | * This should be set by platforms having multiple clock-domains, i.e. | ||
237 | * supporting multiple policies. With this sysfs directories of governor | ||
238 | * would be created in cpu/cpu<num>/cpufreq/ directory and so they can | ||
239 | * use the same governor with different tunables for different clusters. | ||
240 | */ | ||
241 | bool have_governor_per_policy; | ||
232 | 242 | ||
233 | /* needed by all drivers */ | 243 | /* needed by all drivers */ |
234 | int (*init) (struct cpufreq_policy *policy); | 244 | int (*init) (struct cpufreq_policy *policy); |
@@ -268,8 +278,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data); | |||
268 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); | 278 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); |
269 | 279 | ||
270 | 280 | ||
271 | void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); | 281 | void cpufreq_notify_transition(struct cpufreq_policy *policy, |
272 | 282 | struct cpufreq_freqs *freqs, unsigned int state); | |
273 | 283 | ||
274 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) | 284 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) |
275 | { | 285 | { |
@@ -329,6 +339,7 @@ const char *cpufreq_get_current_driver(void); | |||
329 | *********************************************************************/ | 339 | *********************************************************************/ |
330 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); | 340 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); |
331 | int cpufreq_update_policy(unsigned int cpu); | 341 | int cpufreq_update_policy(unsigned int cpu); |
342 | bool have_governor_per_policy(void); | ||
332 | 343 | ||
333 | #ifdef CONFIG_CPU_FREQ | 344 | #ifdef CONFIG_CPU_FREQ |
334 | /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ | 345 | /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 480c14dc1ddd..8f0406230a0a 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/completion.h> | 17 | #include <linux/completion.h> |
18 | #include <linux/hrtimer.h> | 18 | #include <linux/hrtimer.h> |
19 | 19 | ||
20 | #define CPUIDLE_STATE_MAX 8 | 20 | #define CPUIDLE_STATE_MAX 10 |
21 | #define CPUIDLE_NAME_LEN 16 | 21 | #define CPUIDLE_NAME_LEN 16 |
22 | #define CPUIDLE_DESC_LEN 32 | 22 | #define CPUIDLE_DESC_LEN 32 |
23 | 23 | ||
@@ -57,6 +57,7 @@ struct cpuidle_state { | |||
57 | /* Idle State Flags */ | 57 | /* Idle State Flags */ |
58 | #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ | 58 | #define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ |
59 | #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ | 59 | #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ |
60 | #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ | ||
60 | 61 | ||
61 | #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) | 62 | #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) |
62 | 63 | ||
@@ -104,8 +105,8 @@ struct cpuidle_driver { | |||
104 | struct module *owner; | 105 | struct module *owner; |
105 | int refcnt; | 106 | int refcnt; |
106 | 107 | ||
107 | /* set to 1 to use the core cpuidle time keeping (for all states). */ | 108 | /* used by the cpuidle framework to setup the broadcast timer */ |
108 | unsigned int en_core_tk_irqen:1; | 109 | unsigned int bctimer:1; |
109 | /* states array must be ordered in decreasing power consumption */ | 110 | /* states array must be ordered in decreasing power consumption */ |
110 | struct cpuidle_state states[CPUIDLE_STATE_MAX]; | 111 | struct cpuidle_state states[CPUIDLE_STATE_MAX]; |
111 | int state_count; | 112 | int state_count; |
@@ -122,17 +123,15 @@ extern void cpuidle_driver_unref(void); | |||
122 | extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); | 123 | extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); |
123 | extern int cpuidle_register_device(struct cpuidle_device *dev); | 124 | extern int cpuidle_register_device(struct cpuidle_device *dev); |
124 | extern void cpuidle_unregister_device(struct cpuidle_device *dev); | 125 | extern void cpuidle_unregister_device(struct cpuidle_device *dev); |
125 | 126 | extern int cpuidle_register(struct cpuidle_driver *drv, | |
127 | const struct cpumask *const coupled_cpus); | ||
128 | extern void cpuidle_unregister(struct cpuidle_driver *drv); | ||
126 | extern void cpuidle_pause_and_lock(void); | 129 | extern void cpuidle_pause_and_lock(void); |
127 | extern void cpuidle_resume_and_unlock(void); | 130 | extern void cpuidle_resume_and_unlock(void); |
128 | extern void cpuidle_pause(void); | 131 | extern void cpuidle_pause(void); |
129 | extern void cpuidle_resume(void); | 132 | extern void cpuidle_resume(void); |
130 | extern int cpuidle_enable_device(struct cpuidle_device *dev); | 133 | extern int cpuidle_enable_device(struct cpuidle_device *dev); |
131 | extern void cpuidle_disable_device(struct cpuidle_device *dev); | 134 | extern void cpuidle_disable_device(struct cpuidle_device *dev); |
132 | extern int cpuidle_wrap_enter(struct cpuidle_device *dev, | ||
133 | struct cpuidle_driver *drv, int index, | ||
134 | int (*enter)(struct cpuidle_device *dev, | ||
135 | struct cpuidle_driver *drv, int index)); | ||
136 | extern int cpuidle_play_dead(void); | 135 | extern int cpuidle_play_dead(void); |
137 | 136 | ||
138 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); | 137 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); |
@@ -151,7 +150,10 @@ static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } | |||
151 | static inline int cpuidle_register_device(struct cpuidle_device *dev) | 150 | static inline int cpuidle_register_device(struct cpuidle_device *dev) |
152 | {return -ENODEV; } | 151 | {return -ENODEV; } |
153 | static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } | 152 | static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } |
154 | 153 | static inline int cpuidle_register(struct cpuidle_driver *drv, | |
154 | const struct cpumask *const coupled_cpus) | ||
155 | {return -ENODEV; } | ||
156 | static inline void cpuidle_unregister(struct cpuidle_driver *drv) { } | ||
155 | static inline void cpuidle_pause_and_lock(void) { } | 157 | static inline void cpuidle_pause_and_lock(void) { } |
156 | static inline void cpuidle_resume_and_unlock(void) { } | 158 | static inline void cpuidle_resume_and_unlock(void) { } |
157 | static inline void cpuidle_pause(void) { } | 159 | static inline void cpuidle_pause(void) { } |
@@ -159,11 +161,6 @@ static inline void cpuidle_resume(void) { } | |||
159 | static inline int cpuidle_enable_device(struct cpuidle_device *dev) | 161 | static inline int cpuidle_enable_device(struct cpuidle_device *dev) |
160 | {return -ENODEV; } | 162 | {return -ENODEV; } |
161 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } | 163 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } |
162 | static inline int cpuidle_wrap_enter(struct cpuidle_device *dev, | ||
163 | struct cpuidle_driver *drv, int index, | ||
164 | int (*enter)(struct cpuidle_device *dev, | ||
165 | struct cpuidle_driver *drv, int index)) | ||
166 | { return -ENODEV; } | ||
167 | static inline int cpuidle_play_dead(void) {return -ENODEV; } | 164 | static inline int cpuidle_play_dead(void) {return -ENODEV; } |
168 | #endif | 165 | #endif |
169 | 166 | ||
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 032560295fcb..d08e4d2a9b92 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -591,6 +591,21 @@ static inline int cpulist_scnprintf(char *buf, int len, | |||
591 | } | 591 | } |
592 | 592 | ||
593 | /** | 593 | /** |
594 | * cpumask_parse - extract a cpumask from from a string | ||
595 | * @buf: the buffer to extract from | ||
596 | * @dstp: the cpumask to set. | ||
597 | * | ||
598 | * Returns -errno, or 0 for success. | ||
599 | */ | ||
600 | static inline int cpumask_parse(const char *buf, struct cpumask *dstp) | ||
601 | { | ||
602 | char *nl = strchr(buf, '\n'); | ||
603 | int len = nl ? nl - buf : strlen(buf); | ||
604 | |||
605 | return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); | ||
606 | } | ||
607 | |||
608 | /** | ||
594 | * cpulist_parse - extract a cpumask from a user string of ranges | 609 | * cpulist_parse - extract a cpumask from a user string of ranges |
595 | * @buf: the buffer to extract from | 610 | * @buf: the buffer to extract from |
596 | * @dstp: the cpumask to set. | 611 | * @dstp: the cpumask to set. |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 8c8a60d29407..cc1b01cf2035 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <linux/cpumask.h> | 12 | #include <linux/cpumask.h> |
13 | #include <linux/nodemask.h> | 13 | #include <linux/nodemask.h> |
14 | #include <linux/cgroup.h> | ||
15 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
16 | 15 | ||
17 | #ifdef CONFIG_CPUSETS | 16 | #ifdef CONFIG_CPUSETS |
@@ -64,10 +63,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, | |||
64 | extern int cpuset_memory_pressure_enabled; | 63 | extern int cpuset_memory_pressure_enabled; |
65 | extern void __cpuset_memory_pressure_bump(void); | 64 | extern void __cpuset_memory_pressure_bump(void); |
66 | 65 | ||
67 | extern const struct file_operations proc_cpuset_operations; | ||
68 | struct seq_file; | ||
69 | extern void cpuset_task_status_allowed(struct seq_file *m, | 66 | extern void cpuset_task_status_allowed(struct seq_file *m, |
70 | struct task_struct *task); | 67 | struct task_struct *task); |
68 | extern int proc_cpuset_show(struct seq_file *, void *); | ||
71 | 69 | ||
72 | extern int cpuset_mem_spread_node(void); | 70 | extern int cpuset_mem_spread_node(void); |
73 | extern int cpuset_slab_spread_node(void); | 71 | extern int cpuset_slab_spread_node(void); |
diff --git a/include/linux/ctype.h b/include/linux/ctype.h index 8acfe312f947..653589e3e30e 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h | |||
@@ -61,4 +61,10 @@ static inline char _tolower(const char c) | |||
61 | return c | 0x20; | 61 | return c | 0x20; |
62 | } | 62 | } |
63 | 63 | ||
64 | /* Fast check for octal digit */ | ||
65 | static inline int isodigit(const char c) | ||
66 | { | ||
67 | return c >= '0' && c <= '7'; | ||
68 | } | ||
69 | |||
64 | #endif | 70 | #endif |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 3bd46f766751..21ca773f77bf 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
@@ -27,7 +27,7 @@ extern int debug_locks_off(void); | |||
27 | \ | 27 | \ |
28 | if (!oops_in_progress && unlikely(c)) { \ | 28 | if (!oops_in_progress && unlikely(c)) { \ |
29 | if (debug_locks_off() && !debug_locks_silent) \ | 29 | if (debug_locks_off() && !debug_locks_silent) \ |
30 | WARN_ON(1); \ | 30 | WARN(1, "DEBUG_LOCKS_WARN_ON(%s)", #c); \ |
31 | __ret = 1; \ | 31 | __ret = 1; \ |
32 | } \ | 32 | } \ |
33 | __ret; \ | 33 | __ret; \ |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 1e483fa7afb4..3cd32478f2fd 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -79,11 +79,26 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd, | |||
79 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | 79 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, |
80 | struct bio_vec *biovec, int max_size); | 80 | struct bio_vec *biovec, int max_size); |
81 | 81 | ||
82 | /* | ||
83 | * These iteration functions are typically used to check (and combine) | ||
84 | * properties of underlying devices. | ||
85 | * E.g. Does at least one underlying device support flush? | ||
86 | * Does any underlying device not support WRITE_SAME? | ||
87 | * | ||
88 | * The callout function is called once for each contiguous section of | ||
89 | * an underlying device. State can be maintained in *data. | ||
90 | * Return non-zero to stop iterating through any further devices. | ||
91 | */ | ||
82 | typedef int (*iterate_devices_callout_fn) (struct dm_target *ti, | 92 | typedef int (*iterate_devices_callout_fn) (struct dm_target *ti, |
83 | struct dm_dev *dev, | 93 | struct dm_dev *dev, |
84 | sector_t start, sector_t len, | 94 | sector_t start, sector_t len, |
85 | void *data); | 95 | void *data); |
86 | 96 | ||
97 | /* | ||
98 | * This function must iterate through each section of device used by the | ||
99 | * target until it encounters a non-zero return code, which it then returns. | ||
100 | * Returns zero if no callout returned non-zero. | ||
101 | */ | ||
87 | typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, | 102 | typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, |
88 | iterate_devices_callout_fn fn, | 103 | iterate_devices_callout_fn fn, |
89 | void *data); | 104 | void *data); |
diff --git a/include/linux/device.h b/include/linux/device.h index 9d6464ea99c6..c0a126125325 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
26 | #include <linux/atomic.h> | 26 | #include <linux/atomic.h> |
27 | #include <linux/ratelimit.h> | 27 | #include <linux/ratelimit.h> |
28 | #include <linux/uidgid.h> | ||
28 | #include <asm/device.h> | 29 | #include <asm/device.h> |
29 | 30 | ||
30 | struct device; | 31 | struct device; |
@@ -111,17 +112,11 @@ struct bus_type { | |||
111 | struct iommu_ops *iommu_ops; | 112 | struct iommu_ops *iommu_ops; |
112 | 113 | ||
113 | struct subsys_private *p; | 114 | struct subsys_private *p; |
115 | struct lock_class_key lock_key; | ||
114 | }; | 116 | }; |
115 | 117 | ||
116 | /* This is a #define to keep the compiler from merging different | 118 | extern int __must_check bus_register(struct bus_type *bus); |
117 | * instances of the __key variable */ | 119 | |
118 | #define bus_register(subsys) \ | ||
119 | ({ \ | ||
120 | static struct lock_class_key __key; \ | ||
121 | __bus_register(subsys, &__key); \ | ||
122 | }) | ||
123 | extern int __must_check __bus_register(struct bus_type *bus, | ||
124 | struct lock_class_key *key); | ||
125 | extern void bus_unregister(struct bus_type *bus); | 120 | extern void bus_unregister(struct bus_type *bus); |
126 | 121 | ||
127 | extern int __must_check bus_rescan_devices(struct bus_type *bus); | 122 | extern int __must_check bus_rescan_devices(struct bus_type *bus); |
@@ -302,6 +297,8 @@ void subsys_interface_unregister(struct subsys_interface *sif); | |||
302 | 297 | ||
303 | int subsys_system_register(struct bus_type *subsys, | 298 | int subsys_system_register(struct bus_type *subsys, |
304 | const struct attribute_group **groups); | 299 | const struct attribute_group **groups); |
300 | int subsys_virtual_register(struct bus_type *subsys, | ||
301 | const struct attribute_group **groups); | ||
305 | 302 | ||
306 | /** | 303 | /** |
307 | * struct class - device classes | 304 | * struct class - device classes |
@@ -471,7 +468,8 @@ struct device_type { | |||
471 | const char *name; | 468 | const char *name; |
472 | const struct attribute_group **groups; | 469 | const struct attribute_group **groups; |
473 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 470 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
474 | char *(*devnode)(struct device *dev, umode_t *mode); | 471 | char *(*devnode)(struct device *dev, umode_t *mode, |
472 | kuid_t *uid, kgid_t *gid); | ||
475 | void (*release)(struct device *dev); | 473 | void (*release)(struct device *dev); |
476 | 474 | ||
477 | const struct dev_pm_ops *pm; | 475 | const struct dev_pm_ops *pm; |
@@ -578,6 +576,10 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); | |||
578 | void __iomem *devm_request_and_ioremap(struct device *dev, | 576 | void __iomem *devm_request_and_ioremap(struct device *dev, |
579 | struct resource *res); | 577 | struct resource *res); |
580 | 578 | ||
579 | /* allows to add/remove a custom action to devres stack */ | ||
580 | int devm_add_action(struct device *dev, void (*action)(void *), void *data); | ||
581 | void devm_remove_action(struct device *dev, void (*action)(void *), void *data); | ||
582 | |||
581 | struct device_dma_parameters { | 583 | struct device_dma_parameters { |
582 | /* | 584 | /* |
583 | * a low level driver may set these to teach IOMMU code about | 585 | * a low level driver may set these to teach IOMMU code about |
@@ -849,7 +851,8 @@ extern int device_rename(struct device *dev, const char *new_name); | |||
849 | extern int device_move(struct device *dev, struct device *new_parent, | 851 | extern int device_move(struct device *dev, struct device *new_parent, |
850 | enum dpm_order dpm_order); | 852 | enum dpm_order dpm_order); |
851 | extern const char *device_get_devnode(struct device *dev, | 853 | extern const char *device_get_devnode(struct device *dev, |
852 | umode_t *mode, const char **tmp); | 854 | umode_t *mode, kuid_t *uid, kgid_t *gid, |
855 | const char **tmp); | ||
853 | extern void *dev_get_drvdata(const struct device *dev); | 856 | extern void *dev_get_drvdata(const struct device *dev); |
854 | extern int dev_set_drvdata(struct device *dev, void *data); | 857 | extern int dev_set_drvdata(struct device *dev, void *data); |
855 | 858 | ||
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 9978b614a1aa..dfac5ed31120 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
@@ -112,6 +112,8 @@ struct dma_buf_ops { | |||
112 | * @file: file pointer used for sharing buffers across, and for refcounting. | 112 | * @file: file pointer used for sharing buffers across, and for refcounting. |
113 | * @attachments: list of dma_buf_attachment that denotes all devices attached. | 113 | * @attachments: list of dma_buf_attachment that denotes all devices attached. |
114 | * @ops: dma_buf_ops associated with this buffer object. | 114 | * @ops: dma_buf_ops associated with this buffer object. |
115 | * @exp_name: name of the exporter; useful for debugging. | ||
116 | * @list_node: node for dma_buf accounting and debugging. | ||
115 | * @priv: exporter specific private data for this buffer object. | 117 | * @priv: exporter specific private data for this buffer object. |
116 | */ | 118 | */ |
117 | struct dma_buf { | 119 | struct dma_buf { |
@@ -123,6 +125,8 @@ struct dma_buf { | |||
123 | struct mutex lock; | 125 | struct mutex lock; |
124 | unsigned vmapping_counter; | 126 | unsigned vmapping_counter; |
125 | void *vmap_ptr; | 127 | void *vmap_ptr; |
128 | const char *exp_name; | ||
129 | struct list_head list_node; | ||
126 | void *priv; | 130 | void *priv; |
127 | }; | 131 | }; |
128 | 132 | ||
@@ -162,8 +166,13 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | |||
162 | struct device *dev); | 166 | struct device *dev); |
163 | void dma_buf_detach(struct dma_buf *dmabuf, | 167 | void dma_buf_detach(struct dma_buf *dmabuf, |
164 | struct dma_buf_attachment *dmabuf_attach); | 168 | struct dma_buf_attachment *dmabuf_attach); |
165 | struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops, | 169 | |
166 | size_t size, int flags); | 170 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, |
171 | size_t size, int flags, const char *); | ||
172 | |||
173 | #define dma_buf_export(priv, ops, size, flags) \ | ||
174 | dma_buf_export_named(priv, ops, size, flags, __FILE__) | ||
175 | |||
167 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); | 176 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); |
168 | struct dma_buf *dma_buf_get(int fd); | 177 | struct dma_buf *dma_buf_get(int fd); |
169 | void dma_buf_put(struct dma_buf *dmabuf); | 178 | void dma_buf_put(struct dma_buf *dmabuf); |
@@ -185,5 +194,6 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, | |||
185 | unsigned long); | 194 | unsigned long); |
186 | void *dma_buf_vmap(struct dma_buf *); | 195 | void *dma_buf_vmap(struct dma_buf *); |
187 | void dma_buf_vunmap(struct dma_buf *, void *vaddr); | 196 | void dma_buf_vunmap(struct dma_buf *, void *vaddr); |
188 | 197 | int dma_buf_debugfs_create_file(const char *name, | |
198 | int (*write)(struct seq_file *)); | ||
189 | #endif /* __DMA_BUF_H__ */ | 199 | #endif /* __DMA_BUF_H__ */ |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 91ac8da25020..96d3e4ab11a9 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -967,8 +967,9 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); | |||
967 | #ifdef CONFIG_DMA_ENGINE | 967 | #ifdef CONFIG_DMA_ENGINE |
968 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); | 968 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); |
969 | void dma_issue_pending_all(void); | 969 | void dma_issue_pending_all(void); |
970 | struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); | 970 | struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, |
971 | struct dma_chan *dma_request_slave_channel(struct device *dev, char *name); | 971 | dma_filter_fn fn, void *fn_param); |
972 | struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); | ||
972 | void dma_release_channel(struct dma_chan *chan); | 973 | void dma_release_channel(struct dma_chan *chan); |
973 | #else | 974 | #else |
974 | static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) | 975 | static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) |
@@ -978,13 +979,13 @@ static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descript | |||
978 | static inline void dma_issue_pending_all(void) | 979 | static inline void dma_issue_pending_all(void) |
979 | { | 980 | { |
980 | } | 981 | } |
981 | static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, | 982 | static inline struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, |
982 | dma_filter_fn fn, void *fn_param) | 983 | dma_filter_fn fn, void *fn_param) |
983 | { | 984 | { |
984 | return NULL; | 985 | return NULL; |
985 | } | 986 | } |
986 | static inline struct dma_chan *dma_request_slave_channel(struct device *dev, | 987 | static inline struct dma_chan *dma_request_slave_channel(struct device *dev, |
987 | char *name) | 988 | const char *name) |
988 | { | 989 | { |
989 | return NULL; | 990 | return NULL; |
990 | } | 991 | } |
@@ -1005,9 +1006,9 @@ struct dma_chan *net_dma_find_channel(void); | |||
1005 | __dma_request_slave_channel_compat(&(mask), x, y, dev, name) | 1006 | __dma_request_slave_channel_compat(&(mask), x, y, dev, name) |
1006 | 1007 | ||
1007 | static inline struct dma_chan | 1008 | static inline struct dma_chan |
1008 | *__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn, | 1009 | *__dma_request_slave_channel_compat(const dma_cap_mask_t *mask, |
1009 | void *fn_param, struct device *dev, | 1010 | dma_filter_fn fn, void *fn_param, |
1010 | char *name) | 1011 | struct device *dev, char *name) |
1011 | { | 1012 | { |
1012 | struct dma_chan *chan; | 1013 | struct dma_chan *chan; |
1013 | 1014 | ||
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index f156cca25ad0..b6eb7a05d58e 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -99,6 +99,7 @@ extern const char * dmi_get_system_info(int field); | |||
99 | extern const struct dmi_device * dmi_find_device(int type, const char *name, | 99 | extern const struct dmi_device * dmi_find_device(int type, const char *name, |
100 | const struct dmi_device *from); | 100 | const struct dmi_device *from); |
101 | extern void dmi_scan_machine(void); | 101 | extern void dmi_scan_machine(void); |
102 | extern void dmi_set_dump_stack_arch_desc(void); | ||
102 | extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); | 103 | extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); |
103 | extern int dmi_name_in_vendors(const char *str); | 104 | extern int dmi_name_in_vendors(const char *str); |
104 | extern int dmi_name_in_serial(const char *str); | 105 | extern int dmi_name_in_serial(const char *str); |
@@ -114,6 +115,7 @@ static inline const char * dmi_get_system_info(int field) { return NULL; } | |||
114 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, | 115 | static inline const struct dmi_device * dmi_find_device(int type, const char *name, |
115 | const struct dmi_device *from) { return NULL; } | 116 | const struct dmi_device *from) { return NULL; } |
116 | static inline void dmi_scan_machine(void) { return; } | 117 | static inline void dmi_scan_machine(void) { return; } |
118 | static inline void dmi_set_dump_stack_arch_desc(void) { } | ||
117 | static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) | 119 | static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) |
118 | { | 120 | { |
119 | if (yearp) | 121 | if (yearp) |
diff --git a/include/linux/drbd.h b/include/linux/drbd.h index 0c5a18ec322c..1b4d4ee1168f 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h | |||
@@ -52,7 +52,7 @@ | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | extern const char *drbd_buildtag(void); | 54 | extern const char *drbd_buildtag(void); |
55 | #define REL_VERSION "8.4.2" | 55 | #define REL_VERSION "8.4.3" |
56 | #define API_VERSION 1 | 56 | #define API_VERSION 1 |
57 | #define PRO_VERSION_MIN 86 | 57 | #define PRO_VERSION_MIN 86 |
58 | #define PRO_VERSION_MAX 101 | 58 | #define PRO_VERSION_MAX 101 |
@@ -319,7 +319,8 @@ enum drbd_state_rv { | |||
319 | SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ | 319 | SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ |
320 | SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ | 320 | SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ |
321 | SS_O_VOL_PEER_PRI = -20, | 321 | SS_O_VOL_PEER_PRI = -20, |
322 | SS_AFTER_LAST_ERROR = -21, /* Keep this at bottom */ | 322 | SS_OUTDATE_WO_CONN = -21, |
323 | SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */ | ||
323 | }; | 324 | }; |
324 | 325 | ||
325 | /* from drbd_strings.c */ | 326 | /* from drbd_strings.c */ |
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h index 1fa19c5f5e64..1fedf2b17cc8 100644 --- a/include/linux/drbd_limits.h +++ b/include/linux/drbd_limits.h | |||
@@ -126,13 +126,12 @@ | |||
126 | #define DRBD_RESYNC_RATE_DEF 250 | 126 | #define DRBD_RESYNC_RATE_DEF 250 |
127 | #define DRBD_RESYNC_RATE_SCALE 'k' /* kilobytes */ | 127 | #define DRBD_RESYNC_RATE_SCALE 'k' /* kilobytes */ |
128 | 128 | ||
129 | /* less than 7 would hit performance unnecessarily. | 129 | /* less than 7 would hit performance unnecessarily. */ |
130 | * 919 slots context information per transaction, | ||
131 | * 32k activity log, 4k transaction size, | ||
132 | * one transaction in flight: | ||
133 | * 919 * 7 = 6433 */ | ||
134 | #define DRBD_AL_EXTENTS_MIN 7 | 130 | #define DRBD_AL_EXTENTS_MIN 7 |
135 | #define DRBD_AL_EXTENTS_MAX 6433 | 131 | /* we use u16 as "slot number", (u16)~0 is "FREE". |
132 | * If you use >= 292 kB on-disk ring buffer, | ||
133 | * this is the maximum you can use: */ | ||
134 | #define DRBD_AL_EXTENTS_MAX 0xfffe | ||
136 | #define DRBD_AL_EXTENTS_DEF 1237 | 135 | #define DRBD_AL_EXTENTS_DEF 1237 |
137 | #define DRBD_AL_EXTENTS_SCALE '1' | 136 | #define DRBD_AL_EXTENTS_SCALE '1' |
138 | 137 | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h index 3d7df3d32c66..2bc0ad78d058 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -670,6 +670,12 @@ static inline int efi_enabled(int facility) | |||
670 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ | 670 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ |
671 | EFI_VARIABLE_APPEND_WRITE) | 671 | EFI_VARIABLE_APPEND_WRITE) |
672 | /* | 672 | /* |
673 | * Length of a GUID string (strlen("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")) | ||
674 | * not including trailing NUL | ||
675 | */ | ||
676 | #define EFI_VARIABLE_GUID_LEN 36 | ||
677 | |||
678 | /* | ||
673 | * The type of search to perform when calling boottime->locate_handle | 679 | * The type of search to perform when calling boottime->locate_handle |
674 | */ | 680 | */ |
675 | #define EFI_LOCATE_ALL_HANDLES 0 | 681 | #define EFI_LOCATE_ALL_HANDLES 0 |
@@ -726,7 +732,6 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages) | |||
726 | *addr &= PAGE_MASK; | 732 | *addr &= PAGE_MASK; |
727 | } | 733 | } |
728 | 734 | ||
729 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | ||
730 | /* | 735 | /* |
731 | * EFI Variable support. | 736 | * EFI Variable support. |
732 | * | 737 | * |
@@ -752,19 +757,88 @@ struct efivars { | |||
752 | * which is protected by the BKL, so that path is safe. | 757 | * which is protected by the BKL, so that path is safe. |
753 | */ | 758 | */ |
754 | spinlock_t lock; | 759 | spinlock_t lock; |
755 | struct list_head list; | ||
756 | struct kset *kset; | 760 | struct kset *kset; |
757 | struct kobject *kobject; | 761 | struct kobject *kobject; |
758 | struct bin_attribute *new_var, *del_var; | ||
759 | const struct efivar_operations *ops; | 762 | const struct efivar_operations *ops; |
760 | struct efivar_entry *walk_entry; | ||
761 | struct pstore_info efi_pstore_info; | ||
762 | }; | 763 | }; |
763 | 764 | ||
764 | int register_efivars(struct efivars *efivars, | 765 | /* |
766 | * The maximum size of VariableName + Data = 1024 | ||
767 | * Therefore, it's reasonable to save that much | ||
768 | * space in each part of the structure, | ||
769 | * and we use a page for reading/writing. | ||
770 | */ | ||
771 | |||
772 | struct efi_variable { | ||
773 | efi_char16_t VariableName[1024/sizeof(efi_char16_t)]; | ||
774 | efi_guid_t VendorGuid; | ||
775 | unsigned long DataSize; | ||
776 | __u8 Data[1024]; | ||
777 | efi_status_t Status; | ||
778 | __u32 Attributes; | ||
779 | } __attribute__((packed)); | ||
780 | |||
781 | struct efivar_entry { | ||
782 | struct efi_variable var; | ||
783 | struct list_head list; | ||
784 | struct kobject kobj; | ||
785 | }; | ||
786 | |||
787 | extern struct list_head efivar_sysfs_list; | ||
788 | |||
789 | static inline void | ||
790 | efivar_unregister(struct efivar_entry *var) | ||
791 | { | ||
792 | kobject_put(&var->kobj); | ||
793 | } | ||
794 | |||
795 | int efivars_register(struct efivars *efivars, | ||
765 | const struct efivar_operations *ops, | 796 | const struct efivar_operations *ops, |
766 | struct kobject *parent_kobj); | 797 | struct kobject *kobject); |
767 | void unregister_efivars(struct efivars *efivars); | 798 | int efivars_unregister(struct efivars *efivars); |
799 | struct kobject *efivars_kobject(void); | ||
800 | |||
801 | int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), | ||
802 | void *data, bool atomic, bool duplicates, | ||
803 | struct list_head *head); | ||
804 | |||
805 | void efivar_entry_add(struct efivar_entry *entry, struct list_head *head); | ||
806 | void efivar_entry_remove(struct efivar_entry *entry); | ||
807 | |||
808 | int __efivar_entry_delete(struct efivar_entry *entry); | ||
809 | int efivar_entry_delete(struct efivar_entry *entry); | ||
810 | |||
811 | int efivar_entry_size(struct efivar_entry *entry, unsigned long *size); | ||
812 | int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, | ||
813 | unsigned long *size, void *data); | ||
814 | int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, | ||
815 | unsigned long *size, void *data); | ||
816 | int efivar_entry_set(struct efivar_entry *entry, u32 attributes, | ||
817 | unsigned long size, void *data, struct list_head *head); | ||
818 | int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, | ||
819 | unsigned long *size, void *data, bool *set); | ||
820 | int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, | ||
821 | bool block, unsigned long size, void *data); | ||
822 | |||
823 | void efivar_entry_iter_begin(void); | ||
824 | void efivar_entry_iter_end(void); | ||
825 | |||
826 | int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *), | ||
827 | struct list_head *head, void *data, | ||
828 | struct efivar_entry **prev); | ||
829 | int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), | ||
830 | struct list_head *head, void *data); | ||
831 | |||
832 | struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, | ||
833 | struct list_head *head, bool remove); | ||
834 | |||
835 | bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); | ||
836 | |||
837 | extern struct work_struct efivar_work; | ||
838 | void efivar_run_worker(void); | ||
839 | |||
840 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | ||
841 | int efivars_sysfs_init(void); | ||
768 | 842 | ||
769 | #endif /* CONFIG_EFI_VARS */ | 843 | #endif /* CONFIG_EFI_VARS */ |
770 | 844 | ||
diff --git a/include/linux/errno.h b/include/linux/errno.h index f6bf082d4d4f..89627b9187f9 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h | |||
@@ -28,6 +28,5 @@ | |||
28 | #define EBADTYPE 527 /* Type not supported by server */ | 28 | #define EBADTYPE 527 /* Type not supported by server */ |
29 | #define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ | 29 | #define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ |
30 | #define EIOCBQUEUED 529 /* iocb queued, will get completion event */ | 30 | #define EIOCBQUEUED 529 /* iocb queued, will get completion event */ |
31 | #define EIOCBRETRY 530 /* iocb queued, will trigger a retry */ | ||
32 | 31 | ||
33 | #endif | 32 | #endif |
diff --git a/include/linux/evm.h b/include/linux/evm.h index 9fc13a760928..1fcb88ca88de 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h | |||
@@ -96,5 +96,5 @@ static inline int evm_inode_init_security(struct inode *inode, | |||
96 | return 0; | 96 | return 0; |
97 | } | 97 | } |
98 | 98 | ||
99 | #endif /* CONFIG_EVM_H */ | 99 | #endif /* CONFIG_EVM */ |
100 | #endif /* LINUX_EVM_H */ | 100 | #endif /* LINUX_EVM_H */ |
diff --git a/include/linux/export.h b/include/linux/export.h index 696c0f48afc7..412cd509effe 100644 --- a/include/linux/export.h +++ b/include/linux/export.h | |||
@@ -5,17 +5,24 @@ | |||
5 | * to reduce the amount of pointless cruft we feed to gcc when only | 5 | * to reduce the amount of pointless cruft we feed to gcc when only |
6 | * exporting a simple symbol or two. | 6 | * exporting a simple symbol or two. |
7 | * | 7 | * |
8 | * If you feel the need to add #include <linux/foo.h> to this file | 8 | * Try not to add #includes here. It slows compilation and makes kernel |
9 | * then you are doing something wrong and should go away silently. | 9 | * hackers place grumpy comments in header files. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* Some toolchains use a `_' prefix for all user symbols. */ | 12 | /* Some toolchains use a `_' prefix for all user symbols. */ |
13 | #ifdef CONFIG_SYMBOL_PREFIX | 13 | #ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX |
14 | #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | 14 | #define __VMLINUX_SYMBOL(x) _##x |
15 | #define __VMLINUX_SYMBOL_STR(x) "_" #x | ||
15 | #else | 16 | #else |
16 | #define MODULE_SYMBOL_PREFIX "" | 17 | #define __VMLINUX_SYMBOL(x) x |
18 | #define __VMLINUX_SYMBOL_STR(x) #x | ||
17 | #endif | 19 | #endif |
18 | 20 | ||
21 | /* Indirect, so macros are expanded before pasting. */ | ||
22 | #define VMLINUX_SYMBOL(x) __VMLINUX_SYMBOL(x) | ||
23 | #define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x) | ||
24 | |||
25 | #ifndef __ASSEMBLY__ | ||
19 | struct kernel_symbol | 26 | struct kernel_symbol |
20 | { | 27 | { |
21 | unsigned long value; | 28 | unsigned long value; |
@@ -51,7 +58,7 @@ extern struct module __this_module; | |||
51 | __CRC_SYMBOL(sym, sec) \ | 58 | __CRC_SYMBOL(sym, sec) \ |
52 | static const char __kstrtab_##sym[] \ | 59 | static const char __kstrtab_##sym[] \ |
53 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ | 60 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ |
54 | = MODULE_SYMBOL_PREFIX #sym; \ | 61 | = VMLINUX_SYMBOL_STR(sym); \ |
55 | static const struct kernel_symbol __ksymtab_##sym \ | 62 | static const struct kernel_symbol __ksymtab_##sym \ |
56 | __used \ | 63 | __used \ |
57 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ | 64 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ |
@@ -85,5 +92,6 @@ extern struct module __this_module; | |||
85 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) | 92 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) |
86 | 93 | ||
87 | #endif /* CONFIG_MODULES */ | 94 | #endif /* CONFIG_MODULES */ |
95 | #endif /* !__ASSEMBLY__ */ | ||
88 | 96 | ||
89 | #endif /* _LINUX_EXPORT_H */ | 97 | #endif /* _LINUX_EXPORT_H */ |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 5b9b5b317180..41b223a59a63 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
@@ -85,6 +85,17 @@ enum fid_type { | |||
85 | FILEID_NILFS_WITH_PARENT = 0x62, | 85 | FILEID_NILFS_WITH_PARENT = 0x62, |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * 32 bit generation number, 40 bit i_pos. | ||
89 | */ | ||
90 | FILEID_FAT_WITHOUT_PARENT = 0x71, | ||
91 | |||
92 | /* | ||
93 | * 32 bit generation number, 40 bit i_pos, | ||
94 | * 32 bit parent generation number, 40 bit parent i_pos | ||
95 | */ | ||
96 | FILEID_FAT_WITH_PARENT = 0x72, | ||
97 | |||
98 | /* | ||
88 | * Filesystems must not use 0xff file ID. | 99 | * Filesystems must not use 0xff file ID. |
89 | */ | 100 | */ |
90 | FILEID_INVALID = 0xff, | 101 | FILEID_INVALID = 0xff, |
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index f9a12f6243a5..df6fab82f87e 100644 --- a/include/linux/f2fs_fs.h +++ b/include/linux/f2fs_fs.h | |||
@@ -139,7 +139,7 @@ struct f2fs_extent { | |||
139 | __le32 len; /* lengh of the extent */ | 139 | __le32 len; /* lengh of the extent */ |
140 | } __packed; | 140 | } __packed; |
141 | 141 | ||
142 | #define F2FS_MAX_NAME_LEN 256 | 142 | #define F2FS_NAME_LEN 255 |
143 | #define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ | 143 | #define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ |
144 | #define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ | 144 | #define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ |
145 | #define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ | 145 | #define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ |
@@ -165,7 +165,8 @@ struct f2fs_inode { | |||
165 | __le32 i_flags; /* file attributes */ | 165 | __le32 i_flags; /* file attributes */ |
166 | __le32 i_pino; /* parent inode number */ | 166 | __le32 i_pino; /* parent inode number */ |
167 | __le32 i_namelen; /* file name length */ | 167 | __le32 i_namelen; /* file name length */ |
168 | __u8 i_name[F2FS_MAX_NAME_LEN]; /* file name for SPOR */ | 168 | __u8 i_name[F2FS_NAME_LEN]; /* file name for SPOR */ |
169 | __u8 i_reserved2; /* for backward compatibility */ | ||
169 | 170 | ||
170 | struct f2fs_extent i_ext; /* caching a largest extent */ | 171 | struct f2fs_extent i_ext; /* caching a largest extent */ |
171 | 172 | ||
@@ -362,10 +363,10 @@ struct f2fs_summary_block { | |||
362 | typedef __le32 f2fs_hash_t; | 363 | typedef __le32 f2fs_hash_t; |
363 | 364 | ||
364 | /* One directory entry slot covers 8bytes-long file name */ | 365 | /* One directory entry slot covers 8bytes-long file name */ |
365 | #define F2FS_NAME_LEN 8 | 366 | #define F2FS_SLOT_LEN 8 |
366 | #define F2FS_NAME_LEN_BITS 3 | 367 | #define F2FS_SLOT_LEN_BITS 3 |
367 | 368 | ||
368 | #define GET_DENTRY_SLOTS(x) ((x + F2FS_NAME_LEN - 1) >> F2FS_NAME_LEN_BITS) | 369 | #define GET_DENTRY_SLOTS(x) ((x + F2FS_SLOT_LEN - 1) >> F2FS_SLOT_LEN_BITS) |
369 | 370 | ||
370 | /* the number of dentry in a block */ | 371 | /* the number of dentry in a block */ |
371 | #define NR_DENTRY_IN_BLOCK 214 | 372 | #define NR_DENTRY_IN_BLOCK 214 |
@@ -377,10 +378,10 @@ typedef __le32 f2fs_hash_t; | |||
377 | #define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \ | 378 | #define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \ |
378 | BITS_PER_BYTE) | 379 | BITS_PER_BYTE) |
379 | #define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \ | 380 | #define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \ |
380 | F2FS_NAME_LEN) * \ | 381 | F2FS_SLOT_LEN) * \ |
381 | NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP)) | 382 | NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP)) |
382 | 383 | ||
383 | /* One directory entry slot representing F2FS_NAME_LEN-sized file name */ | 384 | /* One directory entry slot representing F2FS_SLOT_LEN-sized file name */ |
384 | struct f2fs_dir_entry { | 385 | struct f2fs_dir_entry { |
385 | __le32 hash_code; /* hash code of file name */ | 386 | __le32 hash_code; /* hash code of file name */ |
386 | __le32 ino; /* inode number */ | 387 | __le32 ino; /* inode number */ |
@@ -394,7 +395,7 @@ struct f2fs_dentry_block { | |||
394 | __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP]; | 395 | __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP]; |
395 | __u8 reserved[SIZE_OF_RESERVED]; | 396 | __u8 reserved[SIZE_OF_RESERVED]; |
396 | struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK]; | 397 | struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK]; |
397 | __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_NAME_LEN]; | 398 | __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN]; |
398 | } __packed; | 399 | } __packed; |
399 | 400 | ||
400 | /* file types used in inode_info->flags */ | 401 | /* file types used in inode_info->flags */ |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 58b98606ac26..d49c60f5aa4c 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -501,6 +501,8 @@ struct fb_info { | |||
501 | resource_size_t size; | 501 | resource_size_t size; |
502 | } ranges[0]; | 502 | } ranges[0]; |
503 | } *apertures; | 503 | } *apertures; |
504 | |||
505 | bool skip_vt_switch; /* no VT switch on suspend/resume required */ | ||
504 | }; | 506 | }; |
505 | 507 | ||
506 | static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { | 508 | static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index fb7dacae0522..085197bd8812 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -27,7 +27,6 @@ struct fdtable { | |||
27 | unsigned long *close_on_exec; | 27 | unsigned long *close_on_exec; |
28 | unsigned long *open_fds; | 28 | unsigned long *open_fds; |
29 | struct rcu_head rcu; | 29 | struct rcu_head rcu; |
30 | struct fdtable *next; | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) | 32 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) |
diff --git a/include/linux/filter.h b/include/linux/filter.h index c45eabc135e1..c050dcc322a4 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -48,8 +48,22 @@ extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); | |||
48 | extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); | 48 | extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); |
49 | 49 | ||
50 | #ifdef CONFIG_BPF_JIT | 50 | #ifdef CONFIG_BPF_JIT |
51 | #include <stdarg.h> | ||
52 | #include <linux/linkage.h> | ||
53 | #include <linux/printk.h> | ||
54 | |||
51 | extern void bpf_jit_compile(struct sk_filter *fp); | 55 | extern void bpf_jit_compile(struct sk_filter *fp); |
52 | extern void bpf_jit_free(struct sk_filter *fp); | 56 | extern void bpf_jit_free(struct sk_filter *fp); |
57 | |||
58 | static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, | ||
59 | u32 pass, void *image) | ||
60 | { | ||
61 | pr_err("flen=%u proglen=%u pass=%u image=%p\n", | ||
62 | flen, proglen, pass, image); | ||
63 | if (image) | ||
64 | print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, | ||
65 | 16, 1, image, proglen, false); | ||
66 | } | ||
53 | #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) | 67 | #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) |
54 | #else | 68 | #else |
55 | static inline void bpf_jit_compile(struct sk_filter *fp) | 69 | static inline void bpf_jit_compile(struct sk_filter *fp) |
@@ -126,6 +140,7 @@ enum { | |||
126 | BPF_S_ANC_SECCOMP_LD_W, | 140 | BPF_S_ANC_SECCOMP_LD_W, |
127 | BPF_S_ANC_VLAN_TAG, | 141 | BPF_S_ANC_VLAN_TAG, |
128 | BPF_S_ANC_VLAN_TAG_PRESENT, | 142 | BPF_S_ANC_VLAN_TAG_PRESENT, |
143 | BPF_S_ANC_PAY_OFFSET, | ||
129 | }; | 144 | }; |
130 | 145 | ||
131 | #endif /* __LINUX_FILTER_H__ */ | 146 | #endif /* __LINUX_FILTER_H__ */ |
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index 30442547b9e6..8293262401de 100644 --- a/include/linux/frontswap.h +++ b/include/linux/frontswap.h | |||
@@ -14,7 +14,7 @@ struct frontswap_ops { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | extern bool frontswap_enabled; | 16 | extern bool frontswap_enabled; |
17 | extern struct frontswap_ops | 17 | extern struct frontswap_ops * |
18 | frontswap_register_ops(struct frontswap_ops *ops); | 18 | frontswap_register_ops(struct frontswap_ops *ops); |
19 | extern void frontswap_shrink(unsigned long); | 19 | extern void frontswap_shrink(unsigned long); |
20 | extern unsigned long frontswap_curr_pages(void); | 20 | extern unsigned long frontswap_curr_pages(void); |
@@ -22,33 +22,19 @@ extern void frontswap_writethrough(bool); | |||
22 | #define FRONTSWAP_HAS_EXCLUSIVE_GETS | 22 | #define FRONTSWAP_HAS_EXCLUSIVE_GETS |
23 | extern void frontswap_tmem_exclusive_gets(bool); | 23 | extern void frontswap_tmem_exclusive_gets(bool); |
24 | 24 | ||
25 | extern void __frontswap_init(unsigned type); | 25 | extern bool __frontswap_test(struct swap_info_struct *, pgoff_t); |
26 | extern void __frontswap_init(unsigned type, unsigned long *map); | ||
26 | extern int __frontswap_store(struct page *page); | 27 | extern int __frontswap_store(struct page *page); |
27 | extern int __frontswap_load(struct page *page); | 28 | extern int __frontswap_load(struct page *page); |
28 | extern void __frontswap_invalidate_page(unsigned, pgoff_t); | 29 | extern void __frontswap_invalidate_page(unsigned, pgoff_t); |
29 | extern void __frontswap_invalidate_area(unsigned); | 30 | extern void __frontswap_invalidate_area(unsigned); |
30 | 31 | ||
31 | #ifdef CONFIG_FRONTSWAP | 32 | #ifdef CONFIG_FRONTSWAP |
33 | #define frontswap_enabled (1) | ||
32 | 34 | ||
33 | static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) | 35 | static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) |
34 | { | 36 | { |
35 | bool ret = false; | 37 | return __frontswap_test(sis, offset); |
36 | |||
37 | if (frontswap_enabled && sis->frontswap_map) | ||
38 | ret = test_bit(offset, sis->frontswap_map); | ||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) | ||
43 | { | ||
44 | if (frontswap_enabled && sis->frontswap_map) | ||
45 | set_bit(offset, sis->frontswap_map); | ||
46 | } | ||
47 | |||
48 | static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset) | ||
49 | { | ||
50 | if (frontswap_enabled && sis->frontswap_map) | ||
51 | clear_bit(offset, sis->frontswap_map); | ||
52 | } | 38 | } |
53 | 39 | ||
54 | static inline void frontswap_map_set(struct swap_info_struct *p, | 40 | static inline void frontswap_map_set(struct swap_info_struct *p, |
@@ -71,14 +57,6 @@ static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) | |||
71 | return false; | 57 | return false; |
72 | } | 58 | } |
73 | 59 | ||
74 | static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset) | ||
79 | { | ||
80 | } | ||
81 | |||
82 | static inline void frontswap_map_set(struct swap_info_struct *p, | 60 | static inline void frontswap_map_set(struct swap_info_struct *p, |
83 | unsigned long *map) | 61 | unsigned long *map) |
84 | { | 62 | { |
@@ -120,10 +98,10 @@ static inline void frontswap_invalidate_area(unsigned type) | |||
120 | __frontswap_invalidate_area(type); | 98 | __frontswap_invalidate_area(type); |
121 | } | 99 | } |
122 | 100 | ||
123 | static inline void frontswap_init(unsigned type) | 101 | static inline void frontswap_init(unsigned type, unsigned long *map) |
124 | { | 102 | { |
125 | if (frontswap_enabled) | 103 | if (frontswap_enabled) |
126 | __frontswap_init(type); | 104 | __frontswap_init(type, map); |
127 | } | 105 | } |
128 | 106 | ||
129 | #endif /* _LINUX_FRONTSWAP_H */ | 107 | #endif /* _LINUX_FRONTSWAP_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 2c28271ab9d4..43db02e9c9fa 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -675,9 +675,11 @@ static inline loff_t i_size_read(const struct inode *inode) | |||
675 | static inline void i_size_write(struct inode *inode, loff_t i_size) | 675 | static inline void i_size_write(struct inode *inode, loff_t i_size) |
676 | { | 676 | { |
677 | #if BITS_PER_LONG==32 && defined(CONFIG_SMP) | 677 | #if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
678 | preempt_disable(); | ||
678 | write_seqcount_begin(&inode->i_size_seqcount); | 679 | write_seqcount_begin(&inode->i_size_seqcount); |
679 | inode->i_size = i_size; | 680 | inode->i_size = i_size; |
680 | write_seqcount_end(&inode->i_size_seqcount); | 681 | write_seqcount_end(&inode->i_size_seqcount); |
682 | preempt_enable(); | ||
681 | #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) | 683 | #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) |
682 | preempt_disable(); | 684 | preempt_disable(); |
683 | inode->i_size = i_size; | 685 | inode->i_size = i_size; |
@@ -2080,7 +2082,6 @@ extern int sync_filesystem(struct super_block *); | |||
2080 | extern const struct file_operations def_blk_fops; | 2082 | extern const struct file_operations def_blk_fops; |
2081 | extern const struct file_operations def_chr_fops; | 2083 | extern const struct file_operations def_chr_fops; |
2082 | extern const struct file_operations bad_sock_fops; | 2084 | extern const struct file_operations bad_sock_fops; |
2083 | extern const struct file_operations def_fifo_fops; | ||
2084 | #ifdef CONFIG_BLOCK | 2085 | #ifdef CONFIG_BLOCK |
2085 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 2086 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
2086 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); | 2087 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
@@ -2090,7 +2091,7 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode, | |||
2090 | void *holder); | 2091 | void *holder); |
2091 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, | 2092 | extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, |
2092 | void *holder); | 2093 | void *holder); |
2093 | extern int blkdev_put(struct block_device *bdev, fmode_t mode); | 2094 | extern void blkdev_put(struct block_device *bdev, fmode_t mode); |
2094 | #ifdef CONFIG_SYSFS | 2095 | #ifdef CONFIG_SYSFS |
2095 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); | 2096 | extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); |
2096 | extern void bd_unlink_disk_holder(struct block_device *bdev, | 2097 | extern void bd_unlink_disk_holder(struct block_device *bdev, |
@@ -2152,10 +2153,6 @@ extern void init_special_inode(struct inode *, umode_t, dev_t); | |||
2152 | extern void make_bad_inode(struct inode *); | 2153 | extern void make_bad_inode(struct inode *); |
2153 | extern int is_bad_inode(struct inode *); | 2154 | extern int is_bad_inode(struct inode *); |
2154 | 2155 | ||
2155 | extern const struct file_operations read_pipefifo_fops; | ||
2156 | extern const struct file_operations write_pipefifo_fops; | ||
2157 | extern const struct file_operations rdwr_pipefifo_fops; | ||
2158 | |||
2159 | #ifdef CONFIG_BLOCK | 2156 | #ifdef CONFIG_BLOCK |
2160 | /* | 2157 | /* |
2161 | * return READ, READA, or WRITE | 2158 | * return READ, READA, or WRITE |
@@ -2223,6 +2220,27 @@ static inline struct inode *file_inode(struct file *f) | |||
2223 | return f->f_inode; | 2220 | return f->f_inode; |
2224 | } | 2221 | } |
2225 | 2222 | ||
2223 | static inline void file_start_write(struct file *file) | ||
2224 | { | ||
2225 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
2226 | return; | ||
2227 | __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true); | ||
2228 | } | ||
2229 | |||
2230 | static inline bool file_start_write_trylock(struct file *file) | ||
2231 | { | ||
2232 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
2233 | return true; | ||
2234 | return __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, false); | ||
2235 | } | ||
2236 | |||
2237 | static inline void file_end_write(struct file *file) | ||
2238 | { | ||
2239 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
2240 | return; | ||
2241 | __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE); | ||
2242 | } | ||
2243 | |||
2226 | /* | 2244 | /* |
2227 | * get_write_access() gets write permission for a file. | 2245 | * get_write_access() gets write permission for a file. |
2228 | * put_write_access() releases this write permission. | 2246 | * put_write_access() releases this write permission. |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index d5b0910d4961..4b2ee8d12f5e 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -157,7 +157,6 @@ struct fsnotify_group { | |||
157 | struct inotify_group_private_data { | 157 | struct inotify_group_private_data { |
158 | spinlock_t idr_lock; | 158 | spinlock_t idr_lock; |
159 | struct idr idr; | 159 | struct idr idr; |
160 | u32 last_wd; | ||
161 | struct user_struct *user; | 160 | struct user_struct *user; |
162 | } inotify_data; | 161 | } inotify_data; |
163 | #endif | 162 | #endif |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 52da2a250795..99d0fbcbaf79 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -90,6 +90,8 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip, | |||
90 | * not set this, then the ftrace infrastructure will add recursion | 90 | * not set this, then the ftrace infrastructure will add recursion |
91 | * protection for the caller. | 91 | * protection for the caller. |
92 | * STUB - The ftrace_ops is just a place holder. | 92 | * STUB - The ftrace_ops is just a place holder. |
93 | * INITIALIZED - The ftrace_ops has already been initialized (first use time | ||
94 | * register_ftrace_function() is called, it will initialized the ops) | ||
93 | */ | 95 | */ |
94 | enum { | 96 | enum { |
95 | FTRACE_OPS_FL_ENABLED = 1 << 0, | 97 | FTRACE_OPS_FL_ENABLED = 1 << 0, |
@@ -100,6 +102,7 @@ enum { | |||
100 | FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5, | 102 | FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5, |
101 | FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, | 103 | FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, |
102 | FTRACE_OPS_FL_STUB = 1 << 7, | 104 | FTRACE_OPS_FL_STUB = 1 << 7, |
105 | FTRACE_OPS_FL_INITIALIZED = 1 << 8, | ||
103 | }; | 106 | }; |
104 | 107 | ||
105 | struct ftrace_ops { | 108 | struct ftrace_ops { |
@@ -110,6 +113,7 @@ struct ftrace_ops { | |||
110 | #ifdef CONFIG_DYNAMIC_FTRACE | 113 | #ifdef CONFIG_DYNAMIC_FTRACE |
111 | struct ftrace_hash *notrace_hash; | 114 | struct ftrace_hash *notrace_hash; |
112 | struct ftrace_hash *filter_hash; | 115 | struct ftrace_hash *filter_hash; |
116 | struct mutex regex_lock; | ||
113 | #endif | 117 | #endif |
114 | }; | 118 | }; |
115 | 119 | ||
@@ -261,8 +265,10 @@ struct ftrace_probe_ops { | |||
261 | void (*func)(unsigned long ip, | 265 | void (*func)(unsigned long ip, |
262 | unsigned long parent_ip, | 266 | unsigned long parent_ip, |
263 | void **data); | 267 | void **data); |
264 | int (*callback)(unsigned long ip, void **data); | 268 | int (*init)(struct ftrace_probe_ops *ops, |
265 | void (*free)(void **data); | 269 | unsigned long ip, void **data); |
270 | void (*free)(struct ftrace_probe_ops *ops, | ||
271 | unsigned long ip, void **data); | ||
266 | int (*print)(struct seq_file *m, | 272 | int (*print)(struct seq_file *m, |
267 | unsigned long ip, | 273 | unsigned long ip, |
268 | struct ftrace_probe_ops *ops, | 274 | struct ftrace_probe_ops *ops, |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 13a54d0bdfa8..4372658c73ae 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/perf_event.h> | 8 | #include <linux/perf_event.h> |
9 | 9 | ||
10 | struct trace_array; | 10 | struct trace_array; |
11 | struct trace_buffer; | ||
11 | struct tracer; | 12 | struct tracer; |
12 | struct dentry; | 13 | struct dentry; |
13 | 14 | ||
@@ -38,6 +39,12 @@ const char *ftrace_print_symbols_seq_u64(struct trace_seq *p, | |||
38 | const char *ftrace_print_hex_seq(struct trace_seq *p, | 39 | const char *ftrace_print_hex_seq(struct trace_seq *p, |
39 | const unsigned char *buf, int len); | 40 | const unsigned char *buf, int len); |
40 | 41 | ||
42 | struct trace_iterator; | ||
43 | struct trace_event; | ||
44 | |||
45 | int ftrace_raw_output_prep(struct trace_iterator *iter, | ||
46 | struct trace_event *event); | ||
47 | |||
41 | /* | 48 | /* |
42 | * The trace entry - the most basic unit of tracing. This is what | 49 | * The trace entry - the most basic unit of tracing. This is what |
43 | * is printed in the end as a single line in the trace output, such as: | 50 | * is printed in the end as a single line in the trace output, such as: |
@@ -61,6 +68,7 @@ struct trace_entry { | |||
61 | struct trace_iterator { | 68 | struct trace_iterator { |
62 | struct trace_array *tr; | 69 | struct trace_array *tr; |
63 | struct tracer *trace; | 70 | struct tracer *trace; |
71 | struct trace_buffer *trace_buffer; | ||
64 | void *private; | 72 | void *private; |
65 | int cpu_file; | 73 | int cpu_file; |
66 | struct mutex mutex; | 74 | struct mutex mutex; |
@@ -95,8 +103,6 @@ enum trace_iter_flags { | |||
95 | }; | 103 | }; |
96 | 104 | ||
97 | 105 | ||
98 | struct trace_event; | ||
99 | |||
100 | typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, | 106 | typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, |
101 | int flags, struct trace_event *event); | 107 | int flags, struct trace_event *event); |
102 | 108 | ||
@@ -128,6 +134,13 @@ enum print_line_t { | |||
128 | void tracing_generic_entry_update(struct trace_entry *entry, | 134 | void tracing_generic_entry_update(struct trace_entry *entry, |
129 | unsigned long flags, | 135 | unsigned long flags, |
130 | int pc); | 136 | int pc); |
137 | struct ftrace_event_file; | ||
138 | |||
139 | struct ring_buffer_event * | ||
140 | trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer, | ||
141 | struct ftrace_event_file *ftrace_file, | ||
142 | int type, unsigned long len, | ||
143 | unsigned long flags, int pc); | ||
131 | struct ring_buffer_event * | 144 | struct ring_buffer_event * |
132 | trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, | 145 | trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, |
133 | int type, unsigned long len, | 146 | int type, unsigned long len, |
@@ -182,53 +195,49 @@ extern int ftrace_event_reg(struct ftrace_event_call *event, | |||
182 | enum trace_reg type, void *data); | 195 | enum trace_reg type, void *data); |
183 | 196 | ||
184 | enum { | 197 | enum { |
185 | TRACE_EVENT_FL_ENABLED_BIT, | ||
186 | TRACE_EVENT_FL_FILTERED_BIT, | 198 | TRACE_EVENT_FL_FILTERED_BIT, |
187 | TRACE_EVENT_FL_RECORDED_CMD_BIT, | ||
188 | TRACE_EVENT_FL_CAP_ANY_BIT, | 199 | TRACE_EVENT_FL_CAP_ANY_BIT, |
189 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, | 200 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, |
190 | TRACE_EVENT_FL_IGNORE_ENABLE_BIT, | 201 | TRACE_EVENT_FL_IGNORE_ENABLE_BIT, |
202 | TRACE_EVENT_FL_WAS_ENABLED_BIT, | ||
191 | }; | 203 | }; |
192 | 204 | ||
205 | /* | ||
206 | * Event flags: | ||
207 | * FILTERED - The event has a filter attached | ||
208 | * CAP_ANY - Any user can enable for perf | ||
209 | * NO_SET_FILTER - Set when filter has error and is to be ignored | ||
210 | * IGNORE_ENABLE - For ftrace internal events, do not enable with debugfs file | ||
211 | * WAS_ENABLED - Set and stays set when an event was ever enabled | ||
212 | * (used for module unloading, if a module event is enabled, | ||
213 | * it is best to clear the buffers that used it). | ||
214 | */ | ||
193 | enum { | 215 | enum { |
194 | TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT), | ||
195 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), | 216 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), |
196 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), | ||
197 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), | 217 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), |
198 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), | 218 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), |
199 | TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), | 219 | TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), |
220 | TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), | ||
200 | }; | 221 | }; |
201 | 222 | ||
202 | struct ftrace_event_call { | 223 | struct ftrace_event_call { |
203 | struct list_head list; | 224 | struct list_head list; |
204 | struct ftrace_event_class *class; | 225 | struct ftrace_event_class *class; |
205 | char *name; | 226 | char *name; |
206 | struct dentry *dir; | ||
207 | struct trace_event event; | 227 | struct trace_event event; |
208 | const char *print_fmt; | 228 | const char *print_fmt; |
209 | struct event_filter *filter; | 229 | struct event_filter *filter; |
230 | struct list_head *files; | ||
210 | void *mod; | 231 | void *mod; |
211 | void *data; | 232 | void *data; |
212 | |||
213 | /* | 233 | /* |
214 | * 32 bit flags: | 234 | * bit 0: filter_active |
215 | * bit 1: enabled | 235 | * bit 1: allow trace by non root (cap any) |
216 | * bit 2: filter_active | 236 | * bit 2: failed to apply filter |
217 | * bit 3: enabled cmd record | 237 | * bit 3: ftrace internal event (do not enable) |
218 | * bit 4: allow trace by non root (cap any) | 238 | * bit 4: Event was enabled by module |
219 | * bit 5: failed to apply filter | ||
220 | * bit 6: ftrace internal event (do not enable) | ||
221 | * | ||
222 | * Changes to flags must hold the event_mutex. | ||
223 | * | ||
224 | * Note: Reads of flags do not hold the event_mutex since | ||
225 | * they occur in critical sections. But the way flags | ||
226 | * is currently used, these changes do no affect the code | ||
227 | * except that when a change is made, it may have a slight | ||
228 | * delay in propagating the changes to other CPUs due to | ||
229 | * caching and such. | ||
230 | */ | 239 | */ |
231 | unsigned int flags; | 240 | int flags; /* static flags of different events */ |
232 | 241 | ||
233 | #ifdef CONFIG_PERF_EVENTS | 242 | #ifdef CONFIG_PERF_EVENTS |
234 | int perf_refcount; | 243 | int perf_refcount; |
@@ -236,6 +245,57 @@ struct ftrace_event_call { | |||
236 | #endif | 245 | #endif |
237 | }; | 246 | }; |
238 | 247 | ||
248 | struct trace_array; | ||
249 | struct ftrace_subsystem_dir; | ||
250 | |||
251 | enum { | ||
252 | FTRACE_EVENT_FL_ENABLED_BIT, | ||
253 | FTRACE_EVENT_FL_RECORDED_CMD_BIT, | ||
254 | FTRACE_EVENT_FL_SOFT_MODE_BIT, | ||
255 | FTRACE_EVENT_FL_SOFT_DISABLED_BIT, | ||
256 | }; | ||
257 | |||
258 | /* | ||
259 | * Ftrace event file flags: | ||
260 | * ENABLED - The event is enabled | ||
261 | * RECORDED_CMD - The comms should be recorded at sched_switch | ||
262 | * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED | ||
263 | * SOFT_DISABLED - When set, do not trace the event (even though its | ||
264 | * tracepoint may be enabled) | ||
265 | */ | ||
266 | enum { | ||
267 | FTRACE_EVENT_FL_ENABLED = (1 << FTRACE_EVENT_FL_ENABLED_BIT), | ||
268 | FTRACE_EVENT_FL_RECORDED_CMD = (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT), | ||
269 | FTRACE_EVENT_FL_SOFT_MODE = (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT), | ||
270 | FTRACE_EVENT_FL_SOFT_DISABLED = (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT), | ||
271 | }; | ||
272 | |||
273 | struct ftrace_event_file { | ||
274 | struct list_head list; | ||
275 | struct ftrace_event_call *event_call; | ||
276 | struct dentry *dir; | ||
277 | struct trace_array *tr; | ||
278 | struct ftrace_subsystem_dir *system; | ||
279 | |||
280 | /* | ||
281 | * 32 bit flags: | ||
282 | * bit 0: enabled | ||
283 | * bit 1: enabled cmd record | ||
284 | * bit 2: enable/disable with the soft disable bit | ||
285 | * bit 3: soft disabled | ||
286 | * | ||
287 | * Note: The bits must be set atomically to prevent races | ||
288 | * from other writers. Reads of flags do not need to be in | ||
289 | * sync as they occur in critical sections. But the way flags | ||
290 | * is currently used, these changes do not affect the code | ||
291 | * except that when a change is made, it may have a slight | ||
292 | * delay in propagating the changes to other CPUs due to | ||
293 | * caching and such. Which is mostly OK ;-) | ||
294 | */ | ||
295 | unsigned long flags; | ||
296 | atomic_t sm_ref; /* soft-mode reference counter */ | ||
297 | }; | ||
298 | |||
239 | #define __TRACE_EVENT_FLAGS(name, value) \ | 299 | #define __TRACE_EVENT_FLAGS(name, value) \ |
240 | static int __init trace_init_flags_##name(void) \ | 300 | static int __init trace_init_flags_##name(void) \ |
241 | { \ | 301 | { \ |
@@ -274,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type, | |||
274 | extern int trace_add_event_call(struct ftrace_event_call *call); | 334 | extern int trace_add_event_call(struct ftrace_event_call *call); |
275 | extern void trace_remove_event_call(struct ftrace_event_call *call); | 335 | extern void trace_remove_event_call(struct ftrace_event_call *call); |
276 | 336 | ||
277 | #define is_signed_type(type) (((type)(-1)) < (type)0) | 337 | #define is_signed_type(type) (((type)(-1)) < (type)1) |
278 | 338 | ||
279 | int trace_set_clr_event(const char *system, const char *event, int set); | 339 | int trace_set_clr_event(const char *system, const char *event, int set); |
280 | 340 | ||
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h index dd7c569aacad..661d374aeb2d 100644 --- a/include/linux/genalloc.h +++ b/include/linux/genalloc.h | |||
@@ -29,6 +29,10 @@ | |||
29 | 29 | ||
30 | #ifndef __GENALLOC_H__ | 30 | #ifndef __GENALLOC_H__ |
31 | #define __GENALLOC_H__ | 31 | #define __GENALLOC_H__ |
32 | |||
33 | struct device; | ||
34 | struct device_node; | ||
35 | |||
32 | /** | 36 | /** |
33 | * Allocation callback function type definition | 37 | * Allocation callback function type definition |
34 | * @map: Pointer to bitmap | 38 | * @map: Pointer to bitmap |
@@ -105,4 +109,18 @@ extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size, | |||
105 | extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, | 109 | extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, |
106 | unsigned long start, unsigned int nr, void *data); | 110 | unsigned long start, unsigned int nr, void *data); |
107 | 111 | ||
112 | extern struct gen_pool *devm_gen_pool_create(struct device *dev, | ||
113 | int min_alloc_order, int nid); | ||
114 | extern struct gen_pool *dev_get_gen_pool(struct device *dev); | ||
115 | |||
116 | #ifdef CONFIG_OF | ||
117 | extern struct gen_pool *of_get_named_gen_pool(struct device_node *np, | ||
118 | const char *propname, int index); | ||
119 | #else | ||
120 | static inline struct gen_pool *of_get_named_gen_pool(struct device_node *np, | ||
121 | const char *propname, int index) | ||
122 | { | ||
123 | return NULL; | ||
124 | } | ||
125 | #endif | ||
108 | #endif /* __GENALLOC_H__ */ | 126 | #endif /* __GENALLOC_H__ */ |
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h index d755b28ba635..d90ebbe02ca4 100644 --- a/include/linux/gpio-pxa.h +++ b/include/linux/gpio-pxa.h | |||
@@ -14,6 +14,7 @@ extern int pxa_last_gpio; | |||
14 | extern int pxa_irq_to_gpio(int irq); | 14 | extern int pxa_irq_to_gpio(int irq); |
15 | 15 | ||
16 | struct pxa_gpio_platform_data { | 16 | struct pxa_gpio_platform_data { |
17 | int irq_base; | ||
17 | int (*gpio_set_wake)(unsigned int gpio, unsigned int on); | 18 | int (*gpio_set_wake)(unsigned int gpio, unsigned int on); |
18 | }; | 19 | }; |
19 | 20 | ||
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index f6c7ae3e223b..552e3f46e4a3 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -39,7 +39,7 @@ struct gpio { | |||
39 | const char *label; | 39 | const char *label; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | #ifdef CONFIG_GENERIC_GPIO | 42 | #ifdef CONFIG_GPIOLIB |
43 | 43 | ||
44 | #ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H | 44 | #ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H |
45 | #include <asm/gpio.h> | 45 | #include <asm/gpio.h> |
@@ -74,7 +74,7 @@ static inline int irq_to_gpio(unsigned int irq) | |||
74 | 74 | ||
75 | #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ | 75 | #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ |
76 | 76 | ||
77 | #else /* ! CONFIG_GENERIC_GPIO */ | 77 | #else /* ! CONFIG_GPIOLIB */ |
78 | 78 | ||
79 | #include <linux/kernel.h> | 79 | #include <linux/kernel.h> |
80 | #include <linux/types.h> | 80 | #include <linux/types.h> |
@@ -226,7 +226,7 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip) | |||
226 | WARN_ON(1); | 226 | WARN_ON(1); |
227 | } | 227 | } |
228 | 228 | ||
229 | #endif /* ! CONFIG_GENERIC_GPIO */ | 229 | #endif /* ! CONFIG_GPIOLIB */ |
230 | 230 | ||
231 | struct device; | 231 | struct device; |
232 | 232 | ||
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h index 53744fa1c8b7..8663f216c563 100644 --- a/include/linux/hid-debug.h +++ b/include/linux/hid-debug.h | |||
@@ -22,11 +22,12 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define HID_DEBUG_BUFSIZE 512 | ||
26 | |||
27 | #ifdef CONFIG_DEBUG_FS | 25 | #ifdef CONFIG_DEBUG_FS |
28 | 26 | ||
27 | #define HID_DEBUG_BUFSIZE 512 | ||
28 | |||
29 | void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); | 29 | void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); |
30 | void hid_dump_report(struct hid_device *, int , u8 *, int); | ||
30 | void hid_dump_device(struct hid_device *, struct seq_file *); | 31 | void hid_dump_device(struct hid_device *, struct seq_file *); |
31 | void hid_dump_field(struct hid_field *, int, struct seq_file *); | 32 | void hid_dump_field(struct hid_field *, int, struct seq_file *); |
32 | char *hid_resolv_usage(unsigned, struct seq_file *); | 33 | char *hid_resolv_usage(unsigned, struct seq_file *); |
@@ -50,6 +51,7 @@ struct hid_debug_list { | |||
50 | #else | 51 | #else |
51 | 52 | ||
52 | #define hid_dump_input(a,b,c) do { } while (0) | 53 | #define hid_dump_input(a,b,c) do { } while (0) |
54 | #define hid_dump_report(a,b,c,d) do { } while (0) | ||
53 | #define hid_dump_device(a,b) do { } while (0) | 55 | #define hid_dump_device(a,b) do { } while (0) |
54 | #define hid_dump_field(a,b,c) do { } while (0) | 56 | #define hid_dump_field(a,b,c) do { } while (0) |
55 | #define hid_resolv_usage(a,b) do { } while (0) | 57 | #define hid_resolv_usage(a,b) do { } while (0) |
diff --git a/include/linux/hid.h b/include/linux/hid.h index e14b465b1146..0c48991b0402 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -282,6 +282,7 @@ struct hid_item { | |||
282 | #define HID_QUIRK_BADPAD 0x00000020 | 282 | #define HID_QUIRK_BADPAD 0x00000020 |
283 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 283 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
284 | #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 | 284 | #define HID_QUIRK_HIDINPUT_FORCE 0x00000080 |
285 | #define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 | ||
285 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 286 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
286 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 287 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
287 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | 288 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 |
@@ -456,7 +457,8 @@ struct hid_device { /* device report descriptor */ | |||
456 | unsigned country; /* HID country */ | 457 | unsigned country; /* HID country */ |
457 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; | 458 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; |
458 | 459 | ||
459 | struct semaphore driver_lock; /* protects the current driver */ | 460 | struct semaphore driver_lock; /* protects the current driver, except during input */ |
461 | struct semaphore driver_input_lock; /* protects the current driver */ | ||
460 | struct device dev; /* device */ | 462 | struct device dev; /* device */ |
461 | struct hid_driver *driver; | 463 | struct hid_driver *driver; |
462 | struct hid_ll_driver *ll_driver; | 464 | struct hid_ll_driver *ll_driver; |
@@ -477,6 +479,7 @@ struct hid_device { /* device report descriptor */ | |||
477 | unsigned int status; /* see STAT flags above */ | 479 | unsigned int status; /* see STAT flags above */ |
478 | unsigned claimed; /* Claimed by hidinput, hiddev? */ | 480 | unsigned claimed; /* Claimed by hidinput, hiddev? */ |
479 | unsigned quirks; /* Various quirks the device can pull on us */ | 481 | unsigned quirks; /* Various quirks the device can pull on us */ |
482 | bool io_started; /* Protected by driver_lock. If IO has started */ | ||
480 | 483 | ||
481 | struct list_head inputs; /* The list of inputs */ | 484 | struct list_head inputs; /* The list of inputs */ |
482 | void *hiddev; /* The hiddev structure */ | 485 | void *hiddev; /* The hiddev structure */ |
@@ -512,6 +515,7 @@ struct hid_device { /* device report descriptor */ | |||
512 | struct dentry *debug_rdesc; | 515 | struct dentry *debug_rdesc; |
513 | struct dentry *debug_events; | 516 | struct dentry *debug_events; |
514 | struct list_head debug_list; | 517 | struct list_head debug_list; |
518 | spinlock_t debug_list_lock; | ||
515 | wait_queue_head_t debug_wait; | 519 | wait_queue_head_t debug_wait; |
516 | }; | 520 | }; |
517 | 521 | ||
@@ -599,6 +603,10 @@ struct hid_usage_id { | |||
599 | * @resume: invoked on resume if device was not reset (NULL means nop) | 603 | * @resume: invoked on resume if device was not reset (NULL means nop) |
600 | * @reset_resume: invoked on resume if device was reset (NULL means nop) | 604 | * @reset_resume: invoked on resume if device was reset (NULL means nop) |
601 | * | 605 | * |
606 | * probe should return -errno on error, or 0 on success. During probe, | ||
607 | * input will not be passed to raw_event unless hid_device_io_start is | ||
608 | * called. | ||
609 | * | ||
602 | * raw_event and event should return 0 on no action performed, 1 when no | 610 | * raw_event and event should return 0 on no action performed, 1 when no |
603 | * further processing should be done and negative on error | 611 | * further processing should be done and negative on error |
604 | * | 612 | * |
@@ -662,6 +670,9 @@ struct hid_driver { | |||
662 | * @hidinput_input_event: event input event (e.g. ff or leds) | 670 | * @hidinput_input_event: event input event (e.g. ff or leds) |
663 | * @parse: this method is called only once to parse the device data, | 671 | * @parse: this method is called only once to parse the device data, |
664 | * shouldn't allocate anything to not leak memory | 672 | * shouldn't allocate anything to not leak memory |
673 | * @request: send report request to device (e.g. feature report) | ||
674 | * @wait: wait for buffered io to complete (send/recv reports) | ||
675 | * @idle: send idle request to device | ||
665 | */ | 676 | */ |
666 | struct hid_ll_driver { | 677 | struct hid_ll_driver { |
667 | int (*start)(struct hid_device *hdev); | 678 | int (*start)(struct hid_device *hdev); |
@@ -676,6 +687,13 @@ struct hid_ll_driver { | |||
676 | unsigned int code, int value); | 687 | unsigned int code, int value); |
677 | 688 | ||
678 | int (*parse)(struct hid_device *hdev); | 689 | int (*parse)(struct hid_device *hdev); |
690 | |||
691 | void (*request)(struct hid_device *hdev, | ||
692 | struct hid_report *report, int reqtype); | ||
693 | |||
694 | int (*wait)(struct hid_device *hdev); | ||
695 | int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype); | ||
696 | |||
679 | }; | 697 | }; |
680 | 698 | ||
681 | #define PM_HINT_FULLON 1<<5 | 699 | #define PM_HINT_FULLON 1<<5 |
@@ -738,6 +756,44 @@ const struct hid_device_id *hid_match_id(struct hid_device *hdev, | |||
738 | s32 hid_snto32(__u32 value, unsigned n); | 756 | s32 hid_snto32(__u32 value, unsigned n); |
739 | 757 | ||
740 | /** | 758 | /** |
759 | * hid_device_io_start - enable HID input during probe, remove | ||
760 | * | ||
761 | * @hid - the device | ||
762 | * | ||
763 | * This should only be called during probe or remove and only be | ||
764 | * called by the thread calling probe or remove. It will allow | ||
765 | * incoming packets to be delivered to the driver. | ||
766 | */ | ||
767 | static inline void hid_device_io_start(struct hid_device *hid) { | ||
768 | if (hid->io_started) { | ||
769 | dev_warn(&hid->dev, "io already started"); | ||
770 | return; | ||
771 | } | ||
772 | hid->io_started = true; | ||
773 | up(&hid->driver_input_lock); | ||
774 | } | ||
775 | |||
776 | /** | ||
777 | * hid_device_io_stop - disable HID input during probe, remove | ||
778 | * | ||
779 | * @hid - the device | ||
780 | * | ||
781 | * Should only be called after hid_device_io_start. It will prevent | ||
782 | * incoming packets from going to the driver for the duration of | ||
783 | * probe, remove. If called during probe, packets will still go to the | ||
784 | * driver after probe is complete. This function should only be called | ||
785 | * by the thread calling probe or remove. | ||
786 | */ | ||
787 | static inline void hid_device_io_stop(struct hid_device *hid) { | ||
788 | if (!hid->io_started) { | ||
789 | dev_warn(&hid->dev, "io already stopped"); | ||
790 | return; | ||
791 | } | ||
792 | hid->io_started = false; | ||
793 | down(&hid->driver_input_lock); | ||
794 | } | ||
795 | |||
796 | /** | ||
741 | * hid_map_usage - map usage input bits | 797 | * hid_map_usage - map usage input bits |
742 | * | 798 | * |
743 | * @hidinput: hidinput which we are interested in | 799 | * @hidinput: hidinput which we are interested in |
@@ -883,6 +939,49 @@ static inline int hid_hw_power(struct hid_device *hdev, int level) | |||
883 | return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; | 939 | return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; |
884 | } | 940 | } |
885 | 941 | ||
942 | |||
943 | /** | ||
944 | * hid_hw_request - send report request to device | ||
945 | * | ||
946 | * @hdev: hid device | ||
947 | * @report: report to send | ||
948 | * @reqtype: hid request type | ||
949 | */ | ||
950 | static inline void hid_hw_request(struct hid_device *hdev, | ||
951 | struct hid_report *report, int reqtype) | ||
952 | { | ||
953 | if (hdev->ll_driver->request) | ||
954 | hdev->ll_driver->request(hdev, report, reqtype); | ||
955 | } | ||
956 | |||
957 | /** | ||
958 | * hid_hw_idle - send idle request to device | ||
959 | * | ||
960 | * @hdev: hid device | ||
961 | * @report: report to control | ||
962 | * @idle: idle state | ||
963 | * @reqtype: hid request type | ||
964 | */ | ||
965 | static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle, | ||
966 | int reqtype) | ||
967 | { | ||
968 | if (hdev->ll_driver->idle) | ||
969 | return hdev->ll_driver->idle(hdev, report, idle, reqtype); | ||
970 | |||
971 | return 0; | ||
972 | } | ||
973 | |||
974 | /** | ||
975 | * hid_hw_wait - wait for buffered io to complete | ||
976 | * | ||
977 | * @hdev: hid device | ||
978 | */ | ||
979 | static inline void hid_hw_wait(struct hid_device *hdev) | ||
980 | { | ||
981 | if (hdev->ll_driver->wait) | ||
982 | hdev->ll_driver->wait(hdev); | ||
983 | } | ||
984 | |||
886 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | 985 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
887 | int interrupt); | 986 | int interrupt); |
888 | 987 | ||
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index cc07d2777bbe..d19a5c2d2270 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -157,6 +157,7 @@ enum hrtimer_base_type { | |||
157 | HRTIMER_BASE_MONOTONIC, | 157 | HRTIMER_BASE_MONOTONIC, |
158 | HRTIMER_BASE_REALTIME, | 158 | HRTIMER_BASE_REALTIME, |
159 | HRTIMER_BASE_BOOTTIME, | 159 | HRTIMER_BASE_BOOTTIME, |
160 | HRTIMER_BASE_TAI, | ||
160 | HRTIMER_MAX_CLOCK_BASES, | 161 | HRTIMER_MAX_CLOCK_BASES, |
161 | }; | 162 | }; |
162 | 163 | ||
@@ -327,7 +328,9 @@ extern ktime_t ktime_get(void); | |||
327 | extern ktime_t ktime_get_real(void); | 328 | extern ktime_t ktime_get_real(void); |
328 | extern ktime_t ktime_get_boottime(void); | 329 | extern ktime_t ktime_get_boottime(void); |
329 | extern ktime_t ktime_get_monotonic_offset(void); | 330 | extern ktime_t ktime_get_monotonic_offset(void); |
330 | extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot); | 331 | extern ktime_t ktime_get_clocktai(void); |
332 | extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot, | ||
333 | ktime_t *offs_tai); | ||
331 | 334 | ||
332 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); | 335 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); |
333 | 336 | ||
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index ee1c244a62a1..528454c2caa9 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h | |||
@@ -99,7 +99,11 @@ extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
99 | extern int handle_pte_fault(struct mm_struct *mm, | 99 | extern int handle_pte_fault(struct mm_struct *mm, |
100 | struct vm_area_struct *vma, unsigned long address, | 100 | struct vm_area_struct *vma, unsigned long address, |
101 | pte_t *pte, pmd_t *pmd, unsigned int flags); | 101 | pte_t *pte, pmd_t *pmd, unsigned int flags); |
102 | extern int split_huge_page(struct page *page); | 102 | extern int split_huge_page_to_list(struct page *page, struct list_head *list); |
103 | static inline int split_huge_page(struct page *page) | ||
104 | { | ||
105 | return split_huge_page_to_list(page, NULL); | ||
106 | } | ||
103 | extern void __split_huge_page_pmd(struct vm_area_struct *vma, | 107 | extern void __split_huge_page_pmd(struct vm_area_struct *vma, |
104 | unsigned long address, pmd_t *pmd); | 108 | unsigned long address, pmd_t *pmd); |
105 | #define split_huge_page_pmd(__vma, __address, __pmd) \ | 109 | #define split_huge_page_pmd(__vma, __address, __pmd) \ |
@@ -186,6 +190,11 @@ extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vm | |||
186 | #define transparent_hugepage_enabled(__vma) 0 | 190 | #define transparent_hugepage_enabled(__vma) 0 |
187 | 191 | ||
188 | #define transparent_hugepage_flags 0UL | 192 | #define transparent_hugepage_flags 0UL |
193 | static inline int | ||
194 | split_huge_page_to_list(struct page *page, struct list_head *list) | ||
195 | { | ||
196 | return 0; | ||
197 | } | ||
189 | static inline int split_huge_page(struct page *page) | 198 | static inline int split_huge_page(struct page *page) |
190 | { | 199 | { |
191 | return 0; | 200 | return 0; |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 16e4e9a643fb..6b4890fa57e7 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, | |||
58 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 58 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
59 | void hugetlb_report_meminfo(struct seq_file *); | 59 | void hugetlb_report_meminfo(struct seq_file *); |
60 | int hugetlb_report_node_meminfo(int, char *); | 60 | int hugetlb_report_node_meminfo(int, char *); |
61 | void hugetlb_show_meminfo(void); | ||
61 | unsigned long hugetlb_total_pages(void); | 62 | unsigned long hugetlb_total_pages(void); |
62 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 63 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
63 | unsigned long address, unsigned int flags); | 64 | unsigned long address, unsigned int flags); |
@@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m) | |||
114 | { | 115 | { |
115 | } | 116 | } |
116 | #define hugetlb_report_node_meminfo(n, buf) 0 | 117 | #define hugetlb_report_node_meminfo(n, buf) 0 |
118 | static inline void hugetlb_show_meminfo(void) | ||
119 | { | ||
120 | } | ||
117 | #define follow_huge_pmd(mm, addr, pmd, write) NULL | 121 | #define follow_huge_pmd(mm, addr, pmd, write) NULL |
118 | #define follow_huge_pud(mm, addr, pud, write) NULL | 122 | #define follow_huge_pud(mm, addr, pud, write) NULL |
119 | #define prepare_hugepage_range(file, addr, len) (-EINVAL) | 123 | #define prepare_hugepage_range(file, addr, len) (-EINVAL) |
@@ -185,8 +189,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | |||
185 | 189 | ||
186 | extern const struct file_operations hugetlbfs_file_operations; | 190 | extern const struct file_operations hugetlbfs_file_operations; |
187 | extern const struct vm_operations_struct hugetlb_vm_ops; | 191 | extern const struct vm_operations_struct hugetlb_vm_ops; |
188 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, | 192 | struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, |
189 | size_t size, vm_flags_t acct, | ||
190 | struct user_struct **user, int creat_flags, | 193 | struct user_struct **user, int creat_flags, |
191 | int page_size_log); | 194 | int page_size_log); |
192 | 195 | ||
@@ -205,8 +208,8 @@ static inline int is_file_hugepages(struct file *file) | |||
205 | 208 | ||
206 | #define is_file_hugepages(file) 0 | 209 | #define is_file_hugepages(file) 0 |
207 | static inline struct file * | 210 | static inline struct file * |
208 | hugetlb_file_setup(const char *name, unsigned long addr, size_t size, | 211 | hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, |
209 | vm_flags_t acctflag, struct user_struct **user, int creat_flags, | 212 | struct user_struct **user, int creat_flags, |
210 | int page_size_log) | 213 | int page_size_log) |
211 | { | 214 | { |
212 | return ERR_PTR(-ENOSYS); | 215 | return ERR_PTR(-ENOSYS); |
@@ -284,6 +287,13 @@ static inline struct hstate *hstate_file(struct file *f) | |||
284 | return hstate_inode(file_inode(f)); | 287 | return hstate_inode(file_inode(f)); |
285 | } | 288 | } |
286 | 289 | ||
290 | static inline struct hstate *hstate_sizelog(int page_size_log) | ||
291 | { | ||
292 | if (!page_size_log) | ||
293 | return &default_hstate; | ||
294 | return size_to_hstate(1 << page_size_log); | ||
295 | } | ||
296 | |||
287 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) | 297 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) |
288 | { | 298 | { |
289 | return hstate_file(vma->vm_file); | 299 | return hstate_file(vma->vm_file); |
@@ -348,11 +358,12 @@ static inline int hstate_index(struct hstate *h) | |||
348 | return h - hstates; | 358 | return h - hstates; |
349 | } | 359 | } |
350 | 360 | ||
351 | #else | 361 | #else /* CONFIG_HUGETLB_PAGE */ |
352 | struct hstate {}; | 362 | struct hstate {}; |
353 | #define alloc_huge_page_node(h, nid) NULL | 363 | #define alloc_huge_page_node(h, nid) NULL |
354 | #define alloc_bootmem_huge_page(h) NULL | 364 | #define alloc_bootmem_huge_page(h) NULL |
355 | #define hstate_file(f) NULL | 365 | #define hstate_file(f) NULL |
366 | #define hstate_sizelog(s) NULL | ||
356 | #define hstate_vma(v) NULL | 367 | #define hstate_vma(v) NULL |
357 | #define hstate_inode(i) NULL | 368 | #define hstate_inode(i) NULL |
358 | #define huge_page_size(h) PAGE_SIZE | 369 | #define huge_page_size(h) PAGE_SIZE |
@@ -367,6 +378,6 @@ static inline unsigned int pages_per_huge_page(struct hstate *h) | |||
367 | } | 378 | } |
368 | #define hstate_index_to_shift(index) 0 | 379 | #define hstate_index_to_shift(index) 0 |
369 | #define hstate_index(h) 0 | 380 | #define hstate_index(h) 0 |
370 | #endif | 381 | #endif /* CONFIG_HUGETLB_PAGE */ |
371 | 382 | ||
372 | #endif /* _LINUX_HUGETLB_H */ | 383 | #endif /* _LINUX_HUGETLB_H */ |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index df77ba9a8166..c2559847d7ee 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -27,6 +27,63 @@ | |||
27 | 27 | ||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | 29 | ||
30 | |||
31 | /* | ||
32 | * Implementation of host controlled snapshot of the guest. | ||
33 | */ | ||
34 | |||
35 | #define VSS_OP_REGISTER 128 | ||
36 | |||
37 | enum hv_vss_op { | ||
38 | VSS_OP_CREATE = 0, | ||
39 | VSS_OP_DELETE, | ||
40 | VSS_OP_HOT_BACKUP, | ||
41 | VSS_OP_GET_DM_INFO, | ||
42 | VSS_OP_BU_COMPLETE, | ||
43 | /* | ||
44 | * Following operations are only supported with IC version >= 5.0 | ||
45 | */ | ||
46 | VSS_OP_FREEZE, /* Freeze the file systems in the VM */ | ||
47 | VSS_OP_THAW, /* Unfreeze the file systems */ | ||
48 | VSS_OP_AUTO_RECOVER, | ||
49 | VSS_OP_COUNT /* Number of operations, must be last */ | ||
50 | }; | ||
51 | |||
52 | |||
53 | /* | ||
54 | * Header for all VSS messages. | ||
55 | */ | ||
56 | struct hv_vss_hdr { | ||
57 | __u8 operation; | ||
58 | __u8 reserved[7]; | ||
59 | } __attribute__((packed)); | ||
60 | |||
61 | |||
62 | /* | ||
63 | * Flag values for the hv_vss_check_feature. Linux supports only | ||
64 | * one value. | ||
65 | */ | ||
66 | #define VSS_HBU_NO_AUTO_RECOVERY 0x00000005 | ||
67 | |||
68 | struct hv_vss_check_feature { | ||
69 | __u32 flags; | ||
70 | } __attribute__((packed)); | ||
71 | |||
72 | struct hv_vss_check_dm_info { | ||
73 | __u32 flags; | ||
74 | } __attribute__((packed)); | ||
75 | |||
76 | struct hv_vss_msg { | ||
77 | union { | ||
78 | struct hv_vss_hdr vss_hdr; | ||
79 | int error; | ||
80 | }; | ||
81 | union { | ||
82 | struct hv_vss_check_feature vss_cf; | ||
83 | struct hv_vss_check_dm_info dm_info; | ||
84 | }; | ||
85 | } __attribute__((packed)); | ||
86 | |||
30 | /* | 87 | /* |
31 | * An implementation of HyperV key value pair (KVP) functionality for Linux. | 88 | * An implementation of HyperV key value pair (KVP) functionality for Linux. |
32 | * | 89 | * |
@@ -1253,6 +1310,25 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver); | |||
1253 | } | 1310 | } |
1254 | 1311 | ||
1255 | /* | 1312 | /* |
1313 | * VSS (Backup/Restore) GUID | ||
1314 | */ | ||
1315 | #define HV_VSS_GUID \ | ||
1316 | .guid = { \ | ||
1317 | 0x29, 0x2e, 0xfa, 0x35, 0x23, 0xea, 0x36, 0x42, \ | ||
1318 | 0x96, 0xae, 0x3a, 0x6e, 0xba, 0xcb, 0xa4, 0x40 \ | ||
1319 | } | ||
1320 | /* | ||
1321 | * Synthetic Video GUID | ||
1322 | * {DA0A7802-E377-4aac-8E77-0558EB1073F8} | ||
1323 | */ | ||
1324 | #define HV_SYNTHVID_GUID \ | ||
1325 | .guid = { \ | ||
1326 | 0x02, 0x78, 0x0a, 0xda, 0x77, 0xe3, 0xac, 0x4a, \ | ||
1327 | 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \ | ||
1328 | } | ||
1329 | |||
1330 | |||
1331 | /* | ||
1256 | * Common header for Hyper-V ICs | 1332 | * Common header for Hyper-V ICs |
1257 | */ | 1333 | */ |
1258 | 1334 | ||
@@ -1356,6 +1432,10 @@ int hv_kvp_init(struct hv_util_service *); | |||
1356 | void hv_kvp_deinit(void); | 1432 | void hv_kvp_deinit(void); |
1357 | void hv_kvp_onchannelcallback(void *); | 1433 | void hv_kvp_onchannelcallback(void *); |
1358 | 1434 | ||
1435 | int hv_vss_init(struct hv_util_service *); | ||
1436 | void hv_vss_deinit(void); | ||
1437 | void hv_vss_onchannelcallback(void *); | ||
1438 | |||
1359 | /* | 1439 | /* |
1360 | * Negotiated version with the Host. | 1440 | * Negotiated version with the Host. |
1361 | */ | 1441 | */ |
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h index 40cb05a97b46..b5f9a007a3ab 100644 --- a/include/linux/i2c-mux.h +++ b/include/linux/i2c-mux.h | |||
@@ -42,7 +42,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, | |||
42 | int (*deselect) (struct i2c_adapter *, | 42 | int (*deselect) (struct i2c_adapter *, |
43 | void *mux_dev, u32 chan_id)); | 43 | void *mux_dev, u32 chan_id)); |
44 | 44 | ||
45 | int i2c_del_mux_adapter(struct i2c_adapter *adap); | 45 | void i2c_del_mux_adapter(struct i2c_adapter *adap); |
46 | 46 | ||
47 | #endif /* __KERNEL__ */ | 47 | #endif /* __KERNEL__ */ |
48 | 48 | ||
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h deleted file mode 100644 index 9c85da49857a..000000000000 --- a/include/linux/i2c-tegra.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/i2c/busses/i2c-tegra.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * Author: Colin Cross <ccross@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef _LINUX_I2C_TEGRA_H | ||
19 | #define _LINUX_I2C_TEGRA_H | ||
20 | |||
21 | struct tegra_i2c_platform_data { | ||
22 | unsigned long bus_clk_rate; | ||
23 | }; | ||
24 | |||
25 | #endif /* _LINUX_I2C_TEGRA_H */ | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index d0c4db7b4872..e988fa935b3c 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -125,7 +125,6 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, | |||
125 | * struct i2c_driver - represent an I2C device driver | 125 | * struct i2c_driver - represent an I2C device driver |
126 | * @class: What kind of i2c device we instantiate (for detect) | 126 | * @class: What kind of i2c device we instantiate (for detect) |
127 | * @attach_adapter: Callback for bus addition (deprecated) | 127 | * @attach_adapter: Callback for bus addition (deprecated) |
128 | * @detach_adapter: Callback for bus removal (deprecated) | ||
129 | * @probe: Callback for device binding | 128 | * @probe: Callback for device binding |
130 | * @remove: Callback for device unbinding | 129 | * @remove: Callback for device unbinding |
131 | * @shutdown: Callback for device shutdown | 130 | * @shutdown: Callback for device shutdown |
@@ -162,12 +161,10 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, | |||
162 | struct i2c_driver { | 161 | struct i2c_driver { |
163 | unsigned int class; | 162 | unsigned int class; |
164 | 163 | ||
165 | /* Notifies the driver that a new bus has appeared or is about to be | 164 | /* Notifies the driver that a new bus has appeared. You should avoid |
166 | * removed. You should avoid using this, it will be removed in a | 165 | * using this, it will be removed in a near future. |
167 | * near future. | ||
168 | */ | 166 | */ |
169 | int (*attach_adapter)(struct i2c_adapter *) __deprecated; | 167 | int (*attach_adapter)(struct i2c_adapter *) __deprecated; |
170 | int (*detach_adapter)(struct i2c_adapter *) __deprecated; | ||
171 | 168 | ||
172 | /* Standard driver model interfaces */ | 169 | /* Standard driver model interfaces */ |
173 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); | 170 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); |
@@ -370,6 +367,45 @@ struct i2c_algorithm { | |||
370 | u32 (*functionality) (struct i2c_adapter *); | 367 | u32 (*functionality) (struct i2c_adapter *); |
371 | }; | 368 | }; |
372 | 369 | ||
370 | /** | ||
371 | * struct i2c_bus_recovery_info - I2C bus recovery information | ||
372 | * @recover_bus: Recover routine. Either pass driver's recover_bus() routine, or | ||
373 | * i2c_generic_scl_recovery() or i2c_generic_gpio_recovery(). | ||
374 | * @get_scl: This gets current value of SCL line. Mandatory for generic SCL | ||
375 | * recovery. Used internally for generic GPIO recovery. | ||
376 | * @set_scl: This sets/clears SCL line. Mandatory for generic SCL recovery. Used | ||
377 | * internally for generic GPIO recovery. | ||
378 | * @get_sda: This gets current value of SDA line. Optional for generic SCL | ||
379 | * recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO | ||
380 | * recovery. | ||
381 | * @prepare_recovery: This will be called before starting recovery. Platform may | ||
382 | * configure padmux here for SDA/SCL line or something else they want. | ||
383 | * @unprepare_recovery: This will be called after completing recovery. Platform | ||
384 | * may configure padmux here for SDA/SCL line or something else they want. | ||
385 | * @scl_gpio: gpio number of the SCL line. Only required for GPIO recovery. | ||
386 | * @sda_gpio: gpio number of the SDA line. Only required for GPIO recovery. | ||
387 | */ | ||
388 | struct i2c_bus_recovery_info { | ||
389 | int (*recover_bus)(struct i2c_adapter *); | ||
390 | |||
391 | int (*get_scl)(struct i2c_adapter *); | ||
392 | void (*set_scl)(struct i2c_adapter *, int val); | ||
393 | int (*get_sda)(struct i2c_adapter *); | ||
394 | |||
395 | void (*prepare_recovery)(struct i2c_bus_recovery_info *bri); | ||
396 | void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri); | ||
397 | |||
398 | /* gpio recovery */ | ||
399 | int scl_gpio; | ||
400 | int sda_gpio; | ||
401 | }; | ||
402 | |||
403 | int i2c_recover_bus(struct i2c_adapter *adap); | ||
404 | |||
405 | /* Generic recovery routines */ | ||
406 | int i2c_generic_gpio_recovery(struct i2c_adapter *adap); | ||
407 | int i2c_generic_scl_recovery(struct i2c_adapter *adap); | ||
408 | |||
373 | /* | 409 | /* |
374 | * i2c_adapter is the structure used to identify a physical i2c bus along | 410 | * i2c_adapter is the structure used to identify a physical i2c bus along |
375 | * with the access algorithms necessary to access it. | 411 | * with the access algorithms necessary to access it. |
@@ -393,6 +429,8 @@ struct i2c_adapter { | |||
393 | 429 | ||
394 | struct mutex userspace_clients_lock; | 430 | struct mutex userspace_clients_lock; |
395 | struct list_head userspace_clients; | 431 | struct list_head userspace_clients; |
432 | |||
433 | struct i2c_bus_recovery_info *bus_recovery_info; | ||
396 | }; | 434 | }; |
397 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 435 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
398 | 436 | ||
@@ -450,7 +488,7 @@ void i2c_unlock_adapter(struct i2c_adapter *); | |||
450 | */ | 488 | */ |
451 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 489 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
452 | extern int i2c_add_adapter(struct i2c_adapter *); | 490 | extern int i2c_add_adapter(struct i2c_adapter *); |
453 | extern int i2c_del_adapter(struct i2c_adapter *); | 491 | extern void i2c_del_adapter(struct i2c_adapter *); |
454 | extern int i2c_add_numbered_adapter(struct i2c_adapter *); | 492 | extern int i2c_add_numbered_adapter(struct i2c_adapter *); |
455 | 493 | ||
456 | extern int i2c_register_driver(struct module *, struct i2c_driver *); | 494 | extern int i2c_register_driver(struct module *, struct i2c_driver *); |
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h index 530e11ba0738..01f595107048 100644 --- a/include/linux/i2c/twl4030-madc.h +++ b/include/linux/i2c/twl4030-madc.h | |||
@@ -39,6 +39,7 @@ struct twl4030_madc_conversion_method { | |||
39 | * @do_avgP: sample the input channel for 4 consecutive cycles | 39 | * @do_avgP: sample the input channel for 4 consecutive cycles |
40 | * @method: RT, SW1, SW2 | 40 | * @method: RT, SW1, SW2 |
41 | * @type: Polling or interrupt based method | 41 | * @type: Polling or interrupt based method |
42 | * @raw: Return raw value, do not convert it | ||
42 | */ | 43 | */ |
43 | 44 | ||
44 | struct twl4030_madc_request { | 45 | struct twl4030_madc_request { |
@@ -48,6 +49,7 @@ struct twl4030_madc_request { | |||
48 | u16 type; | 49 | u16 type; |
49 | bool active; | 50 | bool active; |
50 | bool result_pending; | 51 | bool result_pending; |
52 | bool raw; | ||
51 | int rbuf[TWL4030_MADC_MAX_CHANNELS]; | 53 | int rbuf[TWL4030_MADC_MAX_CHANNELS]; |
52 | void (*func_cb)(int len, int channels, int *buf); | 54 | void (*func_cb)(int len, int channels, int *buf); |
53 | }; | 55 | }; |
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index b4f6c29caced..630f45335c73 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
@@ -11,9 +11,21 @@ static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb) | |||
11 | 11 | ||
12 | #include <linux/netdevice.h> | 12 | #include <linux/netdevice.h> |
13 | 13 | ||
14 | extern void icmpv6_send(struct sk_buff *skb, | 14 | #if IS_ENABLED(CONFIG_IPV6) |
15 | u8 type, u8 code, | 15 | extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info); |
16 | __u32 info); | 16 | |
17 | typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info); | ||
18 | extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn); | ||
19 | extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn); | ||
20 | |||
21 | #else | ||
22 | |||
23 | static inline void icmpv6_send(struct sk_buff *skb, | ||
24 | u8 type, u8 code, __u32 info) | ||
25 | { | ||
26 | |||
27 | } | ||
28 | #endif | ||
17 | 29 | ||
18 | extern int icmpv6_init(void); | 30 | extern int icmpv6_init(void); |
19 | extern int icmpv6_err_convert(u8 type, u8 code, | 31 | extern int icmpv6_err_convert(u8 type, u8 code, |
diff --git a/include/linux/idr.h b/include/linux/idr.h index 2640c7e99e51..871a213a8477 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -42,6 +42,7 @@ struct idr { | |||
42 | struct idr_layer *id_free; | 42 | struct idr_layer *id_free; |
43 | int layers; /* only valid w/o concurrent changes */ | 43 | int layers; /* only valid w/o concurrent changes */ |
44 | int id_free_cnt; | 44 | int id_free_cnt; |
45 | int cur; /* current pos for cyclic allocation */ | ||
45 | spinlock_t lock; | 46 | spinlock_t lock; |
46 | }; | 47 | }; |
47 | 48 | ||
@@ -75,6 +76,7 @@ struct idr { | |||
75 | void *idr_find_slowpath(struct idr *idp, int id); | 76 | void *idr_find_slowpath(struct idr *idp, int id); |
76 | void idr_preload(gfp_t gfp_mask); | 77 | void idr_preload(gfp_t gfp_mask); |
77 | int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); | 78 | int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); |
79 | int idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp_mask); | ||
78 | int idr_for_each(struct idr *idp, | 80 | int idr_for_each(struct idr *idp, |
79 | int (*fn)(int id, void *p, void *data), void *data); | 81 | int (*fn)(int id, void *p, void *data), void *data); |
80 | void *idr_get_next(struct idr *idp, int *nextid); | 82 | void *idr_get_next(struct idr *idp, int *nextid); |
@@ -122,11 +124,13 @@ static inline void *idr_find(struct idr *idr, int id) | |||
122 | * @idp: idr handle | 124 | * @idp: idr handle |
123 | * @entry: the type * to use as cursor | 125 | * @entry: the type * to use as cursor |
124 | * @id: id entry's key | 126 | * @id: id entry's key |
127 | * | ||
128 | * @entry and @id do not need to be initialized before the loop, and | ||
129 | * after normal terminatinon @entry is left with the value NULL. This | ||
130 | * is convenient for a "not found" value. | ||
125 | */ | 131 | */ |
126 | #define idr_for_each_entry(idp, entry, id) \ | 132 | #define idr_for_each_entry(idp, entry, id) \ |
127 | for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ | 133 | for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id) |
128 | entry != NULL; \ | ||
129 | ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) | ||
130 | 134 | ||
131 | /* | 135 | /* |
132 | * Don't use the following functions. These exist only to suppress | 136 | * Don't use the following functions. These exist only to suppress |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 7e24fe0cfbcd..06b0ed0154a4 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -113,6 +113,34 @@ | |||
113 | #define IEEE80211_CTL_EXT_SSW_FBACK 0x9000 | 113 | #define IEEE80211_CTL_EXT_SSW_FBACK 0x9000 |
114 | #define IEEE80211_CTL_EXT_SSW_ACK 0xa000 | 114 | #define IEEE80211_CTL_EXT_SSW_ACK 0xa000 |
115 | 115 | ||
116 | |||
117 | #define IEEE80211_SN_MASK ((IEEE80211_SCTL_SEQ) >> 4) | ||
118 | #define IEEE80211_MAX_SN IEEE80211_SN_MASK | ||
119 | #define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1) | ||
120 | |||
121 | static inline int ieee80211_sn_less(u16 sn1, u16 sn2) | ||
122 | { | ||
123 | return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1); | ||
124 | } | ||
125 | |||
126 | static inline u16 ieee80211_sn_add(u16 sn1, u16 sn2) | ||
127 | { | ||
128 | return (sn1 + sn2) & IEEE80211_SN_MASK; | ||
129 | } | ||
130 | |||
131 | static inline u16 ieee80211_sn_inc(u16 sn) | ||
132 | { | ||
133 | return ieee80211_sn_add(sn, 1); | ||
134 | } | ||
135 | |||
136 | static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) | ||
137 | { | ||
138 | return (sn1 - sn2) & IEEE80211_SN_MASK; | ||
139 | } | ||
140 | |||
141 | #define IEEE80211_SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | ||
142 | #define IEEE80211_SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) | ||
143 | |||
116 | /* miscellaneous IEEE 802.11 constants */ | 144 | /* miscellaneous IEEE 802.11 constants */ |
117 | #define IEEE80211_MAX_FRAG_THRESHOLD 2352 | 145 | #define IEEE80211_MAX_FRAG_THRESHOLD 2352 |
118 | #define IEEE80211_MAX_RTS_THRESHOLD 2353 | 146 | #define IEEE80211_MAX_RTS_THRESHOLD 2353 |
@@ -185,7 +213,7 @@ struct ieee80211_hdr { | |||
185 | u8 addr3[6]; | 213 | u8 addr3[6]; |
186 | __le16 seq_ctrl; | 214 | __le16 seq_ctrl; |
187 | u8 addr4[6]; | 215 | u8 addr4[6]; |
188 | } __packed; | 216 | } __packed __aligned(2); |
189 | 217 | ||
190 | struct ieee80211_hdr_3addr { | 218 | struct ieee80211_hdr_3addr { |
191 | __le16 frame_control; | 219 | __le16 frame_control; |
@@ -194,7 +222,7 @@ struct ieee80211_hdr_3addr { | |||
194 | u8 addr2[6]; | 222 | u8 addr2[6]; |
195 | u8 addr3[6]; | 223 | u8 addr3[6]; |
196 | __le16 seq_ctrl; | 224 | __le16 seq_ctrl; |
197 | } __packed; | 225 | } __packed __aligned(2); |
198 | 226 | ||
199 | struct ieee80211_qos_hdr { | 227 | struct ieee80211_qos_hdr { |
200 | __le16 frame_control; | 228 | __le16 frame_control; |
@@ -204,7 +232,7 @@ struct ieee80211_qos_hdr { | |||
204 | u8 addr3[6]; | 232 | u8 addr3[6]; |
205 | __le16 seq_ctrl; | 233 | __le16 seq_ctrl; |
206 | __le16 qos_ctrl; | 234 | __le16 qos_ctrl; |
207 | } __packed; | 235 | } __packed __aligned(2); |
208 | 236 | ||
209 | /** | 237 | /** |
210 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set | 238 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set |
@@ -581,7 +609,7 @@ struct ieee80211s_hdr { | |||
581 | __le32 seqnum; | 609 | __le32 seqnum; |
582 | u8 eaddr1[6]; | 610 | u8 eaddr1[6]; |
583 | u8 eaddr2[6]; | 611 | u8 eaddr2[6]; |
584 | } __packed; | 612 | } __packed __aligned(2); |
585 | 613 | ||
586 | /* Mesh flags */ | 614 | /* Mesh flags */ |
587 | #define MESH_FLAGS_AE_A4 0x1 | 615 | #define MESH_FLAGS_AE_A4 0x1 |
@@ -645,6 +673,36 @@ struct ieee80211_channel_sw_ie { | |||
645 | } __packed; | 673 | } __packed; |
646 | 674 | ||
647 | /** | 675 | /** |
676 | * struct ieee80211_ext_chansw_ie | ||
677 | * | ||
678 | * This structure represents the "Extended Channel Switch Announcement element" | ||
679 | */ | ||
680 | struct ieee80211_ext_chansw_ie { | ||
681 | u8 mode; | ||
682 | u8 new_operating_class; | ||
683 | u8 new_ch_num; | ||
684 | u8 count; | ||
685 | } __packed; | ||
686 | |||
687 | /** | ||
688 | * struct ieee80211_sec_chan_offs_ie - secondary channel offset IE | ||
689 | * @sec_chan_offs: secondary channel offset, uses IEEE80211_HT_PARAM_CHA_SEC_* | ||
690 | * values here | ||
691 | * This structure represents the "Secondary Channel Offset element" | ||
692 | */ | ||
693 | struct ieee80211_sec_chan_offs_ie { | ||
694 | u8 sec_chan_offs; | ||
695 | } __packed; | ||
696 | |||
697 | /** | ||
698 | * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE | ||
699 | */ | ||
700 | struct ieee80211_wide_bw_chansw_ie { | ||
701 | u8 new_channel_width; | ||
702 | u8 new_center_freq_seg0, new_center_freq_seg1; | ||
703 | } __packed; | ||
704 | |||
705 | /** | ||
648 | * struct ieee80211_tim | 706 | * struct ieee80211_tim |
649 | * | 707 | * |
650 | * This structure refers to "Traffic Indication Map information element" | 708 | * This structure refers to "Traffic Indication Map information element" |
@@ -812,12 +870,15 @@ struct ieee80211_mgmt { | |||
812 | } __packed wme_action; | 870 | } __packed wme_action; |
813 | struct{ | 871 | struct{ |
814 | u8 action_code; | 872 | u8 action_code; |
815 | u8 element_id; | 873 | u8 variable[0]; |
816 | u8 length; | ||
817 | struct ieee80211_channel_sw_ie sw_elem; | ||
818 | } __packed chan_switch; | 874 | } __packed chan_switch; |
819 | struct{ | 875 | struct{ |
820 | u8 action_code; | 876 | u8 action_code; |
877 | struct ieee80211_ext_chansw_ie data; | ||
878 | u8 variable[0]; | ||
879 | } __packed ext_chan_switch; | ||
880 | struct{ | ||
881 | u8 action_code; | ||
821 | u8 dialog_token; | 882 | u8 dialog_token; |
822 | u8 element_id; | 883 | u8 element_id; |
823 | u8 length; | 884 | u8 length; |
@@ -875,7 +936,7 @@ struct ieee80211_mgmt { | |||
875 | } u; | 936 | } u; |
876 | } __packed action; | 937 | } __packed action; |
877 | } u; | 938 | } u; |
878 | } __packed; | 939 | } __packed __aligned(2); |
879 | 940 | ||
880 | /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ | 941 | /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ |
881 | #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 | 942 | #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 |
@@ -906,20 +967,20 @@ struct ieee80211_rts { | |||
906 | __le16 duration; | 967 | __le16 duration; |
907 | u8 ra[6]; | 968 | u8 ra[6]; |
908 | u8 ta[6]; | 969 | u8 ta[6]; |
909 | } __packed; | 970 | } __packed __aligned(2); |
910 | 971 | ||
911 | struct ieee80211_cts { | 972 | struct ieee80211_cts { |
912 | __le16 frame_control; | 973 | __le16 frame_control; |
913 | __le16 duration; | 974 | __le16 duration; |
914 | u8 ra[6]; | 975 | u8 ra[6]; |
915 | } __packed; | 976 | } __packed __aligned(2); |
916 | 977 | ||
917 | struct ieee80211_pspoll { | 978 | struct ieee80211_pspoll { |
918 | __le16 frame_control; | 979 | __le16 frame_control; |
919 | __le16 aid; | 980 | __le16 aid; |
920 | u8 bssid[6]; | 981 | u8 bssid[6]; |
921 | u8 ta[6]; | 982 | u8 ta[6]; |
922 | } __packed; | 983 | } __packed __aligned(2); |
923 | 984 | ||
924 | /* TDLS */ | 985 | /* TDLS */ |
925 | 986 | ||
@@ -999,6 +1060,26 @@ enum ieee80211_p2p_attr_id { | |||
999 | IEEE80211_P2P_ATTR_MAX | 1060 | IEEE80211_P2P_ATTR_MAX |
1000 | }; | 1061 | }; |
1001 | 1062 | ||
1063 | /* Notice of Absence attribute - described in P2P spec 4.1.14 */ | ||
1064 | /* Typical max value used here */ | ||
1065 | #define IEEE80211_P2P_NOA_DESC_MAX 4 | ||
1066 | |||
1067 | struct ieee80211_p2p_noa_desc { | ||
1068 | u8 count; | ||
1069 | __le32 duration; | ||
1070 | __le32 interval; | ||
1071 | __le32 start_time; | ||
1072 | } __packed; | ||
1073 | |||
1074 | struct ieee80211_p2p_noa_attr { | ||
1075 | u8 index; | ||
1076 | u8 oppps_ctwindow; | ||
1077 | struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX]; | ||
1078 | } __packed; | ||
1079 | |||
1080 | #define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7) | ||
1081 | #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F | ||
1082 | |||
1002 | /** | 1083 | /** |
1003 | * struct ieee80211_bar - HT Block Ack Request | 1084 | * struct ieee80211_bar - HT Block Ack Request |
1004 | * | 1085 | * |
@@ -1290,11 +1371,6 @@ struct ieee80211_vht_operation { | |||
1290 | } __packed; | 1371 | } __packed; |
1291 | 1372 | ||
1292 | 1373 | ||
1293 | #define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0 | ||
1294 | #define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1 | ||
1295 | #define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2 | ||
1296 | #define IEEE80211_VHT_MCS_NOT_SUPPORTED 3 | ||
1297 | |||
1298 | /* 802.11ac VHT Capabilities */ | 1374 | /* 802.11ac VHT Capabilities */ |
1299 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 | 1375 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 |
1300 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 | 1376 | #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 |
@@ -1310,10 +1386,11 @@ struct ieee80211_vht_operation { | |||
1310 | #define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 | 1386 | #define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 |
1311 | #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 | 1387 | #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 |
1312 | #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 | 1388 | #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 |
1389 | #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 | ||
1313 | #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 | 1390 | #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 |
1314 | #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 | 1391 | #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 |
1315 | #define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 | 1392 | #define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 |
1316 | #define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000 | 1393 | #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00030000 |
1317 | #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 | 1394 | #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 |
1318 | #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 | 1395 | #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 |
1319 | #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 | 1396 | #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 |
@@ -1594,6 +1671,7 @@ enum ieee80211_eid { | |||
1594 | 1671 | ||
1595 | WLAN_EID_HT_CAPABILITY = 45, | 1672 | WLAN_EID_HT_CAPABILITY = 45, |
1596 | WLAN_EID_HT_OPERATION = 61, | 1673 | WLAN_EID_HT_OPERATION = 61, |
1674 | WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, | ||
1597 | 1675 | ||
1598 | WLAN_EID_RSN = 48, | 1676 | WLAN_EID_RSN = 48, |
1599 | WLAN_EID_MMIE = 76, | 1677 | WLAN_EID_MMIE = 76, |
@@ -1628,6 +1706,8 @@ enum ieee80211_eid { | |||
1628 | WLAN_EID_VHT_CAPABILITY = 191, | 1706 | WLAN_EID_VHT_CAPABILITY = 191, |
1629 | WLAN_EID_VHT_OPERATION = 192, | 1707 | WLAN_EID_VHT_OPERATION = 192, |
1630 | WLAN_EID_OPMODE_NOTIF = 199, | 1708 | WLAN_EID_OPMODE_NOTIF = 199, |
1709 | WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, | ||
1710 | WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196, | ||
1631 | 1711 | ||
1632 | /* 802.11ad */ | 1712 | /* 802.11ad */ |
1633 | WLAN_EID_NON_TX_BSSID_CAP = 83, | 1713 | WLAN_EID_NON_TX_BSSID_CAP = 83, |
@@ -1751,6 +1831,7 @@ enum ieee80211_key_len { | |||
1751 | 1831 | ||
1752 | /* Public action codes */ | 1832 | /* Public action codes */ |
1753 | enum ieee80211_pub_actioncode { | 1833 | enum ieee80211_pub_actioncode { |
1834 | WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, | ||
1754 | WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, | 1835 | WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, |
1755 | }; | 1836 | }; |
1756 | 1837 | ||
@@ -1911,6 +1992,16 @@ enum ieee80211_timeout_interval_type { | |||
1911 | WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, | 1992 | WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, |
1912 | }; | 1993 | }; |
1913 | 1994 | ||
1995 | /** | ||
1996 | * struct ieee80211_timeout_interval_ie - Timeout Interval element | ||
1997 | * @type: type, see &enum ieee80211_timeout_interval_type | ||
1998 | * @value: timeout interval value | ||
1999 | */ | ||
2000 | struct ieee80211_timeout_interval_ie { | ||
2001 | u8 type; | ||
2002 | __le32 value; | ||
2003 | } __packed; | ||
2004 | |||
1914 | /* BACK action code */ | 2005 | /* BACK action code */ |
1915 | enum ieee80211_back_actioncode { | 2006 | enum ieee80211_back_actioncode { |
1916 | WLAN_ACTION_ADDBA_REQ = 0, | 2007 | WLAN_ACTION_ADDBA_REQ = 0, |
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 89b4614a4722..f563907ed776 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
@@ -33,7 +33,15 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb) | |||
33 | 33 | ||
34 | static inline int arp_hdr_len(struct net_device *dev) | 34 | static inline int arp_hdr_len(struct net_device *dev) |
35 | { | 35 | { |
36 | /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ | 36 | switch (dev->type) { |
37 | return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; | 37 | #if IS_ENABLED(CONFIG_FIREWIRE_NET) |
38 | case ARPHRD_IEEE1394: | ||
39 | /* ARP header, device address and 2 IP addresses */ | ||
40 | return sizeof(struct arphdr) + dev->addr_len + sizeof(u32) * 2; | ||
41 | #endif | ||
42 | default: | ||
43 | /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ | ||
44 | return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; | ||
45 | } | ||
38 | } | 46 | } |
39 | #endif /* _LINUX_IF_ARP_H */ | 47 | #endif /* _LINUX_IF_ARP_H */ |
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index cfd21e3d5506..4474557904f6 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
@@ -112,6 +112,10 @@ struct team_mode_ops { | |||
112 | void (*port_disabled)(struct team *team, struct team_port *port); | 112 | void (*port_disabled)(struct team *team, struct team_port *port); |
113 | }; | 113 | }; |
114 | 114 | ||
115 | extern int team_modeop_port_enter(struct team *team, struct team_port *port); | ||
116 | extern void team_modeop_port_change_dev_addr(struct team *team, | ||
117 | struct team_port *port); | ||
118 | |||
115 | enum team_option_type { | 119 | enum team_option_type { |
116 | TEAM_OPTION_TYPE_U32, | 120 | TEAM_OPTION_TYPE_U32, |
117 | TEAM_OPTION_TYPE_STRING, | 121 | TEAM_OPTION_TYPE_STRING, |
@@ -236,7 +240,26 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team, | |||
236 | return NULL; | 240 | return NULL; |
237 | } | 241 | } |
238 | 242 | ||
239 | extern int team_port_set_team_dev_addr(struct team_port *port); | 243 | static inline struct team_port * |
244 | team_get_first_port_txable_rcu(struct team *team, struct team_port *port) | ||
245 | { | ||
246 | struct team_port *cur; | ||
247 | |||
248 | if (likely(team_port_txable(port))) | ||
249 | return port; | ||
250 | cur = port; | ||
251 | list_for_each_entry_continue_rcu(cur, &team->port_list, list) | ||
252 | if (team_port_txable(port)) | ||
253 | return cur; | ||
254 | list_for_each_entry_rcu(cur, &team->port_list, list) { | ||
255 | if (cur == port) | ||
256 | break; | ||
257 | if (team_port_txable(port)) | ||
258 | return cur; | ||
259 | } | ||
260 | return NULL; | ||
261 | } | ||
262 | |||
240 | extern int team_options_register(struct team *team, | 263 | extern int team_options_register(struct team *team, |
241 | const struct team_option *option, | 264 | const struct team_option *option, |
242 | size_t option_count); | 265 | size_t option_count); |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 218a3b686d90..52bd03b38962 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -86,15 +86,15 @@ static inline int is_vlan_dev(struct net_device *dev) | |||
86 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 86 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
87 | 87 | ||
88 | extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, | 88 | extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, |
89 | u16 vlan_id); | 89 | __be16 vlan_proto, u16 vlan_id); |
90 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); | 90 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
91 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); | 91 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); |
92 | 92 | ||
93 | extern bool vlan_do_receive(struct sk_buff **skb); | 93 | extern bool vlan_do_receive(struct sk_buff **skb); |
94 | extern struct sk_buff *vlan_untag(struct sk_buff *skb); | 94 | extern struct sk_buff *vlan_untag(struct sk_buff *skb); |
95 | 95 | ||
96 | extern int vlan_vid_add(struct net_device *dev, unsigned short vid); | 96 | extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); |
97 | extern void vlan_vid_del(struct net_device *dev, unsigned short vid); | 97 | extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); |
98 | 98 | ||
99 | extern int vlan_vids_add_by_dev(struct net_device *dev, | 99 | extern int vlan_vids_add_by_dev(struct net_device *dev, |
100 | const struct net_device *by_dev); | 100 | const struct net_device *by_dev); |
@@ -104,7 +104,8 @@ extern void vlan_vids_del_by_dev(struct net_device *dev, | |||
104 | extern bool vlan_uses_dev(const struct net_device *dev); | 104 | extern bool vlan_uses_dev(const struct net_device *dev); |
105 | #else | 105 | #else |
106 | static inline struct net_device * | 106 | static inline struct net_device * |
107 | __vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) | 107 | __vlan_find_dev_deep(struct net_device *real_dev, |
108 | __be16 vlan_proto, u16 vlan_id) | ||
108 | { | 109 | { |
109 | return NULL; | 110 | return NULL; |
110 | } | 111 | } |
@@ -131,12 +132,12 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb) | |||
131 | return skb; | 132 | return skb; |
132 | } | 133 | } |
133 | 134 | ||
134 | static inline int vlan_vid_add(struct net_device *dev, unsigned short vid) | 135 | static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) |
135 | { | 136 | { |
136 | return 0; | 137 | return 0; |
137 | } | 138 | } |
138 | 139 | ||
139 | static inline void vlan_vid_del(struct net_device *dev, unsigned short vid) | 140 | static inline void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid) |
140 | { | 141 | { |
141 | } | 142 | } |
142 | 143 | ||
@@ -157,9 +158,20 @@ static inline bool vlan_uses_dev(const struct net_device *dev) | |||
157 | } | 158 | } |
158 | #endif | 159 | #endif |
159 | 160 | ||
161 | static inline bool vlan_hw_offload_capable(netdev_features_t features, | ||
162 | __be16 proto) | ||
163 | { | ||
164 | if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX) | ||
165 | return true; | ||
166 | if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX) | ||
167 | return true; | ||
168 | return false; | ||
169 | } | ||
170 | |||
160 | /** | 171 | /** |
161 | * vlan_insert_tag - regular VLAN tag inserting | 172 | * vlan_insert_tag - regular VLAN tag inserting |
162 | * @skb: skbuff to tag | 173 | * @skb: skbuff to tag |
174 | * @vlan_proto: VLAN encapsulation protocol | ||
163 | * @vlan_tci: VLAN TCI to insert | 175 | * @vlan_tci: VLAN TCI to insert |
164 | * | 176 | * |
165 | * Inserts the VLAN tag into @skb as part of the payload | 177 | * Inserts the VLAN tag into @skb as part of the payload |
@@ -170,7 +182,8 @@ static inline bool vlan_uses_dev(const struct net_device *dev) | |||
170 | * | 182 | * |
171 | * Does not change skb->protocol so this function can be used during receive. | 183 | * Does not change skb->protocol so this function can be used during receive. |
172 | */ | 184 | */ |
173 | static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | 185 | static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, |
186 | __be16 vlan_proto, u16 vlan_tci) | ||
174 | { | 187 | { |
175 | struct vlan_ethhdr *veth; | 188 | struct vlan_ethhdr *veth; |
176 | 189 | ||
@@ -185,7 +198,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | |||
185 | skb->mac_header -= VLAN_HLEN; | 198 | skb->mac_header -= VLAN_HLEN; |
186 | 199 | ||
187 | /* first, the ethernet type */ | 200 | /* first, the ethernet type */ |
188 | veth->h_vlan_proto = htons(ETH_P_8021Q); | 201 | veth->h_vlan_proto = vlan_proto; |
189 | 202 | ||
190 | /* now, the TCI */ | 203 | /* now, the TCI */ |
191 | veth->h_vlan_TCI = htons(vlan_tci); | 204 | veth->h_vlan_TCI = htons(vlan_tci); |
@@ -204,24 +217,28 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | |||
204 | * Following the skb_unshare() example, in case of error, the calling function | 217 | * Following the skb_unshare() example, in case of error, the calling function |
205 | * doesn't have to worry about freeing the original skb. | 218 | * doesn't have to worry about freeing the original skb. |
206 | */ | 219 | */ |
207 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | 220 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, |
221 | __be16 vlan_proto, u16 vlan_tci) | ||
208 | { | 222 | { |
209 | skb = vlan_insert_tag(skb, vlan_tci); | 223 | skb = vlan_insert_tag(skb, vlan_proto, vlan_tci); |
210 | if (skb) | 224 | if (skb) |
211 | skb->protocol = htons(ETH_P_8021Q); | 225 | skb->protocol = vlan_proto; |
212 | return skb; | 226 | return skb; |
213 | } | 227 | } |
214 | 228 | ||
215 | /** | 229 | /** |
216 | * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting | 230 | * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting |
217 | * @skb: skbuff to tag | 231 | * @skb: skbuff to tag |
232 | * @vlan_proto: VLAN encapsulation protocol | ||
218 | * @vlan_tci: VLAN TCI to insert | 233 | * @vlan_tci: VLAN TCI to insert |
219 | * | 234 | * |
220 | * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest | 235 | * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest |
221 | */ | 236 | */ |
222 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, | 237 | static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, |
238 | __be16 vlan_proto, | ||
223 | u16 vlan_tci) | 239 | u16 vlan_tci) |
224 | { | 240 | { |
241 | skb->vlan_proto = vlan_proto; | ||
225 | skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; | 242 | skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; |
226 | return skb; | 243 | return skb; |
227 | } | 244 | } |
@@ -236,12 +253,13 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, | |||
236 | * Assumes skb->dev is the target that will xmit this frame. | 253 | * Assumes skb->dev is the target that will xmit this frame. |
237 | * Returns a VLAN tagged skb. | 254 | * Returns a VLAN tagged skb. |
238 | */ | 255 | */ |
239 | static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | 256 | static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, |
257 | __be16 vlan_proto, u16 vlan_tci) | ||
240 | { | 258 | { |
241 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { | 259 | if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) { |
242 | return __vlan_hwaccel_put_tag(skb, vlan_tci); | 260 | return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); |
243 | } else { | 261 | } else { |
244 | return __vlan_put_tag(skb, vlan_tci); | 262 | return __vlan_put_tag(skb, vlan_proto, vlan_tci); |
245 | } | 263 | } |
246 | } | 264 | } |
247 | 265 | ||
@@ -256,9 +274,9 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) | |||
256 | { | 274 | { |
257 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; | 275 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; |
258 | 276 | ||
259 | if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { | 277 | if (veth->h_vlan_proto != htons(ETH_P_8021Q) && |
278 | veth->h_vlan_proto != htons(ETH_P_8021AD)) | ||
260 | return -EINVAL; | 279 | return -EINVAL; |
261 | } | ||
262 | 280 | ||
263 | *vlan_tci = ntohs(veth->h_vlan_TCI); | 281 | *vlan_tci = ntohs(veth->h_vlan_TCI); |
264 | return 0; | 282 | return 0; |
@@ -294,7 +312,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, | |||
294 | */ | 312 | */ |
295 | static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) | 313 | static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) |
296 | { | 314 | { |
297 | if (skb->dev->features & NETIF_F_HW_VLAN_TX) { | 315 | if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) { |
298 | return __vlan_hwaccel_get_tag(skb, vlan_tci); | 316 | return __vlan_hwaccel_get_tag(skb, vlan_tci); |
299 | } else { | 317 | } else { |
300 | return __vlan_get_tag(skb, vlan_tci); | 318 | return __vlan_get_tag(skb, vlan_tci); |
@@ -339,7 +357,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, | |||
339 | */ | 357 | */ |
340 | 358 | ||
341 | proto = vhdr->h_vlan_encapsulated_proto; | 359 | proto = vhdr->h_vlan_encapsulated_proto; |
342 | if (ntohs(proto) >= 1536) { | 360 | if (ntohs(proto) >= ETH_P_802_3_MIN) { |
343 | skb->protocol = proto; | 361 | skb->protocol = proto; |
344 | return; | 362 | return; |
345 | } | 363 | } |
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h index 2e4eab9868a3..e7fdec4db9da 100644 --- a/include/linux/iio/adc/ad_sigma_delta.h +++ b/include/linux/iio/adc/ad_sigma_delta.h | |||
@@ -133,9 +133,9 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig); | |||
133 | .channel2 = (_channel2), \ | 133 | .channel2 = (_channel2), \ |
134 | .address = (_address), \ | 134 | .address = (_address), \ |
135 | .extend_name = (_extend_name), \ | 135 | .extend_name = (_extend_name), \ |
136 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 136 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
137 | IIO_CHAN_INFO_SCALE_SHARED_BIT | \ | 137 | BIT(IIO_CHAN_INFO_OFFSET), \ |
138 | IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ | 138 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
139 | .scan_index = (_si), \ | 139 | .scan_index = (_si), \ |
140 | .scan_type = { \ | 140 | .scan_type = { \ |
141 | .sign = 'u', \ | 141 | .sign = 'u', \ |
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 8bd12be0b02f..172c5b23cb84 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/spi/spi.h> | 15 | #include <linux/spi/spi.h> |
16 | #include <linux/irqreturn.h> | 16 | #include <linux/irqreturn.h> |
17 | #include <linux/iio/trigger.h> | 17 | #include <linux/iio/trigger.h> |
18 | #include <linux/bitops.h> | ||
18 | 19 | ||
19 | #define ST_SENSORS_TX_MAX_LENGTH 2 | 20 | #define ST_SENSORS_TX_MAX_LENGTH 2 |
20 | #define ST_SENSORS_RX_MAX_LENGTH 6 | 21 | #define ST_SENSORS_RX_MAX_LENGTH 6 |
@@ -45,8 +46,8 @@ | |||
45 | { \ | 46 | { \ |
46 | .type = device_type, \ | 47 | .type = device_type, \ |
47 | .modified = 1, \ | 48 | .modified = 1, \ |
48 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 49 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
49 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ | 50 | BIT(IIO_CHAN_INFO_SCALE), \ |
50 | .scan_index = index, \ | 51 | .scan_index = index, \ |
51 | .channel2 = mod, \ | 52 | .channel2 = mod, \ |
52 | .address = addr, \ | 53 | .address = addr, \ |
diff --git a/include/linux/iio/gyro/itg3200.h b/include/linux/iio/gyro/itg3200.h index c53f16914b77..2a820850f284 100644 --- a/include/linux/iio/gyro/itg3200.h +++ b/include/linux/iio/gyro/itg3200.h | |||
@@ -149,6 +149,6 @@ static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev) | |||
149 | { | 149 | { |
150 | } | 150 | } |
151 | 151 | ||
152 | #endif /* CONFIG_IIO_RING_BUFFER */ | 152 | #endif /* CONFIG_IIO_BUFFER */ |
153 | 153 | ||
154 | #endif /* ITG3200_H_ */ | 154 | #endif /* ITG3200_H_ */ |
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index da8c776ba0bd..8d171f427632 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
@@ -38,76 +38,6 @@ enum iio_chan_info_enum { | |||
38 | IIO_CHAN_INFO_HYSTERESIS, | 38 | IIO_CHAN_INFO_HYSTERESIS, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | #define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2) | ||
42 | #define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1) | ||
43 | #define IIO_CHAN_INFO_BITS(type) (IIO_CHAN_INFO_SHARED_BIT(type) | \ | ||
44 | IIO_CHAN_INFO_SEPARATE_BIT(type)) | ||
45 | |||
46 | #define IIO_CHAN_INFO_RAW_SEPARATE_BIT \ | ||
47 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW) | ||
48 | #define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \ | ||
49 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED) | ||
50 | #define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \ | ||
51 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE) | ||
52 | #define IIO_CHAN_INFO_SCALE_SHARED_BIT \ | ||
53 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE) | ||
54 | #define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \ | ||
55 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET) | ||
56 | #define IIO_CHAN_INFO_OFFSET_SHARED_BIT \ | ||
57 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET) | ||
58 | #define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \ | ||
59 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE) | ||
60 | #define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \ | ||
61 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE) | ||
62 | #define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \ | ||
63 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS) | ||
64 | #define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \ | ||
65 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS) | ||
66 | #define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \ | ||
67 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK) | ||
68 | #define IIO_CHAN_INFO_PEAK_SHARED_BIT \ | ||
69 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK) | ||
70 | #define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \ | ||
71 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE) | ||
72 | #define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \ | ||
73 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE) | ||
74 | #define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \ | ||
75 | IIO_CHAN_INFO_SEPARATE_BIT( \ | ||
76 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW) | ||
77 | #define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \ | ||
78 | IIO_CHAN_INFO_SHARED_BIT( \ | ||
79 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW) | ||
80 | #define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \ | ||
81 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW) | ||
82 | #define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \ | ||
83 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW) | ||
84 | #define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \ | ||
85 | IIO_CHAN_INFO_SHARED_BIT( \ | ||
86 | IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) | ||
87 | #define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \ | ||
88 | IIO_CHAN_INFO_SEPARATE_BIT( \ | ||
89 | IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) | ||
90 | #define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \ | ||
91 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ) | ||
92 | #define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \ | ||
93 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ) | ||
94 | #define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \ | ||
95 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY) | ||
96 | #define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \ | ||
97 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY) | ||
98 | #define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \ | ||
99 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE) | ||
100 | #define IIO_CHAN_INFO_PHASE_SHARED_BIT \ | ||
101 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE) | ||
102 | #define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \ | ||
103 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN) | ||
104 | #define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \ | ||
105 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN) | ||
106 | #define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT \ | ||
107 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS) | ||
108 | #define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT \ | ||
109 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS) | ||
110 | |||
111 | enum iio_endian { | 41 | enum iio_endian { |
112 | IIO_CPU, | 42 | IIO_CPU, |
113 | IIO_BE, | 43 | IIO_BE, |
@@ -218,6 +148,10 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev, | |||
218 | * endianness: little or big endian | 148 | * endianness: little or big endian |
219 | * @info_mask: What information is to be exported about this channel. | 149 | * @info_mask: What information is to be exported about this channel. |
220 | * This includes calibbias, scale etc. | 150 | * This includes calibbias, scale etc. |
151 | * @info_mask_separate: What information is to be exported that is specific to | ||
152 | * this channel. | ||
153 | * @info_mask_shared_by_type: What information is to be exported that is shared | ||
154 | * by all channels of the same type. | ||
221 | * @event_mask: What events can this channel produce. | 155 | * @event_mask: What events can this channel produce. |
222 | * @ext_info: Array of extended info attributes for this channel. | 156 | * @ext_info: Array of extended info attributes for this channel. |
223 | * The array is NULL terminated, the last element should | 157 | * The array is NULL terminated, the last element should |
@@ -253,6 +187,8 @@ struct iio_chan_spec { | |||
253 | enum iio_endian endianness; | 187 | enum iio_endian endianness; |
254 | } scan_type; | 188 | } scan_type; |
255 | long info_mask; | 189 | long info_mask; |
190 | long info_mask_separate; | ||
191 | long info_mask_shared_by_type; | ||
256 | long event_mask; | 192 | long event_mask; |
257 | const struct iio_chan_spec_ext_info *ext_info; | 193 | const struct iio_chan_spec_ext_info *ext_info; |
258 | const char *extend_name; | 194 | const char *extend_name; |
@@ -275,7 +211,8 @@ struct iio_chan_spec { | |||
275 | static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, | 211 | static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, |
276 | enum iio_chan_info_enum type) | 212 | enum iio_chan_info_enum type) |
277 | { | 213 | { |
278 | return chan->info_mask & IIO_CHAN_INFO_BITS(type); | 214 | return (chan->info_mask_separate & type) | |
215 | (chan->info_mask_shared_by_type & type); | ||
279 | } | 216 | } |
280 | 217 | ||
281 | #define IIO_ST(si, rb, sb, sh) \ | 218 | #define IIO_ST(si, rb, sb, sh) \ |
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index ff781dca2e9a..b665dc7f017b 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h | |||
@@ -162,8 +162,8 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
162 | .indexed = 1, \ | 162 | .indexed = 1, \ |
163 | .channel = (chan), \ | 163 | .channel = (chan), \ |
164 | .extend_name = name, \ | 164 | .extend_name = name, \ |
165 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 165 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
166 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ | 166 | BIT(IIO_CHAN_INFO_SCALE), \ |
167 | .address = (addr), \ | 167 | .address = (addr), \ |
168 | .scan_index = (si), \ | 168 | .scan_index = (si), \ |
169 | .scan_type = { \ | 169 | .scan_type = { \ |
@@ -184,9 +184,9 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
184 | .type = IIO_TEMP, \ | 184 | .type = IIO_TEMP, \ |
185 | .indexed = 1, \ | 185 | .indexed = 1, \ |
186 | .channel = 0, \ | 186 | .channel = 0, \ |
187 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 187 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
188 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ | 188 | BIT(IIO_CHAN_INFO_SCALE) | \ |
189 | IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ | 189 | BIT(IIO_CHAN_INFO_OFFSET), \ |
190 | .address = (addr), \ | 190 | .address = (addr), \ |
191 | .scan_index = (si), \ | 191 | .scan_index = (si), \ |
192 | .scan_type = { \ | 192 | .scan_type = { \ |
@@ -197,13 +197,13 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
197 | }, \ | 197 | }, \ |
198 | } | 198 | } |
199 | 199 | ||
200 | #define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \ | 200 | #define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \ |
201 | .type = (_type), \ | 201 | .type = (_type), \ |
202 | .modified = 1, \ | 202 | .modified = 1, \ |
203 | .channel2 = IIO_MOD_ ## mod, \ | 203 | .channel2 = IIO_MOD_ ## mod, \ |
204 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 204 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
205 | IIO_CHAN_INFO_SCALE_SHARED_BIT | \ | 205 | info_sep, \ |
206 | info, \ | 206 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
207 | .address = (addr), \ | 207 | .address = (addr), \ |
208 | .scan_index = (si), \ | 208 | .scan_index = (si), \ |
209 | .scan_type = { \ | 209 | .scan_type = { \ |
@@ -214,17 +214,17 @@ int adis_single_conversion(struct iio_dev *indio_dev, | |||
214 | }, \ | 214 | }, \ |
215 | } | 215 | } |
216 | 216 | ||
217 | #define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \ | 217 | #define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \ |
218 | ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits) | 218 | ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits) |
219 | 219 | ||
220 | #define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \ | 220 | #define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \ |
221 | ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits) | 221 | ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits) |
222 | 222 | ||
223 | #define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \ | 223 | #define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \ |
224 | ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits) | 224 | ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits) |
225 | 225 | ||
226 | #define ADIS_ROT_CHAN(mod, addr, si, info, bits) \ | 226 | #define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \ |
227 | ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits) | 227 | ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits) |
228 | 228 | ||
229 | #ifdef CONFIG_IIO_ADIS_LIB_BUFFER | 229 | #ifdef CONFIG_IIO_ADIS_LIB_BUFFER |
230 | 230 | ||
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index c66e0a96f6e8..3869c525b052 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h | |||
@@ -44,7 +44,6 @@ struct iio_trigger_ops { | |||
44 | * @id: [INTERN] unique id number | 44 | * @id: [INTERN] unique id number |
45 | * @name: [DRIVER] unique name | 45 | * @name: [DRIVER] unique name |
46 | * @dev: [DRIVER] associated device (if relevant) | 46 | * @dev: [DRIVER] associated device (if relevant) |
47 | * @private_data: [DRIVER] device specific data | ||
48 | * @list: [INTERN] used in maintenance of global trigger list | 47 | * @list: [INTERN] used in maintenance of global trigger list |
49 | * @alloc_list: [DRIVER] used for driver specific trigger list | 48 | * @alloc_list: [DRIVER] used for driver specific trigger list |
50 | * @use_count: use count for the trigger | 49 | * @use_count: use count for the trigger |
@@ -60,7 +59,6 @@ struct iio_trigger { | |||
60 | const char *name; | 59 | const char *name; |
61 | struct device dev; | 60 | struct device dev; |
62 | 61 | ||
63 | void *private_data; | ||
64 | struct list_head list; | 62 | struct list_head list; |
65 | struct list_head alloc_list; | 63 | struct list_head alloc_list; |
66 | int use_count; | 64 | int use_count; |
@@ -92,6 +90,30 @@ static inline void iio_trigger_get(struct iio_trigger *trig) | |||
92 | } | 90 | } |
93 | 91 | ||
94 | /** | 92 | /** |
93 | * iio_device_set_drvdata() - Set trigger driver data | ||
94 | * @trig: IIO trigger structure | ||
95 | * @data: Driver specific data | ||
96 | * | ||
97 | * Allows to attach an arbitrary pointer to an IIO trigger, which can later be | ||
98 | * retrieved by iio_trigger_get_drvdata(). | ||
99 | */ | ||
100 | static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data) | ||
101 | { | ||
102 | dev_set_drvdata(&trig->dev, data); | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * iio_trigger_get_drvdata() - Get trigger driver data | ||
107 | * @trig: IIO trigger structure | ||
108 | * | ||
109 | * Returns the data previously set with iio_trigger_set_drvdata() | ||
110 | */ | ||
111 | static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig) | ||
112 | { | ||
113 | return dev_get_drvdata(&trig->dev); | ||
114 | } | ||
115 | |||
116 | /** | ||
95 | * iio_trigger_register() - register a trigger with the IIO core | 117 | * iio_trigger_register() - register a trigger with the IIO core |
96 | * @trig_info: trigger to be registered | 118 | * @trig_info: trigger to be registered |
97 | **/ | 119 | **/ |
diff --git a/include/linux/ima.h b/include/linux/ima.h index 86c361e947b9..1b7f268cddce 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h | |||
@@ -46,7 +46,7 @@ static inline int ima_module_check(struct file *file) | |||
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | 48 | ||
49 | #endif /* CONFIG_IMA_H */ | 49 | #endif /* CONFIG_IMA */ |
50 | 50 | ||
51 | #ifdef CONFIG_IMA_APPRAISE | 51 | #ifdef CONFIG_IMA_APPRAISE |
52 | extern void ima_inode_post_setattr(struct dentry *dentry); | 52 | extern void ima_inode_post_setattr(struct dentry *dentry); |
@@ -72,5 +72,5 @@ static inline int ima_inode_removexattr(struct dentry *dentry, | |||
72 | { | 72 | { |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | #endif /* CONFIG_IMA_APPRAISE_H */ | 75 | #endif /* CONFIG_IMA_APPRAISE */ |
76 | #endif /* _LINUX_IMA_H */ | 76 | #endif /* _LINUX_IMA_H */ |
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h index 75d4be717714..5049f21928e4 100644 --- a/include/linux/input/auo-pixcir-ts.h +++ b/include/linux/input/auo-pixcir-ts.h | |||
@@ -43,12 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | struct auo_pixcir_ts_platdata { | 44 | struct auo_pixcir_ts_platdata { |
45 | int gpio_int; | 45 | int gpio_int; |
46 | int gpio_rst; | ||
46 | 47 | ||
47 | int int_setting; | 48 | int int_setting; |
48 | 49 | ||
49 | void (*init_hw)(struct i2c_client *); | ||
50 | void (*exit_hw)(struct i2c_client *); | ||
51 | |||
52 | unsigned int x_max; | 50 | unsigned int x_max; |
53 | unsigned int y_max; | 51 | unsigned int y_max; |
54 | }; | 52 | }; |
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 5f3aa6b11bfa..27e06acc509a 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
@@ -81,4 +81,23 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, | |||
81 | unsigned short *keymap, | 81 | unsigned short *keymap, |
82 | struct input_dev *input_dev); | 82 | struct input_dev *input_dev); |
83 | 83 | ||
84 | #ifdef CONFIG_OF | ||
85 | /** | ||
86 | * matrix_keypad_parse_of_params() - Read parameters from matrix-keypad node | ||
87 | * | ||
88 | * @dev: Device containing of_node | ||
89 | * @rows: Returns number of matrix rows | ||
90 | * @cols: Returns number of matrix columns | ||
91 | * @return 0 if OK, <0 on error | ||
92 | */ | ||
93 | int matrix_keypad_parse_of_params(struct device *dev, | ||
94 | unsigned int *rows, unsigned int *cols); | ||
95 | #else | ||
96 | static inline int matrix_keypad_parse_of_params(struct device *dev, | ||
97 | unsigned int *rows, unsigned int *cols) | ||
98 | { | ||
99 | return -ENOSYS; | ||
100 | } | ||
101 | #endif /* CONFIG_OF */ | ||
102 | |||
84 | #endif /* _MATRIX_KEYPAD_H */ | 103 | #endif /* _MATRIX_KEYPAD_H */ |
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index 2e86bd0bfba1..1b1dfa80d9ff 100644 --- a/include/linux/input/mt.h +++ b/include/linux/input/mt.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */ | 19 | #define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */ |
20 | #define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */ | 20 | #define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */ |
21 | #define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */ | 21 | #define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */ |
22 | #define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */ | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * struct input_mt_slot - represents the state of an input MT slot | 25 | * struct input_mt_slot - represents the state of an input MT slot |
diff --git a/include/linux/integrity.h b/include/linux/integrity.h index 66c5fe9550a5..83222cebd47b 100644 --- a/include/linux/integrity.h +++ b/include/linux/integrity.h | |||
@@ -36,5 +36,5 @@ static inline void integrity_inode_free(struct inode *inode) | |||
36 | { | 36 | { |
37 | return; | 37 | return; |
38 | } | 38 | } |
39 | #endif /* CONFIG_INTEGRITY_H */ | 39 | #endif /* CONFIG_INTEGRITY */ |
40 | #endif /* _LINUX_INTEGRITY_H */ | 40 | #endif /* _LINUX_INTEGRITY_H */ |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index ba3b8a98a049..3aeb7305e2f5 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #define __LINUX_IOMMU_H | 20 | #define __LINUX_IOMMU_H |
21 | 21 | ||
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/err.h> | ||
23 | #include <linux/types.h> | 24 | #include <linux/types.h> |
24 | 25 | ||
25 | #define IOMMU_READ (1) | 26 | #define IOMMU_READ (1) |
@@ -91,8 +92,7 @@ struct iommu_ops { | |||
91 | phys_addr_t paddr, size_t size, int prot); | 92 | phys_addr_t paddr, size_t size, int prot); |
92 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, | 93 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, |
93 | size_t size); | 94 | size_t size); |
94 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, | 95 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); |
95 | unsigned long iova); | ||
96 | int (*domain_has_cap)(struct iommu_domain *domain, | 96 | int (*domain_has_cap)(struct iommu_domain *domain, |
97 | unsigned long cap); | 97 | unsigned long cap); |
98 | int (*add_device)(struct device *dev); | 98 | int (*add_device)(struct device *dev); |
@@ -105,7 +105,7 @@ struct iommu_ops { | |||
105 | 105 | ||
106 | /* Window handling functions */ | 106 | /* Window handling functions */ |
107 | int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, | 107 | int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, |
108 | phys_addr_t paddr, u64 size); | 108 | phys_addr_t paddr, u64 size, int prot); |
109 | void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr); | 109 | void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr); |
110 | /* Set the numer of window per domain */ | 110 | /* Set the numer of window per domain */ |
111 | int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count); | 111 | int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count); |
@@ -125,6 +125,7 @@ struct iommu_ops { | |||
125 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 125 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); |
126 | extern bool iommu_present(struct bus_type *bus); | 126 | extern bool iommu_present(struct bus_type *bus); |
127 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 127 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
128 | extern struct iommu_group *iommu_group_get_by_id(int id); | ||
128 | extern void iommu_domain_free(struct iommu_domain *domain); | 129 | extern void iommu_domain_free(struct iommu_domain *domain); |
129 | extern int iommu_attach_device(struct iommu_domain *domain, | 130 | extern int iommu_attach_device(struct iommu_domain *domain, |
130 | struct device *dev); | 131 | struct device *dev); |
@@ -134,8 +135,7 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova, | |||
134 | phys_addr_t paddr, size_t size, int prot); | 135 | phys_addr_t paddr, size_t size, int prot); |
135 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 136 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, |
136 | size_t size); | 137 | size_t size); |
137 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | 138 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); |
138 | unsigned long iova); | ||
139 | extern int iommu_domain_has_cap(struct iommu_domain *domain, | 139 | extern int iommu_domain_has_cap(struct iommu_domain *domain, |
140 | unsigned long cap); | 140 | unsigned long cap); |
141 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 141 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
@@ -171,7 +171,8 @@ extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, | |||
171 | 171 | ||
172 | /* Window handling function prototypes */ | 172 | /* Window handling function prototypes */ |
173 | extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, | 173 | extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, |
174 | phys_addr_t offset, u64 size); | 174 | phys_addr_t offset, u64 size, |
175 | int prot); | ||
175 | extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr); | 176 | extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr); |
176 | /** | 177 | /** |
177 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework | 178 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework |
@@ -257,7 +258,7 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova, | |||
257 | 258 | ||
258 | static inline int iommu_domain_window_enable(struct iommu_domain *domain, | 259 | static inline int iommu_domain_window_enable(struct iommu_domain *domain, |
259 | u32 wnd_nr, phys_addr_t paddr, | 260 | u32 wnd_nr, phys_addr_t paddr, |
260 | u64 size) | 261 | u64 size, int prot) |
261 | { | 262 | { |
262 | return -ENODEV; | 263 | return -ENODEV; |
263 | } | 264 | } |
@@ -267,8 +268,7 @@ static inline void iommu_domain_window_disable(struct iommu_domain *domain, | |||
267 | { | 268 | { |
268 | } | 269 | } |
269 | 270 | ||
270 | static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | 271 | static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova) |
271 | unsigned long iova) | ||
272 | { | 272 | { |
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 85ac9b9b72a2..89b7c24a36e9 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -192,6 +192,10 @@ extern struct resource * __request_region(struct resource *, | |||
192 | extern int __check_region(struct resource *, resource_size_t, resource_size_t); | 192 | extern int __check_region(struct resource *, resource_size_t, resource_size_t); |
193 | extern void __release_region(struct resource *, resource_size_t, | 193 | extern void __release_region(struct resource *, resource_size_t, |
194 | resource_size_t); | 194 | resource_size_t); |
195 | #ifdef CONFIG_MEMORY_HOTREMOVE | ||
196 | extern int release_mem_region_adjustable(struct resource *, resource_size_t, | ||
197 | resource_size_t); | ||
198 | #endif | ||
195 | 199 | ||
196 | static inline int __deprecated check_region(resource_size_t s, | 200 | static inline int __deprecated check_region(resource_size_t s, |
197 | resource_size_t n) | 201 | resource_size_t n) |
diff --git a/include/linux/ipack.h b/include/linux/ipack.h index fea12cbb2aeb..1888e06ddf64 100644 --- a/include/linux/ipack.h +++ b/include/linux/ipack.h | |||
@@ -207,19 +207,41 @@ int ipack_driver_register(struct ipack_driver *edrv, struct module *owner, | |||
207 | void ipack_driver_unregister(struct ipack_driver *edrv); | 207 | void ipack_driver_unregister(struct ipack_driver *edrv); |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * ipack_device_register -- register an IPack device with the kernel | 210 | * ipack_device_init -- initialize an IPack device |
211 | * @dev: the new device to register. | 211 | * @dev: the new device to initialize. |
212 | * | 212 | * |
213 | * Register a new IPack device ("module" in IndustryPack jargon). The call | 213 | * Initialize a new IPack device ("module" in IndustryPack jargon). The call |
214 | * is done by the carrier driver. The carrier should populate the fields | 214 | * is done by the carrier driver. The carrier should populate the fields |
215 | * bus and slot as well as the region array of @dev prior to calling this | 215 | * bus and slot as well as the region array of @dev prior to calling this |
216 | * function. The rest of the fields will be allocated and populated | 216 | * function. The rest of the fields will be allocated and populated |
217 | * during registration. | 217 | * during initalization. |
218 | * | 218 | * |
219 | * Return zero on success or error code on failure. | 219 | * Return zero on success or error code on failure. |
220 | * | ||
221 | * NOTE: _Never_ directly free @dev after calling this function, even | ||
222 | * if it returned an error! Always use ipack_put_device() to give up the | ||
223 | * reference initialized in this function instead. | ||
224 | */ | ||
225 | int ipack_device_init(struct ipack_device *dev); | ||
226 | |||
227 | /** | ||
228 | * ipack_device_add -- Add an IPack device | ||
229 | * @dev: the new device to add. | ||
230 | * | ||
231 | * Add a new IPack device. The call is done by the carrier driver | ||
232 | * after calling ipack_device_init(). | ||
233 | * | ||
234 | * Return zero on success or error code on failure. | ||
235 | * | ||
236 | * NOTE: _Never_ directly free @dev after calling this function, even | ||
237 | * if it returned an error! Always use ipack_put_device() to give up the | ||
238 | * reference initialized in this function instead. | ||
220 | */ | 239 | */ |
221 | int ipack_device_register(struct ipack_device *dev); | 240 | int ipack_device_add(struct ipack_device *dev); |
222 | void ipack_device_unregister(struct ipack_device *dev); | 241 | void ipack_device_del(struct ipack_device *dev); |
242 | |||
243 | void ipack_get_device(struct ipack_device *dev); | ||
244 | void ipack_put_device(struct ipack_device *dev); | ||
223 | 245 | ||
224 | /** | 246 | /** |
225 | * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table | 247 | * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index ae221a7b5092..c4d870b0d5e6 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -43,8 +43,8 @@ struct ipc_namespace { | |||
43 | 43 | ||
44 | size_t shm_ctlmax; | 44 | size_t shm_ctlmax; |
45 | size_t shm_ctlall; | 45 | size_t shm_ctlall; |
46 | unsigned long shm_tot; | ||
46 | int shm_ctlmni; | 47 | int shm_ctlmni; |
47 | int shm_tot; | ||
48 | /* | 48 | /* |
49 | * Defines whether IPC_RMID is forced for _all_ shm segments regardless | 49 | * Defines whether IPC_RMID is forced for _all_ shm segments regardless |
50 | * of shmctl() | 50 | * of shmctl() |
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 3fd8e4290a1c..3e203eb23cc7 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h | |||
@@ -65,7 +65,6 @@ extern struct irq_chip gic_arch_extn; | |||
65 | 65 | ||
66 | void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, | 66 | void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, |
67 | u32 offset, struct device_node *); | 67 | u32 offset, struct device_node *); |
68 | void gic_secondary_init(unsigned int); | ||
69 | void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); | 68 | void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); |
70 | 69 | ||
71 | static inline void gic_init(unsigned int nr, int start, | 70 | static inline void gic_init(unsigned int nr, int start, |
diff --git a/include/linux/irqchip/chained_irq.h b/include/linux/irqchip/chained_irq.h new file mode 100644 index 000000000000..adf4c30f3af6 --- /dev/null +++ b/include/linux/irqchip/chained_irq.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Chained IRQ handlers support. | ||
3 | * | ||
4 | * Copyright (C) 2011 ARM Ltd. | ||
5 | * | ||
6 | * This program is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | #ifndef __IRQCHIP_CHAINED_IRQ_H | ||
19 | #define __IRQCHIP_CHAINED_IRQ_H | ||
20 | |||
21 | #include <linux/irq.h> | ||
22 | |||
23 | /* | ||
24 | * Entry/exit functions for chained handlers where the primary IRQ chip | ||
25 | * may implement either fasteoi or level-trigger flow control. | ||
26 | */ | ||
27 | static inline void chained_irq_enter(struct irq_chip *chip, | ||
28 | struct irq_desc *desc) | ||
29 | { | ||
30 | /* FastEOI controllers require no action on entry. */ | ||
31 | if (chip->irq_eoi) | ||
32 | return; | ||
33 | |||
34 | if (chip->irq_mask_ack) { | ||
35 | chip->irq_mask_ack(&desc->irq_data); | ||
36 | } else { | ||
37 | chip->irq_mask(&desc->irq_data); | ||
38 | if (chip->irq_ack) | ||
39 | chip->irq_ack(&desc->irq_data); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | static inline void chained_irq_exit(struct irq_chip *chip, | ||
44 | struct irq_desc *desc) | ||
45 | { | ||
46 | if (chip->irq_eoi) | ||
47 | chip->irq_eoi(&desc->irq_data); | ||
48 | else | ||
49 | chip->irq_unmask(&desc->irq_data); | ||
50 | } | ||
51 | |||
52 | #endif /* __IRQCHIP_CHAINED_IRQ_H */ | ||
diff --git a/include/linux/irqchip/mxs.h b/include/linux/irqchip/mxs.h new file mode 100644 index 000000000000..9039a538a919 --- /dev/null +++ b/include/linux/irqchip/mxs.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_IRQCHIP_MXS_H | ||
10 | #define __LINUX_IRQCHIP_MXS_H | ||
11 | |||
12 | extern void icoll_handle_irq(struct pt_regs *); | ||
13 | |||
14 | #endif | ||
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index c8f32975f0e4..7e0b622503c4 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -887,7 +887,7 @@ extern struct kmem_cache *jbd_handle_cache; | |||
887 | 887 | ||
888 | static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) | 888 | static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) |
889 | { | 889 | { |
890 | return kmem_cache_alloc(jbd_handle_cache, gfp_flags); | 890 | return kmem_cache_zalloc(jbd_handle_cache, gfp_flags); |
891 | } | 891 | } |
892 | 892 | ||
893 | static inline void jbd_free_handle(handle_t *handle) | 893 | static inline void jbd_free_handle(handle_t *handle) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 50e5a5e6a712..6e051f472edb 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -480,6 +480,7 @@ struct transaction_s | |||
480 | T_COMMIT, | 480 | T_COMMIT, |
481 | T_COMMIT_DFLUSH, | 481 | T_COMMIT_DFLUSH, |
482 | T_COMMIT_JFLUSH, | 482 | T_COMMIT_JFLUSH, |
483 | T_COMMIT_CALLBACK, | ||
483 | T_FINISHED | 484 | T_FINISHED |
484 | } t_state; | 485 | } t_state; |
485 | 486 | ||
@@ -1144,7 +1145,7 @@ extern struct kmem_cache *jbd2_handle_cache; | |||
1144 | 1145 | ||
1145 | static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags) | 1146 | static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags) |
1146 | { | 1147 | { |
1147 | return kmem_cache_alloc(jbd2_handle_cache, gfp_flags); | 1148 | return kmem_cache_zalloc(jbd2_handle_cache, gfp_flags); |
1148 | } | 1149 | } |
1149 | 1150 | ||
1150 | static inline void jbd2_free_handle(handle_t *handle) | 1151 | static inline void jbd2_free_handle(handle_t *handle) |
@@ -1200,6 +1201,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t tid); | |||
1200 | int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); | 1201 | int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); |
1201 | int jbd2_journal_force_commit_nested(journal_t *journal); | 1202 | int jbd2_journal_force_commit_nested(journal_t *journal); |
1202 | int jbd2_log_wait_commit(journal_t *journal, tid_t tid); | 1203 | int jbd2_log_wait_commit(journal_t *journal, tid_t tid); |
1204 | int jbd2_complete_transaction(journal_t *journal, tid_t tid); | ||
1203 | int jbd2_log_do_checkpoint(journal_t *journal); | 1205 | int jbd2_log_do_checkpoint(journal_t *journal); |
1204 | int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid); | 1206 | int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid); |
1205 | 1207 | ||
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 82ed068b1ebe..8fb8edf12417 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -75,7 +75,6 @@ extern int register_refined_jiffies(long clock_tick_rate); | |||
75 | */ | 75 | */ |
76 | extern u64 __jiffy_data jiffies_64; | 76 | extern u64 __jiffy_data jiffies_64; |
77 | extern unsigned long volatile __jiffy_data jiffies; | 77 | extern unsigned long volatile __jiffy_data jiffies; |
78 | extern seqlock_t jiffies_lock; | ||
79 | 78 | ||
80 | #if (BITS_PER_LONG < 64) | 79 | #if (BITS_PER_LONG < 64) |
81 | u64 get_jiffies_64(void); | 80 | u64 get_jiffies_64(void); |
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h index c18b46f8aeeb..13a3da25ff07 100644 --- a/include/linux/journal-head.h +++ b/include/linux/journal-head.h | |||
@@ -31,21 +31,14 @@ struct journal_head { | |||
31 | /* | 31 | /* |
32 | * Journalling list for this buffer [jbd_lock_bh_state()] | 32 | * Journalling list for this buffer [jbd_lock_bh_state()] |
33 | */ | 33 | */ |
34 | unsigned b_jlist; | 34 | unsigned b_jlist:4; |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * This flag signals the buffer has been modified by | 37 | * This flag signals the buffer has been modified by |
38 | * the currently running transaction | 38 | * the currently running transaction |
39 | * [jbd_lock_bh_state()] | 39 | * [jbd_lock_bh_state()] |
40 | */ | 40 | */ |
41 | unsigned b_modified; | 41 | unsigned b_modified:1; |
42 | |||
43 | /* | ||
44 | * This feild tracks the last transaction id in which this buffer | ||
45 | * has been cowed | ||
46 | * [jbd_lock_bh_state()] | ||
47 | */ | ||
48 | tid_t b_cow_tid; | ||
49 | 42 | ||
50 | /* | 43 | /* |
51 | * Copy of the buffer data frozen for writing to the log. | 44 | * Copy of the buffer data frozen for writing to the log. |
diff --git a/include/linux/kcore.h b/include/linux/kcore.h new file mode 100644 index 000000000000..d92762286645 --- /dev/null +++ b/include/linux/kcore.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * /proc/kcore definitions | ||
3 | */ | ||
4 | #ifndef _LINUX_KCORE_H | ||
5 | #define _LINUX_KCORE_H | ||
6 | |||
7 | enum kcore_type { | ||
8 | KCORE_TEXT, | ||
9 | KCORE_VMALLOC, | ||
10 | KCORE_RAM, | ||
11 | KCORE_VMEMMAP, | ||
12 | KCORE_OTHER, | ||
13 | }; | ||
14 | |||
15 | struct kcore_list { | ||
16 | struct list_head list; | ||
17 | unsigned long addr; | ||
18 | size_t size; | ||
19 | int type; | ||
20 | }; | ||
21 | |||
22 | struct vmcore { | ||
23 | struct list_head list; | ||
24 | unsigned long long paddr; | ||
25 | unsigned long long size; | ||
26 | loff_t offset; | ||
27 | }; | ||
28 | |||
29 | #ifdef CONFIG_PROC_KCORE | ||
30 | extern void kclist_add(struct kcore_list *, void *, size_t, int type); | ||
31 | #else | ||
32 | static inline | ||
33 | void kclist_add(struct kcore_list *new, void *addr, size_t size, int type) | ||
34 | { | ||
35 | } | ||
36 | #endif | ||
37 | |||
38 | #endif /* _LINUX_KCORE_H */ | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 79fdd80a42d4..e96329ceb28c 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -486,6 +486,8 @@ enum ftrace_dump_mode { | |||
486 | void tracing_on(void); | 486 | void tracing_on(void); |
487 | void tracing_off(void); | 487 | void tracing_off(void); |
488 | int tracing_is_on(void); | 488 | int tracing_is_on(void); |
489 | void tracing_snapshot(void); | ||
490 | void tracing_snapshot_alloc(void); | ||
489 | 491 | ||
490 | extern void tracing_start(void); | 492 | extern void tracing_start(void); |
491 | extern void tracing_stop(void); | 493 | extern void tracing_stop(void); |
@@ -515,10 +517,32 @@ do { \ | |||
515 | * | 517 | * |
516 | * This is intended as a debugging tool for the developer only. | 518 | * This is intended as a debugging tool for the developer only. |
517 | * Please refrain from leaving trace_printks scattered around in | 519 | * Please refrain from leaving trace_printks scattered around in |
518 | * your code. | 520 | * your code. (Extra memory is used for special buffers that are |
521 | * allocated when trace_printk() is used) | ||
522 | * | ||
523 | * A little optization trick is done here. If there's only one | ||
524 | * argument, there's no need to scan the string for printf formats. | ||
525 | * The trace_puts() will suffice. But how can we take advantage of | ||
526 | * using trace_puts() when trace_printk() has only one argument? | ||
527 | * By stringifying the args and checking the size we can tell | ||
528 | * whether or not there are args. __stringify((__VA_ARGS__)) will | ||
529 | * turn into "()\0" with a size of 3 when there are no args, anything | ||
530 | * else will be bigger. All we need to do is define a string to this, | ||
531 | * and then take its size and compare to 3. If it's bigger, use | ||
532 | * do_trace_printk() otherwise, optimize it to trace_puts(). Then just | ||
533 | * let gcc optimize the rest. | ||
519 | */ | 534 | */ |
520 | 535 | ||
521 | #define trace_printk(fmt, args...) \ | 536 | #define trace_printk(fmt, ...) \ |
537 | do { \ | ||
538 | char _______STR[] = __stringify((__VA_ARGS__)); \ | ||
539 | if (sizeof(_______STR) > 3) \ | ||
540 | do_trace_printk(fmt, ##__VA_ARGS__); \ | ||
541 | else \ | ||
542 | trace_puts(fmt); \ | ||
543 | } while (0) | ||
544 | |||
545 | #define do_trace_printk(fmt, args...) \ | ||
522 | do { \ | 546 | do { \ |
523 | static const char *trace_printk_fmt \ | 547 | static const char *trace_printk_fmt \ |
524 | __attribute__((section("__trace_printk_fmt"))) = \ | 548 | __attribute__((section("__trace_printk_fmt"))) = \ |
@@ -538,7 +562,45 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...); | |||
538 | extern __printf(2, 3) | 562 | extern __printf(2, 3) |
539 | int __trace_printk(unsigned long ip, const char *fmt, ...); | 563 | int __trace_printk(unsigned long ip, const char *fmt, ...); |
540 | 564 | ||
541 | extern void trace_dump_stack(void); | 565 | /** |
566 | * trace_puts - write a string into the ftrace buffer | ||
567 | * @str: the string to record | ||
568 | * | ||
569 | * Note: __trace_bputs is an internal function for trace_puts and | ||
570 | * the @ip is passed in via the trace_puts macro. | ||
571 | * | ||
572 | * This is similar to trace_printk() but is made for those really fast | ||
573 | * paths that a developer wants the least amount of "Heisenbug" affects, | ||
574 | * where the processing of the print format is still too much. | ||
575 | * | ||
576 | * This function allows a kernel developer to debug fast path sections | ||
577 | * that printk is not appropriate for. By scattering in various | ||
578 | * printk like tracing in the code, a developer can quickly see | ||
579 | * where problems are occurring. | ||
580 | * | ||
581 | * This is intended as a debugging tool for the developer only. | ||
582 | * Please refrain from leaving trace_puts scattered around in | ||
583 | * your code. (Extra memory is used for special buffers that are | ||
584 | * allocated when trace_puts() is used) | ||
585 | * | ||
586 | * Returns: 0 if nothing was written, positive # if string was. | ||
587 | * (1 when __trace_bputs is used, strlen(str) when __trace_puts is used) | ||
588 | */ | ||
589 | |||
590 | extern int __trace_bputs(unsigned long ip, const char *str); | ||
591 | extern int __trace_puts(unsigned long ip, const char *str, int size); | ||
592 | #define trace_puts(str) ({ \ | ||
593 | static const char *trace_printk_fmt \ | ||
594 | __attribute__((section("__trace_printk_fmt"))) = \ | ||
595 | __builtin_constant_p(str) ? str : NULL; \ | ||
596 | \ | ||
597 | if (__builtin_constant_p(str)) \ | ||
598 | __trace_bputs(_THIS_IP_, trace_printk_fmt); \ | ||
599 | else \ | ||
600 | __trace_puts(_THIS_IP_, str, strlen(str)); \ | ||
601 | }) | ||
602 | |||
603 | extern void trace_dump_stack(int skip); | ||
542 | 604 | ||
543 | /* | 605 | /* |
544 | * The double __builtin_constant_p is because gcc will give us an error | 606 | * The double __builtin_constant_p is because gcc will give us an error |
@@ -573,6 +635,8 @@ static inline void trace_dump_stack(void) { } | |||
573 | static inline void tracing_on(void) { } | 635 | static inline void tracing_on(void) { } |
574 | static inline void tracing_off(void) { } | 636 | static inline void tracing_off(void) { } |
575 | static inline int tracing_is_on(void) { return 0; } | 637 | static inline int tracing_is_on(void) { return 0; } |
638 | static inline void tracing_snapshot(void) { } | ||
639 | static inline void tracing_snapshot_alloc(void) { } | ||
576 | 640 | ||
577 | static inline __printf(1, 2) | 641 | static inline __printf(1, 2) |
578 | int trace_printk(const char *fmt, ...) | 642 | int trace_printk(const char *fmt, ...) |
@@ -722,18 +786,9 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
722 | /* Trap pasters of __FUNCTION__ at compile-time */ | 786 | /* Trap pasters of __FUNCTION__ at compile-time */ |
723 | #define __FUNCTION__ (__func__) | 787 | #define __FUNCTION__ (__func__) |
724 | 788 | ||
725 | /* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */ | ||
726 | #ifdef CONFIG_SYMBOL_PREFIX | ||
727 | #define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
728 | #else | ||
729 | #define SYMBOL_PREFIX "" | ||
730 | #endif | ||
731 | |||
732 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ | 789 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ |
733 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 790 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
734 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | 791 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD |
735 | #endif | 792 | #endif |
736 | 793 | ||
737 | extern int do_sysinfo(struct sysinfo *info); | ||
738 | |||
739 | #endif | 794 | #endif |
diff --git a/include/linux/kmalloc_sizes.h b/include/linux/kmalloc_sizes.h deleted file mode 100644 index e576b848ce10..000000000000 --- a/include/linux/kmalloc_sizes.h +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | #if (PAGE_SIZE == 4096) | ||
2 | CACHE(32) | ||
3 | #endif | ||
4 | CACHE(64) | ||
5 | #if L1_CACHE_BYTES < 64 | ||
6 | CACHE(96) | ||
7 | #endif | ||
8 | CACHE(128) | ||
9 | #if L1_CACHE_BYTES < 128 | ||
10 | CACHE(192) | ||
11 | #endif | ||
12 | CACHE(256) | ||
13 | CACHE(512) | ||
14 | CACHE(1024) | ||
15 | CACHE(2048) | ||
16 | CACHE(4096) | ||
17 | CACHE(8192) | ||
18 | CACHE(16384) | ||
19 | CACHE(32768) | ||
20 | CACHE(65536) | ||
21 | CACHE(131072) | ||
22 | #if KMALLOC_MAX_SIZE >= 262144 | ||
23 | CACHE(262144) | ||
24 | #endif | ||
25 | #if KMALLOC_MAX_SIZE >= 524288 | ||
26 | CACHE(524288) | ||
27 | #endif | ||
28 | #if KMALLOC_MAX_SIZE >= 1048576 | ||
29 | CACHE(1048576) | ||
30 | #endif | ||
31 | #if KMALLOC_MAX_SIZE >= 2097152 | ||
32 | CACHE(2097152) | ||
33 | #endif | ||
34 | #if KMALLOC_MAX_SIZE >= 4194304 | ||
35 | CACHE(4194304) | ||
36 | #endif | ||
37 | #if KMALLOC_MAX_SIZE >= 8388608 | ||
38 | CACHE(8388608) | ||
39 | #endif | ||
40 | #if KMALLOC_MAX_SIZE >= 16777216 | ||
41 | CACHE(16777216) | ||
42 | #endif | ||
43 | #if KMALLOC_MAX_SIZE >= 33554432 | ||
44 | CACHE(33554432) | ||
45 | #endif | ||
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 5398d5807075..0555cc66a15b 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -67,16 +67,15 @@ struct subprocess_info { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | extern int | 69 | extern int |
70 | call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, | 70 | call_usermodehelper(char *path, char **argv, char **envp, int wait); |
71 | int (*init)(struct subprocess_info *info, struct cred *new), | ||
72 | void (*cleanup)(struct subprocess_info *), void *data); | ||
73 | 71 | ||
74 | static inline int | 72 | extern struct subprocess_info * |
75 | call_usermodehelper(char *path, char **argv, char **envp, int wait) | 73 | call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask, |
76 | { | 74 | int (*init)(struct subprocess_info *info, struct cred *new), |
77 | return call_usermodehelper_fns(path, argv, envp, wait, | 75 | void (*cleanup)(struct subprocess_info *), void *data); |
78 | NULL, NULL, NULL); | 76 | |
79 | } | 77 | extern int |
78 | call_usermodehelper_exec(struct subprocess_info *info, int wait); | ||
80 | 79 | ||
81 | extern struct ctl_table usermodehelper_table[]; | 80 | extern struct ctl_table usermodehelper_table[]; |
82 | 81 | ||
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 4b6ef4d33cc2..ca1d27a0d6a6 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -29,6 +29,7 @@ | |||
29 | * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi | 29 | * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi |
30 | * <prasanna@in.ibm.com> added function-return probes. | 30 | * <prasanna@in.ibm.com> added function-return probes. |
31 | */ | 31 | */ |
32 | #include <linux/compiler.h> /* for __kprobes */ | ||
32 | #include <linux/linkage.h> | 33 | #include <linux/linkage.h> |
33 | #include <linux/list.h> | 34 | #include <linux/list.h> |
34 | #include <linux/notifier.h> | 35 | #include <linux/notifier.h> |
@@ -49,16 +50,11 @@ | |||
49 | #define KPROBE_REENTER 0x00000004 | 50 | #define KPROBE_REENTER 0x00000004 |
50 | #define KPROBE_HIT_SSDONE 0x00000008 | 51 | #define KPROBE_HIT_SSDONE 0x00000008 |
51 | 52 | ||
52 | /* Attach to insert probes on any functions which should be ignored*/ | ||
53 | #define __kprobes __attribute__((__section__(".kprobes.text"))) | ||
54 | |||
55 | #else /* CONFIG_KPROBES */ | 53 | #else /* CONFIG_KPROBES */ |
56 | typedef int kprobe_opcode_t; | 54 | typedef int kprobe_opcode_t; |
57 | struct arch_specific_insn { | 55 | struct arch_specific_insn { |
58 | int dummy; | 56 | int dummy; |
59 | }; | 57 | }; |
60 | #define __kprobes | ||
61 | |||
62 | #endif /* CONFIG_KPROBES */ | 58 | #endif /* CONFIG_KPROBES */ |
63 | 59 | ||
64 | struct kprobe; | 60 | struct kprobe; |
diff --git a/include/linux/kref.h b/include/linux/kref.h index 4972e6e9ca93..e15828fd71f1 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
@@ -39,8 +39,11 @@ static inline void kref_init(struct kref *kref) | |||
39 | */ | 39 | */ |
40 | static inline void kref_get(struct kref *kref) | 40 | static inline void kref_get(struct kref *kref) |
41 | { | 41 | { |
42 | WARN_ON(!atomic_read(&kref->refcount)); | 42 | /* If refcount was 0 before incrementing then we have a race |
43 | atomic_inc(&kref->refcount); | 43 | * condition when this kref is freeing by some other thread right now. |
44 | * In this case one should use kref_get_unless_zero() | ||
45 | */ | ||
46 | WARN_ON_ONCE(atomic_inc_return(&kref->refcount) < 2); | ||
44 | } | 47 | } |
45 | 48 | ||
46 | /** | 49 | /** |
@@ -100,7 +103,7 @@ static inline int kref_put_mutex(struct kref *kref, | |||
100 | struct mutex *lock) | 103 | struct mutex *lock) |
101 | { | 104 | { |
102 | WARN_ON(release == NULL); | 105 | WARN_ON(release == NULL); |
103 | if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { | 106 | if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { |
104 | mutex_lock(lock); | 107 | mutex_lock(lock); |
105 | if (unlikely(!atomic_dec_and_test(&kref->refcount))) { | 108 | if (unlikely(!atomic_dec_and_test(&kref->refcount))) { |
106 | mutex_unlock(lock); | 109 | mutex_unlock(lock); |
diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 8d816646f766..7dcef3317689 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h | |||
@@ -43,6 +43,7 @@ bool kthread_should_stop(void); | |||
43 | bool kthread_should_park(void); | 43 | bool kthread_should_park(void); |
44 | bool kthread_freezable_should_stop(bool *was_frozen); | 44 | bool kthread_freezable_should_stop(bool *was_frozen); |
45 | void *kthread_data(struct task_struct *k); | 45 | void *kthread_data(struct task_struct *k); |
46 | void *probe_kthread_data(struct task_struct *k); | ||
46 | int kthread_park(struct task_struct *k); | 47 | int kthread_park(struct task_struct *k); |
47 | void kthread_unpark(struct task_struct *k); | 48 | void kthread_unpark(struct task_struct *k); |
48 | void kthread_parkme(void); | 49 | void kthread_parkme(void); |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index e83512f63df5..bbca12804d12 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -330,6 +330,24 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) | |||
330 | 330 | ||
331 | extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); | 331 | extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); |
332 | 332 | ||
333 | /** | ||
334 | * ktime_to_timespec_cond - convert a ktime_t variable to timespec | ||
335 | * format only if the variable contains data | ||
336 | * @kt: the ktime_t variable to convert | ||
337 | * @ts: the timespec variable to store the result in | ||
338 | * | ||
339 | * Returns true if there was a successful conversion, false if kt was 0. | ||
340 | */ | ||
341 | static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) | ||
342 | { | ||
343 | if (kt.tv64) { | ||
344 | *ts = ktime_to_timespec(kt); | ||
345 | return true; | ||
346 | } else { | ||
347 | return false; | ||
348 | } | ||
349 | } | ||
350 | |||
333 | /* | 351 | /* |
334 | * The resolution of the clocks. The resolution value is returned in | 352 | * The resolution of the clocks. The resolution value is returned in |
335 | * the clock_getres() system call to give application programmers an | 353 | * the clock_getres() system call to give application programmers an |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index c13958251927..f0eea07d2c2b 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -117,14 +117,13 @@ static inline bool is_error_page(struct page *page) | |||
117 | #define KVM_REQ_APF_HALT 12 | 117 | #define KVM_REQ_APF_HALT 12 |
118 | #define KVM_REQ_STEAL_UPDATE 13 | 118 | #define KVM_REQ_STEAL_UPDATE 13 |
119 | #define KVM_REQ_NMI 14 | 119 | #define KVM_REQ_NMI 14 |
120 | #define KVM_REQ_IMMEDIATE_EXIT 15 | 120 | #define KVM_REQ_PMU 15 |
121 | #define KVM_REQ_PMU 16 | 121 | #define KVM_REQ_PMI 16 |
122 | #define KVM_REQ_PMI 17 | 122 | #define KVM_REQ_WATCHDOG 17 |
123 | #define KVM_REQ_WATCHDOG 18 | 123 | #define KVM_REQ_MASTERCLOCK_UPDATE 18 |
124 | #define KVM_REQ_MASTERCLOCK_UPDATE 19 | 124 | #define KVM_REQ_MCLOCK_INPROGRESS 19 |
125 | #define KVM_REQ_MCLOCK_INPROGRESS 20 | 125 | #define KVM_REQ_EPR_EXIT 20 |
126 | #define KVM_REQ_EPR_EXIT 21 | 126 | #define KVM_REQ_SCAN_IOAPIC 21 |
127 | #define KVM_REQ_EOIBITMAP 22 | ||
128 | 127 | ||
129 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 128 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
130 | #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 | 129 | #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 |
@@ -133,6 +132,9 @@ struct kvm; | |||
133 | struct kvm_vcpu; | 132 | struct kvm_vcpu; |
134 | extern struct kmem_cache *kvm_vcpu_cache; | 133 | extern struct kmem_cache *kvm_vcpu_cache; |
135 | 134 | ||
135 | extern raw_spinlock_t kvm_lock; | ||
136 | extern struct list_head vm_list; | ||
137 | |||
136 | struct kvm_io_range { | 138 | struct kvm_io_range { |
137 | gpa_t addr; | 139 | gpa_t addr; |
138 | int len; | 140 | int len; |
@@ -149,6 +151,7 @@ struct kvm_io_bus { | |||
149 | enum kvm_bus { | 151 | enum kvm_bus { |
150 | KVM_MMIO_BUS, | 152 | KVM_MMIO_BUS, |
151 | KVM_PIO_BUS, | 153 | KVM_PIO_BUS, |
154 | KVM_VIRTIO_CCW_NOTIFY_BUS, | ||
152 | KVM_NR_BUSES | 155 | KVM_NR_BUSES |
153 | }; | 156 | }; |
154 | 157 | ||
@@ -252,6 +255,7 @@ struct kvm_vcpu { | |||
252 | bool dy_eligible; | 255 | bool dy_eligible; |
253 | } spin_loop; | 256 | } spin_loop; |
254 | #endif | 257 | #endif |
258 | bool preempted; | ||
255 | struct kvm_vcpu_arch arch; | 259 | struct kvm_vcpu_arch arch; |
256 | }; | 260 | }; |
257 | 261 | ||
@@ -285,7 +289,8 @@ struct kvm_kernel_irq_routing_entry { | |||
285 | u32 gsi; | 289 | u32 gsi; |
286 | u32 type; | 290 | u32 type; |
287 | int (*set)(struct kvm_kernel_irq_routing_entry *e, | 291 | int (*set)(struct kvm_kernel_irq_routing_entry *e, |
288 | struct kvm *kvm, int irq_source_id, int level); | 292 | struct kvm *kvm, int irq_source_id, int level, |
293 | bool line_status); | ||
289 | union { | 294 | union { |
290 | struct { | 295 | struct { |
291 | unsigned irqchip; | 296 | unsigned irqchip; |
@@ -296,10 +301,10 @@ struct kvm_kernel_irq_routing_entry { | |||
296 | struct hlist_node link; | 301 | struct hlist_node link; |
297 | }; | 302 | }; |
298 | 303 | ||
299 | #ifdef __KVM_HAVE_IOAPIC | 304 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING |
300 | 305 | ||
301 | struct kvm_irq_routing_table { | 306 | struct kvm_irq_routing_table { |
302 | int chip[KVM_NR_IRQCHIPS][KVM_IOAPIC_NUM_PINS]; | 307 | int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS]; |
303 | struct kvm_kernel_irq_routing_entry *rt_entries; | 308 | struct kvm_kernel_irq_routing_entry *rt_entries; |
304 | u32 nr_rt_entries; | 309 | u32 nr_rt_entries; |
305 | /* | 310 | /* |
@@ -385,6 +390,7 @@ struct kvm { | |||
385 | long mmu_notifier_count; | 390 | long mmu_notifier_count; |
386 | #endif | 391 | #endif |
387 | long tlbs_dirty; | 392 | long tlbs_dirty; |
393 | struct list_head devices; | ||
388 | }; | 394 | }; |
389 | 395 | ||
390 | #define kvm_err(fmt, ...) \ | 396 | #define kvm_err(fmt, ...) \ |
@@ -424,6 +430,19 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | |||
424 | int __must_check vcpu_load(struct kvm_vcpu *vcpu); | 430 | int __must_check vcpu_load(struct kvm_vcpu *vcpu); |
425 | void vcpu_put(struct kvm_vcpu *vcpu); | 431 | void vcpu_put(struct kvm_vcpu *vcpu); |
426 | 432 | ||
433 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING | ||
434 | int kvm_irqfd_init(void); | ||
435 | void kvm_irqfd_exit(void); | ||
436 | #else | ||
437 | static inline int kvm_irqfd_init(void) | ||
438 | { | ||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | static inline void kvm_irqfd_exit(void) | ||
443 | { | ||
444 | } | ||
445 | #endif | ||
427 | int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, | 446 | int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, |
428 | struct module *module); | 447 | struct module *module); |
429 | void kvm_exit(void); | 448 | void kvm_exit(void); |
@@ -452,24 +471,39 @@ id_to_memslot(struct kvm_memslots *slots, int id) | |||
452 | return slot; | 471 | return slot; |
453 | } | 472 | } |
454 | 473 | ||
474 | /* | ||
475 | * KVM_SET_USER_MEMORY_REGION ioctl allows the following operations: | ||
476 | * - create a new memory slot | ||
477 | * - delete an existing memory slot | ||
478 | * - modify an existing memory slot | ||
479 | * -- move it in the guest physical memory space | ||
480 | * -- just change its flags | ||
481 | * | ||
482 | * Since flags can be changed by some of these operations, the following | ||
483 | * differentiation is the best we can do for __kvm_set_memory_region(): | ||
484 | */ | ||
485 | enum kvm_mr_change { | ||
486 | KVM_MR_CREATE, | ||
487 | KVM_MR_DELETE, | ||
488 | KVM_MR_MOVE, | ||
489 | KVM_MR_FLAGS_ONLY, | ||
490 | }; | ||
491 | |||
455 | int kvm_set_memory_region(struct kvm *kvm, | 492 | int kvm_set_memory_region(struct kvm *kvm, |
456 | struct kvm_userspace_memory_region *mem, | 493 | struct kvm_userspace_memory_region *mem); |
457 | bool user_alloc); | ||
458 | int __kvm_set_memory_region(struct kvm *kvm, | 494 | int __kvm_set_memory_region(struct kvm *kvm, |
459 | struct kvm_userspace_memory_region *mem, | 495 | struct kvm_userspace_memory_region *mem); |
460 | bool user_alloc); | ||
461 | void kvm_arch_free_memslot(struct kvm_memory_slot *free, | 496 | void kvm_arch_free_memslot(struct kvm_memory_slot *free, |
462 | struct kvm_memory_slot *dont); | 497 | struct kvm_memory_slot *dont); |
463 | int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); | 498 | int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); |
464 | int kvm_arch_prepare_memory_region(struct kvm *kvm, | 499 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
465 | struct kvm_memory_slot *memslot, | 500 | struct kvm_memory_slot *memslot, |
466 | struct kvm_memory_slot old, | ||
467 | struct kvm_userspace_memory_region *mem, | 501 | struct kvm_userspace_memory_region *mem, |
468 | bool user_alloc); | 502 | enum kvm_mr_change change); |
469 | void kvm_arch_commit_memory_region(struct kvm *kvm, | 503 | void kvm_arch_commit_memory_region(struct kvm *kvm, |
470 | struct kvm_userspace_memory_region *mem, | 504 | struct kvm_userspace_memory_region *mem, |
471 | struct kvm_memory_slot old, | 505 | const struct kvm_memory_slot *old, |
472 | bool user_alloc); | 506 | enum kvm_mr_change change); |
473 | bool kvm_largepages_enabled(void); | 507 | bool kvm_largepages_enabled(void); |
474 | void kvm_disable_largepages(void); | 508 | void kvm_disable_largepages(void); |
475 | /* flush all memory translations */ | 509 | /* flush all memory translations */ |
@@ -539,7 +573,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); | |||
539 | void kvm_flush_remote_tlbs(struct kvm *kvm); | 573 | void kvm_flush_remote_tlbs(struct kvm *kvm); |
540 | void kvm_reload_remote_mmus(struct kvm *kvm); | 574 | void kvm_reload_remote_mmus(struct kvm *kvm); |
541 | void kvm_make_mclock_inprogress_request(struct kvm *kvm); | 575 | void kvm_make_mclock_inprogress_request(struct kvm *kvm); |
542 | void kvm_make_update_eoibitmap_request(struct kvm *kvm); | 576 | void kvm_make_scan_ioapic_request(struct kvm *kvm); |
543 | 577 | ||
544 | long kvm_arch_dev_ioctl(struct file *filp, | 578 | long kvm_arch_dev_ioctl(struct file *filp, |
545 | unsigned int ioctl, unsigned long arg); | 579 | unsigned int ioctl, unsigned long arg); |
@@ -555,10 +589,9 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
555 | struct kvm_dirty_log *log); | 589 | struct kvm_dirty_log *log); |
556 | 590 | ||
557 | int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, | 591 | int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, |
558 | struct | 592 | struct kvm_userspace_memory_region *mem); |
559 | kvm_userspace_memory_region *mem, | 593 | int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level, |
560 | bool user_alloc); | 594 | bool line_status); |
561 | int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level); | ||
562 | long kvm_arch_vm_ioctl(struct file *filp, | 595 | long kvm_arch_vm_ioctl(struct file *filp, |
563 | unsigned int ioctl, unsigned long arg); | 596 | unsigned int ioctl, unsigned long arg); |
564 | 597 | ||
@@ -632,7 +665,6 @@ static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) | |||
632 | 665 | ||
633 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); | 666 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); |
634 | void kvm_arch_destroy_vm(struct kvm *kvm); | 667 | void kvm_arch_destroy_vm(struct kvm *kvm); |
635 | void kvm_free_all_assigned_devices(struct kvm *kvm); | ||
636 | void kvm_arch_sync_events(struct kvm *kvm); | 668 | void kvm_arch_sync_events(struct kvm *kvm); |
637 | 669 | ||
638 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); | 670 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); |
@@ -684,15 +716,11 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, | |||
684 | void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, | 716 | void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, |
685 | bool mask); | 717 | bool mask); |
686 | 718 | ||
687 | #ifdef __KVM_HAVE_IOAPIC | 719 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, |
688 | void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, | 720 | bool line_status); |
689 | union kvm_ioapic_redirect_entry *entry, | ||
690 | unsigned long *deliver_bitmask); | ||
691 | #endif | ||
692 | int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level); | ||
693 | int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); | 721 | int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); |
694 | int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, | 722 | int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, |
695 | int irq_source_id, int level); | 723 | int irq_source_id, int level, bool line_status); |
696 | bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin); | 724 | bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin); |
697 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); | 725 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); |
698 | void kvm_register_irq_ack_notifier(struct kvm *kvm, | 726 | void kvm_register_irq_ack_notifier(struct kvm *kvm, |
@@ -705,7 +733,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
705 | /* For vcpu->arch.iommu_flags */ | 733 | /* For vcpu->arch.iommu_flags */ |
706 | #define KVM_IOMMU_CACHE_COHERENCY 0x1 | 734 | #define KVM_IOMMU_CACHE_COHERENCY 0x1 |
707 | 735 | ||
708 | #ifdef CONFIG_IOMMU_API | 736 | #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT |
709 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 737 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
710 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 738 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
711 | int kvm_iommu_map_guest(struct kvm *kvm); | 739 | int kvm_iommu_map_guest(struct kvm *kvm); |
@@ -714,7 +742,7 @@ int kvm_assign_device(struct kvm *kvm, | |||
714 | struct kvm_assigned_dev_kernel *assigned_dev); | 742 | struct kvm_assigned_dev_kernel *assigned_dev); |
715 | int kvm_deassign_device(struct kvm *kvm, | 743 | int kvm_deassign_device(struct kvm *kvm, |
716 | struct kvm_assigned_dev_kernel *assigned_dev); | 744 | struct kvm_assigned_dev_kernel *assigned_dev); |
717 | #else /* CONFIG_IOMMU_API */ | 745 | #else |
718 | static inline int kvm_iommu_map_pages(struct kvm *kvm, | 746 | static inline int kvm_iommu_map_pages(struct kvm *kvm, |
719 | struct kvm_memory_slot *slot) | 747 | struct kvm_memory_slot *slot) |
720 | { | 748 | { |
@@ -726,28 +754,11 @@ static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | |||
726 | { | 754 | { |
727 | } | 755 | } |
728 | 756 | ||
729 | static inline int kvm_iommu_map_guest(struct kvm *kvm) | ||
730 | { | ||
731 | return -ENODEV; | ||
732 | } | ||
733 | |||
734 | static inline int kvm_iommu_unmap_guest(struct kvm *kvm) | 757 | static inline int kvm_iommu_unmap_guest(struct kvm *kvm) |
735 | { | 758 | { |
736 | return 0; | 759 | return 0; |
737 | } | 760 | } |
738 | 761 | #endif | |
739 | static inline int kvm_assign_device(struct kvm *kvm, | ||
740 | struct kvm_assigned_dev_kernel *assigned_dev) | ||
741 | { | ||
742 | return 0; | ||
743 | } | ||
744 | |||
745 | static inline int kvm_deassign_device(struct kvm *kvm, | ||
746 | struct kvm_assigned_dev_kernel *assigned_dev) | ||
747 | { | ||
748 | return 0; | ||
749 | } | ||
750 | #endif /* CONFIG_IOMMU_API */ | ||
751 | 762 | ||
752 | static inline void __guest_enter(void) | 763 | static inline void __guest_enter(void) |
753 | { | 764 | { |
@@ -921,7 +932,7 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq) | |||
921 | } | 932 | } |
922 | #endif | 933 | #endif |
923 | 934 | ||
924 | #ifdef KVM_CAP_IRQ_ROUTING | 935 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING |
925 | 936 | ||
926 | #define KVM_MAX_IRQ_ROUTES 1024 | 937 | #define KVM_MAX_IRQ_ROUTES 1024 |
927 | 938 | ||
@@ -930,6 +941,9 @@ int kvm_set_irq_routing(struct kvm *kvm, | |||
930 | const struct kvm_irq_routing_entry *entries, | 941 | const struct kvm_irq_routing_entry *entries, |
931 | unsigned nr, | 942 | unsigned nr, |
932 | unsigned flags); | 943 | unsigned flags); |
944 | int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, | ||
945 | struct kvm_kernel_irq_routing_entry *e, | ||
946 | const struct kvm_irq_routing_entry *ue); | ||
933 | void kvm_free_irq_routing(struct kvm *kvm); | 947 | void kvm_free_irq_routing(struct kvm *kvm); |
934 | 948 | ||
935 | int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi); | 949 | int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi); |
@@ -998,11 +1012,13 @@ static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; } | |||
998 | 1012 | ||
999 | #endif | 1013 | #endif |
1000 | 1014 | ||
1001 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT | 1015 | #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT |
1002 | 1016 | ||
1003 | long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | 1017 | long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, |
1004 | unsigned long arg); | 1018 | unsigned long arg); |
1005 | 1019 | ||
1020 | void kvm_free_all_assigned_devices(struct kvm *kvm); | ||
1021 | |||
1006 | #else | 1022 | #else |
1007 | 1023 | ||
1008 | static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | 1024 | static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, |
@@ -1011,6 +1027,8 @@ static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | |||
1011 | return -ENOTTY; | 1027 | return -ENOTTY; |
1012 | } | 1028 | } |
1013 | 1029 | ||
1030 | static inline void kvm_free_all_assigned_devices(struct kvm *kvm) {} | ||
1031 | |||
1014 | #endif | 1032 | #endif |
1015 | 1033 | ||
1016 | static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) | 1034 | static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) |
@@ -1028,6 +1046,46 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) | |||
1028 | } | 1046 | } |
1029 | } | 1047 | } |
1030 | 1048 | ||
1049 | extern bool kvm_rebooting; | ||
1050 | |||
1051 | struct kvm_device_ops; | ||
1052 | |||
1053 | struct kvm_device { | ||
1054 | struct kvm_device_ops *ops; | ||
1055 | struct kvm *kvm; | ||
1056 | void *private; | ||
1057 | struct list_head vm_node; | ||
1058 | }; | ||
1059 | |||
1060 | /* create, destroy, and name are mandatory */ | ||
1061 | struct kvm_device_ops { | ||
1062 | const char *name; | ||
1063 | int (*create)(struct kvm_device *dev, u32 type); | ||
1064 | |||
1065 | /* | ||
1066 | * Destroy is responsible for freeing dev. | ||
1067 | * | ||
1068 | * Destroy may be called before or after destructors are called | ||
1069 | * on emulated I/O regions, depending on whether a reference is | ||
1070 | * held by a vcpu or other kvm component that gets destroyed | ||
1071 | * after the emulated I/O. | ||
1072 | */ | ||
1073 | void (*destroy)(struct kvm_device *dev); | ||
1074 | |||
1075 | int (*set_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); | ||
1076 | int (*get_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); | ||
1077 | int (*has_attr)(struct kvm_device *dev, struct kvm_device_attr *attr); | ||
1078 | long (*ioctl)(struct kvm_device *dev, unsigned int ioctl, | ||
1079 | unsigned long arg); | ||
1080 | }; | ||
1081 | |||
1082 | void kvm_device_get(struct kvm_device *dev); | ||
1083 | void kvm_device_put(struct kvm_device *dev); | ||
1084 | struct kvm_device *kvm_device_from_filp(struct file *filp); | ||
1085 | |||
1086 | extern struct kvm_device_ops kvm_mpic_ops; | ||
1087 | extern struct kvm_device_ops kvm_xics_ops; | ||
1088 | |||
1031 | #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT | 1089 | #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT |
1032 | 1090 | ||
1033 | static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) | 1091 | static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val) |
diff --git a/include/linux/leds.h b/include/linux/leds.h index 0d9b5eed714e..0287ab296689 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -142,6 +142,10 @@ extern void led_set_brightness(struct led_classdev *led_cdev, | |||
142 | /* | 142 | /* |
143 | * LED Triggers | 143 | * LED Triggers |
144 | */ | 144 | */ |
145 | /* Registration functions for simple triggers */ | ||
146 | #define DEFINE_LED_TRIGGER(x) static struct led_trigger *x; | ||
147 | #define DEFINE_LED_TRIGGER_GLOBAL(x) struct led_trigger *x; | ||
148 | |||
145 | #ifdef CONFIG_LEDS_TRIGGERS | 149 | #ifdef CONFIG_LEDS_TRIGGERS |
146 | 150 | ||
147 | #define TRIG_NAME_MAX 50 | 151 | #define TRIG_NAME_MAX 50 |
@@ -164,9 +168,6 @@ struct led_trigger { | |||
164 | extern int led_trigger_register(struct led_trigger *trigger); | 168 | extern int led_trigger_register(struct led_trigger *trigger); |
165 | extern void led_trigger_unregister(struct led_trigger *trigger); | 169 | extern void led_trigger_unregister(struct led_trigger *trigger); |
166 | 170 | ||
167 | /* Registration functions for simple triggers */ | ||
168 | #define DEFINE_LED_TRIGGER(x) static struct led_trigger *x; | ||
169 | #define DEFINE_LED_TRIGGER_GLOBAL(x) struct led_trigger *x; | ||
170 | extern void led_trigger_register_simple(const char *name, | 171 | extern void led_trigger_register_simple(const char *name, |
171 | struct led_trigger **trigger); | 172 | struct led_trigger **trigger); |
172 | extern void led_trigger_unregister_simple(struct led_trigger *trigger); | 173 | extern void led_trigger_unregister_simple(struct led_trigger *trigger); |
@@ -199,20 +200,30 @@ extern void led_trigger_rename_static(const char *name, | |||
199 | 200 | ||
200 | #else | 201 | #else |
201 | 202 | ||
202 | /* Triggers aren't active - null macros */ | 203 | /* Trigger has no members */ |
203 | #define DEFINE_LED_TRIGGER(x) | 204 | struct led_trigger {}; |
204 | #define DEFINE_LED_TRIGGER_GLOBAL(x) | ||
205 | #define led_trigger_register_simple(x, y) do {} while(0) | ||
206 | #define led_trigger_unregister_simple(x) do {} while(0) | ||
207 | #define led_trigger_event(x, y) do {} while(0) | ||
208 | 205 | ||
209 | #endif | 206 | /* Trigger inline empty functions */ |
207 | static inline void led_trigger_register_simple(const char *name, | ||
208 | struct led_trigger **trigger) {} | ||
209 | static inline void led_trigger_unregister_simple(struct led_trigger *trigger) {} | ||
210 | static inline void led_trigger_event(struct led_trigger *trigger, | ||
211 | enum led_brightness event) {} | ||
212 | #endif /* CONFIG_LEDS_TRIGGERS */ | ||
210 | 213 | ||
211 | /* Trigger specific functions */ | 214 | /* Trigger specific functions */ |
212 | #ifdef CONFIG_LEDS_TRIGGER_IDE_DISK | 215 | #ifdef CONFIG_LEDS_TRIGGER_IDE_DISK |
213 | extern void ledtrig_ide_activity(void); | 216 | extern void ledtrig_ide_activity(void); |
214 | #else | 217 | #else |
215 | #define ledtrig_ide_activity() do {} while(0) | 218 | static inline void ledtrig_ide_activity(void) {} |
219 | #endif | ||
220 | |||
221 | #if defined(CONFIG_LEDS_TRIGGER_CAMERA) || defined(CONFIG_LEDS_TRIGGER_CAMERA_MODULE) | ||
222 | extern void ledtrig_flash_ctrl(bool on); | ||
223 | extern void ledtrig_torch_ctrl(bool on); | ||
224 | #else | ||
225 | static inline void ledtrig_flash_ctrl(bool on) {} | ||
226 | static inline void ledtrig_torch_ctrl(bool on) {} | ||
216 | #endif | 227 | #endif |
217 | 228 | ||
218 | /* | 229 | /* |
diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 807f1e533226..d3e8ad23a8e0 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _LINUX_LINKAGE_H | 2 | #define _LINUX_LINKAGE_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/stringify.h> | ||
6 | #include <linux/export.h> | ||
5 | #include <asm/linkage.h> | 7 | #include <asm/linkage.h> |
6 | 8 | ||
7 | #ifdef __cplusplus | 9 | #ifdef __cplusplus |
@@ -14,6 +16,20 @@ | |||
14 | #define asmlinkage CPP_ASMLINKAGE | 16 | #define asmlinkage CPP_ASMLINKAGE |
15 | #endif | 17 | #endif |
16 | 18 | ||
19 | #ifndef cond_syscall | ||
20 | #define cond_syscall(x) asm( \ | ||
21 | ".weak " VMLINUX_SYMBOL_STR(x) "\n\t" \ | ||
22 | ".set " VMLINUX_SYMBOL_STR(x) "," \ | ||
23 | VMLINUX_SYMBOL_STR(sys_ni_syscall)) | ||
24 | #endif | ||
25 | |||
26 | #ifndef SYSCALL_ALIAS | ||
27 | #define SYSCALL_ALIAS(alias, name) asm( \ | ||
28 | ".globl " VMLINUX_SYMBOL_STR(alias) "\n\t" \ | ||
29 | ".set " VMLINUX_SYMBOL_STR(alias) "," \ | ||
30 | VMLINUX_SYMBOL_STR(name)) | ||
31 | #endif | ||
32 | |||
17 | #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) | 33 | #define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE) |
18 | #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) | 34 | #define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE) |
19 | 35 | ||
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index 31f9d75adc5b..2eb88556c5c5 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h | |||
@@ -125,6 +125,11 @@ static inline void hlist_bl_unlock(struct hlist_bl_head *b) | |||
125 | __bit_spin_unlock(0, (unsigned long *)b); | 125 | __bit_spin_unlock(0, (unsigned long *)b); |
126 | } | 126 | } |
127 | 127 | ||
128 | static inline bool hlist_bl_is_locked(struct hlist_bl_head *b) | ||
129 | { | ||
130 | return bit_spin_is_locked(0, (unsigned long *)b); | ||
131 | } | ||
132 | |||
128 | /** | 133 | /** |
129 | * hlist_bl_for_each_entry - iterate over list of given type | 134 | * hlist_bl_for_each_entry - iterate over list of given type |
130 | * @tpos: the type * to use as a loop cursor. | 135 | * @tpos: the type * to use as a loop cursor. |
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h index 4019013c6593..46262284de47 100644 --- a/include/linux/lru_cache.h +++ b/include/linux/lru_cache.h | |||
@@ -256,6 +256,7 @@ extern void lc_destroy(struct lru_cache *lc); | |||
256 | extern void lc_set(struct lru_cache *lc, unsigned int enr, int index); | 256 | extern void lc_set(struct lru_cache *lc, unsigned int enr, int index); |
257 | extern void lc_del(struct lru_cache *lc, struct lc_element *element); | 257 | extern void lc_del(struct lru_cache *lc, struct lc_element *element); |
258 | 258 | ||
259 | extern struct lc_element *lc_get_cumulative(struct lru_cache *lc, unsigned int enr); | ||
259 | extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr); | 260 | extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr); |
260 | extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); | 261 | extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); |
261 | extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); | 262 | extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); |
diff --git a/include/linux/mbus.h b/include/linux/mbus.h index efa1a6d7aca8..dba482e31a13 100644 --- a/include/linux/mbus.h +++ b/include/linux/mbus.h | |||
@@ -32,6 +32,20 @@ struct mbus_dram_target_info | |||
32 | } cs[4]; | 32 | } cs[4]; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | /* Flags for PCI/PCIe address decoding regions */ | ||
36 | #define MVEBU_MBUS_PCI_IO 0x1 | ||
37 | #define MVEBU_MBUS_PCI_MEM 0x2 | ||
38 | #define MVEBU_MBUS_PCI_WA 0x3 | ||
39 | |||
40 | /* | ||
41 | * Magic value that explicits that we don't need a remapping-capable | ||
42 | * address decoding window. | ||
43 | */ | ||
44 | #define MVEBU_MBUS_NO_REMAP (0xffffffff) | ||
45 | |||
46 | /* Maximum size of a mbus window name */ | ||
47 | #define MVEBU_MBUS_MAX_WINNAME_SZ 32 | ||
48 | |||
35 | /* | 49 | /* |
36 | * The Marvell mbus is to be found only on SOCs from the Orion family | 50 | * The Marvell mbus is to be found only on SOCs from the Orion family |
37 | * at the moment. Provide a dummy stub for other architectures. | 51 | * at the moment. Provide a dummy stub for other architectures. |
@@ -44,4 +58,15 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void) | |||
44 | return NULL; | 58 | return NULL; |
45 | } | 59 | } |
46 | #endif | 60 | #endif |
47 | #endif | 61 | |
62 | int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base, | ||
63 | size_t size, phys_addr_t remap, | ||
64 | unsigned int flags); | ||
65 | int mvebu_mbus_add_window(const char *devname, phys_addr_t base, | ||
66 | size_t size); | ||
67 | int mvebu_mbus_del_window(phys_addr_t base, size_t size); | ||
68 | int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, | ||
69 | size_t mbus_size, phys_addr_t sdram_phys_base, | ||
70 | size_t sdram_size); | ||
71 | |||
72 | #endif /* __LINUX_MBUS_H */ | ||
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h new file mode 100644 index 000000000000..d14af7b722ef --- /dev/null +++ b/include/linux/mei_cl_bus.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _LINUX_MEI_CL_BUS_H | ||
2 | #define _LINUX_MEI_CL_BUS_H | ||
3 | |||
4 | #include <linux/device.h> | ||
5 | #include <linux/uuid.h> | ||
6 | |||
7 | struct mei_cl_device; | ||
8 | |||
9 | struct mei_cl_driver { | ||
10 | struct device_driver driver; | ||
11 | const char *name; | ||
12 | |||
13 | const struct mei_cl_device_id *id_table; | ||
14 | |||
15 | int (*probe)(struct mei_cl_device *dev, | ||
16 | const struct mei_cl_device_id *id); | ||
17 | int (*remove)(struct mei_cl_device *dev); | ||
18 | }; | ||
19 | |||
20 | int __mei_cl_driver_register(struct mei_cl_driver *driver, | ||
21 | struct module *owner); | ||
22 | #define mei_cl_driver_register(driver) \ | ||
23 | __mei_cl_driver_register(driver, THIS_MODULE) | ||
24 | |||
25 | void mei_cl_driver_unregister(struct mei_cl_driver *driver); | ||
26 | |||
27 | int mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length); | ||
28 | int mei_cl_recv(struct mei_cl_device *device, u8 *buf, size_t length); | ||
29 | |||
30 | typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device, | ||
31 | u32 events, void *context); | ||
32 | int mei_cl_register_event_cb(struct mei_cl_device *device, | ||
33 | mei_cl_event_cb_t read_cb, void *context); | ||
34 | |||
35 | #define MEI_CL_EVENT_RX 0 | ||
36 | #define MEI_CL_EVENT_TX 1 | ||
37 | |||
38 | void *mei_cl_get_drvdata(const struct mei_cl_device *device); | ||
39 | void mei_cl_set_drvdata(struct mei_cl_device *device, void *data); | ||
40 | |||
41 | int mei_cl_enable_device(struct mei_cl_device *device); | ||
42 | int mei_cl_disable_device(struct mei_cl_device *device); | ||
43 | |||
44 | #endif /* _LINUX_MEI_CL_BUS_H */ | ||
diff --git a/include/linux/memory.h b/include/linux/memory.h index 45e93b468878..85c31a8e2904 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/node.h> | 18 | #include <linux/node.h> |
19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | #include <linux/notifier.h> | ||
21 | 22 | ||
22 | #define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS) | 23 | #define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS) |
23 | 24 | ||
@@ -114,9 +115,10 @@ extern void unregister_memory_notifier(struct notifier_block *nb); | |||
114 | extern int register_memory_isolate_notifier(struct notifier_block *nb); | 115 | extern int register_memory_isolate_notifier(struct notifier_block *nb); |
115 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); | 116 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); |
116 | extern int register_new_memory(int, struct mem_section *); | 117 | extern int register_new_memory(int, struct mem_section *); |
118 | #ifdef CONFIG_MEMORY_HOTREMOVE | ||
117 | extern int unregister_memory_section(struct mem_section *); | 119 | extern int unregister_memory_section(struct mem_section *); |
120 | #endif | ||
118 | extern int memory_dev_init(void); | 121 | extern int memory_dev_init(void); |
119 | extern int remove_memory_block(unsigned long, struct mem_section *, int); | ||
120 | extern int memory_notify(unsigned long val, void *v); | 122 | extern int memory_notify(unsigned long val, void *v); |
121 | extern int memory_isolate_notify(unsigned long val, void *v); | 123 | extern int memory_isolate_notify(unsigned long val, void *v); |
122 | extern struct memory_block *find_memory_block_hinted(struct mem_section *, | 124 | extern struct memory_block *find_memory_block_hinted(struct mem_section *, |
@@ -127,13 +129,18 @@ enum mem_add_context { BOOT, HOTPLUG }; | |||
127 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ | 129 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
128 | 130 | ||
129 | #ifdef CONFIG_MEMORY_HOTPLUG | 131 | #ifdef CONFIG_MEMORY_HOTPLUG |
130 | #define hotplug_memory_notifier(fn, pri) { \ | 132 | #define hotplug_memory_notifier(fn, pri) ({ \ |
131 | static __meminitdata struct notifier_block fn##_mem_nb =\ | 133 | static __meminitdata struct notifier_block fn##_mem_nb =\ |
132 | { .notifier_call = fn, .priority = pri }; \ | 134 | { .notifier_call = fn, .priority = pri };\ |
133 | register_memory_notifier(&fn##_mem_nb); \ | 135 | register_memory_notifier(&fn##_mem_nb); \ |
134 | } | 136 | }) |
137 | #define register_hotmemory_notifier(nb) register_memory_notifier(nb) | ||
138 | #define unregister_hotmemory_notifier(nb) unregister_memory_notifier(nb) | ||
135 | #else | 139 | #else |
136 | #define hotplug_memory_notifier(fn, pri) do { } while (0) | 140 | #define hotplug_memory_notifier(fn, pri) ({ 0; }) |
141 | /* These aren't inline functions due to a GCC bug. */ | ||
142 | #define register_hotmemory_notifier(nb) ({ (void)(nb); 0; }) | ||
143 | #define unregister_hotmemory_notifier(nb) ({ (void)(nb); }) | ||
137 | #endif | 144 | #endif |
138 | 145 | ||
139 | /* | 146 | /* |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index b6a3be7d47bf..3e622c610925 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -97,13 +97,13 @@ extern void __online_page_free(struct page *page); | |||
97 | #ifdef CONFIG_MEMORY_HOTREMOVE | 97 | #ifdef CONFIG_MEMORY_HOTREMOVE |
98 | extern bool is_pageblock_removable_nolock(struct page *page); | 98 | extern bool is_pageblock_removable_nolock(struct page *page); |
99 | extern int arch_remove_memory(u64 start, u64 size); | 99 | extern int arch_remove_memory(u64 start, u64 size); |
100 | extern int __remove_pages(struct zone *zone, unsigned long start_pfn, | ||
101 | unsigned long nr_pages); | ||
100 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | 102 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
101 | 103 | ||
102 | /* reasonably generic interface to expand the physical pages in a zone */ | 104 | /* reasonably generic interface to expand the physical pages in a zone */ |
103 | extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, | 105 | extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, |
104 | unsigned long nr_pages); | 106 | unsigned long nr_pages); |
105 | extern int __remove_pages(struct zone *zone, unsigned long start_pfn, | ||
106 | unsigned long nr_pages); | ||
107 | 107 | ||
108 | #ifdef CONFIG_NUMA | 108 | #ifdef CONFIG_NUMA |
109 | extern int memory_add_physaddr_to_nid(u64 start); | 109 | extern int memory_add_physaddr_to_nid(u64 start); |
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 9ead60bc66b7..3301b2031c8d 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h | |||
@@ -89,6 +89,11 @@ struct abx500_fg; | |||
89 | * points. | 89 | * points. |
90 | * @maint_thres This is the threshold where we stop reporting | 90 | * @maint_thres This is the threshold where we stop reporting |
91 | * battery full while in maintenance, in per cent | 91 | * battery full while in maintenance, in per cent |
92 | * @pcut_enable: Enable power cut feature in ab8505 | ||
93 | * @pcut_max_time: Max time threshold | ||
94 | * @pcut_flag_time: Flagtime threshold | ||
95 | * @pcut_max_restart: Max number of restarts | ||
96 | * @pcut_debounce_time: Sets battery debounce time | ||
92 | */ | 97 | */ |
93 | struct abx500_fg_parameters { | 98 | struct abx500_fg_parameters { |
94 | int recovery_sleep_timer; | 99 | int recovery_sleep_timer; |
@@ -106,6 +111,11 @@ struct abx500_fg_parameters { | |||
106 | int battok_raising_th_sel1; | 111 | int battok_raising_th_sel1; |
107 | int user_cap_limit; | 112 | int user_cap_limit; |
108 | int maint_thres; | 113 | int maint_thres; |
114 | bool pcut_enable; | ||
115 | u8 pcut_max_time; | ||
116 | u8 pcut_flag_time; | ||
117 | u8 pcut_max_restart; | ||
118 | u8 pcut_debounce_time; | ||
109 | }; | 119 | }; |
110 | 120 | ||
111 | /** | 121 | /** |
@@ -173,11 +183,11 @@ struct abx500_battery_type { | |||
173 | int low_high_vol_lvl; | 183 | int low_high_vol_lvl; |
174 | int battery_resistance; | 184 | int battery_resistance; |
175 | int n_temp_tbl_elements; | 185 | int n_temp_tbl_elements; |
176 | struct abx500_res_to_temp *r_to_t_tbl; | 186 | const struct abx500_res_to_temp *r_to_t_tbl; |
177 | int n_v_cap_tbl_elements; | 187 | int n_v_cap_tbl_elements; |
178 | struct abx500_v_to_cap *v_to_cap_tbl; | 188 | const struct abx500_v_to_cap *v_to_cap_tbl; |
179 | int n_batres_tbl_elements; | 189 | int n_batres_tbl_elements; |
180 | struct batres_vs_temp *batres_tbl; | 190 | const struct batres_vs_temp *batres_tbl; |
181 | }; | 191 | }; |
182 | 192 | ||
183 | /** | 193 | /** |
@@ -236,7 +246,11 @@ struct abx500_bm_charger_parameters { | |||
236 | * @interval_not_charging charge alg cycle period time when not charging (sec) | 246 | * @interval_not_charging charge alg cycle period time when not charging (sec) |
237 | * @temp_hysteresis temperature hysteresis | 247 | * @temp_hysteresis temperature hysteresis |
238 | * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm) | 248 | * @gnd_lift_resistance Battery ground to phone ground resistance (mOhm) |
239 | * @maxi: maximization parameters | 249 | * @n_chg_out_curr number of elements in array chg_output_curr |
250 | * @n_chg_in_curr number of elements in array chg_input_curr | ||
251 | * @chg_output_curr charger output current level map | ||
252 | * @chg_input_curr charger input current level map | ||
253 | * @maxi maximization parameters | ||
240 | * @cap_levels capacity in percent for the different capacity levels | 254 | * @cap_levels capacity in percent for the different capacity levels |
241 | * @bat_type table of supported battery types | 255 | * @bat_type table of supported battery types |
242 | * @chg_params charger parameters | 256 | * @chg_params charger parameters |
@@ -257,6 +271,7 @@ struct abx500_bm_data { | |||
257 | bool autopower_cfg; | 271 | bool autopower_cfg; |
258 | bool ac_enabled; | 272 | bool ac_enabled; |
259 | bool usb_enabled; | 273 | bool usb_enabled; |
274 | bool usb_power_path; | ||
260 | bool no_maintenance; | 275 | bool no_maintenance; |
261 | bool capacity_scaling; | 276 | bool capacity_scaling; |
262 | bool chg_unknown_bat; | 277 | bool chg_unknown_bat; |
@@ -270,6 +285,10 @@ struct abx500_bm_data { | |||
270 | int interval_not_charging; | 285 | int interval_not_charging; |
271 | int temp_hysteresis; | 286 | int temp_hysteresis; |
272 | int gnd_lift_resistance; | 287 | int gnd_lift_resistance; |
288 | int n_chg_out_curr; | ||
289 | int n_chg_in_curr; | ||
290 | int *chg_output_curr; | ||
291 | int *chg_input_curr; | ||
273 | const struct abx500_maxim_parameters *maxi; | 292 | const struct abx500_maxim_parameters *maxi; |
274 | const struct abx500_bm_capacity_levels *cap_levels; | 293 | const struct abx500_bm_capacity_levels *cap_levels; |
275 | struct abx500_battery_type *bat_type; | 294 | struct abx500_battery_type *bat_type; |
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index 8d35bfe164c8..cc892a8d8d6e 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h | |||
@@ -23,6 +23,7 @@ | |||
23 | * Bank : 0x5 | 23 | * Bank : 0x5 |
24 | */ | 24 | */ |
25 | #define AB8500_USB_LINE_STAT_REG 0x80 | 25 | #define AB8500_USB_LINE_STAT_REG 0x80 |
26 | #define AB8500_USB_LINE_CTRL2_REG 0x82 | ||
26 | #define AB8500_USB_LINK1_STAT_REG 0x94 | 27 | #define AB8500_USB_LINK1_STAT_REG 0x94 |
27 | 28 | ||
28 | /* | 29 | /* |
@@ -33,7 +34,7 @@ | |||
33 | #define AB8500_CH_STATUS2_REG 0x01 | 34 | #define AB8500_CH_STATUS2_REG 0x01 |
34 | #define AB8500_CH_USBCH_STAT1_REG 0x02 | 35 | #define AB8500_CH_USBCH_STAT1_REG 0x02 |
35 | #define AB8500_CH_USBCH_STAT2_REG 0x03 | 36 | #define AB8500_CH_USBCH_STAT2_REG 0x03 |
36 | #define AB8500_CH_FSM_STAT_REG 0x04 | 37 | #define AB8540_CH_USBCH_STAT3_REG 0x04 |
37 | #define AB8500_CH_STAT_REG 0x05 | 38 | #define AB8500_CH_STAT_REG 0x05 |
38 | 39 | ||
39 | /* | 40 | /* |
@@ -69,6 +70,8 @@ | |||
69 | #define AB8500_USBCH_CTRL1_REG 0xC0 | 70 | #define AB8500_USBCH_CTRL1_REG 0xC0 |
70 | #define AB8500_USBCH_CTRL2_REG 0xC1 | 71 | #define AB8500_USBCH_CTRL2_REG 0xC1 |
71 | #define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2 | 72 | #define AB8500_USBCH_IPT_CRNTLVL_REG 0xC2 |
73 | #define AB8540_USB_PP_MODE_REG 0xC5 | ||
74 | #define AB8540_USB_PP_CHR_REG 0xC6 | ||
72 | 75 | ||
73 | /* | 76 | /* |
74 | * Gas Gauge register offsets | 77 | * Gas Gauge register offsets |
@@ -105,6 +108,7 @@ | |||
105 | #define AB8500_RTC_BACKUP_CHG_REG 0x0C | 108 | #define AB8500_RTC_BACKUP_CHG_REG 0x0C |
106 | #define AB8500_RTC_CC_CONF_REG 0x01 | 109 | #define AB8500_RTC_CC_CONF_REG 0x01 |
107 | #define AB8500_RTC_CTRL_REG 0x0B | 110 | #define AB8500_RTC_CTRL_REG 0x0B |
111 | #define AB8500_RTC_CTRL1_REG 0x11 | ||
108 | 112 | ||
109 | /* | 113 | /* |
110 | * OTP register offsets | 114 | * OTP register offsets |
@@ -154,6 +158,7 @@ | |||
154 | #define CH_OP_CUR_LVL_1P4 0x0D | 158 | #define CH_OP_CUR_LVL_1P4 0x0D |
155 | #define CH_OP_CUR_LVL_1P5 0x0E | 159 | #define CH_OP_CUR_LVL_1P5 0x0E |
156 | #define CH_OP_CUR_LVL_1P6 0x0F | 160 | #define CH_OP_CUR_LVL_1P6 0x0F |
161 | #define CH_OP_CUR_LVL_2P 0x3F | ||
157 | 162 | ||
158 | /* BTEMP High thermal limits */ | 163 | /* BTEMP High thermal limits */ |
159 | #define BTEMP_HIGH_TH_57_0 0x00 | 164 | #define BTEMP_HIGH_TH_57_0 0x00 |
@@ -179,10 +184,25 @@ | |||
179 | #define BUP_ICH_SEL_300UA 0x08 | 184 | #define BUP_ICH_SEL_300UA 0x08 |
180 | #define BUP_ICH_SEL_700UA 0x0C | 185 | #define BUP_ICH_SEL_700UA 0x0C |
181 | 186 | ||
182 | #define BUP_VCH_SEL_2P5V 0x00 | 187 | enum bup_vch_sel { |
183 | #define BUP_VCH_SEL_2P6V 0x01 | 188 | BUP_VCH_SEL_2P5V, |
184 | #define BUP_VCH_SEL_2P8V 0x02 | 189 | BUP_VCH_SEL_2P6V, |
185 | #define BUP_VCH_SEL_3P1V 0x03 | 190 | BUP_VCH_SEL_2P8V, |
191 | BUP_VCH_SEL_3P1V, | ||
192 | /* | ||
193 | * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v | ||
194 | * are only available on ab8540. You can't choose these 5 | ||
195 | * voltage on ab8500/ab8505/ab9540. | ||
196 | */ | ||
197 | BUP_VCH_SEL_2P7V, | ||
198 | BUP_VCH_SEL_2P9V, | ||
199 | BUP_VCH_SEL_3P0V, | ||
200 | BUP_VCH_SEL_3P2V, | ||
201 | BUP_VCH_SEL_3P3V, | ||
202 | }; | ||
203 | |||
204 | #define BUP_VCH_RANGE 0x02 | ||
205 | #define VBUP33_VRTCN 0x01 | ||
186 | 206 | ||
187 | /* Battery OVV constants */ | 207 | /* Battery OVV constants */ |
188 | #define BATT_OVV_ENA 0x02 | 208 | #define BATT_OVV_ENA 0x02 |
@@ -228,6 +248,8 @@ | |||
228 | #define BAT_CTRL_20U_ENA 0x02 | 248 | #define BAT_CTRL_20U_ENA 0x02 |
229 | #define BAT_CTRL_18U_ENA 0x01 | 249 | #define BAT_CTRL_18U_ENA 0x01 |
230 | #define BAT_CTRL_16U_ENA 0x02 | 250 | #define BAT_CTRL_16U_ENA 0x02 |
251 | #define BAT_CTRL_60U_ENA 0x01 | ||
252 | #define BAT_CTRL_120U_ENA 0x02 | ||
231 | #define BAT_CTRL_CMP_ENA 0x04 | 253 | #define BAT_CTRL_CMP_ENA 0x04 |
232 | #define FORCE_BAT_CTRL_CMP_HIGH 0x08 | 254 | #define FORCE_BAT_CTRL_CMP_HIGH 0x08 |
233 | #define BAT_CTRL_PULL_UP_ENA 0x10 | 255 | #define BAT_CTRL_PULL_UP_ENA 0x10 |
@@ -235,6 +257,24 @@ | |||
235 | /* Battery type */ | 257 | /* Battery type */ |
236 | #define BATTERY_UNKNOWN 00 | 258 | #define BATTERY_UNKNOWN 00 |
237 | 259 | ||
260 | /* Registers for pcut feature in ab8505 and ab9540 */ | ||
261 | #define AB8505_RTC_PCUT_CTL_STATUS_REG 0x12 | ||
262 | #define AB8505_RTC_PCUT_TIME_REG 0x13 | ||
263 | #define AB8505_RTC_PCUT_MAX_TIME_REG 0x14 | ||
264 | #define AB8505_RTC_PCUT_FLAG_TIME_REG 0x15 | ||
265 | #define AB8505_RTC_PCUT_RESTART_REG 0x16 | ||
266 | #define AB8505_RTC_PCUT_DEBOUNCE_REG 0x17 | ||
267 | |||
268 | /* USB Power Path constants for ab8540 */ | ||
269 | #define BUS_VSYS_VOL_SELECT_MASK 0x06 | ||
270 | #define BUS_VSYS_VOL_SELECT_3P6V 0x00 | ||
271 | #define BUS_VSYS_VOL_SELECT_3P325V 0x02 | ||
272 | #define BUS_VSYS_VOL_SELECT_3P9V 0x04 | ||
273 | #define BUS_VSYS_VOL_SELECT_4P3V 0x06 | ||
274 | #define BUS_POWER_PATH_MODE_ENA 0x01 | ||
275 | #define BUS_PP_PRECHG_CURRENT_MASK 0x0E | ||
276 | #define BUS_POWER_PATH_PRECHG_ENA 0x01 | ||
277 | |||
238 | /** | 278 | /** |
239 | * struct res_to_temp - defines one point in a temp to res curve. To | 279 | * struct res_to_temp - defines one point in a temp to res curve. To |
240 | * be used in battery packs that combines the identification resistor with a | 280 | * be used in battery packs that combines the identification resistor with a |
@@ -283,6 +323,11 @@ struct ab8500_fg; | |||
283 | * points. | 323 | * points. |
284 | * @maint_thres This is the threshold where we stop reporting | 324 | * @maint_thres This is the threshold where we stop reporting |
285 | * battery full while in maintenance, in per cent | 325 | * battery full while in maintenance, in per cent |
326 | * @pcut_enable: Enable power cut feature in ab8505 | ||
327 | * @pcut_max_time: Max time threshold | ||
328 | * @pcut_flag_time: Flagtime threshold | ||
329 | * @pcut_max_restart: Max number of restarts | ||
330 | * @pcut_debunce_time: Sets battery debounce time | ||
286 | */ | 331 | */ |
287 | struct ab8500_fg_parameters { | 332 | struct ab8500_fg_parameters { |
288 | int recovery_sleep_timer; | 333 | int recovery_sleep_timer; |
@@ -299,6 +344,11 @@ struct ab8500_fg_parameters { | |||
299 | int battok_raising_th_sel1; | 344 | int battok_raising_th_sel1; |
300 | int user_cap_limit; | 345 | int user_cap_limit; |
301 | int maint_thres; | 346 | int maint_thres; |
347 | bool pcut_enable; | ||
348 | u8 pcut_max_time; | ||
349 | u8 pcut_flag_time; | ||
350 | u8 pcut_max_restart; | ||
351 | u8 pcut_debunce_time; | ||
302 | }; | 352 | }; |
303 | 353 | ||
304 | /** | 354 | /** |
@@ -415,6 +465,7 @@ void ab8500_fg_reinit(void); | |||
415 | void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); | 465 | void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); |
416 | struct ab8500_btemp *ab8500_btemp_get(void); | 466 | struct ab8500_btemp *ab8500_btemp_get(void); |
417 | int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); | 467 | int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); |
468 | int ab8500_btemp_get_temp(struct ab8500_btemp *btemp); | ||
418 | struct ab8500_fg *ab8500_fg_get(void); | 469 | struct ab8500_fg *ab8500_fg_get(void); |
419 | int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); | 470 | int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); |
420 | int ab8500_fg_inst_curr_start(struct ab8500_fg *di); | 471 | int ab8500_fg_inst_curr_start(struct ab8500_fg *di); |
diff --git a/include/linux/mfd/abx500/ab8500-gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h index 252966769d93..49ded001049b 100644 --- a/include/linux/mfd/abx500/ab8500-gpadc.h +++ b/include/linux/mfd/abx500/ab8500-gpadc.h | |||
@@ -4,32 +4,72 @@ | |||
4 | * | 4 | * |
5 | * Author: Arun R Murthy <arun.murthy@stericsson.com> | 5 | * Author: Arun R Murthy <arun.murthy@stericsson.com> |
6 | * Author: Daniel Willerud <daniel.willerud@stericsson.com> | 6 | * Author: Daniel Willerud <daniel.willerud@stericsson.com> |
7 | * Author: M'boumba Cedric Madianga <cedric.madianga@stericsson.com> | ||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #ifndef _AB8500_GPADC_H | 10 | #ifndef _AB8500_GPADC_H |
10 | #define _AB8500_GPADC_H | 11 | #define _AB8500_GPADC_H |
11 | 12 | ||
12 | /* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */ | 13 | /* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2 |
13 | #define BAT_CTRL 0x01 | 14 | * and ADCHwSel[4:0] in GPADCCtrl3 ) */ |
14 | #define BTEMP_BALL 0x02 | 15 | #define BAT_CTRL 0x01 |
15 | #define MAIN_CHARGER_V 0x03 | 16 | #define BTEMP_BALL 0x02 |
16 | #define ACC_DETECT1 0x04 | 17 | #define MAIN_CHARGER_V 0x03 |
17 | #define ACC_DETECT2 0x05 | 18 | #define ACC_DETECT1 0x04 |
18 | #define ADC_AUX1 0x06 | 19 | #define ACC_DETECT2 0x05 |
19 | #define ADC_AUX2 0x07 | 20 | #define ADC_AUX1 0x06 |
20 | #define MAIN_BAT_V 0x08 | 21 | #define ADC_AUX2 0x07 |
21 | #define VBUS_V 0x09 | 22 | #define MAIN_BAT_V 0x08 |
22 | #define MAIN_CHARGER_C 0x0A | 23 | #define VBUS_V 0x09 |
23 | #define USB_CHARGER_C 0x0B | 24 | #define MAIN_CHARGER_C 0x0A |
24 | #define BK_BAT_V 0x0C | 25 | #define USB_CHARGER_C 0x0B |
25 | #define DIE_TEMP 0x0D | 26 | #define BK_BAT_V 0x0C |
27 | #define DIE_TEMP 0x0D | ||
28 | #define USB_ID 0x0E | ||
29 | #define XTAL_TEMP 0x12 | ||
30 | #define VBAT_TRUE_MEAS 0x13 | ||
31 | #define BAT_CTRL_AND_IBAT 0x1C | ||
32 | #define VBAT_MEAS_AND_IBAT 0x1D | ||
33 | #define VBAT_TRUE_MEAS_AND_IBAT 0x1E | ||
34 | #define BAT_TEMP_AND_IBAT 0x1F | ||
35 | |||
36 | /* Virtual channel used only for ibat convertion to ampere | ||
37 | * Battery current conversion (ibat) cannot be requested as a single conversion | ||
38 | * but it is always in combination with other input requests | ||
39 | */ | ||
40 | #define IBAT_VIRTUAL_CHANNEL 0xFF | ||
41 | |||
42 | #define SAMPLE_1 1 | ||
43 | #define SAMPLE_4 4 | ||
44 | #define SAMPLE_8 8 | ||
45 | #define SAMPLE_16 16 | ||
46 | #define RISING_EDGE 0 | ||
47 | #define FALLING_EDGE 1 | ||
48 | |||
49 | /* Arbitrary ADC conversion type constants */ | ||
50 | #define ADC_SW 0 | ||
51 | #define ADC_HW 1 | ||
26 | 52 | ||
27 | struct ab8500_gpadc; | 53 | struct ab8500_gpadc; |
28 | 54 | ||
29 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); | 55 | struct ab8500_gpadc *ab8500_gpadc_get(char *name); |
30 | int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel); | 56 | int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel, |
31 | int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel); | 57 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); |
58 | static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel) | ||
59 | { | ||
60 | return ab8500_gpadc_sw_hw_convert(gpadc, channel, | ||
61 | SAMPLE_16, 0, 0, ADC_SW); | ||
62 | } | ||
63 | |||
64 | int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | ||
65 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); | ||
66 | int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel, | ||
67 | u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type, | ||
68 | int *ibat); | ||
32 | int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, | 69 | int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, |
33 | u8 channel, int ad_value); | 70 | u8 channel, int ad_value); |
71 | void ab8540_gpadc_get_otp(struct ab8500_gpadc *gpadc, | ||
72 | u16 *vmain_l, u16 *vmain_h, u16 *btemp_l, u16 *btemp_h, | ||
73 | u16 *vbat_l, u16 *vbat_h, u16 *ibat_l, u16 *ibat_h); | ||
34 | 74 | ||
35 | #endif /* _AB8500_GPADC_H */ | 75 | #endif /* _AB8500_GPADC_H */ |
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h index ebf12e793db9..990bc93f46e1 100644 --- a/include/linux/mfd/abx500/ab8500-sysctrl.h +++ b/include/linux/mfd/abx500/ab8500-sysctrl.h | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | int ab8500_sysctrl_read(u16 reg, u8 *value); | 13 | int ab8500_sysctrl_read(u16 reg, u8 *value); |
14 | int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value); | 14 | int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value); |
15 | void ab8500_restart(char mode, const char *cmd); | ||
15 | 16 | ||
16 | #else | 17 | #else |
17 | 18 | ||
@@ -40,6 +41,7 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits) | |||
40 | /* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */ | 41 | /* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */ |
41 | struct ab8500_sysctrl_platform_data { | 42 | struct ab8500_sysctrl_platform_data { |
42 | u8 initial_req_buf_config[8]; | 43 | u8 initial_req_buf_config[8]; |
44 | u16 (*reboot_reason_code)(const char *cmd); | ||
43 | }; | 45 | }; |
44 | 46 | ||
45 | /* Registers */ | 47 | /* Registers */ |
@@ -299,4 +301,8 @@ struct ab8500_sysctrl_platform_data { | |||
299 | #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF | 301 | #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF |
300 | #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0 | 302 | #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0 |
301 | 303 | ||
304 | #define AB8500_ENABLE_WD 0x1 | ||
305 | #define AB8500_KICK_WD 0x2 | ||
306 | #define AB8500_WD_RESTART_ON_EXPIRE 0x10 | ||
307 | |||
302 | #endif /* __AB8500_SYSCTRL_H */ | 308 | #endif /* __AB8500_SYSCTRL_H */ |
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 9db0bda446a0..fb1bf7d6a410 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h | |||
@@ -362,10 +362,10 @@ struct ab8500 { | |||
362 | u8 *oldmask; | 362 | u8 *oldmask; |
363 | int mask_size; | 363 | int mask_size; |
364 | const int *irq_reg_offset; | 364 | const int *irq_reg_offset; |
365 | int it_latchhier_num; | ||
365 | }; | 366 | }; |
366 | 367 | ||
367 | struct regulator_reg_init; | 368 | struct ab8500_regulator_platform_data; |
368 | struct regulator_init_data; | ||
369 | struct ab8500_gpio_platform_data; | 369 | struct ab8500_gpio_platform_data; |
370 | struct ab8500_codec_platform_data; | 370 | struct ab8500_codec_platform_data; |
371 | struct ab8500_sysctrl_platform_data; | 371 | struct ab8500_sysctrl_platform_data; |
@@ -375,19 +375,13 @@ struct ab8500_sysctrl_platform_data; | |||
375 | * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used | 375 | * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used |
376 | * @pm_power_off: Should machine pm power off hook be registered or not | 376 | * @pm_power_off: Should machine pm power off hook be registered or not |
377 | * @init: board-specific initialization after detection of ab8500 | 377 | * @init: board-specific initialization after detection of ab8500 |
378 | * @num_regulator_reg_init: number of regulator init registers | ||
379 | * @regulator_reg_init: regulator init registers | ||
380 | * @num_regulator: number of regulators | ||
381 | * @regulator: machine-specific constraints for regulators | 378 | * @regulator: machine-specific constraints for regulators |
382 | */ | 379 | */ |
383 | struct ab8500_platform_data { | 380 | struct ab8500_platform_data { |
384 | int irq_base; | 381 | int irq_base; |
385 | bool pm_power_off; | 382 | bool pm_power_off; |
386 | void (*init) (struct ab8500 *); | 383 | void (*init) (struct ab8500 *); |
387 | int num_regulator_reg_init; | 384 | struct ab8500_regulator_platform_data *regulator; |
388 | struct ab8500_regulator_reg_init *regulator_reg_init; | ||
389 | int num_regulator; | ||
390 | struct regulator_init_data *regulator; | ||
391 | struct abx500_gpio_platform_data *gpio; | 385 | struct abx500_gpio_platform_data *gpio; |
392 | struct ab8500_codec_platform_data *codec; | 386 | struct ab8500_codec_platform_data *codec; |
393 | struct ab8500_sysctrl_platform_data *sysctrl; | 387 | struct ab8500_sysctrl_platform_data *sysctrl; |
@@ -512,6 +506,8 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab) | |||
512 | return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0)); | 506 | return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0)); |
513 | } | 507 | } |
514 | 508 | ||
509 | void ab8500_override_turn_on_stat(u8 mask, u8 set); | ||
510 | |||
515 | #ifdef CONFIG_AB8500_DEBUG | 511 | #ifdef CONFIG_AB8500_DEBUG |
516 | void ab8500_dump_all_banks(struct device *dev); | 512 | void ab8500_dump_all_banks(struct device *dev); |
517 | void ab8500_debug_register_interrupt(int line); | 513 | void ab8500_debug_register_interrupt(int line); |
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h index d43ac0f35526..234c99143bf7 100644 --- a/include/linux/mfd/abx500/ux500_chargalg.h +++ b/include/linux/mfd/abx500/ux500_chargalg.h | |||
@@ -17,8 +17,11 @@ struct ux500_charger; | |||
17 | 17 | ||
18 | struct ux500_charger_ops { | 18 | struct ux500_charger_ops { |
19 | int (*enable) (struct ux500_charger *, int, int, int); | 19 | int (*enable) (struct ux500_charger *, int, int, int); |
20 | int (*check_enable) (struct ux500_charger *, int, int); | ||
20 | int (*kick_wd) (struct ux500_charger *); | 21 | int (*kick_wd) (struct ux500_charger *); |
21 | int (*update_curr) (struct ux500_charger *, int); | 22 | int (*update_curr) (struct ux500_charger *, int); |
23 | int (*pp_enable) (struct ux500_charger *, bool); | ||
24 | int (*pre_chg_enable) (struct ux500_charger *, bool); | ||
22 | }; | 25 | }; |
23 | 26 | ||
24 | /** | 27 | /** |
@@ -29,6 +32,7 @@ struct ux500_charger_ops { | |||
29 | * @max_out_curr maximum output charger current in mA | 32 | * @max_out_curr maximum output charger current in mA |
30 | * @enabled indicates if this charger is used or not | 33 | * @enabled indicates if this charger is used or not |
31 | * @external external charger unit (pm2xxx) | 34 | * @external external charger unit (pm2xxx) |
35 | * @power_path USB power path support | ||
32 | */ | 36 | */ |
33 | struct ux500_charger { | 37 | struct ux500_charger { |
34 | struct power_supply psy; | 38 | struct power_supply psy; |
@@ -38,6 +42,9 @@ struct ux500_charger { | |||
38 | int wdt_refresh; | 42 | int wdt_refresh; |
39 | bool enabled; | 43 | bool enabled; |
40 | bool external; | 44 | bool external; |
45 | bool power_path; | ||
41 | }; | 46 | }; |
42 | 47 | ||
48 | extern struct blocking_notifier_head charger_notifier_list; | ||
49 | |||
43 | #endif | 50 | #endif |
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h index a710255528d7..cc281368dc55 100644 --- a/include/linux/mfd/arizona/core.h +++ b/include/linux/mfd/arizona/core.h | |||
@@ -100,6 +100,9 @@ struct arizona { | |||
100 | struct regmap_irq_chip_data *aod_irq_chip; | 100 | struct regmap_irq_chip_data *aod_irq_chip; |
101 | struct regmap_irq_chip_data *irq_chip; | 101 | struct regmap_irq_chip_data *irq_chip; |
102 | 102 | ||
103 | bool hpdet_magic; | ||
104 | unsigned int hp_ena; | ||
105 | |||
103 | struct mutex clk_lock; | 106 | struct mutex clk_lock; |
104 | int clk32k_ref; | 107 | int clk32k_ref; |
105 | 108 | ||
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 455c51d22d6b..80dead1f7100 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h | |||
@@ -78,6 +78,7 @@ struct arizona_micbias { | |||
78 | unsigned int ext_cap:1; /** External capacitor fitted */ | 78 | unsigned int ext_cap:1; /** External capacitor fitted */ |
79 | unsigned int discharge:1; /** Actively discharge */ | 79 | unsigned int discharge:1; /** Actively discharge */ |
80 | unsigned int fast_start:1; /** Enable aggressive startup ramp rate */ | 80 | unsigned int fast_start:1; /** Enable aggressive startup ramp rate */ |
81 | unsigned int bypass:1; /** Use bypass mode */ | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | struct arizona_micd_config { | 84 | struct arizona_micd_config { |
@@ -86,6 +87,11 @@ struct arizona_micd_config { | |||
86 | bool gpio; | 87 | bool gpio; |
87 | }; | 88 | }; |
88 | 89 | ||
90 | struct arizona_micd_range { | ||
91 | int max; /** Ohms */ | ||
92 | int key; /** Key to report to input layer */ | ||
93 | }; | ||
94 | |||
89 | struct arizona_pdata { | 95 | struct arizona_pdata { |
90 | int reset; /** GPIO controlling /RESET, if any */ | 96 | int reset; /** GPIO controlling /RESET, if any */ |
91 | int ldoena; /** GPIO controlling LODENA, if any */ | 97 | int ldoena; /** GPIO controlling LODENA, if any */ |
@@ -99,7 +105,8 @@ struct arizona_pdata { | |||
99 | /** If a direct 32kHz clock is provided on an MCLK specify it here */ | 105 | /** If a direct 32kHz clock is provided on an MCLK specify it here */ |
100 | int clk32k_src; | 106 | int clk32k_src; |
101 | 107 | ||
102 | bool irq_active_high; /** IRQ polarity */ | 108 | /** Mode for primary IRQ (defaults to active low) */ |
109 | unsigned int irq_flags; | ||
103 | 110 | ||
104 | /* Base GPIO */ | 111 | /* Base GPIO */ |
105 | int gpio_base; | 112 | int gpio_base; |
@@ -117,12 +124,21 @@ struct arizona_pdata { | |||
117 | /** GPIO5 is used for jack detection */ | 124 | /** GPIO5 is used for jack detection */ |
118 | bool jd_gpio5; | 125 | bool jd_gpio5; |
119 | 126 | ||
127 | /** Internal pull on GPIO5 is disabled when used for jack detection */ | ||
128 | bool jd_gpio5_nopull; | ||
129 | |||
120 | /** Use the headphone detect circuit to identify the accessory */ | 130 | /** Use the headphone detect circuit to identify the accessory */ |
121 | bool hpdet_acc_id; | 131 | bool hpdet_acc_id; |
122 | 132 | ||
133 | /** Check for line output with HPDET method */ | ||
134 | bool hpdet_acc_id_line; | ||
135 | |||
123 | /** GPIO used for mic isolation with HPDET */ | 136 | /** GPIO used for mic isolation with HPDET */ |
124 | int hpdet_id_gpio; | 137 | int hpdet_id_gpio; |
125 | 138 | ||
139 | /** Extra debounce timeout used during initial mic detection (ms) */ | ||
140 | int micd_detect_debounce; | ||
141 | |||
126 | /** GPIO for mic detection polarity */ | 142 | /** GPIO for mic detection polarity */ |
127 | int micd_pol_gpio; | 143 | int micd_pol_gpio; |
128 | 144 | ||
@@ -135,9 +151,16 @@ struct arizona_pdata { | |||
135 | /** Mic detect debounce level */ | 151 | /** Mic detect debounce level */ |
136 | int micd_dbtime; | 152 | int micd_dbtime; |
137 | 153 | ||
154 | /** Mic detect timeout (ms) */ | ||
155 | int micd_timeout; | ||
156 | |||
138 | /** Force MICBIAS on for mic detect */ | 157 | /** Force MICBIAS on for mic detect */ |
139 | bool micd_force_micbias; | 158 | bool micd_force_micbias; |
140 | 159 | ||
160 | /** Mic detect level parameters */ | ||
161 | const struct arizona_micd_range *micd_ranges; | ||
162 | int num_micd_ranges; | ||
163 | |||
141 | /** Headset polarity configurations */ | 164 | /** Headset polarity configurations */ |
142 | struct arizona_micd_config *micd_configs; | 165 | struct arizona_micd_config *micd_configs; |
143 | int num_micd_configs; | 166 | int num_micd_configs; |
@@ -162,6 +185,9 @@ struct arizona_pdata { | |||
162 | 185 | ||
163 | /** Haptic actuator type */ | 186 | /** Haptic actuator type */ |
164 | unsigned int hap_act; | 187 | unsigned int hap_act; |
188 | |||
189 | /** GPIO for primary IRQ (used for edge triggered emulation) */ | ||
190 | int irq_gpio; | ||
165 | }; | 191 | }; |
166 | 192 | ||
167 | #endif | 193 | #endif |
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h index 340355136069..715b6ba3d52a 100644 --- a/include/linux/mfd/arizona/registers.h +++ b/include/linux/mfd/arizona/registers.h | |||
@@ -85,12 +85,14 @@ | |||
85 | #define ARIZONA_FLL1_CONTROL_6 0x176 | 85 | #define ARIZONA_FLL1_CONTROL_6 0x176 |
86 | #define ARIZONA_FLL1_LOOP_FILTER_TEST_1 0x177 | 86 | #define ARIZONA_FLL1_LOOP_FILTER_TEST_1 0x177 |
87 | #define ARIZONA_FLL1_NCO_TEST_0 0x178 | 87 | #define ARIZONA_FLL1_NCO_TEST_0 0x178 |
88 | #define ARIZONA_FLL1_CONTROL_7 0x179 | ||
88 | #define ARIZONA_FLL1_SYNCHRONISER_1 0x181 | 89 | #define ARIZONA_FLL1_SYNCHRONISER_1 0x181 |
89 | #define ARIZONA_FLL1_SYNCHRONISER_2 0x182 | 90 | #define ARIZONA_FLL1_SYNCHRONISER_2 0x182 |
90 | #define ARIZONA_FLL1_SYNCHRONISER_3 0x183 | 91 | #define ARIZONA_FLL1_SYNCHRONISER_3 0x183 |
91 | #define ARIZONA_FLL1_SYNCHRONISER_4 0x184 | 92 | #define ARIZONA_FLL1_SYNCHRONISER_4 0x184 |
92 | #define ARIZONA_FLL1_SYNCHRONISER_5 0x185 | 93 | #define ARIZONA_FLL1_SYNCHRONISER_5 0x185 |
93 | #define ARIZONA_FLL1_SYNCHRONISER_6 0x186 | 94 | #define ARIZONA_FLL1_SYNCHRONISER_6 0x186 |
95 | #define ARIZONA_FLL1_SYNCHRONISER_7 0x187 | ||
94 | #define ARIZONA_FLL1_SPREAD_SPECTRUM 0x189 | 96 | #define ARIZONA_FLL1_SPREAD_SPECTRUM 0x189 |
95 | #define ARIZONA_FLL1_GPIO_CLOCK 0x18A | 97 | #define ARIZONA_FLL1_GPIO_CLOCK 0x18A |
96 | #define ARIZONA_FLL2_CONTROL_1 0x191 | 98 | #define ARIZONA_FLL2_CONTROL_1 0x191 |
@@ -101,12 +103,14 @@ | |||
101 | #define ARIZONA_FLL2_CONTROL_6 0x196 | 103 | #define ARIZONA_FLL2_CONTROL_6 0x196 |
102 | #define ARIZONA_FLL2_LOOP_FILTER_TEST_1 0x197 | 104 | #define ARIZONA_FLL2_LOOP_FILTER_TEST_1 0x197 |
103 | #define ARIZONA_FLL2_NCO_TEST_0 0x198 | 105 | #define ARIZONA_FLL2_NCO_TEST_0 0x198 |
106 | #define ARIZONA_FLL2_CONTROL_7 0x199 | ||
104 | #define ARIZONA_FLL2_SYNCHRONISER_1 0x1A1 | 107 | #define ARIZONA_FLL2_SYNCHRONISER_1 0x1A1 |
105 | #define ARIZONA_FLL2_SYNCHRONISER_2 0x1A2 | 108 | #define ARIZONA_FLL2_SYNCHRONISER_2 0x1A2 |
106 | #define ARIZONA_FLL2_SYNCHRONISER_3 0x1A3 | 109 | #define ARIZONA_FLL2_SYNCHRONISER_3 0x1A3 |
107 | #define ARIZONA_FLL2_SYNCHRONISER_4 0x1A4 | 110 | #define ARIZONA_FLL2_SYNCHRONISER_4 0x1A4 |
108 | #define ARIZONA_FLL2_SYNCHRONISER_5 0x1A5 | 111 | #define ARIZONA_FLL2_SYNCHRONISER_5 0x1A5 |
109 | #define ARIZONA_FLL2_SYNCHRONISER_6 0x1A6 | 112 | #define ARIZONA_FLL2_SYNCHRONISER_6 0x1A6 |
113 | #define ARIZONA_FLL2_SYNCHRONISER_7 0x1A7 | ||
110 | #define ARIZONA_FLL2_SPREAD_SPECTRUM 0x1A9 | 114 | #define ARIZONA_FLL2_SPREAD_SPECTRUM 0x1A9 |
111 | #define ARIZONA_FLL2_GPIO_CLOCK 0x1AA | 115 | #define ARIZONA_FLL2_GPIO_CLOCK 0x1AA |
112 | #define ARIZONA_MIC_CHARGE_PUMP_1 0x200 | 116 | #define ARIZONA_MIC_CHARGE_PUMP_1 0x200 |
@@ -124,6 +128,10 @@ | |||
124 | #define ARIZONA_MIC_DETECT_1 0x2A3 | 128 | #define ARIZONA_MIC_DETECT_1 0x2A3 |
125 | #define ARIZONA_MIC_DETECT_2 0x2A4 | 129 | #define ARIZONA_MIC_DETECT_2 0x2A4 |
126 | #define ARIZONA_MIC_DETECT_3 0x2A5 | 130 | #define ARIZONA_MIC_DETECT_3 0x2A5 |
131 | #define ARIZONA_MIC_DETECT_LEVEL_1 0x2A6 | ||
132 | #define ARIZONA_MIC_DETECT_LEVEL_2 0x2A7 | ||
133 | #define ARIZONA_MIC_DETECT_LEVEL_3 0x2A8 | ||
134 | #define ARIZONA_MIC_DETECT_LEVEL_4 0x2A9 | ||
127 | #define ARIZONA_MIC_NOISE_MIX_CONTROL_1 0x2C3 | 135 | #define ARIZONA_MIC_NOISE_MIX_CONTROL_1 0x2C3 |
128 | #define ARIZONA_ISOLATION_CONTROL 0x2CB | 136 | #define ARIZONA_ISOLATION_CONTROL 0x2CB |
129 | #define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3 | 137 | #define ARIZONA_JACK_DETECT_ANALOGUE 0x2D3 |
@@ -213,6 +221,8 @@ | |||
213 | #define ARIZONA_PDM_SPK1_CTRL_2 0x491 | 221 | #define ARIZONA_PDM_SPK1_CTRL_2 0x491 |
214 | #define ARIZONA_PDM_SPK2_CTRL_1 0x492 | 222 | #define ARIZONA_PDM_SPK2_CTRL_1 0x492 |
215 | #define ARIZONA_PDM_SPK2_CTRL_2 0x493 | 223 | #define ARIZONA_PDM_SPK2_CTRL_2 0x493 |
224 | #define ARIZONA_SPK_CTRL_2 0x4B5 | ||
225 | #define ARIZONA_SPK_CTRL_3 0x4B6 | ||
216 | #define ARIZONA_DAC_COMP_1 0x4DC | 226 | #define ARIZONA_DAC_COMP_1 0x4DC |
217 | #define ARIZONA_DAC_COMP_2 0x4DD | 227 | #define ARIZONA_DAC_COMP_2 0x4DD |
218 | #define ARIZONA_DAC_COMP_3 0x4DE | 228 | #define ARIZONA_DAC_COMP_3 0x4DE |
@@ -1678,6 +1688,13 @@ | |||
1678 | #define ARIZONA_FLL1_FRC_INTEG_VAL_WIDTH 12 /* FLL1_FRC_INTEG_VAL - [11:0] */ | 1688 | #define ARIZONA_FLL1_FRC_INTEG_VAL_WIDTH 12 /* FLL1_FRC_INTEG_VAL - [11:0] */ |
1679 | 1689 | ||
1680 | /* | 1690 | /* |
1691 | * R377 (0x179) - FLL1 Control 7 | ||
1692 | */ | ||
1693 | #define ARIZONA_FLL1_GAIN_MASK 0x003c /* FLL1_GAIN */ | ||
1694 | #define ARIZONA_FLL1_GAIN_SHIFT 2 /* FLL1_GAIN */ | ||
1695 | #define ARIZONA_FLL1_GAIN_WIDTH 4 /* FLL1_GAIN */ | ||
1696 | |||
1697 | /* | ||
1681 | * R385 (0x181) - FLL1 Synchroniser 1 | 1698 | * R385 (0x181) - FLL1 Synchroniser 1 |
1682 | */ | 1699 | */ |
1683 | #define ARIZONA_FLL1_SYNC_ENA 0x0001 /* FLL1_SYNC_ENA */ | 1700 | #define ARIZONA_FLL1_SYNC_ENA 0x0001 /* FLL1_SYNC_ENA */ |
@@ -1724,6 +1741,17 @@ | |||
1724 | #define ARIZONA_FLL1_CLK_SYNC_SRC_WIDTH 4 /* FLL1_CLK_SYNC_SRC - [3:0] */ | 1741 | #define ARIZONA_FLL1_CLK_SYNC_SRC_WIDTH 4 /* FLL1_CLK_SYNC_SRC - [3:0] */ |
1725 | 1742 | ||
1726 | /* | 1743 | /* |
1744 | * R391 (0x187) - FLL1 Synchroniser 7 | ||
1745 | */ | ||
1746 | #define ARIZONA_FLL1_SYNC_GAIN_MASK 0x003c /* FLL1_SYNC_GAIN */ | ||
1747 | #define ARIZONA_FLL1_SYNC_GAIN_SHIFT 2 /* FLL1_SYNC_GAIN */ | ||
1748 | #define ARIZONA_FLL1_SYNC_GAIN_WIDTH 4 /* FLL1_SYNC_GAIN */ | ||
1749 | #define ARIZONA_FLL1_SYNC_BW 0x0001 /* FLL1_SYNC_BW */ | ||
1750 | #define ARIZONA_FLL1_SYNC_BW_MASK 0x0001 /* FLL1_SYNC_BW */ | ||
1751 | #define ARIZONA_FLL1_SYNC_BW_SHIFT 0 /* FLL1_SYNC_BW */ | ||
1752 | #define ARIZONA_FLL1_SYNC_BW_WIDTH 1 /* FLL1_SYNC_BW */ | ||
1753 | |||
1754 | /* | ||
1727 | * R393 (0x189) - FLL1 Spread Spectrum | 1755 | * R393 (0x189) - FLL1 Spread Spectrum |
1728 | */ | 1756 | */ |
1729 | #define ARIZONA_FLL1_SS_AMPL_MASK 0x0030 /* FLL1_SS_AMPL - [5:4] */ | 1757 | #define ARIZONA_FLL1_SS_AMPL_MASK 0x0030 /* FLL1_SS_AMPL - [5:4] */ |
@@ -1816,6 +1844,13 @@ | |||
1816 | #define ARIZONA_FLL2_FRC_INTEG_VAL_WIDTH 12 /* FLL2_FRC_INTEG_VAL - [11:0] */ | 1844 | #define ARIZONA_FLL2_FRC_INTEG_VAL_WIDTH 12 /* FLL2_FRC_INTEG_VAL - [11:0] */ |
1817 | 1845 | ||
1818 | /* | 1846 | /* |
1847 | * R409 (0x199) - FLL2 Control 7 | ||
1848 | */ | ||
1849 | #define ARIZONA_FLL2_GAIN_MASK 0x003c /* FLL2_GAIN */ | ||
1850 | #define ARIZONA_FLL2_GAIN_SHIFT 2 /* FLL2_GAIN */ | ||
1851 | #define ARIZONA_FLL2_GAIN_WIDTH 4 /* FLL2_GAIN */ | ||
1852 | |||
1853 | /* | ||
1819 | * R417 (0x1A1) - FLL2 Synchroniser 1 | 1854 | * R417 (0x1A1) - FLL2 Synchroniser 1 |
1820 | */ | 1855 | */ |
1821 | #define ARIZONA_FLL2_SYNC_ENA 0x0001 /* FLL2_SYNC_ENA */ | 1856 | #define ARIZONA_FLL2_SYNC_ENA 0x0001 /* FLL2_SYNC_ENA */ |
@@ -1862,6 +1897,17 @@ | |||
1862 | #define ARIZONA_FLL2_CLK_SYNC_SRC_WIDTH 4 /* FLL2_CLK_SYNC_SRC - [3:0] */ | 1897 | #define ARIZONA_FLL2_CLK_SYNC_SRC_WIDTH 4 /* FLL2_CLK_SYNC_SRC - [3:0] */ |
1863 | 1898 | ||
1864 | /* | 1899 | /* |
1900 | * R423 (0x1A7) - FLL2 Synchroniser 7 | ||
1901 | */ | ||
1902 | #define ARIZONA_FLL2_SYNC_GAIN_MASK 0x003c /* FLL2_SYNC_GAIN */ | ||
1903 | #define ARIZONA_FLL2_SYNC_GAIN_SHIFT 2 /* FLL2_SYNC_GAIN */ | ||
1904 | #define ARIZONA_FLL2_SYNC_GAIN_WIDTH 4 /* FLL2_SYNC_GAIN */ | ||
1905 | #define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */ | ||
1906 | #define ARIZONA_FLL2_SYNC_BW_MASK 0x0001 /* FLL2_SYNC_BW */ | ||
1907 | #define ARIZONA_FLL2_SYNC_BW_SHIFT 0 /* FLL2_SYNC_BW */ | ||
1908 | #define ARIZONA_FLL2_SYNC_BW_WIDTH 1 /* FLL2_SYNC_BW */ | ||
1909 | |||
1910 | /* | ||
1865 | * R425 (0x1A9) - FLL2 Spread Spectrum | 1911 | * R425 (0x1A9) - FLL2 Spread Spectrum |
1866 | */ | 1912 | */ |
1867 | #define ARIZONA_FLL2_SS_AMPL_MASK 0x0030 /* FLL2_SS_AMPL - [5:4] */ | 1913 | #define ARIZONA_FLL2_SS_AMPL_MASK 0x0030 /* FLL2_SS_AMPL - [5:4] */ |
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h new file mode 100644 index 000000000000..032af7fc5b2e --- /dev/null +++ b/include/linux/mfd/cros_ec.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /* | ||
2 | * ChromeOS EC multi-function device | ||
3 | * | ||
4 | * Copyright (C) 2012 Google, Inc | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __LINUX_MFD_CROS_EC_H | ||
17 | #define __LINUX_MFD_CROS_EC_H | ||
18 | |||
19 | #include <linux/mfd/cros_ec_commands.h> | ||
20 | |||
21 | /* | ||
22 | * Command interface between EC and AP, for LPC, I2C and SPI interfaces. | ||
23 | */ | ||
24 | enum { | ||
25 | EC_MSG_TX_HEADER_BYTES = 3, | ||
26 | EC_MSG_TX_TRAILER_BYTES = 1, | ||
27 | EC_MSG_TX_PROTO_BYTES = EC_MSG_TX_HEADER_BYTES + | ||
28 | EC_MSG_TX_TRAILER_BYTES, | ||
29 | EC_MSG_RX_PROTO_BYTES = 3, | ||
30 | |||
31 | /* Max length of messages */ | ||
32 | EC_MSG_BYTES = EC_HOST_PARAM_SIZE + EC_MSG_TX_PROTO_BYTES, | ||
33 | |||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * struct cros_ec_msg - A message sent to the EC, and its reply | ||
38 | * | ||
39 | * @version: Command version number (often 0) | ||
40 | * @cmd: Command to send (EC_CMD_...) | ||
41 | * @out_buf: Outgoing payload (to EC) | ||
42 | * @outlen: Outgoing length | ||
43 | * @in_buf: Incoming payload (from EC) | ||
44 | * @in_len: Incoming length | ||
45 | */ | ||
46 | struct cros_ec_msg { | ||
47 | u8 version; | ||
48 | u8 cmd; | ||
49 | uint8_t *out_buf; | ||
50 | int out_len; | ||
51 | uint8_t *in_buf; | ||
52 | int in_len; | ||
53 | }; | ||
54 | |||
55 | /** | ||
56 | * struct cros_ec_device - Information about a ChromeOS EC device | ||
57 | * | ||
58 | * @name: Name of this EC interface | ||
59 | * @priv: Private data | ||
60 | * @irq: Interrupt to use | ||
61 | * @din: input buffer (from EC) | ||
62 | * @dout: output buffer (to EC) | ||
63 | * \note | ||
64 | * These two buffers will always be dword-aligned and include enough | ||
65 | * space for up to 7 word-alignment bytes also, so we can ensure that | ||
66 | * the body of the message is always dword-aligned (64-bit). | ||
67 | * | ||
68 | * We use this alignment to keep ARM and x86 happy. Probably word | ||
69 | * alignment would be OK, there might be a small performance advantage | ||
70 | * to using dword. | ||
71 | * @din_size: size of din buffer | ||
72 | * @dout_size: size of dout buffer | ||
73 | * @command_send: send a command | ||
74 | * @command_recv: receive a command | ||
75 | * @ec_name: name of EC device (e.g. 'chromeos-ec') | ||
76 | * @phys_name: name of physical comms layer (e.g. 'i2c-4') | ||
77 | * @parent: pointer to parent device (e.g. i2c or spi device) | ||
78 | * @dev: Device pointer | ||
79 | * dev_lock: Lock to prevent concurrent access | ||
80 | * @wake_enabled: true if this device can wake the system from sleep | ||
81 | * @was_wake_device: true if this device was set to wake the system from | ||
82 | * sleep at the last suspend | ||
83 | * @event_notifier: interrupt event notifier for transport devices | ||
84 | */ | ||
85 | struct cros_ec_device { | ||
86 | const char *name; | ||
87 | void *priv; | ||
88 | int irq; | ||
89 | uint8_t *din; | ||
90 | uint8_t *dout; | ||
91 | int din_size; | ||
92 | int dout_size; | ||
93 | int (*command_send)(struct cros_ec_device *ec, | ||
94 | uint16_t cmd, void *out_buf, int out_len); | ||
95 | int (*command_recv)(struct cros_ec_device *ec, | ||
96 | uint16_t cmd, void *in_buf, int in_len); | ||
97 | int (*command_sendrecv)(struct cros_ec_device *ec, | ||
98 | uint16_t cmd, void *out_buf, int out_len, | ||
99 | void *in_buf, int in_len); | ||
100 | int (*command_xfer)(struct cros_ec_device *ec, | ||
101 | struct cros_ec_msg *msg); | ||
102 | |||
103 | const char *ec_name; | ||
104 | const char *phys_name; | ||
105 | struct device *parent; | ||
106 | |||
107 | /* These are --private-- fields - do not assign */ | ||
108 | struct device *dev; | ||
109 | struct mutex dev_lock; | ||
110 | bool wake_enabled; | ||
111 | bool was_wake_device; | ||
112 | struct blocking_notifier_head event_notifier; | ||
113 | }; | ||
114 | |||
115 | /** | ||
116 | * cros_ec_suspend - Handle a suspend operation for the ChromeOS EC device | ||
117 | * | ||
118 | * This can be called by drivers to handle a suspend event. | ||
119 | * | ||
120 | * ec_dev: Device to suspend | ||
121 | * @return 0 if ok, -ve on error | ||
122 | */ | ||
123 | int cros_ec_suspend(struct cros_ec_device *ec_dev); | ||
124 | |||
125 | /** | ||
126 | * cros_ec_resume - Handle a resume operation for the ChromeOS EC device | ||
127 | * | ||
128 | * This can be called by drivers to handle a resume event. | ||
129 | * | ||
130 | * @ec_dev: Device to resume | ||
131 | * @return 0 if ok, -ve on error | ||
132 | */ | ||
133 | int cros_ec_resume(struct cros_ec_device *ec_dev); | ||
134 | |||
135 | /** | ||
136 | * cros_ec_prepare_tx - Prepare an outgoing message in the output buffer | ||
137 | * | ||
138 | * This is intended to be used by all ChromeOS EC drivers, but at present | ||
139 | * only SPI uses it. Once LPC uses the same protocol it can start using it. | ||
140 | * I2C could use it now, with a refactor of the existing code. | ||
141 | * | ||
142 | * @ec_dev: Device to register | ||
143 | * @msg: Message to write | ||
144 | */ | ||
145 | int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, | ||
146 | struct cros_ec_msg *msg); | ||
147 | |||
148 | /** | ||
149 | * cros_ec_remove - Remove a ChromeOS EC | ||
150 | * | ||
151 | * Call this to deregister a ChromeOS EC. After this you should call | ||
152 | * cros_ec_free(). | ||
153 | * | ||
154 | * @ec_dev: Device to register | ||
155 | * @return 0 if ok, -ve on error | ||
156 | */ | ||
157 | int cros_ec_remove(struct cros_ec_device *ec_dev); | ||
158 | |||
159 | /** | ||
160 | * cros_ec_register - Register a new ChromeOS EC, using the provided info | ||
161 | * | ||
162 | * Before calling this, allocate a pointer to a new device and then fill | ||
163 | * in all the fields up to the --private-- marker. | ||
164 | * | ||
165 | * @ec_dev: Device to register | ||
166 | * @return 0 if ok, -ve on error | ||
167 | */ | ||
168 | int cros_ec_register(struct cros_ec_device *ec_dev); | ||
169 | |||
170 | #endif /* __LINUX_MFD_CROS_EC_H */ | ||
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h new file mode 100644 index 000000000000..86fd06953bcd --- /dev/null +++ b/include/linux/mfd/cros_ec_commands.h | |||
@@ -0,0 +1,1369 @@ | |||
1 | /* | ||
2 | * Host communication command constants for ChromeOS EC | ||
3 | * | ||
4 | * Copyright (C) 2012 Google, Inc | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * The ChromeOS EC multi function device is used to mux all the requests | ||
16 | * to the EC device for its multiple features: keyboard controller, | ||
17 | * battery charging and regulator control, firmware update. | ||
18 | * | ||
19 | * NOTE: This file is copied verbatim from the ChromeOS EC Open Source | ||
20 | * project in an attempt to make future updates easy to make. | ||
21 | */ | ||
22 | |||
23 | #ifndef __CROS_EC_COMMANDS_H | ||
24 | #define __CROS_EC_COMMANDS_H | ||
25 | |||
26 | /* | ||
27 | * Protocol overview | ||
28 | * | ||
29 | * request: CMD [ P0 P1 P2 ... Pn S ] | ||
30 | * response: ERR [ P0 P1 P2 ... Pn S ] | ||
31 | * | ||
32 | * where the bytes are defined as follow : | ||
33 | * - CMD is the command code. (defined by EC_CMD_ constants) | ||
34 | * - ERR is the error code. (defined by EC_RES_ constants) | ||
35 | * - Px is the optional payload. | ||
36 | * it is not sent if the error code is not success. | ||
37 | * (defined by ec_params_ and ec_response_ structures) | ||
38 | * - S is the checksum which is the sum of all payload bytes. | ||
39 | * | ||
40 | * On LPC, CMD and ERR are sent/received at EC_LPC_ADDR_KERNEL|USER_CMD | ||
41 | * and the payloads are sent/received at EC_LPC_ADDR_KERNEL|USER_PARAM. | ||
42 | * On I2C, all bytes are sent serially in the same message. | ||
43 | */ | ||
44 | |||
45 | /* Current version of this protocol */ | ||
46 | #define EC_PROTO_VERSION 0x00000002 | ||
47 | |||
48 | /* Command version mask */ | ||
49 | #define EC_VER_MASK(version) (1UL << (version)) | ||
50 | |||
51 | /* I/O addresses for ACPI commands */ | ||
52 | #define EC_LPC_ADDR_ACPI_DATA 0x62 | ||
53 | #define EC_LPC_ADDR_ACPI_CMD 0x66 | ||
54 | |||
55 | /* I/O addresses for host command */ | ||
56 | #define EC_LPC_ADDR_HOST_DATA 0x200 | ||
57 | #define EC_LPC_ADDR_HOST_CMD 0x204 | ||
58 | |||
59 | /* I/O addresses for host command args and params */ | ||
60 | #define EC_LPC_ADDR_HOST_ARGS 0x800 | ||
61 | #define EC_LPC_ADDR_HOST_PARAM 0x804 | ||
62 | #define EC_HOST_PARAM_SIZE 0x0fc /* Size of param area in bytes */ | ||
63 | |||
64 | /* I/O addresses for host command params, old interface */ | ||
65 | #define EC_LPC_ADDR_OLD_PARAM 0x880 | ||
66 | #define EC_OLD_PARAM_SIZE 0x080 /* Size of param area in bytes */ | ||
67 | |||
68 | /* EC command register bit functions */ | ||
69 | #define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */ | ||
70 | #define EC_LPC_CMDR_PENDING (1 << 1) /* Write pending to EC */ | ||
71 | #define EC_LPC_CMDR_BUSY (1 << 2) /* EC is busy processing a command */ | ||
72 | #define EC_LPC_CMDR_CMD (1 << 3) /* Last host write was a command */ | ||
73 | #define EC_LPC_CMDR_ACPI_BRST (1 << 4) /* Burst mode (not used) */ | ||
74 | #define EC_LPC_CMDR_SCI (1 << 5) /* SCI event is pending */ | ||
75 | #define EC_LPC_CMDR_SMI (1 << 6) /* SMI event is pending */ | ||
76 | |||
77 | #define EC_LPC_ADDR_MEMMAP 0x900 | ||
78 | #define EC_MEMMAP_SIZE 255 /* ACPI IO buffer max is 255 bytes */ | ||
79 | #define EC_MEMMAP_TEXT_MAX 8 /* Size of a string in the memory map */ | ||
80 | |||
81 | /* The offset address of each type of data in mapped memory. */ | ||
82 | #define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors */ | ||
83 | #define EC_MEMMAP_FAN 0x10 /* Fan speeds */ | ||
84 | #define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* Temp sensors (second set) */ | ||
85 | #define EC_MEMMAP_ID 0x20 /* 'E' 'C' */ | ||
86 | #define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */ | ||
87 | #define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */ | ||
88 | #define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */ | ||
89 | #define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */ | ||
90 | #define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */ | ||
91 | #define EC_MEMMAP_HOST_CMD_FLAGS 0x27 /* Host command interface flags */ | ||
92 | #define EC_MEMMAP_SWITCHES 0x30 | ||
93 | #define EC_MEMMAP_HOST_EVENTS 0x34 | ||
94 | #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ | ||
95 | #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ | ||
96 | #define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */ | ||
97 | #define EC_MEMMAP_BATT_FLAG 0x4c /* Battery State, defined below */ | ||
98 | #define EC_MEMMAP_BATT_DCAP 0x50 /* Battery Design Capacity */ | ||
99 | #define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ | ||
100 | #define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ | ||
101 | #define EC_MEMMAP_BATT_CCNT 0x5c /* Battery Cycle Count */ | ||
102 | #define EC_MEMMAP_BATT_MFGR 0x60 /* Battery Manufacturer String */ | ||
103 | #define EC_MEMMAP_BATT_MODEL 0x68 /* Battery Model Number String */ | ||
104 | #define EC_MEMMAP_BATT_SERIAL 0x70 /* Battery Serial Number String */ | ||
105 | #define EC_MEMMAP_BATT_TYPE 0x78 /* Battery Type String */ | ||
106 | |||
107 | /* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ | ||
108 | #define EC_TEMP_SENSOR_ENTRIES 16 | ||
109 | /* | ||
110 | * Number of temp sensors at EC_MEMMAP_TEMP_SENSOR_B. | ||
111 | * | ||
112 | * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2. | ||
113 | */ | ||
114 | #define EC_TEMP_SENSOR_B_ENTRIES 8 | ||
115 | #define EC_TEMP_SENSOR_NOT_PRESENT 0xff | ||
116 | #define EC_TEMP_SENSOR_ERROR 0xfe | ||
117 | #define EC_TEMP_SENSOR_NOT_POWERED 0xfd | ||
118 | #define EC_TEMP_SENSOR_NOT_CALIBRATED 0xfc | ||
119 | /* | ||
120 | * The offset of temperature value stored in mapped memory. This allows | ||
121 | * reporting a temperature range of 200K to 454K = -73C to 181C. | ||
122 | */ | ||
123 | #define EC_TEMP_SENSOR_OFFSET 200 | ||
124 | |||
125 | #define EC_FAN_SPEED_ENTRIES 4 /* Number of fans at EC_MEMMAP_FAN */ | ||
126 | #define EC_FAN_SPEED_NOT_PRESENT 0xffff /* Entry not present */ | ||
127 | #define EC_FAN_SPEED_STALLED 0xfffe /* Fan stalled */ | ||
128 | |||
129 | /* Battery bit flags at EC_MEMMAP_BATT_FLAG. */ | ||
130 | #define EC_BATT_FLAG_AC_PRESENT 0x01 | ||
131 | #define EC_BATT_FLAG_BATT_PRESENT 0x02 | ||
132 | #define EC_BATT_FLAG_DISCHARGING 0x04 | ||
133 | #define EC_BATT_FLAG_CHARGING 0x08 | ||
134 | #define EC_BATT_FLAG_LEVEL_CRITICAL 0x10 | ||
135 | |||
136 | /* Switch flags at EC_MEMMAP_SWITCHES */ | ||
137 | #define EC_SWITCH_LID_OPEN 0x01 | ||
138 | #define EC_SWITCH_POWER_BUTTON_PRESSED 0x02 | ||
139 | #define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04 | ||
140 | /* Recovery requested via keyboard */ | ||
141 | #define EC_SWITCH_KEYBOARD_RECOVERY 0x08 | ||
142 | /* Recovery requested via dedicated signal (from servo board) */ | ||
143 | #define EC_SWITCH_DEDICATED_RECOVERY 0x10 | ||
144 | /* Was fake developer mode switch; now unused. Remove in next refactor. */ | ||
145 | #define EC_SWITCH_IGNORE0 0x20 | ||
146 | |||
147 | /* Host command interface flags */ | ||
148 | /* Host command interface supports LPC args (LPC interface only) */ | ||
149 | #define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED 0x01 | ||
150 | |||
151 | /* Wireless switch flags */ | ||
152 | #define EC_WIRELESS_SWITCH_WLAN 0x01 | ||
153 | #define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 | ||
154 | |||
155 | /* | ||
156 | * This header file is used in coreboot both in C and ACPI code. The ACPI code | ||
157 | * is pre-processed to handle constants but the ASL compiler is unable to | ||
158 | * handle actual C code so keep it separate. | ||
159 | */ | ||
160 | #ifndef __ACPI__ | ||
161 | |||
162 | /* LPC command status byte masks */ | ||
163 | /* EC has written a byte in the data register and host hasn't read it yet */ | ||
164 | #define EC_LPC_STATUS_TO_HOST 0x01 | ||
165 | /* Host has written a command/data byte and the EC hasn't read it yet */ | ||
166 | #define EC_LPC_STATUS_FROM_HOST 0x02 | ||
167 | /* EC is processing a command */ | ||
168 | #define EC_LPC_STATUS_PROCESSING 0x04 | ||
169 | /* Last write to EC was a command, not data */ | ||
170 | #define EC_LPC_STATUS_LAST_CMD 0x08 | ||
171 | /* EC is in burst mode. Unsupported by Chrome EC, so this bit is never set */ | ||
172 | #define EC_LPC_STATUS_BURST_MODE 0x10 | ||
173 | /* SCI event is pending (requesting SCI query) */ | ||
174 | #define EC_LPC_STATUS_SCI_PENDING 0x20 | ||
175 | /* SMI event is pending (requesting SMI query) */ | ||
176 | #define EC_LPC_STATUS_SMI_PENDING 0x40 | ||
177 | /* (reserved) */ | ||
178 | #define EC_LPC_STATUS_RESERVED 0x80 | ||
179 | |||
180 | /* | ||
181 | * EC is busy. This covers both the EC processing a command, and the host has | ||
182 | * written a new command but the EC hasn't picked it up yet. | ||
183 | */ | ||
184 | #define EC_LPC_STATUS_BUSY_MASK \ | ||
185 | (EC_LPC_STATUS_FROM_HOST | EC_LPC_STATUS_PROCESSING) | ||
186 | |||
187 | /* Host command response codes */ | ||
188 | enum ec_status { | ||
189 | EC_RES_SUCCESS = 0, | ||
190 | EC_RES_INVALID_COMMAND = 1, | ||
191 | EC_RES_ERROR = 2, | ||
192 | EC_RES_INVALID_PARAM = 3, | ||
193 | EC_RES_ACCESS_DENIED = 4, | ||
194 | EC_RES_INVALID_RESPONSE = 5, | ||
195 | EC_RES_INVALID_VERSION = 6, | ||
196 | EC_RES_INVALID_CHECKSUM = 7, | ||
197 | EC_RES_IN_PROGRESS = 8, /* Accepted, command in progress */ | ||
198 | EC_RES_UNAVAILABLE = 9, /* No response available */ | ||
199 | EC_RES_TIMEOUT = 10, /* We got a timeout */ | ||
200 | EC_RES_OVERFLOW = 11, /* Table / data overflow */ | ||
201 | }; | ||
202 | |||
203 | /* | ||
204 | * Host event codes. Note these are 1-based, not 0-based, because ACPI query | ||
205 | * EC command uses code 0 to mean "no event pending". We explicitly specify | ||
206 | * each value in the enum listing so they won't change if we delete/insert an | ||
207 | * item or rearrange the list (it needs to be stable across platforms, not | ||
208 | * just within a single compiled instance). | ||
209 | */ | ||
210 | enum host_event_code { | ||
211 | EC_HOST_EVENT_LID_CLOSED = 1, | ||
212 | EC_HOST_EVENT_LID_OPEN = 2, | ||
213 | EC_HOST_EVENT_POWER_BUTTON = 3, | ||
214 | EC_HOST_EVENT_AC_CONNECTED = 4, | ||
215 | EC_HOST_EVENT_AC_DISCONNECTED = 5, | ||
216 | EC_HOST_EVENT_BATTERY_LOW = 6, | ||
217 | EC_HOST_EVENT_BATTERY_CRITICAL = 7, | ||
218 | EC_HOST_EVENT_BATTERY = 8, | ||
219 | EC_HOST_EVENT_THERMAL_THRESHOLD = 9, | ||
220 | EC_HOST_EVENT_THERMAL_OVERLOAD = 10, | ||
221 | EC_HOST_EVENT_THERMAL = 11, | ||
222 | EC_HOST_EVENT_USB_CHARGER = 12, | ||
223 | EC_HOST_EVENT_KEY_PRESSED = 13, | ||
224 | /* | ||
225 | * EC has finished initializing the host interface. The host can check | ||
226 | * for this event following sending a EC_CMD_REBOOT_EC command to | ||
227 | * determine when the EC is ready to accept subsequent commands. | ||
228 | */ | ||
229 | EC_HOST_EVENT_INTERFACE_READY = 14, | ||
230 | /* Keyboard recovery combo has been pressed */ | ||
231 | EC_HOST_EVENT_KEYBOARD_RECOVERY = 15, | ||
232 | |||
233 | /* Shutdown due to thermal overload */ | ||
234 | EC_HOST_EVENT_THERMAL_SHUTDOWN = 16, | ||
235 | /* Shutdown due to battery level too low */ | ||
236 | EC_HOST_EVENT_BATTERY_SHUTDOWN = 17, | ||
237 | |||
238 | /* | ||
239 | * The high bit of the event mask is not used as a host event code. If | ||
240 | * it reads back as set, then the entire event mask should be | ||
241 | * considered invalid by the host. This can happen when reading the | ||
242 | * raw event status via EC_MEMMAP_HOST_EVENTS but the LPC interface is | ||
243 | * not initialized on the EC, or improperly configured on the host. | ||
244 | */ | ||
245 | EC_HOST_EVENT_INVALID = 32 | ||
246 | }; | ||
247 | /* Host event mask */ | ||
248 | #define EC_HOST_EVENT_MASK(event_code) (1UL << ((event_code) - 1)) | ||
249 | |||
250 | /* Arguments at EC_LPC_ADDR_HOST_ARGS */ | ||
251 | struct ec_lpc_host_args { | ||
252 | uint8_t flags; | ||
253 | uint8_t command_version; | ||
254 | uint8_t data_size; | ||
255 | /* | ||
256 | * Checksum; sum of command + flags + command_version + data_size + | ||
257 | * all params/response data bytes. | ||
258 | */ | ||
259 | uint8_t checksum; | ||
260 | } __packed; | ||
261 | |||
262 | /* Flags for ec_lpc_host_args.flags */ | ||
263 | /* | ||
264 | * Args are from host. Data area at EC_LPC_ADDR_HOST_PARAM contains command | ||
265 | * params. | ||
266 | * | ||
267 | * If EC gets a command and this flag is not set, this is an old-style command. | ||
268 | * Command version is 0 and params from host are at EC_LPC_ADDR_OLD_PARAM with | ||
269 | * unknown length. EC must respond with an old-style response (that is, | ||
270 | * withouth setting EC_HOST_ARGS_FLAG_TO_HOST). | ||
271 | */ | ||
272 | #define EC_HOST_ARGS_FLAG_FROM_HOST 0x01 | ||
273 | /* | ||
274 | * Args are from EC. Data area at EC_LPC_ADDR_HOST_PARAM contains response. | ||
275 | * | ||
276 | * If EC responds to a command and this flag is not set, this is an old-style | ||
277 | * response. Command version is 0 and response data from EC is at | ||
278 | * EC_LPC_ADDR_OLD_PARAM with unknown length. | ||
279 | */ | ||
280 | #define EC_HOST_ARGS_FLAG_TO_HOST 0x02 | ||
281 | |||
282 | /* | ||
283 | * Notes on commands: | ||
284 | * | ||
285 | * Each command is an 8-byte command value. Commands which take params or | ||
286 | * return response data specify structs for that data. If no struct is | ||
287 | * specified, the command does not input or output data, respectively. | ||
288 | * Parameter/response length is implicit in the structs. Some underlying | ||
289 | * communication protocols (I2C, SPI) may add length or checksum headers, but | ||
290 | * those are implementation-dependent and not defined here. | ||
291 | */ | ||
292 | |||
293 | /*****************************************************************************/ | ||
294 | /* General / test commands */ | ||
295 | |||
296 | /* | ||
297 | * Get protocol version, used to deal with non-backward compatible protocol | ||
298 | * changes. | ||
299 | */ | ||
300 | #define EC_CMD_PROTO_VERSION 0x00 | ||
301 | |||
302 | struct ec_response_proto_version { | ||
303 | uint32_t version; | ||
304 | } __packed; | ||
305 | |||
306 | /* | ||
307 | * Hello. This is a simple command to test the EC is responsive to | ||
308 | * commands. | ||
309 | */ | ||
310 | #define EC_CMD_HELLO 0x01 | ||
311 | |||
312 | struct ec_params_hello { | ||
313 | uint32_t in_data; /* Pass anything here */ | ||
314 | } __packed; | ||
315 | |||
316 | struct ec_response_hello { | ||
317 | uint32_t out_data; /* Output will be in_data + 0x01020304 */ | ||
318 | } __packed; | ||
319 | |||
320 | /* Get version number */ | ||
321 | #define EC_CMD_GET_VERSION 0x02 | ||
322 | |||
323 | enum ec_current_image { | ||
324 | EC_IMAGE_UNKNOWN = 0, | ||
325 | EC_IMAGE_RO, | ||
326 | EC_IMAGE_RW | ||
327 | }; | ||
328 | |||
329 | struct ec_response_get_version { | ||
330 | /* Null-terminated version strings for RO, RW */ | ||
331 | char version_string_ro[32]; | ||
332 | char version_string_rw[32]; | ||
333 | char reserved[32]; /* Was previously RW-B string */ | ||
334 | uint32_t current_image; /* One of ec_current_image */ | ||
335 | } __packed; | ||
336 | |||
337 | /* Read test */ | ||
338 | #define EC_CMD_READ_TEST 0x03 | ||
339 | |||
340 | struct ec_params_read_test { | ||
341 | uint32_t offset; /* Starting value for read buffer */ | ||
342 | uint32_t size; /* Size to read in bytes */ | ||
343 | } __packed; | ||
344 | |||
345 | struct ec_response_read_test { | ||
346 | uint32_t data[32]; | ||
347 | } __packed; | ||
348 | |||
349 | /* | ||
350 | * Get build information | ||
351 | * | ||
352 | * Response is null-terminated string. | ||
353 | */ | ||
354 | #define EC_CMD_GET_BUILD_INFO 0x04 | ||
355 | |||
356 | /* Get chip info */ | ||
357 | #define EC_CMD_GET_CHIP_INFO 0x05 | ||
358 | |||
359 | struct ec_response_get_chip_info { | ||
360 | /* Null-terminated strings */ | ||
361 | char vendor[32]; | ||
362 | char name[32]; | ||
363 | char revision[32]; /* Mask version */ | ||
364 | } __packed; | ||
365 | |||
366 | /* Get board HW version */ | ||
367 | #define EC_CMD_GET_BOARD_VERSION 0x06 | ||
368 | |||
369 | struct ec_response_board_version { | ||
370 | uint16_t board_version; /* A monotonously incrementing number. */ | ||
371 | } __packed; | ||
372 | |||
373 | /* | ||
374 | * Read memory-mapped data. | ||
375 | * | ||
376 | * This is an alternate interface to memory-mapped data for bus protocols | ||
377 | * which don't support direct-mapped memory - I2C, SPI, etc. | ||
378 | * | ||
379 | * Response is params.size bytes of data. | ||
380 | */ | ||
381 | #define EC_CMD_READ_MEMMAP 0x07 | ||
382 | |||
383 | struct ec_params_read_memmap { | ||
384 | uint8_t offset; /* Offset in memmap (EC_MEMMAP_*) */ | ||
385 | uint8_t size; /* Size to read in bytes */ | ||
386 | } __packed; | ||
387 | |||
388 | /* Read versions supported for a command */ | ||
389 | #define EC_CMD_GET_CMD_VERSIONS 0x08 | ||
390 | |||
391 | struct ec_params_get_cmd_versions { | ||
392 | uint8_t cmd; /* Command to check */ | ||
393 | } __packed; | ||
394 | |||
395 | struct ec_response_get_cmd_versions { | ||
396 | /* | ||
397 | * Mask of supported versions; use EC_VER_MASK() to compare with a | ||
398 | * desired version. | ||
399 | */ | ||
400 | uint32_t version_mask; | ||
401 | } __packed; | ||
402 | |||
403 | /* | ||
404 | * Check EC communcations status (busy). This is needed on i2c/spi but not | ||
405 | * on lpc since it has its own out-of-band busy indicator. | ||
406 | * | ||
407 | * lpc must read the status from the command register. Attempting this on | ||
408 | * lpc will overwrite the args/parameter space and corrupt its data. | ||
409 | */ | ||
410 | #define EC_CMD_GET_COMMS_STATUS 0x09 | ||
411 | |||
412 | /* Avoid using ec_status which is for return values */ | ||
413 | enum ec_comms_status { | ||
414 | EC_COMMS_STATUS_PROCESSING = 1 << 0, /* Processing cmd */ | ||
415 | }; | ||
416 | |||
417 | struct ec_response_get_comms_status { | ||
418 | uint32_t flags; /* Mask of enum ec_comms_status */ | ||
419 | } __packed; | ||
420 | |||
421 | |||
422 | /*****************************************************************************/ | ||
423 | /* Flash commands */ | ||
424 | |||
425 | /* Get flash info */ | ||
426 | #define EC_CMD_FLASH_INFO 0x10 | ||
427 | |||
428 | struct ec_response_flash_info { | ||
429 | /* Usable flash size, in bytes */ | ||
430 | uint32_t flash_size; | ||
431 | /* | ||
432 | * Write block size. Write offset and size must be a multiple | ||
433 | * of this. | ||
434 | */ | ||
435 | uint32_t write_block_size; | ||
436 | /* | ||
437 | * Erase block size. Erase offset and size must be a multiple | ||
438 | * of this. | ||
439 | */ | ||
440 | uint32_t erase_block_size; | ||
441 | /* | ||
442 | * Protection block size. Protection offset and size must be a | ||
443 | * multiple of this. | ||
444 | */ | ||
445 | uint32_t protect_block_size; | ||
446 | } __packed; | ||
447 | |||
448 | /* | ||
449 | * Read flash | ||
450 | * | ||
451 | * Response is params.size bytes of data. | ||
452 | */ | ||
453 | #define EC_CMD_FLASH_READ 0x11 | ||
454 | |||
455 | struct ec_params_flash_read { | ||
456 | uint32_t offset; /* Byte offset to read */ | ||
457 | uint32_t size; /* Size to read in bytes */ | ||
458 | } __packed; | ||
459 | |||
460 | /* Write flash */ | ||
461 | #define EC_CMD_FLASH_WRITE 0x12 | ||
462 | |||
463 | struct ec_params_flash_write { | ||
464 | uint32_t offset; /* Byte offset to write */ | ||
465 | uint32_t size; /* Size to write in bytes */ | ||
466 | /* | ||
467 | * Data to write. Could really use EC_PARAM_SIZE - 8, but tidiest to | ||
468 | * use a power of 2 so writes stay aligned. | ||
469 | */ | ||
470 | uint8_t data[64]; | ||
471 | } __packed; | ||
472 | |||
473 | /* Erase flash */ | ||
474 | #define EC_CMD_FLASH_ERASE 0x13 | ||
475 | |||
476 | struct ec_params_flash_erase { | ||
477 | uint32_t offset; /* Byte offset to erase */ | ||
478 | uint32_t size; /* Size to erase in bytes */ | ||
479 | } __packed; | ||
480 | |||
481 | /* | ||
482 | * Get/set flash protection. | ||
483 | * | ||
484 | * If mask!=0, sets/clear the requested bits of flags. Depending on the | ||
485 | * firmware write protect GPIO, not all flags will take effect immediately; | ||
486 | * some flags require a subsequent hard reset to take effect. Check the | ||
487 | * returned flags bits to see what actually happened. | ||
488 | * | ||
489 | * If mask=0, simply returns the current flags state. | ||
490 | */ | ||
491 | #define EC_CMD_FLASH_PROTECT 0x15 | ||
492 | #define EC_VER_FLASH_PROTECT 1 /* Command version 1 */ | ||
493 | |||
494 | /* Flags for flash protection */ | ||
495 | /* RO flash code protected when the EC boots */ | ||
496 | #define EC_FLASH_PROTECT_RO_AT_BOOT (1 << 0) | ||
497 | /* | ||
498 | * RO flash code protected now. If this bit is set, at-boot status cannot | ||
499 | * be changed. | ||
500 | */ | ||
501 | #define EC_FLASH_PROTECT_RO_NOW (1 << 1) | ||
502 | /* Entire flash code protected now, until reboot. */ | ||
503 | #define EC_FLASH_PROTECT_ALL_NOW (1 << 2) | ||
504 | /* Flash write protect GPIO is asserted now */ | ||
505 | #define EC_FLASH_PROTECT_GPIO_ASSERTED (1 << 3) | ||
506 | /* Error - at least one bank of flash is stuck locked, and cannot be unlocked */ | ||
507 | #define EC_FLASH_PROTECT_ERROR_STUCK (1 << 4) | ||
508 | /* | ||
509 | * Error - flash protection is in inconsistent state. At least one bank of | ||
510 | * flash which should be protected is not protected. Usually fixed by | ||
511 | * re-requesting the desired flags, or by a hard reset if that fails. | ||
512 | */ | ||
513 | #define EC_FLASH_PROTECT_ERROR_INCONSISTENT (1 << 5) | ||
514 | /* Entile flash code protected when the EC boots */ | ||
515 | #define EC_FLASH_PROTECT_ALL_AT_BOOT (1 << 6) | ||
516 | |||
517 | struct ec_params_flash_protect { | ||
518 | uint32_t mask; /* Bits in flags to apply */ | ||
519 | uint32_t flags; /* New flags to apply */ | ||
520 | } __packed; | ||
521 | |||
522 | struct ec_response_flash_protect { | ||
523 | /* Current value of flash protect flags */ | ||
524 | uint32_t flags; | ||
525 | /* | ||
526 | * Flags which are valid on this platform. This allows the caller | ||
527 | * to distinguish between flags which aren't set vs. flags which can't | ||
528 | * be set on this platform. | ||
529 | */ | ||
530 | uint32_t valid_flags; | ||
531 | /* Flags which can be changed given the current protection state */ | ||
532 | uint32_t writable_flags; | ||
533 | } __packed; | ||
534 | |||
535 | /* | ||
536 | * Note: commands 0x14 - 0x19 version 0 were old commands to get/set flash | ||
537 | * write protect. These commands may be reused with version > 0. | ||
538 | */ | ||
539 | |||
540 | /* Get the region offset/size */ | ||
541 | #define EC_CMD_FLASH_REGION_INFO 0x16 | ||
542 | #define EC_VER_FLASH_REGION_INFO 1 | ||
543 | |||
544 | enum ec_flash_region { | ||
545 | /* Region which holds read-only EC image */ | ||
546 | EC_FLASH_REGION_RO, | ||
547 | /* Region which holds rewritable EC image */ | ||
548 | EC_FLASH_REGION_RW, | ||
549 | /* | ||
550 | * Region which should be write-protected in the factory (a superset of | ||
551 | * EC_FLASH_REGION_RO) | ||
552 | */ | ||
553 | EC_FLASH_REGION_WP_RO, | ||
554 | }; | ||
555 | |||
556 | struct ec_params_flash_region_info { | ||
557 | uint32_t region; /* enum ec_flash_region */ | ||
558 | } __packed; | ||
559 | |||
560 | struct ec_response_flash_region_info { | ||
561 | uint32_t offset; | ||
562 | uint32_t size; | ||
563 | } __packed; | ||
564 | |||
565 | /* Read/write VbNvContext */ | ||
566 | #define EC_CMD_VBNV_CONTEXT 0x17 | ||
567 | #define EC_VER_VBNV_CONTEXT 1 | ||
568 | #define EC_VBNV_BLOCK_SIZE 16 | ||
569 | |||
570 | enum ec_vbnvcontext_op { | ||
571 | EC_VBNV_CONTEXT_OP_READ, | ||
572 | EC_VBNV_CONTEXT_OP_WRITE, | ||
573 | }; | ||
574 | |||
575 | struct ec_params_vbnvcontext { | ||
576 | uint32_t op; | ||
577 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | ||
578 | } __packed; | ||
579 | |||
580 | struct ec_response_vbnvcontext { | ||
581 | uint8_t block[EC_VBNV_BLOCK_SIZE]; | ||
582 | } __packed; | ||
583 | |||
584 | /*****************************************************************************/ | ||
585 | /* PWM commands */ | ||
586 | |||
587 | /* Get fan target RPM */ | ||
588 | #define EC_CMD_PWM_GET_FAN_TARGET_RPM 0x20 | ||
589 | |||
590 | struct ec_response_pwm_get_fan_rpm { | ||
591 | uint32_t rpm; | ||
592 | } __packed; | ||
593 | |||
594 | /* Set target fan RPM */ | ||
595 | #define EC_CMD_PWM_SET_FAN_TARGET_RPM 0x21 | ||
596 | |||
597 | struct ec_params_pwm_set_fan_target_rpm { | ||
598 | uint32_t rpm; | ||
599 | } __packed; | ||
600 | |||
601 | /* Get keyboard backlight */ | ||
602 | #define EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT 0x22 | ||
603 | |||
604 | struct ec_response_pwm_get_keyboard_backlight { | ||
605 | uint8_t percent; | ||
606 | uint8_t enabled; | ||
607 | } __packed; | ||
608 | |||
609 | /* Set keyboard backlight */ | ||
610 | #define EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT 0x23 | ||
611 | |||
612 | struct ec_params_pwm_set_keyboard_backlight { | ||
613 | uint8_t percent; | ||
614 | } __packed; | ||
615 | |||
616 | /* Set target fan PWM duty cycle */ | ||
617 | #define EC_CMD_PWM_SET_FAN_DUTY 0x24 | ||
618 | |||
619 | struct ec_params_pwm_set_fan_duty { | ||
620 | uint32_t percent; | ||
621 | } __packed; | ||
622 | |||
623 | /*****************************************************************************/ | ||
624 | /* | ||
625 | * Lightbar commands. This looks worse than it is. Since we only use one HOST | ||
626 | * command to say "talk to the lightbar", we put the "and tell it to do X" part | ||
627 | * into a subcommand. We'll make separate structs for subcommands with | ||
628 | * different input args, so that we know how much to expect. | ||
629 | */ | ||
630 | #define EC_CMD_LIGHTBAR_CMD 0x28 | ||
631 | |||
632 | struct rgb_s { | ||
633 | uint8_t r, g, b; | ||
634 | }; | ||
635 | |||
636 | #define LB_BATTERY_LEVELS 4 | ||
637 | /* List of tweakable parameters. NOTE: It's __packed so it can be sent in a | ||
638 | * host command, but the alignment is the same regardless. Keep it that way. | ||
639 | */ | ||
640 | struct lightbar_params { | ||
641 | /* Timing */ | ||
642 | int google_ramp_up; | ||
643 | int google_ramp_down; | ||
644 | int s3s0_ramp_up; | ||
645 | int s0_tick_delay[2]; /* AC=0/1 */ | ||
646 | int s0a_tick_delay[2]; /* AC=0/1 */ | ||
647 | int s0s3_ramp_down; | ||
648 | int s3_sleep_for; | ||
649 | int s3_ramp_up; | ||
650 | int s3_ramp_down; | ||
651 | |||
652 | /* Oscillation */ | ||
653 | uint8_t new_s0; | ||
654 | uint8_t osc_min[2]; /* AC=0/1 */ | ||
655 | uint8_t osc_max[2]; /* AC=0/1 */ | ||
656 | uint8_t w_ofs[2]; /* AC=0/1 */ | ||
657 | |||
658 | /* Brightness limits based on the backlight and AC. */ | ||
659 | uint8_t bright_bl_off_fixed[2]; /* AC=0/1 */ | ||
660 | uint8_t bright_bl_on_min[2]; /* AC=0/1 */ | ||
661 | uint8_t bright_bl_on_max[2]; /* AC=0/1 */ | ||
662 | |||
663 | /* Battery level thresholds */ | ||
664 | uint8_t battery_threshold[LB_BATTERY_LEVELS - 1]; | ||
665 | |||
666 | /* Map [AC][battery_level] to color index */ | ||
667 | uint8_t s0_idx[2][LB_BATTERY_LEVELS]; /* AP is running */ | ||
668 | uint8_t s3_idx[2][LB_BATTERY_LEVELS]; /* AP is sleeping */ | ||
669 | |||
670 | /* Color palette */ | ||
671 | struct rgb_s color[8]; /* 0-3 are Google colors */ | ||
672 | } __packed; | ||
673 | |||
674 | struct ec_params_lightbar { | ||
675 | uint8_t cmd; /* Command (see enum lightbar_command) */ | ||
676 | union { | ||
677 | struct { | ||
678 | /* no args */ | ||
679 | } dump, off, on, init, get_seq, get_params; | ||
680 | |||
681 | struct num { | ||
682 | uint8_t num; | ||
683 | } brightness, seq, demo; | ||
684 | |||
685 | struct reg { | ||
686 | uint8_t ctrl, reg, value; | ||
687 | } reg; | ||
688 | |||
689 | struct rgb { | ||
690 | uint8_t led, red, green, blue; | ||
691 | } rgb; | ||
692 | |||
693 | struct lightbar_params set_params; | ||
694 | }; | ||
695 | } __packed; | ||
696 | |||
697 | struct ec_response_lightbar { | ||
698 | union { | ||
699 | struct dump { | ||
700 | struct { | ||
701 | uint8_t reg; | ||
702 | uint8_t ic0; | ||
703 | uint8_t ic1; | ||
704 | } vals[23]; | ||
705 | } dump; | ||
706 | |||
707 | struct get_seq { | ||
708 | uint8_t num; | ||
709 | } get_seq; | ||
710 | |||
711 | struct lightbar_params get_params; | ||
712 | |||
713 | struct { | ||
714 | /* no return params */ | ||
715 | } off, on, init, brightness, seq, reg, rgb, demo, set_params; | ||
716 | }; | ||
717 | } __packed; | ||
718 | |||
719 | /* Lightbar commands */ | ||
720 | enum lightbar_command { | ||
721 | LIGHTBAR_CMD_DUMP = 0, | ||
722 | LIGHTBAR_CMD_OFF = 1, | ||
723 | LIGHTBAR_CMD_ON = 2, | ||
724 | LIGHTBAR_CMD_INIT = 3, | ||
725 | LIGHTBAR_CMD_BRIGHTNESS = 4, | ||
726 | LIGHTBAR_CMD_SEQ = 5, | ||
727 | LIGHTBAR_CMD_REG = 6, | ||
728 | LIGHTBAR_CMD_RGB = 7, | ||
729 | LIGHTBAR_CMD_GET_SEQ = 8, | ||
730 | LIGHTBAR_CMD_DEMO = 9, | ||
731 | LIGHTBAR_CMD_GET_PARAMS = 10, | ||
732 | LIGHTBAR_CMD_SET_PARAMS = 11, | ||
733 | LIGHTBAR_NUM_CMDS | ||
734 | }; | ||
735 | |||
736 | /*****************************************************************************/ | ||
737 | /* Verified boot commands */ | ||
738 | |||
739 | /* | ||
740 | * Note: command code 0x29 version 0 was VBOOT_CMD in Link EVT; it may be | ||
741 | * reused for other purposes with version > 0. | ||
742 | */ | ||
743 | |||
744 | /* Verified boot hash command */ | ||
745 | #define EC_CMD_VBOOT_HASH 0x2A | ||
746 | |||
747 | struct ec_params_vboot_hash { | ||
748 | uint8_t cmd; /* enum ec_vboot_hash_cmd */ | ||
749 | uint8_t hash_type; /* enum ec_vboot_hash_type */ | ||
750 | uint8_t nonce_size; /* Nonce size; may be 0 */ | ||
751 | uint8_t reserved0; /* Reserved; set 0 */ | ||
752 | uint32_t offset; /* Offset in flash to hash */ | ||
753 | uint32_t size; /* Number of bytes to hash */ | ||
754 | uint8_t nonce_data[64]; /* Nonce data; ignored if nonce_size=0 */ | ||
755 | } __packed; | ||
756 | |||
757 | struct ec_response_vboot_hash { | ||
758 | uint8_t status; /* enum ec_vboot_hash_status */ | ||
759 | uint8_t hash_type; /* enum ec_vboot_hash_type */ | ||
760 | uint8_t digest_size; /* Size of hash digest in bytes */ | ||
761 | uint8_t reserved0; /* Ignore; will be 0 */ | ||
762 | uint32_t offset; /* Offset in flash which was hashed */ | ||
763 | uint32_t size; /* Number of bytes hashed */ | ||
764 | uint8_t hash_digest[64]; /* Hash digest data */ | ||
765 | } __packed; | ||
766 | |||
767 | enum ec_vboot_hash_cmd { | ||
768 | EC_VBOOT_HASH_GET = 0, /* Get current hash status */ | ||
769 | EC_VBOOT_HASH_ABORT = 1, /* Abort calculating current hash */ | ||
770 | EC_VBOOT_HASH_START = 2, /* Start computing a new hash */ | ||
771 | EC_VBOOT_HASH_RECALC = 3, /* Synchronously compute a new hash */ | ||
772 | }; | ||
773 | |||
774 | enum ec_vboot_hash_type { | ||
775 | EC_VBOOT_HASH_TYPE_SHA256 = 0, /* SHA-256 */ | ||
776 | }; | ||
777 | |||
778 | enum ec_vboot_hash_status { | ||
779 | EC_VBOOT_HASH_STATUS_NONE = 0, /* No hash (not started, or aborted) */ | ||
780 | EC_VBOOT_HASH_STATUS_DONE = 1, /* Finished computing a hash */ | ||
781 | EC_VBOOT_HASH_STATUS_BUSY = 2, /* Busy computing a hash */ | ||
782 | }; | ||
783 | |||
784 | /* | ||
785 | * Special values for offset for EC_VBOOT_HASH_START and EC_VBOOT_HASH_RECALC. | ||
786 | * If one of these is specified, the EC will automatically update offset and | ||
787 | * size to the correct values for the specified image (RO or RW). | ||
788 | */ | ||
789 | #define EC_VBOOT_HASH_OFFSET_RO 0xfffffffe | ||
790 | #define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd | ||
791 | |||
792 | /*****************************************************************************/ | ||
793 | /* USB charging control commands */ | ||
794 | |||
795 | /* Set USB port charging mode */ | ||
796 | #define EC_CMD_USB_CHARGE_SET_MODE 0x30 | ||
797 | |||
798 | struct ec_params_usb_charge_set_mode { | ||
799 | uint8_t usb_port_id; | ||
800 | uint8_t mode; | ||
801 | } __packed; | ||
802 | |||
803 | /*****************************************************************************/ | ||
804 | /* Persistent storage for host */ | ||
805 | |||
806 | /* Maximum bytes that can be read/written in a single command */ | ||
807 | #define EC_PSTORE_SIZE_MAX 64 | ||
808 | |||
809 | /* Get persistent storage info */ | ||
810 | #define EC_CMD_PSTORE_INFO 0x40 | ||
811 | |||
812 | struct ec_response_pstore_info { | ||
813 | /* Persistent storage size, in bytes */ | ||
814 | uint32_t pstore_size; | ||
815 | /* Access size; read/write offset and size must be a multiple of this */ | ||
816 | uint32_t access_size; | ||
817 | } __packed; | ||
818 | |||
819 | /* | ||
820 | * Read persistent storage | ||
821 | * | ||
822 | * Response is params.size bytes of data. | ||
823 | */ | ||
824 | #define EC_CMD_PSTORE_READ 0x41 | ||
825 | |||
826 | struct ec_params_pstore_read { | ||
827 | uint32_t offset; /* Byte offset to read */ | ||
828 | uint32_t size; /* Size to read in bytes */ | ||
829 | } __packed; | ||
830 | |||
831 | /* Write persistent storage */ | ||
832 | #define EC_CMD_PSTORE_WRITE 0x42 | ||
833 | |||
834 | struct ec_params_pstore_write { | ||
835 | uint32_t offset; /* Byte offset to write */ | ||
836 | uint32_t size; /* Size to write in bytes */ | ||
837 | uint8_t data[EC_PSTORE_SIZE_MAX]; | ||
838 | } __packed; | ||
839 | |||
840 | /*****************************************************************************/ | ||
841 | /* Real-time clock */ | ||
842 | |||
843 | /* RTC params and response structures */ | ||
844 | struct ec_params_rtc { | ||
845 | uint32_t time; | ||
846 | } __packed; | ||
847 | |||
848 | struct ec_response_rtc { | ||
849 | uint32_t time; | ||
850 | } __packed; | ||
851 | |||
852 | /* These use ec_response_rtc */ | ||
853 | #define EC_CMD_RTC_GET_VALUE 0x44 | ||
854 | #define EC_CMD_RTC_GET_ALARM 0x45 | ||
855 | |||
856 | /* These all use ec_params_rtc */ | ||
857 | #define EC_CMD_RTC_SET_VALUE 0x46 | ||
858 | #define EC_CMD_RTC_SET_ALARM 0x47 | ||
859 | |||
860 | /*****************************************************************************/ | ||
861 | /* Port80 log access */ | ||
862 | |||
863 | /* Get last port80 code from previous boot */ | ||
864 | #define EC_CMD_PORT80_LAST_BOOT 0x48 | ||
865 | |||
866 | struct ec_response_port80_last_boot { | ||
867 | uint16_t code; | ||
868 | } __packed; | ||
869 | |||
870 | /*****************************************************************************/ | ||
871 | /* Thermal engine commands */ | ||
872 | |||
873 | /* Set thershold value */ | ||
874 | #define EC_CMD_THERMAL_SET_THRESHOLD 0x50 | ||
875 | |||
876 | struct ec_params_thermal_set_threshold { | ||
877 | uint8_t sensor_type; | ||
878 | uint8_t threshold_id; | ||
879 | uint16_t value; | ||
880 | } __packed; | ||
881 | |||
882 | /* Get threshold value */ | ||
883 | #define EC_CMD_THERMAL_GET_THRESHOLD 0x51 | ||
884 | |||
885 | struct ec_params_thermal_get_threshold { | ||
886 | uint8_t sensor_type; | ||
887 | uint8_t threshold_id; | ||
888 | } __packed; | ||
889 | |||
890 | struct ec_response_thermal_get_threshold { | ||
891 | uint16_t value; | ||
892 | } __packed; | ||
893 | |||
894 | /* Toggle automatic fan control */ | ||
895 | #define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52 | ||
896 | |||
897 | /* Get TMP006 calibration data */ | ||
898 | #define EC_CMD_TMP006_GET_CALIBRATION 0x53 | ||
899 | |||
900 | struct ec_params_tmp006_get_calibration { | ||
901 | uint8_t index; | ||
902 | } __packed; | ||
903 | |||
904 | struct ec_response_tmp006_get_calibration { | ||
905 | float s0; | ||
906 | float b0; | ||
907 | float b1; | ||
908 | float b2; | ||
909 | } __packed; | ||
910 | |||
911 | /* Set TMP006 calibration data */ | ||
912 | #define EC_CMD_TMP006_SET_CALIBRATION 0x54 | ||
913 | |||
914 | struct ec_params_tmp006_set_calibration { | ||
915 | uint8_t index; | ||
916 | uint8_t reserved[3]; /* Reserved; set 0 */ | ||
917 | float s0; | ||
918 | float b0; | ||
919 | float b1; | ||
920 | float b2; | ||
921 | } __packed; | ||
922 | |||
923 | /*****************************************************************************/ | ||
924 | /* MKBP - Matrix KeyBoard Protocol */ | ||
925 | |||
926 | /* | ||
927 | * Read key state | ||
928 | * | ||
929 | * Returns raw data for keyboard cols; see ec_response_mkbp_info.cols for | ||
930 | * expected response size. | ||
931 | */ | ||
932 | #define EC_CMD_MKBP_STATE 0x60 | ||
933 | |||
934 | /* Provide information about the matrix : number of rows and columns */ | ||
935 | #define EC_CMD_MKBP_INFO 0x61 | ||
936 | |||
937 | struct ec_response_mkbp_info { | ||
938 | uint32_t rows; | ||
939 | uint32_t cols; | ||
940 | uint8_t switches; | ||
941 | } __packed; | ||
942 | |||
943 | /* Simulate key press */ | ||
944 | #define EC_CMD_MKBP_SIMULATE_KEY 0x62 | ||
945 | |||
946 | struct ec_params_mkbp_simulate_key { | ||
947 | uint8_t col; | ||
948 | uint8_t row; | ||
949 | uint8_t pressed; | ||
950 | } __packed; | ||
951 | |||
952 | /* Configure keyboard scanning */ | ||
953 | #define EC_CMD_MKBP_SET_CONFIG 0x64 | ||
954 | #define EC_CMD_MKBP_GET_CONFIG 0x65 | ||
955 | |||
956 | /* flags */ | ||
957 | enum mkbp_config_flags { | ||
958 | EC_MKBP_FLAGS_ENABLE = 1, /* Enable keyboard scanning */ | ||
959 | }; | ||
960 | |||
961 | enum mkbp_config_valid { | ||
962 | EC_MKBP_VALID_SCAN_PERIOD = 1 << 0, | ||
963 | EC_MKBP_VALID_POLL_TIMEOUT = 1 << 1, | ||
964 | EC_MKBP_VALID_MIN_POST_SCAN_DELAY = 1 << 3, | ||
965 | EC_MKBP_VALID_OUTPUT_SETTLE = 1 << 4, | ||
966 | EC_MKBP_VALID_DEBOUNCE_DOWN = 1 << 5, | ||
967 | EC_MKBP_VALID_DEBOUNCE_UP = 1 << 6, | ||
968 | EC_MKBP_VALID_FIFO_MAX_DEPTH = 1 << 7, | ||
969 | }; | ||
970 | |||
971 | /* Configuration for our key scanning algorithm */ | ||
972 | struct ec_mkbp_config { | ||
973 | uint32_t valid_mask; /* valid fields */ | ||
974 | uint8_t flags; /* some flags (enum mkbp_config_flags) */ | ||
975 | uint8_t valid_flags; /* which flags are valid */ | ||
976 | uint16_t scan_period_us; /* period between start of scans */ | ||
977 | /* revert to interrupt mode after no activity for this long */ | ||
978 | uint32_t poll_timeout_us; | ||
979 | /* | ||
980 | * minimum post-scan relax time. Once we finish a scan we check | ||
981 | * the time until we are due to start the next one. If this time is | ||
982 | * shorter this field, we use this instead. | ||
983 | */ | ||
984 | uint16_t min_post_scan_delay_us; | ||
985 | /* delay between setting up output and waiting for it to settle */ | ||
986 | uint16_t output_settle_us; | ||
987 | uint16_t debounce_down_us; /* time for debounce on key down */ | ||
988 | uint16_t debounce_up_us; /* time for debounce on key up */ | ||
989 | /* maximum depth to allow for fifo (0 = no keyscan output) */ | ||
990 | uint8_t fifo_max_depth; | ||
991 | } __packed; | ||
992 | |||
993 | struct ec_params_mkbp_set_config { | ||
994 | struct ec_mkbp_config config; | ||
995 | } __packed; | ||
996 | |||
997 | struct ec_response_mkbp_get_config { | ||
998 | struct ec_mkbp_config config; | ||
999 | } __packed; | ||
1000 | |||
1001 | /* Run the key scan emulation */ | ||
1002 | #define EC_CMD_KEYSCAN_SEQ_CTRL 0x66 | ||
1003 | |||
1004 | enum ec_keyscan_seq_cmd { | ||
1005 | EC_KEYSCAN_SEQ_STATUS = 0, /* Get status information */ | ||
1006 | EC_KEYSCAN_SEQ_CLEAR = 1, /* Clear sequence */ | ||
1007 | EC_KEYSCAN_SEQ_ADD = 2, /* Add item to sequence */ | ||
1008 | EC_KEYSCAN_SEQ_START = 3, /* Start running sequence */ | ||
1009 | EC_KEYSCAN_SEQ_COLLECT = 4, /* Collect sequence summary data */ | ||
1010 | }; | ||
1011 | |||
1012 | enum ec_collect_flags { | ||
1013 | /* | ||
1014 | * Indicates this scan was processed by the EC. Due to timing, some | ||
1015 | * scans may be skipped. | ||
1016 | */ | ||
1017 | EC_KEYSCAN_SEQ_FLAG_DONE = 1 << 0, | ||
1018 | }; | ||
1019 | |||
1020 | struct ec_collect_item { | ||
1021 | uint8_t flags; /* some flags (enum ec_collect_flags) */ | ||
1022 | }; | ||
1023 | |||
1024 | struct ec_params_keyscan_seq_ctrl { | ||
1025 | uint8_t cmd; /* Command to send (enum ec_keyscan_seq_cmd) */ | ||
1026 | union { | ||
1027 | struct { | ||
1028 | uint8_t active; /* still active */ | ||
1029 | uint8_t num_items; /* number of items */ | ||
1030 | /* Current item being presented */ | ||
1031 | uint8_t cur_item; | ||
1032 | } status; | ||
1033 | struct { | ||
1034 | /* | ||
1035 | * Absolute time for this scan, measured from the | ||
1036 | * start of the sequence. | ||
1037 | */ | ||
1038 | uint32_t time_us; | ||
1039 | uint8_t scan[0]; /* keyscan data */ | ||
1040 | } add; | ||
1041 | struct { | ||
1042 | uint8_t start_item; /* First item to return */ | ||
1043 | uint8_t num_items; /* Number of items to return */ | ||
1044 | } collect; | ||
1045 | }; | ||
1046 | } __packed; | ||
1047 | |||
1048 | struct ec_result_keyscan_seq_ctrl { | ||
1049 | union { | ||
1050 | struct { | ||
1051 | uint8_t num_items; /* Number of items */ | ||
1052 | /* Data for each item */ | ||
1053 | struct ec_collect_item item[0]; | ||
1054 | } collect; | ||
1055 | }; | ||
1056 | } __packed; | ||
1057 | |||
1058 | /*****************************************************************************/ | ||
1059 | /* Temperature sensor commands */ | ||
1060 | |||
1061 | /* Read temperature sensor info */ | ||
1062 | #define EC_CMD_TEMP_SENSOR_GET_INFO 0x70 | ||
1063 | |||
1064 | struct ec_params_temp_sensor_get_info { | ||
1065 | uint8_t id; | ||
1066 | } __packed; | ||
1067 | |||
1068 | struct ec_response_temp_sensor_get_info { | ||
1069 | char sensor_name[32]; | ||
1070 | uint8_t sensor_type; | ||
1071 | } __packed; | ||
1072 | |||
1073 | /*****************************************************************************/ | ||
1074 | |||
1075 | /* | ||
1076 | * Note: host commands 0x80 - 0x87 are reserved to avoid conflict with ACPI | ||
1077 | * commands accidentally sent to the wrong interface. See the ACPI section | ||
1078 | * below. | ||
1079 | */ | ||
1080 | |||
1081 | /*****************************************************************************/ | ||
1082 | /* Host event commands */ | ||
1083 | |||
1084 | /* | ||
1085 | * Host event mask params and response structures, shared by all of the host | ||
1086 | * event commands below. | ||
1087 | */ | ||
1088 | struct ec_params_host_event_mask { | ||
1089 | uint32_t mask; | ||
1090 | } __packed; | ||
1091 | |||
1092 | struct ec_response_host_event_mask { | ||
1093 | uint32_t mask; | ||
1094 | } __packed; | ||
1095 | |||
1096 | /* These all use ec_response_host_event_mask */ | ||
1097 | #define EC_CMD_HOST_EVENT_GET_B 0x87 | ||
1098 | #define EC_CMD_HOST_EVENT_GET_SMI_MASK 0x88 | ||
1099 | #define EC_CMD_HOST_EVENT_GET_SCI_MASK 0x89 | ||
1100 | #define EC_CMD_HOST_EVENT_GET_WAKE_MASK 0x8d | ||
1101 | |||
1102 | /* These all use ec_params_host_event_mask */ | ||
1103 | #define EC_CMD_HOST_EVENT_SET_SMI_MASK 0x8a | ||
1104 | #define EC_CMD_HOST_EVENT_SET_SCI_MASK 0x8b | ||
1105 | #define EC_CMD_HOST_EVENT_CLEAR 0x8c | ||
1106 | #define EC_CMD_HOST_EVENT_SET_WAKE_MASK 0x8e | ||
1107 | #define EC_CMD_HOST_EVENT_CLEAR_B 0x8f | ||
1108 | |||
1109 | /*****************************************************************************/ | ||
1110 | /* Switch commands */ | ||
1111 | |||
1112 | /* Enable/disable LCD backlight */ | ||
1113 | #define EC_CMD_SWITCH_ENABLE_BKLIGHT 0x90 | ||
1114 | |||
1115 | struct ec_params_switch_enable_backlight { | ||
1116 | uint8_t enabled; | ||
1117 | } __packed; | ||
1118 | |||
1119 | /* Enable/disable WLAN/Bluetooth */ | ||
1120 | #define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 | ||
1121 | |||
1122 | struct ec_params_switch_enable_wireless { | ||
1123 | uint8_t enabled; | ||
1124 | } __packed; | ||
1125 | |||
1126 | /*****************************************************************************/ | ||
1127 | /* GPIO commands. Only available on EC if write protect has been disabled. */ | ||
1128 | |||
1129 | /* Set GPIO output value */ | ||
1130 | #define EC_CMD_GPIO_SET 0x92 | ||
1131 | |||
1132 | struct ec_params_gpio_set { | ||
1133 | char name[32]; | ||
1134 | uint8_t val; | ||
1135 | } __packed; | ||
1136 | |||
1137 | /* Get GPIO value */ | ||
1138 | #define EC_CMD_GPIO_GET 0x93 | ||
1139 | |||
1140 | struct ec_params_gpio_get { | ||
1141 | char name[32]; | ||
1142 | } __packed; | ||
1143 | struct ec_response_gpio_get { | ||
1144 | uint8_t val; | ||
1145 | } __packed; | ||
1146 | |||
1147 | /*****************************************************************************/ | ||
1148 | /* I2C commands. Only available when flash write protect is unlocked. */ | ||
1149 | |||
1150 | /* Read I2C bus */ | ||
1151 | #define EC_CMD_I2C_READ 0x94 | ||
1152 | |||
1153 | struct ec_params_i2c_read { | ||
1154 | uint16_t addr; | ||
1155 | uint8_t read_size; /* Either 8 or 16. */ | ||
1156 | uint8_t port; | ||
1157 | uint8_t offset; | ||
1158 | } __packed; | ||
1159 | struct ec_response_i2c_read { | ||
1160 | uint16_t data; | ||
1161 | } __packed; | ||
1162 | |||
1163 | /* Write I2C bus */ | ||
1164 | #define EC_CMD_I2C_WRITE 0x95 | ||
1165 | |||
1166 | struct ec_params_i2c_write { | ||
1167 | uint16_t data; | ||
1168 | uint16_t addr; | ||
1169 | uint8_t write_size; /* Either 8 or 16. */ | ||
1170 | uint8_t port; | ||
1171 | uint8_t offset; | ||
1172 | } __packed; | ||
1173 | |||
1174 | /*****************************************************************************/ | ||
1175 | /* Charge state commands. Only available when flash write protect unlocked. */ | ||
1176 | |||
1177 | /* Force charge state machine to stop in idle mode */ | ||
1178 | #define EC_CMD_CHARGE_FORCE_IDLE 0x96 | ||
1179 | |||
1180 | struct ec_params_force_idle { | ||
1181 | uint8_t enabled; | ||
1182 | } __packed; | ||
1183 | |||
1184 | /*****************************************************************************/ | ||
1185 | /* Console commands. Only available when flash write protect is unlocked. */ | ||
1186 | |||
1187 | /* Snapshot console output buffer for use by EC_CMD_CONSOLE_READ. */ | ||
1188 | #define EC_CMD_CONSOLE_SNAPSHOT 0x97 | ||
1189 | |||
1190 | /* | ||
1191 | * Read next chunk of data from saved snapshot. | ||
1192 | * | ||
1193 | * Response is null-terminated string. Empty string, if there is no more | ||
1194 | * remaining output. | ||
1195 | */ | ||
1196 | #define EC_CMD_CONSOLE_READ 0x98 | ||
1197 | |||
1198 | /*****************************************************************************/ | ||
1199 | |||
1200 | /* | ||
1201 | * Cut off battery power output if the battery supports. | ||
1202 | * | ||
1203 | * For unsupported battery, just don't implement this command and lets EC | ||
1204 | * return EC_RES_INVALID_COMMAND. | ||
1205 | */ | ||
1206 | #define EC_CMD_BATTERY_CUT_OFF 0x99 | ||
1207 | |||
1208 | /*****************************************************************************/ | ||
1209 | /* Temporary debug commands. TODO: remove this crosbug.com/p/13849 */ | ||
1210 | |||
1211 | /* | ||
1212 | * Dump charge state machine context. | ||
1213 | * | ||
1214 | * Response is a binary dump of charge state machine context. | ||
1215 | */ | ||
1216 | #define EC_CMD_CHARGE_DUMP 0xa0 | ||
1217 | |||
1218 | /* | ||
1219 | * Set maximum battery charging current. | ||
1220 | */ | ||
1221 | #define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1 | ||
1222 | |||
1223 | struct ec_params_current_limit { | ||
1224 | uint32_t limit; | ||
1225 | } __packed; | ||
1226 | |||
1227 | /*****************************************************************************/ | ||
1228 | /* System commands */ | ||
1229 | |||
1230 | /* | ||
1231 | * TODO: this is a confusing name, since it doesn't necessarily reboot the EC. | ||
1232 | * Rename to "set image" or something similar. | ||
1233 | */ | ||
1234 | #define EC_CMD_REBOOT_EC 0xd2 | ||
1235 | |||
1236 | /* Command */ | ||
1237 | enum ec_reboot_cmd { | ||
1238 | EC_REBOOT_CANCEL = 0, /* Cancel a pending reboot */ | ||
1239 | EC_REBOOT_JUMP_RO = 1, /* Jump to RO without rebooting */ | ||
1240 | EC_REBOOT_JUMP_RW = 2, /* Jump to RW without rebooting */ | ||
1241 | /* (command 3 was jump to RW-B) */ | ||
1242 | EC_REBOOT_COLD = 4, /* Cold-reboot */ | ||
1243 | EC_REBOOT_DISABLE_JUMP = 5, /* Disable jump until next reboot */ | ||
1244 | EC_REBOOT_HIBERNATE = 6 /* Hibernate EC */ | ||
1245 | }; | ||
1246 | |||
1247 | /* Flags for ec_params_reboot_ec.reboot_flags */ | ||
1248 | #define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */ | ||
1249 | #define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */ | ||
1250 | |||
1251 | struct ec_params_reboot_ec { | ||
1252 | uint8_t cmd; /* enum ec_reboot_cmd */ | ||
1253 | uint8_t flags; /* See EC_REBOOT_FLAG_* */ | ||
1254 | } __packed; | ||
1255 | |||
1256 | /* | ||
1257 | * Get information on last EC panic. | ||
1258 | * | ||
1259 | * Returns variable-length platform-dependent panic information. See panic.h | ||
1260 | * for details. | ||
1261 | */ | ||
1262 | #define EC_CMD_GET_PANIC_INFO 0xd3 | ||
1263 | |||
1264 | /*****************************************************************************/ | ||
1265 | /* | ||
1266 | * ACPI commands | ||
1267 | * | ||
1268 | * These are valid ONLY on the ACPI command/data port. | ||
1269 | */ | ||
1270 | |||
1271 | /* | ||
1272 | * ACPI Read Embedded Controller | ||
1273 | * | ||
1274 | * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). | ||
1275 | * | ||
1276 | * Use the following sequence: | ||
1277 | * | ||
1278 | * - Write EC_CMD_ACPI_READ to EC_LPC_ADDR_ACPI_CMD | ||
1279 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
1280 | * - Write address to EC_LPC_ADDR_ACPI_DATA | ||
1281 | * - Wait for EC_LPC_CMDR_DATA bit to set | ||
1282 | * - Read value from EC_LPC_ADDR_ACPI_DATA | ||
1283 | */ | ||
1284 | #define EC_CMD_ACPI_READ 0x80 | ||
1285 | |||
1286 | /* | ||
1287 | * ACPI Write Embedded Controller | ||
1288 | * | ||
1289 | * This reads from ACPI memory space on the EC (EC_ACPI_MEM_*). | ||
1290 | * | ||
1291 | * Use the following sequence: | ||
1292 | * | ||
1293 | * - Write EC_CMD_ACPI_WRITE to EC_LPC_ADDR_ACPI_CMD | ||
1294 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
1295 | * - Write address to EC_LPC_ADDR_ACPI_DATA | ||
1296 | * - Wait for EC_LPC_CMDR_PENDING bit to clear | ||
1297 | * - Write value to EC_LPC_ADDR_ACPI_DATA | ||
1298 | */ | ||
1299 | #define EC_CMD_ACPI_WRITE 0x81 | ||
1300 | |||
1301 | /* | ||
1302 | * ACPI Query Embedded Controller | ||
1303 | * | ||
1304 | * This clears the lowest-order bit in the currently pending host events, and | ||
1305 | * sets the result code to the 1-based index of the bit (event 0x00000001 = 1, | ||
1306 | * event 0x80000000 = 32), or 0 if no event was pending. | ||
1307 | */ | ||
1308 | #define EC_CMD_ACPI_QUERY_EVENT 0x84 | ||
1309 | |||
1310 | /* Valid addresses in ACPI memory space, for read/write commands */ | ||
1311 | /* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */ | ||
1312 | #define EC_ACPI_MEM_VERSION 0x00 | ||
1313 | /* | ||
1314 | * Test location; writing value here updates test compliment byte to (0xff - | ||
1315 | * value). | ||
1316 | */ | ||
1317 | #define EC_ACPI_MEM_TEST 0x01 | ||
1318 | /* Test compliment; writes here are ignored. */ | ||
1319 | #define EC_ACPI_MEM_TEST_COMPLIMENT 0x02 | ||
1320 | /* Keyboard backlight brightness percent (0 - 100) */ | ||
1321 | #define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03 | ||
1322 | |||
1323 | /* Current version of ACPI memory address space */ | ||
1324 | #define EC_ACPI_MEM_VERSION_CURRENT 1 | ||
1325 | |||
1326 | |||
1327 | /*****************************************************************************/ | ||
1328 | /* | ||
1329 | * Special commands | ||
1330 | * | ||
1331 | * These do not follow the normal rules for commands. See each command for | ||
1332 | * details. | ||
1333 | */ | ||
1334 | |||
1335 | /* | ||
1336 | * Reboot NOW | ||
1337 | * | ||
1338 | * This command will work even when the EC LPC interface is busy, because the | ||
1339 | * reboot command is processed at interrupt level. Note that when the EC | ||
1340 | * reboots, the host will reboot too, so there is no response to this command. | ||
1341 | * | ||
1342 | * Use EC_CMD_REBOOT_EC to reboot the EC more politely. | ||
1343 | */ | ||
1344 | #define EC_CMD_REBOOT 0xd1 /* Think "die" */ | ||
1345 | |||
1346 | /* | ||
1347 | * Resend last response (not supported on LPC). | ||
1348 | * | ||
1349 | * Returns EC_RES_UNAVAILABLE if there is no response available - for example, | ||
1350 | * there was no previous command, or the previous command's response was too | ||
1351 | * big to save. | ||
1352 | */ | ||
1353 | #define EC_CMD_RESEND_RESPONSE 0xdb | ||
1354 | |||
1355 | /* | ||
1356 | * This header byte on a command indicate version 0. Any header byte less | ||
1357 | * than this means that we are talking to an old EC which doesn't support | ||
1358 | * versioning. In that case, we assume version 0. | ||
1359 | * | ||
1360 | * Header bytes greater than this indicate a later version. For example, | ||
1361 | * EC_CMD_VERSION0 + 1 means we are using version 1. | ||
1362 | * | ||
1363 | * The old EC interface must not use commands 0dc or higher. | ||
1364 | */ | ||
1365 | #define EC_CMD_VERSION0 0xdc | ||
1366 | |||
1367 | #endif /* !__ACPI__ */ | ||
1368 | |||
1369 | #endif /* __CROS_EC_COMMANDS_H */ | ||
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h index 77a46ae2fc17..0bd69446bb05 100644 --- a/include/linux/mfd/db8500-prcmu.h +++ b/include/linux/mfd/db8500-prcmu.h | |||
@@ -489,7 +489,7 @@ struct prcmu_auto_pm_config { | |||
489 | 489 | ||
490 | #ifdef CONFIG_MFD_DB8500_PRCMU | 490 | #ifdef CONFIG_MFD_DB8500_PRCMU |
491 | 491 | ||
492 | void db8500_prcmu_early_init(void); | 492 | void db8500_prcmu_early_init(u32 phy_base, u32 size); |
493 | int prcmu_set_rc_a2p(enum romcode_write); | 493 | int prcmu_set_rc_a2p(enum romcode_write); |
494 | enum romcode_read prcmu_get_rc_p2a(void); | 494 | enum romcode_read prcmu_get_rc_p2a(void); |
495 | enum ap_pwrst prcmu_get_xp70_current_state(void); | 495 | enum ap_pwrst prcmu_get_xp70_current_state(void); |
@@ -522,12 +522,6 @@ int db8500_prcmu_load_a9wdog(u8 id, u32 val); | |||
522 | void db8500_prcmu_system_reset(u16 reset_code); | 522 | void db8500_prcmu_system_reset(u16 reset_code); |
523 | int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); | 523 | int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); |
524 | u8 db8500_prcmu_get_power_state_result(void); | 524 | u8 db8500_prcmu_get_power_state_result(void); |
525 | int db8500_prcmu_gic_decouple(void); | ||
526 | int db8500_prcmu_gic_recouple(void); | ||
527 | int db8500_prcmu_copy_gic_settings(void); | ||
528 | bool db8500_prcmu_gic_pending_irq(void); | ||
529 | bool db8500_prcmu_pending_irq(void); | ||
530 | bool db8500_prcmu_is_cpu_in_wfi(int cpu); | ||
531 | void db8500_prcmu_enable_wakeups(u32 wakeups); | 525 | void db8500_prcmu_enable_wakeups(u32 wakeups); |
532 | int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); | 526 | int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); |
533 | int db8500_prcmu_request_clock(u8 clock, bool enable); | 527 | int db8500_prcmu_request_clock(u8 clock, bool enable); |
@@ -553,7 +547,7 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value); | |||
553 | 547 | ||
554 | #else /* !CONFIG_MFD_DB8500_PRCMU */ | 548 | #else /* !CONFIG_MFD_DB8500_PRCMU */ |
555 | 549 | ||
556 | static inline void db8500_prcmu_early_init(void) {} | 550 | static inline void db8500_prcmu_early_init(u32 phy_base, u32 size) {} |
557 | 551 | ||
558 | static inline int prcmu_set_rc_a2p(enum romcode_write code) | 552 | static inline int prcmu_set_rc_a2p(enum romcode_write code) |
559 | { | 553 | { |
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h index 3abcca91eecd..689e6a0d9c99 100644 --- a/include/linux/mfd/dbx500-prcmu.h +++ b/include/linux/mfd/dbx500-prcmu.h | |||
@@ -237,6 +237,8 @@ struct prcmu_pdata | |||
237 | bool enable_set_ddr_opp; | 237 | bool enable_set_ddr_opp; |
238 | bool enable_ape_opp_100_voltage; | 238 | bool enable_ape_opp_100_voltage; |
239 | struct ab8500_platform_data *ab_platdata; | 239 | struct ab8500_platform_data *ab_platdata; |
240 | int ab_irq; | ||
241 | int irq_base; | ||
240 | u32 version_offset; | 242 | u32 version_offset; |
241 | u32 legacy_offset; | 243 | u32 legacy_offset; |
242 | u32 adt_offset; | 244 | u32 adt_offset; |
@@ -276,9 +278,9 @@ struct prcmu_fw_version { | |||
276 | 278 | ||
277 | #if defined(CONFIG_UX500_SOC_DB8500) | 279 | #if defined(CONFIG_UX500_SOC_DB8500) |
278 | 280 | ||
279 | static inline void __init prcmu_early_init(void) | 281 | static inline void prcmu_early_init(u32 phy_base, u32 size) |
280 | { | 282 | { |
281 | return db8500_prcmu_early_init(); | 283 | return db8500_prcmu_early_init(phy_base, size); |
282 | } | 284 | } |
283 | 285 | ||
284 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 286 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
@@ -293,36 +295,6 @@ static inline u8 prcmu_get_power_state_result(void) | |||
293 | return db8500_prcmu_get_power_state_result(); | 295 | return db8500_prcmu_get_power_state_result(); |
294 | } | 296 | } |
295 | 297 | ||
296 | static inline int prcmu_gic_decouple(void) | ||
297 | { | ||
298 | return db8500_prcmu_gic_decouple(); | ||
299 | } | ||
300 | |||
301 | static inline int prcmu_gic_recouple(void) | ||
302 | { | ||
303 | return db8500_prcmu_gic_recouple(); | ||
304 | } | ||
305 | |||
306 | static inline bool prcmu_gic_pending_irq(void) | ||
307 | { | ||
308 | return db8500_prcmu_gic_pending_irq(); | ||
309 | } | ||
310 | |||
311 | static inline bool prcmu_is_cpu_in_wfi(int cpu) | ||
312 | { | ||
313 | return db8500_prcmu_is_cpu_in_wfi(cpu); | ||
314 | } | ||
315 | |||
316 | static inline int prcmu_copy_gic_settings(void) | ||
317 | { | ||
318 | return db8500_prcmu_copy_gic_settings(); | ||
319 | } | ||
320 | |||
321 | static inline bool prcmu_pending_irq(void) | ||
322 | { | ||
323 | return db8500_prcmu_pending_irq(); | ||
324 | } | ||
325 | |||
326 | static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) | 298 | static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) |
327 | { | 299 | { |
328 | return db8500_prcmu_set_epod(epod_id, epod_state); | 300 | return db8500_prcmu_set_epod(epod_id, epod_state); |
@@ -500,7 +472,7 @@ static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) | |||
500 | } | 472 | } |
501 | #else | 473 | #else |
502 | 474 | ||
503 | static inline void __init prcmu_early_init(void) {} | 475 | static inline void prcmu_early_init(u32 phy_base, u32 size) {} |
504 | 476 | ||
505 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 477 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
506 | bool keep_ap_pll) | 478 | bool keep_ap_pll) |
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 3bbda22721ea..8f21daf62fb5 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
@@ -1,9 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * TI Palmas | 2 | * TI Palmas |
3 | * | 3 | * |
4 | * Copyright 2011 Texas Instruments Inc. | 4 | * Copyright 2011-2013 Texas Instruments Inc. |
5 | * | 5 | * |
6 | * Author: Graeme Gregory <gg@slimlogic.co.uk> | 6 | * Author: Graeme Gregory <gg@slimlogic.co.uk> |
7 | * Author: Ian Lartey <ian@slimlogic.co.uk> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 10 | * under the terms of the GNU General Public License as published by the |
@@ -22,6 +23,15 @@ | |||
22 | 23 | ||
23 | #define PALMAS_NUM_CLIENTS 3 | 24 | #define PALMAS_NUM_CLIENTS 3 |
24 | 25 | ||
26 | /* The ID_REVISION NUMBERS */ | ||
27 | #define PALMAS_CHIP_OLD_ID 0x0000 | ||
28 | #define PALMAS_CHIP_ID 0xC035 | ||
29 | #define PALMAS_CHIP_CHARGER_ID 0xC036 | ||
30 | |||
31 | #define is_palmas(a) (((a) == PALMAS_CHIP_OLD_ID) || \ | ||
32 | ((a) == PALMAS_CHIP_ID)) | ||
33 | #define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) | ||
34 | |||
25 | struct palmas_pmic; | 35 | struct palmas_pmic; |
26 | struct palmas_gpadc; | 36 | struct palmas_gpadc; |
27 | struct palmas_resource; | 37 | struct palmas_resource; |
@@ -109,19 +119,6 @@ struct palmas_reg_init { | |||
109 | */ | 119 | */ |
110 | int mode_sleep; | 120 | int mode_sleep; |
111 | 121 | ||
112 | /* tstep is the timestep loaded to the TSTEP register | ||
113 | * | ||
114 | * For SMPS | ||
115 | * | ||
116 | * 0: Jump (no slope control) | ||
117 | * 1: 10mV/us | ||
118 | * 2: 5mV/us | ||
119 | * 3: 2.5mV/us | ||
120 | * | ||
121 | * For LDO unused | ||
122 | */ | ||
123 | int tstep; | ||
124 | |||
125 | /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE | 122 | /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE |
126 | * register. Set this is the default voltage set in OTP needs | 123 | * register. Set this is the default voltage set in OTP needs |
127 | * to be overridden. | 124 | * to be overridden. |
@@ -154,6 +151,12 @@ enum palmas_regulators { | |||
154 | PALMAS_REG_LDO9, | 151 | PALMAS_REG_LDO9, |
155 | PALMAS_REG_LDOLN, | 152 | PALMAS_REG_LDOLN, |
156 | PALMAS_REG_LDOUSB, | 153 | PALMAS_REG_LDOUSB, |
154 | /* External regulators */ | ||
155 | PALMAS_REG_REGEN1, | ||
156 | PALMAS_REG_REGEN2, | ||
157 | PALMAS_REG_REGEN3, | ||
158 | PALMAS_REG_SYSEN1, | ||
159 | PALMAS_REG_SYSEN2, | ||
157 | /* Total number of regulators */ | 160 | /* Total number of regulators */ |
158 | PALMAS_NUM_REGS, | 161 | PALMAS_NUM_REGS, |
159 | }; | 162 | }; |
@@ -171,6 +174,9 @@ struct palmas_pmic_platform_data { | |||
171 | 174 | ||
172 | /* use LDO6 for vibrator control */ | 175 | /* use LDO6 for vibrator control */ |
173 | int ldo6_vibrator; | 176 | int ldo6_vibrator; |
177 | |||
178 | /* Enable tracking mode of LDO8 */ | ||
179 | bool enable_ldo8_tracking; | ||
174 | }; | 180 | }; |
175 | 181 | ||
176 | struct palmas_usb_platform_data { | 182 | struct palmas_usb_platform_data { |
@@ -331,6 +337,8 @@ struct palmas_pmic { | |||
331 | int smps457; | 337 | int smps457; |
332 | 338 | ||
333 | int range[PALMAS_REG_SMPS10]; | 339 | int range[PALMAS_REG_SMPS10]; |
340 | unsigned int ramp_delay[PALMAS_REG_SMPS10]; | ||
341 | unsigned int current_reg_mode[PALMAS_REG_SMPS10]; | ||
334 | }; | 342 | }; |
335 | 343 | ||
336 | struct palmas_resource { | 344 | struct palmas_resource { |
diff --git a/include/linux/mfd/retu.h b/include/linux/mfd/retu.h index 1e2715d5b836..65471c4a3926 100644 --- a/include/linux/mfd/retu.h +++ b/include/linux/mfd/retu.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Retu MFD driver interface | 2 | * Retu/Tahvo MFD driver interface |
3 | * | 3 | * |
4 | * This file is subject to the terms and conditions of the GNU General | 4 | * This file is subject to the terms and conditions of the GNU General |
5 | * Public License. See the file "COPYING" in the main directory of this | 5 | * Public License. See the file "COPYING" in the main directory of this |
@@ -19,4 +19,10 @@ int retu_write(struct retu_dev *, u8, u16); | |||
19 | #define RETU_REG_CC1 0x0d /* Common control register 1 */ | 19 | #define RETU_REG_CC1 0x0d /* Common control register 1 */ |
20 | #define RETU_REG_STATUS 0x16 /* Status register */ | 20 | #define RETU_REG_STATUS 0x16 /* Status register */ |
21 | 21 | ||
22 | /* Interrupt sources */ | ||
23 | #define TAHVO_INT_VBUS 0 /* VBUS state */ | ||
24 | |||
25 | /* Interrupt status */ | ||
26 | #define TAHVO_STAT_VBUS (1 << TAHVO_INT_VBUS) | ||
27 | |||
22 | #endif /* __LINUX_MFD_RETU_H */ | 28 | #endif /* __LINUX_MFD_RETU_H */ |
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h index 26ea7f1b7caf..86bc635f8385 100644 --- a/include/linux/mfd/rtsx_pci.h +++ b/include/linux/mfd/rtsx_pci.h | |||
@@ -500,6 +500,8 @@ | |||
500 | #define BPP_POWER_15_PERCENT_ON 0x08 | 500 | #define BPP_POWER_15_PERCENT_ON 0x08 |
501 | #define BPP_POWER_ON 0x00 | 501 | #define BPP_POWER_ON 0x00 |
502 | #define BPP_POWER_MASK 0x0F | 502 | #define BPP_POWER_MASK 0x0F |
503 | #define SD_VCC_PARTIAL_POWER_ON 0x02 | ||
504 | #define SD_VCC_POWER_ON 0x00 | ||
503 | 505 | ||
504 | /* PWR_GATE_CTRL */ | 506 | /* PWR_GATE_CTRL */ |
505 | #define PWR_GATE_EN 0x01 | 507 | #define PWR_GATE_EN 0x01 |
@@ -689,6 +691,40 @@ | |||
689 | #define IMAGE_FLAG_ADDR0 0xCE80 | 691 | #define IMAGE_FLAG_ADDR0 0xCE80 |
690 | #define IMAGE_FLAG_ADDR1 0xCE81 | 692 | #define IMAGE_FLAG_ADDR1 0xCE81 |
691 | 693 | ||
694 | /* Phy register */ | ||
695 | #define PHY_PCR 0x00 | ||
696 | #define PHY_RCR0 0x01 | ||
697 | #define PHY_RCR1 0x02 | ||
698 | #define PHY_RCR2 0x03 | ||
699 | #define PHY_RTCR 0x04 | ||
700 | #define PHY_RDR 0x05 | ||
701 | #define PHY_TCR0 0x06 | ||
702 | #define PHY_TCR1 0x07 | ||
703 | #define PHY_TUNE 0x08 | ||
704 | #define PHY_IMR 0x09 | ||
705 | #define PHY_BPCR 0x0A | ||
706 | #define PHY_BIST 0x0B | ||
707 | #define PHY_RAW_L 0x0C | ||
708 | #define PHY_RAW_H 0x0D | ||
709 | #define PHY_RAW_DATA 0x0E | ||
710 | #define PHY_HOST_CLK_CTRL 0x0F | ||
711 | #define PHY_DMR 0x10 | ||
712 | #define PHY_BACR 0x11 | ||
713 | #define PHY_IER 0x12 | ||
714 | #define PHY_BCSR 0x13 | ||
715 | #define PHY_BPR 0x14 | ||
716 | #define PHY_BPNR2 0x15 | ||
717 | #define PHY_BPNR 0x16 | ||
718 | #define PHY_BRNR2 0x17 | ||
719 | #define PHY_BENR 0x18 | ||
720 | #define PHY_REG_REV 0x19 | ||
721 | #define PHY_FLD0 0x1A | ||
722 | #define PHY_FLD1 0x1B | ||
723 | #define PHY_FLD2 0x1C | ||
724 | #define PHY_FLD3 0x1D | ||
725 | #define PHY_FLD4 0x1E | ||
726 | #define PHY_DUM_REG 0x1F | ||
727 | |||
692 | #define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) | 728 | #define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) |
693 | 729 | ||
694 | struct rtsx_pcr; | 730 | struct rtsx_pcr; |
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h new file mode 100644 index 000000000000..ba89b94e4a56 --- /dev/null +++ b/include/linux/mfd/si476x-core.h | |||
@@ -0,0 +1,533 @@ | |||
1 | /* | ||
2 | * include/media/si476x-core.h -- Common definitions for si476x core | ||
3 | * device | ||
4 | * | ||
5 | * Copyright (C) 2012 Innovative Converged Devices(ICD) | ||
6 | * Copyright (C) 2013 Andrey Smirnov | ||
7 | * | ||
8 | * Author: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; version 2 of the License. | ||
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 | */ | ||
20 | |||
21 | #ifndef SI476X_CORE_H | ||
22 | #define SI476X_CORE_H | ||
23 | |||
24 | #include <linux/kfifo.h> | ||
25 | #include <linux/atomic.h> | ||
26 | #include <linux/i2c.h> | ||
27 | #include <linux/regmap.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/mfd/core.h> | ||
30 | #include <linux/videodev2.h> | ||
31 | #include <linux/regulator/consumer.h> | ||
32 | |||
33 | #include <linux/mfd/si476x-platform.h> | ||
34 | #include <linux/mfd/si476x-reports.h> | ||
35 | |||
36 | /* Command Timeouts */ | ||
37 | #define SI476X_DEFAULT_TIMEOUT 100000 | ||
38 | #define SI476X_TIMEOUT_TUNE 700000 | ||
39 | #define SI476X_TIMEOUT_POWER_UP 330000 | ||
40 | #define SI476X_STATUS_POLL_US 0 | ||
41 | |||
42 | /* -------------------- si476x-i2c.c ----------------------- */ | ||
43 | |||
44 | enum si476x_freq_supported_chips { | ||
45 | SI476X_CHIP_SI4761 = 1, | ||
46 | SI476X_CHIP_SI4764, | ||
47 | SI476X_CHIP_SI4768, | ||
48 | }; | ||
49 | |||
50 | enum si476x_part_revisions { | ||
51 | SI476X_REVISION_A10 = 0, | ||
52 | SI476X_REVISION_A20 = 1, | ||
53 | SI476X_REVISION_A30 = 2, | ||
54 | }; | ||
55 | |||
56 | enum si476x_mfd_cells { | ||
57 | SI476X_RADIO_CELL = 0, | ||
58 | SI476X_CODEC_CELL, | ||
59 | SI476X_MFD_CELLS, | ||
60 | }; | ||
61 | |||
62 | /** | ||
63 | * enum si476x_power_state - possible power state of the si476x | ||
64 | * device. | ||
65 | * | ||
66 | * @SI476X_POWER_DOWN: In this state all regulators are turned off | ||
67 | * and the reset line is pulled low. The device is completely | ||
68 | * inactive. | ||
69 | * @SI476X_POWER_UP_FULL: In this state all the power regualtors are | ||
70 | * turned on, reset line pulled high, IRQ line is enabled(polling is | ||
71 | * active for polling use scenario) and device is turned on with | ||
72 | * POWER_UP command. The device is ready to be used. | ||
73 | * @SI476X_POWER_INCONSISTENT: This state indicates that previous | ||
74 | * power down was inconsistent, meaning some of the regulators were | ||
75 | * not turned down and thus use of the device, without power-cycling | ||
76 | * is impossible. | ||
77 | */ | ||
78 | enum si476x_power_state { | ||
79 | SI476X_POWER_DOWN = 0, | ||
80 | SI476X_POWER_UP_FULL = 1, | ||
81 | SI476X_POWER_INCONSISTENT = 2, | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * struct si476x_core - internal data structure representing the | ||
86 | * underlying "core" device which all the MFD cell-devices use. | ||
87 | * | ||
88 | * @client: Actual I2C client used to transfer commands to the chip. | ||
89 | * @chip_id: Last digit of the chip model(E.g. "1" for SI4761) | ||
90 | * @cells: MFD cell devices created by this driver. | ||
91 | * @cmd_lock: Mutex used to serialize all the requests to the core | ||
92 | * device. This filed should not be used directly. Instead | ||
93 | * si476x_core_lock()/si476x_core_unlock() should be used to get | ||
94 | * exclusive access to the "core" device. | ||
95 | * @users: Active users counter(Used by the radio cell) | ||
96 | * @rds_read_queue: Wait queue used to wait for RDS data. | ||
97 | * @rds_fifo: FIFO in which all the RDS data received from the chip is | ||
98 | * placed. | ||
99 | * @rds_fifo_drainer: Worker that drains on-chip RDS FIFO. | ||
100 | * @rds_drainer_is_working: Flag used for launching only one instance | ||
101 | * of the @rds_fifo_drainer. | ||
102 | * @rds_drainer_status_lock: Lock used to guard access to the | ||
103 | * @rds_drainer_is_working variable. | ||
104 | * @command: Wait queue for wainting on the command comapletion. | ||
105 | * @cts: Clear To Send flag set upon receiving first status with CTS | ||
106 | * set. | ||
107 | * @tuning: Wait queue used for wainting for tune/seek comand | ||
108 | * completion. | ||
109 | * @stc: Similar to @cts, but for the STC bit of the status value. | ||
110 | * @power_up_parameters: Parameters used as argument for POWER_UP | ||
111 | * command when the device is started. | ||
112 | * @state: Current power state of the device. | ||
113 | * @supplues: Structure containing handles to all power supplies used | ||
114 | * by the device (NULL ones are ignored). | ||
115 | * @gpio_reset: GPIO pin connectet to the RSTB pin of the chip. | ||
116 | * @pinmux: Chip's configurable pins configuration. | ||
117 | * @diversity_mode: Chips role when functioning in diversity mode. | ||
118 | * @status_monitor: Polling worker used in polling use case scenarion | ||
119 | * (when IRQ is not avalible). | ||
120 | * @revision: Chip's running firmware revision number(Used for correct | ||
121 | * command set support). | ||
122 | */ | ||
123 | |||
124 | struct si476x_core { | ||
125 | struct i2c_client *client; | ||
126 | struct regmap *regmap; | ||
127 | int chip_id; | ||
128 | struct mfd_cell cells[SI476X_MFD_CELLS]; | ||
129 | |||
130 | struct mutex cmd_lock; /* for serializing fm radio operations */ | ||
131 | atomic_t users; | ||
132 | |||
133 | wait_queue_head_t rds_read_queue; | ||
134 | struct kfifo rds_fifo; | ||
135 | struct work_struct rds_fifo_drainer; | ||
136 | bool rds_drainer_is_working; | ||
137 | struct mutex rds_drainer_status_lock; | ||
138 | |||
139 | wait_queue_head_t command; | ||
140 | atomic_t cts; | ||
141 | |||
142 | wait_queue_head_t tuning; | ||
143 | atomic_t stc; | ||
144 | |||
145 | struct si476x_power_up_args power_up_parameters; | ||
146 | |||
147 | enum si476x_power_state power_state; | ||
148 | |||
149 | struct regulator_bulk_data supplies[4]; | ||
150 | |||
151 | int gpio_reset; | ||
152 | |||
153 | struct si476x_pinmux pinmux; | ||
154 | enum si476x_phase_diversity_mode diversity_mode; | ||
155 | |||
156 | atomic_t is_alive; | ||
157 | |||
158 | struct delayed_work status_monitor; | ||
159 | #define SI476X_WORK_TO_CORE(w) container_of(to_delayed_work(w), \ | ||
160 | struct si476x_core, \ | ||
161 | status_monitor) | ||
162 | |||
163 | int revision; | ||
164 | |||
165 | int rds_fifo_depth; | ||
166 | }; | ||
167 | |||
168 | static inline struct si476x_core *i2c_mfd_cell_to_core(struct device *dev) | ||
169 | { | ||
170 | struct i2c_client *client = to_i2c_client(dev->parent); | ||
171 | return i2c_get_clientdata(client); | ||
172 | } | ||
173 | |||
174 | |||
175 | /** | ||
176 | * si476x_core_lock() - lock the core device to get an exclusive access | ||
177 | * to it. | ||
178 | */ | ||
179 | static inline void si476x_core_lock(struct si476x_core *core) | ||
180 | { | ||
181 | mutex_lock(&core->cmd_lock); | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * si476x_core_unlock() - unlock the core device to relinquish an | ||
186 | * exclusive access to it. | ||
187 | */ | ||
188 | static inline void si476x_core_unlock(struct si476x_core *core) | ||
189 | { | ||
190 | mutex_unlock(&core->cmd_lock); | ||
191 | } | ||
192 | |||
193 | /* *_TUNE_FREQ family of commands accept frequency in multiples of | ||
194 | 10kHz */ | ||
195 | static inline u16 hz_to_si476x(struct si476x_core *core, int freq) | ||
196 | { | ||
197 | u16 result; | ||
198 | |||
199 | switch (core->power_up_parameters.func) { | ||
200 | default: | ||
201 | case SI476X_FUNC_FM_RECEIVER: | ||
202 | result = freq / 10000; | ||
203 | break; | ||
204 | case SI476X_FUNC_AM_RECEIVER: | ||
205 | result = freq / 1000; | ||
206 | break; | ||
207 | } | ||
208 | |||
209 | return result; | ||
210 | } | ||
211 | |||
212 | static inline int si476x_to_hz(struct si476x_core *core, u16 freq) | ||
213 | { | ||
214 | int result; | ||
215 | |||
216 | switch (core->power_up_parameters.func) { | ||
217 | default: | ||
218 | case SI476X_FUNC_FM_RECEIVER: | ||
219 | result = freq * 10000; | ||
220 | break; | ||
221 | case SI476X_FUNC_AM_RECEIVER: | ||
222 | result = freq * 1000; | ||
223 | break; | ||
224 | } | ||
225 | |||
226 | return result; | ||
227 | } | ||
228 | |||
229 | /* Since the V4L2_TUNER_CAP_LOW flag is supplied, V4L2 subsystem | ||
230 | * mesures frequency in 62.5 Hz units */ | ||
231 | |||
232 | static inline int hz_to_v4l2(int freq) | ||
233 | { | ||
234 | return (freq * 10) / 625; | ||
235 | } | ||
236 | |||
237 | static inline int v4l2_to_hz(int freq) | ||
238 | { | ||
239 | return (freq * 625) / 10; | ||
240 | } | ||
241 | |||
242 | static inline u16 v4l2_to_si476x(struct si476x_core *core, int freq) | ||
243 | { | ||
244 | return hz_to_si476x(core, v4l2_to_hz(freq)); | ||
245 | } | ||
246 | |||
247 | static inline int si476x_to_v4l2(struct si476x_core *core, u16 freq) | ||
248 | { | ||
249 | return hz_to_v4l2(si476x_to_hz(core, freq)); | ||
250 | } | ||
251 | |||
252 | |||
253 | |||
254 | /** | ||
255 | * struct si476x_func_info - structure containing result of the | ||
256 | * FUNC_INFO command. | ||
257 | * | ||
258 | * @firmware.major: Firmware major number. | ||
259 | * @firmware.minor[...]: Firmware minor numbers. | ||
260 | * @patch_id: | ||
261 | * @func: Mode tuner is working in. | ||
262 | */ | ||
263 | struct si476x_func_info { | ||
264 | struct { | ||
265 | u8 major, minor[2]; | ||
266 | } firmware; | ||
267 | u16 patch_id; | ||
268 | enum si476x_func func; | ||
269 | }; | ||
270 | |||
271 | /** | ||
272 | * struct si476x_power_down_args - structure used to pass parameters | ||
273 | * to POWER_DOWN command | ||
274 | * | ||
275 | * @xosc: true - Power down, but leav oscillator running. | ||
276 | * false - Full power down. | ||
277 | */ | ||
278 | struct si476x_power_down_args { | ||
279 | bool xosc; | ||
280 | }; | ||
281 | |||
282 | /** | ||
283 | * enum si476x_tunemode - enum representing possible tune modes for | ||
284 | * the chip. | ||
285 | * @SI476X_TM_VALIDATED_NORMAL_TUNE: Unconditionally stay on the new | ||
286 | * channel after tune, tune status is valid. | ||
287 | * @SI476X_TM_INVALIDATED_FAST_TUNE: Unconditionally stay in the new | ||
288 | * channel after tune, tune status invalid. | ||
289 | * @SI476X_TM_VALIDATED_AF_TUNE: Jump back to previous channel if | ||
290 | * metric thresholds are not met. | ||
291 | * @SI476X_TM_VALIDATED_AF_CHECK: Unconditionally jump back to the | ||
292 | * previous channel. | ||
293 | */ | ||
294 | enum si476x_tunemode { | ||
295 | SI476X_TM_VALIDATED_NORMAL_TUNE = 0, | ||
296 | SI476X_TM_INVALIDATED_FAST_TUNE = 1, | ||
297 | SI476X_TM_VALIDATED_AF_TUNE = 2, | ||
298 | SI476X_TM_VALIDATED_AF_CHECK = 3, | ||
299 | }; | ||
300 | |||
301 | /** | ||
302 | * enum si476x_smoothmetrics - enum containing the possible setting fo | ||
303 | * audio transitioning of the chip | ||
304 | * @SI476X_SM_INITIALIZE_AUDIO: Initialize audio state to match this | ||
305 | * new channel | ||
306 | * @SI476X_SM_TRANSITION_AUDIO: Transition audio state from previous | ||
307 | * channel values to the new values | ||
308 | */ | ||
309 | enum si476x_smoothmetrics { | ||
310 | SI476X_SM_INITIALIZE_AUDIO = 0, | ||
311 | SI476X_SM_TRANSITION_AUDIO = 1, | ||
312 | }; | ||
313 | |||
314 | /** | ||
315 | * struct si476x_rds_status_report - the structure representing the | ||
316 | * response to 'FM_RD_STATUS' command | ||
317 | * @rdstpptyint: Traffic program flag(TP) and/or program type(PTY) | ||
318 | * code has changed. | ||
319 | * @rdspiint: Program indentifiaction(PI) code has changed. | ||
320 | * @rdssyncint: RDS synchronization has changed. | ||
321 | * @rdsfifoint: RDS was received and the RDS FIFO has at least | ||
322 | * 'FM_RDS_INTERRUPT_FIFO_COUNT' elements in it. | ||
323 | * @tpptyvalid: TP flag and PTY code are valid falg. | ||
324 | * @pivalid: PI code is valid flag. | ||
325 | * @rdssync: RDS is currently synchronized. | ||
326 | * @rdsfifolost: On or more RDS groups have been lost/discarded flag. | ||
327 | * @tp: Current channel's TP flag. | ||
328 | * @pty: Current channel's PTY code. | ||
329 | * @pi: Current channel's PI code. | ||
330 | * @rdsfifoused: Number of blocks remaining in the RDS FIFO (0 if | ||
331 | * empty). | ||
332 | */ | ||
333 | struct si476x_rds_status_report { | ||
334 | bool rdstpptyint, rdspiint, rdssyncint, rdsfifoint; | ||
335 | bool tpptyvalid, pivalid, rdssync, rdsfifolost; | ||
336 | bool tp; | ||
337 | |||
338 | u8 pty; | ||
339 | u16 pi; | ||
340 | |||
341 | u8 rdsfifoused; | ||
342 | u8 ble[4]; | ||
343 | |||
344 | struct v4l2_rds_data rds[4]; | ||
345 | }; | ||
346 | |||
347 | struct si476x_rsq_status_args { | ||
348 | bool primary; | ||
349 | bool rsqack; | ||
350 | bool attune; | ||
351 | bool cancel; | ||
352 | bool stcack; | ||
353 | }; | ||
354 | |||
355 | enum si476x_injside { | ||
356 | SI476X_INJSIDE_AUTO = 0, | ||
357 | SI476X_INJSIDE_LOW = 1, | ||
358 | SI476X_INJSIDE_HIGH = 2, | ||
359 | }; | ||
360 | |||
361 | struct si476x_tune_freq_args { | ||
362 | bool zifsr; | ||
363 | bool hd; | ||
364 | enum si476x_injside injside; | ||
365 | int freq; | ||
366 | enum si476x_tunemode tunemode; | ||
367 | enum si476x_smoothmetrics smoothmetrics; | ||
368 | int antcap; | ||
369 | }; | ||
370 | |||
371 | int si476x_core_stop(struct si476x_core *, bool); | ||
372 | int si476x_core_start(struct si476x_core *, bool); | ||
373 | int si476x_core_set_power_state(struct si476x_core *, enum si476x_power_state); | ||
374 | bool si476x_core_has_am(struct si476x_core *); | ||
375 | bool si476x_core_has_diversity(struct si476x_core *); | ||
376 | bool si476x_core_is_a_secondary_tuner(struct si476x_core *); | ||
377 | bool si476x_core_is_a_primary_tuner(struct si476x_core *); | ||
378 | bool si476x_core_is_in_am_receiver_mode(struct si476x_core *core); | ||
379 | bool si476x_core_is_powered_up(struct si476x_core *core); | ||
380 | |||
381 | enum si476x_i2c_type { | ||
382 | SI476X_I2C_SEND, | ||
383 | SI476X_I2C_RECV | ||
384 | }; | ||
385 | |||
386 | int si476x_core_i2c_xfer(struct si476x_core *, | ||
387 | enum si476x_i2c_type, | ||
388 | char *, int); | ||
389 | |||
390 | |||
391 | /* -------------------- si476x-cmd.c ----------------------- */ | ||
392 | |||
393 | int si476x_core_cmd_func_info(struct si476x_core *, struct si476x_func_info *); | ||
394 | int si476x_core_cmd_set_property(struct si476x_core *, u16, u16); | ||
395 | int si476x_core_cmd_get_property(struct si476x_core *, u16); | ||
396 | int si476x_core_cmd_dig_audio_pin_cfg(struct si476x_core *, | ||
397 | enum si476x_dclk_config, | ||
398 | enum si476x_dfs_config, | ||
399 | enum si476x_dout_config, | ||
400 | enum si476x_xout_config); | ||
401 | int si476x_core_cmd_zif_pin_cfg(struct si476x_core *, | ||
402 | enum si476x_iqclk_config, | ||
403 | enum si476x_iqfs_config, | ||
404 | enum si476x_iout_config, | ||
405 | enum si476x_qout_config); | ||
406 | int si476x_core_cmd_ic_link_gpo_ctl_pin_cfg(struct si476x_core *, | ||
407 | enum si476x_icin_config, | ||
408 | enum si476x_icip_config, | ||
409 | enum si476x_icon_config, | ||
410 | enum si476x_icop_config); | ||
411 | int si476x_core_cmd_ana_audio_pin_cfg(struct si476x_core *, | ||
412 | enum si476x_lrout_config); | ||
413 | int si476x_core_cmd_intb_pin_cfg(struct si476x_core *, enum si476x_intb_config, | ||
414 | enum si476x_a1_config); | ||
415 | int si476x_core_cmd_fm_seek_start(struct si476x_core *, bool, bool); | ||
416 | int si476x_core_cmd_am_seek_start(struct si476x_core *, bool, bool); | ||
417 | int si476x_core_cmd_fm_rds_status(struct si476x_core *, bool, bool, bool, | ||
418 | struct si476x_rds_status_report *); | ||
419 | int si476x_core_cmd_fm_rds_blockcount(struct si476x_core *, bool, | ||
420 | struct si476x_rds_blockcount_report *); | ||
421 | int si476x_core_cmd_fm_tune_freq(struct si476x_core *, | ||
422 | struct si476x_tune_freq_args *); | ||
423 | int si476x_core_cmd_am_tune_freq(struct si476x_core *, | ||
424 | struct si476x_tune_freq_args *); | ||
425 | int si476x_core_cmd_am_rsq_status(struct si476x_core *, | ||
426 | struct si476x_rsq_status_args *, | ||
427 | struct si476x_rsq_status_report *); | ||
428 | int si476x_core_cmd_fm_rsq_status(struct si476x_core *, | ||
429 | struct si476x_rsq_status_args *, | ||
430 | struct si476x_rsq_status_report *); | ||
431 | int si476x_core_cmd_power_up(struct si476x_core *, | ||
432 | struct si476x_power_up_args *); | ||
433 | int si476x_core_cmd_power_down(struct si476x_core *, | ||
434 | struct si476x_power_down_args *); | ||
435 | int si476x_core_cmd_fm_phase_div_status(struct si476x_core *); | ||
436 | int si476x_core_cmd_fm_phase_diversity(struct si476x_core *, | ||
437 | enum si476x_phase_diversity_mode); | ||
438 | |||
439 | int si476x_core_cmd_fm_acf_status(struct si476x_core *, | ||
440 | struct si476x_acf_status_report *); | ||
441 | int si476x_core_cmd_am_acf_status(struct si476x_core *, | ||
442 | struct si476x_acf_status_report *); | ||
443 | int si476x_core_cmd_agc_status(struct si476x_core *, | ||
444 | struct si476x_agc_status_report *); | ||
445 | |||
446 | enum si476x_power_grid_type { | ||
447 | SI476X_POWER_GRID_50HZ = 0, | ||
448 | SI476X_POWER_GRID_60HZ, | ||
449 | }; | ||
450 | |||
451 | /* Properties */ | ||
452 | |||
453 | enum si476x_interrupt_flags { | ||
454 | SI476X_STCIEN = (1 << 0), | ||
455 | SI476X_ACFIEN = (1 << 1), | ||
456 | SI476X_RDSIEN = (1 << 2), | ||
457 | SI476X_RSQIEN = (1 << 3), | ||
458 | |||
459 | SI476X_ERRIEN = (1 << 6), | ||
460 | SI476X_CTSIEN = (1 << 7), | ||
461 | |||
462 | SI476X_STCREP = (1 << 8), | ||
463 | SI476X_ACFREP = (1 << 9), | ||
464 | SI476X_RDSREP = (1 << 10), | ||
465 | SI476X_RSQREP = (1 << 11), | ||
466 | }; | ||
467 | |||
468 | enum si476x_rdsint_sources { | ||
469 | SI476X_RDSTPPTY = (1 << 4), | ||
470 | SI476X_RDSPI = (1 << 3), | ||
471 | SI476X_RDSSYNC = (1 << 1), | ||
472 | SI476X_RDSRECV = (1 << 0), | ||
473 | }; | ||
474 | |||
475 | enum si476x_status_response_bits { | ||
476 | SI476X_CTS = (1 << 7), | ||
477 | SI476X_ERR = (1 << 6), | ||
478 | /* Status response for WB receiver */ | ||
479 | SI476X_WB_ASQ_INT = (1 << 4), | ||
480 | SI476X_RSQ_INT = (1 << 3), | ||
481 | /* Status response for FM receiver */ | ||
482 | SI476X_FM_RDS_INT = (1 << 2), | ||
483 | SI476X_ACF_INT = (1 << 1), | ||
484 | SI476X_STC_INT = (1 << 0), | ||
485 | }; | ||
486 | |||
487 | /* -------------------- si476x-prop.c ----------------------- */ | ||
488 | |||
489 | enum si476x_common_receiver_properties { | ||
490 | SI476X_PROP_INT_CTL_ENABLE = 0x0000, | ||
491 | SI476X_PROP_DIGITAL_IO_INPUT_SAMPLE_RATE = 0x0200, | ||
492 | SI476X_PROP_DIGITAL_IO_INPUT_FORMAT = 0x0201, | ||
493 | SI476X_PROP_DIGITAL_IO_OUTPUT_SAMPLE_RATE = 0x0202, | ||
494 | SI476X_PROP_DIGITAL_IO_OUTPUT_FORMAT = 0x0203, | ||
495 | |||
496 | SI476X_PROP_SEEK_BAND_BOTTOM = 0x1100, | ||
497 | SI476X_PROP_SEEK_BAND_TOP = 0x1101, | ||
498 | SI476X_PROP_SEEK_FREQUENCY_SPACING = 0x1102, | ||
499 | |||
500 | SI476X_PROP_VALID_MAX_TUNE_ERROR = 0x2000, | ||
501 | SI476X_PROP_VALID_SNR_THRESHOLD = 0x2003, | ||
502 | SI476X_PROP_VALID_RSSI_THRESHOLD = 0x2004, | ||
503 | }; | ||
504 | |||
505 | enum si476x_am_receiver_properties { | ||
506 | SI476X_PROP_AUDIO_PWR_LINE_FILTER = 0x0303, | ||
507 | }; | ||
508 | |||
509 | enum si476x_fm_receiver_properties { | ||
510 | SI476X_PROP_AUDIO_DEEMPHASIS = 0x0302, | ||
511 | |||
512 | SI476X_PROP_FM_RDS_INTERRUPT_SOURCE = 0x4000, | ||
513 | SI476X_PROP_FM_RDS_INTERRUPT_FIFO_COUNT = 0x4001, | ||
514 | SI476X_PROP_FM_RDS_CONFIG = 0x4002, | ||
515 | }; | ||
516 | |||
517 | enum si476x_prop_audio_pwr_line_filter_bits { | ||
518 | SI476X_PROP_PWR_HARMONICS_MASK = 0x001f, | ||
519 | SI476X_PROP_PWR_GRID_MASK = 0x0100, | ||
520 | SI476X_PROP_PWR_ENABLE_MASK = 0x0200, | ||
521 | SI476X_PROP_PWR_GRID_50HZ = 0x0000, | ||
522 | SI476X_PROP_PWR_GRID_60HZ = 0x0100, | ||
523 | }; | ||
524 | |||
525 | enum si476x_prop_fm_rds_config_bits { | ||
526 | SI476X_PROP_RDSEN_MASK = 0x1, | ||
527 | SI476X_PROP_RDSEN = 0x1, | ||
528 | }; | ||
529 | |||
530 | |||
531 | struct regmap *devm_regmap_init_si476x(struct si476x_core *); | ||
532 | |||
533 | #endif /* SI476X_CORE_H */ | ||
diff --git a/include/linux/mfd/si476x-platform.h b/include/linux/mfd/si476x-platform.h new file mode 100644 index 000000000000..88bb93b7a9d5 --- /dev/null +++ b/include/linux/mfd/si476x-platform.h | |||
@@ -0,0 +1,267 @@ | |||
1 | /* | ||
2 | * include/media/si476x-platform.h -- Platform data specific definitions | ||
3 | * | ||
4 | * Copyright (C) 2013 Andrey Smirnov | ||
5 | * | ||
6 | * Author: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __SI476X_PLATFORM_H__ | ||
20 | #define __SI476X_PLATFORM_H__ | ||
21 | |||
22 | /* It is possible to select one of the four adresses using pins A0 | ||
23 | * and A1 on SI476x */ | ||
24 | #define SI476X_I2C_ADDR_1 0x60 | ||
25 | #define SI476X_I2C_ADDR_2 0x61 | ||
26 | #define SI476X_I2C_ADDR_3 0x62 | ||
27 | #define SI476X_I2C_ADDR_4 0x63 | ||
28 | |||
29 | enum si476x_iqclk_config { | ||
30 | SI476X_IQCLK_NOOP = 0, | ||
31 | SI476X_IQCLK_TRISTATE = 1, | ||
32 | SI476X_IQCLK_IQ = 21, | ||
33 | }; | ||
34 | enum si476x_iqfs_config { | ||
35 | SI476X_IQFS_NOOP = 0, | ||
36 | SI476X_IQFS_TRISTATE = 1, | ||
37 | SI476X_IQFS_IQ = 21, | ||
38 | }; | ||
39 | enum si476x_iout_config { | ||
40 | SI476X_IOUT_NOOP = 0, | ||
41 | SI476X_IOUT_TRISTATE = 1, | ||
42 | SI476X_IOUT_OUTPUT = 22, | ||
43 | }; | ||
44 | enum si476x_qout_config { | ||
45 | SI476X_QOUT_NOOP = 0, | ||
46 | SI476X_QOUT_TRISTATE = 1, | ||
47 | SI476X_QOUT_OUTPUT = 22, | ||
48 | }; | ||
49 | |||
50 | enum si476x_dclk_config { | ||
51 | SI476X_DCLK_NOOP = 0, | ||
52 | SI476X_DCLK_TRISTATE = 1, | ||
53 | SI476X_DCLK_DAUDIO = 10, | ||
54 | }; | ||
55 | |||
56 | enum si476x_dfs_config { | ||
57 | SI476X_DFS_NOOP = 0, | ||
58 | SI476X_DFS_TRISTATE = 1, | ||
59 | SI476X_DFS_DAUDIO = 10, | ||
60 | }; | ||
61 | |||
62 | enum si476x_dout_config { | ||
63 | SI476X_DOUT_NOOP = 0, | ||
64 | SI476X_DOUT_TRISTATE = 1, | ||
65 | SI476X_DOUT_I2S_OUTPUT = 12, | ||
66 | SI476X_DOUT_I2S_INPUT = 13, | ||
67 | }; | ||
68 | |||
69 | enum si476x_xout_config { | ||
70 | SI476X_XOUT_NOOP = 0, | ||
71 | SI476X_XOUT_TRISTATE = 1, | ||
72 | SI476X_XOUT_I2S_INPUT = 13, | ||
73 | SI476X_XOUT_MODE_SELECT = 23, | ||
74 | }; | ||
75 | |||
76 | enum si476x_icin_config { | ||
77 | SI476X_ICIN_NOOP = 0, | ||
78 | SI476X_ICIN_TRISTATE = 1, | ||
79 | SI476X_ICIN_GPO1_HIGH = 2, | ||
80 | SI476X_ICIN_GPO1_LOW = 3, | ||
81 | SI476X_ICIN_IC_LINK = 30, | ||
82 | }; | ||
83 | |||
84 | enum si476x_icip_config { | ||
85 | SI476X_ICIP_NOOP = 0, | ||
86 | SI476X_ICIP_TRISTATE = 1, | ||
87 | SI476X_ICIP_GPO2_HIGH = 2, | ||
88 | SI476X_ICIP_GPO2_LOW = 3, | ||
89 | SI476X_ICIP_IC_LINK = 30, | ||
90 | }; | ||
91 | |||
92 | enum si476x_icon_config { | ||
93 | SI476X_ICON_NOOP = 0, | ||
94 | SI476X_ICON_TRISTATE = 1, | ||
95 | SI476X_ICON_I2S = 10, | ||
96 | SI476X_ICON_IC_LINK = 30, | ||
97 | }; | ||
98 | |||
99 | enum si476x_icop_config { | ||
100 | SI476X_ICOP_NOOP = 0, | ||
101 | SI476X_ICOP_TRISTATE = 1, | ||
102 | SI476X_ICOP_I2S = 10, | ||
103 | SI476X_ICOP_IC_LINK = 30, | ||
104 | }; | ||
105 | |||
106 | |||
107 | enum si476x_lrout_config { | ||
108 | SI476X_LROUT_NOOP = 0, | ||
109 | SI476X_LROUT_TRISTATE = 1, | ||
110 | SI476X_LROUT_AUDIO = 2, | ||
111 | SI476X_LROUT_MPX = 3, | ||
112 | }; | ||
113 | |||
114 | |||
115 | enum si476x_intb_config { | ||
116 | SI476X_INTB_NOOP = 0, | ||
117 | SI476X_INTB_TRISTATE = 1, | ||
118 | SI476X_INTB_DAUDIO = 10, | ||
119 | SI476X_INTB_IRQ = 40, | ||
120 | }; | ||
121 | |||
122 | enum si476x_a1_config { | ||
123 | SI476X_A1_NOOP = 0, | ||
124 | SI476X_A1_TRISTATE = 1, | ||
125 | SI476X_A1_IRQ = 40, | ||
126 | }; | ||
127 | |||
128 | |||
129 | struct si476x_pinmux { | ||
130 | enum si476x_dclk_config dclk; | ||
131 | enum si476x_dfs_config dfs; | ||
132 | enum si476x_dout_config dout; | ||
133 | enum si476x_xout_config xout; | ||
134 | |||
135 | enum si476x_iqclk_config iqclk; | ||
136 | enum si476x_iqfs_config iqfs; | ||
137 | enum si476x_iout_config iout; | ||
138 | enum si476x_qout_config qout; | ||
139 | |||
140 | enum si476x_icin_config icin; | ||
141 | enum si476x_icip_config icip; | ||
142 | enum si476x_icon_config icon; | ||
143 | enum si476x_icop_config icop; | ||
144 | |||
145 | enum si476x_lrout_config lrout; | ||
146 | |||
147 | enum si476x_intb_config intb; | ||
148 | enum si476x_a1_config a1; | ||
149 | }; | ||
150 | |||
151 | enum si476x_ibias6x { | ||
152 | SI476X_IBIAS6X_OTHER = 0, | ||
153 | SI476X_IBIAS6X_RCVR1_NON_4MHZ_CLK = 1, | ||
154 | }; | ||
155 | |||
156 | enum si476x_xstart { | ||
157 | SI476X_XSTART_MULTIPLE_TUNER = 0x11, | ||
158 | SI476X_XSTART_NORMAL = 0x77, | ||
159 | }; | ||
160 | |||
161 | enum si476x_freq { | ||
162 | SI476X_FREQ_4_MHZ = 0, | ||
163 | SI476X_FREQ_37P209375_MHZ = 1, | ||
164 | SI476X_FREQ_36P4_MHZ = 2, | ||
165 | SI476X_FREQ_37P8_MHZ = 3, | ||
166 | }; | ||
167 | |||
168 | enum si476x_xmode { | ||
169 | SI476X_XMODE_CRYSTAL_RCVR1 = 1, | ||
170 | SI476X_XMODE_EXT_CLOCK = 2, | ||
171 | SI476X_XMODE_CRYSTAL_RCVR2_3 = 3, | ||
172 | }; | ||
173 | |||
174 | enum si476x_xbiashc { | ||
175 | SI476X_XBIASHC_SINGLE_RECEIVER = 0, | ||
176 | SI476X_XBIASHC_MULTIPLE_RECEIVER = 1, | ||
177 | }; | ||
178 | |||
179 | enum si476x_xbias { | ||
180 | SI476X_XBIAS_RCVR2_3 = 0, | ||
181 | SI476X_XBIAS_4MHZ_RCVR1 = 3, | ||
182 | SI476X_XBIAS_RCVR1 = 7, | ||
183 | }; | ||
184 | |||
185 | enum si476x_func { | ||
186 | SI476X_FUNC_BOOTLOADER = 0, | ||
187 | SI476X_FUNC_FM_RECEIVER = 1, | ||
188 | SI476X_FUNC_AM_RECEIVER = 2, | ||
189 | SI476X_FUNC_WB_RECEIVER = 3, | ||
190 | }; | ||
191 | |||
192 | |||
193 | /** | ||
194 | * @xcload: Selects the amount of additional on-chip capacitance to | ||
195 | * be connected between XTAL1 and gnd and between XTAL2 and | ||
196 | * GND. One half of the capacitance value shown here is the | ||
197 | * additional load capacitance presented to the xtal. The | ||
198 | * minimum step size is 0.277 pF. Recommended value is 0x28 | ||
199 | * but it will be layout dependent. Range is 0–0x3F i.e. | ||
200 | * (0–16.33 pF) | ||
201 | * @ctsien: enable CTSINT(interrupt request when CTS condition | ||
202 | * arises) when set | ||
203 | * @intsel: when set A1 pin becomes the interrupt pin; otherwise, | ||
204 | * INTB is the interrupt pin | ||
205 | * @func: selects the boot function of the device. I.e. | ||
206 | * SI476X_BOOTLOADER - Boot loader | ||
207 | * SI476X_FM_RECEIVER - FM receiver | ||
208 | * SI476X_AM_RECEIVER - AM receiver | ||
209 | * SI476X_WB_RECEIVER - Weatherband receiver | ||
210 | * @freq: oscillator's crystal frequency: | ||
211 | * SI476X_XTAL_37P209375_MHZ - 37.209375 Mhz | ||
212 | * SI476X_XTAL_36P4_MHZ - 36.4 Mhz | ||
213 | * SI476X_XTAL_37P8_MHZ - 37.8 Mhz | ||
214 | */ | ||
215 | struct si476x_power_up_args { | ||
216 | enum si476x_ibias6x ibias6x; | ||
217 | enum si476x_xstart xstart; | ||
218 | u8 xcload; | ||
219 | bool fastboot; | ||
220 | enum si476x_xbiashc xbiashc; | ||
221 | enum si476x_xbias xbias; | ||
222 | enum si476x_func func; | ||
223 | enum si476x_freq freq; | ||
224 | enum si476x_xmode xmode; | ||
225 | }; | ||
226 | |||
227 | |||
228 | /** | ||
229 | * enum si476x_phase_diversity_mode - possbile phase diversity modes | ||
230 | * for SI4764/5/6/7 chips. | ||
231 | * | ||
232 | * @SI476X_PHDIV_DISABLED: Phase diversity feature is | ||
233 | * disabled. | ||
234 | * @SI476X_PHDIV_PRIMARY_COMBINING: Tuner works as a primary tuner | ||
235 | * in combination with a | ||
236 | * secondary one. | ||
237 | * @SI476X_PHDIV_PRIMARY_ANTENNA: Tuner works as a primary tuner | ||
238 | * using only its own antenna. | ||
239 | * @SI476X_PHDIV_SECONDARY_ANTENNA: Tuner works as a primary tuner | ||
240 | * usning seconary tuner's antenna. | ||
241 | * @SI476X_PHDIV_SECONDARY_COMBINING: Tuner works as a secondary | ||
242 | * tuner in combination with the | ||
243 | * primary one. | ||
244 | */ | ||
245 | enum si476x_phase_diversity_mode { | ||
246 | SI476X_PHDIV_DISABLED = 0, | ||
247 | SI476X_PHDIV_PRIMARY_COMBINING = 1, | ||
248 | SI476X_PHDIV_PRIMARY_ANTENNA = 2, | ||
249 | SI476X_PHDIV_SECONDARY_ANTENNA = 3, | ||
250 | SI476X_PHDIV_SECONDARY_COMBINING = 5, | ||
251 | }; | ||
252 | |||
253 | |||
254 | /* | ||
255 | * Platform dependent definition | ||
256 | */ | ||
257 | struct si476x_platform_data { | ||
258 | int gpio_reset; /* < 0 if not used */ | ||
259 | |||
260 | struct si476x_power_up_args power_up_parameters; | ||
261 | enum si476x_phase_diversity_mode diversity_mode; | ||
262 | |||
263 | struct si476x_pinmux pinmux; | ||
264 | }; | ||
265 | |||
266 | |||
267 | #endif /* __SI476X_PLATFORM_H__ */ | ||
diff --git a/include/linux/mfd/si476x-reports.h b/include/linux/mfd/si476x-reports.h new file mode 100644 index 000000000000..e0b9455a79c0 --- /dev/null +++ b/include/linux/mfd/si476x-reports.h | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * include/media/si476x-platform.h -- Definitions of the data formats | ||
3 | * returned by debugfs hooks | ||
4 | * | ||
5 | * Copyright (C) 2013 Andrey Smirnov | ||
6 | * | ||
7 | * Author: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; version 2 of the License. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef __SI476X_REPORTS_H__ | ||
21 | #define __SI476X_REPORTS_H__ | ||
22 | |||
23 | /** | ||
24 | * struct si476x_rsq_status - structure containing received signal | ||
25 | * quality | ||
26 | * @multhint: Multipath Detect High. | ||
27 | * true - Indicatedes that the value is below | ||
28 | * FM_RSQ_MULTIPATH_HIGH_THRESHOLD | ||
29 | * false - Indicatedes that the value is above | ||
30 | * FM_RSQ_MULTIPATH_HIGH_THRESHOLD | ||
31 | * @multlint: Multipath Detect Low. | ||
32 | * true - Indicatedes that the value is below | ||
33 | * FM_RSQ_MULTIPATH_LOW_THRESHOLD | ||
34 | * false - Indicatedes that the value is above | ||
35 | * FM_RSQ_MULTIPATH_LOW_THRESHOLD | ||
36 | * @snrhint: SNR Detect High. | ||
37 | * true - Indicatedes that the value is below | ||
38 | * FM_RSQ_SNR_HIGH_THRESHOLD | ||
39 | * false - Indicatedes that the value is above | ||
40 | * FM_RSQ_SNR_HIGH_THRESHOLD | ||
41 | * @snrlint: SNR Detect Low. | ||
42 | * true - Indicatedes that the value is below | ||
43 | * FM_RSQ_SNR_LOW_THRESHOLD | ||
44 | * false - Indicatedes that the value is above | ||
45 | * FM_RSQ_SNR_LOW_THRESHOLD | ||
46 | * @rssihint: RSSI Detect High. | ||
47 | * true - Indicatedes that the value is below | ||
48 | * FM_RSQ_RSSI_HIGH_THRESHOLD | ||
49 | * false - Indicatedes that the value is above | ||
50 | * FM_RSQ_RSSI_HIGH_THRESHOLD | ||
51 | * @rssilint: RSSI Detect Low. | ||
52 | * true - Indicatedes that the value is below | ||
53 | * FM_RSQ_RSSI_LOW_THRESHOLD | ||
54 | * false - Indicatedes that the value is above | ||
55 | * FM_RSQ_RSSI_LOW_THRESHOLD | ||
56 | * @bltf: Band Limit. | ||
57 | * Set if seek command hits the band limit or wrapped to | ||
58 | * the original frequency. | ||
59 | * @snr_ready: SNR measurement in progress. | ||
60 | * @rssiready: RSSI measurement in progress. | ||
61 | * @afcrl: Set if FREQOFF >= MAX_TUNE_ERROR | ||
62 | * @valid: Set if the channel is valid | ||
63 | * rssi < FM_VALID_RSSI_THRESHOLD | ||
64 | * snr < FM_VALID_SNR_THRESHOLD | ||
65 | * tune_error < FM_VALID_MAX_TUNE_ERROR | ||
66 | * @readfreq: Current tuned frequency. | ||
67 | * @freqoff: Signed frequency offset. | ||
68 | * @rssi: Received Signal Strength Indicator(dBuV). | ||
69 | * @snr: RF SNR Indicator(dB). | ||
70 | * @lassi: | ||
71 | * @hassi: Low/High side Adjacent(100 kHz) Channel Strength Indicator | ||
72 | * @mult: Multipath indicator | ||
73 | * @dev: Who knows? But values may vary. | ||
74 | * @readantcap: Antenna tuning capacity value. | ||
75 | * @assi: Adjacent Channel(+/- 200kHz) Strength Indicator | ||
76 | * @usn: Ultrasonic Noise Inticator in -DBFS | ||
77 | */ | ||
78 | struct si476x_rsq_status_report { | ||
79 | __u8 multhint, multlint; | ||
80 | __u8 snrhint, snrlint; | ||
81 | __u8 rssihint, rssilint; | ||
82 | __u8 bltf; | ||
83 | __u8 snr_ready; | ||
84 | __u8 rssiready; | ||
85 | __u8 injside; | ||
86 | __u8 afcrl; | ||
87 | __u8 valid; | ||
88 | |||
89 | __u16 readfreq; | ||
90 | __s8 freqoff; | ||
91 | __s8 rssi; | ||
92 | __s8 snr; | ||
93 | __s8 issi; | ||
94 | __s8 lassi, hassi; | ||
95 | __s8 mult; | ||
96 | __u8 dev; | ||
97 | __u16 readantcap; | ||
98 | __s8 assi; | ||
99 | __s8 usn; | ||
100 | |||
101 | __u8 pilotdev; | ||
102 | __u8 rdsdev; | ||
103 | __u8 assidev; | ||
104 | __u8 strongdev; | ||
105 | __u16 rdspi; | ||
106 | } __packed; | ||
107 | |||
108 | /** | ||
109 | * si476x_acf_status_report - ACF report results | ||
110 | * | ||
111 | * @blend_int: If set, indicates that stereo separation has crossed | ||
112 | * below the blend threshold as set by FM_ACF_BLEND_THRESHOLD | ||
113 | * @hblend_int: If set, indicates that HiBlend cutoff frequency is | ||
114 | * lower than threshold as set by FM_ACF_HBLEND_THRESHOLD | ||
115 | * @hicut_int: If set, indicates that HiCut cutoff frequency is lower | ||
116 | * than the threshold set by ACF_ | ||
117 | |||
118 | */ | ||
119 | struct si476x_acf_status_report { | ||
120 | __u8 blend_int; | ||
121 | __u8 hblend_int; | ||
122 | __u8 hicut_int; | ||
123 | __u8 chbw_int; | ||
124 | __u8 softmute_int; | ||
125 | __u8 smute; | ||
126 | __u8 smattn; | ||
127 | __u8 chbw; | ||
128 | __u8 hicut; | ||
129 | __u8 hiblend; | ||
130 | __u8 pilot; | ||
131 | __u8 stblend; | ||
132 | } __packed; | ||
133 | |||
134 | enum si476x_fmagc { | ||
135 | SI476X_FMAGC_10K_OHM = 0, | ||
136 | SI476X_FMAGC_800_OHM = 1, | ||
137 | SI476X_FMAGC_400_OHM = 2, | ||
138 | SI476X_FMAGC_200_OHM = 4, | ||
139 | SI476X_FMAGC_100_OHM = 8, | ||
140 | SI476X_FMAGC_50_OHM = 16, | ||
141 | SI476X_FMAGC_25_OHM = 32, | ||
142 | SI476X_FMAGC_12P5_OHM = 64, | ||
143 | SI476X_FMAGC_6P25_OHM = 128, | ||
144 | }; | ||
145 | |||
146 | struct si476x_agc_status_report { | ||
147 | __u8 mxhi; | ||
148 | __u8 mxlo; | ||
149 | __u8 lnahi; | ||
150 | __u8 lnalo; | ||
151 | __u8 fmagc1; | ||
152 | __u8 fmagc2; | ||
153 | __u8 pgagain; | ||
154 | __u8 fmwblang; | ||
155 | } __packed; | ||
156 | |||
157 | struct si476x_rds_blockcount_report { | ||
158 | __u16 expected; | ||
159 | __u16 received; | ||
160 | __u16 uncorrectable; | ||
161 | } __packed; | ||
162 | |||
163 | #endif /* __SI476X_REPORTS_H__ */ | ||
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 383ac1512a39..48395a69a7e9 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h | |||
@@ -26,6 +26,7 @@ enum stmpe_partnum { | |||
26 | STMPE801, | 26 | STMPE801, |
27 | STMPE811, | 27 | STMPE811, |
28 | STMPE1601, | 28 | STMPE1601, |
29 | STMPE1801, | ||
29 | STMPE2401, | 30 | STMPE2401, |
30 | STMPE2403, | 31 | STMPE2403, |
31 | STMPE_NBR_PARTS | 32 | STMPE_NBR_PARTS |
@@ -39,6 +40,7 @@ enum { | |||
39 | STMPE_IDX_CHIP_ID, | 40 | STMPE_IDX_CHIP_ID, |
40 | STMPE_IDX_ICR_LSB, | 41 | STMPE_IDX_ICR_LSB, |
41 | STMPE_IDX_IER_LSB, | 42 | STMPE_IDX_IER_LSB, |
43 | STMPE_IDX_ISR_LSB, | ||
42 | STMPE_IDX_ISR_MSB, | 44 | STMPE_IDX_ISR_MSB, |
43 | STMPE_IDX_GPMR_LSB, | 45 | STMPE_IDX_GPMR_LSB, |
44 | STMPE_IDX_GPSR_LSB, | 46 | STMPE_IDX_GPSR_LSB, |
@@ -49,6 +51,7 @@ enum { | |||
49 | STMPE_IDX_GPFER_LSB, | 51 | STMPE_IDX_GPFER_LSB, |
50 | STMPE_IDX_GPAFR_U_MSB, | 52 | STMPE_IDX_GPAFR_U_MSB, |
51 | STMPE_IDX_IEGPIOR_LSB, | 53 | STMPE_IDX_IEGPIOR_LSB, |
54 | STMPE_IDX_ISGPIOR_LSB, | ||
52 | STMPE_IDX_ISGPIOR_MSB, | 55 | STMPE_IDX_ISGPIOR_MSB, |
53 | STMPE_IDX_MAX, | 56 | STMPE_IDX_MAX, |
54 | }; | 57 | }; |
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h index 6aeb6b8da64d..b473577f36db 100644 --- a/include/linux/mfd/syscon.h +++ b/include/linux/mfd/syscon.h | |||
@@ -15,8 +15,11 @@ | |||
15 | #ifndef __LINUX_MFD_SYSCON_H__ | 15 | #ifndef __LINUX_MFD_SYSCON_H__ |
16 | #define __LINUX_MFD_SYSCON_H__ | 16 | #define __LINUX_MFD_SYSCON_H__ |
17 | 17 | ||
18 | struct device_node; | ||
19 | |||
18 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); | 20 | extern struct regmap *syscon_node_to_regmap(struct device_node *np); |
19 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); | 21 | extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); |
22 | extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); | ||
20 | extern struct regmap *syscon_regmap_lookup_by_phandle( | 23 | extern struct regmap *syscon_regmap_lookup_by_phandle( |
21 | struct device_node *np, | 24 | struct device_node *np, |
22 | const char *property); | 25 | const char *property); |
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h index 6694cf43e8b8..3f43069413e7 100644 --- a/include/linux/mfd/tps65090.h +++ b/include/linux/mfd/tps65090.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | /* TPS65090 IRQs */ | 28 | /* TPS65090 IRQs */ |
29 | enum { | 29 | enum { |
30 | TPS65090_IRQ_INTERRUPT, | ||
30 | TPS65090_IRQ_VAC_STATUS_CHANGE, | 31 | TPS65090_IRQ_VAC_STATUS_CHANGE, |
31 | TPS65090_IRQ_VSYS_STATUS_CHANGE, | 32 | TPS65090_IRQ_VSYS_STATUS_CHANGE, |
32 | TPS65090_IRQ_BAT_STATUS_CHANGE, | 33 | TPS65090_IRQ_BAT_STATUS_CHANGE, |
@@ -86,6 +87,11 @@ struct tps65090_regulator_plat_data { | |||
86 | 87 | ||
87 | struct tps65090_platform_data { | 88 | struct tps65090_platform_data { |
88 | int irq_base; | 89 | int irq_base; |
90 | |||
91 | char **supplied_to; | ||
92 | size_t num_supplicants; | ||
93 | int enable_low_current_chrg; | ||
94 | |||
89 | struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; | 95 | struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; |
90 | }; | 96 | }; |
91 | 97 | ||
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h index 290762f93930..29eab2bd3dfa 100644 --- a/include/linux/mfd/tps65217.h +++ b/include/linux/mfd/tps65217.h | |||
@@ -228,6 +228,7 @@ enum tps65217_bl_fdim { | |||
228 | struct tps65217_bl_pdata { | 228 | struct tps65217_bl_pdata { |
229 | enum tps65217_bl_isel isel; | 229 | enum tps65217_bl_isel isel; |
230 | enum tps65217_bl_fdim fdim; | 230 | enum tps65217_bl_fdim fdim; |
231 | int dft_brightness; | ||
231 | }; | 232 | }; |
232 | 233 | ||
233 | /** | 234 | /** |
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index 8e21a094836d..68e776594889 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #define WM8994_NUM_LDO 2 | 18 | #define WM8994_NUM_LDO 2 |
19 | #define WM8994_NUM_GPIO 11 | 19 | #define WM8994_NUM_GPIO 11 |
20 | #define WM8994_NUM_AIF 3 | ||
20 | 21 | ||
21 | struct wm8994_ldo_pdata { | 22 | struct wm8994_ldo_pdata { |
22 | /** GPIOs to enable regulator, 0 or less if not available */ | 23 | /** GPIOs to enable regulator, 0 or less if not available */ |
@@ -215,6 +216,13 @@ struct wm8994_pdata { | |||
215 | * system. | 216 | * system. |
216 | */ | 217 | */ |
217 | bool spkmode_pu; | 218 | bool spkmode_pu; |
219 | |||
220 | /** | ||
221 | * Maximum number of channels clocks will be generated for, | ||
222 | * useful for systems where and I2S bus with multiple data | ||
223 | * lines is mastered. | ||
224 | */ | ||
225 | int max_channels_clocked[WM8994_NUM_AIF]; | ||
218 | }; | 226 | }; |
219 | 227 | ||
220 | #endif | 228 | #endif |
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 9dbb41a4e250..8752dbbc6135 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define PHY_ID_KSZ9021 0x00221610 | 19 | #define PHY_ID_KSZ9021 0x00221610 |
20 | #define PHY_ID_KS8737 0x00221720 | 20 | #define PHY_ID_KS8737 0x00221720 |
21 | #define PHY_ID_KSZ8021 0x00221555 | 21 | #define PHY_ID_KSZ8021 0x00221555 |
22 | #define PHY_ID_KSZ8031 0x00221556 | ||
22 | #define PHY_ID_KSZ8041 0x00221510 | 23 | #define PHY_ID_KSZ8041 0x00221510 |
23 | #define PHY_ID_KSZ8051 0x00221550 | 24 | #define PHY_ID_KSZ8051 0x00221550 |
24 | /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ | 25 | /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 260695186256..adf6e0648f20 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #define MLX4_CMD_H | 34 | #define MLX4_CMD_H |
35 | 35 | ||
36 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
37 | #include <linux/if_link.h> | ||
37 | 38 | ||
38 | enum { | 39 | enum { |
39 | /* initialization and general commands */ | 40 | /* initialization and general commands */ |
@@ -232,6 +233,11 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev); | |||
232 | void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); | 233 | void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox); |
233 | 234 | ||
234 | u32 mlx4_comm_get_version(void); | 235 | u32 mlx4_comm_get_version(void); |
236 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); | ||
237 | int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); | ||
238 | int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); | ||
239 | int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); | ||
240 | |||
235 | 241 | ||
236 | #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) | 242 | #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) |
237 | 243 | ||
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 6f65b2c8bb89..98fa492cf406 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h | |||
@@ -64,6 +64,22 @@ struct mlx4_err_cqe { | |||
64 | u8 owner_sr_opcode; | 64 | u8 owner_sr_opcode; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct mlx4_ts_cqe { | ||
68 | __be32 vlan_my_qpn; | ||
69 | __be32 immed_rss_invalid; | ||
70 | __be32 g_mlpath_rqpn; | ||
71 | __be32 timestamp_hi; | ||
72 | __be16 status; | ||
73 | u8 ipv6_ext_mask; | ||
74 | u8 badfcs_enc; | ||
75 | __be32 byte_cnt; | ||
76 | __be16 wqe_index; | ||
77 | __be16 checksum; | ||
78 | u8 reserved; | ||
79 | __be16 timestamp_lo; | ||
80 | u8 owner_sr_opcode; | ||
81 | } __packed; | ||
82 | |||
67 | enum { | 83 | enum { |
68 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, | 84 | MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29, |
69 | MLX4_CQE_QPN_MASK = 0xffffff, | 85 | MLX4_CQE_QPN_MASK = 0xffffff, |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 811f91cf5e8c..a51b0134ce18 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -40,6 +40,8 @@ | |||
40 | 40 | ||
41 | #include <linux/atomic.h> | 41 | #include <linux/atomic.h> |
42 | 42 | ||
43 | #include <linux/clocksource.h> | ||
44 | |||
43 | #define MAX_MSIX_P_PORT 17 | 45 | #define MAX_MSIX_P_PORT 17 |
44 | #define MAX_MSIX 64 | 46 | #define MAX_MSIX 64 |
45 | #define MSIX_LEGACY_SZ 4 | 47 | #define MSIX_LEGACY_SZ 4 |
@@ -140,6 +142,7 @@ enum { | |||
140 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, | 142 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, |
141 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, | 143 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, |
142 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, | 144 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, |
145 | MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53, | ||
143 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, | 146 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, |
144 | MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, | 147 | MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, |
145 | MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, | 148 | MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61, |
@@ -151,7 +154,10 @@ enum { | |||
151 | MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, | 154 | MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, |
152 | MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, | 155 | MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, |
153 | MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, | 156 | MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3, |
154 | MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4 | 157 | MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, |
158 | MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, | ||
159 | MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, | ||
160 | MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7 | ||
155 | }; | 161 | }; |
156 | 162 | ||
157 | enum { | 163 | enum { |
@@ -443,6 +449,7 @@ struct mlx4_caps { | |||
443 | u8 eqe_factor; | 449 | u8 eqe_factor; |
444 | u32 userspace_caps; /* userspace must be aware of these */ | 450 | u32 userspace_caps; /* userspace must be aware of these */ |
445 | u32 function_caps; /* VFs must be aware of these */ | 451 | u32 function_caps; /* VFs must be aware of these */ |
452 | u16 hca_core_clock; | ||
446 | }; | 453 | }; |
447 | 454 | ||
448 | struct mlx4_buf_list { | 455 | struct mlx4_buf_list { |
@@ -837,7 +844,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres, | |||
837 | 844 | ||
838 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | 845 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, |
839 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, | 846 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, |
840 | unsigned vector, int collapsed); | 847 | unsigned vector, int collapsed, int timestamp_en); |
841 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); | 848 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); |
842 | 849 | ||
843 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); | 850 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); |
@@ -896,11 +903,12 @@ static inline int map_hw_to_sw_id(u16 header_id) | |||
896 | } | 903 | } |
897 | 904 | ||
898 | enum mlx4_net_trans_promisc_mode { | 905 | enum mlx4_net_trans_promisc_mode { |
899 | MLX4_FS_PROMISC_NONE = 0, | 906 | MLX4_FS_REGULAR = 1, |
900 | MLX4_FS_PROMISC_UPLINK, | 907 | MLX4_FS_ALL_DEFAULT, |
901 | /* For future use. Not implemented yet */ | 908 | MLX4_FS_MC_DEFAULT, |
902 | MLX4_FS_PROMISC_FUNCTION_PORT, | 909 | MLX4_FS_UC_SNIFFER, |
903 | MLX4_FS_PROMISC_ALL_MULTI, | 910 | MLX4_FS_MC_SNIFFER, |
911 | MLX4_FS_MODE_NUM, /* should be last */ | ||
904 | }; | 912 | }; |
905 | 913 | ||
906 | struct mlx4_spec_eth { | 914 | struct mlx4_spec_eth { |
@@ -929,7 +937,7 @@ struct mlx4_spec_ipv4 { | |||
929 | }; | 937 | }; |
930 | 938 | ||
931 | struct mlx4_spec_ib { | 939 | struct mlx4_spec_ib { |
932 | __be32 r_qpn; | 940 | __be32 l3_qpn; |
933 | __be32 qpn_msk; | 941 | __be32 qpn_msk; |
934 | u8 dst_gid[16]; | 942 | u8 dst_gid[16]; |
935 | u8 dst_gid_msk[16]; | 943 | u8 dst_gid_msk[16]; |
@@ -962,6 +970,92 @@ struct mlx4_net_trans_rule { | |||
962 | u32 qpn; | 970 | u32 qpn; |
963 | }; | 971 | }; |
964 | 972 | ||
973 | struct mlx4_net_trans_rule_hw_ctrl { | ||
974 | __be16 prio; | ||
975 | u8 type; | ||
976 | u8 flags; | ||
977 | u8 rsvd1; | ||
978 | u8 funcid; | ||
979 | u8 vep; | ||
980 | u8 port; | ||
981 | __be32 qpn; | ||
982 | __be32 rsvd2; | ||
983 | }; | ||
984 | |||
985 | struct mlx4_net_trans_rule_hw_ib { | ||
986 | u8 size; | ||
987 | u8 rsvd1; | ||
988 | __be16 id; | ||
989 | u32 rsvd2; | ||
990 | __be32 l3_qpn; | ||
991 | __be32 qpn_mask; | ||
992 | u8 dst_gid[16]; | ||
993 | u8 dst_gid_msk[16]; | ||
994 | } __packed; | ||
995 | |||
996 | struct mlx4_net_trans_rule_hw_eth { | ||
997 | u8 size; | ||
998 | u8 rsvd; | ||
999 | __be16 id; | ||
1000 | u8 rsvd1[6]; | ||
1001 | u8 dst_mac[6]; | ||
1002 | u16 rsvd2; | ||
1003 | u8 dst_mac_msk[6]; | ||
1004 | u16 rsvd3; | ||
1005 | u8 src_mac[6]; | ||
1006 | u16 rsvd4; | ||
1007 | u8 src_mac_msk[6]; | ||
1008 | u8 rsvd5; | ||
1009 | u8 ether_type_enable; | ||
1010 | __be16 ether_type; | ||
1011 | __be16 vlan_tag_msk; | ||
1012 | __be16 vlan_tag; | ||
1013 | } __packed; | ||
1014 | |||
1015 | struct mlx4_net_trans_rule_hw_tcp_udp { | ||
1016 | u8 size; | ||
1017 | u8 rsvd; | ||
1018 | __be16 id; | ||
1019 | __be16 rsvd1[3]; | ||
1020 | __be16 dst_port; | ||
1021 | __be16 rsvd2; | ||
1022 | __be16 dst_port_msk; | ||
1023 | __be16 rsvd3; | ||
1024 | __be16 src_port; | ||
1025 | __be16 rsvd4; | ||
1026 | __be16 src_port_msk; | ||
1027 | } __packed; | ||
1028 | |||
1029 | struct mlx4_net_trans_rule_hw_ipv4 { | ||
1030 | u8 size; | ||
1031 | u8 rsvd; | ||
1032 | __be16 id; | ||
1033 | __be32 rsvd1; | ||
1034 | __be32 dst_ip; | ||
1035 | __be32 dst_ip_msk; | ||
1036 | __be32 src_ip; | ||
1037 | __be32 src_ip_msk; | ||
1038 | } __packed; | ||
1039 | |||
1040 | struct _rule_hw { | ||
1041 | union { | ||
1042 | struct { | ||
1043 | u8 size; | ||
1044 | u8 rsvd; | ||
1045 | __be16 id; | ||
1046 | }; | ||
1047 | struct mlx4_net_trans_rule_hw_eth eth; | ||
1048 | struct mlx4_net_trans_rule_hw_ib ib; | ||
1049 | struct mlx4_net_trans_rule_hw_ipv4 ipv4; | ||
1050 | struct mlx4_net_trans_rule_hw_tcp_udp tcp_udp; | ||
1051 | }; | ||
1052 | }; | ||
1053 | |||
1054 | /* translating DMFS verbs sniffer rule to the FW API would need two reg IDs */ | ||
1055 | struct mlx4_flow_handle { | ||
1056 | u64 reg_id[2]; | ||
1057 | }; | ||
1058 | |||
965 | int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, | 1059 | int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, |
966 | enum mlx4_net_trans_promisc_mode mode); | 1060 | enum mlx4_net_trans_promisc_mode mode); |
967 | int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, | 1061 | int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, |
@@ -1011,6 +1105,11 @@ void mlx4_counter_free(struct mlx4_dev *dev, u32 idx); | |||
1011 | int mlx4_flow_attach(struct mlx4_dev *dev, | 1105 | int mlx4_flow_attach(struct mlx4_dev *dev, |
1012 | struct mlx4_net_trans_rule *rule, u64 *reg_id); | 1106 | struct mlx4_net_trans_rule *rule, u64 *reg_id); |
1013 | int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); | 1107 | int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); |
1108 | int mlx4_map_sw_to_hw_steering_mode(struct mlx4_dev *dev, | ||
1109 | enum mlx4_net_trans_promisc_mode flow_type); | ||
1110 | int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev, | ||
1111 | enum mlx4_net_trans_rule_id id); | ||
1112 | int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); | ||
1014 | 1113 | ||
1015 | void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, | 1114 | void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, |
1016 | int i, int val); | 1115 | int i, int val); |
@@ -1028,4 +1127,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int | |||
1028 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); | 1127 | void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); |
1029 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); | 1128 | __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); |
1030 | 1129 | ||
1130 | cycle_t mlx4_read_clock(struct mlx4_dev *dev); | ||
1131 | |||
1031 | #endif /* MLX4_DEVICE_H */ | 1132 | #endif /* MLX4_DEVICE_H */ |
diff --git a/include/linux/mlx4/srq.h b/include/linux/mlx4/srq.h index 799a0697a383..192e0f7784f2 100644 --- a/include/linux/mlx4/srq.h +++ b/include/linux/mlx4/srq.h | |||
@@ -39,4 +39,6 @@ struct mlx4_wqe_srq_next_seg { | |||
39 | u32 reserved2[3]; | 39 | u32 reserved2[3]; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn); | ||
43 | |||
42 | #endif /* MLX4_SRQ_H */ | 44 | #endif /* MLX4_SRQ_H */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index e2091b88d24c..e0c8528a41a4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -44,6 +44,9 @@ extern int sysctl_legacy_va_layout; | |||
44 | #include <asm/pgtable.h> | 44 | #include <asm/pgtable.h> |
45 | #include <asm/processor.h> | 45 | #include <asm/processor.h> |
46 | 46 | ||
47 | extern unsigned long sysctl_user_reserve_kbytes; | ||
48 | extern unsigned long sysctl_admin_reserve_kbytes; | ||
49 | |||
47 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) | 50 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) |
48 | 51 | ||
49 | /* to align the pointer to the (next) page boundary */ | 52 | /* to align the pointer to the (next) page boundary */ |
@@ -899,7 +902,8 @@ extern void pagefault_out_of_memory(void); | |||
899 | * Flags passed to show_mem() and show_free_areas() to suppress output in | 902 | * Flags passed to show_mem() and show_free_areas() to suppress output in |
900 | * various contexts. | 903 | * various contexts. |
901 | */ | 904 | */ |
902 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */ | 905 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */ |
906 | #define SHOW_MEM_FILTER_PAGE_COUNT (0x0002u) /* page type count */ | ||
903 | 907 | ||
904 | extern void show_free_areas(unsigned int flags); | 908 | extern void show_free_areas(unsigned int flags); |
905 | extern bool skip_free_areas_node(unsigned int flags, int nid); | 909 | extern bool skip_free_areas_node(unsigned int flags, int nid); |
@@ -947,13 +951,19 @@ void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma, | |||
947 | * (see walk_page_range for more details) | 951 | * (see walk_page_range for more details) |
948 | */ | 952 | */ |
949 | struct mm_walk { | 953 | struct mm_walk { |
950 | int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *); | 954 | int (*pgd_entry)(pgd_t *pgd, unsigned long addr, |
951 | int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *); | 955 | unsigned long next, struct mm_walk *walk); |
952 | int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *); | 956 | int (*pud_entry)(pud_t *pud, unsigned long addr, |
953 | int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *); | 957 | unsigned long next, struct mm_walk *walk); |
954 | int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *); | 958 | int (*pmd_entry)(pmd_t *pmd, unsigned long addr, |
955 | int (*hugetlb_entry)(pte_t *, unsigned long, | 959 | unsigned long next, struct mm_walk *walk); |
956 | unsigned long, unsigned long, struct mm_walk *); | 960 | int (*pte_entry)(pte_t *pte, unsigned long addr, |
961 | unsigned long next, struct mm_walk *walk); | ||
962 | int (*pte_hole)(unsigned long addr, unsigned long next, | ||
963 | struct mm_walk *walk); | ||
964 | int (*hugetlb_entry)(pte_t *pte, unsigned long hmask, | ||
965 | unsigned long addr, unsigned long next, | ||
966 | struct mm_walk *walk); | ||
957 | struct mm_struct *mm; | 967 | struct mm_struct *mm; |
958 | void *private; | 968 | void *private; |
959 | }; | 969 | }; |
@@ -1078,9 +1088,6 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma, | |||
1078 | unsigned long old_addr, struct vm_area_struct *new_vma, | 1088 | unsigned long old_addr, struct vm_area_struct *new_vma, |
1079 | unsigned long new_addr, unsigned long len, | 1089 | unsigned long new_addr, unsigned long len, |
1080 | bool need_rmap_locks); | 1090 | bool need_rmap_locks); |
1081 | extern unsigned long do_mremap(unsigned long addr, | ||
1082 | unsigned long old_len, unsigned long new_len, | ||
1083 | unsigned long flags, unsigned long new_addr); | ||
1084 | extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, | 1091 | extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, |
1085 | unsigned long end, pgprot_t newprot, | 1092 | unsigned long end, pgprot_t newprot, |
1086 | int dirty_accountable, int prot_numa); | 1093 | int dirty_accountable, int prot_numa); |
@@ -1294,6 +1301,61 @@ extern void free_area_init_node(int nid, unsigned long * zones_size, | |||
1294 | unsigned long zone_start_pfn, unsigned long *zholes_size); | 1301 | unsigned long zone_start_pfn, unsigned long *zholes_size); |
1295 | extern void free_initmem(void); | 1302 | extern void free_initmem(void); |
1296 | 1303 | ||
1304 | /* | ||
1305 | * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK) | ||
1306 | * into the buddy system. The freed pages will be poisoned with pattern | ||
1307 | * "poison" if it's non-zero. | ||
1308 | * Return pages freed into the buddy system. | ||
1309 | */ | ||
1310 | extern unsigned long free_reserved_area(unsigned long start, unsigned long end, | ||
1311 | int poison, char *s); | ||
1312 | #ifdef CONFIG_HIGHMEM | ||
1313 | /* | ||
1314 | * Free a highmem page into the buddy system, adjusting totalhigh_pages | ||
1315 | * and totalram_pages. | ||
1316 | */ | ||
1317 | extern void free_highmem_page(struct page *page); | ||
1318 | #endif | ||
1319 | |||
1320 | static inline void adjust_managed_page_count(struct page *page, long count) | ||
1321 | { | ||
1322 | totalram_pages += count; | ||
1323 | } | ||
1324 | |||
1325 | /* Free the reserved page into the buddy system, so it gets managed. */ | ||
1326 | static inline void __free_reserved_page(struct page *page) | ||
1327 | { | ||
1328 | ClearPageReserved(page); | ||
1329 | init_page_count(page); | ||
1330 | __free_page(page); | ||
1331 | } | ||
1332 | |||
1333 | static inline void free_reserved_page(struct page *page) | ||
1334 | { | ||
1335 | __free_reserved_page(page); | ||
1336 | adjust_managed_page_count(page, 1); | ||
1337 | } | ||
1338 | |||
1339 | static inline void mark_page_reserved(struct page *page) | ||
1340 | { | ||
1341 | SetPageReserved(page); | ||
1342 | adjust_managed_page_count(page, -1); | ||
1343 | } | ||
1344 | |||
1345 | /* | ||
1346 | * Default method to free all the __init memory into the buddy system. | ||
1347 | * The freed pages will be poisoned with pattern "poison" if it is | ||
1348 | * non-zero. Return pages freed into the buddy system. | ||
1349 | */ | ||
1350 | static inline unsigned long free_initmem_default(int poison) | ||
1351 | { | ||
1352 | extern char __init_begin[], __init_end[]; | ||
1353 | |||
1354 | return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) , | ||
1355 | ((unsigned long)&__init_end) & PAGE_MASK, | ||
1356 | poison, "unused kernel"); | ||
1357 | } | ||
1358 | |||
1297 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 1359 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
1298 | /* | 1360 | /* |
1299 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its | 1361 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its |
@@ -1675,8 +1737,12 @@ int in_gate_area_no_mm(unsigned long addr); | |||
1675 | #define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) | 1737 | #define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) |
1676 | #endif /* __HAVE_ARCH_GATE_AREA */ | 1738 | #endif /* __HAVE_ARCH_GATE_AREA */ |
1677 | 1739 | ||
1740 | #ifdef CONFIG_SYSCTL | ||
1741 | extern int sysctl_drop_caches; | ||
1678 | int drop_caches_sysctl_handler(struct ctl_table *, int, | 1742 | int drop_caches_sysctl_handler(struct ctl_table *, int, |
1679 | void __user *, size_t *, loff_t *); | 1743 | void __user *, size_t *, loff_t *); |
1744 | #endif | ||
1745 | |||
1680 | unsigned long shrink_slab(struct shrink_control *shrink, | 1746 | unsigned long shrink_slab(struct shrink_control *shrink, |
1681 | unsigned long nr_pages_scanned, | 1747 | unsigned long nr_pages_scanned, |
1682 | unsigned long lru_pages); | 1748 | unsigned long lru_pages); |
@@ -1704,12 +1770,12 @@ pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); | |||
1704 | void *vmemmap_alloc_block(unsigned long size, int node); | 1770 | void *vmemmap_alloc_block(unsigned long size, int node); |
1705 | void *vmemmap_alloc_block_buf(unsigned long size, int node); | 1771 | void *vmemmap_alloc_block_buf(unsigned long size, int node); |
1706 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); | 1772 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); |
1707 | int vmemmap_populate_basepages(struct page *start_page, | 1773 | int vmemmap_populate_basepages(unsigned long start, unsigned long end, |
1708 | unsigned long pages, int node); | 1774 | int node); |
1709 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); | 1775 | int vmemmap_populate(unsigned long start, unsigned long end, int node); |
1710 | void vmemmap_populate_print_last(void); | 1776 | void vmemmap_populate_print_last(void); |
1711 | #ifdef CONFIG_MEMORY_HOTPLUG | 1777 | #ifdef CONFIG_MEMORY_HOTPLUG |
1712 | void vmemmap_free(struct page *memmap, unsigned long nr_pages); | 1778 | void vmemmap_free(unsigned long start, unsigned long end); |
1713 | #endif | 1779 | #endif |
1714 | void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, | 1780 | void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, |
1715 | unsigned long size); | 1781 | unsigned long size); |
@@ -1756,5 +1822,11 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; } | |||
1756 | static inline bool page_is_guard(struct page *page) { return false; } | 1822 | static inline bool page_is_guard(struct page *page) { return false; } |
1757 | #endif /* CONFIG_DEBUG_PAGEALLOC */ | 1823 | #endif /* CONFIG_DEBUG_PAGEALLOC */ |
1758 | 1824 | ||
1825 | #if MAX_NUMNODES > 1 | ||
1826 | void __init setup_nr_node_ids(void); | ||
1827 | #else | ||
1828 | static inline void setup_nr_node_ids(void) {} | ||
1829 | #endif | ||
1830 | |||
1759 | #endif /* __KERNEL__ */ | 1831 | #endif /* __KERNEL__ */ |
1760 | #endif /* _LINUX_MM_H */ | 1832 | #endif /* _LINUX_MM_H */ |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 61b2c30c903b..f31725ba49f3 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -17,6 +17,7 @@ | |||
17 | struct mmc_cid { | 17 | struct mmc_cid { |
18 | unsigned int manfid; | 18 | unsigned int manfid; |
19 | char prod_name[8]; | 19 | char prod_name[8]; |
20 | unsigned char prv; | ||
20 | unsigned int serial; | 21 | unsigned int serial; |
21 | unsigned short oemid; | 22 | unsigned short oemid; |
22 | unsigned short year; | 23 | unsigned short year; |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index d6f20cc6415e..e326ae2882a0 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -280,6 +280,7 @@ struct mmc_host { | |||
280 | #define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */ | 280 | #define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */ |
281 | #define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ | 281 | #define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ |
282 | MMC_CAP2_PACKED_WR) | 282 | MMC_CAP2_PACKED_WR) |
283 | #define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ | ||
283 | 284 | ||
284 | mmc_pm_flag_t pm_caps; /* supported pm features */ | 285 | mmc_pm_flag_t pm_caps; /* supported pm features */ |
285 | 286 | ||
@@ -341,9 +342,7 @@ struct mmc_host { | |||
341 | 342 | ||
342 | mmc_pm_flag_t pm_flags; /* requested pm features */ | 343 | mmc_pm_flag_t pm_flags; /* requested pm features */ |
343 | 344 | ||
344 | #ifdef CONFIG_LEDS_TRIGGERS | ||
345 | struct led_trigger *led; /* activity led */ | 345 | struct led_trigger *led; /* activity led */ |
346 | #endif | ||
347 | 346 | ||
348 | #ifdef CONFIG_REGULATOR | 347 | #ifdef CONFIG_REGULATOR |
349 | bool regulator_enabled; /* regulator state */ | 348 | bool regulator_enabled; /* regulator state */ |
@@ -361,6 +360,8 @@ struct mmc_host { | |||
361 | 360 | ||
362 | unsigned int actual_clock; /* Actual HC clock rate */ | 361 | unsigned int actual_clock; /* Actual HC clock rate */ |
363 | 362 | ||
363 | unsigned int slotno; /* used for sdio acpi binding */ | ||
364 | |||
364 | unsigned long private[0] ____cacheline_aligned; | 365 | unsigned long private[0] ____cacheline_aligned; |
365 | }; | 366 | }; |
366 | 367 | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index c74092eebf5c..5c76737d836b 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -450,7 +450,7 @@ struct zone { | |||
450 | * | 450 | * |
451 | * present_pages is physical pages existing within the zone, which | 451 | * present_pages is physical pages existing within the zone, which |
452 | * is calculated as: | 452 | * is calculated as: |
453 | * present_pages = spanned_pages - absent_pages(pags in holes); | 453 | * present_pages = spanned_pages - absent_pages(pages in holes); |
454 | * | 454 | * |
455 | * managed_pages is present pages managed by the buddy system, which | 455 | * managed_pages is present pages managed by the buddy system, which |
456 | * is calculated as (reserved_pages includes pages allocated by the | 456 | * is calculated as (reserved_pages includes pages allocated by the |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 779cf7c4a3d1..b508016fb76d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/uuid.h> | ||
12 | typedef unsigned long kernel_ulong_t; | 13 | typedef unsigned long kernel_ulong_t; |
13 | #endif | 14 | #endif |
14 | 15 | ||
@@ -568,4 +569,12 @@ struct ipack_device_id { | |||
568 | __u32 device; /* Device ID or IPACK_ANY_ID */ | 569 | __u32 device; /* Device ID or IPACK_ANY_ID */ |
569 | }; | 570 | }; |
570 | 571 | ||
572 | #define MEI_CL_MODULE_PREFIX "mei:" | ||
573 | #define MEI_CL_NAME_SIZE 32 | ||
574 | |||
575 | struct mei_cl_device_id { | ||
576 | char name[MEI_CL_NAME_SIZE]; | ||
577 | kernel_ulong_t driver_info; | ||
578 | }; | ||
579 | |||
571 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 580 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index ead1b5719a12..46f1ea01e6f6 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -190,7 +190,7 @@ extern int modules_disabled; /* for sysctl */ | |||
190 | /* Get/put a kernel symbol (calls must be symmetric) */ | 190 | /* Get/put a kernel symbol (calls must be symmetric) */ |
191 | void *__symbol_get(const char *symbol); | 191 | void *__symbol_get(const char *symbol); |
192 | void *__symbol_get_gpl(const char *symbol); | 192 | void *__symbol_get_gpl(const char *symbol); |
193 | #define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x))) | 193 | #define symbol_get(x) ((typeof(&x))(__symbol_get(VMLINUX_SYMBOL_STR(x)))) |
194 | 194 | ||
195 | /* modules using other modules: kdb wants to see this. */ | 195 | /* modules using other modules: kdb wants to see this. */ |
196 | struct module_use { | 196 | struct module_use { |
@@ -453,7 +453,7 @@ extern void __module_put_and_exit(struct module *mod, long code) | |||
453 | #ifdef CONFIG_MODULE_UNLOAD | 453 | #ifdef CONFIG_MODULE_UNLOAD |
454 | unsigned long module_refcount(struct module *mod); | 454 | unsigned long module_refcount(struct module *mod); |
455 | void __symbol_put(const char *symbol); | 455 | void __symbol_put(const char *symbol); |
456 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) | 456 | #define symbol_put(x) __symbol_put(VMLINUX_SYMBOL_STR(x)) |
457 | void symbol_put_addr(void *addr); | 457 | void symbol_put_addr(void *addr); |
458 | 458 | ||
459 | /* Sometimes we know we already have a refcount, and it's easier not | 459 | /* Sometimes we know we already have a refcount, and it's easier not |
diff --git a/include/linux/msi.h b/include/linux/msi.h index ce93a341337d..20c2d6dd5d25 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
@@ -13,14 +13,14 @@ struct msi_msg { | |||
13 | /* Helper functions */ | 13 | /* Helper functions */ |
14 | struct irq_data; | 14 | struct irq_data; |
15 | struct msi_desc; | 15 | struct msi_desc; |
16 | extern void mask_msi_irq(struct irq_data *data); | 16 | void mask_msi_irq(struct irq_data *data); |
17 | extern void unmask_msi_irq(struct irq_data *data); | 17 | void unmask_msi_irq(struct irq_data *data); |
18 | extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); | 18 | void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); |
19 | extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); | 19 | void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); |
20 | extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); | 20 | void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); |
21 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); | 21 | void read_msi_msg(unsigned int irq, struct msi_msg *msg); |
22 | extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); | 22 | void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); |
23 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); | 23 | void write_msi_msg(unsigned int irq, struct msi_msg *msg); |
24 | 24 | ||
25 | struct msi_desc { | 25 | struct msi_desc { |
26 | struct { | 26 | struct { |
@@ -54,9 +54,8 @@ struct msi_desc { | |||
54 | */ | 54 | */ |
55 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); | 55 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); |
56 | void arch_teardown_msi_irq(unsigned int irq); | 56 | void arch_teardown_msi_irq(unsigned int irq); |
57 | extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | 57 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); |
58 | extern void arch_teardown_msi_irqs(struct pci_dev *dev); | 58 | void arch_teardown_msi_irqs(struct pci_dev *dev); |
59 | extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); | 59 | int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); |
60 | |||
61 | 60 | ||
62 | #endif /* LINUX_MSI_H */ | 61 | #endif /* LINUX_MSI_H */ |
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 4eb0a50d0c55..e93837f647de 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h | |||
@@ -74,7 +74,7 @@ struct mtd_blktrans_ops { | |||
74 | 74 | ||
75 | /* Called with mtd_table_mutex held; no race with add/remove */ | 75 | /* Called with mtd_table_mutex held; no race with add/remove */ |
76 | int (*open)(struct mtd_blktrans_dev *dev); | 76 | int (*open)(struct mtd_blktrans_dev *dev); |
77 | int (*release)(struct mtd_blktrans_dev *dev); | 77 | void (*release)(struct mtd_blktrans_dev *dev); |
78 | 78 | ||
79 | /* Called on {de,}registration and on subsequent addition/removal | 79 | /* Called on {de,}registration and on subsequent addition/removal |
80 | of devices, with mtd_table_mutex held. */ | 80 | of devices, with mtd_table_mutex held. */ |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index f9ac2897b86b..a5cf4e8d6818 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -362,10 +362,10 @@ struct mtd_partition; | |||
362 | struct mtd_part_parser_data; | 362 | struct mtd_part_parser_data; |
363 | 363 | ||
364 | extern int mtd_device_parse_register(struct mtd_info *mtd, | 364 | extern int mtd_device_parse_register(struct mtd_info *mtd, |
365 | const char **part_probe_types, | 365 | const char * const *part_probe_types, |
366 | struct mtd_part_parser_data *parser_data, | 366 | struct mtd_part_parser_data *parser_data, |
367 | const struct mtd_partition *defparts, | 367 | const struct mtd_partition *defparts, |
368 | int defnr_parts); | 368 | int defnr_parts); |
369 | #define mtd_device_register(master, parts, nr_parts) \ | 369 | #define mtd_device_register(master, parts, nr_parts) \ |
370 | mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) | 370 | mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) |
371 | extern int mtd_device_unregister(struct mtd_info *master); | 371 | extern int mtd_device_unregister(struct mtd_info *master); |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index ef52d9c91459..ab6363443ce8 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -86,7 +86,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | |||
86 | #define NAND_CMD_READOOB 0x50 | 86 | #define NAND_CMD_READOOB 0x50 |
87 | #define NAND_CMD_ERASE1 0x60 | 87 | #define NAND_CMD_ERASE1 0x60 |
88 | #define NAND_CMD_STATUS 0x70 | 88 | #define NAND_CMD_STATUS 0x70 |
89 | #define NAND_CMD_STATUS_MULTI 0x71 | ||
90 | #define NAND_CMD_SEQIN 0x80 | 89 | #define NAND_CMD_SEQIN 0x80 |
91 | #define NAND_CMD_RNDIN 0x85 | 90 | #define NAND_CMD_RNDIN 0x85 |
92 | #define NAND_CMD_READID 0x90 | 91 | #define NAND_CMD_READID 0x90 |
@@ -105,25 +104,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | |||
105 | #define NAND_CMD_RNDOUTSTART 0xE0 | 104 | #define NAND_CMD_RNDOUTSTART 0xE0 |
106 | #define NAND_CMD_CACHEDPROG 0x15 | 105 | #define NAND_CMD_CACHEDPROG 0x15 |
107 | 106 | ||
108 | /* Extended commands for AG-AND device */ | ||
109 | /* | ||
110 | * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but | ||
111 | * there is no way to distinguish that from NAND_CMD_READ0 | ||
112 | * until the remaining sequence of commands has been completed | ||
113 | * so add a high order bit and mask it off in the command. | ||
114 | */ | ||
115 | #define NAND_CMD_DEPLETE1 0x100 | ||
116 | #define NAND_CMD_DEPLETE2 0x38 | ||
117 | #define NAND_CMD_STATUS_MULTI 0x71 | ||
118 | #define NAND_CMD_STATUS_ERROR 0x72 | ||
119 | /* multi-bank error status (banks 0-3) */ | ||
120 | #define NAND_CMD_STATUS_ERROR0 0x73 | ||
121 | #define NAND_CMD_STATUS_ERROR1 0x74 | ||
122 | #define NAND_CMD_STATUS_ERROR2 0x75 | ||
123 | #define NAND_CMD_STATUS_ERROR3 0x76 | ||
124 | #define NAND_CMD_STATUS_RESET 0x7f | ||
125 | #define NAND_CMD_STATUS_CLEAR 0xff | ||
126 | |||
127 | #define NAND_CMD_NONE -1 | 107 | #define NAND_CMD_NONE -1 |
128 | 108 | ||
129 | /* Status bits */ | 109 | /* Status bits */ |
@@ -165,28 +145,8 @@ typedef enum { | |||
165 | */ | 145 | */ |
166 | /* Buswidth is 16 bit */ | 146 | /* Buswidth is 16 bit */ |
167 | #define NAND_BUSWIDTH_16 0x00000002 | 147 | #define NAND_BUSWIDTH_16 0x00000002 |
168 | /* Device supports partial programming without padding */ | ||
169 | #define NAND_NO_PADDING 0x00000004 | ||
170 | /* Chip has cache program function */ | 148 | /* Chip has cache program function */ |
171 | #define NAND_CACHEPRG 0x00000008 | 149 | #define NAND_CACHEPRG 0x00000008 |
172 | /* Chip has copy back function */ | ||
173 | #define NAND_COPYBACK 0x00000010 | ||
174 | /* | ||
175 | * AND Chip which has 4 banks and a confusing page / block | ||
176 | * assignment. See Renesas datasheet for further information. | ||
177 | */ | ||
178 | #define NAND_IS_AND 0x00000020 | ||
179 | /* | ||
180 | * Chip has a array of 4 pages which can be read without | ||
181 | * additional ready /busy waits. | ||
182 | */ | ||
183 | #define NAND_4PAGE_ARRAY 0x00000040 | ||
184 | /* | ||
185 | * Chip requires that BBT is periodically rewritten to prevent | ||
186 | * bits from adjacent blocks from 'leaking' in altering data. | ||
187 | * This happens with the Renesas AG-AND chips, possibly others. | ||
188 | */ | ||
189 | #define BBT_AUTO_REFRESH 0x00000080 | ||
190 | /* | 150 | /* |
191 | * Chip requires ready check on read (for auto-incremented sequential read). | 151 | * Chip requires ready check on read (for auto-incremented sequential read). |
192 | * True only for small page devices; large page devices do not support | 152 | * True only for small page devices; large page devices do not support |
@@ -207,13 +167,10 @@ typedef enum { | |||
207 | #define NAND_SUBPAGE_READ 0x00001000 | 167 | #define NAND_SUBPAGE_READ 0x00001000 |
208 | 168 | ||
209 | /* Options valid for Samsung large page devices */ | 169 | /* Options valid for Samsung large page devices */ |
210 | #define NAND_SAMSUNG_LP_OPTIONS \ | 170 | #define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG |
211 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) | ||
212 | 171 | ||
213 | /* Macros to identify the above */ | 172 | /* Macros to identify the above */ |
214 | #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) | ||
215 | #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) | 173 | #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) |
216 | #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) | ||
217 | #define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ)) | 174 | #define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ)) |
218 | 175 | ||
219 | /* Non chip related options */ | 176 | /* Non chip related options */ |
@@ -361,6 +318,7 @@ struct nand_hw_control { | |||
361 | * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error | 318 | * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error |
362 | * @read_subpage: function to read parts of the page covered by ECC; | 319 | * @read_subpage: function to read parts of the page covered by ECC; |
363 | * returns same as read_page() | 320 | * returns same as read_page() |
321 | * @write_subpage: function to write parts of the page covered by ECC. | ||
364 | * @write_page: function to write a page according to the ECC generator | 322 | * @write_page: function to write a page according to the ECC generator |
365 | * requirements. | 323 | * requirements. |
366 | * @write_oob_raw: function to write chip OOB data without ECC | 324 | * @write_oob_raw: function to write chip OOB data without ECC |
@@ -392,6 +350,9 @@ struct nand_ecc_ctrl { | |||
392 | uint8_t *buf, int oob_required, int page); | 350 | uint8_t *buf, int oob_required, int page); |
393 | int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, | 351 | int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, |
394 | uint32_t offs, uint32_t len, uint8_t *buf); | 352 | uint32_t offs, uint32_t len, uint8_t *buf); |
353 | int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip, | ||
354 | uint32_t offset, uint32_t data_len, | ||
355 | const uint8_t *data_buf, int oob_required); | ||
395 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | 356 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, |
396 | const uint8_t *buf, int oob_required); | 357 | const uint8_t *buf, int oob_required); |
397 | int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, | 358 | int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, |
@@ -527,8 +488,8 @@ struct nand_chip { | |||
527 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, | 488 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, |
528 | int status, int page); | 489 | int status, int page); |
529 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | 490 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, |
530 | const uint8_t *buf, int oob_required, int page, | 491 | uint32_t offset, int data_len, const uint8_t *buf, |
531 | int cached, int raw); | 492 | int oob_required, int page, int cached, int raw); |
532 | int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, | 493 | int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, |
533 | int feature_addr, uint8_t *subfeature_para); | 494 | int feature_addr, uint8_t *subfeature_para); |
534 | int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, | 495 | int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, |
@@ -589,25 +550,65 @@ struct nand_chip { | |||
589 | #define NAND_MFR_MACRONIX 0xc2 | 550 | #define NAND_MFR_MACRONIX 0xc2 |
590 | #define NAND_MFR_EON 0x92 | 551 | #define NAND_MFR_EON 0x92 |
591 | 552 | ||
553 | /* The maximum expected count of bytes in the NAND ID sequence */ | ||
554 | #define NAND_MAX_ID_LEN 8 | ||
555 | |||
556 | /* | ||
557 | * A helper for defining older NAND chips where the second ID byte fully | ||
558 | * defined the chip, including the geometry (chip size, eraseblock size, page | ||
559 | * size). All these chips have 512 bytes NAND page size. | ||
560 | */ | ||
561 | #define LEGACY_ID_NAND(nm, devid, chipsz, erasesz, opts) \ | ||
562 | { .name = (nm), {{ .dev_id = (devid) }}, .pagesize = 512, \ | ||
563 | .chipsize = (chipsz), .erasesize = (erasesz), .options = (opts) } | ||
564 | |||
565 | /* | ||
566 | * A helper for defining newer chips which report their page size and | ||
567 | * eraseblock size via the extended ID bytes. | ||
568 | * | ||
569 | * The real difference between LEGACY_ID_NAND and EXTENDED_ID_NAND is that with | ||
570 | * EXTENDED_ID_NAND, manufacturers overloaded the same device ID so that the | ||
571 | * device ID now only represented a particular total chip size (and voltage, | ||
572 | * buswidth), and the page size, eraseblock size, and OOB size could vary while | ||
573 | * using the same device ID. | ||
574 | */ | ||
575 | #define EXTENDED_ID_NAND(nm, devid, chipsz, opts) \ | ||
576 | { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ | ||
577 | .options = (opts) } | ||
578 | |||
592 | /** | 579 | /** |
593 | * struct nand_flash_dev - NAND Flash Device ID Structure | 580 | * struct nand_flash_dev - NAND Flash Device ID Structure |
594 | * @name: Identify the device type | 581 | * @name: a human-readable name of the NAND chip |
595 | * @id: device ID code | 582 | * @dev_id: the device ID (the second byte of the full chip ID array) |
596 | * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 | 583 | * @mfr_id: manufecturer ID part of the full chip ID array (refers the same |
597 | * If the pagesize is 0, then the real pagesize | 584 | * memory address as @id[0]) |
598 | * and the eraseize are determined from the | 585 | * @dev_id: device ID part of the full chip ID array (refers the same memory |
599 | * extended id bytes in the chip | 586 | * address as @id[1]) |
600 | * @erasesize: Size of an erase block in the flash device. | 587 | * @id: full device ID array |
601 | * @chipsize: Total chipsize in Mega Bytes | 588 | * @pagesize: size of the NAND page in bytes; if 0, then the real page size (as |
602 | * @options: Bitfield to store chip relevant options | 589 | * well as the eraseblock size) is determined from the extended NAND |
590 | * chip ID array) | ||
591 | * @chipsize: total chip size in MiB | ||
592 | * @erasesize: eraseblock size in bytes (determined from the extended ID if 0) | ||
593 | * @options: stores various chip bit options | ||
594 | * @id_len: The valid length of the @id. | ||
595 | * @oobsize: OOB size | ||
603 | */ | 596 | */ |
604 | struct nand_flash_dev { | 597 | struct nand_flash_dev { |
605 | char *name; | 598 | char *name; |
606 | int id; | 599 | union { |
607 | unsigned long pagesize; | 600 | struct { |
608 | unsigned long chipsize; | 601 | uint8_t mfr_id; |
609 | unsigned long erasesize; | 602 | uint8_t dev_id; |
610 | unsigned long options; | 603 | }; |
604 | uint8_t id[NAND_MAX_ID_LEN]; | ||
605 | }; | ||
606 | unsigned int pagesize; | ||
607 | unsigned int chipsize; | ||
608 | unsigned int erasesize; | ||
609 | unsigned int options; | ||
610 | uint16_t id_len; | ||
611 | uint16_t oobsize; | ||
611 | }; | 612 | }; |
612 | 613 | ||
613 | /** | 614 | /** |
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index d2887e76b7f6..aa6a2633c2da 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h | |||
@@ -30,7 +30,7 @@ struct physmap_flash_data { | |||
30 | unsigned int pfow_base; | 30 | unsigned int pfow_base; |
31 | char *probe_type; | 31 | char *probe_type; |
32 | struct mtd_partition *parts; | 32 | struct mtd_partition *parts; |
33 | const char **part_probe_types; | 33 | const char * const *part_probe_types; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #endif /* __LINUX_MTD_PHYSMAP__ */ | 36 | #endif /* __LINUX_MTD_PHYSMAP__ */ |
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h index e07890aff1cf..44212d65aa97 100644 --- a/include/linux/mtd/plat-ram.h +++ b/include/linux/mtd/plat-ram.h | |||
@@ -20,8 +20,8 @@ | |||
20 | 20 | ||
21 | struct platdata_mtd_ram { | 21 | struct platdata_mtd_ram { |
22 | const char *mapname; | 22 | const char *mapname; |
23 | const char **map_probes; | 23 | const char * const *map_probes; |
24 | const char **probes; | 24 | const char * const *probes; |
25 | struct mtd_partition *partitions; | 25 | struct mtd_partition *partitions; |
26 | int nr_partitions; | 26 | int nr_partitions; |
27 | int bankwidth; | 27 | int bankwidth; |
diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 9121595a8ebf..433da8a1a426 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h | |||
@@ -53,6 +53,9 @@ struct mutex { | |||
53 | #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) | 53 | #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) |
54 | struct task_struct *owner; | 54 | struct task_struct *owner; |
55 | #endif | 55 | #endif |
56 | #ifdef CONFIG_MUTEX_SPIN_ON_OWNER | ||
57 | void *spin_mlock; /* Spinner MCS lock */ | ||
58 | #endif | ||
56 | #ifdef CONFIG_DEBUG_MUTEXES | 59 | #ifdef CONFIG_DEBUG_MUTEXES |
57 | const char *name; | 60 | const char *name; |
58 | void *magic; | 61 | void *magic; |
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index 49258e0ed1c6..141d395bbb5f 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h | |||
@@ -19,7 +19,6 @@ | |||
19 | 19 | ||
20 | struct mv643xx_eth_shared_platform_data { | 20 | struct mv643xx_eth_shared_platform_data { |
21 | struct mbus_dram_target_info *dram; | 21 | struct mbus_dram_target_info *dram; |
22 | struct platform_device *shared_smi; | ||
23 | /* | 22 | /* |
24 | * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default | 23 | * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default |
25 | * limit of 9KiB will be used. | 24 | * limit of 9KiB will be used. |
diff --git a/include/linux/mxsfb.h b/include/linux/mxsfb.h deleted file mode 100644 index f80af8674342..000000000000 --- a/include/linux/mxsfb.h +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or | ||
3 | * modify it under the terms of the GNU General Public License | ||
4 | * as published by the Free Software Foundation; either version 2 | ||
5 | * of the License, or (at your option) any later version. | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * You should have received a copy of the GNU General Public License | ||
12 | * along with this program; if not, write to the Free Software | ||
13 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
14 | * MA 02110-1301, USA. | ||
15 | */ | ||
16 | |||
17 | #ifndef __LINUX_MXSFB_H | ||
18 | #define __LINUX_MXSFB_H | ||
19 | |||
20 | #include <linux/fb.h> | ||
21 | |||
22 | #define STMLCDIF_8BIT 1 /** pixel data bus to the display is of 8 bit width */ | ||
23 | #define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */ | ||
24 | #define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */ | ||
25 | #define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */ | ||
26 | |||
27 | #define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) | ||
28 | #define MXSFB_SYNC_DOTCLK_FAILING_ACT (1 << 7) /* failing/negtive edge sampling */ | ||
29 | |||
30 | struct mxsfb_platform_data { | ||
31 | struct fb_videomode *mode_list; | ||
32 | unsigned mode_count; | ||
33 | |||
34 | unsigned default_bpp; | ||
35 | |||
36 | unsigned dotclk_delay; /* refer manual HW_LCDIF_VDCTRL4 register */ | ||
37 | unsigned ld_intf_width; /* refer STMLCDIF_* macros */ | ||
38 | |||
39 | unsigned fb_size; /* Size of the video memory. If zero a | ||
40 | * default will be used | ||
41 | */ | ||
42 | unsigned long fb_phys; /* physical address for the video memory. If | ||
43 | * zero the framebuffer memory will be dynamically | ||
44 | * allocated. If specified,fb_size must also be specified. | ||
45 | * fb_phys must be unused by Linux. | ||
46 | */ | ||
47 | u32 sync; /* sync mask, contains MXSFB specifics not | ||
48 | * carried in fb_info->var.sync | ||
49 | */ | ||
50 | }; | ||
51 | |||
52 | #endif /* __LINUX_MXSFB_H */ | ||
diff --git a/include/linux/net.h b/include/linux/net.h index aa1673160a45..99c9f0c103c2 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -240,8 +240,8 @@ do { \ | |||
240 | #define net_dbg_ratelimited(fmt, ...) \ | 240 | #define net_dbg_ratelimited(fmt, ...) \ |
241 | net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) | 241 | net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) |
242 | 242 | ||
243 | #define net_random() random32() | 243 | #define net_random() prandom_u32() |
244 | #define net_srandom(seed) srandom32((__force u32)seed) | 244 | #define net_srandom(seed) prandom_seed((__force u32)(seed)) |
245 | 245 | ||
246 | extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, | 246 | extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, |
247 | struct kvec *vec, size_t num, size_t len); | 247 | struct kvec *vec, size_t num, size_t len); |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 3dd39340430e..09906b7ca47d 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
@@ -22,9 +22,9 @@ enum { | |||
22 | NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ | 22 | NETIF_F_IPV6_CSUM_BIT, /* Can checksum TCP/UDP over IPV6 */ |
23 | NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ | 23 | NETIF_F_HIGHDMA_BIT, /* Can DMA to high memory. */ |
24 | NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ | 24 | NETIF_F_FRAGLIST_BIT, /* Scatter/gather IO. */ |
25 | NETIF_F_HW_VLAN_TX_BIT, /* Transmit VLAN hw acceleration */ | 25 | NETIF_F_HW_VLAN_CTAG_TX_BIT, /* Transmit VLAN CTAG HW acceleration */ |
26 | NETIF_F_HW_VLAN_RX_BIT, /* Receive VLAN hw acceleration */ | 26 | NETIF_F_HW_VLAN_CTAG_RX_BIT, /* Receive VLAN CTAG HW acceleration */ |
27 | NETIF_F_HW_VLAN_FILTER_BIT, /* Receive filtering on VLAN */ | 27 | NETIF_F_HW_VLAN_CTAG_FILTER_BIT,/* Receive filtering on VLAN CTAGs */ |
28 | NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ | 28 | NETIF_F_VLAN_CHALLENGED_BIT, /* Device cannot handle VLAN packets */ |
29 | NETIF_F_GSO_BIT, /* Enable software GSO. */ | 29 | NETIF_F_GSO_BIT, /* Enable software GSO. */ |
30 | NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ | 30 | NETIF_F_LLTX_BIT, /* LockLess TX - deprecated. Please */ |
@@ -42,9 +42,9 @@ enum { | |||
42 | NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ | 42 | NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ |
43 | NETIF_F_FSO_BIT, /* ... FCoE segmentation */ | 43 | NETIF_F_FSO_BIT, /* ... FCoE segmentation */ |
44 | NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ | 44 | NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ |
45 | /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */ | 45 | NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ |
46 | NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */ | 46 | /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ |
47 | = NETIF_F_GSO_LAST, | 47 | NETIF_F_GSO_UDP_TUNNEL_BIT, |
48 | 48 | ||
49 | NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ | 49 | NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ |
50 | NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ | 50 | NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ |
@@ -56,6 +56,9 @@ enum { | |||
56 | NETIF_F_LOOPBACK_BIT, /* Enable loopback */ | 56 | NETIF_F_LOOPBACK_BIT, /* Enable loopback */ |
57 | NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */ | 57 | NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */ |
58 | NETIF_F_RXALL_BIT, /* Receive errored frames too */ | 58 | NETIF_F_RXALL_BIT, /* Receive errored frames too */ |
59 | NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */ | ||
60 | NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ | ||
61 | NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ | ||
59 | 62 | ||
60 | /* | 63 | /* |
61 | * Add your fresh new feature above and remember to update | 64 | * Add your fresh new feature above and remember to update |
@@ -80,9 +83,9 @@ enum { | |||
80 | #define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) | 83 | #define NETIF_F_GSO_ROBUST __NETIF_F(GSO_ROBUST) |
81 | #define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) | 84 | #define NETIF_F_HIGHDMA __NETIF_F(HIGHDMA) |
82 | #define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) | 85 | #define NETIF_F_HW_CSUM __NETIF_F(HW_CSUM) |
83 | #define NETIF_F_HW_VLAN_FILTER __NETIF_F(HW_VLAN_FILTER) | 86 | #define NETIF_F_HW_VLAN_CTAG_FILTER __NETIF_F(HW_VLAN_CTAG_FILTER) |
84 | #define NETIF_F_HW_VLAN_RX __NETIF_F(HW_VLAN_RX) | 87 | #define NETIF_F_HW_VLAN_CTAG_RX __NETIF_F(HW_VLAN_CTAG_RX) |
85 | #define NETIF_F_HW_VLAN_TX __NETIF_F(HW_VLAN_TX) | 88 | #define NETIF_F_HW_VLAN_CTAG_TX __NETIF_F(HW_VLAN_CTAG_TX) |
86 | #define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) | 89 | #define NETIF_F_IP_CSUM __NETIF_F(IP_CSUM) |
87 | #define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) | 90 | #define NETIF_F_IPV6_CSUM __NETIF_F(IPV6_CSUM) |
88 | #define NETIF_F_LLTX __NETIF_F(LLTX) | 91 | #define NETIF_F_LLTX __NETIF_F(LLTX) |
@@ -102,7 +105,11 @@ enum { | |||
102 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) | 105 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) |
103 | #define NETIF_F_RXFCS __NETIF_F(RXFCS) | 106 | #define NETIF_F_RXFCS __NETIF_F(RXFCS) |
104 | #define NETIF_F_RXALL __NETIF_F(RXALL) | 107 | #define NETIF_F_RXALL __NETIF_F(RXALL) |
105 | #define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE) | 108 | #define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) |
109 | #define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) | ||
110 | #define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) | ||
111 | #define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) | ||
112 | #define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) | ||
106 | 113 | ||
107 | /* Features valid for ethtool to change */ | 114 | /* Features valid for ethtool to change */ |
108 | /* = all defined minus driver/device-class-related */ | 115 | /* = all defined minus driver/device-class-related */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6151e903eef0..a94a5a0ab122 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -144,8 +144,6 @@ static inline bool dev_xmit_complete(int rc) | |||
144 | # else | 144 | # else |
145 | # define LL_MAX_HEADER 96 | 145 | # define LL_MAX_HEADER 96 |
146 | # endif | 146 | # endif |
147 | #elif IS_ENABLED(CONFIG_TR) | ||
148 | # define LL_MAX_HEADER 48 | ||
149 | #else | 147 | #else |
150 | # define LL_MAX_HEADER 32 | 148 | # define LL_MAX_HEADER 32 |
151 | #endif | 149 | #endif |
@@ -211,6 +209,7 @@ struct netdev_hw_addr { | |||
211 | #define NETDEV_HW_ADDR_T_UNICAST 4 | 209 | #define NETDEV_HW_ADDR_T_UNICAST 4 |
212 | #define NETDEV_HW_ADDR_T_MULTICAST 5 | 210 | #define NETDEV_HW_ADDR_T_MULTICAST 5 |
213 | bool global_use; | 211 | bool global_use; |
212 | int sync_cnt; | ||
214 | int refcount; | 213 | int refcount; |
215 | int synced; | 214 | int synced; |
216 | struct rcu_head rcu_head; | 215 | struct rcu_head rcu_head; |
@@ -594,7 +593,6 @@ struct rps_dev_flow { | |||
594 | struct rps_dev_flow_table { | 593 | struct rps_dev_flow_table { |
595 | unsigned int mask; | 594 | unsigned int mask; |
596 | struct rcu_head rcu; | 595 | struct rcu_head rcu; |
597 | struct work_struct free_work; | ||
598 | struct rps_dev_flow flows[0]; | 596 | struct rps_dev_flow flows[0]; |
599 | }; | 597 | }; |
600 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ | 598 | #define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \ |
@@ -785,13 +783,13 @@ struct netdev_fcoe_hbainfo { | |||
785 | * 3. Update dev->stats asynchronously and atomically, and define | 783 | * 3. Update dev->stats asynchronously and atomically, and define |
786 | * neither operation. | 784 | * neither operation. |
787 | * | 785 | * |
788 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); | 786 | * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid); |
789 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 787 | * If device support VLAN filtering this function is called when a |
790 | * this function is called when a VLAN id is registered. | 788 | * VLAN id is registered. |
791 | * | 789 | * |
792 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); | 790 | * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); |
793 | * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) | 791 | * If device support VLAN filtering this function is called when a |
794 | * this function is called when a VLAN id is unregistered. | 792 | * VLAN id is unregistered. |
795 | * | 793 | * |
796 | * void (*ndo_poll_controller)(struct net_device *dev); | 794 | * void (*ndo_poll_controller)(struct net_device *dev); |
797 | * | 795 | * |
@@ -935,9 +933,9 @@ struct net_device_ops { | |||
935 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); | 933 | struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
936 | 934 | ||
937 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, | 935 | int (*ndo_vlan_rx_add_vid)(struct net_device *dev, |
938 | unsigned short vid); | 936 | __be16 proto, u16 vid); |
939 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, | 937 | int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, |
940 | unsigned short vid); | 938 | __be16 proto, u16 vid); |
941 | #ifdef CONFIG_NET_POLL_CONTROLLER | 939 | #ifdef CONFIG_NET_POLL_CONTROLLER |
942 | void (*ndo_poll_controller)(struct net_device *dev); | 940 | void (*ndo_poll_controller)(struct net_device *dev); |
943 | int (*ndo_netpoll_setup)(struct net_device *dev, | 941 | int (*ndo_netpoll_setup)(struct net_device *dev, |
@@ -1073,6 +1071,8 @@ struct net_device { | |||
1073 | struct list_head dev_list; | 1071 | struct list_head dev_list; |
1074 | struct list_head napi_list; | 1072 | struct list_head napi_list; |
1075 | struct list_head unreg_list; | 1073 | struct list_head unreg_list; |
1074 | struct list_head upper_dev_list; /* List of upper devices */ | ||
1075 | |||
1076 | 1076 | ||
1077 | /* currently active device features */ | 1077 | /* currently active device features */ |
1078 | netdev_features_t features; | 1078 | netdev_features_t features; |
@@ -1145,6 +1145,13 @@ struct net_device { | |||
1145 | spinlock_t addr_list_lock; | 1145 | spinlock_t addr_list_lock; |
1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ | 1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ |
1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ | 1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ |
1148 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
1149 | * hw addresses | ||
1150 | */ | ||
1151 | #ifdef CONFIG_SYSFS | ||
1152 | struct kset *queues_kset; | ||
1153 | #endif | ||
1154 | |||
1148 | bool uc_promisc; | 1155 | bool uc_promisc; |
1149 | unsigned int promiscuity; | 1156 | unsigned int promiscuity; |
1150 | unsigned int allmulti; | 1157 | unsigned int allmulti; |
@@ -1177,21 +1184,11 @@ struct net_device { | |||
1177 | * avoid dirtying this cache line. | 1184 | * avoid dirtying this cache line. |
1178 | */ | 1185 | */ |
1179 | 1186 | ||
1180 | struct list_head upper_dev_list; /* List of upper devices */ | ||
1181 | |||
1182 | /* Interface address info used in eth_type_trans() */ | 1187 | /* Interface address info used in eth_type_trans() */ |
1183 | unsigned char *dev_addr; /* hw address, (before bcast | 1188 | unsigned char *dev_addr; /* hw address, (before bcast |
1184 | because most packets are | 1189 | because most packets are |
1185 | unicast) */ | 1190 | unicast) */ |
1186 | 1191 | ||
1187 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
1188 | hw addresses */ | ||
1189 | |||
1190 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
1191 | |||
1192 | #ifdef CONFIG_SYSFS | ||
1193 | struct kset *queues_kset; | ||
1194 | #endif | ||
1195 | 1192 | ||
1196 | #ifdef CONFIG_RPS | 1193 | #ifdef CONFIG_RPS |
1197 | struct netdev_rx_queue *_rx; | 1194 | struct netdev_rx_queue *_rx; |
@@ -1202,18 +1199,14 @@ struct net_device { | |||
1202 | /* Number of RX queues currently active in device */ | 1199 | /* Number of RX queues currently active in device */ |
1203 | unsigned int real_num_rx_queues; | 1200 | unsigned int real_num_rx_queues; |
1204 | 1201 | ||
1205 | #ifdef CONFIG_RFS_ACCEL | ||
1206 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
1207 | * by RX queue number. Assigned by driver. This must only be | ||
1208 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
1209 | struct cpu_rmap *rx_cpu_rmap; | ||
1210 | #endif | ||
1211 | #endif | 1202 | #endif |
1212 | 1203 | ||
1213 | rx_handler_func_t __rcu *rx_handler; | 1204 | rx_handler_func_t __rcu *rx_handler; |
1214 | void __rcu *rx_handler_data; | 1205 | void __rcu *rx_handler_data; |
1215 | 1206 | ||
1216 | struct netdev_queue __rcu *ingress_queue; | 1207 | struct netdev_queue __rcu *ingress_queue; |
1208 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
1209 | |||
1217 | 1210 | ||
1218 | /* | 1211 | /* |
1219 | * Cache lines mostly used on transmit path | 1212 | * Cache lines mostly used on transmit path |
@@ -1235,6 +1228,12 @@ struct net_device { | |||
1235 | #ifdef CONFIG_XPS | 1228 | #ifdef CONFIG_XPS |
1236 | struct xps_dev_maps __rcu *xps_maps; | 1229 | struct xps_dev_maps __rcu *xps_maps; |
1237 | #endif | 1230 | #endif |
1231 | #ifdef CONFIG_RFS_ACCEL | ||
1232 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
1233 | * by RX queue number. Assigned by driver. This must only be | ||
1234 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
1235 | struct cpu_rmap *rx_cpu_rmap; | ||
1236 | #endif | ||
1238 | 1237 | ||
1239 | /* These may be needed for future network-power-down code. */ | 1238 | /* These may be needed for future network-power-down code. */ |
1240 | 1239 | ||
@@ -1475,6 +1474,11 @@ static inline void *netdev_priv(const struct net_device *dev) | |||
1475 | */ | 1474 | */ |
1476 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) | 1475 | #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) |
1477 | 1476 | ||
1477 | /* Default NAPI poll() weight | ||
1478 | * Device drivers are strongly advised to not use bigger value | ||
1479 | */ | ||
1480 | #define NAPI_POLL_WEIGHT 64 | ||
1481 | |||
1478 | /** | 1482 | /** |
1479 | * netif_napi_add - initialize a napi context | 1483 | * netif_napi_add - initialize a napi context |
1480 | * @dev: network device | 1484 | * @dev: network device |
@@ -1612,6 +1616,9 @@ extern seqcount_t devnet_rename_seq; /* Device rename seq */ | |||
1612 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) | 1616 | list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) |
1613 | #define for_each_netdev_continue_rcu(net, d) \ | 1617 | #define for_each_netdev_continue_rcu(net, d) \ |
1614 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) | 1618 | list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) |
1619 | #define for_each_netdev_in_bond_rcu(bond, slave) \ | ||
1620 | for_each_netdev_rcu(&init_net, slave) \ | ||
1621 | if (netdev_master_upper_dev_get_rcu(slave) == bond) | ||
1615 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) | 1622 | #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) |
1616 | 1623 | ||
1617 | static inline struct net_device *next_net_device(struct net_device *dev) | 1624 | static inline struct net_device *next_net_device(struct net_device *dev) |
@@ -1684,7 +1691,6 @@ extern int netdev_refcnt_read(const struct net_device *dev); | |||
1684 | extern void free_netdev(struct net_device *dev); | 1691 | extern void free_netdev(struct net_device *dev); |
1685 | extern void synchronize_net(void); | 1692 | extern void synchronize_net(void); |
1686 | extern int init_dummy_netdev(struct net_device *dev); | 1693 | extern int init_dummy_netdev(struct net_device *dev); |
1687 | extern void netdev_resync_ops(struct net_device *dev); | ||
1688 | 1694 | ||
1689 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); | 1695 | extern struct net_device *dev_get_by_index(struct net *net, int ifindex); |
1690 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); | 1696 | extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); |
@@ -2621,6 +2627,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr); | |||
2621 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); | 2627 | extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); |
2622 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); | 2628 | extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); |
2623 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); | 2629 | extern int dev_uc_sync(struct net_device *to, struct net_device *from); |
2630 | extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from); | ||
2624 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); | 2631 | extern void dev_uc_unsync(struct net_device *to, struct net_device *from); |
2625 | extern void dev_uc_flush(struct net_device *dev); | 2632 | extern void dev_uc_flush(struct net_device *dev); |
2626 | extern void dev_uc_init(struct net_device *dev); | 2633 | extern void dev_uc_init(struct net_device *dev); |
@@ -2632,6 +2639,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr); | |||
2632 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); | 2639 | extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); |
2633 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); | 2640 | extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); |
2634 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); | 2641 | extern int dev_mc_sync(struct net_device *to, struct net_device *from); |
2642 | extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from); | ||
2635 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); | 2643 | extern void dev_mc_unsync(struct net_device *to, struct net_device *from); |
2636 | extern void dev_mc_flush(struct net_device *dev); | 2644 | extern void dev_mc_flush(struct net_device *dev); |
2637 | extern void dev_mc_init(struct net_device *dev); | 2645 | extern void dev_mc_init(struct net_device *dev); |
@@ -2678,6 +2686,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) | |||
2678 | { | 2686 | { |
2679 | return __skb_gso_segment(skb, features, true); | 2687 | return __skb_gso_segment(skb, features, true); |
2680 | } | 2688 | } |
2689 | __be16 skb_network_protocol(struct sk_buff *skb); | ||
2690 | |||
2691 | static inline bool can_checksum_protocol(netdev_features_t features, | ||
2692 | __be16 protocol) | ||
2693 | { | ||
2694 | return ((features & NETIF_F_GEN_CSUM) || | ||
2695 | ((features & NETIF_F_V4_CSUM) && | ||
2696 | protocol == htons(ETH_P_IP)) || | ||
2697 | ((features & NETIF_F_V6_CSUM) && | ||
2698 | protocol == htons(ETH_P_IPV6)) || | ||
2699 | ((features & NETIF_F_FCOE_CRC) && | ||
2700 | protocol == htons(ETH_P_FCOE))); | ||
2701 | } | ||
2681 | 2702 | ||
2682 | #ifdef CONFIG_BUG | 2703 | #ifdef CONFIG_BUG |
2683 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2704 | extern void netdev_rx_csum_fault(struct net_device *dev); |
@@ -2756,6 +2777,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
2756 | dev->gso_max_size = size; | 2777 | dev->gso_max_size = size; |
2757 | } | 2778 | } |
2758 | 2779 | ||
2780 | static inline bool netif_is_bond_master(struct net_device *dev) | ||
2781 | { | ||
2782 | return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; | ||
2783 | } | ||
2784 | |||
2759 | static inline bool netif_is_bond_slave(struct net_device *dev) | 2785 | static inline bool netif_is_bond_slave(struct net_device *dev) |
2760 | { | 2786 | { |
2761 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; | 2787 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index ee142846f56a..0060fde3160e 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -289,11 +289,6 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) | |||
289 | #endif | 289 | #endif |
290 | } | 290 | } |
291 | 291 | ||
292 | #ifdef CONFIG_PROC_FS | ||
293 | #include <linux/proc_fs.h> | ||
294 | extern struct proc_dir_entry *proc_net_netfilter; | ||
295 | #endif | ||
296 | |||
297 | #else /* !CONFIG_NETFILTER */ | 292 | #else /* !CONFIG_NETFILTER */ |
298 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) | 293 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) |
299 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) | 294 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) |
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index 7958e84a65af..d80e2753847c 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
3 | * Martin Josefsson <gandalf@wlug.westbo.se> | 3 | * Martin Josefsson <gandalf@wlug.westbo.se> |
4 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
@@ -47,10 +47,36 @@ enum ip_set_feature { | |||
47 | IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), | 47 | IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* Set extensions */ | ||
51 | enum ip_set_extension { | ||
52 | IPSET_EXT_NONE = 0, | ||
53 | IPSET_EXT_BIT_TIMEOUT = 1, | ||
54 | IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT), | ||
55 | IPSET_EXT_BIT_COUNTER = 2, | ||
56 | IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), | ||
57 | }; | ||
58 | |||
59 | /* Extension offsets */ | ||
60 | enum ip_set_offset { | ||
61 | IPSET_OFFSET_TIMEOUT = 0, | ||
62 | IPSET_OFFSET_COUNTER, | ||
63 | IPSET_OFFSET_MAX, | ||
64 | }; | ||
65 | |||
66 | #define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) | ||
67 | #define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) | ||
68 | |||
69 | struct ip_set_ext { | ||
70 | unsigned long timeout; | ||
71 | u64 packets; | ||
72 | u64 bytes; | ||
73 | }; | ||
74 | |||
50 | struct ip_set; | 75 | struct ip_set; |
51 | 76 | ||
52 | typedef int (*ipset_adtfn)(struct ip_set *set, void *value, | 77 | typedef int (*ipset_adtfn)(struct ip_set *set, void *value, |
53 | u32 timeout, u32 flags); | 78 | const struct ip_set_ext *ext, |
79 | struct ip_set_ext *mext, u32 cmdflags); | ||
54 | 80 | ||
55 | /* Kernel API function options */ | 81 | /* Kernel API function options */ |
56 | struct ip_set_adt_opt { | 82 | struct ip_set_adt_opt { |
@@ -58,7 +84,7 @@ struct ip_set_adt_opt { | |||
58 | u8 dim; /* Dimension of match/target */ | 84 | u8 dim; /* Dimension of match/target */ |
59 | u8 flags; /* Direction and negation flags */ | 85 | u8 flags; /* Direction and negation flags */ |
60 | u32 cmdflags; /* Command-like flags */ | 86 | u32 cmdflags; /* Command-like flags */ |
61 | u32 timeout; /* Timeout value */ | 87 | struct ip_set_ext ext; /* Extensions */ |
62 | }; | 88 | }; |
63 | 89 | ||
64 | /* Set type, variant-specific part */ | 90 | /* Set type, variant-specific part */ |
@@ -69,7 +95,7 @@ struct ip_set_type_variant { | |||
69 | * positive for matching element */ | 95 | * positive for matching element */ |
70 | int (*kadt)(struct ip_set *set, const struct sk_buff *skb, | 96 | int (*kadt)(struct ip_set *set, const struct sk_buff *skb, |
71 | const struct xt_action_param *par, | 97 | const struct xt_action_param *par, |
72 | enum ipset_adt adt, const struct ip_set_adt_opt *opt); | 98 | enum ipset_adt adt, struct ip_set_adt_opt *opt); |
73 | 99 | ||
74 | /* Userspace: test/add/del entries | 100 | /* Userspace: test/add/del entries |
75 | * returns negative error code, | 101 | * returns negative error code, |
@@ -151,10 +177,76 @@ struct ip_set { | |||
151 | u8 family; | 177 | u8 family; |
152 | /* The type revision */ | 178 | /* The type revision */ |
153 | u8 revision; | 179 | u8 revision; |
180 | /* Extensions */ | ||
181 | u8 extensions; | ||
154 | /* The type specific data */ | 182 | /* The type specific data */ |
155 | void *data; | 183 | void *data; |
156 | }; | 184 | }; |
157 | 185 | ||
186 | struct ip_set_counter { | ||
187 | atomic64_t bytes; | ||
188 | atomic64_t packets; | ||
189 | }; | ||
190 | |||
191 | static inline void | ||
192 | ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter) | ||
193 | { | ||
194 | atomic64_add((long long)bytes, &(counter)->bytes); | ||
195 | } | ||
196 | |||
197 | static inline void | ||
198 | ip_set_add_packets(u64 packets, struct ip_set_counter *counter) | ||
199 | { | ||
200 | atomic64_add((long long)packets, &(counter)->packets); | ||
201 | } | ||
202 | |||
203 | static inline u64 | ||
204 | ip_set_get_bytes(const struct ip_set_counter *counter) | ||
205 | { | ||
206 | return (u64)atomic64_read(&(counter)->bytes); | ||
207 | } | ||
208 | |||
209 | static inline u64 | ||
210 | ip_set_get_packets(const struct ip_set_counter *counter) | ||
211 | { | ||
212 | return (u64)atomic64_read(&(counter)->packets); | ||
213 | } | ||
214 | |||
215 | static inline void | ||
216 | ip_set_update_counter(struct ip_set_counter *counter, | ||
217 | const struct ip_set_ext *ext, | ||
218 | struct ip_set_ext *mext, u32 flags) | ||
219 | { | ||
220 | if (ext->packets != ULLONG_MAX && | ||
221 | !(flags & IPSET_FLAG_SKIP_COUNTER_UPDATE)) { | ||
222 | ip_set_add_bytes(ext->bytes, counter); | ||
223 | ip_set_add_packets(ext->packets, counter); | ||
224 | } | ||
225 | if (flags & IPSET_FLAG_MATCH_COUNTERS) { | ||
226 | mext->packets = ip_set_get_packets(counter); | ||
227 | mext->bytes = ip_set_get_bytes(counter); | ||
228 | } | ||
229 | } | ||
230 | |||
231 | static inline bool | ||
232 | ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter) | ||
233 | { | ||
234 | return nla_put_net64(skb, IPSET_ATTR_BYTES, | ||
235 | cpu_to_be64(ip_set_get_bytes(counter))) || | ||
236 | nla_put_net64(skb, IPSET_ATTR_PACKETS, | ||
237 | cpu_to_be64(ip_set_get_packets(counter))); | ||
238 | } | ||
239 | |||
240 | static inline void | ||
241 | ip_set_init_counter(struct ip_set_counter *counter, | ||
242 | const struct ip_set_ext *ext) | ||
243 | { | ||
244 | if (ext->bytes != ULLONG_MAX) | ||
245 | atomic64_set(&(counter)->bytes, (long long)(ext->bytes)); | ||
246 | if (ext->packets != ULLONG_MAX) | ||
247 | atomic64_set(&(counter)->packets, (long long)(ext->packets)); | ||
248 | } | ||
249 | |||
158 | /* register and unregister set references */ | 250 | /* register and unregister set references */ |
159 | extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); | 251 | extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); |
160 | extern void ip_set_put_byindex(ip_set_id_t index); | 252 | extern void ip_set_put_byindex(ip_set_id_t index); |
@@ -167,19 +259,21 @@ extern void ip_set_nfnl_put(ip_set_id_t index); | |||
167 | 259 | ||
168 | extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, | 260 | extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, |
169 | const struct xt_action_param *par, | 261 | const struct xt_action_param *par, |
170 | const struct ip_set_adt_opt *opt); | 262 | struct ip_set_adt_opt *opt); |
171 | extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, | 263 | extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, |
172 | const struct xt_action_param *par, | 264 | const struct xt_action_param *par, |
173 | const struct ip_set_adt_opt *opt); | 265 | struct ip_set_adt_opt *opt); |
174 | extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, | 266 | extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, |
175 | const struct xt_action_param *par, | 267 | const struct xt_action_param *par, |
176 | const struct ip_set_adt_opt *opt); | 268 | struct ip_set_adt_opt *opt); |
177 | 269 | ||
178 | /* Utility functions */ | 270 | /* Utility functions */ |
179 | extern void *ip_set_alloc(size_t size); | 271 | extern void *ip_set_alloc(size_t size); |
180 | extern void ip_set_free(void *members); | 272 | extern void ip_set_free(void *members); |
181 | extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); | 273 | extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); |
182 | extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); | 274 | extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); |
275 | extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[], | ||
276 | struct ip_set_ext *ext); | ||
183 | 277 | ||
184 | static inline int | 278 | static inline int |
185 | ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) | 279 | ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) |
@@ -200,6 +294,14 @@ ip_set_eexist(int ret, u32 flags) | |||
200 | return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST); | 294 | return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST); |
201 | } | 295 | } |
202 | 296 | ||
297 | /* Match elements marked with nomatch */ | ||
298 | static inline bool | ||
299 | ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) | ||
300 | { | ||
301 | return adt == IPSET_TEST && | ||
302 | ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); | ||
303 | } | ||
304 | |||
203 | /* Check the NLA_F_NET_BYTEORDER flag */ | 305 | /* Check the NLA_F_NET_BYTEORDER flag */ |
204 | static inline bool | 306 | static inline bool |
205 | ip_set_attr_netorder(struct nlattr *tb[], int type) | 307 | ip_set_attr_netorder(struct nlattr *tb[], int type) |
@@ -284,4 +386,14 @@ bitmap_bytes(u32 a, u32 b) | |||
284 | return 4 * ((((b - a + 8) / 8) + 3) / 4); | 386 | return 4 * ((((b - a + 8) / 8) + 3) / 4); |
285 | } | 387 | } |
286 | 388 | ||
389 | #include <linux/netfilter/ipset/ip_set_timeout.h> | ||
390 | |||
391 | #define IP_SET_INIT_KEXT(skb, opt, map) \ | ||
392 | { .bytes = (skb)->len, .packets = 1, \ | ||
393 | .timeout = ip_set_adt_opt_timeout(opt, map) } | ||
394 | |||
395 | #define IP_SET_INIT_UEXT(map) \ | ||
396 | { .bytes = ULLONG_MAX, .packets = ULLONG_MAX, \ | ||
397 | .timeout = (map)->timeout } | ||
398 | |||
287 | #endif /*_IP_SET_H */ | 399 | #endif /*_IP_SET_H */ |
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h deleted file mode 100644 index 0214c4c146fa..000000000000 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ /dev/null | |||
@@ -1,1241 +0,0 @@ | |||
1 | #ifndef _IP_SET_AHASH_H | ||
2 | #define _IP_SET_AHASH_H | ||
3 | |||
4 | #include <linux/rcupdate.h> | ||
5 | #include <linux/jhash.h> | ||
6 | #include <linux/netfilter/ipset/ip_set_timeout.h> | ||
7 | |||
8 | #define CONCAT(a, b, c) a##b##c | ||
9 | #define TOKEN(a, b, c) CONCAT(a, b, c) | ||
10 | |||
11 | #define type_pf_next TOKEN(TYPE, PF, _elem) | ||
12 | |||
13 | /* Hashing which uses arrays to resolve clashing. The hash table is resized | ||
14 | * (doubled) when searching becomes too long. | ||
15 | * Internally jhash is used with the assumption that the size of the | ||
16 | * stored data is a multiple of sizeof(u32). If storage supports timeout, | ||
17 | * the timeout field must be the last one in the data structure - that field | ||
18 | * is ignored when computing the hash key. | ||
19 | * | ||
20 | * Readers and resizing | ||
21 | * | ||
22 | * Resizing can be triggered by userspace command only, and those | ||
23 | * are serialized by the nfnl mutex. During resizing the set is | ||
24 | * read-locked, so the only possible concurrent operations are | ||
25 | * the kernel side readers. Those must be protected by proper RCU locking. | ||
26 | */ | ||
27 | |||
28 | /* Number of elements to store in an initial array block */ | ||
29 | #define AHASH_INIT_SIZE 4 | ||
30 | /* Max number of elements to store in an array block */ | ||
31 | #define AHASH_MAX_SIZE (3*AHASH_INIT_SIZE) | ||
32 | |||
33 | /* Max number of elements can be tuned */ | ||
34 | #ifdef IP_SET_HASH_WITH_MULTI | ||
35 | #define AHASH_MAX(h) ((h)->ahash_max) | ||
36 | |||
37 | static inline u8 | ||
38 | tune_ahash_max(u8 curr, u32 multi) | ||
39 | { | ||
40 | u32 n; | ||
41 | |||
42 | if (multi < curr) | ||
43 | return curr; | ||
44 | |||
45 | n = curr + AHASH_INIT_SIZE; | ||
46 | /* Currently, at listing one hash bucket must fit into a message. | ||
47 | * Therefore we have a hard limit here. | ||
48 | */ | ||
49 | return n > curr && n <= 64 ? n : curr; | ||
50 | } | ||
51 | #define TUNE_AHASH_MAX(h, multi) \ | ||
52 | ((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi)) | ||
53 | #else | ||
54 | #define AHASH_MAX(h) AHASH_MAX_SIZE | ||
55 | #define TUNE_AHASH_MAX(h, multi) | ||
56 | #endif | ||
57 | |||
58 | /* A hash bucket */ | ||
59 | struct hbucket { | ||
60 | void *value; /* the array of the values */ | ||
61 | u8 size; /* size of the array */ | ||
62 | u8 pos; /* position of the first free entry */ | ||
63 | }; | ||
64 | |||
65 | /* The hash table: the table size stored here in order to make resizing easy */ | ||
66 | struct htable { | ||
67 | u8 htable_bits; /* size of hash table == 2^htable_bits */ | ||
68 | struct hbucket bucket[0]; /* hashtable buckets */ | ||
69 | }; | ||
70 | |||
71 | #define hbucket(h, i) (&((h)->bucket[i])) | ||
72 | |||
73 | /* Book-keeping of the prefixes added to the set */ | ||
74 | struct ip_set_hash_nets { | ||
75 | u8 cidr; /* the different cidr values in the set */ | ||
76 | u32 nets; /* number of elements per cidr */ | ||
77 | }; | ||
78 | |||
79 | /* The generic ip_set hash structure */ | ||
80 | struct ip_set_hash { | ||
81 | struct htable *table; /* the hash table */ | ||
82 | u32 maxelem; /* max elements in the hash */ | ||
83 | u32 elements; /* current element (vs timeout) */ | ||
84 | u32 initval; /* random jhash init value */ | ||
85 | u32 timeout; /* timeout value, if enabled */ | ||
86 | struct timer_list gc; /* garbage collection when timeout enabled */ | ||
87 | struct type_pf_next next; /* temporary storage for uadd */ | ||
88 | #ifdef IP_SET_HASH_WITH_MULTI | ||
89 | u8 ahash_max; /* max elements in an array block */ | ||
90 | #endif | ||
91 | #ifdef IP_SET_HASH_WITH_NETMASK | ||
92 | u8 netmask; /* netmask value for subnets to store */ | ||
93 | #endif | ||
94 | #ifdef IP_SET_HASH_WITH_RBTREE | ||
95 | struct rb_root rbtree; | ||
96 | #endif | ||
97 | #ifdef IP_SET_HASH_WITH_NETS | ||
98 | struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */ | ||
99 | #endif | ||
100 | }; | ||
101 | |||
102 | static size_t | ||
103 | htable_size(u8 hbits) | ||
104 | { | ||
105 | size_t hsize; | ||
106 | |||
107 | /* We must fit both into u32 in jhash and size_t */ | ||
108 | if (hbits > 31) | ||
109 | return 0; | ||
110 | hsize = jhash_size(hbits); | ||
111 | if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket) | ||
112 | < hsize) | ||
113 | return 0; | ||
114 | |||
115 | return hsize * sizeof(struct hbucket) + sizeof(struct htable); | ||
116 | } | ||
117 | |||
118 | /* Compute htable_bits from the user input parameter hashsize */ | ||
119 | static u8 | ||
120 | htable_bits(u32 hashsize) | ||
121 | { | ||
122 | /* Assume that hashsize == 2^htable_bits */ | ||
123 | u8 bits = fls(hashsize - 1); | ||
124 | if (jhash_size(bits) != hashsize) | ||
125 | /* Round up to the first 2^n value */ | ||
126 | bits = fls(hashsize); | ||
127 | |||
128 | return bits; | ||
129 | } | ||
130 | |||
131 | #ifdef IP_SET_HASH_WITH_NETS | ||
132 | #ifdef IP_SET_HASH_WITH_NETS_PACKED | ||
133 | /* When cidr is packed with nomatch, cidr - 1 is stored in the entry */ | ||
134 | #define CIDR(cidr) (cidr + 1) | ||
135 | #else | ||
136 | #define CIDR(cidr) (cidr) | ||
137 | #endif | ||
138 | |||
139 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) | ||
140 | #ifdef IP_SET_HASH_WITH_MULTI | ||
141 | #define NETS_LENGTH(family) (SET_HOST_MASK(family) + 1) | ||
142 | #else | ||
143 | #define NETS_LENGTH(family) SET_HOST_MASK(family) | ||
144 | #endif | ||
145 | |||
146 | /* Network cidr size book keeping when the hash stores different | ||
147 | * sized networks */ | ||
148 | static void | ||
149 | add_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length) | ||
150 | { | ||
151 | int i, j; | ||
152 | |||
153 | /* Add in increasing prefix order, so larger cidr first */ | ||
154 | for (i = 0, j = -1; i < nets_length && h->nets[i].nets; i++) { | ||
155 | if (j != -1) | ||
156 | continue; | ||
157 | else if (h->nets[i].cidr < cidr) | ||
158 | j = i; | ||
159 | else if (h->nets[i].cidr == cidr) { | ||
160 | h->nets[i].nets++; | ||
161 | return; | ||
162 | } | ||
163 | } | ||
164 | if (j != -1) { | ||
165 | for (; i > j; i--) { | ||
166 | h->nets[i].cidr = h->nets[i - 1].cidr; | ||
167 | h->nets[i].nets = h->nets[i - 1].nets; | ||
168 | } | ||
169 | } | ||
170 | h->nets[i].cidr = cidr; | ||
171 | h->nets[i].nets = 1; | ||
172 | } | ||
173 | |||
174 | static void | ||
175 | del_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length) | ||
176 | { | ||
177 | u8 i, j; | ||
178 | |||
179 | for (i = 0; i < nets_length - 1 && h->nets[i].cidr != cidr; i++) | ||
180 | ; | ||
181 | h->nets[i].nets--; | ||
182 | |||
183 | if (h->nets[i].nets != 0) | ||
184 | return; | ||
185 | |||
186 | for (j = i; j < nets_length - 1 && h->nets[j].nets; j++) { | ||
187 | h->nets[j].cidr = h->nets[j + 1].cidr; | ||
188 | h->nets[j].nets = h->nets[j + 1].nets; | ||
189 | } | ||
190 | } | ||
191 | #else | ||
192 | #define NETS_LENGTH(family) 0 | ||
193 | #endif | ||
194 | |||
195 | /* Destroy the hashtable part of the set */ | ||
196 | static void | ||
197 | ahash_destroy(struct htable *t) | ||
198 | { | ||
199 | struct hbucket *n; | ||
200 | u32 i; | ||
201 | |||
202 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
203 | n = hbucket(t, i); | ||
204 | if (n->size) | ||
205 | /* FIXME: use slab cache */ | ||
206 | kfree(n->value); | ||
207 | } | ||
208 | |||
209 | ip_set_free(t); | ||
210 | } | ||
211 | |||
212 | /* Calculate the actual memory size of the set data */ | ||
213 | static size_t | ||
214 | ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 nets_length) | ||
215 | { | ||
216 | u32 i; | ||
217 | struct htable *t = h->table; | ||
218 | size_t memsize = sizeof(*h) | ||
219 | + sizeof(*t) | ||
220 | #ifdef IP_SET_HASH_WITH_NETS | ||
221 | + sizeof(struct ip_set_hash_nets) * nets_length | ||
222 | #endif | ||
223 | + jhash_size(t->htable_bits) * sizeof(struct hbucket); | ||
224 | |||
225 | for (i = 0; i < jhash_size(t->htable_bits); i++) | ||
226 | memsize += t->bucket[i].size * dsize; | ||
227 | |||
228 | return memsize; | ||
229 | } | ||
230 | |||
231 | /* Flush a hash type of set: destroy all elements */ | ||
232 | static void | ||
233 | ip_set_hash_flush(struct ip_set *set) | ||
234 | { | ||
235 | struct ip_set_hash *h = set->data; | ||
236 | struct htable *t = h->table; | ||
237 | struct hbucket *n; | ||
238 | u32 i; | ||
239 | |||
240 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
241 | n = hbucket(t, i); | ||
242 | if (n->size) { | ||
243 | n->size = n->pos = 0; | ||
244 | /* FIXME: use slab cache */ | ||
245 | kfree(n->value); | ||
246 | } | ||
247 | } | ||
248 | #ifdef IP_SET_HASH_WITH_NETS | ||
249 | memset(h->nets, 0, sizeof(struct ip_set_hash_nets) | ||
250 | * NETS_LENGTH(set->family)); | ||
251 | #endif | ||
252 | h->elements = 0; | ||
253 | } | ||
254 | |||
255 | /* Destroy a hash type of set */ | ||
256 | static void | ||
257 | ip_set_hash_destroy(struct ip_set *set) | ||
258 | { | ||
259 | struct ip_set_hash *h = set->data; | ||
260 | |||
261 | if (with_timeout(h->timeout)) | ||
262 | del_timer_sync(&h->gc); | ||
263 | |||
264 | ahash_destroy(h->table); | ||
265 | #ifdef IP_SET_HASH_WITH_RBTREE | ||
266 | rbtree_destroy(&h->rbtree); | ||
267 | #endif | ||
268 | kfree(h); | ||
269 | |||
270 | set->data = NULL; | ||
271 | } | ||
272 | |||
273 | #endif /* _IP_SET_AHASH_H */ | ||
274 | |||
275 | #ifndef HKEY_DATALEN | ||
276 | #define HKEY_DATALEN sizeof(struct type_pf_elem) | ||
277 | #endif | ||
278 | |||
279 | #define HKEY(data, initval, htable_bits) \ | ||
280 | (jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \ | ||
281 | & jhash_mask(htable_bits)) | ||
282 | |||
283 | /* Type/family dependent function prototypes */ | ||
284 | |||
285 | #define type_pf_data_equal TOKEN(TYPE, PF, _data_equal) | ||
286 | #define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull) | ||
287 | #define type_pf_data_copy TOKEN(TYPE, PF, _data_copy) | ||
288 | #define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out) | ||
289 | #define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask) | ||
290 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) | ||
291 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) | ||
292 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) | ||
293 | #define type_pf_data_flags TOKEN(TYPE, PF, _data_flags) | ||
294 | #define type_pf_data_reset_flags TOKEN(TYPE, PF, _data_reset_flags) | ||
295 | #ifdef IP_SET_HASH_WITH_NETS | ||
296 | #define type_pf_data_match TOKEN(TYPE, PF, _data_match) | ||
297 | #else | ||
298 | #define type_pf_data_match(d) 1 | ||
299 | #endif | ||
300 | |||
301 | #define type_pf_elem TOKEN(TYPE, PF, _elem) | ||
302 | #define type_pf_telem TOKEN(TYPE, PF, _telem) | ||
303 | #define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout) | ||
304 | #define type_pf_data_expired TOKEN(TYPE, PF, _data_expired) | ||
305 | #define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set) | ||
306 | |||
307 | #define type_pf_elem_add TOKEN(TYPE, PF, _elem_add) | ||
308 | #define type_pf_add TOKEN(TYPE, PF, _add) | ||
309 | #define type_pf_del TOKEN(TYPE, PF, _del) | ||
310 | #define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs) | ||
311 | #define type_pf_test TOKEN(TYPE, PF, _test) | ||
312 | |||
313 | #define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd) | ||
314 | #define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem) | ||
315 | #define type_pf_expire TOKEN(TYPE, PF, _expire) | ||
316 | #define type_pf_tadd TOKEN(TYPE, PF, _tadd) | ||
317 | #define type_pf_tdel TOKEN(TYPE, PF, _tdel) | ||
318 | #define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs) | ||
319 | #define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest) | ||
320 | |||
321 | #define type_pf_resize TOKEN(TYPE, PF, _resize) | ||
322 | #define type_pf_tresize TOKEN(TYPE, PF, _tresize) | ||
323 | #define type_pf_flush ip_set_hash_flush | ||
324 | #define type_pf_destroy ip_set_hash_destroy | ||
325 | #define type_pf_head TOKEN(TYPE, PF, _head) | ||
326 | #define type_pf_list TOKEN(TYPE, PF, _list) | ||
327 | #define type_pf_tlist TOKEN(TYPE, PF, _tlist) | ||
328 | #define type_pf_same_set TOKEN(TYPE, PF, _same_set) | ||
329 | #define type_pf_kadt TOKEN(TYPE, PF, _kadt) | ||
330 | #define type_pf_uadt TOKEN(TYPE, PF, _uadt) | ||
331 | #define type_pf_gc TOKEN(TYPE, PF, _gc) | ||
332 | #define type_pf_gc_init TOKEN(TYPE, PF, _gc_init) | ||
333 | #define type_pf_variant TOKEN(TYPE, PF, _variant) | ||
334 | #define type_pf_tvariant TOKEN(TYPE, PF, _tvariant) | ||
335 | |||
336 | /* Flavour without timeout */ | ||
337 | |||
338 | /* Get the ith element from the array block n */ | ||
339 | #define ahash_data(n, i) \ | ||
340 | ((struct type_pf_elem *)((n)->value) + (i)) | ||
341 | |||
342 | /* Add an element to the hash table when resizing the set: | ||
343 | * we spare the maintenance of the internal counters. */ | ||
344 | static int | ||
345 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, | ||
346 | u8 ahash_max, u32 cadt_flags) | ||
347 | { | ||
348 | struct type_pf_elem *data; | ||
349 | |||
350 | if (n->pos >= n->size) { | ||
351 | void *tmp; | ||
352 | |||
353 | if (n->size >= ahash_max) | ||
354 | /* Trigger rehashing */ | ||
355 | return -EAGAIN; | ||
356 | |||
357 | tmp = kzalloc((n->size + AHASH_INIT_SIZE) | ||
358 | * sizeof(struct type_pf_elem), | ||
359 | GFP_ATOMIC); | ||
360 | if (!tmp) | ||
361 | return -ENOMEM; | ||
362 | if (n->size) { | ||
363 | memcpy(tmp, n->value, | ||
364 | sizeof(struct type_pf_elem) * n->size); | ||
365 | kfree(n->value); | ||
366 | } | ||
367 | n->value = tmp; | ||
368 | n->size += AHASH_INIT_SIZE; | ||
369 | } | ||
370 | data = ahash_data(n, n->pos++); | ||
371 | type_pf_data_copy(data, value); | ||
372 | #ifdef IP_SET_HASH_WITH_NETS | ||
373 | /* Resizing won't overwrite stored flags */ | ||
374 | if (cadt_flags) | ||
375 | type_pf_data_flags(data, cadt_flags); | ||
376 | #endif | ||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | /* Resize a hash: create a new hash table with doubling the hashsize | ||
381 | * and inserting the elements to it. Repeat until we succeed or | ||
382 | * fail due to memory pressures. */ | ||
383 | static int | ||
384 | type_pf_resize(struct ip_set *set, bool retried) | ||
385 | { | ||
386 | struct ip_set_hash *h = set->data; | ||
387 | struct htable *t, *orig = h->table; | ||
388 | u8 htable_bits = orig->htable_bits; | ||
389 | struct type_pf_elem *data; | ||
390 | struct hbucket *n, *m; | ||
391 | u32 i, j, flags = 0; | ||
392 | int ret; | ||
393 | |||
394 | retry: | ||
395 | ret = 0; | ||
396 | htable_bits++; | ||
397 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | ||
398 | set->name, orig->htable_bits, htable_bits, orig); | ||
399 | if (!htable_bits) { | ||
400 | /* In case we have plenty of memory :-) */ | ||
401 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
402 | set->name); | ||
403 | return -IPSET_ERR_HASH_FULL; | ||
404 | } | ||
405 | t = ip_set_alloc(sizeof(*t) | ||
406 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | ||
407 | if (!t) | ||
408 | return -ENOMEM; | ||
409 | t->htable_bits = htable_bits; | ||
410 | |||
411 | read_lock_bh(&set->lock); | ||
412 | for (i = 0; i < jhash_size(orig->htable_bits); i++) { | ||
413 | n = hbucket(orig, i); | ||
414 | for (j = 0; j < n->pos; j++) { | ||
415 | data = ahash_data(n, j); | ||
416 | #ifdef IP_SET_HASH_WITH_NETS | ||
417 | flags = 0; | ||
418 | type_pf_data_reset_flags(data, &flags); | ||
419 | #endif | ||
420 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | ||
421 | ret = type_pf_elem_add(m, data, AHASH_MAX(h), flags); | ||
422 | if (ret < 0) { | ||
423 | #ifdef IP_SET_HASH_WITH_NETS | ||
424 | type_pf_data_flags(data, flags); | ||
425 | #endif | ||
426 | read_unlock_bh(&set->lock); | ||
427 | ahash_destroy(t); | ||
428 | if (ret == -EAGAIN) | ||
429 | goto retry; | ||
430 | return ret; | ||
431 | } | ||
432 | } | ||
433 | } | ||
434 | |||
435 | rcu_assign_pointer(h->table, t); | ||
436 | read_unlock_bh(&set->lock); | ||
437 | |||
438 | /* Give time to other readers of the set */ | ||
439 | synchronize_rcu_bh(); | ||
440 | |||
441 | pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name, | ||
442 | orig->htable_bits, orig, t->htable_bits, t); | ||
443 | ahash_destroy(orig); | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static inline void | ||
449 | type_pf_data_next(struct ip_set_hash *h, const struct type_pf_elem *d); | ||
450 | |||
451 | /* Add an element to a hash and update the internal counters when succeeded, | ||
452 | * otherwise report the proper error code. */ | ||
453 | static int | ||
454 | type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
455 | { | ||
456 | struct ip_set_hash *h = set->data; | ||
457 | struct htable *t; | ||
458 | const struct type_pf_elem *d = value; | ||
459 | struct hbucket *n; | ||
460 | int i, ret = 0; | ||
461 | u32 key, multi = 0; | ||
462 | u32 cadt_flags = flags >> 16; | ||
463 | |||
464 | if (h->elements >= h->maxelem) { | ||
465 | if (net_ratelimit()) | ||
466 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
467 | set->name, h->maxelem); | ||
468 | return -IPSET_ERR_HASH_FULL; | ||
469 | } | ||
470 | |||
471 | rcu_read_lock_bh(); | ||
472 | t = rcu_dereference_bh(h->table); | ||
473 | key = HKEY(value, h->initval, t->htable_bits); | ||
474 | n = hbucket(t, key); | ||
475 | for (i = 0; i < n->pos; i++) | ||
476 | if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { | ||
477 | #ifdef IP_SET_HASH_WITH_NETS | ||
478 | if (flags & IPSET_FLAG_EXIST) | ||
479 | /* Support overwriting just the flags */ | ||
480 | type_pf_data_flags(ahash_data(n, i), | ||
481 | cadt_flags); | ||
482 | #endif | ||
483 | ret = -IPSET_ERR_EXIST; | ||
484 | goto out; | ||
485 | } | ||
486 | TUNE_AHASH_MAX(h, multi); | ||
487 | ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags); | ||
488 | if (ret != 0) { | ||
489 | if (ret == -EAGAIN) | ||
490 | type_pf_data_next(h, d); | ||
491 | goto out; | ||
492 | } | ||
493 | |||
494 | #ifdef IP_SET_HASH_WITH_NETS | ||
495 | add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
496 | #endif | ||
497 | h->elements++; | ||
498 | out: | ||
499 | rcu_read_unlock_bh(); | ||
500 | return ret; | ||
501 | } | ||
502 | |||
503 | /* Delete an element from the hash: swap it with the last element | ||
504 | * and free up space if possible. | ||
505 | */ | ||
506 | static int | ||
507 | type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
508 | { | ||
509 | struct ip_set_hash *h = set->data; | ||
510 | struct htable *t = h->table; | ||
511 | const struct type_pf_elem *d = value; | ||
512 | struct hbucket *n; | ||
513 | int i; | ||
514 | struct type_pf_elem *data; | ||
515 | u32 key, multi = 0; | ||
516 | |||
517 | key = HKEY(value, h->initval, t->htable_bits); | ||
518 | n = hbucket(t, key); | ||
519 | for (i = 0; i < n->pos; i++) { | ||
520 | data = ahash_data(n, i); | ||
521 | if (!type_pf_data_equal(data, d, &multi)) | ||
522 | continue; | ||
523 | if (i != n->pos - 1) | ||
524 | /* Not last one */ | ||
525 | type_pf_data_copy(data, ahash_data(n, n->pos - 1)); | ||
526 | |||
527 | n->pos--; | ||
528 | h->elements--; | ||
529 | #ifdef IP_SET_HASH_WITH_NETS | ||
530 | del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
531 | #endif | ||
532 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
533 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
534 | * sizeof(struct type_pf_elem), | ||
535 | GFP_ATOMIC); | ||
536 | if (!tmp) | ||
537 | return 0; | ||
538 | n->size -= AHASH_INIT_SIZE; | ||
539 | memcpy(tmp, n->value, | ||
540 | n->size * sizeof(struct type_pf_elem)); | ||
541 | kfree(n->value); | ||
542 | n->value = tmp; | ||
543 | } | ||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | return -IPSET_ERR_EXIST; | ||
548 | } | ||
549 | |||
550 | #ifdef IP_SET_HASH_WITH_NETS | ||
551 | |||
552 | /* Special test function which takes into account the different network | ||
553 | * sizes added to the set */ | ||
554 | static int | ||
555 | type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | ||
556 | { | ||
557 | struct ip_set_hash *h = set->data; | ||
558 | struct htable *t = h->table; | ||
559 | struct hbucket *n; | ||
560 | const struct type_pf_elem *data; | ||
561 | int i, j = 0; | ||
562 | u32 key, multi = 0; | ||
563 | u8 nets_length = NETS_LENGTH(set->family); | ||
564 | |||
565 | pr_debug("test by nets\n"); | ||
566 | for (; j < nets_length && h->nets[j].nets && !multi; j++) { | ||
567 | type_pf_data_netmask(d, h->nets[j].cidr); | ||
568 | key = HKEY(d, h->initval, t->htable_bits); | ||
569 | n = hbucket(t, key); | ||
570 | for (i = 0; i < n->pos; i++) { | ||
571 | data = ahash_data(n, i); | ||
572 | if (type_pf_data_equal(data, d, &multi)) | ||
573 | return type_pf_data_match(data); | ||
574 | } | ||
575 | } | ||
576 | return 0; | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | /* Test whether the element is added to the set */ | ||
581 | static int | ||
582 | type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
583 | { | ||
584 | struct ip_set_hash *h = set->data; | ||
585 | struct htable *t = h->table; | ||
586 | struct type_pf_elem *d = value; | ||
587 | struct hbucket *n; | ||
588 | const struct type_pf_elem *data; | ||
589 | int i; | ||
590 | u32 key, multi = 0; | ||
591 | |||
592 | #ifdef IP_SET_HASH_WITH_NETS | ||
593 | /* If we test an IP address and not a network address, | ||
594 | * try all possible network sizes */ | ||
595 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) | ||
596 | return type_pf_test_cidrs(set, d, timeout); | ||
597 | #endif | ||
598 | |||
599 | key = HKEY(d, h->initval, t->htable_bits); | ||
600 | n = hbucket(t, key); | ||
601 | for (i = 0; i < n->pos; i++) { | ||
602 | data = ahash_data(n, i); | ||
603 | if (type_pf_data_equal(data, d, &multi)) | ||
604 | return type_pf_data_match(data); | ||
605 | } | ||
606 | return 0; | ||
607 | } | ||
608 | |||
609 | /* Reply a HEADER request: fill out the header part of the set */ | ||
610 | static int | ||
611 | type_pf_head(struct ip_set *set, struct sk_buff *skb) | ||
612 | { | ||
613 | const struct ip_set_hash *h = set->data; | ||
614 | struct nlattr *nested; | ||
615 | size_t memsize; | ||
616 | |||
617 | read_lock_bh(&set->lock); | ||
618 | memsize = ahash_memsize(h, with_timeout(h->timeout) | ||
619 | ? sizeof(struct type_pf_telem) | ||
620 | : sizeof(struct type_pf_elem), | ||
621 | NETS_LENGTH(set->family)); | ||
622 | read_unlock_bh(&set->lock); | ||
623 | |||
624 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
625 | if (!nested) | ||
626 | goto nla_put_failure; | ||
627 | if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE, | ||
628 | htonl(jhash_size(h->table->htable_bits))) || | ||
629 | nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem))) | ||
630 | goto nla_put_failure; | ||
631 | #ifdef IP_SET_HASH_WITH_NETMASK | ||
632 | if (h->netmask != HOST_MASK && | ||
633 | nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask)) | ||
634 | goto nla_put_failure; | ||
635 | #endif | ||
636 | if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) || | ||
637 | nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) || | ||
638 | (with_timeout(h->timeout) && | ||
639 | nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)))) | ||
640 | goto nla_put_failure; | ||
641 | ipset_nest_end(skb, nested); | ||
642 | |||
643 | return 0; | ||
644 | nla_put_failure: | ||
645 | return -EMSGSIZE; | ||
646 | } | ||
647 | |||
648 | /* Reply a LIST/SAVE request: dump the elements of the specified set */ | ||
649 | static int | ||
650 | type_pf_list(const struct ip_set *set, | ||
651 | struct sk_buff *skb, struct netlink_callback *cb) | ||
652 | { | ||
653 | const struct ip_set_hash *h = set->data; | ||
654 | const struct htable *t = h->table; | ||
655 | struct nlattr *atd, *nested; | ||
656 | const struct hbucket *n; | ||
657 | const struct type_pf_elem *data; | ||
658 | u32 first = cb->args[2]; | ||
659 | /* We assume that one hash bucket fills into one page */ | ||
660 | void *incomplete; | ||
661 | int i; | ||
662 | |||
663 | atd = ipset_nest_start(skb, IPSET_ATTR_ADT); | ||
664 | if (!atd) | ||
665 | return -EMSGSIZE; | ||
666 | pr_debug("list hash set %s\n", set->name); | ||
667 | for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { | ||
668 | incomplete = skb_tail_pointer(skb); | ||
669 | n = hbucket(t, cb->args[2]); | ||
670 | pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n); | ||
671 | for (i = 0; i < n->pos; i++) { | ||
672 | data = ahash_data(n, i); | ||
673 | pr_debug("list hash %lu hbucket %p i %u, data %p\n", | ||
674 | cb->args[2], n, i, data); | ||
675 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
676 | if (!nested) { | ||
677 | if (cb->args[2] == first) { | ||
678 | nla_nest_cancel(skb, atd); | ||
679 | return -EMSGSIZE; | ||
680 | } else | ||
681 | goto nla_put_failure; | ||
682 | } | ||
683 | if (type_pf_data_list(skb, data)) | ||
684 | goto nla_put_failure; | ||
685 | ipset_nest_end(skb, nested); | ||
686 | } | ||
687 | } | ||
688 | ipset_nest_end(skb, atd); | ||
689 | /* Set listing finished */ | ||
690 | cb->args[2] = 0; | ||
691 | |||
692 | return 0; | ||
693 | |||
694 | nla_put_failure: | ||
695 | nlmsg_trim(skb, incomplete); | ||
696 | ipset_nest_end(skb, atd); | ||
697 | if (unlikely(first == cb->args[2])) { | ||
698 | pr_warning("Can't list set %s: one bucket does not fit into " | ||
699 | "a message. Please report it!\n", set->name); | ||
700 | cb->args[2] = 0; | ||
701 | return -EMSGSIZE; | ||
702 | } | ||
703 | return 0; | ||
704 | } | ||
705 | |||
706 | static int | ||
707 | type_pf_kadt(struct ip_set *set, const struct sk_buff *skb, | ||
708 | const struct xt_action_param *par, | ||
709 | enum ipset_adt adt, const struct ip_set_adt_opt *opt); | ||
710 | static int | ||
711 | type_pf_uadt(struct ip_set *set, struct nlattr *tb[], | ||
712 | enum ipset_adt adt, u32 *lineno, u32 flags, bool retried); | ||
713 | |||
714 | static const struct ip_set_type_variant type_pf_variant = { | ||
715 | .kadt = type_pf_kadt, | ||
716 | .uadt = type_pf_uadt, | ||
717 | .adt = { | ||
718 | [IPSET_ADD] = type_pf_add, | ||
719 | [IPSET_DEL] = type_pf_del, | ||
720 | [IPSET_TEST] = type_pf_test, | ||
721 | }, | ||
722 | .destroy = type_pf_destroy, | ||
723 | .flush = type_pf_flush, | ||
724 | .head = type_pf_head, | ||
725 | .list = type_pf_list, | ||
726 | .resize = type_pf_resize, | ||
727 | .same_set = type_pf_same_set, | ||
728 | }; | ||
729 | |||
730 | /* Flavour with timeout support */ | ||
731 | |||
732 | #define ahash_tdata(n, i) \ | ||
733 | (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i)) | ||
734 | |||
735 | static inline u32 | ||
736 | type_pf_data_timeout(const struct type_pf_elem *data) | ||
737 | { | ||
738 | const struct type_pf_telem *tdata = | ||
739 | (const struct type_pf_telem *) data; | ||
740 | |||
741 | return tdata->timeout; | ||
742 | } | ||
743 | |||
744 | static inline bool | ||
745 | type_pf_data_expired(const struct type_pf_elem *data) | ||
746 | { | ||
747 | const struct type_pf_telem *tdata = | ||
748 | (const struct type_pf_telem *) data; | ||
749 | |||
750 | return ip_set_timeout_expired(tdata->timeout); | ||
751 | } | ||
752 | |||
753 | static inline void | ||
754 | type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout) | ||
755 | { | ||
756 | struct type_pf_telem *tdata = (struct type_pf_telem *) data; | ||
757 | |||
758 | tdata->timeout = ip_set_timeout_set(timeout); | ||
759 | } | ||
760 | |||
761 | static int | ||
762 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | ||
763 | u8 ahash_max, u32 cadt_flags, u32 timeout) | ||
764 | { | ||
765 | struct type_pf_elem *data; | ||
766 | |||
767 | if (n->pos >= n->size) { | ||
768 | void *tmp; | ||
769 | |||
770 | if (n->size >= ahash_max) | ||
771 | /* Trigger rehashing */ | ||
772 | return -EAGAIN; | ||
773 | |||
774 | tmp = kzalloc((n->size + AHASH_INIT_SIZE) | ||
775 | * sizeof(struct type_pf_telem), | ||
776 | GFP_ATOMIC); | ||
777 | if (!tmp) | ||
778 | return -ENOMEM; | ||
779 | if (n->size) { | ||
780 | memcpy(tmp, n->value, | ||
781 | sizeof(struct type_pf_telem) * n->size); | ||
782 | kfree(n->value); | ||
783 | } | ||
784 | n->value = tmp; | ||
785 | n->size += AHASH_INIT_SIZE; | ||
786 | } | ||
787 | data = ahash_tdata(n, n->pos++); | ||
788 | type_pf_data_copy(data, value); | ||
789 | type_pf_data_timeout_set(data, timeout); | ||
790 | #ifdef IP_SET_HASH_WITH_NETS | ||
791 | /* Resizing won't overwrite stored flags */ | ||
792 | if (cadt_flags) | ||
793 | type_pf_data_flags(data, cadt_flags); | ||
794 | #endif | ||
795 | return 0; | ||
796 | } | ||
797 | |||
798 | /* Delete expired elements from the hashtable */ | ||
799 | static void | ||
800 | type_pf_expire(struct ip_set_hash *h, u8 nets_length) | ||
801 | { | ||
802 | struct htable *t = h->table; | ||
803 | struct hbucket *n; | ||
804 | struct type_pf_elem *data; | ||
805 | u32 i; | ||
806 | int j; | ||
807 | |||
808 | for (i = 0; i < jhash_size(t->htable_bits); i++) { | ||
809 | n = hbucket(t, i); | ||
810 | for (j = 0; j < n->pos; j++) { | ||
811 | data = ahash_tdata(n, j); | ||
812 | if (type_pf_data_expired(data)) { | ||
813 | pr_debug("expired %u/%u\n", i, j); | ||
814 | #ifdef IP_SET_HASH_WITH_NETS | ||
815 | del_cidr(h, CIDR(data->cidr), nets_length); | ||
816 | #endif | ||
817 | if (j != n->pos - 1) | ||
818 | /* Not last one */ | ||
819 | type_pf_data_copy(data, | ||
820 | ahash_tdata(n, n->pos - 1)); | ||
821 | n->pos--; | ||
822 | h->elements--; | ||
823 | } | ||
824 | } | ||
825 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
826 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
827 | * sizeof(struct type_pf_telem), | ||
828 | GFP_ATOMIC); | ||
829 | if (!tmp) | ||
830 | /* Still try to delete expired elements */ | ||
831 | continue; | ||
832 | n->size -= AHASH_INIT_SIZE; | ||
833 | memcpy(tmp, n->value, | ||
834 | n->size * sizeof(struct type_pf_telem)); | ||
835 | kfree(n->value); | ||
836 | n->value = tmp; | ||
837 | } | ||
838 | } | ||
839 | } | ||
840 | |||
841 | static int | ||
842 | type_pf_tresize(struct ip_set *set, bool retried) | ||
843 | { | ||
844 | struct ip_set_hash *h = set->data; | ||
845 | struct htable *t, *orig = h->table; | ||
846 | u8 htable_bits = orig->htable_bits; | ||
847 | struct type_pf_elem *data; | ||
848 | struct hbucket *n, *m; | ||
849 | u32 i, j, flags = 0; | ||
850 | int ret; | ||
851 | |||
852 | /* Try to cleanup once */ | ||
853 | if (!retried) { | ||
854 | i = h->elements; | ||
855 | write_lock_bh(&set->lock); | ||
856 | type_pf_expire(set->data, NETS_LENGTH(set->family)); | ||
857 | write_unlock_bh(&set->lock); | ||
858 | if (h->elements < i) | ||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | retry: | ||
863 | ret = 0; | ||
864 | htable_bits++; | ||
865 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | ||
866 | set->name, orig->htable_bits, htable_bits, orig); | ||
867 | if (!htable_bits) { | ||
868 | /* In case we have plenty of memory :-) */ | ||
869 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
870 | set->name); | ||
871 | return -IPSET_ERR_HASH_FULL; | ||
872 | } | ||
873 | t = ip_set_alloc(sizeof(*t) | ||
874 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | ||
875 | if (!t) | ||
876 | return -ENOMEM; | ||
877 | t->htable_bits = htable_bits; | ||
878 | |||
879 | read_lock_bh(&set->lock); | ||
880 | for (i = 0; i < jhash_size(orig->htable_bits); i++) { | ||
881 | n = hbucket(orig, i); | ||
882 | for (j = 0; j < n->pos; j++) { | ||
883 | data = ahash_tdata(n, j); | ||
884 | #ifdef IP_SET_HASH_WITH_NETS | ||
885 | flags = 0; | ||
886 | type_pf_data_reset_flags(data, &flags); | ||
887 | #endif | ||
888 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | ||
889 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), flags, | ||
890 | ip_set_timeout_get(type_pf_data_timeout(data))); | ||
891 | if (ret < 0) { | ||
892 | #ifdef IP_SET_HASH_WITH_NETS | ||
893 | type_pf_data_flags(data, flags); | ||
894 | #endif | ||
895 | read_unlock_bh(&set->lock); | ||
896 | ahash_destroy(t); | ||
897 | if (ret == -EAGAIN) | ||
898 | goto retry; | ||
899 | return ret; | ||
900 | } | ||
901 | } | ||
902 | } | ||
903 | |||
904 | rcu_assign_pointer(h->table, t); | ||
905 | read_unlock_bh(&set->lock); | ||
906 | |||
907 | /* Give time to other readers of the set */ | ||
908 | synchronize_rcu_bh(); | ||
909 | |||
910 | ahash_destroy(orig); | ||
911 | |||
912 | return 0; | ||
913 | } | ||
914 | |||
915 | static int | ||
916 | type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
917 | { | ||
918 | struct ip_set_hash *h = set->data; | ||
919 | struct htable *t = h->table; | ||
920 | const struct type_pf_elem *d = value; | ||
921 | struct hbucket *n; | ||
922 | struct type_pf_elem *data; | ||
923 | int ret = 0, i, j = AHASH_MAX(h) + 1; | ||
924 | bool flag_exist = flags & IPSET_FLAG_EXIST; | ||
925 | u32 key, multi = 0; | ||
926 | u32 cadt_flags = flags >> 16; | ||
927 | |||
928 | if (h->elements >= h->maxelem) | ||
929 | /* FIXME: when set is full, we slow down here */ | ||
930 | type_pf_expire(h, NETS_LENGTH(set->family)); | ||
931 | if (h->elements >= h->maxelem) { | ||
932 | if (net_ratelimit()) | ||
933 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
934 | set->name, h->maxelem); | ||
935 | return -IPSET_ERR_HASH_FULL; | ||
936 | } | ||
937 | |||
938 | rcu_read_lock_bh(); | ||
939 | t = rcu_dereference_bh(h->table); | ||
940 | key = HKEY(d, h->initval, t->htable_bits); | ||
941 | n = hbucket(t, key); | ||
942 | for (i = 0; i < n->pos; i++) { | ||
943 | data = ahash_tdata(n, i); | ||
944 | if (type_pf_data_equal(data, d, &multi)) { | ||
945 | if (type_pf_data_expired(data) || flag_exist) | ||
946 | /* Just timeout value may be updated */ | ||
947 | j = i; | ||
948 | else { | ||
949 | ret = -IPSET_ERR_EXIST; | ||
950 | goto out; | ||
951 | } | ||
952 | } else if (j == AHASH_MAX(h) + 1 && | ||
953 | type_pf_data_expired(data)) | ||
954 | j = i; | ||
955 | } | ||
956 | if (j != AHASH_MAX(h) + 1) { | ||
957 | data = ahash_tdata(n, j); | ||
958 | #ifdef IP_SET_HASH_WITH_NETS | ||
959 | del_cidr(h, CIDR(data->cidr), NETS_LENGTH(set->family)); | ||
960 | add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
961 | #endif | ||
962 | type_pf_data_copy(data, d); | ||
963 | type_pf_data_timeout_set(data, timeout); | ||
964 | #ifdef IP_SET_HASH_WITH_NETS | ||
965 | type_pf_data_flags(data, cadt_flags); | ||
966 | #endif | ||
967 | goto out; | ||
968 | } | ||
969 | TUNE_AHASH_MAX(h, multi); | ||
970 | ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout); | ||
971 | if (ret != 0) { | ||
972 | if (ret == -EAGAIN) | ||
973 | type_pf_data_next(h, d); | ||
974 | goto out; | ||
975 | } | ||
976 | |||
977 | #ifdef IP_SET_HASH_WITH_NETS | ||
978 | add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
979 | #endif | ||
980 | h->elements++; | ||
981 | out: | ||
982 | rcu_read_unlock_bh(); | ||
983 | return ret; | ||
984 | } | ||
985 | |||
986 | static int | ||
987 | type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
988 | { | ||
989 | struct ip_set_hash *h = set->data; | ||
990 | struct htable *t = h->table; | ||
991 | const struct type_pf_elem *d = value; | ||
992 | struct hbucket *n; | ||
993 | int i; | ||
994 | struct type_pf_elem *data; | ||
995 | u32 key, multi = 0; | ||
996 | |||
997 | key = HKEY(value, h->initval, t->htable_bits); | ||
998 | n = hbucket(t, key); | ||
999 | for (i = 0; i < n->pos; i++) { | ||
1000 | data = ahash_tdata(n, i); | ||
1001 | if (!type_pf_data_equal(data, d, &multi)) | ||
1002 | continue; | ||
1003 | if (type_pf_data_expired(data)) | ||
1004 | return -IPSET_ERR_EXIST; | ||
1005 | if (i != n->pos - 1) | ||
1006 | /* Not last one */ | ||
1007 | type_pf_data_copy(data, ahash_tdata(n, n->pos - 1)); | ||
1008 | |||
1009 | n->pos--; | ||
1010 | h->elements--; | ||
1011 | #ifdef IP_SET_HASH_WITH_NETS | ||
1012 | del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); | ||
1013 | #endif | ||
1014 | if (n->pos + AHASH_INIT_SIZE < n->size) { | ||
1015 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | ||
1016 | * sizeof(struct type_pf_telem), | ||
1017 | GFP_ATOMIC); | ||
1018 | if (!tmp) | ||
1019 | return 0; | ||
1020 | n->size -= AHASH_INIT_SIZE; | ||
1021 | memcpy(tmp, n->value, | ||
1022 | n->size * sizeof(struct type_pf_telem)); | ||
1023 | kfree(n->value); | ||
1024 | n->value = tmp; | ||
1025 | } | ||
1026 | return 0; | ||
1027 | } | ||
1028 | |||
1029 | return -IPSET_ERR_EXIST; | ||
1030 | } | ||
1031 | |||
1032 | #ifdef IP_SET_HASH_WITH_NETS | ||
1033 | static int | ||
1034 | type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | ||
1035 | { | ||
1036 | struct ip_set_hash *h = set->data; | ||
1037 | struct htable *t = h->table; | ||
1038 | struct type_pf_elem *data; | ||
1039 | struct hbucket *n; | ||
1040 | int i, j = 0; | ||
1041 | u32 key, multi = 0; | ||
1042 | u8 nets_length = NETS_LENGTH(set->family); | ||
1043 | |||
1044 | for (; j < nets_length && h->nets[j].nets && !multi; j++) { | ||
1045 | type_pf_data_netmask(d, h->nets[j].cidr); | ||
1046 | key = HKEY(d, h->initval, t->htable_bits); | ||
1047 | n = hbucket(t, key); | ||
1048 | for (i = 0; i < n->pos; i++) { | ||
1049 | data = ahash_tdata(n, i); | ||
1050 | #ifdef IP_SET_HASH_WITH_MULTI | ||
1051 | if (type_pf_data_equal(data, d, &multi)) { | ||
1052 | if (!type_pf_data_expired(data)) | ||
1053 | return type_pf_data_match(data); | ||
1054 | multi = 0; | ||
1055 | } | ||
1056 | #else | ||
1057 | if (type_pf_data_equal(data, d, &multi) && | ||
1058 | !type_pf_data_expired(data)) | ||
1059 | return type_pf_data_match(data); | ||
1060 | #endif | ||
1061 | } | ||
1062 | } | ||
1063 | return 0; | ||
1064 | } | ||
1065 | #endif | ||
1066 | |||
1067 | static int | ||
1068 | type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags) | ||
1069 | { | ||
1070 | struct ip_set_hash *h = set->data; | ||
1071 | struct htable *t = h->table; | ||
1072 | struct type_pf_elem *data, *d = value; | ||
1073 | struct hbucket *n; | ||
1074 | int i; | ||
1075 | u32 key, multi = 0; | ||
1076 | |||
1077 | #ifdef IP_SET_HASH_WITH_NETS | ||
1078 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) | ||
1079 | return type_pf_ttest_cidrs(set, d, timeout); | ||
1080 | #endif | ||
1081 | key = HKEY(d, h->initval, t->htable_bits); | ||
1082 | n = hbucket(t, key); | ||
1083 | for (i = 0; i < n->pos; i++) { | ||
1084 | data = ahash_tdata(n, i); | ||
1085 | if (type_pf_data_equal(data, d, &multi) && | ||
1086 | !type_pf_data_expired(data)) | ||
1087 | return type_pf_data_match(data); | ||
1088 | } | ||
1089 | return 0; | ||
1090 | } | ||
1091 | |||
1092 | static int | ||
1093 | type_pf_tlist(const struct ip_set *set, | ||
1094 | struct sk_buff *skb, struct netlink_callback *cb) | ||
1095 | { | ||
1096 | const struct ip_set_hash *h = set->data; | ||
1097 | const struct htable *t = h->table; | ||
1098 | struct nlattr *atd, *nested; | ||
1099 | const struct hbucket *n; | ||
1100 | const struct type_pf_elem *data; | ||
1101 | u32 first = cb->args[2]; | ||
1102 | /* We assume that one hash bucket fills into one page */ | ||
1103 | void *incomplete; | ||
1104 | int i; | ||
1105 | |||
1106 | atd = ipset_nest_start(skb, IPSET_ATTR_ADT); | ||
1107 | if (!atd) | ||
1108 | return -EMSGSIZE; | ||
1109 | for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { | ||
1110 | incomplete = skb_tail_pointer(skb); | ||
1111 | n = hbucket(t, cb->args[2]); | ||
1112 | for (i = 0; i < n->pos; i++) { | ||
1113 | data = ahash_tdata(n, i); | ||
1114 | pr_debug("list %p %u\n", n, i); | ||
1115 | if (type_pf_data_expired(data)) | ||
1116 | continue; | ||
1117 | pr_debug("do list %p %u\n", n, i); | ||
1118 | nested = ipset_nest_start(skb, IPSET_ATTR_DATA); | ||
1119 | if (!nested) { | ||
1120 | if (cb->args[2] == first) { | ||
1121 | nla_nest_cancel(skb, atd); | ||
1122 | return -EMSGSIZE; | ||
1123 | } else | ||
1124 | goto nla_put_failure; | ||
1125 | } | ||
1126 | if (type_pf_data_tlist(skb, data)) | ||
1127 | goto nla_put_failure; | ||
1128 | ipset_nest_end(skb, nested); | ||
1129 | } | ||
1130 | } | ||
1131 | ipset_nest_end(skb, atd); | ||
1132 | /* Set listing finished */ | ||
1133 | cb->args[2] = 0; | ||
1134 | |||
1135 | return 0; | ||
1136 | |||
1137 | nla_put_failure: | ||
1138 | nlmsg_trim(skb, incomplete); | ||
1139 | ipset_nest_end(skb, atd); | ||
1140 | if (unlikely(first == cb->args[2])) { | ||
1141 | pr_warning("Can't list set %s: one bucket does not fit into " | ||
1142 | "a message. Please report it!\n", set->name); | ||
1143 | cb->args[2] = 0; | ||
1144 | return -EMSGSIZE; | ||
1145 | } | ||
1146 | return 0; | ||
1147 | } | ||
1148 | |||
1149 | static const struct ip_set_type_variant type_pf_tvariant = { | ||
1150 | .kadt = type_pf_kadt, | ||
1151 | .uadt = type_pf_uadt, | ||
1152 | .adt = { | ||
1153 | [IPSET_ADD] = type_pf_tadd, | ||
1154 | [IPSET_DEL] = type_pf_tdel, | ||
1155 | [IPSET_TEST] = type_pf_ttest, | ||
1156 | }, | ||
1157 | .destroy = type_pf_destroy, | ||
1158 | .flush = type_pf_flush, | ||
1159 | .head = type_pf_head, | ||
1160 | .list = type_pf_tlist, | ||
1161 | .resize = type_pf_tresize, | ||
1162 | .same_set = type_pf_same_set, | ||
1163 | }; | ||
1164 | |||
1165 | static void | ||
1166 | type_pf_gc(unsigned long ul_set) | ||
1167 | { | ||
1168 | struct ip_set *set = (struct ip_set *) ul_set; | ||
1169 | struct ip_set_hash *h = set->data; | ||
1170 | |||
1171 | pr_debug("called\n"); | ||
1172 | write_lock_bh(&set->lock); | ||
1173 | type_pf_expire(h, NETS_LENGTH(set->family)); | ||
1174 | write_unlock_bh(&set->lock); | ||
1175 | |||
1176 | h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; | ||
1177 | add_timer(&h->gc); | ||
1178 | } | ||
1179 | |||
1180 | static void | ||
1181 | type_pf_gc_init(struct ip_set *set) | ||
1182 | { | ||
1183 | struct ip_set_hash *h = set->data; | ||
1184 | |||
1185 | init_timer(&h->gc); | ||
1186 | h->gc.data = (unsigned long) set; | ||
1187 | h->gc.function = type_pf_gc; | ||
1188 | h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; | ||
1189 | add_timer(&h->gc); | ||
1190 | pr_debug("gc initialized, run in every %u\n", | ||
1191 | IPSET_GC_PERIOD(h->timeout)); | ||
1192 | } | ||
1193 | |||
1194 | #undef HKEY_DATALEN | ||
1195 | #undef HKEY | ||
1196 | #undef type_pf_data_equal | ||
1197 | #undef type_pf_data_isnull | ||
1198 | #undef type_pf_data_copy | ||
1199 | #undef type_pf_data_zero_out | ||
1200 | #undef type_pf_data_netmask | ||
1201 | #undef type_pf_data_list | ||
1202 | #undef type_pf_data_tlist | ||
1203 | #undef type_pf_data_next | ||
1204 | #undef type_pf_data_flags | ||
1205 | #undef type_pf_data_reset_flags | ||
1206 | #undef type_pf_data_match | ||
1207 | |||
1208 | #undef type_pf_elem | ||
1209 | #undef type_pf_telem | ||
1210 | #undef type_pf_data_timeout | ||
1211 | #undef type_pf_data_expired | ||
1212 | #undef type_pf_data_timeout_set | ||
1213 | |||
1214 | #undef type_pf_elem_add | ||
1215 | #undef type_pf_add | ||
1216 | #undef type_pf_del | ||
1217 | #undef type_pf_test_cidrs | ||
1218 | #undef type_pf_test | ||
1219 | |||
1220 | #undef type_pf_elem_tadd | ||
1221 | #undef type_pf_del_telem | ||
1222 | #undef type_pf_expire | ||
1223 | #undef type_pf_tadd | ||
1224 | #undef type_pf_tdel | ||
1225 | #undef type_pf_ttest_cidrs | ||
1226 | #undef type_pf_ttest | ||
1227 | |||
1228 | #undef type_pf_resize | ||
1229 | #undef type_pf_tresize | ||
1230 | #undef type_pf_flush | ||
1231 | #undef type_pf_destroy | ||
1232 | #undef type_pf_head | ||
1233 | #undef type_pf_list | ||
1234 | #undef type_pf_tlist | ||
1235 | #undef type_pf_same_set | ||
1236 | #undef type_pf_kadt | ||
1237 | #undef type_pf_uadt | ||
1238 | #undef type_pf_gc | ||
1239 | #undef type_pf_gc_init | ||
1240 | #undef type_pf_variant | ||
1241 | #undef type_pf_tvariant | ||
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h index 1a30646d5be8..5e4662a71e01 100644 --- a/include/linux/netfilter/ipset/ip_set_bitmap.h +++ b/include/linux/netfilter/ipset/ip_set_bitmap.h | |||
@@ -5,6 +5,12 @@ | |||
5 | 5 | ||
6 | #define IPSET_BITMAP_MAX_RANGE 0x0000FFFF | 6 | #define IPSET_BITMAP_MAX_RANGE 0x0000FFFF |
7 | 7 | ||
8 | enum { | ||
9 | IPSET_ADD_FAILED = 1, | ||
10 | IPSET_ADD_STORE_PLAIN_TIMEOUT, | ||
11 | IPSET_ADD_START_STORED_TIMEOUT, | ||
12 | }; | ||
13 | |||
8 | /* Common functions */ | 14 | /* Common functions */ |
9 | 15 | ||
10 | static inline u32 | 16 | static inline u32 |
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h index 41d9cfa08167..3aac04167ca7 100644 --- a/include/linux/netfilter/ipset/ip_set_timeout.h +++ b/include/linux/netfilter/ipset/ip_set_timeout.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _IP_SET_TIMEOUT_H | 1 | #ifndef _IP_SET_TIMEOUT_H |
2 | #define _IP_SET_TIMEOUT_H | 2 | #define _IP_SET_TIMEOUT_H |
3 | 3 | ||
4 | /* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
@@ -17,13 +17,14 @@ | |||
17 | #define IPSET_GC_PERIOD(timeout) \ | 17 | #define IPSET_GC_PERIOD(timeout) \ |
18 | ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) | 18 | ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) |
19 | 19 | ||
20 | /* Set is defined without timeout support: timeout value may be 0 */ | 20 | /* Entry is set with no timeout value */ |
21 | #define IPSET_NO_TIMEOUT UINT_MAX | 21 | #define IPSET_ELEM_PERMANENT 0 |
22 | 22 | ||
23 | #define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT) | 23 | /* Set is defined with timeout support: timeout value may be 0 */ |
24 | #define IPSET_NO_TIMEOUT UINT_MAX | ||
24 | 25 | ||
25 | #define opt_timeout(opt, map) \ | 26 | #define ip_set_adt_opt_timeout(opt, map) \ |
26 | (with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout) | 27 | ((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (map)->timeout) |
27 | 28 | ||
28 | static inline unsigned int | 29 | static inline unsigned int |
29 | ip_set_timeout_uget(struct nlattr *tb) | 30 | ip_set_timeout_uget(struct nlattr *tb) |
@@ -38,61 +39,6 @@ ip_set_timeout_uget(struct nlattr *tb) | |||
38 | return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; | 39 | return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; |
39 | } | 40 | } |
40 | 41 | ||
41 | #ifdef IP_SET_BITMAP_TIMEOUT | ||
42 | |||
43 | /* Bitmap specific timeout constants and macros for the entries */ | ||
44 | |||
45 | /* Bitmap entry is unset */ | ||
46 | #define IPSET_ELEM_UNSET 0 | ||
47 | /* Bitmap entry is set with no timeout value */ | ||
48 | #define IPSET_ELEM_PERMANENT (UINT_MAX/2) | ||
49 | |||
50 | static inline bool | ||
51 | ip_set_timeout_test(unsigned long timeout) | ||
52 | { | ||
53 | return timeout != IPSET_ELEM_UNSET && | ||
54 | (timeout == IPSET_ELEM_PERMANENT || | ||
55 | time_is_after_jiffies(timeout)); | ||
56 | } | ||
57 | |||
58 | static inline bool | ||
59 | ip_set_timeout_expired(unsigned long timeout) | ||
60 | { | ||
61 | return timeout != IPSET_ELEM_UNSET && | ||
62 | timeout != IPSET_ELEM_PERMANENT && | ||
63 | time_is_before_jiffies(timeout); | ||
64 | } | ||
65 | |||
66 | static inline unsigned long | ||
67 | ip_set_timeout_set(u32 timeout) | ||
68 | { | ||
69 | unsigned long t; | ||
70 | |||
71 | if (!timeout) | ||
72 | return IPSET_ELEM_PERMANENT; | ||
73 | |||
74 | t = msecs_to_jiffies(timeout * 1000) + jiffies; | ||
75 | if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) | ||
76 | /* Bingo! */ | ||
77 | t++; | ||
78 | |||
79 | return t; | ||
80 | } | ||
81 | |||
82 | static inline u32 | ||
83 | ip_set_timeout_get(unsigned long timeout) | ||
84 | { | ||
85 | return timeout == IPSET_ELEM_PERMANENT ? 0 : | ||
86 | jiffies_to_msecs(timeout - jiffies)/1000; | ||
87 | } | ||
88 | |||
89 | #else | ||
90 | |||
91 | /* Hash specific timeout constants and macros for the entries */ | ||
92 | |||
93 | /* Hash entry is set with no timeout value */ | ||
94 | #define IPSET_ELEM_PERMANENT 0 | ||
95 | |||
96 | static inline bool | 42 | static inline bool |
97 | ip_set_timeout_test(unsigned long timeout) | 43 | ip_set_timeout_test(unsigned long timeout) |
98 | { | 44 | { |
@@ -101,36 +47,32 @@ ip_set_timeout_test(unsigned long timeout) | |||
101 | } | 47 | } |
102 | 48 | ||
103 | static inline bool | 49 | static inline bool |
104 | ip_set_timeout_expired(unsigned long timeout) | 50 | ip_set_timeout_expired(unsigned long *timeout) |
105 | { | 51 | { |
106 | return timeout != IPSET_ELEM_PERMANENT && | 52 | return *timeout != IPSET_ELEM_PERMANENT && |
107 | time_is_before_jiffies(timeout); | 53 | time_is_before_jiffies(*timeout); |
108 | } | 54 | } |
109 | 55 | ||
110 | static inline unsigned long | 56 | static inline void |
111 | ip_set_timeout_set(u32 timeout) | 57 | ip_set_timeout_set(unsigned long *timeout, u32 t) |
112 | { | 58 | { |
113 | unsigned long t; | 59 | if (!t) { |
114 | 60 | *timeout = IPSET_ELEM_PERMANENT; | |
115 | if (!timeout) | 61 | return; |
116 | return IPSET_ELEM_PERMANENT; | 62 | } |
117 | 63 | ||
118 | t = msecs_to_jiffies(timeout * 1000) + jiffies; | 64 | *timeout = msecs_to_jiffies(t * 1000) + jiffies; |
119 | if (t == IPSET_ELEM_PERMANENT) | 65 | if (*timeout == IPSET_ELEM_PERMANENT) |
120 | /* Bingo! :-) */ | 66 | /* Bingo! :-) */ |
121 | t++; | 67 | (*timeout)--; |
122 | |||
123 | return t; | ||
124 | } | 68 | } |
125 | 69 | ||
126 | static inline u32 | 70 | static inline u32 |
127 | ip_set_timeout_get(unsigned long timeout) | 71 | ip_set_timeout_get(unsigned long *timeout) |
128 | { | 72 | { |
129 | return timeout == IPSET_ELEM_PERMANENT ? 0 : | 73 | return *timeout == IPSET_ELEM_PERMANENT ? 0 : |
130 | jiffies_to_msecs(timeout - jiffies)/1000; | 74 | jiffies_to_msecs(*timeout - jiffies)/1000; |
131 | } | 75 | } |
132 | #endif /* ! IP_SET_BITMAP_TIMEOUT */ | ||
133 | 76 | ||
134 | #endif /* __KERNEL__ */ | 77 | #endif /* __KERNEL__ */ |
135 | |||
136 | #endif /* _IP_SET_TIMEOUT_H */ | 78 | #endif /* _IP_SET_TIMEOUT_H */ |
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h index 199fd11fedc0..1afbb94b4b65 100644 --- a/include/linux/netfilter/ipset/pfxlen.h +++ b/include/linux/netfilter/ipset/pfxlen.h | |||
@@ -41,4 +41,13 @@ do { \ | |||
41 | to = from | ~ip_set_hostmask(cidr); \ | 41 | to = from | ~ip_set_hostmask(cidr); \ |
42 | } while (0) | 42 | } while (0) |
43 | 43 | ||
44 | static inline void | ||
45 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
46 | { | ||
47 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
48 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
49 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
50 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
51 | } | ||
52 | |||
44 | #endif /*_PFXLEN_H */ | 53 | #endif /*_PFXLEN_H */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index ecbb8e495912..cadb7402d7a7 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -29,10 +29,13 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); | |||
29 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); | 29 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
30 | 30 | ||
31 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); | 31 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); |
32 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, | 32 | extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, |
33 | int echo, gfp_t flags); | 33 | u32 dst_portid, gfp_t gfp_mask); |
34 | extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); | 34 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, |
35 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); | 35 | unsigned int group, int echo, gfp_t flags); |
36 | extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); | ||
37 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, | ||
38 | u32 portid, int flags); | ||
36 | 39 | ||
37 | extern void nfnl_lock(__u8 subsys_id); | 40 | extern void nfnl_lock(__u8 subsys_id); |
38 | extern void nfnl_unlock(__u8 subsys_id); | 41 | extern void nfnl_unlock(__u8 subsys_id); |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index e0f746b7b95c..6358da5eeee8 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -15,11 +15,18 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) | |||
15 | return (struct nlmsghdr *)skb->data; | 15 | return (struct nlmsghdr *)skb->data; |
16 | } | 16 | } |
17 | 17 | ||
18 | enum netlink_skb_flags { | ||
19 | NETLINK_SKB_MMAPED = 0x1, /* Packet data is mmaped */ | ||
20 | NETLINK_SKB_TX = 0x2, /* Packet was sent by userspace */ | ||
21 | NETLINK_SKB_DELIVERED = 0x4, /* Packet was delivered */ | ||
22 | }; | ||
23 | |||
18 | struct netlink_skb_parms { | 24 | struct netlink_skb_parms { |
19 | struct scm_creds creds; /* Skb credentials */ | 25 | struct scm_creds creds; /* Skb credentials */ |
20 | __u32 portid; | 26 | __u32 portid; |
21 | __u32 dst_group; | 27 | __u32 dst_group; |
22 | struct sock *ssk; | 28 | __u32 flags; |
29 | struct sock *sk; | ||
23 | }; | 30 | }; |
24 | 31 | ||
25 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) | 32 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) |
@@ -57,6 +64,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group) | |||
57 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); | 64 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); |
58 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); | 65 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); |
59 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); | 66 | extern int netlink_has_listeners(struct sock *sk, unsigned int group); |
67 | extern struct sk_buff *netlink_alloc_skb(struct sock *ssk, unsigned int size, | ||
68 | u32 dst_portid, gfp_t gfp_mask); | ||
60 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); | 69 | extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); |
61 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, | 70 | extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, |
62 | __u32 group, gfp_t allocation); | 71 | __u32 group, gfp_t allocation); |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 9d7d8c64f7c8..fa2cb76a7029 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -40,7 +40,7 @@ struct netpoll_info { | |||
40 | 40 | ||
41 | unsigned long rx_flags; | 41 | unsigned long rx_flags; |
42 | spinlock_t rx_lock; | 42 | spinlock_t rx_lock; |
43 | struct mutex dev_lock; | 43 | struct semaphore dev_lock; |
44 | struct list_head rx_np; /* netpolls that registered an rx_hook */ | 44 | struct list_head rx_np; /* netpolls that registered an rx_hook */ |
45 | 45 | ||
46 | struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ | 46 | struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 1cc25682b20b..fc01d5cb4cf1 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -59,11 +59,18 @@ struct nfs_lockowner { | |||
59 | pid_t l_pid; | 59 | pid_t l_pid; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | #define NFS_IO_INPROGRESS 0 | ||
63 | struct nfs_io_counter { | ||
64 | unsigned long flags; | ||
65 | atomic_t io_count; | ||
66 | }; | ||
67 | |||
62 | struct nfs_lock_context { | 68 | struct nfs_lock_context { |
63 | atomic_t count; | 69 | atomic_t count; |
64 | struct list_head list; | 70 | struct list_head list; |
65 | struct nfs_open_context *open_context; | 71 | struct nfs_open_context *open_context; |
66 | struct nfs_lockowner lockowner; | 72 | struct nfs_lockowner lockowner; |
73 | struct nfs_io_counter io_count; | ||
67 | }; | 74 | }; |
68 | 75 | ||
69 | struct nfs4_state; | 76 | struct nfs4_state; |
@@ -77,6 +84,7 @@ struct nfs_open_context { | |||
77 | unsigned long flags; | 84 | unsigned long flags; |
78 | #define NFS_CONTEXT_ERROR_WRITE (0) | 85 | #define NFS_CONTEXT_ERROR_WRITE (0) |
79 | #define NFS_CONTEXT_RESEND_WRITES (1) | 86 | #define NFS_CONTEXT_RESEND_WRITES (1) |
87 | #define NFS_CONTEXT_BAD (2) | ||
80 | int error; | 88 | int error; |
81 | 89 | ||
82 | struct list_head list; | 90 | struct list_head list; |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 6c6ed153a9b4..3b7fa2abecca 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -40,6 +40,7 @@ struct nfs_client { | |||
40 | #define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */ | 40 | #define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */ |
41 | #define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ | 41 | #define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ |
42 | #define NFS_CS_MIGRATION 2 /* - transparent state migr */ | 42 | #define NFS_CS_MIGRATION 2 /* - transparent state migr */ |
43 | #define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ | ||
43 | struct sockaddr_storage cl_addr; /* server identifier */ | 44 | struct sockaddr_storage cl_addr; /* server identifier */ |
44 | size_t cl_addrlen; | 45 | size_t cl_addrlen; |
45 | char * cl_hostname; /* hostname of server */ | 46 | char * cl_hostname; /* hostname of server */ |
@@ -197,5 +198,7 @@ struct nfs_server { | |||
197 | #define NFS_CAP_MTIME (1U << 13) | 198 | #define NFS_CAP_MTIME (1U << 13) |
198 | #define NFS_CAP_POSIX_LOCK (1U << 14) | 199 | #define NFS_CAP_POSIX_LOCK (1U << 14) |
199 | #define NFS_CAP_UIDGID_NOMAP (1U << 15) | 200 | #define NFS_CAP_UIDGID_NOMAP (1U << 15) |
201 | #define NFS_CAP_STATEID_NFSV41 (1U << 16) | ||
202 | #define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) | ||
200 | 203 | ||
201 | #endif | 204 | #endif |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 4b993d358dad..104b62f23ee0 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -14,9 +14,6 @@ | |||
14 | #define NFS_DEF_FILE_IO_SIZE (4096U) | 14 | #define NFS_DEF_FILE_IO_SIZE (4096U) |
15 | #define NFS_MIN_FILE_IO_SIZE (1024U) | 15 | #define NFS_MIN_FILE_IO_SIZE (1024U) |
16 | 16 | ||
17 | /* Forward declaration for NFS v3 */ | ||
18 | struct nfs4_secinfo_flavors; | ||
19 | |||
20 | struct nfs4_string { | 17 | struct nfs4_string { |
21 | unsigned int len; | 18 | unsigned int len; |
22 | char *data; | 19 | char *data; |
@@ -349,6 +346,7 @@ struct nfs_openargs { | |||
349 | const u32 * bitmask; | 346 | const u32 * bitmask; |
350 | const u32 * open_bitmap; | 347 | const u32 * open_bitmap; |
351 | __u32 claim; | 348 | __u32 claim; |
349 | enum createmode4 createmode; | ||
352 | }; | 350 | }; |
353 | 351 | ||
354 | struct nfs_openres { | 352 | struct nfs_openres { |
@@ -486,6 +484,7 @@ struct nfs_readargs { | |||
486 | struct nfs_fh * fh; | 484 | struct nfs_fh * fh; |
487 | struct nfs_open_context *context; | 485 | struct nfs_open_context *context; |
488 | struct nfs_lock_context *lock_context; | 486 | struct nfs_lock_context *lock_context; |
487 | nfs4_stateid stateid; | ||
489 | __u64 offset; | 488 | __u64 offset; |
490 | __u32 count; | 489 | __u32 count; |
491 | unsigned int pgbase; | 490 | unsigned int pgbase; |
@@ -507,6 +506,7 @@ struct nfs_writeargs { | |||
507 | struct nfs_fh * fh; | 506 | struct nfs_fh * fh; |
508 | struct nfs_open_context *context; | 507 | struct nfs_open_context *context; |
509 | struct nfs_lock_context *lock_context; | 508 | struct nfs_lock_context *lock_context; |
509 | nfs4_stateid stateid; | ||
510 | __u64 offset; | 510 | __u64 offset; |
511 | __u32 count; | 511 | __u32 count; |
512 | enum nfs3_stable_how stable; | 512 | enum nfs3_stable_how stable; |
@@ -1050,25 +1050,14 @@ struct nfs4_fs_locations_res { | |||
1050 | struct nfs4_fs_locations *fs_locations; | 1050 | struct nfs4_fs_locations *fs_locations; |
1051 | }; | 1051 | }; |
1052 | 1052 | ||
1053 | struct nfs4_secinfo_oid { | 1053 | struct nfs4_secinfo4 { |
1054 | unsigned int len; | 1054 | u32 flavor; |
1055 | char data[GSS_OID_MAX_LEN]; | 1055 | struct rpcsec_gss_info flavor_info; |
1056 | }; | ||
1057 | |||
1058 | struct nfs4_secinfo_gss { | ||
1059 | struct nfs4_secinfo_oid sec_oid4; | ||
1060 | unsigned int qop4; | ||
1061 | unsigned int service; | ||
1062 | }; | ||
1063 | |||
1064 | struct nfs4_secinfo_flavor { | ||
1065 | unsigned int flavor; | ||
1066 | struct nfs4_secinfo_gss gss; | ||
1067 | }; | 1056 | }; |
1068 | 1057 | ||
1069 | struct nfs4_secinfo_flavors { | 1058 | struct nfs4_secinfo_flavors { |
1070 | unsigned int num_flavors; | 1059 | unsigned int num_flavors; |
1071 | struct nfs4_secinfo_flavor flavors[0]; | 1060 | struct nfs4_secinfo4 flavors[0]; |
1072 | }; | 1061 | }; |
1073 | 1062 | ||
1074 | struct nfs4_secinfo_arg { | 1063 | struct nfs4_secinfo_arg { |
@@ -1187,7 +1176,7 @@ struct nfs41_test_stateid_res { | |||
1187 | 1176 | ||
1188 | struct nfs41_free_stateid_args { | 1177 | struct nfs41_free_stateid_args { |
1189 | struct nfs4_sequence_args seq_args; | 1178 | struct nfs4_sequence_args seq_args; |
1190 | nfs4_stateid *stateid; | 1179 | nfs4_stateid stateid; |
1191 | }; | 1180 | }; |
1192 | 1181 | ||
1193 | struct nfs41_free_stateid_res { | 1182 | struct nfs41_free_stateid_res { |
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index d65746efc954..d14a4c362465 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -47,8 +47,11 @@ | |||
47 | * runtime initialization. | 47 | * runtime initialization. |
48 | */ | 48 | */ |
49 | 49 | ||
50 | typedef int (*notifier_fn_t)(struct notifier_block *nb, | ||
51 | unsigned long action, void *data); | ||
52 | |||
50 | struct notifier_block { | 53 | struct notifier_block { |
51 | int (*notifier_call)(struct notifier_block *, unsigned long, void *); | 54 | notifier_fn_t notifier_call; |
52 | struct notifier_block __rcu *next; | 55 | struct notifier_block __rcu *next; |
53 | int priority; | 56 | int priority; |
54 | }; | 57 | }; |
diff --git a/include/linux/nubus.h b/include/linux/nubus.h index a8696bbdfbc4..6165b2c62040 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h | |||
@@ -80,10 +80,13 @@ extern struct nubus_board* nubus_boards; | |||
80 | 80 | ||
81 | /* Generic NuBus interface functions, modelled after the PCI interface */ | 81 | /* Generic NuBus interface functions, modelled after the PCI interface */ |
82 | void nubus_scan_bus(void); | 82 | void nubus_scan_bus(void); |
83 | #ifdef CONFIG_PROC_FS | ||
83 | extern void nubus_proc_init(void); | 84 | extern void nubus_proc_init(void); |
85 | #else | ||
86 | static inline void nubus_proc_init(void) {} | ||
87 | #endif | ||
84 | int get_nubus_list(char *buf); | 88 | int get_nubus_list(char *buf); |
85 | int nubus_proc_attach_device(struct nubus_dev *dev); | 89 | int nubus_proc_attach_device(struct nubus_dev *dev); |
86 | int nubus_proc_detach_device(struct nubus_dev *dev); | ||
87 | /* If we need more precision we can add some more of these */ | 90 | /* If we need more precision we can add some more of these */ |
88 | struct nubus_dev* nubus_find_device(unsigned short category, | 91 | struct nubus_dev* nubus_find_device(unsigned short category, |
89 | unsigned short type, | 92 | unsigned short type, |
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 4fa3b0b9b071..f451c8d6e231 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
@@ -107,6 +107,12 @@ struct nvme_id_ctrl { | |||
107 | __u8 vs[1024]; | 107 | __u8 vs[1024]; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | enum { | ||
111 | NVME_CTRL_ONCS_COMPARE = 1 << 0, | ||
112 | NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1, | ||
113 | NVME_CTRL_ONCS_DSM = 1 << 2, | ||
114 | }; | ||
115 | |||
110 | struct nvme_lbaf { | 116 | struct nvme_lbaf { |
111 | __le16 ms; | 117 | __le16 ms; |
112 | __u8 ds; | 118 | __u8 ds; |
@@ -201,11 +207,11 @@ struct nvme_common_command { | |||
201 | __u8 flags; | 207 | __u8 flags; |
202 | __u16 command_id; | 208 | __u16 command_id; |
203 | __le32 nsid; | 209 | __le32 nsid; |
204 | __u32 cdw2[2]; | 210 | __le32 cdw2[2]; |
205 | __le64 metadata; | 211 | __le64 metadata; |
206 | __le64 prp1; | 212 | __le64 prp1; |
207 | __le64 prp2; | 213 | __le64 prp2; |
208 | __u32 cdw10[6]; | 214 | __le32 cdw10[6]; |
209 | }; | 215 | }; |
210 | 216 | ||
211 | struct nvme_rw_command { | 217 | struct nvme_rw_command { |
@@ -246,6 +252,31 @@ enum { | |||
246 | NVME_RW_DSM_COMPRESSED = 1 << 7, | 252 | NVME_RW_DSM_COMPRESSED = 1 << 7, |
247 | }; | 253 | }; |
248 | 254 | ||
255 | struct nvme_dsm_cmd { | ||
256 | __u8 opcode; | ||
257 | __u8 flags; | ||
258 | __u16 command_id; | ||
259 | __le32 nsid; | ||
260 | __u64 rsvd2[2]; | ||
261 | __le64 prp1; | ||
262 | __le64 prp2; | ||
263 | __le32 nr; | ||
264 | __le32 attributes; | ||
265 | __u32 rsvd12[4]; | ||
266 | }; | ||
267 | |||
268 | enum { | ||
269 | NVME_DSMGMT_IDR = 1 << 0, | ||
270 | NVME_DSMGMT_IDW = 1 << 1, | ||
271 | NVME_DSMGMT_AD = 1 << 2, | ||
272 | }; | ||
273 | |||
274 | struct nvme_dsm_range { | ||
275 | __le32 cattr; | ||
276 | __le32 nlb; | ||
277 | __le64 slba; | ||
278 | }; | ||
279 | |||
249 | /* Admin commands */ | 280 | /* Admin commands */ |
250 | 281 | ||
251 | enum nvme_admin_opcode { | 282 | enum nvme_admin_opcode { |
@@ -285,6 +316,9 @@ enum { | |||
285 | NVME_FEAT_WRITE_ATOMIC = 0x0a, | 316 | NVME_FEAT_WRITE_ATOMIC = 0x0a, |
286 | NVME_FEAT_ASYNC_EVENT = 0x0b, | 317 | NVME_FEAT_ASYNC_EVENT = 0x0b, |
287 | NVME_FEAT_SW_PROGRESS = 0x0c, | 318 | NVME_FEAT_SW_PROGRESS = 0x0c, |
319 | NVME_FWACT_REPL = (0 << 3), | ||
320 | NVME_FWACT_REPL_ACTV = (1 << 3), | ||
321 | NVME_FWACT_ACTV = (2 << 3), | ||
288 | }; | 322 | }; |
289 | 323 | ||
290 | struct nvme_identify { | 324 | struct nvme_identify { |
@@ -362,6 +396,16 @@ struct nvme_download_firmware { | |||
362 | __u32 rsvd12[4]; | 396 | __u32 rsvd12[4]; |
363 | }; | 397 | }; |
364 | 398 | ||
399 | struct nvme_format_cmd { | ||
400 | __u8 opcode; | ||
401 | __u8 flags; | ||
402 | __u16 command_id; | ||
403 | __le32 nsid; | ||
404 | __u64 rsvd2[4]; | ||
405 | __le32 cdw10; | ||
406 | __u32 rsvd11[5]; | ||
407 | }; | ||
408 | |||
365 | struct nvme_command { | 409 | struct nvme_command { |
366 | union { | 410 | union { |
367 | struct nvme_common_command common; | 411 | struct nvme_common_command common; |
@@ -372,6 +416,8 @@ struct nvme_command { | |||
372 | struct nvme_create_sq create_sq; | 416 | struct nvme_create_sq create_sq; |
373 | struct nvme_delete_queue delete_queue; | 417 | struct nvme_delete_queue delete_queue; |
374 | struct nvme_download_firmware dlfw; | 418 | struct nvme_download_firmware dlfw; |
419 | struct nvme_format_cmd format; | ||
420 | struct nvme_dsm_cmd dsm; | ||
375 | }; | 421 | }; |
376 | }; | 422 | }; |
377 | 423 | ||
@@ -388,6 +434,7 @@ enum { | |||
388 | NVME_SC_FUSED_FAIL = 0x9, | 434 | NVME_SC_FUSED_FAIL = 0x9, |
389 | NVME_SC_FUSED_MISSING = 0xa, | 435 | NVME_SC_FUSED_MISSING = 0xa, |
390 | NVME_SC_INVALID_NS = 0xb, | 436 | NVME_SC_INVALID_NS = 0xb, |
437 | NVME_SC_CMD_SEQ_ERROR = 0xc, | ||
391 | NVME_SC_LBA_RANGE = 0x80, | 438 | NVME_SC_LBA_RANGE = 0x80, |
392 | NVME_SC_CAP_EXCEEDED = 0x81, | 439 | NVME_SC_CAP_EXCEEDED = 0x81, |
393 | NVME_SC_NS_NOT_READY = 0x82, | 440 | NVME_SC_NS_NOT_READY = 0x82, |
@@ -461,4 +508,111 @@ struct nvme_admin_cmd { | |||
461 | #define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) | 508 | #define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) |
462 | #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) | 509 | #define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) |
463 | 510 | ||
511 | #ifdef __KERNEL__ | ||
512 | #include <linux/pci.h> | ||
513 | #include <linux/miscdevice.h> | ||
514 | #include <linux/kref.h> | ||
515 | |||
516 | #define NVME_IO_TIMEOUT (5 * HZ) | ||
517 | |||
518 | /* | ||
519 | * Represents an NVM Express device. Each nvme_dev is a PCI function. | ||
520 | */ | ||
521 | struct nvme_dev { | ||
522 | struct list_head node; | ||
523 | struct nvme_queue **queues; | ||
524 | u32 __iomem *dbs; | ||
525 | struct pci_dev *pci_dev; | ||
526 | struct dma_pool *prp_page_pool; | ||
527 | struct dma_pool *prp_small_pool; | ||
528 | int instance; | ||
529 | int queue_count; | ||
530 | int db_stride; | ||
531 | u32 ctrl_config; | ||
532 | struct msix_entry *entry; | ||
533 | struct nvme_bar __iomem *bar; | ||
534 | struct list_head namespaces; | ||
535 | struct kref kref; | ||
536 | struct miscdevice miscdev; | ||
537 | char name[12]; | ||
538 | char serial[20]; | ||
539 | char model[40]; | ||
540 | char firmware_rev[8]; | ||
541 | u32 max_hw_sectors; | ||
542 | u32 stripe_size; | ||
543 | u16 oncs; | ||
544 | }; | ||
545 | |||
546 | /* | ||
547 | * An NVM Express namespace is equivalent to a SCSI LUN | ||
548 | */ | ||
549 | struct nvme_ns { | ||
550 | struct list_head list; | ||
551 | |||
552 | struct nvme_dev *dev; | ||
553 | struct request_queue *queue; | ||
554 | struct gendisk *disk; | ||
555 | |||
556 | int ns_id; | ||
557 | int lba_shift; | ||
558 | int ms; | ||
559 | u64 mode_select_num_blocks; | ||
560 | u32 mode_select_block_len; | ||
561 | }; | ||
562 | |||
563 | /* | ||
564 | * The nvme_iod describes the data in an I/O, including the list of PRP | ||
565 | * entries. You can't see it in this data structure because C doesn't let | ||
566 | * me express that. Use nvme_alloc_iod to ensure there's enough space | ||
567 | * allocated to store the PRP list. | ||
568 | */ | ||
569 | struct nvme_iod { | ||
570 | void *private; /* For the use of the submitter of the I/O */ | ||
571 | int npages; /* In the PRP list. 0 means small pool in use */ | ||
572 | int offset; /* Of PRP list */ | ||
573 | int nents; /* Used in scatterlist */ | ||
574 | int length; /* Of data, in bytes */ | ||
575 | dma_addr_t first_dma; | ||
576 | struct scatterlist sg[0]; | ||
577 | }; | ||
578 | |||
579 | static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector) | ||
580 | { | ||
581 | return (sector >> (ns->lba_shift - 9)); | ||
582 | } | ||
583 | |||
584 | /** | ||
585 | * nvme_free_iod - frees an nvme_iod | ||
586 | * @dev: The device that the I/O was submitted to | ||
587 | * @iod: The memory to free | ||
588 | */ | ||
589 | void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod); | ||
590 | |||
591 | int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd, | ||
592 | struct nvme_iod *iod, int total_len, gfp_t gfp); | ||
593 | struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, | ||
594 | unsigned long addr, unsigned length); | ||
595 | void nvme_unmap_user_pages(struct nvme_dev *dev, int write, | ||
596 | struct nvme_iod *iod); | ||
597 | struct nvme_queue *get_nvmeq(struct nvme_dev *dev); | ||
598 | void put_nvmeq(struct nvme_queue *nvmeq); | ||
599 | int nvme_submit_sync_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd, | ||
600 | u32 *result, unsigned timeout); | ||
601 | int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns); | ||
602 | int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *, | ||
603 | u32 *result); | ||
604 | int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns, | ||
605 | dma_addr_t dma_addr); | ||
606 | int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, | ||
607 | dma_addr_t dma_addr, u32 *result); | ||
608 | int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11, | ||
609 | dma_addr_t dma_addr, u32 *result); | ||
610 | |||
611 | struct sg_io_hdr; | ||
612 | |||
613 | int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr); | ||
614 | int nvme_sg_get_version_num(int __user *ip); | ||
615 | |||
616 | #endif | ||
617 | |||
464 | #endif /* _LINUX_NVME_H */ | 618 | #endif /* _LINUX_NVME_H */ |
diff --git a/include/linux/of.h b/include/linux/of.h index a0f129284948..1fd08ca23106 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -235,6 +235,9 @@ extern struct device_node *of_find_node_with_property( | |||
235 | extern struct property *of_find_property(const struct device_node *np, | 235 | extern struct property *of_find_property(const struct device_node *np, |
236 | const char *name, | 236 | const char *name, |
237 | int *lenp); | 237 | int *lenp); |
238 | extern int of_property_read_u32_index(const struct device_node *np, | ||
239 | const char *propname, | ||
240 | u32 index, u32 *out_value); | ||
238 | extern int of_property_read_u8_array(const struct device_node *np, | 241 | extern int of_property_read_u8_array(const struct device_node *np, |
239 | const char *propname, u8 *out_values, size_t sz); | 242 | const char *propname, u8 *out_values, size_t sz); |
240 | extern int of_property_read_u16_array(const struct device_node *np, | 243 | extern int of_property_read_u16_array(const struct device_node *np, |
@@ -353,6 +356,11 @@ static inline struct device_node *of_find_node_by_name(struct device_node *from, | |||
353 | return NULL; | 356 | return NULL; |
354 | } | 357 | } |
355 | 358 | ||
359 | static inline struct device_node *of_get_parent(const struct device_node *node) | ||
360 | { | ||
361 | return NULL; | ||
362 | } | ||
363 | |||
356 | static inline bool of_have_populated_dt(void) | 364 | static inline bool of_have_populated_dt(void) |
357 | { | 365 | { |
358 | return false; | 366 | return false; |
@@ -379,6 +387,11 @@ static inline int of_device_is_compatible(const struct device_node *device, | |||
379 | return 0; | 387 | return 0; |
380 | } | 388 | } |
381 | 389 | ||
390 | static inline int of_device_is_available(const struct device_node *device) | ||
391 | { | ||
392 | return 0; | ||
393 | } | ||
394 | |||
382 | static inline struct property *of_find_property(const struct device_node *np, | 395 | static inline struct property *of_find_property(const struct device_node *np, |
383 | const char *name, | 396 | const char *name, |
384 | int *lenp) | 397 | int *lenp) |
@@ -394,6 +407,12 @@ static inline struct device_node *of_find_compatible_node( | |||
394 | return NULL; | 407 | return NULL; |
395 | } | 408 | } |
396 | 409 | ||
410 | static inline int of_property_read_u32_index(const struct device_node *np, | ||
411 | const char *propname, u32 index, u32 *out_value) | ||
412 | { | ||
413 | return -ENOSYS; | ||
414 | } | ||
415 | |||
397 | static inline int of_property_read_u8_array(const struct device_node *np, | 416 | static inline int of_property_read_u8_array(const struct device_node *np, |
398 | const char *propname, u8 *out_values, size_t sz) | 417 | const char *propname, u8 *out_values, size_t sz) |
399 | { | 418 | { |
@@ -540,4 +559,14 @@ static inline int of_property_read_u32(const struct device_node *np, | |||
540 | return of_property_read_u32_array(np, propname, out_value, 1); | 559 | return of_property_read_u32_array(np, propname, out_value, 1); |
541 | } | 560 | } |
542 | 561 | ||
562 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) | ||
563 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); | ||
564 | extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); | ||
565 | extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, | ||
566 | struct property *prop); | ||
567 | extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, | ||
568 | struct property *newprop, | ||
569 | struct property *oldprop); | ||
570 | #endif | ||
571 | |||
543 | #endif /* _LINUX_OF_H */ | 572 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h index d15073e080dd..364dda734877 100644 --- a/include/linux/of_dma.h +++ b/include/linux/of_dma.h | |||
@@ -25,7 +25,6 @@ struct of_dma { | |||
25 | struct dma_chan *(*of_dma_xlate) | 25 | struct dma_chan *(*of_dma_xlate) |
26 | (struct of_phandle_args *, struct of_dma *); | 26 | (struct of_phandle_args *, struct of_dma *); |
27 | void *of_dma_data; | 27 | void *of_dma_data; |
28 | int use_count; | ||
29 | }; | 28 | }; |
30 | 29 | ||
31 | struct of_dma_filter_info { | 30 | struct of_dma_filter_info { |
@@ -38,9 +37,9 @@ extern int of_dma_controller_register(struct device_node *np, | |||
38 | struct dma_chan *(*of_dma_xlate) | 37 | struct dma_chan *(*of_dma_xlate) |
39 | (struct of_phandle_args *, struct of_dma *), | 38 | (struct of_phandle_args *, struct of_dma *), |
40 | void *data); | 39 | void *data); |
41 | extern int of_dma_controller_free(struct device_node *np); | 40 | extern void of_dma_controller_free(struct device_node *np); |
42 | extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np, | 41 | extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np, |
43 | char *name); | 42 | const char *name); |
44 | extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, | 43 | extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, |
45 | struct of_dma *ofdma); | 44 | struct of_dma *ofdma); |
46 | #else | 45 | #else |
@@ -52,13 +51,12 @@ static inline int of_dma_controller_register(struct device_node *np, | |||
52 | return -ENODEV; | 51 | return -ENODEV; |
53 | } | 52 | } |
54 | 53 | ||
55 | static inline int of_dma_controller_free(struct device_node *np) | 54 | static inline void of_dma_controller_free(struct device_node *np) |
56 | { | 55 | { |
57 | return -ENODEV; | ||
58 | } | 56 | } |
59 | 57 | ||
60 | static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np, | 58 | static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np, |
61 | char *name) | 59 | const char *name) |
62 | { | 60 | { |
63 | return NULL; | 61 | return NULL; |
64 | } | 62 | } |
diff --git a/include/linux/of_net.h b/include/linux/of_net.h index f47464188710..61bf53b02779 100644 --- a/include/linux/of_net.h +++ b/include/linux/of_net.h | |||
@@ -11,6 +11,16 @@ | |||
11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
12 | extern const int of_get_phy_mode(struct device_node *np); | 12 | extern const int of_get_phy_mode(struct device_node *np); |
13 | extern const void *of_get_mac_address(struct device_node *np); | 13 | extern const void *of_get_mac_address(struct device_node *np); |
14 | #else | ||
15 | static inline const int of_get_phy_mode(struct device_node *np) | ||
16 | { | ||
17 | return -ENODEV; | ||
18 | } | ||
19 | |||
20 | static inline const void *of_get_mac_address(struct device_node *np) | ||
21 | { | ||
22 | return NULL; | ||
23 | } | ||
14 | #endif | 24 | #endif |
15 | 25 | ||
16 | #endif /* __LINUX_OF_NET_H */ | 26 | #endif /* __LINUX_OF_NET_H */ |
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h index d42e174bd0c8..e6b240b6196c 100644 --- a/include/linux/openvswitch.h +++ b/include/linux/openvswitch.h | |||
@@ -19,435 +19,6 @@ | |||
19 | #ifndef _LINUX_OPENVSWITCH_H | 19 | #ifndef _LINUX_OPENVSWITCH_H |
20 | #define _LINUX_OPENVSWITCH_H 1 | 20 | #define _LINUX_OPENVSWITCH_H 1 |
21 | 21 | ||
22 | #include <linux/types.h> | 22 | #include <uapi/linux/openvswitch.h> |
23 | |||
24 | /** | ||
25 | * struct ovs_header - header for OVS Generic Netlink messages. | ||
26 | * @dp_ifindex: ifindex of local port for datapath (0 to make a request not | ||
27 | * specific to a datapath). | ||
28 | * | ||
29 | * Attributes following the header are specific to a particular OVS Generic | ||
30 | * Netlink family, but all of the OVS families use this header. | ||
31 | */ | ||
32 | |||
33 | struct ovs_header { | ||
34 | int dp_ifindex; | ||
35 | }; | ||
36 | |||
37 | /* Datapaths. */ | ||
38 | |||
39 | #define OVS_DATAPATH_FAMILY "ovs_datapath" | ||
40 | #define OVS_DATAPATH_MCGROUP "ovs_datapath" | ||
41 | #define OVS_DATAPATH_VERSION 0x1 | ||
42 | |||
43 | enum ovs_datapath_cmd { | ||
44 | OVS_DP_CMD_UNSPEC, | ||
45 | OVS_DP_CMD_NEW, | ||
46 | OVS_DP_CMD_DEL, | ||
47 | OVS_DP_CMD_GET, | ||
48 | OVS_DP_CMD_SET | ||
49 | }; | ||
50 | |||
51 | /** | ||
52 | * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. | ||
53 | * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local | ||
54 | * port". This is the name of the network device whose dp_ifindex is given in | ||
55 | * the &struct ovs_header. Always present in notifications. Required in | ||
56 | * %OVS_DP_NEW requests. May be used as an alternative to specifying | ||
57 | * dp_ifindex in other requests (with a dp_ifindex of 0). | ||
58 | * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially | ||
59 | * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on | ||
60 | * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should | ||
61 | * not be sent. | ||
62 | * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the | ||
63 | * datapath. Always present in notifications. | ||
64 | * | ||
65 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
66 | * payload for %OVS_DP_* commands. | ||
67 | */ | ||
68 | enum ovs_datapath_attr { | ||
69 | OVS_DP_ATTR_UNSPEC, | ||
70 | OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ | ||
71 | OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ | ||
72 | OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ | ||
73 | __OVS_DP_ATTR_MAX | ||
74 | }; | ||
75 | |||
76 | #define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) | ||
77 | |||
78 | struct ovs_dp_stats { | ||
79 | __u64 n_hit; /* Number of flow table matches. */ | ||
80 | __u64 n_missed; /* Number of flow table misses. */ | ||
81 | __u64 n_lost; /* Number of misses not sent to userspace. */ | ||
82 | __u64 n_flows; /* Number of flows present */ | ||
83 | }; | ||
84 | |||
85 | struct ovs_vport_stats { | ||
86 | __u64 rx_packets; /* total packets received */ | ||
87 | __u64 tx_packets; /* total packets transmitted */ | ||
88 | __u64 rx_bytes; /* total bytes received */ | ||
89 | __u64 tx_bytes; /* total bytes transmitted */ | ||
90 | __u64 rx_errors; /* bad packets received */ | ||
91 | __u64 tx_errors; /* packet transmit problems */ | ||
92 | __u64 rx_dropped; /* no space in linux buffers */ | ||
93 | __u64 tx_dropped; /* no space available in linux */ | ||
94 | }; | ||
95 | |||
96 | /* Fixed logical ports. */ | ||
97 | #define OVSP_LOCAL ((__u16)0) | ||
98 | |||
99 | /* Packet transfer. */ | ||
100 | |||
101 | #define OVS_PACKET_FAMILY "ovs_packet" | ||
102 | #define OVS_PACKET_VERSION 0x1 | ||
103 | |||
104 | enum ovs_packet_cmd { | ||
105 | OVS_PACKET_CMD_UNSPEC, | ||
106 | |||
107 | /* Kernel-to-user notifications. */ | ||
108 | OVS_PACKET_CMD_MISS, /* Flow table miss. */ | ||
109 | OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ | ||
110 | |||
111 | /* Userspace commands. */ | ||
112 | OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ | ||
113 | }; | ||
114 | |||
115 | /** | ||
116 | * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. | ||
117 | * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire | ||
118 | * packet as received, from the start of the Ethernet header onward. For | ||
119 | * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by | ||
120 | * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is | ||
121 | * the flow key extracted from the packet as originally received. | ||
122 | * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key | ||
123 | * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows | ||
124 | * userspace to adapt its flow setup strategy by comparing its notion of the | ||
125 | * flow key against the kernel's. | ||
126 | * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used | ||
127 | * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. | ||
128 | * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION | ||
129 | * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an | ||
130 | * %OVS_USERSPACE_ATTR_USERDATA attribute. | ||
131 | * | ||
132 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
133 | * payload for %OVS_PACKET_* commands. | ||
134 | */ | ||
135 | enum ovs_packet_attr { | ||
136 | OVS_PACKET_ATTR_UNSPEC, | ||
137 | OVS_PACKET_ATTR_PACKET, /* Packet data. */ | ||
138 | OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ | ||
139 | OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
140 | OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ | ||
141 | __OVS_PACKET_ATTR_MAX | ||
142 | }; | ||
143 | |||
144 | #define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) | ||
145 | |||
146 | /* Virtual ports. */ | ||
147 | |||
148 | #define OVS_VPORT_FAMILY "ovs_vport" | ||
149 | #define OVS_VPORT_MCGROUP "ovs_vport" | ||
150 | #define OVS_VPORT_VERSION 0x1 | ||
151 | |||
152 | enum ovs_vport_cmd { | ||
153 | OVS_VPORT_CMD_UNSPEC, | ||
154 | OVS_VPORT_CMD_NEW, | ||
155 | OVS_VPORT_CMD_DEL, | ||
156 | OVS_VPORT_CMD_GET, | ||
157 | OVS_VPORT_CMD_SET | ||
158 | }; | ||
159 | |||
160 | enum ovs_vport_type { | ||
161 | OVS_VPORT_TYPE_UNSPEC, | ||
162 | OVS_VPORT_TYPE_NETDEV, /* network device */ | ||
163 | OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ | ||
164 | __OVS_VPORT_TYPE_MAX | ||
165 | }; | ||
166 | |||
167 | #define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) | ||
168 | |||
169 | /** | ||
170 | * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. | ||
171 | * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. | ||
172 | * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type | ||
173 | * of vport. | ||
174 | * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device | ||
175 | * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes | ||
176 | * plus a null terminator. | ||
177 | * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. | ||
178 | * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that | ||
179 | * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on | ||
180 | * this port. A value of zero indicates that upcalls should not be sent. | ||
181 | * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for | ||
182 | * packets sent or received through the vport. | ||
183 | * | ||
184 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
185 | * payload for %OVS_VPORT_* commands. | ||
186 | * | ||
187 | * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and | ||
188 | * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is | ||
189 | * optional; if not specified a free port number is automatically selected. | ||
190 | * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type | ||
191 | * of vport. | ||
192 | * and other attributes are ignored. | ||
193 | * | ||
194 | * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to | ||
195 | * look up the vport to operate on; otherwise dp_idx from the &struct | ||
196 | * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. | ||
197 | */ | ||
198 | enum ovs_vport_attr { | ||
199 | OVS_VPORT_ATTR_UNSPEC, | ||
200 | OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */ | ||
201 | OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */ | ||
202 | OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ | ||
203 | OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ | ||
204 | OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ | ||
205 | OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ | ||
206 | __OVS_VPORT_ATTR_MAX | ||
207 | }; | ||
208 | |||
209 | #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) | ||
210 | |||
211 | /* Flows. */ | ||
212 | |||
213 | #define OVS_FLOW_FAMILY "ovs_flow" | ||
214 | #define OVS_FLOW_MCGROUP "ovs_flow" | ||
215 | #define OVS_FLOW_VERSION 0x1 | ||
216 | |||
217 | enum ovs_flow_cmd { | ||
218 | OVS_FLOW_CMD_UNSPEC, | ||
219 | OVS_FLOW_CMD_NEW, | ||
220 | OVS_FLOW_CMD_DEL, | ||
221 | OVS_FLOW_CMD_GET, | ||
222 | OVS_FLOW_CMD_SET | ||
223 | }; | ||
224 | |||
225 | struct ovs_flow_stats { | ||
226 | __u64 n_packets; /* Number of matched packets. */ | ||
227 | __u64 n_bytes; /* Number of matched bytes. */ | ||
228 | }; | ||
229 | |||
230 | enum ovs_key_attr { | ||
231 | OVS_KEY_ATTR_UNSPEC, | ||
232 | OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */ | ||
233 | OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */ | ||
234 | OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */ | ||
235 | OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */ | ||
236 | OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */ | ||
237 | OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */ | ||
238 | OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */ | ||
239 | OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */ | ||
240 | OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */ | ||
241 | OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */ | ||
242 | OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */ | ||
243 | OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ | ||
244 | OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ | ||
245 | OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ | ||
246 | OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ | ||
247 | __OVS_KEY_ATTR_MAX | ||
248 | }; | ||
249 | |||
250 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) | ||
251 | |||
252 | /** | ||
253 | * enum ovs_frag_type - IPv4 and IPv6 fragment type | ||
254 | * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. | ||
255 | * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. | ||
256 | * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. | ||
257 | * | ||
258 | * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct | ||
259 | * ovs_key_ipv6. | ||
260 | */ | ||
261 | enum ovs_frag_type { | ||
262 | OVS_FRAG_TYPE_NONE, | ||
263 | OVS_FRAG_TYPE_FIRST, | ||
264 | OVS_FRAG_TYPE_LATER, | ||
265 | __OVS_FRAG_TYPE_MAX | ||
266 | }; | ||
267 | |||
268 | #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) | ||
269 | |||
270 | struct ovs_key_ethernet { | ||
271 | __u8 eth_src[6]; | ||
272 | __u8 eth_dst[6]; | ||
273 | }; | ||
274 | |||
275 | struct ovs_key_ipv4 { | ||
276 | __be32 ipv4_src; | ||
277 | __be32 ipv4_dst; | ||
278 | __u8 ipv4_proto; | ||
279 | __u8 ipv4_tos; | ||
280 | __u8 ipv4_ttl; | ||
281 | __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */ | ||
282 | }; | ||
283 | |||
284 | struct ovs_key_ipv6 { | ||
285 | __be32 ipv6_src[4]; | ||
286 | __be32 ipv6_dst[4]; | ||
287 | __be32 ipv6_label; /* 20-bits in least-significant bits. */ | ||
288 | __u8 ipv6_proto; | ||
289 | __u8 ipv6_tclass; | ||
290 | __u8 ipv6_hlimit; | ||
291 | __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */ | ||
292 | }; | ||
293 | |||
294 | struct ovs_key_tcp { | ||
295 | __be16 tcp_src; | ||
296 | __be16 tcp_dst; | ||
297 | }; | ||
298 | |||
299 | struct ovs_key_udp { | ||
300 | __be16 udp_src; | ||
301 | __be16 udp_dst; | ||
302 | }; | ||
303 | |||
304 | struct ovs_key_icmp { | ||
305 | __u8 icmp_type; | ||
306 | __u8 icmp_code; | ||
307 | }; | ||
308 | |||
309 | struct ovs_key_icmpv6 { | ||
310 | __u8 icmpv6_type; | ||
311 | __u8 icmpv6_code; | ||
312 | }; | ||
313 | |||
314 | struct ovs_key_arp { | ||
315 | __be32 arp_sip; | ||
316 | __be32 arp_tip; | ||
317 | __be16 arp_op; | ||
318 | __u8 arp_sha[6]; | ||
319 | __u8 arp_tha[6]; | ||
320 | }; | ||
321 | |||
322 | struct ovs_key_nd { | ||
323 | __u32 nd_target[4]; | ||
324 | __u8 nd_sll[6]; | ||
325 | __u8 nd_tll[6]; | ||
326 | }; | ||
327 | |||
328 | /** | ||
329 | * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. | ||
330 | * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow | ||
331 | * key. Always present in notifications. Required for all requests (except | ||
332 | * dumps). | ||
333 | * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying | ||
334 | * the actions to take for packets that match the key. Always present in | ||
335 | * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for | ||
336 | * %OVS_FLOW_CMD_SET requests. | ||
337 | * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this | ||
338 | * flow. Present in notifications if the stats would be nonzero. Ignored in | ||
339 | * requests. | ||
340 | * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the | ||
341 | * TCP flags seen on packets in this flow. Only present in notifications for | ||
342 | * TCP flows, and only if it would be nonzero. Ignored in requests. | ||
343 | * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on | ||
344 | * the system monotonic clock, at which a packet was last processed for this | ||
345 | * flow. Only present in notifications if a packet has been processed for this | ||
346 | * flow. Ignored in requests. | ||
347 | * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the | ||
348 | * last-used time, accumulated TCP flags, and statistics for this flow. | ||
349 | * Otherwise ignored in requests. Never present in notifications. | ||
350 | * | ||
351 | * These attributes follow the &struct ovs_header within the Generic Netlink | ||
352 | * payload for %OVS_FLOW_* commands. | ||
353 | */ | ||
354 | enum ovs_flow_attr { | ||
355 | OVS_FLOW_ATTR_UNSPEC, | ||
356 | OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */ | ||
357 | OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
358 | OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */ | ||
359 | OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ | ||
360 | OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ | ||
361 | OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ | ||
362 | __OVS_FLOW_ATTR_MAX | ||
363 | }; | ||
364 | |||
365 | #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) | ||
366 | |||
367 | /** | ||
368 | * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. | ||
369 | * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with | ||
370 | * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of | ||
371 | * %UINT32_MAX samples all packets and intermediate values sample intermediate | ||
372 | * fractions of packets. | ||
373 | * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. | ||
374 | * Actions are passed as nested attributes. | ||
375 | * | ||
376 | * Executes the specified actions with the given probability on a per-packet | ||
377 | * basis. | ||
378 | */ | ||
379 | enum ovs_sample_attr { | ||
380 | OVS_SAMPLE_ATTR_UNSPEC, | ||
381 | OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ | ||
382 | OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ | ||
383 | __OVS_SAMPLE_ATTR_MAX, | ||
384 | }; | ||
385 | |||
386 | #define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) | ||
387 | |||
388 | /** | ||
389 | * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. | ||
390 | * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION | ||
391 | * message should be sent. Required. | ||
392 | * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the | ||
393 | * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA, | ||
394 | */ | ||
395 | enum ovs_userspace_attr { | ||
396 | OVS_USERSPACE_ATTR_UNSPEC, | ||
397 | OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ | ||
398 | OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */ | ||
399 | __OVS_USERSPACE_ATTR_MAX | ||
400 | }; | ||
401 | |||
402 | #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) | ||
403 | |||
404 | /** | ||
405 | * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. | ||
406 | * @vlan_tpid: Tag protocol identifier (TPID) to push. | ||
407 | * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set | ||
408 | * (but it will not be set in the 802.1Q header that is pushed). | ||
409 | * | ||
410 | * The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID | ||
411 | * values are those that the kernel module also parses as 802.1Q headers, to | ||
412 | * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN | ||
413 | * from having surprising results. | ||
414 | */ | ||
415 | struct ovs_action_push_vlan { | ||
416 | __be16 vlan_tpid; /* 802.1Q TPID. */ | ||
417 | __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ | ||
418 | }; | ||
419 | |||
420 | /** | ||
421 | * enum ovs_action_attr - Action types. | ||
422 | * | ||
423 | * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. | ||
424 | * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested | ||
425 | * %OVS_USERSPACE_ATTR_* attributes. | ||
426 | * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The | ||
427 | * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its | ||
428 | * value. | ||
429 | * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the | ||
430 | * packet. | ||
431 | * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. | ||
432 | * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in | ||
433 | * the nested %OVS_SAMPLE_ATTR_* attributes. | ||
434 | * | ||
435 | * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all | ||
436 | * fields within a header are modifiable, e.g. the IPv4 protocol and fragment | ||
437 | * type may not be changed. | ||
438 | */ | ||
439 | |||
440 | enum ovs_action_attr { | ||
441 | OVS_ACTION_ATTR_UNSPEC, | ||
442 | OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */ | ||
443 | OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */ | ||
444 | OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */ | ||
445 | OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ | ||
446 | OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ | ||
447 | OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ | ||
448 | __OVS_ACTION_ATTR_MAX | ||
449 | }; | ||
450 | |||
451 | #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) | ||
452 | 23 | ||
453 | #endif /* _LINUX_OPENVSWITCH_H */ | 24 | #endif /* _LINUX_OPENVSWITCH_H */ |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0e38e13eb249..e3dea75a078b 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -149,7 +149,7 @@ static inline int page_cache_get_speculative(struct page *page) | |||
149 | { | 149 | { |
150 | VM_BUG_ON(in_interrupt()); | 150 | VM_BUG_ON(in_interrupt()); |
151 | 151 | ||
152 | #if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) | 152 | #ifdef CONFIG_TINY_RCU |
153 | # ifdef CONFIG_PREEMPT_COUNT | 153 | # ifdef CONFIG_PREEMPT_COUNT |
154 | VM_BUG_ON(!in_atomic()); | 154 | VM_BUG_ON(!in_atomic()); |
155 | # endif | 155 | # endif |
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h index a7b4fc386e63..3cc21c9cc1e8 100644 --- a/include/linux/pata_arasan_cf_data.h +++ b/include/linux/pata_arasan_cf_data.h | |||
@@ -37,8 +37,6 @@ struct arasan_cf_pdata { | |||
37 | #define CF_BROKEN_PIO (1) | 37 | #define CF_BROKEN_PIO (1) |
38 | #define CF_BROKEN_MWDMA (1 << 1) | 38 | #define CF_BROKEN_MWDMA (1 << 1) |
39 | #define CF_BROKEN_UDMA (1 << 2) | 39 | #define CF_BROKEN_UDMA (1 << 2) |
40 | /* This is platform specific data for the DMA controller */ | ||
41 | void *dma_priv; | ||
42 | }; | 40 | }; |
43 | 41 | ||
44 | static inline void | 42 | static inline void |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 9a22b5efb384..81b31613eb25 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -41,8 +41,37 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | |||
41 | 41 | ||
42 | return DEVICE_ACPI_HANDLE(dev); | 42 | return DEVICE_ACPI_HANDLE(dev); |
43 | } | 43 | } |
44 | |||
45 | void acpi_pci_add_bus(struct pci_bus *bus); | ||
46 | void acpi_pci_remove_bus(struct pci_bus *bus); | ||
47 | |||
48 | #ifdef CONFIG_ACPI_PCI_SLOT | ||
49 | void acpi_pci_slot_init(void); | ||
50 | void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); | ||
51 | void acpi_pci_slot_remove(struct pci_bus *bus); | ||
52 | #else | ||
53 | static inline void acpi_pci_slot_init(void) { } | ||
54 | static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, | ||
55 | acpi_handle handle) { } | ||
56 | static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } | ||
44 | #endif | 57 | #endif |
45 | 58 | ||
59 | #ifdef CONFIG_HOTPLUG_PCI_ACPI | ||
60 | void acpiphp_init(void); | ||
61 | void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); | ||
62 | void acpiphp_remove_slots(struct pci_bus *bus); | ||
63 | #else | ||
64 | static inline void acpiphp_init(void) { } | ||
65 | static inline void acpiphp_enumerate_slots(struct pci_bus *bus, | ||
66 | acpi_handle handle) { } | ||
67 | static inline void acpiphp_remove_slots(struct pci_bus *bus) { } | ||
68 | #endif | ||
69 | |||
70 | #else /* CONFIG_ACPI */ | ||
71 | static inline void acpi_pci_add_bus(struct pci_bus *bus) { } | ||
72 | static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } | ||
73 | #endif /* CONFIG_ACPI */ | ||
74 | |||
46 | #ifdef CONFIG_ACPI_APEI | 75 | #ifdef CONFIG_ACPI_APEI |
47 | extern bool aer_acpi_firmware_first(void); | 76 | extern bool aer_acpi_firmware_first(void); |
48 | #else | 77 | #else |
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index c8320144fe79..8af4610c2e41 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h | |||
@@ -23,14 +23,14 @@ | |||
23 | #define PCIE_LINK_STATE_CLKPM 4 | 23 | #define PCIE_LINK_STATE_CLKPM 4 |
24 | 24 | ||
25 | #ifdef CONFIG_PCIEASPM | 25 | #ifdef CONFIG_PCIEASPM |
26 | extern void pcie_aspm_init_link_state(struct pci_dev *pdev); | 26 | void pcie_aspm_init_link_state(struct pci_dev *pdev); |
27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); | 27 | void pcie_aspm_exit_link_state(struct pci_dev *pdev); |
28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | 28 | void pcie_aspm_pm_state_change(struct pci_dev *pdev); |
29 | extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); | 29 | void pcie_aspm_powersave_config_link(struct pci_dev *pdev); |
30 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | 30 | void pci_disable_link_state(struct pci_dev *pdev, int state); |
31 | extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); | 31 | void pci_disable_link_state_locked(struct pci_dev *pdev, int state); |
32 | extern void pcie_clear_aspm(struct pci_bus *bus); | 32 | void pcie_clear_aspm(struct pci_bus *bus); |
33 | extern void pcie_no_aspm(void); | 33 | void pcie_no_aspm(void); |
34 | #else | 34 | #else |
35 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) | 35 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) |
36 | { | 36 | { |
@@ -56,8 +56,8 @@ static inline void pcie_no_aspm(void) | |||
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ | 58 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ |
59 | extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); | 59 | void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); |
60 | extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); | 60 | void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); |
61 | #else | 61 | #else |
62 | static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) | 62 | static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) |
63 | { | 63 | { |
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index 7ef68724f0f0..68bcefd7fca0 100644 --- a/include/linux/pci-ats.h +++ b/include/linux/pci-ats.h | |||
@@ -14,9 +14,9 @@ struct pci_ats { | |||
14 | 14 | ||
15 | #ifdef CONFIG_PCI_ATS | 15 | #ifdef CONFIG_PCI_ATS |
16 | 16 | ||
17 | extern int pci_enable_ats(struct pci_dev *dev, int ps); | 17 | int pci_enable_ats(struct pci_dev *dev, int ps); |
18 | extern void pci_disable_ats(struct pci_dev *dev); | 18 | void pci_disable_ats(struct pci_dev *dev); |
19 | extern int pci_ats_queue_depth(struct pci_dev *dev); | 19 | int pci_ats_queue_depth(struct pci_dev *dev); |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * pci_ats_enabled - query the ATS status | 22 | * pci_ats_enabled - query the ATS status |
@@ -54,12 +54,12 @@ static inline int pci_ats_enabled(struct pci_dev *dev) | |||
54 | 54 | ||
55 | #ifdef CONFIG_PCI_PRI | 55 | #ifdef CONFIG_PCI_PRI |
56 | 56 | ||
57 | extern int pci_enable_pri(struct pci_dev *pdev, u32 reqs); | 57 | int pci_enable_pri(struct pci_dev *pdev, u32 reqs); |
58 | extern void pci_disable_pri(struct pci_dev *pdev); | 58 | void pci_disable_pri(struct pci_dev *pdev); |
59 | extern bool pci_pri_enabled(struct pci_dev *pdev); | 59 | bool pci_pri_enabled(struct pci_dev *pdev); |
60 | extern int pci_reset_pri(struct pci_dev *pdev); | 60 | int pci_reset_pri(struct pci_dev *pdev); |
61 | extern bool pci_pri_stopped(struct pci_dev *pdev); | 61 | bool pci_pri_stopped(struct pci_dev *pdev); |
62 | extern int pci_pri_status(struct pci_dev *pdev); | 62 | int pci_pri_status(struct pci_dev *pdev); |
63 | 63 | ||
64 | #else /* CONFIG_PCI_PRI */ | 64 | #else /* CONFIG_PCI_PRI */ |
65 | 65 | ||
@@ -95,10 +95,10 @@ static inline int pci_pri_status(struct pci_dev *pdev) | |||
95 | 95 | ||
96 | #ifdef CONFIG_PCI_PASID | 96 | #ifdef CONFIG_PCI_PASID |
97 | 97 | ||
98 | extern int pci_enable_pasid(struct pci_dev *pdev, int features); | 98 | int pci_enable_pasid(struct pci_dev *pdev, int features); |
99 | extern void pci_disable_pasid(struct pci_dev *pdev); | 99 | void pci_disable_pasid(struct pci_dev *pdev); |
100 | extern int pci_pasid_features(struct pci_dev *pdev); | 100 | int pci_pasid_features(struct pci_dev *pdev); |
101 | extern int pci_max_pasids(struct pci_dev *pdev); | 101 | int pci_max_pasids(struct pci_dev *pdev); |
102 | 102 | ||
103 | #else /* CONFIG_PCI_PASID */ | 103 | #else /* CONFIG_PCI_PASID */ |
104 | 104 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 710067f3618c..3a24e4ff3248 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -35,6 +35,21 @@ | |||
35 | /* Include the ID list */ | 35 | /* Include the ID list */ |
36 | #include <linux/pci_ids.h> | 36 | #include <linux/pci_ids.h> |
37 | 37 | ||
38 | /* | ||
39 | * The PCI interface treats multi-function devices as independent | ||
40 | * devices. The slot/function address of each device is encoded | ||
41 | * in a single byte as follows: | ||
42 | * | ||
43 | * 7:3 = slot | ||
44 | * 2:0 = function | ||
45 | * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined uapi/linux/pci.h | ||
46 | * In the interest of not exposing interfaces to user-space unnecessarily, | ||
47 | * the following kernel only defines are being added here. | ||
48 | */ | ||
49 | #define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) | ||
50 | /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ | ||
51 | #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) | ||
52 | |||
38 | /* pci_slot represents a physical slot */ | 53 | /* pci_slot represents a physical slot */ |
39 | struct pci_slot { | 54 | struct pci_slot { |
40 | struct pci_bus *bus; /* The bus this slot is on */ | 55 | struct pci_bus *bus; /* The bus this slot is on */ |
@@ -232,6 +247,8 @@ struct pci_dev { | |||
232 | u8 revision; /* PCI revision, low byte of class word */ | 247 | u8 revision; /* PCI revision, low byte of class word */ |
233 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ | 248 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ |
234 | u8 pcie_cap; /* PCI-E capability offset */ | 249 | u8 pcie_cap; /* PCI-E capability offset */ |
250 | u8 msi_cap; /* MSI capability offset */ | ||
251 | u8 msix_cap; /* MSI-X capability offset */ | ||
235 | u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ | 252 | u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ |
236 | u8 rom_base_reg; /* which config register controls the ROM */ | 253 | u8 rom_base_reg; /* which config register controls the ROM */ |
237 | u8 pin; /* which interrupt pin this device uses */ | 254 | u8 pin; /* which interrupt pin this device uses */ |
@@ -249,8 +266,7 @@ struct pci_dev { | |||
249 | pci_power_t current_state; /* Current operating state. In ACPI-speak, | 266 | pci_power_t current_state; /* Current operating state. In ACPI-speak, |
250 | this is D0-D3, D0 being fully functional, | 267 | this is D0-D3, D0 being fully functional, |
251 | and D3 being off. */ | 268 | and D3 being off. */ |
252 | int pm_cap; /* PM capability offset in the | 269 | u8 pm_cap; /* PM capability offset */ |
253 | configuration space */ | ||
254 | unsigned int pme_support:5; /* Bitmask of states from which PME# | 270 | unsigned int pme_support:5; /* Bitmask of states from which PME# |
255 | can be generated */ | 271 | can be generated */ |
256 | unsigned int pme_interrupt:1; | 272 | unsigned int pme_interrupt:1; |
@@ -348,7 +364,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev) | |||
348 | return dev; | 364 | return dev; |
349 | } | 365 | } |
350 | 366 | ||
351 | extern struct pci_dev *alloc_pci_dev(void); | 367 | struct pci_dev *alloc_pci_dev(void); |
352 | 368 | ||
353 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) | 369 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
354 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) | 370 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) |
@@ -504,10 +520,10 @@ struct pci_ops { | |||
504 | * ACPI needs to be able to access PCI config space before we've done a | 520 | * ACPI needs to be able to access PCI config space before we've done a |
505 | * PCI bus scan and created pci_bus structures. | 521 | * PCI bus scan and created pci_bus structures. |
506 | */ | 522 | */ |
507 | extern int raw_pci_read(unsigned int domain, unsigned int bus, | 523 | int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, |
508 | unsigned int devfn, int reg, int len, u32 *val); | 524 | int reg, int len, u32 *val); |
509 | extern int raw_pci_write(unsigned int domain, unsigned int bus, | 525 | int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, |
510 | unsigned int devfn, int reg, int len, u32 val); | 526 | int reg, int len, u32 val); |
511 | 527 | ||
512 | struct pci_bus_region { | 528 | struct pci_bus_region { |
513 | resource_size_t start; | 529 | resource_size_t start; |
@@ -658,7 +674,7 @@ struct pci_driver { | |||
658 | /* these external functions are only available when PCI support is enabled */ | 674 | /* these external functions are only available when PCI support is enabled */ |
659 | #ifdef CONFIG_PCI | 675 | #ifdef CONFIG_PCI |
660 | 676 | ||
661 | extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); | 677 | void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); |
662 | 678 | ||
663 | enum pcie_bus_config_types { | 679 | enum pcie_bus_config_types { |
664 | PCIE_BUS_TUNE_OFF, | 680 | PCIE_BUS_TUNE_OFF, |
@@ -675,9 +691,11 @@ extern struct bus_type pci_bus_type; | |||
675 | * code, or pci core code. */ | 691 | * code, or pci core code. */ |
676 | extern struct list_head pci_root_buses; /* list of all known PCI buses */ | 692 | extern struct list_head pci_root_buses; /* list of all known PCI buses */ |
677 | /* Some device drivers need know if pci is initiated */ | 693 | /* Some device drivers need know if pci is initiated */ |
678 | extern int no_pci_devices(void); | 694 | int no_pci_devices(void); |
679 | 695 | ||
680 | void pcibios_resource_survey_bus(struct pci_bus *bus); | 696 | void pcibios_resource_survey_bus(struct pci_bus *bus); |
697 | void pcibios_add_bus(struct pci_bus *bus); | ||
698 | void pcibios_remove_bus(struct pci_bus *bus); | ||
681 | void pcibios_fixup_bus(struct pci_bus *); | 699 | void pcibios_fixup_bus(struct pci_bus *); |
682 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); | 700 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); |
683 | /* Architecture specific versions may override this (weak) */ | 701 | /* Architecture specific versions may override this (weak) */ |
@@ -699,7 +717,7 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | |||
699 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | 717 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, |
700 | struct pci_bus_region *region); | 718 | struct pci_bus_region *region); |
701 | void pcibios_scan_specific_bus(int busn); | 719 | void pcibios_scan_specific_bus(int busn); |
702 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 720 | struct pci_bus *pci_find_bus(int domain, int busnr); |
703 | void pci_bus_add_devices(const struct pci_bus *bus); | 721 | void pci_bus_add_devices(const struct pci_bus *bus); |
704 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, | 722 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, |
705 | struct pci_ops *ops, void *sysdata); | 723 | struct pci_ops *ops, void *sysdata); |
@@ -732,14 +750,14 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev, | |||
732 | u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); | 750 | u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); |
733 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); | 751 | int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); |
734 | u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); | 752 | u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); |
735 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | 753 | struct pci_dev *pci_dev_get(struct pci_dev *dev); |
736 | extern void pci_dev_put(struct pci_dev *dev); | 754 | void pci_dev_put(struct pci_dev *dev); |
737 | extern void pci_remove_bus(struct pci_bus *b); | 755 | void pci_remove_bus(struct pci_bus *b); |
738 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); | 756 | void pci_stop_and_remove_bus_device(struct pci_dev *dev); |
739 | void pci_stop_root_bus(struct pci_bus *bus); | 757 | void pci_stop_root_bus(struct pci_bus *bus); |
740 | void pci_remove_root_bus(struct pci_bus *bus); | 758 | void pci_remove_root_bus(struct pci_bus *bus); |
741 | void pci_setup_cardbus(struct pci_bus *bus); | 759 | void pci_setup_cardbus(struct pci_bus *bus); |
742 | extern void pci_sort_breadthfirst(void); | 760 | void pci_sort_breadthfirst(void); |
743 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) | 761 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) |
744 | #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) | 762 | #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) |
745 | #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) | 763 | #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) |
@@ -1142,18 +1160,17 @@ static inline int pci_msi_enabled(void) | |||
1142 | return 0; | 1160 | return 0; |
1143 | } | 1161 | } |
1144 | #else | 1162 | #else |
1145 | extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); | 1163 | int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); |
1146 | extern int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); | 1164 | int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); |
1147 | extern void pci_msi_shutdown(struct pci_dev *dev); | 1165 | void pci_msi_shutdown(struct pci_dev *dev); |
1148 | extern void pci_disable_msi(struct pci_dev *dev); | 1166 | void pci_disable_msi(struct pci_dev *dev); |
1149 | extern int pci_msix_table_size(struct pci_dev *dev); | 1167 | int pci_msix_table_size(struct pci_dev *dev); |
1150 | extern int pci_enable_msix(struct pci_dev *dev, | 1168 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); |
1151 | struct msix_entry *entries, int nvec); | 1169 | void pci_msix_shutdown(struct pci_dev *dev); |
1152 | extern void pci_msix_shutdown(struct pci_dev *dev); | 1170 | void pci_disable_msix(struct pci_dev *dev); |
1153 | extern void pci_disable_msix(struct pci_dev *dev); | 1171 | void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
1154 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 1172 | void pci_restore_msi_state(struct pci_dev *dev); |
1155 | extern void pci_restore_msi_state(struct pci_dev *dev); | 1173 | int pci_msi_enabled(void); |
1156 | extern int pci_msi_enabled(void); | ||
1157 | #endif | 1174 | #endif |
1158 | 1175 | ||
1159 | #ifdef CONFIG_PCIEPORTBUS | 1176 | #ifdef CONFIG_PCIEPORTBUS |
@@ -1168,8 +1185,8 @@ extern bool pcie_ports_auto; | |||
1168 | static inline int pcie_aspm_enabled(void) { return 0; } | 1185 | static inline int pcie_aspm_enabled(void) { return 0; } |
1169 | static inline bool pcie_aspm_support_enabled(void) { return false; } | 1186 | static inline bool pcie_aspm_support_enabled(void) { return false; } |
1170 | #else | 1187 | #else |
1171 | extern int pcie_aspm_enabled(void); | 1188 | int pcie_aspm_enabled(void); |
1172 | extern bool pcie_aspm_support_enabled(void); | 1189 | bool pcie_aspm_support_enabled(void); |
1173 | #endif | 1190 | #endif |
1174 | 1191 | ||
1175 | #ifdef CONFIG_PCIEAER | 1192 | #ifdef CONFIG_PCIEAER |
@@ -1187,8 +1204,8 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev) | |||
1187 | } | 1204 | } |
1188 | static inline void pcie_ecrc_get_policy(char *str) {}; | 1205 | static inline void pcie_ecrc_get_policy(char *str) {}; |
1189 | #else | 1206 | #else |
1190 | extern void pcie_set_ecrc_checking(struct pci_dev *dev); | 1207 | void pcie_set_ecrc_checking(struct pci_dev *dev); |
1191 | extern void pcie_ecrc_get_policy(char *str); | 1208 | void pcie_ecrc_get_policy(char *str); |
1192 | #endif | 1209 | #endif |
1193 | 1210 | ||
1194 | #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) | 1211 | #define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) |
@@ -1199,9 +1216,9 @@ int ht_create_irq(struct pci_dev *dev, int idx); | |||
1199 | void ht_destroy_irq(unsigned int irq); | 1216 | void ht_destroy_irq(unsigned int irq); |
1200 | #endif /* CONFIG_HT_IRQ */ | 1217 | #endif /* CONFIG_HT_IRQ */ |
1201 | 1218 | ||
1202 | extern void pci_cfg_access_lock(struct pci_dev *dev); | 1219 | void pci_cfg_access_lock(struct pci_dev *dev); |
1203 | extern bool pci_cfg_access_trylock(struct pci_dev *dev); | 1220 | bool pci_cfg_access_trylock(struct pci_dev *dev); |
1204 | extern void pci_cfg_access_unlock(struct pci_dev *dev); | 1221 | void pci_cfg_access_unlock(struct pci_dev *dev); |
1205 | 1222 | ||
1206 | /* | 1223 | /* |
1207 | * PCI domain support. Sometimes called PCI segment (eg by ACPI), | 1224 | * PCI domain support. Sometimes called PCI segment (eg by ACPI), |
@@ -1226,7 +1243,7 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
1226 | /* some architectures require additional setup to direct VGA traffic */ | 1243 | /* some architectures require additional setup to direct VGA traffic */ |
1227 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, | 1244 | typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, |
1228 | unsigned int command_bits, u32 flags); | 1245 | unsigned int command_bits, u32 flags); |
1229 | extern void pci_register_set_vga_state(arch_set_vga_state_t func); | 1246 | void pci_register_set_vga_state(arch_set_vga_state_t func); |
1230 | 1247 | ||
1231 | #else /* CONFIG_PCI is not enabled */ | 1248 | #else /* CONFIG_PCI is not enabled */ |
1232 | 1249 | ||
@@ -1628,8 +1645,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, | |||
1628 | int pcibios_add_device(struct pci_dev *dev); | 1645 | int pcibios_add_device(struct pci_dev *dev); |
1629 | 1646 | ||
1630 | #ifdef CONFIG_PCI_MMCONFIG | 1647 | #ifdef CONFIG_PCI_MMCONFIG |
1631 | extern void __init pci_mmcfg_early_init(void); | 1648 | void __init pci_mmcfg_early_init(void); |
1632 | extern void __init pci_mmcfg_late_init(void); | 1649 | void __init pci_mmcfg_late_init(void); |
1633 | #else | 1650 | #else |
1634 | static inline void pci_mmcfg_early_init(void) { } | 1651 | static inline void pci_mmcfg_early_init(void) { } |
1635 | static inline void pci_mmcfg_late_init(void) { } | 1652 | static inline void pci_mmcfg_late_init(void) { } |
@@ -1640,12 +1657,13 @@ int pci_ext_cfg_avail(void); | |||
1640 | void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); | 1657 | void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); |
1641 | 1658 | ||
1642 | #ifdef CONFIG_PCI_IOV | 1659 | #ifdef CONFIG_PCI_IOV |
1643 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | 1660 | int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); |
1644 | extern void pci_disable_sriov(struct pci_dev *dev); | 1661 | void pci_disable_sriov(struct pci_dev *dev); |
1645 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); | 1662 | irqreturn_t pci_sriov_migration(struct pci_dev *dev); |
1646 | extern int pci_num_vf(struct pci_dev *dev); | 1663 | int pci_num_vf(struct pci_dev *dev); |
1647 | extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); | 1664 | int pci_vfs_assigned(struct pci_dev *dev); |
1648 | extern int pci_sriov_get_totalvfs(struct pci_dev *dev); | 1665 | int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); |
1666 | int pci_sriov_get_totalvfs(struct pci_dev *dev); | ||
1649 | #else | 1667 | #else |
1650 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1668 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
1651 | { | 1669 | { |
@@ -1662,6 +1680,10 @@ static inline int pci_num_vf(struct pci_dev *dev) | |||
1662 | { | 1680 | { |
1663 | return 0; | 1681 | return 0; |
1664 | } | 1682 | } |
1683 | static inline int pci_vfs_assigned(struct pci_dev *dev) | ||
1684 | { | ||
1685 | return 0; | ||
1686 | } | ||
1665 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) | 1687 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) |
1666 | { | 1688 | { |
1667 | return 0; | 1689 | return 0; |
@@ -1673,8 +1695,8 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) | |||
1673 | #endif | 1695 | #endif |
1674 | 1696 | ||
1675 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | 1697 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) |
1676 | extern void pci_hp_create_module_link(struct pci_slot *pci_slot); | 1698 | void pci_hp_create_module_link(struct pci_slot *pci_slot); |
1677 | extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); | 1699 | void pci_hp_remove_module_link(struct pci_slot *pci_slot); |
1678 | #endif | 1700 | #endif |
1679 | 1701 | ||
1680 | /** | 1702 | /** |
@@ -1818,13 +1840,13 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, | |||
1818 | /* PCI <-> OF binding helpers */ | 1840 | /* PCI <-> OF binding helpers */ |
1819 | #ifdef CONFIG_OF | 1841 | #ifdef CONFIG_OF |
1820 | struct device_node; | 1842 | struct device_node; |
1821 | extern void pci_set_of_node(struct pci_dev *dev); | 1843 | void pci_set_of_node(struct pci_dev *dev); |
1822 | extern void pci_release_of_node(struct pci_dev *dev); | 1844 | void pci_release_of_node(struct pci_dev *dev); |
1823 | extern void pci_set_bus_of_node(struct pci_bus *bus); | 1845 | void pci_set_bus_of_node(struct pci_bus *bus); |
1824 | extern void pci_release_bus_of_node(struct pci_bus *bus); | 1846 | void pci_release_bus_of_node(struct pci_bus *bus); |
1825 | 1847 | ||
1826 | /* Arch may override this (weak) */ | 1848 | /* Arch may override this (weak) */ |
1827 | extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus); | 1849 | struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); |
1828 | 1850 | ||
1829 | static inline struct device_node * | 1851 | static inline struct device_node * |
1830 | pci_device_to_OF_node(const struct pci_dev *pdev) | 1852 | pci_device_to_OF_node(const struct pci_dev *pdev) |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 45fc162cbdc0..8db71dcd6337 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
@@ -125,12 +125,12 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) | |||
125 | return pci_slot_name(slot->pci_slot); | 125 | return pci_slot_name(slot->pci_slot); |
126 | } | 126 | } |
127 | 127 | ||
128 | extern int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, | 128 | int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr, |
129 | int nr, const char *name, | 129 | const char *name, struct module *owner, |
130 | struct module *owner, const char *mod_name); | 130 | const char *mod_name); |
131 | extern int pci_hp_deregister(struct hotplug_slot *slot); | 131 | int pci_hp_deregister(struct hotplug_slot *slot); |
132 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, | 132 | int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot, |
133 | struct hotplug_slot_info *info); | 133 | struct hotplug_slot_info *info); |
134 | 134 | ||
135 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ | 135 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
136 | #define pci_hp_register(slot, pbus, devnr, name) \ | 136 | #define pci_hp_register(slot, pbus, devnr, name) \ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index f11c1c2609d5..c12916248469 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -524,6 +524,8 @@ | |||
524 | #define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 | 524 | #define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 |
525 | #define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 | 525 | #define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 |
526 | #define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 | 526 | #define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 |
527 | #define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533 | ||
528 | #define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534 | ||
527 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 | 529 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 |
528 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 | 530 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 |
529 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 | 531 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 |
@@ -1604,6 +1606,7 @@ | |||
1604 | #define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 | 1606 | #define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 |
1605 | 1607 | ||
1606 | #define PCI_VENDOR_ID_MARVELL 0x11ab | 1608 | #define PCI_VENDOR_ID_MARVELL 0x11ab |
1609 | #define PCI_VENDOR_ID_MARVELL_EXT 0x1b4b | ||
1607 | #define PCI_DEVICE_ID_MARVELL_GT64111 0x4146 | 1610 | #define PCI_DEVICE_ID_MARVELL_GT64111 0x4146 |
1608 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 | 1611 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 |
1609 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 | 1612 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 |
@@ -2144,11 +2147,13 @@ | |||
2144 | #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e | 2147 | #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e |
2145 | #define PCI_DEVICE_ID_NX2_57712 0x1662 | 2148 | #define PCI_DEVICE_ID_NX2_57712 0x1662 |
2146 | #define PCI_DEVICE_ID_NX2_57712E 0x1663 | 2149 | #define PCI_DEVICE_ID_NX2_57712E 0x1663 |
2150 | #define PCI_DEVICE_ID_NX2_57712_MF 0x1663 | ||
2147 | #define PCI_DEVICE_ID_TIGON3_5714 0x1668 | 2151 | #define PCI_DEVICE_ID_TIGON3_5714 0x1668 |
2148 | #define PCI_DEVICE_ID_TIGON3_5714S 0x1669 | 2152 | #define PCI_DEVICE_ID_TIGON3_5714S 0x1669 |
2149 | #define PCI_DEVICE_ID_TIGON3_5780 0x166a | 2153 | #define PCI_DEVICE_ID_TIGON3_5780 0x166a |
2150 | #define PCI_DEVICE_ID_TIGON3_5780S 0x166b | 2154 | #define PCI_DEVICE_ID_TIGON3_5780S 0x166b |
2151 | #define PCI_DEVICE_ID_TIGON3_5705F 0x166e | 2155 | #define PCI_DEVICE_ID_TIGON3_5705F 0x166e |
2156 | #define PCI_DEVICE_ID_NX2_57712_VF 0x166f | ||
2152 | #define PCI_DEVICE_ID_TIGON3_5754M 0x1672 | 2157 | #define PCI_DEVICE_ID_TIGON3_5754M 0x1672 |
2153 | #define PCI_DEVICE_ID_TIGON3_5755M 0x1673 | 2158 | #define PCI_DEVICE_ID_TIGON3_5755M 0x1673 |
2154 | #define PCI_DEVICE_ID_TIGON3_5756 0x1674 | 2159 | #define PCI_DEVICE_ID_TIGON3_5756 0x1674 |
@@ -2174,13 +2179,15 @@ | |||
2174 | #define PCI_DEVICE_ID_TIGON3_5787 0x169b | 2179 | #define PCI_DEVICE_ID_TIGON3_5787 0x169b |
2175 | #define PCI_DEVICE_ID_TIGON3_5788 0x169c | 2180 | #define PCI_DEVICE_ID_TIGON3_5788 0x169c |
2176 | #define PCI_DEVICE_ID_TIGON3_5789 0x169d | 2181 | #define PCI_DEVICE_ID_TIGON3_5789 0x169d |
2182 | #define PCI_DEVICE_ID_NX2_57840_4_10 0x16a1 | ||
2183 | #define PCI_DEVICE_ID_NX2_57840_2_20 0x16a2 | ||
2184 | #define PCI_DEVICE_ID_NX2_57840_MF 0x16a4 | ||
2177 | #define PCI_DEVICE_ID_NX2_57800_MF 0x16a5 | 2185 | #define PCI_DEVICE_ID_NX2_57800_MF 0x16a5 |
2178 | #define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 | 2186 | #define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 |
2179 | #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 | 2187 | #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 |
2180 | #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 | 2188 | #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 |
2181 | #define PCI_DEVICE_ID_NX2_57800_VF 0x16a9 | 2189 | #define PCI_DEVICE_ID_NX2_57800_VF 0x16a9 |
2182 | #define PCI_DEVICE_ID_NX2_5706S 0x16aa | 2190 | #define PCI_DEVICE_ID_NX2_5706S 0x16aa |
2183 | #define PCI_DEVICE_ID_NX2_57840_MF 0x16a4 | ||
2184 | #define PCI_DEVICE_ID_NX2_5708S 0x16ac | 2191 | #define PCI_DEVICE_ID_NX2_5708S 0x16ac |
2185 | #define PCI_DEVICE_ID_NX2_57840_VF 0x16ad | 2192 | #define PCI_DEVICE_ID_NX2_57840_VF 0x16ad |
2186 | #define PCI_DEVICE_ID_NX2_57810_MF 0x16ae | 2193 | #define PCI_DEVICE_ID_NX2_57810_MF 0x16ae |
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index e6f91b1406d8..9572669eea97 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h | |||
@@ -62,7 +62,7 @@ struct pcie_port_service_driver { | |||
62 | #define to_service_driver(d) \ | 62 | #define to_service_driver(d) \ |
63 | container_of(d, struct pcie_port_service_driver, driver) | 63 | container_of(d, struct pcie_port_service_driver, driver) |
64 | 64 | ||
65 | extern int pcie_port_service_register(struct pcie_port_service_driver *new); | 65 | int pcie_port_service_register(struct pcie_port_service_driver *new); |
66 | extern void pcie_port_service_unregister(struct pcie_port_service_driver *new); | 66 | void pcie_port_service_unregister(struct pcie_port_service_driver *new); |
67 | 67 | ||
68 | #endif /* _PCIEPORT_IF_H_ */ | 68 | #endif /* _PCIEPORT_IF_H_ */ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 1d795df6f4cf..f463a46424e2 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -21,7 +21,6 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifdef CONFIG_PERF_EVENTS | 23 | #ifdef CONFIG_PERF_EVENTS |
24 | # include <linux/cgroup.h> | ||
25 | # include <asm/perf_event.h> | 24 | # include <asm/perf_event.h> |
26 | # include <asm/local64.h> | 25 | # include <asm/local64.h> |
27 | #endif | 26 | #endif |
@@ -128,6 +127,7 @@ struct hw_perf_event { | |||
128 | int event_base_rdpmc; | 127 | int event_base_rdpmc; |
129 | int idx; | 128 | int idx; |
130 | int last_cpu; | 129 | int last_cpu; |
130 | int flags; | ||
131 | 131 | ||
132 | struct hw_perf_event_extra extra_reg; | 132 | struct hw_perf_event_extra extra_reg; |
133 | struct hw_perf_event_extra branch_reg; | 133 | struct hw_perf_event_extra branch_reg; |
@@ -299,22 +299,7 @@ struct swevent_hlist { | |||
299 | #define PERF_ATTACH_GROUP 0x02 | 299 | #define PERF_ATTACH_GROUP 0x02 |
300 | #define PERF_ATTACH_TASK 0x04 | 300 | #define PERF_ATTACH_TASK 0x04 |
301 | 301 | ||
302 | #ifdef CONFIG_CGROUP_PERF | 302 | struct perf_cgroup; |
303 | /* | ||
304 | * perf_cgroup_info keeps track of time_enabled for a cgroup. | ||
305 | * This is a per-cpu dynamically allocated data structure. | ||
306 | */ | ||
307 | struct perf_cgroup_info { | ||
308 | u64 time; | ||
309 | u64 timestamp; | ||
310 | }; | ||
311 | |||
312 | struct perf_cgroup { | ||
313 | struct cgroup_subsys_state css; | ||
314 | struct perf_cgroup_info *info; /* timing info, one per cpu */ | ||
315 | }; | ||
316 | #endif | ||
317 | |||
318 | struct ring_buffer; | 303 | struct ring_buffer; |
319 | 304 | ||
320 | /** | 305 | /** |
@@ -583,11 +568,13 @@ struct perf_sample_data { | |||
583 | u32 reserved; | 568 | u32 reserved; |
584 | } cpu_entry; | 569 | } cpu_entry; |
585 | u64 period; | 570 | u64 period; |
571 | union perf_mem_data_src data_src; | ||
586 | struct perf_callchain_entry *callchain; | 572 | struct perf_callchain_entry *callchain; |
587 | struct perf_raw_record *raw; | 573 | struct perf_raw_record *raw; |
588 | struct perf_branch_stack *br_stack; | 574 | struct perf_branch_stack *br_stack; |
589 | struct perf_regs_user regs_user; | 575 | struct perf_regs_user regs_user; |
590 | u64 stack_user_size; | 576 | u64 stack_user_size; |
577 | u64 weight; | ||
591 | }; | 578 | }; |
592 | 579 | ||
593 | static inline void perf_sample_data_init(struct perf_sample_data *data, | 580 | static inline void perf_sample_data_init(struct perf_sample_data *data, |
@@ -601,6 +588,8 @@ static inline void perf_sample_data_init(struct perf_sample_data *data, | |||
601 | data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE; | 588 | data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE; |
602 | data->regs_user.regs = NULL; | 589 | data->regs_user.regs = NULL; |
603 | data->stack_user_size = 0; | 590 | data->stack_user_size = 0; |
591 | data->weight = 0; | ||
592 | data->data_src.val = 0; | ||
604 | } | 593 | } |
605 | 594 | ||
606 | extern void perf_output_sample(struct perf_output_handle *handle, | 595 | extern void perf_output_sample(struct perf_output_handle *handle, |
@@ -799,6 +788,12 @@ static inline int __perf_event_disable(void *info) { return -1; } | |||
799 | static inline void perf_event_task_tick(void) { } | 788 | static inline void perf_event_task_tick(void) { } |
800 | #endif | 789 | #endif |
801 | 790 | ||
791 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_NO_HZ_FULL) | ||
792 | extern bool perf_event_can_stop_tick(void); | ||
793 | #else | ||
794 | static inline bool perf_event_can_stop_tick(void) { return true; } | ||
795 | #endif | ||
796 | |||
802 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) | 797 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) |
803 | extern void perf_restore_debug_store(void); | 798 | extern void perf_restore_debug_store(void); |
804 | #else | 799 | #else |
@@ -831,6 +826,7 @@ do { \ | |||
831 | struct perf_pmu_events_attr { | 826 | struct perf_pmu_events_attr { |
832 | struct device_attribute attr; | 827 | struct device_attribute attr; |
833 | u64 id; | 828 | u64 id; |
829 | const char *event_str; | ||
834 | }; | 830 | }; |
835 | 831 | ||
836 | #define PMU_EVENT_ATTR(_name, _var, _id, _show) \ | 832 | #define PMU_EVENT_ATTR(_name, _var, _id, _show) \ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 33999adbf8c8..9e11039dd7a3 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -455,6 +455,14 @@ struct phy_driver { | |||
455 | */ | 455 | */ |
456 | void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); | 456 | void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); |
457 | 457 | ||
458 | /* Some devices (e.g. qnap TS-119P II) require PHY register changes to | ||
459 | * enable Wake on LAN, so set_wol is provided to be called in the | ||
460 | * ethernet driver's set_wol function. */ | ||
461 | int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); | ||
462 | |||
463 | /* See set_wol, but for checking whether Wake on LAN is enabled. */ | ||
464 | void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); | ||
465 | |||
458 | struct device_driver driver; | 466 | struct device_driver driver; |
459 | }; | 467 | }; |
460 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 468 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |
@@ -560,6 +568,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable); | |||
560 | int phy_get_eee_err(struct phy_device *phydev); | 568 | int phy_get_eee_err(struct phy_device *phydev); |
561 | int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); | 569 | int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data); |
562 | int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); | 570 | int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); |
571 | int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); | ||
572 | void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); | ||
563 | 573 | ||
564 | int __init mdio_bus_init(void); | 574 | int __init mdio_bus_init(void); |
565 | void mdio_bus_exit(void); | 575 | void mdio_bus_exit(void); |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 215e5e3dda10..e2772666f004 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/bug.h> | 5 | #include <linux/bug.h> |
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
7 | #include <linux/workqueue.h> | ||
7 | #include <linux/threads.h> | 8 | #include <linux/threads.h> |
8 | #include <linux/nsproxy.h> | 9 | #include <linux/nsproxy.h> |
9 | #include <linux/kref.h> | 10 | #include <linux/kref.h> |
@@ -13,7 +14,9 @@ struct pidmap { | |||
13 | void *page; | 14 | void *page; |
14 | }; | 15 | }; |
15 | 16 | ||
16 | #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) | 17 | #define BITS_PER_PAGE (PAGE_SIZE * 8) |
18 | #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) | ||
19 | #define PIDMAP_ENTRIES ((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE) | ||
17 | 20 | ||
18 | struct bsd_acct_struct; | 21 | struct bsd_acct_struct; |
19 | 22 | ||
@@ -28,6 +31,7 @@ struct pid_namespace { | |||
28 | struct pid_namespace *parent; | 31 | struct pid_namespace *parent; |
29 | #ifdef CONFIG_PROC_FS | 32 | #ifdef CONFIG_PROC_FS |
30 | struct vfsmount *proc_mnt; | 33 | struct vfsmount *proc_mnt; |
34 | struct dentry *proc_self; | ||
31 | #endif | 35 | #endif |
32 | #ifdef CONFIG_BSD_PROCESS_ACCT | 36 | #ifdef CONFIG_BSD_PROCESS_ACCT |
33 | struct bsd_acct_struct *bacct; | 37 | struct bsd_acct_struct *bacct; |
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index e7a720104a47..1ad4f31ef6b8 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h | |||
@@ -14,6 +14,8 @@ | |||
14 | 14 | ||
15 | #ifdef CONFIG_PINCONF | 15 | #ifdef CONFIG_PINCONF |
16 | 16 | ||
17 | #include <linux/pinctrl/machine.h> | ||
18 | |||
17 | struct pinctrl_dev; | 19 | struct pinctrl_dev; |
18 | struct seq_file; | 20 | struct seq_file; |
19 | 21 | ||
@@ -28,6 +30,7 @@ struct seq_file; | |||
28 | * @pin_config_set: configure an individual pin | 30 | * @pin_config_set: configure an individual pin |
29 | * @pin_config_group_get: get configurations for an entire pin group | 31 | * @pin_config_group_get: get configurations for an entire pin group |
30 | * @pin_config_group_set: configure all pins in a group | 32 | * @pin_config_group_set: configure all pins in a group |
33 | * @pin_config_group_dbg_set: optional debugfs to modify a pin configuration | ||
31 | * @pin_config_dbg_show: optional debugfs display hook that will provide | 34 | * @pin_config_dbg_show: optional debugfs display hook that will provide |
32 | * per-device info for a certain pin in debugfs | 35 | * per-device info for a certain pin in debugfs |
33 | * @pin_config_group_dbg_show: optional debugfs display hook that will provide | 36 | * @pin_config_group_dbg_show: optional debugfs display hook that will provide |
@@ -51,6 +54,9 @@ struct pinconf_ops { | |||
51 | int (*pin_config_group_set) (struct pinctrl_dev *pctldev, | 54 | int (*pin_config_group_set) (struct pinctrl_dev *pctldev, |
52 | unsigned selector, | 55 | unsigned selector, |
53 | unsigned long config); | 56 | unsigned long config); |
57 | int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev, | ||
58 | const char *arg, | ||
59 | unsigned long *config); | ||
54 | void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, | 60 | void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, |
55 | struct seq_file *s, | 61 | struct seq_file *s, |
56 | unsigned offset); | 62 | unsigned offset); |
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 778804df293f..2c2a9e8d8578 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
@@ -118,9 +118,9 @@ struct pinctrl_desc { | |||
118 | const char *name; | 118 | const char *name; |
119 | struct pinctrl_pin_desc const *pins; | 119 | struct pinctrl_pin_desc const *pins; |
120 | unsigned int npins; | 120 | unsigned int npins; |
121 | struct pinctrl_ops *pctlops; | 121 | const struct pinctrl_ops *pctlops; |
122 | struct pinmux_ops *pmxops; | 122 | const struct pinmux_ops *pmxops; |
123 | struct pinconf_ops *confops; | 123 | const struct pinconf_ops *confops; |
124 | struct module *owner; | 124 | struct module *owner; |
125 | }; | 125 | }; |
126 | 126 | ||
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index ad1a427b5267..b8809fef61f5 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -27,6 +27,7 @@ struct pipe_buffer { | |||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * struct pipe_inode_info - a linux kernel pipe | 29 | * struct pipe_inode_info - a linux kernel pipe |
30 | * @mutex: mutex protecting the whole thing | ||
30 | * @wait: reader/writer wait point in case of empty/full pipe | 31 | * @wait: reader/writer wait point in case of empty/full pipe |
31 | * @nrbufs: the number of non-empty pipe buffers in this pipe | 32 | * @nrbufs: the number of non-empty pipe buffers in this pipe |
32 | * @buffers: total number of buffers (should be a power of 2) | 33 | * @buffers: total number of buffers (should be a power of 2) |
@@ -34,26 +35,27 @@ struct pipe_buffer { | |||
34 | * @tmp_page: cached released page | 35 | * @tmp_page: cached released page |
35 | * @readers: number of current readers of this pipe | 36 | * @readers: number of current readers of this pipe |
36 | * @writers: number of current writers of this pipe | 37 | * @writers: number of current writers of this pipe |
38 | * @files: number of struct file refering this pipe (protected by ->i_lock) | ||
37 | * @waiting_writers: number of writers blocked waiting for room | 39 | * @waiting_writers: number of writers blocked waiting for room |
38 | * @r_counter: reader counter | 40 | * @r_counter: reader counter |
39 | * @w_counter: writer counter | 41 | * @w_counter: writer counter |
40 | * @fasync_readers: reader side fasync | 42 | * @fasync_readers: reader side fasync |
41 | * @fasync_writers: writer side fasync | 43 | * @fasync_writers: writer side fasync |
42 | * @inode: inode this pipe is attached to | ||
43 | * @bufs: the circular array of pipe buffers | 44 | * @bufs: the circular array of pipe buffers |
44 | **/ | 45 | **/ |
45 | struct pipe_inode_info { | 46 | struct pipe_inode_info { |
47 | struct mutex mutex; | ||
46 | wait_queue_head_t wait; | 48 | wait_queue_head_t wait; |
47 | unsigned int nrbufs, curbuf, buffers; | 49 | unsigned int nrbufs, curbuf, buffers; |
48 | unsigned int readers; | 50 | unsigned int readers; |
49 | unsigned int writers; | 51 | unsigned int writers; |
52 | unsigned int files; | ||
50 | unsigned int waiting_writers; | 53 | unsigned int waiting_writers; |
51 | unsigned int r_counter; | 54 | unsigned int r_counter; |
52 | unsigned int w_counter; | 55 | unsigned int w_counter; |
53 | struct page *tmp_page; | 56 | struct page *tmp_page; |
54 | struct fasync_struct *fasync_readers; | 57 | struct fasync_struct *fasync_readers; |
55 | struct fasync_struct *fasync_writers; | 58 | struct fasync_struct *fasync_writers; |
56 | struct inode *inode; | ||
57 | struct pipe_buffer *bufs; | 59 | struct pipe_buffer *bufs; |
58 | }; | 60 | }; |
59 | 61 | ||
@@ -144,9 +146,8 @@ int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *); | |||
144 | /* Drop the inode semaphore and wait for a pipe event, atomically */ | 146 | /* Drop the inode semaphore and wait for a pipe event, atomically */ |
145 | void pipe_wait(struct pipe_inode_info *pipe); | 147 | void pipe_wait(struct pipe_inode_info *pipe); |
146 | 148 | ||
147 | struct pipe_inode_info * alloc_pipe_info(struct inode * inode); | 149 | struct pipe_inode_info *alloc_pipe_info(void); |
148 | void free_pipe_info(struct inode * inode); | 150 | void free_pipe_info(struct pipe_inode_info *); |
149 | void __free_pipe_info(struct pipe_inode_info *); | ||
150 | 151 | ||
151 | /* Generic pipe buffer ops functions */ | 152 | /* Generic pipe buffer ops functions */ |
152 | void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); | 153 | void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); |
diff --git a/include/linux/platform_data/arm-ux500-pm.h b/include/linux/platform_data/arm-ux500-pm.h new file mode 100644 index 000000000000..8dff64b29ec0 --- /dev/null +++ b/include/linux/platform_data/arm-ux500-pm.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010-2013 | ||
3 | * Author: Rickard Andersson <rickard.andersson@stericsson.com> for | ||
4 | * ST-Ericsson. | ||
5 | * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro. | ||
6 | * License terms: GNU General Public License (GPL) version 2 | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef ARM_UX500_PM_H | ||
11 | #define ARM_UX500_PM_H | ||
12 | |||
13 | int prcmu_gic_decouple(void); | ||
14 | int prcmu_gic_recouple(void); | ||
15 | bool prcmu_gic_pending_irq(void); | ||
16 | bool prcmu_pending_irq(void); | ||
17 | bool prcmu_is_cpu_in_wfi(int cpu); | ||
18 | int prcmu_copy_gic_settings(void); | ||
19 | void ux500_pm_init(u32 phy_base, u32 size); | ||
20 | |||
21 | #endif /* ARM_UX500_PM_H */ | ||
diff --git a/include/linux/platform_data/asoc-ux500-msp.h b/include/linux/platform_data/asoc-ux500-msp.h new file mode 100644 index 000000000000..9991aea3d577 --- /dev/null +++ b/include/linux/platform_data/asoc-ux500-msp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson | ||
5 | * License terms: GNU General Public License (GPL), version 2. | ||
6 | */ | ||
7 | |||
8 | #ifndef __MSP_H | ||
9 | #define __MSP_H | ||
10 | |||
11 | #include <linux/platform_data/dma-ste-dma40.h> | ||
12 | |||
13 | enum msp_i2s_id { | ||
14 | MSP_I2S_0 = 0, | ||
15 | MSP_I2S_1, | ||
16 | MSP_I2S_2, | ||
17 | MSP_I2S_3, | ||
18 | }; | ||
19 | |||
20 | /* Platform data structure for a MSP I2S-device */ | ||
21 | struct msp_i2s_platform_data { | ||
22 | enum msp_i2s_id id; | ||
23 | struct stedma40_chan_cfg *msp_i2s_dma_rx; | ||
24 | struct stedma40_chan_cfg *msp_i2s_dma_tx; | ||
25 | }; | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/platform_data/atmel-aes.h b/include/linux/platform_data/atmel-aes.h deleted file mode 100644 index ab68082fbcb0..000000000000 --- a/include/linux/platform_data/atmel-aes.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef __LINUX_ATMEL_AES_H | ||
2 | #define __LINUX_ATMEL_AES_H | ||
3 | |||
4 | #include <linux/platform_data/dma-atmel.h> | ||
5 | |||
6 | /** | ||
7 | * struct aes_dma_data - DMA data for AES | ||
8 | */ | ||
9 | struct aes_dma_data { | ||
10 | struct at_dma_slave txdata; | ||
11 | struct at_dma_slave rxdata; | ||
12 | }; | ||
13 | |||
14 | /** | ||
15 | * struct aes_platform_data - board-specific AES configuration | ||
16 | * @dma_slave: DMA slave interface to use in data transfers. | ||
17 | */ | ||
18 | struct aes_platform_data { | ||
19 | struct aes_dma_data *dma_slave; | ||
20 | }; | ||
21 | |||
22 | #endif /* __LINUX_ATMEL_AES_H */ | ||
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h new file mode 100644 index 000000000000..1ade657d5fc1 --- /dev/null +++ b/include/linux/platform_data/brcmfmac-sdio.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Broadcom Corporation | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_BRCMFMAC_PLATFORM_H | ||
18 | #define _LINUX_BRCMFMAC_PLATFORM_H | ||
19 | |||
20 | /* | ||
21 | * Platform specific driver functions and data. Through the platform specific | ||
22 | * device data functions can be provided to help the brcmfmac driver to | ||
23 | * operate with the device in combination with the used platform. | ||
24 | * | ||
25 | * Use the platform data in the following (similar) way: | ||
26 | * | ||
27 | * | ||
28 | #include <brcmfmac_platform.h> | ||
29 | |||
30 | |||
31 | static void brcmfmac_power_on(void) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | static void brcmfmac_power_off(void) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | static void brcmfmac_reset(void) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = { | ||
44 | .power_on = brcmfmac_power_on, | ||
45 | .power_off = brcmfmac_power_off, | ||
46 | .reset = brcmfmac_reset | ||
47 | }; | ||
48 | |||
49 | static struct platform_device brcmfmac_device = { | ||
50 | .name = BRCMFMAC_SDIO_PDATA_NAME, | ||
51 | .id = PLATFORM_DEVID_NONE, | ||
52 | .dev.platform_data = &brcmfmac_sdio_pdata | ||
53 | }; | ||
54 | |||
55 | void __init brcmfmac_init_pdata(void) | ||
56 | { | ||
57 | brcmfmac_sdio_pdata.oob_irq_supported = true; | ||
58 | brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB); | ||
59 | brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ | | ||
60 | IORESOURCE_IRQ_HIGHLEVEL; | ||
61 | platform_device_register(&brcmfmac_device); | ||
62 | } | ||
63 | * | ||
64 | * | ||
65 | * Note: the brcmfmac can be loaded as module or be statically built-in into | ||
66 | * the kernel. If built-in then do note that it uses module_init (and | ||
67 | * module_exit) routines which equal device_initcall. So if you intend to | ||
68 | * create a module with the platform specific data for the brcmfmac and have | ||
69 | * it built-in to the kernel then use a higher initcall then device_initcall | ||
70 | * (see init.h). If this is not done then brcmfmac will load without problems | ||
71 | * but will not pickup the platform data. | ||
72 | * | ||
73 | * When the driver does not "detect" platform driver data then it will continue | ||
74 | * without reporting anything and just assume there is no data needed. Which is | ||
75 | * probably true for most platforms. | ||
76 | * | ||
77 | * Explanation of the platform_data fields: | ||
78 | * | ||
79 | * drive_strength: is the preferred drive_strength to be used for the SDIO | ||
80 | * pins. If 0 then a default value will be used. This is the target drive | ||
81 | * strength, the exact drive strength which will be used depends on the | ||
82 | * capabilities of the device. | ||
83 | * | ||
84 | * oob_irq_supported: does the board have support for OOB interrupts. SDIO | ||
85 | * in-band interrupts are relatively slow and for having less overhead on | ||
86 | * interrupt processing an out of band interrupt can be used. If the HW | ||
87 | * supports this then enable this by setting this field to true and configure | ||
88 | * the oob related fields. | ||
89 | * | ||
90 | * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are | ||
91 | * used for registering the irq using request_irq function. | ||
92 | * | ||
93 | * power_on: This function is called by the brcmfmac when the module gets | ||
94 | * loaded. This can be particularly useful for low power devices. The platform | ||
95 | * spcific routine may for example decide to power up the complete device. | ||
96 | * If there is no use-case for this function then provide NULL. | ||
97 | * | ||
98 | * power_off: This function is called by the brcmfmac when the module gets | ||
99 | * unloaded. At this point the device can be powered down or otherwise be reset. | ||
100 | * So if an actual power_off is not supported but reset is then reset the device | ||
101 | * when this function gets called. This can be particularly useful for low power | ||
102 | * devices. If there is no use-case for this function (either power-down or | ||
103 | * reset) then provide NULL. | ||
104 | * | ||
105 | * reset: This function can get called if the device communication broke down. | ||
106 | * This functionality is particularly useful in case of SDIO type devices. It is | ||
107 | * possible to reset a dongle via sdio data interface, but it requires that | ||
108 | * this is fully functional. This function is chip/module specific and this | ||
109 | * function should return only after the complete reset has completed. | ||
110 | */ | ||
111 | |||
112 | #define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio" | ||
113 | |||
114 | struct brcmfmac_sdio_platform_data { | ||
115 | unsigned int drive_strength; | ||
116 | bool oob_irq_supported; | ||
117 | unsigned int oob_irq_nr; | ||
118 | unsigned long oob_irq_flags; | ||
119 | void (*power_on)(void); | ||
120 | void (*power_off)(void); | ||
121 | void (*reset)(void); | ||
122 | }; | ||
123 | |||
124 | #endif /* _LINUX_BRCMFMAC_PLATFORM_H */ | ||
diff --git a/include/linux/platform_data/clk-lpss.h b/include/linux/platform_data/clk-lpss.h new file mode 100644 index 000000000000..528e73ce46d2 --- /dev/null +++ b/include/linux/platform_data/clk-lpss.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Intel Low Power Subsystem clocks. | ||
3 | * | ||
4 | * Copyright (C) 2013, Intel Corporation | ||
5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
6 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __CLK_LPSS_H | ||
14 | #define __CLK_LPSS_H | ||
15 | |||
16 | extern int lpt_clk_init(void); | ||
17 | |||
18 | #endif /* __CLK_LPSS_H */ | ||
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h index 3af0da1f3be5..320d9c39ea0a 100644 --- a/include/linux/platform_data/clk-ux500.h +++ b/include/linux/platform_data/clk-ux500.h | |||
@@ -10,7 +10,8 @@ | |||
10 | #ifndef __CLK_UX500_H | 10 | #ifndef __CLK_UX500_H |
11 | #define __CLK_UX500_H | 11 | #define __CLK_UX500_H |
12 | 12 | ||
13 | void u8500_clk_init(void); | 13 | void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, |
14 | u32 clkrst5_base, u32 clkrst6_base); | ||
14 | void u9540_clk_init(void); | 15 | void u9540_clk_init(void); |
15 | void u8540_clk_init(void); | 16 | void u8540_clk_init(void); |
16 | 17 | ||
diff --git a/include/linux/platform_data/coda.h b/include/linux/platform_data/coda.h new file mode 100644 index 000000000000..6ad4410d9e20 --- /dev/null +++ b/include/linux/platform_data/coda.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Philipp Zabel, Pengutronix | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | */ | ||
9 | #ifndef PLATFORM_CODA_H | ||
10 | #define PLATFORM_CODA_H | ||
11 | |||
12 | struct device; | ||
13 | |||
14 | struct coda_platform_data { | ||
15 | struct device *iram_dev; | ||
16 | }; | ||
17 | |||
18 | #endif | ||
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h index 798fb80b024b..bb3cd58d71e3 100644 --- a/include/linux/platform_data/cpsw.h +++ b/include/linux/platform_data/cpsw.h | |||
@@ -30,7 +30,7 @@ struct cpsw_platform_data { | |||
30 | u32 channels; /* number of cpdma channels (symmetric) */ | 30 | u32 channels; /* number of cpdma channels (symmetric) */ |
31 | u32 slaves; /* number of slave cpgmac ports */ | 31 | u32 slaves; /* number of slave cpgmac ports */ |
32 | struct cpsw_slave_data *slave_data; | 32 | struct cpsw_slave_data *slave_data; |
33 | u32 cpts_active_slave; /* time stamping slave */ | 33 | u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */ |
34 | u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */ | 34 | u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */ |
35 | u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */ | 35 | u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */ |
36 | u32 ale_entries; /* ale table size */ | 36 | u32 ale_entries; /* ale table size */ |
diff --git a/include/linux/platform_data/crypto-atmel.h b/include/linux/platform_data/crypto-atmel.h new file mode 100644 index 000000000000..b46e0d9062a0 --- /dev/null +++ b/include/linux/platform_data/crypto-atmel.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef __LINUX_CRYPTO_ATMEL_H | ||
2 | #define __LINUX_CRYPTO_ATMEL_H | ||
3 | |||
4 | #include <linux/platform_data/dma-atmel.h> | ||
5 | |||
6 | /** | ||
7 | * struct crypto_dma_data - DMA data for AES/TDES/SHA | ||
8 | */ | ||
9 | struct crypto_dma_data { | ||
10 | struct at_dma_slave txdata; | ||
11 | struct at_dma_slave rxdata; | ||
12 | }; | ||
13 | |||
14 | /** | ||
15 | * struct crypto_platform_data - board-specific AES/TDES/SHA configuration | ||
16 | * @dma_slave: DMA slave interface to use in data transfers. | ||
17 | */ | ||
18 | struct crypto_platform_data { | ||
19 | struct crypto_dma_data *dma_slave; | ||
20 | }; | ||
21 | |||
22 | #endif /* __LINUX_CRYPTO_ATMEL_H */ | ||
diff --git a/include/linux/platform_data/dwc3-omap.h b/include/linux/platform_data/dwc3-omap.h index ada401244e0b..1d36ca874cc8 100644 --- a/include/linux/platform_data/dwc3-omap.h +++ b/include/linux/platform_data/dwc3-omap.h | |||
@@ -41,7 +41,3 @@ enum dwc3_omap_utmi_mode { | |||
41 | DWC3_OMAP_UTMI_MODE_HW, | 41 | DWC3_OMAP_UTMI_MODE_HW, |
42 | DWC3_OMAP_UTMI_MODE_SW, | 42 | DWC3_OMAP_UTMI_MODE_SW, |
43 | }; | 43 | }; |
44 | |||
45 | struct dwc3_omap_data { | ||
46 | enum dwc3_omap_utmi_mode utmi_mode; | ||
47 | }; | ||
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h index 1bd5244d1dcd..bf0a83b7ed9d 100644 --- a/include/linux/platform_data/elm.h +++ b/include/linux/platform_data/elm.h | |||
@@ -50,5 +50,5 @@ struct elm_errorvec { | |||
50 | 50 | ||
51 | void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, | 51 | void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, |
52 | struct elm_errorvec *err_vec); | 52 | struct elm_errorvec *err_vec); |
53 | void elm_config(struct device *dev, enum bch_ecc bch_type); | 53 | int elm_config(struct device *dev, enum bch_ecc bch_type); |
54 | #endif /* __ELM_H */ | 54 | #endif /* __ELM_H */ |
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h index 03378ca84061..5c19a2a647c4 100644 --- a/include/linux/platform_data/emif_plat.h +++ b/include/linux/platform_data/emif_plat.h | |||
@@ -40,6 +40,7 @@ | |||
40 | /* Custom config requests */ | 40 | /* Custom config requests */ |
41 | #define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001 | 41 | #define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001 |
42 | #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002 | 42 | #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002 |
43 | #define EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART 0x00000004 | ||
43 | 44 | ||
44 | #ifndef __ASSEMBLY__ | 45 | #ifndef __ASSEMBLY__ |
45 | /** | 46 | /** |
diff --git a/include/linux/platform_data/gpio-rcar.h b/include/linux/platform_data/gpio-rcar.h new file mode 100644 index 000000000000..b253f77a7ddf --- /dev/null +++ b/include/linux/platform_data/gpio-rcar.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Renesas R-Car GPIO Support | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __GPIO_RCAR_H__ | ||
17 | #define __GPIO_RCAR_H__ | ||
18 | |||
19 | struct gpio_rcar_config { | ||
20 | unsigned int gpio_base; | ||
21 | unsigned int irq_base; | ||
22 | unsigned int number_of_pins; | ||
23 | const char *pctl_name; | ||
24 | }; | ||
25 | |||
26 | #endif /* __GPIO_RCAR_H__ */ | ||
diff --git a/include/linux/platform_data/imx-iram.h b/include/linux/platform_data/imx-iram.h deleted file mode 100644 index 022690c33702..000000000000 --- a/include/linux/platform_data/imx-iram.h +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
17 | * MA 02110-1301, USA. | ||
18 | */ | ||
19 | #include <linux/errno.h> | ||
20 | |||
21 | #ifdef CONFIG_IRAM_ALLOC | ||
22 | |||
23 | int __init iram_init(unsigned long base, unsigned long size); | ||
24 | void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr); | ||
25 | void iram_free(unsigned long dma_addr, unsigned int size); | ||
26 | |||
27 | #else | ||
28 | |||
29 | static inline int __init iram_init(unsigned long base, unsigned long size) | ||
30 | { | ||
31 | return -ENOMEM; | ||
32 | } | ||
33 | |||
34 | static inline void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr) | ||
35 | { | ||
36 | return NULL; | ||
37 | } | ||
38 | |||
39 | static inline void iram_free(unsigned long base, unsigned long size) {} | ||
40 | |||
41 | #endif | ||
diff --git a/include/linux/platform_data/irq-renesas-intc-irqpin.h b/include/linux/platform_data/irq-renesas-intc-irqpin.h new file mode 100644 index 000000000000..e4cb911066a6 --- /dev/null +++ b/include/linux/platform_data/irq-renesas-intc-irqpin.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Renesas INTC External IRQ Pin Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __IRQ_RENESAS_INTC_IRQPIN_H__ | ||
21 | #define __IRQ_RENESAS_INTC_IRQPIN_H__ | ||
22 | |||
23 | struct renesas_intc_irqpin_config { | ||
24 | unsigned int sense_bitfield_width; | ||
25 | unsigned int irq_base; | ||
26 | bool control_parent; | ||
27 | }; | ||
28 | |||
29 | #endif /* __IRQ_RENESAS_INTC_IRQPIN_H__ */ | ||
diff --git a/include/linux/platform_data/irq-renesas-irqc.h b/include/linux/platform_data/irq-renesas-irqc.h new file mode 100644 index 000000000000..3ae17b3e00ed --- /dev/null +++ b/include/linux/platform_data/irq-renesas-irqc.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Renesas IRQC Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __IRQ_RENESAS_IRQC_H__ | ||
21 | #define __IRQ_RENESAS_IRQC_H__ | ||
22 | |||
23 | struct renesas_irqc_config { | ||
24 | unsigned int irq_base; | ||
25 | }; | ||
26 | |||
27 | #endif /* __IRQ_RENESAS_IRQC_H__ */ | ||
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h index 1509570d5a3f..202e290faea8 100644 --- a/include/linux/platform_data/leds-lp55xx.h +++ b/include/linux/platform_data/leds-lp55xx.h | |||
@@ -20,18 +20,6 @@ | |||
20 | #define LP55XX_CLOCK_INT 1 | 20 | #define LP55XX_CLOCK_INT 1 |
21 | #define LP55XX_CLOCK_EXT 2 | 21 | #define LP55XX_CLOCK_EXT 2 |
22 | 22 | ||
23 | /* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */ | ||
24 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | ||
25 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | ||
26 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
27 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
28 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
29 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
30 | #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */ | ||
31 | #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */ | ||
32 | #define LP5521_CLK_INT 1 /* Internal clock */ | ||
33 | #define LP5521_CLK_AUTO 2 /* Automatic clock selection */ | ||
34 | |||
35 | struct lp55xx_led_config { | 23 | struct lp55xx_led_config { |
36 | const char *name; | 24 | const char *name; |
37 | u8 chan_nr; | 25 | u8 chan_nr; |
@@ -40,9 +28,9 @@ struct lp55xx_led_config { | |||
40 | }; | 28 | }; |
41 | 29 | ||
42 | struct lp55xx_predef_pattern { | 30 | struct lp55xx_predef_pattern { |
43 | u8 *r; | 31 | const u8 *r; |
44 | u8 *g; | 32 | const u8 *g; |
45 | u8 *b; | 33 | const u8 *b; |
46 | u8 size_r; | 34 | u8 size_r; |
47 | u8 size_g; | 35 | u8 size_g; |
48 | u8 size_b; | 36 | u8 size_b; |
@@ -79,9 +67,6 @@ struct lp55xx_platform_data { | |||
79 | /* Predefined pattern data */ | 67 | /* Predefined pattern data */ |
80 | struct lp55xx_predef_pattern *patterns; | 68 | struct lp55xx_predef_pattern *patterns; |
81 | unsigned int num_patterns; | 69 | unsigned int num_patterns; |
82 | |||
83 | /* _CONFIG register */ | ||
84 | u8 update_config; | ||
85 | }; | 70 | }; |
86 | 71 | ||
87 | #endif /* _LEDS_LP55XX_H */ | 72 | #endif /* _LEDS_LP55XX_H */ |
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h index 20ee8b221dbd..ea3200527dd3 100644 --- a/include/linux/platform_data/lp855x.h +++ b/include/linux/platform_data/lp855x.h | |||
@@ -69,11 +69,6 @@ enum lp855x_chip_id { | |||
69 | LP8557, | 69 | LP8557, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | enum lp855x_brightness_ctrl_mode { | ||
73 | PWM_BASED = 1, | ||
74 | REGISTER_BASED, | ||
75 | }; | ||
76 | |||
77 | enum lp8550_brighntess_source { | 72 | enum lp8550_brighntess_source { |
78 | LP8550_PWM_ONLY, | 73 | LP8550_PWM_ONLY, |
79 | LP8550_I2C_ONLY = 2, | 74 | LP8550_I2C_ONLY = 2, |
@@ -116,24 +111,18 @@ struct lp855x_rom_data { | |||
116 | /** | 111 | /** |
117 | * struct lp855x_platform_data | 112 | * struct lp855x_platform_data |
118 | * @name : Backlight driver name. If it is not defined, default name is set. | 113 | * @name : Backlight driver name. If it is not defined, default name is set. |
119 | * @mode : brightness control by pwm or lp855x register | ||
120 | * @device_control : value of DEVICE CONTROL register | 114 | * @device_control : value of DEVICE CONTROL register |
121 | * @initial_brightness : initial value of backlight brightness | 115 | * @initial_brightness : initial value of backlight brightness |
122 | * @period_ns : platform specific pwm period value. unit is nano. | 116 | * @period_ns : platform specific pwm period value. unit is nano. |
123 | Only valid when mode is PWM_BASED. | 117 | Only valid when mode is PWM_BASED. |
124 | * @load_new_rom_data : | ||
125 | 0 : use default configuration data | ||
126 | 1 : update values of eeprom or eprom registers on loading driver | ||
127 | * @size_program : total size of lp855x_rom_data | 118 | * @size_program : total size of lp855x_rom_data |
128 | * @rom_data : list of new eeprom/eprom registers | 119 | * @rom_data : list of new eeprom/eprom registers |
129 | */ | 120 | */ |
130 | struct lp855x_platform_data { | 121 | struct lp855x_platform_data { |
131 | char *name; | 122 | const char *name; |
132 | enum lp855x_brightness_ctrl_mode mode; | ||
133 | u8 device_control; | 123 | u8 device_control; |
134 | int initial_brightness; | 124 | u8 initial_brightness; |
135 | unsigned int period_ns; | 125 | unsigned int period_ns; |
136 | u8 load_new_rom_data; | ||
137 | int size_program; | 126 | int size_program; |
138 | struct lp855x_rom_data *rom_data; | 127 | struct lp855x_rom_data *rom_data; |
139 | }; | 128 | }; |
diff --git a/include/linux/platform_data/mmc-davinci.h b/include/linux/platform_data/mmc-davinci.h index 5ba6b22ce338..9cea4ee377b5 100644 --- a/include/linux/platform_data/mmc-davinci.h +++ b/include/linux/platform_data/mmc-davinci.h | |||
@@ -23,9 +23,6 @@ struct davinci_mmc_config { | |||
23 | /* any additional host capabilities: OR'd in to mmc->f_caps */ | 23 | /* any additional host capabilities: OR'd in to mmc->f_caps */ |
24 | u32 caps; | 24 | u32 caps; |
25 | 25 | ||
26 | /* Version of the MMC/SD controller */ | ||
27 | u8 version; | ||
28 | |||
29 | /* Number of sg segments */ | 26 | /* Number of sg segments */ |
30 | u8 nr_sg; | 27 | u8 nr_sg; |
31 | }; | 28 | }; |
diff --git a/include/linux/platform_data/mmc-sdhci-s3c.h b/include/linux/platform_data/mmc-sdhci-s3c.h new file mode 100644 index 000000000000..249f02387a35 --- /dev/null +++ b/include/linux/platform_data/mmc-sdhci-s3c.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef __PLATFORM_DATA_SDHCI_S3C_H | ||
2 | #define __PLATFORM_DATA_SDHCI_S3C_H | ||
3 | |||
4 | struct platform_device; | ||
5 | |||
6 | enum cd_types { | ||
7 | S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */ | ||
8 | S3C_SDHCI_CD_EXTERNAL, /* use external callback */ | ||
9 | S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */ | ||
10 | S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */ | ||
11 | S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */ | ||
12 | }; | ||
13 | |||
14 | /** | ||
15 | * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI | ||
16 | * @max_width: The maximum number of data bits supported. | ||
17 | * @host_caps: Standard MMC host capabilities bit field. | ||
18 | * @host_caps2: The second standard MMC host capabilities bit field. | ||
19 | * @cd_type: Type of Card Detection method (see cd_types enum above) | ||
20 | * @ext_cd_init: Initialize external card detect subsystem. Called on | ||
21 | * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL. | ||
22 | * notify_func argument is a callback to the sdhci-s3c driver | ||
23 | * that triggers the card detection event. Callback arguments: | ||
24 | * dev is pointer to platform device of the host controller, | ||
25 | * state is new state of the card (0 - removed, 1 - inserted). | ||
26 | * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on | ||
27 | * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL. | ||
28 | * notify_func argument is the same callback as for ext_cd_init. | ||
29 | * @ext_cd_gpio: gpio pin used for external CD line, valid only if | ||
30 | * cd_type == S3C_SDHCI_CD_GPIO | ||
31 | * @ext_cd_gpio_invert: invert values for external CD gpio line | ||
32 | * @cfg_gpio: Configure the GPIO for a specific card bit-width | ||
33 | * | ||
34 | * Initialisation data specific to either the machine or the platform | ||
35 | * for the device driver to use or call-back when configuring gpio or | ||
36 | * card speed information. | ||
37 | */ | ||
38 | struct s3c_sdhci_platdata { | ||
39 | unsigned int max_width; | ||
40 | unsigned int host_caps; | ||
41 | unsigned int host_caps2; | ||
42 | unsigned int pm_caps; | ||
43 | enum cd_types cd_type; | ||
44 | |||
45 | int ext_cd_gpio; | ||
46 | bool ext_cd_gpio_invert; | ||
47 | int (*ext_cd_init)(void (*notify_func)(struct platform_device *, | ||
48 | int state)); | ||
49 | int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *, | ||
50 | int state)); | ||
51 | |||
52 | void (*cfg_gpio)(struct platform_device *dev, int width); | ||
53 | }; | ||
54 | |||
55 | |||
56 | #endif /* __PLATFORM_DATA_SDHCI_S3C_H */ | ||
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h index 944b01dd103e..98b7925f1a2d 100644 --- a/include/linux/platform_data/mv_usb.h +++ b/include/linux/platform_data/mv_usb.h | |||
@@ -34,8 +34,6 @@ struct mv_usb_addon_irq { | |||
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct mv_usb_platform_data { | 36 | struct mv_usb_platform_data { |
37 | unsigned int clknum; | ||
38 | char **clkname; | ||
39 | struct mv_usb_addon_irq *id; /* Only valid for OTG. ID pin change*/ | 37 | struct mv_usb_addon_irq *id; /* Only valid for OTG. ID pin change*/ |
40 | struct mv_usb_addon_irq *vbus; /* valid for OTG/UDC. VBUS change*/ | 38 | struct mv_usb_addon_irq *vbus; /* valid for OTG/UDC. VBUS change*/ |
41 | 39 | ||
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h index 88734e871e3a..c7285b575462 100644 --- a/include/linux/platform_data/ntc_thermistor.h +++ b/include/linux/platform_data/ntc_thermistor.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef _LINUX_NTC_H | 21 | #ifndef _LINUX_NTC_H |
22 | #define _LINUX_NTC_H | 22 | #define _LINUX_NTC_H |
23 | 23 | ||
24 | struct iio_channel; | ||
25 | |||
24 | enum ntc_thermistor_type { | 26 | enum ntc_thermistor_type { |
25 | TYPE_NCPXXWB473, | 27 | TYPE_NCPXXWB473, |
26 | TYPE_NCPXXWL333, | 28 | TYPE_NCPXXWL333, |
@@ -39,13 +41,17 @@ struct ntc_thermistor_platform_data { | |||
39 | * described at Documentation/hwmon/ntc_thermistor | 41 | * described at Documentation/hwmon/ntc_thermistor |
40 | * | 42 | * |
41 | * pullup/down_ohm: 0 for infinite / not-connected | 43 | * pullup/down_ohm: 0 for infinite / not-connected |
44 | * | ||
45 | * chan: iio_channel pointer to communicate with the ADC which the | ||
46 | * thermistor is using for conversion of the analog values. | ||
42 | */ | 47 | */ |
43 | int (*read_uV)(void); | 48 | int (*read_uv)(struct ntc_thermistor_platform_data *); |
44 | unsigned int pullup_uV; | 49 | unsigned int pullup_uv; |
45 | 50 | ||
46 | unsigned int pullup_ohm; | 51 | unsigned int pullup_ohm; |
47 | unsigned int pulldown_ohm; | 52 | unsigned int pulldown_ohm; |
48 | enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect; | 53 | enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect; |
54 | struct iio_channel *chan; | ||
49 | 55 | ||
50 | int (*read_ohm)(void); | 56 | int (*read_ohm)(void); |
51 | }; | 57 | }; |
diff --git a/include/linux/platform_data/serial-sccnxp.h b/include/linux/platform_data/serial-sccnxp.h index 215574d1e81d..bdc510d03245 100644 --- a/include/linux/platform_data/serial-sccnxp.h +++ b/include/linux/platform_data/serial-sccnxp.h | |||
@@ -86,10 +86,6 @@ struct sccnxp_pdata { | |||
86 | const u32 mctrl_cfg[SCCNXP_MAX_UARTS]; | 86 | const u32 mctrl_cfg[SCCNXP_MAX_UARTS]; |
87 | /* Timer value for polling mode (usecs) */ | 87 | /* Timer value for polling mode (usecs) */ |
88 | const unsigned int poll_time_us; | 88 | const unsigned int poll_time_us; |
89 | /* Called during startup */ | ||
90 | void (*init)(void); | ||
91 | /* Called before finish */ | ||
92 | void (*exit)(void); | ||
93 | }; | 89 | }; |
94 | 90 | ||
95 | #endif | 91 | #endif |
diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h new file mode 100644 index 000000000000..92dabcaf6499 --- /dev/null +++ b/include/linux/platform_data/si5351.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * Si5351A/B/C programmable clock generator platform_data. | ||
3 | */ | ||
4 | |||
5 | #ifndef __LINUX_PLATFORM_DATA_SI5351_H__ | ||
6 | #define __LINUX_PLATFORM_DATA_SI5351_H__ | ||
7 | |||
8 | struct clk; | ||
9 | |||
10 | /** | ||
11 | * enum si5351_variant - SiLabs Si5351 chip variant | ||
12 | * @SI5351_VARIANT_A: Si5351A (8 output clocks, XTAL input) | ||
13 | * @SI5351_VARIANT_A3: Si5351A MSOP10 (3 output clocks, XTAL input) | ||
14 | * @SI5351_VARIANT_B: Si5351B (8 output clocks, XTAL/VXCO input) | ||
15 | * @SI5351_VARIANT_C: Si5351C (8 output clocks, XTAL/CLKIN input) | ||
16 | */ | ||
17 | enum si5351_variant { | ||
18 | SI5351_VARIANT_A = 1, | ||
19 | SI5351_VARIANT_A3 = 2, | ||
20 | SI5351_VARIANT_B = 3, | ||
21 | SI5351_VARIANT_C = 4, | ||
22 | }; | ||
23 | |||
24 | /** | ||
25 | * enum si5351_pll_src - Si5351 pll clock source | ||
26 | * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config | ||
27 | * @SI5351_PLL_SRC_XTAL: pll source clock is XTAL input | ||
28 | * @SI5351_PLL_SRC_CLKIN: pll source clock is CLKIN input (Si5351C only) | ||
29 | */ | ||
30 | enum si5351_pll_src { | ||
31 | SI5351_PLL_SRC_DEFAULT = 0, | ||
32 | SI5351_PLL_SRC_XTAL = 1, | ||
33 | SI5351_PLL_SRC_CLKIN = 2, | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * enum si5351_multisynth_src - Si5351 multisynth clock source | ||
38 | * @SI5351_MULTISYNTH_SRC_DEFAULT: default, do not change eeprom config | ||
39 | * @SI5351_MULTISYNTH_SRC_VCO0: multisynth source clock is VCO0 | ||
40 | * @SI5351_MULTISYNTH_SRC_VCO1: multisynth source clock is VCO1/VXCO | ||
41 | */ | ||
42 | enum si5351_multisynth_src { | ||
43 | SI5351_MULTISYNTH_SRC_DEFAULT = 0, | ||
44 | SI5351_MULTISYNTH_SRC_VCO0 = 1, | ||
45 | SI5351_MULTISYNTH_SRC_VCO1 = 2, | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * enum si5351_clkout_src - Si5351 clock output clock source | ||
50 | * @SI5351_CLKOUT_SRC_DEFAULT: default, do not change eeprom config | ||
51 | * @SI5351_CLKOUT_SRC_MSYNTH_N: clkout N source clock is multisynth N | ||
52 | * @SI5351_CLKOUT_SRC_MSYNTH_0_4: clkout N source clock is multisynth 0 (N<4) | ||
53 | * or 4 (N>=4) | ||
54 | * @SI5351_CLKOUT_SRC_XTAL: clkout N source clock is XTAL | ||
55 | * @SI5351_CLKOUT_SRC_CLKIN: clkout N source clock is CLKIN (Si5351C only) | ||
56 | */ | ||
57 | enum si5351_clkout_src { | ||
58 | SI5351_CLKOUT_SRC_DEFAULT = 0, | ||
59 | SI5351_CLKOUT_SRC_MSYNTH_N = 1, | ||
60 | SI5351_CLKOUT_SRC_MSYNTH_0_4 = 2, | ||
61 | SI5351_CLKOUT_SRC_XTAL = 3, | ||
62 | SI5351_CLKOUT_SRC_CLKIN = 4, | ||
63 | }; | ||
64 | |||
65 | /** | ||
66 | * enum si5351_drive_strength - Si5351 clock output drive strength | ||
67 | * @SI5351_DRIVE_DEFAULT: default, do not change eeprom config | ||
68 | * @SI5351_DRIVE_2MA: 2mA clock output drive strength | ||
69 | * @SI5351_DRIVE_4MA: 4mA clock output drive strength | ||
70 | * @SI5351_DRIVE_6MA: 6mA clock output drive strength | ||
71 | * @SI5351_DRIVE_8MA: 8mA clock output drive strength | ||
72 | */ | ||
73 | enum si5351_drive_strength { | ||
74 | SI5351_DRIVE_DEFAULT = 0, | ||
75 | SI5351_DRIVE_2MA = 2, | ||
76 | SI5351_DRIVE_4MA = 4, | ||
77 | SI5351_DRIVE_6MA = 6, | ||
78 | SI5351_DRIVE_8MA = 8, | ||
79 | }; | ||
80 | |||
81 | /** | ||
82 | * struct si5351_clkout_config - Si5351 clock output configuration | ||
83 | * @clkout: clkout number | ||
84 | * @multisynth_src: multisynth source clock | ||
85 | * @clkout_src: clkout source clock | ||
86 | * @pll_master: if true, clkout can also change pll rate | ||
87 | * @drive: output drive strength | ||
88 | * @rate: initial clkout rate, or default if 0 | ||
89 | */ | ||
90 | struct si5351_clkout_config { | ||
91 | enum si5351_multisynth_src multisynth_src; | ||
92 | enum si5351_clkout_src clkout_src; | ||
93 | enum si5351_drive_strength drive; | ||
94 | bool pll_master; | ||
95 | unsigned long rate; | ||
96 | }; | ||
97 | |||
98 | /** | ||
99 | * struct si5351_platform_data - Platform data for the Si5351 clock driver | ||
100 | * @variant: Si5351 chip variant | ||
101 | * @clk_xtal: xtal input clock | ||
102 | * @clk_clkin: clkin input clock | ||
103 | * @pll_src: array of pll source clock setting | ||
104 | * @clkout: array of clkout configuration | ||
105 | */ | ||
106 | struct si5351_platform_data { | ||
107 | enum si5351_variant variant; | ||
108 | struct clk *clk_xtal; | ||
109 | struct clk *clk_clkin; | ||
110 | enum si5351_pll_src pll_src[2]; | ||
111 | struct si5351_clkout_config clkout[8]; | ||
112 | }; | ||
113 | |||
114 | #endif | ||
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h index ceba18d23a5a..8447f634c7f5 100644 --- a/include/linux/platform_data/spi-s3c64xx.h +++ b/include/linux/platform_data/spi-s3c64xx.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef __S3C64XX_PLAT_SPI_H | 11 | #ifndef __S3C64XX_PLAT_SPI_H |
12 | #define __S3C64XX_PLAT_SPI_H | 12 | #define __S3C64XX_PLAT_SPI_H |
13 | 13 | ||
14 | #include <linux/dmaengine.h> | ||
15 | |||
14 | struct platform_device; | 16 | struct platform_device; |
15 | 17 | ||
16 | /** | 18 | /** |
@@ -38,6 +40,7 @@ struct s3c64xx_spi_info { | |||
38 | int src_clk_nr; | 40 | int src_clk_nr; |
39 | int num_cs; | 41 | int num_cs; |
40 | int (*cfg_gpio)(void); | 42 | int (*cfg_gpio)(void); |
43 | dma_filter_fn filter; | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | /** | 46 | /** |
diff --git a/include/linux/platform_data/st1232_pdata.h b/include/linux/platform_data/st1232_pdata.h new file mode 100644 index 000000000000..cac3e7b4c454 --- /dev/null +++ b/include/linux/platform_data/st1232_pdata.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _LINUX_ST1232_PDATA_H | ||
2 | #define _LINUX_ST1232_PDATA_H | ||
3 | |||
4 | /* | ||
5 | * Optional platform data | ||
6 | * | ||
7 | * Use this if you want the driver to drive the reset pin. | ||
8 | */ | ||
9 | struct st1232_pdata { | ||
10 | int reset_gpio; | ||
11 | }; | ||
12 | |||
13 | #endif | ||
diff --git a/include/linux/platform_data/usb-exynos.h b/include/linux/platform_data/usb-ohci-exynos.h index c256c595be5e..c256c595be5e 100644 --- a/include/linux/platform_data/usb-exynos.h +++ b/include/linux/platform_data/usb-ohci-exynos.h | |||
diff --git a/include/linux/platform_data/video-vt8500lcdfb.h b/include/linux/platform_data/video-vt8500lcdfb.h deleted file mode 100644 index 7f399c370fe0..000000000000 --- a/include/linux/platform_data/video-vt8500lcdfb.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * VT8500/WM8505 Frame Buffer platform data definitions | ||
3 | * | ||
4 | * Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com> | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _VT8500FB_H | ||
17 | #define _VT8500FB_H | ||
18 | |||
19 | #include <linux/fb.h> | ||
20 | |||
21 | struct vt8500fb_platform_data { | ||
22 | struct fb_videomode mode; | ||
23 | u32 xres_virtual; | ||
24 | u32 yres_virtual; | ||
25 | u32 bpp; | ||
26 | unsigned long video_mem_phys; | ||
27 | void *video_mem_virt; | ||
28 | unsigned long video_mem_len; | ||
29 | }; | ||
30 | |||
31 | #endif /* _VT8500FB_H */ | ||
diff --git a/include/linux/platform_data/video_s3c.h b/include/linux/platform_data/video_s3c.h new file mode 100644 index 000000000000..48883995f47f --- /dev/null +++ b/include/linux/platform_data/video_s3c.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef __PLATFORM_DATA_VIDEO_S3C | ||
2 | #define __PLATFORM_DATA_VIDEO_S3C | ||
3 | |||
4 | /* S3C_FB_MAX_WIN | ||
5 | * Set to the maximum number of windows that any of the supported hardware | ||
6 | * can use. Since the platform data uses this for an array size, having it | ||
7 | * set to the maximum of any version of the hardware can do is safe. | ||
8 | */ | ||
9 | #define S3C_FB_MAX_WIN (5) | ||
10 | |||
11 | /** | ||
12 | * struct s3c_fb_pd_win - per window setup data | ||
13 | * @xres : The window X size. | ||
14 | * @yres : The window Y size. | ||
15 | * @virtual_x: The virtual X size. | ||
16 | * @virtual_y: The virtual Y size. | ||
17 | */ | ||
18 | struct s3c_fb_pd_win { | ||
19 | unsigned short default_bpp; | ||
20 | unsigned short max_bpp; | ||
21 | unsigned short xres; | ||
22 | unsigned short yres; | ||
23 | unsigned short virtual_x; | ||
24 | unsigned short virtual_y; | ||
25 | }; | ||
26 | |||
27 | /** | ||
28 | * struct s3c_fb_platdata - S3C driver platform specific information | ||
29 | * @setup_gpio: Setup the external GPIO pins to the right state to transfer | ||
30 | * the data from the display system to the connected display | ||
31 | * device. | ||
32 | * @vidcon0: The base vidcon0 values to control the panel data format. | ||
33 | * @vidcon1: The base vidcon1 values to control the panel data output. | ||
34 | * @vtiming: Video timing when connected to a RGB type panel. | ||
35 | * @win: The setup data for each hardware window, or NULL for unused. | ||
36 | * @display_mode: The LCD output display mode. | ||
37 | * | ||
38 | * The platform data supplies the video driver with all the information | ||
39 | * it requires to work with the display(s) attached to the machine. It | ||
40 | * controls the initial mode, the number of display windows (0 is always | ||
41 | * the base framebuffer) that are initialised etc. | ||
42 | * | ||
43 | */ | ||
44 | struct s3c_fb_platdata { | ||
45 | void (*setup_gpio)(void); | ||
46 | |||
47 | struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN]; | ||
48 | struct fb_videomode *vtiming; | ||
49 | |||
50 | u32 vidcon0; | ||
51 | u32 vidcon1; | ||
52 | }; | ||
53 | |||
54 | #endif | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index c082c71f7225..9abf1db6aea6 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -20,12 +20,12 @@ | |||
20 | struct mfd_cell; | 20 | struct mfd_cell; |
21 | 21 | ||
22 | struct platform_device { | 22 | struct platform_device { |
23 | const char * name; | 23 | const char *name; |
24 | int id; | 24 | int id; |
25 | bool id_auto; | 25 | bool id_auto; |
26 | struct device dev; | 26 | struct device dev; |
27 | u32 num_resources; | 27 | u32 num_resources; |
28 | struct resource * resource; | 28 | struct resource *resource; |
29 | 29 | ||
30 | const struct platform_device_id *id_entry; | 30 | const struct platform_device_id *id_entry; |
31 | 31 | ||
@@ -47,9 +47,12 @@ extern struct bus_type platform_bus_type; | |||
47 | extern struct device platform_bus; | 47 | extern struct device platform_bus; |
48 | 48 | ||
49 | extern void arch_setup_pdev_archdata(struct platform_device *); | 49 | extern void arch_setup_pdev_archdata(struct platform_device *); |
50 | extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); | 50 | extern struct resource *platform_get_resource(struct platform_device *, |
51 | unsigned int, unsigned int); | ||
51 | extern int platform_get_irq(struct platform_device *, unsigned int); | 52 | extern int platform_get_irq(struct platform_device *, unsigned int); |
52 | extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *); | 53 | extern struct resource *platform_get_resource_byname(struct platform_device *, |
54 | unsigned int, | ||
55 | const char *); | ||
53 | extern int platform_get_irq_byname(struct platform_device *, const char *); | 56 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
54 | extern int platform_add_devices(struct platform_device **, int); | 57 | extern int platform_add_devices(struct platform_device **, int); |
55 | 58 | ||
@@ -161,7 +164,8 @@ extern struct platform_device *platform_device_alloc(const char *name, int id); | |||
161 | extern int platform_device_add_resources(struct platform_device *pdev, | 164 | extern int platform_device_add_resources(struct platform_device *pdev, |
162 | const struct resource *res, | 165 | const struct resource *res, |
163 | unsigned int num); | 166 | unsigned int num); |
164 | extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); | 167 | extern int platform_device_add_data(struct platform_device *pdev, |
168 | const void *data, size_t size); | ||
165 | extern int platform_device_add(struct platform_device *pdev); | 169 | extern int platform_device_add(struct platform_device *pdev); |
166 | extern void platform_device_del(struct platform_device *pdev); | 170 | extern void platform_device_del(struct platform_device *pdev); |
167 | extern void platform_device_put(struct platform_device *pdev); | 171 | extern void platform_device_put(struct platform_device *pdev); |
@@ -190,7 +194,8 @@ static inline void *platform_get_drvdata(const struct platform_device *pdev) | |||
190 | return dev_get_drvdata(&pdev->dev); | 194 | return dev_get_drvdata(&pdev->dev); |
191 | } | 195 | } |
192 | 196 | ||
193 | static inline void platform_set_drvdata(struct platform_device *pdev, void *data) | 197 | static inline void platform_set_drvdata(struct platform_device *pdev, |
198 | void *data) | ||
194 | { | 199 | { |
195 | dev_set_drvdata(&pdev->dev, data); | 200 | dev_set_drvdata(&pdev->dev, data); |
196 | } | 201 | } |
@@ -222,10 +227,10 @@ static void __exit __platform_driver##_exit(void) \ | |||
222 | } \ | 227 | } \ |
223 | module_exit(__platform_driver##_exit); | 228 | module_exit(__platform_driver##_exit); |
224 | 229 | ||
225 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, | 230 | extern struct platform_device *platform_create_bundle( |
226 | int (*probe)(struct platform_device *), | 231 | struct platform_driver *driver, int (*probe)(struct platform_device *), |
227 | struct resource *res, unsigned int n_res, | 232 | struct resource *res, unsigned int n_res, |
228 | const void *data, size_t size); | 233 | const void *data, size_t size); |
229 | 234 | ||
230 | /* early platform driver interface */ | 235 | /* early platform driver interface */ |
231 | struct early_platform_driver { | 236 | struct early_platform_driver { |
diff --git a/include/linux/pm.h b/include/linux/pm.h index e5d7230332a4..a224c7f5c377 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -34,6 +34,19 @@ | |||
34 | extern void (*pm_power_off)(void); | 34 | extern void (*pm_power_off)(void); |
35 | extern void (*pm_power_off_prepare)(void); | 35 | extern void (*pm_power_off_prepare)(void); |
36 | 36 | ||
37 | struct device; /* we have a circular dep with device.h */ | ||
38 | #ifdef CONFIG_VT_CONSOLE_SLEEP | ||
39 | extern void pm_vt_switch_required(struct device *dev, bool required); | ||
40 | extern void pm_vt_switch_unregister(struct device *dev); | ||
41 | #else | ||
42 | static inline void pm_vt_switch_required(struct device *dev, bool required) | ||
43 | { | ||
44 | } | ||
45 | static inline void pm_vt_switch_unregister(struct device *dev) | ||
46 | { | ||
47 | } | ||
48 | #endif /* CONFIG_VT_CONSOLE_SLEEP */ | ||
49 | |||
37 | /* | 50 | /* |
38 | * Device power management | 51 | * Device power management |
39 | */ | 52 | */ |
diff --git a/include/linux/pm2301_charger.h b/include/linux/pm2301_charger.h index fc3f026922ae..85c16defe11a 100644 --- a/include/linux/pm2301_charger.h +++ b/include/linux/pm2301_charger.h | |||
@@ -48,7 +48,7 @@ struct pm2xxx_charger_platform_data { | |||
48 | size_t num_supplicants; | 48 | size_t num_supplicants; |
49 | int i2c_bus; | 49 | int i2c_bus; |
50 | const char *label; | 50 | const char *label; |
51 | int irq_number; | 51 | int gpio_irq_number; |
52 | unsigned int lpn_gpio; | 52 | unsigned int lpn_gpio; |
53 | int irq_type; | 53 | int irq_type; |
54 | }; | 54 | }; |
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 042058fdb0af..7794d75ed155 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -55,6 +55,7 @@ struct cpu_timer_list { | |||
55 | /* POSIX.1b interval timer structure. */ | 55 | /* POSIX.1b interval timer structure. */ |
56 | struct k_itimer { | 56 | struct k_itimer { |
57 | struct list_head list; /* free/ allocate list */ | 57 | struct list_head list; /* free/ allocate list */ |
58 | struct hlist_node t_hash; | ||
58 | spinlock_t it_lock; | 59 | spinlock_t it_lock; |
59 | clockid_t it_clock; /* which timer type */ | 60 | clockid_t it_clock; /* which timer type */ |
60 | timer_t it_id; /* timer id */ | 61 | timer_t it_id; /* timer id */ |
@@ -122,6 +123,8 @@ void run_posix_cpu_timers(struct task_struct *task); | |||
122 | void posix_cpu_timers_exit(struct task_struct *task); | 123 | void posix_cpu_timers_exit(struct task_struct *task); |
123 | void posix_cpu_timers_exit_group(struct task_struct *task); | 124 | void posix_cpu_timers_exit_group(struct task_struct *task); |
124 | 125 | ||
126 | bool posix_cpu_timers_can_stop_tick(struct task_struct *tsk); | ||
127 | |||
125 | void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, | 128 | void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, |
126 | cputime_t *newval, cputime_t *oldval); | 129 | cputime_t *newval, cputime_t *oldval); |
127 | 130 | ||
diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 000000000000..cdbb6c2a8c51 --- /dev/null +++ b/include/linux/power/ab8500.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson 2013 | ||
3 | * Author: Hongbo Zhang <hongbo.zhang@linaro.com> | ||
4 | * License terms: GNU General Public License v2 | ||
5 | */ | ||
6 | |||
7 | #ifndef PWR_AB8500_H | ||
8 | #define PWR_AB8500_H | ||
9 | |||
10 | extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; | ||
11 | extern const int ab8500_temp_tbl_a_size; | ||
12 | |||
13 | extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; | ||
14 | extern const int ab8500_temp_tbl_b_size; | ||
15 | |||
16 | #endif /* PWR_AB8500_H */ | ||
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 002a99f96331..3828cefb4f65 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -171,6 +171,12 @@ struct power_supply { | |||
171 | char **supplied_to; | 171 | char **supplied_to; |
172 | size_t num_supplicants; | 172 | size_t num_supplicants; |
173 | 173 | ||
174 | char **supplied_from; | ||
175 | size_t num_supplies; | ||
176 | #ifdef CONFIG_OF | ||
177 | struct device_node *of_node; | ||
178 | #endif | ||
179 | |||
174 | int (*get_property)(struct power_supply *psy, | 180 | int (*get_property)(struct power_supply *psy, |
175 | enum power_supply_property psp, | 181 | enum power_supply_property psp, |
176 | union power_supply_propval *val); | 182 | union power_supply_propval *val); |
diff --git a/include/linux/printk.h b/include/linux/printk.h index 822171fcb1c8..6af944ab38f0 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __KERNEL_PRINTK__ | 1 | #ifndef __KERNEL_PRINTK__ |
2 | #define __KERNEL_PRINTK__ | 2 | #define __KERNEL_PRINTK__ |
3 | 3 | ||
4 | #include <stdarg.h> | ||
4 | #include <linux/init.h> | 5 | #include <linux/init.h> |
5 | #include <linux/kern_levels.h> | 6 | #include <linux/kern_levels.h> |
6 | 7 | ||
@@ -95,8 +96,14 @@ int no_printk(const char *fmt, ...) | |||
95 | return 0; | 96 | return 0; |
96 | } | 97 | } |
97 | 98 | ||
99 | #ifdef CONFIG_EARLY_PRINTK | ||
98 | extern asmlinkage __printf(1, 2) | 100 | extern asmlinkage __printf(1, 2) |
99 | void early_printk(const char *fmt, ...); | 101 | void early_printk(const char *fmt, ...); |
102 | void early_vprintk(const char *fmt, va_list ap); | ||
103 | #else | ||
104 | static inline __printf(1, 2) __cold | ||
105 | void early_printk(const char *s, ...) { } | ||
106 | #endif | ||
100 | 107 | ||
101 | #ifdef CONFIG_PRINTK | 108 | #ifdef CONFIG_PRINTK |
102 | asmlinkage __printf(5, 0) | 109 | asmlinkage __printf(5, 0) |
@@ -138,6 +145,9 @@ extern void wake_up_klogd(void); | |||
138 | 145 | ||
139 | void log_buf_kexec_setup(void); | 146 | void log_buf_kexec_setup(void); |
140 | void __init setup_log_buf(int early); | 147 | void __init setup_log_buf(int early); |
148 | void dump_stack_set_arch_desc(const char *fmt, ...); | ||
149 | void dump_stack_print_info(const char *log_lvl); | ||
150 | void show_regs_print_info(const char *log_lvl); | ||
141 | #else | 151 | #else |
142 | static inline __printf(1, 0) | 152 | static inline __printf(1, 0) |
143 | int vprintk(const char *s, va_list args) | 153 | int vprintk(const char *s, va_list args) |
@@ -175,6 +185,18 @@ static inline void log_buf_kexec_setup(void) | |||
175 | static inline void setup_log_buf(int early) | 185 | static inline void setup_log_buf(int early) |
176 | { | 186 | { |
177 | } | 187 | } |
188 | |||
189 | static inline void dump_stack_set_arch_desc(const char *fmt, ...) | ||
190 | { | ||
191 | } | ||
192 | |||
193 | static inline void dump_stack_print_info(const char *log_lvl) | ||
194 | { | ||
195 | } | ||
196 | |||
197 | static inline void show_regs_print_info(const char *log_lvl) | ||
198 | { | ||
199 | } | ||
178 | #endif | 200 | #endif |
179 | 201 | ||
180 | extern void dump_stack(void) __cold; | 202 | extern void dump_stack(void) __cold; |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 94dfb2aa5533..608e60a74c3c 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -1,318 +1,79 @@ | |||
1 | #ifndef _LINUX_PROC_FS_H | ||
2 | #define _LINUX_PROC_FS_H | ||
3 | |||
4 | #include <linux/slab.h> | ||
5 | #include <linux/fs.h> | ||
6 | #include <linux/spinlock.h> | ||
7 | #include <linux/magic.h> | ||
8 | #include <linux/atomic.h> | ||
9 | |||
10 | struct net; | ||
11 | struct completion; | ||
12 | struct mm_struct; | ||
13 | |||
14 | /* | 1 | /* |
15 | * The proc filesystem constants/structures | 2 | * The proc filesystem constants/structures |
16 | */ | 3 | */ |
4 | #ifndef _LINUX_PROC_FS_H | ||
5 | #define _LINUX_PROC_FS_H | ||
17 | 6 | ||
18 | /* | 7 | #include <linux/types.h> |
19 | * Offset of the first process in the /proc root directory.. | 8 | #include <linux/fs.h> |
20 | */ | ||
21 | #define FIRST_PROCESS_ENTRY 256 | ||
22 | |||
23 | /* Worst case buffer size needed for holding an integer. */ | ||
24 | #define PROC_NUMBUF 13 | ||
25 | |||
26 | /* | ||
27 | * We always define these enumerators | ||
28 | */ | ||
29 | |||
30 | enum { | ||
31 | PROC_ROOT_INO = 1, | ||
32 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
33 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
34 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
35 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * This is not completely implemented yet. The idea is to | ||
40 | * create an in-memory tree (like the actual /proc filesystem | ||
41 | * tree) of these proc_dir_entries, so that we can dynamically | ||
42 | * add new files to /proc. | ||
43 | * | ||
44 | * The "next" pointer creates a linked list of one /proc directory, | ||
45 | * while parent/subdir create the directory structure (every | ||
46 | * /proc file has a parent, but "subdir" is NULL for all | ||
47 | * non-directory entries). | ||
48 | */ | ||
49 | |||
50 | typedef int (read_proc_t)(char *page, char **start, off_t off, | ||
51 | int count, int *eof, void *data); | ||
52 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, | ||
53 | unsigned long count, void *data); | ||
54 | |||
55 | struct proc_dir_entry { | ||
56 | unsigned int low_ino; | ||
57 | umode_t mode; | ||
58 | nlink_t nlink; | ||
59 | kuid_t uid; | ||
60 | kgid_t gid; | ||
61 | loff_t size; | ||
62 | const struct inode_operations *proc_iops; | ||
63 | /* | ||
64 | * NULL ->proc_fops means "PDE is going away RSN" or | ||
65 | * "PDE is just created". In either case, e.g. ->read_proc won't be | ||
66 | * called because it's too late or too early, respectively. | ||
67 | * | ||
68 | * If you're allocating ->proc_fops dynamically, save a pointer | ||
69 | * somewhere. | ||
70 | */ | ||
71 | const struct file_operations *proc_fops; | ||
72 | struct proc_dir_entry *next, *parent, *subdir; | ||
73 | void *data; | ||
74 | read_proc_t *read_proc; | ||
75 | write_proc_t *write_proc; | ||
76 | atomic_t count; /* use count */ | ||
77 | int pde_users; /* number of callers into module in progress */ | ||
78 | struct completion *pde_unload_completion; | ||
79 | struct list_head pde_openers; /* who did ->open, but not ->release */ | ||
80 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | ||
81 | u8 namelen; | ||
82 | char name[]; | ||
83 | }; | ||
84 | |||
85 | enum kcore_type { | ||
86 | KCORE_TEXT, | ||
87 | KCORE_VMALLOC, | ||
88 | KCORE_RAM, | ||
89 | KCORE_VMEMMAP, | ||
90 | KCORE_OTHER, | ||
91 | }; | ||
92 | |||
93 | struct kcore_list { | ||
94 | struct list_head list; | ||
95 | unsigned long addr; | ||
96 | size_t size; | ||
97 | int type; | ||
98 | }; | ||
99 | 9 | ||
100 | struct vmcore { | 10 | struct proc_dir_entry; |
101 | struct list_head list; | ||
102 | unsigned long long paddr; | ||
103 | unsigned long long size; | ||
104 | loff_t offset; | ||
105 | }; | ||
106 | 11 | ||
107 | #ifdef CONFIG_PROC_FS | 12 | #ifdef CONFIG_PROC_FS |
108 | 13 | ||
109 | extern void proc_root_init(void); | 14 | extern void proc_root_init(void); |
110 | 15 | extern void proc_flush_task(struct task_struct *); | |
111 | void proc_flush_task(struct task_struct *task); | ||
112 | |||
113 | extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode, | ||
114 | struct proc_dir_entry *parent); | ||
115 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | ||
116 | struct proc_dir_entry *parent, | ||
117 | const struct file_operations *proc_fops, | ||
118 | void *data); | ||
119 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); | ||
120 | extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent); | ||
121 | |||
122 | struct pid_namespace; | ||
123 | |||
124 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
125 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
126 | |||
127 | /* | ||
128 | * proc_tty.c | ||
129 | */ | ||
130 | struct tty_driver; | ||
131 | #ifdef CONFIG_TTY | ||
132 | extern void proc_tty_init(void); | ||
133 | #else | ||
134 | static inline void proc_tty_init(void) | ||
135 | { } | ||
136 | #endif | ||
137 | extern void proc_tty_register_driver(struct tty_driver *driver); | ||
138 | extern void proc_tty_unregister_driver(struct tty_driver *driver); | ||
139 | |||
140 | /* | ||
141 | * proc_devtree.c | ||
142 | */ | ||
143 | #ifdef CONFIG_PROC_DEVICETREE | ||
144 | struct device_node; | ||
145 | struct property; | ||
146 | extern void proc_device_tree_init(void); | ||
147 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); | ||
148 | extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); | ||
149 | extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, | ||
150 | struct property *prop); | ||
151 | extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, | ||
152 | struct property *newprop, | ||
153 | struct property *oldprop); | ||
154 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
155 | 16 | ||
156 | extern struct proc_dir_entry *proc_symlink(const char *, | 17 | extern struct proc_dir_entry *proc_symlink(const char *, |
157 | struct proc_dir_entry *, const char *); | 18 | struct proc_dir_entry *, const char *); |
158 | extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); | 19 | extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); |
159 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, | 20 | extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, |
160 | struct proc_dir_entry *parent); | 21 | struct proc_dir_entry *, void *); |
161 | 22 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, | |
162 | static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, | 23 | struct proc_dir_entry *); |
163 | struct proc_dir_entry *parent, const struct file_operations *proc_fops) | 24 | |
25 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, | ||
26 | struct proc_dir_entry *, | ||
27 | const struct file_operations *, | ||
28 | void *); | ||
29 | |||
30 | static inline struct proc_dir_entry *proc_create( | ||
31 | const char *name, umode_t mode, struct proc_dir_entry *parent, | ||
32 | const struct file_operations *proc_fops) | ||
164 | { | 33 | { |
165 | return proc_create_data(name, mode, parent, proc_fops, NULL); | 34 | return proc_create_data(name, mode, parent, proc_fops, NULL); |
166 | } | 35 | } |
167 | 36 | ||
168 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 37 | extern void proc_set_size(struct proc_dir_entry *, loff_t); |
169 | umode_t mode, struct proc_dir_entry *base, | 38 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); |
170 | read_proc_t *read_proc, void * data) | 39 | extern void *PDE_DATA(const struct inode *); |
171 | { | 40 | extern void *proc_get_parent_data(const struct inode *); |
172 | struct proc_dir_entry *res=create_proc_entry(name,mode,base); | 41 | extern void proc_remove(struct proc_dir_entry *); |
173 | if (res) { | 42 | extern void remove_proc_entry(const char *, struct proc_dir_entry *); |
174 | res->read_proc=read_proc; | 43 | extern int remove_proc_subtree(const char *, struct proc_dir_entry *); |
175 | res->data=data; | ||
176 | } | ||
177 | return res; | ||
178 | } | ||
179 | |||
180 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | ||
181 | struct proc_dir_entry *parent); | ||
182 | |||
183 | extern struct file *proc_ns_fget(int fd); | ||
184 | extern bool proc_ns_inode(struct inode *inode); | ||
185 | 44 | ||
186 | extern int proc_alloc_inum(unsigned int *pino); | 45 | #else /* CONFIG_PROC_FS */ |
187 | extern void proc_free_inum(unsigned int inum); | ||
188 | #else | ||
189 | 46 | ||
190 | static inline void proc_flush_task(struct task_struct *task) | 47 | static inline void proc_flush_task(struct task_struct *task) |
191 | { | 48 | { |
192 | } | 49 | } |
193 | 50 | ||
194 | static inline struct proc_dir_entry *create_proc_entry(const char *name, | ||
195 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | ||
196 | |||
197 | #define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; }) | ||
198 | |||
199 | static inline struct proc_dir_entry *proc_create_data(const char *name, | ||
200 | umode_t mode, struct proc_dir_entry *parent, | ||
201 | const struct file_operations *proc_fops, void *data) | ||
202 | { | ||
203 | return NULL; | ||
204 | } | ||
205 | #define remove_proc_entry(name, parent) do {} while (0) | ||
206 | #define remove_proc_subtree(name, parent) do {} while (0) | ||
207 | |||
208 | static inline struct proc_dir_entry *proc_symlink(const char *name, | 51 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
209 | struct proc_dir_entry *parent,const char *dest) {return NULL;} | 52 | struct proc_dir_entry *parent,const char *dest) { return NULL;} |
210 | static inline struct proc_dir_entry *proc_mkdir(const char *name, | 53 | static inline struct proc_dir_entry *proc_mkdir(const char *name, |
211 | struct proc_dir_entry *parent) {return NULL;} | 54 | struct proc_dir_entry *parent) {return NULL;} |
55 | static inline struct proc_dir_entry *proc_mkdir_data(const char *name, | ||
56 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } | ||
212 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, | 57 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
213 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | 58 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
59 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) | ||
60 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) | ||
214 | 61 | ||
215 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 62 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} |
216 | umode_t mode, struct proc_dir_entry *base, | 63 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} |
217 | read_proc_t *read_proc, void * data) { return NULL; } | 64 | static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} |
218 | 65 | static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; } | |
219 | struct tty_driver; | ||
220 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; | ||
221 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; | ||
222 | 66 | ||
223 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) | 67 | static inline void proc_remove(struct proc_dir_entry *de) {} |
224 | { | 68 | #define remove_proc_entry(name, parent) do {} while (0) |
225 | return 0; | 69 | static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } |
226 | } | ||
227 | |||
228 | static inline void pid_ns_release_proc(struct pid_namespace *ns) | ||
229 | { | ||
230 | } | ||
231 | |||
232 | static inline struct file *proc_ns_fget(int fd) | ||
233 | { | ||
234 | return ERR_PTR(-EINVAL); | ||
235 | } | ||
236 | |||
237 | static inline bool proc_ns_inode(struct inode *inode) | ||
238 | { | ||
239 | return false; | ||
240 | } | ||
241 | 70 | ||
242 | static inline int proc_alloc_inum(unsigned int *inum) | ||
243 | { | ||
244 | *inum = 1; | ||
245 | return 0; | ||
246 | } | ||
247 | static inline void proc_free_inum(unsigned int inum) | ||
248 | { | ||
249 | } | ||
250 | #endif /* CONFIG_PROC_FS */ | 71 | #endif /* CONFIG_PROC_FS */ |
251 | 72 | ||
252 | #if !defined(CONFIG_PROC_KCORE) | 73 | static inline struct proc_dir_entry *proc_net_mkdir( |
253 | static inline void | 74 | struct net *net, const char *name, struct proc_dir_entry *parent) |
254 | kclist_add(struct kcore_list *new, void *addr, size_t size, int type) | ||
255 | { | 75 | { |
76 | return proc_mkdir_data(name, 0, parent, net); | ||
256 | } | 77 | } |
257 | #else | ||
258 | extern void kclist_add(struct kcore_list *, void *, size_t, int type); | ||
259 | #endif | ||
260 | |||
261 | struct nsproxy; | ||
262 | struct proc_ns_operations { | ||
263 | const char *name; | ||
264 | int type; | ||
265 | void *(*get)(struct task_struct *task); | ||
266 | void (*put)(void *ns); | ||
267 | int (*install)(struct nsproxy *nsproxy, void *ns); | ||
268 | unsigned int (*inum)(void *ns); | ||
269 | }; | ||
270 | extern const struct proc_ns_operations netns_operations; | ||
271 | extern const struct proc_ns_operations utsns_operations; | ||
272 | extern const struct proc_ns_operations ipcns_operations; | ||
273 | extern const struct proc_ns_operations pidns_operations; | ||
274 | extern const struct proc_ns_operations userns_operations; | ||
275 | extern const struct proc_ns_operations mntns_operations; | ||
276 | |||
277 | union proc_op { | ||
278 | int (*proc_get_link)(struct dentry *, struct path *); | ||
279 | int (*proc_read)(struct task_struct *task, char *page); | ||
280 | int (*proc_show)(struct seq_file *m, | ||
281 | struct pid_namespace *ns, struct pid *pid, | ||
282 | struct task_struct *task); | ||
283 | }; | ||
284 | |||
285 | struct ctl_table_header; | ||
286 | struct ctl_table; | ||
287 | |||
288 | struct proc_inode { | ||
289 | struct pid *pid; | ||
290 | int fd; | ||
291 | union proc_op op; | ||
292 | struct proc_dir_entry *pde; | ||
293 | struct ctl_table_header *sysctl; | ||
294 | struct ctl_table *sysctl_entry; | ||
295 | void *ns; | ||
296 | const struct proc_ns_operations *ns_ops; | ||
297 | struct inode vfs_inode; | ||
298 | }; | ||
299 | |||
300 | static inline struct proc_inode *PROC_I(const struct inode *inode) | ||
301 | { | ||
302 | return container_of(inode, struct proc_inode, vfs_inode); | ||
303 | } | ||
304 | |||
305 | static inline struct proc_dir_entry *PDE(const struct inode *inode) | ||
306 | { | ||
307 | return PROC_I(inode)->pde; | ||
308 | } | ||
309 | |||
310 | static inline struct net *PDE_NET(struct proc_dir_entry *pde) | ||
311 | { | ||
312 | return pde->parent->data; | ||
313 | } | ||
314 | |||
315 | #include <linux/signal.h> | ||
316 | 78 | ||
317 | void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set); | ||
318 | #endif /* _LINUX_PROC_FS_H */ | 79 | #endif /* _LINUX_PROC_FS_H */ |
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h new file mode 100644 index 000000000000..34a1e105bef4 --- /dev/null +++ b/include/linux/proc_ns.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * procfs namespace bits | ||
3 | */ | ||
4 | #ifndef _LINUX_PROC_NS_H | ||
5 | #define _LINUX_PROC_NS_H | ||
6 | |||
7 | struct pid_namespace; | ||
8 | struct nsproxy; | ||
9 | |||
10 | struct proc_ns_operations { | ||
11 | const char *name; | ||
12 | int type; | ||
13 | void *(*get)(struct task_struct *task); | ||
14 | void (*put)(void *ns); | ||
15 | int (*install)(struct nsproxy *nsproxy, void *ns); | ||
16 | unsigned int (*inum)(void *ns); | ||
17 | }; | ||
18 | |||
19 | struct proc_ns { | ||
20 | void *ns; | ||
21 | const struct proc_ns_operations *ns_ops; | ||
22 | }; | ||
23 | |||
24 | extern const struct proc_ns_operations netns_operations; | ||
25 | extern const struct proc_ns_operations utsns_operations; | ||
26 | extern const struct proc_ns_operations ipcns_operations; | ||
27 | extern const struct proc_ns_operations pidns_operations; | ||
28 | extern const struct proc_ns_operations userns_operations; | ||
29 | extern const struct proc_ns_operations mntns_operations; | ||
30 | |||
31 | /* | ||
32 | * We always define these enumerators | ||
33 | */ | ||
34 | enum { | ||
35 | PROC_ROOT_INO = 1, | ||
36 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
37 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
38 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
39 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
40 | }; | ||
41 | |||
42 | #ifdef CONFIG_PROC_FS | ||
43 | |||
44 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
45 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
46 | extern struct file *proc_ns_fget(int fd); | ||
47 | extern struct proc_ns *get_proc_ns(struct inode *); | ||
48 | extern int proc_alloc_inum(unsigned int *pino); | ||
49 | extern void proc_free_inum(unsigned int inum); | ||
50 | extern bool proc_ns_inode(struct inode *inode); | ||
51 | |||
52 | #else /* CONFIG_PROC_FS */ | ||
53 | |||
54 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; } | ||
55 | static inline void pid_ns_release_proc(struct pid_namespace *ns) {} | ||
56 | |||
57 | static inline struct file *proc_ns_fget(int fd) | ||
58 | { | ||
59 | return ERR_PTR(-EINVAL); | ||
60 | } | ||
61 | |||
62 | static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; } | ||
63 | |||
64 | static inline int proc_alloc_inum(unsigned int *inum) | ||
65 | { | ||
66 | *inum = 1; | ||
67 | return 0; | ||
68 | } | ||
69 | static inline void proc_free_inum(unsigned int inum) {} | ||
70 | static inline bool proc_ns_inode(struct inode *inode) { return false; } | ||
71 | |||
72 | #endif /* CONFIG_PROC_FS */ | ||
73 | |||
74 | #endif /* _LINUX_PROC_NS_H */ | ||
diff --git a/include/linux/profile.h b/include/linux/profile.h index 21123902366d..aaad3861beb8 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -18,10 +18,10 @@ struct pt_regs; | |||
18 | struct notifier_block; | 18 | struct notifier_block; |
19 | 19 | ||
20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) | 20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) |
21 | void create_prof_cpu_mask(struct proc_dir_entry *de); | 21 | void create_prof_cpu_mask(void); |
22 | int create_proc_profile(void); | 22 | int create_proc_profile(void); |
23 | #else | 23 | #else |
24 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) | 24 | static inline void create_prof_cpu_mask(void) |
25 | { | 25 | { |
26 | } | 26 | } |
27 | 27 | ||
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index cb6ab5feab67..9974975d40db 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h | |||
@@ -26,6 +26,13 @@ | |||
26 | struct persistent_ram_buffer; | 26 | struct persistent_ram_buffer; |
27 | struct rs_control; | 27 | struct rs_control; |
28 | 28 | ||
29 | struct persistent_ram_ecc_info { | ||
30 | int block_size; | ||
31 | int ecc_size; | ||
32 | int symsize; | ||
33 | int poly; | ||
34 | }; | ||
35 | |||
29 | struct persistent_ram_zone { | 36 | struct persistent_ram_zone { |
30 | phys_addr_t paddr; | 37 | phys_addr_t paddr; |
31 | size_t size; | 38 | size_t size; |
@@ -39,15 +46,14 @@ struct persistent_ram_zone { | |||
39 | struct rs_control *rs_decoder; | 46 | struct rs_control *rs_decoder; |
40 | int corrected_bytes; | 47 | int corrected_bytes; |
41 | int bad_blocks; | 48 | int bad_blocks; |
42 | int ecc_block_size; | 49 | struct persistent_ram_ecc_info ecc_info; |
43 | int ecc_size; | ||
44 | 50 | ||
45 | char *old_log; | 51 | char *old_log; |
46 | size_t old_log_size; | 52 | size_t old_log_size; |
47 | }; | 53 | }; |
48 | 54 | ||
49 | struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, | 55 | struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, |
50 | u32 sig, int ecc_size); | 56 | u32 sig, struct persistent_ram_ecc_info *ecc_info); |
51 | void persistent_ram_free(struct persistent_ram_zone *prz); | 57 | void persistent_ram_free(struct persistent_ram_zone *prz); |
52 | void persistent_ram_zap(struct persistent_ram_zone *prz); | 58 | void persistent_ram_zap(struct persistent_ram_zone *prz); |
53 | 59 | ||
@@ -74,7 +80,7 @@ struct ramoops_platform_data { | |||
74 | unsigned long console_size; | 80 | unsigned long console_size; |
75 | unsigned long ftrace_size; | 81 | unsigned long ftrace_size; |
76 | int dump_oops; | 82 | int dump_oops; |
77 | int ecc_size; | 83 | struct persistent_ram_ecc_info ecc_info; |
78 | }; | 84 | }; |
79 | 85 | ||
80 | #endif | 86 | #endif |
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index 5bf5500db83d..69e37c2d1ea5 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h | |||
@@ -6,7 +6,13 @@ struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, | |||
6 | extern struct dentry *ramfs_mount(struct file_system_type *fs_type, | 6 | extern struct dentry *ramfs_mount(struct file_system_type *fs_type, |
7 | int flags, const char *dev_name, void *data); | 7 | int flags, const char *dev_name, void *data); |
8 | 8 | ||
9 | #ifndef CONFIG_MMU | 9 | #ifdef CONFIG_MMU |
10 | static inline int | ||
11 | ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) | ||
12 | { | ||
13 | return 0; | ||
14 | } | ||
15 | #else | ||
10 | extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); | 16 | extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); |
11 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, | 17 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, |
12 | unsigned long addr, | 18 | unsigned long addr, |
diff --git a/include/linux/random.h b/include/linux/random.h index 347ce553a306..3b9377d6b7a5 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
@@ -29,13 +29,6 @@ u32 prandom_u32(void); | |||
29 | void prandom_bytes(void *buf, int nbytes); | 29 | void prandom_bytes(void *buf, int nbytes); |
30 | void prandom_seed(u32 seed); | 30 | void prandom_seed(u32 seed); |
31 | 31 | ||
32 | /* | ||
33 | * These macros are preserved for backward compatibility and should be | ||
34 | * removed as soon as a transition is finished. | ||
35 | */ | ||
36 | #define random32() prandom_u32() | ||
37 | #define srandom32(seed) prandom_seed(seed) | ||
38 | |||
39 | u32 prandom_u32_state(struct rnd_state *); | 32 | u32 prandom_u32_state(struct rnd_state *); |
40 | void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); | 33 | void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); |
41 | 34 | ||
diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h index cf1244fbf3b6..4f216c59e7db 100644 --- a/include/linux/rculist_bl.h +++ b/include/linux/rculist_bl.h | |||
@@ -20,7 +20,7 @@ static inline void hlist_bl_set_first_rcu(struct hlist_bl_head *h, | |||
20 | static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h) | 20 | static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h) |
21 | { | 21 | { |
22 | return (struct hlist_bl_node *) | 22 | return (struct hlist_bl_node *) |
23 | ((unsigned long)rcu_dereference(h->first) & ~LIST_BL_LOCKMASK); | 23 | ((unsigned long)rcu_dereference_check(h->first, hlist_bl_is_locked(h)) & ~LIST_BL_LOCKMASK); |
24 | } | 24 | } |
25 | 25 | ||
26 | /** | 26 | /** |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index b758ce17b309..4ccd68e49b00 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -80,6 +80,7 @@ extern void do_trace_rcu_torture_read(char *rcutorturename, | |||
80 | #define UINT_CMP_LT(a, b) (UINT_MAX / 2 < (a) - (b)) | 80 | #define UINT_CMP_LT(a, b) (UINT_MAX / 2 < (a) - (b)) |
81 | #define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) | 81 | #define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) |
82 | #define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b)) | 82 | #define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b)) |
83 | #define ulong2long(a) (*(long *)(&(a))) | ||
83 | 84 | ||
84 | /* Exported common interfaces */ | 85 | /* Exported common interfaces */ |
85 | 86 | ||
@@ -999,4 +1000,11 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
999 | #define kfree_rcu(ptr, rcu_head) \ | 1000 | #define kfree_rcu(ptr, rcu_head) \ |
1000 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) | 1001 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) |
1001 | 1002 | ||
1003 | #ifdef CONFIG_RCU_NOCB_CPU | ||
1004 | extern bool rcu_is_nocb_cpu(int cpu); | ||
1005 | #else | ||
1006 | static inline bool rcu_is_nocb_cpu(int cpu) { return false; } | ||
1007 | #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ | ||
1008 | |||
1009 | |||
1002 | #endif /* __LINUX_RCUPDATE_H */ | 1010 | #endif /* __LINUX_RCUPDATE_H */ |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index bf77dfdabef9..02d84e24b7c2 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -389,6 +389,7 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg, | |||
389 | bool *change); | 389 | bool *change); |
390 | int regmap_get_val_bytes(struct regmap *map); | 390 | int regmap_get_val_bytes(struct regmap *map); |
391 | int regmap_async_complete(struct regmap *map); | 391 | int regmap_async_complete(struct regmap *map); |
392 | bool regmap_can_raw_write(struct regmap *map); | ||
392 | 393 | ||
393 | int regcache_sync(struct regmap *map); | 394 | int regcache_sync(struct regmap *map); |
394 | int regcache_sync_region(struct regmap *map, unsigned int min, | 395 | int regcache_sync_region(struct regmap *map, unsigned int min, |
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 7bd73bbdfd1b..7c5ff0c55773 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h | |||
@@ -5,11 +5,14 @@ | |||
5 | * | 5 | * |
6 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson | 6 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson |
7 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson | 7 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson |
8 | * Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson | ||
8 | */ | 9 | */ |
9 | 10 | ||
10 | #ifndef __LINUX_MFD_AB8500_REGULATOR_H | 11 | #ifndef __LINUX_MFD_AB8500_REGULATOR_H |
11 | #define __LINUX_MFD_AB8500_REGULATOR_H | 12 | #define __LINUX_MFD_AB8500_REGULATOR_H |
12 | 13 | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
13 | /* AB8500 regulators */ | 16 | /* AB8500 regulators */ |
14 | enum ab8500_regulator_id { | 17 | enum ab8500_regulator_id { |
15 | AB8500_LDO_AUX1, | 18 | AB8500_LDO_AUX1, |
@@ -17,7 +20,6 @@ enum ab8500_regulator_id { | |||
17 | AB8500_LDO_AUX3, | 20 | AB8500_LDO_AUX3, |
18 | AB8500_LDO_INTCORE, | 21 | AB8500_LDO_INTCORE, |
19 | AB8500_LDO_TVOUT, | 22 | AB8500_LDO_TVOUT, |
20 | AB8500_LDO_USB, | ||
21 | AB8500_LDO_AUDIO, | 23 | AB8500_LDO_AUDIO, |
22 | AB8500_LDO_ANAMIC1, | 24 | AB8500_LDO_ANAMIC1, |
23 | AB8500_LDO_ANAMIC2, | 25 | AB8500_LDO_ANAMIC2, |
@@ -26,7 +28,28 @@ enum ab8500_regulator_id { | |||
26 | AB8500_NUM_REGULATORS, | 28 | AB8500_NUM_REGULATORS, |
27 | }; | 29 | }; |
28 | 30 | ||
29 | /* AB9450 regulators */ | 31 | /* AB8505 regulators */ |
32 | enum ab8505_regulator_id { | ||
33 | AB8505_LDO_AUX1, | ||
34 | AB8505_LDO_AUX2, | ||
35 | AB8505_LDO_AUX3, | ||
36 | AB8505_LDO_AUX4, | ||
37 | AB8505_LDO_AUX5, | ||
38 | AB8505_LDO_AUX6, | ||
39 | AB8505_LDO_INTCORE, | ||
40 | AB8505_LDO_ADC, | ||
41 | AB8505_LDO_USB, | ||
42 | AB8505_LDO_AUDIO, | ||
43 | AB8505_LDO_ANAMIC1, | ||
44 | AB8505_LDO_ANAMIC2, | ||
45 | AB8505_LDO_AUX8, | ||
46 | AB8505_LDO_ANA, | ||
47 | AB8505_SYSCLKREQ_2, | ||
48 | AB8505_SYSCLKREQ_4, | ||
49 | AB8505_NUM_REGULATORS, | ||
50 | }; | ||
51 | |||
52 | /* AB9540 regulators */ | ||
30 | enum ab9540_regulator_id { | 53 | enum ab9540_regulator_id { |
31 | AB9540_LDO_AUX1, | 54 | AB9540_LDO_AUX1, |
32 | AB9540_LDO_AUX2, | 55 | AB9540_LDO_AUX2, |
@@ -45,16 +68,39 @@ enum ab9540_regulator_id { | |||
45 | AB9540_NUM_REGULATORS, | 68 | AB9540_NUM_REGULATORS, |
46 | }; | 69 | }; |
47 | 70 | ||
48 | /* AB8500 and AB9540 register initialization */ | 71 | /* AB8540 regulators */ |
72 | enum ab8540_regulator_id { | ||
73 | AB8540_LDO_AUX1, | ||
74 | AB8540_LDO_AUX2, | ||
75 | AB8540_LDO_AUX3, | ||
76 | AB8540_LDO_AUX4, | ||
77 | AB8540_LDO_AUX5, | ||
78 | AB8540_LDO_AUX6, | ||
79 | AB8540_LDO_INTCORE, | ||
80 | AB8540_LDO_TVOUT, | ||
81 | AB8540_LDO_AUDIO, | ||
82 | AB8540_LDO_ANAMIC1, | ||
83 | AB8540_LDO_ANAMIC2, | ||
84 | AB8540_LDO_DMIC, | ||
85 | AB8540_LDO_ANA, | ||
86 | AB8540_LDO_SDIO, | ||
87 | AB8540_SYSCLKREQ_2, | ||
88 | AB8540_SYSCLKREQ_4, | ||
89 | AB8540_NUM_REGULATORS, | ||
90 | }; | ||
91 | |||
92 | /* AB8500, AB8505, and AB9540 register initialization */ | ||
49 | struct ab8500_regulator_reg_init { | 93 | struct ab8500_regulator_reg_init { |
50 | int id; | 94 | int id; |
95 | u8 mask; | ||
51 | u8 value; | 96 | u8 value; |
52 | }; | 97 | }; |
53 | 98 | ||
54 | #define INIT_REGULATOR_REGISTER(_id, _value) \ | 99 | #define INIT_REGULATOR_REGISTER(_id, _mask, _value) \ |
55 | { \ | 100 | { \ |
56 | .id = _id, \ | 101 | .id = _id, \ |
57 | .value = _value, \ | 102 | .mask = _mask, \ |
103 | .value = _value, \ | ||
58 | } | 104 | } |
59 | 105 | ||
60 | /* AB8500 registers */ | 106 | /* AB8500 registers */ |
@@ -86,10 +132,58 @@ enum ab8500_regulator_reg { | |||
86 | AB8500_REGUCTRL2SPARE, | 132 | AB8500_REGUCTRL2SPARE, |
87 | AB8500_REGUCTRLDISCH, | 133 | AB8500_REGUCTRLDISCH, |
88 | AB8500_REGUCTRLDISCH2, | 134 | AB8500_REGUCTRLDISCH2, |
89 | AB8500_VSMPS1SEL1, | ||
90 | AB8500_NUM_REGULATOR_REGISTERS, | 135 | AB8500_NUM_REGULATOR_REGISTERS, |
91 | }; | 136 | }; |
92 | 137 | ||
138 | /* AB8505 registers */ | ||
139 | enum ab8505_regulator_reg { | ||
140 | AB8505_REGUREQUESTCTRL1, | ||
141 | AB8505_REGUREQUESTCTRL2, | ||
142 | AB8505_REGUREQUESTCTRL3, | ||
143 | AB8505_REGUREQUESTCTRL4, | ||
144 | AB8505_REGUSYSCLKREQ1HPVALID1, | ||
145 | AB8505_REGUSYSCLKREQ1HPVALID2, | ||
146 | AB8505_REGUHWHPREQ1VALID1, | ||
147 | AB8505_REGUHWHPREQ1VALID2, | ||
148 | AB8505_REGUHWHPREQ2VALID1, | ||
149 | AB8505_REGUHWHPREQ2VALID2, | ||
150 | AB8505_REGUSWHPREQVALID1, | ||
151 | AB8505_REGUSWHPREQVALID2, | ||
152 | AB8505_REGUSYSCLKREQVALID1, | ||
153 | AB8505_REGUSYSCLKREQVALID2, | ||
154 | AB8505_REGUVAUX4REQVALID, | ||
155 | AB8505_REGUMISC1, | ||
156 | AB8505_VAUDIOSUPPLY, | ||
157 | AB8505_REGUCTRL1VAMIC, | ||
158 | AB8505_VSMPSAREGU, | ||
159 | AB8505_VSMPSBREGU, | ||
160 | AB8505_VSAFEREGU, /* NOTE! PRCMU register */ | ||
161 | AB8505_VPLLVANAREGU, | ||
162 | AB8505_EXTSUPPLYREGU, | ||
163 | AB8505_VAUX12REGU, | ||
164 | AB8505_VRF1VAUX3REGU, | ||
165 | AB8505_VSMPSASEL1, | ||
166 | AB8505_VSMPSASEL2, | ||
167 | AB8505_VSMPSASEL3, | ||
168 | AB8505_VSMPSBSEL1, | ||
169 | AB8505_VSMPSBSEL2, | ||
170 | AB8505_VSMPSBSEL3, | ||
171 | AB8505_VSAFESEL1, /* NOTE! PRCMU register */ | ||
172 | AB8505_VSAFESEL2, /* NOTE! PRCMU register */ | ||
173 | AB8505_VSAFESEL3, /* NOTE! PRCMU register */ | ||
174 | AB8505_VAUX1SEL, | ||
175 | AB8505_VAUX2SEL, | ||
176 | AB8505_VRF1VAUX3SEL, | ||
177 | AB8505_VAUX4REQCTRL, | ||
178 | AB8505_VAUX4REGU, | ||
179 | AB8505_VAUX4SEL, | ||
180 | AB8505_REGUCTRLDISCH, | ||
181 | AB8505_REGUCTRLDISCH2, | ||
182 | AB8505_REGUCTRLDISCH3, | ||
183 | AB8505_CTRLVAUX5, | ||
184 | AB8505_CTRLVAUX6, | ||
185 | AB8505_NUM_REGULATOR_REGISTERS, | ||
186 | }; | ||
93 | 187 | ||
94 | /* AB9540 registers */ | 188 | /* AB9540 registers */ |
95 | enum ab9540_regulator_reg { | 189 | enum ab9540_regulator_reg { |
@@ -139,4 +233,111 @@ enum ab9540_regulator_reg { | |||
139 | AB9540_NUM_REGULATOR_REGISTERS, | 233 | AB9540_NUM_REGULATOR_REGISTERS, |
140 | }; | 234 | }; |
141 | 235 | ||
236 | /* AB8540 registers */ | ||
237 | enum ab8540_regulator_reg { | ||
238 | AB8540_REGUREQUESTCTRL1, | ||
239 | AB8540_REGUREQUESTCTRL2, | ||
240 | AB8540_REGUREQUESTCTRL3, | ||
241 | AB8540_REGUREQUESTCTRL4, | ||
242 | AB8540_REGUSYSCLKREQ1HPVALID1, | ||
243 | AB8540_REGUSYSCLKREQ1HPVALID2, | ||
244 | AB8540_REGUHWHPREQ1VALID1, | ||
245 | AB8540_REGUHWHPREQ1VALID2, | ||
246 | AB8540_REGUHWHPREQ2VALID1, | ||
247 | AB8540_REGUHWHPREQ2VALID2, | ||
248 | AB8540_REGUSWHPREQVALID1, | ||
249 | AB8540_REGUSWHPREQVALID2, | ||
250 | AB8540_REGUSYSCLKREQVALID1, | ||
251 | AB8540_REGUSYSCLKREQVALID2, | ||
252 | AB8540_REGUVAUX4REQVALID, | ||
253 | AB8540_REGUVAUX5REQVALID, | ||
254 | AB8540_REGUVAUX6REQVALID, | ||
255 | AB8540_REGUVCLKBREQVALID, | ||
256 | AB8540_REGUVRF1REQVALID, | ||
257 | AB8540_REGUMISC1, | ||
258 | AB8540_VAUDIOSUPPLY, | ||
259 | AB8540_REGUCTRL1VAMIC, | ||
260 | AB8540_VHSIC, | ||
261 | AB8540_VSDIO, | ||
262 | AB8540_VSMPS1REGU, | ||
263 | AB8540_VSMPS2REGU, | ||
264 | AB8540_VSMPS3REGU, | ||
265 | AB8540_VPLLVANAREGU, | ||
266 | AB8540_EXTSUPPLYREGU, | ||
267 | AB8540_VAUX12REGU, | ||
268 | AB8540_VRF1VAUX3REGU, | ||
269 | AB8540_VSMPS1SEL1, | ||
270 | AB8540_VSMPS1SEL2, | ||
271 | AB8540_VSMPS1SEL3, | ||
272 | AB8540_VSMPS2SEL1, | ||
273 | AB8540_VSMPS2SEL2, | ||
274 | AB8540_VSMPS2SEL3, | ||
275 | AB8540_VSMPS3SEL1, | ||
276 | AB8540_VSMPS3SEL2, | ||
277 | AB8540_VAUX1SEL, | ||
278 | AB8540_VAUX2SEL, | ||
279 | AB8540_VRF1VAUX3SEL, | ||
280 | AB8540_REGUCTRL2SPARE, | ||
281 | AB8540_VAUX4REQCTRL, | ||
282 | AB8540_VAUX4REGU, | ||
283 | AB8540_VAUX4SEL, | ||
284 | AB8540_VAUX5REQCTRL, | ||
285 | AB8540_VAUX5REGU, | ||
286 | AB8540_VAUX5SEL, | ||
287 | AB8540_VAUX6REQCTRL, | ||
288 | AB8540_VAUX6REGU, | ||
289 | AB8540_VAUX6SEL, | ||
290 | AB8540_VCLKBREQCTRL, | ||
291 | AB8540_VCLKBREGU, | ||
292 | AB8540_VCLKBSEL, | ||
293 | AB8540_VRF1REQCTRL, | ||
294 | AB8540_REGUCTRLDISCH, | ||
295 | AB8540_REGUCTRLDISCH2, | ||
296 | AB8540_REGUCTRLDISCH3, | ||
297 | AB8540_REGUCTRLDISCH4, | ||
298 | AB8540_VSIMSYSCLKCTRL, | ||
299 | AB8540_VANAVPLLSEL, | ||
300 | AB8540_NUM_REGULATOR_REGISTERS, | ||
301 | }; | ||
302 | |||
303 | /* AB8500 external regulators */ | ||
304 | struct ab8500_ext_regulator_cfg { | ||
305 | bool hwreq; /* requires hw mode or high power mode */ | ||
306 | }; | ||
307 | |||
308 | enum ab8500_ext_regulator_id { | ||
309 | AB8500_EXT_SUPPLY1, | ||
310 | AB8500_EXT_SUPPLY2, | ||
311 | AB8500_EXT_SUPPLY3, | ||
312 | AB8500_NUM_EXT_REGULATORS, | ||
313 | }; | ||
314 | |||
315 | /* AB8500 regulator platform data */ | ||
316 | struct ab8500_regulator_platform_data { | ||
317 | int num_reg_init; | ||
318 | struct ab8500_regulator_reg_init *reg_init; | ||
319 | int num_regulator; | ||
320 | struct regulator_init_data *regulator; | ||
321 | int num_ext_regulator; | ||
322 | struct regulator_init_data *ext_regulator; | ||
323 | }; | ||
324 | |||
325 | #ifdef CONFIG_REGULATOR_AB8500_DEBUG | ||
326 | int ab8500_regulator_debug_init(struct platform_device *pdev); | ||
327 | int ab8500_regulator_debug_exit(struct platform_device *pdev); | ||
328 | #else | ||
329 | static inline int ab8500_regulator_debug_init(struct platform_device *pdev) | ||
330 | { | ||
331 | return 0; | ||
332 | } | ||
333 | static inline int ab8500_regulator_debug_exit(struct platform_device *pdev) | ||
334 | { | ||
335 | return 0; | ||
336 | } | ||
337 | #endif | ||
338 | |||
339 | /* AB8500 external regulator functions. */ | ||
340 | int ab8500_ext_regulator_init(struct platform_device *pdev); | ||
341 | void ab8500_ext_regulator_exit(struct platform_device *pdev); | ||
342 | |||
142 | #endif | 343 | #endif |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 7bc732ce6e50..145022a83085 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -141,18 +141,18 @@ void regulator_put(struct regulator *regulator); | |||
141 | void devm_regulator_put(struct regulator *regulator); | 141 | void devm_regulator_put(struct regulator *regulator); |
142 | 142 | ||
143 | /* regulator output control and status */ | 143 | /* regulator output control and status */ |
144 | int regulator_enable(struct regulator *regulator); | 144 | int __must_check regulator_enable(struct regulator *regulator); |
145 | int regulator_disable(struct regulator *regulator); | 145 | int regulator_disable(struct regulator *regulator); |
146 | int regulator_force_disable(struct regulator *regulator); | 146 | int regulator_force_disable(struct regulator *regulator); |
147 | int regulator_is_enabled(struct regulator *regulator); | 147 | int regulator_is_enabled(struct regulator *regulator); |
148 | int regulator_disable_deferred(struct regulator *regulator, int ms); | 148 | int regulator_disable_deferred(struct regulator *regulator, int ms); |
149 | 149 | ||
150 | int regulator_bulk_get(struct device *dev, int num_consumers, | 150 | int __must_check regulator_bulk_get(struct device *dev, int num_consumers, |
151 | struct regulator_bulk_data *consumers); | 151 | struct regulator_bulk_data *consumers); |
152 | int devm_regulator_bulk_get(struct device *dev, int num_consumers, | 152 | int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, |
153 | struct regulator_bulk_data *consumers); | 153 | struct regulator_bulk_data *consumers); |
154 | int regulator_bulk_enable(int num_consumers, | 154 | int __must_check regulator_bulk_enable(int num_consumers, |
155 | struct regulator_bulk_data *consumers); | 155 | struct regulator_bulk_data *consumers); |
156 | int regulator_bulk_disable(int num_consumers, | 156 | int regulator_bulk_disable(int num_consumers, |
157 | struct regulator_bulk_data *consumers); | 157 | struct regulator_bulk_data *consumers); |
158 | int regulator_bulk_force_disable(int num_consumers, | 158 | int regulator_bulk_force_disable(int num_consumers, |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 7df93f52db08..6700cc94bdd1 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -22,6 +22,7 @@ | |||
22 | struct regmap; | 22 | struct regmap; |
23 | struct regulator_dev; | 23 | struct regulator_dev; |
24 | struct regulator_init_data; | 24 | struct regulator_init_data; |
25 | struct regulator_enable_gpio; | ||
25 | 26 | ||
26 | enum regulator_status { | 27 | enum regulator_status { |
27 | REGULATOR_STATUS_OFF, | 28 | REGULATOR_STATUS_OFF, |
@@ -199,6 +200,8 @@ enum regulator_type { | |||
199 | * output when using regulator_set_voltage_sel_regmap | 200 | * output when using regulator_set_voltage_sel_regmap |
200 | * @enable_reg: Register for control when using regmap enable/disable ops | 201 | * @enable_reg: Register for control when using regmap enable/disable ops |
201 | * @enable_mask: Mask for control when using regmap enable/disable ops | 202 | * @enable_mask: Mask for control when using regmap enable/disable ops |
203 | * @enable_is_inverted: A flag to indicate set enable_mask bits to disable | ||
204 | * when using regulator_enable_regmap and friends APIs. | ||
202 | * @bypass_reg: Register for control when using regmap set_bypass | 205 | * @bypass_reg: Register for control when using regmap set_bypass |
203 | * @bypass_mask: Mask for control when using regmap set_bypass | 206 | * @bypass_mask: Mask for control when using regmap set_bypass |
204 | * | 207 | * |
@@ -228,6 +231,7 @@ struct regulator_desc { | |||
228 | unsigned int apply_bit; | 231 | unsigned int apply_bit; |
229 | unsigned int enable_reg; | 232 | unsigned int enable_reg; |
230 | unsigned int enable_mask; | 233 | unsigned int enable_mask; |
234 | bool enable_is_inverted; | ||
231 | unsigned int bypass_reg; | 235 | unsigned int bypass_reg; |
232 | unsigned int bypass_mask; | 236 | unsigned int bypass_mask; |
233 | 237 | ||
@@ -302,8 +306,7 @@ struct regulator_dev { | |||
302 | 306 | ||
303 | struct dentry *debugfs; | 307 | struct dentry *debugfs; |
304 | 308 | ||
305 | int ena_gpio; | 309 | struct regulator_enable_gpio *ena_pin; |
306 | unsigned int ena_gpio_invert:1; | ||
307 | unsigned int ena_gpio_state:1; | 310 | unsigned int ena_gpio_state:1; |
308 | }; | 311 | }; |
309 | 312 | ||
@@ -329,6 +332,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, | |||
329 | int min_uV, int max_uV); | 332 | int min_uV, int max_uV); |
330 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, | 333 | int regulator_map_voltage_iterate(struct regulator_dev *rdev, |
331 | int min_uV, int max_uV); | 334 | int min_uV, int max_uV); |
335 | int regulator_map_voltage_ascend(struct regulator_dev *rdev, | ||
336 | int min_uV, int max_uV); | ||
332 | int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); | 337 | int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); |
333 | int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); | 338 | int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); |
334 | int regulator_is_enabled_regmap(struct regulator_dev *rdev); | 339 | int regulator_is_enabled_regmap(struct regulator_dev *rdev); |
diff --git a/include/linux/regulator/max8952.h b/include/linux/regulator/max8952.h index 45e42855ad05..4dbb63a1d4ab 100644 --- a/include/linux/regulator/max8952.h +++ b/include/linux/regulator/max8952.h | |||
@@ -122,13 +122,13 @@ struct max8952_platform_data { | |||
122 | int gpio_vid1; | 122 | int gpio_vid1; |
123 | int gpio_en; | 123 | int gpio_en; |
124 | 124 | ||
125 | u8 default_mode; | 125 | u32 default_mode; |
126 | u8 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ | 126 | u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ |
127 | 127 | ||
128 | u8 sync_freq; | 128 | u32 sync_freq; |
129 | u8 ramp_speed; | 129 | u32 ramp_speed; |
130 | 130 | ||
131 | struct regulator_init_data reg_data; | 131 | struct regulator_init_data *reg_data; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | 134 | ||
diff --git a/include/linux/relay.h b/include/linux/relay.h index 91cacc34c159..d7c8359693c6 100644 --- a/include/linux/relay.h +++ b/include/linux/relay.h | |||
@@ -20,9 +20,6 @@ | |||
20 | #include <linux/poll.h> | 20 | #include <linux/poll.h> |
21 | #include <linux/kref.h> | 21 | #include <linux/kref.h> |
22 | 22 | ||
23 | /* Needs a _much_ better name... */ | ||
24 | #define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) | ||
25 | |||
26 | /* | 23 | /* |
27 | * Tracks changes to rchan/rchan_buf structs | 24 | * Tracks changes to rchan/rchan_buf structs |
28 | */ | 25 | */ |
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index faf33324c78f..9e7e745dac55 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h | |||
@@ -401,6 +401,9 @@ enum rproc_crash_type { | |||
401 | * @crash_comp: completion used to sync crash handler and the rproc reload | 401 | * @crash_comp: completion used to sync crash handler and the rproc reload |
402 | * @recovery_disabled: flag that state if recovery was disabled | 402 | * @recovery_disabled: flag that state if recovery was disabled |
403 | * @max_notifyid: largest allocated notify id. | 403 | * @max_notifyid: largest allocated notify id. |
404 | * @table_ptr: pointer to the resource table in effect | ||
405 | * @cached_table: copy of the resource table | ||
406 | * @table_csum: checksum of the resource table | ||
404 | */ | 407 | */ |
405 | struct rproc { | 408 | struct rproc { |
406 | struct klist_node node; | 409 | struct klist_node node; |
@@ -429,9 +432,13 @@ struct rproc { | |||
429 | struct completion crash_comp; | 432 | struct completion crash_comp; |
430 | bool recovery_disabled; | 433 | bool recovery_disabled; |
431 | int max_notifyid; | 434 | int max_notifyid; |
435 | struct resource_table *table_ptr; | ||
436 | struct resource_table *cached_table; | ||
437 | u32 table_csum; | ||
432 | }; | 438 | }; |
433 | 439 | ||
434 | /* we currently support only two vrings per rvdev */ | 440 | /* we currently support only two vrings per rvdev */ |
441 | |||
435 | #define RVDEV_NUM_VRINGS 2 | 442 | #define RVDEV_NUM_VRINGS 2 |
436 | 443 | ||
437 | /** | 444 | /** |
@@ -462,16 +469,14 @@ struct rproc_vring { | |||
462 | * @rproc: the rproc handle | 469 | * @rproc: the rproc handle |
463 | * @vdev: the virio device | 470 | * @vdev: the virio device |
464 | * @vring: the vrings for this vdev | 471 | * @vring: the vrings for this vdev |
465 | * @dfeatures: virtio device features | 472 | * @rsc_offset: offset of the vdev's resource entry |
466 | * @gfeatures: virtio guest features | ||
467 | */ | 473 | */ |
468 | struct rproc_vdev { | 474 | struct rproc_vdev { |
469 | struct list_head node; | 475 | struct list_head node; |
470 | struct rproc *rproc; | 476 | struct rproc *rproc; |
471 | struct virtio_device vdev; | 477 | struct virtio_device vdev; |
472 | struct rproc_vring vring[RVDEV_NUM_VRINGS]; | 478 | struct rproc_vring vring[RVDEV_NUM_VRINGS]; |
473 | unsigned long dfeatures; | 479 | u32 rsc_offset; |
474 | unsigned long gfeatures; | ||
475 | }; | 480 | }; |
476 | 481 | ||
477 | struct rproc *rproc_alloc(struct device *dev, const char *name, | 482 | struct rproc *rproc_alloc(struct device *dev, const char *name, |
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index c23099413ad6..96a509b6be04 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -13,7 +13,7 @@ | |||
13 | * info about what this counter is. | 13 | * info about what this counter is. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/cgroup.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | 18 | ||
19 | /* | 19 | /* |
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h new file mode 100644 index 000000000000..2f61311ae3e0 --- /dev/null +++ b/include/linux/reset-controller.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef _LINUX_RESET_CONTROLLER_H_ | ||
2 | #define _LINUX_RESET_CONTROLLER_H_ | ||
3 | |||
4 | #include <linux/list.h> | ||
5 | |||
6 | struct reset_controller_dev; | ||
7 | |||
8 | /** | ||
9 | * struct reset_control_ops | ||
10 | * | ||
11 | * @reset: for self-deasserting resets, does all necessary | ||
12 | * things to reset the device | ||
13 | * @assert: manually assert the reset line, if supported | ||
14 | * @deassert: manually deassert the reset line, if supported | ||
15 | */ | ||
16 | struct reset_control_ops { | ||
17 | int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); | ||
18 | int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); | ||
19 | int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); | ||
20 | }; | ||
21 | |||
22 | struct module; | ||
23 | struct device_node; | ||
24 | |||
25 | /** | ||
26 | * struct reset_controller_dev - reset controller entity that might | ||
27 | * provide multiple reset controls | ||
28 | * @ops: a pointer to device specific struct reset_control_ops | ||
29 | * @owner: kernel module of the reset controller driver | ||
30 | * @list: internal list of reset controller devices | ||
31 | * @of_node: corresponding device tree node as phandle target | ||
32 | * @of_reset_n_cells: number of cells in reset line specifiers | ||
33 | * @of_xlate: translation function to translate from specifier as found in the | ||
34 | * device tree to id as given to the reset control ops | ||
35 | * @nr_resets: number of reset controls in this reset controller device | ||
36 | */ | ||
37 | struct reset_controller_dev { | ||
38 | struct reset_control_ops *ops; | ||
39 | struct module *owner; | ||
40 | struct list_head list; | ||
41 | struct device_node *of_node; | ||
42 | int of_reset_n_cells; | ||
43 | int (*of_xlate)(struct reset_controller_dev *rcdev, | ||
44 | const struct of_phandle_args *reset_spec); | ||
45 | unsigned int nr_resets; | ||
46 | }; | ||
47 | |||
48 | int reset_controller_register(struct reset_controller_dev *rcdev); | ||
49 | void reset_controller_unregister(struct reset_controller_dev *rcdev); | ||
50 | |||
51 | #endif | ||
diff --git a/include/linux/reset.h b/include/linux/reset.h new file mode 100644 index 000000000000..6082247feab1 --- /dev/null +++ b/include/linux/reset.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _LINUX_RESET_H_ | ||
2 | #define _LINUX_RESET_H_ | ||
3 | |||
4 | struct device; | ||
5 | struct reset_control; | ||
6 | |||
7 | int reset_control_reset(struct reset_control *rstc); | ||
8 | int reset_control_assert(struct reset_control *rstc); | ||
9 | int reset_control_deassert(struct reset_control *rstc); | ||
10 | |||
11 | struct reset_control *reset_control_get(struct device *dev, const char *id); | ||
12 | void reset_control_put(struct reset_control *rstc); | ||
13 | struct reset_control *devm_reset_control_get(struct device *dev, const char *id); | ||
14 | |||
15 | int device_reset(struct device *dev); | ||
16 | |||
17 | #endif | ||
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 1342e69542f3..d69cf637a15a 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/kmemcheck.h> | 4 | #include <linux/kmemcheck.h> |
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <linux/seq_file.h> | 6 | #include <linux/seq_file.h> |
7 | #include <linux/poll.h> | ||
7 | 8 | ||
8 | struct ring_buffer; | 9 | struct ring_buffer; |
9 | struct ring_buffer_iter; | 10 | struct ring_buffer_iter; |
@@ -96,6 +97,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k | |||
96 | __ring_buffer_alloc((size), (flags), &__key); \ | 97 | __ring_buffer_alloc((size), (flags), &__key); \ |
97 | }) | 98 | }) |
98 | 99 | ||
100 | void ring_buffer_wait(struct ring_buffer *buffer, int cpu); | ||
101 | int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, | ||
102 | struct file *filp, poll_table *poll_table); | ||
103 | |||
104 | |||
99 | #define RING_BUFFER_ALL_CPUS -1 | 105 | #define RING_BUFFER_ALL_CPUS -1 |
100 | 106 | ||
101 | void ring_buffer_free(struct ring_buffer *buffer); | 107 | void ring_buffer_free(struct ring_buffer *buffer); |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 580b24c8b8ca..c2c28975293c 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -133,7 +133,13 @@ extern struct rtc_device *rtc_device_register(const char *name, | |||
133 | struct device *dev, | 133 | struct device *dev, |
134 | const struct rtc_class_ops *ops, | 134 | const struct rtc_class_ops *ops, |
135 | struct module *owner); | 135 | struct module *owner); |
136 | extern struct rtc_device *devm_rtc_device_register(struct device *dev, | ||
137 | const char *name, | ||
138 | const struct rtc_class_ops *ops, | ||
139 | struct module *owner); | ||
136 | extern void rtc_device_unregister(struct rtc_device *rtc); | 140 | extern void rtc_device_unregister(struct rtc_device *rtc); |
141 | extern void devm_rtc_device_unregister(struct device *dev, | ||
142 | struct rtc_device *rtc); | ||
137 | 143 | ||
138 | extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); | 144 | extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); |
139 | extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); | 145 | extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 489dd7bb28ec..f28544b2f9af 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -69,6 +69,15 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb, | |||
69 | struct netlink_callback *cb, | 69 | struct netlink_callback *cb, |
70 | struct net_device *dev, | 70 | struct net_device *dev, |
71 | int idx); | 71 | int idx); |
72 | extern int ndo_dflt_fdb_add(struct ndmsg *ndm, | ||
73 | struct nlattr *tb[], | ||
74 | struct net_device *dev, | ||
75 | const unsigned char *addr, | ||
76 | u16 flags); | ||
77 | extern int ndo_dflt_fdb_del(struct ndmsg *ndm, | ||
78 | struct nlattr *tb[], | ||
79 | struct net_device *dev, | ||
80 | const unsigned char *addr); | ||
72 | 81 | ||
73 | extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | 82 | extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, |
74 | struct net_device *dev, u16 mode); | 83 | struct net_device *dev, u16 mode); |
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 8da67d625e13..0616ffe45702 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
@@ -133,10 +133,20 @@ do { \ | |||
133 | _down_write_nest_lock(sem, &(nest_lock)->dep_map); \ | 133 | _down_write_nest_lock(sem, &(nest_lock)->dep_map); \ |
134 | } while (0); | 134 | } while (0); |
135 | 135 | ||
136 | /* | ||
137 | * Take/release a lock when not the owner will release it. | ||
138 | * | ||
139 | * [ This API should be avoided as much as possible - the | ||
140 | * proper abstraction for this case is completions. ] | ||
141 | */ | ||
142 | extern void down_read_non_owner(struct rw_semaphore *sem); | ||
143 | extern void up_read_non_owner(struct rw_semaphore *sem); | ||
136 | #else | 144 | #else |
137 | # define down_read_nested(sem, subclass) down_read(sem) | 145 | # define down_read_nested(sem, subclass) down_read(sem) |
138 | # define down_write_nest_lock(sem, nest_lock) down_write(sem) | 146 | # define down_write_nest_lock(sem, nest_lock) down_write(sem) |
139 | # define down_write_nested(sem, subclass) down_write(sem) | 147 | # define down_write_nested(sem, subclass) down_write(sem) |
148 | # define down_read_non_owner(sem) down_read(sem) | ||
149 | # define up_read_non_owner(sem) up_read(sem) | ||
140 | #endif | 150 | #endif |
141 | 151 | ||
142 | #endif /* _LINUX_RWSEM_H */ | 152 | #endif /* _LINUX_RWSEM_H */ |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 2d8bdaef9611..5951e3f38878 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -172,6 +172,22 @@ static inline void sg_mark_end(struct scatterlist *sg) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * sg_unmark_end - Undo setting the end of the scatterlist | ||
176 | * @sg: SG entryScatterlist | ||
177 | * | ||
178 | * Description: | ||
179 | * Removes the termination marker from the given entry of the scatterlist. | ||
180 | * | ||
181 | **/ | ||
182 | static inline void sg_unmark_end(struct scatterlist *sg) | ||
183 | { | ||
184 | #ifdef CONFIG_DEBUG_SG | ||
185 | BUG_ON(sg->sg_magic != SG_MAGIC); | ||
186 | #endif | ||
187 | sg->page_link &= ~0x02; | ||
188 | } | ||
189 | |||
190 | /** | ||
175 | * sg_phys - Return physical address of an sg entry | 191 | * sg_phys - Return physical address of an sg entry |
176 | * @sg: SG entry | 192 | * @sg: SG entry |
177 | * | 193 | * |
@@ -235,13 +251,13 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, | |||
235 | * sg page iterator | 251 | * sg page iterator |
236 | * | 252 | * |
237 | * Iterates over sg entries page-by-page. On each successful iteration, | 253 | * Iterates over sg entries page-by-page. On each successful iteration, |
238 | * @piter->page points to the current page, @piter->sg to the sg holding this | 254 | * you can call sg_page_iter_page(@piter) and sg_page_iter_dma_address(@piter) |
239 | * page and @piter->sg_pgoffset to the page's page offset within the sg. The | 255 | * to get the current page and its dma address. @piter->sg will point to the |
240 | * iteration will stop either when a maximum number of sg entries was reached | 256 | * sg holding this page and @piter->sg_pgoffset to the page's page offset |
241 | * or a terminating sg (sg_last(sg) == true) was reached. | 257 | * within the sg. The iteration will stop either when a maximum number of sg |
258 | * entries was reached or a terminating sg (sg_last(sg) == true) was reached. | ||
242 | */ | 259 | */ |
243 | struct sg_page_iter { | 260 | struct sg_page_iter { |
244 | struct page *page; /* current page */ | ||
245 | struct scatterlist *sg; /* sg holding the page */ | 261 | struct scatterlist *sg; /* sg holding the page */ |
246 | unsigned int sg_pgoffset; /* page offset within the sg */ | 262 | unsigned int sg_pgoffset; /* page offset within the sg */ |
247 | 263 | ||
@@ -255,6 +271,24 @@ bool __sg_page_iter_next(struct sg_page_iter *piter); | |||
255 | void __sg_page_iter_start(struct sg_page_iter *piter, | 271 | void __sg_page_iter_start(struct sg_page_iter *piter, |
256 | struct scatterlist *sglist, unsigned int nents, | 272 | struct scatterlist *sglist, unsigned int nents, |
257 | unsigned long pgoffset); | 273 | unsigned long pgoffset); |
274 | /** | ||
275 | * sg_page_iter_page - get the current page held by the page iterator | ||
276 | * @piter: page iterator holding the page | ||
277 | */ | ||
278 | static inline struct page *sg_page_iter_page(struct sg_page_iter *piter) | ||
279 | { | ||
280 | return nth_page(sg_page(piter->sg), piter->sg_pgoffset); | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * sg_page_iter_dma_address - get the dma address of the current page held by | ||
285 | * the page iterator. | ||
286 | * @piter: page iterator holding the page | ||
287 | */ | ||
288 | static inline dma_addr_t sg_page_iter_dma_address(struct sg_page_iter *piter) | ||
289 | { | ||
290 | return sg_dma_address(piter->sg) + (piter->sg_pgoffset << PAGE_SHIFT); | ||
291 | } | ||
258 | 292 | ||
259 | /** | 293 | /** |
260 | * for_each_sg_page - iterate over the pages of the given sg list | 294 | * for_each_sg_page - iterate over the pages of the given sg list |
diff --git a/include/linux/sched.h b/include/linux/sched.h index e692a022527b..178a8d909f14 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -127,18 +127,6 @@ extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); | |||
127 | extern void proc_sched_set_task(struct task_struct *p); | 127 | extern void proc_sched_set_task(struct task_struct *p); |
128 | extern void | 128 | extern void |
129 | print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); | 129 | print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); |
130 | #else | ||
131 | static inline void | ||
132 | proc_sched_show_task(struct task_struct *p, struct seq_file *m) | ||
133 | { | ||
134 | } | ||
135 | static inline void proc_sched_set_task(struct task_struct *p) | ||
136 | { | ||
137 | } | ||
138 | static inline void | ||
139 | print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | ||
140 | { | ||
141 | } | ||
142 | #endif | 130 | #endif |
143 | 131 | ||
144 | /* | 132 | /* |
@@ -243,7 +231,7 @@ extern void init_idle_bootup_task(struct task_struct *idle); | |||
243 | 231 | ||
244 | extern int runqueue_is_locked(int cpu); | 232 | extern int runqueue_is_locked(int cpu); |
245 | 233 | ||
246 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) | 234 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) |
247 | extern void nohz_balance_enter_idle(int cpu); | 235 | extern void nohz_balance_enter_idle(int cpu); |
248 | extern void set_cpu_sd_state_idle(void); | 236 | extern void set_cpu_sd_state_idle(void); |
249 | extern int get_nohz_timer_target(void); | 237 | extern int get_nohz_timer_target(void); |
@@ -321,13 +309,10 @@ extern signed long schedule_timeout_killable(signed long timeout); | |||
321 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 309 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
322 | asmlinkage void schedule(void); | 310 | asmlinkage void schedule(void); |
323 | extern void schedule_preempt_disabled(void); | 311 | extern void schedule_preempt_disabled(void); |
324 | extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); | ||
325 | 312 | ||
326 | struct nsproxy; | 313 | struct nsproxy; |
327 | struct user_namespace; | 314 | struct user_namespace; |
328 | 315 | ||
329 | #include <linux/aio.h> | ||
330 | |||
331 | #ifdef CONFIG_MMU | 316 | #ifdef CONFIG_MMU |
332 | extern void arch_pick_mmap_layout(struct mm_struct *mm); | 317 | extern void arch_pick_mmap_layout(struct mm_struct *mm); |
333 | extern unsigned long | 318 | extern unsigned long |
@@ -527,7 +512,8 @@ struct signal_struct { | |||
527 | unsigned int has_child_subreaper:1; | 512 | unsigned int has_child_subreaper:1; |
528 | 513 | ||
529 | /* POSIX.1b Interval Timers */ | 514 | /* POSIX.1b Interval Timers */ |
530 | struct list_head posix_timers; | 515 | int posix_timer_id; |
516 | struct list_head posix_timers; | ||
531 | 517 | ||
532 | /* ITIMER_REAL timer for the process */ | 518 | /* ITIMER_REAL timer for the process */ |
533 | struct hrtimer real_timer; | 519 | struct hrtimer real_timer; |
@@ -571,7 +557,7 @@ struct signal_struct { | |||
571 | cputime_t utime, stime, cutime, cstime; | 557 | cputime_t utime, stime, cutime, cstime; |
572 | cputime_t gtime; | 558 | cputime_t gtime; |
573 | cputime_t cgtime; | 559 | cputime_t cgtime; |
574 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 560 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE |
575 | struct cputime prev_cputime; | 561 | struct cputime prev_cputime; |
576 | #endif | 562 | #endif |
577 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 563 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
@@ -607,6 +593,7 @@ struct signal_struct { | |||
607 | #endif | 593 | #endif |
608 | #ifdef CONFIG_AUDIT | 594 | #ifdef CONFIG_AUDIT |
609 | unsigned audit_tty; | 595 | unsigned audit_tty; |
596 | unsigned audit_tty_log_passwd; | ||
610 | struct tty_audit_buf *tty_audit_buf; | 597 | struct tty_audit_buf *tty_audit_buf; |
611 | #endif | 598 | #endif |
612 | #ifdef CONFIG_CGROUPS | 599 | #ifdef CONFIG_CGROUPS |
@@ -638,6 +625,7 @@ struct signal_struct { | |||
638 | #define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */ | 625 | #define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */ |
639 | #define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */ | 626 | #define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */ |
640 | #define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */ | 627 | #define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */ |
628 | #define SIGNAL_GROUP_COREDUMP 0x00000008 /* coredump in progress */ | ||
641 | /* | 629 | /* |
642 | * Pending notifications to parent. | 630 | * Pending notifications to parent. |
643 | */ | 631 | */ |
@@ -769,31 +757,6 @@ enum cpu_idle_type { | |||
769 | }; | 757 | }; |
770 | 758 | ||
771 | /* | 759 | /* |
772 | * Increase resolution of nice-level calculations for 64-bit architectures. | ||
773 | * The extra resolution improves shares distribution and load balancing of | ||
774 | * low-weight task groups (eg. nice +19 on an autogroup), deeper taskgroup | ||
775 | * hierarchies, especially on larger systems. This is not a user-visible change | ||
776 | * and does not change the user-interface for setting shares/weights. | ||
777 | * | ||
778 | * We increase resolution only if we have enough bits to allow this increased | ||
779 | * resolution (i.e. BITS_PER_LONG > 32). The costs for increasing resolution | ||
780 | * when BITS_PER_LONG <= 32 are pretty high and the returns do not justify the | ||
781 | * increased costs. | ||
782 | */ | ||
783 | #if 0 /* BITS_PER_LONG > 32 -- currently broken: it increases power usage under light load */ | ||
784 | # define SCHED_LOAD_RESOLUTION 10 | ||
785 | # define scale_load(w) ((w) << SCHED_LOAD_RESOLUTION) | ||
786 | # define scale_load_down(w) ((w) >> SCHED_LOAD_RESOLUTION) | ||
787 | #else | ||
788 | # define SCHED_LOAD_RESOLUTION 0 | ||
789 | # define scale_load(w) (w) | ||
790 | # define scale_load_down(w) (w) | ||
791 | #endif | ||
792 | |||
793 | #define SCHED_LOAD_SHIFT (10 + SCHED_LOAD_RESOLUTION) | ||
794 | #define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT) | ||
795 | |||
796 | /* | ||
797 | * Increase resolution of cpu_power calculations | 760 | * Increase resolution of cpu_power calculations |
798 | */ | 761 | */ |
799 | #define SCHED_POWER_SHIFT 10 | 762 | #define SCHED_POWER_SHIFT 10 |
@@ -818,62 +781,6 @@ enum cpu_idle_type { | |||
818 | 781 | ||
819 | extern int __weak arch_sd_sibiling_asym_packing(void); | 782 | extern int __weak arch_sd_sibiling_asym_packing(void); |
820 | 783 | ||
821 | struct sched_group_power { | ||
822 | atomic_t ref; | ||
823 | /* | ||
824 | * CPU power of this group, SCHED_LOAD_SCALE being max power for a | ||
825 | * single CPU. | ||
826 | */ | ||
827 | unsigned int power, power_orig; | ||
828 | unsigned long next_update; | ||
829 | /* | ||
830 | * Number of busy cpus in this group. | ||
831 | */ | ||
832 | atomic_t nr_busy_cpus; | ||
833 | |||
834 | unsigned long cpumask[0]; /* iteration mask */ | ||
835 | }; | ||
836 | |||
837 | struct sched_group { | ||
838 | struct sched_group *next; /* Must be a circular list */ | ||
839 | atomic_t ref; | ||
840 | |||
841 | unsigned int group_weight; | ||
842 | struct sched_group_power *sgp; | ||
843 | |||
844 | /* | ||
845 | * The CPUs this group covers. | ||
846 | * | ||
847 | * NOTE: this field is variable length. (Allocated dynamically | ||
848 | * by attaching extra space to the end of the structure, | ||
849 | * depending on how many CPUs the kernel has booted up with) | ||
850 | */ | ||
851 | unsigned long cpumask[0]; | ||
852 | }; | ||
853 | |||
854 | static inline struct cpumask *sched_group_cpus(struct sched_group *sg) | ||
855 | { | ||
856 | return to_cpumask(sg->cpumask); | ||
857 | } | ||
858 | |||
859 | /* | ||
860 | * cpumask masking which cpus in the group are allowed to iterate up the domain | ||
861 | * tree. | ||
862 | */ | ||
863 | static inline struct cpumask *sched_group_mask(struct sched_group *sg) | ||
864 | { | ||
865 | return to_cpumask(sg->sgp->cpumask); | ||
866 | } | ||
867 | |||
868 | /** | ||
869 | * group_first_cpu - Returns the first cpu in the cpumask of a sched_group. | ||
870 | * @group: The group whose first cpu is to be returned. | ||
871 | */ | ||
872 | static inline unsigned int group_first_cpu(struct sched_group *group) | ||
873 | { | ||
874 | return cpumask_first(sched_group_cpus(group)); | ||
875 | } | ||
876 | |||
877 | struct sched_domain_attr { | 784 | struct sched_domain_attr { |
878 | int relax_domain_level; | 785 | int relax_domain_level; |
879 | }; | 786 | }; |
@@ -884,6 +791,8 @@ struct sched_domain_attr { | |||
884 | 791 | ||
885 | extern int sched_domain_level_max; | 792 | extern int sched_domain_level_max; |
886 | 793 | ||
794 | struct sched_group; | ||
795 | |||
887 | struct sched_domain { | 796 | struct sched_domain { |
888 | /* These fields must be setup */ | 797 | /* These fields must be setup */ |
889 | struct sched_domain *parent; /* top domain must be null terminated */ | 798 | struct sched_domain *parent; /* top domain must be null terminated */ |
@@ -900,6 +809,8 @@ struct sched_domain { | |||
900 | unsigned int wake_idx; | 809 | unsigned int wake_idx; |
901 | unsigned int forkexec_idx; | 810 | unsigned int forkexec_idx; |
902 | unsigned int smt_gain; | 811 | unsigned int smt_gain; |
812 | |||
813 | int nohz_idle; /* NOHZ IDLE status */ | ||
903 | int flags; /* See SD_* */ | 814 | int flags; /* See SD_* */ |
904 | int level; | 815 | int level; |
905 | 816 | ||
@@ -972,18 +883,6 @@ extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], | |||
972 | cpumask_var_t *alloc_sched_domains(unsigned int ndoms); | 883 | cpumask_var_t *alloc_sched_domains(unsigned int ndoms); |
973 | void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); | 884 | void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); |
974 | 885 | ||
975 | /* Test a flag in parent sched domain */ | ||
976 | static inline int test_sd_parent(struct sched_domain *sd, int flag) | ||
977 | { | ||
978 | if (sd->parent && (sd->parent->flags & flag)) | ||
979 | return 1; | ||
980 | |||
981 | return 0; | ||
982 | } | ||
983 | |||
984 | unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); | ||
985 | unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); | ||
986 | |||
987 | bool cpus_share_cache(int this_cpu, int that_cpu); | 886 | bool cpus_share_cache(int this_cpu, int that_cpu); |
988 | 887 | ||
989 | #else /* CONFIG_SMP */ | 888 | #else /* CONFIG_SMP */ |
@@ -1018,72 +917,6 @@ struct mempolicy; | |||
1018 | struct pipe_inode_info; | 917 | struct pipe_inode_info; |
1019 | struct uts_namespace; | 918 | struct uts_namespace; |
1020 | 919 | ||
1021 | struct rq; | ||
1022 | struct sched_domain; | ||
1023 | |||
1024 | /* | ||
1025 | * wake flags | ||
1026 | */ | ||
1027 | #define WF_SYNC 0x01 /* waker goes to sleep after wakup */ | ||
1028 | #define WF_FORK 0x02 /* child wakeup after fork */ | ||
1029 | #define WF_MIGRATED 0x04 /* internal use, task got migrated */ | ||
1030 | |||
1031 | #define ENQUEUE_WAKEUP 1 | ||
1032 | #define ENQUEUE_HEAD 2 | ||
1033 | #ifdef CONFIG_SMP | ||
1034 | #define ENQUEUE_WAKING 4 /* sched_class::task_waking was called */ | ||
1035 | #else | ||
1036 | #define ENQUEUE_WAKING 0 | ||
1037 | #endif | ||
1038 | |||
1039 | #define DEQUEUE_SLEEP 1 | ||
1040 | |||
1041 | struct sched_class { | ||
1042 | const struct sched_class *next; | ||
1043 | |||
1044 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); | ||
1045 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); | ||
1046 | void (*yield_task) (struct rq *rq); | ||
1047 | bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt); | ||
1048 | |||
1049 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); | ||
1050 | |||
1051 | struct task_struct * (*pick_next_task) (struct rq *rq); | ||
1052 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); | ||
1053 | |||
1054 | #ifdef CONFIG_SMP | ||
1055 | int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); | ||
1056 | void (*migrate_task_rq)(struct task_struct *p, int next_cpu); | ||
1057 | |||
1058 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | ||
1059 | void (*post_schedule) (struct rq *this_rq); | ||
1060 | void (*task_waking) (struct task_struct *task); | ||
1061 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | ||
1062 | |||
1063 | void (*set_cpus_allowed)(struct task_struct *p, | ||
1064 | const struct cpumask *newmask); | ||
1065 | |||
1066 | void (*rq_online)(struct rq *rq); | ||
1067 | void (*rq_offline)(struct rq *rq); | ||
1068 | #endif | ||
1069 | |||
1070 | void (*set_curr_task) (struct rq *rq); | ||
1071 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | ||
1072 | void (*task_fork) (struct task_struct *p); | ||
1073 | |||
1074 | void (*switched_from) (struct rq *this_rq, struct task_struct *task); | ||
1075 | void (*switched_to) (struct rq *this_rq, struct task_struct *task); | ||
1076 | void (*prio_changed) (struct rq *this_rq, struct task_struct *task, | ||
1077 | int oldprio); | ||
1078 | |||
1079 | unsigned int (*get_rr_interval) (struct rq *rq, | ||
1080 | struct task_struct *task); | ||
1081 | |||
1082 | #ifdef CONFIG_FAIR_GROUP_SCHED | ||
1083 | void (*task_move_group) (struct task_struct *p, int on_rq); | ||
1084 | #endif | ||
1085 | }; | ||
1086 | |||
1087 | struct load_weight { | 920 | struct load_weight { |
1088 | unsigned long weight, inv_weight; | 921 | unsigned long weight, inv_weight; |
1089 | }; | 922 | }; |
@@ -1275,8 +1108,10 @@ struct task_struct { | |||
1275 | int exit_code, exit_signal; | 1108 | int exit_code, exit_signal; |
1276 | int pdeath_signal; /* The signal sent when the parent dies */ | 1109 | int pdeath_signal; /* The signal sent when the parent dies */ |
1277 | unsigned int jobctl; /* JOBCTL_*, siglock protected */ | 1110 | unsigned int jobctl; /* JOBCTL_*, siglock protected */ |
1278 | /* ??? */ | 1111 | |
1112 | /* Used for emulating ABI behavior of previous Linux versions */ | ||
1279 | unsigned int personality; | 1113 | unsigned int personality; |
1114 | |||
1280 | unsigned did_exec:1; | 1115 | unsigned did_exec:1; |
1281 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an | 1116 | unsigned in_execve:1; /* Tell the LSMs that the process is doing an |
1282 | * execve */ | 1117 | * execve */ |
@@ -1328,7 +1163,7 @@ struct task_struct { | |||
1328 | 1163 | ||
1329 | cputime_t utime, stime, utimescaled, stimescaled; | 1164 | cputime_t utime, stime, utimescaled, stimescaled; |
1330 | cputime_t gtime; | 1165 | cputime_t gtime; |
1331 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | 1166 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE |
1332 | struct cputime prev_cputime; | 1167 | struct cputime prev_cputime; |
1333 | #endif | 1168 | #endif |
1334 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN | 1169 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN |
@@ -1577,6 +1412,10 @@ struct task_struct { | |||
1577 | #ifdef CONFIG_UPROBES | 1412 | #ifdef CONFIG_UPROBES |
1578 | struct uprobe_task *utask; | 1413 | struct uprobe_task *utask; |
1579 | #endif | 1414 | #endif |
1415 | #if defined(CONFIG_BCACHE) || defined(CONFIG_BCACHE_MODULE) | ||
1416 | unsigned int sequential_io; | ||
1417 | unsigned int sequential_io_avg; | ||
1418 | #endif | ||
1580 | }; | 1419 | }; |
1581 | 1420 | ||
1582 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1421 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
@@ -1794,7 +1633,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, | |||
1794 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ | 1633 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
1795 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ | 1634 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ |
1796 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ | 1635 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ |
1797 | #define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ | 1636 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ |
1798 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ | 1637 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
1799 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1638 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
1800 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1639 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
@@ -1928,13 +1767,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, | |||
1928 | } | 1767 | } |
1929 | #endif | 1768 | #endif |
1930 | 1769 | ||
1931 | #ifdef CONFIG_NO_HZ | 1770 | #ifdef CONFIG_NO_HZ_COMMON |
1932 | void calc_load_enter_idle(void); | 1771 | void calc_load_enter_idle(void); |
1933 | void calc_load_exit_idle(void); | 1772 | void calc_load_exit_idle(void); |
1934 | #else | 1773 | #else |
1935 | static inline void calc_load_enter_idle(void) { } | 1774 | static inline void calc_load_enter_idle(void) { } |
1936 | static inline void calc_load_exit_idle(void) { } | 1775 | static inline void calc_load_exit_idle(void) { } |
1937 | #endif /* CONFIG_NO_HZ */ | 1776 | #endif /* CONFIG_NO_HZ_COMMON */ |
1938 | 1777 | ||
1939 | #ifndef CONFIG_CPUMASK_OFFSTACK | 1778 | #ifndef CONFIG_CPUMASK_OFFSTACK |
1940 | static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | 1779 | static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) |
@@ -2020,10 +1859,17 @@ extern void idle_task_exit(void); | |||
2020 | static inline void idle_task_exit(void) {} | 1859 | static inline void idle_task_exit(void) {} |
2021 | #endif | 1860 | #endif |
2022 | 1861 | ||
2023 | #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) | 1862 | #if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP) |
2024 | extern void wake_up_idle_cpu(int cpu); | 1863 | extern void wake_up_nohz_cpu(int cpu); |
2025 | #else | 1864 | #else |
2026 | static inline void wake_up_idle_cpu(int cpu) { } | 1865 | static inline void wake_up_nohz_cpu(int cpu) { } |
1866 | #endif | ||
1867 | |||
1868 | #ifdef CONFIG_NO_HZ_FULL | ||
1869 | extern bool sched_can_stop_tick(void); | ||
1870 | extern u64 scheduler_tick_max_deferment(void); | ||
1871 | #else | ||
1872 | static inline bool sched_can_stop_tick(void) { return false; } | ||
2027 | #endif | 1873 | #endif |
2028 | 1874 | ||
2029 | #ifdef CONFIG_SCHED_AUTOGROUP | 1875 | #ifdef CONFIG_SCHED_AUTOGROUP |
@@ -2413,27 +2259,18 @@ static inline void threadgroup_change_end(struct task_struct *tsk) | |||
2413 | * | 2259 | * |
2414 | * Lock the threadgroup @tsk belongs to. No new task is allowed to enter | 2260 | * Lock the threadgroup @tsk belongs to. No new task is allowed to enter |
2415 | * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or | 2261 | * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or |
2416 | * perform exec. This is useful for cases where the threadgroup needs to | 2262 | * change ->group_leader/pid. This is useful for cases where the threadgroup |
2417 | * stay stable across blockable operations. | 2263 | * needs to stay stable across blockable operations. |
2418 | * | 2264 | * |
2419 | * fork and exit paths explicitly call threadgroup_change_{begin|end}() for | 2265 | * fork and exit paths explicitly call threadgroup_change_{begin|end}() for |
2420 | * synchronization. While held, no new task will be added to threadgroup | 2266 | * synchronization. While held, no new task will be added to threadgroup |
2421 | * and no existing live task will have its PF_EXITING set. | 2267 | * and no existing live task will have its PF_EXITING set. |
2422 | * | 2268 | * |
2423 | * During exec, a task goes and puts its thread group through unusual | 2269 | * de_thread() does threadgroup_change_{begin|end}() when a non-leader |
2424 | * changes. After de-threading, exclusive access is assumed to resources | 2270 | * sub-thread becomes a new leader. |
2425 | * which are usually shared by tasks in the same group - e.g. sighand may | ||
2426 | * be replaced with a new one. Also, the exec'ing task takes over group | ||
2427 | * leader role including its pid. Exclude these changes while locked by | ||
2428 | * grabbing cred_guard_mutex which is used to synchronize exec path. | ||
2429 | */ | 2271 | */ |
2430 | static inline void threadgroup_lock(struct task_struct *tsk) | 2272 | static inline void threadgroup_lock(struct task_struct *tsk) |
2431 | { | 2273 | { |
2432 | /* | ||
2433 | * exec uses exit for de-threading nesting group_rwsem inside | ||
2434 | * cred_guard_mutex. Grab cred_guard_mutex first. | ||
2435 | */ | ||
2436 | mutex_lock(&tsk->signal->cred_guard_mutex); | ||
2437 | down_write(&tsk->signal->group_rwsem); | 2274 | down_write(&tsk->signal->group_rwsem); |
2438 | } | 2275 | } |
2439 | 2276 | ||
@@ -2446,7 +2283,6 @@ static inline void threadgroup_lock(struct task_struct *tsk) | |||
2446 | static inline void threadgroup_unlock(struct task_struct *tsk) | 2283 | static inline void threadgroup_unlock(struct task_struct *tsk) |
2447 | { | 2284 | { |
2448 | up_write(&tsk->signal->group_rwsem); | 2285 | up_write(&tsk->signal->group_rwsem); |
2449 | mutex_unlock(&tsk->signal->cred_guard_mutex); | ||
2450 | } | 2286 | } |
2451 | #else | 2287 | #else |
2452 | static inline void threadgroup_change_begin(struct task_struct *tsk) {} | 2288 | static inline void threadgroup_change_begin(struct task_struct *tsk) {} |
@@ -2623,6 +2459,47 @@ static inline int spin_needbreak(spinlock_t *lock) | |||
2623 | } | 2459 | } |
2624 | 2460 | ||
2625 | /* | 2461 | /* |
2462 | * Idle thread specific functions to determine the need_resched | ||
2463 | * polling state. We have two versions, one based on TS_POLLING in | ||
2464 | * thread_info.status and one based on TIF_POLLING_NRFLAG in | ||
2465 | * thread_info.flags | ||
2466 | */ | ||
2467 | #ifdef TS_POLLING | ||
2468 | static inline int tsk_is_polling(struct task_struct *p) | ||
2469 | { | ||
2470 | return task_thread_info(p)->status & TS_POLLING; | ||
2471 | } | ||
2472 | static inline void current_set_polling(void) | ||
2473 | { | ||
2474 | current_thread_info()->status |= TS_POLLING; | ||
2475 | } | ||
2476 | |||
2477 | static inline void current_clr_polling(void) | ||
2478 | { | ||
2479 | current_thread_info()->status &= ~TS_POLLING; | ||
2480 | smp_mb__after_clear_bit(); | ||
2481 | } | ||
2482 | #elif defined(TIF_POLLING_NRFLAG) | ||
2483 | static inline int tsk_is_polling(struct task_struct *p) | ||
2484 | { | ||
2485 | return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); | ||
2486 | } | ||
2487 | static inline void current_set_polling(void) | ||
2488 | { | ||
2489 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
2490 | } | ||
2491 | |||
2492 | static inline void current_clr_polling(void) | ||
2493 | { | ||
2494 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
2495 | } | ||
2496 | #else | ||
2497 | static inline int tsk_is_polling(struct task_struct *p) { return 0; } | ||
2498 | static inline void current_set_polling(void) { } | ||
2499 | static inline void current_clr_polling(void) { } | ||
2500 | #endif | ||
2501 | |||
2502 | /* | ||
2626 | * Thread group CPU time accounting. | 2503 | * Thread group CPU time accounting. |
2627 | */ | 2504 | */ |
2628 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); | 2505 | void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); |
@@ -2682,28 +2559,7 @@ extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); | |||
2682 | extern long sched_getaffinity(pid_t pid, struct cpumask *mask); | 2559 | extern long sched_getaffinity(pid_t pid, struct cpumask *mask); |
2683 | 2560 | ||
2684 | #ifdef CONFIG_CGROUP_SCHED | 2561 | #ifdef CONFIG_CGROUP_SCHED |
2685 | |||
2686 | extern struct task_group root_task_group; | 2562 | extern struct task_group root_task_group; |
2687 | |||
2688 | extern struct task_group *sched_create_group(struct task_group *parent); | ||
2689 | extern void sched_online_group(struct task_group *tg, | ||
2690 | struct task_group *parent); | ||
2691 | extern void sched_destroy_group(struct task_group *tg); | ||
2692 | extern void sched_offline_group(struct task_group *tg); | ||
2693 | extern void sched_move_task(struct task_struct *tsk); | ||
2694 | #ifdef CONFIG_FAIR_GROUP_SCHED | ||
2695 | extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); | ||
2696 | extern unsigned long sched_group_shares(struct task_group *tg); | ||
2697 | #endif | ||
2698 | #ifdef CONFIG_RT_GROUP_SCHED | ||
2699 | extern int sched_group_set_rt_runtime(struct task_group *tg, | ||
2700 | long rt_runtime_us); | ||
2701 | extern long sched_group_rt_runtime(struct task_group *tg); | ||
2702 | extern int sched_group_set_rt_period(struct task_group *tg, | ||
2703 | long rt_period_us); | ||
2704 | extern long sched_group_rt_period(struct task_group *tg); | ||
2705 | extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk); | ||
2706 | #endif | ||
2707 | #endif /* CONFIG_CGROUP_SCHED */ | 2563 | #endif /* CONFIG_CGROUP_SCHED */ |
2708 | 2564 | ||
2709 | extern int task_can_switch_user(struct user_struct *up, | 2565 | extern int task_can_switch_user(struct user_struct *up, |
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index c11a28706fa4..3bfe8d6ee248 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -53,7 +53,9 @@ | |||
53 | 53 | ||
54 | #include <linux/in.h> /* We need in_addr. */ | 54 | #include <linux/in.h> /* We need in_addr. */ |
55 | #include <linux/in6.h> /* We need in6_addr. */ | 55 | #include <linux/in6.h> /* We need in6_addr. */ |
56 | #include <linux/skbuff.h> | ||
56 | 57 | ||
58 | #include <uapi/linux/sctp.h> | ||
57 | 59 | ||
58 | /* Section 3.1. SCTP Common Header Format */ | 60 | /* Section 3.1. SCTP Common Header Format */ |
59 | typedef struct sctphdr { | 61 | typedef struct sctphdr { |
@@ -63,14 +65,10 @@ typedef struct sctphdr { | |||
63 | __le32 checksum; | 65 | __le32 checksum; |
64 | } __packed sctp_sctphdr_t; | 66 | } __packed sctp_sctphdr_t; |
65 | 67 | ||
66 | #ifdef __KERNEL__ | ||
67 | #include <linux/skbuff.h> | ||
68 | |||
69 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) | 68 | static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) |
70 | { | 69 | { |
71 | return (struct sctphdr *)skb_transport_header(skb); | 70 | return (struct sctphdr *)skb_transport_header(skb); |
72 | } | 71 | } |
73 | #endif | ||
74 | 72 | ||
75 | /* Section 3.2. Chunk Field Descriptions. */ | 73 | /* Section 3.2. Chunk Field Descriptions. */ |
76 | typedef struct sctp_chunkhdr { | 74 | typedef struct sctp_chunkhdr { |
diff --git a/include/linux/security.h b/include/linux/security.h index 032c366ef1c6..4686491852a7 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1440,7 +1440,7 @@ struct security_operations { | |||
1440 | struct path *new_path); | 1440 | struct path *new_path); |
1441 | int (*sb_set_mnt_opts) (struct super_block *sb, | 1441 | int (*sb_set_mnt_opts) (struct super_block *sb, |
1442 | struct security_mnt_opts *opts); | 1442 | struct security_mnt_opts *opts); |
1443 | void (*sb_clone_mnt_opts) (const struct super_block *oldsb, | 1443 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
1444 | struct super_block *newsb); | 1444 | struct super_block *newsb); |
1445 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); | 1445 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
1446 | 1446 | ||
@@ -1726,7 +1726,7 @@ int security_sb_mount(const char *dev_name, struct path *path, | |||
1726 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1726 | int security_sb_umount(struct vfsmount *mnt, int flags); |
1727 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); | 1727 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
1728 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); | 1728 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); |
1729 | void security_sb_clone_mnt_opts(const struct super_block *oldsb, | 1729 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
1730 | struct super_block *newsb); | 1730 | struct super_block *newsb); |
1731 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | 1731 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); |
1732 | 1732 | ||
@@ -2016,9 +2016,11 @@ static inline int security_sb_set_mnt_opts(struct super_block *sb, | |||
2016 | return 0; | 2016 | return 0; |
2017 | } | 2017 | } |
2018 | 2018 | ||
2019 | static inline void security_sb_clone_mnt_opts(const struct super_block *oldsb, | 2019 | static inline int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
2020 | struct super_block *newsb) | 2020 | struct super_block *newsb) |
2021 | { } | 2021 | { |
2022 | return 0; | ||
2023 | } | ||
2022 | 2024 | ||
2023 | static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) | 2025 | static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) |
2024 | { | 2026 | { |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 68a04a343cad..2da29ac178fc 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -123,6 +123,7 @@ static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); | 125 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); |
126 | int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t); | ||
126 | int single_release(struct inode *, struct file *); | 127 | int single_release(struct inode *, struct file *); |
127 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | 128 | void *__seq_open_private(struct file *, const struct seq_operations *, int); |
128 | int seq_open_private(struct file *, const struct seq_operations *, int); | 129 | int seq_open_private(struct file *, const struct seq_operations *, int); |
diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h new file mode 100644 index 000000000000..907d9d1d56cf --- /dev/null +++ b/include/linux/serial_s3c.h | |||
@@ -0,0 +1,260 @@ | |||
1 | /* | ||
2 | * Internal header file for Samsung S3C2410 serial ports (UART0-2) | ||
3 | * | ||
4 | * Copyright (C) 2002 Shane Nay (shane@minirl.com) | ||
5 | * | ||
6 | * Additional defines, Copyright 2003 Simtec Electronics (linux@simtec.co.uk) | ||
7 | * | ||
8 | * Adapted from: | ||
9 | * | ||
10 | * Internal header file for MX1ADS serial ports (UART1 & 2) | ||
11 | * | ||
12 | * Copyright (C) 2002 Shane Nay (shane@minirl.com) | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
27 | */ | ||
28 | |||
29 | #ifndef __ASM_ARM_REGS_SERIAL_H | ||
30 | #define __ASM_ARM_REGS_SERIAL_H | ||
31 | |||
32 | #define S3C2410_URXH (0x24) | ||
33 | #define S3C2410_UTXH (0x20) | ||
34 | #define S3C2410_ULCON (0x00) | ||
35 | #define S3C2410_UCON (0x04) | ||
36 | #define S3C2410_UFCON (0x08) | ||
37 | #define S3C2410_UMCON (0x0C) | ||
38 | #define S3C2410_UBRDIV (0x28) | ||
39 | #define S3C2410_UTRSTAT (0x10) | ||
40 | #define S3C2410_UERSTAT (0x14) | ||
41 | #define S3C2410_UFSTAT (0x18) | ||
42 | #define S3C2410_UMSTAT (0x1C) | ||
43 | |||
44 | #define S3C2410_LCON_CFGMASK ((0xF<<3)|(0x3)) | ||
45 | |||
46 | #define S3C2410_LCON_CS5 (0x0) | ||
47 | #define S3C2410_LCON_CS6 (0x1) | ||
48 | #define S3C2410_LCON_CS7 (0x2) | ||
49 | #define S3C2410_LCON_CS8 (0x3) | ||
50 | #define S3C2410_LCON_CSMASK (0x3) | ||
51 | |||
52 | #define S3C2410_LCON_PNONE (0x0) | ||
53 | #define S3C2410_LCON_PEVEN (0x5 << 3) | ||
54 | #define S3C2410_LCON_PODD (0x4 << 3) | ||
55 | #define S3C2410_LCON_PMASK (0x7 << 3) | ||
56 | |||
57 | #define S3C2410_LCON_STOPB (1<<2) | ||
58 | #define S3C2410_LCON_IRM (1<<6) | ||
59 | |||
60 | #define S3C2440_UCON_CLKMASK (3<<10) | ||
61 | #define S3C2440_UCON_CLKSHIFT (10) | ||
62 | #define S3C2440_UCON_PCLK (0<<10) | ||
63 | #define S3C2440_UCON_UCLK (1<<10) | ||
64 | #define S3C2440_UCON_PCLK2 (2<<10) | ||
65 | #define S3C2440_UCON_FCLK (3<<10) | ||
66 | #define S3C2443_UCON_EPLL (3<<10) | ||
67 | |||
68 | #define S3C6400_UCON_CLKMASK (3<<10) | ||
69 | #define S3C6400_UCON_CLKSHIFT (10) | ||
70 | #define S3C6400_UCON_PCLK (0<<10) | ||
71 | #define S3C6400_UCON_PCLK2 (2<<10) | ||
72 | #define S3C6400_UCON_UCLK0 (1<<10) | ||
73 | #define S3C6400_UCON_UCLK1 (3<<10) | ||
74 | |||
75 | #define S3C2440_UCON2_FCLK_EN (1<<15) | ||
76 | #define S3C2440_UCON0_DIVMASK (15 << 12) | ||
77 | #define S3C2440_UCON1_DIVMASK (15 << 12) | ||
78 | #define S3C2440_UCON2_DIVMASK (7 << 12) | ||
79 | #define S3C2440_UCON_DIVSHIFT (12) | ||
80 | |||
81 | #define S3C2412_UCON_CLKMASK (3<<10) | ||
82 | #define S3C2412_UCON_CLKSHIFT (10) | ||
83 | #define S3C2412_UCON_UCLK (1<<10) | ||
84 | #define S3C2412_UCON_USYSCLK (3<<10) | ||
85 | #define S3C2412_UCON_PCLK (0<<10) | ||
86 | #define S3C2412_UCON_PCLK2 (2<<10) | ||
87 | |||
88 | #define S3C2410_UCON_CLKMASK (1 << 10) | ||
89 | #define S3C2410_UCON_CLKSHIFT (10) | ||
90 | #define S3C2410_UCON_UCLK (1<<10) | ||
91 | #define S3C2410_UCON_SBREAK (1<<4) | ||
92 | |||
93 | #define S3C2410_UCON_TXILEVEL (1<<9) | ||
94 | #define S3C2410_UCON_RXILEVEL (1<<8) | ||
95 | #define S3C2410_UCON_TXIRQMODE (1<<2) | ||
96 | #define S3C2410_UCON_RXIRQMODE (1<<0) | ||
97 | #define S3C2410_UCON_RXFIFO_TOI (1<<7) | ||
98 | #define S3C2443_UCON_RXERR_IRQEN (1<<6) | ||
99 | #define S3C2443_UCON_LOOPBACK (1<<5) | ||
100 | |||
101 | #define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
102 | S3C2410_UCON_RXILEVEL | \ | ||
103 | S3C2410_UCON_TXIRQMODE | \ | ||
104 | S3C2410_UCON_RXIRQMODE | \ | ||
105 | S3C2410_UCON_RXFIFO_TOI) | ||
106 | |||
107 | #define S3C2410_UFCON_FIFOMODE (1<<0) | ||
108 | #define S3C2410_UFCON_TXTRIG0 (0<<6) | ||
109 | #define S3C2410_UFCON_RXTRIG8 (1<<4) | ||
110 | #define S3C2410_UFCON_RXTRIG12 (2<<4) | ||
111 | |||
112 | /* S3C2440 FIFO trigger levels */ | ||
113 | #define S3C2440_UFCON_RXTRIG1 (0<<4) | ||
114 | #define S3C2440_UFCON_RXTRIG8 (1<<4) | ||
115 | #define S3C2440_UFCON_RXTRIG16 (2<<4) | ||
116 | #define S3C2440_UFCON_RXTRIG32 (3<<4) | ||
117 | |||
118 | #define S3C2440_UFCON_TXTRIG0 (0<<6) | ||
119 | #define S3C2440_UFCON_TXTRIG16 (1<<6) | ||
120 | #define S3C2440_UFCON_TXTRIG32 (2<<6) | ||
121 | #define S3C2440_UFCON_TXTRIG48 (3<<6) | ||
122 | |||
123 | #define S3C2410_UFCON_RESETBOTH (3<<1) | ||
124 | #define S3C2410_UFCON_RESETTX (1<<2) | ||
125 | #define S3C2410_UFCON_RESETRX (1<<1) | ||
126 | |||
127 | #define S3C2410_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
128 | S3C2410_UFCON_TXTRIG0 | \ | ||
129 | S3C2410_UFCON_RXTRIG8 ) | ||
130 | |||
131 | #define S3C2410_UMCOM_AFC (1<<4) | ||
132 | #define S3C2410_UMCOM_RTS_LOW (1<<0) | ||
133 | |||
134 | #define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */ | ||
135 | #define S3C2412_UMCON_AFC_56 (1<<5) | ||
136 | #define S3C2412_UMCON_AFC_48 (2<<5) | ||
137 | #define S3C2412_UMCON_AFC_40 (3<<5) | ||
138 | #define S3C2412_UMCON_AFC_32 (4<<5) | ||
139 | #define S3C2412_UMCON_AFC_24 (5<<5) | ||
140 | #define S3C2412_UMCON_AFC_16 (6<<5) | ||
141 | #define S3C2412_UMCON_AFC_8 (7<<5) | ||
142 | |||
143 | #define S3C2410_UFSTAT_TXFULL (1<<9) | ||
144 | #define S3C2410_UFSTAT_RXFULL (1<<8) | ||
145 | #define S3C2410_UFSTAT_TXMASK (15<<4) | ||
146 | #define S3C2410_UFSTAT_TXSHIFT (4) | ||
147 | #define S3C2410_UFSTAT_RXMASK (15<<0) | ||
148 | #define S3C2410_UFSTAT_RXSHIFT (0) | ||
149 | |||
150 | /* UFSTAT S3C2443 same as S3C2440 */ | ||
151 | #define S3C2440_UFSTAT_TXFULL (1<<14) | ||
152 | #define S3C2440_UFSTAT_RXFULL (1<<6) | ||
153 | #define S3C2440_UFSTAT_TXSHIFT (8) | ||
154 | #define S3C2440_UFSTAT_RXSHIFT (0) | ||
155 | #define S3C2440_UFSTAT_TXMASK (63<<8) | ||
156 | #define S3C2440_UFSTAT_RXMASK (63) | ||
157 | |||
158 | #define S3C2410_UTRSTAT_TXE (1<<2) | ||
159 | #define S3C2410_UTRSTAT_TXFE (1<<1) | ||
160 | #define S3C2410_UTRSTAT_RXDR (1<<0) | ||
161 | |||
162 | #define S3C2410_UERSTAT_OVERRUN (1<<0) | ||
163 | #define S3C2410_UERSTAT_FRAME (1<<2) | ||
164 | #define S3C2410_UERSTAT_BREAK (1<<3) | ||
165 | #define S3C2443_UERSTAT_PARITY (1<<1) | ||
166 | |||
167 | #define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \ | ||
168 | S3C2410_UERSTAT_FRAME | \ | ||
169 | S3C2410_UERSTAT_BREAK) | ||
170 | |||
171 | #define S3C2410_UMSTAT_CTS (1<<0) | ||
172 | #define S3C2410_UMSTAT_DeltaCTS (1<<2) | ||
173 | |||
174 | #define S3C2443_DIVSLOT (0x2C) | ||
175 | |||
176 | /* S3C64XX interrupt registers. */ | ||
177 | #define S3C64XX_UINTP 0x30 | ||
178 | #define S3C64XX_UINTSP 0x34 | ||
179 | #define S3C64XX_UINTM 0x38 | ||
180 | |||
181 | #define S3C64XX_UINTM_RXD (0) | ||
182 | #define S3C64XX_UINTM_TXD (2) | ||
183 | #define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD) | ||
184 | #define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD) | ||
185 | |||
186 | /* Following are specific to S5PV210 */ | ||
187 | #define S5PV210_UCON_CLKMASK (1<<10) | ||
188 | #define S5PV210_UCON_CLKSHIFT (10) | ||
189 | #define S5PV210_UCON_PCLK (0<<10) | ||
190 | #define S5PV210_UCON_UCLK (1<<10) | ||
191 | |||
192 | #define S5PV210_UFCON_TXTRIG0 (0<<8) | ||
193 | #define S5PV210_UFCON_TXTRIG4 (1<<8) | ||
194 | #define S5PV210_UFCON_TXTRIG8 (2<<8) | ||
195 | #define S5PV210_UFCON_TXTRIG16 (3<<8) | ||
196 | #define S5PV210_UFCON_TXTRIG32 (4<<8) | ||
197 | #define S5PV210_UFCON_TXTRIG64 (5<<8) | ||
198 | #define S5PV210_UFCON_TXTRIG128 (6<<8) | ||
199 | #define S5PV210_UFCON_TXTRIG256 (7<<8) | ||
200 | |||
201 | #define S5PV210_UFCON_RXTRIG1 (0<<4) | ||
202 | #define S5PV210_UFCON_RXTRIG4 (1<<4) | ||
203 | #define S5PV210_UFCON_RXTRIG8 (2<<4) | ||
204 | #define S5PV210_UFCON_RXTRIG16 (3<<4) | ||
205 | #define S5PV210_UFCON_RXTRIG32 (4<<4) | ||
206 | #define S5PV210_UFCON_RXTRIG64 (5<<4) | ||
207 | #define S5PV210_UFCON_RXTRIG128 (6<<4) | ||
208 | #define S5PV210_UFCON_RXTRIG256 (7<<4) | ||
209 | |||
210 | #define S5PV210_UFSTAT_TXFULL (1<<24) | ||
211 | #define S5PV210_UFSTAT_RXFULL (1<<8) | ||
212 | #define S5PV210_UFSTAT_TXMASK (255<<16) | ||
213 | #define S5PV210_UFSTAT_TXSHIFT (16) | ||
214 | #define S5PV210_UFSTAT_RXMASK (255<<0) | ||
215 | #define S5PV210_UFSTAT_RXSHIFT (0) | ||
216 | |||
217 | #define S3C2410_UCON_CLKSEL0 (1 << 0) | ||
218 | #define S3C2410_UCON_CLKSEL1 (1 << 1) | ||
219 | #define S3C2410_UCON_CLKSEL2 (1 << 2) | ||
220 | #define S3C2410_UCON_CLKSEL3 (1 << 3) | ||
221 | |||
222 | /* Default values for s5pv210 UCON and UFCON uart registers */ | ||
223 | #define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
224 | S3C2410_UCON_RXILEVEL | \ | ||
225 | S3C2410_UCON_TXIRQMODE | \ | ||
226 | S3C2410_UCON_RXIRQMODE | \ | ||
227 | S3C2410_UCON_RXFIFO_TOI | \ | ||
228 | S3C2443_UCON_RXERR_IRQEN) | ||
229 | |||
230 | #define S5PV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
231 | S5PV210_UFCON_TXTRIG4 | \ | ||
232 | S5PV210_UFCON_RXTRIG4) | ||
233 | |||
234 | #ifndef __ASSEMBLY__ | ||
235 | |||
236 | /* configuration structure for per-machine configurations for the | ||
237 | * serial port | ||
238 | * | ||
239 | * the pointer is setup by the machine specific initialisation from the | ||
240 | * arch/arm/mach-s3c2410/ directory. | ||
241 | */ | ||
242 | |||
243 | struct s3c2410_uartcfg { | ||
244 | unsigned char hwport; /* hardware port number */ | ||
245 | unsigned char unused; | ||
246 | unsigned short flags; | ||
247 | upf_t uart_flags; /* default uart flags */ | ||
248 | unsigned int clk_sel; | ||
249 | |||
250 | unsigned int has_fracval; | ||
251 | |||
252 | unsigned long ucon; /* value of ucon for port */ | ||
253 | unsigned long ulcon; /* value of ulcon for port */ | ||
254 | unsigned long ufcon; /* value of ufcon for port */ | ||
255 | }; | ||
256 | |||
257 | #endif /* __ASSEMBLY__ */ | ||
258 | |||
259 | #endif /* __ASM_ARM_REGS_SERIAL_H */ | ||
260 | |||
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h index b17d765ded84..fc305713fc6d 100644 --- a/include/linux/sh_eth.h +++ b/include/linux/sh_eth.h | |||
@@ -6,6 +6,7 @@ | |||
6 | enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; | 6 | enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; |
7 | enum { | 7 | enum { |
8 | SH_ETH_REG_GIGABIT, | 8 | SH_ETH_REG_GIGABIT, |
9 | SH_ETH_REG_FAST_RCAR, | ||
9 | SH_ETH_REG_FAST_SH4, | 10 | SH_ETH_REG_FAST_SH4, |
10 | SH_ETH_REG_FAST_SH3_SH2 | 11 | SH_ETH_REG_FAST_SH3_SH2 |
11 | }; | 12 | }; |
diff --git a/include/linux/signal.h b/include/linux/signal.h index 9475c5cb28bc..d897484730c0 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -434,4 +434,9 @@ void signals_init(void); | |||
434 | int restore_altstack(const stack_t __user *); | 434 | int restore_altstack(const stack_t __user *); |
435 | int __save_altstack(stack_t __user *, unsigned long); | 435 | int __save_altstack(stack_t __user *, unsigned long); |
436 | 436 | ||
437 | #ifdef CONFIG_PROC_FS | ||
438 | struct seq_file; | ||
439 | extern void render_sigset_t(struct seq_file *, const char *, sigset_t *); | ||
440 | #endif | ||
441 | |||
437 | #endif /* _LINUX_SIGNAL_H */ | 442 | #endif /* _LINUX_SIGNAL_H */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index b8292d8cc9fa..2e0ced1af3b1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/hrtimer.h> | 32 | #include <linux/hrtimer.h> |
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/netdev_features.h> | 34 | #include <linux/netdev_features.h> |
35 | #include <net/flow_keys.h> | ||
35 | 36 | ||
36 | /* Don't change this without changing skb_csum_unnecessary! */ | 37 | /* Don't change this without changing skb_csum_unnecessary! */ |
37 | #define CHECKSUM_NONE 0 | 38 | #define CHECKSUM_NONE 0 |
@@ -316,6 +317,8 @@ enum { | |||
316 | SKB_GSO_FCOE = 1 << 5, | 317 | SKB_GSO_FCOE = 1 << 5, |
317 | 318 | ||
318 | SKB_GSO_GRE = 1 << 6, | 319 | SKB_GSO_GRE = 1 << 6, |
320 | |||
321 | SKB_GSO_UDP_TUNNEL = 1 << 7, | ||
319 | }; | 322 | }; |
320 | 323 | ||
321 | #if BITS_PER_LONG > 32 | 324 | #if BITS_PER_LONG > 32 |
@@ -384,9 +387,11 @@ typedef unsigned char *sk_buff_data_t; | |||
384 | * @secmark: security marking | 387 | * @secmark: security marking |
385 | * @mark: Generic packet mark | 388 | * @mark: Generic packet mark |
386 | * @dropcount: total number of sk_receive_queue overflows | 389 | * @dropcount: total number of sk_receive_queue overflows |
390 | * @vlan_proto: vlan encapsulation protocol | ||
387 | * @vlan_tci: vlan tag control information | 391 | * @vlan_tci: vlan tag control information |
388 | * @inner_transport_header: Inner transport layer header (encapsulation) | 392 | * @inner_transport_header: Inner transport layer header (encapsulation) |
389 | * @inner_network_header: Network layer header (encapsulation) | 393 | * @inner_network_header: Network layer header (encapsulation) |
394 | * @inner_mac_header: Link layer header (encapsulation) | ||
390 | * @transport_header: Transport layer header | 395 | * @transport_header: Transport layer header |
391 | * @network_header: Network layer header | 396 | * @network_header: Network layer header |
392 | * @mac_header: Link layer header | 397 | * @mac_header: Link layer header |
@@ -461,6 +466,7 @@ struct sk_buff { | |||
461 | 466 | ||
462 | __u32 rxhash; | 467 | __u32 rxhash; |
463 | 468 | ||
469 | __be16 vlan_proto; | ||
464 | __u16 vlan_tci; | 470 | __u16 vlan_tci; |
465 | 471 | ||
466 | #ifdef CONFIG_NET_SCHED | 472 | #ifdef CONFIG_NET_SCHED |
@@ -505,6 +511,7 @@ struct sk_buff { | |||
505 | 511 | ||
506 | sk_buff_data_t inner_transport_header; | 512 | sk_buff_data_t inner_transport_header; |
507 | sk_buff_data_t inner_network_header; | 513 | sk_buff_data_t inner_network_header; |
514 | sk_buff_data_t inner_mac_header; | ||
508 | sk_buff_data_t transport_header; | 515 | sk_buff_data_t transport_header; |
509 | sk_buff_data_t network_header; | 516 | sk_buff_data_t network_header; |
510 | sk_buff_data_t mac_header; | 517 | sk_buff_data_t mac_header; |
@@ -570,7 +577,40 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) | |||
570 | skb->_skb_refdst = (unsigned long)dst; | 577 | skb->_skb_refdst = (unsigned long)dst; |
571 | } | 578 | } |
572 | 579 | ||
573 | extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); | 580 | extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, |
581 | bool force); | ||
582 | |||
583 | /** | ||
584 | * skb_dst_set_noref - sets skb dst, hopefully, without taking reference | ||
585 | * @skb: buffer | ||
586 | * @dst: dst entry | ||
587 | * | ||
588 | * Sets skb dst, assuming a reference was not taken on dst. | ||
589 | * If dst entry is cached, we do not take reference and dst_release | ||
590 | * will be avoided by refdst_drop. If dst entry is not cached, we take | ||
591 | * reference, so that last dst_release can destroy the dst immediately. | ||
592 | */ | ||
593 | static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) | ||
594 | { | ||
595 | __skb_dst_set_noref(skb, dst, false); | ||
596 | } | ||
597 | |||
598 | /** | ||
599 | * skb_dst_set_noref_force - sets skb dst, without taking reference | ||
600 | * @skb: buffer | ||
601 | * @dst: dst entry | ||
602 | * | ||
603 | * Sets skb dst, assuming a reference was not taken on dst. | ||
604 | * No reference is taken and no dst_release will be called. While for | ||
605 | * cached dsts deferred reclaim is a basic feature, for entries that are | ||
606 | * not cached it is caller's job to guarantee that last dst_release for | ||
607 | * provided dst happens when nobody uses it, eg. after a RCU grace period. | ||
608 | */ | ||
609 | static inline void skb_dst_set_noref_force(struct sk_buff *skb, | ||
610 | struct dst_entry *dst) | ||
611 | { | ||
612 | __skb_dst_set_noref(skb, dst, true); | ||
613 | } | ||
574 | 614 | ||
575 | /** | 615 | /** |
576 | * skb_dst_is_noref - Test if skb dst isn't refcounted | 616 | * skb_dst_is_noref - Test if skb dst isn't refcounted |
@@ -611,6 +651,12 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
611 | return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); | 651 | return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); |
612 | } | 652 | } |
613 | 653 | ||
654 | extern struct sk_buff *__alloc_skb_head(gfp_t priority, int node); | ||
655 | static inline struct sk_buff *alloc_skb_head(gfp_t priority) | ||
656 | { | ||
657 | return __alloc_skb_head(priority, -1); | ||
658 | } | ||
659 | |||
614 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | 660 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); |
615 | extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); | 661 | extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); |
616 | extern struct sk_buff *skb_clone(struct sk_buff *skb, | 662 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
@@ -1471,6 +1517,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len) | |||
1471 | 1517 | ||
1472 | static inline void skb_reset_inner_headers(struct sk_buff *skb) | 1518 | static inline void skb_reset_inner_headers(struct sk_buff *skb) |
1473 | { | 1519 | { |
1520 | skb->inner_mac_header = skb->mac_header; | ||
1474 | skb->inner_network_header = skb->network_header; | 1521 | skb->inner_network_header = skb->network_header; |
1475 | skb->inner_transport_header = skb->transport_header; | 1522 | skb->inner_transport_header = skb->transport_header; |
1476 | } | 1523 | } |
@@ -1516,6 +1563,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
1516 | skb->inner_network_header += offset; | 1563 | skb->inner_network_header += offset; |
1517 | } | 1564 | } |
1518 | 1565 | ||
1566 | static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) | ||
1567 | { | ||
1568 | return skb->head + skb->inner_mac_header; | ||
1569 | } | ||
1570 | |||
1571 | static inline void skb_reset_inner_mac_header(struct sk_buff *skb) | ||
1572 | { | ||
1573 | skb->inner_mac_header = skb->data - skb->head; | ||
1574 | } | ||
1575 | |||
1576 | static inline void skb_set_inner_mac_header(struct sk_buff *skb, | ||
1577 | const int offset) | ||
1578 | { | ||
1579 | skb_reset_inner_mac_header(skb); | ||
1580 | skb->inner_mac_header += offset; | ||
1581 | } | ||
1519 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | 1582 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) |
1520 | { | 1583 | { |
1521 | return skb->transport_header != ~0U; | 1584 | return skb->transport_header != ~0U; |
@@ -1609,6 +1672,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb, | |||
1609 | skb->inner_network_header = skb->data + offset; | 1672 | skb->inner_network_header = skb->data + offset; |
1610 | } | 1673 | } |
1611 | 1674 | ||
1675 | static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) | ||
1676 | { | ||
1677 | return skb->inner_mac_header; | ||
1678 | } | ||
1679 | |||
1680 | static inline void skb_reset_inner_mac_header(struct sk_buff *skb) | ||
1681 | { | ||
1682 | skb->inner_mac_header = skb->data; | ||
1683 | } | ||
1684 | |||
1685 | static inline void skb_set_inner_mac_header(struct sk_buff *skb, | ||
1686 | const int offset) | ||
1687 | { | ||
1688 | skb->inner_mac_header = skb->data + offset; | ||
1689 | } | ||
1612 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) | 1690 | static inline bool skb_transport_header_was_set(const struct sk_buff *skb) |
1613 | { | 1691 | { |
1614 | return skb->transport_header != NULL; | 1692 | return skb->transport_header != NULL; |
@@ -1666,6 +1744,19 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) | |||
1666 | } | 1744 | } |
1667 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | 1745 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ |
1668 | 1746 | ||
1747 | static inline void skb_probe_transport_header(struct sk_buff *skb, | ||
1748 | const int offset_hint) | ||
1749 | { | ||
1750 | struct flow_keys keys; | ||
1751 | |||
1752 | if (skb_transport_header_was_set(skb)) | ||
1753 | return; | ||
1754 | else if (skb_flow_dissect(skb, &keys)) | ||
1755 | skb_set_transport_header(skb, keys.thoff); | ||
1756 | else | ||
1757 | skb_set_transport_header(skb, offset_hint); | ||
1758 | } | ||
1759 | |||
1669 | static inline void skb_mac_header_rebuild(struct sk_buff *skb) | 1760 | static inline void skb_mac_header_rebuild(struct sk_buff *skb) |
1670 | { | 1761 | { |
1671 | if (skb_mac_header_was_set(skb)) { | 1762 | if (skb_mac_header_was_set(skb)) { |
@@ -2811,6 +2902,8 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb) | |||
2811 | 2902 | ||
2812 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); | 2903 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); |
2813 | 2904 | ||
2905 | u32 __skb_get_poff(const struct sk_buff *skb); | ||
2906 | |||
2814 | /** | 2907 | /** |
2815 | * skb_head_is_locked - Determine if the skb->head is locked down | 2908 | * skb_head_is_locked - Determine if the skb->head is locked down |
2816 | * @skb: skb to check | 2909 | * @skb: skb to check |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 5d168d7e0a28..0c621752caa6 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -94,29 +94,6 @@ | |||
94 | #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ | 94 | #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ |
95 | (unsigned long)ZERO_SIZE_PTR) | 95 | (unsigned long)ZERO_SIZE_PTR) |
96 | 96 | ||
97 | /* | ||
98 | * Common fields provided in kmem_cache by all slab allocators | ||
99 | * This struct is either used directly by the allocator (SLOB) | ||
100 | * or the allocator must include definitions for all fields | ||
101 | * provided in kmem_cache_common in their definition of kmem_cache. | ||
102 | * | ||
103 | * Once we can do anonymous structs (C11 standard) we could put a | ||
104 | * anonymous struct definition in these allocators so that the | ||
105 | * separate allocations in the kmem_cache structure of SLAB and | ||
106 | * SLUB is no longer needed. | ||
107 | */ | ||
108 | #ifdef CONFIG_SLOB | ||
109 | struct kmem_cache { | ||
110 | unsigned int object_size;/* The original size of the object */ | ||
111 | unsigned int size; /* The aligned/padded/added on size */ | ||
112 | unsigned int align; /* Alignment as calculated */ | ||
113 | unsigned long flags; /* Active flags on the slab */ | ||
114 | const char *name; /* Slab name for sysfs */ | ||
115 | int refcount; /* Use counter */ | ||
116 | void (*ctor)(void *); /* Called on object slot creation */ | ||
117 | struct list_head list; /* List of all slab caches on the system */ | ||
118 | }; | ||
119 | #endif | ||
120 | 97 | ||
121 | struct mem_cgroup; | 98 | struct mem_cgroup; |
122 | /* | 99 | /* |
@@ -148,7 +125,63 @@ void kmem_cache_free(struct kmem_cache *, void *); | |||
148 | (__flags), NULL) | 125 | (__flags), NULL) |
149 | 126 | ||
150 | /* | 127 | /* |
151 | * The largest kmalloc size supported by the slab allocators is | 128 | * Common kmalloc functions provided by all allocators |
129 | */ | ||
130 | void * __must_check __krealloc(const void *, size_t, gfp_t); | ||
131 | void * __must_check krealloc(const void *, size_t, gfp_t); | ||
132 | void kfree(const void *); | ||
133 | void kzfree(const void *); | ||
134 | size_t ksize(const void *); | ||
135 | |||
136 | /* | ||
137 | * Some archs want to perform DMA into kmalloc caches and need a guaranteed | ||
138 | * alignment larger than the alignment of a 64-bit integer. | ||
139 | * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that. | ||
140 | */ | ||
141 | #if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8 | ||
142 | #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN | ||
143 | #define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN | ||
144 | #define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN) | ||
145 | #else | ||
146 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) | ||
147 | #endif | ||
148 | |||
149 | #ifdef CONFIG_SLOB | ||
150 | /* | ||
151 | * Common fields provided in kmem_cache by all slab allocators | ||
152 | * This struct is either used directly by the allocator (SLOB) | ||
153 | * or the allocator must include definitions for all fields | ||
154 | * provided in kmem_cache_common in their definition of kmem_cache. | ||
155 | * | ||
156 | * Once we can do anonymous structs (C11 standard) we could put a | ||
157 | * anonymous struct definition in these allocators so that the | ||
158 | * separate allocations in the kmem_cache structure of SLAB and | ||
159 | * SLUB is no longer needed. | ||
160 | */ | ||
161 | struct kmem_cache { | ||
162 | unsigned int object_size;/* The original size of the object */ | ||
163 | unsigned int size; /* The aligned/padded/added on size */ | ||
164 | unsigned int align; /* Alignment as calculated */ | ||
165 | unsigned long flags; /* Active flags on the slab */ | ||
166 | const char *name; /* Slab name for sysfs */ | ||
167 | int refcount; /* Use counter */ | ||
168 | void (*ctor)(void *); /* Called on object slot creation */ | ||
169 | struct list_head list; /* List of all slab caches on the system */ | ||
170 | }; | ||
171 | |||
172 | #define KMALLOC_MAX_SIZE (1UL << 30) | ||
173 | |||
174 | #include <linux/slob_def.h> | ||
175 | |||
176 | #else /* CONFIG_SLOB */ | ||
177 | |||
178 | /* | ||
179 | * Kmalloc array related definitions | ||
180 | */ | ||
181 | |||
182 | #ifdef CONFIG_SLAB | ||
183 | /* | ||
184 | * The largest kmalloc size supported by the SLAB allocators is | ||
152 | * 32 megabyte (2^25) or the maximum allocatable page order if that is | 185 | * 32 megabyte (2^25) or the maximum allocatable page order if that is |
153 | * less than 32 MB. | 186 | * less than 32 MB. |
154 | * | 187 | * |
@@ -158,22 +191,120 @@ void kmem_cache_free(struct kmem_cache *, void *); | |||
158 | */ | 191 | */ |
159 | #define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ | 192 | #define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ |
160 | (MAX_ORDER + PAGE_SHIFT - 1) : 25) | 193 | (MAX_ORDER + PAGE_SHIFT - 1) : 25) |
194 | #define KMALLOC_SHIFT_MAX KMALLOC_SHIFT_HIGH | ||
195 | #ifndef KMALLOC_SHIFT_LOW | ||
196 | #define KMALLOC_SHIFT_LOW 5 | ||
197 | #endif | ||
198 | #else | ||
199 | /* | ||
200 | * SLUB allocates up to order 2 pages directly and otherwise | ||
201 | * passes the request to the page allocator. | ||
202 | */ | ||
203 | #define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1) | ||
204 | #define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT) | ||
205 | #ifndef KMALLOC_SHIFT_LOW | ||
206 | #define KMALLOC_SHIFT_LOW 3 | ||
207 | #endif | ||
208 | #endif | ||
161 | 209 | ||
162 | #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_HIGH) | 210 | /* Maximum allocatable size */ |
163 | #define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) | 211 | #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX) |
212 | /* Maximum size for which we actually use a slab cache */ | ||
213 | #define KMALLOC_MAX_CACHE_SIZE (1UL << KMALLOC_SHIFT_HIGH) | ||
214 | /* Maximum order allocatable via the slab allocagtor */ | ||
215 | #define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_MAX - PAGE_SHIFT) | ||
164 | 216 | ||
165 | /* | 217 | /* |
166 | * Some archs want to perform DMA into kmalloc caches and need a guaranteed | 218 | * Kmalloc subsystem. |
167 | * alignment larger than the alignment of a 64-bit integer. | ||
168 | * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that. | ||
169 | */ | 219 | */ |
170 | #ifdef ARCH_DMA_MINALIGN | 220 | #ifndef KMALLOC_MIN_SIZE |
171 | #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN | 221 | #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) |
222 | #endif | ||
223 | |||
224 | extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; | ||
225 | #ifdef CONFIG_ZONE_DMA | ||
226 | extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; | ||
227 | #endif | ||
228 | |||
229 | /* | ||
230 | * Figure out which kmalloc slab an allocation of a certain size | ||
231 | * belongs to. | ||
232 | * 0 = zero alloc | ||
233 | * 1 = 65 .. 96 bytes | ||
234 | * 2 = 120 .. 192 bytes | ||
235 | * n = 2^(n-1) .. 2^n -1 | ||
236 | */ | ||
237 | static __always_inline int kmalloc_index(size_t size) | ||
238 | { | ||
239 | if (!size) | ||
240 | return 0; | ||
241 | |||
242 | if (size <= KMALLOC_MIN_SIZE) | ||
243 | return KMALLOC_SHIFT_LOW; | ||
244 | |||
245 | if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96) | ||
246 | return 1; | ||
247 | if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192) | ||
248 | return 2; | ||
249 | if (size <= 8) return 3; | ||
250 | if (size <= 16) return 4; | ||
251 | if (size <= 32) return 5; | ||
252 | if (size <= 64) return 6; | ||
253 | if (size <= 128) return 7; | ||
254 | if (size <= 256) return 8; | ||
255 | if (size <= 512) return 9; | ||
256 | if (size <= 1024) return 10; | ||
257 | if (size <= 2 * 1024) return 11; | ||
258 | if (size <= 4 * 1024) return 12; | ||
259 | if (size <= 8 * 1024) return 13; | ||
260 | if (size <= 16 * 1024) return 14; | ||
261 | if (size <= 32 * 1024) return 15; | ||
262 | if (size <= 64 * 1024) return 16; | ||
263 | if (size <= 128 * 1024) return 17; | ||
264 | if (size <= 256 * 1024) return 18; | ||
265 | if (size <= 512 * 1024) return 19; | ||
266 | if (size <= 1024 * 1024) return 20; | ||
267 | if (size <= 2 * 1024 * 1024) return 21; | ||
268 | if (size <= 4 * 1024 * 1024) return 22; | ||
269 | if (size <= 8 * 1024 * 1024) return 23; | ||
270 | if (size <= 16 * 1024 * 1024) return 24; | ||
271 | if (size <= 32 * 1024 * 1024) return 25; | ||
272 | if (size <= 64 * 1024 * 1024) return 26; | ||
273 | BUG(); | ||
274 | |||
275 | /* Will never be reached. Needed because the compiler may complain */ | ||
276 | return -1; | ||
277 | } | ||
278 | |||
279 | #ifdef CONFIG_SLAB | ||
280 | #include <linux/slab_def.h> | ||
281 | #elif defined(CONFIG_SLUB) | ||
282 | #include <linux/slub_def.h> | ||
172 | #else | 283 | #else |
173 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) | 284 | #error "Unknown slab allocator" |
174 | #endif | 285 | #endif |
175 | 286 | ||
176 | /* | 287 | /* |
288 | * Determine size used for the nth kmalloc cache. | ||
289 | * return size or 0 if a kmalloc cache for that | ||
290 | * size does not exist | ||
291 | */ | ||
292 | static __always_inline int kmalloc_size(int n) | ||
293 | { | ||
294 | if (n > 2) | ||
295 | return 1 << n; | ||
296 | |||
297 | if (n == 1 && KMALLOC_MIN_SIZE <= 32) | ||
298 | return 96; | ||
299 | |||
300 | if (n == 2 && KMALLOC_MIN_SIZE <= 64) | ||
301 | return 192; | ||
302 | |||
303 | return 0; | ||
304 | } | ||
305 | #endif /* !CONFIG_SLOB */ | ||
306 | |||
307 | /* | ||
177 | * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. | 308 | * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. |
178 | * Intended for arches that get misalignment faults even for 64 bit integer | 309 | * Intended for arches that get misalignment faults even for 64 bit integer |
179 | * aligned buffers. | 310 | * aligned buffers. |
@@ -224,42 +355,6 @@ struct seq_file; | |||
224 | int cache_show(struct kmem_cache *s, struct seq_file *m); | 355 | int cache_show(struct kmem_cache *s, struct seq_file *m); |
225 | void print_slabinfo_header(struct seq_file *m); | 356 | void print_slabinfo_header(struct seq_file *m); |
226 | 357 | ||
227 | /* | ||
228 | * Common kmalloc functions provided by all allocators | ||
229 | */ | ||
230 | void * __must_check __krealloc(const void *, size_t, gfp_t); | ||
231 | void * __must_check krealloc(const void *, size_t, gfp_t); | ||
232 | void kfree(const void *); | ||
233 | void kzfree(const void *); | ||
234 | size_t ksize(const void *); | ||
235 | |||
236 | /* | ||
237 | * Allocator specific definitions. These are mainly used to establish optimized | ||
238 | * ways to convert kmalloc() calls to kmem_cache_alloc() invocations by | ||
239 | * selecting the appropriate general cache at compile time. | ||
240 | * | ||
241 | * Allocators must define at least: | ||
242 | * | ||
243 | * kmem_cache_alloc() | ||
244 | * __kmalloc() | ||
245 | * kmalloc() | ||
246 | * | ||
247 | * Those wishing to support NUMA must also define: | ||
248 | * | ||
249 | * kmem_cache_alloc_node() | ||
250 | * kmalloc_node() | ||
251 | * | ||
252 | * See each allocator definition file for additional comments and | ||
253 | * implementation notes. | ||
254 | */ | ||
255 | #ifdef CONFIG_SLUB | ||
256 | #include <linux/slub_def.h> | ||
257 | #elif defined(CONFIG_SLOB) | ||
258 | #include <linux/slob_def.h> | ||
259 | #else | ||
260 | #include <linux/slab_def.h> | ||
261 | #endif | ||
262 | |||
263 | /** | 358 | /** |
264 | * kmalloc_array - allocate memory for an array. | 359 | * kmalloc_array - allocate memory for an array. |
265 | * @n: number of elements. | 360 | * @n: number of elements. |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 8bb6e0eaf3c6..cd401580bdd3 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -11,8 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ | ||
15 | #include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ | ||
16 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
17 | 15 | ||
18 | /* | 16 | /* |
@@ -97,23 +95,13 @@ struct kmem_cache { | |||
97 | * pointer for each node since "nodelists" uses the remainder of | 95 | * pointer for each node since "nodelists" uses the remainder of |
98 | * available pointers. | 96 | * available pointers. |
99 | */ | 97 | */ |
100 | struct kmem_list3 **nodelists; | 98 | struct kmem_cache_node **node; |
101 | struct array_cache *array[NR_CPUS + MAX_NUMNODES]; | 99 | struct array_cache *array[NR_CPUS + MAX_NUMNODES]; |
102 | /* | 100 | /* |
103 | * Do not add fields after array[] | 101 | * Do not add fields after array[] |
104 | */ | 102 | */ |
105 | }; | 103 | }; |
106 | 104 | ||
107 | /* Size description struct for general caches. */ | ||
108 | struct cache_sizes { | ||
109 | size_t cs_size; | ||
110 | struct kmem_cache *cs_cachep; | ||
111 | #ifdef CONFIG_ZONE_DMA | ||
112 | struct kmem_cache *cs_dmacachep; | ||
113 | #endif | ||
114 | }; | ||
115 | extern struct cache_sizes malloc_sizes[]; | ||
116 | |||
117 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 105 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
118 | void *__kmalloc(size_t size, gfp_t flags); | 106 | void *__kmalloc(size_t size, gfp_t flags); |
119 | 107 | ||
@@ -133,26 +121,22 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) | |||
133 | void *ret; | 121 | void *ret; |
134 | 122 | ||
135 | if (__builtin_constant_p(size)) { | 123 | if (__builtin_constant_p(size)) { |
136 | int i = 0; | 124 | int i; |
137 | 125 | ||
138 | if (!size) | 126 | if (!size) |
139 | return ZERO_SIZE_PTR; | 127 | return ZERO_SIZE_PTR; |
140 | 128 | ||
141 | #define CACHE(x) \ | 129 | if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE)) |
142 | if (size <= x) \ | 130 | return NULL; |
143 | goto found; \ | 131 | |
144 | else \ | 132 | i = kmalloc_index(size); |
145 | i++; | 133 | |
146 | #include <linux/kmalloc_sizes.h> | ||
147 | #undef CACHE | ||
148 | return NULL; | ||
149 | found: | ||
150 | #ifdef CONFIG_ZONE_DMA | 134 | #ifdef CONFIG_ZONE_DMA |
151 | if (flags & GFP_DMA) | 135 | if (flags & GFP_DMA) |
152 | cachep = malloc_sizes[i].cs_dmacachep; | 136 | cachep = kmalloc_dma_caches[i]; |
153 | else | 137 | else |
154 | #endif | 138 | #endif |
155 | cachep = malloc_sizes[i].cs_cachep; | 139 | cachep = kmalloc_caches[i]; |
156 | 140 | ||
157 | ret = kmem_cache_alloc_trace(cachep, flags, size); | 141 | ret = kmem_cache_alloc_trace(cachep, flags, size); |
158 | 142 | ||
@@ -186,26 +170,22 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
186 | struct kmem_cache *cachep; | 170 | struct kmem_cache *cachep; |
187 | 171 | ||
188 | if (__builtin_constant_p(size)) { | 172 | if (__builtin_constant_p(size)) { |
189 | int i = 0; | 173 | int i; |
190 | 174 | ||
191 | if (!size) | 175 | if (!size) |
192 | return ZERO_SIZE_PTR; | 176 | return ZERO_SIZE_PTR; |
193 | 177 | ||
194 | #define CACHE(x) \ | 178 | if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE)) |
195 | if (size <= x) \ | 179 | return NULL; |
196 | goto found; \ | 180 | |
197 | else \ | 181 | i = kmalloc_index(size); |
198 | i++; | 182 | |
199 | #include <linux/kmalloc_sizes.h> | ||
200 | #undef CACHE | ||
201 | return NULL; | ||
202 | found: | ||
203 | #ifdef CONFIG_ZONE_DMA | 183 | #ifdef CONFIG_ZONE_DMA |
204 | if (flags & GFP_DMA) | 184 | if (flags & GFP_DMA) |
205 | cachep = malloc_sizes[i].cs_dmacachep; | 185 | cachep = kmalloc_dma_caches[i]; |
206 | else | 186 | else |
207 | #endif | 187 | #endif |
208 | cachep = malloc_sizes[i].cs_cachep; | 188 | cachep = kmalloc_caches[i]; |
209 | 189 | ||
210 | return kmem_cache_alloc_node_trace(cachep, flags, node, size); | 190 | return kmem_cache_alloc_node_trace(cachep, flags, node, size); |
211 | } | 191 | } |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 9db4825cd393..027276fa8713 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -53,17 +53,6 @@ struct kmem_cache_cpu { | |||
53 | #endif | 53 | #endif |
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct kmem_cache_node { | ||
57 | spinlock_t list_lock; /* Protect partial list and nr_partial */ | ||
58 | unsigned long nr_partial; | ||
59 | struct list_head partial; | ||
60 | #ifdef CONFIG_SLUB_DEBUG | ||
61 | atomic_long_t nr_slabs; | ||
62 | atomic_long_t total_objects; | ||
63 | struct list_head full; | ||
64 | #endif | ||
65 | }; | ||
66 | |||
67 | /* | 56 | /* |
68 | * Word size structure that can be atomically updated or read and that | 57 | * Word size structure that can be atomically updated or read and that |
69 | * contains both the order and the number of objects that a slab of the | 58 | * contains both the order and the number of objects that a slab of the |
@@ -115,111 +104,6 @@ struct kmem_cache { | |||
115 | struct kmem_cache_node *node[MAX_NUMNODES]; | 104 | struct kmem_cache_node *node[MAX_NUMNODES]; |
116 | }; | 105 | }; |
117 | 106 | ||
118 | /* | ||
119 | * Kmalloc subsystem. | ||
120 | */ | ||
121 | #if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8 | ||
122 | #define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN | ||
123 | #else | ||
124 | #define KMALLOC_MIN_SIZE 8 | ||
125 | #endif | ||
126 | |||
127 | #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) | ||
128 | |||
129 | /* | ||
130 | * Maximum kmalloc object size handled by SLUB. Larger object allocations | ||
131 | * are passed through to the page allocator. The page allocator "fastpath" | ||
132 | * is relatively slow so we need this value sufficiently high so that | ||
133 | * performance critical objects are allocated through the SLUB fastpath. | ||
134 | * | ||
135 | * This should be dropped to PAGE_SIZE / 2 once the page allocator | ||
136 | * "fastpath" becomes competitive with the slab allocator fastpaths. | ||
137 | */ | ||
138 | #define SLUB_MAX_SIZE (2 * PAGE_SIZE) | ||
139 | |||
140 | #define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2) | ||
141 | |||
142 | #ifdef CONFIG_ZONE_DMA | ||
143 | #define SLUB_DMA __GFP_DMA | ||
144 | #else | ||
145 | /* Disable DMA functionality */ | ||
146 | #define SLUB_DMA (__force gfp_t)0 | ||
147 | #endif | ||
148 | |||
149 | /* | ||
150 | * We keep the general caches in an array of slab caches that are used for | ||
151 | * 2^x bytes of allocations. | ||
152 | */ | ||
153 | extern struct kmem_cache *kmalloc_caches[SLUB_PAGE_SHIFT]; | ||
154 | |||
155 | /* | ||
156 | * Sorry that the following has to be that ugly but some versions of GCC | ||
157 | * have trouble with constant propagation and loops. | ||
158 | */ | ||
159 | static __always_inline int kmalloc_index(size_t size) | ||
160 | { | ||
161 | if (!size) | ||
162 | return 0; | ||
163 | |||
164 | if (size <= KMALLOC_MIN_SIZE) | ||
165 | return KMALLOC_SHIFT_LOW; | ||
166 | |||
167 | if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96) | ||
168 | return 1; | ||
169 | if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192) | ||
170 | return 2; | ||
171 | if (size <= 8) return 3; | ||
172 | if (size <= 16) return 4; | ||
173 | if (size <= 32) return 5; | ||
174 | if (size <= 64) return 6; | ||
175 | if (size <= 128) return 7; | ||
176 | if (size <= 256) return 8; | ||
177 | if (size <= 512) return 9; | ||
178 | if (size <= 1024) return 10; | ||
179 | if (size <= 2 * 1024) return 11; | ||
180 | if (size <= 4 * 1024) return 12; | ||
181 | /* | ||
182 | * The following is only needed to support architectures with a larger page | ||
183 | * size than 4k. We need to support 2 * PAGE_SIZE here. So for a 64k page | ||
184 | * size we would have to go up to 128k. | ||
185 | */ | ||
186 | if (size <= 8 * 1024) return 13; | ||
187 | if (size <= 16 * 1024) return 14; | ||
188 | if (size <= 32 * 1024) return 15; | ||
189 | if (size <= 64 * 1024) return 16; | ||
190 | if (size <= 128 * 1024) return 17; | ||
191 | if (size <= 256 * 1024) return 18; | ||
192 | if (size <= 512 * 1024) return 19; | ||
193 | if (size <= 1024 * 1024) return 20; | ||
194 | if (size <= 2 * 1024 * 1024) return 21; | ||
195 | BUG(); | ||
196 | return -1; /* Will never be reached */ | ||
197 | |||
198 | /* | ||
199 | * What we really wanted to do and cannot do because of compiler issues is: | ||
200 | * int i; | ||
201 | * for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) | ||
202 | * if (size <= (1 << i)) | ||
203 | * return i; | ||
204 | */ | ||
205 | } | ||
206 | |||
207 | /* | ||
208 | * Find the slab cache for a given combination of allocation flags and size. | ||
209 | * | ||
210 | * This ought to end up with a global pointer to the right cache | ||
211 | * in kmalloc_caches. | ||
212 | */ | ||
213 | static __always_inline struct kmem_cache *kmalloc_slab(size_t size) | ||
214 | { | ||
215 | int index = kmalloc_index(size); | ||
216 | |||
217 | if (index == 0) | ||
218 | return NULL; | ||
219 | |||
220 | return kmalloc_caches[index]; | ||
221 | } | ||
222 | |||
223 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | 107 | void *kmem_cache_alloc(struct kmem_cache *, gfp_t); |
224 | void *__kmalloc(size_t size, gfp_t flags); | 108 | void *__kmalloc(size_t size, gfp_t flags); |
225 | 109 | ||
@@ -274,16 +158,17 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | |||
274 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | 158 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
275 | { | 159 | { |
276 | if (__builtin_constant_p(size)) { | 160 | if (__builtin_constant_p(size)) { |
277 | if (size > SLUB_MAX_SIZE) | 161 | if (size > KMALLOC_MAX_CACHE_SIZE) |
278 | return kmalloc_large(size, flags); | 162 | return kmalloc_large(size, flags); |
279 | 163 | ||
280 | if (!(flags & SLUB_DMA)) { | 164 | if (!(flags & GFP_DMA)) { |
281 | struct kmem_cache *s = kmalloc_slab(size); | 165 | int index = kmalloc_index(size); |
282 | 166 | ||
283 | if (!s) | 167 | if (!index) |
284 | return ZERO_SIZE_PTR; | 168 | return ZERO_SIZE_PTR; |
285 | 169 | ||
286 | return kmem_cache_alloc_trace(s, flags, size); | 170 | return kmem_cache_alloc_trace(kmalloc_caches[index], |
171 | flags, size); | ||
287 | } | 172 | } |
288 | } | 173 | } |
289 | return __kmalloc(size, flags); | 174 | return __kmalloc(size, flags); |
@@ -310,13 +195,14 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s, | |||
310 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | 195 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
311 | { | 196 | { |
312 | if (__builtin_constant_p(size) && | 197 | if (__builtin_constant_p(size) && |
313 | size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) { | 198 | size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) { |
314 | struct kmem_cache *s = kmalloc_slab(size); | 199 | int index = kmalloc_index(size); |
315 | 200 | ||
316 | if (!s) | 201 | if (!index) |
317 | return ZERO_SIZE_PTR; | 202 | return ZERO_SIZE_PTR; |
318 | 203 | ||
319 | return kmem_cache_alloc_node_trace(s, flags, node, size); | 204 | return kmem_cache_alloc_node_trace(kmalloc_caches[index], |
205 | flags, node, size); | ||
320 | } | 206 | } |
321 | return __kmalloc_node(size, flags, node); | 207 | return __kmalloc_node(size, flags, node); |
322 | } | 208 | } |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 3e07a7df6478..e6564c1dc552 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -20,7 +20,6 @@ struct call_single_data { | |||
20 | smp_call_func_t func; | 20 | smp_call_func_t func; |
21 | void *info; | 21 | void *info; |
22 | u16 flags; | 22 | u16 flags; |
23 | u16 priv; | ||
24 | }; | 23 | }; |
25 | 24 | ||
26 | /* total number of cpus in this system (may exceed NR_CPUS) */ | 25 | /* total number of cpus in this system (may exceed NR_CPUS) */ |
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h index e8d702e0fd89..54f91d35e5fd 100644 --- a/include/linux/sock_diag.h +++ b/include/linux/sock_diag.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __SOCK_DIAG_H__ | 1 | #ifndef __SOCK_DIAG_H__ |
2 | #define __SOCK_DIAG_H__ | 2 | #define __SOCK_DIAG_H__ |
3 | 3 | ||
4 | #include <linux/user_namespace.h> | ||
4 | #include <uapi/linux/sock_diag.h> | 5 | #include <uapi/linux/sock_diag.h> |
5 | 6 | ||
6 | struct sk_buff; | 7 | struct sk_buff; |
@@ -22,5 +23,7 @@ int sock_diag_check_cookie(void *sk, __u32 *cookie); | |||
22 | void sock_diag_save_cookie(void *sk, __u32 *cookie); | 23 | void sock_diag_save_cookie(void *sk, __u32 *cookie); |
23 | 24 | ||
24 | int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); | 25 | int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); |
26 | int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk, | ||
27 | struct sk_buff *skb, int attrtype); | ||
25 | 28 | ||
26 | #endif | 29 | #endif |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 2b9f74b0ffea..428c37a1f95c 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -298,6 +298,7 @@ struct ucred { | |||
298 | #define SOL_IUCV 277 | 298 | #define SOL_IUCV 277 |
299 | #define SOL_CAIF 278 | 299 | #define SOL_CAIF 278 |
300 | #define SOL_ALG 279 | 300 | #define SOL_ALG 279 |
301 | #define SOL_NFC 280 | ||
301 | 302 | ||
302 | /* IPX options */ | 303 | /* IPX options */ |
303 | #define IPX_TYPE 1 | 304 | #define IPX_TYPE 1 |
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h index b2b1afbb3202..aa327a8105ad 100644 --- a/include/linux/spi/at86rf230.h +++ b/include/linux/spi/at86rf230.h | |||
@@ -26,6 +26,20 @@ struct at86rf230_platform_data { | |||
26 | int rstn; | 26 | int rstn; |
27 | int slp_tr; | 27 | int slp_tr; |
28 | int dig2; | 28 | int dig2; |
29 | |||
30 | /* Setting the irq_type will configure the driver to request | ||
31 | * the platform irq trigger type according to the given value | ||
32 | * and configure the interrupt polarity of the device to the | ||
33 | * corresponding polarity. | ||
34 | * | ||
35 | * Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING, | ||
36 | * IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW | ||
37 | * | ||
38 | * Setting it to 0, the driver does not touch the trigger type | ||
39 | * configuration of the interrupt and sets the interrupt polarity | ||
40 | * of the device to high active (the default value). | ||
41 | */ | ||
42 | int irq_type; | ||
29 | }; | 43 | }; |
30 | 44 | ||
31 | #endif | 45 | #endif |
diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h index 61ae1306db23..4835486f58e5 100644 --- a/include/linux/spi/mxs-spi.h +++ b/include/linux/spi/mxs-spi.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #ifndef __LINUX_SPI_MXS_SPI_H__ | 24 | #ifndef __LINUX_SPI_MXS_SPI_H__ |
25 | #define __LINUX_SPI_MXS_SPI_H__ | 25 | #define __LINUX_SPI_MXS_SPI_H__ |
26 | 26 | ||
27 | #include <linux/fsl/mxs-dma.h> | 27 | #include <linux/dmaengine.h> |
28 | 28 | ||
29 | #define ssp_is_old(host) ((host)->devid == IMX23_SSP) | 29 | #define ssp_is_old(host) ((host)->devid == IMX23_SSP) |
30 | 30 | ||
@@ -137,9 +137,7 @@ struct mxs_ssp { | |||
137 | unsigned int clk_rate; | 137 | unsigned int clk_rate; |
138 | enum mxs_ssp_id devid; | 138 | enum mxs_ssp_id devid; |
139 | 139 | ||
140 | int dma_channel; | ||
141 | struct dma_chan *dmach; | 140 | struct dma_chan *dmach; |
142 | struct mxs_dma_data dma_data; | ||
143 | unsigned int dma_dir; | 141 | unsigned int dma_dir; |
144 | enum dma_transfer_direction slave_dirn; | 142 | enum dma_transfer_direction slave_dirn; |
145 | u32 ssp_pio_words[SSP_PIO_NUM]; | 143 | u32 ssp_pio_words[SSP_PIO_NUM]; |
diff --git a/include/linux/spi/spi-tegra.h b/include/linux/spi/spi-tegra.h deleted file mode 100644 index 786932c62edb..000000000000 --- a/include/linux/spi/spi-tegra.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller. | ||
3 | * | ||
4 | * Copyright (C) 2011 NVIDIA Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that 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 | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_SPI_TEGRA_H | ||
22 | #define _LINUX_SPI_TEGRA_H | ||
23 | |||
24 | struct tegra_spi_platform_data { | ||
25 | int dma_req_sel; | ||
26 | unsigned int spi_max_frequency; | ||
27 | }; | ||
28 | |||
29 | /* | ||
30 | * Controller data from device to pass some info like | ||
31 | * hw based chip select can be used or not and if yes | ||
32 | * then CS hold and setup time. | ||
33 | */ | ||
34 | struct tegra_spi_device_controller_data { | ||
35 | bool is_hw_based_cs; | ||
36 | int cs_setup_clk_count; | ||
37 | int cs_hold_clk_count; | ||
38 | }; | ||
39 | |||
40 | #endif /* _LINUX_SPI_TEGRA_H */ | ||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 38c2b925923d..733eb5ee31c5 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -228,6 +228,11 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
228 | * every chipselect is connected to a slave. | 228 | * every chipselect is connected to a slave. |
229 | * @dma_alignment: SPI controller constraint on DMA buffers alignment. | 229 | * @dma_alignment: SPI controller constraint on DMA buffers alignment. |
230 | * @mode_bits: flags understood by this controller driver | 230 | * @mode_bits: flags understood by this controller driver |
231 | * @bits_per_word_mask: A mask indicating which values of bits_per_word are | ||
232 | * supported by the driver. Bit n indicates that a bits_per_word n+1 is | ||
233 | * suported. If set, the SPI core will reject any transfer with an | ||
234 | * unsupported bits_per_word. If not set, this value is simply ignored, | ||
235 | * and it's up to the individual driver to perform any validation. | ||
231 | * @flags: other constraints relevant to this driver | 236 | * @flags: other constraints relevant to this driver |
232 | * @bus_lock_spinlock: spinlock for SPI bus locking | 237 | * @bus_lock_spinlock: spinlock for SPI bus locking |
233 | * @bus_lock_mutex: mutex for SPI bus locking | 238 | * @bus_lock_mutex: mutex for SPI bus locking |
@@ -301,6 +306,9 @@ struct spi_master { | |||
301 | /* spi_device.mode flags understood by this controller driver */ | 306 | /* spi_device.mode flags understood by this controller driver */ |
302 | u16 mode_bits; | 307 | u16 mode_bits; |
303 | 308 | ||
309 | /* bitmask of supported bits_per_word for transfers */ | ||
310 | u32 bits_per_word_mask; | ||
311 | |||
304 | /* other constraints relevant to this driver */ | 312 | /* other constraints relevant to this driver */ |
305 | u16 flags; | 313 | u16 flags; |
306 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ | 314 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 22958d68ecfe..c64999fd1660 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -26,9 +26,9 @@ struct ssb_sprom_core_pwr_info { | |||
26 | 26 | ||
27 | struct ssb_sprom { | 27 | struct ssb_sprom { |
28 | u8 revision; | 28 | u8 revision; |
29 | u8 il0mac[6]; /* MAC address for 802.11b/g */ | 29 | u8 il0mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11b/g */ |
30 | u8 et0mac[6]; /* MAC address for Ethernet */ | 30 | u8 et0mac[6] __aligned(sizeof(u16)); /* MAC address for Ethernet */ |
31 | u8 et1mac[6]; /* MAC address for 802.11a */ | 31 | u8 et1mac[6] __aligned(sizeof(u16)); /* MAC address for 802.11a */ |
32 | u8 et0phyaddr; /* MII address for enet0 */ | 32 | u8 et0phyaddr; /* MII address for enet0 */ |
33 | u8 et1phyaddr; /* MII address for enet1 */ | 33 | u8 et1phyaddr; /* MII address for enet1 */ |
34 | u8 et0mdcport; /* MDIO for enet0 */ | 34 | u8 et0mdcport; /* MDIO for enet0 */ |
@@ -340,13 +340,61 @@ enum ssb_bustype { | |||
340 | #define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ | 340 | #define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ |
341 | #define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ | 341 | #define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ |
342 | /* board_type */ | 342 | /* board_type */ |
343 | #define SSB_BOARD_BCM94301CB 0x0406 | ||
344 | #define SSB_BOARD_BCM94301MP 0x0407 | ||
345 | #define SSB_BOARD_BU4309 0x040A | ||
346 | #define SSB_BOARD_BCM94309CB 0x040B | ||
347 | #define SSB_BOARD_BCM4309MP 0x040C | ||
348 | #define SSB_BOARD_BU4306 0x0416 | ||
343 | #define SSB_BOARD_BCM94306MP 0x0418 | 349 | #define SSB_BOARD_BCM94306MP 0x0418 |
344 | #define SSB_BOARD_BCM4309G 0x0421 | 350 | #define SSB_BOARD_BCM4309G 0x0421 |
345 | #define SSB_BOARD_BCM4306CB 0x0417 | 351 | #define SSB_BOARD_BCM4306CB 0x0417 |
346 | #define SSB_BOARD_BCM4309MP 0x040C | 352 | #define SSB_BOARD_BCM94306PC 0x0425 /* pcmcia 3.3v 4306 card */ |
353 | #define SSB_BOARD_BCM94306CBSG 0x042B /* with SiGe PA */ | ||
354 | #define SSB_BOARD_PCSG94306 0x042D /* with SiGe PA */ | ||
355 | #define SSB_BOARD_BU4704SD 0x042E /* with sdram */ | ||
356 | #define SSB_BOARD_BCM94704AGR 0x042F /* dual 11a/11g Router */ | ||
357 | #define SSB_BOARD_BCM94308MP 0x0430 /* 11a-only minipci */ | ||
358 | #define SSB_BOARD_BU4318 0x0447 | ||
359 | #define SSB_BOARD_CB4318 0x0448 | ||
360 | #define SSB_BOARD_MPG4318 0x0449 | ||
347 | #define SSB_BOARD_MP4318 0x044A | 361 | #define SSB_BOARD_MP4318 0x044A |
348 | #define SSB_BOARD_BU4306 0x0416 | 362 | #define SSB_BOARD_SD4318 0x044B |
349 | #define SSB_BOARD_BU4309 0x040A | 363 | #define SSB_BOARD_BCM94306P 0x044C /* with SiGe */ |
364 | #define SSB_BOARD_BCM94303MP 0x044E | ||
365 | #define SSB_BOARD_BCM94306MPM 0x0450 | ||
366 | #define SSB_BOARD_BCM94306MPL 0x0453 | ||
367 | #define SSB_BOARD_PC4303 0x0454 /* pcmcia */ | ||
368 | #define SSB_BOARD_BCM94306MPLNA 0x0457 | ||
369 | #define SSB_BOARD_BCM94306MPH 0x045B | ||
370 | #define SSB_BOARD_BCM94306PCIV 0x045C | ||
371 | #define SSB_BOARD_BCM94318MPGH 0x0463 | ||
372 | #define SSB_BOARD_BU4311 0x0464 | ||
373 | #define SSB_BOARD_BCM94311MC 0x0465 | ||
374 | #define SSB_BOARD_BCM94311MCAG 0x0466 | ||
375 | /* 4321 boards */ | ||
376 | #define SSB_BOARD_BU4321 0x046B | ||
377 | #define SSB_BOARD_BU4321E 0x047C | ||
378 | #define SSB_BOARD_MP4321 0x046C | ||
379 | #define SSB_BOARD_CB2_4321 0x046D | ||
380 | #define SSB_BOARD_CB2_4321_AG 0x0066 | ||
381 | #define SSB_BOARD_MC4321 0x046E | ||
382 | /* 4325 boards */ | ||
383 | #define SSB_BOARD_BCM94325DEVBU 0x0490 | ||
384 | #define SSB_BOARD_BCM94325BGABU 0x0491 | ||
385 | #define SSB_BOARD_BCM94325SDGWB 0x0492 | ||
386 | #define SSB_BOARD_BCM94325SDGMDL 0x04AA | ||
387 | #define SSB_BOARD_BCM94325SDGMDL2 0x04C6 | ||
388 | #define SSB_BOARD_BCM94325SDGMDL3 0x04C9 | ||
389 | #define SSB_BOARD_BCM94325SDABGWBA 0x04E1 | ||
390 | /* 4322 boards */ | ||
391 | #define SSB_BOARD_BCM94322MC 0x04A4 | ||
392 | #define SSB_BOARD_BCM94322USB 0x04A8 /* dualband */ | ||
393 | #define SSB_BOARD_BCM94322HM 0x04B0 | ||
394 | #define SSB_BOARD_BCM94322USB2D 0x04Bf /* single band discrete front end */ | ||
395 | /* 4312 boards */ | ||
396 | #define SSB_BOARD_BU4312 0x048A | ||
397 | #define SSB_BOARD_BCM4312MCGSG 0x04B5 | ||
350 | /* chip_package */ | 398 | /* chip_package */ |
351 | #define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ | 399 | #define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ |
352 | #define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ | 400 | #define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ |
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index 6ecfa02ddbac..3a7256955b10 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -289,11 +289,11 @@ | |||
289 | #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 | 289 | #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 |
290 | #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ | 290 | #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ |
291 | #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ | 291 | #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ |
292 | #define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */ | 292 | #define SSB_SPROM4_ANTAVAIL 0x005C /* Antenna available bitfields */ |
293 | #define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ | 293 | #define SSB_SPROM4_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ |
294 | #define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 | 294 | #define SSB_SPROM4_ANTAVAIL_BG_SHIFT 0 |
295 | #define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ | 295 | #define SSB_SPROM4_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ |
296 | #define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 | 296 | #define SSB_SPROM4_ANTAVAIL_A_SHIFT 8 |
297 | #define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */ | 297 | #define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */ |
298 | #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ | 298 | #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ |
299 | #define SSB_SPROM4_AGAIN0_SHIFT 0 | 299 | #define SSB_SPROM4_AGAIN0_SHIFT 0 |
diff --git a/include/linux/ssbi.h b/include/linux/ssbi.h new file mode 100644 index 000000000000..44ef5da21470 --- /dev/null +++ b/include/linux/ssbi.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* Copyright (C) 2010 Google, Inc. | ||
2 | * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | ||
3 | * Author: Dima Zavin <dima@android.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 and | ||
7 | * only version 2 as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_SSBI_H | ||
16 | #define _LINUX_SSBI_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | struct ssbi_slave_info { | ||
21 | const char *name; | ||
22 | void *platform_data; | ||
23 | }; | ||
24 | |||
25 | enum ssbi_controller_type { | ||
26 | MSM_SBI_CTRL_SSBI = 0, | ||
27 | MSM_SBI_CTRL_SSBI2, | ||
28 | MSM_SBI_CTRL_PMIC_ARBITER, | ||
29 | }; | ||
30 | |||
31 | struct ssbi_platform_data { | ||
32 | struct ssbi_slave_info slave; | ||
33 | enum ssbi_controller_type controller_type; | ||
34 | }; | ||
35 | |||
36 | int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len); | ||
37 | int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); | ||
38 | #endif | ||
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index a3eb2f65b656..3eeee9672a4a 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h | |||
@@ -13,4 +13,62 @@ enum string_size_units { | |||
13 | int string_get_size(u64 size, enum string_size_units units, | 13 | int string_get_size(u64 size, enum string_size_units units, |
14 | char *buf, int len); | 14 | char *buf, int len); |
15 | 15 | ||
16 | #define UNESCAPE_SPACE 0x01 | ||
17 | #define UNESCAPE_OCTAL 0x02 | ||
18 | #define UNESCAPE_HEX 0x04 | ||
19 | #define UNESCAPE_SPECIAL 0x08 | ||
20 | #define UNESCAPE_ANY \ | ||
21 | (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) | ||
22 | |||
23 | /** | ||
24 | * string_unescape - unquote characters in the given string | ||
25 | * @src: source buffer (escaped) | ||
26 | * @dst: destination buffer (unescaped) | ||
27 | * @size: size of the destination buffer (0 to unlimit) | ||
28 | * @flags: combination of the flags (bitwise OR): | ||
29 | * %UNESCAPE_SPACE: | ||
30 | * '\f' - form feed | ||
31 | * '\n' - new line | ||
32 | * '\r' - carriage return | ||
33 | * '\t' - horizontal tab | ||
34 | * '\v' - vertical tab | ||
35 | * %UNESCAPE_OCTAL: | ||
36 | * '\NNN' - byte with octal value NNN (1 to 3 digits) | ||
37 | * %UNESCAPE_HEX: | ||
38 | * '\xHH' - byte with hexadecimal value HH (1 to 2 digits) | ||
39 | * %UNESCAPE_SPECIAL: | ||
40 | * '\"' - double quote | ||
41 | * '\\' - backslash | ||
42 | * '\a' - alert (BEL) | ||
43 | * '\e' - escape | ||
44 | * %UNESCAPE_ANY: | ||
45 | * all previous together | ||
46 | * | ||
47 | * Returns amount of characters processed to the destination buffer excluding | ||
48 | * trailing '\0'. | ||
49 | * | ||
50 | * Because the size of the output will be the same as or less than the size of | ||
51 | * the input, the transformation may be performed in place. | ||
52 | * | ||
53 | * Caller must provide valid source and destination pointers. Be aware that | ||
54 | * destination buffer will always be NULL-terminated. Source string must be | ||
55 | * NULL-terminated as well. | ||
56 | */ | ||
57 | int string_unescape(char *src, char *dst, size_t size, unsigned int flags); | ||
58 | |||
59 | static inline int string_unescape_inplace(char *buf, unsigned int flags) | ||
60 | { | ||
61 | return string_unescape(buf, buf, 0, flags); | ||
62 | } | ||
63 | |||
64 | static inline int string_unescape_any(char *src, char *dst, size_t size) | ||
65 | { | ||
66 | return string_unescape(src, dst, size, UNESCAPE_ANY); | ||
67 | } | ||
68 | |||
69 | static inline int string_unescape_any_inplace(char *buf) | ||
70 | { | ||
71 | return string_unescape_any(buf, buf, 0); | ||
72 | } | ||
73 | |||
16 | #endif | 74 | #endif |
diff --git a/include/linux/sudmac.h b/include/linux/sudmac.h new file mode 100644 index 000000000000..377b8a5788fa --- /dev/null +++ b/include/linux/sudmac.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Header for the SUDMAC driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
5 | * | ||
6 | * This is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of version 2 of the GNU General Public License as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef SUDMAC_H | ||
11 | #define SUDMAC_H | ||
12 | |||
13 | #include <linux/dmaengine.h> | ||
14 | #include <linux/shdma-base.h> | ||
15 | #include <linux/types.h> | ||
16 | |||
17 | /* Used by slave DMA clients to request DMA to/from a specific peripheral */ | ||
18 | struct sudmac_slave { | ||
19 | struct shdma_slave shdma_slave; /* Set by the platform */ | ||
20 | }; | ||
21 | |||
22 | /* | ||
23 | * Supplied by platforms to specify, how a DMA channel has to be configured for | ||
24 | * a certain peripheral | ||
25 | */ | ||
26 | struct sudmac_slave_config { | ||
27 | int slave_id; | ||
28 | }; | ||
29 | |||
30 | struct sudmac_channel { | ||
31 | unsigned long offset; | ||
32 | unsigned long config; | ||
33 | unsigned long wait; /* The configuable range is 0 to 3 */ | ||
34 | unsigned long dint_end_bit; | ||
35 | }; | ||
36 | |||
37 | struct sudmac_pdata { | ||
38 | const struct sudmac_slave_config *slave; | ||
39 | int slave_num; | ||
40 | const struct sudmac_channel *channel; | ||
41 | int channel_num; | ||
42 | }; | ||
43 | |||
44 | /* Definitions for the sudmac_channel.config */ | ||
45 | #define SUDMAC_TX_BUFFER_MODE BIT(0) | ||
46 | #define SUDMAC_RX_END_MODE BIT(1) | ||
47 | |||
48 | /* Definitions for the sudmac_channel.dint_end_bit */ | ||
49 | #define SUDMAC_DMA_BIT_CH0 BIT(0) | ||
50 | #define SUDMAC_DMA_BIT_CH1 BIT(1) | ||
51 | |||
52 | #endif | ||
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 58fda1c3c783..0dd00f4f6810 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -22,6 +22,8 @@ | |||
22 | /* size of the nodename buffer */ | 22 | /* size of the nodename buffer */ |
23 | #define UNX_MAXNODENAME 32 | 23 | #define UNX_MAXNODENAME 32 |
24 | 24 | ||
25 | struct rpcsec_gss_info; | ||
26 | |||
25 | /* Work around the lack of a VFS credential */ | 27 | /* Work around the lack of a VFS credential */ |
26 | struct auth_cred { | 28 | struct auth_cred { |
27 | kuid_t uid; | 29 | kuid_t uid; |
@@ -103,6 +105,9 @@ struct rpc_authops { | |||
103 | int (*pipes_create)(struct rpc_auth *); | 105 | int (*pipes_create)(struct rpc_auth *); |
104 | void (*pipes_destroy)(struct rpc_auth *); | 106 | void (*pipes_destroy)(struct rpc_auth *); |
105 | int (*list_pseudoflavors)(rpc_authflavor_t *, int); | 107 | int (*list_pseudoflavors)(rpc_authflavor_t *, int); |
108 | rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *); | ||
109 | int (*flavor2info)(rpc_authflavor_t, | ||
110 | struct rpcsec_gss_info *); | ||
106 | }; | 111 | }; |
107 | 112 | ||
108 | struct rpc_credops { | 113 | struct rpc_credops { |
@@ -137,6 +142,10 @@ int rpcauth_register(const struct rpc_authops *); | |||
137 | int rpcauth_unregister(const struct rpc_authops *); | 142 | int rpcauth_unregister(const struct rpc_authops *); |
138 | struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); | 143 | struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); |
139 | void rpcauth_release(struct rpc_auth *); | 144 | void rpcauth_release(struct rpc_auth *); |
145 | rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t, | ||
146 | struct rpcsec_gss_info *); | ||
147 | int rpcauth_get_gssinfo(rpc_authflavor_t, | ||
148 | struct rpcsec_gss_info *); | ||
140 | int rpcauth_list_flavors(rpc_authflavor_t *, int); | 149 | int rpcauth_list_flavors(rpc_authflavor_t *, int); |
141 | struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); | 150 | struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); |
142 | void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); | 151 | void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 2cf4ffaa3cd4..bfe11be81f6f 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -124,6 +124,8 @@ struct rpc_create_args { | |||
124 | #define RPC_CLNT_CREATE_NOPING (1UL << 4) | 124 | #define RPC_CLNT_CREATE_NOPING (1UL << 4) |
125 | #define RPC_CLNT_CREATE_DISCRTRY (1UL << 5) | 125 | #define RPC_CLNT_CREATE_DISCRTRY (1UL << 5) |
126 | #define RPC_CLNT_CREATE_QUIET (1UL << 6) | 126 | #define RPC_CLNT_CREATE_QUIET (1UL << 6) |
127 | #define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) | ||
128 | #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) | ||
127 | 129 | ||
128 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 130 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
129 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 131 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index a19e2547ae6a..161463e59624 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h | |||
@@ -25,10 +25,21 @@ struct gss_ctx { | |||
25 | 25 | ||
26 | #define GSS_C_NO_BUFFER ((struct xdr_netobj) 0) | 26 | #define GSS_C_NO_BUFFER ((struct xdr_netobj) 0) |
27 | #define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0) | 27 | #define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0) |
28 | #define GSS_C_NULL_OID ((struct xdr_netobj) 0) | 28 | #define GSS_C_QOP_DEFAULT (0) |
29 | 29 | ||
30 | /*XXX arbitrary length - is this set somewhere? */ | 30 | /*XXX arbitrary length - is this set somewhere? */ |
31 | #define GSS_OID_MAX_LEN 32 | 31 | #define GSS_OID_MAX_LEN 32 |
32 | struct rpcsec_gss_oid { | ||
33 | unsigned int len; | ||
34 | u8 data[GSS_OID_MAX_LEN]; | ||
35 | }; | ||
36 | |||
37 | /* From RFC 3530 */ | ||
38 | struct rpcsec_gss_info { | ||
39 | struct rpcsec_gss_oid oid; | ||
40 | u32 qop; | ||
41 | u32 service; | ||
42 | }; | ||
32 | 43 | ||
33 | /* gss-api prototypes; note that these are somewhat simplified versions of | 44 | /* gss-api prototypes; note that these are somewhat simplified versions of |
34 | * the prototypes specified in RFC 2744. */ | 45 | * the prototypes specified in RFC 2744. */ |
@@ -37,6 +48,7 @@ int gss_import_sec_context( | |||
37 | size_t bufsize, | 48 | size_t bufsize, |
38 | struct gss_api_mech *mech, | 49 | struct gss_api_mech *mech, |
39 | struct gss_ctx **ctx_id, | 50 | struct gss_ctx **ctx_id, |
51 | time_t *endtime, | ||
40 | gfp_t gfp_mask); | 52 | gfp_t gfp_mask); |
41 | u32 gss_get_mic( | 53 | u32 gss_get_mic( |
42 | struct gss_ctx *ctx_id, | 54 | struct gss_ctx *ctx_id, |
@@ -58,12 +70,14 @@ u32 gss_unwrap( | |||
58 | u32 gss_delete_sec_context( | 70 | u32 gss_delete_sec_context( |
59 | struct gss_ctx **ctx_id); | 71 | struct gss_ctx **ctx_id); |
60 | 72 | ||
61 | u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service); | 73 | rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop, |
74 | u32 service); | ||
62 | u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor); | 75 | u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor); |
63 | char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service); | 76 | char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service); |
64 | 77 | ||
65 | struct pf_desc { | 78 | struct pf_desc { |
66 | u32 pseudoflavor; | 79 | u32 pseudoflavor; |
80 | u32 qop; | ||
67 | u32 service; | 81 | u32 service; |
68 | char *name; | 82 | char *name; |
69 | char *auth_domain_name; | 83 | char *auth_domain_name; |
@@ -76,7 +90,7 @@ struct pf_desc { | |||
76 | struct gss_api_mech { | 90 | struct gss_api_mech { |
77 | struct list_head gm_list; | 91 | struct list_head gm_list; |
78 | struct module *gm_owner; | 92 | struct module *gm_owner; |
79 | struct xdr_netobj gm_oid; | 93 | struct rpcsec_gss_oid gm_oid; |
80 | char *gm_name; | 94 | char *gm_name; |
81 | const struct gss_api_ops *gm_ops; | 95 | const struct gss_api_ops *gm_ops; |
82 | /* pseudoflavors supported by this mechanism: */ | 96 | /* pseudoflavors supported by this mechanism: */ |
@@ -92,6 +106,7 @@ struct gss_api_ops { | |||
92 | const void *input_token, | 106 | const void *input_token, |
93 | size_t bufsize, | 107 | size_t bufsize, |
94 | struct gss_ctx *ctx_id, | 108 | struct gss_ctx *ctx_id, |
109 | time_t *endtime, | ||
95 | gfp_t gfp_mask); | 110 | gfp_t gfp_mask); |
96 | u32 (*gss_get_mic)( | 111 | u32 (*gss_get_mic)( |
97 | struct gss_ctx *ctx_id, | 112 | struct gss_ctx *ctx_id, |
@@ -119,7 +134,13 @@ void gss_mech_unregister(struct gss_api_mech *); | |||
119 | 134 | ||
120 | /* returns a mechanism descriptor given an OID, and increments the mechanism's | 135 | /* returns a mechanism descriptor given an OID, and increments the mechanism's |
121 | * reference count. */ | 136 | * reference count. */ |
122 | struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *); | 137 | struct gss_api_mech * gss_mech_get_by_OID(struct rpcsec_gss_oid *); |
138 | |||
139 | /* Given a GSS security tuple, look up a pseudoflavor */ | ||
140 | rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *); | ||
141 | |||
142 | /* Given a pseudoflavor, look up a GSS security tuple */ | ||
143 | int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *); | ||
123 | 144 | ||
124 | /* Returns a reference to a mechanism, given a name like "krb5" etc. */ | 145 | /* Returns a reference to a mechanism, given a name like "krb5" etc. */ |
125 | struct gss_api_mech *gss_mech_get_by_name(const char *); | 146 | struct gss_api_mech *gss_mech_get_by_name(const char *); |
@@ -130,9 +151,6 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); | |||
130 | /* Fill in an array with a list of supported pseudoflavors */ | 151 | /* Fill in an array with a list of supported pseudoflavors */ |
131 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); | 152 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); |
132 | 153 | ||
133 | /* Just increments the mechanism's reference count and returns its input: */ | ||
134 | struct gss_api_mech * gss_mech_get(struct gss_api_mech *); | ||
135 | |||
136 | /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a | 154 | /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a |
137 | * corresponding call to gss_mech_put. */ | 155 | * corresponding call to gss_mech_put. */ |
138 | void gss_mech_put(struct gss_api_mech *); | 156 | void gss_mech_put(struct gss_api_mech *); |
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index c68a147939a6..aadc6a04e1ac 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h | |||
@@ -138,6 +138,9 @@ typedef __be32 rpc_fraghdr; | |||
138 | #define RPC_MAX_HEADER_WITH_AUTH \ | 138 | #define RPC_MAX_HEADER_WITH_AUTH \ |
139 | (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) | 139 | (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) |
140 | 140 | ||
141 | #define RPC_MAX_REPHEADER_WITH_AUTH \ | ||
142 | (RPC_REPHDRSIZE + (2 + RPC_MAX_AUTH_SIZE/4)) | ||
143 | |||
141 | /* | 144 | /* |
142 | * RFC1833/RFC3530 rpcbind (v3+) well-known netid's. | 145 | * RFC1833/RFC3530 rpcbind (v3+) well-known netid's. |
143 | */ | 146 | */ |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 30834be03011..cec7b9b5e1bf 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -255,6 +255,9 @@ static inline int bc_prealloc(struct rpc_rqst *req) | |||
255 | } | 255 | } |
256 | #endif /* CONFIG_SUNRPC_BACKCHANNEL */ | 256 | #endif /* CONFIG_SUNRPC_BACKCHANNEL */ |
257 | 257 | ||
258 | #define XPRT_CREATE_INFINITE_SLOTS (1U) | ||
259 | #define XPRT_CREATE_NO_IDLE_TIMEOUT (1U << 1) | ||
260 | |||
258 | struct xprt_create { | 261 | struct xprt_create { |
259 | int ident; /* XPRT_TRANSPORT identifier */ | 262 | int ident; /* XPRT_TRANSPORT identifier */ |
260 | struct net * net; | 263 | struct net * net; |
@@ -263,6 +266,7 @@ struct xprt_create { | |||
263 | size_t addrlen; | 266 | size_t addrlen; |
264 | const char *servername; | 267 | const char *servername; |
265 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ | 268 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
269 | unsigned int flags; | ||
266 | }; | 270 | }; |
267 | 271 | ||
268 | struct xprt_class { | 272 | struct xprt_class { |
@@ -279,6 +283,7 @@ struct xprt_class { | |||
279 | struct rpc_xprt *xprt_create_transport(struct xprt_create *args); | 283 | struct rpc_xprt *xprt_create_transport(struct xprt_create *args); |
280 | void xprt_connect(struct rpc_task *task); | 284 | void xprt_connect(struct rpc_task *task); |
281 | void xprt_reserve(struct rpc_task *task); | 285 | void xprt_reserve(struct rpc_task *task); |
286 | void xprt_retry_reserve(struct rpc_task *task); | ||
282 | int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task); | 287 | int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task); |
283 | int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); | 288 | int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); |
284 | void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); | 289 | void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); |
@@ -334,6 +339,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable); | |||
334 | #define XPRT_CLOSING (6) | 339 | #define XPRT_CLOSING (6) |
335 | #define XPRT_CONNECTION_ABORT (7) | 340 | #define XPRT_CONNECTION_ABORT (7) |
336 | #define XPRT_CONNECTION_CLOSE (8) | 341 | #define XPRT_CONNECTION_CLOSE (8) |
342 | #define XPRT_CONGESTED (9) | ||
337 | 343 | ||
338 | static inline void xprt_set_connected(struct rpc_xprt *xprt) | 344 | static inline void xprt_set_connected(struct rpc_xprt *xprt) |
339 | { | 345 | { |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 2818a123f3ea..1701ce4be746 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -236,7 +236,7 @@ extern unsigned long nr_free_pagecache_pages(void); | |||
236 | extern void __lru_cache_add(struct page *, enum lru_list lru); | 236 | extern void __lru_cache_add(struct page *, enum lru_list lru); |
237 | extern void lru_cache_add_lru(struct page *, enum lru_list lru); | 237 | extern void lru_cache_add_lru(struct page *, enum lru_list lru); |
238 | extern void lru_add_page_tail(struct page *page, struct page *page_tail, | 238 | extern void lru_add_page_tail(struct page *page, struct page *page_tail, |
239 | struct lruvec *lruvec); | 239 | struct lruvec *lruvec, struct list_head *head); |
240 | extern void activate_page(struct page *); | 240 | extern void activate_page(struct page *); |
241 | extern void mark_page_accessed(struct page *); | 241 | extern void mark_page_accessed(struct page *); |
242 | extern void lru_add_drain(void); | 242 | extern void lru_add_drain(void); |
@@ -330,6 +330,9 @@ static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) | |||
330 | /* linux/mm/page_io.c */ | 330 | /* linux/mm/page_io.c */ |
331 | extern int swap_readpage(struct page *); | 331 | extern int swap_readpage(struct page *); |
332 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); | 332 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); |
333 | extern void end_swap_bio_write(struct bio *bio, int err); | ||
334 | extern int __swap_writepage(struct page *page, struct writeback_control *wbc, | ||
335 | void (*end_write_func)(struct bio *, int)); | ||
333 | extern int swap_set_page_dirty(struct page *page); | 336 | extern int swap_set_page_dirty(struct page *page); |
334 | extern void end_swap_bio_read(struct bio *bio, int err); | 337 | extern void end_swap_bio_read(struct bio *bio, int err); |
335 | 338 | ||
@@ -343,8 +346,9 @@ extern struct address_space swapper_spaces[]; | |||
343 | #define swap_address_space(entry) (&swapper_spaces[swp_type(entry)]) | 346 | #define swap_address_space(entry) (&swapper_spaces[swp_type(entry)]) |
344 | extern unsigned long total_swapcache_pages(void); | 347 | extern unsigned long total_swapcache_pages(void); |
345 | extern void show_swap_cache_info(void); | 348 | extern void show_swap_cache_info(void); |
346 | extern int add_to_swap(struct page *); | 349 | extern int add_to_swap(struct page *, struct list_head *list); |
347 | extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); | 350 | extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); |
351 | extern int __add_to_swap_cache(struct page *page, swp_entry_t entry); | ||
348 | extern void __delete_from_swap_cache(struct page *); | 352 | extern void __delete_from_swap_cache(struct page *); |
349 | extern void delete_from_swap_cache(struct page *); | 353 | extern void delete_from_swap_cache(struct page *); |
350 | extern void free_page_and_swap_cache(struct page *); | 354 | extern void free_page_and_swap_cache(struct page *); |
@@ -461,7 +465,7 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp) | |||
461 | return NULL; | 465 | return NULL; |
462 | } | 466 | } |
463 | 467 | ||
464 | static inline int add_to_swap(struct page *page) | 468 | static inline int add_to_swap(struct page *page, struct list_head *list) |
465 | { | 469 | { |
466 | return 0; | 470 | return 0; |
467 | } | 471 | } |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 313a8e0a6553..4147d700a293 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -78,49 +78,34 @@ struct sigaltstack; | |||
78 | #include <linux/key.h> | 78 | #include <linux/key.h> |
79 | #include <trace/syscall.h> | 79 | #include <trace/syscall.h> |
80 | 80 | ||
81 | #define __SC_DECL1(t1, a1) t1 a1 | 81 | /* |
82 | #define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) | 82 | * __MAP - apply a macro to syscall arguments |
83 | #define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__) | 83 | * __MAP(n, m, t1, a1, t2, a2, ..., tn, an) will expand to |
84 | #define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__) | 84 | * m(t1, a1), m(t2, a2), ..., m(tn, an) |
85 | #define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) | 85 | * The first argument must be equal to the amount of type/name |
86 | #define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) | 86 | * pairs given. Note that this list of pairs (i.e. the arguments |
87 | 87 | * of __MAP starting at the third one) is in the same format as | |
88 | #define __SC_LONG1(t1, a1) long a1 | 88 | * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n> |
89 | #define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__) | 89 | */ |
90 | #define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__) | 90 | #define __MAP0(m,...) |
91 | #define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) | 91 | #define __MAP1(m,t,a) m(t,a) |
92 | #define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) | 92 | #define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__) |
93 | #define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) | 93 | #define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__) |
94 | 94 | #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__) | |
95 | #define __SC_CAST1(t1, a1) (t1) a1 | 95 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__) |
96 | #define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) | 96 | #define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__) |
97 | #define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__) | 97 | #define __MAP(n,...) __MAP##n(__VA_ARGS__) |
98 | #define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__) | 98 | |
99 | #define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__) | 99 | #define __SC_DECL(t, a) t a |
100 | #define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__) | 100 | #define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL)) |
101 | 101 | #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a | |
102 | #define __SC_TEST(type) BUILD_BUG_ON(sizeof(type) > sizeof(long)) | 102 | #define __SC_CAST(t, a) (t) a |
103 | #define __SC_TEST1(t1, a1) __SC_TEST(t1) | 103 | #define __SC_ARGS(t, a) a |
104 | #define __SC_TEST2(t2, a2, ...) __SC_TEST(t2); __SC_TEST1(__VA_ARGS__) | 104 | #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long)) |
105 | #define __SC_TEST3(t3, a3, ...) __SC_TEST(t3); __SC_TEST2(__VA_ARGS__) | ||
106 | #define __SC_TEST4(t4, a4, ...) __SC_TEST(t4); __SC_TEST3(__VA_ARGS__) | ||
107 | #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) | ||
108 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) | ||
109 | 105 | ||
110 | #ifdef CONFIG_FTRACE_SYSCALLS | 106 | #ifdef CONFIG_FTRACE_SYSCALLS |
111 | #define __SC_STR_ADECL1(t, a) #a | 107 | #define __SC_STR_ADECL(t, a) #a |
112 | #define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) | 108 | #define __SC_STR_TDECL(t, a) #t |
113 | #define __SC_STR_ADECL3(t, a, ...) #a, __SC_STR_ADECL2(__VA_ARGS__) | ||
114 | #define __SC_STR_ADECL4(t, a, ...) #a, __SC_STR_ADECL3(__VA_ARGS__) | ||
115 | #define __SC_STR_ADECL5(t, a, ...) #a, __SC_STR_ADECL4(__VA_ARGS__) | ||
116 | #define __SC_STR_ADECL6(t, a, ...) #a, __SC_STR_ADECL5(__VA_ARGS__) | ||
117 | |||
118 | #define __SC_STR_TDECL1(t, a) #t | ||
119 | #define __SC_STR_TDECL2(t, a, ...) #t, __SC_STR_TDECL1(__VA_ARGS__) | ||
120 | #define __SC_STR_TDECL3(t, a, ...) #t, __SC_STR_TDECL2(__VA_ARGS__) | ||
121 | #define __SC_STR_TDECL4(t, a, ...) #t, __SC_STR_TDECL3(__VA_ARGS__) | ||
122 | #define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) | ||
123 | #define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) | ||
124 | 109 | ||
125 | extern struct ftrace_event_class event_class_syscall_enter; | 110 | extern struct ftrace_event_class event_class_syscall_enter; |
126 | extern struct ftrace_event_class event_class_syscall_exit; | 111 | extern struct ftrace_event_class event_class_syscall_exit; |
@@ -155,7 +140,13 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
155 | __attribute__((section("_ftrace_events"))) \ | 140 | __attribute__((section("_ftrace_events"))) \ |
156 | *__event_exit_##sname = &event_exit_##sname; | 141 | *__event_exit_##sname = &event_exit_##sname; |
157 | 142 | ||
158 | #define SYSCALL_METADATA(sname, nb) \ | 143 | #define SYSCALL_METADATA(sname, nb, ...) \ |
144 | static const char *types_##sname[] = { \ | ||
145 | __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \ | ||
146 | }; \ | ||
147 | static const char *args_##sname[] = { \ | ||
148 | __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \ | ||
149 | }; \ | ||
159 | SYSCALL_TRACE_ENTER_EVENT(sname); \ | 150 | SYSCALL_TRACE_ENTER_EVENT(sname); \ |
160 | SYSCALL_TRACE_EXIT_EVENT(sname); \ | 151 | SYSCALL_TRACE_EXIT_EVENT(sname); \ |
161 | static struct syscall_metadata __used \ | 152 | static struct syscall_metadata __used \ |
@@ -163,8 +154,8 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
163 | .name = "sys"#sname, \ | 154 | .name = "sys"#sname, \ |
164 | .syscall_nr = -1, /* Filled in at boot */ \ | 155 | .syscall_nr = -1, /* Filled in at boot */ \ |
165 | .nb_args = nb, \ | 156 | .nb_args = nb, \ |
166 | .types = types_##sname, \ | 157 | .types = nb ? types_##sname : NULL, \ |
167 | .args = args_##sname, \ | 158 | .args = nb ? args_##sname : NULL, \ |
168 | .enter_event = &event_enter_##sname, \ | 159 | .enter_event = &event_enter_##sname, \ |
169 | .exit_event = &event_exit_##sname, \ | 160 | .exit_event = &event_exit_##sname, \ |
170 | .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ | 161 | .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ |
@@ -172,26 +163,13 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
172 | static struct syscall_metadata __used \ | 163 | static struct syscall_metadata __used \ |
173 | __attribute__((section("__syscalls_metadata"))) \ | 164 | __attribute__((section("__syscalls_metadata"))) \ |
174 | *__p_syscall_meta_##sname = &__syscall_meta_##sname; | 165 | *__p_syscall_meta_##sname = &__syscall_meta_##sname; |
166 | #else | ||
167 | #define SYSCALL_METADATA(sname, nb, ...) | ||
168 | #endif | ||
175 | 169 | ||
176 | #define SYSCALL_DEFINE0(sname) \ | 170 | #define SYSCALL_DEFINE0(sname) \ |
177 | SYSCALL_TRACE_ENTER_EVENT(_##sname); \ | 171 | SYSCALL_METADATA(_##sname, 0); \ |
178 | SYSCALL_TRACE_EXIT_EVENT(_##sname); \ | ||
179 | static struct syscall_metadata __used \ | ||
180 | __syscall_meta__##sname = { \ | ||
181 | .name = "sys_"#sname, \ | ||
182 | .syscall_nr = -1, /* Filled in at boot */ \ | ||
183 | .nb_args = 0, \ | ||
184 | .enter_event = &event_enter__##sname, \ | ||
185 | .exit_event = &event_exit__##sname, \ | ||
186 | .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ | ||
187 | }; \ | ||
188 | static struct syscall_metadata __used \ | ||
189 | __attribute__((section("__syscalls_metadata"))) \ | ||
190 | *__p_syscall_meta_##sname = &__syscall_meta__##sname; \ | ||
191 | asmlinkage long sys_##sname(void) | 172 | asmlinkage long sys_##sname(void) |
192 | #else | ||
193 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) | ||
194 | #endif | ||
195 | 173 | ||
196 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) | 174 | #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) |
197 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) | 175 | #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) |
@@ -200,57 +178,23 @@ extern struct trace_event_functions exit_syscall_print_funcs; | |||
200 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) | 178 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) |
201 | #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) | 179 | #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) |
202 | 180 | ||
203 | #ifdef CONFIG_PPC64 | ||
204 | #define SYSCALL_ALIAS(alias, name) \ | ||
205 | asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ | ||
206 | "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) | ||
207 | #else | ||
208 | #if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) | ||
209 | #define SYSCALL_ALIAS(alias, name) \ | ||
210 | asm ( #alias " = " #name "\n\t.globl " #alias) | ||
211 | #else | ||
212 | #define SYSCALL_ALIAS(alias, name) \ | ||
213 | asm ("\t.globl " #alias "\n\t.set " #alias ", " #name) | ||
214 | #endif | ||
215 | #endif | ||
216 | |||
217 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
218 | #define SYSCALL_DEFINEx(x, sname, ...) \ | 181 | #define SYSCALL_DEFINEx(x, sname, ...) \ |
219 | static const char *types_##sname[] = { \ | 182 | SYSCALL_METADATA(sname, x, __VA_ARGS__) \ |
220 | __SC_STR_TDECL##x(__VA_ARGS__) \ | ||
221 | }; \ | ||
222 | static const char *args_##sname[] = { \ | ||
223 | __SC_STR_ADECL##x(__VA_ARGS__) \ | ||
224 | }; \ | ||
225 | SYSCALL_METADATA(sname, x); \ | ||
226 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) | 183 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) |
227 | #else | ||
228 | #define SYSCALL_DEFINEx(x, sname, ...) \ | ||
229 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) | ||
230 | #endif | ||
231 | |||
232 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
233 | |||
234 | #define SYSCALL_DEFINE(name) static inline long SYSC_##name | ||
235 | 184 | ||
185 | #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) | ||
236 | #define __SYSCALL_DEFINEx(x, name, ...) \ | 186 | #define __SYSCALL_DEFINEx(x, name, ...) \ |
237 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ | 187 | asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ |
238 | static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ | 188 | static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ |
239 | asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ | 189 | asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ |
240 | { \ | 190 | { \ |
241 | __SC_TEST##x(__VA_ARGS__); \ | 191 | long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ |
242 | return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__)); \ | 192 | __MAP(x,__SC_TEST,__VA_ARGS__); \ |
193 | __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ | ||
194 | return ret; \ | ||
243 | } \ | 195 | } \ |
244 | SYSCALL_ALIAS(sys##name, SyS##name); \ | 196 | SYSCALL_ALIAS(sys##name, SyS##name); \ |
245 | static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)) | 197 | static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) |
246 | |||
247 | #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
248 | |||
249 | #define SYSCALL_DEFINE(name) asmlinkage long sys_##name | ||
250 | #define __SYSCALL_DEFINEx(x, name, ...) \ | ||
251 | asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)) | ||
252 | |||
253 | #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ | ||
254 | 198 | ||
255 | asmlinkage long sys_time(time_t __user *tloc); | 199 | asmlinkage long sys_time(time_t __user *tloc); |
256 | asmlinkage long sys_stime(time_t __user *tptr); | 200 | asmlinkage long sys_stime(time_t __user *tptr); |
@@ -694,7 +638,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf); | |||
694 | asmlinkage long sys_semget(key_t key, int nsems, int semflg); | 638 | asmlinkage long sys_semget(key_t key, int nsems, int semflg); |
695 | asmlinkage long sys_semop(int semid, struct sembuf __user *sops, | 639 | asmlinkage long sys_semop(int semid, struct sembuf __user *sops, |
696 | unsigned nsops); | 640 | unsigned nsops); |
697 | asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg); | 641 | asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg); |
698 | asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, | 642 | asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops, |
699 | unsigned nsops, | 643 | unsigned nsops, |
700 | const struct timespec __user *timeout); | 644 | const struct timespec __user *timeout); |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index f28408c07dc2..5adbc33d1ab3 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -90,9 +90,6 @@ struct tcp_options_received { | |||
90 | sack_ok : 4, /* SACK seen on SYN packet */ | 90 | sack_ok : 4, /* SACK seen on SYN packet */ |
91 | snd_wscale : 4, /* Window scaling received from sender */ | 91 | snd_wscale : 4, /* Window scaling received from sender */ |
92 | rcv_wscale : 4; /* Window scaling to send to receiver */ | 92 | rcv_wscale : 4; /* Window scaling to send to receiver */ |
93 | u8 cookie_plus:6, /* bytes in authenticator/cookie option */ | ||
94 | cookie_out_never:1, | ||
95 | cookie_in_always:1; | ||
96 | u8 num_sacks; /* Number of SACK blocks */ | 93 | u8 num_sacks; /* Number of SACK blocks */ |
97 | u16 user_mss; /* mss requested by user in ioctl */ | 94 | u16 user_mss; /* mss requested by user in ioctl */ |
98 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ | 95 | u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ |
@@ -102,7 +99,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt) | |||
102 | { | 99 | { |
103 | rx_opt->tstamp_ok = rx_opt->sack_ok = 0; | 100 | rx_opt->tstamp_ok = rx_opt->sack_ok = 0; |
104 | rx_opt->wscale_ok = rx_opt->snd_wscale = 0; | 101 | rx_opt->wscale_ok = rx_opt->snd_wscale = 0; |
105 | rx_opt->cookie_plus = 0; | ||
106 | } | 102 | } |
107 | 103 | ||
108 | /* This is the max number of SACKS that we'll generate and process. It's safe | 104 | /* This is the max number of SACKS that we'll generate and process. It's safe |
@@ -191,20 +187,19 @@ struct tcp_sock { | |||
191 | u32 window_clamp; /* Maximal window to advertise */ | 187 | u32 window_clamp; /* Maximal window to advertise */ |
192 | u32 rcv_ssthresh; /* Current window clamp */ | 188 | u32 rcv_ssthresh; /* Current window clamp */ |
193 | 189 | ||
194 | u32 frto_highmark; /* snd_nxt when RTO occurred */ | ||
195 | u16 advmss; /* Advertised MSS */ | 190 | u16 advmss; /* Advertised MSS */ |
196 | u8 frto_counter; /* Number of new acks after RTO */ | 191 | u8 unused; |
197 | u8 nonagle : 4,/* Disable Nagle algorithm? */ | 192 | u8 nonagle : 4,/* Disable Nagle algorithm? */ |
198 | thin_lto : 1,/* Use linear timeouts for thin streams */ | 193 | thin_lto : 1,/* Use linear timeouts for thin streams */ |
199 | thin_dupack : 1,/* Fast retransmit on first dupack */ | 194 | thin_dupack : 1,/* Fast retransmit on first dupack */ |
200 | repair : 1, | 195 | repair : 1, |
201 | unused : 1; | 196 | frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */ |
202 | u8 repair_queue; | 197 | u8 repair_queue; |
203 | u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ | 198 | u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ |
204 | early_retrans_delayed:1, /* Delayed ER timer installed */ | ||
205 | syn_data:1, /* SYN includes data */ | 199 | syn_data:1, /* SYN includes data */ |
206 | syn_fastopen:1, /* SYN includes Fast Open option */ | 200 | syn_fastopen:1, /* SYN includes Fast Open option */ |
207 | syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ | 201 | syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ |
202 | u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ | ||
208 | 203 | ||
209 | /* RTT measurement */ | 204 | /* RTT measurement */ |
210 | u32 srtt; /* smoothed round trip time << 3 */ | 205 | u32 srtt; /* smoothed round trip time << 3 */ |
@@ -320,12 +315,6 @@ struct tcp_sock { | |||
320 | struct tcp_md5sig_info __rcu *md5sig_info; | 315 | struct tcp_md5sig_info __rcu *md5sig_info; |
321 | #endif | 316 | #endif |
322 | 317 | ||
323 | /* When the cookie options are generated and exchanged, then this | ||
324 | * object holds a reference to them (cookie_values->kref). Also | ||
325 | * contains related tcp_cookie_transactions fields. | ||
326 | */ | ||
327 | struct tcp_cookie_values *cookie_values; | ||
328 | |||
329 | /* TCP fastopen related information */ | 318 | /* TCP fastopen related information */ |
330 | struct tcp_fastopen_request *fastopen_req; | 319 | struct tcp_fastopen_request *fastopen_req; |
331 | /* fastopen_rsk points to request_sock that resulted in this big | 320 | /* fastopen_rsk points to request_sock that resulted in this big |
@@ -361,10 +350,6 @@ struct tcp_timewait_sock { | |||
361 | #ifdef CONFIG_TCP_MD5SIG | 350 | #ifdef CONFIG_TCP_MD5SIG |
362 | struct tcp_md5sig_key *tw_md5_key; | 351 | struct tcp_md5sig_key *tw_md5_key; |
363 | #endif | 352 | #endif |
364 | /* Few sockets in timewait have cookies; in that case, then this | ||
365 | * object holds a reference to them (tw_cookie_values->kref). | ||
366 | */ | ||
367 | struct tcp_cookie_values *tw_cookie_values; | ||
368 | }; | 353 | }; |
369 | 354 | ||
370 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) | 355 | static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) |
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h new file mode 100644 index 000000000000..55c29a8d5015 --- /dev/null +++ b/include/linux/tegra-powergate.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010 Google, Inc | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@google.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef _MACH_TEGRA_POWERGATE_H_ | ||
19 | #define _MACH_TEGRA_POWERGATE_H_ | ||
20 | |||
21 | struct clk; | ||
22 | |||
23 | #define TEGRA_POWERGATE_CPU 0 | ||
24 | #define TEGRA_POWERGATE_3D 1 | ||
25 | #define TEGRA_POWERGATE_VENC 2 | ||
26 | #define TEGRA_POWERGATE_PCIE 3 | ||
27 | #define TEGRA_POWERGATE_VDEC 4 | ||
28 | #define TEGRA_POWERGATE_L2 5 | ||
29 | #define TEGRA_POWERGATE_MPE 6 | ||
30 | #define TEGRA_POWERGATE_HEG 7 | ||
31 | #define TEGRA_POWERGATE_SATA 8 | ||
32 | #define TEGRA_POWERGATE_CPU1 9 | ||
33 | #define TEGRA_POWERGATE_CPU2 10 | ||
34 | #define TEGRA_POWERGATE_CPU3 11 | ||
35 | #define TEGRA_POWERGATE_CELP 12 | ||
36 | #define TEGRA_POWERGATE_3D1 13 | ||
37 | |||
38 | #define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU | ||
39 | #define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D | ||
40 | |||
41 | int tegra_powergate_is_powered(int id); | ||
42 | int tegra_powergate_power_on(int id); | ||
43 | int tegra_powergate_power_off(int id); | ||
44 | int tegra_powergate_remove_clamping(int id); | ||
45 | |||
46 | /* Must be called with clk disabled, and returns with clk enabled */ | ||
47 | int tegra_powergate_sequence_power_up(int id, struct clk *clk); | ||
48 | |||
49 | #endif /* _MACH_TEGRA_POWERGATE_H_ */ | ||
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index e3c0ae9bb1fa..a386a1cbb6e1 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -33,8 +33,11 @@ | |||
33 | #define THERMAL_MAX_TRIPS 12 | 33 | #define THERMAL_MAX_TRIPS 12 |
34 | #define THERMAL_NAME_LENGTH 20 | 34 | #define THERMAL_NAME_LENGTH 20 |
35 | 35 | ||
36 | /* invalid cooling state */ | ||
37 | #define THERMAL_CSTATE_INVALID -1UL | ||
38 | |||
36 | /* No upper/lower limit requirement */ | 39 | /* No upper/lower limit requirement */ |
37 | #define THERMAL_NO_LIMIT -1UL | 40 | #define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID |
38 | 41 | ||
39 | /* Unit conversion macros */ | 42 | /* Unit conversion macros */ |
40 | #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ | 43 | #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ |
@@ -184,7 +187,6 @@ struct thermal_governor { | |||
184 | char name[THERMAL_NAME_LENGTH]; | 187 | char name[THERMAL_NAME_LENGTH]; |
185 | int (*throttle)(struct thermal_zone_device *tz, int trip); | 188 | int (*throttle)(struct thermal_zone_device *tz, int trip); |
186 | struct list_head governor_list; | 189 | struct list_head governor_list; |
187 | struct module *owner; | ||
188 | }; | 190 | }; |
189 | 191 | ||
190 | /* Structure that holds binding parameters for a zone */ | 192 | /* Structure that holds binding parameters for a zone */ |
@@ -237,21 +239,20 @@ void thermal_zone_device_update(struct thermal_zone_device *); | |||
237 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 239 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
238 | const struct thermal_cooling_device_ops *); | 240 | const struct thermal_cooling_device_ops *); |
239 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 241 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
242 | struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); | ||
243 | int thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned long *temp); | ||
240 | 244 | ||
241 | int get_tz_trend(struct thermal_zone_device *, int); | 245 | int get_tz_trend(struct thermal_zone_device *, int); |
242 | struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, | 246 | struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, |
243 | struct thermal_cooling_device *, int); | 247 | struct thermal_cooling_device *, int); |
244 | void thermal_cdev_update(struct thermal_cooling_device *); | 248 | void thermal_cdev_update(struct thermal_cooling_device *); |
245 | void notify_thermal_framework(struct thermal_zone_device *, int); | 249 | void thermal_notify_framework(struct thermal_zone_device *, int); |
246 | |||
247 | int thermal_register_governor(struct thermal_governor *); | ||
248 | void thermal_unregister_governor(struct thermal_governor *); | ||
249 | 250 | ||
250 | #ifdef CONFIG_NET | 251 | #ifdef CONFIG_NET |
251 | extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, | 252 | extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, |
252 | enum events event); | 253 | enum events event); |
253 | #else | 254 | #else |
254 | static int thermal_generate_netlink_event(struct thermal_zone_device *tz, | 255 | static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz, |
255 | enum events event) | 256 | enum events event) |
256 | { | 257 | { |
257 | return 0; | 258 | return 0; |
diff --git a/include/linux/tick.h b/include/linux/tick.h index 553272e6af55..9180f4b85e6d 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -82,7 +82,7 @@ extern int tick_program_event(ktime_t expires, int force); | |||
82 | extern void tick_setup_sched_timer(void); | 82 | extern void tick_setup_sched_timer(void); |
83 | # endif | 83 | # endif |
84 | 84 | ||
85 | # if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS | 85 | # if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS |
86 | extern void tick_cancel_sched_timer(int cpu); | 86 | extern void tick_cancel_sched_timer(int cpu); |
87 | # else | 87 | # else |
88 | static inline void tick_cancel_sched_timer(int cpu) { } | 88 | static inline void tick_cancel_sched_timer(int cpu) { } |
@@ -123,7 +123,7 @@ static inline void tick_check_idle(int cpu) { } | |||
123 | static inline int tick_oneshot_mode_active(void) { return 0; } | 123 | static inline int tick_oneshot_mode_active(void) { return 0; } |
124 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ | 124 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ |
125 | 125 | ||
126 | # ifdef CONFIG_NO_HZ | 126 | # ifdef CONFIG_NO_HZ_COMMON |
127 | DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched); | 127 | DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched); |
128 | 128 | ||
129 | static inline int tick_nohz_tick_stopped(void) | 129 | static inline int tick_nohz_tick_stopped(void) |
@@ -138,7 +138,7 @@ extern ktime_t tick_nohz_get_sleep_length(void); | |||
138 | extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); | 138 | extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); |
139 | extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); | 139 | extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); |
140 | 140 | ||
141 | # else /* !CONFIG_NO_HZ */ | 141 | # else /* !CONFIG_NO_HZ_COMMON */ |
142 | static inline int tick_nohz_tick_stopped(void) | 142 | static inline int tick_nohz_tick_stopped(void) |
143 | { | 143 | { |
144 | return 0; | 144 | return 0; |
@@ -155,7 +155,24 @@ static inline ktime_t tick_nohz_get_sleep_length(void) | |||
155 | } | 155 | } |
156 | static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } | 156 | static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } |
157 | static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } | 157 | static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } |
158 | # endif /* !NO_HZ */ | 158 | # endif /* !CONFIG_NO_HZ_COMMON */ |
159 | |||
160 | #ifdef CONFIG_NO_HZ_FULL | ||
161 | extern void tick_nohz_init(void); | ||
162 | extern int tick_nohz_full_cpu(int cpu); | ||
163 | extern void tick_nohz_full_check(void); | ||
164 | extern void tick_nohz_full_kick(void); | ||
165 | extern void tick_nohz_full_kick_all(void); | ||
166 | extern void tick_nohz_task_switch(struct task_struct *tsk); | ||
167 | #else | ||
168 | static inline void tick_nohz_init(void) { } | ||
169 | static inline int tick_nohz_full_cpu(int cpu) { return 0; } | ||
170 | static inline void tick_nohz_full_check(void) { } | ||
171 | static inline void tick_nohz_full_kick(void) { } | ||
172 | static inline void tick_nohz_full_kick_all(void) { } | ||
173 | static inline void tick_nohz_task_switch(struct task_struct *tsk) { } | ||
174 | #endif | ||
175 | |||
159 | 176 | ||
160 | # ifdef CONFIG_CPU_IDLE_GOV_MENU | 177 | # ifdef CONFIG_CPU_IDLE_GOV_MENU |
161 | extern void menu_hrtimer_cancel(void); | 178 | extern void menu_hrtimer_cancel(void); |
diff --git a/include/linux/time.h b/include/linux/time.h index d4835dfdf25e..22d81b3c955b 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -181,6 +181,9 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | |||
181 | extern int timekeeping_valid_for_hres(void); | 181 | extern int timekeeping_valid_for_hres(void); |
182 | extern u64 timekeeping_max_deferment(void); | 182 | extern u64 timekeeping_max_deferment(void); |
183 | extern int timekeeping_inject_offset(struct timespec *ts); | 183 | extern int timekeeping_inject_offset(struct timespec *ts); |
184 | extern s32 timekeeping_get_tai_offset(void); | ||
185 | extern void timekeeping_set_tai_offset(s32 tai_offset); | ||
186 | extern void timekeeping_clocktai(struct timespec *ts); | ||
184 | 187 | ||
185 | struct tms; | 188 | struct tms; |
186 | extern void do_sys_times(struct tms *); | 189 | extern void do_sys_times(struct tms *); |
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index e1d558e237ec..c1825eb436ed 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h | |||
@@ -20,6 +20,8 @@ struct timekeeper { | |||
20 | u32 shift; | 20 | u32 shift; |
21 | /* Number of clock cycles in one NTP interval. */ | 21 | /* Number of clock cycles in one NTP interval. */ |
22 | cycle_t cycle_interval; | 22 | cycle_t cycle_interval; |
23 | /* Last cycle value (also stored in clock->cycle_last) */ | ||
24 | cycle_t cycle_last; | ||
23 | /* Number of clock shifted nano seconds in one NTP interval. */ | 25 | /* Number of clock shifted nano seconds in one NTP interval. */ |
24 | u64 xtime_interval; | 26 | u64 xtime_interval; |
25 | /* shifted nano seconds left over when rounding cycle_interval */ | 27 | /* shifted nano seconds left over when rounding cycle_interval */ |
@@ -62,8 +64,11 @@ struct timekeeper { | |||
62 | ktime_t offs_boot; | 64 | ktime_t offs_boot; |
63 | /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ | 65 | /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ |
64 | struct timespec raw_time; | 66 | struct timespec raw_time; |
65 | /* Seqlock for all timekeeper values */ | 67 | /* The current UTC to TAI offset in seconds */ |
66 | seqlock_t lock; | 68 | s32 tai_offset; |
69 | /* Offset clock monotonic -> clock tai */ | ||
70 | ktime_t offs_tai; | ||
71 | |||
67 | }; | 72 | }; |
68 | 73 | ||
69 | static inline struct timespec tk_xtime(struct timekeeper *tk) | 74 | static inline struct timespec tk_xtime(struct timekeeper *tk) |
diff --git a/include/linux/timeriomem-rng.h b/include/linux/timeriomem-rng.h index 3e08a1c86830..46eb27ddbfab 100644 --- a/include/linux/timeriomem-rng.h +++ b/include/linux/timeriomem-rng.h | |||
@@ -8,12 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/completion.h> | ||
12 | |||
13 | struct timeriomem_rng_data { | 11 | struct timeriomem_rng_data { |
14 | struct completion completion; | ||
15 | unsigned int present:1; | ||
16 | |||
17 | void __iomem *address; | 12 | void __iomem *address; |
18 | 13 | ||
19 | /* measures in usecs */ | 14 | /* measures in usecs */ |
diff --git a/include/linux/timex.h b/include/linux/timex.h index 5ec87c60b97c..b3726e61368e 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -125,9 +125,6 @@ | |||
125 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ | 125 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ |
126 | extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ | 126 | extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ |
127 | 127 | ||
128 | extern void ntp_init(void); | ||
129 | extern void ntp_clear(void); | ||
130 | |||
131 | /* Required to safely shift negative values */ | 128 | /* Required to safely shift negative values */ |
132 | #define shift_right(x, s) ({ \ | 129 | #define shift_right(x, s) ({ \ |
133 | __typeof__(x) __x = (x); \ | 130 | __typeof__(x) __x = (x); \ |
@@ -140,10 +137,6 @@ extern void ntp_clear(void); | |||
140 | #define NTP_INTERVAL_FREQ (HZ) | 137 | #define NTP_INTERVAL_FREQ (HZ) |
141 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 138 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
142 | 139 | ||
143 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | ||
144 | extern u64 ntp_tick_length(void); | ||
145 | |||
146 | extern int second_overflow(unsigned long secs); | ||
147 | extern int do_adjtimex(struct timex *); | 140 | extern int do_adjtimex(struct timex *); |
148 | extern void hardpps(const struct timespec *, const struct timespec *); | 141 | extern void hardpps(const struct timespec *, const struct timespec *); |
149 | 142 | ||
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h index d563f37e1a1d..1d7ca2739272 100644 --- a/include/linux/trace_clock.h +++ b/include/linux/trace_clock.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | extern u64 notrace trace_clock_local(void); | 17 | extern u64 notrace trace_clock_local(void); |
18 | extern u64 notrace trace_clock(void); | 18 | extern u64 notrace trace_clock(void); |
19 | extern u64 notrace trace_clock_jiffies(void); | ||
19 | extern u64 notrace trace_clock_global(void); | 20 | extern u64 notrace trace_clock_global(void); |
20 | extern u64 notrace trace_clock_counter(void); | 21 | extern u64 notrace trace_clock_counter(void); |
21 | 22 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index c75d886b0307..8780bd2a272a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -255,9 +255,9 @@ struct tty_struct { | |||
255 | int count; | 255 | int count; |
256 | struct winsize winsize; /* termios mutex */ | 256 | struct winsize winsize; /* termios mutex */ |
257 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; | 257 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; |
258 | unsigned char warned:1; | ||
259 | unsigned char ctrl_status; /* ctrl_lock */ | 258 | unsigned char ctrl_status; /* ctrl_lock */ |
260 | unsigned int receive_room; /* Bytes free for queue */ | 259 | unsigned int receive_room; /* Bytes free for queue */ |
260 | int flow_change; | ||
261 | 261 | ||
262 | struct tty_struct *link; | 262 | struct tty_struct *link; |
263 | struct fasync_struct *fasync; | 263 | struct fasync_struct *fasync; |
@@ -315,9 +315,25 @@ struct tty_file_private { | |||
315 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ | 315 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
316 | #define TTY_HUPPED 18 /* Post driver->hangup() */ | 316 | #define TTY_HUPPED 18 /* Post driver->hangup() */ |
317 | #define TTY_HUPPING 21 /* ->hangup() in progress */ | 317 | #define TTY_HUPPING 21 /* ->hangup() in progress */ |
318 | #define TTY_LDISC_HALTED 22 /* Line discipline is halted */ | ||
318 | 319 | ||
319 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) | 320 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |
320 | 321 | ||
322 | /* Values for tty->flow_change */ | ||
323 | #define TTY_THROTTLE_SAFE 1 | ||
324 | #define TTY_UNTHROTTLE_SAFE 2 | ||
325 | |||
326 | static inline void __tty_set_flow_change(struct tty_struct *tty, int val) | ||
327 | { | ||
328 | tty->flow_change = val; | ||
329 | } | ||
330 | |||
331 | static inline void tty_set_flow_change(struct tty_struct *tty, int val) | ||
332 | { | ||
333 | tty->flow_change = val; | ||
334 | smp_mb(); | ||
335 | } | ||
336 | |||
321 | #ifdef CONFIG_TTY | 337 | #ifdef CONFIG_TTY |
322 | extern void console_init(void); | 338 | extern void console_init(void); |
323 | extern void tty_kref_put(struct tty_struct *tty); | 339 | extern void tty_kref_put(struct tty_struct *tty); |
@@ -400,6 +416,8 @@ extern int tty_write_room(struct tty_struct *tty); | |||
400 | extern void tty_driver_flush_buffer(struct tty_struct *tty); | 416 | extern void tty_driver_flush_buffer(struct tty_struct *tty); |
401 | extern void tty_throttle(struct tty_struct *tty); | 417 | extern void tty_throttle(struct tty_struct *tty); |
402 | extern void tty_unthrottle(struct tty_struct *tty); | 418 | extern void tty_unthrottle(struct tty_struct *tty); |
419 | extern int tty_throttle_safe(struct tty_struct *tty); | ||
420 | extern int tty_unthrottle_safe(struct tty_struct *tty); | ||
403 | extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); | 421 | extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); |
404 | extern void tty_driver_remove_tty(struct tty_driver *driver, | 422 | extern void tty_driver_remove_tty(struct tty_driver *driver, |
405 | struct tty_struct *tty); | 423 | struct tty_struct *tty); |
@@ -419,13 +437,28 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty); | |||
419 | extern void tty_buffer_free_all(struct tty_port *port); | 437 | extern void tty_buffer_free_all(struct tty_port *port); |
420 | extern void tty_buffer_flush(struct tty_struct *tty); | 438 | extern void tty_buffer_flush(struct tty_struct *tty); |
421 | extern void tty_buffer_init(struct tty_port *port); | 439 | extern void tty_buffer_init(struct tty_port *port); |
422 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); | ||
423 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 440 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
424 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 441 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
425 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, | 442 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, |
426 | speed_t ibaud, speed_t obaud); | 443 | speed_t ibaud, speed_t obaud); |
427 | extern void tty_encode_baud_rate(struct tty_struct *tty, | 444 | extern void tty_encode_baud_rate(struct tty_struct *tty, |
428 | speed_t ibaud, speed_t obaud); | 445 | speed_t ibaud, speed_t obaud); |
446 | |||
447 | /** | ||
448 | * tty_get_baud_rate - get tty bit rates | ||
449 | * @tty: tty to query | ||
450 | * | ||
451 | * Returns the baud rate as an integer for this terminal. The | ||
452 | * termios lock must be held by the caller and the terminal bit | ||
453 | * flags may be updated. | ||
454 | * | ||
455 | * Locking: none | ||
456 | */ | ||
457 | static inline speed_t tty_get_baud_rate(struct tty_struct *tty) | ||
458 | { | ||
459 | return tty_termios_baud_rate(&tty->termios); | ||
460 | } | ||
461 | |||
429 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); | 462 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); |
430 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); | 463 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); |
431 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); | 464 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); |
@@ -502,6 +535,8 @@ extern int tty_port_carrier_raised(struct tty_port *port); | |||
502 | extern void tty_port_raise_dtr_rts(struct tty_port *port); | 535 | extern void tty_port_raise_dtr_rts(struct tty_port *port); |
503 | extern void tty_port_lower_dtr_rts(struct tty_port *port); | 536 | extern void tty_port_lower_dtr_rts(struct tty_port *port); |
504 | extern void tty_port_hangup(struct tty_port *port); | 537 | extern void tty_port_hangup(struct tty_port *port); |
538 | extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal); | ||
539 | extern void tty_port_tty_wakeup(struct tty_port *port); | ||
505 | extern int tty_port_block_til_ready(struct tty_port *port, | 540 | extern int tty_port_block_til_ready(struct tty_port *port, |
506 | struct tty_struct *tty, struct file *filp); | 541 | struct tty_struct *tty, struct file *filp); |
507 | extern int tty_port_close_start(struct tty_port *port, | 542 | extern int tty_port_close_start(struct tty_port *port, |
@@ -526,8 +561,6 @@ extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty); | |||
526 | extern void tty_ldisc_init(struct tty_struct *tty); | 561 | extern void tty_ldisc_init(struct tty_struct *tty); |
527 | extern void tty_ldisc_deinit(struct tty_struct *tty); | 562 | extern void tty_ldisc_deinit(struct tty_struct *tty); |
528 | extern void tty_ldisc_begin(void); | 563 | extern void tty_ldisc_begin(void); |
529 | /* This last one is just for the tty layer internals and shouldn't be used elsewhere */ | ||
530 | extern void tty_ldisc_enable(struct tty_struct *tty); | ||
531 | 564 | ||
532 | 565 | ||
533 | /* n_tty.c */ | 566 | /* n_tty.c */ |
@@ -542,8 +575,7 @@ extern void tty_audit_exit(void); | |||
542 | extern void tty_audit_fork(struct signal_struct *sig); | 575 | extern void tty_audit_fork(struct signal_struct *sig); |
543 | extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); | 576 | extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); |
544 | extern void tty_audit_push(struct tty_struct *tty); | 577 | extern void tty_audit_push(struct tty_struct *tty); |
545 | extern int tty_audit_push_task(struct task_struct *tsk, | 578 | extern int tty_audit_push_current(void); |
546 | kuid_t loginuid, u32 sessionid); | ||
547 | #else | 579 | #else |
548 | static inline void tty_audit_add_data(struct tty_struct *tty, | 580 | static inline void tty_audit_add_data(struct tty_struct *tty, |
549 | unsigned char *data, size_t size, unsigned icanon) | 581 | unsigned char *data, size_t size, unsigned icanon) |
@@ -561,8 +593,7 @@ static inline void tty_audit_fork(struct signal_struct *sig) | |||
561 | static inline void tty_audit_push(struct tty_struct *tty) | 593 | static inline void tty_audit_push(struct tty_struct *tty) |
562 | { | 594 | { |
563 | } | 595 | } |
564 | static inline int tty_audit_push_task(struct task_struct *tsk, | 596 | static inline int tty_audit_push_current(void) |
565 | kuid_t loginuid, u32 sessionid) | ||
566 | { | 597 | { |
567 | return 0; | 598 | return 0; |
568 | } | 599 | } |
@@ -658,5 +689,12 @@ do { \ | |||
658 | finish_wait(&wq, &__wait); \ | 689 | finish_wait(&wq, &__wait); \ |
659 | } while (0) | 690 | } while (0) |
660 | 691 | ||
692 | #ifdef CONFIG_PROC_FS | ||
693 | extern void proc_tty_register_driver(struct tty_driver *); | ||
694 | extern void proc_tty_unregister_driver(struct tty_driver *); | ||
695 | #else | ||
696 | static inline void proc_tty_register_driver(struct tty_driver *d) {} | ||
697 | static inline void proc_tty_unregister_driver(struct tty_driver *d) {} | ||
698 | #endif | ||
661 | 699 | ||
662 | #endif | 700 | #endif |
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 455a0d7bf220..58390c73df8b 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h | |||
@@ -9,89 +9,89 @@ | |||
9 | * | 9 | * |
10 | * int (*open)(struct tty_struct *); | 10 | * int (*open)(struct tty_struct *); |
11 | * | 11 | * |
12 | * This function is called when the line discipline is associated | 12 | * This function is called when the line discipline is associated |
13 | * with the tty. The line discipline can use this as an | 13 | * with the tty. The line discipline can use this as an |
14 | * opportunity to initialize any state needed by the ldisc routines. | 14 | * opportunity to initialize any state needed by the ldisc routines. |
15 | * | 15 | * |
16 | * void (*close)(struct tty_struct *); | 16 | * void (*close)(struct tty_struct *); |
17 | * | 17 | * |
18 | * This function is called when the line discipline is being | 18 | * This function is called when the line discipline is being |
19 | * shutdown, either because the tty is being closed or because | 19 | * shutdown, either because the tty is being closed or because |
20 | * the tty is being changed to use a new line discipline | 20 | * the tty is being changed to use a new line discipline |
21 | * | 21 | * |
22 | * void (*flush_buffer)(struct tty_struct *tty); | 22 | * void (*flush_buffer)(struct tty_struct *tty); |
23 | * | 23 | * |
24 | * This function instructs the line discipline to clear its | 24 | * This function instructs the line discipline to clear its |
25 | * buffers of any input characters it may have queued to be | 25 | * buffers of any input characters it may have queued to be |
26 | * delivered to the user mode process. | 26 | * delivered to the user mode process. |
27 | * | 27 | * |
28 | * ssize_t (*chars_in_buffer)(struct tty_struct *tty); | 28 | * ssize_t (*chars_in_buffer)(struct tty_struct *tty); |
29 | * | 29 | * |
30 | * This function returns the number of input characters the line | 30 | * This function returns the number of input characters the line |
31 | * discipline may have queued up to be delivered to the user mode | 31 | * discipline may have queued up to be delivered to the user mode |
32 | * process. | 32 | * process. |
33 | * | 33 | * |
34 | * ssize_t (*read)(struct tty_struct * tty, struct file * file, | 34 | * ssize_t (*read)(struct tty_struct * tty, struct file * file, |
35 | * unsigned char * buf, size_t nr); | 35 | * unsigned char * buf, size_t nr); |
36 | * | 36 | * |
37 | * This function is called when the user requests to read from | 37 | * This function is called when the user requests to read from |
38 | * the tty. The line discipline will return whatever characters | 38 | * the tty. The line discipline will return whatever characters |
39 | * it has buffered up for the user. If this function is not | 39 | * it has buffered up for the user. If this function is not |
40 | * defined, the user will receive an EIO error. | 40 | * defined, the user will receive an EIO error. |
41 | * | 41 | * |
42 | * ssize_t (*write)(struct tty_struct * tty, struct file * file, | 42 | * ssize_t (*write)(struct tty_struct * tty, struct file * file, |
43 | * const unsigned char * buf, size_t nr); | 43 | * const unsigned char * buf, size_t nr); |
44 | * | 44 | * |
45 | * This function is called when the user requests to write to the | 45 | * This function is called when the user requests to write to the |
46 | * tty. The line discipline will deliver the characters to the | 46 | * tty. The line discipline will deliver the characters to the |
47 | * low-level tty device for transmission, optionally performing | 47 | * low-level tty device for transmission, optionally performing |
48 | * some processing on the characters first. If this function is | 48 | * some processing on the characters first. If this function is |
49 | * not defined, the user will receive an EIO error. | 49 | * not defined, the user will receive an EIO error. |
50 | * | 50 | * |
51 | * int (*ioctl)(struct tty_struct * tty, struct file * file, | 51 | * int (*ioctl)(struct tty_struct * tty, struct file * file, |
52 | * unsigned int cmd, unsigned long arg); | 52 | * unsigned int cmd, unsigned long arg); |
53 | * | 53 | * |
54 | * This function is called when the user requests an ioctl which | 54 | * This function is called when the user requests an ioctl which |
55 | * is not handled by the tty layer or the low-level tty driver. | 55 | * is not handled by the tty layer or the low-level tty driver. |
56 | * It is intended for ioctls which affect line discpline | 56 | * It is intended for ioctls which affect line discpline |
57 | * operation. Note that the search order for ioctls is (1) tty | 57 | * operation. Note that the search order for ioctls is (1) tty |
58 | * layer, (2) tty low-level driver, (3) line discpline. So a | 58 | * layer, (2) tty low-level driver, (3) line discpline. So a |
59 | * low-level driver can "grab" an ioctl request before the line | 59 | * low-level driver can "grab" an ioctl request before the line |
60 | * discpline has a chance to see it. | 60 | * discpline has a chance to see it. |
61 | * | 61 | * |
62 | * long (*compat_ioctl)(struct tty_struct * tty, struct file * file, | 62 | * long (*compat_ioctl)(struct tty_struct * tty, struct file * file, |
63 | * unsigned int cmd, unsigned long arg); | 63 | * unsigned int cmd, unsigned long arg); |
64 | * | 64 | * |
65 | * Process ioctl calls from 32-bit process on 64-bit system | 65 | * Process ioctl calls from 32-bit process on 64-bit system |
66 | * | 66 | * |
67 | * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); | 67 | * void (*set_termios)(struct tty_struct *tty, struct ktermios * old); |
68 | * | 68 | * |
69 | * This function notifies the line discpline that a change has | 69 | * This function notifies the line discpline that a change has |
70 | * been made to the termios structure. | 70 | * been made to the termios structure. |
71 | * | 71 | * |
72 | * int (*poll)(struct tty_struct * tty, struct file * file, | 72 | * int (*poll)(struct tty_struct * tty, struct file * file, |
73 | * poll_table *wait); | 73 | * poll_table *wait); |
74 | * | 74 | * |
75 | * This function is called when a user attempts to select/poll on a | 75 | * This function is called when a user attempts to select/poll on a |
76 | * tty device. It is solely the responsibility of the line | 76 | * tty device. It is solely the responsibility of the line |
77 | * discipline to handle poll requests. | 77 | * discipline to handle poll requests. |
78 | * | 78 | * |
79 | * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, | 79 | * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, |
80 | * char *fp, int count); | 80 | * char *fp, int count); |
81 | * | 81 | * |
82 | * This function is called by the low-level tty driver to send | 82 | * This function is called by the low-level tty driver to send |
83 | * characters received by the hardware to the line discpline for | 83 | * characters received by the hardware to the line discpline for |
84 | * processing. <cp> is a pointer to the buffer of input | 84 | * processing. <cp> is a pointer to the buffer of input |
85 | * character received by the device. <fp> is a pointer to a | 85 | * character received by the device. <fp> is a pointer to a |
86 | * pointer of flag bytes which indicate whether a character was | 86 | * pointer of flag bytes which indicate whether a character was |
87 | * received with a parity error, etc. | 87 | * received with a parity error, etc. |
88 | * | 88 | * |
89 | * void (*write_wakeup)(struct tty_struct *); | 89 | * void (*write_wakeup)(struct tty_struct *); |
90 | * | 90 | * |
91 | * This function is called by the low-level tty driver to signal | 91 | * This function is called by the low-level tty driver to signal |
92 | * that line discpline should try to send more characters to the | 92 | * that line discpline should try to send more characters to the |
93 | * low-level driver for transmission. If the line discpline does | 93 | * low-level driver for transmission. If the line discpline does |
94 | * not have any more data to send, it can just return. | 94 | * not have any more data to send, it can just return. |
95 | * | 95 | * |
96 | * int (*hangup)(struct tty_struct *) | 96 | * int (*hangup)(struct tty_struct *) |
97 | * | 97 | * |
@@ -115,7 +115,7 @@ struct tty_ldisc_ops { | |||
115 | char *name; | 115 | char *name; |
116 | int num; | 116 | int num; |
117 | int flags; | 117 | int flags; |
118 | 118 | ||
119 | /* | 119 | /* |
120 | * The following routines are called from above. | 120 | * The following routines are called from above. |
121 | */ | 121 | */ |
@@ -123,19 +123,19 @@ struct tty_ldisc_ops { | |||
123 | void (*close)(struct tty_struct *); | 123 | void (*close)(struct tty_struct *); |
124 | void (*flush_buffer)(struct tty_struct *tty); | 124 | void (*flush_buffer)(struct tty_struct *tty); |
125 | ssize_t (*chars_in_buffer)(struct tty_struct *tty); | 125 | ssize_t (*chars_in_buffer)(struct tty_struct *tty); |
126 | ssize_t (*read)(struct tty_struct * tty, struct file * file, | 126 | ssize_t (*read)(struct tty_struct *tty, struct file *file, |
127 | unsigned char __user * buf, size_t nr); | 127 | unsigned char __user *buf, size_t nr); |
128 | ssize_t (*write)(struct tty_struct * tty, struct file * file, | 128 | ssize_t (*write)(struct tty_struct *tty, struct file *file, |
129 | const unsigned char * buf, size_t nr); | 129 | const unsigned char *buf, size_t nr); |
130 | int (*ioctl)(struct tty_struct * tty, struct file * file, | 130 | int (*ioctl)(struct tty_struct *tty, struct file *file, |
131 | unsigned int cmd, unsigned long arg); | 131 | unsigned int cmd, unsigned long arg); |
132 | long (*compat_ioctl)(struct tty_struct * tty, struct file * file, | 132 | long (*compat_ioctl)(struct tty_struct *tty, struct file *file, |
133 | unsigned int cmd, unsigned long arg); | 133 | unsigned int cmd, unsigned long arg); |
134 | void (*set_termios)(struct tty_struct *tty, struct ktermios * old); | 134 | void (*set_termios)(struct tty_struct *tty, struct ktermios *old); |
135 | unsigned int (*poll)(struct tty_struct *, struct file *, | 135 | unsigned int (*poll)(struct tty_struct *, struct file *, |
136 | struct poll_table_struct *); | 136 | struct poll_table_struct *); |
137 | int (*hangup)(struct tty_struct *tty); | 137 | int (*hangup)(struct tty_struct *tty); |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * The following routines are called from below. | 140 | * The following routines are called from below. |
141 | */ | 141 | */ |
@@ -145,7 +145,7 @@ struct tty_ldisc_ops { | |||
145 | void (*dcd_change)(struct tty_struct *, unsigned int); | 145 | void (*dcd_change)(struct tty_struct *, unsigned int); |
146 | 146 | ||
147 | struct module *owner; | 147 | struct module *owner; |
148 | 148 | ||
149 | int refcount; | 149 | int refcount; |
150 | }; | 150 | }; |
151 | 151 | ||
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index d21b33c4c6ca..2e9ee4d1c676 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h | |||
@@ -83,15 +83,12 @@ | |||
83 | #define UCB_ID 0x7e | 83 | #define UCB_ID 0x7e |
84 | #define UCB_ID_1400 0x4304 | 84 | #define UCB_ID_1400 0x4304 |
85 | 85 | ||
86 | struct ucb1400_gpio_data { | ||
87 | int gpio_offset; | ||
88 | int (*gpio_setup)(struct device *dev, int ngpio); | ||
89 | int (*gpio_teardown)(struct device *dev, int ngpio); | ||
90 | }; | ||
91 | |||
92 | struct ucb1400_gpio { | 86 | struct ucb1400_gpio { |
93 | struct gpio_chip gc; | 87 | struct gpio_chip gc; |
94 | struct snd_ac97 *ac97; | 88 | struct snd_ac97 *ac97; |
89 | int gpio_offset; | ||
90 | int (*gpio_setup)(struct device *dev, int ngpio); | ||
91 | int (*gpio_teardown)(struct device *dev, int ngpio); | ||
95 | }; | 92 | }; |
96 | 93 | ||
97 | struct ucb1400_ts { | 94 | struct ucb1400_ts { |
@@ -110,6 +107,9 @@ struct ucb1400 { | |||
110 | 107 | ||
111 | struct ucb1400_pdata { | 108 | struct ucb1400_pdata { |
112 | int irq; | 109 | int irq; |
110 | int gpio_offset; | ||
111 | int (*gpio_setup)(struct device *dev, int ngpio); | ||
112 | int (*gpio_teardown)(struct device *dev, int ngpio); | ||
113 | }; | 113 | }; |
114 | 114 | ||
115 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) | 115 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) |
@@ -162,10 +162,4 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97) | |||
162 | unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, | 162 | unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, |
163 | int adcsync); | 163 | int adcsync); |
164 | 164 | ||
165 | #ifdef CONFIG_GPIO_UCB1400 | ||
166 | void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data); | ||
167 | #else | ||
168 | static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {} | ||
169 | #endif | ||
170 | |||
171 | #endif | 165 | #endif |
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 02b83db8e2c5..06f28beed7c2 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h | |||
@@ -38,6 +38,8 @@ struct inode; | |||
38 | #define UPROBE_HANDLER_REMOVE 1 | 38 | #define UPROBE_HANDLER_REMOVE 1 |
39 | #define UPROBE_HANDLER_MASK 1 | 39 | #define UPROBE_HANDLER_MASK 1 |
40 | 40 | ||
41 | #define MAX_URETPROBE_DEPTH 64 | ||
42 | |||
41 | enum uprobe_filter_ctx { | 43 | enum uprobe_filter_ctx { |
42 | UPROBE_FILTER_REGISTER, | 44 | UPROBE_FILTER_REGISTER, |
43 | UPROBE_FILTER_UNREGISTER, | 45 | UPROBE_FILTER_UNREGISTER, |
@@ -46,6 +48,9 @@ enum uprobe_filter_ctx { | |||
46 | 48 | ||
47 | struct uprobe_consumer { | 49 | struct uprobe_consumer { |
48 | int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); | 50 | int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); |
51 | int (*ret_handler)(struct uprobe_consumer *self, | ||
52 | unsigned long func, | ||
53 | struct pt_regs *regs); | ||
49 | bool (*filter)(struct uprobe_consumer *self, | 54 | bool (*filter)(struct uprobe_consumer *self, |
50 | enum uprobe_filter_ctx ctx, | 55 | enum uprobe_filter_ctx ctx, |
51 | struct mm_struct *mm); | 56 | struct mm_struct *mm); |
@@ -68,6 +73,8 @@ struct uprobe_task { | |||
68 | enum uprobe_task_state state; | 73 | enum uprobe_task_state state; |
69 | struct arch_uprobe_task autask; | 74 | struct arch_uprobe_task autask; |
70 | 75 | ||
76 | struct return_instance *return_instances; | ||
77 | unsigned int depth; | ||
71 | struct uprobe *active_uprobe; | 78 | struct uprobe *active_uprobe; |
72 | 79 | ||
73 | unsigned long xol_vaddr; | 80 | unsigned long xol_vaddr; |
@@ -100,6 +107,7 @@ struct uprobes_state { | |||
100 | extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); | 107 | extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); |
101 | extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); | 108 | extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); |
102 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); | 109 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); |
110 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); | ||
103 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 111 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
104 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); | 112 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); |
105 | extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 113 | extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 4d22d0f6167a..a0bee5a28d1a 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -469,14 +469,12 @@ struct usb3_lpm_parameters { | |||
469 | * @lpm_capable: device supports LPM | 469 | * @lpm_capable: device supports LPM |
470 | * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM | 470 | * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM |
471 | * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled | 471 | * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled |
472 | * @usb3_lpm_enabled: USB3 hardware LPM enabled | ||
472 | * @string_langid: language ID for strings | 473 | * @string_langid: language ID for strings |
473 | * @product: iProduct string, if present (static) | 474 | * @product: iProduct string, if present (static) |
474 | * @manufacturer: iManufacturer string, if present (static) | 475 | * @manufacturer: iManufacturer string, if present (static) |
475 | * @serial: iSerialNumber string, if present (static) | 476 | * @serial: iSerialNumber string, if present (static) |
476 | * @filelist: usbfs files that are open to this device | 477 | * @filelist: usbfs files that are open to this device |
477 | * @usb_classdev: USB class device that was created for usbfs device | ||
478 | * access from userspace | ||
479 | * @usbfs_dentry: usbfs dentry entry for the device | ||
480 | * @maxchild: number of ports if hub | 478 | * @maxchild: number of ports if hub |
481 | * @quirks: quirks of the whole device | 479 | * @quirks: quirks of the whole device |
482 | * @urbnum: number of URBs submitted for the whole device | 480 | * @urbnum: number of URBs submitted for the whole device |
@@ -619,7 +617,7 @@ static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index) | |||
619 | #endif | 617 | #endif |
620 | 618 | ||
621 | /* USB autosuspend and autoresume */ | 619 | /* USB autosuspend and autoresume */ |
622 | #ifdef CONFIG_USB_SUSPEND | 620 | #ifdef CONFIG_PM_RUNTIME |
623 | extern void usb_enable_autosuspend(struct usb_device *udev); | 621 | extern void usb_enable_autosuspend(struct usb_device *udev); |
624 | extern void usb_disable_autosuspend(struct usb_device *udev); | 622 | extern void usb_disable_autosuspend(struct usb_device *udev); |
625 | 623 | ||
@@ -978,7 +976,12 @@ struct usbdrv_wrap { | |||
978 | * the "usbfs" filesystem. This lets devices provide ways to | 976 | * the "usbfs" filesystem. This lets devices provide ways to |
979 | * expose information to user space regardless of where they | 977 | * expose information to user space regardless of where they |
980 | * do (or don't) show up otherwise in the filesystem. | 978 | * do (or don't) show up otherwise in the filesystem. |
981 | * @suspend: Called when the device is going to be suspended by the system. | 979 | * @suspend: Called when the device is going to be suspended by the |
980 | * system either from system sleep or runtime suspend context. The | ||
981 | * return value will be ignored in system sleep context, so do NOT | ||
982 | * try to continue using the device if suspend fails in this case. | ||
983 | * Instead, let the resume or reset-resume routine recover from | ||
984 | * the failure. | ||
982 | * @resume: Called when the device is being resumed by the system. | 985 | * @resume: Called when the device is being resumed by the system. |
983 | * @reset_resume: Called when the suspended device has been reset instead | 986 | * @reset_resume: Called when the suspended device has been reset instead |
984 | * of being resumed. | 987 | * of being resumed. |
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index ed13053153f4..c5f2158ab00e 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h | |||
@@ -170,6 +170,8 @@ struct uac2_as_header_descriptor { | |||
170 | __u8 iChannelNames; | 170 | __u8 iChannelNames; |
171 | } __attribute__((packed)); | 171 | } __attribute__((packed)); |
172 | 172 | ||
173 | #define UAC2_FORMAT_TYPE_I_RAW_DATA (1 << 31) | ||
174 | |||
173 | /* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ | 175 | /* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ |
174 | 176 | ||
175 | struct uac2_iso_endpoint_descriptor { | 177 | struct uac2_iso_endpoint_descriptor { |
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h index 719c332620fa..0b3f4295c025 100644 --- a/include/linux/usb/cdc-wdm.h +++ b/include/linux/usb/cdc-wdm.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef __LINUX_USB_CDC_WDM_H | 11 | #ifndef __LINUX_USB_CDC_WDM_H |
12 | #define __LINUX_USB_CDC_WDM_H | 12 | #define __LINUX_USB_CDC_WDM_H |
13 | 13 | ||
14 | #include <uapi/linux/usb/cdc-wdm.h> | ||
15 | |||
14 | extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf, | 16 | extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf, |
15 | struct usb_endpoint_descriptor *ep, | 17 | struct usb_endpoint_descriptor *ep, |
16 | int bufsize, | 18 | int bufsize, |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 9c210f2283df..27603bcbb9b9 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -43,4 +43,13 @@ | |||
43 | */ | 43 | */ |
44 | extern const char *usb_speed_string(enum usb_device_speed speed); | 44 | extern const char *usb_speed_string(enum usb_device_speed speed); |
45 | 45 | ||
46 | |||
47 | /** | ||
48 | * usb_state_string - Returns human readable name for the state. | ||
49 | * @state: The state to return a human-readable name for. If it's not | ||
50 | * any of the states devices in usb_device_state_string enum, | ||
51 | * the string UNKNOWN will be returned. | ||
52 | */ | ||
53 | extern const char *usb_state_string(enum usb_device_state state); | ||
54 | |||
46 | #endif /* __LINUX_USB_CH9_H */ | 55 | #endif /* __LINUX_USB_CH9_H */ |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 8860594d6364..5e61589fc166 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/usb/ch9.h> | 39 | #include <linux/usb/ch9.h> |
40 | #include <linux/usb/gadget.h> | 40 | #include <linux/usb/gadget.h> |
41 | #include <linux/log2.h> | 41 | #include <linux/log2.h> |
42 | #include <linux/configfs.h> | ||
42 | 43 | ||
43 | /* | 44 | /* |
44 | * USB function drivers should return USB_GADGET_DELAYED_STATUS if they | 45 | * USB function drivers should return USB_GADGET_DELAYED_STATUS if they |
@@ -464,6 +465,8 @@ struct usb_function_driver { | |||
464 | }; | 465 | }; |
465 | 466 | ||
466 | struct usb_function_instance { | 467 | struct usb_function_instance { |
468 | struct config_group group; | ||
469 | struct list_head cfs_list; | ||
467 | struct usb_function_driver *fd; | 470 | struct usb_function_driver *fd; |
468 | void (*free_func_inst)(struct usb_function_instance *inst); | 471 | void (*free_func_inst)(struct usb_function_instance *inst); |
469 | }; | 472 | }; |
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h index 51eae14477f7..5615f4d82724 100644 --- a/include/linux/usb/dwc3-omap.h +++ b/include/linux/usb/dwc3-omap.h | |||
@@ -19,11 +19,11 @@ enum omap_dwc3_vbus_id_status { | |||
19 | }; | 19 | }; |
20 | 20 | ||
21 | #if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) | 21 | #if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) |
22 | extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); | 22 | extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); |
23 | #else | 23 | #else |
24 | static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) | 24 | static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) |
25 | { | 25 | { |
26 | return; | 26 | return -ENODEV; |
27 | } | 27 | } |
28 | #endif | 28 | #endif |
29 | 29 | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 2e297e80d59a..c454a88abf2e 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -482,6 +482,7 @@ struct usb_gadget_ops { | |||
482 | * @speed: Speed of current connection to USB host. | 482 | * @speed: Speed of current connection to USB host. |
483 | * @max_speed: Maximal speed the UDC can handle. UDC must support this | 483 | * @max_speed: Maximal speed the UDC can handle. UDC must support this |
484 | * and all slower speeds. | 484 | * and all slower speeds. |
485 | * @state: the state we are now (attached, suspended, configured, etc) | ||
485 | * @sg_supported: true if we can handle scatter-gather | 486 | * @sg_supported: true if we can handle scatter-gather |
486 | * @is_otg: True if the USB device port uses a Mini-AB jack, so that the | 487 | * @is_otg: True if the USB device port uses a Mini-AB jack, so that the |
487 | * gadget driver must provide a USB OTG descriptor. | 488 | * gadget driver must provide a USB OTG descriptor. |
@@ -525,6 +526,7 @@ struct usb_gadget { | |||
525 | struct list_head ep_list; /* of usb_ep */ | 526 | struct list_head ep_list; /* of usb_ep */ |
526 | enum usb_device_speed speed; | 527 | enum usb_device_speed speed; |
527 | enum usb_device_speed max_speed; | 528 | enum usb_device_speed max_speed; |
529 | enum usb_device_state state; | ||
528 | unsigned sg_supported:1; | 530 | unsigned sg_supported:1; |
529 | unsigned is_otg:1; | 531 | unsigned is_otg:1; |
530 | unsigned is_a_peripheral:1; | 532 | unsigned is_a_peripheral:1; |
@@ -872,6 +874,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver); | |||
872 | */ | 874 | */ |
873 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); | 875 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); |
874 | 876 | ||
877 | extern int usb_add_gadget_udc_release(struct device *parent, | ||
878 | struct usb_gadget *gadget, void (*release)(struct device *dev)); | ||
875 | extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); | 879 | extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); |
876 | extern void usb_del_gadget_udc(struct usb_gadget *gadget); | 880 | extern void usb_del_gadget_udc(struct usb_gadget *gadget); |
877 | extern int udc_attach_driver(const char *name, | 881 | extern int udc_attach_driver(const char *name, |
@@ -959,6 +963,13 @@ extern void usb_gadget_unmap_request(struct usb_gadget *gadget, | |||
959 | 963 | ||
960 | /*-------------------------------------------------------------------------*/ | 964 | /*-------------------------------------------------------------------------*/ |
961 | 965 | ||
966 | /* utility to set gadget state properly */ | ||
967 | |||
968 | extern void usb_gadget_set_state(struct usb_gadget *gadget, | ||
969 | enum usb_device_state state); | ||
970 | |||
971 | /*-------------------------------------------------------------------------*/ | ||
972 | |||
962 | /* utility wrapping a simple endpoint selection policy */ | 973 | /* utility wrapping a simple endpoint selection policy */ |
963 | 974 | ||
964 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, | 975 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, |
diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h new file mode 100644 index 000000000000..d74c0ae989d5 --- /dev/null +++ b/include/linux/usb/gadget_configfs.h | |||
@@ -0,0 +1,110 @@ | |||
1 | #ifndef __GADGET_CONFIGFS__ | ||
2 | #define __GADGET_CONFIGFS__ | ||
3 | |||
4 | #include <linux/configfs.h> | ||
5 | |||
6 | int check_user_usb_string(const char *name, | ||
7 | struct usb_gadget_strings *stringtab_dev); | ||
8 | |||
9 | #define GS_STRINGS_W(__struct, __name) \ | ||
10 | static ssize_t __struct##_##__name##_store(struct __struct *gs, \ | ||
11 | const char *page, size_t len) \ | ||
12 | { \ | ||
13 | int ret; \ | ||
14 | \ | ||
15 | ret = usb_string_copy(page, &gs->__name); \ | ||
16 | if (ret) \ | ||
17 | return ret; \ | ||
18 | return len; \ | ||
19 | } | ||
20 | |||
21 | #define GS_STRINGS_R(__struct, __name) \ | ||
22 | static ssize_t __struct##_##__name##_show(struct __struct *gs, \ | ||
23 | char *page) \ | ||
24 | { \ | ||
25 | return sprintf(page, "%s\n", gs->__name ?: ""); \ | ||
26 | } | ||
27 | |||
28 | #define GS_STRING_ITEM_ATTR(struct_name, name) \ | ||
29 | static struct struct_name##_attribute struct_name##_##name = \ | ||
30 | __CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \ | ||
31 | struct_name##_##name##_show, \ | ||
32 | struct_name##_##name##_store) | ||
33 | |||
34 | #define GS_STRINGS_RW(struct_name, _name) \ | ||
35 | GS_STRINGS_R(struct_name, _name) \ | ||
36 | GS_STRINGS_W(struct_name, _name) \ | ||
37 | GS_STRING_ITEM_ATTR(struct_name, _name) | ||
38 | |||
39 | #define USB_CONFIG_STRING_RW_OPS(struct_in) \ | ||
40 | CONFIGFS_ATTR_OPS(struct_in); \ | ||
41 | \ | ||
42 | static struct configfs_item_operations struct_in##_langid_item_ops = { \ | ||
43 | .release = struct_in##_attr_release, \ | ||
44 | .show_attribute = struct_in##_attr_show, \ | ||
45 | .store_attribute = struct_in##_attr_store, \ | ||
46 | }; \ | ||
47 | \ | ||
48 | static struct config_item_type struct_in##_langid_type = { \ | ||
49 | .ct_item_ops = &struct_in##_langid_item_ops, \ | ||
50 | .ct_attrs = struct_in##_langid_attrs, \ | ||
51 | .ct_owner = THIS_MODULE, \ | ||
52 | } | ||
53 | |||
54 | #define USB_CONFIG_STRINGS_LANG(struct_in, struct_member) \ | ||
55 | static struct config_group *struct_in##_strings_make( \ | ||
56 | struct config_group *group, \ | ||
57 | const char *name) \ | ||
58 | { \ | ||
59 | struct struct_member *gi; \ | ||
60 | struct struct_in *gs; \ | ||
61 | struct struct_in *new; \ | ||
62 | int langs = 0; \ | ||
63 | int ret; \ | ||
64 | \ | ||
65 | new = kzalloc(sizeof(*new), GFP_KERNEL); \ | ||
66 | if (!new) \ | ||
67 | return ERR_PTR(-ENOMEM); \ | ||
68 | \ | ||
69 | ret = check_user_usb_string(name, &new->stringtab_dev); \ | ||
70 | if (ret) \ | ||
71 | goto err; \ | ||
72 | config_group_init_type_name(&new->group, name, \ | ||
73 | &struct_in##_langid_type); \ | ||
74 | \ | ||
75 | gi = container_of(group, struct struct_member, strings_group); \ | ||
76 | ret = -EEXIST; \ | ||
77 | list_for_each_entry(gs, &gi->string_list, list) { \ | ||
78 | if (gs->stringtab_dev.language == new->stringtab_dev.language) \ | ||
79 | goto err; \ | ||
80 | langs++; \ | ||
81 | } \ | ||
82 | ret = -EOVERFLOW; \ | ||
83 | if (langs >= MAX_USB_STRING_LANGS) \ | ||
84 | goto err; \ | ||
85 | \ | ||
86 | list_add_tail(&new->list, &gi->string_list); \ | ||
87 | return &new->group; \ | ||
88 | err: \ | ||
89 | kfree(new); \ | ||
90 | return ERR_PTR(ret); \ | ||
91 | } \ | ||
92 | \ | ||
93 | static void struct_in##_strings_drop( \ | ||
94 | struct config_group *group, \ | ||
95 | struct config_item *item) \ | ||
96 | { \ | ||
97 | config_item_put(item); \ | ||
98 | } \ | ||
99 | \ | ||
100 | static struct configfs_group_operations struct_in##_strings_ops = { \ | ||
101 | .make_group = &struct_in##_strings_make, \ | ||
102 | .drop_item = &struct_in##_strings_drop, \ | ||
103 | }; \ | ||
104 | \ | ||
105 | static struct config_item_type struct_in##_strings_type = { \ | ||
106 | .ct_group_ops = &struct_in##_strings_ops, \ | ||
107 | .ct_owner = THIS_MODULE, \ | ||
108 | } | ||
109 | |||
110 | #endif | ||
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 59694b5e5e90..f5f5c7dfda90 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -84,7 +84,7 @@ struct usb_hcd { | |||
84 | 84 | ||
85 | struct timer_list rh_timer; /* drives root-hub polling */ | 85 | struct timer_list rh_timer; /* drives root-hub polling */ |
86 | struct urb *status_urb; /* the current status urb */ | 86 | struct urb *status_urb; /* the current status urb */ |
87 | #ifdef CONFIG_USB_SUSPEND | 87 | #ifdef CONFIG_PM_RUNTIME |
88 | struct work_struct wakeup_work; /* for remote wakeup */ | 88 | struct work_struct wakeup_work; /* for remote wakeup */ |
89 | #endif | 89 | #endif |
90 | 90 | ||
@@ -593,14 +593,14 @@ extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); | |||
593 | extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); | 593 | extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); |
594 | #endif /* CONFIG_PM */ | 594 | #endif /* CONFIG_PM */ |
595 | 595 | ||
596 | #ifdef CONFIG_USB_SUSPEND | 596 | #ifdef CONFIG_PM_RUNTIME |
597 | extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); | 597 | extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); |
598 | #else | 598 | #else |
599 | static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) | 599 | static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) |
600 | { | 600 | { |
601 | return; | 601 | return; |
602 | } | 602 | } |
603 | #endif /* CONFIG_USB_SUSPEND */ | 603 | #endif /* CONFIG_PM_RUNTIME */ |
604 | 604 | ||
605 | /*-------------------------------------------------------------------------*/ | 605 | /*-------------------------------------------------------------------------*/ |
606 | 606 | ||
diff --git a/include/linux/irqchip/sunxi.h b/include/linux/usb/musb-ux500.h index 1fe2c2260e2b..1e2c7130f6e1 100644 --- a/include/linux/irqchip/sunxi.h +++ b/include/linux/usb/musb-ux500.h | |||
@@ -1,7 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2012 Maxime Ripard | 2 | * Copyright (C) 2013 ST-Ericsson AB |
3 | * | ||
4 | * Maxime Ripard <maxime.ripard@free-electrons.com> | ||
5 | * | 3 | * |
6 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -14,14 +12,20 @@ | |||
14 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
15 | */ | 13 | */ |
16 | 14 | ||
17 | #ifndef __LINUX_IRQCHIP_SUNXI_H | 15 | #ifndef __MUSB_UX500_H__ |
18 | #define __LINUX_IRQCHIP_SUNXI_H | 16 | #define __MUSB_UX500_H__ |
19 | |||
20 | #include <asm/exception.h> | ||
21 | |||
22 | extern void sunxi_init_irq(void); | ||
23 | 17 | ||
24 | extern asmlinkage void __exception_irq_entry sunxi_handle_irq( | 18 | enum ux500_musb_vbus_id_status { |
25 | struct pt_regs *regs); | 19 | UX500_MUSB_NONE = 0, |
20 | UX500_MUSB_VBUS, | ||
21 | UX500_MUSB_ID, | ||
22 | UX500_MUSB_CHARGER, | ||
23 | UX500_MUSB_ENUMERATED, | ||
24 | UX500_MUSB_RIDA, | ||
25 | UX500_MUSB_RIDB, | ||
26 | UX500_MUSB_RIDC, | ||
27 | UX500_MUSB_PREPARE, | ||
28 | UX500_MUSB_CLEAN, | ||
29 | }; | ||
26 | 30 | ||
27 | #endif | 31 | #endif /* __MUSB_UX500_H__ */ |
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h index 28884c717411..148d35171aac 100644 --- a/include/linux/usb/nop-usb-xceiv.h +++ b/include/linux/usb/nop-usb-xceiv.h | |||
@@ -5,6 +5,11 @@ | |||
5 | 5 | ||
6 | struct nop_usb_xceiv_platform_data { | 6 | struct nop_usb_xceiv_platform_data { |
7 | enum usb_phy_type type; | 7 | enum usb_phy_type type; |
8 | unsigned long clk_rate; | ||
9 | |||
10 | /* if set fails with -EPROBE_DEFER if can't get regulator */ | ||
11 | unsigned int needs_vcc:1; | ||
12 | unsigned int needs_reset:1; | ||
8 | }; | 13 | }; |
9 | 14 | ||
10 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) | 15 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index e8a5fe87c6bd..291e01ba32e5 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -36,14 +36,7 @@ struct usb_otg { | |||
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | #ifdef CONFIG_USB_OTG_UTILS | 39 | extern const char *usb_otg_state_string(enum usb_otg_state state); |
40 | extern const char *otg_state_string(enum usb_otg_state state); | ||
41 | #else | ||
42 | static inline const char *otg_state_string(enum usb_otg_state state) | ||
43 | { | ||
44 | return NULL; | ||
45 | } | ||
46 | #endif | ||
47 | 40 | ||
48 | /* Context: can sleep */ | 41 | /* Context: can sleep */ |
49 | static inline int | 42 | static inline int |
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 15847cbdb512..6b5978f57633 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h | |||
@@ -91,6 +91,9 @@ struct usb_phy { | |||
91 | int (*init)(struct usb_phy *x); | 91 | int (*init)(struct usb_phy *x); |
92 | void (*shutdown)(struct usb_phy *x); | 92 | void (*shutdown)(struct usb_phy *x); |
93 | 93 | ||
94 | /* enable/disable VBUS */ | ||
95 | int (*set_vbus)(struct usb_phy *x, int on); | ||
96 | |||
94 | /* effective for B devices, ignored for A-peripheral */ | 97 | /* effective for B devices, ignored for A-peripheral */ |
95 | int (*set_power)(struct usb_phy *x, | 98 | int (*set_power)(struct usb_phy *x, |
96 | unsigned mA); | 99 | unsigned mA); |
@@ -160,8 +163,26 @@ usb_phy_shutdown(struct usb_phy *x) | |||
160 | x->shutdown(x); | 163 | x->shutdown(x); |
161 | } | 164 | } |
162 | 165 | ||
166 | static inline int | ||
167 | usb_phy_vbus_on(struct usb_phy *x) | ||
168 | { | ||
169 | if (!x->set_vbus) | ||
170 | return 0; | ||
171 | |||
172 | return x->set_vbus(x, true); | ||
173 | } | ||
174 | |||
175 | static inline int | ||
176 | usb_phy_vbus_off(struct usb_phy *x) | ||
177 | { | ||
178 | if (!x->set_vbus) | ||
179 | return 0; | ||
180 | |||
181 | return x->set_vbus(x, false); | ||
182 | } | ||
183 | |||
163 | /* for usb host and peripheral controller drivers */ | 184 | /* for usb host and peripheral controller drivers */ |
164 | #ifdef CONFIG_USB_OTG_UTILS | 185 | #if IS_ENABLED(CONFIG_USB_PHY) |
165 | extern struct usb_phy *usb_get_phy(enum usb_phy_type type); | 186 | extern struct usb_phy *usb_get_phy(enum usb_phy_type type); |
166 | extern struct usb_phy *devm_usb_get_phy(struct device *dev, | 187 | extern struct usb_phy *devm_usb_get_phy(struct device *dev, |
167 | enum usb_phy_type type); | 188 | enum usb_phy_type type); |
@@ -176,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index, | |||
176 | #else | 197 | #else |
177 | static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) | 198 | static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) |
178 | { | 199 | { |
179 | return NULL; | 200 | return ERR_PTR(-ENXIO); |
180 | } | 201 | } |
181 | 202 | ||
182 | static inline struct usb_phy *devm_usb_get_phy(struct device *dev, | 203 | static inline struct usb_phy *devm_usb_get_phy(struct device *dev, |
183 | enum usb_phy_type type) | 204 | enum usb_phy_type type) |
184 | { | 205 | { |
185 | return NULL; | 206 | return ERR_PTR(-ENXIO); |
186 | } | 207 | } |
187 | 208 | ||
188 | static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) | 209 | static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) |
189 | { | 210 | { |
190 | return NULL; | 211 | return ERR_PTR(-ENXIO); |
191 | } | 212 | } |
192 | 213 | ||
193 | static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index) | 214 | static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index) |
194 | { | 215 | { |
195 | return NULL; | 216 | return ERR_PTR(-ENXIO); |
196 | } | 217 | } |
197 | 218 | ||
198 | static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | 219 | static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, |
199 | const char *phandle, u8 index) | 220 | const char *phandle, u8 index) |
200 | { | 221 | { |
201 | return NULL; | 222 | return ERR_PTR(-ENXIO); |
202 | } | 223 | } |
203 | 224 | ||
204 | static inline void usb_put_phy(struct usb_phy *x) | 225 | static inline void usb_put_phy(struct usb_phy *x) |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index c5d36c65c33b..e452ba6ec6bd 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
@@ -62,14 +62,14 @@ struct renesas_usbhs_platform_callback { | |||
62 | * Hardware exit function for platform. | 62 | * Hardware exit function for platform. |
63 | * it is called when driver was removed | 63 | * it is called when driver was removed |
64 | */ | 64 | */ |
65 | void (*hardware_exit)(struct platform_device *pdev); | 65 | int (*hardware_exit)(struct platform_device *pdev); |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * option: | 68 | * option: |
69 | * | 69 | * |
70 | * for board specific clock control | 70 | * for board specific clock control |
71 | */ | 71 | */ |
72 | void (*power_ctrl)(struct platform_device *pdev, | 72 | int (*power_ctrl)(struct platform_device *pdev, |
73 | void __iomem *base, int enable); | 73 | void __iomem *base, int enable); |
74 | 74 | ||
75 | /* | 75 | /* |
@@ -77,7 +77,7 @@ struct renesas_usbhs_platform_callback { | |||
77 | * | 77 | * |
78 | * Phy reset for platform | 78 | * Phy reset for platform |
79 | */ | 79 | */ |
80 | void (*phy_reset)(struct platform_device *pdev); | 80 | int (*phy_reset)(struct platform_device *pdev); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * get USB ID function | 83 | * get USB ID function |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 1819b59aab2a..b9b0f7b4e43b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/kref.h> | 16 | #include <linux/kref.h> |
17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
18 | #include <linux/serial.h> | ||
18 | #include <linux/sysrq.h> | 19 | #include <linux/sysrq.h> |
19 | #include <linux/kfifo.h> | 20 | #include <linux/kfifo.h> |
20 | 21 | ||
@@ -61,12 +62,12 @@ | |||
61 | * @bulk_out_buffers: pointers to the bulk out buffers for this port | 62 | * @bulk_out_buffers: pointers to the bulk out buffers for this port |
62 | * @write_urbs: pointers to the bulk out urbs for this port | 63 | * @write_urbs: pointers to the bulk out urbs for this port |
63 | * @write_urbs_free: status bitmap the for bulk out urbs | 64 | * @write_urbs_free: status bitmap the for bulk out urbs |
65 | * @icount: interrupt counters | ||
64 | * @tx_bytes: number of bytes currently in host stack queues | 66 | * @tx_bytes: number of bytes currently in host stack queues |
65 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this | 67 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this |
66 | * port. | 68 | * port. |
67 | * @flags: usb serial port flags | 69 | * @flags: usb serial port flags |
68 | * @write_wait: a wait_queue_head_t used by the port. | 70 | * @write_wait: a wait_queue_head_t used by the port. |
69 | * @delta_msr_wait: modem-status-change wait queue | ||
70 | * @work: work queue entry for the line discipline waking up. | 71 | * @work: work queue entry for the line discipline waking up. |
71 | * @throttled: nonzero if the read urb is inactive to throttle the device | 72 | * @throttled: nonzero if the read urb is inactive to throttle the device |
72 | * @throttle_req: nonzero if the tty wants to throttle us | 73 | * @throttle_req: nonzero if the tty wants to throttle us |
@@ -109,11 +110,11 @@ struct usb_serial_port { | |||
109 | unsigned long write_urbs_free; | 110 | unsigned long write_urbs_free; |
110 | __u8 bulk_out_endpointAddress; | 111 | __u8 bulk_out_endpointAddress; |
111 | 112 | ||
113 | struct async_icount icount; | ||
112 | int tx_bytes; | 114 | int tx_bytes; |
113 | 115 | ||
114 | unsigned long flags; | 116 | unsigned long flags; |
115 | wait_queue_head_t write_wait; | 117 | wait_queue_head_t write_wait; |
116 | wait_queue_head_t delta_msr_wait; | ||
117 | struct work_struct work; | 118 | struct work_struct work; |
118 | char throttled; | 119 | char throttled; |
119 | char throttle_req; | 120 | char throttle_req; |
@@ -272,6 +273,7 @@ struct usb_serial_driver { | |||
272 | int (*tiocmget)(struct tty_struct *tty); | 273 | int (*tiocmget)(struct tty_struct *tty); |
273 | int (*tiocmset)(struct tty_struct *tty, | 274 | int (*tiocmset)(struct tty_struct *tty, |
274 | unsigned int set, unsigned int clear); | 275 | unsigned int set, unsigned int clear); |
276 | int (*tiocmiwait)(struct tty_struct *tty, unsigned long arg); | ||
275 | int (*get_icount)(struct tty_struct *tty, | 277 | int (*get_icount)(struct tty_struct *tty, |
276 | struct serial_icounter_struct *icount); | 278 | struct serial_icounter_struct *icount); |
277 | /* Called by the tty layer for port level work. There may or may not | 279 | /* Called by the tty layer for port level work. There may or may not |
@@ -329,8 +331,10 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb); | |||
329 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); | 331 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
330 | extern void usb_serial_generic_throttle(struct tty_struct *tty); | 332 | extern void usb_serial_generic_throttle(struct tty_struct *tty); |
331 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); | 333 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); |
332 | extern void usb_serial_generic_disconnect(struct usb_serial *serial); | 334 | extern int usb_serial_generic_tiocmiwait(struct tty_struct *tty, |
333 | extern void usb_serial_generic_release(struct usb_serial *serial); | 335 | unsigned long arg); |
336 | extern int usb_serial_generic_get_icount(struct tty_struct *tty, | ||
337 | struct serial_icounter_struct *icount); | ||
334 | extern int usb_serial_generic_register(void); | 338 | extern int usb_serial_generic_register(void); |
335 | extern void usb_serial_generic_deregister(void); | 339 | extern void usb_serial_generic_deregister(void); |
336 | extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, | 340 | extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, |
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h index 9ebebe906925..1b7519a8c0bf 100644 --- a/include/linux/usb/tegra_usb_phy.h +++ b/include/linux/usb/tegra_usb_phy.h | |||
@@ -61,10 +61,14 @@ struct tegra_usb_phy { | |||
61 | struct device *dev; | 61 | struct device *dev; |
62 | bool is_legacy_phy; | 62 | bool is_legacy_phy; |
63 | bool is_ulpi_phy; | 63 | bool is_ulpi_phy; |
64 | void (*set_pts)(struct usb_phy *x, u8 pts_val); | ||
65 | void (*set_phcd)(struct usb_phy *x, bool enable); | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, | 68 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, |
67 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); | 69 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode, |
70 | void (*set_pts)(struct usb_phy *x, u8 pts_val), | ||
71 | void (*set_phcd)(struct usb_phy *x, bool enable)); | ||
68 | 72 | ||
69 | void tegra_usb_phy_preresume(struct usb_phy *phy); | 73 | void tegra_usb_phy_preresume(struct usb_phy *phy); |
70 | 74 | ||
@@ -75,8 +79,4 @@ void tegra_ehci_phy_restore_start(struct usb_phy *phy, | |||
75 | 79 | ||
76 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); | 80 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); |
77 | 81 | ||
78 | void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val); | ||
79 | |||
80 | void tegra_ehci_set_phcd(struct usb_phy *x, bool enable); | ||
81 | |||
82 | #endif /* __TEGRA_USB_PHY_H */ | 82 | #endif /* __TEGRA_USB_PHY_H */ |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 0e5ac93bab10..f18d64129f99 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -56,6 +56,8 @@ struct usbnet { | |||
56 | struct sk_buff_head done; | 56 | struct sk_buff_head done; |
57 | struct sk_buff_head rxq_pause; | 57 | struct sk_buff_head rxq_pause; |
58 | struct urb *interrupt; | 58 | struct urb *interrupt; |
59 | unsigned interrupt_count; | ||
60 | struct mutex interrupt_mutex; | ||
59 | struct usb_anchor deferred; | 61 | struct usb_anchor deferred; |
60 | struct tasklet_struct bh; | 62 | struct tasklet_struct bh; |
61 | 63 | ||
@@ -72,6 +74,7 @@ struct usbnet { | |||
72 | # define EVENT_DEVICE_REPORT_IDLE 8 | 74 | # define EVENT_DEVICE_REPORT_IDLE 8 |
73 | # define EVENT_NO_RUNTIME_PM 9 | 75 | # define EVENT_NO_RUNTIME_PM 9 |
74 | # define EVENT_RX_KILL 10 | 76 | # define EVENT_RX_KILL 10 |
77 | # define EVENT_LINK_CHANGE 11 | ||
75 | }; | 78 | }; |
76 | 79 | ||
77 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 80 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
@@ -245,5 +248,9 @@ extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); | |||
245 | extern int usbnet_nway_reset(struct net_device *net); | 248 | extern int usbnet_nway_reset(struct net_device *net); |
246 | 249 | ||
247 | extern int usbnet_manage_power(struct usbnet *, int); | 250 | extern int usbnet_manage_power(struct usbnet *, int); |
251 | extern void usbnet_link_change(struct usbnet *, bool, bool); | ||
252 | |||
253 | extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags); | ||
254 | extern void usbnet_status_stop(struct usbnet *dev); | ||
248 | 255 | ||
249 | #endif /* __LINUX_USB_USBNET_H */ | 256 | #endif /* __LINUX_USB_USBNET_H */ |
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h index 75818744ab59..ea7168a68081 100644 --- a/include/linux/vexpress.h +++ b/include/linux/vexpress.h | |||
@@ -115,9 +115,6 @@ unsigned __vexpress_get_site(struct device *dev, struct device_node *node); | |||
115 | void vexpress_sysreg_early_init(void __iomem *base); | 115 | void vexpress_sysreg_early_init(void __iomem *base); |
116 | void vexpress_sysreg_of_early_init(void); | 116 | void vexpress_sysreg_of_early_init(void); |
117 | 117 | ||
118 | void vexpress_power_off(void); | ||
119 | void vexpress_restart(char str, const char *cmd); | ||
120 | |||
121 | /* Clocks */ | 118 | /* Clocks */ |
122 | 119 | ||
123 | struct clk *vexpress_osc_setup(struct device *dev); | 120 | struct clk *vexpress_osc_setup(struct device *dev); |
diff --git a/include/linux/vfio.h b/include/linux/vfio.h index ab9e86224c54..ac8d488e4372 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h | |||
@@ -45,6 +45,9 @@ extern int vfio_add_group_dev(struct device *dev, | |||
45 | void *device_data); | 45 | void *device_data); |
46 | 46 | ||
47 | extern void *vfio_del_group_dev(struct device *dev); | 47 | extern void *vfio_del_group_dev(struct device *dev); |
48 | extern struct vfio_device *vfio_device_get_from_dev(struct device *dev); | ||
49 | extern void vfio_device_put(struct vfio_device *device); | ||
50 | extern void *vfio_device_data(struct vfio_device *device); | ||
48 | 51 | ||
49 | /** | 52 | /** |
50 | * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks | 53 | * struct vfio_iommu_driver_ops - VFIO IOMMU driver callbacks |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index ff6714e6d0f5..9ff8645b7e0b 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
9 | #include <linux/mod_devicetable.h> | 9 | #include <linux/mod_devicetable.h> |
10 | #include <linux/gfp.h> | 10 | #include <linux/gfp.h> |
11 | #include <linux/vringh.h> | ||
11 | 12 | ||
12 | /** | 13 | /** |
13 | * virtqueue - a queue to register buffers for sending or receiving. | 14 | * virtqueue - a queue to register buffers for sending or receiving. |
@@ -40,6 +41,23 @@ int virtqueue_add_buf(struct virtqueue *vq, | |||
40 | void *data, | 41 | void *data, |
41 | gfp_t gfp); | 42 | gfp_t gfp); |
42 | 43 | ||
44 | int virtqueue_add_outbuf(struct virtqueue *vq, | ||
45 | struct scatterlist sg[], unsigned int num, | ||
46 | void *data, | ||
47 | gfp_t gfp); | ||
48 | |||
49 | int virtqueue_add_inbuf(struct virtqueue *vq, | ||
50 | struct scatterlist sg[], unsigned int num, | ||
51 | void *data, | ||
52 | gfp_t gfp); | ||
53 | |||
54 | int virtqueue_add_sgs(struct virtqueue *vq, | ||
55 | struct scatterlist *sgs[], | ||
56 | unsigned int out_sgs, | ||
57 | unsigned int in_sgs, | ||
58 | void *data, | ||
59 | gfp_t gfp); | ||
60 | |||
43 | void virtqueue_kick(struct virtqueue *vq); | 61 | void virtqueue_kick(struct virtqueue *vq); |
44 | 62 | ||
45 | bool virtqueue_kick_prepare(struct virtqueue *vq); | 63 | bool virtqueue_kick_prepare(struct virtqueue *vq); |
@@ -58,18 +76,13 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq); | |||
58 | 76 | ||
59 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); | 77 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); |
60 | 78 | ||
61 | /* FIXME: Obsolete accessor, but required for virtio_net merge. */ | ||
62 | static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq) | ||
63 | { | ||
64 | return vq->index; | ||
65 | } | ||
66 | |||
67 | /** | 79 | /** |
68 | * virtio_device - representation of a device using virtio | 80 | * virtio_device - representation of a device using virtio |
69 | * @index: unique position on the virtio bus | 81 | * @index: unique position on the virtio bus |
70 | * @dev: underlying device. | 82 | * @dev: underlying device. |
71 | * @id: the device type identification (used to match it with a driver). | 83 | * @id: the device type identification (used to match it with a driver). |
72 | * @config: the configuration ops for this device. | 84 | * @config: the configuration ops for this device. |
85 | * @vringh_config: configuration ops for host vrings. | ||
73 | * @vqs: the list of virtqueues for this device. | 86 | * @vqs: the list of virtqueues for this device. |
74 | * @features: the features supported by both driver and device. | 87 | * @features: the features supported by both driver and device. |
75 | * @priv: private pointer for the driver's use. | 88 | * @priv: private pointer for the driver's use. |
@@ -79,6 +92,7 @@ struct virtio_device { | |||
79 | struct device dev; | 92 | struct device dev; |
80 | struct virtio_device_id id; | 93 | struct virtio_device_id id; |
81 | const struct virtio_config_ops *config; | 94 | const struct virtio_config_ops *config; |
95 | const struct vringh_config_ops *vringh_config; | ||
82 | struct list_head vqs; | 96 | struct list_head vqs; |
83 | /* Note that this is a Linux set_bit-style bitmap. */ | 97 | /* Note that this is a Linux set_bit-style bitmap. */ |
84 | unsigned long features[1]; | 98 | unsigned long features[1]; |
diff --git a/include/linux/virtio_caif.h b/include/linux/virtio_caif.h new file mode 100644 index 000000000000..5d2d3124ca3d --- /dev/null +++ b/include/linux/virtio_caif.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson AB 2012 | ||
3 | * Author: Sjur Brændeland <sjur.brandeland@stericsson.com> | ||
4 | * | ||
5 | * This header is BSD licensed so | ||
6 | * anyone can use the definitions to implement compatible remote processors | ||
7 | */ | ||
8 | |||
9 | #ifndef VIRTIO_CAIF_H | ||
10 | #define VIRTIO_CAIF_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | struct virtio_caif_transf_config { | ||
14 | u16 headroom; | ||
15 | u16 tailroom; | ||
16 | u32 mtu; | ||
17 | u8 reserved[4]; | ||
18 | }; | ||
19 | |||
20 | struct virtio_caif_config { | ||
21 | struct virtio_caif_transf_config uplink, downlink; | ||
22 | u8 reserved[8]; | ||
23 | }; | ||
24 | #endif | ||
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 63c6ea199519..ca3ad41c2c82 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -4,6 +4,63 @@ | |||
4 | #include <linux/irqreturn.h> | 4 | #include <linux/irqreturn.h> |
5 | #include <uapi/linux/virtio_ring.h> | 5 | #include <uapi/linux/virtio_ring.h> |
6 | 6 | ||
7 | /* | ||
8 | * Barriers in virtio are tricky. Non-SMP virtio guests can't assume | ||
9 | * they're not on an SMP host system, so they need to assume real | ||
10 | * barriers. Non-SMP virtio hosts could skip the barriers, but does | ||
11 | * anyone care? | ||
12 | * | ||
13 | * For virtio_pci on SMP, we don't need to order with respect to MMIO | ||
14 | * accesses through relaxed memory I/O windows, so smp_mb() et al are | ||
15 | * sufficient. | ||
16 | * | ||
17 | * For using virtio to talk to real devices (eg. other heterogeneous | ||
18 | * CPUs) we do need real barriers. In theory, we could be using both | ||
19 | * kinds of virtio, so it's a runtime decision, and the branch is | ||
20 | * actually quite cheap. | ||
21 | */ | ||
22 | |||
23 | #ifdef CONFIG_SMP | ||
24 | static inline void virtio_mb(bool weak_barriers) | ||
25 | { | ||
26 | if (weak_barriers) | ||
27 | smp_mb(); | ||
28 | else | ||
29 | mb(); | ||
30 | } | ||
31 | |||
32 | static inline void virtio_rmb(bool weak_barriers) | ||
33 | { | ||
34 | if (weak_barriers) | ||
35 | smp_rmb(); | ||
36 | else | ||
37 | rmb(); | ||
38 | } | ||
39 | |||
40 | static inline void virtio_wmb(bool weak_barriers) | ||
41 | { | ||
42 | if (weak_barriers) | ||
43 | smp_wmb(); | ||
44 | else | ||
45 | wmb(); | ||
46 | } | ||
47 | #else | ||
48 | static inline void virtio_mb(bool weak_barriers) | ||
49 | { | ||
50 | mb(); | ||
51 | } | ||
52 | |||
53 | static inline void virtio_rmb(bool weak_barriers) | ||
54 | { | ||
55 | rmb(); | ||
56 | } | ||
57 | |||
58 | static inline void virtio_wmb(bool weak_barriers) | ||
59 | { | ||
60 | wmb(); | ||
61 | } | ||
62 | #endif | ||
63 | |||
7 | struct virtio_device; | 64 | struct virtio_device; |
8 | struct virtqueue; | 65 | struct virtqueue; |
9 | 66 | ||
diff --git a/include/linux/vm_sockets.h b/include/linux/vm_sockets.h new file mode 100644 index 000000000000..0805eecba8f7 --- /dev/null +++ b/include/linux/vm_sockets.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * VMware vSockets Driver | ||
3 | * | ||
4 | * Copyright (C) 2007-2013 VMware, Inc. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation version 2 and no later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _VM_SOCKETS_H | ||
17 | #define _VM_SOCKETS_H | ||
18 | |||
19 | #include <uapi/linux/vm_sockets.h> | ||
20 | |||
21 | int vm_sockets_get_local_cid(void); | ||
22 | |||
23 | #endif /* _VM_SOCKETS_H */ | ||
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 6071e911c7f4..7d5773a99f20 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -3,7 +3,9 @@ | |||
3 | 3 | ||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/list.h> | ||
6 | #include <asm/page.h> /* pgprot_t */ | 7 | #include <asm/page.h> /* pgprot_t */ |
8 | #include <linux/rbtree.h> | ||
7 | 9 | ||
8 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ | 10 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ |
9 | 11 | ||
@@ -35,6 +37,17 @@ struct vm_struct { | |||
35 | const void *caller; | 37 | const void *caller; |
36 | }; | 38 | }; |
37 | 39 | ||
40 | struct vmap_area { | ||
41 | unsigned long va_start; | ||
42 | unsigned long va_end; | ||
43 | unsigned long flags; | ||
44 | struct rb_node rb_node; /* address sorted rbtree */ | ||
45 | struct list_head list; /* address sorted list */ | ||
46 | struct list_head purge_list; /* "lazy purge" list */ | ||
47 | struct vm_struct *vm; | ||
48 | struct rcu_head rcu_head; | ||
49 | }; | ||
50 | |||
38 | /* | 51 | /* |
39 | * Highlevel APIs for driver use | 52 | * Highlevel APIs for driver use |
40 | */ | 53 | */ |
@@ -130,8 +143,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count); | |||
130 | /* | 143 | /* |
131 | * Internals. Dont't use.. | 144 | * Internals. Dont't use.. |
132 | */ | 145 | */ |
133 | extern rwlock_t vmlist_lock; | 146 | extern struct list_head vmap_area_list; |
134 | extern struct vm_struct *vmlist; | ||
135 | extern __init void vm_area_add_early(struct vm_struct *vm); | 147 | extern __init void vm_area_add_early(struct vm_struct *vm); |
136 | extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); | 148 | extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); |
137 | 149 | ||
@@ -158,4 +170,22 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) | |||
158 | # endif | 170 | # endif |
159 | #endif | 171 | #endif |
160 | 172 | ||
173 | struct vmalloc_info { | ||
174 | unsigned long used; | ||
175 | unsigned long largest_chunk; | ||
176 | }; | ||
177 | |||
178 | #ifdef CONFIG_MMU | ||
179 | #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) | ||
180 | extern void get_vmalloc_info(struct vmalloc_info *vmi); | ||
181 | #else | ||
182 | |||
183 | #define VMALLOC_TOTAL 0UL | ||
184 | #define get_vmalloc_info(vmi) \ | ||
185 | do { \ | ||
186 | (vmi)->used = 0; \ | ||
187 | (vmi)->largest_chunk = 0; \ | ||
188 | } while (0) | ||
189 | #endif | ||
190 | |||
161 | #endif /* _LINUX_VMALLOC_H */ | 191 | #endif /* _LINUX_VMALLOC_H */ |
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h new file mode 100644 index 000000000000..76be077340ea --- /dev/null +++ b/include/linux/vmpressure.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef __LINUX_VMPRESSURE_H | ||
2 | #define __LINUX_VMPRESSURE_H | ||
3 | |||
4 | #include <linux/mutex.h> | ||
5 | #include <linux/list.h> | ||
6 | #include <linux/workqueue.h> | ||
7 | #include <linux/gfp.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/cgroup.h> | ||
10 | |||
11 | struct vmpressure { | ||
12 | unsigned long scanned; | ||
13 | unsigned long reclaimed; | ||
14 | /* The lock is used to keep the scanned/reclaimed above in sync. */ | ||
15 | struct mutex sr_lock; | ||
16 | |||
17 | /* The list of vmpressure_event structs. */ | ||
18 | struct list_head events; | ||
19 | /* Have to grab the lock on events traversal or modifications. */ | ||
20 | struct mutex events_lock; | ||
21 | |||
22 | struct work_struct work; | ||
23 | }; | ||
24 | |||
25 | struct mem_cgroup; | ||
26 | |||
27 | #ifdef CONFIG_MEMCG | ||
28 | extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | ||
29 | unsigned long scanned, unsigned long reclaimed); | ||
30 | extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); | ||
31 | |||
32 | extern void vmpressure_init(struct vmpressure *vmpr); | ||
33 | extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); | ||
34 | extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); | ||
35 | extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); | ||
36 | extern int vmpressure_register_event(struct cgroup *cg, struct cftype *cft, | ||
37 | struct eventfd_ctx *eventfd, | ||
38 | const char *args); | ||
39 | extern void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, | ||
40 | struct eventfd_ctx *eventfd); | ||
41 | #else | ||
42 | static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, | ||
43 | unsigned long scanned, unsigned long reclaimed) {} | ||
44 | static inline void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, | ||
45 | int prio) {} | ||
46 | #endif /* CONFIG_MEMCG */ | ||
47 | #endif /* __LINUX_VMPRESSURE_H */ | ||
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 5fd71a7d0dfd..c586679b6fef 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -48,13 +48,8 @@ static inline void count_vm_events(enum vm_event_item item, long delta) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | extern void all_vm_events(unsigned long *); | 50 | extern void all_vm_events(unsigned long *); |
51 | #ifdef CONFIG_HOTPLUG | 51 | |
52 | extern void vm_events_fold_cpu(int cpu); | 52 | extern void vm_events_fold_cpu(int cpu); |
53 | #else | ||
54 | static inline void vm_events_fold_cpu(int cpu) | ||
55 | { | ||
56 | } | ||
57 | #endif | ||
58 | 53 | ||
59 | #else | 54 | #else |
60 | 55 | ||
diff --git a/include/linux/vringh.h b/include/linux/vringh.h new file mode 100644 index 000000000000..749cde28728b --- /dev/null +++ b/include/linux/vringh.h | |||
@@ -0,0 +1,225 @@ | |||
1 | /* | ||
2 | * Linux host-side vring helpers; for when the kernel needs to access | ||
3 | * someone else's vring. | ||
4 | * | ||
5 | * Copyright IBM Corporation, 2013. | ||
6 | * Parts taken from drivers/vhost/vhost.c Copyright 2009 Red Hat, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | * | ||
22 | * Written by: Rusty Russell <rusty@rustcorp.com.au> | ||
23 | */ | ||
24 | #ifndef _LINUX_VRINGH_H | ||
25 | #define _LINUX_VRINGH_H | ||
26 | #include <uapi/linux/virtio_ring.h> | ||
27 | #include <linux/uio.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <asm/barrier.h> | ||
30 | |||
31 | /* virtio_ring with information needed for host access. */ | ||
32 | struct vringh { | ||
33 | /* Guest publishes used event idx (note: we always do). */ | ||
34 | bool event_indices; | ||
35 | |||
36 | /* Can we get away with weak barriers? */ | ||
37 | bool weak_barriers; | ||
38 | |||
39 | /* Last available index we saw (ie. where we're up to). */ | ||
40 | u16 last_avail_idx; | ||
41 | |||
42 | /* Last index we used. */ | ||
43 | u16 last_used_idx; | ||
44 | |||
45 | /* How many descriptors we've completed since last need_notify(). */ | ||
46 | u32 completed; | ||
47 | |||
48 | /* The vring (note: it may contain user pointers!) */ | ||
49 | struct vring vring; | ||
50 | |||
51 | /* The function to call to notify the guest about added buffers */ | ||
52 | void (*notify)(struct vringh *); | ||
53 | }; | ||
54 | |||
55 | /** | ||
56 | * struct vringh_config_ops - ops for creating a host vring from a virtio driver | ||
57 | * @find_vrhs: find the host vrings and instantiate them | ||
58 | * vdev: the virtio_device | ||
59 | * nhvrs: the number of host vrings to find | ||
60 | * hvrs: on success, includes new host vrings | ||
61 | * callbacks: array of driver callbacks, for each host vring | ||
62 | * include a NULL entry for vqs that do not need a callback | ||
63 | * Returns 0 on success or error status | ||
64 | * @del_vrhs: free the host vrings found by find_vrhs(). | ||
65 | */ | ||
66 | struct virtio_device; | ||
67 | typedef void vrh_callback_t(struct virtio_device *, struct vringh *); | ||
68 | struct vringh_config_ops { | ||
69 | int (*find_vrhs)(struct virtio_device *vdev, unsigned nhvrs, | ||
70 | struct vringh *vrhs[], vrh_callback_t *callbacks[]); | ||
71 | void (*del_vrhs)(struct virtio_device *vdev); | ||
72 | }; | ||
73 | |||
74 | /* The memory the vring can access, and what offset to apply. */ | ||
75 | struct vringh_range { | ||
76 | u64 start, end_incl; | ||
77 | u64 offset; | ||
78 | }; | ||
79 | |||
80 | /** | ||
81 | * struct vringh_iov - iovec mangler. | ||
82 | * | ||
83 | * Mangles iovec in place, and restores it. | ||
84 | * Remaining data is iov + i, of used - i elements. | ||
85 | */ | ||
86 | struct vringh_iov { | ||
87 | struct iovec *iov; | ||
88 | size_t consumed; /* Within iov[i] */ | ||
89 | unsigned i, used, max_num; | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * struct vringh_iov - kvec mangler. | ||
94 | * | ||
95 | * Mangles kvec in place, and restores it. | ||
96 | * Remaining data is iov + i, of used - i elements. | ||
97 | */ | ||
98 | struct vringh_kiov { | ||
99 | struct kvec *iov; | ||
100 | size_t consumed; /* Within iov[i] */ | ||
101 | unsigned i, used, max_num; | ||
102 | }; | ||
103 | |||
104 | /* Flag on max_num to indicate we're kmalloced. */ | ||
105 | #define VRINGH_IOV_ALLOCATED 0x8000000 | ||
106 | |||
107 | /* Helpers for userspace vrings. */ | ||
108 | int vringh_init_user(struct vringh *vrh, u32 features, | ||
109 | unsigned int num, bool weak_barriers, | ||
110 | struct vring_desc __user *desc, | ||
111 | struct vring_avail __user *avail, | ||
112 | struct vring_used __user *used); | ||
113 | |||
114 | static inline void vringh_iov_init(struct vringh_iov *iov, | ||
115 | struct iovec *iovec, unsigned num) | ||
116 | { | ||
117 | iov->used = iov->i = 0; | ||
118 | iov->consumed = 0; | ||
119 | iov->max_num = num; | ||
120 | iov->iov = iovec; | ||
121 | } | ||
122 | |||
123 | static inline void vringh_iov_reset(struct vringh_iov *iov) | ||
124 | { | ||
125 | iov->iov[iov->i].iov_len += iov->consumed; | ||
126 | iov->iov[iov->i].iov_base -= iov->consumed; | ||
127 | iov->consumed = 0; | ||
128 | iov->i = 0; | ||
129 | } | ||
130 | |||
131 | static inline void vringh_iov_cleanup(struct vringh_iov *iov) | ||
132 | { | ||
133 | if (iov->max_num & VRINGH_IOV_ALLOCATED) | ||
134 | kfree(iov->iov); | ||
135 | iov->max_num = iov->used = iov->i = iov->consumed = 0; | ||
136 | iov->iov = NULL; | ||
137 | } | ||
138 | |||
139 | /* Convert a descriptor into iovecs. */ | ||
140 | int vringh_getdesc_user(struct vringh *vrh, | ||
141 | struct vringh_iov *riov, | ||
142 | struct vringh_iov *wiov, | ||
143 | bool (*getrange)(struct vringh *vrh, | ||
144 | u64 addr, struct vringh_range *r), | ||
145 | u16 *head); | ||
146 | |||
147 | /* Copy bytes from readable vsg, consuming it (and incrementing wiov->i). */ | ||
148 | ssize_t vringh_iov_pull_user(struct vringh_iov *riov, void *dst, size_t len); | ||
149 | |||
150 | /* Copy bytes into writable vsg, consuming it (and incrementing wiov->i). */ | ||
151 | ssize_t vringh_iov_push_user(struct vringh_iov *wiov, | ||
152 | const void *src, size_t len); | ||
153 | |||
154 | /* Mark a descriptor as used. */ | ||
155 | int vringh_complete_user(struct vringh *vrh, u16 head, u32 len); | ||
156 | int vringh_complete_multi_user(struct vringh *vrh, | ||
157 | const struct vring_used_elem used[], | ||
158 | unsigned num_used); | ||
159 | |||
160 | /* Pretend we've never seen descriptor (for easy error handling). */ | ||
161 | void vringh_abandon_user(struct vringh *vrh, unsigned int num); | ||
162 | |||
163 | /* Do we need to fire the eventfd to notify the other side? */ | ||
164 | int vringh_need_notify_user(struct vringh *vrh); | ||
165 | |||
166 | bool vringh_notify_enable_user(struct vringh *vrh); | ||
167 | void vringh_notify_disable_user(struct vringh *vrh); | ||
168 | |||
169 | /* Helpers for kernelspace vrings. */ | ||
170 | int vringh_init_kern(struct vringh *vrh, u32 features, | ||
171 | unsigned int num, bool weak_barriers, | ||
172 | struct vring_desc *desc, | ||
173 | struct vring_avail *avail, | ||
174 | struct vring_used *used); | ||
175 | |||
176 | static inline void vringh_kiov_init(struct vringh_kiov *kiov, | ||
177 | struct kvec *kvec, unsigned num) | ||
178 | { | ||
179 | kiov->used = kiov->i = 0; | ||
180 | kiov->consumed = 0; | ||
181 | kiov->max_num = num; | ||
182 | kiov->iov = kvec; | ||
183 | } | ||
184 | |||
185 | static inline void vringh_kiov_reset(struct vringh_kiov *kiov) | ||
186 | { | ||
187 | kiov->iov[kiov->i].iov_len += kiov->consumed; | ||
188 | kiov->iov[kiov->i].iov_base -= kiov->consumed; | ||
189 | kiov->consumed = 0; | ||
190 | kiov->i = 0; | ||
191 | } | ||
192 | |||
193 | static inline void vringh_kiov_cleanup(struct vringh_kiov *kiov) | ||
194 | { | ||
195 | if (kiov->max_num & VRINGH_IOV_ALLOCATED) | ||
196 | kfree(kiov->iov); | ||
197 | kiov->max_num = kiov->used = kiov->i = kiov->consumed = 0; | ||
198 | kiov->iov = NULL; | ||
199 | } | ||
200 | |||
201 | int vringh_getdesc_kern(struct vringh *vrh, | ||
202 | struct vringh_kiov *riov, | ||
203 | struct vringh_kiov *wiov, | ||
204 | u16 *head, | ||
205 | gfp_t gfp); | ||
206 | |||
207 | ssize_t vringh_iov_pull_kern(struct vringh_kiov *riov, void *dst, size_t len); | ||
208 | ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov, | ||
209 | const void *src, size_t len); | ||
210 | void vringh_abandon_kern(struct vringh *vrh, unsigned int num); | ||
211 | int vringh_complete_kern(struct vringh *vrh, u16 head, u32 len); | ||
212 | |||
213 | bool vringh_notify_enable_kern(struct vringh *vrh); | ||
214 | void vringh_notify_disable_kern(struct vringh *vrh); | ||
215 | |||
216 | int vringh_need_notify_kern(struct vringh *vrh); | ||
217 | |||
218 | /* Notify the guest about buffers added to the used ring */ | ||
219 | static inline void vringh_notify(struct vringh *vrh) | ||
220 | { | ||
221 | if (vrh->notify) | ||
222 | vrh->notify(vrh); | ||
223 | } | ||
224 | |||
225 | #endif /* _LINUX_VRINGH_H */ | ||
diff --git a/include/linux/wait.h b/include/linux/wait.h index 7cb64d4b499d..ac38be2692d8 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -330,6 +330,92 @@ do { \ | |||
330 | __ret; \ | 330 | __ret; \ |
331 | }) | 331 | }) |
332 | 332 | ||
333 | #define __wait_event_hrtimeout(wq, condition, timeout, state) \ | ||
334 | ({ \ | ||
335 | int __ret = 0; \ | ||
336 | DEFINE_WAIT(__wait); \ | ||
337 | struct hrtimer_sleeper __t; \ | ||
338 | \ | ||
339 | hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \ | ||
340 | HRTIMER_MODE_REL); \ | ||
341 | hrtimer_init_sleeper(&__t, current); \ | ||
342 | if ((timeout).tv64 != KTIME_MAX) \ | ||
343 | hrtimer_start_range_ns(&__t.timer, timeout, \ | ||
344 | current->timer_slack_ns, \ | ||
345 | HRTIMER_MODE_REL); \ | ||
346 | \ | ||
347 | for (;;) { \ | ||
348 | prepare_to_wait(&wq, &__wait, state); \ | ||
349 | if (condition) \ | ||
350 | break; \ | ||
351 | if (state == TASK_INTERRUPTIBLE && \ | ||
352 | signal_pending(current)) { \ | ||
353 | __ret = -ERESTARTSYS; \ | ||
354 | break; \ | ||
355 | } \ | ||
356 | if (!__t.task) { \ | ||
357 | __ret = -ETIME; \ | ||
358 | break; \ | ||
359 | } \ | ||
360 | schedule(); \ | ||
361 | } \ | ||
362 | \ | ||
363 | hrtimer_cancel(&__t.timer); \ | ||
364 | destroy_hrtimer_on_stack(&__t.timer); \ | ||
365 | finish_wait(&wq, &__wait); \ | ||
366 | __ret; \ | ||
367 | }) | ||
368 | |||
369 | /** | ||
370 | * wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses | ||
371 | * @wq: the waitqueue to wait on | ||
372 | * @condition: a C expression for the event to wait for | ||
373 | * @timeout: timeout, as a ktime_t | ||
374 | * | ||
375 | * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the | ||
376 | * @condition evaluates to true or a signal is received. | ||
377 | * The @condition is checked each time the waitqueue @wq is woken up. | ||
378 | * | ||
379 | * wake_up() has to be called after changing any variable that could | ||
380 | * change the result of the wait condition. | ||
381 | * | ||
382 | * The function returns 0 if @condition became true, or -ETIME if the timeout | ||
383 | * elapsed. | ||
384 | */ | ||
385 | #define wait_event_hrtimeout(wq, condition, timeout) \ | ||
386 | ({ \ | ||
387 | int __ret = 0; \ | ||
388 | if (!(condition)) \ | ||
389 | __ret = __wait_event_hrtimeout(wq, condition, timeout, \ | ||
390 | TASK_UNINTERRUPTIBLE); \ | ||
391 | __ret; \ | ||
392 | }) | ||
393 | |||
394 | /** | ||
395 | * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses | ||
396 | * @wq: the waitqueue to wait on | ||
397 | * @condition: a C expression for the event to wait for | ||
398 | * @timeout: timeout, as a ktime_t | ||
399 | * | ||
400 | * The process is put to sleep (TASK_INTERRUPTIBLE) until the | ||
401 | * @condition evaluates to true or a signal is received. | ||
402 | * The @condition is checked each time the waitqueue @wq is woken up. | ||
403 | * | ||
404 | * wake_up() has to be called after changing any variable that could | ||
405 | * change the result of the wait condition. | ||
406 | * | ||
407 | * The function returns 0 if @condition became true, -ERESTARTSYS if it was | ||
408 | * interrupted by a signal, or -ETIME if the timeout elapsed. | ||
409 | */ | ||
410 | #define wait_event_interruptible_hrtimeout(wq, condition, timeout) \ | ||
411 | ({ \ | ||
412 | long __ret = 0; \ | ||
413 | if (!(condition)) \ | ||
414 | __ret = __wait_event_hrtimeout(wq, condition, timeout, \ | ||
415 | TASK_INTERRUPTIBLE); \ | ||
416 | __ret; \ | ||
417 | }) | ||
418 | |||
333 | #define __wait_event_interruptible_exclusive(wq, condition, ret) \ | 419 | #define __wait_event_interruptible_exclusive(wq, condition, ret) \ |
334 | do { \ | 420 | do { \ |
335 | DEFINE_WAIT(__wait); \ | 421 | DEFINE_WAIT(__wait); \ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 8afab27cdbc2..623488fdc1f5 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/lockdep.h> | 11 | #include <linux/lockdep.h> |
12 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
13 | #include <linux/atomic.h> | 13 | #include <linux/atomic.h> |
14 | #include <linux/cpumask.h> | ||
14 | 15 | ||
15 | struct workqueue_struct; | 16 | struct workqueue_struct; |
16 | 17 | ||
@@ -68,7 +69,7 @@ enum { | |||
68 | WORK_STRUCT_COLOR_BITS, | 69 | WORK_STRUCT_COLOR_BITS, |
69 | 70 | ||
70 | /* data contains off-queue information when !WORK_STRUCT_PWQ */ | 71 | /* data contains off-queue information when !WORK_STRUCT_PWQ */ |
71 | WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS, | 72 | WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT, |
72 | 73 | ||
73 | WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), | 74 | WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), |
74 | 75 | ||
@@ -91,6 +92,9 @@ enum { | |||
91 | /* bit mask for work_busy() return values */ | 92 | /* bit mask for work_busy() return values */ |
92 | WORK_BUSY_PENDING = 1 << 0, | 93 | WORK_BUSY_PENDING = 1 << 0, |
93 | WORK_BUSY_RUNNING = 1 << 1, | 94 | WORK_BUSY_RUNNING = 1 << 1, |
95 | |||
96 | /* maximum string length for set_worker_desc() */ | ||
97 | WORKER_DESC_LEN = 24, | ||
94 | }; | 98 | }; |
95 | 99 | ||
96 | struct work_struct { | 100 | struct work_struct { |
@@ -115,6 +119,20 @@ struct delayed_work { | |||
115 | int cpu; | 119 | int cpu; |
116 | }; | 120 | }; |
117 | 121 | ||
122 | /* | ||
123 | * A struct for workqueue attributes. This can be used to change | ||
124 | * attributes of an unbound workqueue. | ||
125 | * | ||
126 | * Unlike other fields, ->no_numa isn't a property of a worker_pool. It | ||
127 | * only modifies how apply_workqueue_attrs() select pools and thus doesn't | ||
128 | * participate in pool hash calculations or equality comparisons. | ||
129 | */ | ||
130 | struct workqueue_attrs { | ||
131 | int nice; /* nice level */ | ||
132 | cpumask_var_t cpumask; /* allowed CPUs */ | ||
133 | bool no_numa; /* disable NUMA affinity */ | ||
134 | }; | ||
135 | |||
118 | static inline struct delayed_work *to_delayed_work(struct work_struct *work) | 136 | static inline struct delayed_work *to_delayed_work(struct work_struct *work) |
119 | { | 137 | { |
120 | return container_of(work, struct delayed_work, work); | 138 | return container_of(work, struct delayed_work, work); |
@@ -283,9 +301,10 @@ enum { | |||
283 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ | 301 | WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ |
284 | WQ_HIGHPRI = 1 << 4, /* high priority */ | 302 | WQ_HIGHPRI = 1 << 4, /* high priority */ |
285 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ | 303 | WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ |
304 | WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ | ||
286 | 305 | ||
287 | WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */ | 306 | __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ |
288 | WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */ | 307 | __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ |
289 | 308 | ||
290 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ | 309 | WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ |
291 | WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ | 310 | WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ |
@@ -388,7 +407,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | |||
388 | * Pointer to the allocated workqueue on success, %NULL on failure. | 407 | * Pointer to the allocated workqueue on success, %NULL on failure. |
389 | */ | 408 | */ |
390 | #define alloc_ordered_workqueue(fmt, flags, args...) \ | 409 | #define alloc_ordered_workqueue(fmt, flags, args...) \ |
391 | alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args) | 410 | alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) |
392 | 411 | ||
393 | #define create_workqueue(name) \ | 412 | #define create_workqueue(name) \ |
394 | alloc_workqueue((name), WQ_MEM_RECLAIM, 1) | 413 | alloc_workqueue((name), WQ_MEM_RECLAIM, 1) |
@@ -399,30 +418,23 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | |||
399 | 418 | ||
400 | extern void destroy_workqueue(struct workqueue_struct *wq); | 419 | extern void destroy_workqueue(struct workqueue_struct *wq); |
401 | 420 | ||
421 | struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); | ||
422 | void free_workqueue_attrs(struct workqueue_attrs *attrs); | ||
423 | int apply_workqueue_attrs(struct workqueue_struct *wq, | ||
424 | const struct workqueue_attrs *attrs); | ||
425 | |||
402 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, | 426 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, |
403 | struct work_struct *work); | 427 | struct work_struct *work); |
404 | extern bool queue_work(struct workqueue_struct *wq, struct work_struct *work); | ||
405 | extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | 428 | extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, |
406 | struct delayed_work *work, unsigned long delay); | 429 | struct delayed_work *work, unsigned long delay); |
407 | extern bool queue_delayed_work(struct workqueue_struct *wq, | ||
408 | struct delayed_work *work, unsigned long delay); | ||
409 | extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, | 430 | extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, |
410 | struct delayed_work *dwork, unsigned long delay); | 431 | struct delayed_work *dwork, unsigned long delay); |
411 | extern bool mod_delayed_work(struct workqueue_struct *wq, | ||
412 | struct delayed_work *dwork, unsigned long delay); | ||
413 | 432 | ||
414 | extern void flush_workqueue(struct workqueue_struct *wq); | 433 | extern void flush_workqueue(struct workqueue_struct *wq); |
415 | extern void drain_workqueue(struct workqueue_struct *wq); | 434 | extern void drain_workqueue(struct workqueue_struct *wq); |
416 | extern void flush_scheduled_work(void); | 435 | extern void flush_scheduled_work(void); |
417 | 436 | ||
418 | extern bool schedule_work_on(int cpu, struct work_struct *work); | ||
419 | extern bool schedule_work(struct work_struct *work); | ||
420 | extern bool schedule_delayed_work_on(int cpu, struct delayed_work *work, | ||
421 | unsigned long delay); | ||
422 | extern bool schedule_delayed_work(struct delayed_work *work, | ||
423 | unsigned long delay); | ||
424 | extern int schedule_on_each_cpu(work_func_t func); | 437 | extern int schedule_on_each_cpu(work_func_t func); |
425 | extern int keventd_up(void); | ||
426 | 438 | ||
427 | int execute_in_process_context(work_func_t fn, struct execute_work *); | 439 | int execute_in_process_context(work_func_t fn, struct execute_work *); |
428 | 440 | ||
@@ -435,8 +447,122 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork); | |||
435 | 447 | ||
436 | extern void workqueue_set_max_active(struct workqueue_struct *wq, | 448 | extern void workqueue_set_max_active(struct workqueue_struct *wq, |
437 | int max_active); | 449 | int max_active); |
438 | extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); | 450 | extern bool current_is_workqueue_rescuer(void); |
451 | extern bool workqueue_congested(int cpu, struct workqueue_struct *wq); | ||
439 | extern unsigned int work_busy(struct work_struct *work); | 452 | extern unsigned int work_busy(struct work_struct *work); |
453 | extern __printf(1, 2) void set_worker_desc(const char *fmt, ...); | ||
454 | extern void print_worker_info(const char *log_lvl, struct task_struct *task); | ||
455 | |||
456 | /** | ||
457 | * queue_work - queue work on a workqueue | ||
458 | * @wq: workqueue to use | ||
459 | * @work: work to queue | ||
460 | * | ||
461 | * Returns %false if @work was already on a queue, %true otherwise. | ||
462 | * | ||
463 | * We queue the work to the CPU on which it was submitted, but if the CPU dies | ||
464 | * it can be processed by another CPU. | ||
465 | */ | ||
466 | static inline bool queue_work(struct workqueue_struct *wq, | ||
467 | struct work_struct *work) | ||
468 | { | ||
469 | return queue_work_on(WORK_CPU_UNBOUND, wq, work); | ||
470 | } | ||
471 | |||
472 | /** | ||
473 | * queue_delayed_work - queue work on a workqueue after delay | ||
474 | * @wq: workqueue to use | ||
475 | * @dwork: delayable work to queue | ||
476 | * @delay: number of jiffies to wait before queueing | ||
477 | * | ||
478 | * Equivalent to queue_delayed_work_on() but tries to use the local CPU. | ||
479 | */ | ||
480 | static inline bool queue_delayed_work(struct workqueue_struct *wq, | ||
481 | struct delayed_work *dwork, | ||
482 | unsigned long delay) | ||
483 | { | ||
484 | return queue_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay); | ||
485 | } | ||
486 | |||
487 | /** | ||
488 | * mod_delayed_work - modify delay of or queue a delayed work | ||
489 | * @wq: workqueue to use | ||
490 | * @dwork: work to queue | ||
491 | * @delay: number of jiffies to wait before queueing | ||
492 | * | ||
493 | * mod_delayed_work_on() on local CPU. | ||
494 | */ | ||
495 | static inline bool mod_delayed_work(struct workqueue_struct *wq, | ||
496 | struct delayed_work *dwork, | ||
497 | unsigned long delay) | ||
498 | { | ||
499 | return mod_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay); | ||
500 | } | ||
501 | |||
502 | /** | ||
503 | * schedule_work_on - put work task on a specific cpu | ||
504 | * @cpu: cpu to put the work task on | ||
505 | * @work: job to be done | ||
506 | * | ||
507 | * This puts a job on a specific cpu | ||
508 | */ | ||
509 | static inline bool schedule_work_on(int cpu, struct work_struct *work) | ||
510 | { | ||
511 | return queue_work_on(cpu, system_wq, work); | ||
512 | } | ||
513 | |||
514 | /** | ||
515 | * schedule_work - put work task in global workqueue | ||
516 | * @work: job to be done | ||
517 | * | ||
518 | * Returns %false if @work was already on the kernel-global workqueue and | ||
519 | * %true otherwise. | ||
520 | * | ||
521 | * This puts a job in the kernel-global workqueue if it was not already | ||
522 | * queued and leaves it in the same position on the kernel-global | ||
523 | * workqueue otherwise. | ||
524 | */ | ||
525 | static inline bool schedule_work(struct work_struct *work) | ||
526 | { | ||
527 | return queue_work(system_wq, work); | ||
528 | } | ||
529 | |||
530 | /** | ||
531 | * schedule_delayed_work_on - queue work in global workqueue on CPU after delay | ||
532 | * @cpu: cpu to use | ||
533 | * @dwork: job to be done | ||
534 | * @delay: number of jiffies to wait | ||
535 | * | ||
536 | * After waiting for a given time this puts a job in the kernel-global | ||
537 | * workqueue on the specified CPU. | ||
538 | */ | ||
539 | static inline bool schedule_delayed_work_on(int cpu, struct delayed_work *dwork, | ||
540 | unsigned long delay) | ||
541 | { | ||
542 | return queue_delayed_work_on(cpu, system_wq, dwork, delay); | ||
543 | } | ||
544 | |||
545 | /** | ||
546 | * schedule_delayed_work - put work task in global workqueue after delay | ||
547 | * @dwork: job to be done | ||
548 | * @delay: number of jiffies to wait or 0 for immediate execution | ||
549 | * | ||
550 | * After waiting for a given time this puts a job in the kernel-global | ||
551 | * workqueue. | ||
552 | */ | ||
553 | static inline bool schedule_delayed_work(struct delayed_work *dwork, | ||
554 | unsigned long delay) | ||
555 | { | ||
556 | return queue_delayed_work(system_wq, dwork, delay); | ||
557 | } | ||
558 | |||
559 | /** | ||
560 | * keventd_up - is workqueue initialized yet? | ||
561 | */ | ||
562 | static inline bool keventd_up(void) | ||
563 | { | ||
564 | return system_wq != NULL; | ||
565 | } | ||
440 | 566 | ||
441 | /* | 567 | /* |
442 | * Like above, but uses del_timer() instead of del_timer_sync(). This means, | 568 | * Like above, but uses del_timer() instead of del_timer_sync(). This means, |
@@ -466,12 +592,12 @@ static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwo | |||
466 | } | 592 | } |
467 | 593 | ||
468 | #ifndef CONFIG_SMP | 594 | #ifndef CONFIG_SMP |
469 | static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | 595 | static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg) |
470 | { | 596 | { |
471 | return fn(arg); | 597 | return fn(arg); |
472 | } | 598 | } |
473 | #else | 599 | #else |
474 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); | 600 | long work_on_cpu(int cpu, long (*fn)(void *), void *arg); |
475 | #endif /* CONFIG_SMP */ | 601 | #endif /* CONFIG_SMP */ |
476 | 602 | ||
477 | #ifdef CONFIG_FREEZER | 603 | #ifdef CONFIG_FREEZER |
@@ -480,4 +606,11 @@ extern bool freeze_workqueues_busy(void); | |||
480 | extern void thaw_workqueues(void); | 606 | extern void thaw_workqueues(void); |
481 | #endif /* CONFIG_FREEZER */ | 607 | #endif /* CONFIG_FREEZER */ |
482 | 608 | ||
609 | #ifdef CONFIG_SYSFS | ||
610 | int workqueue_sysfs_register(struct workqueue_struct *wq); | ||
611 | #else /* CONFIG_SYSFS */ | ||
612 | static inline int workqueue_sysfs_register(struct workqueue_struct *wq) | ||
613 | { return 0; } | ||
614 | #endif /* CONFIG_SYSFS */ | ||
615 | |||
483 | #endif | 616 | #endif |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 9a9367c0c076..579a5007c696 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #define WRITEBACK_H | 5 | #define WRITEBACK_H |
6 | 6 | ||
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/workqueue.h> | ||
8 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
9 | 10 | ||
10 | DECLARE_PER_CPU(int, dirty_throttle_leaks); | 11 | DECLARE_PER_CPU(int, dirty_throttle_leaks); |